@lingxiteam/ebe-utils 0.2.21 → 0.2.23

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 (144) hide show
  1. package/lib/h5public/yarn.lock +7 -8
  2. package/lib/pcpublic/src/components/pcfactory/src/Button/index.tsx +11 -10
  3. package/lib/pcpublic/src/components/pcfactory/src/Card/CardTitle/index.tsx +31 -24
  4. package/lib/pcpublic/src/components/pcfactory/src/Card/index.tsx +32 -14
  5. package/lib/pcpublic/src/components/pcfactory/src/Card/useExtendBtn.tsx +85 -48
  6. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/ChartLine.tsx +24 -6
  7. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/PropsType.ts +31 -5
  8. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/index.tsx +3 -2
  9. package/lib/pcpublic/src/components/pcfactory/src/ChartLine/loader.tsx +1 -1
  10. package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +153 -129
  11. package/lib/pcpublic/src/components/pcfactory/src/Form/index.tsx +2 -5
  12. package/lib/pcpublic/src/components/pcfactory/src/Form/useFormStatus.ts +8 -4
  13. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +15 -3
  14. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/PropsType.ts +4 -3
  15. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/index.tsx +1 -1
  16. package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/loader.tsx +1 -1
  17. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +18 -4
  18. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/PropsType.ts +2 -1
  19. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/index.tsx +1 -1
  20. package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/loader.tsx +1 -1
  21. package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +7 -2
  22. package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/index.tsx +60 -26
  23. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +62 -55
  24. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +2 -6
  25. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +5 -5
  26. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/index.tsx +9 -2
  27. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/loader.ts +1 -1
  28. package/lib/pcpublic/src/components/pcfactory/src/Select/index.tsx +145 -66
  29. package/lib/pcpublic/src/components/pcfactory/src/Select/selectUtils.ts +13 -9
  30. package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +36 -26
  31. package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +69 -94
  32. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +12 -5
  33. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +9 -5
  34. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +11 -5
  35. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +11 -5
  36. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +14 -7
  37. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +30 -31
  38. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +89 -41
  39. package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +25 -12
  40. package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/index.tsx +12 -5
  41. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/PopoverWrapper.tsx +220 -0
  42. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +39 -32
  43. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +178 -148
  44. package/lib/pcpublic/src/components/pcfactory/src/Table/Table.tsx +439 -0
  45. package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +159 -72
  46. package/lib/pcpublic/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +12 -20
  47. package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +3 -0
  48. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/index.ts +4 -4
  49. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +32 -28
  50. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +44 -57
  51. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +306 -276
  52. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +9 -6
  53. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +30 -21
  54. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +33 -27
  55. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +84 -77
  56. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +33 -16
  57. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +15 -5
  58. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +33 -33
  59. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +13 -5
  60. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useScroll.ts +94 -28
  61. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSelection.ts +108 -99
  62. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +8 -5
  63. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +27 -43
  64. package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +73 -394
  65. package/lib/pcpublic/src/components/pcfactory/src/Table/loader.tsx +15 -0
  66. package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +2 -2
  67. package/lib/pcpublic/src/components/pcfactory/src/Table/types/event.d.ts +12 -8
  68. package/lib/pcpublic/src/components/pcfactory/src/Table/types/headerCell.d.ts +2 -1
  69. package/lib/pcpublic/src/components/pcfactory/src/Table/types/prop.d.ts +24 -11
  70. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/SequenceId.ts +2 -1
  71. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +90 -82
  72. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/indexedDBHelper.ts +9 -22
  73. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/translate.ts +59 -0
  74. package/lib/pcpublic/src/components/pcfactory/src/Transfer/Transfer.tsx +644 -0
  75. package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +49 -637
  76. package/lib/pcpublic/src/components/pcfactory/src/Transfer/loader.tsx +11 -0
  77. package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeEllipsisIcon.tsx +38 -0
  78. package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +34 -35
  79. package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +213 -149
  80. package/lib/pcpublic/src/components/pcfactory/src/TreeSelect/index.tsx +47 -43
  81. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/TreeTable.tsx +264 -0
  82. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -1
  83. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +9 -3
  84. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +9 -3
  85. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +52 -191
  86. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/loader.tsx +16 -0
  87. package/lib/pcpublic/src/components/pcfactory/src/assets/index.tsx +34 -0
  88. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/quadrate.tsx +20 -0
  89. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/roundness.tsx +14 -0
  90. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/semicircle.tsx +15 -0
  91. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/verticalLine.tsx +12 -0
  92. package/lib/pcpublic/src/components/pcfactory/src/styles/common.less +17 -0
  93. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +57 -11
  94. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +101 -12
  95. package/lib/pcpublic/src/components/pcfactory/src/styles/components/ModalSelect.less +6 -0
  96. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Select.less +70 -6
  97. package/lib/pcpublic/src/components/pcfactory/src/utils/ChannelContainer.tsx +20 -14
  98. package/lib/pcpublic/src/components/pcfactory/src/utils/ChildRender.ts +6 -8
  99. package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +4 -6
  100. package/lib/pcpublic/src/components/pcfactory/src/utils/DummyFormContext.ts +9 -13
  101. package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/empty.tsx +5 -17
  102. package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/index.tsx +3 -3
  103. package/lib/pcpublic/src/components/pcfactory/src/utils/Holidays.ts +11 -39
  104. package/lib/pcpublic/src/components/pcfactory/src/utils/HolidaysFormat.ts +83 -0
  105. package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/index.tsx +47 -0
  106. package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/scheduler.ts +74 -0
  107. package/lib/pcpublic/src/components/pcfactory/src/utils/LoaderHelper.tsx +4 -1
  108. package/lib/pcpublic/src/components/pcfactory/src/utils/Spin/index.tsx +8 -7
  109. package/lib/pcpublic/src/components/pcfactory/src/utils/WithSyncValue.ts +25 -23
  110. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/index.ts +10 -7
  111. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMap.ts +9 -6
  112. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +4 -1
  113. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/usePersistFn.ts +17 -0
  114. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +2 -2
  115. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSetState.ts +7 -5
  116. package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +23 -50
  117. package/lib/pcpublic/src/components/pcfactory/src/utils/constant.ts +53 -57
  118. package/lib/pcpublic/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +12 -17
  119. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +22 -12
  120. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +50 -19
  121. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +58 -37
  122. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +33 -30
  123. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/common.ts +2 -0
  124. package/lib/pcpublic/src/components/pcfactory/src/utils/generatorDisabledCallback.ts +121 -113
  125. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +16 -14
  126. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCompState.tsx +1 -1
  127. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDataMask.ts +7 -2
  128. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +3 -1
  129. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +16 -14
  130. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +9 -3
  131. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +4 -5
  132. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInit.ts +11 -0
  133. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +3 -1
  134. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useListenState.ts +1 -0
  135. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useLocale.ts +5 -3
  136. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +2 -2
  137. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useRules.ts +1 -1
  138. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +2 -0
  139. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +8 -4
  140. package/lib/pcpublic/src/components/pcfactory/src/utils/index.ts +10 -10
  141. package/lib/pcpublic/src/components/pcfactory/src/utils/polyfill.js +29 -31
  142. package/lib/pcpublic/src/components/pcfactory/src/utils/renderReadOnly.tsx +29 -26
  143. package/lib/public/public/iconfont.js +1 -0
  144. package/package.json +2 -2
@@ -7,57 +7,58 @@ const formatStr = {
7
7
  time: 'YYYY-MM-DD HH:mm:ss',
8
8
  };
9
9
 
10
- export type DisabledDateTimeFnResult = (cur: Moment) => {
11
- disabledHours: () => number[];
12
- disabledMinutes: () => number[];
13
- disabledSeconds: () => number[];
14
- };
10
+ export type DisabledDateTimeFnResult = (cur: Moment) => ({
11
+ disabledHours: () => number[];
12
+ disabledMinutes: () => number[];
13
+ disabledSeconds: () => number[];
14
+ })
15
+
15
16
 
16
17
  /**
17
18
  * 限制范围类型
18
19
  */
19
- export type LimitRangeType = (typeof DatePickerOptions.limitRangeOptions)[number]['value'];
20
+ export type LimitRangeType = typeof DatePickerOptions.limitRangeOptions[number]['value'];
20
21
 
21
22
  /**
22
23
  * 节假日类型
23
24
  */
24
- export type HolidaysLimitType = (typeof DatePickerOptions.holidaysLimitOptions)[number]['value'];
25
+ export type HolidaysLimitType = typeof DatePickerOptions.holidaysLimitOptions[number]['value'];
25
26
  export interface IGeneratorParams {
26
27
 
27
- /**
28
- * 限制类型
29
- */
30
- limitRange: LimitRangeType;
31
-
32
- /**
33
- * 日期模式
34
- */
35
- timeMode: 'time' | 'date';
36
-
37
- /**
38
- * 开始时间 limitRange => period
39
- */
40
- startDate?: string;
41
-
42
- /**
43
- * 截止时间 limitRange => period
44
- */
45
- endDate?: string;
46
-
47
- /**
48
- * 指定时间 limitRange => beforeSelect | afterSelect
49
- */
50
- selectTime?: string;
51
-
52
- /**
53
- * 可选时间 limitRange => multipleSelect
54
- */
55
- validMultiDate?: string[];
56
-
57
- /**
58
- * 节假日限制
59
- */
60
- holidaysLimit: HolidaysLimitType;
28
+ /**
29
+ * 限制类型
30
+ */
31
+ limitRange: LimitRangeType;
32
+
33
+ /**
34
+ * 日期模式
35
+ */
36
+ timeMode: 'time' | 'date';
37
+
38
+ /**
39
+ * 开始时间 limitRange => period
40
+ */
41
+ startDate?: string;
42
+
43
+ /**
44
+ * 截止时间 limitRange => period
45
+ */
46
+ endDate?: string;
47
+
48
+ /**
49
+ * 指定时间 limitRange => beforeSelect | afterSelect
50
+ */
51
+ selectTime?: string;
52
+
53
+ /**
54
+ * 可选时间 limitRange => multipleSelect
55
+ */
56
+ validMultiDate?: string[];
57
+
58
+ /**
59
+ * 节假日限制
60
+ */
61
+ holidaysLimit: HolidaysLimitType;
61
62
  }
62
63
 
63
64
  /**
@@ -65,7 +66,7 @@ export interface IGeneratorParams {
65
66
  * @param str runtime | 具体日期 | add:[1day] | subtract:[1day]
66
67
  * @returns
67
68
  */
68
- const getRelDate = (str: string): Moment | null => {
69
+ const getRelDate = (str: string):Moment | null => {
69
70
  if (str === 'runtime') {
70
71
  return moment();
71
72
  }
@@ -94,6 +95,7 @@ export const getPeriodDate = (dateStr: string, refDate: Moment = moment()): Mome
94
95
  return refDate[fn](amount, unit);
95
96
  };
96
97
 
98
+
97
99
  export interface GeneratorDisabledCallbackResultType {
98
100
 
99
101
  /**
@@ -123,7 +125,12 @@ export interface GeneratorDisabledCallbackResultType {
123
125
  }
124
126
 
125
127
  const getInfoFromMoment = (cur?: Moment): [string, number, number, number] => {
126
- return cur ? [cur?.format(formatStr.date), cur?.get('hours'), cur?.get('minutes'), cur?.get('seconds')] : ['', 0, 0, 0];
128
+ return cur ? [
129
+ cur?.format(formatStr.date),
130
+ cur?.get('hours'),
131
+ cur?.get('minutes'),
132
+ cur?.get('seconds'),
133
+ ] : ['', 0, 0, 0];
127
134
  };
128
135
 
129
136
  /**
@@ -141,33 +148,32 @@ const generatorDisabledDateTimeFn = (startDate?: Moment, endDate?: Moment): null
141
148
  const [startDateStr, startHour, startMinute, startSecond] = getInfoFromMoment(startDate);
142
149
  const [endDateStr, endHour, endMinute, endSecond] = getInfoFromMoment(endDate);
143
150
 
144
- return cur => {
151
+ return (cur) => {
145
152
  const [currentDateStr, currentHour, currentMinute] = getInfoFromMoment(cur);
146
153
  // 起始日期
147
154
  if (startDateStr === currentDateStr) {
148
155
  // 如果当前小时大于开始小时
149
156
  if (currentHour > startHour) {
150
157
  return {
151
- disabledHours: () => (startHour ? [...Array(startHour).keys()] : []), // 如果当前日期和startTime相同,禁止选择startTime之前的小时
158
+ disabledHours: () => startHour ? [...Array(startHour).keys()] : [], // 如果当前日期和startTime相同,禁止选择startTime之前的小时
152
159
  disabledMinutes: () => [],
153
160
  disabledSeconds: () => [],
154
161
  };
155
- // 如果当前小时等于开始小时,且当前分钟大于开始分钟
156
- }
157
- if (currentHour === startHour) {
162
+ // 如果当前小时等于开始小时,且当前分钟大于开始分钟
163
+ } if (currentHour === startHour) {
158
164
  if (currentMinute > startMinute) {
159
165
  return {
160
- disabledHours: () => (startHour ? [...Array(startHour).keys()] : []), // 如果当前日期和startTime相同,禁止选择startTime之前的小时
161
- disabledMinutes: () => (startMinute ? [...Array(startMinute).keys()] : []), // 如果当前日期和startTime相同,禁止选择startTime之前的分钟
166
+ disabledHours: () => startHour ? [...Array(startHour).keys()] : [], // 如果当前日期和startTime相同,禁止选择startTime之前的小时
167
+ disabledMinutes: () => startMinute ? [...Array(startMinute).keys()] : [], // 如果当前日期和startTime相同,禁止选择startTime之前的分钟
162
168
  disabledSeconds: () => [],
163
169
  };
164
170
  }
165
171
  }
166
172
  // 否则就按照开始时间的小时、分钟、秒钟来禁用
167
173
  return {
168
- disabledHours: () => (startHour ? [...Array(startHour).keys()] : []), // 如果当前日期和startTime相同,禁止选择startTime之前的小时
169
- disabledMinutes: () => (startMinute ? [...Array(startMinute).keys()] : []), // 如果当前日期和startTime相同,禁止选择startTime之前的分钟
170
- disabledSeconds: () => (startSecond ? [...Array(startSecond).keys()] : []), // 如果当前日期和startTime相同,禁止选择startTime之前的秒钟
174
+ disabledHours: () => startHour ? [...Array(startHour).keys()] : [], // 如果当前日期和startTime相同,禁止选择startTime之前的小时
175
+ disabledMinutes: () => startMinute ? [...Array(startMinute).keys()] : [], // 如果当前日期和startTime相同,禁止选择startTime之前的分钟
176
+ disabledSeconds: () => startSecond ? [...Array(startSecond).keys()] : [], // 如果当前日期和startTime相同,禁止选择startTime之前的秒钟
171
177
  };
172
178
  }
173
179
 
@@ -176,25 +182,24 @@ const generatorDisabledDateTimeFn = (startDate?: Moment, endDate?: Moment): null
176
182
  // 当前小时小于结束小时
177
183
  if (currentHour < endHour) {
178
184
  return {
179
- disabledHours: () => (endHour ? [...Array(24 - endHour - 1).keys()].map(h => h + endHour + 1) : []), // 如果当前日期和endTime相同,禁止选择endTime之后的小时
185
+ disabledHours: () => endHour ? [...Array(24 - endHour - 1).keys()].map(h => h + endHour + 1) : [], // 如果当前日期和endTime相同,禁止选择endTime之后的小时
180
186
  disabledMinutes: () => [],
181
187
  disabledSeconds: () => [],
182
188
  };
183
189
  // 当当前小时等于结束小时,且当前分钟小于结束分钟
184
- }
185
- if (currentHour === endHour) {
190
+ } if (currentHour === endHour) {
186
191
  if (currentMinute < endMinute) {
187
192
  return {
188
- disabledHours: () => (endHour ? [...Array(24 - endHour - 1).keys()].map(h => h + endHour + 1) : []), // 如果当前日期和endTime相同,禁止选择endTime之后的小时
189
- disabledMinutes: () => (endMinute ? [...Array(60 - endMinute - 1).keys()].map(m => m + endMinute + 1) : []), // 如果当前日期和endTime相同,禁止选择endTime之后的分钟
193
+ disabledHours: () => endHour ? [...Array(24 - endHour - 1).keys()].map(h => h + endHour + 1) : [], // 如果当前日期和endTime相同,禁止选择endTime之后的小时
194
+ disabledMinutes: () => endMinute ? [...Array(60 - endMinute - 1).keys()].map(m => m + endMinute + 1) : [], // 如果当前日期和endTime相同,禁止选择endTime之后的分钟
190
195
  disabledSeconds: () => [],
191
196
  };
192
197
  }
193
198
  }
194
199
  return {
195
- disabledHours: () => (endHour ? [...Array(24 - endHour - 1).keys()].map(h => h + endHour + 1) : []), // 如果当前日期和endTime相同,禁止选择endTime之后的小时
196
- disabledMinutes: () => (endMinute ? [...Array(60 - endMinute - 1).keys()].map(m => m + endMinute + 1) : []), // 如果当前日期和endTime相同,禁止选择endTime之后的分钟
197
- disabledSeconds: () => (endSecond ? [...Array(60 - endSecond - 1).keys()].map(s => s + endSecond + 1) : []), // 如果当前日期和endTime相同,禁止选择endTime之后的秒钟
200
+ disabledHours: () => endHour ? [...Array(24 - endHour - 1).keys()].map(h => h + endHour + 1) : [], // 如果当前日期和endTime相同,禁止选择endTime之后的小时
201
+ disabledMinutes: () => endMinute ? [...Array(60 - endMinute - 1).keys()].map(m => m + endMinute + 1) : [], // 如果当前日期和endTime相同,禁止选择endTime之后的分钟
202
+ disabledSeconds: () => endSecond ? [...Array(60 - endSecond - 1).keys()].map(s => s + endSecond + 1) : [], // 如果当前日期和endTime相同,禁止选择endTime之后的秒钟
198
203
  };
199
204
  }
200
205
 
@@ -206,13 +211,22 @@ const generatorDisabledDateTimeFn = (startDate?: Moment, endDate?: Moment): null
206
211
  };
207
212
  };
208
213
 
214
+
209
215
  /**
210
216
  * 根据传入的规则生成 日期禁用回调函数
211
217
  * @param params 入参
212
218
  * @returns
213
219
  */
214
220
  export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDisabledCallbackResultType => {
215
- const { holidaysLimit = 'no', limitRange, selectTime, startDate, endDate, validMultiDate, timeMode } = params;
221
+ const {
222
+ holidaysLimit = 'no',
223
+ limitRange,
224
+ selectTime,
225
+ startDate,
226
+ endDate,
227
+ validMultiDate,
228
+ timeMode,
229
+ } = params;
216
230
 
217
231
  /**
218
232
  * 所选日期
@@ -223,7 +237,7 @@ export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDi
223
237
  * 运行时间
224
238
  */
225
239
  const runtimeMoment = moment();
226
-
240
+
227
241
  const { isHolidayLimit } = getHolidaysChecker(holidaysLimit);
228
242
 
229
243
  const isTimeMode = timeMode === 'time';
@@ -233,8 +247,8 @@ export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDi
233
247
  * @param cb
234
248
  * @returns
235
249
  */
236
- const wrapperFn = (cb: (cur: Moment) => boolean) => {
237
- return (cur: Moment) => {
250
+ const wrapperFn = (cb: (cur:Moment) => boolean) => {
251
+ return (cur:Moment) => {
238
252
  if (isHolidayLimit(cur)) {
239
253
  return true;
240
254
  }
@@ -247,6 +261,7 @@ export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDi
247
261
  */
248
262
  const unlimitedFn = wrapperFn(() => false);
249
263
 
264
+
250
265
  /**
251
266
  * 默认方法
252
267
  */
@@ -265,7 +280,7 @@ export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDi
265
280
  case undefined:
266
281
  defaultResult.disabledDateFn = unlimitedFn;
267
282
  break;
268
- // 指定日期前后
283
+ // 指定日期前后
269
284
  case 'beforeSelect':
270
285
  case 'afterSelect': {
271
286
  if (limitRange === 'beforeSelect') {
@@ -273,29 +288,30 @@ export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDi
273
288
  } else {
274
289
  start = selectDateMoment.isValid() ? selectDateMoment : null;
275
290
  }
276
- defaultResult.disabledDateFn =
277
- selectTime && selectDateMoment.isValid()
278
- ? wrapperFn(cur => {
279
- return limitRange === 'beforeSelect' ? cur.isAfter(selectDateMoment) : cur.isBefore(selectDateMoment);
280
- })
281
- : unlimitedFn;
291
+ defaultResult.disabledDateFn = selectTime && selectDateMoment.isValid() ? wrapperFn((cur) => {
292
+ return limitRange === 'beforeSelect'
293
+ ? cur.isAfter(selectDateMoment)
294
+ : cur.isBefore(selectDateMoment);
295
+ }) : unlimitedFn;
282
296
  break;
283
297
  }
284
298
  case 'beforeToday':
285
299
  case 'afterToday': {
286
300
  if (limitRange === 'beforeToday') {
287
- end = isTimeMode ? runtimeMoment.clone() : runtimeMoment.clone().endOf('days');
301
+ end = isTimeMode ? runtimeMoment.clone() : (runtimeMoment.clone()).endOf('days');
288
302
  } else {
289
- start = isTimeMode ? runtimeMoment.clone() : runtimeMoment.clone().startOf('days');
303
+ start = isTimeMode ? runtimeMoment.clone() : (runtimeMoment.clone()).startOf('days');
290
304
  }
291
- defaultResult.disabledDateFn = wrapperFn(cur => {
292
- return limitRange === 'beforeToday' ? cur.isAfter(runtimeMoment.clone().endOf('days')) : cur.isBefore(runtimeMoment.clone().startOf('days'));
305
+ defaultResult.disabledDateFn = wrapperFn((cur) => {
306
+ return limitRange === 'beforeToday'
307
+ ? cur.isAfter(runtimeMoment.clone().endOf('days'))
308
+ : cur.isBefore(runtimeMoment.clone().startOf('days'));
293
309
  });
294
310
  break;
295
311
  }
296
312
  case 'multipleSelect':
297
313
  defaultResult.disabledDateFn = validMultiDate?.length
298
- ? wrapperFn(cur => {
314
+ ? wrapperFn((cur) => {
299
315
  const curStr = cur.format(formatStr.date);
300
316
  return !validMultiDate.includes(curStr);
301
317
  })
@@ -328,9 +344,9 @@ export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDi
328
344
  const dynamicStr = startStr === 'runtime' ? endStr : startStr;
329
345
  const leng = Number(dynamicStr.replace(/\D+/, ''));
330
346
  const unit = dynamicStr.replace(/\d+/, '');
331
-
347
+
332
348
  const fnType = startStr === 'runtime' ? 'add' : 'subtract';
333
-
349
+
334
350
  // 工作日需要特殊处理
335
351
  if (unit === 'workdays') {
336
352
  let curLength = leng;
@@ -371,7 +387,7 @@ export const generatorDisabledCallback = (params: IGeneratorParams): GeneratorDi
371
387
  defaultResult.disabledDateTimeFn = generatorDisabledDateTimeFn(start, end);
372
388
  }
373
389
 
374
- defaultResult.disabledDateFn = wrapperFn(cur => {
390
+ defaultResult.disabledDateFn = wrapperFn((cur) => {
375
391
  const curStr = cur.format(formatStr.date);
376
392
  if (dynamicDisabledDate.includes(curStr)) {
377
393
  return true;
@@ -418,7 +434,9 @@ export interface RuleCallbackProps extends GeneratorDisabledCallbackResultType {
418
434
  format: string;
419
435
  }
420
436
 
421
- export const getRuleCallback = (props: RuleCallbackProps): string => {
437
+ export const getRuleCallback = (
438
+ props: RuleCallbackProps
439
+ ): string => {
422
440
  const { disabledDateFn, tiemMode, startDate, currentValue, endDate, holidaysLimit, getLocale, name, format } = props;
423
441
 
424
442
  const isArray = Array.isArray(currentValue) && currentValue.length === 2;
@@ -434,43 +452,33 @@ export const getRuleCallback = (props: RuleCallbackProps): string => {
434
452
  });
435
453
  }
436
454
  const list = [
437
- startDate
438
- ? {
439
- min: currentStart,
440
- max: startDate,
441
- type: 'DatePicker.after',
442
- }
443
- : null,
444
- startDate
445
- ? {
446
- min: currentEnd,
447
- max: startDate,
448
- type: 'DatePicker.after',
449
- }
450
- : null,
451
- endDate
452
- ? {
453
- min: endDate,
454
- max: currentStart,
455
- type: 'DatePicker.before',
456
- }
457
- : null,
458
- endDate
459
- ? {
460
- min: endDate,
461
- max: currentEnd,
462
- type: 'DatePicker.before',
463
- }
464
- : null,
455
+ startDate ? {
456
+ min: currentStart,
457
+ max: startDate,
458
+ type: 'DatePicker.after',
459
+ } : null,
460
+ startDate ? {
461
+ min: currentEnd,
462
+ max: startDate,
463
+ type: 'DatePicker.after',
464
+ } : null,
465
+ endDate ? {
466
+ min: endDate,
467
+ max: currentStart,
468
+ type: 'DatePicker.before',
469
+ } : null,
470
+ endDate ? {
471
+ min: endDate,
472
+ max: currentEnd,
473
+ type: 'DatePicker.before',
474
+ } : null,
465
475
  ].filter(el => !!el);
466
476
  for (let i = 0; i < list.length; i += 1) {
467
477
  const item = list[i];
468
478
  if (item && item.min < item.max) {
469
479
  return getLocale(item.type, {
470
480
  name,
471
- [`${item.type === 'DatePicker.after' ? 'startTime' : 'endTime'}`]: (item.type === 'DatePicker.after' ? item.max : item.min).format(
472
- tiemMode === 'time' ? formatStr.time : formatStr.date
473
- ),
481
+ [`${item.type === 'DatePicker.after' ? 'startTime' : 'endTime'}`]: (item.type === 'DatePicker.after' ? item.max : item.min).format(tiemMode === 'time' ? formatStr.time : formatStr.date),
474
482
  });
475
483
  }
476
484
  }
@@ -484,7 +492,7 @@ export const getRuleCallback = (props: RuleCallbackProps): string => {
484
492
  name,
485
493
  });
486
494
  };
487
-
495
+
488
496
  const { isHolidayLimit } = getHolidaysChecker(holidaysLimit);
489
497
  let diff = currentEnd.diff(currentStart, 'days');
490
498
  let flag = false;
@@ -1,9 +1,9 @@
1
1
  import React, { useEffect, useImperativeHandle } from 'react';
2
- import { MonitorFn, useForm } from '../formUtils/FormContext';
3
2
  import { FormFieldsHooks } from '../formUtils/FormFields';
3
+ import useRules, { createEmptyRule, RuleInterface } from './useRules';
4
4
  import { useListenProps } from './useListenState';
5
+ import { MonitorFn, useForm } from '../formUtils/FormContext';
5
6
  import { useLocale } from './useLocale';
6
- import useRules, { createEmptyRule, RuleInterface } from './useRules';
7
7
 
8
8
  /**
9
9
  *
@@ -12,7 +12,13 @@ import useRules, { createEmptyRule, RuleInterface } from './useRules';
12
12
  * @param depends 依赖监听
13
13
  */
14
14
  export const useCommonImperativeHandle = (ref: any, props: any, handle: any = {}) => {
15
- const { disabled: propsDisabled, required: propsRequired, readOnly: propsReadOnly, getEngineApis, fieldName } = props;
15
+ const {
16
+ disabled: propsDisabled,
17
+ required: propsRequired,
18
+ readOnly: propsReadOnly,
19
+ getEngineApis,
20
+ fieldName,
21
+ } = props;
16
22
 
17
23
  const engineApis = getEngineApis();
18
24
 
@@ -31,17 +37,13 @@ export const useCommonImperativeHandle = (ref: any, props: any, handle: any = {}
31
37
  const { getLocale, lang } = useLocale(engineApis);
32
38
 
33
39
  // 通用规则生成
34
- const [finalRules, setExtendRules, setFinialRules] = useRules(
35
- {
36
- required,
37
- regexp: props.regexp,
38
- rules: props.rules,
39
- message: props.message,
40
- name: props.name,
41
- },
42
- getLocale,
43
- lang
44
- );
40
+ const [finalRules, setExtendRules, setFinialRules] = useRules({
41
+ required,
42
+ regexp: props.regexp,
43
+ rules: props.rules,
44
+ message: props.message,
45
+ name: props.name,
46
+ }, getLocale, lang);
45
47
 
46
48
  const clearValue = () => {
47
49
  let initValue: any = '';
@@ -1,4 +1,4 @@
1
- import { useMemo } from 'react';
1
+ import React, { useMemo } from 'react';
2
2
 
3
3
  export const renderHTML = (des: string) => {
4
4
  if (des) {
@@ -1,3 +1,4 @@
1
+
1
2
  import { useMemo } from 'react';
2
3
  import { useCreation } from '../ahooks';
3
4
 
@@ -36,11 +37,15 @@ export const useDataMask = ({
36
37
  };
37
38
  }
38
39
 
39
- const defaultMaskValue = defaultValue !== undefined ? functorsMap.DATAMASK(defaultValue || '', dataMask) : defaultValue;
40
+ const defaultMaskValue =
41
+ defaultValue !== undefined
42
+ ? functorsMap.DATAMASK(defaultValue || '', dataMask)
43
+ : defaultValue;
40
44
  return {
41
45
  isMask: true,
42
46
  defaultMaskValue,
43
- maskValue: value !== undefined ? functorsMap.DATAMASK(value || '', dataMask) : defaultMaskValue,
47
+ maskValue:
48
+ value !== undefined ? functorsMap.DATAMASK(value || '', dataMask) : defaultMaskValue,
44
49
  getMaskData(value) {
45
50
  return functorsMap.DATAMASK(value, dataMask);
46
51
  },
@@ -5,7 +5,7 @@ export interface DoubleClickProps {
5
5
  events: Record<string, MouseEventHandler<HTMLElement> | undefined>;
6
6
  clickName: string;
7
7
  doubleClickName: string;
8
- type?: 'Button';
8
+ type?: 'Button'
9
9
  }
10
10
 
11
11
  /**
@@ -44,6 +44,7 @@ const useDoubleClick = ({ events = {}, clickName = 'onClick', doubleClickName =
44
44
 
45
45
  useEffect(() => resetClickParams, []);
46
46
 
47
+
47
48
  // 存在双击事件
48
49
  const target: DoubleClickProps['events'] = {
49
50
  [clickName]: (...args) => {
@@ -66,6 +67,7 @@ const useDoubleClick = ({ events = {}, clickName = 'onClick', doubleClickName =
66
67
  },
67
68
  };
68
69
 
70
+
69
71
  return target;
70
72
  };
71
73
 
@@ -1,6 +1,11 @@
1
1
  import { useCallback } from 'react';
2
2
 
3
- export type FuncExpExeCuteType = (str: string, params: { key: string; value: any }[], execute?: Function, getLocale?: Function) => any;
3
+ export type FuncExpExeCuteType = (
4
+ str: string,
5
+ params: ({ key: string; value: any })[],
6
+ execute?: Function,
7
+ getLocale?: Function
8
+ ) => any;
4
9
 
5
10
  const funcExpExeCute: FuncExpExeCuteType = (str, params, execute, getLocale?: Function) => {
6
11
  if (!str) return '';
@@ -10,18 +15,18 @@ const funcExpExeCute: FuncExpExeCuteType = (str, params, execute, getLocale?: Fu
10
15
  try {
11
16
  if (params && Array.isArray(params)) {
12
17
  const isArrowFunc = codeStr.indexOf('=>') !== -1;
13
-
18
+
14
19
  if (isArrowFunc) {
15
20
  const [funcDefine, funcBody] = codeStr.split('=>');
16
21
  codeStr = `function ${funcDefine} ${funcBody}`;
17
22
  }
18
-
23
+
19
24
  const codeFunc = execute?.(codeStr);
20
25
 
21
26
  if (typeof codeFunc !== 'function') {
22
27
  throw new Error(getLocale?.('functionWarning') || '必须为函数声明的表达式');
23
28
  }
24
-
29
+
25
30
  let funcParams: any = [];
26
31
 
27
32
  /**
@@ -34,18 +39,18 @@ const funcExpExeCute: FuncExpExeCuteType = (str, params, execute, getLocale?: Fu
34
39
  funcParams = params.map(param => param.value);
35
40
  } else {
36
41
  const objParam: any = {};
37
-
42
+
38
43
  params.forEach(param => {
39
44
  objParam[param.key] = param.value;
40
45
  });
41
-
46
+
42
47
  funcParams = objParam;
43
48
  }
44
-
49
+
45
50
  if (funcParams && Array.isArray(funcParams)) {
46
51
  return codeFunc(...funcParams);
47
52
  }
48
-
53
+
49
54
  return codeFunc(funcParams);
50
55
  }
51
56
  } catch (error) {
@@ -65,10 +70,7 @@ export const useFuncExpExecute = (executor: Function, getLocale?: any) => {
65
70
  * @param {function} execute
66
71
  * @returns
67
72
  */
68
- return useCallback(
69
- (str, params) => {
70
- return funcExpExeCute(str, params, executor, getLocale);
71
- },
72
- [executor]
73
- );
73
+ return useCallback((str, params) => {
74
+ return funcExpExeCute(str, params, executor, getLocale);
75
+ }, [executor]);
74
76
  };
@@ -1,7 +1,13 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
 
3
3
  // 静态页面查询静态数据
4
- const useGetStaticAttrData = ({ attrNbrs = [], engineApis }: { attrNbrs: any; engineApis?: any }) => {
4
+ const useGetStaticAttrData = ({
5
+ attrNbrs = [],
6
+ engineApis,
7
+ }: {
8
+ attrNbrs: any;
9
+ engineApis?: any;
10
+ }) => {
5
11
  const [attrDataMap, setAttrDataMap] = useState<any>([]);
6
12
 
7
13
  const getAttrData = async () => {
@@ -14,7 +20,7 @@ const useGetStaticAttrData = ({ attrNbrs = [], engineApis }: { attrNbrs: any; en
14
20
  const res = await engineApis?.service?.batchGetAppStaticAttr({
15
21
  attrCodes,
16
22
  });
17
- Object.keys(res).forEach(key => {
23
+ Object.keys(res).forEach((key) => {
18
24
  attrMap[key] = (res[key] || []).map((item: any) => ({
19
25
  label: item.attrValueName,
20
26
  value: item.attrValue,
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties, useMemo } from 'react';
2
2
 
3
+
3
4
  /**
4
5
  *
5
6
  * @param visible 是否显示
@@ -22,18 +23,16 @@ const useHiddenStyle = (visible: boolean, style?: CSSProperties, visibility?: bo
22
23
  return _style;
23
24
  }
24
25
  if (visibility) {
25
- return {
26
- visibility: 'hidden',
27
- transform: 'opacity 0.3s ease',
28
- opacity: 0,
29
- };
26
+ return { visibility: 'hidden', transform: 'opacity 0.3s ease', opacity: 0 };
30
27
  }
31
28
  return { display: 'none' };
32
29
  }
33
30
  return style || {};
34
31
  }, [visible, visibility]);
35
32
 
33
+
36
34
  return finalStyle;
37
35
  };
38
36
 
37
+
39
38
  export default useHiddenStyle;
@@ -0,0 +1,11 @@
1
+ import { useRef } from 'react';
2
+
3
+ const useInit = (cb: () => void) => {
4
+ const isInitRef = useRef(false);
5
+ if (!isInitRef.current) {
6
+ isInitRef.current = true;
7
+ cb();
8
+ }
9
+ };
10
+
11
+ export default useInit;
@@ -3,7 +3,9 @@ import { useRef, useState } from 'react';
3
3
  import { useLocale } from './useLocale';
4
4
 
5
5
  const useInitReactQuill = (props: any) => {
6
- const { engineApis } = props;
6
+ const {
7
+ engineApis,
8
+ } = props;
7
9
 
8
10
  const quillRef: any = useRef(null);
9
11