@cloudbase/weda-ui 3.4.11 → 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/common/form-input-required.js +3 -3
- package/dist/configs/components/customer-service.js +3 -0
- package/dist/configs/components/dataView.js +20 -10
- package/dist/configs/components/form-checkbox.js +15 -2
- 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-email.js +17 -2
- package/dist/configs/components/form-input.js +17 -2
- package/dist/configs/components/form-location.js +1 -1
- package/dist/configs/components/form-multi-region.js +1 -1
- package/dist/configs/components/form-phone.js +17 -2
- package/dist/configs/components/form-radio.js +15 -2
- package/dist/configs/components/form-rich-text.js +1 -1
- package/dist/configs/components/form-select-multiple.js +362 -0
- package/dist/configs/components/form-select.js +1 -1
- package/dist/configs/components/form-switch.js +16 -3
- package/dist/configs/components/form-text-area.js +15 -2
- package/dist/configs/components/form-time.js +1 -1
- package/dist/configs/components/form-url.js +17 -2
- package/dist/configs/components/form-user-tree-select.js +14 -1
- package/dist/configs/components/listView.js +32 -49
- package/dist/configs/components/table.json +1 -54
- package/dist/configs/components/wd-bubble.js +46 -8
- package/dist/configs/components/wd-button.js +3 -0
- package/dist/configs/components/wd-checkbox.js +464 -0
- package/dist/configs/components/wd-form.js +66 -10
- package/dist/configs/components/wd-input-email.js +37 -0
- package/dist/configs/components/wd-input-phone.js +43 -0
- package/dist/configs/components/wd-input-url.js +37 -0
- package/dist/configs/components/wd-input.js +94 -0
- package/dist/configs/components/wd-official-account.js +87 -0
- package/dist/configs/components/wd-radio.js +443 -0
- package/dist/configs/components/wd-switch.js +315 -0
- package/dist/configs/components/wd-table.js +11 -59
- package/dist/configs/components/wd-textarea.js +82 -0
- package/dist/configs/components/wd-tree.js +443 -0
- package/dist/configs/components/web-view.js +3 -0
- package/dist/configs/index.js +24 -1
- package/dist/configs/type-utils/type-form.js +681 -0
- package/dist/docs/common/components/json-schema-view.js +1 -1
- package/dist/docs/common/components/methods-view.js +1 -1
- package/dist/docs/common/components/properties-view.js +3 -1
- package/dist/docs/common/format.js +7 -7
- package/dist/docs/common/tableView.js +3 -1
- package/dist/enum/index.js +196 -0
- package/dist/style/index.scss +1 -1
- package/dist/web/actions/showMessage/index.js +4 -1
- package/dist/web/components/carousel/index.js +1 -1
- package/dist/web/components/customer-service/customer-service.js +19 -2
- package/dist/web/components/dataView/index.js +16 -3
- package/dist/web/components/flow/common/hooks/useCommonFlowData/flow-get.js +5 -1
- package/dist/web/components/flow/common/request.js +5 -5
- package/dist/web/components/flow/modules/operations/controls-items/flow-task-info-modal.js +90 -0
- package/dist/web/components/form/formcell/index.css +13 -1
- package/dist/web/components/form/formcell/index.js +1 -1
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +1 -1
- package/dist/web/components/form/select/dropdown-select/index.js +9 -3
- package/dist/web/components/form/select/h5.js +18 -8
- package/dist/web/components/form/select/index.js +9 -10
- package/dist/web/components/form/select/region/index.js +1 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/h5.js +111 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/index.css +270 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/index.js +206 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/pc.js +115 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/ui.js +113 -0
- package/dist/web/components/form/selectMultiple/h5.js +40 -0
- package/dist/web/components/form/selectMultiple/index.js +94 -0
- package/dist/web/components/form/selectMultiple/request.js +76 -0
- package/dist/web/components/form/selectMultiple/status/allEmpty.js +5 -0
- package/dist/web/components/form/selectMultiple/status/empty.js +19 -0
- package/dist/web/components/form/selectMultiple/status/index.css +63 -0
- package/dist/web/components/form/selectMultiple/status/index.js +7 -0
- package/dist/web/components/form/selectMultiple/status/loading.js +19 -0
- package/dist/web/components/form/selectMultiple/status/propsType.js +1 -0
- package/dist/web/components/form/selectMultiple/status/retry.js +19 -0
- package/dist/web/components/form/tips/index.css +9 -3
- package/dist/web/components/form/uploader/index.css +10 -0
- package/dist/web/components/form/uploader/uploader.h5.js +60 -62
- package/dist/web/components/form/uploader/uploader.pc.js +48 -41
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +8 -33
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +8 -37
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +76 -50
- package/dist/web/components/form/userOrgSelect/common/utils.js +24 -8
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +3 -8
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +14 -18
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +20 -14
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +1 -1
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +21 -9
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +76 -15
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +2 -7
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +6 -4
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +8 -2
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +25 -51
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +10 -6
- package/dist/web/components/form-input-hooks/index.js +41 -15
- package/dist/web/components/form-select-multiple/index.js +26 -0
- package/dist/web/components/form-upload-file/index.js +0 -1
- package/dist/web/components/form-user-tree-select/index.js +2 -2
- package/dist/web/components/formdetail/index.css +31 -1
- package/dist/web/components/formdetail/index.js +33 -1
- package/dist/web/components/index.js +27 -11
- package/dist/web/components/listView/index.js +20 -5
- 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/phone/index.js +26 -1
- package/dist/web/components/phoneCode/index.js +3 -1
- package/dist/web/components/richText/index.css +70 -67
- package/dist/web/components/richText/index.js +311 -251
- package/dist/web/components/richText/richtext.module.css +1 -0
- package/dist/web/components/richTextView/index.css +39 -0
- package/dist/web/components/richTextView/index.js +1 -1
- package/dist/web/components/share/index.js +26 -1
- package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +1 -1
- package/dist/web/components/wd-checkbox/checkbox.js +34 -0
- package/dist/web/components/wd-checkbox/index.js +3 -0
- package/dist/web/components/wd-checkbox-list/checkboxList.js +140 -0
- package/dist/web/components/wd-checkbox-list/index.js +3 -0
- package/dist/web/components/wd-form/hooks/use-remote-value.js +9 -2
- package/dist/web/components/wd-form/index.js +69 -34
- package/dist/web/components/wd-form/wd-form.js +42 -0
- package/dist/web/components/wd-form-cell/index.js +3 -0
- package/dist/web/components/wd-form-cell/wd-form-cell.js +42 -0
- package/dist/web/components/wd-form-item/index.js +4 -0
- package/dist/web/components/wd-form-item/wd-form-item.js +55 -0
- package/dist/web/components/wd-form-item/wd-input-group.js +24 -0
- package/dist/web/components/wd-icon/wd-icon.js +10 -2
- package/dist/web/components/wd-input/index.js +3 -0
- package/dist/web/components/wd-input/wd-input.js +155 -0
- package/dist/web/components/wd-input-email/index.js +3 -0
- package/dist/web/components/wd-input-email/wd-input-email.js +13 -0
- package/dist/web/components/wd-input-group/index.js +3 -0
- package/dist/web/components/wd-input-group/wd-input-group.js +10 -0
- package/dist/web/components/wd-input-phone/index.js +3 -0
- package/dist/web/components/wd-input-phone/wd-input-phone.js +14 -0
- package/dist/web/components/wd-input-url/index.js +3 -0
- package/dist/web/components/wd-input-url/wd-input-url.js +13 -0
- package/dist/web/components/wd-input-wrap/index.js +3 -0
- package/dist/web/components/wd-input-wrap/wd-input-wrap.js +18 -0
- package/dist/web/components/wd-official-account/index.css +29 -0
- package/dist/web/components/wd-official-account/index.js +36 -0
- package/dist/web/components/wd-radio/index.js +3 -0
- package/dist/web/components/wd-radio/wd-radio.js +30 -0
- package/dist/web/components/wd-radio-list/index.js +3 -0
- package/dist/web/components/wd-radio-list/wd-radio-list.js +104 -0
- package/dist/web/components/wd-switch/index.js +3 -0
- package/dist/web/components/wd-switch/wd-switch.js +52 -0
- package/dist/web/components/wd-table/components/FieldRender/index.js +5 -4
- package/dist/web/components/wd-table/components/FilterFieldsPanel/FilterFieldItem.js +4 -0
- package/dist/web/components/wd-table/components/Table/index.js +40 -9
- package/dist/web/components/wd-table/hooks/useQueryParams.js +4 -1
- 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/utils/index.js +6 -2
- package/dist/web/components/wd-table/wd-table.js +125 -99
- package/dist/web/components/wd-textarea/index.js +3 -0
- package/dist/web/components/wd-textarea/wd-textarea.js +78 -0
- package/dist/web/components/wd-tree/index.js +3 -0
- package/dist/web/components/wd-tree/utils.js +291 -0
- package/dist/web/components/wd-tree/wd-tree.js +193 -0
- package/dist/web/utils/constant.js +16 -0
- package/dist/web/utils/datasource.js +2 -2
- package/dist/web/utils/date.js +3 -3
- package/dist/web/utils/hooks/useFormLegacy.js +112 -0
- package/dist/web/utils/tool.js +12 -2
- package/dist/web/weda-ui.css +197 -3
- package/package.json +6 -5
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import classNames from '../../utils/classnames';
|
|
4
|
+
import { useConfig } from '../../utils/config-context';
|
|
5
|
+
import { usePlatform } from '../../utils/platform';
|
|
6
|
+
import { WdFormItem } from '../wd-form-item';
|
|
7
|
+
import getLocalCounter from '../../utils/getLocalCounter';
|
|
8
|
+
import { useSyncValue } from '../../utils/hooks/useSyncValue';
|
|
9
|
+
import { emptyObject } from '../../utils/constant';
|
|
10
|
+
import { useFormInputTrait } from '../form-input-hooks';
|
|
11
|
+
import { useSize } from '../../utils/hooks/useFormLegacy';
|
|
12
|
+
export const WdSwitch = React.forwardRef(function FormSwitch(props, inputRef) {
|
|
13
|
+
const {
|
|
14
|
+
// 系统属性
|
|
15
|
+
name, label, events = emptyObject, } = props;
|
|
16
|
+
const size = useSize(props);
|
|
17
|
+
const [innerHandle, setInnerHandle] = React.useState({}); // hook里挂出的属性
|
|
18
|
+
/** 兼容从 Form 获取属性,必须引入,自动挂载组件方法 */
|
|
19
|
+
const traitProps = { ...props, inputRef, setInnerHandle };
|
|
20
|
+
const { value: defaultChecked, onChange: outerOnChange, disabled, readOnly, validateErrorMsg, validateState, visible, value, required, layout, } = useFormInputTrait(traitProps);
|
|
21
|
+
const [checked, setChecked] = useSyncValue(defaultChecked);
|
|
22
|
+
const { classPrefix } = useConfig();
|
|
23
|
+
const platform = usePlatform();
|
|
24
|
+
// 现在低码组件往源码组件传入的id不唯一, 暂时使用hashcode替代
|
|
25
|
+
const hashcode = getLocalCounter();
|
|
26
|
+
const _id = `switch-${hashcode}`;
|
|
27
|
+
const switchCls = classNames({
|
|
28
|
+
'is-checked': checked,
|
|
29
|
+
'is-disabled': disabled || readOnly,
|
|
30
|
+
'size-sm': !['h5'].includes(platform) && ['sm'].includes(size),
|
|
31
|
+
'size-md': !['h5'].includes(platform) && ['md'].includes(size),
|
|
32
|
+
'size-lg': ['h5'].includes(platform) || ['lg'].includes(size),
|
|
33
|
+
});
|
|
34
|
+
React.useImperativeHandle(inputRef, () => ({
|
|
35
|
+
...innerHandle,
|
|
36
|
+
name,
|
|
37
|
+
value,
|
|
38
|
+
label,
|
|
39
|
+
required,
|
|
40
|
+
visible,
|
|
41
|
+
disabled,
|
|
42
|
+
readOnly,
|
|
43
|
+
}), [innerHandle, name, value, label, required, visible, disabled, readOnly]);
|
|
44
|
+
const onChange = (ev) => {
|
|
45
|
+
var _a;
|
|
46
|
+
const value = ev.target.checked;
|
|
47
|
+
setChecked(value);
|
|
48
|
+
outerOnChange === null || outerOnChange === void 0 ? void 0 : outerOnChange(value);
|
|
49
|
+
(_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value }, { orgianalEvent: ev });
|
|
50
|
+
};
|
|
51
|
+
return (visible && (_jsx(WdFormItem, { ...props, testId: "form-switch", validateErrorMsg: validateErrorMsg, validateState: validateState, readValue: defaultChecked, classRoot: 'switch', disabled: disabled, layout: layout, children: _jsxs("label", { className: `${classPrefix}-switch ${switchCls}`, htmlFor: _id, children: [_jsx("input", { id: _id, name: name, className: `${classPrefix}-switch__input `, type: "checkbox", checked: checked, disabled: disabled || readOnly, onChange: onChange }), _jsx("div", { className: `${classPrefix}-switch__box` })] }, _id) })));
|
|
52
|
+
});
|
|
@@ -16,6 +16,7 @@ import { QuoteModal } from './QuoteModal';
|
|
|
16
16
|
import { TABLE_SLOT_PREFIX } from '../../../../utils/constant';
|
|
17
17
|
import { getPrimaryField } from '../../../../utils/datasource';
|
|
18
18
|
import { useConfig } from '../../../../utils/config-context';
|
|
19
|
+
import { EnumHoc } from '../../../../utils/hooks/EnumHoc';
|
|
19
20
|
import { ImagePreview } from './ImagePreview';
|
|
20
21
|
const MODAL_SIZE = 'auto';
|
|
21
22
|
// 文字提示框包裹组件
|
|
@@ -208,10 +209,10 @@ export const DataItemView = ({ fields, modelType, value }) => {
|
|
|
208
209
|
* object,展示表格组件
|
|
209
210
|
*/
|
|
210
211
|
export const DataTableView = ({ fields, value }) => {
|
|
212
|
+
var _a;
|
|
211
213
|
const { classPrefix } = useConfig();
|
|
214
|
+
const rawFields = (_a = Object === null || Object === void 0 ? void 0 : Object.entries(fields.properties)) === null || _a === void 0 ? void 0 : _a.map(([name, field]) => Object.assign({}, field, { name }));
|
|
212
215
|
const columns = useMemo(() => {
|
|
213
|
-
var _a;
|
|
214
|
-
const rawFields = (_a = Object === null || Object === void 0 ? void 0 : Object.entries(fields.properties)) === null || _a === void 0 ? void 0 : _a.map(([name, field]) => Object.assign({}, field, { name }));
|
|
215
216
|
const rawFieldsSort = rawFields.sort((a, b) => a['x-index'] - b['x-index']);
|
|
216
217
|
const baseColumns = getColumns({
|
|
217
218
|
columnSets: [],
|
|
@@ -219,8 +220,8 @@ export const DataTableView = ({ fields, value }) => {
|
|
|
219
220
|
isH5: false,
|
|
220
221
|
});
|
|
221
222
|
return baseColumns;
|
|
222
|
-
}, [
|
|
223
|
-
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(Table, { className: `${classPrefix}-table-wrap`, bordered: "all", recordKey: "_id", records: [].concat(value), columns: columns }) }));
|
|
223
|
+
}, [rawFields]);
|
|
224
|
+
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(EnumHoc, { fields: rawFields, children: _jsx(Table, { className: `${classPrefix}-table-wrap`, bordered: "all", recordKey: "_id", records: [].concat(value), columns: columns }) }) }));
|
|
224
225
|
};
|
|
225
226
|
/**
|
|
226
227
|
* array类型,展示组件
|
|
@@ -40,6 +40,10 @@ export const FilterFieldItem = ({ updateFilterData, ...filterFieldItemConfig })
|
|
|
40
40
|
const { filterType, isRange, label, options, fieldCalculation, value } = filterFieldItemConfig;
|
|
41
41
|
const updateFilterConfig = (value) => {
|
|
42
42
|
const lastFilterConfig = { ...filterFieldItemConfig, ...value };
|
|
43
|
+
// 选择为空不为空,则清空数据
|
|
44
|
+
if (['$empty', '$nempty'].includes(lastFilterConfig === null || lastFilterConfig === void 0 ? void 0 : lastFilterConfig.fieldCalculation.value)) {
|
|
45
|
+
lastFilterConfig.value = '';
|
|
46
|
+
}
|
|
43
47
|
updateFilterData(lastFilterConfig);
|
|
44
48
|
};
|
|
45
49
|
useEffect(() => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint max-lines: [error, 350] */
|
|
2
3
|
import React, { useRef, useEffect } from 'react';
|
|
3
4
|
import { Icon, Table, StatusTip, ConfigProvider } from 'tea-component';
|
|
4
5
|
import { useResizeObserver } from '@react-hookz/web';
|
|
5
6
|
import { useConfig } from '../../../../utils/config-context';
|
|
6
7
|
import { isInIde } from '../../../../utils/platform';
|
|
7
|
-
const { sortable, radioable, selectable, injectable, pageable, autotip, scrollable, } = Table.addons;
|
|
8
|
+
const { sortable, radioable, selectable, injectable, pageable, autotip, scrollable, columnsResizable, } = Table.addons;
|
|
8
9
|
import StatusContent from '../../../statusContent';
|
|
9
10
|
import classNames from '../../../../utils/classnames';
|
|
10
11
|
import { setTableHeaderStyle } from './util';
|
|
@@ -15,8 +16,18 @@ const miniPageSize = 10;
|
|
|
15
16
|
// h5 端表格高度
|
|
16
17
|
const tableHeight = { sm: 500, md: 580, lg: 880 };
|
|
17
18
|
const tableHeaderHeight = 51;
|
|
19
|
+
const renderStatus = ({ isH5, status, classPrefix, refreshTable, isNoDataSourceBind, _emptyText, }) => {
|
|
20
|
+
const text = {
|
|
21
|
+
loading: '数据加载中,请稍候...',
|
|
22
|
+
error: (_jsxs("p", { children: ["\u6570\u636E\u52A0\u8F7D\u5931\u8D25,", _jsx("span", { className: `${classPrefix}-empty-retry-text`, onClick: () => {
|
|
23
|
+
refreshTable();
|
|
24
|
+
}, children: "\u8BF7\u91CD\u8BD5" })] })),
|
|
25
|
+
empty: isNoDataSourceBind ? '请绑定数据源' : _emptyText,
|
|
26
|
+
};
|
|
27
|
+
return (_jsx(StatusContent, { emptyText: text[`${status}`], component: "table", icon: status, isH5: isH5 }));
|
|
28
|
+
};
|
|
18
29
|
// eslint-disable-next-line complexity
|
|
19
|
-
export const BaseTableCom = ({ recordKey, className, columns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, isLoading, queryParams, total = defaultTotal, refreshTable, onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, }) => {
|
|
30
|
+
export const BaseTableCom = ({ recordKey, className, columns, setColumns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, isLoading, queryParams, total = defaultTotal, refreshTable, onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, }) => {
|
|
20
31
|
var _a;
|
|
21
32
|
const tableRef = useRef(null);
|
|
22
33
|
const { classPrefix } = useConfig();
|
|
@@ -25,8 +36,11 @@ export const BaseTableCom = ({ recordKey, className, columns, records, sortColum
|
|
|
25
36
|
? (queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex) === pageIndexSpan && isLoading
|
|
26
37
|
: isLoading;
|
|
27
38
|
// table状态样式
|
|
39
|
+
const showStatus = isShowLoading || isError || !(records === null || records === void 0 ? void 0 : records.length);
|
|
28
40
|
const classes = {
|
|
29
|
-
[`${classPrefix}-table
|
|
41
|
+
[`${classPrefix}-table-scroll-wrap`]: true,
|
|
42
|
+
[`${classPrefix}-table--status`]: showStatus,
|
|
43
|
+
[`${classPrefix}-table--without-pagination`]: !enablePagination,
|
|
30
44
|
};
|
|
31
45
|
// table 插件
|
|
32
46
|
const tableAddons = [
|
|
@@ -48,11 +62,9 @@ export const BaseTableCom = ({ recordKey, className, columns, records, sortColum
|
|
|
48
62
|
autotip({
|
|
49
63
|
isLoading: isShowLoading,
|
|
50
64
|
isError,
|
|
51
|
-
loadingText:
|
|
52
|
-
emptyText:
|
|
53
|
-
errorText:
|
|
54
|
-
refreshTable();
|
|
55
|
-
}, children: "\u8BF7\u91CD\u8BD5" })] }), component: "table", icon: "error", isH5: isH5 })),
|
|
65
|
+
loadingText: null,
|
|
66
|
+
emptyText: null,
|
|
67
|
+
errorText: null,
|
|
56
68
|
}),
|
|
57
69
|
// 行背景色
|
|
58
70
|
injectable({
|
|
@@ -71,6 +83,16 @@ export const BaseTableCom = ({ recordKey, className, columns, records, sortColum
|
|
|
71
83
|
}),
|
|
72
84
|
}),
|
|
73
85
|
];
|
|
86
|
+
// 仅运行态可编辑
|
|
87
|
+
if (!isInIde()) {
|
|
88
|
+
tableAddons.push(columnsResizable({
|
|
89
|
+
onResizeEnd: (columns) => {
|
|
90
|
+
setColumns(columns);
|
|
91
|
+
},
|
|
92
|
+
minWidth: 92,
|
|
93
|
+
maxWidth: 1000,
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
74
96
|
// 支撑分页的最大高度
|
|
75
97
|
const tableDomHeight = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
76
98
|
// 支持表格滚动,高度超过 500 开始显示滚动条
|
|
@@ -167,6 +189,15 @@ export const BaseTableCom = ({ recordKey, className, columns, records, sortColum
|
|
|
167
189
|
}
|
|
168
190
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
169
191
|
}, [queryParams.pageIndex, currentSize, isLoading, isH5, total]);
|
|
170
|
-
|
|
192
|
+
const status = isShowLoading ? 'loading' : isError ? 'error' : 'empty';
|
|
193
|
+
return (_jsxs("div", { className: classNames(className, classes), children: [_jsx(Table, { ref: tableRef, className: className, bordered: true, recordKey: recordKey, columns: columns, records: records, addons: tableAddons, bottomTip: bottomTipCompRender() }), showStatus &&
|
|
194
|
+
renderStatus({
|
|
195
|
+
isH5,
|
|
196
|
+
status,
|
|
197
|
+
classPrefix,
|
|
198
|
+
refreshTable,
|
|
199
|
+
isNoDataSourceBind,
|
|
200
|
+
_emptyText,
|
|
201
|
+
})] }));
|
|
171
202
|
};
|
|
172
203
|
export const BaseTable = React.memo(BaseTableCom);
|
|
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import { getQueryParams } from '../utils';
|
|
3
3
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
4
4
|
// const defaultCount = 1;
|
|
5
|
-
export const useQueryParams = ({ queryParams, wList, viewFieldsData, connectorParams, isModel, isViewTable, events, }) => {
|
|
5
|
+
export const useQueryParams = ({ queryParams, wList, viewFieldsData, connectorParams, isModel, isViewTable, events, columns, }) => {
|
|
6
6
|
const queryRef = useRef({});
|
|
7
7
|
const [query, setQuery] = useState(() => {
|
|
8
8
|
return getQueryParams({
|
|
@@ -12,6 +12,7 @@ export const useQueryParams = ({ queryParams, wList, viewFieldsData, connectorPa
|
|
|
12
12
|
connectorParams,
|
|
13
13
|
isModel,
|
|
14
14
|
isViewTable,
|
|
15
|
+
columns,
|
|
15
16
|
});
|
|
16
17
|
});
|
|
17
18
|
useEffect(() => {
|
|
@@ -23,6 +24,7 @@ export const useQueryParams = ({ queryParams, wList, viewFieldsData, connectorPa
|
|
|
23
24
|
connectorParams,
|
|
24
25
|
isModel,
|
|
25
26
|
isViewTable,
|
|
27
|
+
columns,
|
|
26
28
|
});
|
|
27
29
|
if (!isObjectEqual(queryRef.current, query)) {
|
|
28
30
|
queryRef.current = query;
|
|
@@ -36,6 +38,7 @@ export const useQueryParams = ({ queryParams, wList, viewFieldsData, connectorPa
|
|
|
36
38
|
queryParams,
|
|
37
39
|
viewFieldsData,
|
|
38
40
|
wList,
|
|
41
|
+
columns,
|
|
39
42
|
]);
|
|
40
43
|
return { query };
|
|
41
44
|
};
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { useEffect, useCallback, useState } from 'react';
|
|
2
2
|
const defaultPageNo = 1;
|
|
3
|
-
export const useTableData = ({ dataSourceAPI, connectorMethod, query, events, isModel, dbName, isH5, isNoDataSourceBind, }) => {
|
|
3
|
+
export const useTableData = ({ dataSourceAPI, connectorMethod, query, events, isModel, dbName, isH5, isNoDataSourceBind, viewFieldsData, isViewTable, }) => {
|
|
4
4
|
const [total, setTotal] = useState(0);
|
|
5
5
|
const [tableLoading, setTableLoading] = useState(true);
|
|
6
6
|
const [tableData, setTableData] = useState([]);
|
|
7
7
|
const fetch = useCallback(async () => {
|
|
8
|
+
var _a;
|
|
8
9
|
if (isNoDataSourceBind) {
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
12
|
+
// 视图配置请求返回查询参数,配置视图时,等待视图返回成功后再查询,避免多次查询
|
|
13
|
+
if (isModel && isViewTable && !((_a = viewFieldsData === null || viewFieldsData === void 0 ? void 0 : viewFieldsData.viewList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
11
16
|
let data = { records: [], total: 0 };
|
|
12
17
|
setTableLoading(true);
|
|
13
18
|
if (isModel) {
|
|
@@ -15,6 +15,6 @@ export const useViewFields = ({ selectedView, selectedViewIds, dbName, isModel,
|
|
|
15
15
|
},
|
|
16
16
|
viewFields: (data === null || data === void 0 ? void 0 : data.fields) || authFields,
|
|
17
17
|
isError: error,
|
|
18
|
-
|
|
18
|
+
viewLoading: !error && !data,
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -86,8 +86,8 @@ export const whereList = (whereProxy) => {
|
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
// 获取最终的查询参数
|
|
89
|
-
export const getQueryParams = ({ queryParams, wList, viewFieldsData, connectorParams, isModel, isViewTable, }) => {
|
|
90
|
-
var _a, _b;
|
|
89
|
+
export const getQueryParams = ({ queryParams, wList, viewFieldsData, connectorParams, isModel, isViewTable, columns, }) => {
|
|
90
|
+
var _a, _b, _c;
|
|
91
91
|
const _defaultPageSize = 10;
|
|
92
92
|
const _defaultPageIndex = 1;
|
|
93
93
|
const { pageIndex: pageNo, pageSize, sort } = queryParams;
|
|
@@ -125,6 +125,10 @@ export const getQueryParams = ({ queryParams, wList, viewFieldsData, connectorPa
|
|
|
125
125
|
// 运行态主动排序进行覆盖
|
|
126
126
|
if ((sort === null || sort === void 0 ? void 0 : sort.length) && sort[0].order) {
|
|
127
127
|
params.orderBy = sort[0].by;
|
|
128
|
+
// 后端根据业务字段排序
|
|
129
|
+
params.orderBy =
|
|
130
|
+
((_c = columns === null || columns === void 0 ? void 0 : columns.find((i) => params.orderBy === i.slotKey)) === null || _c === void 0 ? void 0 : _c.fieldKey) ||
|
|
131
|
+
params.orderBy;
|
|
128
132
|
params.orderType = sort[0].order;
|
|
129
133
|
}
|
|
130
134
|
const _pageSize = parseInt(`${params.pageSize}`);
|
|
@@ -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
|
// 行点击出参
|
|
@@ -118,8 +114,10 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
118
114
|
// 筛选条件
|
|
119
115
|
const wList = where;
|
|
120
116
|
// 搜索和分页参数
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
let initPageIndex = isModel ? defaultPageIndex : connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.pageNo;
|
|
118
|
+
let initPageSize = isModel ? defaultPageSize : connectorParams === null || connectorParams === void 0 ? void 0 : connectorParams.pageSize;
|
|
119
|
+
initPageIndex = parseInt(initPageIndex);
|
|
120
|
+
initPageSize = parseInt(initPageSize);
|
|
123
121
|
const [queryParams, setQueryParams] = useState({
|
|
124
122
|
pageIndex: initPageIndex,
|
|
125
123
|
pageSize: initPageSize,
|
|
@@ -134,7 +132,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
134
132
|
// 过滤权限字段
|
|
135
133
|
const { authFields, fieldsLoading } = useAuthFields(dbName, dbFieldNames, isNewData, isModel, connectorMethod);
|
|
136
134
|
// 视图
|
|
137
|
-
const { viewFieldsData, viewFields } = useViewFields({
|
|
135
|
+
const { viewFieldsData, viewFields, viewLoading } = useViewFields({
|
|
138
136
|
selectedView,
|
|
139
137
|
selectedViewIds,
|
|
140
138
|
dbName,
|
|
@@ -147,60 +145,11 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
147
145
|
const filterFieldsData = getFilterFields(filterFields, fields);
|
|
148
146
|
// 可排序字段
|
|
149
147
|
const sortColumns = getSortColumns({ fields, columnSets });
|
|
150
|
-
// 查询参数
|
|
151
|
-
const { query } = useQueryParams({
|
|
152
|
-
queryParams,
|
|
153
|
-
wList,
|
|
154
|
-
viewFieldsData,
|
|
155
|
-
connectorParams,
|
|
156
|
-
isModel,
|
|
157
|
-
isViewTable,
|
|
158
|
-
events,
|
|
159
|
-
});
|
|
160
|
-
// 查询数据
|
|
161
|
-
const { tableData, total, tableLoading, getNewList } = useTableData({
|
|
162
|
-
dataSourceAPI,
|
|
163
|
-
dbName,
|
|
164
|
-
connectorMethod,
|
|
165
|
-
query,
|
|
166
|
-
events,
|
|
167
|
-
isModel,
|
|
168
|
-
isH5,
|
|
169
|
-
isNoDataSourceBind,
|
|
170
|
-
});
|
|
171
|
-
const refreshTable = () => {
|
|
172
|
-
// 清除选中的 key
|
|
173
|
-
setSelectedKeys([]);
|
|
174
|
-
if (queryParams.pageIndex === _defaultPageIndex) {
|
|
175
|
-
getNewList();
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
setQueryParams((queryParams) => ({ ...queryParams, pageIndex: 1 }));
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
const isTableLoading = !isNoDataSourceBind && (tableLoading || fieldsLoading || !fields.length);
|
|
182
|
-
// 表格数据
|
|
183
|
-
const mapTableData = () => {
|
|
184
|
-
if (isMock || (isInIde() && isNoDataSourceBind)) {
|
|
185
|
-
return Mock.records;
|
|
186
|
-
}
|
|
187
|
-
// 加载过程中,pc端每次查询置空,h5端仅首页置空
|
|
188
|
-
// 避免编辑器内切换数据源时,column更改,table render还未更新造成渲染问题
|
|
189
|
-
if ((isTableLoading && !isH5) || isNoDataSourceBind) {
|
|
190
|
-
return [];
|
|
191
|
-
}
|
|
192
|
-
if (isTableLoading &&
|
|
193
|
-
isH5 &&
|
|
194
|
-
(queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex) === _defaultPageIndex) {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
|
-
if (viewFieldsData === null || viewFieldsData === void 0 ? void 0 : viewFieldsData.selectedViewId) {
|
|
198
|
-
mapTableDataWithView(viewFieldsData, tableData);
|
|
199
|
-
}
|
|
200
|
-
return tableData;
|
|
201
|
-
};
|
|
202
|
-
const tableRecords = mapTableData();
|
|
203
148
|
// 表格 columns
|
|
149
|
+
const [resizeColumns, setColumns] = useState([]);
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
setColumns([]);
|
|
152
|
+
}, [columnSets]);
|
|
204
153
|
const columns = useMemo(() => {
|
|
205
154
|
if (isMock || (isInIde() && isNoDataSourceBind)) {
|
|
206
155
|
return Mock.columns;
|
|
@@ -208,7 +157,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
208
157
|
if (fieldsLoading || isNoDataSourceBind) {
|
|
209
158
|
return [];
|
|
210
159
|
}
|
|
211
|
-
|
|
160
|
+
let baseColumns = getTableColumns({
|
|
212
161
|
fields,
|
|
213
162
|
columnSets,
|
|
214
163
|
slots,
|
|
@@ -225,7 +174,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
225
174
|
width: 150,
|
|
226
175
|
align: 'left',
|
|
227
176
|
fixed: 'right',
|
|
228
|
-
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 }) })),
|
|
229
178
|
});
|
|
230
179
|
}
|
|
231
180
|
// 选择列
|
|
@@ -246,6 +195,11 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
246
195
|
fixed: 'left',
|
|
247
196
|
});
|
|
248
197
|
}
|
|
198
|
+
baseColumns = baseColumns.map((i) => {
|
|
199
|
+
var _a;
|
|
200
|
+
const width = (_a = resizeColumns === null || resizeColumns === void 0 ? void 0 : resizeColumns.find((j) => i.key === j.key)) === null || _a === void 0 ? void 0 : _a.width;
|
|
201
|
+
return width ? { ...i, width } : i;
|
|
202
|
+
});
|
|
249
203
|
return baseColumns;
|
|
250
204
|
}, [
|
|
251
205
|
isMock,
|
|
@@ -260,7 +214,68 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
260
214
|
enableCellCustomOption,
|
|
261
215
|
columnSelectType,
|
|
262
216
|
classPrefix,
|
|
217
|
+
resizeColumns,
|
|
263
218
|
]);
|
|
219
|
+
// 查询参数
|
|
220
|
+
const { query } = useQueryParams({
|
|
221
|
+
queryParams,
|
|
222
|
+
wList,
|
|
223
|
+
viewFieldsData,
|
|
224
|
+
connectorParams,
|
|
225
|
+
isModel,
|
|
226
|
+
isViewTable,
|
|
227
|
+
events,
|
|
228
|
+
columns,
|
|
229
|
+
});
|
|
230
|
+
// 查询数据
|
|
231
|
+
const { tableData, total, tableLoading, getNewList } = useTableData({
|
|
232
|
+
dataSourceAPI,
|
|
233
|
+
dbName,
|
|
234
|
+
connectorMethod,
|
|
235
|
+
query,
|
|
236
|
+
events,
|
|
237
|
+
isModel,
|
|
238
|
+
isH5,
|
|
239
|
+
isNoDataSourceBind,
|
|
240
|
+
viewFieldsData,
|
|
241
|
+
isViewTable,
|
|
242
|
+
});
|
|
243
|
+
const refreshTable = () => {
|
|
244
|
+
// 清除选中的 key
|
|
245
|
+
setSelectedKeys([]);
|
|
246
|
+
if (queryParams.pageIndex === _defaultPageIndex) {
|
|
247
|
+
getNewList();
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
setQueryParams((queryParams) => ({ ...queryParams, pageIndex: 1 }));
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
const isTableLoading = !isNoDataSourceBind &&
|
|
254
|
+
(tableLoading ||
|
|
255
|
+
fieldsLoading ||
|
|
256
|
+
!fields.length ||
|
|
257
|
+
(viewLoading && isViewTable));
|
|
258
|
+
// 表格数据
|
|
259
|
+
const mapTableData = () => {
|
|
260
|
+
if (isMock || (isInIde() && isNoDataSourceBind)) {
|
|
261
|
+
return Mock.records;
|
|
262
|
+
}
|
|
263
|
+
// 加载过程中,pc端每次查询置空,h5端仅首页置空
|
|
264
|
+
// 避免编辑器内切换数据源时,column更改,table render还未更新造成渲染问题
|
|
265
|
+
if ((isTableLoading && !isH5) || isNoDataSourceBind) {
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
if (isTableLoading &&
|
|
269
|
+
isH5 &&
|
|
270
|
+
(queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex) === _defaultPageIndex) {
|
|
271
|
+
return [];
|
|
272
|
+
}
|
|
273
|
+
if (viewFieldsData === null || viewFieldsData === void 0 ? void 0 : viewFieldsData.selectedViewId) {
|
|
274
|
+
mapTableDataWithView(viewFieldsData, tableData);
|
|
275
|
+
}
|
|
276
|
+
return tableData;
|
|
277
|
+
};
|
|
278
|
+
const tableRecords = mapTableData();
|
|
264
279
|
// 总数
|
|
265
280
|
const beforeModalDestroy = () => {
|
|
266
281
|
// 重新加载数据
|
|
@@ -334,6 +349,10 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
334
349
|
pageSize: query.pageSize,
|
|
335
350
|
selectedRecords: tableRecords.filter((_) => selectedKeys.find((key) => _._id === key)),
|
|
336
351
|
dataSourceType,
|
|
352
|
+
bindMetadata,
|
|
353
|
+
columnSets,
|
|
354
|
+
defaultPageSize,
|
|
355
|
+
defaultPageIndex,
|
|
337
356
|
}),
|
|
338
357
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
339
358
|
[
|
|
@@ -348,6 +367,9 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
348
367
|
query.pageNo,
|
|
349
368
|
query.pageSize,
|
|
350
369
|
dataSourceType,
|
|
370
|
+
bindMetadata,
|
|
371
|
+
defaultPageSize,
|
|
372
|
+
defaultPageIndex,
|
|
351
373
|
]);
|
|
352
374
|
// 表格更改上下文数据
|
|
353
375
|
// 移动端和自定义APIs场景不支持导入功能,监听变化存到表格上下文中
|
|
@@ -406,6 +428,35 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
406
428
|
}, [isH5]);
|
|
407
429
|
const hasFilterButton = !!filterFieldsData.length;
|
|
408
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
|
+
};
|
|
409
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 = []) => {
|
|
410
461
|
if (isObjectEqual(queryParams.searchValues, searchValues)) {
|
|
411
462
|
getNewList();
|
|
@@ -421,32 +472,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
421
472
|
enableTableHeightSizeBtn ||
|
|
422
473
|
hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: refreshTable, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
423
474
|
setOpenMobileFilter(true);
|
|
424
|
-
}, 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, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: (
|
|
425
|
-
setSelectedKeys([].concat(keys));
|
|
426
|
-
if (events === null || events === void 0 ? void 0 : events.rowsSelect) {
|
|
427
|
-
const selectValue = columnSelectType === 'radio'
|
|
428
|
-
? context === null || context === void 0 ? void 0 : context.record
|
|
429
|
-
: context === null || context === void 0 ? void 0 : context.selectedRecords;
|
|
430
|
-
events.rowsSelect(selectValue);
|
|
431
|
-
}
|
|
432
|
-
}, isError: false, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, refreshTable: () => {
|
|
433
|
-
refreshTable();
|
|
434
|
-
}, onQueryChange: (query) => {
|
|
435
|
-
setQueryParams({ ...queryParams, ...query });
|
|
436
|
-
}, rowClick: (context) => {
|
|
437
|
-
if (events === null || events === void 0 ? void 0 : events.tabTableRow) {
|
|
438
|
-
events.tabTableRow({
|
|
439
|
-
record: context.record,
|
|
440
|
-
rowKey: context.rowKey,
|
|
441
|
-
recordIndex: context.recordIndex,
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
setRowData({
|
|
445
|
-
record: context.record,
|
|
446
|
-
rowKey: context.rowKey,
|
|
447
|
-
recordIndex: context.recordIndex,
|
|
448
|
-
});
|
|
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: () => {
|
|
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: () => {
|
|
450
476
|
// 导入成功后刷新页面
|
|
451
477
|
refreshTable();
|
|
452
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: {
|