@lingxiteam/ebe-utils 0.0.27 → 0.0.30
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/es/constants.js +0 -1
- package/es/index.d.ts +8 -2
- package/es/index.js +106 -42
- package/es/node/move.d.ts +1 -0
- package/es/node/move.js +7 -4
- package/es/requestQueue.d.ts +9 -0
- package/es/requestQueue.js +59 -0
- package/lib/h5public/src/components/common/PreviewFile/index.tsx +3 -7
- package/lib/h5public/src/components/factory/package.json +1 -1
- package/lib/h5public/src/components/factory/src/BlockSelect/components/CheckBox/index.tsx +14 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/components/Icon/index.tsx +4 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/index.tsx +13 -21
- package/lib/h5public/src/components/factory/src/Button/index.tsx +1 -0
- package/lib/h5public/src/components/factory/src/Card/index.less +11 -24
- package/lib/h5public/src/components/factory/src/Card/index.tsx +61 -22
- package/lib/h5public/src/components/factory/src/DGroup/index.less +7 -3
- package/lib/h5public/src/components/factory/src/DformFile/FormFile.tsx +17 -4
- package/lib/h5public/src/components/factory/src/DformFile/assets/closeIcon.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/default.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/fileName.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/img.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/js.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/pdf.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/ppt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/txt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/word.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/xls.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/zip.png +0 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.less +41 -5
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/h5public/src/components/factory/src/DynamicList/index.tsx +4 -2
- package/lib/h5public/src/components/factory/src/DynamicTable/Table.tsx +3 -1
- package/lib/h5public/src/components/factory/src/Image/BasicImage/index.tsx +36 -1
- package/lib/h5public/src/components/factory/src/StackColumn/loader.tsx +1 -1
- package/lib/h5public/src/components/factory/src/StaticTabs/index.tsx +1 -1
- package/lib/h5public/src/components/factory/src/VerificationCode/index.tsx +14 -3
- package/lib/h5public/src/components/factory/src/VideoPlayer/loader.ts +1 -1
- package/lib/h5public/src/components/factory/src/utils/CustomModule.tsx +3 -0
- package/lib/h5public/src/components/factory/src/utils/hooks/useFormItem.ts +3 -0
- package/lib/h5public/src/hooks/usePageForm.ts +2 -3
- package/lib/h5public/src/utils/native.ts +94 -0
- package/lib/node/move.d.ts +1 -0
- package/lib/node/move.js +6 -3
- package/lib/pcpublic/src/components/common/PreviewFile/index.tsx +8 -0
- package/lib/pcpublic/src/components/common/PreviewFile/utils.ts +45 -0
- package/lib/pcpublic/src/components/pcfactory/package.json +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/CollapsePanel/index.tsx +6 -4
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/pcpublic/src/components/pcfactory/src/Img/index.tsx +34 -2
- package/lib/pcpublic/src/components/pcfactory/src/LoopList/index.tsx +9 -4
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +8 -1
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/index.tsx +39 -13
- package/lib/pcpublic/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +22 -14
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +12 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +54 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +516 -485
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +40 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +3 -34
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +30 -3
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +34 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +15 -4
- package/lib/pcpublic/src/components/pcfactory/src/Tabs/index.tsx +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tag/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +13 -2
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/FormGroup.less +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Icon.less +4 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/StdUpload.less +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +15 -0
- package/lib/pcpublic/src/hooks/usePageForm.ts +2 -3
- package/lib/pcpublic/src/utils/exportCustomData/index.tsx +0 -3
- package/lib/pcpublic/src/utils/formUtils.ts +20 -1
- package/lib/public/src/hooks/useExportCustomDataFile.ts +4 -0
- package/lib/public/src/services/api/index.ts +12 -0
- package/lib/public/src/utils/Context/context.tsx +1 -0
- package/lib/public/src/utils/historytool.ts +3 -0
- package/lib/public/src/utils/lcdpBaseApi.ts +2 -2
- package/lib/public/src/utils/platform/utils/fileUtils.ts +12 -11
- package/lib/public/src/utils/polyfills.ts +4 -0
- package/lib/public/src/utils/popoverUtils.ts +56 -0
- package/lib/public/src/utils/service/baseRequest.ts +8 -8
- package/lib/public/src/utils/service/urlHelper.ts +2 -0
- package/package.json +2 -2
|
@@ -100,9 +100,9 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
|
|
|
100
100
|
|
|
101
101
|
const [reload, setReload] = useState(0);
|
|
102
102
|
const [compValue, setCompValue] = useState<any>();
|
|
103
|
-
const [dataSource, setDataSource] = useState([]);
|
|
104
|
-
const [oldDataSource, setOldDataSource] = useState([]);
|
|
105
|
-
const [selectedRows, setSelectedRows] = useState<any>([]);
|
|
103
|
+
const [dataSource, setDataSource] = useState<any[]>([]);
|
|
104
|
+
const [oldDataSource, setOldDataSource] = useState<any[]>([]);
|
|
105
|
+
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
106
106
|
const [params, setParams] = useState(defaultParams);
|
|
107
107
|
const [total, setTotal] = useState(0);
|
|
108
108
|
const [, setShow] = useState(false);
|
|
@@ -240,24 +240,28 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
|
|
|
240
240
|
},
|
|
241
241
|
})
|
|
242
242
|
.then((res = []) => {
|
|
243
|
-
res.
|
|
243
|
+
const newList = res.map((l: any) => ({
|
|
244
|
+
...l,
|
|
245
|
+
[valueKey?.key]: String(l[valueKey?.key]),
|
|
246
|
+
}));
|
|
247
|
+
newList.forEach((item) => {
|
|
244
248
|
set(item[valueKey?.key], item);
|
|
245
249
|
});
|
|
246
250
|
// 针对选择的数据在对应表中已删除时,手动补齐数据做展示
|
|
247
251
|
const others: any[] = [];
|
|
248
252
|
ids.forEach((i: any) => {
|
|
249
253
|
// eslint-disable-next-line eqeqeq
|
|
250
|
-
if (!
|
|
254
|
+
if (!newList.find((r) => r[valueKey?.key] == i)) {
|
|
251
255
|
others.push({
|
|
252
256
|
[valueKey?.key]: i,
|
|
253
257
|
[labelKey?.key || valueKey?.key]: i,
|
|
254
258
|
});
|
|
255
259
|
}
|
|
256
260
|
});
|
|
257
|
-
setSelectedRows([...
|
|
261
|
+
setSelectedRows([...newList, ...others]);
|
|
258
262
|
// 如果初次未传入正确的value数据类型
|
|
259
|
-
if (
|
|
260
|
-
const realType = typeof
|
|
263
|
+
if (newList?.length && newList[0][valueKey?.key]) {
|
|
264
|
+
const realType = typeof newList[0][valueKey?.key];
|
|
261
265
|
const valueType = typeof ids[0];
|
|
262
266
|
if (
|
|
263
267
|
(realType !== valueType || ignoreValueType) &&
|
|
@@ -269,7 +273,7 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
|
|
|
269
273
|
: ids.map((item) => transFormType[realType](item));
|
|
270
274
|
onSelectChange(
|
|
271
275
|
transformValue,
|
|
272
|
-
|
|
276
|
+
newList
|
|
273
277
|
.map((item) => item[labelKey?.key || valueKey?.key])
|
|
274
278
|
.join(','),
|
|
275
279
|
);
|
|
@@ -308,12 +312,16 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
|
|
|
308
312
|
})
|
|
309
313
|
.then((res: any) => {
|
|
310
314
|
const { list = [], total: newTotal } = res || {};
|
|
315
|
+
const newList: any[] = list.map((l: any) => ({
|
|
316
|
+
...l,
|
|
317
|
+
[valueKey?.key]: String(l[valueKey?.key]),
|
|
318
|
+
}));
|
|
311
319
|
if (!isSearch) {
|
|
312
|
-
setOldDataSource(
|
|
320
|
+
setOldDataSource([...newList]);
|
|
313
321
|
setTotal(newTotal || 0);
|
|
314
322
|
}
|
|
315
|
-
setDataSource(
|
|
316
|
-
(
|
|
323
|
+
setDataSource([...newList]);
|
|
324
|
+
(newList || []).forEach((item: any) => {
|
|
317
325
|
if (!get(item[valueKey?.key])) {
|
|
318
326
|
set(item[valueKey?.key], item);
|
|
319
327
|
}
|
|
@@ -432,7 +440,7 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
|
|
|
432
440
|
// onSearch={fetchList}
|
|
433
441
|
onSearch={(v) => superSelectGetAllPage(v, true)}
|
|
434
442
|
onChange={(e) => {
|
|
435
|
-
let changeValue:
|
|
443
|
+
let changeValue: any[] = [];
|
|
436
444
|
if (labelInValue) {
|
|
437
445
|
changeValue =
|
|
438
446
|
mode === 'multiple'
|
|
@@ -441,7 +449,7 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
|
|
|
441
449
|
} else {
|
|
442
450
|
changeValue = mode === 'multiple' ? e : [e];
|
|
443
451
|
}
|
|
444
|
-
const newData = dataSource.filter((f) =>
|
|
452
|
+
const newData = dataSource.filter((f: any) =>
|
|
445
453
|
changeValue.includes(f[valueKey.key]),
|
|
446
454
|
);
|
|
447
455
|
setSelectedRows(newData);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { FuncExpExeCuteType } from '../../utils/hooks/useFuncExpExecute';
|
|
4
4
|
import {
|
|
@@ -42,6 +42,7 @@ export interface CellContentProps {
|
|
|
42
42
|
children: any;
|
|
43
43
|
contentStyle: ContentStyle;
|
|
44
44
|
funcExpExecute?: FuncExpExeCuteType;
|
|
45
|
+
controllLineStyle?: CSSProperties | null;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
const CellContent = (props: CellContentProps) => {
|
|
@@ -54,6 +55,7 @@ const CellContent = (props: CellContentProps) => {
|
|
|
54
55
|
rowIndex,
|
|
55
56
|
contentStyle,
|
|
56
57
|
funcExpExecute,
|
|
58
|
+
controllLineStyle,
|
|
57
59
|
} = props;
|
|
58
60
|
const {
|
|
59
61
|
contentType,
|
|
@@ -96,6 +98,14 @@ const CellContent = (props: CellContentProps) => {
|
|
|
96
98
|
|
|
97
99
|
children = content ? handleCellContent(row, rowIndex) : children;
|
|
98
100
|
|
|
101
|
+
if (content && controllLineStyle) {
|
|
102
|
+
children = (
|
|
103
|
+
<span className="ued-control-line-number" style={controllLineStyle}>
|
|
104
|
+
{children}
|
|
105
|
+
</span>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
99
109
|
const handleOnCellClick = (e: any) => {
|
|
100
110
|
e.stopPropagation();
|
|
101
111
|
if (typeof onCellClick === 'function') {
|
|
@@ -214,6 +224,7 @@ const FormatCell: React.FC<MyFormatCell> = (props) => {
|
|
|
214
224
|
row={row}
|
|
215
225
|
rowId={rowId}
|
|
216
226
|
rowIndex={rowIndex}
|
|
227
|
+
controllLineStyle={props.tdProps?.controllLineStyle}
|
|
217
228
|
>
|
|
218
229
|
{children}
|
|
219
230
|
</CellContent>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EngineApisType } from '@lingxiteam/types';
|
|
1
2
|
import { useImperativeHandle, useState } from 'react';
|
|
2
3
|
import { createEmptyRow, EMPTY_ROW_TEMP_KEY_ATTR } from '../utils';
|
|
3
4
|
|
|
@@ -18,6 +19,7 @@ interface UseCommonCMDAction {
|
|
|
18
19
|
setInnerDataSource: Function;
|
|
19
20
|
setOuterDataSource: Function;
|
|
20
21
|
onRowSelected: Function;
|
|
22
|
+
engineApis?: EngineApisType;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
interface UseCMDActionPropsType extends UseCommonCMDAction {
|
|
@@ -59,11 +61,15 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
59
61
|
pagination,
|
|
60
62
|
onRowSaveClick,
|
|
61
63
|
loadPrint,
|
|
64
|
+
engineApis,
|
|
62
65
|
} = props;
|
|
63
66
|
|
|
64
67
|
// 表格编辑格式为下拉框时,绑定的服务对应的数据
|
|
65
68
|
const [colServiceDataForEdit, setColServiceDataForEdit] = useState({});
|
|
66
69
|
|
|
70
|
+
// 是否只更新内部数据源,从3.8.1开始只更新内部数据源
|
|
71
|
+
const { tableUpdateInnerDataSource } = engineApis?.compatConfig?.cmd || {};
|
|
72
|
+
|
|
67
73
|
const { loading, colServiceData } = useCommonCMDAction(props);
|
|
68
74
|
|
|
69
75
|
const validateFormAndScroll = (compId: string, callback: any = () => {}) => {
|
|
@@ -88,14 +94,25 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
88
94
|
* 加载表格数据(加载完之后,表格就脱离了数据源的控制了)
|
|
89
95
|
*/
|
|
90
96
|
setTableData: (data: { dataSource: any[]; total: any; current: any }) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
if (tableUpdateInnerDataSource) {
|
|
98
|
+
setInnerDataSource(data?.dataSource || []);
|
|
99
|
+
} else {
|
|
100
|
+
/**
|
|
101
|
+
* 注意,不是直接使用 setInnerDataSource
|
|
102
|
+
* 而是通过 setOuterDataSource 间接驱动 -> setInnerDataSource
|
|
103
|
+
* 因为需要对数据进行初始化
|
|
104
|
+
*/
|
|
105
|
+
setOuterDataSource(data?.dataSource || []);
|
|
106
|
+
}
|
|
107
|
+
const isNumber = (num: any) =>
|
|
108
|
+
typeof num === 'number' ||
|
|
109
|
+
(typeof num === 'string' && !isNaN(Number(num)));
|
|
110
|
+
if (isNumber(data?.total)) {
|
|
111
|
+
setTotal?.(data?.total);
|
|
112
|
+
}
|
|
113
|
+
if (isNumber(data?.current)) {
|
|
114
|
+
setCurrent?.(data?.current);
|
|
115
|
+
}
|
|
99
116
|
},
|
|
100
117
|
|
|
101
118
|
/**
|
|
@@ -123,7 +140,20 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
123
140
|
* 新增一行空白数据(绑定了数据源/没有绑定数据源通用)
|
|
124
141
|
*/
|
|
125
142
|
addTableEmptyRow: (updateData: Function, inlineeditnow?: boolean) => {
|
|
126
|
-
const newRowData = createEmptyRow();
|
|
143
|
+
const newRowData: any = createEmptyRow();
|
|
144
|
+
if (tableUpdateInnerDataSource) {
|
|
145
|
+
const newRowKey = newRowData[EMPTY_ROW_TEMP_KEY_ATTR];
|
|
146
|
+
newRowData[currentRowKey] = newRowKey;
|
|
147
|
+
delete newRowData[EMPTY_ROW_TEMP_KEY_ATTR];
|
|
148
|
+
setInnerDataSource([newRowData, ...innerDataSource]);
|
|
149
|
+
// 是否开启行编辑
|
|
150
|
+
if (inlineeditnow) {
|
|
151
|
+
// 设置当前行为编辑状态
|
|
152
|
+
setNowEditingData({ ...newRowData });
|
|
153
|
+
setNowInlineEditKey(newRowKey);
|
|
154
|
+
}
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
127
157
|
|
|
128
158
|
// TODO: 正是由于这里的历史需求,导致在表格初始化数据里,需要保留处理空白行的逻辑
|
|
129
159
|
// 如果表格绑定了数据源,则添加空白数据行时,采用先在数据源中加入空白行的方式,再刷新该表格数据实现
|
|
@@ -178,13 +208,18 @@ const useCMDAction = (props: UseCMDActionPropsType) => {
|
|
|
178
208
|
},
|
|
179
209
|
|
|
180
210
|
/**
|
|
181
|
-
*
|
|
211
|
+
* 新增一行数据
|
|
182
212
|
*/
|
|
183
213
|
addTableRowData: (newRowData: any) => {
|
|
214
|
+
if (tableUpdateInnerDataSource) {
|
|
215
|
+
setInnerDataSource([newRowData, ...innerDataSource]);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
184
219
|
/**
|
|
185
220
|
* 注意,不是直接使用 setInnerDataSource
|
|
186
221
|
* 而是通过 setOuterDataSource 间接驱动 -> setInnerDataSource
|
|
187
|
-
*
|
|
222
|
+
* 因为需要对数据进行初始化, 表格脱离了数据源的控制了
|
|
188
223
|
*/
|
|
189
224
|
setOuterDataSource([newRowData, ...innerDataSource]);
|
|
190
225
|
},
|
|
@@ -255,12 +290,16 @@ const useCommonCMDAction = (props: UseCommonCMDAction) => {
|
|
|
255
290
|
innerDataSource,
|
|
256
291
|
setInnerDataSource,
|
|
257
292
|
setOuterDataSource,
|
|
293
|
+
engineApis,
|
|
258
294
|
} = props;
|
|
259
295
|
|
|
260
296
|
const [loading, setLoading] = useState(false);
|
|
261
297
|
// 表格字段翻译绑定的服务对应的翻译数据
|
|
262
298
|
const [colServiceData, setColServiceData] = useState({});
|
|
263
299
|
|
|
300
|
+
// 是否只更新内部数据源,从3.8.1开始只更新内部数据源
|
|
301
|
+
const { tableUpdateInnerDataSource } = engineApis?.compatConfig?.cmd || {};
|
|
302
|
+
|
|
264
303
|
useImperativeHandle(ref, () => ({
|
|
265
304
|
/**
|
|
266
305
|
* 加载字段翻译数据
|
|
@@ -303,7 +342,10 @@ const useCommonCMDAction = (props: UseCommonCMDAction) => {
|
|
|
303
342
|
},
|
|
304
343
|
clearData: () => {
|
|
305
344
|
setInnerDataSource([]);
|
|
306
|
-
|
|
345
|
+
if (!tableUpdateInnerDataSource) {
|
|
346
|
+
// 3.8.1前,清空表格数据后,会脱离数据源控制
|
|
347
|
+
setOuterDataSource([]);
|
|
348
|
+
}
|
|
307
349
|
setTotal?.(0);
|
|
308
350
|
setCurrent?.(1);
|
|
309
351
|
setCurrentPage?.(1);
|