@cloudbase/weda-ui 3.4.12 → 3.4.13
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/dist/configs/components/form-date.js +1 -1
- package/dist/configs/components/form-depart-tree-select.js +1 -1
- package/dist/configs/components/form-location.js +1 -1
- package/dist/configs/components/form-multi-region.js +1 -1
- package/dist/configs/components/form-rich-text.js +1 -1
- package/dist/configs/components/form-select-multiple.js +1 -1
- package/dist/configs/components/form-select.js +1 -1
- package/dist/configs/components/form-switch.js +1 -1
- package/dist/configs/components/form-time.js +1 -1
- package/dist/configs/components/form-user-tree-select.js +1 -1
- package/dist/configs/components/wd-checkbox.js +1 -1
- package/dist/configs/components/wd-input.js +1 -1
- package/dist/configs/components/wd-radio.js +1 -1
- package/dist/configs/components/wd-table.js +3 -3
- package/dist/configs/components/wd-textarea.js +1 -1
- package/dist/style/index.scss +1 -1
- package/dist/web/components/form/select/dropdown-select/index.js +3 -3
- package/dist/web/components/form/select/index.js +0 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +20 -6
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +8 -4
- package/dist/web/components/form-input-hooks/index.js +3 -2
- package/dist/web/components/form-upload-file/index.js +0 -1
- package/dist/web/components/formdetail/index.js +3 -1
- package/dist/web/components/index.js +10 -10
- package/dist/web/components/navigationBar/common.js +1 -1
- package/dist/web/components/navigationBar/horizontalMenu.js +1 -1
- package/dist/web/components/navigationBar/index.css +11 -0
- package/dist/web/components/navigationBar/index.js +8 -1
- package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +1 -1
- package/dist/web/components/wd-form/hooks/use-remote-value.js +9 -2
- package/dist/web/components/wd-form/index.js +45 -23
- package/dist/web/components/wd-icon/wd-icon.js +10 -2
- package/dist/web/components/wd-table/components/FilterFieldsPanel/FilterFieldItem.js +4 -0
- package/dist/web/components/wd-table/components/Table/index.js +28 -7
- package/dist/web/components/wd-table/hooks/useTableData.js +6 -1
- package/dist/web/components/wd-table/hooks/useViewFields.js +1 -1
- package/dist/web/components/wd-table/wd-table.js +57 -44
- package/dist/web/utils/hooks/useFormLegacy.js +3 -2
- package/dist/web/weda-ui.css +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable max-lines */
|
|
3
|
-
import { useRef, useEffect, useState, useMemo, useImperativeHandle, forwardRef, } from 'react';
|
|
3
|
+
import { useRef, useEffect, useState, useMemo, useImperativeHandle, forwardRef, memo, } from 'react';
|
|
4
4
|
import { ConfigProvider } from 'tea-component';
|
|
5
5
|
import { Table, ExportFileModal, ImportFileModal, InOrOutRecordModal, deleteRecord, importHandleByApi, exportHandleByApi, exportHandle, FilterFieldsPanel, ToolBar, } from './components';
|
|
6
6
|
import classNames from '../../utils/classnames';
|
|
@@ -24,22 +24,16 @@ import Modal from '../modal';
|
|
|
24
24
|
import { WdButton } from '../wd-button';
|
|
25
25
|
const _defaultPageIndex = 1;
|
|
26
26
|
const _defaultPageSize = 10;
|
|
27
|
-
const TableOption = ({
|
|
27
|
+
const TableOption = memo(function TableOption({ slots, ...props }) {
|
|
28
28
|
const component = useMemo(() => {
|
|
29
29
|
// 计算单元格的值
|
|
30
|
-
return slotRender(slots[CELL_CUSTOM_OPTION],
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
columnIndex,
|
|
36
|
-
});
|
|
37
|
-
}, [column, columnIndex, record, recordIndex, rowKey, slots]);
|
|
38
|
-
return (_jsx("div", { className: `${classPrefix}-pc-table-option-btn-wrap`, children: component }));
|
|
39
|
-
};
|
|
40
|
-
const GlobalButton = function GlobalButtonDom({ classPrefix, slots, }) {
|
|
30
|
+
return slotRender(slots[CELL_CUSTOM_OPTION], props);
|
|
31
|
+
}, [props, slots]);
|
|
32
|
+
return component;
|
|
33
|
+
});
|
|
34
|
+
const GlobalButton = memo(function GlobalButtonDom({ classPrefix, slots, }) {
|
|
41
35
|
return _jsx("div", { className: `${classPrefix}-global-btn`, children: slotRender(slots) });
|
|
42
|
-
};
|
|
36
|
+
});
|
|
43
37
|
// eslint-disable-next-line complexity
|
|
44
38
|
export const WdTable = forwardRef(function TableComp({ className, style, dataSourceType, bindConnectMetadata = {
|
|
45
39
|
datasource: { id: '', name: '', title: '' },
|
|
@@ -110,7 +104,9 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
110
104
|
const { enumOptions } = useEnumContext();
|
|
111
105
|
const dataSourceAPI = useMemo(() => new DataSource(dbName), [dbName]); // datasource 方法-模型
|
|
112
106
|
// 插槽属性
|
|
113
|
-
const slots =
|
|
107
|
+
const slots = useMemo(() => {
|
|
108
|
+
return getSlots(props);
|
|
109
|
+
}, [props]);
|
|
114
110
|
// table选中key值
|
|
115
111
|
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
116
112
|
// 行点击出参
|
|
@@ -136,7 +132,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
136
132
|
// 过滤权限字段
|
|
137
133
|
const { authFields, fieldsLoading } = useAuthFields(dbName, dbFieldNames, isNewData, isModel, connectorMethod);
|
|
138
134
|
// 视图
|
|
139
|
-
const { viewFieldsData, viewFields } = useViewFields({
|
|
135
|
+
const { viewFieldsData, viewFields, viewLoading } = useViewFields({
|
|
140
136
|
selectedView,
|
|
141
137
|
selectedViewIds,
|
|
142
138
|
dbName,
|
|
@@ -178,7 +174,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
178
174
|
width: 150,
|
|
179
175
|
align: 'left',
|
|
180
176
|
fixed: 'right',
|
|
181
|
-
render: (record, rowKey, recordIndex, column, columnIndex) => (_jsx(
|
|
177
|
+
render: (record, rowKey, recordIndex, column, columnIndex) => (_jsx("div", { className: `${classPrefix}-pc-table-option-btn-wrap`, children: _jsx(TableOption, { slots: slots, record: record, rowKey: rowKey, recordIndex: recordIndex, column: column, columnIndex: columnIndex }) })),
|
|
182
178
|
});
|
|
183
179
|
}
|
|
184
180
|
// 选择列
|
|
@@ -241,6 +237,8 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
241
237
|
isModel,
|
|
242
238
|
isH5,
|
|
243
239
|
isNoDataSourceBind,
|
|
240
|
+
viewFieldsData,
|
|
241
|
+
isViewTable,
|
|
244
242
|
});
|
|
245
243
|
const refreshTable = () => {
|
|
246
244
|
// 清除选中的 key
|
|
@@ -252,7 +250,11 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
252
250
|
setQueryParams((queryParams) => ({ ...queryParams, pageIndex: 1 }));
|
|
253
251
|
}
|
|
254
252
|
};
|
|
255
|
-
const isTableLoading = !isNoDataSourceBind &&
|
|
253
|
+
const isTableLoading = !isNoDataSourceBind &&
|
|
254
|
+
(tableLoading ||
|
|
255
|
+
fieldsLoading ||
|
|
256
|
+
!fields.length ||
|
|
257
|
+
(viewLoading && isViewTable));
|
|
256
258
|
// 表格数据
|
|
257
259
|
const mapTableData = () => {
|
|
258
260
|
if (isMock || (isInIde() && isNoDataSourceBind)) {
|
|
@@ -347,6 +349,10 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
347
349
|
pageSize: query.pageSize,
|
|
348
350
|
selectedRecords: tableRecords.filter((_) => selectedKeys.find((key) => _._id === key)),
|
|
349
351
|
dataSourceType,
|
|
352
|
+
bindMetadata,
|
|
353
|
+
columnSets,
|
|
354
|
+
defaultPageSize,
|
|
355
|
+
defaultPageIndex,
|
|
350
356
|
}),
|
|
351
357
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
352
358
|
[
|
|
@@ -361,6 +367,9 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
361
367
|
query.pageNo,
|
|
362
368
|
query.pageSize,
|
|
363
369
|
dataSourceType,
|
|
370
|
+
bindMetadata,
|
|
371
|
+
defaultPageSize,
|
|
372
|
+
defaultPageIndex,
|
|
364
373
|
]);
|
|
365
374
|
// 表格更改上下文数据
|
|
366
375
|
// 移动端和自定义APIs场景不支持导入功能,监听变化存到表格上下文中
|
|
@@ -419,6 +428,35 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
419
428
|
}, [isH5]);
|
|
420
429
|
const hasFilterButton = !!filterFieldsData.length;
|
|
421
430
|
const recordKey = isInIde() ? undefined : '_id';
|
|
431
|
+
// 行点击事件
|
|
432
|
+
const rowClick = (context) => {
|
|
433
|
+
if (events === null || events === void 0 ? void 0 : events.tabTableRow) {
|
|
434
|
+
events.tabTableRow({
|
|
435
|
+
record: context.record,
|
|
436
|
+
rowKey: context.rowKey,
|
|
437
|
+
recordIndex: context.recordIndex,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
setRowData({
|
|
441
|
+
record: context.record,
|
|
442
|
+
rowKey: context.rowKey,
|
|
443
|
+
recordIndex: context.recordIndex,
|
|
444
|
+
});
|
|
445
|
+
};
|
|
446
|
+
// 选择事件
|
|
447
|
+
const onSelectChange = (keys, context) => {
|
|
448
|
+
setSelectedKeys([].concat(keys));
|
|
449
|
+
if (events === null || events === void 0 ? void 0 : events.rowsSelect) {
|
|
450
|
+
const selectValue = columnSelectType === 'radio'
|
|
451
|
+
? context === null || context === void 0 ? void 0 : context.record
|
|
452
|
+
: context === null || context === void 0 ? void 0 : context.selectedRecords;
|
|
453
|
+
events.rowsSelect(selectValue);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
// 查询参数改变
|
|
457
|
+
const onQueryChange = (query) => {
|
|
458
|
+
setQueryParams({ ...queryParams, ...query });
|
|
459
|
+
};
|
|
422
460
|
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 = []) => {
|
|
423
461
|
if (isObjectEqual(queryParams.searchValues, searchValues)) {
|
|
424
462
|
getNewList();
|
|
@@ -434,32 +472,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
434
472
|
enableTableHeightSizeBtn ||
|
|
435
473
|
hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: refreshTable, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
436
474
|
setOpenMobileFilter(true);
|
|
437
|
-
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(Table, { emptyText: emptyText, isH5: isH5, isNoDataSourceBind: isNoDataSourceBind, className: tableClassList, recordKey: recordKey, currentSize: tableHightSize, defaultPageIndex: defaultPageIndex, defaultPageSize: defaultPageSize, sortColumns: sortColumns, enablePagination: !isH5 && enablePagination, columnSelectType: columnSelectType, columns: columns, setColumns: setColumns, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: (
|
|
438
|
-
setSelectedKeys([].concat(keys));
|
|
439
|
-
if (events === null || events === void 0 ? void 0 : events.rowsSelect) {
|
|
440
|
-
const selectValue = columnSelectType === 'radio'
|
|
441
|
-
? context === null || context === void 0 ? void 0 : context.record
|
|
442
|
-
: context === null || context === void 0 ? void 0 : context.selectedRecords;
|
|
443
|
-
events.rowsSelect(selectValue);
|
|
444
|
-
}
|
|
445
|
-
}, isError: false, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, refreshTable: () => {
|
|
446
|
-
refreshTable();
|
|
447
|
-
}, onQueryChange: (query) => {
|
|
448
|
-
setQueryParams({ ...queryParams, ...query });
|
|
449
|
-
}, rowClick: (context) => {
|
|
450
|
-
if (events === null || events === void 0 ? void 0 : events.tabTableRow) {
|
|
451
|
-
events.tabTableRow({
|
|
452
|
-
record: context.record,
|
|
453
|
-
rowKey: context.rowKey,
|
|
454
|
-
recordIndex: context.recordIndex,
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
setRowData({
|
|
458
|
-
record: context.record,
|
|
459
|
-
rowKey: context.rowKey,
|
|
460
|
-
recordIndex: context.recordIndex,
|
|
461
|
-
});
|
|
462
|
-
} }), 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: () => {
|
|
475
|
+
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(Table, { emptyText: emptyText, isH5: isH5, isNoDataSourceBind: isNoDataSourceBind, className: tableClassList, recordKey: recordKey, currentSize: tableHightSize, defaultPageIndex: defaultPageIndex, defaultPageSize: defaultPageSize, sortColumns: sortColumns, enablePagination: !isH5 && enablePagination, columnSelectType: columnSelectType, columns: columns, setColumns: setColumns, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: onSelectChange, isError: false, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, refreshTable: refreshTable, onQueryChange: onQueryChange, rowClick: rowClick }), 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: () => {
|
|
463
476
|
// 导入成功后刷新页面
|
|
464
477
|
refreshTable();
|
|
465
478
|
} }), _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: {
|
|
@@ -58,8 +58,9 @@ export const useRules = (props) => {
|
|
|
58
58
|
export const useStatus = (props) => {
|
|
59
59
|
const { disabled: _disabled, readOnly: _readOnly, status } = props || {};
|
|
60
60
|
const result = useMemo(() => {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
61
|
+
const rawReadOnly = typeof _readOnly === 'boolean' ? _readOnly : !!_disabled;
|
|
62
|
+
const disabled = status == null ? !!_disabled : status === 'disabled';
|
|
63
|
+
const readOnly = status == null ? rawReadOnly : status === 'readOnly';
|
|
63
64
|
return { disabled, readOnly };
|
|
64
65
|
}, [_disabled, _readOnly, status]);
|
|
65
66
|
return result;
|
package/dist/web/weda-ui.css
CHANGED
|
@@ -301,6 +301,10 @@ body .weda-ui {
|
|
|
301
301
|
.weda-ui.gsd-h5-react-formitem .wedatea2td-textarea-group,
|
|
302
302
|
.weda-ui.gsd-h5-react-formitem .form-select-pc .wedatea2td-dropdown__header {
|
|
303
303
|
font: inherit;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.weda-ui.gsd-h5-react-formitem .wedatea2td-input,
|
|
307
|
+
.weda-ui.gsd-h5-react-formitem .form-select-pc .wedatea2td-dropdown__header {
|
|
304
308
|
height: var(--wd-form-item-height-md);
|
|
305
309
|
}
|
|
306
310
|
|