@cloudbase/weda-ui 3.4.12 → 3.4.14
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.js +3 -0
- package/dist/configs/components/echart.js +505 -0
- package/dist/configs/components/form-date.js +1 -1
- package/dist/configs/components/form-depart-tree-select.js +1 -1
- package/dist/configs/components/form-location.js +1 -1
- package/dist/configs/components/form-multi-region.js +1 -1
- package/dist/configs/components/form-rich-text.js +1 -1
- package/dist/configs/components/form-select-multiple.js +1 -1
- package/dist/configs/components/form-select.js +1 -1
- package/dist/configs/components/form-switch.js +1 -1
- package/dist/configs/components/form-time.js +1 -1
- package/dist/configs/components/form-user-tree-select.js +1 -1
- package/dist/configs/components/listView.js +1 -0
- package/dist/configs/components/wd-checkbox.js +1 -1
- package/dist/configs/components/wd-input.js +1 -1
- package/dist/configs/components/wd-official-account.js +1 -0
- package/dist/configs/components/wd-radio.js +1 -1
- package/dist/configs/components/wd-table.js +3 -3
- package/dist/configs/components/wd-textarea.js +1 -1
- package/dist/configs/index.js +2 -0
- package/dist/style/index.scss +1 -1
- package/dist/web/actions/showMessage/index.js +1 -1
- package/dist/web/actions/showMessage/style.js +2 -0
- package/dist/web/actions/showModal/index.js +1 -1
- package/dist/web/actions/showModal/style.js +2 -0
- package/dist/web/components/button/index.js +1 -1
- package/dist/web/components/button/style.js +2 -0
- package/dist/web/components/calendar/index.js +1 -1
- package/dist/web/components/calendar/style.js +2 -0
- package/dist/web/components/carousel/index.js +1 -1
- package/dist/web/components/carousel/style.js +2 -0
- package/dist/web/components/chart/common/echarts.js +1 -0
- package/dist/web/components/chart/statisticsCard/index.js +1 -1
- package/dist/web/components/chart/statisticsCard/style.js +2 -0
- package/dist/web/components/customer-service/customer-service.js +1 -0
- package/dist/web/components/echart/echart.js +82 -0
- package/dist/web/components/echart/index.js +3 -0
- package/dist/web/components/flow/process/constants.js +3 -1
- package/dist/web/components/form/checkbox/index.js +1 -0
- package/dist/web/components/form/checkbox/style.js +2 -0
- package/dist/web/components/form/enumSelect/index.js +2 -0
- package/dist/web/components/form/enumSelect/style.js +1 -0
- package/dist/web/components/form/form/index.js +1 -1
- package/dist/web/components/form/form/style.js +2 -0
- package/dist/web/components/form/formcell/index.js +1 -1
- package/dist/web/components/form/formcell/style.js +2 -0
- package/dist/web/components/form/input/index.js +1 -1
- package/dist/web/components/form/input/style.js +2 -0
- package/dist/web/components/form/location/common/mapChoose.js +1 -1
- package/dist/web/components/form/location/common/selectModal.js +1 -1
- package/dist/web/components/form/location/common/style.js +3 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +1 -1
- package/dist/web/components/form/location/components/LocationH5/style.js +2 -0
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +1 -1
- package/dist/web/components/form/location/components/LocationPC/style.js +2 -0
- package/dist/web/components/form/location/index.js +1 -1
- package/dist/web/components/form/location/style.js +1 -0
- package/dist/web/components/form/radio/index.js +1 -1
- package/dist/web/components/form/radio/style.js +2 -0
- package/dist/web/components/form/select/allTimePicker/calendar.js +1 -1
- package/dist/web/components/form/select/allTimePicker/index.js +1 -1
- package/dist/web/components/form/select/allTimePicker/style.js +3 -0
- package/dist/web/components/form/select/dropdown-select/h5.js +1 -1
- package/dist/web/components/form/select/dropdown-select/index.js +3 -3
- package/dist/web/components/form/select/dropdown-select/pc.js +1 -1
- package/dist/web/components/form/select/dropdown-select/style.js +2 -0
- package/dist/web/components/form/select/index.js +2 -2
- package/dist/web/components/form/select/moment-locale.js +1 -0
- package/dist/web/components/form/select/status/allEmpty.js +1 -1
- package/dist/web/components/form/select/status/empty.js +1 -1
- package/dist/web/components/form/select/status/loading.js +1 -1
- package/dist/web/components/form/select/status/retry.js +1 -1
- package/dist/web/components/form/select/status/style.js +2 -0
- package/dist/web/components/form/select/style.js +2 -0
- package/dist/web/components/form/select/year.js +1 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/h5.js +1 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/pc.js +1 -1
- package/dist/web/components/form/selectMultiple/dropdown-select/style.js +2 -0
- package/dist/web/components/form/selectMultiple/index.css +37 -0
- package/dist/web/components/form/selectMultiple/index.js +1 -0
- package/dist/web/components/form/selectMultiple/status/allEmpty.js +1 -1
- package/dist/web/components/form/selectMultiple/status/empty.js +1 -1
- package/dist/web/components/form/selectMultiple/status/loading.js +1 -1
- package/dist/web/components/form/selectMultiple/status/retry.js +1 -1
- package/dist/web/components/form/selectMultiple/status/style.js +2 -0
- package/dist/web/components/form/selectMultiple/style.js +2 -0
- package/dist/web/components/form/switch/index.js +1 -0
- package/dist/web/components/form/switch/style.js +2 -0
- package/dist/web/components/form/textarea/index.js +1 -1
- package/dist/web/components/form/textarea/style.js +2 -0
- package/dist/web/components/form/tips/index.js +1 -1
- package/dist/web/components/form/tips/style.js +3 -0
- package/dist/web/components/form/uploader/index.js +1 -1
- package/dist/web/components/form/uploader/style.js +2 -0
- package/dist/web/components/form/uploaderFile/index.js +1 -1
- package/dist/web/components/form/uploaderFile/style.js +2 -0
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +0 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +21 -7
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/style.js +3 -0
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +8 -4
- package/dist/web/components/form-checkbox/index.js +1 -0
- package/dist/web/components/form-date/index.js +1 -0
- package/dist/web/components/form-depart-tree-select/index.js +1 -0
- package/dist/web/components/form-image-uploader/index.js +1 -0
- package/dist/web/components/form-image-uploader/style.js +1 -0
- package/dist/web/components/form-input/index.js +1 -0
- package/dist/web/components/form-input-hooks/index.js +3 -2
- package/dist/web/components/form-location/index.js +1 -0
- package/dist/web/components/form-multi-region/index.js +1 -0
- package/dist/web/components/form-phone/index.js +1 -0
- package/dist/web/components/form-radio/index.js +1 -0
- package/dist/web/components/form-rich-text/index.js +1 -0
- package/dist/web/components/form-select/index.js +1 -0
- package/dist/web/components/form-select-multiple/index.js +1 -0
- package/dist/web/components/form-switch/index.js +1 -0
- package/dist/web/components/form-text-area/index.js +1 -0
- package/dist/web/components/form-time/index.js +1 -0
- package/dist/web/components/form-upload-file/index.js +1 -1
- package/dist/web/components/form-url/index.js +1 -0
- package/dist/web/components/form-user-tree-select/index.js +1 -0
- package/dist/web/components/formdetail/index.js +4 -2
- package/dist/web/components/formdetail/style.js +2 -0
- package/dist/web/components/graphicCard/index.js +1 -1
- package/dist/web/components/graphicCard/style.js +2 -0
- package/dist/web/components/grid/col.js +1 -1
- package/dist/web/components/grid/grid.js +1 -2
- package/dist/web/components/grid/row.js +1 -1
- package/dist/web/components/grid/style.js +2 -0
- package/dist/web/components/image/index.js +1 -1
- package/dist/web/components/image/style.js +2 -0
- package/dist/web/components/index.js +12 -41
- package/dist/web/components/link/index.js +1 -1
- package/dist/web/components/link/style.js +2 -0
- package/dist/web/components/listView/index.js +1 -1
- package/dist/web/components/listView/style.js +2 -0
- package/dist/web/components/lottery/index.js +5 -3
- package/dist/web/components/lottery/style.js +2 -0
- package/dist/web/components/modal/modal.h5.js +1 -1
- package/dist/web/components/modal/modal.pc.js +1 -0
- package/dist/web/components/modal/style.js +3 -0
- package/dist/web/components/navLayout/index.js +1 -1
- package/dist/web/components/navLayout/style.js +3 -0
- package/dist/web/components/navigationBar/common.js +1 -1
- package/dist/web/components/navigationBar/horizontalMenu.js +1 -1
- package/dist/web/components/navigationBar/index.css +11 -0
- package/dist/web/components/navigationBar/index.js +9 -2
- package/dist/web/components/navigationBar/style.js +2 -0
- package/dist/web/components/pageLayout/PageContent/index.js +1 -1
- package/dist/web/components/pageLayout/PageContent/style.js +2 -0
- package/dist/web/components/pageLayout/index.js +1 -1
- package/dist/web/components/pageLayout/style.js +2 -0
- package/dist/web/components/phone/index.js +1 -0
- package/dist/web/components/phoneCode/index.js +1 -0
- package/dist/web/components/picker/datePicker.js +1 -0
- package/dist/web/components/picker/picker.js +1 -0
- package/dist/web/components/picker/style.js +1 -0
- package/dist/web/components/picker/timePicker.js +1 -0
- package/dist/web/components/qrcode/qr-code.js +1 -0
- package/dist/web/components/richText/index.js +7 -5
- package/dist/web/components/richText/style.js +2 -0
- package/dist/web/components/richTextView/index.js +1 -1
- package/dist/web/components/richTextView/style.js +2 -0
- package/dist/web/components/scrollView/index.js +1 -0
- package/dist/web/components/scrollView/style.js +1 -0
- package/dist/web/components/share/index.js +1 -0
- package/dist/web/components/statusContent/index.js +1 -1
- package/dist/web/components/statusContent/style.js +2 -0
- package/dist/web/components/style.js +5 -0
- package/dist/web/components/swiper/index.js +1 -1
- package/dist/web/components/swiper/style.js +2 -0
- package/dist/web/components/table/BaseTable.js +1 -2
- package/dist/web/components/table/ExportFileModalByApi/index.js +1 -1
- package/dist/web/components/table/ExportFileModalByApi/style.js +3 -0
- package/dist/web/components/table/Form/Location.js +1 -1
- package/dist/web/components/table/Form/style.js +2 -0
- package/dist/web/components/table/ImportFileModal/index.js +1 -1
- package/dist/web/components/table/ImportFileModal/style.js +2 -0
- package/dist/web/components/table/ImportFileModalByApi/index.js +0 -2
- package/dist/web/components/table/ImportFileModalByApi/style.js +3 -0
- package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +1 -1
- package/dist/web/components/table/SelectableBlock/index.js +1 -1
- package/dist/web/components/table/SelectableBlock/style.js +2 -0
- package/dist/web/components/table/UserDepartment/ViewCell.js +1 -1
- package/dist/web/components/table/UserDepartment/style.js +2 -0
- package/dist/web/components/table/index.js +1 -1
- package/dist/web/components/table/style.js +4 -0
- package/dist/web/components/tabs/index.js +1 -0
- package/dist/web/components/tabs/style.js +2 -0
- package/dist/web/components/tabs/tabs.h5.js +0 -1
- package/dist/web/components/text/index.js +1 -1
- package/dist/web/components/text/style.js +3 -0
- package/dist/web/components/uploaderFileView/index.js +1 -1
- package/dist/web/components/uploaderFileView/style.js +2 -0
- package/dist/web/components/uploaderView/index.js +1 -1
- package/dist/web/components/uploaderView/style.js +2 -0
- package/dist/web/components/userInfo/index.js +1 -0
- package/dist/web/components/wd-bubble/wd-bubble.js +1 -0
- package/dist/web/components/wd-button/wd-button.js +1 -0
- package/dist/web/components/wd-form/hooks/use-remote-value.js +9 -2
- package/dist/web/components/wd-form/index.js +46 -23
- package/dist/web/components/wd-icon/wd-icon.js +10 -2
- package/dist/web/components/wd-image/index.js +1 -0
- package/dist/web/components/wd-link/wd-link.js +1 -0
- package/dist/web/components/wd-official-account/index.js +1 -1
- package/dist/web/components/wd-official-account/style.js +2 -0
- package/dist/web/components/wd-table/components/ExportFileModalByApi/ExportFileModalByApi.js +1 -1
- package/dist/web/components/wd-table/components/ExportFileModalByApi/index.js +7 -14
- package/dist/web/components/wd-table/components/ExportFileModalByApi/style.js +2 -0
- package/dist/web/components/wd-table/components/FieldRender/Form/Location.js +1 -1
- package/dist/web/components/wd-table/components/FieldRender/Form/style.js +2 -0
- package/dist/web/components/wd-table/components/FieldRender/UserDepartment/ViewCell.js +1 -1
- package/dist/web/components/wd-table/components/FieldRender/UserDepartment/style.js +2 -0
- package/dist/web/components/wd-table/components/FilterFieldsPanel/FilterFieldItem.js +4 -0
- package/dist/web/components/wd-table/components/ImportFileModalByApi/index.js +1 -0
- package/dist/web/components/wd-table/components/ImportFileModalByApi/style.js +1 -0
- package/dist/web/components/wd-table/components/Table/index.js +28 -7
- package/dist/web/components/wd-table/hooks/useTableData.js +6 -1
- package/dist/web/components/wd-table/hooks/useViewFields.js +1 -1
- package/dist/web/components/wd-table/wd-table.js +58 -44
- package/dist/web/components/wd-text/wd-text.js +1 -0
- package/dist/web/components/web-view/style.js +2 -0
- package/dist/web/components/web-view/web-view.js +1 -1
- package/dist/web/components/wedaVideo/index.js +1 -2
- package/dist/web/components/wedaVideo/style.js +4 -0
- package/dist/web/utils/hooks/useFormLegacy.js +3 -2
- package/dist/web/utils/platform.js +1 -1
- package/dist/web/weda-ui.css +4 -0
- package/package.json +16 -1
|
@@ -3,6 +3,7 @@ import { forwardRef, useImperativeHandle } from 'react';
|
|
|
3
3
|
import { Bubble, ConfigProvider } from 'tea-component';
|
|
4
4
|
import classNames from '../../utils/classnames';
|
|
5
5
|
import { isInIde, usePlatform } from '../../utils/platform';
|
|
6
|
+
import '../style';
|
|
6
7
|
export const WdBubble = forwardRef(function WdBubble({ trigger, placement, promptTheme, arrowPointAtCenter, openDelay, closeDelay, bubbleContent, bubbleChildren, events, id, style, className, }, ref) {
|
|
7
8
|
const platform = usePlatform();
|
|
8
9
|
// Widget API,挂载组件只读属性和组件方法
|
|
@@ -9,6 +9,7 @@ import { textToString, usePlatform } from '../../utils/platform';
|
|
|
9
9
|
import { convertLegacyEnum, filterPropsWithOn } from '../../utils/tool';
|
|
10
10
|
import { WD_BUTTON_THEME, WD_BUTTON_VARIANT, WD_BUTTON_SIZE, WD_BUTTON_ICON_TYPE, WD_BUTTON_ICON_POSITION, WD_BUTTON_TYPE, } from '../../../enum';
|
|
11
11
|
import { WdIcon } from '../index';
|
|
12
|
+
import '../style';
|
|
12
13
|
export const WdButton = forwardRef(function WdButton(props, ref) {
|
|
13
14
|
const { text, size: _size = 'md', theme: _theme = 'secondary', variant: _variant = 'base', iconType: _iconType = 'none', iconSource = 'inner', icon: _icon, iconSrc, iconPosition: _iconPosition = 'before', block, formType: _formType, disabled, events = emptyObject, className, style, id, loading,
|
|
14
15
|
// 组件 widget 实例,后续可能会更改接口
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
1
|
+
import { useCallback, useEffect } from 'react';
|
|
2
2
|
import { debug } from '../../../utils/console';
|
|
3
3
|
import { usePlatform } from '../../../utils/platform';
|
|
4
4
|
import { alertError } from '../../form/form';
|
|
@@ -19,7 +19,7 @@ methodGetItem, paramGetItem, appCloud, isDataModel, }) {
|
|
|
19
19
|
console.error(err);
|
|
20
20
|
alertError(platform, '表单容器数据查询失败');
|
|
21
21
|
}, [platform]);
|
|
22
|
-
const { data: remoteValue, error, isLoading, } = useSWR(() => {
|
|
22
|
+
const { data: remoteValue, error, isLoading, mutate, } = useSWR(() => {
|
|
23
23
|
if (!formTypeWithInitValue.includes(formType) || !dataSourceName) {
|
|
24
24
|
logger.debug('formType没有初始值或者,没配数据源', {
|
|
25
25
|
formType,
|
|
@@ -70,10 +70,17 @@ methodGetItem, paramGetItem, appCloud, isDataModel, }) {
|
|
|
70
70
|
}, true);
|
|
71
71
|
}, {
|
|
72
72
|
onError: onInitialValuesError,
|
|
73
|
+
revalidateOnFocus: false,
|
|
73
74
|
});
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
return () => {
|
|
77
|
+
mutate();
|
|
78
|
+
};
|
|
79
|
+
}, [mutate]);
|
|
74
80
|
return {
|
|
75
81
|
remoteValue,
|
|
76
82
|
error,
|
|
77
83
|
isLoading,
|
|
84
|
+
mutate,
|
|
78
85
|
};
|
|
79
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/* eslint max-lines: [error,
|
|
2
|
+
/* eslint max-lines: [error, 600] */
|
|
3
3
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
4
4
|
import { useDebouncedCallback, useDebouncedEffect, useMap, useMountEffect, useSyncedRef, } from '@react-hookz/web';
|
|
5
5
|
import { isInIde, usePlatform } from '../../utils/platform';
|
|
@@ -16,6 +16,8 @@ import lodashGet from 'lodash.get';
|
|
|
16
16
|
import isObjectEqual from '../../utils/isObjectEqual';
|
|
17
17
|
import { useDataSource } from '../../utils/hooks/useDataSource';
|
|
18
18
|
import { WdForm as FormUi } from './wd-form';
|
|
19
|
+
import '../style';
|
|
20
|
+
const SET_VALUE_DEBOUNCE_TIMEOUT = 200;
|
|
19
21
|
const logger = debug('wd-form');
|
|
20
22
|
const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
21
23
|
var _a;
|
|
@@ -39,6 +41,8 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
39
41
|
'gsd-h5-react-form-pc': platform === 'pc',
|
|
40
42
|
'wedatea2td-form': platform === 'pc',
|
|
41
43
|
}, className);
|
|
44
|
+
const isDataModel = !['connector', 'custom-connector'].includes(datasourceType); // 是否为数据模型,兼容历史 undefined
|
|
45
|
+
const hasSetInitValueRef = useRef(false);
|
|
42
46
|
const [initialValues, setInitialValues] = useState((_a = props.initialValues) !== null && _a !== void 0 ? _a : emptyObject);
|
|
43
47
|
const eventsRef = useSyncedRef(props.events);
|
|
44
48
|
const validate = useCallback(async () => {
|
|
@@ -71,6 +75,17 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
71
75
|
return errObj;
|
|
72
76
|
}, [formItemMap]);
|
|
73
77
|
const [errors, setErrors] = useState(undefined);
|
|
78
|
+
const { remoteValue: fetchedInitialValues, isLoading: isLoadingInitValues, error: initValueFetchError, } = useRemoteValue({
|
|
79
|
+
appCloud,
|
|
80
|
+
formType,
|
|
81
|
+
_id,
|
|
82
|
+
// methodCreate,
|
|
83
|
+
methodGetItem,
|
|
84
|
+
// methodUpdate,
|
|
85
|
+
paramGetItem,
|
|
86
|
+
dataSourceName,
|
|
87
|
+
isDataModel,
|
|
88
|
+
});
|
|
74
89
|
const submit = useCallback(async () => {
|
|
75
90
|
const { submit } = eventsRef.current;
|
|
76
91
|
const errorObj = await validate();
|
|
@@ -96,7 +111,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
96
111
|
}
|
|
97
112
|
});
|
|
98
113
|
}, [eventsRef, formItemMap]);
|
|
99
|
-
const setValue =
|
|
114
|
+
const setValue = useDebouncedCallback((data, setNull) => {
|
|
100
115
|
if (typeof data !== 'object' || typeof data === null) {
|
|
101
116
|
console.warn('setValue data need expect a object but got', data);
|
|
102
117
|
return;
|
|
@@ -115,7 +130,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
115
130
|
}
|
|
116
131
|
});
|
|
117
132
|
updateFormContext();
|
|
118
|
-
}, [formItemMap, updateFormContext]);
|
|
133
|
+
}, [formItemMap, updateFormContext], SET_VALUE_DEBOUNCE_TIMEOUT);
|
|
119
134
|
const clearValidate = useCallback(() => {
|
|
120
135
|
formItemMap.forEach((item) => {
|
|
121
136
|
if (!item.clearValidate || typeof item.clearValidate !== 'function') {
|
|
@@ -128,6 +143,10 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
128
143
|
// useWhatChanged([formItemMap, initialValues, submit, validate]);
|
|
129
144
|
useLoopRenderDetect();
|
|
130
145
|
const { ready } = useWedaAppContext();
|
|
146
|
+
const [visible, setVisible] = React.useState(false);
|
|
147
|
+
React.useEffect(() => {
|
|
148
|
+
setVisible(true);
|
|
149
|
+
}, []);
|
|
131
150
|
const previousFormType = useRef(null);
|
|
132
151
|
useEffect(() => {
|
|
133
152
|
if (!ready) {
|
|
@@ -144,8 +163,16 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
144
163
|
}
|
|
145
164
|
else {
|
|
146
165
|
formItemMap.forEach((item) => {
|
|
147
|
-
|
|
148
|
-
|
|
166
|
+
const { initialReadOnly, initialDisabled } = item || {};
|
|
167
|
+
if (initialReadOnly) {
|
|
168
|
+
item.setReadOnly(true);
|
|
169
|
+
}
|
|
170
|
+
else if (initialDisabled) {
|
|
171
|
+
item.setDisabled(true);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
item.setReadOnly(false);
|
|
175
|
+
}
|
|
149
176
|
});
|
|
150
177
|
}
|
|
151
178
|
});
|
|
@@ -153,18 +180,6 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
153
180
|
useMountEffect(() => {
|
|
154
181
|
logger.debug('formItemMap', formItemMap);
|
|
155
182
|
});
|
|
156
|
-
const isDataModel = !['connector', 'custom-connector'].includes(datasourceType); // 是否为数据模型,兼容历史 undefined
|
|
157
|
-
const { remoteValue: fetchedInitialValues, isLoading: isLoadingInitValues, error: initValueFetchError, } = useRemoteValue({
|
|
158
|
-
appCloud,
|
|
159
|
-
formType,
|
|
160
|
-
_id,
|
|
161
|
-
// methodCreate,
|
|
162
|
-
methodGetItem,
|
|
163
|
-
// methodUpdate,
|
|
164
|
-
paramGetItem,
|
|
165
|
-
dataSourceName,
|
|
166
|
-
isDataModel,
|
|
167
|
-
});
|
|
168
183
|
useEffect(() => {
|
|
169
184
|
if (isLoadingInitValues)
|
|
170
185
|
return;
|
|
@@ -173,8 +188,13 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
173
188
|
错误处理放在了 @link {onInitialValuesError}
|
|
174
189
|
下面是可以拿到data了
|
|
175
190
|
*/
|
|
176
|
-
|
|
177
|
-
|
|
191
|
+
setInitialValues((original) => {
|
|
192
|
+
if (hasSetInitValueRef.current) {
|
|
193
|
+
return original;
|
|
194
|
+
}
|
|
195
|
+
hasSetInitValueRef.current = true;
|
|
196
|
+
return fetchedInitialValues;
|
|
197
|
+
});
|
|
178
198
|
setValue(fetchedInitialValues, true);
|
|
179
199
|
}
|
|
180
200
|
}, [fetchedInitialValues, initValueFetchError, isLoadingInitValues, setValue]);
|
|
@@ -323,10 +343,12 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
323
343
|
}
|
|
324
344
|
}
|
|
325
345
|
updateFormContext();
|
|
326
|
-
}, [formItemMap, initialValues, updateFormContext],
|
|
327
|
-
|
|
328
|
-
200);
|
|
346
|
+
}, [formItemMap, initialValues, updateFormContext], SET_VALUE_DEBOUNCE_TIMEOUT);
|
|
347
|
+
const lastInitValueRef = useRef(null);
|
|
329
348
|
React.useEffect(() => {
|
|
349
|
+
if (isObjectEqual(lastInitValueRef.current, initialValues)) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
330
352
|
// 单向 Form向下设置值
|
|
331
353
|
let setValueReady = false;
|
|
332
354
|
const timeout = 30;
|
|
@@ -346,6 +368,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
346
368
|
setInitValue();
|
|
347
369
|
};
|
|
348
370
|
setValueUntilReady();
|
|
371
|
+
lastInitValueRef.current = initialValues;
|
|
349
372
|
return () => {
|
|
350
373
|
if (id) {
|
|
351
374
|
clearTimeout(id);
|
|
@@ -381,7 +404,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
381
404
|
}
|
|
382
405
|
return 'vertical-left';
|
|
383
406
|
}, [layout]);
|
|
384
|
-
return (_jsx(FormUi, { layout: layout, className: cls, style: style, id: id, labelPosition: labelPosition, children: contentSlot }));
|
|
407
|
+
return (_jsx(FormUi, { layout: layout, className: cls, style: style, id: id, labelPosition: labelPosition, children: visible && contentSlot }));
|
|
385
408
|
});
|
|
386
409
|
function getFormDataFromItemMap(formItemMap) {
|
|
387
410
|
const formData = {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
4
|
import { emptyObject } from '../../utils/constant';
|
|
5
5
|
import { useConfig } from '../../utils/config-context';
|
|
6
6
|
import { usePlatform } from '../../utils/platform';
|
|
7
7
|
import { convertLegacyEnum } from '../../utils/tool';
|
|
8
8
|
import { WD_ICON_TYPE, WD_ICON_SIZE } from '../../../enum';
|
|
9
|
+
import '../style';
|
|
9
10
|
export const WdIcon = forwardRef(function WdIcon({ type: _type = 'inner', name, src, size: _size, events = emptyObject, className, style: _style, id, color: _color, ...props }, ref) {
|
|
11
|
+
const [isError, setIsError] = useState(false);
|
|
10
12
|
const platform = usePlatform();
|
|
11
13
|
// 兼容旧版组件的属性值 size/color
|
|
12
14
|
const remdiff = 2;
|
|
@@ -27,6 +29,7 @@ export const WdIcon = forwardRef(function WdIcon({ type: _type = 'inner', name,
|
|
|
27
29
|
const isTdIcon = /td/.test(name) && type === 'inner';
|
|
28
30
|
const isLegacyIcon = !isTdIcon && type === 'inner';
|
|
29
31
|
const iconName = name === null || name === void 0 ? void 0 : name.split(':')[1];
|
|
32
|
+
const showErrorIcon = isError && type === 'custom';
|
|
30
33
|
// 响应式css api
|
|
31
34
|
const platformCss = `${classPrefix}-${platform}-icon`;
|
|
32
35
|
const classes = {
|
|
@@ -40,6 +43,7 @@ export const WdIcon = forwardRef(function WdIcon({ type: _type = 'inner', name,
|
|
|
40
43
|
// 尺寸
|
|
41
44
|
[`${compClassName}--${size}`]: !!size,
|
|
42
45
|
[platformCss]: true,
|
|
46
|
+
[`${classPrefix}-icon-error`]: showErrorIcon,
|
|
43
47
|
};
|
|
44
48
|
const onClick = (e) => {
|
|
45
49
|
var _a;
|
|
@@ -68,6 +72,10 @@ export const WdIcon = forwardRef(function WdIcon({ type: _type = 'inner', name,
|
|
|
68
72
|
else {
|
|
69
73
|
return (_jsx("img", { className: classNames(classes, className), style: style, id: id, src: src
|
|
70
74
|
? src
|
|
71
|
-
: 'https://qcloudimg.tencent-cloud.cn/raw/4a29d51b504f12b4933ce4490110b4dc.svg',
|
|
75
|
+
: 'https://qcloudimg.tencent-cloud.cn/raw/4a29d51b504f12b4933ce4490110b4dc.svg', onLoad: () => {
|
|
76
|
+
setIsError(false);
|
|
77
|
+
}, onError: () => {
|
|
78
|
+
setIsError(true);
|
|
79
|
+
}, onClick: onClick, ...propsStartWithOn }));
|
|
72
80
|
}
|
|
73
81
|
});
|
|
@@ -5,6 +5,7 @@ import { ImageInner } from './image';
|
|
|
5
5
|
import { emptyObject } from '../../utils/constant';
|
|
6
6
|
import { useTempUrl } from '../../utils/hooks/use-cloud-id-temp-url';
|
|
7
7
|
import { useConfig } from '../../utils/config-context';
|
|
8
|
+
import '../style';
|
|
8
9
|
export default forwardRef(function WdImage({
|
|
9
10
|
// 系统属性
|
|
10
11
|
className, events = emptyObject, style,
|
|
@@ -5,6 +5,7 @@ import { emptyObject } from '../../utils/constant';
|
|
|
5
5
|
import { useConfig } from '../../utils/config-context';
|
|
6
6
|
import { usePlatform } from '../../utils/platform';
|
|
7
7
|
import { WdIcon } from '../index';
|
|
8
|
+
import '../style';
|
|
8
9
|
export const WdLink = forwardRef(function WdLink({ content, url, isOpenInNewWindow, params, iconType, iconSource = 'inner', icon, iconSrc, iconPosition = 'before', disabled, enableSlot = true, contentSlot, events = emptyObject, className, style, id, ...props }, ref) {
|
|
9
10
|
const platform = usePlatform();
|
|
10
11
|
// 样式
|
|
@@ -11,7 +11,7 @@ import { WdButton } from '../../components/wd-button';
|
|
|
11
11
|
// @ts-ignore忽略ts交验
|
|
12
12
|
// eslint-disable-next-line rulesdir/no-phantom-deps,import/no-unresolved
|
|
13
13
|
import { autorun } from 'mobx';
|
|
14
|
-
import './
|
|
14
|
+
import './style';
|
|
15
15
|
export default function WdOfficialAccount(props) {
|
|
16
16
|
var _a, _b;
|
|
17
17
|
const { className, id, style } = props;
|
package/dist/web/components/wd-table/components/ExportFileModalByApi/ExportFileModalByApi.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ConfigProvider } from 'tea-component';
|
|
3
3
|
import { ExportFileModalByApi as ExportFileModalByApiFromTable } from '../../../table/ExportFileModalByApi';
|
|
4
|
-
import './
|
|
4
|
+
import './style';
|
|
5
5
|
export function ExportFileModalByApi({ onCancel, visible, fields, selectedKeysList, handleInOrOutRecordModalVisible, dbName, whereList, where, orderBy, orderType, tableColumns, }) {
|
|
6
6
|
return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(ExportFileModalByApiFromTable, { onCancel: onCancel, visible: visible, fields: fields, selectedKeysList: selectedKeysList, handleInOrOutRecordModealVisible: handleInOrOutRecordModalVisible, dbName: dbName, where: where, whereList: whereList, orderBy: orderBy, orderType: orderType, tableColumns: tableColumns }) }));
|
|
7
7
|
}
|
|
@@ -4,24 +4,17 @@ import { formatDataToXlsx, filterCustomFields } from '../FieldRender';
|
|
|
4
4
|
import { getFieldsTypeName } from '../../../../utils/tool';
|
|
5
5
|
import { alertErrorMessage } from '../../../../utils/platform';
|
|
6
6
|
import { exportData } from '../../../../utils/file';
|
|
7
|
-
import './
|
|
7
|
+
import './style';
|
|
8
8
|
/**
|
|
9
9
|
* 后端导出弹窗
|
|
10
10
|
*/
|
|
11
11
|
export const ExportFileModal = ({ fields, columns, isExportFileModalByApiVisible, selectedKeys, dbName, query, whereList, setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible, }) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return false;
|
|
19
|
-
return true;
|
|
20
|
-
})) === null || _a === void 0 ? void 0 : _a.sort((a, b) => (a === null || a === void 0 ? void 0 : a['x-index']) - (b === null || b === void 0 ? void 0 : b['x-index']))) === null || _b === void 0 ? void 0 : _b.filter((item) => {
|
|
21
|
-
// 筛选出列管理字段
|
|
22
|
-
const isVisible = columns === null || columns === void 0 ? void 0 : columns.findIndex((column) => (column === null || column === void 0 ? void 0 : column.key) === (item === null || item === void 0 ? void 0 : item.name) && (column === null || column === void 0 ? void 0 : column.isExport));
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
24
|
-
return isVisible != -1;
|
|
12
|
+
const supportFields = [];
|
|
13
|
+
columns.forEach((i) => {
|
|
14
|
+
const field = fields.find((field) => field.name === i.key);
|
|
15
|
+
if (field && (i === null || i === void 0 ? void 0 : i.isExport)) {
|
|
16
|
+
supportFields.push(field);
|
|
17
|
+
}
|
|
25
18
|
});
|
|
26
19
|
// 没有数据标识默认加上数据标识字段
|
|
27
20
|
const isExitId = supportFields === null || supportFields === void 0 ? void 0 : supportFields.findIndex((item) => (item === null || item === void 0 ? void 0 : item.name) === '_id');
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import classNames from '../../../../../utils/classnames';
|
|
4
4
|
import { Form, Input, Text } from 'tea-component';
|
|
5
|
-
import './
|
|
5
|
+
import './style';
|
|
6
6
|
export const locationProperties = {
|
|
7
7
|
address: {
|
|
8
8
|
title: '地点',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from 'tea-component';
|
|
3
3
|
import { getRelationData } from './utils';
|
|
4
|
-
import './
|
|
4
|
+
import './style';
|
|
5
5
|
export const ViewCell = ({ data, showType, relation }) => {
|
|
6
6
|
if (showType === 'tree') {
|
|
7
7
|
return _jsx(Text, { verticalAlign: "middle", children: (data === null || data === void 0 ? void 0 : data.content) || '-' });
|
|
@@ -40,6 +40,10 @@ export const FilterFieldItem = ({ updateFilterData, ...filterFieldItemConfig })
|
|
|
40
40
|
const { filterType, isRange, label, options, fieldCalculation, value } = filterFieldItemConfig;
|
|
41
41
|
const updateFilterConfig = (value) => {
|
|
42
42
|
const lastFilterConfig = { ...filterFieldItemConfig, ...value };
|
|
43
|
+
// 选择为空不为空,则清空数据
|
|
44
|
+
if (['$empty', '$nempty'].includes(lastFilterConfig === null || lastFilterConfig === void 0 ? void 0 : lastFilterConfig.fieldCalculation.value)) {
|
|
45
|
+
lastFilterConfig.value = '';
|
|
46
|
+
}
|
|
43
47
|
updateFilterData(lastFilterConfig);
|
|
44
48
|
};
|
|
45
49
|
useEffect(() => {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ImportFileModalByApi as ImportFileModalByApiFromTable } from '../../../table/ImportFileModalByApi';
|
|
3
3
|
import { alertErrorMessage } from '../../../../utils/platform';
|
|
4
4
|
import { ConfigProvider } from 'tea-component';
|
|
5
|
+
import './style';
|
|
5
6
|
/**
|
|
6
7
|
* 后端导入弹窗
|
|
7
8
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../../../../components/table/ImportFileModalByApi/style';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint max-lines: [error, 350] */
|
|
2
3
|
import React, { useRef, useEffect } from 'react';
|
|
3
4
|
import { Icon, Table, StatusTip, ConfigProvider } from 'tea-component';
|
|
4
5
|
import { useResizeObserver } from '@react-hookz/web';
|
|
@@ -15,6 +16,16 @@ const miniPageSize = 10;
|
|
|
15
16
|
// h5 端表格高度
|
|
16
17
|
const tableHeight = { sm: 500, md: 580, lg: 880 };
|
|
17
18
|
const tableHeaderHeight = 51;
|
|
19
|
+
const renderStatus = ({ isH5, status, classPrefix, refreshTable, isNoDataSourceBind, _emptyText, }) => {
|
|
20
|
+
const text = {
|
|
21
|
+
loading: '数据加载中,请稍候...',
|
|
22
|
+
error: (_jsxs("p", { children: ["\u6570\u636E\u52A0\u8F7D\u5931\u8D25,", _jsx("span", { className: `${classPrefix}-empty-retry-text`, onClick: () => {
|
|
23
|
+
refreshTable();
|
|
24
|
+
}, children: "\u8BF7\u91CD\u8BD5" })] })),
|
|
25
|
+
empty: isNoDataSourceBind ? '请绑定数据源' : _emptyText,
|
|
26
|
+
};
|
|
27
|
+
return (_jsx(StatusContent, { emptyText: text[`${status}`], component: "table", icon: status, isH5: isH5 }));
|
|
28
|
+
};
|
|
18
29
|
// eslint-disable-next-line complexity
|
|
19
30
|
export const BaseTableCom = ({ recordKey, className, columns, setColumns, records, sortColumns, sort, onSelectChange, selectedKeys, rowColor, isError, isLoading, queryParams, total = defaultTotal, refreshTable, onQueryChange, enablePagination, columnSelectType, defaultPageSize, defaultPageIndex, rowClick, currentSize, isNoDataSourceBind, isH5, emptyText: _emptyText, }) => {
|
|
20
31
|
var _a;
|
|
@@ -25,8 +36,11 @@ export const BaseTableCom = ({ recordKey, className, columns, setColumns, record
|
|
|
25
36
|
? (queryParams === null || queryParams === void 0 ? void 0 : queryParams.pageIndex) === pageIndexSpan && isLoading
|
|
26
37
|
: isLoading;
|
|
27
38
|
// table状态样式
|
|
39
|
+
const showStatus = isShowLoading || isError || !(records === null || records === void 0 ? void 0 : records.length);
|
|
28
40
|
const classes = {
|
|
29
|
-
[`${classPrefix}-table
|
|
41
|
+
[`${classPrefix}-table-scroll-wrap`]: true,
|
|
42
|
+
[`${classPrefix}-table--status`]: showStatus,
|
|
43
|
+
[`${classPrefix}-table--without-pagination`]: !enablePagination,
|
|
30
44
|
};
|
|
31
45
|
// table 插件
|
|
32
46
|
const tableAddons = [
|
|
@@ -48,11 +62,9 @@ export const BaseTableCom = ({ recordKey, className, columns, setColumns, record
|
|
|
48
62
|
autotip({
|
|
49
63
|
isLoading: isShowLoading,
|
|
50
64
|
isError,
|
|
51
|
-
loadingText:
|
|
52
|
-
emptyText:
|
|
53
|
-
errorText:
|
|
54
|
-
refreshTable();
|
|
55
|
-
}, children: "\u8BF7\u91CD\u8BD5" })] }), component: "table", icon: "error", isH5: isH5 })),
|
|
65
|
+
loadingText: null,
|
|
66
|
+
emptyText: null,
|
|
67
|
+
errorText: null,
|
|
56
68
|
}),
|
|
57
69
|
// 行背景色
|
|
58
70
|
injectable({
|
|
@@ -177,6 +189,15 @@ export const BaseTableCom = ({ recordKey, className, columns, setColumns, record
|
|
|
177
189
|
}
|
|
178
190
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
191
|
}, [queryParams.pageIndex, currentSize, isLoading, isH5, total]);
|
|
180
|
-
|
|
192
|
+
const status = isShowLoading ? 'loading' : isError ? 'error' : 'empty';
|
|
193
|
+
return (_jsxs("div", { className: classNames(className, classes), children: [_jsx(Table, { ref: tableRef, className: className, bordered: true, recordKey: recordKey, columns: columns, records: records, addons: tableAddons, bottomTip: bottomTipCompRender() }), showStatus &&
|
|
194
|
+
renderStatus({
|
|
195
|
+
isH5,
|
|
196
|
+
status,
|
|
197
|
+
classPrefix,
|
|
198
|
+
refreshTable,
|
|
199
|
+
isNoDataSourceBind,
|
|
200
|
+
_emptyText,
|
|
201
|
+
})] }));
|
|
181
202
|
};
|
|
182
203
|
export const BaseTable = React.memo(BaseTableCom);
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { useEffect, useCallback, useState } from 'react';
|
|
2
2
|
const defaultPageNo = 1;
|
|
3
|
-
export const useTableData = ({ dataSourceAPI, connectorMethod, query, events, isModel, dbName, isH5, isNoDataSourceBind, }) => {
|
|
3
|
+
export const useTableData = ({ dataSourceAPI, connectorMethod, query, events, isModel, dbName, isH5, isNoDataSourceBind, viewFieldsData, isViewTable, }) => {
|
|
4
4
|
const [total, setTotal] = useState(0);
|
|
5
5
|
const [tableLoading, setTableLoading] = useState(true);
|
|
6
6
|
const [tableData, setTableData] = useState([]);
|
|
7
7
|
const fetch = useCallback(async () => {
|
|
8
|
+
var _a;
|
|
8
9
|
if (isNoDataSourceBind) {
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
12
|
+
// 视图配置请求返回查询参数,配置视图时,等待视图返回成功后再查询,避免多次查询
|
|
13
|
+
if (isModel && isViewTable && !((_a = viewFieldsData === null || viewFieldsData === void 0 ? void 0 : viewFieldsData.viewList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
11
16
|
let data = { records: [], total: 0 };
|
|
12
17
|
setTableLoading(true);
|
|
13
18
|
if (isModel) {
|
|
@@ -15,6 +15,6 @@ export const useViewFields = ({ selectedView, selectedViewIds, dbName, isModel,
|
|
|
15
15
|
},
|
|
16
16
|
viewFields: (data === null || data === void 0 ? void 0 : data.fields) || authFields,
|
|
17
17
|
isError: error,
|
|
18
|
-
|
|
18
|
+
viewLoading: !error && !data,
|
|
19
19
|
};
|
|
20
20
|
};
|