@zat-design/sisyphus-react 3.7.3-beta.9 → 3.8.0

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 (67) hide show
  1. package/dist/index.esm.css +21 -4
  2. package/dist/less.esm.css +21 -4
  3. package/es/ProEditTable/components/RenderField/index.js +1 -1
  4. package/es/ProEnum/components/Group.js +10 -2
  5. package/es/ProEnum/index.js +1 -1
  6. package/es/ProEnum/style/index.less +7 -1
  7. package/es/ProForm/components/combination/ProModalSelect/index.js +50 -45
  8. package/es/ProForm/components/combination/ProNumberRange/index.js +11 -4
  9. package/es/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  10. package/es/ProForm/components/render/ChangedWrapper.d.ts +1 -0
  11. package/es/ProForm/components/render/ChangedWrapper.js +26 -10
  12. package/es/ProForm/propsType.d.ts +1 -0
  13. package/es/ProForm/style/index.less +1 -1
  14. package/es/ProForm/utils/transformValue.js +17 -11
  15. package/es/ProSelect/index.js +3 -4
  16. package/es/ProSelect/utils/index.js +5 -4
  17. package/es/ProTable/components/FormatColumn/index.d.ts +7 -1
  18. package/es/ProTable/components/FormatColumn/index.js +14 -8
  19. package/es/ProTable/index.js +30 -13
  20. package/es/ProTable/propsType.d.ts +14 -1
  21. package/es/ProTable/style/index.less +1 -1
  22. package/es/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  23. package/es/ProTree/components/AdaptiveTooltip.js +55 -0
  24. package/es/ProTree/components/List.js +15 -3
  25. package/es/ProTree/components/ProTreeSelect/index.js +25 -5
  26. package/es/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  27. package/es/ProTree/components/SearchTitle.d.ts +2 -0
  28. package/es/ProTree/components/SearchTitle.js +17 -8
  29. package/es/ProTree/style/index.less +14 -0
  30. package/es/ProTreeModal/components/Tree.js +15 -17
  31. package/es/ProTreeModal/index.js +62 -7
  32. package/es/ProTreeModal/utils.d.ts +1 -0
  33. package/es/ProTreeModal/utils.js +21 -1
  34. package/es/style/theme/index.less +1 -1
  35. package/lib/ProEditTable/components/RenderField/index.js +1 -1
  36. package/lib/ProEnum/components/Group.js +10 -2
  37. package/lib/ProEnum/index.js +1 -1
  38. package/lib/ProEnum/style/index.less +7 -1
  39. package/lib/ProForm/components/combination/ProModalSelect/index.js +49 -44
  40. package/lib/ProForm/components/combination/ProNumberRange/index.js +11 -4
  41. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +5 -1
  42. package/lib/ProForm/components/render/ChangedWrapper.d.ts +1 -0
  43. package/lib/ProForm/components/render/ChangedWrapper.js +27 -11
  44. package/lib/ProForm/propsType.d.ts +1 -0
  45. package/lib/ProForm/style/index.less +1 -1
  46. package/lib/ProForm/utils/transformValue.js +17 -11
  47. package/lib/ProSelect/index.js +3 -4
  48. package/lib/ProSelect/utils/index.js +5 -4
  49. package/lib/ProTable/components/FormatColumn/index.d.ts +7 -1
  50. package/lib/ProTable/components/FormatColumn/index.js +14 -8
  51. package/lib/ProTable/index.js +30 -13
  52. package/lib/ProTable/propsType.d.ts +14 -1
  53. package/lib/ProTable/style/index.less +1 -1
  54. package/lib/ProTree/components/AdaptiveTooltip.d.ts +4 -0
  55. package/lib/ProTree/components/AdaptiveTooltip.js +61 -0
  56. package/lib/ProTree/components/List.js +15 -3
  57. package/lib/ProTree/components/ProTreeSelect/index.js +25 -5
  58. package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
  59. package/lib/ProTree/components/SearchTitle.d.ts +2 -0
  60. package/lib/ProTree/components/SearchTitle.js +19 -7
  61. package/lib/ProTree/style/index.less +14 -0
  62. package/lib/ProTreeModal/components/Tree.js +15 -17
  63. package/lib/ProTreeModal/index.js +61 -6
  64. package/lib/ProTreeModal/utils.d.ts +1 -0
  65. package/lib/ProTreeModal/utils.js +20 -0
  66. package/lib/style/theme/index.less +1 -1
  67. package/package.json +1 -1
@@ -296,8 +296,8 @@ export var ProSelect = function ProSelect(props, ref) {
296
296
  showArrow: true,
297
297
  loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
298
298
  onChange: handleChange,
299
- optionLabelProp: "children" // 解决warning报错,添加默认值
300
- ,
299
+ optionLabelProp: (otherProps === null || otherProps === void 0 ? void 0 : otherProps.isDiffChange) ? 'label' : 'children',
300
+ // optionLabelProp="label" // 解决warning报错,添加默认值
301
301
  showSearch: true,
302
302
  filterOption: isFunction(_onSearch) ? false : function (input, option) {
303
303
  var _option$children, _option$children$prop;
@@ -314,16 +314,15 @@ export var ProSelect = function ProSelect(props, ref) {
314
314
  value: transformValue(),
315
315
  children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
316
316
  return _jsx(Option, {
317
+ label: item[label],
317
318
  value: item[code],
318
319
  record: item,
319
320
  disabled: !!item.disabled,
320
321
  children: _jsx(TooltipOption, {
321
322
  title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
322
323
  children: OptionRender ? _jsx("span", {
323
- title: OptionRender(item),
324
324
  children: OptionRender(item)
325
325
  }) : _jsx("span", {
326
- title: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
327
326
  children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
328
327
  })
329
328
  }, item[code])
@@ -30,7 +30,7 @@ var findSelectNameValues = function findSelectNameValues(_ref) {
30
30
  _iterator.f();
31
31
  }
32
32
  if (mode === 'multiple') {
33
- selectValues = [].concat(_toConsumableArray(selectValues), _toConsumableArray(result));
33
+ selectValues = [].concat(_toConsumableArray(selectValues), _toConsumableArray(result || []));
34
34
  } else {
35
35
  selectValues.push(result);
36
36
  }
@@ -53,13 +53,14 @@ export var getSelectList = function getSelectList(_ref2) {
53
53
  if (!otherProps) {
54
54
  return null;
55
55
  }
56
- var listName = otherProps.listName,
56
+ var name = otherProps.name,
57
+ listName = otherProps.listName,
57
58
  form = otherProps.form;
58
59
  var firstNumberIndex = listName.lastIndexOf(listName.findLast(function (item) {
59
60
  return typeof item === 'number';
60
61
  }));
61
- var fatherName = listName.slice(0, firstNumberIndex);
62
- var selectName = listName.slice(firstNumberIndex + 1);
62
+ var fatherName = (name || listName).slice(0, firstNumberIndex);
63
+ var selectName = (name || listName).slice(firstNumberIndex + 1);
63
64
  return findSelectNameValues({
64
65
  list: form.getFieldValue(fatherName) || [],
65
66
  selectName: selectName,
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
2
2
  import { ProTableColumn } from '../../propsType';
3
- export declare const formatColumn: (column: ProTableColumn, originalObj: any, dataSourceObj: any, rowKey: any) => void;
3
+ export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, }: {
4
+ column: ProTableColumn;
5
+ originalObj: any;
6
+ dataSourceObj: any;
7
+ rowKey: any;
8
+ diffToolTip?: boolean;
9
+ }) => void;
4
10
  /**
5
11
  * 查找最近的父级className
6
12
  * @param element 当前node节点
@@ -11,7 +11,12 @@ import RenderColumn from '../RenderColumn';
11
11
  import { getDecimalDigits, getOriginalValue } from '../../utils';
12
12
  import getEnumLabel from '../../../ProEnum/utils/getEnumLabel';
13
13
  import ProForm from '../../../ProForm';
14
- export var formatColumn = function formatColumn(column, originalObj, dataSourceObj, rowKey) {
14
+ export var formatColumn = function formatColumn(_ref) {
15
+ var column = _ref.column,
16
+ originalObj = _ref.originalObj,
17
+ dataSourceObj = _ref.dataSourceObj,
18
+ rowKey = _ref.rowKey,
19
+ diffToolTip = _ref.diffToolTip;
15
20
  var title = column.title,
16
21
  valueType = column.valueType,
17
22
  _column$format = column.format,
@@ -31,6 +36,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
31
36
  originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
32
37
  _column$toolTipProps = column.toolTipProps,
33
38
  toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps;
39
+ var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
34
40
  // 前缀处理
35
41
  var prefixNode = function prefixNode(value, record, index) {
36
42
  if (!prefix) {
@@ -98,7 +104,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
98
104
  node: node,
99
105
  value: value,
100
106
  currentValue: renderValue,
101
- originalDiffTip: originalDiffTip,
107
+ originalDiffTip: _originalDiffTip,
102
108
  toolTipProps: toolTipProps
103
109
  });
104
110
  };
@@ -128,7 +134,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
128
134
  node: node,
129
135
  value: value,
130
136
  currentValue: renderValue,
131
- originalDiffTip: originalDiffTip,
137
+ originalDiffTip: _originalDiffTip,
132
138
  toolTipProps: toolTipProps
133
139
  });
134
140
  };
@@ -181,7 +187,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
181
187
  node: node,
182
188
  value: value,
183
189
  currentValue: renderValue,
184
- originalDiffTip: originalDiffTip,
190
+ originalDiffTip: _originalDiffTip,
185
191
  toolTipProps: toolTipProps
186
192
  });
187
193
  };
@@ -219,7 +225,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
219
225
  node: node,
220
226
  value: value,
221
227
  currentValue: renderValue,
222
- originalDiffTip: originalDiffTip,
228
+ originalDiffTip: _originalDiffTip,
223
229
  toolTipProps: toolTipProps
224
230
  });
225
231
  };
@@ -246,7 +252,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
246
252
  node: node,
247
253
  value: value,
248
254
  currentValue: renderValue,
249
- originalDiffTip: originalDiffTip,
255
+ originalDiffTip: _originalDiffTip,
250
256
  toolTipProps: toolTipProps
251
257
  });
252
258
  };
@@ -323,7 +329,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
323
329
  node: value,
324
330
  value: value,
325
331
  currentValue: value || '-',
326
- originalDiffTip: originalDiffTip,
332
+ originalDiffTip: _originalDiffTip,
327
333
  toolTipProps: toolTipProps
328
334
  }), suffixNode(value, record, index)]
329
335
  });
@@ -346,7 +352,7 @@ export var formatColumn = function formatColumn(column, originalObj, dataSourceO
346
352
  node: node,
347
353
  value: value,
348
354
  currentValue: value || '-',
349
- originalDiffTip: originalDiffTip,
355
+ originalDiffTip: _originalDiffTip,
350
356
  toolTipProps: toolTipProps
351
357
  });
352
358
  };
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
7
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
8
- var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "originalDataSource", "onDragStart", "onDragEnd"],
8
+ var _excluded = ["tableId", "headerRender", "footerRender", "quickConfig", "stripe", "columns", "className", "draggable", "disabled", "isView", "rowDisabled", "summary", "emptyText", "diffConfig", "onDragStart", "onDragEnd"],
9
9
  _excluded2 = ["resizeColumn", "columnConfig", "cacheTime", "storage"];
10
10
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useEffect, useMemo, useState, createContext } from 'react';
@@ -52,10 +52,15 @@ function ProTable(props) {
52
52
  summary = props.summary,
53
53
  _props$emptyText = props.emptyText,
54
54
  emptyText = _props$emptyText === void 0 ? locale === null || locale === void 0 ? void 0 : (_locale$ProTable = locale.ProTable) === null || _locale$ProTable === void 0 ? void 0 : _locale$ProTable.noData : _props$emptyText,
55
- originalDataSource = props.originalDataSource,
55
+ diffConfig = props.diffConfig,
56
56
  onDragStartGuard = props.onDragStart,
57
57
  onDragEndGuard = props.onDragEnd,
58
58
  restProps = _objectWithoutProperties(props, _excluded);
59
+ var _ref3 = diffConfig || {},
60
+ originalDataSource = _ref3.originalDataSource,
61
+ changeTipColor = _ref3.changeTipColor,
62
+ addTipColor = _ref3.addTipColor,
63
+ toolTip = _ref3.toolTip;
59
64
  var quickTableConfig = quickConfig ? _objectSpread({
60
65
  columnConfig: true,
61
66
  cacheTime: true
@@ -71,10 +76,10 @@ function ProTable(props) {
71
76
  _quickTableConfig$sto = quickTableConfig.storage,
72
77
  storage = _quickTableConfig$sto === void 0 ? configStorage : _quickTableConfig$sto,
73
78
  tableProps = _objectWithoutProperties(quickTableConfig, _excluded2);
74
- var _ref3 = tableProps || {},
75
- pagination = _ref3.pagination,
76
- dataSource = _ref3.dataSource,
77
- rowKey = _ref3.rowKey;
79
+ var _ref4 = tableProps || {},
80
+ pagination = _ref4.pagination,
81
+ dataSource = _ref4.dataSource,
82
+ rowKey = _ref4.rowKey;
78
83
  var initDataSource = dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
79
84
  return _objectSpread(_objectSpread({}, item), {}, {
80
85
  rowKey: getRowKey(rowKey, item)
@@ -157,8 +162,8 @@ function ProTable(props) {
157
162
  };
158
163
  // 列宽resize函数
159
164
  var handleResize = function handleResize(index) {
160
- return function (e, _ref4) {
161
- var size = _ref4.size;
165
+ return function (e, _ref5) {
166
+ var size = _ref5.size;
162
167
  var nextColumns = _toConsumableArray(curColumns);
163
168
  nextColumns[index] = _objectSpread(_objectSpread({}, nextColumns[index]), {}, {
164
169
  width: size.width
@@ -188,7 +193,13 @@ function ProTable(props) {
188
193
  return !(item === null || item === void 0 ? void 0 : item.delete);
189
194
  });
190
195
  newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item) {
191
- formatColumn(item, originalObj, dataSourceObj, 'rowKey');
196
+ formatColumn({
197
+ column: item,
198
+ originalObj: originalObj,
199
+ dataSourceObj: dataSourceObj,
200
+ rowKey: 'rowKey',
201
+ diffToolTip: toolTip
202
+ });
192
203
  });
193
204
  return newColumns;
194
205
  }, [curColumns, handleResize]);
@@ -205,7 +216,7 @@ function ProTable(props) {
205
216
  });
206
217
  }, [columns]);
207
218
  var handleColumnConfig = /*#__PURE__*/function () {
208
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
219
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
209
220
  var newColumns, _columnConfig$onColum, catchColumns;
210
221
  return _regeneratorRuntime().wrap(function _callee$(_context) {
211
222
  while (1) switch (_context.prev = _context.next) {
@@ -241,7 +252,7 @@ function ProTable(props) {
241
252
  }, _callee);
242
253
  }));
243
254
  return function handleColumnConfig(_x) {
244
- return _ref5.apply(this, arguments);
255
+ return _ref6.apply(this, arguments);
245
256
  };
246
257
  }();
247
258
  useDebounceEffect(function () {
@@ -314,7 +325,7 @@ function ProTable(props) {
314
325
  return _rowSelection;
315
326
  };
316
327
  var onDataSourceChange = /*#__PURE__*/function () {
317
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(nextDataSource) {
328
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(nextDataSource) {
318
329
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
319
330
  while (1) switch (_context2.prev = _context2.next) {
320
331
  case 0:
@@ -330,7 +341,7 @@ function ProTable(props) {
330
341
  }, _callee2);
331
342
  }));
332
343
  return function onDataSourceChange(_x2) {
333
- return _ref6.apply(this, arguments);
344
+ return _ref7.apply(this, arguments);
334
345
  };
335
346
  }();
336
347
  var _rowClassName = function _rowClassName(record, index) {
@@ -339,6 +350,11 @@ function ProTable(props) {
339
350
  }
340
351
  };
341
352
  var TableComponent = draggable ? DraggableTable : BaseTable;
353
+ // 标记样式
354
+ var tagStyle = {
355
+ '--zaui-contract-bg': changeTipColor,
356
+ '--zaui-contract-bg-add': addTipColor
357
+ };
342
358
  return _jsx(TableContext.Provider, {
343
359
  value: {
344
360
  pathKey: pathKey,
@@ -362,6 +378,7 @@ function ProTable(props) {
362
378
  }
363
379
  }), _jsxs("div", {
364
380
  className: "pro-table-container",
381
+ style: tagStyle,
365
382
  children: [_jsx(TableComponent, _objectSpread(_objectSpread({}, restProps), {}, {
366
383
  draggableProps: {
367
384
  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
- originalDataSource?: any[];
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, #fffaa1);
273
+ background: var(--zaui-contract-bg; #fffaa1) !important;
274
274
  border-radius: var(--zaui-border-radius, 8px);
275
275
  }
276
276
 
@@ -0,0 +1,4 @@
1
+ declare const AdaptiveTooltip: ({ children }: {
2
+ children: any;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default AdaptiveTooltip;
@@ -0,0 +1,55 @@
1
+ import "antd/es/tooltip/style";
2
+ import _Tooltip from "antd/es/tooltip";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
5
+ /*
6
+ * @Author: za-xuwenli xuwenli@zhongan.io
7
+ * @Date: 2024-09-20 10:26:04
8
+ * @LastEditors: za-xuwenli xuwenli@zhongan.io
9
+ * @LastEditTime: 2024-09-26 14:12:44
10
+ * @FilePath: /za-material-warehouse/src/ProTree/components/AdaptiveTooltip.tsx
11
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
12
+ */
13
+
14
+ import { useEffect, useState } from 'react';
15
+ var AdaptiveTooltip = function AdaptiveTooltip(_ref) {
16
+ var children = _ref.children;
17
+ var _useState = useState('right'),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ placement = _useState2[0],
20
+ setPlacement = _useState2[1];
21
+ useEffect(function () {
22
+ var handleResize = function handleResize() {
23
+ var tooltipElement = document.getElementById('adaptive-tooltip');
24
+ if (tooltipElement) {
25
+ var boundingRect = tooltipElement.getBoundingClientRect();
26
+ var windowWidth = window.innerWidth;
27
+ if (windowWidth - boundingRect.right < 150) {
28
+ setPlacement('left');
29
+ } else {
30
+ setPlacement('right');
31
+ }
32
+ }
33
+ };
34
+ window.addEventListener('resize', handleResize);
35
+ handleResize();
36
+ return function () {
37
+ window.removeEventListener('resize', handleResize);
38
+ };
39
+ }, [children]);
40
+ return _jsx(_Tooltip, {
41
+ placement: placement,
42
+ title: _jsx("div", {
43
+ onMouseDown: function onMouseDown(e) {
44
+ return e.stopPropagation();
45
+ },
46
+ children: children
47
+ }),
48
+ id: "adaptive-tooltip",
49
+ children: _jsxs("span", {
50
+ className: "pro-tree-wrap-ellipse",
51
+ children: [" ", children]
52
+ })
53
+ });
54
+ };
55
+ export default AdaptiveTooltip;
@@ -1,6 +1,17 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import "antd/es/checkbox/style";
2
3
  import _Checkbox from "antd/es/checkbox";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["checkedValues", "disabled", "treeData", "searchStr", "showCodeName", "mode", "fieldNames", "handleOnChange", "handleFilterClose", "optionRender"];
3
6
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
+ /*
8
+ * @Author: za-xuwenli xuwenli@zhongan.io
9
+ * @Date: 2024-07-03 11:02:19
10
+ * @LastEditors: za-xuwenli xuwenli@zhongan.io
11
+ * @LastEditTime: 2024-09-26 14:30:26
12
+ * @FilePath: /za-material-warehouse/src/ProTree/components/List.tsx
13
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
14
+ */
4
15
  import { memo } from 'react';
5
16
  import SearchTitle from './SearchTitle';
6
17
  import CloseIcon from './CloseIcon';
@@ -15,7 +26,8 @@ function List(props) {
15
26
  fieldNames = props.fieldNames,
16
27
  handleOnChange = props.handleOnChange,
17
28
  handleFilterClose = props.handleFilterClose,
18
- optionRender = props.optionRender;
29
+ optionRender = props.optionRender,
30
+ other = _objectWithoutProperties(props, _excluded);
19
31
  var fieldNameLabel = fieldNames.label;
20
32
  var fieldNameValue = fieldNames.value;
21
33
  if (mode === 'render') {
@@ -37,10 +49,10 @@ function List(props) {
37
49
  value: item[fieldNameValue],
38
50
  disabled: item.disabled,
39
51
  children: _jsx("span", {
40
- children: optionRender ? optionRender(item, searchStr) : _jsx(SearchTitle, {
52
+ children: optionRender ? optionRender(item, searchStr) : _jsx(SearchTitle, _objectSpread({
41
53
  label: title,
42
54
  searchStr: searchStr
43
- })
55
+ }, other))
44
56
  })
45
57
  })
46
58
  }, item[fieldNameValue]);
@@ -21,6 +21,7 @@ import { useImperativeHandle, forwardRef } from 'react';
21
21
  import { cloneDeep } from 'lodash';
22
22
  import { useProConfig } from '../../../ProConfigProvider';
23
23
  import Container from '../../../ProForm/components/Container';
24
+ import AdaptiveTooltip from '../AdaptiveTooltip';
24
25
  var SHOW_PARENT = _TreeSelect.SHOW_PARENT;
25
26
  export var ProTreeSelect = function ProTreeSelect(props, ref) {
26
27
  // 全局属性配置在ConfigProvider
@@ -74,9 +75,14 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
74
75
  selectProps = _objectWithoutProperties(props, _excluded);
75
76
  var _props$value = props.value,
76
77
  value = _props$value === void 0 ? undefined : _props$value;
77
- var _ref2 = otherProps || {},
78
- isView = _ref2.isView,
79
- viewEmpty = _ref2.viewEmpty;
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
+ var _showEllipse = showEllipse && !isDiffChange;
83
+ var _ref3 = otherProps || {},
84
+ isView = _ref3.isView,
85
+ viewEmpty = _ref3.viewEmpty;
80
86
  if (fieldNames && Object.keys(fieldNames).length) {
81
87
  code = fieldNames.value || 'value';
82
88
  label = fieldNames.label || 'label';
@@ -209,8 +215,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
209
215
  return undefined;
210
216
  }
211
217
  // 如果配置手动加载,不执行请求
212
- var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
213
- defaultParams = _ref3.defaultParams;
218
+ var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
219
+ defaultParams = _ref4.defaultParams;
214
220
  // 执行用户配置的枚举服务,拉取枚举数据进行更新
215
221
  fetchFunction.run(defaultParams);
216
222
  }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, defaultDisableValue]);
@@ -312,6 +318,20 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
312
318
  children: _jsx(Icon, {})
313
319
  }) : null]
314
320
  });
321
+ if (_showEllipse) {
322
+ title = _jsx(AdaptiveTooltip, {
323
+ children: treeCheckable ? titleHtml : _jsxs("span", {
324
+ className: "check-option-text",
325
+ children: [_jsx("span", {
326
+ className: "check-option-text-content",
327
+ children: titleHtml
328
+ }), !disabled ? _jsx("span", {
329
+ className: "check-mark-icon",
330
+ children: _jsx(Icon, {})
331
+ }) : null]
332
+ })
333
+ });
334
+ }
315
335
  if (!children) {
316
336
  return _jsx(_TreeSelect.TreeNode, {
317
337
  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 */
@@ -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,13 +1,24 @@
1
- import "antd/es/tooltip/style";
2
- import _Tooltip from "antd/es/tooltip";
3
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * @Author: za-xuwenli xuwenli@zhongan.io
4
+ * @Date: 2024-09-26 14:37:00
5
+ * @LastEditors: za-xuwenli xuwenli@zhongan.io
6
+ * @LastEditTime: 2024-09-26 17:50:59
7
+ * @FilePath: /za-material-warehouse/src/ProTree/components/SearchTitle.tsx
8
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
9
+ */
4
10
  import { memo } from 'react';
11
+ import AdaptiveTooltip from './AdaptiveTooltip';
5
12
  function SearchTitle(props) {
6
13
  var label = props.label,
7
14
  _props$searchStr = props.searchStr,
8
15
  searchStr = _props$searchStr === void 0 ? '' : _props$searchStr,
9
16
  showEllipse = props.showEllipse,
10
- ellipseWidth = props.ellipseWidth;
17
+ ellipseWidth = props.ellipseWidth,
18
+ otherProps = props.otherProps;
19
+ var _ref = otherProps !== null && otherProps !== void 0 ? otherProps : {},
20
+ _ref$isDiffChange = _ref.isDiffChange,
21
+ isDiffChange = _ref$isDiffChange === void 0 ? false : _ref$isDiffChange;
11
22
  var strTitle = label;
12
23
  var index = strTitle === null || strTitle === void 0 ? void 0 : strTitle.indexOf(searchStr);
13
24
  var beforeStr = strTitle === null || strTitle === void 0 ? void 0 : strTitle.substring(0, index);
@@ -40,11 +51,9 @@ function SearchTitle(props) {
40
51
  style: style,
41
52
  children: strTitle
42
53
  });
43
- if (classEllipse) {
44
- return _jsx(_Tooltip, {
45
- title: titleTips,
46
- placement: "rightTop",
47
- children: title
54
+ if (classEllipse && !isDiffChange) {
55
+ return _jsx(AdaptiveTooltip, {
56
+ children: titleTips
48
57
  });
49
58
  }
50
59
  return title;
@@ -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
+ }
@@ -177,23 +177,21 @@ function List(props, ref) {
177
177
  setAutoExpandParent(false);
178
178
  };
179
179
  if (mode === 'render') {
180
- return _jsx(_Fragment, {
181
- children: _jsx(_Tree, {
182
- disabled: disabled,
183
- style: {
184
- width: '100%'
185
- },
186
- checkable: true,
187
- treeData: _treeData,
188
- onExpand: onExpand,
189
- expandedKeys: expandedKeys,
190
- autoExpandParent: autoExpandParent,
191
- selectable: false,
192
- onCheck: onCheck,
193
- checkedKeys: checkedValues,
194
- checkStrictly: checkStrictly,
195
- height: 432
196
- })
180
+ return _jsx(_Tree, {
181
+ disabled: disabled,
182
+ style: {
183
+ width: '100%'
184
+ },
185
+ checkable: true,
186
+ treeData: _treeData,
187
+ onExpand: onExpand,
188
+ expandedKeys: expandedKeys,
189
+ autoExpandParent: autoExpandParent,
190
+ selectable: false,
191
+ onCheck: onCheck,
192
+ checkedKeys: checkedValues,
193
+ checkStrictly: searchStr ? true : checkStrictly,
194
+ height: 432
197
195
  });
198
196
  }
199
197
  return _jsx(_Fragment, {