uiw 5.0.0-bate-9 → 5.0.0-bate-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/uiw.js CHANGED
@@ -17122,17 +17122,17 @@ function TableTr(props) {
17122
17122
  treeData,
17123
17123
  isAutoMergeRowSpan,
17124
17124
  expandIndex,
17125
- setExpandIndex
17125
+ setExpandIndex,
17126
+ onExpand
17126
17127
  } = props;
17127
17128
  var [isOpacity, setIsOpacity] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
17128
17129
  var [childrenIndex, setChildrenIndex] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0);
17129
- // const [expandIndex, setExpandIndex] = useState<Array<T[keyof T] | number>>([]);
17130
17130
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
17131
17131
  setIsOpacity(!!(data != null && data.find(it => it[childrenColumnName])));
17132
17132
  setChildrenIndex((keys == null ? void 0 : keys.findIndex(it => it.key === 'uiw-expanded')) === -1 ? 0 : 1);
17133
17133
  }, [data]);
17134
17134
  var IconDom = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
17135
- return (key, isOpacity) => {
17135
+ return (key, isOpacity, trData, rowNum) => {
17136
17136
  var flag = expandIndex.includes(key);
17137
17137
  var Icon = flag ? lib_MinusSquareO/* MinusSquareO */.d : lib_PlusSquareO/* PlusSquareO */.D;
17138
17138
  return /*#__PURE__*/(0,jsx_runtime.jsx)(TableStyleDomIcon, {
@@ -17144,6 +17144,7 @@ function TableTr(props) {
17144
17144
  marginTop: 3.24
17145
17145
  },
17146
17146
  onClick: () => {
17147
+ onExpand && onExpand(flag, trData, rowNum, hierarchy);
17147
17148
  setExpandIndex(flag ? expandIndex.filter(it => it !== key) : [...expandIndex, key]);
17148
17149
  },
17149
17150
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {})
@@ -17170,7 +17171,6 @@ function TableTr(props) {
17170
17171
  children: keys.map((keyName, colNum) => {
17171
17172
  var isHasChildren = Array.isArray(trData[childrenColumnName]);
17172
17173
  var itemShow = {};
17173
- console.log(isAutoMergeRowSpan, summary);
17174
17174
  if (isAutoMergeRowSpan && summary) {
17175
17175
  var newLaval = Reflect.get(keyName, 'level');
17176
17176
  var summaryCount = summary.summaryCount[newLaval];
@@ -17184,7 +17184,11 @@ function TableTr(props) {
17184
17184
  children: trData[keyName.key]
17185
17185
  };
17186
17186
  if (render[keyName.key]) {
17187
- var child = render[keyName.key](trData[keyName.key], keyName.key, trData, rowNum, colNum, itemShow.rowSpan);
17187
+ var child = render[keyName.key](trData[keyName.key], keyName.key, trData, rowNum, colNum, {
17188
+ level: hierarchy,
17189
+ rowSpan: itemShow.rowSpan,
17190
+ summary
17191
+ });
17188
17192
  if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(child)) {
17189
17193
  objs.children = child;
17190
17194
  } else {
@@ -17207,14 +17211,24 @@ function TableTr(props) {
17207
17211
  } else if ((isOpacity || hierarchy || isHasChildren) && !isAutoExpanded && keyName.isExpanded) {
17208
17212
  isExpanded = true;
17209
17213
  }
17210
- if (isExpanded) {
17211
- objs.children = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
17212
- children: [IconDom(key, isHasChildren), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
17213
- style: {
17214
- paddingLeft: hierarchy * indentSize
17215
- }
17216
- }), objs.children]
17217
- });
17214
+ if (isExpanded || keyName.isExpandedButton) {
17215
+ if (keyName.isExpandedButtonLayout === 'right') {
17216
+ objs.children = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
17217
+ children: [IconDom(key, isHasChildren || !!(keyName != null && keyName.isExpandedButton), trData, rowNum), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
17218
+ style: {
17219
+ paddingLeft: hierarchy * indentSize
17220
+ }
17221
+ }), objs.children]
17222
+ });
17223
+ } else {
17224
+ objs.children = /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
17225
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
17226
+ style: {
17227
+ paddingLeft: hierarchy * indentSize
17228
+ }
17229
+ }), objs.children, IconDom(key, isHasChildren || !!(keyName != null && keyName.isExpandedButton), trData, rowNum)]
17230
+ });
17231
+ }
17218
17232
  }
17219
17233
  if (keyName.fixed) {
17220
17234
  if (keyName.fixed === 'right') {
@@ -17481,7 +17495,7 @@ function esm_Table(props) {
17481
17495
  render,
17482
17496
  ellipsis
17483
17497
  } = getLevelItems(self.selfColumns);
17484
- var treeData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => isAutoMergeRowSpan && new NodeTreeData(data, rowKey, (expandable == null ? void 0 : expandable.childrenColumnName) || 'children') || undefined, [data, rowKey, expandable == null ? void 0 : expandable.childrenColumnName, isAutoMergeRowSpan]);
17498
+ var treeData = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => new NodeTreeData(data, rowKey, (expandable == null ? void 0 : expandable.childrenColumnName) || 'children'), [data, rowKey, expandable == null ? void 0 : expandable.childrenColumnName, isAutoMergeRowSpan]);
17485
17499
  return /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
17486
17500
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)(TableStyleWrap, extends_extends({
17487
17501
  className: cls
@@ -17514,6 +17528,7 @@ function esm_Table(props) {
17514
17528
  onCell: onCell,
17515
17529
  hierarchy: 0,
17516
17530
  isExpandedDom: isExpandedDom,
17531
+ onExpand: expandable == null ? void 0 : expandable.onExpand,
17517
17532
  indentSize: typeof (expandable == null ? void 0 : expandable.indentSize) === 'number' ? expandable == null ? void 0 : expandable.indentSize : 16,
17518
17533
  childrenColumnName: (expandable == null ? void 0 : expandable.childrenColumnName) || 'children',
17519
17534
  isAutoExpanded: expandable == null ? void 0 : expandable.isAutoExpanded,