ztxkui 4.2.23-2 → 4.2.23-21

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.
Files changed (86) hide show
  1. package/dist/DemoCom/PrintContainerDemo.js +223 -70
  2. package/dist/TableDemo/data.js +1 -1
  3. package/dist/UI/Basic/index.d.ts +2 -0
  4. package/dist/UI/Basic/index.js +18 -0
  5. package/dist/UI/Form/index.d.ts +3 -0
  6. package/dist/UI/Form/index.js +187 -0
  7. package/dist/UI/Modal/hooks.d.ts +15 -0
  8. package/dist/UI/Modal/hooks.js +172 -0
  9. package/dist/UI/Modal/index.d.ts +3 -0
  10. package/dist/UI/Modal/index.js +46 -0
  11. package/dist/UI/Table/DefaultTable.d.ts +2 -0
  12. package/dist/UI/Table/DefaultTable.js +49 -0
  13. package/dist/UI/Table/EditTable.d.ts +2 -0
  14. package/dist/UI/Table/EditTable.js +259 -0
  15. package/dist/UI/Table/data.d.ts +10 -0
  16. package/dist/UI/Table/data.js +14 -0
  17. package/dist/UI/Table/index.d.ts +2 -0
  18. package/dist/UI/Table/index.js +5 -0
  19. package/dist/UI/index.d.ts +2 -0
  20. package/dist/UI/index.js +26 -0
  21. package/dist/components/EnhanceSelect/index.js +4 -0
  22. package/dist/components/Input/input.js +38 -13
  23. package/dist/components/PrintContainer/print-container.js +70 -30
  24. package/dist/components/ProForm/hooks.d.ts +23 -0
  25. package/dist/components/ProForm/hooks.js +209 -0
  26. package/dist/components/ProForm/index.d.ts +6 -0
  27. package/dist/components/ProForm/index.js +87 -0
  28. package/dist/components/ProForm/interface.d.ts +116 -0
  29. package/dist/components/ProForm/interface.js +1 -0
  30. package/dist/components/ProForm/items.d.ts +5 -0
  31. package/dist/components/ProForm/items.js +136 -0
  32. package/dist/components/ProForm/search-drawer.d.ts +11 -0
  33. package/dist/components/ProForm/search-drawer.js +76 -0
  34. package/dist/components/ProForm/setting.d.ts +5 -0
  35. package/dist/components/ProForm/setting.js +13 -0
  36. package/dist/components/ProFormList/index.d.ts +12 -0
  37. package/dist/components/ProFormList/index.js +34 -0
  38. package/dist/components/ProModal/ModalForm.d.ts +8 -0
  39. package/dist/components/ProModal/ModalForm.js +32 -0
  40. package/dist/components/ProModal/ModalTable.d.ts +8 -0
  41. package/dist/components/ProModal/ModalTable.js +32 -0
  42. package/dist/components/ProModal/hooks.d.ts +33 -0
  43. package/dist/components/ProModal/hooks.js +193 -0
  44. package/dist/components/ProModal/index.d.ts +17 -0
  45. package/dist/components/ProModal/index.js +80 -0
  46. package/dist/components/ProModal/interface.d.ts +47 -0
  47. package/dist/components/ProModal/interface.js +1 -0
  48. package/dist/components/ProTable/hooks.d.ts +28 -0
  49. package/dist/components/ProTable/hooks.js +272 -0
  50. package/dist/components/ProTable/index.d.ts +8 -0
  51. package/dist/components/ProTable/index.js +76 -0
  52. package/dist/components/ProTable/interface.d.ts +51 -0
  53. package/dist/components/ProTable/interface.js +1 -0
  54. package/dist/components/Table/hooks/useColumns.d.ts +4 -4
  55. package/dist/components/Table/hooks/useColumns.js +227 -169
  56. package/dist/components/Table/hooks/useInnerPagination.js +1 -0
  57. package/dist/components/Table/table-adddel-column.d.ts +2 -1
  58. package/dist/components/Table/table-adddel-column.js +5 -3
  59. package/dist/components/Table/table-enhance-cell.d.ts +6 -3
  60. package/dist/components/Table/table-enhance-cell.js +119 -110
  61. package/dist/components/Table/table-enhance-row.d.ts +3 -4
  62. package/dist/components/Table/table-enhance-row.js +6 -10
  63. package/dist/components/Table/table-resizable-title.d.ts +4 -5
  64. package/dist/components/Table/table-resizable-title.js +31 -6
  65. package/dist/components/Table/table.d.ts +2 -0
  66. package/dist/components/Table/table.js +154 -150
  67. package/dist/components/Table/utils/shallowEqual.d.ts +2 -0
  68. package/dist/components/Table/utils/shallowEqual.js +34 -0
  69. package/dist/components/Table/utils/validate.js +0 -3
  70. package/dist/components/Tabs/DraggableTabNode.d.ts +7 -0
  71. package/dist/components/Tabs/DraggableTabNode.js +33 -0
  72. package/dist/components/Tabs/hooks.d.ts +3 -0
  73. package/dist/components/Tabs/hooks.js +59 -0
  74. package/dist/components/Tabs/tabs.d.ts +3 -0
  75. package/dist/components/Tabs/tabs.js +8 -2
  76. package/dist/components/business/Footer/index.d.ts +1 -0
  77. package/dist/components/business/Footer/index.js +18 -4
  78. package/dist/components/business/Signatures/components/QunjSeal.js +3 -2
  79. package/dist/components/business/Signatures/index.js +13 -14
  80. package/dist/constants.d.ts +1 -1
  81. package/dist/constants.js +1 -1
  82. package/dist/index.css +327 -0
  83. package/dist/index.css.map +1 -1
  84. package/dist/index.d.ts +4 -0
  85. package/dist/index.js +9 -1
  86. package/package.json +4 -4
@@ -56,9 +56,10 @@ var __rest = (this && this.__rest) || function (s, e) {
56
56
  }
57
57
  return t;
58
58
  };
59
- import React, { useContext, useEffect, memo, useRef } from 'react';
60
- import { EditableContext } from './table-enhance-row';
61
- import { Form, Input, InputNumber, Select, message } from '../../index';
59
+ import React, { useEffect, memo, useRef, useCallback, useMemo, useState, } from 'react';
60
+ // import { EditableContext } from './table-enhance-row';
61
+ import { InputNumber, Select, message } from '../../index';
62
+ import { Input } from 'antd';
62
63
  import { ERROR_TD_CLASSNAME } from './index';
63
64
  import { getInnerIndex } from './hooks/useInnerPagination';
64
65
  import { exactRound } from 'ztxkutils/dist/tools';
@@ -85,74 +86,66 @@ function transformData(data, config) {
85
86
  }
86
87
  return newData;
87
88
  }
88
- var TableEnhanceCell = memo(function (_a) {
89
- var title = _a.title, index = _a.index, editable = _a.editable, editableConfig = _a.editableConfig, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, onTableChange = _a.onTableChange, columns = _a.columns, currentpage = _a.currentpage, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave", "onTableChange", "columns", "currentpage"]);
90
- var form = useContext(EditableContext);
89
+ var TableEnhanceCell = function (_a) {
90
+ var title = _a.title, index = _a.index, editable = _a.editable, editableConfig = _a.editableConfig, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, onTableChange = _a.onTableChange, columns = _a.columns, currentpage = _a.currentpage, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave", "onTableChange", "columns", "currentpage", "onMouseEnter", "onMouseLeave"]);
91
91
  var tdRef = useRef();
92
+ var valueRef = useRef({});
93
+ var _b = useState(), val = _b[0], setVal = _b[1];
92
94
  useEffect(function () {
93
- var _a;
94
95
  if (dataIndex) {
95
- form === null || form === void 0 ? void 0 : form.setFieldsValue((_a = {}, _a[dataIndex] = record[dataIndex], _a));
96
+ // form?.setFieldsValue({ [dataIndex]: record[dataIndex] });
97
+ // form?.setFieldValue(dataIndex, record[dataIndex]);
98
+ setVal(record[dataIndex]);
99
+ valueRef.current[dataIndex] = record[dataIndex];
96
100
  }
97
- }, [dataIndex, form, record]);
101
+ }, [dataIndex, record]);
98
102
  /**
99
103
  * @description 保存事件
100
104
  */
101
- var save = function (info) { return __awaiter(void 0, void 0, void 0, function () {
102
- var innerIndex, values, result, currentInputNumberValue, result, currentInputNumberValue, err_1;
103
- var _a, _b;
104
- return __generator(this, function (_c) {
105
- switch (_c.label) {
106
- case 0:
107
- innerIndex = getInnerIndex(currentpage, index);
108
- _c.label = 1;
109
- case 1:
110
- _c.trys.push([1, 3, , 4]);
111
- return [4 /*yield*/, (form === null || form === void 0 ? void 0 : form.validateFields())];
112
- case 2:
113
- values = _c.sent();
114
- if (!handleSave) {
115
- console.error('Table props onEditableSave is not a function');
116
- }
117
- if (info && info.maxResult) {
118
- result = info.maxResult;
119
- currentInputNumberValue = values[dataIndex];
120
- if (currentInputNumberValue > (result === null || result === void 0 ? void 0 : result.number)) {
121
- message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (typeof index === 'number' ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u8D85\u8FC7\u6700\u5927\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5927\u503C!");
122
- handleSave(__assign(__assign(__assign({}, record), values), (_a = {}, _a[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _a)),
123
- // index,
124
- innerIndex, dataIndex);
125
- return [2 /*return*/];
126
- }
105
+ var save = useCallback(function (info) { return __awaiter(void 0, void 0, void 0, function () {
106
+ var innerIndex, values, result, currentInputNumberValue, result, currentInputNumberValue;
107
+ var _a, _b, _c;
108
+ return __generator(this, function (_d) {
109
+ innerIndex = getInnerIndex(currentpage, index);
110
+ try {
111
+ values = valueRef.current;
112
+ if (!handleSave) {
113
+ console.error('Table props onEditableSave is not a function');
114
+ }
115
+ if (info && info.maxResult) {
116
+ result = info.maxResult;
117
+ currentInputNumberValue = values[dataIndex];
118
+ if (currentInputNumberValue > (result === null || result === void 0 ? void 0 : result.number)) {
119
+ message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (typeof index === 'number' ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u8D85\u8FC7\u6700\u5927\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5927\u503C!");
120
+ handleSave(__assign(__assign({}, record), (_a = {}, _a[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _a)), innerIndex, dataIndex, { isInner: true });
121
+ return [2 /*return*/];
127
122
  }
128
- if (info && info.minResult) {
129
- result = info.minResult;
130
- currentInputNumberValue = values[dataIndex];
131
- if (currentInputNumberValue < (result === null || result === void 0 ? void 0 : result.number)) {
132
- message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (index ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u4F4E\u4E8E\u6700\u5C0F\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5C0F\u503C!");
133
- handleSave(__assign(__assign(__assign({}, record), values), (_b = {}, _b[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _b)),
134
- // index,
135
- innerIndex, dataIndex);
136
- return [2 /*return*/];
137
- }
123
+ }
124
+ if (info && info.minResult) {
125
+ result = info.minResult;
126
+ currentInputNumberValue = values[dataIndex];
127
+ if (currentInputNumberValue < (result === null || result === void 0 ? void 0 : result.number)) {
128
+ message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (index ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u4F4E\u4E8E\u6700\u5C0F\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5C0F\u503C!");
129
+ handleSave(__assign(__assign({}, record), (_b = {}, _b[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _b)), innerIndex, dataIndex, { isInner: true });
130
+ return [2 /*return*/];
138
131
  }
139
- // handleSave({ ...record, ...values }, index, dataIndex);
140
- handleSave(__assign(__assign({}, record), values), innerIndex, dataIndex);
141
- return [3 /*break*/, 4];
142
- case 3:
143
- err_1 = _c.sent();
144
- console.error('Save failed:', err_1);
145
- return [3 /*break*/, 4];
146
- case 4: return [2 /*return*/];
132
+ }
133
+ handleSave(__assign(__assign({}, record), (_c = {}, _c[dataIndex] = values[dataIndex], _c)), innerIndex, dataIndex, { isInner: true });
134
+ }
135
+ catch (err) {
136
+ console.error('Save failed:', err);
147
137
  }
138
+ return [2 /*return*/];
148
139
  });
149
- }); };
150
- function removeErrorClass() {
151
- if (tdRef.current) {
140
+ }); }, [currentpage, dataIndex, handleSave, index, record, title]);
141
+ var removeErrorClass = useCallback(function () {
142
+ var _a, _b;
143
+ if (tdRef.current &&
144
+ ((_b = (_a = tdRef.current.classList).contains) === null || _b === void 0 ? void 0 : _b.call(_a, ERROR_TD_CLASSNAME))) {
152
145
  tdRef.current.classList.remove(ERROR_TD_CLASSNAME);
153
146
  }
154
- }
155
- function onPasteHandle(e) {
147
+ }, []);
148
+ var onPasteHandle = useCallback(function (e) {
156
149
  if (!onTableChange) {
157
150
  return;
158
151
  }
@@ -211,22 +204,29 @@ var TableEnhanceCell = memo(function (_a) {
211
204
  return result;
212
205
  });
213
206
  // onTableChange && onTableChange(resultTextList, index, record);
207
+ setVal(resultTextList[0][dataIndex]);
208
+ valueRef.current[dataIndex] = resultTextList[0][dataIndex];
214
209
  onTableChange && onTableChange(resultTextList, innerIndex, record);
215
210
  }
216
211
  }
217
- }
212
+ }, [columns, currentpage, dataIndex, index, onTableChange, record]);
218
213
  /**
219
214
  * @description 生成编辑框
220
215
  */
221
- var createEditableDom = function (editableConfig) {
216
+ var createEditableDom = useMemo(function () {
217
+ // 执行优化,减少生成无意义的组件rerender次数
218
+ if (!editable) {
219
+ return null;
220
+ }
222
221
  if (!editableConfig) {
223
- return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
224
- React.createElement(Input, { autoComplete: "new-password", maxLength: 50, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, onChange: function (e) {
225
- removeErrorClass();
226
- if (!e.target.value) {
227
- e.target.focus();
228
- }
229
- } })));
222
+ return (React.createElement(Input, { autoComplete: "new-password", maxLength: 50, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, value: val, onChange: function (e) {
223
+ setVal(e.target.value);
224
+ removeErrorClass();
225
+ valueRef.current[dataIndex] = e.target.value;
226
+ if (!e.target.value) {
227
+ e.target.focus();
228
+ }
229
+ } }));
230
230
  }
231
231
  var type = editableConfig.type, data = editableConfig.data, keyValue = editableConfig.keyValue, maxHandle = editableConfig.maxHandle, minHandle = editableConfig.minHandle, overMaxTip = editableConfig.overMaxTip, lowMinTip = editableConfig.lowMinTip, disabledHandle = editableConfig.disabledHandle, editableProps = __rest(editableConfig, ["type", "data", "keyValue", "maxHandle", "minHandle", "overMaxTip", "lowMinTip", "disabledHandle"]);
232
232
  var selectData = data; // 下拉框使用到得数据
@@ -278,53 +278,62 @@ var TableEnhanceCell = memo(function (_a) {
278
278
  }
279
279
  // 处理各种类型
280
280
  if (type === 'select') {
281
- return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
282
- React.createElement(Select, __assign({ allowClear: true }, editableProps, { disabled: disabledResult, onChange: function (value, option) {
283
- removeErrorClass();
284
- save(value);
285
- } }), Array.isArray(selectData) &&
286
- selectData.map(function (item) { return (React.createElement(Select.Option, { key: item[selectKeyValue.key] + '', value: item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.key] }, item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.label])); }))));
281
+ return (React.createElement(Select, __assign({ allowClear: true }, editableProps, { disabled: disabledResult, value: val, onChange: function (value, option) {
282
+ removeErrorClass();
283
+ save(value);
284
+ valueRef.current[dataIndex] = value;
285
+ } }), Array.isArray(selectData) &&
286
+ selectData.map(function (item) { return (React.createElement(Select.Option, { key: item[selectKeyValue.key] + '', value: item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.key] }, item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.label])); })));
287
287
  }
288
288
  else if (type === 'inputNumber') {
289
- return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
290
- React.createElement(InputNumber, __assign({ autoComplete: "new-password", maxLength: 50 }, inputNumMaxMin, editableProps, inputNumberRangeTip, { disabled: disabledResult, onPressEnter: function (e) {
291
- var _a;
292
- editableProps.onPressEnter && ((_a = editableProps.onPressEnter) === null || _a === void 0 ? void 0 : _a.call(editableProps, e));
293
- save({ maxResult: maxResult, minResult: minResult });
294
- }, onBlur: function (e) {
295
- var _a;
296
- editableProps.onBlur && ((_a = editableProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(editableProps, e));
297
- save({ maxResult: maxResult, minResult: minResult });
298
- }, onFocus: function (e) {
299
- var _a;
300
- editableProps.onFocus && ((_a = editableProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(editableProps, e));
301
- }, onPaste: onPasteHandle, onChange: function () {
302
- removeErrorClass();
303
- } }))));
289
+ return (React.createElement(InputNumber, __assign({ autoComplete: "new-password", maxLength: 50 }, inputNumMaxMin, editableProps, inputNumberRangeTip, { disabled: disabledResult, onPressEnter: function (e) {
290
+ var _a;
291
+ editableProps.onPressEnter && ((_a = editableProps.onPressEnter) === null || _a === void 0 ? void 0 : _a.call(editableProps, e));
292
+ save({ maxResult: maxResult, minResult: minResult });
293
+ }, onBlur: function (e) {
294
+ var _a;
295
+ editableProps.onBlur && ((_a = editableProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(editableProps, e));
296
+ save({ maxResult: maxResult, minResult: minResult });
297
+ }, onFocus: function (e) {
298
+ var _a;
299
+ editableProps.onFocus && ((_a = editableProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(editableProps, e));
300
+ }, onPaste: onPasteHandle, value: val, onChange: function (value) {
301
+ setVal(value);
302
+ valueRef.current[dataIndex] = value;
303
+ removeErrorClass();
304
+ } })));
304
305
  }
305
306
  else if (type === 'textArea') {
306
- return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
307
- React.createElement(Input.TextArea, __assign({ autoComplete: "new-password", maxLength: 200, autoSize: { maxRows: 3 } }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, onPaste: onPasteHandle, onChange: function (e) {
308
- removeErrorClass();
309
- if (!e.target.value) {
310
- e.target.focus();
311
- }
312
- }, allowClear: true }))));
307
+ return (React.createElement(Input.TextArea, __assign({ autoComplete: "new-password", maxLength: 200, autoSize: { maxRows: 3 } }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, onPaste: onPasteHandle, value: val, onChange: function (e) {
308
+ setVal(e.target.value);
309
+ valueRef.current[dataIndex] = e.target.value;
310
+ removeErrorClass();
311
+ if (!e.target.value) {
312
+ e.target.focus();
313
+ }
314
+ }, allowClear: true })));
313
315
  }
314
316
  else {
315
- return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
316
- React.createElement(Input, __assign({ autoComplete: "new-password", maxLength: 50 }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, onChange: function (e) {
317
- removeErrorClass();
318
- if (!e.target.value) {
319
- e.target.focus();
320
- }
321
- } }))));
317
+ return (React.createElement(Input, __assign({ autoComplete: "new-password", maxLength: 50 }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, allowClear: true, onPaste: onPasteHandle, value: val, onChange: function (e) {
318
+ setVal(e.target.value);
319
+ valueRef.current[dataIndex] = e.target.value;
320
+ removeErrorClass();
321
+ if (!e.target.value) {
322
+ e.target.focus();
323
+ }
324
+ } })));
322
325
  }
323
- };
324
- var childNode = children;
325
- if (editable) {
326
- childNode = createEditableDom(editableConfig);
327
- }
328
- return (React.createElement("td", __assign({ ref: tdRef }, restProps), childNode));
329
- });
330
- export default TableEnhanceCell;
326
+ }, [
327
+ val,
328
+ editable,
329
+ editableConfig,
330
+ dataIndex,
331
+ index,
332
+ onPasteHandle,
333
+ record,
334
+ removeErrorClass,
335
+ save,
336
+ ]);
337
+ return (React.createElement("td", __assign({ ref: tdRef }, restProps), editable ? (React.createElement("div", { className: "zt-table__enhance-cell" }, createEditableDom)) : (children)));
338
+ };
339
+ export default memo(TableEnhanceCell);
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
2
  import { IMoveRow as _IMoveRow } from './hooks/useDropRef';
3
- import { FormInstance } from 'antd/lib/form';
4
3
  export declare type IMoveRow = _IMoveRow;
5
4
  interface IProps {
6
5
  index: number;
7
6
  moverow: IMoveRow;
8
7
  className?: string;
9
8
  style?: any;
9
+ [prop: string]: any;
10
10
  }
11
- export declare const EditableContext: React.Context<FormInstance<any>>;
12
- declare const TableEnhanceRow: React.FC<IProps>;
13
- export default TableEnhanceRow;
11
+ declare const _default: React.NamedExoticComponent<IProps>;
12
+ export default _default;
@@ -20,16 +20,12 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import React, { memo } from 'react';
23
+ import React, { memo, useMemo } from 'react';
24
24
  import useDropRef from './hooks/useDropRef';
25
- import { Form } from '../../index';
26
- export var EditableContext = React.createContext(null);
27
- var TableEnhanceRow = memo(function (props) {
25
+ var TableEnhanceRow = function (props) {
28
26
  var index = props.index, moverow = props.moverow, className = props.className, style = props.style, restProps = __rest(props, ["index", "moverow", "className", "style"]);
29
27
  var _a = useDropRef(index, moverow), ref = _a.ref, isOver = _a.isOver, dropClassName = _a.dropClassName;
30
- var form = Form.useForm()[0];
31
- return (React.createElement(Form, { autoComplete: "off", form: form, component: false, name: props['data-row-key'] },
32
- React.createElement(EditableContext.Provider, { value: form },
33
- React.createElement("tr", __assign({ ref: ref, className: "" + className + (isOver ? dropClassName : ''), style: __assign({ cursor: !moverow ? 'default' : 'move' }, style) }, restProps)))));
34
- });
35
- export default TableEnhanceRow;
28
+ var memoStyle = useMemo(function () { return (__assign({ cursor: !moverow ? 'default' : 'move' }, style)); }, [moverow, style]);
29
+ return (React.createElement("tr", __assign({ ref: ref, className: "" + className + (isOver ? dropClassName : ''), style: memoStyle }, restProps)));
30
+ };
31
+ export default memo(TableEnhanceRow);
@@ -3,9 +3,8 @@
3
3
  * @description
4
4
  */
5
5
  import React from 'react';
6
- import type { ResizeCallbackData } from 'react-resizable';
7
- declare const TableResizableTitle: (props: React.HTMLAttributes<any> & {
8
- onResize: (e: React.SyntheticEvent<Element>, data: any) => void;
6
+ declare const _default: React.MemoExoticComponent<(props: React.HTMLAttributes<any> & {
7
+ onResize: (e: React.SyntheticEvent<Element, Event>, data: any) => void;
9
8
  width: number;
10
- }) => JSX.Element;
11
- export default TableResizableTitle;
9
+ }) => JSX.Element>;
10
+ export default _default;
@@ -24,16 +24,41 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  * @author 陈亚雄
25
25
  * @description
26
26
  */
27
- import React from 'react';
27
+ import React, { useState } from 'react';
28
28
  import { Resizable } from 'react-resizable';
29
+ import classnames from 'classnames';
29
30
  var TableResizableTitle = function (props) {
30
- var onResize = props.onResize, width = props.width, restProps = __rest(props, ["onResize", "width"]);
31
+ var onResize = props.onResize, width = props.width, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, restProps = __rest(props, ["onResize", "width", "onMouseEnter", "onMouseLeave"]);
32
+ // 添加偏移量
33
+ var _a = useState(0), offset = _a[0], setOffset = _a[1];
31
34
  if (!width) {
32
35
  return React.createElement("th", __assign({}, restProps));
33
36
  }
34
- return (React.createElement(Resizable, { width: width, height: 0, handle: React.createElement("span", { className: "react-resizable-handle", onClick: function (e) {
37
+ return (React.createElement(Resizable, { width: Number(width) + Number(offset), height: 0, handle: React.createElement("span", {
38
+ // 有偏移量显示竖线
39
+ // className="react-resizable-handle"
40
+ className: classnames(['react-resizable-handle', offset && 'active']),
41
+ // 拖拽层偏移
42
+ style: { transform: "translateX(" + offset + "px)" }, onClick: function (e) {
35
43
  e.stopPropagation();
36
- } }), onResize: onResize, draggableOpts: { enableUserSelectHack: false } },
37
- React.createElement("th", __assign({}, restProps))));
44
+ e.preventDefault();
45
+ } }), onResize: function (e, _a) {
46
+ var size = _a.size;
47
+ // 这里只更新偏移量,数据列表其实并没有伸缩
48
+ setOffset(size.width - width);
49
+ }, onResizeStop: function (e, data) {
50
+ // 拖拽结束以后偏移量归零
51
+ setOffset(0);
52
+ // 这里是props传进来的事件,在外部是列数据中的onHeaderCell方法提供的事件,请自行研究官方提供的案例
53
+ onResize(e, data);
54
+ }, draggableOpts: { enableUserSelectHack: false } },
55
+ React.createElement("th", __assign({}, restProps, { style: __assign({ overflow: 'visible' }, restProps.style) }),
56
+ React.createElement("div", { style: {
57
+ width: '100%',
58
+ overflow: 'hidden',
59
+ whiteSpace: 'nowrap',
60
+ textOverflow: 'ellipsis',
61
+ // 此处样式是在th中增加div块,为了解决拖拉时偏移虚线在右侧不出现问题
62
+ } }, restProps.children))));
38
63
  };
39
- export default TableResizableTitle;
64
+ export default React.memo(TableResizableTitle);
@@ -14,6 +14,8 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
14
14
  hideDelIcon?: boolean;
15
15
  /**删除icon提示文字 */
16
16
  delIconText?: string;
17
+ /** 是否隐藏图标 */
18
+ hiddenColumnDynamicIcon?: boolean;
17
19
  /**是否显示动态表头配置 */
18
20
  showColumnDynamic?: boolean;
19
21
  /**动态表头配置,是否缓存,动态列配置如果要缓存得话,必须得使用一个全局唯一得key来标识 */