@cloudbase/weda-ui 3.4.9-alpha.1024 → 3.4.9
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/README.md +65 -30
- package/dist/configs/components/chart/bar.json +1 -1
- package/dist/configs/components/chart/line.js +1 -1
- package/dist/configs/components/chart/pie.json +1 -1
- package/dist/configs/components/customer-service.js +0 -2
- package/dist/configs/components/flowgraph.json +22 -0
- package/dist/configs/components/form-checkbox.js +1 -0
- package/dist/configs/components/form-date.js +1 -0
- package/dist/configs/components/form-depart-tree-select.js +2 -4
- package/dist/configs/components/form-email.js +1 -0
- package/dist/configs/components/form-image-uploader.js +1 -0
- package/dist/configs/components/form-input.js +1 -2
- package/dist/configs/components/form-location.js +2 -2
- package/dist/configs/components/form-multi-region.js +1 -0
- package/dist/configs/components/form-phone.js +1 -0
- package/dist/configs/components/form-radio.js +1 -0
- package/dist/configs/components/form-region.js +1 -0
- package/dist/configs/components/form-rich-text.js +1 -0
- package/dist/configs/components/form-select.js +1 -0
- package/dist/configs/components/form-switch.js +1 -0
- package/dist/configs/components/form-text-area.js +1 -0
- package/dist/configs/components/form-time.js +1 -0
- package/dist/configs/components/form-upload-file.js +1 -0
- package/dist/configs/components/form-url.js +1 -0
- package/dist/configs/components/form-user-tree-select.js +3 -4
- package/dist/configs/components/modal.js +0 -2
- package/dist/configs/components/navigationBar.json +1 -3
- package/dist/configs/components/wd-button.js +2 -2
- package/dist/configs/components/wd-icon.js +2 -2
- package/dist/configs/components/wd-link.js +2 -2
- package/dist/configs/components/wd-table.js +1 -1
- package/dist/configs/index.js +2 -0
- package/dist/docs/common/components/properties-view.js +3 -6
- package/dist/docs/common/tableView.js +7 -10
- package/dist/style/index.scss +1 -1
- package/dist/web/components/chart/common/core/eChartLine.js +12 -1
- package/dist/web/components/chart/common/data-transform.js +13 -9
- package/dist/web/components/chart/line/index.old.js +2 -1
- package/dist/web/components/flow/common/request.js +3 -3
- package/dist/web/components/flow/modules/chart/index.js +42 -3
- package/dist/web/components/flow/modules/chart/preview-data.js +88 -0
- package/dist/web/components/flow-graph/constants.js +28 -0
- package/dist/web/components/flow-graph/graph.js +267 -0
- package/dist/web/components/flow-graph/index.js +2 -0
- package/dist/web/components/flow-graph/style.css +109 -0
- package/dist/web/components/flow-graph/types.js +1 -0
- package/dist/web/components/form/select/dropdown-select/index.css +4 -0
- package/dist/web/components/form/select/dropdown-select/index.js +4 -1
- package/dist/web/components/form/select/request.js +9 -9
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +44 -490
- package/dist/web/components/form/userOrgSelect/common/utils.js +14 -58
- package/dist/web/components/form/userOrgSelect/component/OrgPaths.js +12 -0
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +1 -3
- package/dist/web/components/form/userOrgSelect/component/depart-select/departTreeSelect.h5.js +35 -56
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +46 -24
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +11 -20
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +57 -120
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +8 -24
- package/dist/web/components/form/userOrgSelect/component/user-org-list.js +4 -4
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +42 -33
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.js +20 -51
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/org-tree.js +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +4 -17
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +4 -6
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +7 -3
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +68 -158
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +3 -109
- package/dist/web/components/form-input-hooks/index.js +5 -2
- package/dist/web/components/index.js +1 -0
- package/dist/web/components/swiper/index.js +1 -2
- package/dist/web/components/table/BaseTable.js +1 -1
- package/dist/web/components/tabs/tabs.pc.js +10 -9
- package/dist/web/components/wd-form/index.js +28 -14
- package/dist/web/components/wd-table/components/ExportFileModalByApi/index.js +1 -1
- package/dist/web/components/wd-table/components/FieldRender/index.js +13 -2
- package/dist/web/components/wd-table/hooks/useChooseList.js +3 -5
- package/dist/web/components/wd-table/hooks/useTableData.js +1 -7
- package/dist/web/components/wd-table/utils/index.js +22 -3
- package/dist/web/components/wd-table/wd-table.js +9 -3
- package/dist/web/utils/datasource.js +3 -1
- package/package.json +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/* eslint max-lines: [error, 500] */
|
|
3
3
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useDebouncedCallback, useMap, useMountEffect, useSyncedRef, } from '@react-hookz/web';
|
|
5
5
|
import { isInIde, usePlatform } from '../../utils/platform';
|
|
6
6
|
import { ConfigProvider, Form as TeaForm } from 'tea-component';
|
|
7
7
|
import classNames from '../../utils/classnames';
|
|
@@ -23,6 +23,12 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
23
23
|
// 兼容流程setValue调用,其他地方别用
|
|
24
24
|
$node, } = props;
|
|
25
25
|
const formItemMap = useMap([]);
|
|
26
|
+
/**
|
|
27
|
+
* 根据他的文档
|
|
28
|
+
* 上面返回的 formItemMap 引用会保持不变,但是Map的方法会导致重渲染
|
|
29
|
+
* 所以要用它作useEffect deps的时候用下面这个string
|
|
30
|
+
* */
|
|
31
|
+
const formItemMapKey = [...formItemMap.keys()].sort().join(',');
|
|
26
32
|
const platform = usePlatform();
|
|
27
33
|
const contentSlot = useMemo(() => contentSlotEl, [contentSlotEl]);
|
|
28
34
|
const cls = classNames({
|
|
@@ -84,6 +90,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
84
90
|
const formData = getFormDataFromItemMap(formItemMap);
|
|
85
91
|
if (!isObjectEqual(formData, preFormCtxRef.current, true)) {
|
|
86
92
|
(_b = (_a = eventsRef === null || eventsRef === void 0 ? void 0 : eventsRef.current) === null || _a === void 0 ? void 0 : _a.onDataChange) === null || _b === void 0 ? void 0 : _b.call(_a, { data: formData });
|
|
93
|
+
setFormData(formData);
|
|
87
94
|
preFormCtxRef.current = formData;
|
|
88
95
|
}
|
|
89
96
|
});
|
|
@@ -120,28 +127,27 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
120
127
|
// useWhatChanged([formItemMap, initialValues, submit, validate]);
|
|
121
128
|
useLoopRenderDetect();
|
|
122
129
|
const { ready } = useWedaAppContext();
|
|
123
|
-
const [recoversFn, { push: addRecoversFn, reset: resetRecoversFn }] = useList([]);
|
|
124
130
|
const previousFormType = useRef(null);
|
|
125
131
|
useEffect(() => {
|
|
126
132
|
if (!ready) {
|
|
127
133
|
return;
|
|
128
134
|
}
|
|
129
|
-
if (formType === previousFormType.current)
|
|
130
|
-
return;
|
|
135
|
+
// if (formType === previousFormType.current) return;
|
|
131
136
|
logger.debug('listen formType', { formType, previousFormType }, formItemMap);
|
|
132
137
|
previousFormType.current = formType;
|
|
133
138
|
Promise.resolve().then(() => {
|
|
134
139
|
if (formType === 'read') {
|
|
135
140
|
formItemMap.forEach((item) => {
|
|
136
|
-
|
|
141
|
+
item.setReadOnly(true);
|
|
137
142
|
});
|
|
138
143
|
}
|
|
139
144
|
else {
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
formItemMap.forEach((item) => {
|
|
146
|
+
item.setReadOnly(item.initialDisabled);
|
|
147
|
+
});
|
|
142
148
|
}
|
|
143
149
|
});
|
|
144
|
-
}, [ready, formType, formItemMap,
|
|
150
|
+
}, [ready, formType, formItemMap, formItemMapKey]);
|
|
145
151
|
useMountEffect(() => {
|
|
146
152
|
logger.debug('formItemMap', formItemMap);
|
|
147
153
|
});
|
|
@@ -231,9 +237,16 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
231
237
|
if (!isInIde()) {
|
|
232
238
|
onInitDataSourceFieldsWithAuth(authValue);
|
|
233
239
|
}
|
|
234
|
-
}, [
|
|
240
|
+
}, [
|
|
241
|
+
authValue,
|
|
242
|
+
isDataModel,
|
|
243
|
+
onInitDataSourceFieldsWithAuth,
|
|
244
|
+
formItemMap,
|
|
245
|
+
formItemMapKey,
|
|
246
|
+
]);
|
|
235
247
|
const initedItemMapRef = useRef({});
|
|
236
248
|
const preFormCtxRef = useRef(null);
|
|
249
|
+
const [formData, setFormData] = useState(() => getFormDataFromItemMap(formItemMap));
|
|
237
250
|
React.useImperativeHandle(ref, () => {
|
|
238
251
|
return {
|
|
239
252
|
formType,
|
|
@@ -266,9 +279,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
266
279
|
authValue,
|
|
267
280
|
layout,
|
|
268
281
|
dataSourceName,
|
|
269
|
-
|
|
270
|
-
return getFormDataFromItemMap(formItemMap);
|
|
271
|
-
},
|
|
282
|
+
value: formData,
|
|
272
283
|
remoteValue: fetchedInitialValues,
|
|
273
284
|
updateFormContext,
|
|
274
285
|
dataSourceProfile,
|
|
@@ -290,8 +301,9 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
290
301
|
validate,
|
|
291
302
|
clearValidate,
|
|
292
303
|
updateFormContext,
|
|
304
|
+
formData,
|
|
293
305
|
]);
|
|
294
|
-
const setInitValue =
|
|
306
|
+
const setInitValue = useDebouncedCallback(() => {
|
|
295
307
|
var _a;
|
|
296
308
|
for (const [name, formItem] of formItemMap.entries()) {
|
|
297
309
|
const value = lodashGet(initialValues, name);
|
|
@@ -301,7 +313,9 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
301
313
|
}
|
|
302
314
|
}
|
|
303
315
|
updateFormContext();
|
|
304
|
-
}, [formItemMap, initialValues, updateFormContext]
|
|
316
|
+
}, [formItemMap, initialValues, updateFormContext],
|
|
317
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
318
|
+
200);
|
|
305
319
|
React.useEffect(() => {
|
|
306
320
|
// 单向 Form向下设置值
|
|
307
321
|
let setValueReady = false;
|
|
@@ -19,7 +19,7 @@ export const ExportFileModal = ({ fields, columns, isExportFileModalByApiVisible
|
|
|
19
19
|
return true;
|
|
20
20
|
})) === null || _a === void 0 ? void 0 : _a.sort((a, b) => (a === null || a === void 0 ? void 0 : a['x-index']) - (b === null || b === void 0 ? void 0 : b['x-index']))) === null || _b === void 0 ? void 0 : _b.filter((item) => {
|
|
21
21
|
// 筛选出列管理字段
|
|
22
|
-
const isVisible = columns === null || columns === void 0 ? void 0 : columns.findIndex((column) => (column === null || column === void 0 ? void 0 : column.
|
|
22
|
+
const isVisible = columns === null || columns === void 0 ? void 0 : columns.findIndex((column) => (column === null || column === void 0 ? void 0 : column.key) === (item === null || item === void 0 ? void 0 : item.name) && (column === null || column === void 0 ? void 0 : column.isExport));
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
24
24
|
return isVisible != -1;
|
|
25
25
|
});
|
|
@@ -14,6 +14,7 @@ import UploaderFileView from '../../../uploaderFileView';
|
|
|
14
14
|
import { ViewCell } from './UserDepartment/ViewCell';
|
|
15
15
|
import { QuoteModal } from './QuoteModal';
|
|
16
16
|
import { TABLE_SLOT_PREFIX } from '../../../../utils/constant';
|
|
17
|
+
import { getPrimaryField } from '../../../../utils/datasource';
|
|
17
18
|
import { useConfig } from '../../../../utils/config-context';
|
|
18
19
|
import { ImagePreview } from './ImagePreview';
|
|
19
20
|
const MODAL_SIZE = 'auto';
|
|
@@ -46,7 +47,10 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
46
47
|
}
|
|
47
48
|
// render 方法
|
|
48
49
|
const FieldRender = (val) => {
|
|
49
|
-
|
|
50
|
+
var _a;
|
|
51
|
+
if (isValueEmpty(val) ||
|
|
52
|
+
(type === 'array' && !(val === null || val === void 0 ? void 0 : val.length)) ||
|
|
53
|
+
(type === 'array' && (val === null || val === void 0 ? void 0 : val.length) && !((_a = Object.keys(val[0])) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
50
54
|
return '-';
|
|
51
55
|
}
|
|
52
56
|
// fieldValue 值转换,如布尔/时间/枚举等
|
|
@@ -564,8 +568,9 @@ export const getSearchAttributes = (fields) => fields
|
|
|
564
568
|
}
|
|
565
569
|
return config;
|
|
566
570
|
});
|
|
567
|
-
export const getFieldValue = (name,
|
|
571
|
+
export const getFieldValue = (name, _record) => {
|
|
568
572
|
var _a;
|
|
573
|
+
const record = getPrimaryField(_record);
|
|
569
574
|
if (name === '_departmentList')
|
|
570
575
|
return (((_a = record === null || record === void 0 ? void 0 : record['##SHOW']) === null || _a === void 0 ? void 0 : _a._departmentList) || []).join(',');
|
|
571
576
|
return record[name];
|
|
@@ -685,7 +690,13 @@ export const getTableColumns = ({ fields, columnSets, slots, fixedFront, fixedEn
|
|
|
685
690
|
});
|
|
686
691
|
return baseColumns.map((i) => ({
|
|
687
692
|
...i,
|
|
693
|
+
// key值默认为字段的name值,同时作为table的key值需要唯一,因此重新设置为slotKey
|
|
688
694
|
key: (i === null || i === void 0 ? void 0 : i.slotKey) || (i === null || i === void 0 ? void 0 : i.key),
|
|
695
|
+
// 此字段为colum 绑定字段的key值,业务场景使用次字段
|
|
689
696
|
fieldKey: i === null || i === void 0 ? void 0 : i.key,
|
|
690
697
|
}));
|
|
691
698
|
};
|
|
699
|
+
export const mapColumKey = (columnSets) => {
|
|
700
|
+
// 业务场景,多依赖key字段,还原为字段值
|
|
701
|
+
return columnSets.map((i) => ({ ...i, key: i.fieldKey }));
|
|
702
|
+
};
|
|
@@ -34,12 +34,10 @@ export const getDataBaseInfo = (fields, format, childDbName) => {
|
|
|
34
34
|
return dataBase;
|
|
35
35
|
};
|
|
36
36
|
export const mapResult = (data, primaryColumn) => {
|
|
37
|
-
var _a
|
|
38
|
-
return (
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = data === null || data === void 0 ? void 0 : data.records) === null || _a === void 0 ? void 0 : _a.map((childItem) => ({
|
|
39
39
|
value: childItem._id,
|
|
40
|
-
text: childItem[primaryColumn]
|
|
41
|
-
? childItem._id
|
|
42
|
-
: childItem[primaryColumn],
|
|
40
|
+
text: childItem[primaryColumn] ? childItem[primaryColumn] : childItem._id,
|
|
43
41
|
}));
|
|
44
42
|
};
|
|
45
43
|
export const useChooseList = ({ dataSourceAPI, queryParams, childDbName, primaryColumn, }) => {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { useEffect, useCallback, useState } from 'react';
|
|
2
|
-
import { getPrimaryField } from '../../../utils/datasource';
|
|
3
2
|
const defaultPageNo = 1;
|
|
4
3
|
export const useTableData = ({ dataSourceAPI, connectorMethod, query, events, isModel, dbName, isH5, isNoDataSourceBind, }) => {
|
|
5
4
|
const [total, setTotal] = useState(0);
|
|
6
5
|
const [tableLoading, setTableLoading] = useState(true);
|
|
7
6
|
const [tableData, setTableData] = useState([]);
|
|
8
7
|
const fetch = useCallback(async () => {
|
|
9
|
-
var _a;
|
|
10
8
|
if (isNoDataSourceBind) {
|
|
11
9
|
return;
|
|
12
10
|
}
|
|
@@ -14,11 +12,7 @@ export const useTableData = ({ dataSourceAPI, connectorMethod, query, events, is
|
|
|
14
12
|
setTableLoading(true);
|
|
15
13
|
if (isModel) {
|
|
16
14
|
data = await dataSourceAPI.getRecordList(query);
|
|
17
|
-
data.records =
|
|
18
|
-
((_a = data.records) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
19
|
-
const temp = getPrimaryField(item);
|
|
20
|
-
return { ...temp };
|
|
21
|
-
})) || [];
|
|
15
|
+
data.records = data.records || [];
|
|
22
16
|
}
|
|
23
17
|
else if (connectorMethod === null || connectorMethod === void 0 ? void 0 : connectorMethod.name) {
|
|
24
18
|
data = await dataSourceAPI.getConnect(connectorMethod === null || connectorMethod === void 0 ? void 0 : connectorMethod.name, query);
|
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
import { getDataSourceFieldsWithAuth } from '../../../utils/datasource';
|
|
3
3
|
import { TABLE_SLOT_PREFIX, GLOBAL_BUTTON, REL_DICT, } from '../../../utils/constant';
|
|
4
4
|
import { callWedaApi, appCloudGetWedaUserId, getIsExitApi, } from '../../../utils/tcb';
|
|
5
|
+
// 新接口没有返回关联表的主列字段,从旧接口中查询出来
|
|
6
|
+
const getPrimaryColumn = (fields, dataViewPropertiesList) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const RelationViewList = ((_b = (_a = dataViewPropertiesList === null || dataViewPropertiesList === void 0 ? void 0 : dataViewPropertiesList.Rows) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.RelationViewList) || [];
|
|
9
|
+
const RelationViewListSchemaList = RelationViewList.map((i) => (i === null || i === void 0 ? void 0 : i.Schema) && JSON.parse(i.Schema));
|
|
10
|
+
return fields.map((i) => {
|
|
11
|
+
const item = { ...i };
|
|
12
|
+
if (item === null || item === void 0 ? void 0 : item['x-parent']) {
|
|
13
|
+
const schema = RelationViewListSchemaList.find((j) => (j === null || j === void 0 ? void 0 : j['x-parentRelationKey']) === `@${item.name}`);
|
|
14
|
+
item.parentDatasource = { schema };
|
|
15
|
+
return item;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return item;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
5
22
|
// 通过前缀过滤出插槽属性,传入属性是确定的,所以可以通过前缀识别
|
|
6
23
|
export const getSlots = (props) => Object.keys(props).reduce((acc, key) => {
|
|
7
24
|
if (key.startsWith(TABLE_SLOT_PREFIX) || key === GLOBAL_BUTTON) {
|
|
@@ -91,12 +108,12 @@ export const getQueryParams = ({ queryParams, wList, viewFieldsData, connectorPa
|
|
|
91
108
|
...SearchConfig,
|
|
92
109
|
ConditionConfig,
|
|
93
110
|
];
|
|
94
|
-
//
|
|
95
|
-
if ((viewed === null || viewed === void 0 ? void 0 : viewed.sortItem)
|
|
111
|
+
// 如果视图里存在排序设置则以视图为主
|
|
112
|
+
if (isViewTable && (viewed === null || viewed === void 0 ? void 0 : viewed.sortItem)) {
|
|
96
113
|
params.orderBy = (_a = viewed === null || viewed === void 0 ? void 0 : viewed.sortItem) === null || _a === void 0 ? void 0 : _a.orderBy;
|
|
97
114
|
params.orderType = (_b = viewed === null || viewed === void 0 ? void 0 : viewed.sortItem) === null || _b === void 0 ? void 0 : _b.orderType;
|
|
98
115
|
}
|
|
99
|
-
//
|
|
116
|
+
// 非视图存在排序属性配置
|
|
100
117
|
if (!isViewTable && orderBy && orderType) {
|
|
101
118
|
params.orderBy = orderBy;
|
|
102
119
|
params.orderType = orderType;
|
|
@@ -218,6 +235,8 @@ export const getViews = async (dbName, selectedView) => {
|
|
|
218
235
|
describeRuntimeDataViewPropertiesListStatus) {
|
|
219
236
|
// 设置字段权限,关联模型字段权限,接口没返回暂不进行校验:['x-viewType']
|
|
220
237
|
item.fields = (_f = getDataSourceFieldsWithAuth(item.fields, dataViewPropertiesList.ResourceCheckInfos)) === null || _f === void 0 ? void 0 : _f.filter((value) => value.readWriteAuth === 'rw' || value.readWriteAuth === 'r');
|
|
238
|
+
// 关联模型的主列字段
|
|
239
|
+
item.fields = getPrimaryColumn(item.fields, dataViewPropertiesList);
|
|
221
240
|
}
|
|
222
241
|
return item;
|
|
223
242
|
});
|
|
@@ -11,6 +11,7 @@ import { useEnumContext } from '../../utils/hooks/context';
|
|
|
11
11
|
import { EnumHoc } from '../../utils/hooks/EnumHoc';
|
|
12
12
|
import { usePlatform, isInIde } from '../../utils/platform';
|
|
13
13
|
import { convertWhere } from '../../utils/getModelParams';
|
|
14
|
+
import isObjectEqual from '../../utils/isObjectEqual';
|
|
14
15
|
import { useAuthFields } from './hooks/useAuthFields';
|
|
15
16
|
import { useDataSourceTitle } from './hooks/useDataSource';
|
|
16
17
|
import { useTableData } from './hooks/useTableData';
|
|
@@ -18,7 +19,7 @@ import { useViewFields } from './hooks/useViewFields';
|
|
|
18
19
|
import { useQueryParams } from './hooks/useQueryParams';
|
|
19
20
|
import { getSlots, getFilterFields, getSelectedView, getSortColumns, mapTableDataWithView, } from './utils';
|
|
20
21
|
import { Mock } from './mock';
|
|
21
|
-
import { getTableColumns, slotRender } from './components/FieldRender';
|
|
22
|
+
import { getTableColumns, slotRender, mapColumKey, } from './components/FieldRender';
|
|
22
23
|
import Modal from '../modal';
|
|
23
24
|
import { WdButton } from '../wd-button';
|
|
24
25
|
const _defaultPageIndex = 1;
|
|
@@ -406,7 +407,12 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
406
407
|
const hasFilterButton = !!filterFieldsData.length;
|
|
407
408
|
const recordKey = isInIde() ? undefined : '_id';
|
|
408
409
|
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(EnumHoc, { fields: authFields, children: _jsxs("div", { className: classNames(wrapClassList, className), style: style, id: id, children: [_jsx(FilterFieldsPanel, { openMobileFilter: openMobileFilter, setOpenMobileFilter: setOpenMobileFilter, filterFields: filterFieldsData, fetchData: (searchValues = []) => {
|
|
409
|
-
|
|
410
|
+
if (isObjectEqual(queryParams.searchValues, searchValues)) {
|
|
411
|
+
getNewList();
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
setQueryParams({ ...queryParams, searchValues, pageIndex: 1 });
|
|
415
|
+
}
|
|
410
416
|
} }), _jsxs("div", { className: `${classPrefix}-table-container`, children: [!isH5 && !isNoDataSourceBind && (_jsxs("div", { className: `${classPrefix}-table-wrap-toolbar`, children: [enableGlobalButton && (_jsx("div", { className: `${classPrefix}-table-wrap-toolbar__col ${classPrefix}-table-wrap-toolbar__col-start`, children: _jsx(GlobalButton, { classPrefix: classPrefix, slots: slots === null || slots === void 0 ? void 0 : slots.globalButton }) })), (enableRefreshBtn || enableTableHeightSizeBtn) && (_jsx("div", { className: `${classPrefix}-table-wrap-toolbar__col ${classPrefix}-table-wrap-toolbar__col-end`, children: _jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: refreshTable, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
411
417
|
setOpenMobileFilter(true);
|
|
412
418
|
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination }) }))] })), isH5 &&
|
|
@@ -443,7 +449,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
443
449
|
} }), isH5 && enableGlobalButton && !isNoDataSourceBind && (_jsx("div", { className: `${classPrefix}-h5-table-wrap-footer`, children: _jsx(GlobalButton, { classPrefix: classPrefix, slots: slots === null || slots === void 0 ? void 0 : slots.globalButton }) }))] }), _jsx(ImportFileModal, { dbName: dbName, datasourceTitle: datasourceTitle, fields: fields, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, isImportFileModalByApiVisible: isImportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, refresh: () => {
|
|
444
450
|
// 导入成功后刷新页面
|
|
445
451
|
refreshTable();
|
|
446
|
-
} }), _jsx(ExportFileModal, { whereList: wList, fields: fields, columns: columns, isExportFileModalByApiVisible: isExportFileModalByApiVisible, selectedKeys: selectedKeys, dbName: dbName, query: query, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), _jsx(InOrOutRecordModal, { dbName: dbName, isInOrOutRecordModalVisible: isInOrOutRecordModalVisible, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), isH5 && (_jsx(Modal, { className: `${classPrefix}-h5-table-option-modal-wrap`, disableCloseIcon: true, title: "\u64CD\u4F5C", visible: isMobileOptionVisible, outerRef: modalRef, events: {
|
|
452
|
+
} }), _jsx(ExportFileModal, { whereList: wList, fields: fields, columns: mapColumKey(columns), isExportFileModalByApiVisible: isExportFileModalByApiVisible, selectedKeys: selectedKeys, dbName: dbName, query: query, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), _jsx(InOrOutRecordModal, { dbName: dbName, isInOrOutRecordModalVisible: isInOrOutRecordModalVisible, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), isH5 && (_jsx(Modal, { className: `${classPrefix}-h5-table-option-modal-wrap`, disableCloseIcon: true, title: "\u64CD\u4F5C", visible: isMobileOptionVisible, outerRef: modalRef, events: {
|
|
447
453
|
close: () => {
|
|
448
454
|
setIsMobileOptionVisible(false);
|
|
449
455
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isInIde, alertErrorMessage, isSystemField } from './platform';
|
|
2
|
+
import { deepClone } from './tool';
|
|
2
3
|
/* **** 数据源相关方法 **** */
|
|
3
4
|
const callWedaApi = (...args) => { var _a, _b; return (_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.callWedaApi(...args); };
|
|
4
5
|
export class DataSource {
|
|
@@ -348,7 +349,8 @@ export const resolveFieldsFromDatasource = async ({ dbName, enabledFieldNames, d
|
|
|
348
349
|
/**
|
|
349
350
|
* 获取主列字段标识并展示主列字段
|
|
350
351
|
*/
|
|
351
|
-
export const getPrimaryField = (
|
|
352
|
+
export const getPrimaryField = (_data) => {
|
|
353
|
+
const data = deepClone(_data);
|
|
352
354
|
const keys = Object.keys(data).filter((item) => item.includes('@'));
|
|
353
355
|
keys.forEach((item) => {
|
|
354
356
|
var _a, _b, _c, _d, _e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.4.9
|
|
3
|
+
"version": "3.4.9",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
"object.fromentries": "^2.0.5",
|
|
83
83
|
"prop-types": "^15.7.2",
|
|
84
84
|
"qrcode.react": "^3.1.0",
|
|
85
|
-
"rc-virtual-list": "^3.4.13",
|
|
86
85
|
"react-easy-swipe": "0.0.22",
|
|
87
86
|
"react-error-boundary": "^3.1.4",
|
|
88
87
|
"react-highlight-within-textarea": "3.1.1",
|
|
@@ -170,10 +169,10 @@
|
|
|
170
169
|
"identity-obj-proxy": "^3.0.0",
|
|
171
170
|
"is-builtin-module": "^3.2.0",
|
|
172
171
|
"jest": "^27.5.1",
|
|
172
|
+
"jest_workaround": "0.1.14",
|
|
173
173
|
"jest-canvas-mock": "^2.4.0",
|
|
174
174
|
"jest-environment-jsdom": "^27",
|
|
175
175
|
"jest-preview": "^0.2.6",
|
|
176
|
-
"jest_workaround": "0.1.14",
|
|
177
176
|
"json-schema-to-ts": "^2.5.5",
|
|
178
177
|
"make-fetch-happen": "^11.0.1",
|
|
179
178
|
"miniprogram-simulate": "^1.5.8",
|