@cloudbase/weda-ui 3.9.7 → 3.10.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/dataView.d.ts +31 -0
- package/dist/configs/components/dataView.js +53 -16
- package/dist/configs/components/grid/col.d.ts +1 -1
- package/dist/configs/components/grid/col.js +1 -1
- package/dist/configs/components/grid/grid.d.ts +1 -1
- package/dist/configs/components/grid/grid.js +1 -1
- package/dist/configs/components/grid/row.d.ts +1 -1
- package/dist/configs/components/grid/row.js +1 -1
- package/dist/configs/components/listView.d.ts +148 -444
- package/dist/configs/components/listView.js +991 -703
- package/dist/configs/components/wd-bubble.d.ts +6 -6
- package/dist/configs/components/wd-cascader.d.ts +1 -1
- package/dist/configs/components/wd-checkbox.d.ts +1 -1
- package/dist/configs/components/wd-code-editor.d.ts +1 -1
- package/dist/configs/components/wd-date-range.d.ts +1 -1
- package/dist/configs/components/wd-date.d.ts +1 -1
- package/dist/configs/components/wd-department.d.ts +1 -1
- package/dist/configs/components/wd-form-arr.d.ts +1 -1
- package/dist/configs/components/wd-form-detail.d.ts +1 -1
- package/dist/configs/components/wd-form-obj.d.ts +1 -1
- package/dist/configs/components/wd-form.js +2 -1
- package/dist/configs/components/wd-input-email.d.ts +4 -3
- package/dist/configs/components/wd-input-number.d.ts +2 -2
- package/dist/configs/components/wd-input-phone.d.ts +4 -3
- package/dist/configs/components/wd-input-url.d.ts +4 -3
- package/dist/configs/components/wd-input.d.ts +3 -1
- package/dist/configs/components/wd-location.d.ts +1 -1
- package/dist/configs/components/wd-member.d.ts +1 -1
- package/dist/configs/components/wd-modal.js +2 -0
- package/dist/configs/components/wd-progress.d.ts +2 -2
- package/dist/configs/components/wd-radio.d.ts +1 -1
- package/dist/configs/components/wd-rating.d.ts +2 -2
- package/dist/configs/components/wd-region.d.ts +1 -1
- package/dist/configs/components/wd-rich-text.d.ts +1 -1
- package/dist/configs/components/wd-select-multiple.d.ts +18 -1
- package/dist/configs/components/wd-select-multiple.js +17 -1
- package/dist/configs/components/wd-select.d.ts +18 -1
- package/dist/configs/components/wd-select.js +16 -0
- package/dist/configs/components/wd-side-tab.d.ts +12 -0
- package/dist/configs/components/wd-side-tab.js +47 -3
- package/dist/configs/components/wd-switch.d.ts +2 -2
- package/dist/configs/components/wd-table.d.ts +4 -4
- package/dist/configs/components/wd-table.js +2 -1
- package/dist/configs/components/wd-tag-select.d.ts +3 -3
- package/dist/configs/components/wd-tag.d.ts +21 -21
- package/dist/configs/components/wd-textarea.d.ts +8 -1
- package/dist/configs/components/wd-textarea.js +1 -0
- package/dist/configs/components/wd-time.d.ts +1 -1
- package/dist/configs/components/wd-top-tab.d.ts +12 -0
- package/dist/configs/components/wd-top-tab.js +47 -3
- package/dist/configs/components/wd-upload-file.d.ts +5 -1
- package/dist/configs/components/wd-upload-file.js +15 -0
- package/dist/configs/components/wd-upload-image.d.ts +1 -1
- package/dist/configs/index.d.ts +883 -1407
- package/dist/configs/type-utils/index.d.ts +1 -1
- package/dist/configs/type-utils/type-form.d.ts +29 -14
- package/dist/configs/type-utils/type-form.js +43 -10
- package/dist/configs/type-utils/x-runtime-default.d.ts +6 -0
- package/dist/configs/type-utils/x-runtime-default.js +6 -0
- package/dist/configs/utils/constants.d.ts +2 -0
- package/dist/configs/utils/constants.js +3 -0
- package/dist/configs/utils/get-combinations.d.ts +1 -0
- package/dist/configs/utils/get-combinations.js +13 -0
- package/dist/style/components/grid/grid.css +1288 -0
- package/dist/style/index.css +10478 -0
- package/dist/style/index.scss +1 -1
- package/dist/style/weda-ui.min.css +4 -0
- package/dist/web/actions/showMessage/index.js +5 -0
- package/dist/web/components/carousel/index.js +5 -0
- package/dist/web/components/chart/common/core/eChartBase.js +5 -0
- package/dist/web/components/chart/statisticsCard/index.js +6 -1
- package/dist/web/components/form/form/index.js +9 -1
- package/dist/web/components/form/location/common/mapChoose.js +17 -3
- package/dist/web/components/form/location/common/mapView.js +18 -5
- package/dist/web/components/form/select/dropdown-select/h5.d.ts +3 -1
- package/dist/web/components/form/select/dropdown-select/h5.js +20 -20
- package/dist/web/components/form/select/dropdown-select/index.css +8 -0
- package/dist/web/components/form/select/dropdown-select/index.d.ts +6 -1
- package/dist/web/components/form/select/dropdown-select/index.js +64 -30
- package/dist/web/components/form/select/dropdown-select/pc.d.ts +2 -1
- package/dist/web/components/form/select/dropdown-select/pc.js +3 -3
- package/dist/web/components/form/select/dropdown-select/ui.d.ts +5 -0
- package/dist/web/components/form/select/dropdown-select/ui.js +8 -4
- package/dist/web/components/form/select/formats-util.d.ts +1 -0
- package/dist/web/components/form/select/formats-util.js +8 -0
- package/dist/web/components/form/select/h5.d.ts +1 -1
- package/dist/web/components/form/select/h5.js +6 -3
- package/dist/web/components/form/select/index.css +34 -3
- package/dist/web/components/form/select/index.d.ts +3 -0
- package/dist/web/components/form/select/index.js +6 -3
- package/dist/web/components/form/select/region/index.js +5 -1
- package/dist/web/components/form/select/request.js +2 -1
- package/dist/web/components/form/select/status/index.d.ts +2 -0
- package/dist/web/components/form/select/status/index.js +2 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/h5.d.ts +3 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/h5.js +31 -31
- package/dist/web/components/form/selectMultiple/dropdown-select/index.css +23 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/index.d.ts +6 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/index.js +58 -24
- package/dist/web/components/form/selectMultiple/dropdown-select/pc.d.ts +2 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/pc.js +2 -2
- package/dist/web/components/form/selectMultiple/dropdown-select/ui.d.ts +5 -0
- package/dist/web/components/form/selectMultiple/dropdown-select/ui.js +7 -5
- package/dist/web/components/form/selectMultiple/h5.d.ts +1 -1
- package/dist/web/components/form/selectMultiple/h5.js +6 -3
- package/dist/web/components/form/selectMultiple/index.d.ts +5 -0
- package/dist/web/components/form/selectMultiple/index.js +7 -4
- package/dist/web/components/form/selectMultiple/request.js +2 -1
- package/dist/web/components/form/selectMultiple/status/index.d.ts +2 -0
- package/dist/web/components/form/selectMultiple/status/index.js +2 -0
- package/dist/web/components/form/uploader/index.css +26 -0
- package/dist/web/components/form/uploader/uploader.h5.d.ts +11 -3
- package/dist/web/components/form/uploader/uploader.h5.js +32 -96
- package/dist/web/components/form/uploader/uploader.pc.d.ts +9 -1
- package/dist/web/components/form/uploader/uploader.pc.js +36 -100
- package/dist/web/components/form/uploader/useUploadFile.d.ts +16 -0
- package/dist/web/components/form/uploader/useUploadFile.js +99 -0
- package/dist/web/components/form/uploader/util.d.ts +2 -0
- package/dist/web/components/form/uploader/util.js +87 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +2 -1
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +14 -4
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +2 -1
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +21 -5
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +5 -0
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +8 -0
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +6 -0
- package/dist/web/components/form-date/index.d.ts +9 -10
- package/dist/web/components/form-depart-tree-select/index.d.ts +8 -8
- package/dist/web/components/form-email/index.d.ts +12 -19
- package/dist/web/components/form-image-uploader/index.d.ts +10 -13
- package/dist/web/components/form-input/index.d.ts +4 -4
- package/dist/web/components/form-input-hooks/index.js +7 -1
- package/dist/web/components/form-location/index.d.ts +8 -7
- package/dist/web/components/form-multi-region/index.d.ts +9 -10
- package/dist/web/components/form-phone/index.d.ts +12 -19
- package/dist/web/components/form-radio/index.d.ts +7 -6
- package/dist/web/components/form-region/index.d.ts +9 -10
- package/dist/web/components/form-rich-text/index.d.ts +8 -9
- package/dist/web/components/form-select/index.d.ts +12 -16
- package/dist/web/components/form-select-multiple/index.d.ts +9 -10
- package/dist/web/components/form-switch/index.d.ts +8 -7
- package/dist/web/components/form-text-area/index.d.ts +12 -19
- package/dist/web/components/form-time/index.d.ts +9 -10
- package/dist/web/components/form-upload-file/index.d.ts +10 -13
- package/dist/web/components/form-url/index.d.ts +12 -19
- package/dist/web/components/form-user-tree-select/index.d.ts +8 -8
- package/dist/web/components/grid/col.d.ts +6 -9
- package/dist/web/components/grid/grid.d.ts +6 -14
- package/dist/web/components/grid/row.d.ts +6 -12
- package/dist/web/components/listView/index.d.ts +21 -2
- package/dist/web/components/listView/index.js +0 -3
- package/dist/web/components/listView/interface.d.ts +4 -4
- package/dist/web/components/lottery/index.d.ts +13 -15
- package/dist/web/components/navigationBar/index.css +2 -1
- package/dist/web/components/richText/index.js +6 -0
- package/dist/web/components/richTextView/useImgTransform.js +6 -1
- package/dist/web/components/table/ImportFileModalByApi/index.js +6 -1
- package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +6 -1
- package/dist/web/components/wd-audio/wd-audio.js +5 -0
- package/dist/web/components/wd-canvas/wd-canvas.js +6 -1
- package/dist/web/components/wd-code-editor/wd-code-editor.js +7 -2
- package/dist/web/components/wd-date/elements/WheelPicker.js +7 -1
- package/dist/web/components/wd-form/index.d.ts +26 -40
- package/dist/web/components/wd-form/index.js +9 -2
- package/dist/web/components/wd-form-item/wd-form-item-read-only.d.ts +2 -0
- package/dist/web/components/wd-form-item/wd-form-item-read-only.js +15 -2
- package/dist/web/components/wd-form-item/wd-form-item.js +4 -3
- package/dist/web/components/wd-input/wd-input.d.ts +20 -42
- package/dist/web/components/wd-input-email/wd-input-email.d.ts +19 -41
- package/dist/web/components/wd-input-phone/wd-input-phone.d.ts +20 -42
- package/dist/web/components/wd-input-url/wd-input-url.d.ts +19 -41
- package/dist/web/components/wd-markdown/wd-markdown.js +5 -2
- package/dist/web/components/wd-select/relationalSetting.d.ts +7 -0
- package/dist/web/components/wd-select/relationalSetting.js +15 -0
- package/dist/web/components/wd-select/wd-select.css +43 -0
- package/dist/web/components/wd-select/wd-select.d.ts +2 -0
- package/dist/web/components/wd-select/wd-select.js +25 -6
- package/dist/web/components/wd-select-multiple/wd-select-multiple.css +4 -0
- package/dist/web/components/wd-select-multiple/wd-select-multiple.d.ts +6 -0
- package/dist/web/components/wd-select-multiple/wd-select-multiple.js +25 -6
- package/dist/web/components/wd-table/components/FieldRender/Form/Enum.js +18 -4
- package/dist/web/components/wd-table/components/FieldRender/index.js +34 -5
- package/dist/web/components/wd-table/utils/index.js +18 -4
- package/dist/web/components/wd-tabs/tabs-h5.js +2 -3
- package/dist/web/components/wd-tabs/tabs-pc.js +2 -3
- package/dist/web/components/wd-tabs/util.d.ts +1 -0
- package/dist/web/components/wd-tabs/util.js +21 -0
- package/dist/web/components/wd-textarea/wd-textarea.js +11 -1
- package/dist/web/components/wd-unified-link/utils.js +1 -1
- package/dist/web/components/wd-upload-file/wd-upload-file.js +2 -2
- package/dist/web/components/web-view/web-view.d.ts +14 -20
- package/dist/web/utils/color.js +5 -0
- package/dist/web/utils/datasource.js +30 -20
- package/dist/web/utils/error.d.ts +3 -1
- package/dist/web/utils/error.js +9 -4
- package/dist/web/utils/file.js +4 -1
- package/dist/web/utils/getModelParams.js +27 -2
- package/dist/web/utils/hooks/EnumHoc.js +3 -1
- package/dist/web/utils/hooks/useRecycle.d.ts +4 -0
- package/dist/web/utils/loadIconCss.js +2 -1
- package/dist/web/utils/moment.js +2 -1
- package/dist/web/utils/platform.js +5 -2
- package/dist/web/utils/tcb.js +5 -3
- package/dist/web/weda-ui.css +8 -4
- package/package.json +8 -3
|
@@ -27,7 +27,7 @@ startDate, endDate, defaultDate,
|
|
|
27
27
|
// time mode
|
|
28
28
|
startTime, endTime, defaultTime,
|
|
29
29
|
// region mode
|
|
30
|
-
defaultRegion, defaultMutiRegion, separator, regionType, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, }) {
|
|
30
|
+
defaultRegion, defaultMutiRegion, separator, regionType, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, childRef, addRelationButtonText, enableAddRelationButton, }) {
|
|
31
31
|
var _a;
|
|
32
32
|
const { classPrefix } = useConfig();
|
|
33
33
|
const [date, setDate] = React.useState(decodeIsoDatetime(defaultDate, 'date', dateMode));
|
|
@@ -339,14 +339,17 @@ defaultRegion, defaultMutiRegion, separator, regionType, clearable = false, onCh
|
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
341
|
if (mode === 'selector') {
|
|
342
|
-
return (_jsx(PureSelectH5, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value, triggerEvent = false) => {
|
|
342
|
+
return (_jsx(PureSelectH5, { childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, staticSearchable: staticSearchable, ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value, triggerEvent = false) => {
|
|
343
343
|
var _a;
|
|
344
344
|
setSelectedValue(value);
|
|
345
345
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
346
346
|
if (triggerEvent) {
|
|
347
347
|
(_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
348
348
|
}
|
|
349
|
-
}, onSearchValueInput: onSearchValueInput
|
|
349
|
+
}, onSearchValueInput: onSearchValueInput, onAddRelationButtonClick: () => {
|
|
350
|
+
var _a;
|
|
351
|
+
(_a = events === null || events === void 0 ? void 0 : events.onAddRelationButtonClick) === null || _a === void 0 ? void 0 : _a.call(events);
|
|
352
|
+
} }));
|
|
350
353
|
}
|
|
351
354
|
return (_jsx(WdFormItemReadOnly, { readValue: readValue, children: readOnly ? (_jsx("div", { className: classNames('weui-cell', `${classPrefix}-form-read-color`), children: readValue })) : (_jsx("div", { className: subCls, children: _jsxs("div", { className: `weui-cell__bd weui-flex ${clearCls}`, children: [_jsx("input", { onClick: onClick, className: "weui-input", type: "select", name: name, placeholder: placeholder, value: readValue, disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select" }), hasClearMode && (_jsx(WdIcon, { name: "td:close-circle-filled", onClick: (e) => {
|
|
352
355
|
var _a;
|
|
@@ -59,6 +59,14 @@
|
|
|
59
59
|
.wedatea2td-search--icon-front
|
|
60
60
|
.wedatea2td-input--search:focus,
|
|
61
61
|
:root
|
|
62
|
+
.wedatea2td-dropdown-box
|
|
63
|
+
.wedatea2td-search--simple
|
|
64
|
+
.wedatea2td-input--search:focus,
|
|
65
|
+
:host
|
|
66
|
+
.wedatea2td-dropdown-box
|
|
67
|
+
.wedatea2td-search--icon-front
|
|
68
|
+
.wedatea2td-input--search:focus,
|
|
69
|
+
:host
|
|
62
70
|
.wedatea2td-dropdown-box
|
|
63
71
|
.wedatea2td-search--simple
|
|
64
72
|
.wedatea2td-input--search:focus {
|
|
@@ -69,12 +77,35 @@
|
|
|
69
77
|
.weda-ui-custom-picker__cloumn-item.is-selected,
|
|
70
78
|
:root .weda-ui-custom-search__btn-cancle,
|
|
71
79
|
:root .weda-ui-custom-picker__loading-icon,
|
|
72
|
-
:root .weda-ui-custom-picker__status--loading
|
|
80
|
+
:root .weda-ui-custom-picker__status--loading,
|
|
81
|
+
:host
|
|
82
|
+
.weda-ui-custom-picker__cloumns.weda-ui-custom-picker__cloumns--select
|
|
83
|
+
.weda-ui-custom-picker__cloumn-item.is-selected,
|
|
84
|
+
:host .weda-ui-custom-search__btn-cancle,
|
|
85
|
+
:host .weda-ui-custom-picker__loading-icon,
|
|
86
|
+
:host .weda-ui-custom-picker__status--loading {
|
|
73
87
|
color: var(--wd-color-brand, #0052d9);
|
|
74
88
|
}
|
|
75
|
-
:root .is-expanded .wedatea2td-dropdown-btn.wedatea2td-dropdown__header
|
|
89
|
+
:root .is-expanded .wedatea2td-dropdown-btn.wedatea2td-dropdown__header,
|
|
90
|
+
:host .is-expanded .wedatea2td-dropdown-btn.wedatea2td-dropdown__header {
|
|
76
91
|
border-color: var(--wd-color-brand, #0052d9);
|
|
77
92
|
}
|
|
78
|
-
:root .wedatea2td-list--option > li:hover
|
|
93
|
+
:root .wedatea2td-list--option > li:hover,
|
|
94
|
+
:host .wedatea2td-list--option > li:hover {
|
|
79
95
|
background-color: var(--wd-color-brand-light, #f3f3f3);
|
|
80
96
|
}
|
|
97
|
+
|
|
98
|
+
.wd-add-relation-button-wrap {
|
|
99
|
+
font-size: 14px;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
margin-right: 20px;
|
|
103
|
+
color: var(--wd-color-brand, #0052d9);
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
}
|
|
106
|
+
.wd-add-relation-button-wrap .wd-icon {
|
|
107
|
+
margin-right: 5px;
|
|
108
|
+
}
|
|
109
|
+
.weda-ui-custom-picker__cloumns .wd-add-relation-button-wrap {
|
|
110
|
+
margin: 10px 0;
|
|
111
|
+
}
|
|
@@ -59,6 +59,9 @@ export interface PropsType extends CommonFormPropsType {
|
|
|
59
59
|
ignoreCase?: boolean;
|
|
60
60
|
staticSearchable?: boolean;
|
|
61
61
|
popupContainer?: AttachContainer;
|
|
62
|
+
childRef?: any;
|
|
63
|
+
addRelationButtonText?: string;
|
|
64
|
+
enableAddRelationButton?: boolean;
|
|
62
65
|
}
|
|
63
66
|
export declare const defaultProps: {
|
|
64
67
|
events: {};
|
|
@@ -70,7 +70,7 @@ export const defaultProps = {
|
|
|
70
70
|
separator: ',',
|
|
71
71
|
};
|
|
72
72
|
// const button = <Button type="icon" icon="more" />;
|
|
73
|
-
function SelectPc({ name, where, dataSourceName, viewId, format, primaryField, enumName, defaultValue, placeholder = '请选择', mode = 'selector', dateMode = 'day', events = emptyObject, disabled = false, range = defaultProps.range, startDate, endDate, defaultDate, defaultTime, startTime, endTime, defaultRegion, defaultMutiRegion, regionType, separator = defaultProps.separator, size = defaultProps.size, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, popupContainer, }) {
|
|
73
|
+
function SelectPc({ name, where, dataSourceName, viewId, format, primaryField, enumName, defaultValue, placeholder = '请选择', mode = 'selector', dateMode = 'day', events = emptyObject, disabled = false, range = defaultProps.range, startDate, endDate, defaultDate, defaultTime, startTime, endTime, defaultRegion, defaultMutiRegion, regionType, separator = defaultProps.separator, size = defaultProps.size, clearable = false, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, popupContainer, childRef, addRelationButtonText, enableAddRelationButton, }) {
|
|
74
74
|
const { classPrefix } = useConfig();
|
|
75
75
|
// 两次默认值不同, 需要刷新
|
|
76
76
|
const prevDefaultRef = React.useRef();
|
|
@@ -187,14 +187,17 @@ function SelectPc({ name, where, dataSourceName, viewId, format, primaryField, e
|
|
|
187
187
|
const createDropdown = () => {
|
|
188
188
|
switch (mode) {
|
|
189
189
|
case 'selector':
|
|
190
|
-
return (_jsx(PureSelectPc, { ignoreCase: ignoreCase, staticSearchable: staticSearchable, button: '', name: name, params: params, disabled: disabled, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent = false) => {
|
|
190
|
+
return (_jsx(PureSelectPc, { childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, ignoreCase: ignoreCase, staticSearchable: staticSearchable, button: '', name: name, params: params, disabled: disabled, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent = false) => {
|
|
191
191
|
var _a;
|
|
192
192
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
193
193
|
if (triggerEvent) {
|
|
194
194
|
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
195
195
|
}
|
|
196
196
|
setSelectedValue(value);
|
|
197
|
-
}, onSearchValueInput: onSearchValueInput
|
|
197
|
+
}, onSearchValueInput: onSearchValueInput, onAddRelationButtonClick: () => {
|
|
198
|
+
var _a;
|
|
199
|
+
(_a = events === null || events === void 0 ? void 0 : events.onAddRelationButtonClick) === null || _a === void 0 ? void 0 : _a.call(events);
|
|
200
|
+
} }));
|
|
198
201
|
case 'date': {
|
|
199
202
|
const start = startDate ? decodeIsoDatetime(startDate, 'date') : null;
|
|
200
203
|
const end = endDate ? decodeIsoDatetime(endDate, 'date') : null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import weui from '../../../../utils/weui';
|
|
2
2
|
import { callWedaApi } from '../../../../utils/tcb';
|
|
3
|
+
import { errorHandler } from '../../../../utils/error';
|
|
3
4
|
let tree;
|
|
4
5
|
export function getRegionTree(regionData, regionType, regionMode) {
|
|
5
6
|
tree = [];
|
|
@@ -30,7 +31,10 @@ export async function getAreaCode() {
|
|
|
30
31
|
return res === null || res === void 0 ? void 0 : res.AreaCodeList;
|
|
31
32
|
}
|
|
32
33
|
catch (error) {
|
|
33
|
-
|
|
34
|
+
errorHandler({
|
|
35
|
+
code: 'WdRegion.getAreaCodeError',
|
|
36
|
+
error,
|
|
37
|
+
});
|
|
34
38
|
return [];
|
|
35
39
|
}
|
|
36
40
|
}
|
|
@@ -73,7 +73,8 @@ export const requestFatherRelatedOption = async (params, pageNo, type, searchVal
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
const defaultData = results === null || results === void 0 ? void 0 : results.map((opt) => ({
|
|
76
|
-
|
|
76
|
+
label: opt._id,
|
|
77
|
+
value: opt._id,
|
|
77
78
|
})); // 兜底 正常来说一定有primaryField
|
|
78
79
|
return !isEmpty(defaultData)
|
|
79
80
|
? { option: defaultData, isLoadMore: false }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './style';
|
|
3
|
-
export declare function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, getIsShow, onSearchValueInput, }: {
|
|
3
|
+
export declare function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, getIsShow, onSearchValueInput, addRelationButton, portalContainer, }: {
|
|
4
4
|
updateValue: any;
|
|
5
5
|
selectedValue: any;
|
|
6
6
|
options: any;
|
|
@@ -12,4 +12,6 @@ export declare function SelectPickerH5({ updateValue, selectedValue, options, is
|
|
|
12
12
|
isShow: any;
|
|
13
13
|
getIsShow: any;
|
|
14
14
|
onSearchValueInput: any;
|
|
15
|
+
addRelationButton: any;
|
|
16
|
+
portalContainer: any;
|
|
15
17
|
}): JSX.Element;
|
|
@@ -10,7 +10,7 @@ import { PAGE_SIZE } from '../request';
|
|
|
10
10
|
import { alertErrorMessage } from '../../../../utils/platform';
|
|
11
11
|
import classNames from '../../../../utils/classnames';
|
|
12
12
|
import './style';
|
|
13
|
-
export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, getIsShow, onSearchValueInput, }) {
|
|
13
|
+
export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, getIsShow, onSearchValueInput, addRelationButton, portalContainer, }) {
|
|
14
14
|
const focusRef = useRef();
|
|
15
15
|
const contentRef = useRef();
|
|
16
16
|
const heightRef = useRef(0);
|
|
@@ -90,7 +90,7 @@ export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPage
|
|
|
90
90
|
loadMore();
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
return isShow ? (_jsx(Portal, { type: "div", disableOutsidePointerEvents: true, disableOutsideScroll: true, children: _jsxs("div", { className: "weda-ui-custom-picker", children: [_jsx("div", { className: "weda-ui-custom-backdrop", onClick: () => {
|
|
93
|
+
return isShow ? (_jsx(Portal, { type: "div", disableOutsidePointerEvents: true, disableOutsideScroll: true, portalContainer: portalContainer, children: _jsxs("div", { className: "weda-ui-custom-picker", children: [_jsx("div", { className: "weda-ui-custom-backdrop", onClick: () => {
|
|
94
94
|
setInputFocus(false);
|
|
95
95
|
setSearchValue('');
|
|
96
96
|
// confirm();
|
|
@@ -109,38 +109,38 @@ export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPage
|
|
|
109
109
|
} }))] }), _jsx("button", { className: "weda-ui-custom-search__btn-cancle", onClick: () => {
|
|
110
110
|
setInputFocus(false);
|
|
111
111
|
setSearchValue('');
|
|
112
|
-
}, children: "\u53D6\u6D88" })] }), status === Status.ALl_EMPTY ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (
|
|
112
|
+
}, children: "\u53D6\u6D88" })] }), status === Status.ALl_EMPTY ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (_jsxs("div", { className: "weda-ui-custom-picker__cloumns weda-ui-custom-picker__cloumns--select-multiple ", style: {
|
|
113
113
|
height: inputFocus ? 'calc(100vh - 160px)' : '280px',
|
|
114
|
-
}, onScroll: contentScroll, ref: contentRef, children: _jsxs("ul", { className: "weda-ui-custom-picker__cloumn", style: {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
114
|
+
}, onScroll: contentScroll, ref: contentRef, children: [_jsxs("ul", { className: "weda-ui-custom-picker__cloumn", style: {
|
|
115
|
+
height: inputFocus ? 'calc(100vh - 190px)' : '250px',
|
|
116
|
+
}, children: [options === null || options === void 0 ? void 0 : options.map((item, index) => {
|
|
117
|
+
// is-selected 选中态
|
|
118
|
+
// is-disabled 禁用态
|
|
119
|
+
const itemCls = classNames('weda-ui-custom-picker__cloumn-item', {
|
|
120
|
+
'is-selected': checkIndex(item),
|
|
121
|
+
'is-disabled': index === -1 || item.disabled,
|
|
122
|
+
});
|
|
123
|
+
return (_jsx("li", { className: itemCls, onClick: () => {
|
|
124
|
+
if (item.disabled)
|
|
125
|
+
return;
|
|
126
|
+
if (selectedValueCache &&
|
|
127
|
+
selectedValueCache.length > 49) {
|
|
128
|
+
if (selectedValueCache.indexOf(item.value) !== -1) {
|
|
129
|
+
// updateValue(item);
|
|
130
|
+
setSelectedValueCache(dealSelectedValue(item.value));
|
|
131
|
+
setInd(Math.random());
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
alertErrorMessage({
|
|
135
|
+
message: '最多选择50条数据',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
129
140
|
// updateValue(item);
|
|
130
141
|
setSelectedValueCache(dealSelectedValue(item.value));
|
|
131
142
|
setInd(Math.random());
|
|
132
143
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
message: '最多选择50条数据',
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
// updateValue(item);
|
|
141
|
-
setSelectedValueCache(dealSelectedValue(item.value));
|
|
142
|
-
setInd(Math.random());
|
|
143
|
-
}
|
|
144
|
-
}, children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text-multiple', children: item.label }) }, index));
|
|
145
|
-
}), status === Status.LOADING && (_jsx("li", { children: _jsx(Loading, {}) }, 'loading')), status === Status.ERROR && (_jsx("li", { children: _jsx(Retry, { reTry: reTry }) }, 'retry')), status === Status.EMPTY && (_jsx("li", { children: _jsx(Empty, {}) }, 'empty'))] }) }))] })] })] }) })) : null;
|
|
144
|
+
}, children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text-multiple', children: item.label }) }, index));
|
|
145
|
+
}), status === Status.LOADING && (_jsx("li", { children: _jsx(Loading, {}) }, 'loading')), status === Status.ERROR && (_jsx("li", { children: _jsx(Retry, { reTry: reTry }) }, 'retry')), status === Status.EMPTY && (_jsx("li", { children: _jsx(Empty, {}) }, 'empty'))] }), addRelationButton] }))] })] })] }) })) : null;
|
|
146
146
|
}
|
|
@@ -268,3 +268,26 @@
|
|
|
268
268
|
background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiIHZpZXdCb3g9IjAgMCA4IDgiIGZpbGw9Im5vbmUiPgo8cGF0aCBkPSJNNC4wMDAwMSA0LjgwNTMxTDYuNjk0NjkgNy40OTk5OEw3LjUgNi42OTQ2N0w0LjgwNTMyIDRMNy41IDEuMzA1MzNMNi42OTQ2OSAwLjUwMDAyM0w0LjAwMDAxIDMuMTk0NjlMMS4zMDUzMSAwLjVMMC41IDEuMzA1MzFMMy4xOTQ3IDRMMC41IDYuNjk0NjlMMS4zMDUzMSA3LjVMNC4wMDAwMSA0LjgwNTMxWiIgZmlsbD0iYmxhY2siIGZpbGwtb3BhY2l0eT0iMC45Ii8+Cjwvc3ZnPg==)
|
|
269
269
|
no-repeat center;
|
|
270
270
|
}
|
|
271
|
+
|
|
272
|
+
.wd-add-relation-button-wrap {
|
|
273
|
+
font-size: 14px;
|
|
274
|
+
display: flex;
|
|
275
|
+
align-items: center;
|
|
276
|
+
margin-right: 20px;
|
|
277
|
+
color: var(--wd-color-brand, #0052d9);
|
|
278
|
+
cursor: pointer;
|
|
279
|
+
}
|
|
280
|
+
.wd-add-relation-button-wrap .wd-icon {
|
|
281
|
+
margin-right: 5px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.weda-ui-custom-picker__cloumns {
|
|
285
|
+
display: flex;
|
|
286
|
+
flex-direction: column;
|
|
287
|
+
}
|
|
288
|
+
.weda-ui-custom-picker__cloumn {
|
|
289
|
+
width: 100%;
|
|
290
|
+
}
|
|
291
|
+
.weda-ui-custom-picker__cloumns .wd-add-relation-button-wrap {
|
|
292
|
+
margin: 10px 0;
|
|
293
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, closeModal, allOption, onSearchValueInput, ignoreCase, staticSearchable, }: {
|
|
2
|
+
export declare function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, closeModal, allOption, onSearchValueInput, ignoreCase, staticSearchable, childRef, updateStatus, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, }: {
|
|
3
3
|
params: any;
|
|
4
4
|
selectedValue: any;
|
|
5
5
|
updateValue: any;
|
|
@@ -12,4 +12,9 @@ export declare function PureSelect({ params, selectedValue, updateValue, placeho
|
|
|
12
12
|
onSearchValueInput: any;
|
|
13
13
|
ignoreCase?: boolean;
|
|
14
14
|
staticSearchable?: boolean;
|
|
15
|
+
childRef: any;
|
|
16
|
+
updateStatus?: any;
|
|
17
|
+
addRelationButtonText: any;
|
|
18
|
+
enableAddRelationButton: any;
|
|
19
|
+
onAddRelationButtonClick: any;
|
|
15
20
|
}): JSX.Element;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState, useCallback, useImperativeHandle, } from 'react';
|
|
3
3
|
import { SelectPickerH5 } from './h5';
|
|
4
4
|
import { formatNeedDataFetch, PAGE_SIZE, requestFatherRelatedOption, RequestOptionType, transFormatTeaSelectKey, } from '../request';
|
|
5
5
|
import SelectPickerPc from './pc';
|
|
6
6
|
import { usePlatform } from '../../../../utils/platform';
|
|
7
|
-
import { Status } from '../status';
|
|
7
|
+
import { Status, Loading } from '../status';
|
|
8
8
|
import { useDeepCompareEffect } from '@react-hookz/web';
|
|
9
9
|
import { useRecycle } from '../../../../utils/hooks/useRecycle';
|
|
10
|
-
|
|
10
|
+
import { errorHandler } from '../../../../utils/error';
|
|
11
|
+
import WdIcon from '../../../wd-icon';
|
|
12
|
+
export function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, closeModal, allOption, onSearchValueInput, ignoreCase = true, staticSearchable = true, childRef, updateStatus = undefined, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, }) {
|
|
11
13
|
const isRequestingRef = useRef(false);
|
|
12
14
|
const [status, setStatus] = useState(Status.ALl_EMPTY);
|
|
15
|
+
const [refreshStatus, setRefreshStatus] = useState(false);
|
|
13
16
|
const [options, setOptions] = useState([]);
|
|
14
17
|
const [page, setPage] = useState(1);
|
|
15
18
|
const [searchOptions, setSearchOptions] = useState([]);
|
|
@@ -19,8 +22,27 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
19
22
|
const [format, setFormat] = useState('');
|
|
20
23
|
const [isTurnPages, setIsTurnPages] = useState(false);
|
|
21
24
|
const platform = usePlatform();
|
|
22
|
-
const { recycleBack } = useRecycle();
|
|
25
|
+
const { recycleBack, portalContainer } = useRecycle();
|
|
23
26
|
const isSearch = useMemo(() => searchValue !== '', [searchValue]);
|
|
27
|
+
const getOptionsByRequest = useCallback((isTurnPages) => {
|
|
28
|
+
if (isTurnPages) {
|
|
29
|
+
setStatus(Status.LOADING);
|
|
30
|
+
requestFatherRelatedOption(params, 1, RequestOptionType.ALL)
|
|
31
|
+
.then((value) => {
|
|
32
|
+
setOptions(value.option);
|
|
33
|
+
if (value.option.length === 0) {
|
|
34
|
+
setStatus(platform === 'pc' ? Status.EMPTY : Status.ALl_EMPTY);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setStatus(value.isLoadMore ? Status.LOADING : Status.FINISH);
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.catch(() => {
|
|
41
|
+
setStatus(Status.ERROR);
|
|
42
|
+
})
|
|
43
|
+
.finally(() => (isRequestingRef.current = false));
|
|
44
|
+
}
|
|
45
|
+
}, [params, platform]);
|
|
24
46
|
useDeepCompareEffect(() => {
|
|
25
47
|
const { format, controlledValue } = params || {
|
|
26
48
|
format: '',
|
|
@@ -41,23 +63,7 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
41
63
|
return;
|
|
42
64
|
}
|
|
43
65
|
// 接口请求
|
|
44
|
-
|
|
45
|
-
setStatus(Status.LOADING);
|
|
46
|
-
requestFatherRelatedOption(params, 1, RequestOptionType.ALL)
|
|
47
|
-
.then((value) => {
|
|
48
|
-
setOptions(value.option);
|
|
49
|
-
if (value.option.length === 0) {
|
|
50
|
-
setStatus(platform === 'pc' ? Status.EMPTY : Status.ALl_EMPTY);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
setStatus(value.isLoadMore ? Status.LOADING : Status.FINISH);
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
.catch(() => {
|
|
57
|
-
setStatus(Status.ERROR);
|
|
58
|
-
})
|
|
59
|
-
.finally(() => (isRequestingRef.current = false));
|
|
60
|
-
}
|
|
66
|
+
getOptionsByRequest(isTurnPages);
|
|
61
67
|
}, [params]);
|
|
62
68
|
useEffect(() => {
|
|
63
69
|
if (page > 1) {
|
|
@@ -91,7 +97,13 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
})
|
|
94
|
-
.catch(() =>
|
|
100
|
+
.catch((error) => {
|
|
101
|
+
errorHandler({
|
|
102
|
+
code: 'WdSelectMultiple.requestFatherRelatedOption',
|
|
103
|
+
error,
|
|
104
|
+
});
|
|
105
|
+
isSearch ? setSearchStatus(Status.ERROR) : setStatus(Status.ERROR);
|
|
106
|
+
})
|
|
95
107
|
.finally(() => (isRequestingRef.current = false));
|
|
96
108
|
};
|
|
97
109
|
const currentStatus = useMemo(() => {
|
|
@@ -214,5 +226,27 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
214
226
|
const getIsShow = () => {
|
|
215
227
|
closeModal();
|
|
216
228
|
};
|
|
217
|
-
|
|
229
|
+
useImperativeHandle(childRef, () => {
|
|
230
|
+
return {
|
|
231
|
+
refresh: async () => {
|
|
232
|
+
setRefreshStatus(true);
|
|
233
|
+
updateStatus === null || updateStatus === void 0 ? void 0 : updateStatus(true);
|
|
234
|
+
await getOptionsByRequest(isTurnPages);
|
|
235
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
236
|
+
const timer = setTimeout(() => {
|
|
237
|
+
setRefreshStatus(false);
|
|
238
|
+
updateStatus === null || updateStatus === void 0 ? void 0 : updateStatus(false);
|
|
239
|
+
clearTimeout(timer);
|
|
240
|
+
}, 500);
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
}, [getOptionsByRequest, isTurnPages, updateStatus]);
|
|
244
|
+
const addRelationButton = isTurnPages && enableAddRelationButton && (_jsxs("span", { className: "wd-add-relation-button-wrap", onClick: onAddRelationButtonClick, children: [_jsx(WdIcon, { size: 'xs', name: 'td:add-circle' }), addRelationButtonText] }));
|
|
245
|
+
if (refreshStatus && platform === 'pc') {
|
|
246
|
+
return _jsx(Loading, {});
|
|
247
|
+
}
|
|
248
|
+
if (refreshStatus && platform === 'h5') {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
return platform === 'h5' ? (_jsx(SelectPickerH5, { portalContainer: portalContainer, addRelationButton: addRelationButton, updateValue: updateValue, options: currentOption, loadMore: loadMore, reTry: reTry, isTurnPages: isTurnPages, status: currentStatus, onSearchValue: onSearchValue, isShow: isShow, selectedValue: selectedValue, getIsShow: getIsShow, onSearchValueInput: onSearchValueInput })) : (_jsx(SelectPickerPc, { placeholder: placeholder, size: size, selectedValue: selectedValue, disabled: disabled, updateValue: updateValue, reTry: reTry, loadMore: loadMore, format: format, status: currentStatus, options: currentOption, allOptions: currentOption, onSearchValue: onSearchValue, defaultSearchValue: '', onSearchValueInput: onSearchValueInput, footer: addRelationButton }));
|
|
218
252
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './style';
|
|
3
|
-
export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, allOptions, onSearchValue, defaultSearchValue, onSearchValueInput, }: {
|
|
3
|
+
export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, allOptions, onSearchValue, defaultSearchValue, onSearchValueInput, footer, }: {
|
|
4
4
|
format: any;
|
|
5
5
|
selectedValue: any;
|
|
6
6
|
updateValue: any;
|
|
@@ -15,4 +15,5 @@ export default function SelectPickerPc({ format, selectedValue, updateValue: _up
|
|
|
15
15
|
onSearchValue: any;
|
|
16
16
|
defaultSearchValue: any;
|
|
17
17
|
onSearchValueInput: any;
|
|
18
|
+
footer: any;
|
|
18
19
|
}): JSX.Element;
|
|
@@ -11,7 +11,7 @@ import equal from '../../../../utils/isObjectEqual';
|
|
|
11
11
|
import lodashGet from 'lodash.get';
|
|
12
12
|
import { arrayToMap } from '../../../../utils/tool';
|
|
13
13
|
import './style';
|
|
14
|
-
export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, allOptions, onSearchValue, defaultSearchValue, onSearchValueInput, }) {
|
|
14
|
+
export default function SelectPickerPc({ format, selectedValue, updateValue: _updateValue, placeholder, size, disabled, reTry, loadMore, status, options, allOptions, onSearchValue, defaultSearchValue, onSearchValueInput, footer, }) {
|
|
15
15
|
const [optList, setOptList] = useState(options);
|
|
16
16
|
const findDataRef = useRef(undefined);
|
|
17
17
|
const [readValue, setReadValue] = useState([]);
|
|
@@ -72,7 +72,7 @@ export default function SelectPickerPc({ format, selectedValue, updateValue: _up
|
|
|
72
72
|
return '';
|
|
73
73
|
}
|
|
74
74
|
}, [format, status, optList]);
|
|
75
|
-
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(WdFormItemReadOnly, { readValue: readValue, children: _jsx("div", { className: 'form-select-multiple-pc', "data-testid": "form-item-select-multiple-pc", children: _jsx(SelectMultiple, { className: Array.isArray(selectedValue) && selectedValue.length > 0
|
|
75
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(WdFormItemReadOnly, { readValue: readValue, value: selectedValue, children: _jsx("div", { className: 'form-select-multiple-pc', "data-testid": "form-item-select-multiple-pc", children: _jsx(SelectMultiple, { footer: footer, className: Array.isArray(selectedValue) && selectedValue.length > 0
|
|
76
76
|
? ''
|
|
77
77
|
: 'select-multiple__placeholder', searchable: true, staging: false, autoClearSearchValue: true, clearable: true, matchButtonWidth: true, defaultSearchValue: defaultSearchValue, value: Array.isArray(selectedValue) ? selectedValue : [], placeholder: placeholder, appearance: 'button', bottomTips: isShowBottomTips, size: size, disabled: disabled, options: optList, onChange: (v) => updateValue(v, true), onScrollBottom: loadMore, button: (selectedValue) => {
|
|
78
78
|
let str = '';
|
|
@@ -12,6 +12,11 @@ interface IPureSelectProps extends Pick<SelectProps, 'size' | 'disabled' | 'plac
|
|
|
12
12
|
onSearchValueInput?: (value: string) => void;
|
|
13
13
|
ignoreCase?: boolean;
|
|
14
14
|
staticSearchable?: boolean;
|
|
15
|
+
childRef?: any;
|
|
16
|
+
enableAddRelationButton?: boolean;
|
|
17
|
+
addRelationButtonText?: string;
|
|
18
|
+
onAddRelationButtonClick?: () => void;
|
|
19
|
+
format?: boolean;
|
|
15
20
|
}
|
|
16
21
|
export declare function PureSelectPc(props: IPureSelectProps): JSX.Element;
|
|
17
22
|
export declare function PureSelectH5(props: IPureSelectProps): JSX.Element;
|
|
@@ -10,13 +10,14 @@ import { useDeepCompareEffect } from '@react-hookz/web';
|
|
|
10
10
|
import lodashGet from 'lodash.get';
|
|
11
11
|
import equal from '../../../../utils/isObjectEqual';
|
|
12
12
|
import { arrayToMap } from '../../../../utils/tool';
|
|
13
|
+
import Loading from '../status/loading';
|
|
13
14
|
export function PureSelectPc(props) {
|
|
14
|
-
const { size, onChange, value, placeholder, params, disabled, ignoreCase, staticSearchable, onSearchValueInput, } = props;
|
|
15
|
+
const { size, onChange, value, placeholder, params, disabled, ignoreCase, staticSearchable, onSearchValueInput, childRef, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, } = props;
|
|
15
16
|
const previousValueRef = useRef(value);
|
|
16
17
|
useEffect(() => {
|
|
17
18
|
previousValueRef.current = props.value;
|
|
18
19
|
}, [props.value]);
|
|
19
|
-
return (_jsx(PureSelect, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, onSearchValueInput: onSearchValueInput, updateValue: (v, triggerEvent) => {
|
|
20
|
+
return (_jsx(PureSelect, { childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, staticSearchable: staticSearchable, ignoreCase: ignoreCase, isShow: false, params: params, placeholder: placeholder, size: size, selectedValue: value, disabled: disabled, onAddRelationButtonClick: onAddRelationButtonClick, onSearchValueInput: onSearchValueInput, updateValue: (v, triggerEvent) => {
|
|
20
21
|
if (previousValueRef.current != v) {
|
|
21
22
|
if (Array.isArray(v) && v.length > 50) {
|
|
22
23
|
alertErrorMessage({ message: '最多选择50条数据' });
|
|
@@ -29,12 +30,13 @@ export function PureSelectPc(props) {
|
|
|
29
30
|
}, closeModal: undefined, allOption: () => { } }));
|
|
30
31
|
}
|
|
31
32
|
export function PureSelectH5(props) {
|
|
32
|
-
const { placeholder, name, disabled, onChange = noop, layout, className, params, ignoreCase, onSearchValueInput, staticSearchable, } = props;
|
|
33
|
+
const { placeholder, name, disabled, onChange = noop, layout, className, params, ignoreCase, onSearchValueInput, staticSearchable, childRef, addRelationButtonText, enableAddRelationButton, onAddRelationButtonClick, } = props;
|
|
33
34
|
const [value, setValue] = useSyncValue(props.value);
|
|
34
35
|
const previousValueRef = useRef(value);
|
|
35
36
|
const [currentMultiLabels, setCurrentMultiLabels] = useState([]);
|
|
36
37
|
const [allOption, setAllOption] = useState([]);
|
|
37
38
|
const [isShow, setIsShow] = useState(false);
|
|
39
|
+
const [status, setStatus] = useState(false);
|
|
38
40
|
const subCls = classNames({
|
|
39
41
|
'weui-cell': true,
|
|
40
42
|
'weui-cell_active': true,
|
|
@@ -102,12 +104,12 @@ export function PureSelectH5(props) {
|
|
|
102
104
|
const getAllOption = (val) => {
|
|
103
105
|
setAllOption(val);
|
|
104
106
|
};
|
|
105
|
-
return (_jsxs(_Fragment, { children: [_jsx(WdFormItemReadOnly, { readValue: currentMultiLabels, children: _jsx("div", { className: subCls, children: _jsxs("div", { className: "weui-cell__bd weui-flex select-picker", children: [_jsx("div", { style: { width: '100%' }, onClick: disabled ? null : onClick, children: _jsx("input", { className: "weui-input multiple weda-ui-show-label",
|
|
107
|
+
return status ? (_jsx(Loading, {})) : (_jsxs(_Fragment, { children: [_jsx(WdFormItemReadOnly, { readValue: currentMultiLabels, value: value, children: _jsx("div", { className: subCls, children: _jsxs("div", { className: "weui-cell__bd weui-flex select-picker", children: [_jsx("div", { style: { width: '100%' }, onClick: disabled ? null : onClick, children: _jsx("input", { className: "weui-input multiple weda-ui-show-label",
|
|
106
108
|
// style={{
|
|
107
109
|
// display: currentMultiLabels.length > 0 ? 'none' : 'block',
|
|
108
110
|
// }}
|
|
109
111
|
type: "select", name: name, placeholder: placeholder, value: currentMultiLabels, disabled: disabled, autoComplete: 'off', readOnly: true, "data-testid": "form-item-select-multiple" }) }), Array.isArray(currentMultiLabels) &&
|
|
110
112
|
currentMultiLabels.length > 0 && (_jsx("span", { className: 'weui-input-clear', onClick: () => {
|
|
111
113
|
onChooseCallback(null);
|
|
112
|
-
} })), _jsx("span", { className: 'weui-input-arrow' })] }) }) }), _jsx(PureSelect, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, placeholder: undefined, onSearchValueInput: onSearchValueInput, closeModal: close, allOption: getAllOption })] }));
|
|
114
|
+
} })), _jsx("span", { className: 'weui-input-arrow' })] }) }) }), _jsx(PureSelect, { onAddRelationButtonClick: onAddRelationButtonClick, childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, staticSearchable: staticSearchable, ignoreCase: ignoreCase, params: params, updateValue: onChooseCallback, selectedValue: value, isShow: isShow, size: undefined, disabled: undefined, placeholder: undefined, onSearchValueInput: onSearchValueInput, closeModal: close, allOption: getAllOption, updateStatus: setStatus })] }));
|
|
113
115
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PropsType } from './index';
|
|
3
|
-
export default function SelectH5({ events, name, placeholder, disabled, range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, staticSearchable, where, }: PropsType): JSX.Element;
|
|
3
|
+
export default function SelectH5({ events, name, placeholder, disabled, range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, staticSearchable, where, childRef, addRelationButtonText, enableAddRelationButton, }: PropsType): JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { defaultProps } from './index';
|
|
|
3
3
|
import { emptyObject } from '../../../utils/constant';
|
|
4
4
|
import { PureSelectH5 } from './dropdown-select/ui';
|
|
5
5
|
import { useSyncValue } from '../../../utils/hooks/useSyncValue';
|
|
6
|
-
export default function SelectH5({ events = emptyObject, name, placeholder, disabled = false, range = defaultProps.range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, staticSearchable, where, }) {
|
|
6
|
+
export default function SelectH5({ events = emptyObject, name, placeholder, disabled = false, range = defaultProps.range, primaryField, dataSourceName, format, onChange, onSearchValueInput, defaultValue, readOnly, ignoreCase, staticSearchable, where, childRef, addRelationButtonText, enableAddRelationButton, }) {
|
|
7
7
|
const [selectedValue, setSelectedValue] = useSyncValue(defaultValue);
|
|
8
8
|
let params = { controlledValue: range };
|
|
9
9
|
if (format === 'many-many' || format === 'one-many') {
|
|
@@ -15,10 +15,13 @@ export default function SelectH5({ events = emptyObject, name, placeholder, disa
|
|
|
15
15
|
controlledValue: range,
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
return (_jsx(PureSelectH5, { staticSearchable: staticSearchable, ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value) => {
|
|
18
|
+
return (_jsx(PureSelectH5, { childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, staticSearchable: staticSearchable, ignoreCase: ignoreCase, className: "weda-ui weda-picker", name: name, value: selectedValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, params: params, onChange: (value) => {
|
|
19
19
|
var _a;
|
|
20
20
|
setSelectedValue(value);
|
|
21
21
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
22
22
|
(_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
23
|
-
}, onSearchValueInput: onSearchValueInput
|
|
23
|
+
}, onSearchValueInput: onSearchValueInput, onAddRelationButtonClick: () => {
|
|
24
|
+
var _a;
|
|
25
|
+
(_a = events === null || events === void 0 ? void 0 : events.onAddRelationButtonClick) === null || _a === void 0 ? void 0 : _a.call(events);
|
|
26
|
+
} }));
|
|
24
27
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CommonFormPropsType } from '../types';
|
|
3
3
|
import { IUseoptionsParams } from './request';
|
|
4
|
+
import { AttachContainer } from 'tea-component/lib/_util/get-overlay-root';
|
|
4
5
|
import './style';
|
|
5
6
|
export default function SelectMultiple(props: any): JSX.Element;
|
|
6
7
|
export interface PropsType extends CommonFormPropsType {
|
|
@@ -41,6 +42,10 @@ export interface PropsType extends CommonFormPropsType {
|
|
|
41
42
|
readOnly?: boolean;
|
|
42
43
|
ignoreCase?: boolean;
|
|
43
44
|
staticSearchable?: boolean;
|
|
45
|
+
childRef?: any;
|
|
46
|
+
addRelationButtonText?: string;
|
|
47
|
+
enableAddRelationButton?: boolean;
|
|
48
|
+
popupContainer?: AttachContainer;
|
|
44
49
|
}
|
|
45
50
|
export declare const defaultProps: {
|
|
46
51
|
events: {};
|
|
@@ -54,7 +54,7 @@ export const defaultProps = {
|
|
|
54
54
|
requiredFlag: false,
|
|
55
55
|
range: [],
|
|
56
56
|
};
|
|
57
|
-
function SelectPc({ dataSourceName, format, primaryField, defaultValue, placeholder = '请选择', events = emptyObject, disabled = false, range = defaultProps.range, size = defaultProps.size, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, where, }) {
|
|
57
|
+
function SelectPc({ dataSourceName, format, primaryField, defaultValue, placeholder = '请选择', events = emptyObject, disabled = false, range = defaultProps.range, size = defaultProps.size, onChange, onSearchValueInput, readOnly, ignoreCase, staticSearchable, where, childRef, addRelationButtonText, enableAddRelationButton, popupContainer, }) {
|
|
58
58
|
const [selectedValue, setSelectedValue] = useSyncValue(defaultValue);
|
|
59
59
|
let params = { controlledValue: range };
|
|
60
60
|
if (format === 'many-many' || format === 'one-many') {
|
|
@@ -67,13 +67,16 @@ function SelectPc({ dataSourceName, format, primaryField, defaultValue, placehol
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
const createDropdown = () => {
|
|
70
|
-
return (_jsx(PureSelectPc, { ignoreCase: ignoreCase, staticSearchable: staticSearchable, params: params, disabled: disabled, readOnly: readOnly, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent) => {
|
|
70
|
+
return (_jsx(PureSelectPc, { childRef: childRef, addRelationButtonText: addRelationButtonText, enableAddRelationButton: enableAddRelationButton, ignoreCase: ignoreCase, staticSearchable: staticSearchable, params: params, disabled: disabled, readOnly: readOnly, placeholder: placeholder, size: size, value: selectedValue, onChange: (value, triggerEvent) => {
|
|
71
71
|
var _a;
|
|
72
72
|
onChange && onChange(value);
|
|
73
73
|
setSelectedValue(value);
|
|
74
74
|
triggerEvent && ((_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value }));
|
|
75
|
-
}, onSearchValueInput: onSearchValueInput
|
|
75
|
+
}, onSearchValueInput: onSearchValueInput, onAddRelationButtonClick: () => {
|
|
76
|
+
var _a;
|
|
77
|
+
(_a = events === null || events === void 0 ? void 0 : events.onAddRelationButtonClick) === null || _a === void 0 ? void 0 : _a.call(events);
|
|
78
|
+
} }));
|
|
76
79
|
};
|
|
77
80
|
const dropdown = createDropdown();
|
|
78
|
-
return _jsx(ConfigProvider, { classPrefix: "wedatea2td", children: dropdown });
|
|
81
|
+
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", popupContainer: popupContainer, children: dropdown }));
|
|
79
82
|
}
|