@lingxiteam/ebe-utils 0.2.22 → 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
@@ -1,22 +1,25 @@
1
1
  import classNames from 'classnames';
2
+ import { useEffect, useState, useRef } from 'react';
2
3
  import { clone } from 'lodash';
3
- import { useEffect, useRef, useState } from 'react';
4
4
  import { useCreation } from '../../utils/ahooks';
5
5
 
6
6
  const TABLE_ZEBRA_STRIPE_TYPE_CODE = 'zebra';
7
7
  const TABLE_BORDER_TYPE_CODE = 'border';
8
8
 
9
9
  const useCommon = (props: any) => {
10
- const { rowKeyType, rowKey, bordered, boundDataSource } = props;
10
+ const {
11
+ rowKeyType,
12
+ rowKey,
13
+ bordered,
14
+ boundDataSource,
15
+ } = props;
11
16
 
12
17
  const state = props.pageState;
13
18
  const isBordered = typeof bordered === 'boolean' ? bordered : bordered === TABLE_BORDER_TYPE_CODE; // 是否为边框线类型,且兼容带borderd的存量数据
14
19
  const isZebraStripe = typeof bordered === 'boolean' ? bordered : bordered === TABLE_ZEBRA_STRIPE_TYPE_CODE; // 是否为斑马纹类型
15
20
  const [currentRowKey, setCurrentRowKey] = useState<any>(rowKey);
16
-
17
- const innerClassName = classNames('ued-table', {
18
- 'ued-table-zebra-stripe': isZebraStripe,
19
- });
21
+
22
+ const innerClassName = classNames('ued-table', { 'ued-table-zebra-stripe': isZebraStripe });
20
23
 
21
24
  useEffect(() => {
22
25
  // 行主键自动生成时,替换行主键
@@ -1,6 +1,6 @@
1
- import { message } from 'antd';
2
1
  import { useEffect, useMemo, useRef, useState } from 'react';
3
- import { createAutoKey, createTempRowKey, deleteTempRowProperties, EMPTY_ROW_TEMP_KEY_ATTR } from '../utils';
2
+ import { message } from 'antd';
3
+ import { deleteTempRowProperties, createTempRowKey, createAutoKey, EMPTY_ROW_TEMP_KEY_ATTR } from '../utils';
4
4
  import SequenceId from '../utils/SequenceId';
5
5
 
6
6
  const useDataSource = (props: any) => {
@@ -22,13 +22,9 @@ const useDataSource = (props: any) => {
22
22
  const [dataSource, setDataSource] = useState<any[]>([]);
23
23
 
24
24
  // 创建id 实例
25
- const seqId = useMemo(
26
- () =>
27
- new SequenceId({
28
- type: 'random',
29
- }),
30
- []
31
- );
25
+ const seqId = useMemo(() => new SequenceId({
26
+ type: 'random',
27
+ }), []);
32
28
 
33
29
  // 表格当前页数据
34
30
  const currentPageDataSource = useMemo(() => {
@@ -36,10 +32,19 @@ const useDataSource = (props: any) => {
36
32
  const currentPageData =
37
33
  hasPageChangeEvent || !page
38
34
  ? dataSource
39
- : dataSource.slice((pagination?.current - 1) * pagination?.pageSize, pagination?.current * pagination?.pageSize);
35
+ : dataSource.slice(
36
+ (pagination?.current - 1) * pagination?.pageSize,
37
+ pagination?.current * pagination?.pageSize,
38
+ );
40
39
 
41
40
  return currentPageData;
42
- }, [dataSource, hasPageChangeEvent, page, pagination?.current, pagination?.pageSize]);
41
+ }, [
42
+ dataSource,
43
+ hasPageChangeEvent,
44
+ page,
45
+ pagination?.current,
46
+ pagination?.pageSize,
47
+ ]);
43
48
 
44
49
  // 表格自动生成主键时,记录当前使用的index值,不使用数据下标,防止重复报错
45
50
  const rowIdMapRef: any = useRef();
@@ -85,16 +90,13 @@ const useDataSource = (props: any) => {
85
90
  let fd: any[] = outerDataSource || [];
86
91
  // 处理数据
87
92
  if (!Array.isArray(fd)) {
88
- message.warn(
89
- getLocale('Table.data.typeError', {
90
- type: Object.prototype.toString.call(fd),
91
- })
92
- );
93
+ message.warn(getLocale('Table.data.typeError', { type: Object.prototype.toString.call(fd) }));
93
94
  return;
94
95
  }
95
96
 
96
97
  const tempRows = fd.filter(r => r?.[EMPTY_ROW_TEMP_KEY_ATTR]);
97
- const lastTempRow = tempRows[tempRows.length - 1];
98
+ // 新增空白行数据会追加到最前面
99
+ const lastTempRow = tempRows[0];
98
100
 
99
101
  fd = fd.map((i: any, idx) => {
100
102
  if (i) {
@@ -123,8 +125,8 @@ const useDataSource = (props: any) => {
123
125
  // }
124
126
 
125
127
  /**
126
- * 移除空白行的临时属性
127
- * 最后一条空白行,不允许自动移除临时属性(交由保存/取消逻辑手动移除)
128
+ * 移除其余空白行的临时属性
129
+ * 最后新一条空白行数据,不允许自动移除临时属性(交由保存/取消逻辑手动移除)
128
130
  */
129
131
  if (lastTempRow?.[EMPTY_ROW_TEMP_KEY_ATTR] !== i?.[EMPTY_ROW_TEMP_KEY_ATTR]) {
130
132
  // 移除临时属性
@@ -134,7 +136,8 @@ const useDataSource = (props: any) => {
134
136
  ...(i || {}),
135
137
  };
136
138
  }
137
- return setTableRowKey({ ...(i || {}) }, idx);
139
+ // 自动生成的主键需要同步到源数据上
140
+ setTableRowKey(i, idx);
138
141
  }
139
142
 
140
143
  /**
@@ -150,7 +153,13 @@ const useDataSource = (props: any) => {
150
153
  setCurrentPage(1);
151
154
  }
152
155
  setDataSource(fd);
153
- }, [outerDataSourceRef.current, currentRowKey, boundDataSource, hasPageChangeEvent, page]);
156
+ }, [
157
+ outerDataSourceRef.current,
158
+ currentRowKey,
159
+ boundDataSource,
160
+ hasPageChangeEvent,
161
+ page,
162
+ ]);
154
163
 
155
164
  return {
156
165
  outerDataSource,
@@ -1,9 +1,9 @@
1
- import { useEffect, useState } from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import CommIconEG from '../../Icon';
3
- import { handleIsValidIconCfg } from '../../Icon/hooks';
4
3
  import CommIconED from '../../Icon/IconED';
5
- import { useUpdateEffect } from '../../utils/ahooks';
4
+ import { handleIsValidIconCfg } from '../../Icon/hooks';
6
5
  import { useLocale } from '../../utils/hooks/useLocale';
6
+ import { useUpdateEffect } from '../../utils/ahooks';
7
7
 
8
8
  const useExpandable = (expandCfg: any, isED?: boolean) => {
9
9
  const {
@@ -64,9 +64,8 @@ const useExpandable = (expandCfg: any, isED?: boolean) => {
64
64
  // 非树形表格调用时,isLeaf 为 undefined
65
65
  if (!isTree) {
66
66
  // 需要兼容表格存量树形数据判断
67
- isLeaf =
68
- !Array.isArray(record?.[realChildrenColumnName]) ||
69
- (Array.isArray(record?.[realChildrenColumnName]) && record?.[realChildrenColumnName]?.length === 0);
67
+ isLeaf = !Array.isArray(record?.[realChildrenColumnName])
68
+ || (Array.isArray(record?.[realChildrenColumnName]) && record?.[realChildrenColumnName]?.length === 0);
70
69
  }
71
70
 
72
71
  // 若没有下级
@@ -105,7 +104,12 @@ const useExpandable = (expandCfg: any, isED?: boolean) => {
105
104
  if (handleIsValidIconCfg(expandOpenIcon)) {
106
105
  openIcon = (
107
106
  // @ts-ignore
108
- <CommIcon icon={expandOpenIcon} className={customIconCls} engineApis={engineApis} onClick={handleIconClick} />
107
+ <CommIcon
108
+ icon={expandOpenIcon}
109
+ className={customIconCls}
110
+ engineApis={engineApis}
111
+ onClick={handleIconClick}
112
+ />
109
113
  );
110
114
  }
111
115
 
@@ -117,7 +121,12 @@ const useExpandable = (expandCfg: any, isED?: boolean) => {
117
121
  if (handleIsValidIconCfg(expandCloseIcon)) {
118
122
  closeIcon = (
119
123
  // @ts-ignore
120
- <CommIcon icon={expandCloseIcon} className={customIconCls} engineApis={engineApis} onClick={handleIconClick} />
124
+ <CommIcon
125
+ icon={expandCloseIcon}
126
+ className={customIconCls}
127
+ engineApis={engineApis}
128
+ onClick={handleIconClick}
129
+ />
121
130
  );
122
131
  }
123
132
 
@@ -152,8 +161,8 @@ const useExpandable = (expandCfg: any, isED?: boolean) => {
152
161
  busiCompStatesKeys.forEach(k => {
153
162
  if (typeof busiCompStates[k] === 'string') {
154
163
  const originExp = busiCompStates[k];
155
- busiCompStates[k] = (row: any, rowId: any, index: number) =>
156
- sandBoxSafeRun(originExp, {
164
+ busiCompStates[k] = (row: any, rowId: any, index: number) => sandBoxSafeRun(originExp,
165
+ {
157
166
  row,
158
167
  rowId,
159
168
  index,
@@ -213,8 +222,7 @@ const useExpandable = (expandCfg: any, isED?: boolean) => {
213
222
  value: record,
214
223
  },
215
224
  ]);
216
- }
217
- if (funcExpExecute && rowExpandable) {
225
+ } if (funcExpExecute && rowExpandable) {
218
226
  /**
219
227
  * 新版:配置态生成的DSL就是一个$$包含函数的表达式
220
228
  * 但会经过预处理移除 $$
@@ -237,22 +245,20 @@ const useExpandable = (expandCfg: any, isED?: boolean) => {
237
245
  }
238
246
 
239
247
  const handleAllExpandRowKeys = (rows: any[]) => {
240
- const currPageRowKeys: any[] = rows
241
- .map((row: any) => {
242
- // 树形数据时,存在多级
243
- if (row?.[realChildrenColumnName]) {
244
- return [row?.[currentRowKey], ...handleAllExpandRowKeys(row[realChildrenColumnName])];
245
- }
248
+ const currPageRowKeys: any[] = rows.map((row: any) => {
249
+ // 树形数据时,存在多级
250
+ if (row?.[realChildrenColumnName]) {
251
+ return [row?.[currentRowKey], ...handleAllExpandRowKeys(row[realChildrenColumnName])];
252
+ }
246
253
 
247
- return row?.[currentRowKey];
248
- })
249
- .reduce((prev: any, curr: any) => {
250
- // 将数组数据打平
251
- if (Array.isArray(curr)) {
252
- return [...prev, ...curr];
253
- }
254
- return [...prev, curr];
255
- }, []);
254
+ return row?.[currentRowKey];
255
+ }).reduce((prev: any, curr: any) => {
256
+ // 将数组数据打平
257
+ if (Array.isArray(curr)) {
258
+ return [...prev, ...curr];
259
+ }
260
+ return [...prev, curr];
261
+ }, []);
256
262
  return currPageRowKeys || [];
257
263
  };
258
264
 
@@ -1,11 +1,17 @@
1
1
  /* eslint-disable react/no-danger-with-children */
2
- import { Button, Checkbox } from 'antd';
2
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
+ import { Checkbox, Button } from 'antd';
3
4
  import { FilterDropdownProps } from 'antd/lib/table/interface';
4
5
  import _ from 'lodash';
5
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
6
 
7
7
  const useFilter = (props: any) => {
8
- const { compId, innerDataSource, currentRowKey, getLocale, outerDataSourceRef } = props;
8
+ const {
9
+ compId,
10
+ innerDataSource,
11
+ currentRowKey,
12
+ getLocale,
13
+ pagination,
14
+ } = props;
9
15
 
10
16
  const [filters, setFilters] = useState<any>({}); // 筛选条件
11
17
  // 筛选时不影响页码,不使用antd默认的确定方法,因为会导致触发onChange方法
@@ -39,16 +45,14 @@ const useFilter = (props: any) => {
39
45
  }, [filters]);
40
46
 
41
47
  // 判断行是否经过筛选后需要隐藏
42
- const checkIfHiddenRow = useCallback(
43
- (rowId: string) => {
44
- let flag: boolean = false;
45
- if (rowFilterSetList?.length) {
46
- flag = !rowFilterSetList.every((rowSet: Set<string>) => rowSet.has(rowId));
47
- }
48
- return flag;
49
- },
50
- [rowFilterSetList]
51
- );
48
+ const checkIfHiddenRow = useCallback((rowId: string) => {
49
+ let flag: boolean = false;
50
+ if (rowFilterSetList?.length) {
51
+ flag = !rowFilterSetList.every((rowSet: Set<string>) => rowSet.has(rowId));
52
+ }
53
+ return flag;
54
+ }, [rowFilterSetList]);
55
+
52
56
 
53
57
  // 筛选下拉列表显隐
54
58
  const onFilterDropdownVisibleChange = (dataIndex: string, open: boolean) => {
@@ -63,6 +67,7 @@ const useFilter = (props: any) => {
63
67
  }
64
68
  };
65
69
 
70
+
66
71
  // 筛选条件下拉列表
67
72
  const collectFilterDropDownDom = (colParams: { dataIndex: string }) => {
68
73
  const { dataIndex } = colParams;
@@ -107,16 +112,21 @@ const useFilter = (props: any) => {
107
112
  };
108
113
  };
109
114
 
115
+
110
116
  useEffect(() => {
111
- // 源数据变化时,重置筛选条件以及重新收集筛选条件
117
+ // 源数据或者页码变化时,重置筛选条件以及重新收集筛选条件
112
118
  setFilters({});
113
119
  tempFilterDomList.current = {};
114
- }, [outerDataSourceRef, currentRowKey]);
120
+ }, [
121
+ innerDataSource,
122
+ currentRowKey,
123
+ pagination?.current,
124
+ ]);
115
125
 
116
126
  // 收集所有筛选条件
117
127
  const collectAllFilters = (columns: any[], dataIndex: any) => {
118
128
  if (!Object.keys(tempFilterDomList.current)?.length || !tempFilterDomList.current?.[dataIndex]) {
119
- columns.forEach(col => {
129
+ columns.forEach((col) => {
120
130
  if (col.filter) {
121
131
  collectFilterDropDownDom({
122
132
  ...col,
@@ -162,68 +172,65 @@ const useFilter = (props: any) => {
162
172
  const setSelectedKeys = (keys: string[] | null) => setSelectedFilterKeys((pre: any) => ({ ...pre, [dataIndex]: keys }));
163
173
  collectAllFilters(columns, dataIndex);
164
174
  const valMap = getCurrentFilterList(dataIndex);
165
- return (
166
- visible && (
167
- <div className="ued-table-filters">
168
- <div className="ued-table-filters-content">
169
- {Object.keys(valMap || {}).map((val: any) => {
170
- const { dom } = valMap[val];
171
- return (
172
- <div className="ued-table-filters-item">
173
- <Checkbox
174
- checked={selectedKeys.includes(val)}
175
- onChange={e => {
176
- let newSelected: any[] = [];
177
- if (e.target.checked) {
178
- newSelected = [...selectedKeys, val];
179
- } else {
180
- newSelected = selectedKeys.filter((k: string) => k !== val);
181
- }
182
- setSelectedKeys(newSelected?.length ? newSelected : null);
183
- }}
184
- >
185
- <div
186
- className="ued-table-filters-dom"
187
- // eslint-disable-next-line react/no-danger
188
- dangerouslySetInnerHTML={dom && val ? { __html: dom } : undefined}
189
- >
190
- {val ? null : `(${getLocale('Table.filter.empty')})`}
191
- </div>
192
- </Checkbox>
193
- </div>
194
- );
195
- })}
196
- </div>
197
- <div className="ued-table-filters-bottom">
198
- <Button
199
- type="link"
200
- disabled={selectedKeys?.length === 0}
201
- size="small"
202
- onClick={() => {
203
- setSelectedKeys(null);
204
- }}
205
- >
206
- {getLocale('reset')}
207
- </Button>
208
- <Button
209
- type="primary"
210
- size="small"
211
- onClick={() => {
212
- setFilters((pre: any) => ({
213
- ...pre,
214
- [dataIndex]: selectedKeys?.length ? selectedKeys : null,
215
- }));
216
- setFilterDropdownOpen(pre => ({
217
- ...pre,
218
- [dataIndex]: false,
219
- }));
220
- }}
221
- >
222
- {getLocale('confirm')}
223
- </Button>
224
- </div>
175
+ return (visible &&
176
+ <div className="ued-table-filters">
177
+ <div className="ued-table-filters-content">
178
+ {(Object.keys(valMap || {})).map((val: any) => {
179
+ const { dom } = valMap[val];
180
+ return (
181
+ <div className="ued-table-filters-item">
182
+ <Checkbox
183
+ checked={selectedKeys.includes(val)}
184
+ onChange={(e) => {
185
+ let newSelected: any[] = [];
186
+ if (e.target.checked) {
187
+ newSelected = [...selectedKeys, val];
188
+ } else {
189
+ newSelected = selectedKeys.filter((k: string) => k !== val);
190
+ }
191
+ setSelectedKeys(newSelected?.length ? newSelected : null);
192
+ }}
193
+ >
194
+ <div
195
+ className="ued-table-filters-dom"
196
+ // eslint-disable-next-line react/no-danger
197
+ dangerouslySetInnerHTML={dom && val ? { __html: dom } : undefined}
198
+ >{val ? null : `(${getLocale('Table.filter.empty')})`}
199
+ </div>
200
+ </Checkbox>
201
+ </div>
202
+ );
203
+ })}
204
+ </div>
205
+ <div className="ued-table-filters-bottom">
206
+ <Button
207
+ type="link"
208
+ disabled={selectedKeys?.length === 0}
209
+ size="small"
210
+ onClick={() => {
211
+ setSelectedKeys(null);
212
+ }}
213
+ >
214
+ {getLocale('reset')}
215
+ </Button>
216
+ <Button
217
+ type="primary"
218
+ size="small"
219
+ onClick={() => {
220
+ setFilters((pre: any) => ({
221
+ ...pre,
222
+ [dataIndex]: selectedKeys?.length ? selectedKeys : null,
223
+ }));
224
+ setFilterDropdownOpen(pre => ({
225
+ ...pre,
226
+ [dataIndex]: false,
227
+ }));
228
+ }}
229
+ >
230
+ {getLocale('confirm')}
231
+ </Button>
225
232
  </div>
226
- )
233
+ </div>
227
234
  );
228
235
  };
229
236
 
@@ -1,9 +1,18 @@
1
+ import React from 'react';
1
2
  import { message } from 'antd';
2
- import Qs from 'qs';
3
3
  import CustomModule from '../../utils/CustomModule';
4
- import type { FuncExpExeCuteType } from '../../utils/hooks/useFuncExpExecute';
5
- import { CUSTOM, DOWNLOAD_FILE, OPEN_MODAL, PAGE_JUMP, PREVIEW_FILE, ROUTE_PUSH, ROUTE_REPLACE } from '../constant';
4
+ import Qs from 'qs';
5
+ import {
6
+ PAGE_JUMP,
7
+ DOWNLOAD_FILE,
8
+ PREVIEW_FILE,
9
+ CUSTOM,
10
+ ROUTE_PUSH,
11
+ ROUTE_REPLACE,
12
+ OPEN_MODAL,
13
+ } from '../constant';
6
14
  import type { ContentClick, FuncCode } from '../types/contentStyle';
15
+ import type { FuncExpExeCuteType } from '../../utils/hooks/useFuncExpExecute';
7
16
 
8
17
  interface useFormatCellProps extends ContentClick {
9
18
  appId: string;
@@ -75,12 +84,14 @@ const useFormatCell = (props: useFormatCellProps) => {
75
84
  Object.keys(params).forEach(key => {
76
85
  if (typeof params[key] === 'string') {
77
86
  const exp = params[key];
78
- params[key] = (row: any, rowId: string | number, index: number) =>
79
- engineApis?.sandBoxSafeRun(exp, {
87
+ params[key] = (row: any, rowId: string | number, index: number) => engineApis?.sandBoxSafeRun(
88
+ exp,
89
+ {
80
90
  row,
81
91
  rowId,
82
92
  index,
83
- });
93
+ }
94
+ );
84
95
  }
85
96
 
86
97
  if (typeof params[key] === 'function') {
@@ -96,7 +107,11 @@ const useFormatCell = (props: useFormatCellProps) => {
96
107
 
97
108
  const handlePageJump = async (row: any, rowId: string | number, rowIndex: number) => {
98
109
  if (page) {
99
- const { pagePath, searchParams = {}, routerData = {} } = page;
110
+ const {
111
+ pagePath,
112
+ searchParams = {},
113
+ routerData = {},
114
+ } = page;
100
115
  const newSearchParams = getParams(searchParams, row, rowId, rowIndex);
101
116
  const newRouteData = getParams(routerData, row, rowId, rowIndex);
102
117
 
@@ -129,7 +144,10 @@ const useFormatCell = (props: useFormatCellProps) => {
129
144
 
130
145
  const handleOpenModal = async (row: any, rowId: string | number, rowIndex: number) => {
131
146
  if (modal) {
132
- const { pageId, compStates = {} } = modal;
147
+ const {
148
+ pageId,
149
+ compStates = {},
150
+ } = modal;
133
151
 
134
152
  const newCompStates = getParams(compStates, row, rowId, rowIndex);
135
153
 
@@ -148,6 +166,7 @@ const useFormatCell = (props: useFormatCellProps) => {
148
166
  let realFilename = filename;
149
167
  let realFileIds = fileIds;
150
168
 
169
+
151
170
  if ((filename as FuncCode)?.code && funcExpExecute) {
152
171
  realFilename = funcExpExecute((filename as FuncCode).code, [
153
172
  {
@@ -225,15 +244,14 @@ const useFormatCell = (props: useFormatCellProps) => {
225
244
  appId: realAppId,
226
245
  modalWidth,
227
246
  });
228
- } else if (previewType !== undefined && typeof engineApis?.previewFile === 'function') {
247
+ } else if (
248
+ previewType !== undefined &&
249
+ typeof engineApis?.previewFile === 'function'
250
+ ) {
229
251
  // 新窗口预览
230
252
  realFileIds = Array.isArray(realFileIds) ? realFileIds[0] : realFileIds;
231
253
  try {
232
- engineApis.previewFile({
233
- fileId: realFileIds,
234
- appId: realAppId,
235
- pageId: realPageId,
236
- });
254
+ engineApis.previewFile({ fileId: realFileIds, appId: realAppId, pageId: realPageId });
237
255
  } catch (e) {
238
256
  console.error(e);
239
257
  }
@@ -271,8 +289,7 @@ const useFormatCell = (props: useFormatCellProps) => {
271
289
  }
272
290
 
273
291
  window.open(realDownloadUrl, openType);
274
- break;
275
- }
292
+ break; }
276
293
  default:
277
294
  break;
278
295
  }
@@ -1,6 +1,6 @@
1
- import classNames from 'classnames';
2
1
  import { useEffect, useMemo, useRef, useState } from 'react';
3
2
  import { useListenProps } from '../../utils';
3
+ import classNames from 'classnames';
4
4
  import { useLocale } from '../../utils/hooks/useLocale';
5
5
 
6
6
  const usePagination = (props: any) => {
@@ -60,7 +60,7 @@ const usePagination = (props: any) => {
60
60
  try {
61
61
  const arr = JSON.parse(pageSizeOptions);
62
62
  if (Array.isArray(arr)) {
63
- return arr.map(s => String(s));
63
+ return arr.map((s) => String(s));
64
64
  }
65
65
  return [];
66
66
  } catch (e) {
@@ -94,18 +94,28 @@ const usePagination = (props: any) => {
94
94
  // },
95
95
  };
96
96
 
97
+
97
98
  useEffect(() => {
98
99
  // 前端分页时,若传入的分页信息有变更且有效,需要更新内部维护的分页数据
99
100
  if (!hasPageChangeEvent) {
100
- if (typeof current === 'number' || (typeof current === 'string' && !isNaN(Number(current)))) {
101
+ if (
102
+ typeof current === 'number' ||
103
+ (typeof current === 'string' && !isNaN(Number(current)))
104
+ ) {
101
105
  setCurrentPage(Number(current));
102
106
  }
103
107
 
104
- if (typeof pageSize === 'number' || (typeof pageSize === 'string' && !isNaN(Number(pageSize)))) {
108
+ if (
109
+ typeof pageSize === 'number' ||
110
+ (typeof pageSize === 'string' && !isNaN(Number(pageSize)))
111
+ ) {
105
112
  setCurrentPageSize(Number(pageSize));
106
113
  }
107
114
  }
108
- }, [current, pageSize]);
115
+ }, [
116
+ current,
117
+ pageSize,
118
+ ]);
109
119
 
110
120
  return {
111
121
  pagination,