@zat-design/sisyphus-react 3.2.2 → 3.3.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 (170) hide show
  1. package/README.md +7 -0
  2. package/dist/index.esm.css +82 -37
  3. package/es/ProAction/index.less +3 -0
  4. package/es/ProDownload/index.js +9 -6
  5. package/es/ProDownload/style/index.less +5 -2
  6. package/es/ProDrawerForm/index.js +1 -15
  7. package/es/ProDrawerForm/style/index.less +76 -73
  8. package/es/ProEditLabel/style/index.less +12 -9
  9. package/es/ProEditTable/index.js +8 -4
  10. package/es/ProEditTable/style/index.less +57 -47
  11. package/es/ProEditTable/utils/config.d.ts +1 -1
  12. package/es/ProEditTable/utils/config.js +3 -3
  13. package/es/ProEnum/style/index.less +3 -0
  14. package/es/ProForm/components/base/DatePicker/index.js +0 -3
  15. package/es/ProForm/components/base/SwitchCheckbox/style/index.less +3 -0
  16. package/es/ProForm/components/base/TextArea/index.less +4 -3
  17. package/es/ProForm/components/base/TimePicker/style/index.less +4 -1
  18. package/es/ProForm/components/combination/Container/style/index.less +6 -3
  19. package/es/ProForm/components/combination/FormList/style/index.less +20 -24
  20. package/es/ProForm/components/combination/Group/style/index.less +18 -15
  21. package/es/ProForm/components/combination/ProAddressBar/style/index.less +6 -3
  22. package/es/ProForm/components/combination/ProCombination/style/index.less +5 -2
  23. package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +6 -1
  24. package/es/ProForm/components/combination/ProModalSelect/style/index.less +32 -11
  25. package/es/ProForm/components/combination/ProNumberRange/style/index.less +13 -10
  26. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +9 -6
  27. package/es/ProForm/components/render/RenderFields.js +4 -5
  28. package/es/ProForm/style/index.less +46 -44
  29. package/es/ProIcon/style/index.less +4 -1
  30. package/es/ProLayout/components/Layout/Header/style/index.less +1 -1
  31. package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +10 -7
  32. package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +31 -28
  33. package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +14 -11
  34. package/es/ProLayout/components/Layout/Menu/style/index.less +2 -0
  35. package/es/ProLayout/components/Layout/Notice/style/index.less +3 -0
  36. package/es/ProLayout/components/ProCollapse/style/index.less +27 -24
  37. package/es/ProLayout/components/ProFooter/style/index.less +11 -7
  38. package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +4 -1
  39. package/es/ProLayout/components/ProHeader/style/index.less +12 -11
  40. package/es/ProLayout/style/index.less +10 -7
  41. package/es/ProSelect/index.less +3 -0
  42. package/es/ProStep/style/index.less +3 -0
  43. package/es/ProTable/index.js +15 -7
  44. package/es/ProTable/style/index.less +76 -54
  45. package/es/ProTable/utils.d.ts +1 -1
  46. package/es/ProTable/utils.js +38 -19
  47. package/es/ProTabs/style/index.less +25 -23
  48. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  49. package/es/ProThemeTools/component/PrdTools/index.js +7 -6
  50. package/es/ProThemeTools/component/PrdTools/style/index.less +6 -6
  51. package/es/ProThemeTools/index.d.ts +1 -1
  52. package/es/ProThemeTools/index.js +7 -2
  53. package/es/ProThemeTools/propsType.d.ts +4 -0
  54. package/es/ProThemeTools/style/index.less +6 -3
  55. package/es/ProThemeTools/utils/index.d.ts +1 -1
  56. package/es/ProThemeTools/utils/index.js +2 -1
  57. package/es/ProTooltip/style/index.less +3 -0
  58. package/es/ProTree/components/CloseIcon.js +2 -4
  59. package/es/ProTree/components/ProTree.js +27 -11
  60. package/es/ProTree/components/Tree.js +1 -1
  61. package/es/ProTree/propsType.d.ts +2 -2
  62. package/es/ProTree/style/index.less +29 -26
  63. package/es/ProTree/utils.d.ts +6 -0
  64. package/es/ProTree/utils.js +11 -0
  65. package/es/ProTreeModal/components/CloseIcon.js +2 -4
  66. package/es/ProTreeModal/components/Trigger.d.ts +3 -0
  67. package/es/ProTreeModal/components/Trigger.js +79 -19
  68. package/es/ProTreeModal/index.js +38 -6
  69. package/es/ProTreeModal/propsType.d.ts +5 -2
  70. package/es/ProTreeModal/style/index.less +11 -8
  71. package/es/ProTreeSelect/index.js +6 -4
  72. package/es/ProTreeSelect/propsType.d.ts +2 -0
  73. package/es/ProTreeSelect/style/index.less +25 -22
  74. package/es/ProUpload/components/DragRender.js +7 -4
  75. package/es/ProUpload/components/ImageRender.js +5 -1
  76. package/es/ProUpload/index.js +11 -7
  77. package/es/ProUpload/style/index.less +13 -4
  78. package/es/ProViewer/index.js +3 -1
  79. package/es/ProViewer/style/index.less +6 -3
  80. package/es/locale/en_US.d.ts +4 -0
  81. package/es/locale/en_US.js +5 -1
  82. package/es/locale/zh_CN.d.ts +4 -0
  83. package/es/locale/zh_CN.js +6 -2
  84. package/es/style/core/compatible.less +6 -6
  85. package/es/style/theme/antd.less +272 -253
  86. package/lib/ProAction/index.less +3 -0
  87. package/lib/ProDownload/index.js +9 -6
  88. package/lib/ProDownload/style/index.less +5 -2
  89. package/lib/ProDrawerForm/index.js +0 -14
  90. package/lib/ProDrawerForm/style/index.less +76 -73
  91. package/lib/ProEditLabel/style/index.less +12 -9
  92. package/lib/ProEditTable/index.js +6 -2
  93. package/lib/ProEditTable/style/index.less +57 -47
  94. package/lib/ProEditTable/utils/config.d.ts +1 -1
  95. package/lib/ProEditTable/utils/config.js +3 -3
  96. package/lib/ProEnum/style/index.less +3 -0
  97. package/lib/ProForm/components/base/DatePicker/index.js +0 -3
  98. package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +3 -0
  99. package/lib/ProForm/components/base/TextArea/index.less +4 -3
  100. package/lib/ProForm/components/base/TimePicker/style/index.less +4 -1
  101. package/lib/ProForm/components/combination/Container/style/index.less +6 -3
  102. package/lib/ProForm/components/combination/FormList/style/index.less +20 -24
  103. package/lib/ProForm/components/combination/Group/style/index.less +18 -15
  104. package/lib/ProForm/components/combination/ProAddressBar/style/index.less +6 -3
  105. package/lib/ProForm/components/combination/ProCombination/style/index.less +5 -2
  106. package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +7 -1
  107. package/lib/ProForm/components/combination/ProModalSelect/style/index.less +32 -11
  108. package/lib/ProForm/components/combination/ProNumberRange/style/index.less +13 -10
  109. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +9 -6
  110. package/lib/ProForm/components/render/RenderFields.js +4 -5
  111. package/lib/ProForm/style/index.less +46 -44
  112. package/lib/ProIcon/style/index.less +4 -1
  113. package/lib/ProLayout/components/Layout/Header/style/index.less +1 -1
  114. package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +10 -7
  115. package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +31 -28
  116. package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +14 -11
  117. package/lib/ProLayout/components/Layout/Menu/style/index.less +2 -0
  118. package/lib/ProLayout/components/Layout/Notice/style/index.less +3 -0
  119. package/lib/ProLayout/components/ProCollapse/style/index.less +27 -24
  120. package/lib/ProLayout/components/ProFooter/style/index.less +11 -7
  121. package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +4 -1
  122. package/lib/ProLayout/components/ProHeader/style/index.less +12 -11
  123. package/lib/ProLayout/style/index.less +10 -7
  124. package/lib/ProSelect/index.less +3 -0
  125. package/lib/ProStep/style/index.less +3 -0
  126. package/lib/ProTable/index.js +14 -6
  127. package/lib/ProTable/style/index.less +76 -54
  128. package/lib/ProTable/utils.d.ts +1 -1
  129. package/lib/ProTable/utils.js +38 -19
  130. package/lib/ProTabs/style/index.less +25 -23
  131. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  132. package/lib/ProThemeTools/component/PrdTools/index.js +7 -6
  133. package/lib/ProThemeTools/component/PrdTools/style/index.less +6 -6
  134. package/lib/ProThemeTools/index.d.ts +1 -1
  135. package/lib/ProThemeTools/index.js +7 -2
  136. package/lib/ProThemeTools/propsType.d.ts +4 -0
  137. package/lib/ProThemeTools/style/index.less +6 -3
  138. package/lib/ProThemeTools/utils/index.d.ts +1 -1
  139. package/lib/ProThemeTools/utils/index.js +2 -1
  140. package/lib/ProTooltip/style/index.less +3 -0
  141. package/lib/ProTree/components/CloseIcon.js +2 -4
  142. package/lib/ProTree/components/ProTree.js +26 -10
  143. package/lib/ProTree/components/Tree.js +1 -1
  144. package/lib/ProTree/propsType.d.ts +2 -2
  145. package/lib/ProTree/style/index.less +29 -26
  146. package/lib/ProTree/utils.d.ts +6 -0
  147. package/lib/ProTree/utils.js +12 -0
  148. package/lib/ProTreeModal/components/CloseIcon.js +2 -4
  149. package/lib/ProTreeModal/components/Trigger.d.ts +3 -0
  150. package/lib/ProTreeModal/components/Trigger.js +74 -18
  151. package/lib/ProTreeModal/index.js +38 -6
  152. package/lib/ProTreeModal/propsType.d.ts +5 -2
  153. package/lib/ProTreeModal/style/index.less +11 -8
  154. package/lib/ProTreeSelect/index.js +6 -4
  155. package/lib/ProTreeSelect/propsType.d.ts +2 -0
  156. package/lib/ProTreeSelect/style/index.less +25 -22
  157. package/lib/ProUpload/components/DragRender.js +7 -4
  158. package/lib/ProUpload/components/ImageRender.js +5 -1
  159. package/lib/ProUpload/index.js +11 -7
  160. package/lib/ProUpload/style/index.less +13 -4
  161. package/lib/ProViewer/index.js +4 -3
  162. package/lib/ProViewer/style/index.less +6 -3
  163. package/lib/locale/en_US.d.ts +4 -0
  164. package/lib/locale/en_US.js +5 -1
  165. package/lib/locale/zh_CN.d.ts +4 -0
  166. package/lib/locale/zh_CN.js +6 -2
  167. package/lib/style/core/compatible.less +6 -6
  168. package/lib/style/theme/antd.less +272 -253
  169. package/package.json +1 -1
  170. package/typings.d.ts +0 -6
@@ -6,7 +6,7 @@ import _message from "antd/es/message";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
7
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
8
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
9
- var _excluded = ["size", "className", "cacheTime", "color", "mode", "iconFollowTheme", "tableBorder", "tableStripe", "theme"];
9
+ var _excluded = ["size", "className", "cacheTime", "color", "mode", "iconFollowTheme", "prefixCls", "tableBorder", "tableStripe", "theme"];
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  /* eslint-disable prefer-const */
12
12
  import { SettingOutlined } from '@ant-design/icons';
@@ -38,6 +38,8 @@ var ProThemeTools = function ProThemeTools(_ref) {
38
38
  color = _ref.color,
39
39
  mode = _ref.mode,
40
40
  iconFollowTheme = _ref.iconFollowTheme,
41
+ _ref$prefixCls = _ref.prefixCls,
42
+ prefixCls = _ref$prefixCls === void 0 ? 'ant' : _ref$prefixCls,
41
43
  _ref$tableBorder = _ref.tableBorder,
42
44
  tableBorder = _ref$tableBorder === void 0 ? false : _ref$tableBorder,
43
45
  _ref$tableStripe = _ref.tableStripe,
@@ -117,6 +119,7 @@ var ProThemeTools = function ProThemeTools(_ref) {
117
119
  setState(_objectSpread(_objectSpread({}, state), localThemeConfig));
118
120
  setThemes(cssVariables);
119
121
  _ConfigProvider.config({
122
+ prefixCls: prefixCls,
120
123
  theme: {
121
124
  primaryColor: (_localThemeConfig = localThemeConfig) === null || _localThemeConfig === void 0 ? void 0 : _localThemeConfig.zauiBrand
122
125
  }
@@ -124,6 +127,7 @@ var ProThemeTools = function ProThemeTools(_ref) {
124
127
  } else {
125
128
  setThemes(getMapKebabCase(state));
126
129
  _ConfigProvider.config({
130
+ prefixCls: prefixCls,
127
131
  theme: {
128
132
  primaryColor: state === null || state === void 0 ? void 0 : state.zauiBrand
129
133
  }
@@ -146,7 +150,7 @@ var ProThemeTools = function ProThemeTools(_ref) {
146
150
  }, [zauiBrand]);
147
151
  // 斑马纹设置
148
152
  useEffect(function () {
149
- setTableNoStripe(zauiStripe);
153
+ setTableNoStripe(zauiStripe, prefixCls);
150
154
  }, [zauiStripe]);
151
155
  // 表格边框设置
152
156
  useEffect(function () {
@@ -178,6 +182,7 @@ var ProThemeTools = function ProThemeTools(_ref) {
178
182
  showDrawer();
179
183
  }
180
184
  }), _jsx(PrdTools, {
185
+ prefixCls: prefixCls,
181
186
  onReset: onReset,
182
187
  onClose: onClose,
183
188
  onCopy: onCopy,
@@ -9,6 +9,8 @@ export interface DevToolsPropsType {
9
9
  tableBorder?: boolean;
10
10
  /** 是否有斑马纹 */
11
11
  tableStripe?: boolean;
12
+ /** 统一样式前缀, 默认ant */
13
+ prefixCls?: string;
12
14
  }
13
15
  export interface ProThemeToolsProps {
14
16
  size?: number;
@@ -23,6 +25,8 @@ export interface ProThemeToolsProps {
23
25
  tableBorder?: boolean;
24
26
  /** 是否有斑马纹 */
25
27
  tableStripe?: boolean;
28
+ /** 统一样式前缀, 默认ant */
29
+ prefixCls?: string;
26
30
  [key: string]: any;
27
31
  }
28
32
  export interface LocalThemeConfigPropsType {
@@ -1,3 +1,6 @@
1
+ @root-entry-name: 'default';
2
+ @import (reference) '~antd/es/style/themes/index.less';
3
+
1
4
  @import '../component/PrdTools/style/index.less';
2
5
 
3
6
  .pro-theme-tools {
@@ -19,11 +22,11 @@
19
22
  }
20
23
 
21
24
  .pro-theme-tools-drawer {
22
- .ant-drawer-body {
25
+ .@{ant-prefix}-drawer-body {
23
26
  padding: 32px;
24
27
  }
25
28
 
26
- .ant-space-vertical {
29
+ .@{ant-prefix}-space-vertical {
27
30
  gap: var(--zaui-space-size-sm, 8px) !important;
28
31
  }
29
32
 
@@ -49,7 +52,7 @@
49
52
  margin-bottom: var(--zaui-space-size-md, 16px);
50
53
  }
51
54
 
52
- .ant-radio-button-wrapper {
55
+ .@{ant-prefix}-radio-button-wrapper {
53
56
  padding: 0 12px;
54
57
  }
55
58
  }
@@ -23,7 +23,7 @@ export declare const getMapHumpCase: (obj?: {}) => {};
23
23
  * 设置表格斑马纹
24
24
  * @param stripe boolean
25
25
  */
26
- export declare const setTableNoStripe: (stripe: boolean) => void;
26
+ export declare const setTableNoStripe: (stripe: boolean, prefixCls?: string) => void;
27
27
  /**
28
28
  * 设置表格边框
29
29
  * @param border boolean
@@ -75,8 +75,9 @@ export var getMapHumpCase = function getMapHumpCase() {
75
75
  * @param stripe boolean
76
76
  */
77
77
  export var setTableNoStripe = function setTableNoStripe(stripe) {
78
+ var prefixCls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ant';
78
79
  var proTables = document.querySelectorAll('.pro-table');
79
- var antTables = document.querySelectorAll('.ant-table');
80
+ var antTables = document.querySelectorAll(".".concat(prefixCls, "-table"));
80
81
  if (!proTables.length) {
81
82
  return;
82
83
  }
@@ -1,3 +1,6 @@
1
+ @root-entry-name: 'default';
2
+ @import (reference) '~antd/es/style/themes/index.less';
3
+
1
4
  .pro-tooltip {
2
5
  cursor: pointer;
3
6
 
@@ -1,11 +1,9 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  function CloseIcon(props) {
4
- return _jsx("span", _objectSpread(_objectSpread({
5
- className: "ant-input-suffix"
6
- }, props), {}, {
4
+ return _jsx("span", _objectSpread(_objectSpread({}, props), {}, {
7
5
  children: _jsx("span", {
8
- className: "ant-input-clear-icon pro-tree-modal-checkbox-close",
6
+ className: "pro-tree-modal-checkbox-close",
9
7
  role: "button",
10
8
  children: _jsx("span", {
11
9
  role: "img",
@@ -12,7 +12,7 @@ import _message from "antd/es/message";
12
12
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
13
13
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
14
14
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
15
- var _excluded = ["value", "onChange", "dataSource", "mode", "code", "useRequest", "allValue", "showCodeName", "checkStrictly", "tags", "placeholder", "labelInValue", "fieldNames", "disabled", "isView", "transformResponse", "optionRender", "onSelect", "loading", "style", "className", "showSearch", "title", "footer", "expandedKeys", "showExpand", "selectKey"];
15
+ var _excluded = ["value", "onChange", "dataSource", "mode", "code", "useRequest", "allValue", "showCodeName", "checkStrictly", "tags", "placeholder", "labelInValue", "fieldNames", "disabled", "isView", "transformResponse", "optionRender", "onSelect", "loading", "style", "className", "showSearch", "title", "footer", "expandedKeys", "showExpand", "defaultExpandAll"];
16
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  import { useEffect } from 'react';
18
18
  import classNames from 'classnames';
@@ -23,7 +23,7 @@ import { ReactSVG } from 'react-svg';
23
23
  import { useProConfig } from '../../ProConfigProvider';
24
24
  import { TreeView } from './index';
25
25
  import locale from '../../locale';
26
- import { getFlatTreeData, getChildrenKeys, findTreeNodeByKey, getAllKeys } from '../utils';
26
+ import { getDefaultExpandKeys, getFlatTreeData, getChildrenKeys, findTreeNodeByKey, getAllKeys } from '../utils';
27
27
  import searchSVG from '../../assets/input-search.svg';
28
28
  import '../style/index.less';
29
29
  var ProTree = function ProTree(props) {
@@ -71,7 +71,7 @@ var ProTree = function ProTree(props) {
71
71
  expandedKeys = props.expandedKeys,
72
72
  _props$showExpand = props.showExpand,
73
73
  showExpand = _props$showExpand === void 0 ? false : _props$showExpand,
74
- selectKey = props.selectKey,
74
+ defaultExpandAll = props.defaultExpandAll,
75
75
  other = _objectWithoutProperties(props, _excluded);
76
76
  var fieldNameLabel = fieldNames.label;
77
77
  var fieldNameValue = fieldNames.value;
@@ -86,7 +86,7 @@ var ProTree = function ProTree(props) {
86
86
  checkAll: false,
87
87
  allKeys: [],
88
88
  clickShowLoading: false,
89
- innerExpandKeys: props === null || props === void 0 ? void 0 : props.expandedKeys
89
+ innerExpandKeys: []
90
90
  }),
91
91
  _useSetState2 = _slicedToArray(_useSetState, 2),
92
92
  state = _useSetState2[0],
@@ -96,11 +96,14 @@ var ProTree = function ProTree(props) {
96
96
  onSuccess: function onSuccess(res) {
97
97
  if (transformResponse && typeof transformResponse === 'function') {
98
98
  var responseData = transformResponse(res);
99
+ var flatTrees = getFlatTreeData(responseData, fieldNames);
100
+ var allKey = getAllKeys(responseData, fieldNames);
99
101
  setState({
100
102
  treeData: responseData,
101
103
  originalTreeData: responseData,
102
- flatTreeData: getFlatTreeData(responseData, fieldNames),
103
- allKeys: getAllKeys(responseData, fieldNames)
104
+ flatTreeData: flatTrees,
105
+ allKeys: allKey,
106
+ innerExpandKeys: (props === null || props === void 0 ? void 0 : props.expandedKeys) ? props === null || props === void 0 ? void 0 : props.expandedKeys : getDefaultExpandKeys(defaultExpandAll, allKey)
104
107
  });
105
108
  } else {
106
109
  var _res$status = res.status,
@@ -111,11 +114,14 @@ var ProTree = function ProTree(props) {
111
114
  _message.error(msg);
112
115
  return;
113
116
  }
117
+ var _flatTrees = getFlatTreeData(data, fieldNames);
118
+ var _allKey = getAllKeys(data, fieldNames);
114
119
  setState({
115
120
  treeData: data,
116
121
  originalTreeData: data,
117
- flatTreeData: getFlatTreeData(data, fieldNames),
118
- allKeys: getAllKeys(data, fieldNames)
122
+ flatTreeData: _flatTrees,
123
+ allKeys: _allKey,
124
+ innerExpandKeys: (props === null || props === void 0 ? void 0 : props.expandedKeys) ? props === null || props === void 0 ? void 0 : props.expandedKeys : getDefaultExpandKeys(defaultExpandAll, _allKey)
119
125
  });
120
126
  }
121
127
  },
@@ -123,11 +129,13 @@ var ProTree = function ProTree(props) {
123
129
  }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
124
130
  useDeepCompareEffect(function () {
125
131
  if (dataSource && dataSource.length) {
132
+ var allKey = getAllKeys(dataSource, fieldNames);
126
133
  setState({
127
134
  treeData: dataSource,
128
135
  originalTreeData: cloneDeep(dataSource),
129
136
  flatTreeData: getFlatTreeData(dataSource, fieldNames),
130
- allKeys: getAllKeys(dataSource, fieldNames)
137
+ allKeys: allKey,
138
+ innerExpandKeys: (props === null || props === void 0 ? void 0 : props.expandedKeys) ? props === null || props === void 0 ? void 0 : props.expandedKeys : getDefaultExpandKeys(defaultExpandAll, allKey)
131
139
  });
132
140
  } else if (enumCode) {
133
141
  var dictEnum = dics[enumCode] || [];
@@ -140,11 +148,13 @@ var ProTree = function ProTree(props) {
140
148
  console.error('请返回有效的数组');
141
149
  dictEnum = [];
142
150
  }
151
+ var _allKey2 = getAllKeys(dictEnum, fieldNames);
143
152
  setState({
144
153
  treeData: dictEnum,
145
154
  originalTreeData: cloneDeep(dictEnum),
146
155
  flatTreeData: getFlatTreeData(dictEnum, fieldNames),
147
- allKeys: getAllKeys(dictEnum, fieldNames)
156
+ allKeys: getAllKeys(dictEnum, fieldNames),
157
+ innerExpandKeys: (props === null || props === void 0 ? void 0 : props.expandedKeys) ? props === null || props === void 0 ? void 0 : props.expandedKeys : getDefaultExpandKeys(defaultExpandAll, _allKey2)
148
158
  });
149
159
  }
150
160
  }, [dataSource, enumCode]);
@@ -204,7 +214,7 @@ var ProTree = function ProTree(props) {
204
214
  return item[fieldNameValue];
205
215
  });
206
216
  } else {
207
- // 单选值场景为string走到这里
217
+ // 复选,单纯value数组场景
208
218
  checkedValues = _innerVal;
209
219
  }
210
220
  }
@@ -215,6 +225,11 @@ var ProTree = function ProTree(props) {
215
225
  // treeViewData,
216
226
  });
217
227
  }
228
+ } else if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
229
+ // 单选--场景-->如果表单的value没有值,那么配置的selectedKey就起作用了,选中树节点
230
+ setState({
231
+ checkedValues: props === null || props === void 0 ? void 0 : props.selectedKey
232
+ });
218
233
  }
219
234
  }, [value, state.allKeys]);
220
235
  /**
@@ -240,6 +255,7 @@ var ProTree = function ProTree(props) {
240
255
  onChange && onChange(values);
241
256
  }
242
257
  };
258
+ // 该方法只有复选框,在勾中checkbox后才会走到这个方法
243
259
  var onCheck = function onCheck(checkedKeys, info) {
244
260
  if (disabled || isView) {
245
261
  return null;
@@ -95,8 +95,8 @@ function List(props) {
95
95
  }
96
96
  }, [checkedValues]);
97
97
  useEffect(function () {
98
+ // 复选树,配置的selectedKey在这里处理选中,单选树,在ProTree组件里跟value比优先级处理,到这个组件里面是checkedValues了
98
99
  if (checkable) {
99
- // 复选树,selectedKey,选中那个树节点
100
100
  setState({
101
101
  currentClickTreeNode: selectedKey
102
102
  });
@@ -118,8 +118,8 @@ export interface ProTreeProps extends PropTreeSelectProps {
118
118
  prefixCls?: string;
119
119
  children?: any;
120
120
  blockNode?: boolean;
121
- /** 复选模式下,点中的树节点key */
122
- selectKey?: string | number | undefined;
121
+ /** 点中的树节点key,表单模式下value有值该配置优先级降低 */
122
+ selectedKey?: string | number | undefined;
123
123
  }
124
124
  export interface DataProps {
125
125
  label?: string;
@@ -1,10 +1,13 @@
1
+ @root-entry-name: 'default';
2
+ @import (reference) '~antd/es/style/themes/index.less';
3
+
1
4
  .pro-tree {
2
5
  height: 100%; // tree auto css
3
6
 
4
- .ant-spin-nested-loading {
7
+ .@{ant-prefix}-spin-nested-loading {
5
8
  height: 100%; // tree auto css
6
9
 
7
- .ant-spin-container {
10
+ .@{ant-prefix}-spin-container {
8
11
  height: 100%; // tree auto css
9
12
  }
10
13
  }
@@ -68,19 +71,19 @@
68
71
  }
69
72
  }
70
73
 
71
- .ant-tree-checkbox {
74
+ .@{ant-prefix}-tree-checkbox {
72
75
  margin-top: 11px;
73
76
  }
74
77
 
75
- .ant-tree-switcher {
78
+ .@{ant-prefix}-tree-switcher {
76
79
  line-height: 44px;
77
80
  }
78
81
 
79
- .ant-tree-switcher-leaf-line {
82
+ .@{ant-prefix}-tree-switcher-leaf-line {
80
83
  display: none;
81
84
  }
82
85
 
83
- .ant-tree-treenode {
86
+ .@{ant-prefix}-tree-treenode {
84
87
  align-items: flex-start;
85
88
  width : 100%;
86
89
  padding : 0;
@@ -88,15 +91,15 @@
88
91
  font-size : var(--zaui-font-size);
89
92
  }
90
93
 
91
- .ant-tree-node-content-wrapper {
94
+ .@{ant-prefix}-tree-node-content-wrapper {
92
95
  min-height : 20px;
93
96
  line-height: 20px;
94
97
  }
95
98
 
96
- .ant-tree-node-content-wrapper {
99
+ .@{ant-prefix}-tree-node-content-wrapper {
97
100
  width: 100%;
98
101
 
99
- .ant-tree-title {
102
+ .@{ant-prefix}-tree-title {
100
103
  display: block;
101
104
  width : 100%;
102
105
  }
@@ -104,13 +107,13 @@
104
107
 
105
108
  // 只读状态下,是否隐藏未勾选行
106
109
  .hide-disable-node {
107
- .ant-tree-treenode.ant-tree-treenode-disabled {
110
+ .@{ant-prefix}-tree-treenode.@{ant-prefix}-tree-treenode-disabled {
108
111
  display: none;
109
112
  }
110
113
 
111
- .ant-tree-treenode-checkbox-indeterminate,
112
- .ant-tree-treenode-checkbox-checked {
113
- &.ant-tree-treenode-disabled {
114
+ .@{ant-prefix}-tree-treenode-checkbox-indeterminate,
115
+ .@{ant-prefix}-tree-treenode-checkbox-checked {
116
+ &.@{ant-prefix}-tree-treenode-disabled {
114
117
  display: flex;
115
118
  }
116
119
  }
@@ -221,17 +224,17 @@
221
224
  }
222
225
 
223
226
  // 连接线、箭头宽度
224
- .ant-tree-show-line .ant-tree-indent-unit {
227
+ .@{ant-prefix}-tree-show-line .@{ant-prefix}-tree-indent-unit {
225
228
  width: 20px;
226
229
  }
227
230
 
228
- .ant-tree-switcher {
231
+ .@{ant-prefix}-tree-switcher {
229
232
  width : 20px;
230
233
  align-self: flex-start;
231
234
  margin-top: -4px;
232
235
  }
233
236
 
234
- .ant-tree-show-line .ant-tree-indent-unit::before {
237
+ .@{ant-prefix}-tree-show-line .@{ant-prefix}-tree-indent-unit::before {
235
238
  right: 9px;
236
239
  }
237
240
 
@@ -244,8 +247,8 @@
244
247
  }
245
248
 
246
249
  // 去除antd白色背景
247
- .ant-tree-show-line .ant-tree-switcher,
248
- .ant-tree {
250
+ .@{ant-prefix}-tree-show-line .@{ant-prefix}-tree-switcher,
251
+ .@{ant-prefix}-tree {
249
252
  background-color: transparent;
250
253
  }
251
254
 
@@ -264,12 +267,12 @@
264
267
  padding-top: 0px;
265
268
  min-width : 120px;
266
269
 
267
- .ant-popover-inner-content {
270
+ .@{ant-prefix}-popover-inner-content {
268
271
  padding: 0px;
269
272
  width : 100%;
270
273
  }
271
274
 
272
- .ant-popover-arrow {
275
+ .@{ant-prefix}-popover-arrow {
273
276
  display: none;
274
277
  }
275
278
 
@@ -301,8 +304,8 @@
301
304
  }
302
305
  }
303
306
 
304
- .ant-tree .ant-tree-treenode-disabled {
305
- .ant-tree-node-content-wrapper {
307
+ .@{ant-prefix}-tree .@{ant-prefix}-tree-treenode-disabled {
308
+ .@{ant-prefix}-tree-node-content-wrapper {
306
309
  color: var(--zaui-text);
307
310
  }
308
311
 
@@ -316,20 +319,20 @@
316
319
  }
317
320
 
318
321
  // 重置ant-form view模式样式ant-tree样式
319
- .pro-form.pro-form-view .ant-form-item .pro-tree * {
322
+ .pro-form.pro-form-view .@{ant-prefix}-form-item .pro-tree * {
320
323
  line-height: 1 !important;
321
324
  height : auto !important;
322
325
  min-height : auto !important;
323
326
  }
324
327
 
325
- .pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox {
328
+ .pro-form.pro-form-view .@{ant-prefix}-form-item .pro-tree .@{ant-prefix}-tree-checkbox {
326
329
  margin-top: var(--zaui-space-size-sm);
327
330
  }
328
331
 
329
- .pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-switcher {
332
+ .pro-form.pro-form-view .@{ant-prefix}-form-item .pro-tree .@{ant-prefix}-tree-switcher {
330
333
  padding-top: var(--zaui-font-size-sm);
331
334
  }
332
335
 
333
- .pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox * {
336
+ .pro-form.pro-form-view .@{ant-prefix}-form-item .pro-tree .@{ant-prefix}-tree-checkbox * {
334
337
  height: 16px !important;
335
338
  }
@@ -35,3 +35,9 @@ export declare function filterCheckedNodes(data: any, checkedKeys: any, searchSt
35
35
  * @returns
36
36
  */
37
37
  export declare function getChildrenKeys(node: TreeDataProps, childrenKeys: string[], fieldNames: FieldNamesType, type: 'treeClose' | 'treeCheck'): void;
38
+ /**
39
+ * 如果默认全开展那么返回所有key,否则返回空[]
40
+ * @param isExpand 是否全展开
41
+ * @param allkeys 所有key
42
+ */
43
+ export declare function getDefaultExpandKeys(isExpand: any, allKeys: any): any;
@@ -180,4 +180,15 @@ export function getChildrenKeys(node, childrenKeys, fieldNames, type) {
180
180
  }
181
181
  });
182
182
  }
183
+ }
184
+ /**
185
+ * 如果默认全开展那么返回所有key,否则返回空[]
186
+ * @param isExpand 是否全展开
187
+ * @param allkeys 所有key
188
+ */
189
+ export function getDefaultExpandKeys(isExpand, allKeys) {
190
+ if (isExpand) {
191
+ return allKeys;
192
+ }
193
+ return [];
183
194
  }
@@ -1,11 +1,9 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  function CloseIcon(props) {
4
- return _jsx("span", _objectSpread(_objectSpread({
5
- className: "ant-input-suffix"
6
- }, props), {}, {
4
+ return _jsx("span", _objectSpread(_objectSpread({}, props), {}, {
7
5
  children: _jsx("span", {
8
- className: "ant-input-clear-icon pro-tree-modal-checkbox-close",
6
+ className: "pro-tree-modal-checkbox-close",
9
7
  role: "button",
10
8
  children: _jsx("span", {
11
9
  role: "img",
@@ -5,9 +5,12 @@ interface TriggerProps {
5
5
  disabled?: boolean;
6
6
  isView?: boolean;
7
7
  checkAll?: boolean;
8
+ appoint: boolean;
9
+ allValue?: string | number;
8
10
  triggerStyle?: CSSProperties;
9
11
  handleClick: () => void;
10
12
  handleClearAll: () => void;
13
+ appointChange: (appoint?: boolean) => void;
11
14
  }
12
15
  declare function Trigger(props: TriggerProps): JSX.Element;
13
16
  export default Trigger;
@@ -1,24 +1,54 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import "antd/es/input/style";
3
3
  import _Input from "antd/es/input";
4
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ import "antd/es/select/style";
5
+ import _Select from "antd/es/select";
6
+ import "antd/es/space/style";
7
+ import _Space from "antd/es/space";
8
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ import { useEffect } from 'react';
5
11
  import classNames from 'classnames';
6
12
  import { CloseOutlined } from '@ant-design/icons';
7
13
  import { ReactSVG } from 'react-svg';
14
+ import { useSetState } from 'ahooks';
8
15
  import locale, { formatMessage } from '../../locale';
9
16
  import viewSvg from '../../assets/view.svg';
10
17
  function Trigger(props) {
11
- var _locale$ProTreeModal, _locale$ProTreeModal2, _locale$ProTreeModal3;
12
- var checkedValues = props.checkedValues,
13
- handleClick = props.handleClick,
14
- handleClearAll = props.handleClearAll,
15
- value = props.value,
16
- checkAll = props.checkAll,
18
+ var _locale$ProTreeModal2, _locale$ProTreeModal3;
19
+ var value = props.value,
17
20
  disabled = props.disabled,
18
21
  isView = props.isView,
19
- triggerStyle = props.triggerStyle;
20
- return _jsxs(_Fragment, {
21
- children: [isView ? _jsxs("div", {
22
+ triggerStyle = props.triggerStyle,
23
+ appoint = props.appoint,
24
+ allValue = props.allValue,
25
+ checkAll = props.checkAll,
26
+ checkedValues = props.checkedValues,
27
+ handleClick = props.handleClick,
28
+ handleClearAll = props.handleClearAll,
29
+ appointChange = props.appointChange;
30
+ var _useSetState = useSetState({
31
+ mode: 'appoint'
32
+ }),
33
+ _useSetState2 = _slicedToArray(_useSetState, 2),
34
+ state = _useSetState2[0],
35
+ setState = _useSetState2[1];
36
+ useEffect(function () {
37
+ if (checkAll && appoint) {
38
+ setState({
39
+ mode: 'all'
40
+ });
41
+ }
42
+ }, [checkAll]);
43
+ var onIconClick = function onIconClick() {
44
+ if (appoint && state.mode === 'all') {
45
+ return;
46
+ }
47
+ handleClick();
48
+ };
49
+ if (isView) {
50
+ var _locale$ProTreeModal;
51
+ return _jsxs("div", {
22
52
  className: "pro-tree-modal-isView",
23
53
  children: [_jsx("div", {
24
54
  children: checkedValues.length === 0 ? '-' : checkAll ? locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.checkAll : formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal = locale.ProTreeModal) === null || _locale$ProTreeModal === void 0 ? void 0 : _locale$ProTreeModal.checkNumber, {
@@ -29,11 +59,44 @@ function Trigger(props) {
29
59
  children: _jsx(ReactSVG, {
30
60
  className: "viewSvg",
31
61
  src: viewSvg,
32
- onClick: handleClick
62
+ onClick: onIconClick
33
63
  })
34
64
  })]
35
- }) : _jsx(_Input, {
36
- className: classNames(disabled ? 'trigger-no-hover' : ''),
65
+ });
66
+ }
67
+ var onAppointChange = function onAppointChange(value) {
68
+ setState({
69
+ mode: value
70
+ });
71
+ if (value === 'all') {
72
+ appointChange === null || appointChange === void 0 ? void 0 : appointChange(true);
73
+ } else {
74
+ appointChange === null || appointChange === void 0 ? void 0 : appointChange(false);
75
+ }
76
+ };
77
+ var TriggerComponent = function TriggerComponent(props) {
78
+ if (appoint) {
79
+ return _jsxs(_Space.Compact, {
80
+ block: true,
81
+ children: [_jsxs(_Select, {
82
+ defaultValue: "appoint",
83
+ value: state.mode,
84
+ onChange: onAppointChange,
85
+ children: [_jsx(_Select.Option, {
86
+ value: "all",
87
+ children: "\u5168\u90E8"
88
+ }), _jsx(_Select.Option, {
89
+ value: "appoint",
90
+ children: "\u6307\u5B9A"
91
+ })]
92
+ }), props.children]
93
+ });
94
+ }
95
+ return props.children;
96
+ };
97
+ return _jsx(TriggerComponent, {
98
+ children: _jsx(_Input, {
99
+ className: classNames(disabled ? 'trigger-no-hover' : '', appoint ? 'pro-tree-modal-input-appoint' : ''),
37
100
  onClick: handleClick,
38
101
  value: checkedValues.length === 0 ? null : checkAll ? locale === null || locale === void 0 ? void 0 : locale.ProTreeModal.checkAll : formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal2 = locale.ProTreeModal) === null || _locale$ProTreeModal2 === void 0 ? void 0 : _locale$ProTreeModal2.checkNumber, {
39
102
  num: checkedValues.length
@@ -48,16 +111,13 @@ function Trigger(props) {
48
111
  }), _jsx(ReactSVG, {
49
112
  className: "viewSvg",
50
113
  src: viewSvg,
51
- onClick: handleClick
114
+ onClick: onIconClick
52
115
  })]
53
116
  }),
54
117
  placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProTreeModal3 = locale.ProTreeModal) === null || _locale$ProTreeModal3 === void 0 ? void 0 : _locale$ProTreeModal3.select,
55
- disabled: disabled,
118
+ disabled: disabled || appoint && value === allValue,
56
119
  style: _objectSpread({}, triggerStyle)
57
- }), _jsx(_Input, {
58
- type: "hidden",
59
- value: value
60
- })]
120
+ })
61
121
  });
62
122
  }
63
123
  export default Trigger;