1 line
9.9 KiB
JSON
1 line
9.9 KiB
JSON
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { useContext } from '@rc-component/context';\nimport TableContext from \"../context/TableContext\";\nimport { getColumnsKey } from \"../utils/valueUtil\";\nimport { useEvent } from 'rc-util';\nimport classNames from 'classnames';\nexport default function useRowInfo(record, rowKey, recordIndex, indent) {\n var context = useContext(TableContext, ['prefixCls', 'fixedInfoList', 'flattenColumns', 'expandableType', 'expandRowByClick', 'onTriggerExpand', 'rowClassName', 'expandedRowClassName', 'indentSize', 'expandIcon', 'expandedRowRender', 'expandIconColumnIndex', 'expandedKeys', 'childrenColumnName', 'rowExpandable', 'onRow']);\n var flattenColumns = context.flattenColumns,\n expandableType = context.expandableType,\n expandedKeys = context.expandedKeys,\n childrenColumnName = context.childrenColumnName,\n onTriggerExpand = context.onTriggerExpand,\n rowExpandable = context.rowExpandable,\n onRow = context.onRow,\n expandRowByClick = context.expandRowByClick,\n rowClassName = context.rowClassName;\n\n // ======================= Expandable =======================\n // Only when row is not expandable and `children` exist in record\n var nestExpandable = expandableType === 'nest';\n var rowSupportExpand = expandableType === 'row' && (!rowExpandable || rowExpandable(record));\n var mergedExpandable = rowSupportExpand || nestExpandable;\n var expanded = expandedKeys && expandedKeys.has(rowKey);\n var hasNestChildren = childrenColumnName && record && record[childrenColumnName];\n var onInternalTriggerExpand = useEvent(onTriggerExpand);\n\n // ========================= onRow ==========================\n var rowProps = onRow === null || onRow === void 0 ? void 0 : onRow(record, recordIndex);\n var onRowClick = rowProps === null || rowProps === void 0 ? void 0 : rowProps.onClick;\n var onClick = function onClick(event) {\n if (expandRowByClick && mergedExpandable) {\n onTriggerExpand(record, event);\n }\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n onRowClick === null || onRowClick === void 0 || onRowClick.apply(void 0, [event].concat(args));\n };\n\n // ====================== RowClassName ======================\n var computeRowClassName;\n if (typeof rowClassName === 'string') {\n computeRowClassName = rowClassName;\n } else if (typeof rowClassName === 'function') {\n computeRowClassName = rowClassName(record, recordIndex, indent);\n }\n\n // ========================= Column =========================\n var columnsKey = getColumnsKey(flattenColumns);\n return _objectSpread(_objectSpread({}, context), {}, {\n columnsKey: columnsKey,\n nestExpandable: nestExpandable,\n expanded: expanded,\n hasNestChildren: hasNestChildren,\n record: record,\n onTriggerExpand: onInternalTriggerExpand,\n rowSupportExpand: rowSupportExpand,\n expandable: mergedExpandable,\n rowProps: _objectSpread(_objectSpread({}, rowProps), {}, {\n className: classNames(computeRowClassName, rowProps === null || rowProps === void 0 ? void 0 : rowProps.className),\n onClick: onClick\n })\n });\n}","map":{"version":3,"names":["_objectSpread","useContext","TableContext","getColumnsKey","useEvent","classNames","useRowInfo","record","rowKey","recordIndex","indent","context","flattenColumns","expandableType","expandedKeys","childrenColumnName","onTriggerExpand","rowExpandable","onRow","expandRowByClick","rowClassName","nestExpandable","rowSupportExpand","mergedExpandable","expanded","has","hasNestChildren","onInternalTriggerExpand","rowProps","onRowClick","onClick","event","_len","arguments","length","args","Array","_key","apply","concat","computeRowClassName","columnsKey","expandable","className"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-table/es/hooks/useRowInfo.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { useContext } from '@rc-component/context';\nimport TableContext from \"../context/TableContext\";\nimport { getColumnsKey } from \"../utils/valueUtil\";\nimport { useEvent } from 'rc-util';\nimport classNames from 'classnames';\nexport default function useRowInfo(record, rowKey, recordIndex, indent) {\n var context = useContext(TableContext, ['prefixCls', 'fixedInfoList', 'flattenColumns', 'expandableType', 'expandRowByClick', 'onTriggerExpand', 'rowClassName', 'expandedRowClassName', 'indentSize', 'expandIcon', 'expandedRowRender', 'expandIconColumnIndex', 'expandedKeys', 'childrenColumnName', 'rowExpandable', 'onRow']);\n var flattenColumns = context.flattenColumns,\n expandableType = context.expandableType,\n expandedKeys = context.expandedKeys,\n childrenColumnName = context.childrenColumnName,\n onTriggerExpand = context.onTriggerExpand,\n rowExpandable = context.rowExpandable,\n onRow = context.onRow,\n expandRowByClick = context.expandRowByClick,\n rowClassName = context.rowClassName;\n\n // ======================= Expandable =======================\n // Only when row is not expandable and `children` exist in record\n var nestExpandable = expandableType === 'nest';\n var rowSupportExpand = expandableType === 'row' && (!rowExpandable || rowExpandable(record));\n var mergedExpandable = rowSupportExpand || nestExpandable;\n var expanded = expandedKeys && expandedKeys.has(rowKey);\n var hasNestChildren = childrenColumnName && record && record[childrenColumnName];\n var onInternalTriggerExpand = useEvent(onTriggerExpand);\n\n // ========================= onRow ==========================\n var rowProps = onRow === null || onRow === void 0 ? void 0 : onRow(record, recordIndex);\n var onRowClick = rowProps === null || rowProps === void 0 ? void 0 : rowProps.onClick;\n var onClick = function onClick(event) {\n if (expandRowByClick && mergedExpandable) {\n onTriggerExpand(record, event);\n }\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n onRowClick === null || onRowClick === void 0 || onRowClick.apply(void 0, [event].concat(args));\n };\n\n // ====================== RowClassName ======================\n var computeRowClassName;\n if (typeof rowClassName === 'string') {\n computeRowClassName = rowClassName;\n } else if (typeof rowClassName === 'function') {\n computeRowClassName = rowClassName(record, recordIndex, indent);\n }\n\n // ========================= Column =========================\n var columnsKey = getColumnsKey(flattenColumns);\n return _objectSpread(_objectSpread({}, context), {}, {\n columnsKey: columnsKey,\n nestExpandable: nestExpandable,\n expanded: expanded,\n hasNestChildren: hasNestChildren,\n record: record,\n onTriggerExpand: onInternalTriggerExpand,\n rowSupportExpand: rowSupportExpand,\n expandable: mergedExpandable,\n rowProps: _objectSpread(_objectSpread({}, rowProps), {}, {\n className: classNames(computeRowClassName, rowProps === null || rowProps === void 0 ? void 0 : rowProps.className),\n onClick: onClick\n })\n });\n}"],"mappings":"AAAA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