@zat-design/sisyphus-react 4.0.14 → 4.0.16

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 (84) hide show
  1. package/es/ProAction/propsType.d.ts +0 -1
  2. package/es/ProDownload/propsType.d.ts +0 -1
  3. package/es/ProEditLabel/propsType.d.ts +0 -5
  4. package/es/ProEnum/hooks/useEnum.d.ts +5 -5
  5. package/es/ProEnum/propsType.d.ts +2 -9
  6. package/es/ProEnum/utils/index.d.ts +3 -3
  7. package/es/ProForm/components/FormFooter/propsType.d.ts +0 -5
  8. package/es/ProForm/components/combination/Container/propsType.d.ts +0 -4
  9. package/es/ProForm/components/combination/FormList/propsType.d.ts +0 -8
  10. package/es/ProForm/components/combination/Group/propsType.d.ts +0 -5
  11. package/es/ProForm/components/combination/Group/utils/index.d.ts +14 -14
  12. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +0 -5
  13. package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +0 -4
  14. package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +0 -6
  15. package/es/ProForm/components/combination/ProTimeLimit/index.js +1 -5
  16. package/es/ProForm/components/render/propsType.d.ts +10 -10
  17. package/es/ProForm/propsType.d.ts +0 -8
  18. package/es/ProForm/propsType.js +0 -4
  19. package/es/ProIcon/propsTypes.d.ts +0 -1
  20. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +1 -3
  21. package/es/ProLayout/components/ProFooter/PropTypes.d.ts +0 -1
  22. package/es/ProLayout/components/ProHeader/PropTypes.d.ts +0 -4
  23. package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +1 -1
  24. package/es/ProLayout/components/TabsManager/propTypes.d.ts +0 -1
  25. package/es/ProLayout/components/TabsManager/propTypes.js +1 -2
  26. package/es/ProLayout/components/TabsManager/utils/index.d.ts +4 -1
  27. package/es/ProLayout/components/TabsManager/utils/index.js +7 -0
  28. package/es/ProLayout/propTypes.d.ts +0 -4
  29. package/es/ProLayout/propTypes.js +0 -2
  30. package/es/ProSelect/index.js +45 -7
  31. package/es/ProSelect/propsType.d.ts +0 -4
  32. package/es/ProTable/propsType.d.ts +0 -4
  33. package/es/ProTabs/components/Card/index.d.ts +2 -2
  34. package/es/ProTabs/propType.d.ts +0 -4
  35. package/es/ProThemeTools/propsType.d.ts +0 -2
  36. package/es/ProTooltip/propsType.d.ts +0 -1
  37. package/es/ProTree/components/ProTreeSelect/propsType.d.ts +0 -2
  38. package/es/ProTree/propsType.d.ts +0 -2
  39. package/es/ProTreeModal/propsType.d.ts +0 -2
  40. package/es/ProUpload/propsType.d.ts +0 -5
  41. package/es/index.d.ts +14 -14
  42. package/es/index.js +27 -1
  43. package/lib/ProAction/propsType.d.ts +0 -1
  44. package/lib/ProDownload/propsType.d.ts +0 -1
  45. package/lib/ProEditLabel/propsType.d.ts +0 -5
  46. package/lib/ProEnum/hooks/useEnum.d.ts +5 -5
  47. package/lib/ProEnum/propsType.d.ts +2 -9
  48. package/lib/ProEnum/utils/index.d.ts +3 -3
  49. package/lib/ProForm/components/FormFooter/propsType.d.ts +0 -5
  50. package/lib/ProForm/components/combination/Container/propsType.d.ts +0 -4
  51. package/lib/ProForm/components/combination/FormList/propsType.d.ts +0 -8
  52. package/lib/ProForm/components/combination/Group/propsType.d.ts +0 -5
  53. package/lib/ProForm/components/combination/Group/utils/index.d.ts +14 -14
  54. package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +0 -5
  55. package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +0 -4
  56. package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +0 -6
  57. package/lib/ProForm/components/combination/ProTimeLimit/index.js +1 -4
  58. package/lib/ProForm/components/render/propsType.d.ts +10 -10
  59. package/lib/ProForm/propsType.d.ts +0 -8
  60. package/lib/ProForm/propsType.js +0 -4
  61. package/lib/ProIcon/propsTypes.d.ts +0 -1
  62. package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +1 -3
  63. package/lib/ProLayout/components/ProFooter/PropTypes.d.ts +0 -1
  64. package/lib/ProLayout/components/ProHeader/PropTypes.d.ts +0 -4
  65. package/lib/ProLayout/components/TabsManager/hooks/useTabsCache.js +1 -1
  66. package/lib/ProLayout/components/TabsManager/propTypes.d.ts +0 -1
  67. package/lib/ProLayout/components/TabsManager/propTypes.js +1 -2
  68. package/lib/ProLayout/components/TabsManager/utils/index.d.ts +4 -1
  69. package/lib/ProLayout/components/TabsManager/utils/index.js +7 -0
  70. package/lib/ProLayout/propTypes.d.ts +0 -4
  71. package/lib/ProLayout/propTypes.js +0 -2
  72. package/lib/ProSelect/index.js +45 -7
  73. package/lib/ProSelect/propsType.d.ts +0 -4
  74. package/lib/ProTable/propsType.d.ts +0 -4
  75. package/lib/ProTabs/components/Card/index.d.ts +2 -2
  76. package/lib/ProTabs/propType.d.ts +0 -4
  77. package/lib/ProThemeTools/propsType.d.ts +0 -2
  78. package/lib/ProTooltip/propsType.d.ts +0 -1
  79. package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +0 -2
  80. package/lib/ProTree/propsType.d.ts +0 -2
  81. package/lib/ProTreeModal/propsType.d.ts +0 -2
  82. package/lib/ProUpload/propsType.d.ts +0 -5
  83. package/lib/index.d.ts +14 -14
  84. package/package.json +1 -1
@@ -32,7 +32,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
32
32
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
33
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
34
34
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
35
- var Option = _antd.Select.Option;
35
+ var Option = _antd.Select.Option,
36
+ OptGroup = _antd.Select.OptGroup;
37
+
38
+ /** 将 selectList(扁平或分组)转为扁平选项列表,用于查找、回显、defaultOne */
39
+ function flattenOptions(list) {
40
+ if (!Array.isArray(list) || !list.length) return [];
41
+ var out = [];
42
+ list.forEach(item => {
43
+ if (Array.isArray(item.options)) {
44
+ out.push(...item.options);
45
+ } else {
46
+ out.push(item);
47
+ }
48
+ });
49
+ return out;
50
+ }
36
51
  var ProSelect = (props, ref) => {
37
52
  var _selectProps$showCode, _useRequest$options3, _locale$ProSelect;
38
53
  var _ref = (0, _ProConfigProvider.useProConfig)('ProSelect') || {},
@@ -132,16 +147,17 @@ var ProSelect = (props, ref) => {
132
147
  }
133
148
  }));
134
149
  var cacheList = useRequest !== null && useRequest !== void 0 && (_useRequest$options3 = useRequest.options) !== null && _useRequest$options3 !== void 0 && _useRequest$options3.cacheKey ? successTransformDataHandle(fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.data) : [];
150
+ var flatOptions = flattenOptions(selectList);
135
151
  var getValueObject = input => {
136
152
  if (Array.isArray(input) && input.length) {
137
153
  var resArr = [];
138
154
  input.forEach(i => {
139
- var res = selectList.find(item => item[code] === i);
155
+ var res = flatOptions.find(item => item[code] === i);
140
156
  if (res) resArr.push(res);
141
157
  });
142
158
  return resArr;
143
159
  }
144
- return selectList.find(item => item[code] === input);
160
+ return flatOptions.find(item => item[code] === input);
145
161
  };
146
162
  (0, _react.useImperativeHandle)(ref, () => ({
147
163
  getValueObject,
@@ -187,11 +203,11 @@ var ProSelect = (props, ref) => {
187
203
  }
188
204
  }, [defaultOne, value, isDefaultOne, selectList, code, onChange]);
189
205
  var transToLabel = value => {
190
- if (!Array.isArray(selectList) || !selectList.length) {
206
+ if (!flatOptions.length) {
191
207
  return viewEmpty;
192
208
  }
193
209
  var labelList = value.map(v => {
194
- var option = selectList.find(item => {
210
+ var option = flatOptions.find(item => {
195
211
  if (labelInValue) {
196
212
  return item[code] === v[code];
197
213
  }
@@ -203,7 +219,7 @@ var ProSelect = (props, ref) => {
203
219
  return '-';
204
220
  });
205
221
  var record = value.map(v => {
206
- return selectList.find(item => {
222
+ return flatOptions.find(item => {
207
223
  if (labelInValue) {
208
224
  return item[code] === v[code];
209
225
  }
@@ -302,7 +318,7 @@ var ProSelect = (props, ref) => {
302
318
  }
303
319
  // 只有当 dataSource 只有一个值时才默认回填(只返回值,不进行状态更新)
304
320
  if (defaultOne && !value && !isDefaultOne && (selectList === null || selectList === void 0 ? void 0 : selectList.length) === 1) {
305
- var option = selectList === null || selectList === void 0 ? void 0 : selectList[0];
321
+ var option = flatOptions[0];
306
322
  // selectList 可能是异步回来的值
307
323
  if (option) {
308
324
  return option === null || option === void 0 ? void 0 : option[code];
@@ -336,6 +352,7 @@ var ProSelect = (props, ref) => {
336
352
  showSearch: true,
337
353
  filterOption: (0, _lodash.isFunction)(_onSearch) ? false : (input, option) => {
338
354
  var _option$children;
355
+ if ((option === null || option === void 0 ? void 0 : option.value) == null) return false;
339
356
  var value = (0, _lodash.isString)(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 || (_option$children = option.children) === null || _option$children === void 0 || (_option$children = _option$children.props) === null || _option$children === void 0 ? void 0 : _option$children.title;
340
357
  return value.toLowerCase().includes(input.toLowerCase());
341
358
  },
@@ -351,6 +368,27 @@ var ProSelect = (props, ref) => {
351
368
  var itemValue = item[code];
352
369
  var itemKey = itemValue != null ? `${itemValue}-${index}` : `option-${index}`;
353
370
  var optionValue = itemValue != null ? itemValue : undefined;
371
+ var groupOpts = item.options;
372
+ if (Array.isArray(groupOpts)) {
373
+ var _item$label;
374
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(OptGroup, {
375
+ label: item[label],
376
+ children: groupOpts.map(opt => /*#__PURE__*/(0, _jsxRuntime.jsx)(Option, {
377
+ label: opt[label],
378
+ value: opt[code],
379
+ record: opt,
380
+ disabled: !!opt.disabled,
381
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TooltipOption, {
382
+ title: OptionRender ? OptionRender(opt) : selectProps.showCodeName ? `${opt[code]}-${opt[label]}` : opt[label],
383
+ children: OptionRender ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
384
+ children: OptionRender(opt)
385
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
386
+ children: selectProps.showCodeName ? `${opt[code]}-${opt[label]}` : opt[label]
387
+ })
388
+ })
389
+ }, opt[code]))
390
+ }, (_item$label = item[label]) !== null && _item$label !== void 0 ? _item$label : `group-${index}`);
391
+ }
354
392
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Option, {
355
393
  label: item[label],
356
394
  value: optionValue,
@@ -158,7 +158,3 @@ export interface ResponseDataType {
158
158
  */
159
159
  code?: number;
160
160
  }
161
- export type DataOption = DataOptionType;
162
- export type PropSelectProps = PropSelectType;
163
- export type ProSelectAction = ProSelectActionType;
164
- export type ResponseData = ResponseDataType;
@@ -754,8 +754,4 @@ export interface ProTableUseAntdTableType<I, R> {
754
754
  allSelected: boolean;
755
755
  [key: string]: any;
756
756
  }
757
- export type ProTableProps<T = any> = ProTableType<T>;
758
- export type ProTableColumn = ProTableColumnType;
759
- export type ProTableSummaryProps = ProTableSummaryType;
760
- export type UseAntdTableState<I, R> = ProTableUseAntdTableType<I, R>;
761
757
  export {};
@@ -1,3 +1,3 @@
1
- import { CardProps } from '../../propType';
2
- declare const Card: (props: CardProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { CardType } from '../../propType';
2
+ declare const Card: (props: CardType) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Card;
@@ -92,7 +92,3 @@ export interface ProTabsType extends Omit<TabsProps, 'items' | 'onChange'> {
92
92
  size?: 'small' | 'middle' | 'large';
93
93
  [key: string]: any;
94
94
  }
95
- export type ProTabsProps = ProTabsType;
96
- export type ProTabsItemsProps = ProTabsItemType;
97
- export type ProTabsAction = ProTabsActionType;
98
- export type CardProps = CardType;
@@ -168,5 +168,3 @@ export interface LocalThemeConfigType {
168
168
  */
169
169
  zauiBaseFontSize?: string;
170
170
  }
171
- export type ProThemeToolsProps = ProThemeToolsType;
172
- export type LocalThemeConfigPropsType = LocalThemeConfigType;
@@ -55,4 +55,3 @@ export type ProTooltipTriggerNodeType = HTMLElement & {
55
55
  /** 父节点元素 */
56
56
  parentNode: HTMLElement;
57
57
  };
58
- export type ProTooltipProps = ProTooltipType;
@@ -437,5 +437,3 @@ export interface ProTreeSelectResponseDataType {
437
437
  */
438
438
  code?: number;
439
439
  }
440
- export type PropTreeSelectProps = ProTreeSelectType;
441
- export type ProSelectAction = ProTreeSelectActionType;
@@ -809,6 +809,4 @@ export interface ProTreeResponseDataType {
809
809
  */
810
810
  code?: number;
811
811
  }
812
- export type ProTreeProps = ProTreeType;
813
- export type PropTreeSelectProps = ProTreeSelectType;
814
812
  export {};
@@ -296,5 +296,3 @@ export interface ProTreeModalType {
296
296
  */
297
297
  openChange?: (open: boolean) => void;
298
298
  }
299
- export type ProTreeModalProps = ProTreeModalType;
300
- export type ProTreeModalAction = ProTreeModalActionType;
@@ -262,8 +262,3 @@ export interface DraggableUploadListItemType {
262
262
  */
263
263
  children: React.ReactNode;
264
264
  }
265
- export type UploadFileRes = UploadFileResType;
266
- export type ExampleModalProps = ExampleModalType;
267
- export type fieldNamesProps = FieldNamesType;
268
- export type ProUploadProps = ProUploadType;
269
- export type DraggableUploadListItemProps = DraggableUploadListItemType;
package/lib/index.d.ts CHANGED
@@ -28,20 +28,20 @@ export * from './ProConfigProvider';
28
28
  export * from './locale';
29
29
  export { default as ProBackBtn } from './ProLayout/components/ProHeader/components/ProBackBtn';
30
30
  export type { ProConfigProviderType } from './ProConfigProvider';
31
- export type { ProFormType, ProColumnProps, ProFormColumnType } from './ProForm/propsType';
31
+ export type { ProFormType, ProFormColumnType } from './ProForm/propsType';
32
32
  export type { ProFormComponentType } from './ProForm/components';
33
- export type { ProTableType, ProTableColumnType, ProTableSummaryType, ProTableUseAntdTableType, ProTableProps, ProTableSummaryProps, ProTableColumn, UseAntdTableState, } from './ProTable/propsType';
34
- export type { ProUploadType, ProUploadProps } from './ProUpload/propsType';
35
- export type { ProTabsType, ProTabsItemType, ProTabsProps, ProTabsItemsProps } from './ProTabs/propType';
36
- export type { BreadcrumbColumnType, SubDescribeColumnType, DescribeColumnType, ProHeaderType, ProHeaderProps, BreadcrumbColumnsProps, SubDescribeColumnsProps, DescribeColumnsProps, } from './ProLayout/components/ProHeader/PropTypes';
37
- export type { ProLayoutTabsInstance, AddTabParams, AddTabOptions } from './ProLayout/propTypes';
38
- export type { ProTooltipType, ProTooltipProps } from './ProTooltip/propsType';
39
- export type { ProIconType, ProIconProps } from './ProIcon/propsTypes';
40
- export type { ProTreeType, ProTreeSelectType, ProTreeProps, PropTreeSelectProps } from './ProTree/propsType';
41
- export type { ProTreeModalType, ProTreeModalActionType, ProTreeModalProps, ProTreeModalAction, } from './ProTreeModal/propsType';
42
- export type { ProEditTableType, ProEditTableColumnType, ProEditTableSummaryColumnType, ProEditTableSummaryConfigType, ProEditTableActionType, ProEditTableProps, ProEditTableColumnsProps, SummaryProps, SummaryColumnProps, BaseActionProps, } from './ProEditTable/propsType';
43
- export type { ProStepType, ProStepContextType, ProStepItemType, ProStepPropsType, ProStepItemPropsType, } from './ProStep/propsType';
44
- export type { ProDrawerFormType, ProDrawerFormPropsType } from './ProDrawerForm/propsType';
45
- export type { ProModalSelectType, ProModalSelectConfigType, ProModalSelectPropsType, } from './ProForm/components/combination/ProModalSelect/propsType';
33
+ export type { ProTableType, ProTableColumnType, ProTableSummaryType, ProTableUseAntdTableType } from './ProTable/propsType';
34
+ export type { ProUploadType } from './ProUpload/propsType';
35
+ export type { ProTabsType, ProTabsItemType } from './ProTabs/propType';
36
+ export type { BreadcrumbColumnType, SubDescribeColumnType, DescribeColumnType, ProHeaderType, } from './ProLayout/components/ProHeader/PropTypes';
37
+ export type { ProLayoutType } from './ProLayout/propTypes';
38
+ export type { ProTooltipType } from './ProTooltip/propsType';
39
+ export type { ProIconType } from './ProIcon/propsTypes';
40
+ export type { ProTreeType, ProTreeSelectType } from './ProTree/propsType';
41
+ export type { ProTreeModalType, ProTreeModalActionType } from './ProTreeModal/propsType';
42
+ export type { ProEditTableType, ProEditTableColumnType, ProEditTableSummaryColumnType, ProEditTableSummaryConfigType, ProEditTableActionType, } from './ProEditTable/propsType';
43
+ export type { ProStepType, ProStepContextType, ProStepItemType } from './ProStep/propsType';
44
+ export type { ProDrawerFormType } from './ProDrawerForm/propsType';
45
+ export type { ProModalSelectType, ProModalSelectConfigType } from './ProForm/components/combination/ProModalSelect/propsType';
46
46
  export type { ProStepTabType, ProStepTabResultType } from './ProStepTab/propsType';
47
47
  export * from './tokens';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.0.14",
3
+ "version": "4.0.16",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",