@cloudbase/weda-ui 3.10.1 → 3.11.0
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/button.js +1 -1
- package/dist/configs/components/chart/bar.d.ts +146 -0
- package/dist/configs/components/chart/bar.js +1147 -0
- package/dist/configs/components/dataView.js +0 -16
- package/dist/configs/components/image.js +1 -1
- package/dist/configs/components/listView.js +0 -16
- package/dist/configs/components/lottery.js +1 -1
- package/dist/configs/components/navigationBar.json +1 -1
- package/dist/configs/components/wd-audio.js +1 -1
- package/dist/configs/components/wd-button.js +2 -2
- package/dist/configs/components/wd-icon.js +1 -1
- package/dist/configs/components/wd-image.js +1 -1
- package/dist/configs/components/wd-input-email.d.ts +2 -2
- package/dist/configs/components/wd-input-phone.d.ts +2 -2
- package/dist/configs/components/wd-input-url.d.ts +2 -2
- package/dist/configs/components/wd-layout.js +0 -1
- package/dist/configs/components/wd-link.js +1 -1
- package/dist/configs/components/wd-menu-layout.js +1 -1
- package/dist/configs/components/wd-menu-list.js +1 -1
- package/dist/configs/components/wd-rating.js +2 -2
- package/dist/configs/components/wd-select-multiple.d.ts +23 -0
- package/dist/configs/components/wd-select-multiple.js +26 -1
- package/dist/configs/components/wd-select.d.ts +23 -0
- package/dist/configs/components/wd-select.js +25 -0
- package/dist/configs/components/wd-side-tab.js +2 -2
- package/dist/configs/components/wd-tabbar.js +1 -1
- package/dist/configs/components/wd-table.d.ts +13 -1
- package/dist/configs/components/wd-table.js +34 -0
- package/dist/configs/components/wd-top-tab.js +2 -2
- package/dist/configs/components/wd-upload-image.js +1 -1
- package/dist/configs/components/wedaVideo.js +3 -3
- package/dist/configs/components/wxOpenApi/share.js +1 -1
- package/dist/configs/index.d.ts +4422 -5720
- package/dist/configs/index.js +1 -1
- package/dist/configs/type-utils/type-form.d.ts +6 -0
- package/dist/configs/type-utils/type-form.js +63 -22
- package/dist/configs/type-utils/x-runtime-default.d.ts +1 -0
- package/dist/configs/type-utils/x-runtime-default.js +1 -0
- package/dist/enum/index.js +5 -1
- package/dist/style/index.css +15 -0
- package/dist/style/index.scss +1 -1
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/form/select/index.css +2 -2
- package/dist/web/components/form/select/request.d.ts +3 -3
- package/dist/web/components/form/select/request.js +1 -0
- package/dist/web/components/form/select/status/index.d.ts +3 -1
- package/dist/web/components/form/select/status/index.js +3 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/index.css +5 -5
- package/dist/web/components/form/uploader/uploader.h5.js +1 -1
- package/dist/web/components/form/uploader/uploader.pc.js +1 -1
- package/dist/web/components/form/uploader/util.d.ts +1 -0
- package/dist/web/components/form/uploader/util.js +2 -1
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +4 -3
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +3 -1
- package/dist/web/components/form-date/index.d.ts +1 -1
- package/dist/web/components/form-email/index.d.ts +1 -1
- package/dist/web/components/form-input/index.d.ts +1 -1
- package/dist/web/components/form-input-hooks/index.js +10 -1
- package/dist/web/components/form-input-hooks/validator.d.ts +1 -0
- package/dist/web/components/form-input-hooks/validator.js +6 -2
- package/dist/web/components/form-phone/index.d.ts +1 -1
- package/dist/web/components/form-time/index.d.ts +1 -1
- package/dist/web/components/form-url/index.d.ts +1 -1
- package/dist/web/components/formdetail/index.css +0 -6
- package/dist/web/components/wd-date/elements/Modal.h5.d.ts +2 -0
- package/dist/web/components/wd-date/elements/Modal.h5.js +3 -3
- package/dist/web/components/wd-form/index.js +1 -1
- package/dist/web/components/wd-form-item/wd-form-item-read-only.d.ts +1 -0
- package/dist/web/components/wd-input/wd-input.d.ts +1 -1
- package/dist/web/components/wd-input-email/wd-input-email.d.ts +1 -1
- package/dist/web/components/wd-input-phone/wd-input-phone.d.ts +1 -1
- package/dist/web/components/wd-input-url/wd-input-url.d.ts +1 -1
- package/dist/web/components/wd-menu-list/CommonMenuList.js +1 -1
- package/dist/web/components/wd-menu-list/HorizontalMenuList.js +1 -1
- package/dist/web/components/wd-select/relationSelect/relationSelect.d.ts +4 -0
- package/dist/web/components/wd-select/relationSelect/relationSelect.js +202 -0
- package/dist/web/components/wd-select/{relationalSetting.js → relationSelect/relationalSetting.js} +4 -4
- package/dist/web/components/wd-select/select/index.d.ts +2 -0
- package/dist/web/components/wd-select/select/index.js +8 -0
- package/dist/web/components/wd-select/select/selectUI.d.ts +3 -0
- package/dist/web/components/wd-select/select/selectUI.js +190 -0
- package/dist/web/components/wd-select/style.d.ts +2 -0
- package/dist/web/components/wd-select/style.js +2 -0
- package/dist/web/components/wd-select/wd-select.css +83 -0
- package/dist/web/components/wd-select/wd-select.d.ts +0 -1
- package/dist/web/components/wd-select/wd-select.js +18 -8
- package/dist/web/components/wd-select-multiple/style.d.ts +2 -0
- package/dist/web/components/wd-select-multiple/style.js +2 -0
- package/dist/web/components/wd-select-multiple/wd-select-multiple.css +30 -4
- package/dist/web/components/wd-select-multiple/wd-select-multiple.js +18 -7
- package/dist/web/components/wd-table/components/FieldRender/index.d.ts +7 -4
- package/dist/web/components/wd-table/components/FieldRender/index.js +27 -11
- package/dist/web/components/wd-table/components/ModalTable/index.js +1 -1
- package/dist/web/components/wd-table/components/Table/index.d.ts +4 -2
- package/dist/web/components/wd-table/components/Table/index.js +12 -3
- package/dist/web/components/wd-table/hooks/useChooseList.d.ts +1 -0
- package/dist/web/components/wd-table/hooks/useChooseList.js +55 -26
- package/dist/web/components/wd-table/wd-table.js +8 -3
- package/dist/web/components/wd-textarea/wd-textarea.js +5 -2
- package/dist/web/utils/platform.js +3 -3
- package/package.json +2 -2
- package/dist/configs/components/chart/bar.json +0 -1144
- /package/dist/web/components/wd-select/{relationalSetting.d.ts → relationSelect/relationalSetting.d.ts} +0 -0
|
@@ -76,10 +76,6 @@
|
|
|
76
76
|
color: var(--wd-color-text-placeholder) !important;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.wd-tag-root {
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
79
|
.wd-pc-select-multiple-root .wd-form-item-wrap__control {
|
|
84
80
|
overflow: hidden;
|
|
85
81
|
}
|
|
@@ -91,3 +87,33 @@
|
|
|
91
87
|
width: 100%;
|
|
92
88
|
padding-right: calc(var(--wd-size-icon-md));
|
|
93
89
|
}
|
|
90
|
+
|
|
91
|
+
.wd-relation-select-overlay.multiple
|
|
92
|
+
.wedatea2td-dropdown-box
|
|
93
|
+
.wedatea2td-list--option
|
|
94
|
+
> li {
|
|
95
|
+
width: fit-content !important;
|
|
96
|
+
min-width: 100%;
|
|
97
|
+
padding: 0;
|
|
98
|
+
}
|
|
99
|
+
.wd-relation-select-overlay.multiple .wd-relation-select-option-wrap {
|
|
100
|
+
padding: 0 8px;
|
|
101
|
+
margin-top: -6px;
|
|
102
|
+
}
|
|
103
|
+
.wd-form-item.wd-pc-select-multiple-root .wedatea2td-dropdown__value div {
|
|
104
|
+
text-overflow: ellipsis;
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
}
|
|
108
|
+
/* h5端关联下拉样式 */
|
|
109
|
+
.weda-ui-custom-picker__cloumns.weda-ui-custom-picker__cloumns--select-multiple.wd-relation-select-overlay
|
|
110
|
+
.weda-ui-custom-picker__cloumn-item {
|
|
111
|
+
height: auto;
|
|
112
|
+
}
|
|
113
|
+
.weda-ui-custom-picker__cloumns--select-multiple
|
|
114
|
+
.weda-ui-custom-picker__cloumn-item-text {
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
text-overflow: ellipsis;
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
margin-left: 30px;
|
|
119
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { forwardRef, useState, useCallback, useRef } from 'react';
|
|
3
3
|
import { WdFormItem, WdInputGroup, WdInputWrap } from '../wd-form-item';
|
|
4
|
-
import SelectMultiple from '../
|
|
4
|
+
import { SelectCom as SelectMultiple } from '../wd-select/select';
|
|
5
5
|
import { useHandleClear, useFixedIcon, SELECT_ICON_H5, SELECT_ICON_PC, } from '../../utils/hooks/useFormLegacy';
|
|
6
6
|
import { useFormInputTrait } from '../../components/form-input-hooks';
|
|
7
|
-
import { RecycleProvider } from '../../utils/hooks/useRecycle';
|
|
8
7
|
import { useSelected } from '../../utils/hooks/use-selected';
|
|
9
8
|
import { emptyObject } from '../../utils/constant';
|
|
10
9
|
import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
|
|
@@ -13,12 +12,13 @@ import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default
|
|
|
13
12
|
import './style';
|
|
14
13
|
import { useDebouncedCallback, useSyncedRef } from '@react-hookz/web';
|
|
15
14
|
import { isFormatWithRelation } from '../form/select/formats-util';
|
|
16
|
-
import { RelationalSetting } from '../wd-select/relationalSetting';
|
|
15
|
+
import { RelationalSetting } from '../wd-select/relationSelect/relationalSetting';
|
|
17
16
|
/**
|
|
18
17
|
* 下拉多选-标准化
|
|
19
18
|
*/
|
|
20
19
|
export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref) {
|
|
21
|
-
const { classRoot = 'select-multiple', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, enumName, format, primaryField, tipBlock = X_RUNTIME_DEFAULT.tipBlock, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, where = X_RUNTIME_DEFAULT.where, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, popupContainer,
|
|
20
|
+
const { classRoot = 'select-multiple', clearable = X_RUNTIME_DEFAULT.clearable, placeholder, range, enumName, format, primaryField, tipBlock = X_RUNTIME_DEFAULT.tipBlock, viewId, dataSourceName, events = emptyObject, ignoreCase = X_RUNTIME_DEFAULT.ignoreCase, staticSearchable = X_RUNTIME_DEFAULT.staticSearchable, where = X_RUNTIME_DEFAULT.where, enableRelationalSetting = X_RUNTIME_DEFAULT.enableRelationalSetting, enableRelationalRefresh = X_RUNTIME_DEFAULT.enableRelationalRefresh, addRelationButtonText = X_RUNTIME_DEFAULT.addRelationButtonText, enableAddRelationButton = X_RUNTIME_DEFAULT.enableAddRelationButton, enableRelationOptionJump = X_RUNTIME_DEFAULT.enableRelationOptionJump, popupContainer, selectFields: customFields = [], // 自定义展示字段
|
|
21
|
+
selectFieldType = 'primary', } = props;
|
|
22
22
|
const childRef = useRef(null);
|
|
23
23
|
const [options, setOptions] = useState([]);
|
|
24
24
|
const [innerHandle, setInnerHandle] = useState({});
|
|
@@ -48,6 +48,11 @@ export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref)
|
|
|
48
48
|
disabled,
|
|
49
49
|
value,
|
|
50
50
|
});
|
|
51
|
+
const handleChange = (v) => {
|
|
52
|
+
var _a;
|
|
53
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(v);
|
|
54
|
+
(_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.change) === null || _a === void 0 ? void 0 : _a.call(delayEvents, { value: v });
|
|
55
|
+
};
|
|
51
56
|
const isRelation = isFormatWithRelation(format);
|
|
52
57
|
const LabelAdornment = isRelation && (_jsx(RelationalSetting, { size: props.size, refresh: () => {
|
|
53
58
|
var _a;
|
|
@@ -81,7 +86,10 @@ export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref)
|
|
|
81
86
|
}), [innerHandle, selectedLabel, primaryField, selectedItem, value], ref);
|
|
82
87
|
const eventsRef = useSyncedRef(events);
|
|
83
88
|
const debouncedTriggerSearchEvent = useDebouncedCallback((value) => {
|
|
84
|
-
|
|
89
|
+
var _a, _b;
|
|
90
|
+
if (typeof ((_a = eventsRef.current) === null || _a === void 0 ? void 0 : _a.search) === 'function') {
|
|
91
|
+
(_b = eventsRef.current) === null || _b === void 0 ? void 0 : _b.search({ value });
|
|
92
|
+
}
|
|
85
93
|
}, [eventsRef],
|
|
86
94
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
87
95
|
300);
|
|
@@ -90,8 +98,11 @@ export const WdSelectMultiple = forwardRef(function WdSelectMultiple(props, ref)
|
|
|
90
98
|
}, [debouncedTriggerSearchEvent]);
|
|
91
99
|
if (!visible)
|
|
92
100
|
return null;
|
|
93
|
-
return (_jsx(WdFormItem, { ...formItemProps, children: _jsxs(_Fragment, { children: [_jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(
|
|
101
|
+
return (_jsx(WdFormItem, { ...formItemProps, children: _jsxs(_Fragment, { children: [_jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(SelectMultiple, { ...props, setAllOption: setOptions, onRelationTagClick: (item) => {
|
|
94
102
|
var _a;
|
|
95
103
|
(_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.onRelationTagClick) === null || _a === void 0 ? void 0 : _a.call(delayEvents, item);
|
|
96
|
-
},
|
|
104
|
+
}, enableRelationOptionJump: enableRelationOptionJump, onRelationOptionJump: (item) => {
|
|
105
|
+
var _a;
|
|
106
|
+
(_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.onRelationOptionJump) === null || _a === void 0 ? void 0 : _a.call(delayEvents, item);
|
|
107
|
+
}, selectFieldType: selectFieldType, selectFields: customFields, isRelation: isRelation, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, childRef: childRef, events: delayEvents, labelVisible: false, value: value, enumName: enumName, format: format, placeholder: placeholder, primaryField: primaryField, options: range, size: "full", tipBlock: tipBlock, viewId: viewId, dataSourceName: dataSourceName, readOnly: readOnly, disabled: disabled, mode: "multiple", decorator: null, ignoreCase: ignoreCase, staticSearchable: staticSearchable, where: where, onChange: handleChange, onSearch: onSearchValueInput, popupContainer: popupContainer, searchable: true }) }) }), layout === 'horizontal' && LabelAdornment] }) }));
|
|
97
108
|
});
|
|
@@ -56,17 +56,18 @@ export declare const formatNumberFix: (val: any, field: any, setZero?: boolean)
|
|
|
56
56
|
* 根据 fields 信息生成 column
|
|
57
57
|
* h5 和 pc 部分参数不同
|
|
58
58
|
*/
|
|
59
|
-
export declare const getColumns: ({ columnSets, fields, isH5, supportManyRelated, }: {
|
|
59
|
+
export declare const getColumns: ({ columnSets, fields, isH5, supportManyRelated, showRelationWithTag, }: {
|
|
60
60
|
columnSets?: any[];
|
|
61
61
|
fields: any;
|
|
62
62
|
isH5?: boolean;
|
|
63
63
|
supportManyRelated: any;
|
|
64
|
+
showRelationWithTag: any;
|
|
64
65
|
}) => any;
|
|
65
66
|
/**
|
|
66
67
|
* 根据 field 属性,生成 column 配置
|
|
67
68
|
* https://git.woa.com/QBase/lcap/common-application-specs/blob/master/types/platform/datasource.ts
|
|
68
69
|
*/
|
|
69
|
-
export declare const formatFieldToColumn: (field: any, isH5: any, columnSets: any, supportManyRelated: any) => {
|
|
70
|
+
export declare const formatFieldToColumn: (field: any, isH5: any, columnSets: any, supportManyRelated: any, showRelationWithTag: any) => {
|
|
70
71
|
width: any;
|
|
71
72
|
render: (record: any) => JSX.Element;
|
|
72
73
|
key: any;
|
|
@@ -109,13 +110,14 @@ export declare const slotRender: (Slot: any, props?: {}) => any;
|
|
|
109
110
|
* slots: object 模型表格作用域插槽
|
|
110
111
|
* isH5: 判断自定义插槽列能否展示,目前是正常展示
|
|
111
112
|
*/
|
|
112
|
-
export declare const filterCustomColumns: ({ columns, columnSets, slots, fields, isH5, supportManyRelated, }: {
|
|
113
|
+
export declare const filterCustomColumns: ({ columns, columnSets, slots, fields, isH5, supportManyRelated, showRelationWithTag, }: {
|
|
113
114
|
columns: any;
|
|
114
115
|
columnSets: any;
|
|
115
116
|
slots: any;
|
|
116
117
|
fields: any;
|
|
117
118
|
isH5: any;
|
|
118
119
|
supportManyRelated: any;
|
|
120
|
+
showRelationWithTag: any;
|
|
119
121
|
}) => any;
|
|
120
122
|
/**
|
|
121
123
|
* 过滤字段列表
|
|
@@ -137,7 +139,7 @@ export declare const getFixedColumnSets: ({ fixedFront, fixedEnd, columnSets, }:
|
|
|
137
139
|
/**
|
|
138
140
|
* 列管理字段转换
|
|
139
141
|
*/
|
|
140
|
-
export declare const getTableColumns: ({ fields, columnSets, slots, fixedFront, fixedEnd, isH5, supportManyRelated, }: {
|
|
142
|
+
export declare const getTableColumns: ({ fields, columnSets, slots, fixedFront, fixedEnd, isH5, supportManyRelated, showRelationWithTag, }: {
|
|
141
143
|
fields: any;
|
|
142
144
|
columnSets: any;
|
|
143
145
|
slots: any;
|
|
@@ -145,5 +147,6 @@ export declare const getTableColumns: ({ fields, columnSets, slots, fixedFront,
|
|
|
145
147
|
fixedEnd: any;
|
|
146
148
|
isH5: any;
|
|
147
149
|
supportManyRelated: any;
|
|
150
|
+
showRelationWithTag?: boolean;
|
|
148
151
|
}) => any;
|
|
149
152
|
export declare const mapColumKey: (columnSets: any) => any;
|
|
@@ -39,7 +39,7 @@ export const TextWrap = React.memo(function TextWrapComp(props) {
|
|
|
39
39
|
export function getFieldRender(field = {}, extra = {}) {
|
|
40
40
|
var _a;
|
|
41
41
|
const { type, format, items, properties, title, parentDatasource } = field;
|
|
42
|
-
const { modelType, showTip = true, detailText = '详情', isH5 } = extra;
|
|
42
|
+
const { modelType, showTip = true, detailText = '详情', isH5, showRelationWithTag = true, } = extra;
|
|
43
43
|
const textProps = { showTip };
|
|
44
44
|
// 枚举-旧,新版 TODO
|
|
45
45
|
if ((_a = field['x-enumObj']) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -135,13 +135,19 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
135
135
|
(format === 'father-son' || format === 'related')) {
|
|
136
136
|
const primaryField = ((_b = (_a = field === null || field === void 0 ? void 0 : field.parentDatasource) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b['x-primary-column']) || '';
|
|
137
137
|
const relatedField = (_c = extra === null || extra === void 0 ? void 0 : extra.columnSet) === null || _c === void 0 ? void 0 : _c.relatedField;
|
|
138
|
+
if (!showRelationWithTag) {
|
|
139
|
+
if (typeof fieldValue === 'string') {
|
|
140
|
+
return _jsx(TextWrap, { ...textProps, children: fieldValue });
|
|
141
|
+
}
|
|
142
|
+
return (_jsx(TextWrap, { ...textProps, children: fieldValue[relatedField] || fieldValue[primaryField] || '-' }));
|
|
143
|
+
}
|
|
138
144
|
if (typeof fieldValue === 'string') {
|
|
139
|
-
return (_jsx(WdTag, { range: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(',').map((i) => ({
|
|
145
|
+
return fieldValue && fieldValue !== '-' ? (_jsx(WdTag, { range: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(',').map((i) => ({
|
|
140
146
|
label: i,
|
|
141
147
|
value: i,
|
|
142
148
|
prefixType: 'inner',
|
|
143
149
|
prefixIcon: 'td:link-1',
|
|
144
|
-
})), tagStyleType: 'light', tagStyleWidthCols: 4 }));
|
|
150
|
+
})), tagStyleType: 'light', tagStyleWidthCols: 4 })) : ('-');
|
|
145
151
|
}
|
|
146
152
|
const val = fieldValue[relatedField] || fieldValue[primaryField];
|
|
147
153
|
return val ? (_jsx(WdTag, { range: val === null || val === void 0 ? void 0 : val.split(',').map((i) => ({
|
|
@@ -194,12 +200,15 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
194
200
|
const primaryField = ((_e = (_d = field === null || field === void 0 ? void 0 : field.parentDatasource) === null || _d === void 0 ? void 0 : _d.schema) === null || _e === void 0 ? void 0 : _e['x-primary-column']) || '';
|
|
195
201
|
const relatedField = (_f = extra === null || extra === void 0 ? void 0 : extra.columnSet) === null || _f === void 0 ? void 0 : _f.relatedField;
|
|
196
202
|
const _readValue = fieldValue[relatedField] || fieldValue[primaryField];
|
|
197
|
-
|
|
203
|
+
if (!showRelationWithTag) {
|
|
204
|
+
return (_jsx(TextWrap, { ...textProps, children: fieldValue[relatedField] || fieldValue[primaryField] }));
|
|
205
|
+
}
|
|
206
|
+
return _readValue ? (_jsx(WdTag, { range: _readValue === null || _readValue === void 0 ? void 0 : _readValue.split(',').map((i) => ({
|
|
198
207
|
label: i,
|
|
199
208
|
value: i,
|
|
200
209
|
prefixType: 'inner',
|
|
201
210
|
prefixIcon: 'td:link-1',
|
|
202
|
-
})), tagStyleType: 'light', tagStyleWidthCols: 4 }));
|
|
211
|
+
})), tagStyleType: 'light', tagStyleWidthCols: 4 })) : ('-');
|
|
203
212
|
}
|
|
204
213
|
else {
|
|
205
214
|
return (_jsx(QuoteModal, { className: "e-object-view-modal", caption: title, size: MODAL_SIZE, text: detailText, children: objectRender({
|
|
@@ -314,6 +323,7 @@ export const DataTableView = ({ fields, value }) => {
|
|
|
314
323
|
fields: rawFieldsSort,
|
|
315
324
|
isH5: false,
|
|
316
325
|
supportManyRelated: false,
|
|
326
|
+
showRelationWithTag: false,
|
|
317
327
|
});
|
|
318
328
|
return baseColumns;
|
|
319
329
|
}, [rawFields]);
|
|
@@ -412,8 +422,8 @@ export const formatNumberFix = (val, field, setZero = false) => {
|
|
|
412
422
|
* 根据 fields 信息生成 column
|
|
413
423
|
* h5 和 pc 部分参数不同
|
|
414
424
|
*/
|
|
415
|
-
export const getColumns = ({ columnSets = [], fields, isH5 = false, supportManyRelated, }) => fields === null || fields === void 0 ? void 0 : fields.map((item) => formatFieldToColumn(item, isH5, columnSets, supportManyRelated));
|
|
416
|
-
const TableCell = ({ record, field, isH5, supportManyRelated }) => {
|
|
425
|
+
export const getColumns = ({ columnSets = [], fields, isH5 = false, supportManyRelated, showRelationWithTag, }) => fields === null || fields === void 0 ? void 0 : fields.map((item) => formatFieldToColumn(item, isH5, columnSets, supportManyRelated, showRelationWithTag));
|
|
426
|
+
const TableCell = ({ record, field, isH5, supportManyRelated, showRelationWithTag, }) => {
|
|
417
427
|
const component = React.useMemo(() => {
|
|
418
428
|
const { name } = field;
|
|
419
429
|
const value = getFieldValue(name, record);
|
|
@@ -424,12 +434,14 @@ const TableCell = ({ record, field, isH5, supportManyRelated }) => {
|
|
|
424
434
|
relation: record[`@${name}`],
|
|
425
435
|
supportManyRelated,
|
|
426
436
|
isH5,
|
|
437
|
+
showRelationWithTag,
|
|
427
438
|
}
|
|
428
439
|
: {
|
|
429
440
|
modelType: 'table',
|
|
430
441
|
relation: record[`@${name}`],
|
|
431
442
|
supportManyRelated,
|
|
432
443
|
isH5,
|
|
444
|
+
showRelationWithTag,
|
|
433
445
|
};
|
|
434
446
|
return getFieldRender(field, extra)(value);
|
|
435
447
|
}, [record, field, isH5]);
|
|
@@ -440,7 +452,7 @@ const TableCell = ({ record, field, isH5, supportManyRelated }) => {
|
|
|
440
452
|
* 根据 field 属性,生成 column 配置
|
|
441
453
|
* https://git.woa.com/QBase/lcap/common-application-specs/blob/master/types/platform/datasource.ts
|
|
442
454
|
*/
|
|
443
|
-
export const formatFieldToColumn = (field, isH5, columnSets, supportManyRelated) => {
|
|
455
|
+
export const formatFieldToColumn = (field, isH5, columnSets, supportManyRelated, showRelationWithTag) => {
|
|
444
456
|
const { name, title } = field;
|
|
445
457
|
// 计算列宽度,略大于计算宽度
|
|
446
458
|
const width = getFieldWidth(field) + 10;
|
|
@@ -450,7 +462,7 @@ export const formatFieldToColumn = (field, isH5, columnSets, supportManyRelated)
|
|
|
450
462
|
width: !item || (item === null || item === void 0 ? void 0 : item.widthType) === 'auto' || isIllegalWidth
|
|
451
463
|
? width
|
|
452
464
|
: item === null || item === void 0 ? void 0 : item.width,
|
|
453
|
-
render: (record) => (_jsx(TableCell, { record: record, field: field, isH5: isH5, supportManyRelated: supportManyRelated })),
|
|
465
|
+
render: (record) => (_jsx(TableCell, { record: record, field: field, isH5: isH5, supportManyRelated: supportManyRelated, showRelationWithTag: showRelationWithTag })),
|
|
454
466
|
key: name,
|
|
455
467
|
slotKey: (item === null || item === void 0 ? void 0 : item.slotKey) || name,
|
|
456
468
|
header: title,
|
|
@@ -725,7 +737,7 @@ const TableSlotCell = ({ record, rowKey, recordIndex, column, columnIndex, slot,
|
|
|
725
737
|
* slots: object 模型表格作用域插槽
|
|
726
738
|
* isH5: 判断自定义插槽列能否展示,目前是正常展示
|
|
727
739
|
*/
|
|
728
|
-
export const filterCustomColumns = ({ columns, columnSets, slots, fields, isH5, supportManyRelated, }) => {
|
|
740
|
+
export const filterCustomColumns = ({ columns, columnSets, slots, fields, isH5, supportManyRelated, showRelationWithTag, }) => {
|
|
729
741
|
if (!Array.isArray(columnSets) || !(columnSets === null || columnSets === void 0 ? void 0 : columnSets.length))
|
|
730
742
|
return columns;
|
|
731
743
|
const columnSetsReg = columnSets.map((item) => {
|
|
@@ -774,6 +786,7 @@ export const filterCustomColumns = ({ columns, columnSets, slots, fields, isH5,
|
|
|
774
786
|
rowId: record._id,
|
|
775
787
|
supportManyRelated,
|
|
776
788
|
isH5,
|
|
789
|
+
showRelationWithTag,
|
|
777
790
|
}
|
|
778
791
|
: {
|
|
779
792
|
modelType: 'table',
|
|
@@ -782,6 +795,7 @@ export const filterCustomColumns = ({ columns, columnSets, slots, fields, isH5,
|
|
|
782
795
|
rowId: record._id,
|
|
783
796
|
supportManyRelated,
|
|
784
797
|
isH5,
|
|
798
|
+
showRelationWithTag,
|
|
785
799
|
};
|
|
786
800
|
const value = getFieldValue(key, record, relatedField, isMany(_oriField));
|
|
787
801
|
const component = getFieldRender(field, extra)(value);
|
|
@@ -897,12 +911,13 @@ export const getFixedColumnSets = ({ fixedFront = '', fixedEnd = '', columnSets,
|
|
|
897
911
|
/**
|
|
898
912
|
* 列管理字段转换
|
|
899
913
|
*/
|
|
900
|
-
export const getTableColumns = ({ fields, columnSets, slots, fixedFront, fixedEnd, isH5, supportManyRelated, }) => {
|
|
914
|
+
export const getTableColumns = ({ fields, columnSets, slots, fixedFront, fixedEnd, isH5, supportManyRelated, showRelationWithTag = true, }) => {
|
|
901
915
|
const defaultColumns = getColumns({
|
|
902
916
|
columnSets,
|
|
903
917
|
fields,
|
|
904
918
|
isH5: false,
|
|
905
919
|
supportManyRelated,
|
|
920
|
+
showRelationWithTag,
|
|
906
921
|
});
|
|
907
922
|
let fixedColumnSets = columnSets;
|
|
908
923
|
// h5端不冻结
|
|
@@ -920,6 +935,7 @@ export const getTableColumns = ({ fields, columnSets, slots, fixedFront, fixedEn
|
|
|
920
935
|
fields,
|
|
921
936
|
isH5,
|
|
922
937
|
supportManyRelated,
|
|
938
|
+
showRelationWithTag,
|
|
923
939
|
});
|
|
924
940
|
return baseColumns.map((i) => ({
|
|
925
941
|
...i,
|
|
@@ -220,7 +220,7 @@ enablePagination = true, columnSelectType = 'select', defaultPageIndex = _defaul
|
|
|
220
220
|
const renderTable = () => {
|
|
221
221
|
return (_jsx(Table, { events: events, emptyText: emptyText, isH5: isH5, isNoDataSourceBind: isNoDataSourceBind, className: `${tableClassList} modal-table`, recordKey: recordKey, currentSize: tableHightSize, defaultPageIndex: defaultPageIndex, defaultPageSize: defaultPageSize, sortColumns: sortColumns, enablePagination: !isH5 && enablePagination, columnSelectType: columnSelectType, columns: columns, records: tableRecords, sort: queryParams.sort, selectedKeys: [], onSelectChange: () => { }, isError: false, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, setColumns: undefined, onQueryChange: (query) => {
|
|
222
222
|
setQueryParams({ ...queryParams, ...query });
|
|
223
|
-
}, rowClick: () => { }, errorObj: errorObj }));
|
|
223
|
+
}, rowClick: () => { }, cellClick: () => { }, errorObj: errorObj }));
|
|
224
224
|
};
|
|
225
225
|
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(EnumHoc, { fields: authFields, children: _jsx("div", { className: classNames(wrapClassList, className), style: style, id: id, children: renderTable() }) }) }));
|
|
226
226
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
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, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot, }: {
|
|
2
|
+
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, }: {
|
|
3
3
|
events: any;
|
|
4
4
|
recordKey: any;
|
|
5
5
|
className: any;
|
|
@@ -22,13 +22,14 @@ export declare const BaseTableCom: ({ events, recordKey, className, columns, set
|
|
|
22
22
|
defaultPageSize: any;
|
|
23
23
|
defaultPageIndex: any;
|
|
24
24
|
rowClick: any;
|
|
25
|
+
cellClick: any;
|
|
25
26
|
currentSize: any;
|
|
26
27
|
isNoDataSourceBind: any;
|
|
27
28
|
isH5: any;
|
|
28
29
|
emptyText: any;
|
|
29
30
|
__innerSlot?: React.ReactNode;
|
|
30
31
|
}) => JSX.Element;
|
|
31
|
-
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, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot, }: {
|
|
32
|
+
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, }: {
|
|
32
33
|
events: any;
|
|
33
34
|
recordKey: any;
|
|
34
35
|
className: any;
|
|
@@ -51,6 +52,7 @@ export declare const BaseTable: React.MemoExoticComponent<({ events, recordKey,
|
|
|
51
52
|
defaultPageSize: any;
|
|
52
53
|
defaultPageIndex: any;
|
|
53
54
|
rowClick: any;
|
|
55
|
+
cellClick: any;
|
|
54
56
|
currentSize: any;
|
|
55
57
|
isNoDataSourceBind: any;
|
|
56
58
|
isH5: any;
|
|
@@ -33,7 +33,7 @@ const renderStatus = ({ isH5, status, isNoDataSourceBind, _emptyText, errorObj,
|
|
|
33
33
|
// eslint-disable-next-line complexity
|
|
34
34
|
export const BaseTableCom = ({ events, recordKey, className, columns, setColumns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, errorObj, isLoading, queryParams, total = defaultTotal,
|
|
35
35
|
// refreshTable,
|
|
36
|
-
onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot = (_jsx(_Fragment, {})), }) => {
|
|
36
|
+
onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, cellClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, __innerSlot = (_jsx(_Fragment, {})), }) => {
|
|
37
37
|
var _a;
|
|
38
38
|
const inEditor = isInIde();
|
|
39
39
|
const tableRef = useRef(null);
|
|
@@ -87,8 +87,17 @@ onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageI
|
|
|
87
87
|
: undefined,
|
|
88
88
|
},
|
|
89
89
|
className: rowColor ? 'modal-table-rowcolor' : '',
|
|
90
|
-
onClick: () => {
|
|
91
|
-
rowClick
|
|
90
|
+
onClick: (e) => {
|
|
91
|
+
if (rowClick) {
|
|
92
|
+
rowClick(e, context);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
96
|
+
cell: (props, context) => ({
|
|
97
|
+
onClick: (e) => {
|
|
98
|
+
if (cellClick) {
|
|
99
|
+
cellClick(e, context);
|
|
100
|
+
}
|
|
92
101
|
},
|
|
93
102
|
}),
|
|
94
103
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
2
2
|
const defaultPage = 1;
|
|
3
3
|
const getDataBase = (format, fields) => {
|
|
4
4
|
const filter = fields.filter((item) => (item === null || item === void 0 ? void 0 : item.format) === format);
|
|
@@ -37,41 +37,69 @@ export const mapResult = (records, primaryColumn) => {
|
|
|
37
37
|
return records === null || records === void 0 ? void 0 : records.map((childItem) => ({
|
|
38
38
|
value: childItem._id,
|
|
39
39
|
text: childItem[primaryColumn] ? childItem[primaryColumn] : childItem._id,
|
|
40
|
+
label: childItem[primaryColumn] ? childItem[primaryColumn] : childItem._id,
|
|
41
|
+
extra: childItem,
|
|
40
42
|
}));
|
|
41
43
|
};
|
|
42
44
|
export const useChooseList = ({ dataSourceAPI, queryParams, childDbName, primaryColumn, value, }) => {
|
|
43
45
|
const [option, setOption] = useState([]);
|
|
44
46
|
const [total, setTotal] = useState(0);
|
|
45
47
|
const [loading, setLoading] = useState(true);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
const unshiftVal = (transformedRecords, itemResult) => {
|
|
49
|
+
if (itemResult &&
|
|
50
|
+
transformedRecords.findIndex((item) => item._id === itemResult._id) < 0 &&
|
|
51
|
+
option.findIndex((item) => item._id === itemResult._id) < 0) {
|
|
52
|
+
return [itemResult, ...transformedRecords];
|
|
53
|
+
}
|
|
54
|
+
return transformedRecords;
|
|
55
|
+
};
|
|
56
|
+
const fetchData = useCallback(async () => {
|
|
57
|
+
setLoading(true);
|
|
58
|
+
const isMultiple = Array.isArray(value);
|
|
59
|
+
const promiseList = [
|
|
60
|
+
dataSourceAPI.getRecordList(queryParams, {
|
|
61
|
+
db: childDbName,
|
|
62
|
+
}),
|
|
63
|
+
];
|
|
64
|
+
if (value === null || value === void 0 ? void 0 : value.length) {
|
|
65
|
+
if (isMultiple) {
|
|
66
|
+
value.forEach((i) => {
|
|
67
|
+
if (i) {
|
|
68
|
+
promiseList.push(dataSourceAPI.getRecord(i, {
|
|
69
|
+
db: childDbName,
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
63
73
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
else {
|
|
75
|
+
promiseList.push(dataSourceAPI.getRecord(value, {
|
|
76
|
+
db: childDbName,
|
|
77
|
+
}));
|
|
67
78
|
}
|
|
68
|
-
setOption(optionRes);
|
|
69
|
-
setTotal(result === null || result === void 0 ? void 0 : result.total);
|
|
70
|
-
setLoading(false);
|
|
71
79
|
}
|
|
72
|
-
|
|
80
|
+
const [result, ...rest] = await Promise.all(promiseList);
|
|
81
|
+
let transformedRecords = [...((result === null || result === void 0 ? void 0 : result.records) || [])];
|
|
82
|
+
const itemResult = [...rest];
|
|
83
|
+
// 若下拉列表中无选中值,则将选中值插到数组头部
|
|
84
|
+
if ((isMultiple && (value === null || value === void 0 ? void 0 : value.length)) || value) {
|
|
85
|
+
itemResult.forEach((i) => {
|
|
86
|
+
transformedRecords = unshiftVal(transformedRecords, i);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
let optionRes = mapResult(transformedRecords, primaryColumn);
|
|
90
|
+
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageNo) > defaultPage) {
|
|
91
|
+
optionRes = [...option, ...optionRes];
|
|
92
|
+
}
|
|
93
|
+
setOption(optionRes);
|
|
94
|
+
setTotal(result === null || result === void 0 ? void 0 : result.total);
|
|
95
|
+
setLoading(false);
|
|
73
96
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
|
-
}, [childDbName, queryParams]);
|
|
97
|
+
}, [childDbName, primaryColumn, queryParams]);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (childDbName) {
|
|
100
|
+
fetchData();
|
|
101
|
+
}
|
|
102
|
+
}, [childDbName, fetchData]);
|
|
75
103
|
return {
|
|
76
104
|
result: option || [],
|
|
77
105
|
total: total,
|
|
@@ -79,5 +107,6 @@ export const useChooseList = ({ dataSourceAPI, queryParams, childDbName, primary
|
|
|
79
107
|
empty: () => {
|
|
80
108
|
setOption([]);
|
|
81
109
|
},
|
|
110
|
+
getRelationOptions: fetchData,
|
|
82
111
|
};
|
|
83
112
|
};
|
|
@@ -674,13 +674,13 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
674
674
|
}, [isH5]);
|
|
675
675
|
const hasFilterButton = !!filterFieldsData.length && !isExpression;
|
|
676
676
|
// 行点击事件
|
|
677
|
-
const rowClick = (context) => {
|
|
677
|
+
const rowClick = (e, context) => {
|
|
678
678
|
if (events === null || events === void 0 ? void 0 : events.tabTableRow) {
|
|
679
679
|
events.tabTableRow({
|
|
680
680
|
record: context.record,
|
|
681
681
|
rowKey: context.rowKey,
|
|
682
682
|
recordIndex: context.recordIndex,
|
|
683
|
-
});
|
|
683
|
+
}, { originEvent: e });
|
|
684
684
|
}
|
|
685
685
|
setRowData({
|
|
686
686
|
record: context.record,
|
|
@@ -688,6 +688,11 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
688
688
|
recordIndex: context.recordIndex,
|
|
689
689
|
});
|
|
690
690
|
};
|
|
691
|
+
const cellClick = (e, context) => {
|
|
692
|
+
if (events === null || events === void 0 ? void 0 : events.cellClick) {
|
|
693
|
+
events.cellClick(context, { originEvent: e });
|
|
694
|
+
}
|
|
695
|
+
};
|
|
691
696
|
// 选择事件
|
|
692
697
|
const onSelectChange = (keys, context, empty = false) => {
|
|
693
698
|
if (empty) {
|
|
@@ -750,7 +755,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
750
755
|
enableTableHeightSizeBtn ||
|
|
751
756
|
hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: onRefreshBtnClick, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
|
|
752
757
|
setOpenMobileFilter(true);
|
|
753
|
-
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(Table, { 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: columns, setColumns: setColumns, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: onSelectChange, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, onQueryChange: onQueryChange, rowClick: rowClick, isError: errorStatus, errorObj: errorMsg, __innerSlot: __innerSlot }), 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: {
|
|
758
|
+
}, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(Table, { 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: columns, 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 }), 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: {
|
|
754
759
|
close: () => {
|
|
755
760
|
setIsMobileOptionVisible(false);
|
|
756
761
|
},
|
|
@@ -26,7 +26,7 @@ export const WdTextarea = forwardRef(function WdTextarea(props, ref) {
|
|
|
26
26
|
const size = useSize(props);
|
|
27
27
|
const textareaRef = useRef(null);
|
|
28
28
|
const counter = typeof value === 'string' ? value.length : 0;
|
|
29
|
-
const
|
|
29
|
+
const [isFocus, setIsFocus] = useState(focus);
|
|
30
30
|
const root = `${classPrefix}-${classRoot}`;
|
|
31
31
|
const inputWrap = `${classPrefix}-form-input-wrap`;
|
|
32
32
|
const textareaWrap = `${classPrefix}-form-textarea-wrap`;
|
|
@@ -34,6 +34,7 @@ export const WdTextarea = forwardRef(function WdTextarea(props, ref) {
|
|
|
34
34
|
'size-width-hundred': true,
|
|
35
35
|
'is-disabled': disabled,
|
|
36
36
|
'textarea-restriction': counterVisible,
|
|
37
|
+
'is-focused': isFocus,
|
|
37
38
|
});
|
|
38
39
|
const countCls = `${textareaWrap}__label ${root}-${classRoot}__count-text`;
|
|
39
40
|
const displayValue = (_a = (zhRef.current ? zhValue : value)) !== null && _a !== void 0 ? _a : '';
|
|
@@ -71,10 +72,12 @@ export const WdTextarea = forwardRef(function WdTextarea(props, ref) {
|
|
|
71
72
|
};
|
|
72
73
|
const onFocus = function (e) {
|
|
73
74
|
var _a;
|
|
75
|
+
setIsFocus(true);
|
|
74
76
|
(_a = events.focus) === null || _a === void 0 ? void 0 : _a.call(events, { value: e.target.value }, { originEvent: e });
|
|
75
77
|
};
|
|
76
78
|
const onBlur = function (e) {
|
|
77
79
|
var _a;
|
|
80
|
+
setIsFocus(false);
|
|
78
81
|
(_a = events.blur) === null || _a === void 0 ? void 0 : _a.call(events, { value: e.target.value }, { originEvent: e });
|
|
79
82
|
};
|
|
80
83
|
const handleZhStart = () => {
|
|
@@ -105,5 +108,5 @@ export const WdTextarea = forwardRef(function WdTextarea(props, ref) {
|
|
|
105
108
|
disabled,
|
|
106
109
|
readOnly,
|
|
107
110
|
}), [innerHandle, name, value, label, required, visible, disabled, readOnly]);
|
|
108
|
-
return (visible && (_jsx(WdFormItem, { ...props, validateErrorMsg: validateErrorMsg, validateState: validateState, readOnly: readOnly, disabled: disabled, readValue: value, classRoot: classRoot, inputId: inputId, layout: props.layout, children: _jsxs("div", { className: cls,
|
|
111
|
+
return (visible && (_jsx(WdFormItem, { ...props, validateErrorMsg: validateErrorMsg, validateState: validateState, readOnly: readOnly, disabled: disabled, readValue: value, classRoot: classRoot, inputId: inputId, layout: props.layout, children: _jsxs("div", { className: cls, children: [_jsx("textarea", { id: inputId, ref: textareaRef, rows: 2, placeholder: placeholder, name: name, value: displayValue, maxLength: maxLength, autoFocus: focus, disabled: disabled, readOnly: readOnly, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: handleKeyDown, onCompositionStart: handleZhStart, onCompositionEnd: handleZhEnd, ...startWithOnProps }), counterVisible && (_jsxs("label", { className: countCls, children: [counter, "/", maxLength] }))] }) })));
|
|
109
112
|
});
|
|
@@ -284,12 +284,12 @@ export const textToString = (text) => {
|
|
|
284
284
|
* 统一错误提示
|
|
285
285
|
*/
|
|
286
286
|
export function alertErrorMessage({ message, duration = 3000, icon = 'none' }) {
|
|
287
|
-
var _a, _b, _c, _d, _e;
|
|
287
|
+
var _a, _b, _c, _d, _e, _f;
|
|
288
288
|
const smallScreen = (_b = (_a = window === null || window === void 0 ? void 0 : window.matchMedia('(max-width: 768px)')) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : isH5Platform();
|
|
289
289
|
const touchDevice = (_d = (_c = window === null || window === void 0 ? void 0 : window.matchMedia('(pointer:coarse)')) === null || _c === void 0 ? void 0 : _c.matches) !== null && _d !== void 0 ? _d : smallScreen;
|
|
290
290
|
const platform = touchDevice || smallScreen ? 'h5' : 'pc';
|
|
291
|
-
if (platform === 'h5') {
|
|
292
|
-
(
|
|
291
|
+
if (platform === 'h5' && ((_e = window === null || window === void 0 ? void 0 : window.app) === null || _e === void 0 ? void 0 : _e.showToast)) {
|
|
292
|
+
(_f = window === null || window === void 0 ? void 0 : window.app) === null || _f === void 0 ? void 0 : _f.showToast({
|
|
293
293
|
title: message,
|
|
294
294
|
icon,
|
|
295
295
|
duration,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
"!.temp/dist/*.map"
|
|
275
275
|
],
|
|
276
276
|
"webpack": false,
|
|
277
|
-
"limit": "
|
|
277
|
+
"limit": "950 KB"
|
|
278
278
|
}
|
|
279
279
|
],
|
|
280
280
|
"nyc": {
|