@zat-design/sisyphus-react 3.7.3 → 3.8.0-beat.10
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/index.esm.css +100 -4
- package/dist/less.esm.css +97 -4
- package/es/ProAction/index.js +1 -1
- package/es/ProDownload/index.js +3 -3
- package/es/ProDownload/utils.js +3 -3
- package/es/ProDrawerForm/components/ProDrawer/index.js +4 -4
- package/es/ProDrawerForm/components/ProModal/index.js +3 -3
- package/es/ProEditLabel/index.js +3 -3
- package/es/ProEditTable/components/ActionButton/index.js +3 -3
- package/es/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
- package/es/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +29 -14
- package/es/ProEditTable/components/RenderField/index.js +10 -8
- package/es/ProEditTable/components/RenderToolbar/index.js +1 -1
- package/es/ProEditTable/utils/config.js +2 -2
- package/es/ProEditTable/utils/index.js +5 -5
- package/es/ProEditTable/utils/tools.js +1 -1
- package/es/ProEnum/components/Group.js +10 -2
- package/es/ProEnum/hooks/useEnumRequest.js +2 -2
- package/es/ProEnum/index.js +6 -5
- package/es/ProEnum/style/index.less +14 -4
- package/es/ProEnum/utils/index.d.ts +1 -1
- package/es/ProEnum/utils/index.js +4 -0
- package/es/ProForm/components/combination/Container/index.js +5 -3
- package/es/ProForm/components/combination/Container/propsType.d.ts +2 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/es/ProForm/components/combination/FormList/utils.js +6 -5
- package/es/ProForm/components/combination/Group/component/ComRender.js +1 -1
- package/es/ProForm/components/combination/Group/utils.js +8 -1
- package/es/ProForm/components/combination/ProCascader/index.js +6 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +57 -46
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/ProNumberRange/index.js +14 -5
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
- package/es/ProForm/components/old/ProAddress/index.js +1 -1
- package/es/ProForm/components/render/ChangedWrapper.d.ts +17 -0
- package/es/ProForm/components/render/ChangedWrapper.js +110 -0
- package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/es/ProForm/components/render/Render.js +11 -11
- package/es/ProForm/components/render/RenderFields.d.ts +2 -3
- package/es/ProForm/components/render/RenderFields.js +3 -4
- package/es/ProForm/components/render/propsType.d.ts +5 -4
- package/es/ProForm/index.js +4 -7
- package/es/ProForm/propsType.d.ts +13 -2
- package/es/ProForm/style/index.less +103 -5
- package/es/ProForm/utils/diffOriginal.d.ts +4 -4
- package/es/ProForm/utils/diffOriginal.js +18 -7
- package/es/ProForm/utils/transformValue.js +17 -11
- package/es/ProForm/utils/useForm.js +1 -1
- package/es/ProForm/utils/useShouldUpdate.d.ts +2 -2
- package/es/ProForm/utils/useShouldUpdate.js +1 -1
- package/es/ProSelect/index.js +12 -11
- package/es/ProSelect/propsType.d.ts +4 -0
- package/es/ProSelect/utils/index.js +5 -4
- package/es/ProStep/components/Listener/index.d.ts +1 -1
- package/es/ProStep/components/Listener/index.js +6 -3
- package/es/ProStep/index.d.ts +1 -1
- package/es/ProStep/index.js +25 -18
- package/es/ProTable/components/FormatColumn/index.d.ts +7 -1
- package/es/ProTable/components/FormatColumn/index.js +14 -8
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +2 -2
- package/es/ProTable/hooks/useAntdTable.js +3 -3
- package/es/ProTable/index.js +30 -13
- package/es/ProTable/propsType.d.ts +14 -1
- package/es/ProTable/style/index.less +1 -1
- package/es/ProTree/components/AdaptiveTooltip.d.ts +4 -0
- package/es/ProTree/components/AdaptiveTooltip.js +55 -0
- package/es/ProTree/components/List.js +15 -3
- package/es/ProTree/components/ProTree.js +1 -1
- package/es/ProTree/components/ProTreeSelect/index.js +38 -5
- package/es/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
- package/es/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/es/ProTree/components/SearchTitle.d.ts +2 -0
- package/es/ProTree/components/SearchTitle.js +17 -8
- package/es/ProTree/components/Tree.js +1 -1
- package/es/ProTree/style/index.less +14 -0
- package/es/ProTreeModal/components/Tree.js +15 -17
- package/es/ProTreeModal/index.js +62 -7
- package/es/ProTreeModal/utils.d.ts +1 -0
- package/es/ProTreeModal/utils.js +21 -1
- package/es/ProUpload/components/ImageRender.js +1 -1
- package/es/ProViewer/index.js +2 -2
- package/es/old/ProEditableTable/index.js +4 -4
- package/es/style/theme/antd.less +5 -0
- package/es/style/theme/index.less +2 -1
- package/es/style/theme/tokens.less +1 -0
- package/es/utils/index.d.ts +2 -0
- package/es/utils/index.js +13 -0
- package/lib/ProAction/index.js +1 -1
- package/lib/ProDownload/index.js +3 -3
- package/lib/ProDownload/utils.js +3 -3
- package/lib/ProDrawerForm/components/ProDrawer/index.js +4 -4
- package/lib/ProDrawerForm/components/ProModal/index.js +3 -3
- package/lib/ProEditLabel/index.js +3 -3
- package/lib/ProEditTable/components/ActionButton/index.js +3 -3
- package/lib/ProEditTable/components/RenderField/{ListChanged.d.ts → ListChangedWrapper.d.ts} +4 -3
- package/lib/ProEditTable/components/RenderField/{ListChanged.js → ListChangedWrapper.js} +32 -15
- package/lib/ProEditTable/components/RenderField/index.js +10 -8
- package/lib/ProEditTable/components/RenderToolbar/index.js +1 -1
- package/lib/ProEditTable/utils/config.js +2 -2
- package/lib/ProEditTable/utils/index.js +5 -5
- package/lib/ProEditTable/utils/tools.js +1 -1
- package/lib/ProEnum/components/Group.js +10 -2
- package/lib/ProEnum/hooks/useEnumRequest.js +2 -2
- package/lib/ProEnum/index.js +6 -5
- package/lib/ProEnum/style/index.less +14 -4
- package/lib/ProEnum/utils/index.d.ts +1 -1
- package/lib/ProEnum/utils/index.js +4 -0
- package/lib/ProForm/components/combination/Container/index.js +5 -3
- package/lib/ProForm/components/combination/Container/propsType.d.ts +2 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/lib/ProForm/components/combination/FormList/utils.js +5 -4
- package/lib/ProForm/components/combination/Group/component/ComRender.js +1 -1
- package/lib/ProForm/components/combination/Group/utils.js +8 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +6 -3
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +56 -45
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/ProNumberRange/index.js +14 -5
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
- package/lib/ProForm/components/old/ProAddress/index.js +1 -1
- package/lib/ProForm/components/render/ChangedWrapper.d.ts +17 -0
- package/lib/ProForm/components/render/ChangedWrapper.js +115 -0
- package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/lib/ProForm/components/render/Render.js +11 -11
- package/lib/ProForm/components/render/RenderFields.d.ts +2 -3
- package/lib/ProForm/components/render/RenderFields.js +3 -4
- package/lib/ProForm/components/render/propsType.d.ts +5 -4
- package/lib/ProForm/index.js +4 -7
- package/lib/ProForm/propsType.d.ts +13 -2
- package/lib/ProForm/style/index.less +103 -5
- package/lib/ProForm/utils/diffOriginal.d.ts +4 -4
- package/lib/ProForm/utils/diffOriginal.js +18 -7
- package/lib/ProForm/utils/transformValue.js +17 -11
- package/lib/ProForm/utils/useForm.js +1 -1
- package/lib/ProForm/utils/useShouldUpdate.d.ts +2 -2
- package/lib/ProForm/utils/useShouldUpdate.js +1 -1
- package/lib/ProSelect/index.js +12 -11
- package/lib/ProSelect/propsType.d.ts +4 -0
- package/lib/ProSelect/utils/index.js +5 -4
- package/lib/ProStep/components/Listener/index.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.js +6 -3
- package/lib/ProStep/index.d.ts +1 -1
- package/lib/ProStep/index.js +25 -18
- package/lib/ProTable/components/FormatColumn/index.d.ts +7 -1
- package/lib/ProTable/components/FormatColumn/index.js +14 -8
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +2 -2
- package/lib/ProTable/hooks/useAntdTable.js +3 -3
- package/lib/ProTable/index.js +30 -13
- package/lib/ProTable/propsType.d.ts +14 -1
- package/lib/ProTable/style/index.less +1 -1
- package/lib/ProTree/components/AdaptiveTooltip.d.ts +4 -0
- package/lib/ProTree/components/AdaptiveTooltip.js +61 -0
- package/lib/ProTree/components/List.js +15 -3
- package/lib/ProTree/components/ProTree.js +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +38 -5
- package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
- package/lib/ProTree/components/ProTreeSelect/style/index.less +2 -2
- package/lib/ProTree/components/SearchTitle.d.ts +2 -0
- package/lib/ProTree/components/SearchTitle.js +19 -7
- package/lib/ProTree/components/Tree.js +1 -1
- package/lib/ProTree/style/index.less +14 -0
- package/lib/ProTreeModal/components/Tree.js +15 -17
- package/lib/ProTreeModal/index.js +61 -6
- package/lib/ProTreeModal/utils.d.ts +1 -0
- package/lib/ProTreeModal/utils.js +20 -0
- package/lib/ProUpload/components/ImageRender.js +1 -1
- package/lib/ProViewer/index.js +2 -2
- package/lib/old/ProEditableTable/index.js +4 -4
- package/lib/style/theme/antd.less +5 -0
- package/lib/style/theme/index.less +2 -1
- package/lib/style/theme/tokens.less +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +19 -0
- package/package.json +4 -4
- package/es/ProForm/components/render/Changed.d.ts +0 -14
- package/es/ProForm/components/render/Changed.js +0 -64
- package/lib/ProForm/components/render/Changed.d.ts +0 -14
- package/lib/ProForm/components/render/Changed.js +0 -69
- /package/es/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
- /package/es/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
- /package/es/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
- /package/es/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
- /package/lib/ProForm/utils/{useChanged.d.ts → _useChanged.d.ts} +0 -0
- /package/lib/ProForm/utils/{useChanged.js → _useChanged.js} +0 -0
- /package/lib/ProForm/utils/{useListChanged.d.ts → _useListChanged.d.ts} +0 -0
- /package/lib/ProForm/utils/{useListChanged.js → _useListChanged.js} +0 -0
package/lib/ProTable/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var _reset = _interopRequireDefault(require("../assets/reset.svg"));
|
|
|
27
27
|
var _customColumn = _interopRequireDefault(require("../assets/customColumn.svg"));
|
|
28
28
|
var _utils = require("./utils");
|
|
29
29
|
var _locale = _interopRequireDefault(require("../locale"));
|
|
30
|
-
var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "
|
|
30
|
+
var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "diffConfig", "onDragStart", "onDragEnd"],
|
|
31
31
|
_excluded2 = ["resizeColumn", "columnConfig", "cacheTime", "storage"];
|
|
32
32
|
var defaultCacheTime = 1; // columns 配置保存时间为一天
|
|
33
33
|
// 全局上下文
|
|
@@ -59,10 +59,15 @@ function ProTable(props) {
|
|
|
59
59
|
summary = props.summary,
|
|
60
60
|
_props$emptyText = props.emptyText,
|
|
61
61
|
emptyText = _props$emptyText === void 0 ? _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTable = _locale.default.ProTable) === null || _locale$ProTable === void 0 ? void 0 : _locale$ProTable.noData : _props$emptyText,
|
|
62
|
-
|
|
62
|
+
diffConfig = props.diffConfig,
|
|
63
63
|
onDragStartGuard = props.onDragStart,
|
|
64
64
|
onDragEndGuard = props.onDragEnd,
|
|
65
65
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
66
|
+
var _ref3 = diffConfig || {},
|
|
67
|
+
originalDataSource = _ref3.originalDataSource,
|
|
68
|
+
changeTipColor = _ref3.changeTipColor,
|
|
69
|
+
addTipColor = _ref3.addTipColor,
|
|
70
|
+
toolTip = _ref3.toolTip;
|
|
66
71
|
var quickTableConfig = quickConfig ? (0, _objectSpread4.default)({
|
|
67
72
|
columnConfig: true,
|
|
68
73
|
cacheTime: true
|
|
@@ -78,10 +83,10 @@ function ProTable(props) {
|
|
|
78
83
|
_quickTableConfig$sto = quickTableConfig.storage,
|
|
79
84
|
storage = _quickTableConfig$sto === void 0 ? configStorage : _quickTableConfig$sto,
|
|
80
85
|
tableProps = (0, _objectWithoutProperties2.default)(quickTableConfig, _excluded2);
|
|
81
|
-
var
|
|
82
|
-
pagination =
|
|
83
|
-
dataSource =
|
|
84
|
-
rowKey =
|
|
86
|
+
var _ref4 = tableProps || {},
|
|
87
|
+
pagination = _ref4.pagination,
|
|
88
|
+
dataSource = _ref4.dataSource,
|
|
89
|
+
rowKey = _ref4.rowKey;
|
|
85
90
|
var initDataSource = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
|
|
86
91
|
return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, item), {}, {
|
|
87
92
|
rowKey: (0, _utils.getRowKey)(rowKey, item)
|
|
@@ -164,8 +169,8 @@ function ProTable(props) {
|
|
|
164
169
|
};
|
|
165
170
|
// 列宽resize函数
|
|
166
171
|
var handleResize = function handleResize(index) {
|
|
167
|
-
return function (e,
|
|
168
|
-
var size =
|
|
172
|
+
return function (e, _ref5) {
|
|
173
|
+
var size = _ref5.size;
|
|
169
174
|
var nextColumns = (0, _toConsumableArray2.default)(curColumns);
|
|
170
175
|
nextColumns[index] = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, nextColumns[index]), {}, {
|
|
171
176
|
width: size.width
|
|
@@ -195,7 +200,13 @@ function ProTable(props) {
|
|
|
195
200
|
return !(item === null || item === void 0 ? void 0 : item.delete);
|
|
196
201
|
});
|
|
197
202
|
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item) {
|
|
198
|
-
(0, _FormatColumn.formatColumn)(
|
|
203
|
+
(0, _FormatColumn.formatColumn)({
|
|
204
|
+
column: item,
|
|
205
|
+
originalObj: originalObj,
|
|
206
|
+
dataSourceObj: dataSourceObj,
|
|
207
|
+
rowKey: 'rowKey',
|
|
208
|
+
diffToolTip: toolTip
|
|
209
|
+
});
|
|
199
210
|
});
|
|
200
211
|
return newColumns;
|
|
201
212
|
}, [curColumns, handleResize]);
|
|
@@ -212,7 +223,7 @@ function ProTable(props) {
|
|
|
212
223
|
});
|
|
213
224
|
}, [columns]);
|
|
214
225
|
var handleColumnConfig = /*#__PURE__*/function () {
|
|
215
|
-
var
|
|
226
|
+
var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(checkList) {
|
|
216
227
|
var newColumns, _columnConfig$onColum, catchColumns;
|
|
217
228
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
218
229
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -248,7 +259,7 @@ function ProTable(props) {
|
|
|
248
259
|
}, _callee);
|
|
249
260
|
}));
|
|
250
261
|
return function handleColumnConfig(_x) {
|
|
251
|
-
return
|
|
262
|
+
return _ref6.apply(this, arguments);
|
|
252
263
|
};
|
|
253
264
|
}();
|
|
254
265
|
(0, _ahooks.useDebounceEffect)(function () {
|
|
@@ -321,7 +332,7 @@ function ProTable(props) {
|
|
|
321
332
|
return _rowSelection;
|
|
322
333
|
};
|
|
323
334
|
var onDataSourceChange = /*#__PURE__*/function () {
|
|
324
|
-
var
|
|
335
|
+
var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(nextDataSource) {
|
|
325
336
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
326
337
|
while (1) switch (_context2.prev = _context2.next) {
|
|
327
338
|
case 0:
|
|
@@ -337,7 +348,7 @@ function ProTable(props) {
|
|
|
337
348
|
}, _callee2);
|
|
338
349
|
}));
|
|
339
350
|
return function onDataSourceChange(_x2) {
|
|
340
|
-
return
|
|
351
|
+
return _ref7.apply(this, arguments);
|
|
341
352
|
};
|
|
342
353
|
}();
|
|
343
354
|
var _rowClassName = function _rowClassName(record, index) {
|
|
@@ -346,6 +357,11 @@ function ProTable(props) {
|
|
|
346
357
|
}
|
|
347
358
|
};
|
|
348
359
|
var TableComponent = draggable ? _RcTable.DraggableTable : _RcTable.BaseTable;
|
|
360
|
+
// 标记样式
|
|
361
|
+
var tagStyle = {
|
|
362
|
+
'--zaui-contract-bg': changeTipColor,
|
|
363
|
+
'--zaui-contract-bg-add': addTipColor
|
|
364
|
+
};
|
|
349
365
|
return (0, _jsxRuntime.jsx)(TableContext.Provider, {
|
|
350
366
|
value: {
|
|
351
367
|
pathKey: pathKey,
|
|
@@ -369,6 +385,7 @@ function ProTable(props) {
|
|
|
369
385
|
}
|
|
370
386
|
}), (0, _jsxRuntime.jsxs)("div", {
|
|
371
387
|
className: "pro-table-container",
|
|
388
|
+
style: tagStyle,
|
|
372
389
|
children: [(0, _jsxRuntime.jsx)(TableComponent, (0, _objectSpread4.default)((0, _objectSpread4.default)({}, restProps), {}, {
|
|
373
390
|
draggableProps: {
|
|
374
391
|
onChange: onDataSourceChange,
|
|
@@ -59,6 +59,16 @@ export interface DragStartGuardProps {
|
|
|
59
59
|
activeObject: any;
|
|
60
60
|
currentDataSource: any[];
|
|
61
61
|
}
|
|
62
|
+
export interface TableDiffConfigProps {
|
|
63
|
+
/** 比对原始数据源 */
|
|
64
|
+
originalDataSource: any[];
|
|
65
|
+
/** 是否显示对比值气泡 */
|
|
66
|
+
toolTip?: boolean;
|
|
67
|
+
/** 变更提示颜色 */
|
|
68
|
+
changeTipColor?: string;
|
|
69
|
+
/** 新增提示颜色 */
|
|
70
|
+
addTipColor?: string;
|
|
71
|
+
}
|
|
62
72
|
export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary' | 'columns'> {
|
|
63
73
|
tableId?: string;
|
|
64
74
|
rowKey?: string | GetRowKey<any>;
|
|
@@ -84,7 +94,10 @@ export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary'
|
|
|
84
94
|
*/
|
|
85
95
|
stripe?: boolean;
|
|
86
96
|
columns: ProTableColumn[];
|
|
87
|
-
|
|
97
|
+
/**
|
|
98
|
+
* 比对配置
|
|
99
|
+
*/
|
|
100
|
+
diffConfig?: TableDiffConfigProps;
|
|
88
101
|
/**
|
|
89
102
|
* 拖拽额外配置
|
|
90
103
|
*/
|
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
.@{ant-prefix}-table-cell .varied-cell {
|
|
271
271
|
margin-left: -8px;
|
|
272
272
|
padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
|
|
273
|
-
background: var(--zaui-contract-bg
|
|
273
|
+
background: var(--zaui-contract-bg; #fffaa1) !important;
|
|
274
274
|
border-radius: var(--zaui-border-radius, 8px);
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
var _antd = require("antd");
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
/*
|
|
13
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
14
|
+
* @Date: 2024-09-20 10:26:04
|
|
15
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
16
|
+
* @LastEditTime: 2024-09-26 14:12:44
|
|
17
|
+
* @FilePath: /za-material-warehouse/src/ProTree/components/AdaptiveTooltip.tsx
|
|
18
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
var AdaptiveTooltip = function AdaptiveTooltip(_ref) {
|
|
22
|
+
var children = _ref.children;
|
|
23
|
+
var _useState = (0, _react.useState)('right'),
|
|
24
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
+
placement = _useState2[0],
|
|
26
|
+
setPlacement = _useState2[1];
|
|
27
|
+
(0, _react.useEffect)(function () {
|
|
28
|
+
var handleResize = function handleResize() {
|
|
29
|
+
var tooltipElement = document.getElementById('adaptive-tooltip');
|
|
30
|
+
if (tooltipElement) {
|
|
31
|
+
var boundingRect = tooltipElement.getBoundingClientRect();
|
|
32
|
+
var windowWidth = window.innerWidth;
|
|
33
|
+
if (windowWidth - boundingRect.right < 150) {
|
|
34
|
+
setPlacement('left');
|
|
35
|
+
} else {
|
|
36
|
+
setPlacement('right');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
window.addEventListener('resize', handleResize);
|
|
41
|
+
handleResize();
|
|
42
|
+
return function () {
|
|
43
|
+
window.removeEventListener('resize', handleResize);
|
|
44
|
+
};
|
|
45
|
+
}, [children]);
|
|
46
|
+
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
47
|
+
placement: placement,
|
|
48
|
+
title: (0, _jsxRuntime.jsx)("div", {
|
|
49
|
+
onMouseDown: function onMouseDown(e) {
|
|
50
|
+
return e.stopPropagation();
|
|
51
|
+
},
|
|
52
|
+
children: children
|
|
53
|
+
}),
|
|
54
|
+
id: "adaptive-tooltip",
|
|
55
|
+
children: (0, _jsxRuntime.jsxs)("span", {
|
|
56
|
+
className: "pro-tree-wrap-ellipse",
|
|
57
|
+
children: [" ", children]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
var _default = exports.default = AdaptiveTooltip;
|
|
@@ -5,11 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
8
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
11
|
var _react = require("react");
|
|
10
12
|
var _antd = require("antd");
|
|
11
13
|
var _SearchTitle = _interopRequireDefault(require("./SearchTitle"));
|
|
12
14
|
var _CloseIcon = _interopRequireDefault(require("./CloseIcon"));
|
|
15
|
+
var _excluded = ["checkedValues", "disabled", "treeData", "searchStr", "showCodeName", "mode", "fieldNames", "handleOnChange", "handleFilterClose", "optionRender"];
|
|
16
|
+
/*
|
|
17
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
18
|
+
* @Date: 2024-07-03 11:02:19
|
|
19
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
20
|
+
* @LastEditTime: 2024-09-26 14:30:26
|
|
21
|
+
* @FilePath: /za-material-warehouse/src/ProTree/components/List.tsx
|
|
22
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
23
|
+
*/
|
|
13
24
|
function List(props) {
|
|
14
25
|
var checkedValues = props.checkedValues,
|
|
15
26
|
disabled = props.disabled,
|
|
@@ -21,7 +32,8 @@ function List(props) {
|
|
|
21
32
|
fieldNames = props.fieldNames,
|
|
22
33
|
handleOnChange = props.handleOnChange,
|
|
23
34
|
handleFilterClose = props.handleFilterClose,
|
|
24
|
-
optionRender = props.optionRender
|
|
35
|
+
optionRender = props.optionRender,
|
|
36
|
+
other = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
25
37
|
var fieldNameLabel = fieldNames.label;
|
|
26
38
|
var fieldNameValue = fieldNames.value;
|
|
27
39
|
if (mode === 'render') {
|
|
@@ -43,10 +55,10 @@ function List(props) {
|
|
|
43
55
|
value: item[fieldNameValue],
|
|
44
56
|
disabled: item.disabled,
|
|
45
57
|
children: (0, _jsxRuntime.jsx)("span", {
|
|
46
|
-
children: optionRender ? optionRender(item, searchStr) : (0, _jsxRuntime.jsx)(_SearchTitle.default, {
|
|
58
|
+
children: optionRender ? optionRender(item, searchStr) : (0, _jsxRuntime.jsx)(_SearchTitle.default, (0, _objectSpread2.default)({
|
|
47
59
|
label: title,
|
|
48
60
|
searchStr: searchStr
|
|
49
|
-
})
|
|
61
|
+
}, other))
|
|
50
62
|
})
|
|
51
63
|
})
|
|
52
64
|
}, item[fieldNameValue]);
|
|
@@ -359,7 +359,7 @@ var ProTree = function ProTree(props) {
|
|
|
359
359
|
};
|
|
360
360
|
/** 点击了树节点开始loading,改变自身state并将值通过onchange上传到form */
|
|
361
361
|
var onSelectTreeNode = /*#__PURE__*/function () {
|
|
362
|
-
var _ref2 = (0, _asyncToGenerator2.default)(
|
|
362
|
+
var _ref2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(props, info) {
|
|
363
363
|
var _options$;
|
|
364
364
|
var values, options, option;
|
|
365
365
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
@@ -17,6 +17,7 @@ var _react = require("react");
|
|
|
17
17
|
var _lodash = require("lodash");
|
|
18
18
|
var _ProConfigProvider = require("../../../ProConfigProvider");
|
|
19
19
|
var _Container = _interopRequireDefault(require("../../../ProForm/components/Container"));
|
|
20
|
+
var _AdaptiveTooltip = _interopRequireDefault(require("../AdaptiveTooltip"));
|
|
20
21
|
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable"],
|
|
21
22
|
_excluded2 = ["children"];
|
|
22
23
|
/* eslint-disable react/no-danger */
|
|
@@ -74,9 +75,16 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
74
75
|
selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
75
76
|
var _props$value = props.value,
|
|
76
77
|
value = _props$value === void 0 ? undefined : _props$value;
|
|
77
|
-
var
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
var _props$showEllipse = props.showEllipse,
|
|
79
|
+
showEllipse = _props$showEllipse === void 0 ? true : _props$showEllipse;
|
|
80
|
+
var _ref2 = otherProps !== null && otherProps !== void 0 ? otherProps : {},
|
|
81
|
+
isDiffChange = _ref2.isDiffChange;
|
|
82
|
+
console.log('tag1', showEllipse, otherProps, isDiffChange);
|
|
83
|
+
var _showEllipse = showEllipse && !isDiffChange;
|
|
84
|
+
console.log('tag2', _showEllipse);
|
|
85
|
+
var _ref3 = otherProps || {},
|
|
86
|
+
isView = _ref3.isView,
|
|
87
|
+
viewEmpty = _ref3.viewEmpty;
|
|
80
88
|
if (fieldNames && Object.keys(fieldNames).length) {
|
|
81
89
|
code = fieldNames.value || 'value';
|
|
82
90
|
label = fieldNames.label || 'label';
|
|
@@ -209,8 +217,8 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
209
217
|
return undefined;
|
|
210
218
|
}
|
|
211
219
|
// 如果配置手动加载,不执行请求
|
|
212
|
-
var
|
|
213
|
-
defaultParams =
|
|
220
|
+
var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
|
221
|
+
defaultParams = _ref4.defaultParams;
|
|
214
222
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
|
215
223
|
fetchFunction.run(defaultParams);
|
|
216
224
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, defaultDisableValue]);
|
|
@@ -291,6 +299,16 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
291
299
|
var labelText = node[label];
|
|
292
300
|
var value = node[code];
|
|
293
301
|
var key = node[uuidKey];
|
|
302
|
+
// 三无走默认
|
|
303
|
+
if (['undefined-undefined', 'undefined'].includes(labelText) && !value && !key) {
|
|
304
|
+
if (showCodeName) {
|
|
305
|
+
labelText = "".concat(node === null || node === void 0 ? void 0 : node.value, "-").concat(node === null || node === void 0 ? void 0 : node.label);
|
|
306
|
+
} else {
|
|
307
|
+
labelText = node === null || node === void 0 ? void 0 : node.label;
|
|
308
|
+
}
|
|
309
|
+
value = node === null || node === void 0 ? void 0 : node.value;
|
|
310
|
+
key = node === null || node === void 0 ? void 0 : node.value;
|
|
311
|
+
}
|
|
294
312
|
var titleHtml = (0, _jsxRuntime.jsx)("span", {
|
|
295
313
|
dangerouslySetInnerHTML: {
|
|
296
314
|
__html: labelText
|
|
@@ -312,6 +330,21 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
312
330
|
children: (0, _jsxRuntime.jsx)(Icon, {})
|
|
313
331
|
}) : null]
|
|
314
332
|
});
|
|
333
|
+
if (_showEllipse) {
|
|
334
|
+
console.log('tag3', '走自身气泡了');
|
|
335
|
+
title = (0, _jsxRuntime.jsx)(_AdaptiveTooltip.default, {
|
|
336
|
+
children: treeCheckable ? titleHtml : (0, _jsxRuntime.jsxs)("span", {
|
|
337
|
+
className: "check-option-text",
|
|
338
|
+
children: [(0, _jsxRuntime.jsx)("span", {
|
|
339
|
+
className: "check-option-text-content",
|
|
340
|
+
children: titleHtml
|
|
341
|
+
}), !disabled ? (0, _jsxRuntime.jsx)("span", {
|
|
342
|
+
className: "check-mark-icon",
|
|
343
|
+
children: (0, _jsxRuntime.jsx)(Icon, {})
|
|
344
|
+
}) : null]
|
|
345
|
+
})
|
|
346
|
+
});
|
|
347
|
+
}
|
|
315
348
|
if (!children) {
|
|
316
349
|
return (0, _jsxRuntime.jsx)(_antd.TreeSelect.TreeNode, {
|
|
317
350
|
value: value,
|
|
@@ -73,6 +73,8 @@ export interface PropTreeSelectProps extends Omit<TreeSelectProps, 'onSearch'> {
|
|
|
73
73
|
expandedKeys?: any[];
|
|
74
74
|
checkStrictly?: boolean;
|
|
75
75
|
checkable?: boolean;
|
|
76
|
+
showEllipse?: boolean;
|
|
77
|
+
isDiffChange?: boolean;
|
|
76
78
|
}
|
|
77
79
|
export interface ProSelectAction {
|
|
78
80
|
/** 获取发生请求的 useRequest 的 ref */
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
.@{ant-prefix}-select-tree-treenode:hover{
|
|
73
|
-
background-color:
|
|
73
|
+
background-color: var(--zaui-disabled-bg);
|
|
74
74
|
}
|
|
75
75
|
.check-option-text{
|
|
76
76
|
.check-mark-icon{
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
padding-left: 7px;
|
|
91
91
|
}
|
|
92
92
|
.@{ant-prefix}-select-tree-treenode:hover{
|
|
93
|
-
background-color:
|
|
93
|
+
background-color: var(--zaui-disabled-bg);;
|
|
94
94
|
}
|
|
95
95
|
.@{ant-prefix}-select-tree-node-content-wrapper{
|
|
96
96
|
padding-right: var(--zaui-space-size-md);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ProFormOtherProps } from '../../ProForm/propsType';
|
|
2
3
|
declare function SearchTitle(props: {
|
|
3
4
|
searchStr?: string;
|
|
4
5
|
label?: string;
|
|
5
6
|
showEllipse?: boolean;
|
|
6
7
|
ellipseWidth?: string;
|
|
8
|
+
otherProps?: ProFormOtherProps;
|
|
7
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
declare const _default: import("react").MemoExoticComponent<typeof SearchTitle>;
|
|
9
11
|
export default _default;
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
9
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
+
var _AdaptiveTooltip = _interopRequireDefault(require("./AdaptiveTooltip"));
|
|
11
|
+
/*
|
|
12
|
+
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
13
|
+
* @Date: 2024-09-26 14:37:00
|
|
14
|
+
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
15
|
+
* @LastEditTime: 2024-09-26 17:50:59
|
|
16
|
+
* @FilePath: /za-material-warehouse/src/ProTree/components/SearchTitle.tsx
|
|
17
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
18
|
+
*/
|
|
19
|
+
|
|
10
20
|
function SearchTitle(props) {
|
|
11
21
|
var label = props.label,
|
|
12
22
|
_props$searchStr = props.searchStr,
|
|
13
23
|
searchStr = _props$searchStr === void 0 ? '' : _props$searchStr,
|
|
14
24
|
showEllipse = props.showEllipse,
|
|
15
|
-
ellipseWidth = props.ellipseWidth
|
|
25
|
+
ellipseWidth = props.ellipseWidth,
|
|
26
|
+
otherProps = props.otherProps;
|
|
27
|
+
var _ref = otherProps !== null && otherProps !== void 0 ? otherProps : {},
|
|
28
|
+
_ref$isDiffChange = _ref.isDiffChange,
|
|
29
|
+
isDiffChange = _ref$isDiffChange === void 0 ? false : _ref$isDiffChange;
|
|
16
30
|
var strTitle = label;
|
|
17
31
|
var index = strTitle === null || strTitle === void 0 ? void 0 : strTitle.indexOf(searchStr);
|
|
18
32
|
var beforeStr = strTitle === null || strTitle === void 0 ? void 0 : strTitle.substring(0, index);
|
|
@@ -45,11 +59,9 @@ function SearchTitle(props) {
|
|
|
45
59
|
style: style,
|
|
46
60
|
children: strTitle
|
|
47
61
|
});
|
|
48
|
-
if (classEllipse) {
|
|
49
|
-
return (0, _jsxRuntime.jsx)(
|
|
50
|
-
|
|
51
|
-
placement: "rightTop",
|
|
52
|
-
children: title
|
|
62
|
+
if (classEllipse && !isDiffChange) {
|
|
63
|
+
return (0, _jsxRuntime.jsx)(_AdaptiveTooltip.default, {
|
|
64
|
+
children: titleTips
|
|
53
65
|
});
|
|
54
66
|
}
|
|
55
67
|
return title;
|
|
@@ -115,7 +115,7 @@ function List(props) {
|
|
|
115
115
|
}
|
|
116
116
|
}, [selectedKey]);
|
|
117
117
|
var onSelect = /*#__PURE__*/function () {
|
|
118
|
-
var _ref = (0, _asyncToGenerator2.default)(
|
|
118
|
+
var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(value, item) {
|
|
119
119
|
var _props$onSelect;
|
|
120
120
|
var val;
|
|
121
121
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
@root-entry-name: 'default';
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
|
+
.pro-tree-wrap-ellipse {
|
|
5
|
+
display: block;
|
|
6
|
+
width: 100%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
text-overflow: ellipsis;
|
|
10
|
+
word-break: keep-all;
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
.pro-tree {
|
|
5
14
|
height: 100%; // tree auto css
|
|
6
15
|
.@{ant-prefix}-tree-iconEle{
|
|
@@ -368,3 +377,8 @@
|
|
|
368
377
|
}
|
|
369
378
|
|
|
370
379
|
|
|
380
|
+
.@{ant-prefix}-select-tree-node-content-wrapper {
|
|
381
|
+
&:has(.pro-tree-wrap-ellipse){
|
|
382
|
+
overflow: hidden;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -183,23 +183,21 @@ function List(props, ref) {
|
|
|
183
183
|
setAutoExpandParent(false);
|
|
184
184
|
};
|
|
185
185
|
if (mode === 'render') {
|
|
186
|
-
return (0, _jsxRuntime.jsx)(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
height: 432
|
|
202
|
-
})
|
|
186
|
+
return (0, _jsxRuntime.jsx)(_antd.Tree, {
|
|
187
|
+
disabled: disabled,
|
|
188
|
+
style: {
|
|
189
|
+
width: '100%'
|
|
190
|
+
},
|
|
191
|
+
checkable: true,
|
|
192
|
+
treeData: _treeData,
|
|
193
|
+
onExpand: onExpand,
|
|
194
|
+
expandedKeys: expandedKeys,
|
|
195
|
+
autoExpandParent: autoExpandParent,
|
|
196
|
+
selectable: false,
|
|
197
|
+
onCheck: onCheck,
|
|
198
|
+
checkedKeys: checkedValues,
|
|
199
|
+
checkStrictly: searchStr ? true : checkStrictly,
|
|
200
|
+
height: 432
|
|
203
201
|
});
|
|
204
202
|
}
|
|
205
203
|
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -20,6 +20,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
20
20
|
var _index = require("../index");
|
|
21
21
|
var _components = require("./components");
|
|
22
22
|
var _utils = require("./utils");
|
|
23
|
+
var _index2 = require("../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index");
|
|
23
24
|
var _inputSearch = _interopRequireDefault(require("../assets/input-search.svg"));
|
|
24
25
|
var _locale = _interopRequireWildcard(require("../locale"));
|
|
25
26
|
require("./style/index.less");
|
|
@@ -27,7 +28,7 @@ require("./style/index.less");
|
|
|
27
28
|
* @Author: za-xuwenli xuwenli@zhongan.io
|
|
28
29
|
* @Date: 2024-06-04 10:01:18
|
|
29
30
|
* @LastEditors: za-xuwenli xuwenli@zhongan.io
|
|
30
|
-
* @LastEditTime: 2024-
|
|
31
|
+
* @LastEditTime: 2024-09-27 11:49:28
|
|
31
32
|
* @FilePath: /za-material-warehouse/src/ProTreeModal/index.tsx
|
|
32
33
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
33
34
|
*/
|
|
@@ -100,7 +101,8 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
100
101
|
flatTreeData: [],
|
|
101
102
|
searchStr: '',
|
|
102
103
|
checkAll: false,
|
|
103
|
-
allKeys: []
|
|
104
|
+
allKeys: [],
|
|
105
|
+
transformedTree: []
|
|
104
106
|
}),
|
|
105
107
|
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
106
108
|
state = _useSetState2[0],
|
|
@@ -222,6 +224,12 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
226
|
}, [value, state.allKeys, state.open]);
|
|
227
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
228
|
+
var transformedTree = (0, _utils.addLevelAndParentId)(state.treeData, fieldNames);
|
|
229
|
+
setState({
|
|
230
|
+
transformedTree: transformedTree
|
|
231
|
+
});
|
|
232
|
+
}, [state.treeData]);
|
|
225
233
|
var handleClick = function handleClick() {
|
|
226
234
|
setState({
|
|
227
235
|
open: true
|
|
@@ -362,8 +370,55 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
362
370
|
var onCheck = function onCheck(checkedKeys, info) {
|
|
363
371
|
var checkedValues = (0, _toConsumableArray2.default)(state.checkedValues);
|
|
364
372
|
var originalTreeData = state.originalTreeData;
|
|
373
|
+
// 如果有检索则自管理
|
|
374
|
+
if (state.searchStr) {
|
|
375
|
+
var _transformTreeToArray;
|
|
376
|
+
var node = info.node;
|
|
377
|
+
// 从完整树中找到当前节点
|
|
378
|
+
var activeNode = (0, _index2.treeNodeFind)(state.transformedTree, function (t) {
|
|
379
|
+
return t[fieldNameValue] === node[fieldNameValue];
|
|
380
|
+
}, {
|
|
381
|
+
childrenKey: fieldNames.children
|
|
382
|
+
});
|
|
383
|
+
var allChildren = (_transformTreeToArray = (0, _index2.transformTreeToArray)([activeNode], {
|
|
384
|
+
childrenKey: fieldNames.children
|
|
385
|
+
})) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(function (item) {
|
|
386
|
+
return item[fieldNameValue];
|
|
387
|
+
});
|
|
388
|
+
// 子项合并勾选
|
|
389
|
+
checkedValues = checkedValues.concat(allChildren);
|
|
390
|
+
// 从完整树中拿到父节点 只要存在父节点,那么就判断当前children是否全被勾选 若全被勾选就合并当前key到勾选队列
|
|
391
|
+
var _recourse2 = function _recourse(findNode) {
|
|
392
|
+
if (findNode.parentId) {
|
|
393
|
+
var _transformTreeToArray2;
|
|
394
|
+
var parentNode = (0, _index2.treeNodeFind)(state.transformedTree, function (t) {
|
|
395
|
+
return t[fieldNameValue] === findNode.parentId;
|
|
396
|
+
}, {
|
|
397
|
+
childrenKey: fieldNames.children
|
|
398
|
+
});
|
|
399
|
+
var parentChildrenKeys = (_transformTreeToArray2 = (0, _index2.transformTreeToArray)([parentNode], {
|
|
400
|
+
childrenKey: fieldNames.children
|
|
401
|
+
})) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(function (item) {
|
|
402
|
+
return item[fieldNameValue];
|
|
403
|
+
});
|
|
404
|
+
var parentChildrenAllChecked = parentChildrenKeys.every(function (key) {
|
|
405
|
+
return checkedValues.includes(key);
|
|
406
|
+
});
|
|
407
|
+
if (parentChildrenAllChecked) {
|
|
408
|
+
// 把当前父节点追加进来
|
|
409
|
+
checkedValues = checkedValues.concat([parentNode[fieldNameValue]]);
|
|
410
|
+
// 继续向上查找
|
|
411
|
+
if (parentNode.parentId) {
|
|
412
|
+
_recourse2(parentNode);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
_recourse2(activeNode);
|
|
418
|
+
}
|
|
419
|
+
var _checkStrictly = state.searchStr ? true : checkStrictly;
|
|
365
420
|
// 此时应该取消掉自身并包含它所有的子集
|
|
366
|
-
if (!info.checked && !
|
|
421
|
+
if (!info.checked && !_checkStrictly) {
|
|
367
422
|
// 1. 取消自身
|
|
368
423
|
// 2. 把所有的子节点也要取消
|
|
369
424
|
var childrenkeys = [];
|
|
@@ -380,8 +435,8 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
380
435
|
return !parentKeys.includes(key);
|
|
381
436
|
});
|
|
382
437
|
} else {
|
|
383
|
-
//
|
|
384
|
-
if (
|
|
438
|
+
// _checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
|
|
439
|
+
if (_checkStrictly) {
|
|
385
440
|
if (!info.checked) {
|
|
386
441
|
checkedValues = checkedValues.filter(function (key) {
|
|
387
442
|
return key !== info.node.key;
|
|
@@ -620,7 +675,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
|
620
675
|
});
|
|
621
676
|
case TREE:
|
|
622
677
|
return (0, _jsxRuntime.jsx)(_components.TreeView, {
|
|
623
|
-
treeData: state.
|
|
678
|
+
treeData: state.transformedTree,
|
|
624
679
|
originalTreeData: state.originalTreeData,
|
|
625
680
|
flatTreeData: state.flatTreeData,
|
|
626
681
|
checkedValues: state.checkedValues,
|
|
@@ -36,3 +36,4 @@ export declare function filterCheckedNodes(data: any, checkedKeys: any, searchSt
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function getChildrenKeys(node: TreeDataProps, childrenKeys: string[], fieldNames: FieldNamesType, type: 'treeClose' | 'treeCheck'): void;
|
|
38
38
|
export declare const transformMessage: (obj: any, message: string) => string;
|
|
39
|
+
export declare const addLevelAndParentId: (tree: any[], fieldNames: any, currentLevel?: number, currentParentId?: any) => any[];
|