70bedac8c2e5dfdfa8500f5b68f70027.json
6.62 KB
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar INTERNAL_KEY_PREFIX = 'RC_TABLE_KEY';\n\nfunction toArray(arr) {\n if (arr === undefined || arr === null) {\n return [];\n }\n\n return Array.isArray(arr) ? arr : [arr];\n}\n\nexport function getPathValue(record, path) {\n // Skip if path is empty\n if (!path && typeof path !== 'number') {\n return record;\n }\n\n var pathList = toArray(path);\n var current = record;\n\n for (var i = 0; i < pathList.length; i += 1) {\n if (!current) {\n return null;\n }\n\n var prop = pathList[i];\n current = current[prop];\n }\n\n return current;\n}\nexport function getColumnsKey(columns) {\n var columnKeys = [];\n var keys = {};\n columns.forEach(function (column) {\n var _ref = column || {},\n key = _ref.key,\n dataIndex = _ref.dataIndex;\n\n var mergedKey = key || toArray(dataIndex).join('-') || INTERNAL_KEY_PREFIX;\n\n while (keys[mergedKey]) {\n mergedKey = \"\".concat(mergedKey, \"_next\");\n }\n\n keys[mergedKey] = true;\n columnKeys.push(mergedKey);\n });\n return columnKeys;\n}\nexport function mergeObject() {\n var merged = {};\n /* eslint-disable no-param-reassign */\n\n function fillProps(obj, clone) {\n if (clone) {\n Object.keys(clone).forEach(function (key) {\n var value = clone[key];\n\n if (value && _typeof(value) === 'object') {\n obj[key] = obj[key] || {};\n fillProps(obj[key], value);\n } else {\n obj[key] = value;\n }\n });\n }\n }\n /* eslint-enable */\n\n\n for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {\n objects[_key] = arguments[_key];\n }\n\n objects.forEach(function (clone) {\n fillProps(merged, clone);\n });\n return merged;\n}\nexport function validateValue(val) {\n return val !== null && val !== undefined;\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-table/es/utils/valueUtil.js"],"names":["_typeof","INTERNAL_KEY_PREFIX","toArray","arr","undefined","Array","isArray","getPathValue","record","path","pathList","current","i","length","prop","getColumnsKey","columns","columnKeys","keys","forEach","column","_ref","key","dataIndex","mergedKey","join","concat","push","mergeObject","merged","fillProps","obj","clone","Object","value","_len","arguments","objects","_key","validateValue","val"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,mCAApB;AACA,IAAIC,mBAAmB,GAAG,cAA1B;;AAEA,SAASC,OAAT,CAAiBC,GAAjB,EAAsB;AACpB,MAAIA,GAAG,KAAKC,SAAR,IAAqBD,GAAG,KAAK,IAAjC,EAAuC;AACrC,WAAO,EAAP;AACD;;AAED,SAAOE,KAAK,CAACC,OAAN,CAAcH,GAAd,IAAqBA,GAArB,GAA2B,CAACA,GAAD,CAAlC;AACD;;AAED,OAAO,SAASI,YAAT,CAAsBC,MAAtB,EAA8BC,IAA9B,EAAoC;AACzC;AACA,MAAI,CAACA,IAAD,IAAS,OAAOA,IAAP,KAAgB,QAA7B,EAAuC;AACrC,WAAOD,MAAP;AACD;;AAED,MAAIE,QAAQ,GAAGR,OAAO,CAACO,IAAD,CAAtB;AACA,MAAIE,OAAO,GAAGH,MAAd;;AAEA,OAAK,IAAII,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,QAAQ,CAACG,MAA7B,EAAqCD,CAAC,IAAI,CAA1C,EAA6C;AAC3C,QAAI,CAACD,OAAL,EAAc;AACZ,aAAO,IAAP;AACD;;AAED,QAAIG,IAAI,GAAGJ,QAAQ,CAACE,CAAD,CAAnB;AACAD,IAAAA,OAAO,GAAGA,OAAO,CAACG,IAAD,CAAjB;AACD;;AAED,SAAOH,OAAP;AACD;AACD,OAAO,SAASI,aAAT,CAAuBC,OAAvB,EAAgC;AACrC,MAAIC,UAAU,GAAG,EAAjB;AACA,MAAIC,IAAI,GAAG,EAAX;AACAF,EAAAA,OAAO,CAACG,OAAR,CAAgB,UAAUC,MAAV,EAAkB;AAChC,QAAIC,IAAI,GAAGD,MAAM,IAAI,EAArB;AAAA,QACIE,GAAG,GAAGD,IAAI,CAACC,GADf;AAAA,QAEIC,SAAS,GAAGF,IAAI,CAACE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AACC,IAAD,CAAP,GAAgBF,SAAS,CAACE,IAAD,CAAzB;AACD;;AAEDD,EAAAA,OAAO,CAAClB,OAAR,CAAgB,UAAUa,KAAV,EAAiB;AAC/BF,IAAAA,SAAS,CAACD,MAAD,EAASG,KAAT,CAAT;AACD,GAFD;AAGA,SAAOH,MAAP;AACD;AACD,OAAO,SAASU,aAAT,CAAuBC,GAAvB,EAA4B;AACjC,SAAOA,GAAG,KAAK,IAAR,IAAgBA,GAAG,KAAKpC,SAA/B;AACD","sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nvar INTERNAL_KEY_PREFIX = 'RC_TABLE_KEY';\n\nfunction toArray(arr) {\n if (arr === undefined || arr === null) {\n return [];\n }\n\n return Array.isArray(arr) ? arr : [arr];\n}\n\nexport function getPathValue(record, path) {\n // Skip if path is empty\n if (!path && typeof path !== 'number') {\n return record;\n }\n\n var pathList = toArray(path);\n var current = record;\n\n for (var i = 0; i < pathList.length; i += 1) {\n if (!current) {\n return null;\n }\n\n var prop = pathList[i];\n current = current[prop];\n }\n\n return current;\n}\nexport function getColumnsKey(columns) {\n var columnKeys = [];\n var keys = {};\n columns.forEach(function (column) {\n var _ref = column || {},\n key = _ref.key,\n dataIndex = _ref.dataIndex;\n\n var mergedKey = key || toArray(dataIndex).join('-') || INTERNAL_KEY_PREFIX;\n\n while (keys[mergedKey]) {\n mergedKey = \"\".concat(mergedKey, \"_next\");\n }\n\n keys[mergedKey] = true;\n columnKeys.push(mergedKey);\n });\n return columnKeys;\n}\nexport function mergeObject() {\n var merged = {};\n /* eslint-disable no-param-reassign */\n\n function fillProps(obj, clone) {\n if (clone) {\n Object.keys(clone).forEach(function (key) {\n var value = clone[key];\n\n if (value && _typeof(value) === 'object') {\n obj[key] = obj[key] || {};\n fillProps(obj[key], value);\n } else {\n obj[key] = value;\n }\n });\n }\n }\n /* eslint-enable */\n\n\n for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {\n objects[_key] = arguments[_key];\n }\n\n objects.forEach(function (clone) {\n fillProps(merged, clone);\n });\n return merged;\n}\nexport function validateValue(val) {\n return val !== null && val !== undefined;\n}"]},"metadata":{},"sourceType":"module"}