@cloudbase/weda-ui 3.24.0 → 3.24.1
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/wd-button.js +2 -1
- package/dist/style/weda-ui.min.css +1 -1
- package/dist/web/components/table/ExportFileModalByApi/index.js +24 -13
- package/dist/web/components/wd-form/hoc/form-container-decorator.js +8 -3
- package/dist/web/components/wd-form/hooks/use-remote-value.js +0 -1
- package/dist/web/components/wd-table/components/FieldRender/index.js +1 -0
- package/dist/web/components/wd-table/components/FilterFieldsPanel/index.js +2 -2
- package/dist/web/components/wd-table/components/Table/index.d.ts +1 -2
- package/dist/web/components/wd-table/components/Table/index.js +26 -13
- package/dist/web/components/wd-table/components/index.d.ts +2 -1
- package/dist/web/components/wd-table/components/index.js +1 -1
- package/dist/web/components/wd-table/hooks/useTableData.js +15 -6
- package/dist/web/components/wd-table/table-with-form.d.ts +9 -0
- package/dist/web/components/wd-table/table-with-form.js +32 -0
- package/dist/web/components/wd-table/wd-table.d.ts +19 -4
- package/dist/web/components/wd-table/wd-table.js +10 -29
- package/package.json +1 -1
|
@@ -187,7 +187,8 @@ const data = Type.Object({
|
|
|
187
187
|
'x-runtime-default': 'button',
|
|
188
188
|
'x-index': 130,
|
|
189
189
|
enum: Tuple(WD_BUTTON_TYPE),
|
|
190
|
-
|
|
190
|
+
'x-helper-text': ' 按钮: 适用于常见的按钮点击使用场景;重置、提交: 需配合表单容器组件使用,不触发点击事件',
|
|
191
|
+
description: ' 按钮: 适用于常见的按钮点击使用场景,可在事件配置区中对按钮组件配置点击事件并触发相应的执行动作;重置: 需配合表单容器组件使用,将按钮放置在表单容器中,点击后即可重置表单容器中表单组件的输入信息;提交:需配合表单容器组件使用,将按钮放置在表单容器中,点击后即可对表单容器中的数据进行提交',
|
|
191
192
|
'x-category': '高级属性',
|
|
192
193
|
'x-linkages': [
|
|
193
194
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
@cloudbase/weda-ui v3.24.
|
|
2
|
+
@cloudbase/weda-ui v3.24.1
|
|
3
3
|
*/
|
|
4
4
|
@charset "UTF-8";@media (min-width:1024px){.weda-ui .weui-cells{font-size:1em}.weui .weui-cell_active:active{background-color:unset!important}}@font-face{font-family:lcap-icon;font-weight:400;font-style:normal;src:url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAkMAA0AAAAAFZgAAAi1AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4GYACCXhEICpxYlmoLTgABNgIkA1gEIAWDMweDBRtzEVGUTVKf7GdCpjLGY/HIYGvbDpn6q7Qdj3xvUaZJUNFads3M7geYVSSiCgsZJYFkhEfn2DjU9//jpn8D1QTqVBQqSrtAVZAq1bwkpTOo0Hbz2tnYfkP3ZzAxpv6ZiSFf3OHh8/b+/oqzxIt4QmFX5ImmIe0SWAOEOJL2n9ZSO5PcCwErnTjzLxOYud0Az24IS8AOXSWgBtyL2lbFtkKxMAhSoPNdlrMFakJqTjuamX+3E3teqiTm6/UpPkH213oLGNahKuAtpQ0wbERrXcnzO1bBpK388B4D6I5fCT9kh69EbSy65RKsi/26+7qKtJv2oREq98FIbnbJO3TaMjBjPcwtqFDG9qp0XxcX/7ndSrUHxotP16TcVrHOGHgIM0PwK6JIMvN/BgpiRTDc/CFwhO+x7ZDYI/ONMoO4NDIX3PYHqpDAWg0a1byp4P4j3ft6fX2jqrvbO6bLU5gtI53w8U4ueG4vS7h0Ze7t9hJUld5xMnwpJp2X5O8KxChB4KG0IQ8pBk+JUXq17qFT7cTN1G17zf2SrGdNz1yMi7Agh0PzRINR0otFF515Z3Fzzml7wfmCrEvFl1zV9wiL6o6j8ELh5LgzjkKpbVTilkw1XLvyYxiCxZHZhpkOEZY3gDto5Ci7PcrBzbTTOYWZGNeqCfoBN0loREx3AceICXbDYFPHIUNaFz37kj0Ei2vbd+MI4fpcJncQ7UiqZzDbycj160Ox7c5YRB0pveJQ3Y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pIk80xVIUlCBjmykYNc5CEfBShEJaqggBIqjzpSRkIGObKRg1zkIR8FKEQlqqCAEiqPulNOAgAA) format('woff2')}.wd-form--vertical-left .wedatea2td-form .weda-formcells__pc.horizontal,.wd-form--vertical-right .wedatea2td-form .weda-formcells__pc.horizontal,.wedatea2td-form--vertical .wd-form--horizontal-left .wd-form-item-wrap,.wedatea2td-form--vertical .wd-form--horizontal-right .wd-form-item-wrap,.wedatea2td-form--vertical .wd-form-item.wd-form-item--horizontal-left .wd-form-item-wrap,.wedatea2td-form--vertical .wd-form-item.wd-form-item--horizontal-right .wd-form-item-wrap,.wedatea2td-form--vertical .wedatea2td-form .weda-formcells__pc.horizontal{flex-direction:column}.g-swiper-item>div>*{max-width:100%;max-height:100%;object-fit:cover;max-width:100%;object-fit:cover;max-width:100%;max-height:100%;object-fit:cover;width:100%;height:auto;max-width:100%;object-fit:cover}.form-detail-wrap .form-detail-content-wrap .form-detail-group-header-container{display:flex;align-items:center;justify-content:space-between}.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__desc{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weda-menu .wedatea2td-menu--light .wedatea2td-menu__list li.is-selected>.wedatea2td-menu__item:hover,.wedatea2td-drawer .wedatea2td-menu--light .wedatea2td-menu__list li .wedatea2td-menu__item:hover{background-color:var(--weda-navigation-menu-hover-color)}.weda-menu-mobile .weda-menu__wrapper{display:flex;align-items:center;justify-content:space-between;box-shadow:0 2px 2px rgba(0,0,0,.05)}.weda-menu .wedatea2td-menu__text .menu-text,.weda-menu__drawer .wedatea2td-menu__text .menu-text{display:flex;justify-content:center;align-items:center}.ExEditor-basic{box-sizing:border-box;min-height:var(--exeditor-editor-min-height,100px);background:var(--exeditor-editor-background,#fff);padding:var(--exeditor-editor-padding,20px);white-space:pre-wrap;--exeditor-hr-color:var(--exeditor-basic-hr-color, #e7e7e7);--exeditor-link-color:var(--exeditor-basic-link-color, #0052ff);--exeditor-selected-outline:var(--exeditor-basic-selected-outline, 2px solid #68cef8);--exeditor-selected-background:var(--exeditor-basic-selected-background, rgba(24, 144, 255, 0.3));--exeditor-selected-cell-background:var(--exeditor-basic-selected-cell-background, rgba(24, 144, 255, 0.15));--exeditor-formula-vertical-align:var(--exeditor-basic-formula-vertical-align, middle)}@media (max-width:1024px){.g-swiper .g-swiper__turn-next,.g-swiper .g-swiper__turn-pre{display:none}.modal-table-delete .wedatea2td-dialog__inner,.model-relation-selector-modal .wedatea2td-dialog__inner,.wedatea2td-dialog__inner{min-width:0;width:90%;margin:10px 0}.wedatea2td-form.model-form{width:100%}}.markdown-body .octicon{fill:currentColor}.markdown-body pre{word-wrap:normal}.wd-form-item.wd-pc-rich-text-root .ExEditor-basic,.wd-form-item.wd-pc-rich-text-root .exeditor-toolbar{background-color:inherit}.wd-add-relation-button-wrap{display:flex;align-items:center;color:var(--wd-color-brand,#0052d9);white-space:pre-wrap}.weda-import-csv-file-modal .file-json-map-wrap{display:flex;flex-direction:column;box-sizing:border-box}.weda-import-csv-file-modal .import-file-result-wrap .error-container{display:flex;flex-direction:column}.weda-import-csv-file-modal .import-file-result-wrap .error-content{flex:1}.wd-table-wrap-filter .wedatea2td-input:focus,.wd-table-wrap-filter .wedatea2td-input:hover,.wd-table-wrap-filter .wedatea2td-textarea-group:focus,.wd-table-wrap-filter .wedatea2td-textarea-group:hover,.wd-table-wrap-filter .wedatea2td-textarea:focus,.wd-table-wrap-filter .wedatea2td-textarea:hover,.wedatea2td-overlay .wedatea2td-checkbox:focus,.wedatea2td-overlay .wedatea2td-checkbox:hover,.wedatea2td-overlay input[type=checkbox]:focus,.wedatea2td-overlay input[type=checkbox]:hover{border-color:var(--wd-color-brand,#0052d9)}.weda-ui_mapChoose_search_input_clear{display:flex;justify-content:center}.form-select-map .wedatea2td-dialog__inner{box-shadow:none;min-width:100vw!important}.weda-ui-custom-calendar-op__end,.weda-ui-custom-calendar-op__start{display:flex;align-items:center}.weui-tag span{word-wrap:break-word;word-break:break-word}.weda-ui-user-select-container-list__start .depart-tree .wedatea2td-tree__node.is-selected>.wedatea2td-tree__node-content,.weda-ui-user-select-container-list__start .depart-tree .wedatea2td-tree__node.is-selected>.wedatea2td-tree__node-content .wedatea2td-tree__label,.weda-ui-user-select-container-list__start .wedatea2td-tree.wedatea2td-tree--checkbox-separate .wedatea2td-tree__node.is-selected>.wedatea2td-tree__node-content .wedatea2td-tree__label .wedatea2td-tree__label-title{background-color:var(--wd-color-brand-light,#d4e3fc)}.weda-select-user-dept-breadcrumb{display:flex;align-items:center}.form-location-con_disabled{opacity:.4}body{font-size:var(--wd-font-base)}@font-face{font-family:wd-lcap-icon;font-weight:400;font-style:normal;src:url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAkMAA0AAAAAFZgAAAi1AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4GYACCXhEICpxYlmoLTgABNgIkA1gEIAWDMweDBRtzEVGUTVKf7GdCpjLGY/HIYGvbDpn6q7Qdj3xvUaZJUNFads3M7geYVSSiCgsZJYFkhEfn2DjU9//jpn8D1QTqVBQqSrtAVZAq1bwkpTOo0Hbz2tnYfkP3ZzAxpv6ZiSFf3OHh8/b+/oqzxIt4QmFX5ImmIe0SWAOEOJL2n9ZSO5PcCwErnTjzLxOYud0Az24IS8AOXSWgBtyL2lbFtkKxMAhSoPNdlrMFakJqTjuamX+3E3teqiTm6/UpPkH213oLGNahKuAtpQ0wbERrXcnzO1bBpK388B4D6I5fCT9kh69EbSy65RKsi/26+7qKtJv2oREq98FIbnbJO3TaMjBjPcwtqFDG9qp0XxcX/7ndSrUHxotP16TcVrHOGHgIM0PwK6JIMvN/BgpiRTDc/CFwhO+x7ZDYI/ONMoO4NDIX3PYHqpDAWg0a1byp4P4j3ft6fX2jqrvbO6bLU5gtI53w8U4ueG4vS7h0Ze7t9hJUld5xM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SGWWs4aGlmhqdGjnCFPBYAqTFrMVhmw/tErzDrt1E1nqkx9Os0wHbxR48t8+rYA9icsgyFzkc5s8Ne9hwCEXWH8WM82YAhjUzGZLCR46/+MZFkk2djoLT1IzKCbi3WV1hnUrcvSm+MZtRSpiYWanQU+67DN62G7tnPGP8h5DgBGvMgjgCILl0eQyJQoo5wKKqmimhpqqSOQIIIJQUQoYYQTQSRRRBNDLHGIkRBPAonZMHXOzF6Z99D0PpIk80xVIUlCBjmykYNc5CEfBShEJaqggBIqjzpSRkIGObKRg1zkIR8FKEQlqqCAEiqPulNOAgAA) format("woff2")}.t-icon{speak:none;text-transform:none;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wd-space-align-items--flex-start{align-items:flex-start;align-items:center;align-items:flex-end}.wd-space-justify-content--flex-start{justify-content:flex-start;justify-content:center;justify-content:flex-end}.wd-btn{--wd-btn-sm-padding:0.0625rem calc(var(--wd-space-base) * 2);--wd-btn-md-padding:0.25rem calc(var(--wd-space-base) * 4);--wd-btn-lg-padding:0.4375rem calc(var(--wd-space-base) * 6);--wd-btn-margin-top:0;--wd-btn-margin-top:0;--wd-btn-font-size-sm:var(--wd-font-size-2);--wd-btn-line-height-sm:1.5;--wd-btn-min-height-sm:24px;--wd-btn-font-size-md:var(--wd-font-size-3);--wd-btn-line-height-md:1.5;--wd-btn-min-height-md:32px;--wd-btn-font-size-lg:var(--wd-font-size-4);--wd-btn-line-height-lg:1.5;--wd-btn-min-height-lg:40px;--wd-btn-icon-space-sm:var(--wd-space-base);--wd-btn-icon-space-md:calc(var(--wd-space-base) * 2);--wd-btn-icon-space-lg:calc(var(--wd-space-base) * 3);--wd-btn-icon-size-sm:calc(var(--wd-btn-font-size-sm) + 0.125rem);--wd-btn-icon-size-md:calc(var(--wd-btn-font-size-md) + 0.125rem);--wd-btn-icon-size-lg:calc(var(--wd-btn-font-size-lg) + 0.25rem);--wd-btn-border-radius:var(--wd-border-radius);--wd-btn-color-text:var(--wd-color-text-default);--wd-btn-color-text-inverse:var(--wd-color-text-inverse);--wd-btn-color-text-hover:var(--wd-color-text-default);--wd-btn-color-text-active:var(--wd-color-text-default);--wd-btn-color-text-focus:var(--wd-color-text-default);--wd-btn-color-text-disabled:var(--wd-color-text-disabled);--wd-btn-color-brand:var(--wd-color-brand);--wd-btn-color-brand-hover:var(--wd-color-brand-hover);--wd-btn-color-brand-active:var(--wd-color-brand-active);--wd-btn-color-brand-focus:var(--wd-color-brand-focus);--wd-btn-color-brand-disabled:var(--wd-color-brand-disabled);--wd-btn-color-warning:var(--wd-color-warning);--wd-btn-color-warning-hover:var(--wd-color-warning-hover);--wd-btn-color-warning-active:var(--wd-color-warning-active);--wd-btn-color-warning-focus:var(--wd-color-warning-focus);--wd-btn-color-warning-disabled:var(--wd-color-warning-disabled);--wd-btn-color-error:var(--wd-color-error);--wd-btn-color-error-hover:var(--wd-color-error-hover);--wd-btn-color-error-active:var(--wd-color-error-active);--wd-btn-color-error-focus:var(--wd-color-error-focus);--wd-btn-color-error-disabled:var(--wd-color-error-disabled);--wd-btn-color-gray:var(
|
|
5
5
|
--wd-color-gray-1
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
3
3
|
import { Modal, Radio, Form, Table, Checkbox, Icon, List, Status, Bubble, Tooltip } from 'tea-component';
|
|
4
4
|
import { useImportingStatus } from '../hooks/useImportingStatus';
|
|
5
5
|
import { callWedaApi } from '../../../utils/tcb';
|
|
@@ -15,20 +15,31 @@ export function ExportFileModalByApi({ onCancel, visible, fields, selectedKeysLi
|
|
|
15
15
|
const [status, setStatus] = useState(null);
|
|
16
16
|
const [fileId, setFileIds] = useState(null);
|
|
17
17
|
const { fileImportStatus, fileImportErrorMessage } = useImportingStatus(fileId, dbName, 'export');
|
|
18
|
-
const exportFields =
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const exportFields = useMemo(() => {
|
|
19
|
+
const resultArray = [];
|
|
20
|
+
selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.forEach((item) => {
|
|
21
|
+
const field = tableColumns === null || tableColumns === void 0 ? void 0 : tableColumns.find((columns) => {
|
|
22
|
+
if (columns === null || columns === void 0 ? void 0 : columns.isRelated) {
|
|
23
|
+
return (columns === null || columns === void 0 ? void 0 : columns.slotKey) === item;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return (columns === null || columns === void 0 ? void 0 : columns.fieldKey) === item;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
resultArray.push({
|
|
30
|
+
FieldId: (field === null || field === void 0 ? void 0 : field.isRelated) ? `@${field === null || field === void 0 ? void 0 : field.fieldKey}.${field === null || field === void 0 ? void 0 : field.relatedField}` : item,
|
|
31
|
+
ColumnName: item === '_id' ? '数据标识' : field === null || field === void 0 ? void 0 : field.header,
|
|
32
|
+
});
|
|
33
|
+
const hasRelationId = resultArray.some((item) => item.FieldId === `@${field === null || field === void 0 ? void 0 : field.fieldKey}._id`);
|
|
34
|
+
if (!!exportIdentity.length && (field === null || field === void 0 ? void 0 : field.isRelated) && !hasRelationId) {
|
|
35
|
+
resultArray.push({
|
|
36
|
+
FieldId: `@${field === null || field === void 0 ? void 0 : field.fieldKey}._id`,
|
|
37
|
+
ColumnName: `关联关系【${field === null || field === void 0 ? void 0 : field.fieldKey}】数据标识`,
|
|
38
|
+
});
|
|
25
39
|
}
|
|
26
40
|
});
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
ColumnName: item === '_id' ? '数据标识' : field === null || field === void 0 ? void 0 : field.header,
|
|
30
|
-
};
|
|
31
|
-
});
|
|
41
|
+
return resultArray;
|
|
42
|
+
}, [selectedKeys, tableColumns, exportIdentity]);
|
|
32
43
|
const handleExport = async () => {
|
|
33
44
|
try {
|
|
34
45
|
setStep('isExporting');
|
|
@@ -6,6 +6,7 @@ import { deepClone } from '../../../utils/tool';
|
|
|
6
6
|
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
7
7
|
import { emptyObject, emptyArray, NOT_EXISTED_VALUE } from '../../../utils/constant';
|
|
8
8
|
import { FormFieldProvider, useFormField } from '../contexts/form-field-context';
|
|
9
|
+
import { useFormFieldObj } from '../contexts/form-field-obj-context';
|
|
9
10
|
/**
|
|
10
11
|
* 表单容器装饰器高阶组件
|
|
11
12
|
* 用于包装组件,提供表单容器上下文
|
|
@@ -14,9 +15,10 @@ import { FormFieldProvider, useFormField } from '../contexts/form-field-context'
|
|
|
14
15
|
*/
|
|
15
16
|
export function withFormContainer(Component) {
|
|
16
17
|
const WithFormContainer = React.forwardRef((props, ref) => {
|
|
17
|
-
var _a;
|
|
18
|
+
var _a, _b;
|
|
18
19
|
const { ...componentProps } = props;
|
|
19
20
|
const formField = useFormField();
|
|
21
|
+
const formFieldObjsContext = useFormFieldObj();
|
|
20
22
|
const _formFieldValues = (_a = props.initialValues) !== null && _a !== void 0 ? _a : props.value;
|
|
21
23
|
const [formFieldsValue, setFormFieldsValue] = useState(_formFieldValues !== null && _formFieldValues !== void 0 ? _formFieldValues : ((props === null || props === void 0 ? void 0 : props.objType) === 'arr' ? emptyArray : emptyObject));
|
|
22
24
|
const [isReadyToCalculate, setIsReadyToCalculate] = useState(true);
|
|
@@ -49,8 +51,11 @@ export function withFormContainer(Component) {
|
|
|
49
51
|
return _formData;
|
|
50
52
|
});
|
|
51
53
|
}, []);
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
+
// 顶层没有表单容器,则组件自己管理值
|
|
55
|
+
// 非table组件,直接渲染原始组件,值交给顶层表单容器管理
|
|
56
|
+
// 在表单容器内,table组件,如果结合嵌套组件使用,则将组件值交给顶层表单容器管理,否则自己管理
|
|
57
|
+
const shouldUseProvider = formField ? !formFieldObjsContext && ((_b = props === null || props === void 0 ? void 0 : props.id) === null || _b === void 0 ? void 0 : _b.includes('table')) : true;
|
|
58
|
+
if (!shouldUseProvider) {
|
|
54
59
|
return _jsx(Component, { ...props, ref: ref, isInformContainer: true });
|
|
55
60
|
}
|
|
56
61
|
return (_jsx(FormFieldProvider, { setFieldValue: setFieldValue, getFieldValue: getFieldValue, isInformContainer: true, formFieldsValue: formFieldsValue, setFormFieldsValue: setFormFieldsValue, isReadyToCalculate: isReadyToCalculate, setIsReadyToCalculate: setIsReadyToCalculate, children: _jsx(Component, { ...componentProps, formFieldsValue: formFieldsValue, ref: ref }) }));
|
|
@@ -989,6 +989,7 @@ export const getTableColumns = ({ fields, columnSets, slots, fixedFront, fixedEn
|
|
|
989
989
|
key: (i === null || i === void 0 ? void 0 : i.slotKey) || (i === null || i === void 0 ? void 0 : i.key),
|
|
990
990
|
// 此字段为colum 绑定字段的key值,业务场景使用次字段
|
|
991
991
|
fieldKey: i === null || i === void 0 ? void 0 : i.key,
|
|
992
|
+
shouldCellUpdate: (prevRow, nextRow) => prevRow[i === null || i === void 0 ? void 0 : i.key] !== nextRow[i === null || i === void 0 ? void 0 : i.key],
|
|
992
993
|
}));
|
|
993
994
|
};
|
|
994
995
|
export const mapColumKey = (columnSets) => {
|
|
@@ -8,7 +8,7 @@ import { FilterFieldItem } from './FilterFieldItem';
|
|
|
8
8
|
import { arrayInputType } from './Fields';
|
|
9
9
|
import { filterFieldsGenerate } from './filterFieldsGenerate';
|
|
10
10
|
import { WdButton } from '../../../wd-button';
|
|
11
|
-
import { usePlatform } from '../../../../utils/platform';
|
|
11
|
+
import { usePlatform, textToString } from '../../../../utils/platform';
|
|
12
12
|
import { useSetWidgetApi } from '../../../../utils/widget-api/use-set-widget-api';
|
|
13
13
|
// 正则元字符添加转义符
|
|
14
14
|
const escapeRegExp = (string) => {
|
|
@@ -151,7 +151,7 @@ export const FilterFieldsPanel = forwardRef(function Comp(props, ref) {
|
|
|
151
151
|
searchValues.push(searchItem);
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
|
-
searchItem.val = (_c = i.value) === null || _c === void 0 ? void 0 : _c.trim();
|
|
154
|
+
searchItem.val = (_c = textToString(i.value)) === null || _c === void 0 ? void 0 : _c.trim();
|
|
155
155
|
searchValues.push(searchItem);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
interface BaseTableComProps {
|
|
2
|
+
export interface BaseTableComProps {
|
|
3
3
|
events?: any;
|
|
4
4
|
recordKey?: string;
|
|
5
5
|
className?: any;
|
|
@@ -40,4 +40,3 @@ interface BaseTableComProps {
|
|
|
40
40
|
}
|
|
41
41
|
export declare const BaseTableCom: ({ events, recordKey, className, columns, setColumns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, errorObj, isLoading, queryParams, total, onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, cellClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot, bottomTip, enableBottomTipSlot, rowDisabled, componentId, }: BaseTableComProps) => JSX.Element;
|
|
42
42
|
export declare const BaseTable: React.MemoExoticComponent<({ events, recordKey, className, columns, setColumns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, errorObj, isLoading, queryParams, total, onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, cellClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot, bottomTip, enableBottomTipSlot, rowDisabled, componentId, }: BaseTableComProps) => JSX.Element>;
|
|
43
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint max-lines: [error,
|
|
3
|
-
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
/* eslint max-lines: [error, 380] */
|
|
3
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
4
4
|
import { Table, StatusTip, ConfigProvider } from 'tea-component';
|
|
5
|
-
import { useResizeObserver } from '@react-hookz/web';
|
|
5
|
+
import { useResizeObserver, useDebouncedCallback } from '@react-hookz/web';
|
|
6
6
|
import { errorHandler } from '../../../../utils/error';
|
|
7
7
|
import { useConfig } from '../../../../utils/config-context';
|
|
8
8
|
const { sortable, radioable, selectable, injectable, pageable, autotip, scrollable, columnsResizable } = Table.addons;
|
|
@@ -17,6 +17,8 @@ const miniPageSize = 10;
|
|
|
17
17
|
// h5 端表格高度
|
|
18
18
|
const tableHeight = { sm: 500, md: 580, lg: 880 };
|
|
19
19
|
const tableHeaderHeight = 51;
|
|
20
|
+
// 默认防抖延迟时间(毫秒)
|
|
21
|
+
const DEFAULT_DEBOUNCE_DELAY = 200;
|
|
20
22
|
const renderStatus = ({ isH5, status, isNoDataSourceBind, _emptyText, errorObj, __innerSlot }) => {
|
|
21
23
|
var _a, _b;
|
|
22
24
|
const text = {
|
|
@@ -32,14 +34,13 @@ const renderStatus = ({ isH5, status, isNoDataSourceBind, _emptyText, errorObj,
|
|
|
32
34
|
return (_jsx(StatusContent, { emptyText: text[`${status}`], component: "table", icon: status, errorObj: errorObj, isH5: isH5 }));
|
|
33
35
|
};
|
|
34
36
|
// eslint-disable-next-line complexity
|
|
35
|
-
export const BaseTableCom = ({ events, recordKey, className, columns, setColumns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, errorObj, isLoading, queryParams, total = defaultTotal,
|
|
36
|
-
// refreshTable,
|
|
37
|
-
onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, cellClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot = (_jsx(_Fragment, {})), bottomTip, enableBottomTipSlot = false, rowDisabled, componentId, }) => {
|
|
37
|
+
export const BaseTableCom = ({ events, recordKey, className, columns, setColumns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, errorObj, isLoading, queryParams, total = defaultTotal, onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, cellClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot = (_jsx(_Fragment, {})), bottomTip, enableBottomTipSlot = false, rowDisabled, componentId, }) => {
|
|
38
38
|
var _a;
|
|
39
39
|
const tableRef = useRef(null);
|
|
40
40
|
const { classPrefix } = useConfig();
|
|
41
41
|
// 是否展示全局loading
|
|
42
42
|
const isShowLoading = isH5 ? (queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex) === pageIndexSpan && isLoading : isLoading;
|
|
43
|
+
const [h5Loading, setH5Loading] = useState(false);
|
|
43
44
|
// table状态样式
|
|
44
45
|
const showStatus = isShowLoading || isError || !(records === null || records === void 0 ? void 0 : records.length);
|
|
45
46
|
const classes = {
|
|
@@ -110,17 +111,29 @@ onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageI
|
|
|
110
111
|
// 支撑分页的最大高度
|
|
111
112
|
const tableDomHeight = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
112
113
|
// 支持表格滚动,高度超过 500 开始显示滚动条
|
|
114
|
+
const fetchData = useDebouncedCallback(() => {
|
|
115
|
+
if (!isLoading && (records === null || records === void 0 ? void 0 : records.length) < total && isH5 && Number.isFinite(total)) {
|
|
116
|
+
const newPageIndex = queryParams.pageIndex + pageIndexSpan;
|
|
117
|
+
onQueryChange({ pageIndex: newPageIndex });
|
|
118
|
+
if (events === null || events === void 0 ? void 0 : events.onPagingChange) {
|
|
119
|
+
events.onPagingChange({
|
|
120
|
+
pageIndex: newPageIndex,
|
|
121
|
+
pageSize: queryParams.pageSize || defaultPageSize,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, [isLoading, records === null || records === void 0 ? void 0 : records.length, total, isH5, queryParams.pageIndex], DEFAULT_DEBOUNCE_DELAY);
|
|
113
126
|
if (isH5) {
|
|
114
127
|
tableAddons.push(scrollable({
|
|
115
128
|
maxHeight: tableDomHeight - tableHeaderHeight,
|
|
116
129
|
onScrollBottom: () => {
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
});
|
|
130
|
+
if ((records === null || records === void 0 ? void 0 : records.length) < total && isH5) {
|
|
131
|
+
setH5Loading(true);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
setH5Loading(false);
|
|
123
135
|
}
|
|
136
|
+
fetchData();
|
|
124
137
|
},
|
|
125
138
|
}));
|
|
126
139
|
}
|
|
@@ -153,7 +166,7 @@ onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageI
|
|
|
153
166
|
targetColumnKey: (columns === null || columns === void 0 ? void 0 : columns.length) && columnSelectType === 'radio' ? 'weda_radio' : undefined,
|
|
154
167
|
}));
|
|
155
168
|
}
|
|
156
|
-
const showLoadingBottomTip = isLoading
|
|
169
|
+
const showLoadingBottomTip = (isLoading || h5Loading) && records.length > 0;
|
|
157
170
|
const showAllDataBottomTip = (records === null || records === void 0 ? void 0 : records.length) === total && !isLoading && (records === null || records === void 0 ? void 0 : records.length) > miniPageSize;
|
|
158
171
|
const bottomTipCompRender = () => {
|
|
159
172
|
const shouldShowBottomTip = enableBottomTipSlot && !showStatus;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pagination } from './Pagination';
|
|
2
|
-
import { BaseTable as Table } from './Table';
|
|
2
|
+
import { BaseTable as Table, BaseTableComProps } from './Table';
|
|
3
3
|
import { SearchBox } from './SearchBox';
|
|
4
4
|
import { ExportFileModal, exportHandle, exportHandleByApi } from './ExportFileModalByApi';
|
|
5
5
|
import { ImportFileModal, importHandleByApi } from './ImportFileModalByApi';
|
|
@@ -8,3 +8,4 @@ import { deleteRecord } from './deleteModal';
|
|
|
8
8
|
import { FilterFieldsPanel } from './FilterFieldsPanel';
|
|
9
9
|
import { ToolBar } from './ToolBar';
|
|
10
10
|
export { Pagination, Table, SearchBox, ExportFileModal, ImportFileModal, InOrOutRecordModal, deleteRecord, importHandleByApi, exportHandle, exportHandleByApi, FilterFieldsPanel, ToolBar, };
|
|
11
|
+
export type { BaseTableComProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Pagination } from './Pagination';
|
|
2
2
|
import { BaseTable as Table } from './Table';
|
|
3
3
|
import { SearchBox } from './SearchBox';
|
|
4
|
-
import { ExportFileModal, exportHandle, exportHandleByApi
|
|
4
|
+
import { ExportFileModal, exportHandle, exportHandleByApi } from './ExportFileModalByApi';
|
|
5
5
|
import { ImportFileModal, importHandleByApi } from './ImportFileModalByApi';
|
|
6
6
|
import { InOrOutRecordModal } from './InOrOutRecordModal';
|
|
7
7
|
import { deleteRecord } from './deleteModal';
|
|
@@ -28,22 +28,31 @@ export const useTableData = ({ dataSourceAPI, connectorMethod, query, events, is
|
|
|
28
28
|
canCallQuerySuccess = false;
|
|
29
29
|
if (Object.keys(select).length !== 0) {
|
|
30
30
|
canCallQuerySuccess = true;
|
|
31
|
-
|
|
32
|
-
data
|
|
31
|
+
const result = await dataSourceAPI.getRecordListV2(query, { swr });
|
|
32
|
+
data = {
|
|
33
|
+
...data,
|
|
34
|
+
total: result.total,
|
|
35
|
+
records: result.records || [],
|
|
36
|
+
};
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
else {
|
|
36
40
|
// 不是新添加的表格,用旧方法查询
|
|
37
|
-
|
|
38
|
-
data
|
|
41
|
+
const result = await dataSourceAPI.getRecordList(query, { swr });
|
|
42
|
+
data = {
|
|
43
|
+
...data,
|
|
44
|
+
total: result.total,
|
|
45
|
+
records: result.records || [],
|
|
46
|
+
};
|
|
39
47
|
}
|
|
40
48
|
setIsError(false);
|
|
41
49
|
}
|
|
42
50
|
else if (connectorMethod === null || connectorMethod === void 0 ? void 0 : connectorMethod.name) {
|
|
43
51
|
data = await dataSourceAPI.getConnect(connectorMethod === null || connectorMethod === void 0 ? void 0 : connectorMethod.name, query, swr);
|
|
44
52
|
}
|
|
45
|
-
//
|
|
46
|
-
|
|
53
|
+
// 分页器查询时合并多次请求结果再赋值表格
|
|
54
|
+
// H5端是滚动加载更多,不合并请求
|
|
55
|
+
if (fetchVersion !== fetchRef.current.version && !isH5)
|
|
47
56
|
return;
|
|
48
57
|
const records = (data === null || data === void 0 ? void 0 : data.records) || [];
|
|
49
58
|
setTotal(data === null || data === void 0 ? void 0 : data.total);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseTableComProps } from './components';
|
|
3
|
+
export interface TableWithFormProps extends BaseTableComProps {
|
|
4
|
+
isInformContainer?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const TableWithForm: React.ForwardRefExoticComponent<Pick<{
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
initialValues?: any;
|
|
9
|
+
}, string | number> & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { useDeepCompareEffect } from '@react-hookz/web';
|
|
4
|
+
import { Table } from './components';
|
|
5
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
6
|
+
import { withFormContainer } from '../wd-form/hoc/form-container-decorator';
|
|
7
|
+
import { useFormField } from '../wd-form/contexts/form-field-context';
|
|
8
|
+
import { useFormFieldObj } from '../wd-form/contexts/form-field-obj-context';
|
|
9
|
+
import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
|
|
10
|
+
export const TableWithForm = withFormContainer(forwardRef(function TableComp(tableProps, ref) {
|
|
11
|
+
const { records = [] } = tableProps;
|
|
12
|
+
const formField = useFormField();
|
|
13
|
+
const { formFieldsValue = [], setFieldValue, setFormFieldsValue } = formField || {};
|
|
14
|
+
const formFieldObjsContext = useFormFieldObj();
|
|
15
|
+
useDeepCompareEffect(() => {
|
|
16
|
+
const value = [...records];
|
|
17
|
+
if (tableProps.isInformContainer) {
|
|
18
|
+
if (setFieldValue) {
|
|
19
|
+
// 在表单容器内,表格作为子表单,结合嵌套组件使用,通过顶层表单容器实现值管理
|
|
20
|
+
const parentNamePath = (formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.isChildField) ? formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath : [];
|
|
21
|
+
setFieldValue({ namePath: parentNamePath, value });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (setFormFieldsValue) {
|
|
25
|
+
setFormFieldsValue(value);
|
|
26
|
+
}
|
|
27
|
+
}, [formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath, records, tableProps.isInformContainer, formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.isChildField]);
|
|
28
|
+
useSetWidgetApi(() => ({
|
|
29
|
+
value: formFieldsValue,
|
|
30
|
+
}), [formFieldsValue], ref);
|
|
31
|
+
return _jsx(Table, { ...tableProps });
|
|
32
|
+
}));
|
|
@@ -10,10 +10,7 @@ export declare const GlobalButton: React.NamedExoticComponent<{
|
|
|
10
10
|
classPrefix: string;
|
|
11
11
|
slots: any;
|
|
12
12
|
}>;
|
|
13
|
-
export declare const WdTable: React.ForwardRefExoticComponent<
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
initialValues?: any;
|
|
16
|
-
}, string | number> & React.RefAttributes<unknown>>;
|
|
13
|
+
export declare const WdTable: React.ForwardRefExoticComponent<WdTableProps & React.RefAttributes<TCompRef>>;
|
|
17
14
|
export interface WdTableProps extends CommonPropsType, DataType {
|
|
18
15
|
isMock?: boolean;
|
|
19
16
|
multipleSelect: boolean;
|
|
@@ -22,3 +19,21 @@ export interface WdTableProps extends CommonPropsType, DataType {
|
|
|
22
19
|
__innerSlot?: React.ReactNode;
|
|
23
20
|
initialValues?: [];
|
|
24
21
|
}
|
|
22
|
+
type TCompRef = {
|
|
23
|
+
import: () => void;
|
|
24
|
+
exportOptionalMode: () => void;
|
|
25
|
+
export: () => void;
|
|
26
|
+
deleteSelected: () => void;
|
|
27
|
+
refresh: () => void;
|
|
28
|
+
refreshKeepPage: () => void;
|
|
29
|
+
deleteOne: (params: {
|
|
30
|
+
id: string;
|
|
31
|
+
}) => void;
|
|
32
|
+
openOperationDialog: () => void;
|
|
33
|
+
records?: any[];
|
|
34
|
+
total: number;
|
|
35
|
+
pageNo: number;
|
|
36
|
+
pageSize: number;
|
|
37
|
+
selectedRecords: any[];
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
@@ -2,25 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
/* eslint-disable max-lines */
|
|
3
3
|
import { useRef, useEffect, useState, useMemo, forwardRef, memo } from 'react';
|
|
4
4
|
import { ConfigProvider } from 'tea-component';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ExportFileModal, ImportFileModal, InOrOutRecordModal, deleteRecord, importHandleByApi, exportHandleByApi, exportHandle, FilterFieldsPanel, ToolBar, } from './components';
|
|
6
|
+
import { TableWithForm } from './table-with-form';
|
|
7
7
|
import classNames from '../../utils/classnames';
|
|
8
8
|
import { useConfig } from '../../utils/config-context';
|
|
9
9
|
import { DataSource } from '../../utils/datasource';
|
|
10
10
|
import { CELL_CUSTOM_OPTION, emptyArray } from '../../utils/constant';
|
|
11
11
|
import { useEnumContext } from '../../utils/hooks/context';
|
|
12
12
|
import { EnumHoc } from '../../utils/hooks/EnumHoc';
|
|
13
|
-
import { usePlatform
|
|
13
|
+
import { usePlatform } from '../../utils/platform';
|
|
14
14
|
import { convertWhere } from '../../utils/getModelParams';
|
|
15
15
|
import isObjectEqual from '../../utils/isObjectEqual';
|
|
16
16
|
import { useAuthFields } from './hooks/useAuthFields';
|
|
17
17
|
import { useTableData } from './hooks/useTableData';
|
|
18
18
|
import { useViewFields } from './hooks/useViewFields';
|
|
19
19
|
import { useQueryParams } from './hooks/useQueryParams';
|
|
20
|
-
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
21
|
-
import { withFormContainer } from '../wd-form/hoc/form-container-decorator';
|
|
22
|
-
import { useFormField } from '../wd-form/contexts/form-field-context';
|
|
23
|
-
import { useFormFieldObj } from '../wd-form/contexts/form-field-obj-context';
|
|
24
20
|
import { WdCompError } from '../../utils/error';
|
|
25
21
|
import { getSlots, getFilterFields, getSelectedView, getSortColumns, mapTableDataWithView, checkSupport, DataSourceType, getRecordKey, getCurrentPageData, } from './utils';
|
|
26
22
|
import { Mock } from './mock';
|
|
@@ -38,9 +34,8 @@ export const TableOption = function TableOption({ slots, ...props }) {
|
|
|
38
34
|
export const GlobalButton = memo(function GlobalButtonDom({ classPrefix, slots }) {
|
|
39
35
|
return _jsx("div", { className: `${classPrefix}-global-btn`, children: slotRender(slots) });
|
|
40
36
|
});
|
|
41
|
-
export const WdTable = withFormContainer(
|
|
42
37
|
// eslint-disable-next-line complexity
|
|
43
|
-
forwardRef(function TableComp(tableProps, ref) {
|
|
38
|
+
export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
44
39
|
const { className, style, dataSourceType = 'data-model', bindConnectMetadata = {
|
|
45
40
|
datasource: { id: '', name: '', title: '' },
|
|
46
41
|
}, // APImock数据
|
|
@@ -80,10 +75,7 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
80
75
|
isSupportMultipleSort = false, // 是否支持多字段排序
|
|
81
76
|
sorter, // 排序规则
|
|
82
77
|
__innerSlot, enableRelationTag = true, // 关联关系字段是否开启关联标签
|
|
83
|
-
enableBottomTipSlot = false, row__bottom__slot,
|
|
84
|
-
const formField = useFormField();
|
|
85
|
-
const { formFieldsValue = [], setFieldValue, setFormFieldsValue } = formField || {};
|
|
86
|
-
const formFieldObjsContext = useFormFieldObj();
|
|
78
|
+
enableBottomTipSlot = false, row__bottom__slot, ...props } = tableProps;
|
|
87
79
|
const wList = convertWhere(props, supportManyRelated); // 查询参数
|
|
88
80
|
const { classPrefix } = useConfig();
|
|
89
81
|
const platform = usePlatform();
|
|
@@ -209,7 +201,7 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
209
201
|
setColumns([]);
|
|
210
202
|
}, [columnSets]);
|
|
211
203
|
const columns = useMemo(() => {
|
|
212
|
-
if (isMock
|
|
204
|
+
if (isMock) {
|
|
213
205
|
return Mock.columns;
|
|
214
206
|
}
|
|
215
207
|
if (isNoDataSourceBind || (!isExpression && fieldsLoading)) {
|
|
@@ -341,7 +333,7 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
341
333
|
const isTableLoading = getLoadingStatus();
|
|
342
334
|
// 表格数据
|
|
343
335
|
const mapTableData = () => {
|
|
344
|
-
if (isMock
|
|
336
|
+
if (isMock) {
|
|
345
337
|
return Mock.records;
|
|
346
338
|
}
|
|
347
339
|
// 绑定表达式则直接返回表达式的值
|
|
@@ -364,15 +356,6 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
364
356
|
return tableData;
|
|
365
357
|
};
|
|
366
358
|
const tableRecords = mapTableData();
|
|
367
|
-
useDeepCompareEffect(() => {
|
|
368
|
-
const value = [...tableRecords];
|
|
369
|
-
if (setFieldValue && (formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath)) {
|
|
370
|
-
setFieldValue({ namePath: formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath, value });
|
|
371
|
-
}
|
|
372
|
-
else if (setFormFieldsValue) {
|
|
373
|
-
setFormFieldsValue(value);
|
|
374
|
-
}
|
|
375
|
-
}, [formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath, tableRecords]);
|
|
376
359
|
// 总数
|
|
377
360
|
let total = isExpression ? tableRecords === null || tableRecords === void 0 ? void 0 : tableRecords.length : tableTotal;
|
|
378
361
|
if (enableTotal && isExpression && !isNaN(parseInt(`${_total}`))) {
|
|
@@ -591,7 +574,6 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
591
574
|
filter: supportManyRelated ? query.filter : query === null || query === void 0 ? void 0 : query.where,
|
|
592
575
|
dataSourceVersion: supportManyRelated ? 'v2' : 'v1',
|
|
593
576
|
filterConfig,
|
|
594
|
-
value: formFieldsValue,
|
|
595
577
|
}),
|
|
596
578
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
597
579
|
[
|
|
@@ -618,7 +600,6 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
618
600
|
query === null || query === void 0 ? void 0 : query.filter,
|
|
619
601
|
supportManyRelated,
|
|
620
602
|
filterConfig,
|
|
621
|
-
formFieldsValue,
|
|
622
603
|
], ref);
|
|
623
604
|
// 表格更改上下文数据
|
|
624
605
|
// 移动端和自定义APIs场景不支持导入功能,监听变化存到表格上下文中
|
|
@@ -747,7 +728,7 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
747
728
|
pageIndex: 1,
|
|
748
729
|
}));
|
|
749
730
|
}
|
|
750
|
-
events === null || events === void 0 ? void 0 : events.onFilterChange({ searchValues
|
|
731
|
+
events === null || events === void 0 ? void 0 : events.onFilterChange({ searchValues });
|
|
751
732
|
};
|
|
752
733
|
const errorStatus = isError || fieldsError;
|
|
753
734
|
const errorMsg = isError ? errorObj : fieldsError;
|
|
@@ -756,7 +737,7 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
756
737
|
setOpenMobileFilter(true);
|
|
757
738
|
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination }) }))] })), isH5 && (enablePagination || enableRefreshBtn || enableTableHeightSizeBtn || hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: onRefreshBtnClick, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
758
739
|
setOpenMobileFilter(true);
|
|
759
|
-
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(
|
|
740
|
+
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(TableWithForm, { ref: ref, events: events, emptyText: emptyText, isH5: isH5, isNoDataSourceBind: isNoDataSourceBind, className: tableClassList, recordKey: recordKey, currentSize: tableHightSize, defaultPageIndex: defaultPageIndex, defaultPageSize: defaultPageSize, sortColumns: sortColumns, enablePagination: !isH5 && enablePagination, columnSelectType: columnSelectType, columns: visibleColumns, setColumns: setColumns, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: onSelectChange, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, onQueryChange: onQueryChange, rowClick: rowClick, cellClick: cellClick, isError: errorStatus, errorObj: errorMsg, __innerSlot: __innerSlot, bottomTip: row__bottom__slot, enableBottomTipSlot: enableBottomTipSlot }), 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, { columnSets: columnSets, dbName: dbName, datasourceTitle: datasourceTitle, fields: fields, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, isImportFileModalByApiVisible: isImportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, refresh: refreshTable, supportManyRelated: supportManyRelated }), _jsx(ExportFileModal, { whereList: wList, fields: fields, columns: mapColumKey(columns), isExportFileModalByApiVisible: isExportFileModalByApiVisible, selectedKeys: selectedKeys, dbName: dbName, query: query, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, supportManyRelated: supportManyRelated }), _jsx(InOrOutRecordModal, { dbName: dbName, isInOrOutRecordModalVisible: isInOrOutRecordModalVisible, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), isH5 && (_jsx(Modal, { overlayClassName: `${classPrefix}-h5-table-overlay`, className: `${classPrefix}-h5-table-option-modal-wrap`, disableCloseIcon: true, title: "\u64CD\u4F5C", visible: isMobileOptionVisible, outerRef: modalRef, events: {
|
|
760
741
|
close: () => {
|
|
761
742
|
setIsMobileOptionVisible(false);
|
|
762
743
|
},
|
|
@@ -765,4 +746,4 @@ forwardRef(function TableComp(tableProps, ref) {
|
|
|
765
746
|
setIsMobileOptionVisible(false);
|
|
766
747
|
},
|
|
767
748
|
} }) }))] }) }) }));
|
|
768
|
-
})
|
|
749
|
+
});
|