@zat-design/sisyphus-react 3.13.2 → 3.13.3-beta.1

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 (61) hide show
  1. package/README.md +1 -1
  2. package/dist/index.esm.css +3 -0
  3. package/es/FormsProvider/index.d.ts +2 -2
  4. package/es/ProForm/components/FormFooter/index.js +14 -1
  5. package/es/ProForm/components/FormFooter/propsType.d.ts +2 -1
  6. package/es/ProForm/components/base/DatePicker/index.js +0 -9
  7. package/es/ProForm/components/base/RangePicker/index.js +0 -8
  8. package/es/ProForm/components/render/Render.js +4 -2
  9. package/es/ProForm/index.js +13 -3
  10. package/es/ProForm/propsType.d.ts +2 -0
  11. package/es/ProForm/utils/index.d.ts +7 -2
  12. package/es/ProForm/utils/index.js +19 -1
  13. package/es/ProForm/utils/useForm.d.ts +7 -2
  14. package/es/ProForm/utils/useForm.js +87 -20
  15. package/es/ProForm/utils/useWatch.d.ts +8 -3
  16. package/es/ProForm/utils/useWatch.js +136 -54
  17. package/es/ProTable/components/RcTable/components/DraggableTable/index.js +0 -9
  18. package/es/ProTable/components/RenderTabs/index.js +7 -2
  19. package/es/ProTable/hooks/useAntdTable.js +8 -13
  20. package/es/ProTable/propsType.d.ts +6 -6
  21. package/es/ProTable/utils/index.d.ts +0 -1
  22. package/es/ProTable/utils/index.js +0 -1
  23. package/es/ProTooltip/index.js +9 -2
  24. package/es/ProTooltip/propsType.d.ts +2 -3
  25. package/es/ProTree/components/AdaptiveTooltip.js +0 -9
  26. package/es/ProTree/components/List.js +0 -8
  27. package/es/ProTree/components/SearchTitle.js +0 -8
  28. package/es/ProTreeModal/index.js +0 -8
  29. package/es/ProUpload/components/ImageRender.js +0 -9
  30. package/es/ProUpload/index.js +0 -7
  31. package/es/style/theme/antd.less +5 -0
  32. package/lib/FormsProvider/index.d.ts +2 -2
  33. package/lib/ProForm/components/FormFooter/index.js +14 -1
  34. package/lib/ProForm/components/FormFooter/propsType.d.ts +2 -1
  35. package/lib/ProForm/components/base/DatePicker/index.js +0 -8
  36. package/lib/ProForm/components/base/RangePicker/index.js +1 -10
  37. package/lib/ProForm/components/render/Render.js +4 -2
  38. package/lib/ProForm/index.js +11 -1
  39. package/lib/ProForm/propsType.d.ts +2 -0
  40. package/lib/ProForm/utils/index.d.ts +7 -2
  41. package/lib/ProForm/utils/index.js +20 -2
  42. package/lib/ProForm/utils/useForm.d.ts +7 -2
  43. package/lib/ProForm/utils/useForm.js +86 -19
  44. package/lib/ProForm/utils/useWatch.d.ts +8 -3
  45. package/lib/ProForm/utils/useWatch.js +136 -56
  46. package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +0 -8
  47. package/lib/ProTable/components/RenderTabs/index.js +7 -2
  48. package/lib/ProTable/hooks/useAntdTable.js +6 -13
  49. package/lib/ProTable/propsType.d.ts +6 -6
  50. package/lib/ProTable/utils/index.d.ts +0 -1
  51. package/lib/ProTable/utils/index.js +0 -1
  52. package/lib/ProTooltip/index.js +9 -2
  53. package/lib/ProTooltip/propsType.d.ts +2 -3
  54. package/lib/ProTree/components/AdaptiveTooltip.js +0 -9
  55. package/lib/ProTree/components/List.js +0 -8
  56. package/lib/ProTree/components/SearchTitle.js +0 -9
  57. package/lib/ProTreeModal/index.js +0 -9
  58. package/lib/ProUpload/components/ImageRender.js +0 -9
  59. package/lib/ProUpload/index.js +0 -7
  60. package/lib/style/theme/antd.less +5 -0
  61. package/package.json +2 -2
@@ -1,77 +1,159 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import { debounce } from 'lodash';
3
- import { HOOK_MARK } from 'rc-field-form/es/FieldContext';
4
4
  import warning from 'rc-util/lib/warning';
5
5
  import { useState, useEffect, useRef, useMemo } from 'react';
6
+ import isEqual from 'lodash/isEqual';
6
7
  export function toArray(value) {
7
8
  if (value === undefined || value === null) {
8
9
  return [];
9
10
  }
10
11
  return Array.isArray(value) ? value : [value];
11
12
  }
12
- export function getNamePath(path) {
13
- return toArray(path);
13
+ // 从一个对象或Form值中获取特定路径的值
14
+ function get(source, path) {
15
+ if (!source || path.length === 0) {
16
+ return source;
17
+ }
18
+ var current = source;
19
+ for (var i = 0; i < path.length; i++) {
20
+ if (current === undefined || current === null) {
21
+ return undefined;
22
+ }
23
+ current = current[path[i]];
24
+ }
25
+ return current;
14
26
  }
15
- export function stringify(value) {
16
- try {
17
- return JSON.stringify(value);
18
- } catch (err) {
19
- return Math.random();
27
+ /**
28
+ * 将值设置到指定路径的嵌套对象中
29
+ * @param obj 目标对象
30
+ * @param path 路径数组
31
+ * @param value 要设置的值
32
+ */
33
+ function setValueByPath(obj, path, value) {
34
+ if (path.length === 0) return;
35
+ // 处理单层路径
36
+ if (path.length === 1) {
37
+ obj[path[0]] = value;
38
+ return;
39
+ }
40
+ // 处理多层嵌套路径
41
+ var current = obj;
42
+ for (var i = 0; i < path.length - 1; i++) {
43
+ var key = path[i];
44
+ if (!current[key]) {
45
+ current[key] = {};
46
+ }
47
+ current = current[key];
20
48
  }
49
+ current[path[path.length - 1]] = value;
21
50
  }
22
- // 创建之后namepath就不可变
23
- var useWatchWarning = process.env.NODE_ENV !== 'production' ? function (namePath) {
24
- var fullyStr = JSON.stringify(namePath);
25
- var nameStrRef = useRef(fullyStr);
26
- warning(nameStrRef.current === fullyStr, '`useWatch` is not support dynamic `namePath`. Please provide static instead.');
51
+ // 创建之后namepath就不可变的警告
52
+ var useWatchWarning = process.env.NODE_ENV !== 'production' ? function (dependencies) {
53
+ var depsStr = JSON.stringify(dependencies);
54
+ var depsStrRef = useRef(depsStr);
55
+ warning(depsStrRef.current === depsStr, '`useWatch` is not support dynamic `namePath`. Please provide static instead.');
27
56
  } : function () {};
57
+ /**
58
+ * ProForm的useWatch hook,用于监听表单字段变化
59
+ * @param dependencies 监听的字段路径
60
+ * @param form 表单实例
61
+ * @param wait 防抖等待时间
62
+ * @returns 表单值
63
+ */
28
64
  function useWatch(dependencies, form, wait) {
29
- var isSingle = typeof dependencies === 'string';
65
+ // 处理开发环境警告
66
+ useWatchWarning(dependencies);
67
+ // 获取表单实例
68
+ var formInstance = form;
69
+ // 用于存储最终结果
30
70
  var _useState = useState({}),
31
71
  _useState2 = _slicedToArray(_useState, 2),
32
- value = _useState2[0],
33
- setValue = _useState2[1];
34
- var valueStr = useMemo(function () {
35
- return stringify(value);
36
- }, [value]);
37
- var valueStrRef = useRef(valueStr);
38
- valueStrRef.current = valueStr;
39
- var formInstance = form;
40
- var isValidForm = formInstance && formInstance._init;
41
- var _dependencies = isSingle ? [dependencies] : dependencies;
42
- var namePaths = _dependencies === null || _dependencies === void 0 ? void 0 : _dependencies.map(function (item) {
43
- return getNamePath(item);
44
- });
45
- var namePathsRef = useRef(namePaths);
46
- namePathsRef.current = namePaths;
47
- useWatchWarning(namePaths);
72
+ state = _useState2[0],
73
+ setState = _useState2[1];
74
+ // 使用ref存储中间状态,避免不必要的渲染
75
+ var valueRef = useRef({});
76
+ var prevStateRef = useRef({});
77
+ // 标准化依赖为路径数组的数组
78
+ var namePaths = useMemo(function () {
79
+ // 将依赖标准化为数组的数组形式
80
+ var paths = [];
81
+ // 字符串形式: 'fieldName'
82
+ if (typeof dependencies === 'string') {
83
+ paths.push(dependencies);
84
+ // 数组形式
85
+ } else if (Array.isArray(dependencies)) {
86
+ // 检查是否是路径数组的集合,例如:[['a', 'number'], 'fieldName']
87
+ var isPathsCollection = dependencies.length > 0 && (typeof dependencies[0] === 'string' || Array.isArray(dependencies[0]));
88
+ if (isPathsCollection) {
89
+ // 每个元素都是一个路径
90
+ dependencies.forEach(function (path) {
91
+ paths.push(path);
92
+ });
93
+ } else {
94
+ // 整个数组是一个单一路径
95
+ paths.push(dependencies);
96
+ }
97
+ }
98
+ return paths;
99
+ }, [/* dependencies 故意忽略,与原实现一致 */]);
100
+ // 保存防抖函数引用,避免重复创建
101
+ var debouncedFn = useMemo(function () {
102
+ if (wait) {
103
+ return debounce(function (value) {
104
+ // 只在值真正变化时才更新状态
105
+ if (!isEqual(prevStateRef.current, value)) {
106
+ prevStateRef.current = _objectSpread({}, value);
107
+ setState(value);
108
+ }
109
+ }, wait);
110
+ }
111
+ // 非防抖版本
112
+ return function (value) {
113
+ if (!isEqual(prevStateRef.current, value)) {
114
+ prevStateRef.current = _objectSpread({}, value);
115
+ setState(value);
116
+ }
117
+ };
118
+ }, [wait]);
48
119
  useEffect(function () {
49
- if (!isValidForm) return;
50
- var getFieldsValue = formInstance.getFieldsValue,
51
- getInternalHooks = formInstance.getInternalHooks;
52
- var _getInternalHooks = getInternalHooks(HOOK_MARK),
120
+ if (!formInstance) return undefined;
121
+ // 创建更新状态的函数
122
+ var updateState = function updateState() {
123
+ var values = formInstance.getFieldsValue(true);
124
+ var newState = {};
125
+ // 处理每个监听路径
126
+ namePaths.forEach(function (path) {
127
+ // 将路径转换为数组形式
128
+ var namePath = toArray(path);
129
+ // 获取路径对应的值
130
+ var value = get(values, namePath);
131
+ // 将值设置到正确的嵌套结构中
132
+ setValueByPath(newState, namePath, value);
133
+ });
134
+ // 存储并更新状态
135
+ valueRef.current = newState;
136
+ debouncedFn(newState);
137
+ };
138
+ // 初始调用一次
139
+ updateState();
140
+ // 注册表单变化监听
141
+ var getInternalHooks = formInstance.getInternalHooks;
142
+ var _getInternalHooks = getInternalHooks('RC_FORM_INTERNAL_HOOKS'),
53
143
  registerWatch = _getInternalHooks.registerWatch;
54
- var callback = function callback() {
55
- var newValue = getFieldsValue(_dependencies);
56
- var nextValueStr = stringify(newValue);
57
- // Compare stringify in case it's nest object
58
- if (valueStrRef.current !== nextValueStr) {
59
- valueStrRef.current = nextValueStr;
60
- setValue(getFieldsValue(_dependencies));
144
+ var cancelWatch = registerWatch(function (values) {
145
+ if (values) {
146
+ updateState();
147
+ }
148
+ });
149
+ // 清理订阅
150
+ return function () {
151
+ if (wait) {
152
+ debouncedFn.cancel();
61
153
  }
154
+ cancelWatch();
62
155
  };
63
- // 增加防抖
64
- if (wait) {
65
- callback = debounce(callback, wait);
66
- }
67
- var cancelRegister = registerWatch(callback);
68
- var initialValue = getFieldsValue(_dependencies);
69
- setValue(initialValue);
70
- return cancelRegister;
71
- },
72
- // We do not need re-register since namePath content is the same
73
- // eslint-disable-next-line react-hooks/exhaustive-deps
74
- [isValidForm]);
75
- return value;
156
+ }, [formInstance, namePaths, debouncedFn, wait]);
157
+ return state;
76
158
  }
77
159
  export default useWatch;
@@ -4,15 +4,6 @@ import _Table from "antd/es/table";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  var _excluded = ["dataSource", "tableProps", "draggableProps", "summaryProps", "emptyTextProps"];
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- /*
8
- * @Author: ''
9
- * @Date: 2024-08-09 13:48:59
10
- * @LastEditors: ''
11
- * @LastEditTime: 2024-08-27 15:27:44
12
- * @FilePath: /za-material-warehouse/src/ProTable/components/RcTable/components/DraggableTable/index.tsx
13
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
14
- */
15
-
16
7
  import { memo } from 'react';
17
8
  import DndWrapper, { Row } from './components/DndWrapper';
18
9
  import { RenderEmptyText, RenderSummary } from '../../../index';
@@ -16,7 +16,8 @@ var RenderTabs = function RenderTabs(props) {
16
16
  transformResponse = props.transformResponse,
17
17
  tabsProps = props.tabsProps,
18
18
  name = props.name,
19
- formTableProps = props.formTableProps;
19
+ formTableProps = props.formTableProps,
20
+ transformParams = props.transformParams;
20
21
  var _ref = formTableProps || {},
21
22
  form = _ref.form,
22
23
  onSearch = _ref.onSearch;
@@ -67,7 +68,11 @@ var RenderTabs = function RenderTabs(props) {
67
68
  var fieldsValues = (form === null || form === void 0 ? void 0 : form.getFieldsValue()) || {};
68
69
  setActiveKey(key);
69
70
  form.setFieldValue(name, key);
70
- onSearch === null || onSearch === void 0 ? void 0 : onSearch(_objectSpread(_objectSpread({}, fieldsValues), {}, _defineProperty({}, name, key)));
71
+ var params = _objectSpread(_objectSpread({}, fieldsValues), {}, _defineProperty({}, name, key));
72
+ if (transformParams && typeof transformParams === 'function') {
73
+ params = transformParams(params);
74
+ }
75
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(params);
71
76
  },
72
77
  type: "card"
73
78
  }, tabsProps), {}, {
@@ -4,6 +4,8 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
4
  import "antd/es/message/style";
5
5
  import _message from "antd/es/message";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
+ import "antd/es/form/style";
8
+ import _Form from "antd/es/form";
7
9
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
8
10
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
11
  var _excluded = ["page", "filters", "sorter"];
@@ -26,13 +28,12 @@ var useDefaultOptions = function useDefaultOptions(options) {
26
28
  };
27
29
  var previousSearchValues = null;
28
30
  function useAntdTable(service, options, useRequestOptions) {
29
- var _locale$ProTable2, _locale$ProTable3, _locale$ProTable4, _locale$ProTable5;
31
+ var _locale$ProTable2, _locale$ProTable3, _locale$ProTable4, _locale$ProTable5, _result$params;
30
32
  var _useSetState = useSetState({
31
33
  data: [],
32
34
  total: 0,
33
35
  selectedRecords: [],
34
36
  selectedRowKeys: [],
35
- searchValues: undefined,
36
37
  extraFilter: {
37
38
  filters: undefined,
38
39
  sorter: undefined
@@ -45,7 +46,6 @@ function useAntdTable(service, options, useRequestOptions) {
45
46
  total = _useSetState2$.total,
46
47
  selectedRecords = _useSetState2$.selectedRecords,
47
48
  selectedRowKeys = _useSetState2$.selectedRowKeys,
48
- searchValues = _useSetState2$.searchValues,
49
49
  extraFilter = _useSetState2$.extraFilter,
50
50
  allSelected = _useSetState2$.allSelected,
51
51
  setState = _useSetState2[1];
@@ -66,6 +66,9 @@ function useAntdTable(service, options, useRequestOptions) {
66
66
  transformParams = _useDefaultOptions.transformParams,
67
67
  transformResponse = _useDefaultOptions.transformResponse,
68
68
  disabled = _useDefaultOptions.disabled;
69
+ // 搜索表单里的值
70
+ var _searchValues = _Form.useWatch([], form);
71
+ var searchValues = removeEmptyKeys(_searchValues);
69
72
  var _ref = useRequestOptions || {},
70
73
  defaultParams = _ref.defaultParams;
71
74
  var defaultParam = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
@@ -103,12 +106,6 @@ function useAntdTable(service, options, useRequestOptions) {
103
106
  allSelected: false
104
107
  }, values));
105
108
  };
106
- var params = useMemo(function () {
107
- var newQueryBean = _objectSpread(_objectSpread({}, searchValues), extraFilter);
108
- return getTransformParams(_objectSpread({
109
- page: page
110
- }, newQueryBean));
111
- }, [page, searchValues, extraFilter]);
112
109
  var curService = useMemo(function () {
113
110
  return service.toString();
114
111
  }, [service]);
@@ -247,10 +244,9 @@ function useAntdTable(service, options, useRequestOptions) {
247
244
  onPageChange(newPage);
248
245
  }
249
246
  // 减少查询按钮的渲染,只有需要重置值时才需要调用
250
- if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) || isNonEmptyObject(_values) && !isEqual(previousSearchValues, _values)) {
247
+ if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) || isNonEmptyObject(_values) || !isEqual(previousSearchValues, _values)) {
251
248
  previousSearchValues = _values;
252
249
  setState({
253
- searchValues: _values,
254
250
  allSelected: false,
255
251
  selectedRecords: [],
256
252
  selectedRowKeys: []
@@ -262,7 +258,6 @@ function useAntdTable(service, options, useRequestOptions) {
262
258
  }, [extraFilter, page.pageSize, previousPage, getTransformParams]);
263
259
  var resetParams = useCallback(function (page) {
264
260
  setState({
265
- searchValues: undefined,
266
261
  allSelected: false,
267
262
  selectedRecords: [],
268
263
  selectedRowKeys: [],
@@ -477,7 +472,7 @@ function useAntdTable(service, options, useRequestOptions) {
477
472
  };
478
473
  var useAntdTableProps = _objectSpread(_objectSpread({}, result), {}, {
479
474
  data: data,
480
- params: params,
475
+ params: (result === null || result === void 0 ? void 0 : (_result$params = result.params) === null || _result$params === void 0 ? void 0 : _result$params[0]) || {},
481
476
  rowSelection: rowSelection,
482
477
  searchValues: searchValues,
483
478
  allSelected: allSelected,
@@ -337,6 +337,12 @@ export interface ProTableTabsType {
337
337
  label: string;
338
338
  value: string;
339
339
  }[];
340
+ /**
341
+ * 转换查询参数
342
+ * @description 转换查询参数
343
+ * @default undefined
344
+ */
345
+ transformParams?: (params: any) => any;
340
346
  /**
341
347
  * 枚举数据源转换
342
348
  * @description 枚举数据源转换
@@ -729,12 +735,6 @@ export interface ProTableUseAntdTableType<I, R> {
729
735
  * @default []
730
736
  */
731
737
  selectedRowKeys: Key[];
732
- /**
733
- * 搜索值
734
- * @description 当前表单的搜索条件
735
- * @default undefined
736
- */
737
- searchValues: I;
738
738
  /**
739
739
  * 额外过滤条件
740
740
  * @description 表单之外的额外过滤条件
@@ -6,7 +6,6 @@
6
6
  export declare const getDecimalDigits: (num?: number) => number;
7
7
  /**
8
8
  * @description: 获取初始值
9
- * @author: xiangchengli
10
9
  * @param {any} rowKey
11
10
  * @param any value
12
11
  * @param any originalObj
@@ -15,7 +15,6 @@ export var getDecimalDigits = function getDecimalDigits() {
15
15
  };
16
16
  /**
17
17
  * @description: 获取初始值
18
- * @author: xiangchengli
19
18
  * @param {any} rowKey
20
19
  * @param any value
21
20
  * @param any originalObj
@@ -10,8 +10,15 @@ import { useSize, useSetState, useDebounce } from 'ahooks';
10
10
  import { useEffect, useRef } from 'react';
11
11
  import classnames from 'classnames';
12
12
  import { isEllipsisActive } from '../utils';
13
+ var _findTableParent = function findTableParent(element) {
14
+ var _element$tagName;
15
+ var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
16
+ if (!element || depth >= 3) return false;
17
+ if (((_element$tagName = element.tagName) === null || _element$tagName === void 0 ? void 0 : _element$tagName.toLowerCase()) === 'td') return true;
18
+ return _findTableParent(element.parentElement, depth + 1);
19
+ };
13
20
  var ProTooltip = function ProTooltip(props) {
14
- var _useSize, _parentElement$tagNam;
21
+ var _useSize;
15
22
  var ref = useRef();
16
23
  var childRef = useRef();
17
24
  var contentWrapRef = useRef();
@@ -58,7 +65,7 @@ var ProTooltip = function ProTooltip(props) {
58
65
  });
59
66
  var _ref = (_useSize = useSize(localElement)) !== null && _useSize !== void 0 ? _useSize : {},
60
67
  _localSizeWidth = _ref.width;
61
- var isTable = (parentElement === null || parentElement === void 0 ? void 0 : (_parentElement$tagNam = parentElement.tagName) === null || _parentElement$tagNam === void 0 ? void 0 : _parentElement$tagNam.toLowerCase()) === 'td';
68
+ var isTable = _findTableParent(ref.current);
62
69
  var overlayStyle = mode === 'auto' ? {
63
70
  maxWidth: _localSizeWidth
64
71
  } : {};
@@ -1,4 +1,4 @@
1
- import { ReactNode, CSSProperties } from 'react';
1
+ import { CSSProperties, ReactNode } from 'react';
2
2
  export interface ProTooltipType {
3
3
  /**
4
4
  * 提示文本内容
@@ -9,9 +9,8 @@ export interface ProTooltipType {
9
9
  /**
10
10
  * 提示框宽度
11
11
  * @description 设置提示框的宽度,支持各种CSS宽度单位
12
- * @default 'auto'
13
12
  */
14
- width?: string;
13
+ width?: string | number;
15
14
  /**
16
15
  * 显示的行数
17
16
  * @description 当内容超过设定行数时将截断显示
@@ -2,15 +2,6 @@ import "antd/es/tooltip/style";
2
2
  import _Tooltip from "antd/es/tooltip";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
5
- /*
6
- * @Author: ''
7
- * @Date: 2024-09-20 10:26:04
8
- * @LastEditors: ''
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
5
  import { useEffect, useState } from 'react';
15
6
  var AdaptiveTooltip = function AdaptiveTooltip(_ref) {
16
7
  var children = _ref.children;
@@ -4,14 +4,6 @@ import _Checkbox from "antd/es/checkbox";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  var _excluded = ["checkedValues", "disabled", "treeData", "searchStr", "showCodeName", "mode", "fieldNames", "handleOnChange", "handleFilterClose", "optionRender"];
6
6
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
- /*
8
- * @Author: ''
9
- * @Date: 2024-07-03 11:02:19
10
- * @LastEditors: za-xuwenli xuwenli@zhongan.io
11
- * @LastEditTime: 2025-03-20 10:44:39
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
- */
15
7
  import { memo } from 'react';
16
8
  import SearchTitle from './SearchTitle';
17
9
  import CloseIcon from './CloseIcon';
@@ -1,12 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /*
3
- * @Author: ''
4
- * @Date: 2024-09-26 14:37:00
5
- * @LastEditors: ''
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
- */
10
2
  import { memo } from 'react';
11
3
  import AdaptiveTooltip from './AdaptiveTooltip';
12
4
  function SearchTitle(props) {
@@ -11,14 +11,6 @@ import _message from "antd/es/message";
11
11
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
12
12
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
- /*
15
- * @Author: ''
16
- * @Date: 2024-06-04 10:01:18
17
- * @LastEditors: za-xuwenli xuwenli@zhongan.io
18
- * @LastEditTime: 2025-03-20 11:12:23
19
- * @FilePath: /za-material-warehouse/src/ProTreeModal/index.tsx
20
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
21
- */
22
14
  import React, { useEffect, useMemo, useRef } from 'react';
23
15
  import { useDeepCompareEffect, useSetState, useRequest as useRequestFunc, useDebounceFn } from 'ahooks';
24
16
  import { cloneDeep, isFunction } from 'lodash';
@@ -13,15 +13,6 @@ import _Progress from "antd/es/progress";
13
13
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
14
14
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
15
15
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
16
- /*
17
- * @Author: wangshengqiang
18
- * @Date: 2023-07-27 20:13:07
19
- * @LastEditors: wangshengqiang
20
- * @LastEditTime: 2023-11-29 19:33:04
21
- * @Description: 图片类型
22
- *
23
- */
24
-
25
16
  import { useRef, useState } from 'react';
26
17
  import { DndContext } from '@dnd-kit/core';
27
18
  import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
@@ -5,13 +5,6 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
5
5
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  var _excluded = ["value", "size", "action", "maxCount", "headerRender", "footerRender", "centerRender", "disabled", "uploadType", "buttonProps", "accept", "extraTipText", "beforeUpload", "onChange", "onDownload", "onPreview", "onRemove", "filterOriginFileObj", "method", "className", "dataParams", "name", "showExampleContent", "showUploadList", "otherProps", "transformResponse", "exampleTitle", "exampleContent", "exampleModalProps", "buttonText", "afterRender", "fieldNames", "isConfirmDelete"];
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
- /*
9
- * @Author: wangshengqiang
10
- * @Date: 2023-02-03 14:18:59
11
- * @LastEditTime: 2023-11-14 18:32:13
12
- * @LastEditors: wangshengqiang
13
- * @Description: 上传控件
14
- */
15
8
  import React, { useEffect, useState, useImperativeHandle } from 'react';
16
9
  import { isFunction, omit } from 'lodash';
17
10
  import { PointerSensor, useSensor } from '@dnd-kit/core';
@@ -107,6 +107,11 @@
107
107
  .@{ant-prefix}-empty-normal {
108
108
  margin: calc(var(--zaui-space-size-lg; 32px) * var(--zaui-size; 1)) 0;
109
109
  }
110
+ .@{ant-prefix}-table-tbody{
111
+ .@{ant-prefix}-table-cell-fix-left-last:after{
112
+ width: 8px;
113
+ }
114
+ }
110
115
  &.pro-table-no-stripe {
111
116
  .@{ant-prefix}-table-tbody {
112
117
  .@{ant-prefix}-table-row {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { ModifiedFormInstance } from '../ProForm/utils/useForm';
3
- type Forms = Record<string, ModifiedFormInstance<any>>;
2
+ import { ModifiedFormInstanceType } from '../ProForm/utils/useForm';
3
+ type Forms = Record<string, ModifiedFormInstanceType<any>>;
4
4
  export declare const FormsContext: React.Context<Forms>;
5
5
  /**
6
6
  * @param formKey 表单实例key
@@ -42,12 +42,25 @@ var FormFooter = function FormFooter(props) {
42
42
  }
43
43
  }, [formId]);
44
44
  var _onOk = function _onOk() {
45
+ var _modifiedForm$__INTER;
45
46
  if (formId) {
46
47
  var values = form.getFieldsValue();
47
48
  searchCache[formId] = values;
48
49
  window.sessionStorage.setItem(PRO_FORM_CACHE, JSON.stringify(searchCache));
49
50
  }
50
- onOk();
51
+ // 支持 stopOnFirstError
52
+ // @ts-ignore 使用类型断言处理自定义属性
53
+ var modifiedForm = form;
54
+ if ((_modifiedForm$__INTER = modifiedForm.__INTERNAL_CONFIG__) === null || _modifiedForm$__INTER === void 0 ? void 0 : _modifiedForm$__INTER.stopOnFirstError) {
55
+ // 使用自定义验证逻辑
56
+ form.validateFields().then(function () {
57
+ onOk();
58
+ }).catch(function () {
59
+ // 验证失败,不执行 onOk
60
+ });
61
+ } else {
62
+ onOk();
63
+ }
51
64
  };
52
65
  var _onCancel = function _onCancel() {
53
66
  if (formId && searchCache[formId]) {
@@ -1,4 +1,5 @@
1
1
  import { ButtonProps, ColProps, FormInstance } from 'antd';
2
+ import { ModifiedFormInstanceType } from '../../utils/useForm';
2
3
  export interface ButtonItem extends ButtonProps {
3
4
  children?: any;
4
5
  }
@@ -15,7 +16,7 @@ export interface FooterRenderType {
15
16
  footer?: FooterButtonType;
16
17
  confirmLoading?: boolean;
17
18
  formId?: string;
18
- form: FormInstance;
19
+ form: FormInstance | ModifiedFormInstanceType<any>;
19
20
  }
20
21
  /**
21
22
  * 兼容旧命名导出
@@ -18,14 +18,6 @@ var _ProConfigProvider = require("../../../../ProConfigProvider");
18
18
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
19
19
  var _Container = _interopRequireDefault(require("../../Container"));
20
20
  var _excluded = ["className", "format"];
21
- /*
22
- * @Author: ''
23
- * @Date: 2024-01-19 18:27:41
24
- * @LastEditors: ''
25
- * @LastEditTime: 2024-06-03 15:33:12
26
- * @FilePath: /za-material-warehouse/src/ProForm/components/base/DatePicker/index.tsx
27
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
28
- */
29
21
  var DatePicker = function DatePicker(props) {
30
22
  var className = props.className,
31
23
  _props$format = props.format,
@@ -16,16 +16,7 @@ var _ProConfigProvider = require("../../../../ProConfigProvider");
16
16
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
17
17
  var _Container = _interopRequireDefault(require("../../Container"));
18
18
  var _useDateRange = require("./useDateRange");
19
- var _excluded = ["format", "otherProps", "separator", "range"];
20
- /*
21
- * @Author: ''
22
- * @Date: 2024-04-10 11:39:17
23
- * @LastEditors: ''
24
- * @LastEditTime: 2024-05-29 11:50:49
25
- * @FilePath: /za-material-warehouse/src/ProForm/components/base/RangePicker/index.tsx
26
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
27
- */
28
- // @ts-check
19
+ var _excluded = ["format", "otherProps", "separator", "range"]; // @ts-check
29
20
  var AntRangePicker = _antd.DatePicker.RangePicker;
30
21
  var RangePicker = function RangePicker(props) {
31
22
  var _props$format = props.format,
@@ -27,7 +27,7 @@ var _tip = _interopRequireDefault(require("../../../assets/tip.svg"));
27
27
  var _useRules = _interopRequireDefault(require("../../utils/useRules"));
28
28
  var _ConfirmWrapper = _interopRequireDefault(require("./ConfirmWrapper"));
29
29
  var _ChangedWrapper = _interopRequireDefault(require("./ChangedWrapper"));
30
- var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip"];
30
+ var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip", "validateFirst"];
31
31
  /* eslint-disable prefer-destructuring */
32
32
  // 这个组件只管渲染, 参数的整理在外部处理
33
33
  var Render = function Render(props) {
@@ -64,6 +64,8 @@ var Render = function Render(props) {
64
64
  required = formItemProps.required,
65
65
  labelRequired = formItemProps.labelRequired,
66
66
  tooltip = formItemProps.tooltip,
67
+ _formItemProps$valida = formItemProps.validateFirst,
68
+ validateFirst = _formItemProps$valida === void 0 ? true : _formItemProps$valida,
67
69
  otherFormItemProps = (0, _objectWithoutProperties2.default)(formItemProps, _excluded);
68
70
  // 更新show & disabled & rules
69
71
  var _useShouldUpdate = (0, _useShouldUpdate2.default)({
@@ -156,7 +158,7 @@ var Render = function Render(props) {
156
158
  required: false
157
159
  } : null, (0, _objectSpread2.default)({}, (0, _index.isTrim)(type, trim, (0, _ProConfigProvider.useProConfig)())), // 优先取传进来的,其次取ProConfigProvider配置的
158
160
  (0, _objectSpread2.default)({}, (0, _index.isUpperCase)(type, upperCase)), {
159
- validateFirst: true
161
+ validateFirst: validateFirst
160
162
  },
161
163
  // 当某一规则校验不通过时,是否停止剩下的规则的校验
162
164
  {