@lingxiteam/ebe-utils 0.2.22 → 0.2.24

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 (145) 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/Layout/index.tsx +2 -2
  22. package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +7 -2
  23. package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/index.tsx +60 -26
  24. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +62 -55
  25. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +2 -6
  26. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +5 -5
  27. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/index.tsx +9 -2
  28. package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/loader.ts +1 -1
  29. package/lib/pcpublic/src/components/pcfactory/src/Select/index.tsx +145 -66
  30. package/lib/pcpublic/src/components/pcfactory/src/Select/selectUtils.ts +13 -9
  31. package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +36 -26
  32. package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +69 -94
  33. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +12 -5
  34. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +9 -5
  35. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +11 -5
  36. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +11 -5
  37. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +14 -7
  38. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +30 -31
  39. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +89 -41
  40. package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +25 -12
  41. package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/index.tsx +12 -5
  42. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/PopoverWrapper.tsx +220 -0
  43. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +39 -32
  44. package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +178 -148
  45. package/lib/pcpublic/src/components/pcfactory/src/Table/Table.tsx +439 -0
  46. package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +159 -72
  47. package/lib/pcpublic/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +12 -20
  48. package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +3 -0
  49. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/index.ts +4 -4
  50. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +32 -28
  51. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +44 -57
  52. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +306 -276
  53. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +9 -6
  54. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +30 -21
  55. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +33 -27
  56. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +84 -77
  57. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +33 -16
  58. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +15 -5
  59. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +33 -33
  60. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +13 -5
  61. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useScroll.ts +94 -28
  62. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSelection.ts +108 -99
  63. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +8 -5
  64. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +27 -43
  65. package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +73 -394
  66. package/lib/pcpublic/src/components/pcfactory/src/Table/loader.tsx +15 -0
  67. package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +2 -2
  68. package/lib/pcpublic/src/components/pcfactory/src/Table/types/event.d.ts +12 -8
  69. package/lib/pcpublic/src/components/pcfactory/src/Table/types/headerCell.d.ts +2 -1
  70. package/lib/pcpublic/src/components/pcfactory/src/Table/types/prop.d.ts +24 -11
  71. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/SequenceId.ts +2 -1
  72. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +90 -82
  73. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/indexedDBHelper.ts +9 -22
  74. package/lib/pcpublic/src/components/pcfactory/src/Table/utils/translate.ts +59 -0
  75. package/lib/pcpublic/src/components/pcfactory/src/Transfer/Transfer.tsx +644 -0
  76. package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +49 -637
  77. package/lib/pcpublic/src/components/pcfactory/src/Transfer/loader.tsx +11 -0
  78. package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeEllipsisIcon.tsx +38 -0
  79. package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +34 -35
  80. package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +213 -149
  81. package/lib/pcpublic/src/components/pcfactory/src/TreeSelect/index.tsx +47 -43
  82. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/TreeTable.tsx +264 -0
  83. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -1
  84. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +9 -3
  85. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +9 -3
  86. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +52 -191
  87. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/loader.tsx +16 -0
  88. package/lib/pcpublic/src/components/pcfactory/src/assets/index.tsx +34 -0
  89. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/quadrate.tsx +20 -0
  90. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/roundness.tsx +14 -0
  91. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/semicircle.tsx +15 -0
  92. package/lib/pcpublic/src/components/pcfactory/src/assets/svg/verticalLine.tsx +12 -0
  93. package/lib/pcpublic/src/components/pcfactory/src/styles/common.less +17 -0
  94. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +57 -11
  95. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +101 -12
  96. package/lib/pcpublic/src/components/pcfactory/src/styles/components/ModalSelect.less +6 -0
  97. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Select.less +70 -6
  98. package/lib/pcpublic/src/components/pcfactory/src/utils/ChannelContainer.tsx +20 -14
  99. package/lib/pcpublic/src/components/pcfactory/src/utils/ChildRender.ts +6 -8
  100. package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +4 -6
  101. package/lib/pcpublic/src/components/pcfactory/src/utils/DummyFormContext.ts +9 -13
  102. package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/empty.tsx +5 -17
  103. package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/index.tsx +3 -3
  104. package/lib/pcpublic/src/components/pcfactory/src/utils/Holidays.ts +11 -39
  105. package/lib/pcpublic/src/components/pcfactory/src/utils/HolidaysFormat.ts +83 -0
  106. package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/index.tsx +47 -0
  107. package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/scheduler.ts +74 -0
  108. package/lib/pcpublic/src/components/pcfactory/src/utils/LoaderHelper.tsx +4 -1
  109. package/lib/pcpublic/src/components/pcfactory/src/utils/Spin/index.tsx +8 -7
  110. package/lib/pcpublic/src/components/pcfactory/src/utils/WithSyncValue.ts +25 -23
  111. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/index.ts +10 -7
  112. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMap.ts +9 -6
  113. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +4 -1
  114. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/usePersistFn.ts +17 -0
  115. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +2 -2
  116. package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSetState.ts +7 -5
  117. package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +23 -50
  118. package/lib/pcpublic/src/components/pcfactory/src/utils/constant.ts +53 -57
  119. package/lib/pcpublic/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +12 -17
  120. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +22 -12
  121. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +50 -19
  122. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +58 -37
  123. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +33 -30
  124. package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/common.ts +2 -0
  125. package/lib/pcpublic/src/components/pcfactory/src/utils/generatorDisabledCallback.ts +121 -113
  126. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +16 -14
  127. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCompState.tsx +1 -1
  128. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDataMask.ts +7 -2
  129. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +3 -1
  130. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +16 -14
  131. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +9 -3
  132. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +4 -5
  133. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInit.ts +11 -0
  134. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +3 -1
  135. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useListenState.ts +1 -0
  136. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useLocale.ts +6 -4
  137. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +2 -2
  138. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useRules.ts +1 -1
  139. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +2 -0
  140. package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +8 -4
  141. package/lib/pcpublic/src/components/pcfactory/src/utils/index.ts +10 -10
  142. package/lib/pcpublic/src/components/pcfactory/src/utils/polyfill.js +29 -31
  143. package/lib/pcpublic/src/components/pcfactory/src/utils/renderReadOnly.tsx +29 -26
  144. package/lib/public/public/iconfont.js +1 -0
  145. package/package.json +2 -2
@@ -1,25 +1,33 @@
1
1
  import React, { CSSProperties } from 'react';
2
2
 
3
- import type { FuncExpExeCuteType } from '../../utils/hooks/useFuncExpExecute';
4
- import { FADE_COLOUR_TAG, GHOST_TAG, HYPER_LINK, POINT_TAG, PURE_COLOUR_FILL, PURE_COLOUR_TAG, THUMBNAIL } from '../constant';
5
- import { useFormatCell } from '../hooks';
6
- import type { ContentStyle } from '../types/contentStyle';
7
3
  import GhostTag from './GhostTag';
8
- import Hyperlink from './Hyperlink';
9
4
  import PointTag from './PointTag';
10
5
  import PureColourFill from './PureColourFill';
11
6
  import PureFadeColourTag from './PureFadeColourTag';
7
+ import Hyperlink from './Hyperlink';
12
8
  import Thumbnail from './Thumbnail';
9
+ import { useFormatCell } from '../hooks';
10
+ import {
11
+ PURE_COLOUR_FILL,
12
+ POINT_TAG,
13
+ GHOST_TAG,
14
+ FADE_COLOUR_TAG,
15
+ PURE_COLOUR_TAG,
16
+ HYPER_LINK,
17
+ THUMBNAIL,
18
+ } from '../constant';
19
+ import type { ContentStyle } from '../types/contentStyle';
20
+ import type { FuncExpExeCuteType } from '../../utils/hooks/useFuncExpExecute';
13
21
 
14
22
  export interface MyFormatCell {
15
- contentStyle: ContentStyle | undefined | {};
23
+ contentStyle: ContentStyle | undefined | {},
16
24
  bgColorStyle: {
17
25
  formatStyle: number;
18
26
  contentType: string;
19
27
  fontColor: string;
20
28
  borderColor: string;
21
29
  backgroundColor: string;
22
- };
30
+ },
23
31
  tdProps: any;
24
32
  funcExpExecute?: FuncExpExeCuteType;
25
33
  engineApis: any;
@@ -38,7 +46,7 @@ export interface CellContentProps {
38
46
  children: any;
39
47
  contentStyle: ContentStyle;
40
48
  funcExpExecute?: FuncExpExeCuteType;
41
- controllLineStyle?: CSSProperties | null;
49
+ controllLineStyle?: CSSProperties | null
42
50
  mode?: string;
43
51
  width?: number;
44
52
  rowText?: any;
@@ -107,11 +115,7 @@ const CellContent = (props: CellContentProps) => {
107
115
  children = content ? handleCellContent(row, rowIndex, rowText) : children;
108
116
 
109
117
  if (content && controllLineStyle) {
110
- children = (
111
- <span className="ued-control-line-number" style={controllLineStyle}>
112
- {children}
113
- </span>
114
- );
118
+ children = <span className="ued-control-line-number" style={controllLineStyle}>{children}</span>;
115
119
  }
116
120
 
117
121
  const handleOnCellClick = (e: any) => {
@@ -130,20 +134,56 @@ const CellContent = (props: CellContentProps) => {
130
134
  * 配置了:“设置xx单元格里内容的颜色” 默认 -> “纯色填充”
131
135
  * 注:此情况下,children 有可能为 自定义渲染函数返回的内容
132
136
  */
133
- return <PureColourFill content={children} fontColor={fontColor} backgroundColor={backgroundColor} onClick={onClick} />;
137
+ return (
138
+ <PureColourFill
139
+ content={children}
140
+ fontColor={fontColor}
141
+ backgroundColor={backgroundColor}
142
+ onClick={onClick}
143
+ />
144
+ );
134
145
  }
135
146
 
136
147
  // 新版内容样式(注:此时 children 不可能为自定义函数)
137
148
  switch (contentType) {
138
149
  case PURE_COLOUR_FILL:
139
- return <PureColourFill content={children} fontColor={fontColor} backgroundColor={backgroundColor} onClick={onClick} />;
150
+ return (
151
+ <PureColourFill
152
+ content={children}
153
+ fontColor={fontColor}
154
+ backgroundColor={backgroundColor}
155
+ onClick={onClick}
156
+ />
157
+ );
140
158
  case POINT_TAG:
141
- return <PointTag content={children} fontColor={fontColor} backgroundColor={backgroundColor} onClick={onClick} />;
159
+ return (
160
+ <PointTag
161
+ content={children}
162
+ fontColor={fontColor}
163
+ backgroundColor={backgroundColor}
164
+ onClick={onClick}
165
+ />
166
+ );
142
167
  case GHOST_TAG:
143
- return <GhostTag content={children} fontColor={fontColor} backgroundColor={backgroundColor} borderColor={borderColor} onClick={onClick} />;
168
+ return (
169
+ <GhostTag
170
+ content={children}
171
+ fontColor={fontColor}
172
+ backgroundColor={backgroundColor}
173
+ borderColor={borderColor}
174
+ onClick={onClick}
175
+ />
176
+ );
144
177
  case FADE_COLOUR_TAG:
145
178
  case PURE_COLOUR_TAG:
146
- return <PureFadeColourTag content={children} fontColor={fontColor} backgroundColor={backgroundColor} onClick={onClick} />;
179
+ return (
180
+ <PureFadeColourTag
181
+ content={children}
182
+ fontColor={fontColor}
183
+ backgroundColor={backgroundColor}
184
+ onClick={onClick}
185
+ />
186
+ );
147
187
  case HYPER_LINK:
148
188
  return <Hyperlink content={children} onClick={onClick} />;
149
189
  case THUMBNAIL:
@@ -167,7 +207,7 @@ const CellContent = (props: CellContentProps) => {
167
207
  return null;
168
208
  };
169
209
 
170
- const FormatCell: React.FC<MyFormatCell> = props => {
210
+ const FormatCell: React.FC<MyFormatCell> = (props) => {
171
211
  const {
172
212
  bgColorStyle,
173
213
  contentStyle,
@@ -180,7 +220,15 @@ const FormatCell: React.FC<MyFormatCell> = props => {
180
220
  width,
181
221
  } = props;
182
222
 
183
- const { history, appId, pageId, row, rowId, rowIndex, ...restTdProps } = tdProps;
223
+ const {
224
+ history,
225
+ appId,
226
+ pageId,
227
+ row,
228
+ rowId,
229
+ rowIndex,
230
+ ...restTdProps
231
+ } = tdProps;
184
232
 
185
233
  // 如果条件全部为假,直接返回
186
234
  if (!bgColorStyle && !contentStyle) {
@@ -201,27 +249,27 @@ const FormatCell: React.FC<MyFormatCell> = props => {
201
249
  }
202
250
  }}
203
251
  >
204
- {contentStyle ? (
205
- <CellContent
206
- contentStyle={contentStyle as ContentStyle}
207
- funcExpExecute={funcExpExecute}
208
- engineApis={engineApis}
209
- appId={appId}
210
- pageId={pageId}
211
- row={row}
212
- rowId={rowId}
213
- rowIndex={rowIndex}
214
- controllLineStyle={props.tdProps?.controllLineStyle}
215
- mode={mode}
216
- width={width}
217
- rowText={restTdProps?.title}
218
- $$componentItemId={restTdProps?.$$componentItemId}
219
- >
220
- {children}
221
- </CellContent>
222
- ) : (
223
- children
224
- )}
252
+ {
253
+ contentStyle ? (
254
+ <CellContent
255
+ contentStyle={(contentStyle as ContentStyle)}
256
+ funcExpExecute={funcExpExecute}
257
+ engineApis={engineApis}
258
+ appId={appId}
259
+ pageId={pageId}
260
+ row={row}
261
+ rowId={rowId}
262
+ rowIndex={rowIndex}
263
+ controllLineStyle={props.tdProps?.controllLineStyle}
264
+ mode={mode}
265
+ width={width}
266
+ rowText={restTdProps?.title}
267
+ $$componentItemId={restTdProps?.$$componentItemId}
268
+ >
269
+ {children}
270
+ </CellContent>
271
+ ) : children
272
+ }
225
273
  </td>
226
274
  );
227
275
  };
@@ -1,15 +1,32 @@
1
1
  import React from 'react';
2
2
  import TooltipViewEG from '../../../TooltipView';
3
3
  import TooltipViewED from '../../../TooltipView/TooltipViewED';
4
- import type { FuncCode } from '../../types/contentStyle';
5
4
  import type { HeaderCellTitleProps } from '../../types/headerCell';
5
+ import type { FuncCode } from '../../types/contentStyle';
6
+
6
7
 
7
- const HeaderCellTitle: React.FC<HeaderCellTitleProps> = props => {
8
- const { size, column, mode = 'editor', funcExpExecute, engineApis } = props;
8
+ const HeaderCellTitle: React.FC<HeaderCellTitleProps> = (props) => {
9
+ const {
10
+ size,
11
+ column,
12
+ mode = 'editor',
13
+ funcExpExecute,
14
+ engineApis,
15
+ } = props;
9
16
 
10
- const { title, titleLineNum, titleTip } = column || {};
17
+ const {
18
+ title,
19
+ titleLineNum,
20
+ titleTip,
21
+ } = column || {};
11
22
 
12
- const { type, content, icon, placement, iconPlacement } = titleTip || {};
23
+ const {
24
+ type,
25
+ content,
26
+ icon,
27
+ placement,
28
+ iconPlacement,
29
+ } = titleTip || {};
13
30
 
14
31
  const lineHeight = size === 'small' ? 16 : 20;
15
32
  const isTitleLineNumSet = typeof titleLineNum === 'number' && titleLineNum > 0;
@@ -37,10 +54,8 @@ const HeaderCellTitle: React.FC<HeaderCellTitleProps> = props => {
37
54
  // eslint-disable-next-line react/no-danger
38
55
  dangerouslySetInnerHTML={{ __html: title || '' }}
39
56
  />
40
- ) : (
41
- // eslint-disable-next-line react/no-danger
42
- <span dangerouslySetInnerHTML={{ __html: title || '' }} />
43
- );
57
+ // eslint-disable-next-line react/no-danger
58
+ ) : <span dangerouslySetInnerHTML={{ __html: title || '' }} />;
44
59
 
45
60
  return titleTip && realContent ? (
46
61
  <TooltipView
@@ -54,9 +69,7 @@ const HeaderCellTitle: React.FC<HeaderCellTitleProps> = props => {
54
69
  tipPlacement={placement}
55
70
  engineApis={engineApis}
56
71
  />
57
- ) : (
58
- <>{realTitle}</>
59
- );
72
+ ) : <>{realTitle}</>;
60
73
  };
61
74
 
62
75
  export default HeaderCellTitle;
@@ -1,10 +1,13 @@
1
- import { useMemo } from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  // @ts-ignore
3
- import classNames from 'classnames';
4
3
  import { Resizable } from 'react-resizable';
5
4
  import type { HeaderCellProps } from '../types/headerCell';
5
+ import classNames from 'classnames';
6
+ import { TH_CELL_KEY } from '../constant';
6
7
 
7
- const HeaderCell = (props: HeaderCellProps) => {
8
+ const HeaderCell = (
9
+ props: HeaderCellProps,
10
+ ) => {
8
11
  const { onResize, width, isFlexColumn, columnIndex, tableData, hasExpandContent, className, childrenColumnName, ...restProps } = props;
9
12
 
10
13
  const mergeClassName = useMemo(() => {
@@ -30,7 +33,7 @@ const HeaderCell = (props: HeaderCellProps) => {
30
33
  handle={
31
34
  <span
32
35
  className="react-resizable-handle"
33
- onClick={e => {
36
+ onClick={(e) => {
34
37
  e.stopPropagation();
35
38
  }}
36
39
  />
@@ -38,7 +41,11 @@ const HeaderCell = (props: HeaderCellProps) => {
38
41
  onResize={onResize}
39
42
  draggableOpts={{ enableUserSelectHack: false }}
40
43
  >
41
- <th {...restProps} className={mergeClassName} />
44
+ <th
45
+ {...restProps}
46
+ className={mergeClassName}
47
+ {...{ [TH_CELL_KEY]: restProps[TH_CELL_KEY] }}
48
+ />
42
49
  </Resizable>
43
50
  );
44
51
  };
@@ -0,0 +1,220 @@
1
+ import { isDynamicProperty } from '../../utils/common';
2
+ import { EngineBaseProps } from '@lingxiteam/types';
3
+ import { Popover, PopoverProps } from 'antd';
4
+ import React from 'react';
5
+
6
+ export type PopoverValueType =
7
+ | {
8
+ options?: {
9
+ title?: string;
10
+ placement?: PopoverProps['placement'];
11
+ trigger?: 'click' | 'hover';
12
+ content: string;
13
+ contentFn: () => string;
14
+ rule?: string;
15
+ maxWidth?: number;
16
+ };
17
+ }
18
+ | {
19
+ page: {
20
+ pageId: string;
21
+ pagePath: string;
22
+ pageName: string;
23
+ placement?: PopoverProps['placement'];
24
+ rule?: string;
25
+ trigger?: 'click' | 'hover';
26
+ options?: any[];
27
+ maxWidth?: number;
28
+ };
29
+ };
30
+ const PopoverWrapper: React.FC<{
31
+ popoverSetting?: PopoverValueType;
32
+ engineApis: ReturnType<EngineBaseProps['getEngineApis']>;
33
+ compId: string;
34
+ row: any;
35
+ rowId: string;
36
+ index: number;
37
+ }> = (props) => {
38
+ const { children, popoverSetting, engineApis, compId, row, rowId, index } =
39
+ props;
40
+ const { renderPopover, sandBoxSafeRun } = engineApis || {};
41
+ if (!popoverSetting || !renderPopover) {
42
+ return children;
43
+ }
44
+
45
+ const renderChildren = () => {
46
+ let trigger = 'page' in popoverSetting && popoverSetting.page ? popoverSetting?.page?.trigger : undefined;
47
+ if ('options' in popoverSetting && popoverSetting?.options) {
48
+ trigger = popoverSetting?.options.trigger;
49
+ }
50
+ if (trigger === 'click') {
51
+ // 阻止点击冒泡行为
52
+ return (
53
+ <span
54
+ onClick={(e) => {
55
+ e.stopPropagation();
56
+ }}
57
+ style={{
58
+ lineHeight: 0,
59
+ }}
60
+ >
61
+ {children}
62
+ </span>);
63
+ }
64
+ return children;
65
+ };
66
+ // 页面
67
+ if ('page' in popoverSetting && popoverSetting.page) {
68
+ const { page } = popoverSetting;
69
+ try {
70
+ const pageRule = page.rule;
71
+ if (pageRule) {
72
+ const hiddenRuleFn = (row: any, rowId: string, index: number) =>
73
+ sandBoxSafeRun(pageRule, {
74
+ row,
75
+ rowId,
76
+ index,
77
+ });
78
+
79
+ if (hiddenRuleFn(row, rowId, index)) {
80
+ return renderChildren();
81
+ }
82
+ }
83
+ } catch (e) {
84
+ console.error(e);
85
+ }
86
+
87
+ const params: any = {};
88
+ let popoverOptions = page.options;
89
+ if (page.options) {
90
+ popoverOptions = page.options.map((_c: any) => {
91
+ const c = {
92
+ ..._c,
93
+ };
94
+ try {
95
+ const stateParamRule = c?.stateParam;
96
+ if (stateParamRule && typeof stateParamRule === 'string') {
97
+ const paramFunc = (row: any, rowId: string, index: number) =>
98
+ sandBoxSafeRun(stateParamRule, {
99
+ row,
100
+ rowId,
101
+ index,
102
+ });
103
+
104
+ params[_c.code] = paramFunc(row, rowId, index);
105
+ c.stateParam = params[_c.code];
106
+ }
107
+ } catch (e) {
108
+ console.error(e);
109
+ }
110
+ return c;
111
+ });
112
+ }
113
+
114
+ const comp = (
115
+ <span
116
+ onClick={(e) => {
117
+ if (page.trigger === 'click') {
118
+ e.stopPropagation();
119
+ }
120
+ }}
121
+ style={{
122
+ lineHeight: 0,
123
+ }}
124
+ >
125
+ { renderPopover({
126
+ childElement: <>{children}</>,
127
+ props,
128
+ popoverSetting: {
129
+ page: {
130
+ ...page,
131
+ options: popoverOptions,
132
+ },
133
+ options: popoverOptions,
134
+ state: params,
135
+ },
136
+ uid: compId,
137
+ })}
138
+ </span>);
139
+ return comp as any;
140
+ }
141
+ // 自定义
142
+ if ('options' in popoverSetting && popoverSetting?.options?.contentFn) {
143
+ const { options } = popoverSetting;
144
+ const {
145
+ maxWidth,
146
+ contentFn,
147
+ content,
148
+ rule: popRule,
149
+ ...resOptions
150
+ } = options;
151
+
152
+ // 隐藏规则
153
+ try {
154
+ if (popRule) {
155
+ const hiddenRule = (row: any, rowId: string, index: number) =>
156
+ sandBoxSafeRun(popRule, {
157
+ row,
158
+ rowId,
159
+ index,
160
+ });
161
+ if (hiddenRule(row, rowId, index)) {
162
+ return renderChildren();
163
+ }
164
+ }
165
+ } catch (e) {
166
+ console.error(e);
167
+ }
168
+
169
+ const popContent = contentFn() || content;
170
+
171
+ let newPopContent: string = popContent;
172
+ try {
173
+ if (popContent) {
174
+ const popoverContent = (row: any, rowId: string, index: number) =>
175
+ sandBoxSafeRun(popContent, {
176
+ row,
177
+ rowId,
178
+ index,
179
+ });
180
+
181
+ newPopContent = popoverContent(row, rowId, index) as string;
182
+ }
183
+ } catch (e) {
184
+ console.error(e);
185
+ }
186
+ if (
187
+ newPopContent === undefined &&
188
+ typeof popContent === 'string' &&
189
+ !isDynamicProperty(popContent)
190
+ ) {
191
+ // 当表达式返回空,且不被$$包裹时,内容当成普通文本处理
192
+ newPopContent = popContent;
193
+ }
194
+
195
+ return (
196
+ <span
197
+ onClick={(e) => {
198
+ if (options.trigger === 'click') {
199
+ e.stopPropagation();
200
+ }
201
+ }}
202
+ style={{
203
+ lineHeight: 0,
204
+ }}
205
+ >
206
+ <Popover
207
+ overlayStyle={{ maxWidth: maxWidth || 'none', wordBreak: 'break-word' }}
208
+ content={newPopContent}
209
+ {...resOptions}
210
+ arrowPointAtCenter
211
+ >
212
+ <>{children}</>
213
+ </Popover>
214
+ </span>
215
+ );
216
+ }
217
+ return children;
218
+ };
219
+
220
+ export default PopoverWrapper;
@@ -1,11 +1,13 @@
1
+ import React, { Fragment, useState } from 'react';
2
+ import { Divider, Popconfirm, Tooltip, Button } from 'antd';
1
3
  import { Icon as LegacyIcon } from '@lingxiteam/icons';
2
- import { Button, Divider, Popconfirm, Tooltip } from 'antd';
3
4
  import classnames from 'classnames';
4
- import { Fragment, useState } from 'react';
5
5
  import type { SingleBtnProps } from '../types/OperationCell';
6
6
 
7
7
  // 操作项单个按钮
8
- const SingleBtn = (props: SingleBtnProps) => {
8
+ const SingleBtn = (
9
+ props: SingleBtnProps,
10
+ ) => {
9
11
  const {
10
12
  onDeleteClick,
11
13
  onBtnClick,
@@ -20,6 +22,7 @@ const SingleBtn = (props: SingleBtnProps) => {
20
22
  popconfirmPlacement,
21
23
  } = props;
22
24
  const [popVisible, setPopVisible] = useState(false);
25
+ const popoverOptions = c?.popoverSetting?.page || c?.popoverSetting?.options;
23
26
 
24
27
  const renderBtn = () => {
25
28
  const { visible: buttonVisible = true } = c;
@@ -32,14 +35,14 @@ const SingleBtn = (props: SingleBtnProps) => {
32
35
  disabled={c.disabled}
33
36
  className={classnames('ued-table-actions-antBtn', type ? `ued-table-actions-${type}` : undefined)}
34
37
  key={typeof c === 'string' ? c : c.type}
35
- onClick={e => {
38
+ onClick={(e) => {
36
39
  onBtnClick(e);
37
40
  setPopVisible(false);
38
41
  if (isPopover && !(typeof c === 'string' ? c === 'delete' : c.type === 'delete')) {
39
42
  hideMorePopover();
40
43
  }
41
44
  }}
42
- onDoubleClick={e => {
45
+ onDoubleClick={(e) => {
43
46
  e.stopPropagation();
44
47
  }}
45
48
  >
@@ -66,39 +69,43 @@ const SingleBtn = (props: SingleBtnProps) => {
66
69
  >
67
70
  {buildInBtn}
68
71
  </Tooltip>
69
- ) : (
70
- buildInBtn
71
- );
72
+ ) : buildInBtn;
72
73
 
73
74
  const btn = buttonVisible ? (
74
75
  <Fragment key={idx}>
75
- {(typeof c === 'string' ? c === 'delete' : c.type === 'delete') && !c.disabled ? (
76
- <span
77
- style={{ lineHeight: '0px' }}
78
- onClick={e => {
79
- e.stopPropagation();
80
- }}
81
- onDoubleClick={e => {
82
- e.stopPropagation();
83
- }}
84
- >
85
- <Popconfirm
86
- onVisibleChange={v => v && setPopVisible(false)}
87
- placement={popconfirmPlacement}
88
- title={getLocale('deleteConfirm')}
89
- onConfirm={(e: any) => {
90
- onDeleteClick(e);
91
- if (isPopover) {
92
- hideMorePopover();
76
+ {
77
+ (
78
+ (typeof c === 'string' ? c === 'delete' : c.type === 'delete') &&
79
+ !c.disabled
80
+ ) ? (
81
+ <span
82
+ style={{ lineHeight: '0px' }}
83
+ onClick={(e) => {
84
+ if (popoverOptions?.trigger !== 'click') {
85
+ // trigger为点击的气泡卡片,阻止冒泡在内部实现
86
+ e.stopPropagation();
93
87
  }
94
88
  }}
89
+ onDoubleClick={(e) => {
90
+ e.stopPropagation();
91
+ }}
95
92
  >
96
- {buildInBtn}
97
- </Popconfirm>
98
- </span>
99
- ) : (
100
- buildInBtn
101
- )}
93
+ <Popconfirm
94
+ onVisibleChange={v => v && setPopVisible(false)}
95
+ placement={popconfirmPlacement}
96
+ title={getLocale('deleteConfirm')}
97
+ onConfirm={(e: any) => {
98
+ onDeleteClick(e);
99
+ if (isPopover) {
100
+ hideMorePopover();
101
+ }
102
+ }}
103
+ >
104
+ {buildInBtn}
105
+ </Popconfirm>
106
+ </span>
107
+ ) : buildInBtn
108
+ }
102
109
  {!isPopover && idx !== defaultBtnList.length - 1 && <Divider type="vertical" />}
103
110
  </Fragment>
104
111
  ) : null;