1 line
3.7 KiB
JSON
1 line
3.7 KiB
JSON
{"ast":null,"code":"import * as React from 'react';\nimport { groupKeysMap } from '../../_util/transKeys';\nconst useData = (dataSource, rowKey, targetKeys) => {\n const mergedDataSource = React.useMemo(() => (dataSource || []).map(record => {\n if (rowKey) {\n return Object.assign(Object.assign({}, record), {\n key: rowKey(record)\n });\n }\n return record;\n }), [dataSource, rowKey]);\n const [leftDataSource, rightDataSource] = React.useMemo(() => {\n const leftData = [];\n const rightData = new Array((targetKeys || []).length);\n const targetKeysMap = groupKeysMap(targetKeys || []);\n mergedDataSource.forEach(record => {\n // rightData should be ordered by targetKeys\n // leftData should be ordered by dataSource\n if (targetKeysMap.has(record.key)) {\n rightData[targetKeysMap.get(record.key)] = record;\n } else {\n leftData.push(record);\n }\n });\n return [leftData, rightData];\n }, [mergedDataSource, targetKeys, rowKey]);\n return [mergedDataSource, leftDataSource, rightDataSource];\n};\nexport default useData;","map":{"version":3,"names":["React","groupKeysMap","useData","dataSource","rowKey","targetKeys","mergedDataSource","useMemo","map","record","Object","assign","key","leftDataSource","rightDataSource","leftData","rightData","Array","length","targetKeysMap","forEach","has","get","push"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/transfer/hooks/useData.js"],"sourcesContent":["import * as React from 'react';\nimport { groupKeysMap } from '../../_util/transKeys';\nconst useData = (dataSource, rowKey, targetKeys) => {\n const mergedDataSource = React.useMemo(() => (dataSource || []).map(record => {\n if (rowKey) {\n return Object.assign(Object.assign({}, record), {\n key: rowKey(record)\n });\n }\n return record;\n }), [dataSource, rowKey]);\n const [leftDataSource, rightDataSource] = React.useMemo(() => {\n const leftData = [];\n const rightData = new Array((targetKeys || []).length);\n const targetKeysMap = groupKeysMap(targetKeys || []);\n mergedDataSource.forEach(record => {\n // rightData should be ordered by targetKeys\n // leftData should be ordered by dataSource\n if (targetKeysMap.has(record.key)) {\n rightData[targetKeysMap.get(record.key)] = record;\n } else {\n leftData.push(record);\n }\n });\n return [leftData, rightData];\n }, [mergedDataSource, targetKeys, rowKey]);\n return [mergedDataSource, leftDataSource, rightDataSource];\n};\nexport default useData;"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,QAAQ,uBAAuB;AACpD,MAAMC,OAAO,GAAGA,CAACC,UAAU,EAAEC,MAAM,EAAEC,UAAU,KAAK;EAClD,MAAMC,gBAAgB,GAAGN,KAAK,CAACO,OAAO,CAAC,MAAM,CAACJ,UAAU,IAAI,EAAE,EAAEK,GAAG,CAACC,MAAM,IAAI;IAC5E,IAAIL,MAAM,EAAE;MACV,OAAOM,MAAM,CAACC,MAAM,CAACD,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEF,MAAM,CAAC,EAAE;QAC9CG,GAAG,EAAER,MAAM,CAACK,MAAM;MACpB,CAAC,CAAC;IACJ;IACA,OAAOA,MAAM;EACf,CAAC,CAAC,EAAE,CAACN,UAAU,EAAEC,MAAM,CAAC,CAAC;EACzB,MAAM,CAACS,cAAc,EAAEC,eAAe,CAAC,GAAGd,KAAK,CAACO,OAAO,CAAC,MAAM;IAC5D,MAAMQ,QAAQ,GAAG,EAAE;IACnB,MAAMC,SAAS,GAAG,IAAIC,KAAK,CAAC,CAACZ,UAAU,IAAI,EAAE,EAAEa,MAAM,CAAC;IACtD,MAAMC,aAAa,GAAGlB,YAAY,CAACI,UAAU,IAAI,EAAE,CAAC;IACpDC,gBAAgB,CAACc,OAAO,CAACX,MAAM,IAAI;MACjC;MACA;MACA,IAAIU,aAAa,CAACE,GAAG,CAACZ,MAAM,CAACG,GAAG,CAAC,EAAE;QACjCI,SAAS,CAACG,aAAa,CAACG,GAAG,CAACb,MAAM,CAACG,GAAG,CAAC,CAAC,GAAGH,MAAM;MACnD,CAAC,MAAM;QACLM,QAAQ,CAACQ,IAAI,CAACd,MAAM,CAAC;MACvB;IACF,CAAC,CAAC;IACF,OAAO,CAACM,QAAQ,EAAEC,SAAS,CAAC;EAC9B,CAAC,EAAE,CAACV,gBAAgB,EAAED,UAAU,EAAED,MAAM,CAAC,CAAC;EAC1C,OAAO,CAACE,gBAAgB,EAAEO,cAAc,EAAEC,eAAe,CAAC;AAC5D,CAAC;AACD,eAAeZ,OAAO","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |