@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.
- package/lib/h5public/yarn.lock +7 -8
- package/lib/pcpublic/src/components/pcfactory/src/Button/index.tsx +11 -10
- package/lib/pcpublic/src/components/pcfactory/src/Card/CardTitle/index.tsx +31 -24
- package/lib/pcpublic/src/components/pcfactory/src/Card/index.tsx +32 -14
- package/lib/pcpublic/src/components/pcfactory/src/Card/useExtendBtn.tsx +85 -48
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/ChartLine.tsx +24 -6
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/PropsType.ts +31 -5
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/index.tsx +3 -2
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +153 -129
- package/lib/pcpublic/src/components/pcfactory/src/Form/index.tsx +2 -5
- package/lib/pcpublic/src/components/pcfactory/src/Form/useFormStatus.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +15 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/PropsType.ts +4 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +18 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/PropsType.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/index.tsx +60 -26
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +62 -55
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +2 -6
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +5 -5
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/index.tsx +9 -2
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/loader.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Select/index.tsx +145 -66
- package/lib/pcpublic/src/components/pcfactory/src/Select/selectUtils.ts +13 -9
- package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +36 -26
- package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +69 -94
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +9 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +14 -7
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +30 -31
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +89 -41
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +25 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/PopoverWrapper.tsx +220 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +39 -32
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +178 -148
- package/lib/pcpublic/src/components/pcfactory/src/Table/Table.tsx +439 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +159 -72
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +12 -20
- package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/index.ts +4 -4
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +32 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +44 -57
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +306 -276
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +30 -21
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +33 -27
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +84 -77
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +33 -16
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +15 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +33 -33
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +13 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useScroll.ts +94 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSelection.ts +108 -99
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +8 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +27 -43
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +73 -394
- package/lib/pcpublic/src/components/pcfactory/src/Table/loader.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/event.d.ts +12 -8
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/headerCell.d.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/prop.d.ts +24 -11
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/SequenceId.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +90 -82
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/indexedDBHelper.ts +9 -22
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/translate.ts +59 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/Transfer.tsx +644 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +49 -637
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/loader.tsx +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeEllipsisIcon.tsx +38 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +34 -35
- package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +213 -149
- package/lib/pcpublic/src/components/pcfactory/src/TreeSelect/index.tsx +47 -43
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/TreeTable.tsx +264 -0
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +52 -191
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/loader.tsx +16 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/index.tsx +34 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/quadrate.tsx +20 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/roundness.tsx +14 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/semicircle.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/verticalLine.tsx +12 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/common.less +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +57 -11
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +101 -12
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/ModalSelect.less +6 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Select.less +70 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChannelContainer.tsx +20 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChildRender.ts +6 -8
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +4 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/DummyFormContext.ts +9 -13
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/empty.tsx +5 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/index.tsx +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/Holidays.ts +11 -39
- package/lib/pcpublic/src/components/pcfactory/src/utils/HolidaysFormat.ts +83 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/index.tsx +47 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/scheduler.ts +74 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/LoaderHelper.tsx +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/Spin/index.tsx +8 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/WithSyncValue.ts +25 -23
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/index.ts +10 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMap.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/usePersistFn.ts +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSetState.ts +7 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +23 -50
- package/lib/pcpublic/src/components/pcfactory/src/utils/constant.ts +53 -57
- package/lib/pcpublic/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +12 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +22 -12
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +50 -19
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +58 -37
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +33 -30
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/common.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/generatorDisabledCallback.ts +121 -113
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCompState.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDataMask.ts +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +4 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInit.ts +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useListenState.ts +1 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useLocale.ts +5 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useRules.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/utils/index.ts +10 -10
- package/lib/pcpublic/src/components/pcfactory/src/utils/polyfill.js +29 -31
- package/lib/pcpublic/src/components/pcfactory/src/utils/renderReadOnly.tsx +29 -26
- package/lib/public/public/iconfont.js +1 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
|
+
import { Button, Checkbox, Popover, Tree, Divider, Tooltip } from 'antd';
|
|
2
3
|
import { Icon } from '@lingxiteam/icons';
|
|
3
|
-
import { Button, Checkbox, Divider, Popover, Tooltip, Tree } from 'antd';
|
|
4
4
|
import type { ButtonType } from 'antd/lib/button';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
@@ -47,6 +47,17 @@ export interface MyTableHeadProps {
|
|
|
47
47
|
sandBoxSafeRun?: any;
|
|
48
48
|
engineApis?: any;
|
|
49
49
|
getEdEngineApi?: any;
|
|
50
|
+
getEngineApis?: any;
|
|
51
|
+
headIconType?: string;
|
|
52
|
+
headPrefixIcon?: {
|
|
53
|
+
prefixIconTheme?: string;
|
|
54
|
+
prefixIconType?: string;
|
|
55
|
+
prefixIconiconFile?: {
|
|
56
|
+
fileId: string;
|
|
57
|
+
fileCode: string;
|
|
58
|
+
}
|
|
59
|
+
prefixIconFontAddress?: string;
|
|
60
|
+
}
|
|
50
61
|
}
|
|
51
62
|
const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
52
63
|
const {
|
|
@@ -69,6 +80,8 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
69
80
|
headBtnNum = 3,
|
|
70
81
|
sandBoxSafeRun,
|
|
71
82
|
engineApis,
|
|
83
|
+
headIconType,
|
|
84
|
+
headPrefixIcon,
|
|
72
85
|
} = props;
|
|
73
86
|
const CommIcon = source === 'editor' ? CommIconEd : CommIconEg;
|
|
74
87
|
|
|
@@ -86,7 +99,7 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
86
99
|
iconFile: newIconFile,
|
|
87
100
|
// 默认列
|
|
88
101
|
defaultColumn,
|
|
89
|
-
} = !showCustom || typeof showCustom === 'boolean' ?
|
|
102
|
+
} = (!showCustom || typeof showCustom === 'boolean') ? {} as any : showCustom; // 兼容旧数据,旧数据是true、false、undefined
|
|
90
103
|
|
|
91
104
|
const [checkedKeys, checkedMap] = useMemo(() => {
|
|
92
105
|
const map: any = {};
|
|
@@ -107,7 +120,10 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
107
120
|
map[c.dataIndex] = c;
|
|
108
121
|
keys.push(`${c.dataIndex || ''}`);
|
|
109
122
|
});
|
|
110
|
-
return [
|
|
123
|
+
return [
|
|
124
|
+
keys,
|
|
125
|
+
map,
|
|
126
|
+
];
|
|
111
127
|
}
|
|
112
128
|
return [
|
|
113
129
|
selectedCols.map((c: any) => {
|
|
@@ -138,7 +154,17 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
138
154
|
// onHeadClickBtn5,
|
|
139
155
|
// ] as FunctionHandleType[];
|
|
140
156
|
return _headExtends.map((c, i) => {
|
|
141
|
-
const {
|
|
157
|
+
const {
|
|
158
|
+
icon,
|
|
159
|
+
iconPos,
|
|
160
|
+
id,
|
|
161
|
+
btnType,
|
|
162
|
+
btnSize,
|
|
163
|
+
isIcon,
|
|
164
|
+
rule,
|
|
165
|
+
visible: buttonVisible = true,
|
|
166
|
+
disabled,
|
|
167
|
+
} = c;
|
|
142
168
|
const handleOnClick = (e: any) => {
|
|
143
169
|
if (typeof onClicks[i] === 'function') {
|
|
144
170
|
onClicks[i](e);
|
|
@@ -177,11 +203,10 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
177
203
|
}
|
|
178
204
|
|
|
179
205
|
return (
|
|
180
|
-
<>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{buttonVisible ? (
|
|
206
|
+
<> {isPopover ? (
|
|
207
|
+
<div>
|
|
208
|
+
{
|
|
209
|
+
buttonVisible ? (
|
|
185
210
|
isIcon ? (
|
|
186
211
|
BtnIcon
|
|
187
212
|
) : (
|
|
@@ -193,32 +218,29 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
193
218
|
size={btnSize}
|
|
194
219
|
onClick={handleOnClick}
|
|
195
220
|
>
|
|
196
|
-
{iconPos && iconPos === 'left' && icon &&
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
/>
|
|
205
|
-
)}
|
|
221
|
+
{iconPos && iconPos === 'left' && icon && <CommIcon
|
|
222
|
+
icon={icon}
|
|
223
|
+
className=""
|
|
224
|
+
$$componentItem={props.$$componentItem}
|
|
225
|
+
getEngineApis={props.getEngineApis}
|
|
226
|
+
engineApis={engineApis}
|
|
227
|
+
getEdEngineApi={props.getEdEngineApi}
|
|
228
|
+
/>}
|
|
206
229
|
{c.title}
|
|
207
|
-
{iconPos && iconPos === 'right' && icon &&
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
/>
|
|
216
|
-
)}
|
|
230
|
+
{iconPos && iconPos === 'right' && icon && <CommIcon
|
|
231
|
+
icon={icon}
|
|
232
|
+
className=""
|
|
233
|
+
$$componentItem={props.$$componentItem}
|
|
234
|
+
getEngineApis={props.getEngineApis}
|
|
235
|
+
engineApis={engineApis}
|
|
236
|
+
getEdEngineApi={props.getEdEngineApi}
|
|
237
|
+
/>}
|
|
217
238
|
</Button>
|
|
218
239
|
)
|
|
219
|
-
) : null
|
|
220
|
-
|
|
221
|
-
) :
|
|
240
|
+
) : null
|
|
241
|
+
}
|
|
242
|
+
</div>) : (
|
|
243
|
+
buttonVisible ? (
|
|
222
244
|
isIcon ? (
|
|
223
245
|
BtnIcon
|
|
224
246
|
) : (
|
|
@@ -230,39 +252,41 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
230
252
|
size={btnSize}
|
|
231
253
|
onClick={handleOnClick}
|
|
232
254
|
>
|
|
233
|
-
{iconPos && iconPos === 'left' && icon &&
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
/>
|
|
242
|
-
)}
|
|
255
|
+
{iconPos && iconPos === 'left' && icon && <CommIcon
|
|
256
|
+
icon={icon}
|
|
257
|
+
className=""
|
|
258
|
+
$$componentItem={props.$$componentItem}
|
|
259
|
+
getEngineApis={props.getEngineApis}
|
|
260
|
+
engineApis={engineApis}
|
|
261
|
+
getEdEngineApi={props.getEdEngineApi}
|
|
262
|
+
/>}
|
|
243
263
|
{c.title}
|
|
244
|
-
{iconPos && iconPos === 'right' && icon &&
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
/>
|
|
253
|
-
)}
|
|
264
|
+
{iconPos && iconPos === 'right' && icon && <CommIcon
|
|
265
|
+
icon={icon}
|
|
266
|
+
className=""
|
|
267
|
+
$$componentItem={props.$$componentItem}
|
|
268
|
+
getEngineApis={props.getEngineApis}
|
|
269
|
+
engineApis={engineApis}
|
|
270
|
+
getEdEngineApi={props.getEdEngineApi}
|
|
271
|
+
/>}
|
|
254
272
|
</Button>
|
|
255
273
|
)
|
|
256
|
-
) : null
|
|
257
|
-
|
|
258
|
-
|
|
274
|
+
) : null
|
|
275
|
+
)}
|
|
276
|
+
</>);
|
|
259
277
|
});
|
|
260
278
|
}
|
|
261
279
|
return undefined;
|
|
262
280
|
};
|
|
263
281
|
const renderHeaderBtn = () => {
|
|
264
282
|
if (Array.isArray(headExtends) && headExtends.length) {
|
|
265
|
-
const onClicks = [
|
|
283
|
+
const onClicks = [
|
|
284
|
+
onHeadClickBtn1,
|
|
285
|
+
onHeadClickBtn2,
|
|
286
|
+
onHeadClickBtn3,
|
|
287
|
+
onHeadClickBtn4,
|
|
288
|
+
onHeadClickBtn5,
|
|
289
|
+
] as FunctionHandleType[];
|
|
266
290
|
const visibleClick: any = [];
|
|
267
291
|
const visibleBtn: any = [];
|
|
268
292
|
headExtends.forEach((item, index) => {
|
|
@@ -290,15 +314,17 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
290
314
|
{renderExtendBtn(preList, false, preClick)}
|
|
291
315
|
<Divider type="vertical" />
|
|
292
316
|
<Popover content={content} trigger="click">
|
|
293
|
-
<Button
|
|
317
|
+
<Button
|
|
318
|
+
type="link"
|
|
319
|
+
key="more"
|
|
320
|
+
>
|
|
294
321
|
<div className="ued-table-actions-extendBtn">
|
|
295
322
|
{getLocale?.('more')}
|
|
296
323
|
<Icon className="actIcon-left" type="down" />
|
|
297
324
|
</div>
|
|
298
325
|
</Button>
|
|
299
326
|
</Popover>
|
|
300
|
-
</>
|
|
301
|
-
);
|
|
327
|
+
</>);
|
|
302
328
|
|
|
303
329
|
// }
|
|
304
330
|
}
|
|
@@ -309,7 +335,7 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
309
335
|
const [indeterminate, checkAll] = useMemo(() => {
|
|
310
336
|
const allLen = columns?.length;
|
|
311
337
|
const selectedLen = checkedKeys?.length;
|
|
312
|
-
return [!!selectedLen && selectedLen < allLen, !!allLen && selectedLen === allLen];
|
|
338
|
+
return [(!!selectedLen && selectedLen < allLen), !!allLen && selectedLen === allLen];
|
|
313
339
|
}, [columns?.length, checkedKeys?.length]);
|
|
314
340
|
|
|
315
341
|
// 点击自定义列全选触发
|
|
@@ -340,14 +366,17 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
340
366
|
const tableSize = props.size || 'middle';
|
|
341
367
|
return (
|
|
342
368
|
<>
|
|
343
|
-
<Checkbox
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
369
|
+
<Checkbox
|
|
370
|
+
indeterminate={indeterminate}
|
|
371
|
+
checked={checkAll}
|
|
372
|
+
onChange={onCheckAllChange}
|
|
373
|
+
className={classnames('checkAll', 'checkbox')}
|
|
374
|
+
>
|
|
375
|
+
<span className={checkAll ? 'checkedText' : ''}>{getLocale?.('all', '全选')}({checkedKeys?.length})</span>
|
|
347
376
|
</Checkbox>
|
|
348
377
|
<Tree
|
|
349
378
|
selectable={false}
|
|
350
|
-
onCheck={keys => {
|
|
379
|
+
onCheck={(keys) => {
|
|
351
380
|
setSelectedCols(keys);
|
|
352
381
|
}}
|
|
353
382
|
draggable={{ icon: false }}
|
|
@@ -368,9 +397,9 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
368
397
|
extendCols.push(`${col.dataIndex}`);
|
|
369
398
|
}
|
|
370
399
|
});
|
|
371
|
-
orders = orders.filter(o => orderMap[o]).concat(extendCols);
|
|
400
|
+
orders = orders.filter((o) => orderMap[o]).concat(extendCols);
|
|
372
401
|
}
|
|
373
|
-
const index = orders.findIndex(o => o === dragNodesKeys[0]);
|
|
402
|
+
const index = orders.findIndex((o) => o === dragNodesKeys[0]);
|
|
374
403
|
const dropPos = dropPosition + (dragOverGapTop ? 1 : 0);
|
|
375
404
|
if (index === dropPos) {
|
|
376
405
|
return orders;
|
|
@@ -387,7 +416,7 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
387
416
|
}
|
|
388
417
|
}}
|
|
389
418
|
>
|
|
390
|
-
{columns?.map((col: { dataIndex: string | string[];
|
|
419
|
+
{columns?.map((col: { dataIndex: string | string[];[key: string]: any }) => {
|
|
391
420
|
const dataIndex = `${col.dataIndex}`;
|
|
392
421
|
const checked = checkedMap[dataIndex] !== undefined;
|
|
393
422
|
return (
|
|
@@ -401,7 +430,7 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
401
430
|
<Checkbox
|
|
402
431
|
checked={checked}
|
|
403
432
|
className="checkbox"
|
|
404
|
-
onChange={e => {
|
|
433
|
+
onChange={(e) => {
|
|
405
434
|
onCustomColumnChecked(dataIndex, e.target.checked);
|
|
406
435
|
}}
|
|
407
436
|
/>
|
|
@@ -421,7 +450,11 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
421
450
|
|
|
422
451
|
const renderCustomBtn = () => {
|
|
423
452
|
const Btn = (
|
|
424
|
-
<Button
|
|
453
|
+
<Button
|
|
454
|
+
type={customStyle}
|
|
455
|
+
size={(BtnSize as any)[props?.size || 'middle']}
|
|
456
|
+
className={classnames('btn', `table-head-btn-${props.size}`)}
|
|
457
|
+
>
|
|
425
458
|
{iconPosition && iconPosition === 'left' && (
|
|
426
459
|
<CommIcon
|
|
427
460
|
icon={{
|
|
@@ -465,7 +498,9 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
465
498
|
title={
|
|
466
499
|
<>
|
|
467
500
|
<div className="popHead">
|
|
468
|
-
<span>
|
|
501
|
+
<span>
|
|
502
|
+
{getLocale?.('Table.headCol')}
|
|
503
|
+
</span>
|
|
469
504
|
<a
|
|
470
505
|
className="extend"
|
|
471
506
|
onClick={() => {
|
|
@@ -487,9 +522,61 @@ const TableHead: React.FC<MyTableHeadProps> = (props: any) => {
|
|
|
487
522
|
return Btn;
|
|
488
523
|
};
|
|
489
524
|
|
|
525
|
+
const tableHeader = useMemo(() => {
|
|
526
|
+
// { title: '无图标', value: 'none' },
|
|
527
|
+
// { title: '样式一', value: 'styleOne' },
|
|
528
|
+
// { title: '样式二', value: 'styleTwo' },
|
|
529
|
+
// { title: '自定义', value: 'custom' },
|
|
530
|
+
let header = <></>;
|
|
531
|
+
switch (headIconType) {
|
|
532
|
+
case 'none':
|
|
533
|
+
header = <div className={classnames('title', `${prefix}-title`, 'custom-title')}>{tableTitle}</div>;
|
|
534
|
+
break;
|
|
535
|
+
case 'styleOne':
|
|
536
|
+
header = (
|
|
537
|
+
<div className={classnames('title', `${prefix}-title`, 'custom-title')}>
|
|
538
|
+
<div className="head-style-one">{tableTitle}</div>
|
|
539
|
+
</div>
|
|
540
|
+
);
|
|
541
|
+
break;
|
|
542
|
+
case 'styleTwo':
|
|
543
|
+
header = (
|
|
544
|
+
<div className={classnames('title', `${prefix}-title`, 'custom-title')}>
|
|
545
|
+
<div className="head-style-two">{tableTitle}</div>
|
|
546
|
+
</div>
|
|
547
|
+
);
|
|
548
|
+
break;
|
|
549
|
+
case 'custom':
|
|
550
|
+
header = (
|
|
551
|
+
<div className={classnames('title', `${prefix}-title`, 'custom-title')}>
|
|
552
|
+
<CommIcon
|
|
553
|
+
icon={{
|
|
554
|
+
type: headPrefixIcon?.prefixIconType,
|
|
555
|
+
theme: headPrefixIcon?.prefixIconTheme,
|
|
556
|
+
fontAddress: headPrefixIcon?.prefixIconFontAddress,
|
|
557
|
+
iconFile: headPrefixIcon?.prefixIconiconFile,
|
|
558
|
+
}}
|
|
559
|
+
engineApis={props.engineApis}
|
|
560
|
+
getEngineApis={props.getEngineApis}
|
|
561
|
+
$$componentItem={props.$$componentItem}
|
|
562
|
+
className="head-style-custom"
|
|
563
|
+
getEdEngineApi={props.getEdEngineApi}
|
|
564
|
+
/>
|
|
565
|
+
{tableTitle}
|
|
566
|
+
</div>
|
|
567
|
+
);
|
|
568
|
+
break;
|
|
569
|
+
default:
|
|
570
|
+
header = <div className={classnames('title', `${prefix}-title`)}>{tableTitle}</div>;
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
return header;
|
|
575
|
+
}, [tableTitle, headIconType, headPrefixIcon]);
|
|
576
|
+
|
|
490
577
|
return showHead ? (
|
|
491
578
|
<div className={classnames(prefix, `${prefix}-${props.size}`)}>
|
|
492
|
-
|
|
579
|
+
{tableHeader}
|
|
493
580
|
<div className="extend">
|
|
494
581
|
{renderHeaderBtn()}
|
|
495
582
|
{(typeof showCustom === 'boolean' ? showCustom : hasCustom) && renderCustomBtn()}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import useSummaryCol, { SummaryProps } from '../hooks/useSummaryCol';
|
|
3
|
+
import { Table, TableProps } from 'antd';
|
|
3
4
|
import { SummaryConfig } from '../types/prop';
|
|
4
5
|
|
|
5
6
|
const { Row, Cell } = Table.Summary;
|
|
6
7
|
export interface SummaryRowProps<T> {
|
|
7
|
-
dataSource?: SummaryProps<T>['dataSource']
|
|
8
|
-
columns?: SummaryProps<T>['columns']
|
|
8
|
+
dataSource?: SummaryProps<T>['dataSource'],
|
|
9
|
+
columns?: SummaryProps<T>['columns'],
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 合计行属性
|
|
@@ -20,34 +21,25 @@ export interface SummaryRowProps<T> {
|
|
|
20
21
|
/**
|
|
21
22
|
* 选择模式
|
|
22
23
|
*/
|
|
23
|
-
selectionType?: Required<TableProps<T>>['rowSelection']['type']
|
|
24
|
+
selectionType?: Required<TableProps<T>>['rowSelection']['type']
|
|
24
25
|
}
|
|
25
26
|
const TableSummaryRow = <T, >(props: SummaryRowProps<T>) => {
|
|
26
27
|
const { dataSource, columns, summaryConfig, summary, selectionType } = props;
|
|
27
28
|
const { background } = summaryConfig || {};
|
|
28
|
-
const { summaryColList } = useSummaryCol({
|
|
29
|
-
dataSource,
|
|
30
|
-
columns,
|
|
31
|
-
summaryConfig,
|
|
32
|
-
});
|
|
29
|
+
const { summaryColList } = useSummaryCol({ dataSource, columns, summaryConfig });
|
|
33
30
|
|
|
34
|
-
return summaryColList?.length > 0 ? (
|
|
35
|
-
<Row
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}}
|
|
31
|
+
return (summaryColList?.length > 0) ? (
|
|
32
|
+
<Row style={{
|
|
33
|
+
background,
|
|
34
|
+
}}
|
|
39
35
|
>
|
|
40
36
|
{/* 开启选择模式时,预置一个占位单元格 */}
|
|
41
37
|
{selectionType !== undefined && <Cell index={0} />}
|
|
42
38
|
{summaryColList.map(({ colSpan, title, align }, i) => (
|
|
43
|
-
<Cell index={i} colSpan={colSpan || 1} align={align}>
|
|
44
|
-
{title}
|
|
45
|
-
</Cell>
|
|
39
|
+
<Cell index={i} colSpan={colSpan || 1} align={align}>{title}</Cell>
|
|
46
40
|
))}
|
|
47
41
|
</Row>
|
|
48
|
-
) : (
|
|
49
|
-
((summary?.(dataSource as any[]) || null) as any)
|
|
50
|
-
);
|
|
42
|
+
) : (summary?.(dataSource as any[]) || null) as any;
|
|
51
43
|
};
|
|
52
44
|
|
|
53
45
|
export default TableSummaryRow;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import useCMDAction, { useCommonCMDAction } from './useCMDActions';
|
|
1
|
+
import useExpandable from './useExpandable';
|
|
3
2
|
import useColumns from './useColumns';
|
|
3
|
+
import useFormatCell from './useFormatCell';
|
|
4
|
+
import useCMDAction, { useCommonCMDAction } from './useCMDActions';
|
|
4
5
|
import useCommon from './useCommon';
|
|
5
6
|
import useDataSource from './useDataSource';
|
|
6
|
-
import useExpandable from './useExpandable';
|
|
7
7
|
import useFilter from './useFilter';
|
|
8
|
-
import useFormatCell from './useFormatCell';
|
|
9
8
|
import usePagination from './usePagination';
|
|
10
9
|
import useRowEdit from './useRowEdit';
|
|
11
10
|
import useRowMerge from './useRowMerge';
|
|
12
11
|
import useScroll from './useScroll';
|
|
13
12
|
import useSelection from './useSelection';
|
|
14
13
|
import useSort from './useSort';
|
|
14
|
+
import useCheckStrict from './useCheckStrict';
|
|
15
15
|
|
|
16
16
|
export {
|
|
17
17
|
useExpandable,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useState, useImperativeHandle } from 'react';
|
|
2
|
+
import { createEmptyRow, EMPTY_ROW_TEMP_KEY_ATTR, deleteTempRowProperties } from '../utils';
|
|
1
3
|
import { EngineApisType } from '@lingxiteam/types';
|
|
2
4
|
import merge from 'lodash/merge';
|
|
3
|
-
import { useImperativeHandle, useState } from 'react';
|
|
4
|
-
import { createEmptyRow, deleteTempRowProperties, EMPTY_ROW_TEMP_KEY_ATTR } from '../utils';
|
|
5
5
|
|
|
6
6
|
interface UseCommonCMDAction {
|
|
7
|
-
ref: any
|
|
7
|
+
ref: any,
|
|
8
8
|
setCurrent?: React.SetStateAction<any>;
|
|
9
9
|
setCurrentPage?: React.SetStateAction<any>;
|
|
10
10
|
setTotal?: React.SetStateAction<any>;
|
|
@@ -74,11 +74,14 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
74
74
|
// 是否只更新内部数据源,从3.8.1开始只更新内部数据源
|
|
75
75
|
const { tableUpdateInnerDataSource } = engineApis?.compatConfig?.cmd || {};
|
|
76
76
|
|
|
77
|
-
const {
|
|
77
|
+
const {
|
|
78
|
+
loading,
|
|
79
|
+
colServiceData,
|
|
80
|
+
} = useCommonCMDAction(props);
|
|
78
81
|
|
|
79
82
|
const validateFormAndScroll = (compId: string, callback: any = () => {}) => {
|
|
80
83
|
const formValues = form.getFieldsValue() || {};
|
|
81
|
-
const keys = Object.keys(formValues).filter(k => k.startsWith(compId));
|
|
84
|
+
const keys = Object.keys(formValues).filter((k) => k.startsWith(compId));
|
|
82
85
|
form
|
|
83
86
|
.validateFields(keys)
|
|
84
87
|
.then(() => {
|
|
@@ -105,11 +108,9 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
105
108
|
}
|
|
106
109
|
if (tableUpdateInnerDataSource) {
|
|
107
110
|
// 主键不存在时需补上
|
|
108
|
-
setInnerDataSource(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})
|
|
112
|
-
);
|
|
111
|
+
setInnerDataSource((data?.dataSource || []).map((c: any, idx: number) => {
|
|
112
|
+
return setTableRowKey(c, idx);
|
|
113
|
+
}));
|
|
113
114
|
} else {
|
|
114
115
|
/**
|
|
115
116
|
* 注意,不是直接使用 setInnerDataSource
|
|
@@ -118,7 +119,8 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
118
119
|
*/
|
|
119
120
|
setOuterDataSource(data?.dataSource || []);
|
|
120
121
|
}
|
|
121
|
-
const isNumber = (num: any) => typeof num === 'number' ||
|
|
122
|
+
const isNumber = (num: any) => typeof num === 'number' ||
|
|
123
|
+
(typeof num === 'string' && !isNaN(Number(num)));
|
|
122
124
|
if (isNumber(data?.total)) {
|
|
123
125
|
setTotal?.(data?.total);
|
|
124
126
|
}
|
|
@@ -151,16 +153,18 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
151
153
|
/**
|
|
152
154
|
* 新增一行空白数据(绑定了数据源/没有绑定数据源通用)
|
|
153
155
|
*/
|
|
154
|
-
addTableEmptyRow: (updateData: Function, inlineeditnow?: boolean) => {
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
addTableEmptyRow: (updateData: Function, inlineeditnow: boolean, updateDataSource?: boolean,) => {
|
|
157
|
+
// 是否需要上报数据源
|
|
158
|
+
const needUpdateDataSource = updateDataSource === true || !tableUpdateInnerDataSource;
|
|
159
|
+
const newRowData: any = createEmptyRow(needUpdateDataSource);
|
|
160
|
+
if (!needUpdateDataSource) {
|
|
157
161
|
const newRowKey = newRowData[EMPTY_ROW_TEMP_KEY_ATTR];
|
|
158
162
|
newRowData[currentRowKey] = newRowKey;
|
|
159
|
-
const newDataSource = innerDataSource.map(c => {
|
|
163
|
+
const newDataSource = innerDataSource.map((c) => {
|
|
160
164
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
165
|
+
* 移除空白行的临时属性
|
|
166
|
+
* 最后一条空白行,不允许自动移除临时属性(交由保存/取消逻辑手动移除)
|
|
167
|
+
*/
|
|
164
168
|
delete c[EMPTY_ROW_TEMP_KEY_ATTR];
|
|
165
169
|
deleteTempRowProperties(c);
|
|
166
170
|
return c;
|
|
@@ -168,7 +172,7 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
168
172
|
setInnerDataSource([newRowData, ...newDataSource]);
|
|
169
173
|
// 是否开启行编辑
|
|
170
174
|
if (inlineeditnow) {
|
|
171
|
-
|
|
175
|
+
// 设置当前行为编辑状态
|
|
172
176
|
setNowEditingData({ ...newRowData });
|
|
173
177
|
setNowInlineEditKey(newRowKey);
|
|
174
178
|
}
|
|
@@ -230,11 +234,9 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
230
234
|
addTableRowData: (newRowData: any) => {
|
|
231
235
|
if (tableUpdateInnerDataSource) {
|
|
232
236
|
// 主键不存在时需补上
|
|
233
|
-
setInnerDataSource(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
})
|
|
237
|
-
);
|
|
237
|
+
setInnerDataSource([newRowData, ...innerDataSource].map((c: any, idx: number) => {
|
|
238
|
+
return setTableRowKey(c, idx);
|
|
239
|
+
}));
|
|
238
240
|
return;
|
|
239
241
|
}
|
|
240
242
|
|
|
@@ -346,9 +348,9 @@ const useCommonCMDAction = (props: UseCommonCMDAction) => {
|
|
|
346
348
|
useImperativeHandle(ref, () => ({
|
|
347
349
|
|
|
348
350
|
/**
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
351
|
+
* 加载字段翻译数据
|
|
352
|
+
* @param serviceData
|
|
353
|
+
*/
|
|
352
354
|
addColServiceData: (serviceData: any = {}) => {
|
|
353
355
|
setColServiceData({
|
|
354
356
|
...(colServiceData || {}),
|
|
@@ -411,4 +413,6 @@ const useCommonCMDAction = (props: UseCommonCMDAction) => {
|
|
|
411
413
|
};
|
|
412
414
|
|
|
413
415
|
export default useCMDAction;
|
|
414
|
-
export {
|
|
416
|
+
export {
|
|
417
|
+
useCommonCMDAction,
|
|
418
|
+
};
|