@cloudbase/weda-ui 3.4.12 → 3.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/configs/components/form-date.js +1 -1
  2. package/dist/configs/components/form-depart-tree-select.js +1 -1
  3. package/dist/configs/components/form-location.js +1 -1
  4. package/dist/configs/components/form-multi-region.js +1 -1
  5. package/dist/configs/components/form-rich-text.js +1 -1
  6. package/dist/configs/components/form-select-multiple.js +1 -1
  7. package/dist/configs/components/form-select.js +1 -1
  8. package/dist/configs/components/form-switch.js +1 -1
  9. package/dist/configs/components/form-time.js +1 -1
  10. package/dist/configs/components/form-user-tree-select.js +1 -1
  11. package/dist/configs/components/wd-checkbox.js +1 -1
  12. package/dist/configs/components/wd-input.js +1 -1
  13. package/dist/configs/components/wd-radio.js +1 -1
  14. package/dist/configs/components/wd-table.js +3 -3
  15. package/dist/configs/components/wd-textarea.js +1 -1
  16. package/dist/style/index.scss +1 -1
  17. package/dist/web/components/form/select/dropdown-select/index.js +3 -3
  18. package/dist/web/components/form/select/index.js +0 -1
  19. package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +20 -6
  20. package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +8 -4
  21. package/dist/web/components/form-input-hooks/index.js +3 -2
  22. package/dist/web/components/form-upload-file/index.js +0 -1
  23. package/dist/web/components/formdetail/index.js +3 -1
  24. package/dist/web/components/index.js +10 -10
  25. package/dist/web/components/navigationBar/common.js +1 -1
  26. package/dist/web/components/navigationBar/horizontalMenu.js +1 -1
  27. package/dist/web/components/navigationBar/index.css +11 -0
  28. package/dist/web/components/navigationBar/index.js +8 -1
  29. package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +1 -1
  30. package/dist/web/components/wd-form/hooks/use-remote-value.js +9 -2
  31. package/dist/web/components/wd-form/index.js +45 -23
  32. package/dist/web/components/wd-icon/wd-icon.js +10 -2
  33. package/dist/web/components/wd-table/components/FilterFieldsPanel/FilterFieldItem.js +4 -0
  34. package/dist/web/components/wd-table/components/Table/index.js +28 -7
  35. package/dist/web/components/wd-table/hooks/useTableData.js +6 -1
  36. package/dist/web/components/wd-table/hooks/useViewFields.js +1 -1
  37. package/dist/web/components/wd-table/wd-table.js +57 -44
  38. package/dist/web/utils/hooks/useFormLegacy.js +3 -2
  39. package/dist/web/weda-ui.css +4 -0
  40. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { formatNeedDataFetch, PAGE_SIZE, requestEnumOption, requestFatherRelated
5
5
  import SelectPickerPc from './pc';
6
6
  import { usePlatform } from '../../../../utils/platform';
7
7
  import { Status } from '../status';
8
- import { useDeepCompareEffect } from '@react-hookz/web';
8
+ import { useDebouncedEffect, useDeepCompareEffect } from '@react-hookz/web';
9
9
  export function PureSelect({ params, selectedValue, updateValue, placeholder, size, disabled, isShow, }) {
10
10
  const isRequestingRef = useRef(false);
11
11
  const [status, setStatus] = useState(Status.ALl_EMPTY);
@@ -146,9 +146,9 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
146
146
  return () => clearTimeout(timer);
147
147
  }
148
148
  };
149
- useEffect(() => {
149
+ useDebouncedEffect(() => {
150
150
  handleSearch();
151
- }, [searchValue]);
151
+ }, [searchValue], 300);
152
152
  // 加载更多
153
153
  const loadMore = () => {
154
154
  if (!isRequestingRef.current &&
@@ -19,7 +19,6 @@ export const moment = (typeof _moment === 'function' ? _moment : _moment.default
19
19
  const Select = React.memo(function Select(props) {
20
20
  return (_jsx(CommonErrorBoundary, { children: _jsx(SelectImpl, { ...props }) }));
21
21
  });
22
- Select.whyDidYouRender = true;
23
22
  export default Select;
24
23
  function SelectImpl(props) {
25
24
  const { id, style, className, label = '标题', labelVisible = true, layout = 'horizontal', requiredFlag = false, size = 'l', decorator, } = props;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { useState, useEffect } from 'react';
2
+ import React, { useState, useEffect, useRef } from 'react';
3
3
  import { UserSelectPC } from '../user-select-pc/user-select-pc';
4
4
  import { UserTreeSelectH5 as UserSelectH5 } from './user-select-h5';
5
5
  import '../userOrgSelect.css';
@@ -12,6 +12,7 @@ import { useViewData } from '../../hooks/use-views-data';
12
12
  import { useDepartData } from '../../hooks/use-depart-data';
13
13
  import { parseStrToArr } from '../../common/utils';
14
14
  import { useDeepCompareEffect } from '@react-hookz/web';
15
+ import { getUuid } from '../../../../../utils/tool';
15
16
  export default function UserTreeSelect(props) {
16
17
  const { events = emptyObject, defaultValue = emptyArray, confirmValue = '', defaultValueType = 'noneUser', onChange = null, multiple = false, request = defaultRequest, where, confirmAction, closeAction, secondDisplay, // 辅助信息
17
18
  corpScope, // 展示企业范围
@@ -21,7 +22,9 @@ export default function UserTreeSelect(props) {
21
22
  * containerClass: string
22
23
  * triggerElement: React.ReactNode
23
24
  */
24
- naked = false, containerClass = '', triggerElement = null, } = props;
25
+ naked = false, containerClass = '', triggerElement = null,
26
+ /** 是否展示未关联部门用户 */
27
+ displayUncategorizedUsers = true, } = props;
25
28
  const platform = usePlatform();
26
29
  const [errInfo, setErrInfo] = useState({
27
30
  errorStatus: false,
@@ -29,6 +32,7 @@ export default function UserTreeSelect(props) {
29
32
  });
30
33
  const [open, setOpen] = useState(false);
31
34
  const [selectUserIds, setSelectUserIds] = useSyncValue(defaultValue, isObjectEqual);
35
+ const fetchRef = useRef({ version: '' });
32
36
  // 两次默认值不同, 需要刷新
33
37
  const prevDefaultRef = React.useRef(null);
34
38
  // 当前选中的部门id
@@ -55,6 +59,7 @@ export default function UserTreeSelect(props) {
55
59
  const { treeData, error } = useDepartData({
56
60
  request,
57
61
  params: { corpScopes },
62
+ displayUncategorizedUsers,
58
63
  });
59
64
  // 默认选中第一个部门
60
65
  useEffect(() => {
@@ -90,11 +95,14 @@ export default function UserTreeSelect(props) {
90
95
  setErrInfo({ errorStatus: false, errorMessage: null });
91
96
  // 避免ide mock值请求数据异常
92
97
  if (defaultValue && defaultValue.length !== 0 && !isInIde()) {
98
+ const fetchVersion = (fetchRef.current.version = getUuid());
93
99
  const userSelectList = await getUserListByIds({
94
100
  selectUserIds: filterStrList(parseStrToArr(defaultValue)) || [],
95
101
  IsNoRelatedOrgFlag: false,
96
102
  request,
97
103
  });
104
+ if (fetchVersion !== fetchRef.current.version)
105
+ return;
98
106
  setConfirmUserList(userSelectList);
99
107
  }
100
108
  else {
@@ -107,7 +115,8 @@ export default function UserTreeSelect(props) {
107
115
  };
108
116
  useEffect(() => {
109
117
  try {
110
- if (!isObjectEqual(prevDefaultRef.current, selectUserIds)) {
118
+ if (selectUserIds &&
119
+ !isObjectEqual(prevDefaultRef.current, selectUserIds)) {
111
120
  getDefaultUser(selectUserIds);
112
121
  prevDefaultRef.current = selectUserIds;
113
122
  }
@@ -116,10 +125,15 @@ export default function UserTreeSelect(props) {
116
125
  // eslint-disable-next-line react-hooks/exhaustive-deps
117
126
  }, [defaultValueType, selectUserIds]);
118
127
  useDeepCompareEffect(() => {
119
- var _a;
128
+ var _a, _b;
120
129
  setSelectedUserList(confirmUserList);
121
- onChange === null || onChange === void 0 ? void 0 : onChange(setOnChangeValue(multiple, confirmUserList));
122
- (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, setOnChangeValue(multiple, confirmUserList, true));
130
+ const _value = (_a = setOnChangeValue(multiple, confirmUserList)) !== null && _a !== void 0 ? _a : null;
131
+ const _eventValue = setOnChangeValue(multiple, confirmUserList, true);
132
+ // 值和默认值相同时,不触发 change 事件
133
+ if (isObjectEqual(_value, defaultValue))
134
+ return;
135
+ onChange === null || onChange === void 0 ? void 0 : onChange(_value);
136
+ (_b = events === null || events === void 0 ? void 0 : events.change) === null || _b === void 0 ? void 0 : _b.call(events, _eventValue);
123
137
  }, [confirmUserList === null || confirmUserList === void 0 ? void 0 : confirmUserList.map((user) => filterUserInfo(user))]);
124
138
  /** 点击确认时获取所选用户,调用confirmAction,将所选用户向外传出 */
125
139
  const onConfirmSelectUser = (selectedUserList) => {
@@ -64,14 +64,18 @@ const isNoOrgList = {
64
64
  icon: Icon,
65
65
  };
66
66
  export const useDepartData = (props) => {
67
- const { request, params } = props;
67
+ const { request, params, displayUncategorizedUsers } = props;
68
68
  const { data: treeData, error } = useSWR(`${DescribeOrgs}_${JSON.stringify(params)}`, async () => {
69
69
  const tempList = await DescribeOrgs(request, params);
70
70
  const orgsData = destr(tempList);
71
71
  const { res: tempTreeData, tempOrgList } = buildTreeData(orgsData);
72
- //是否展示非组织节点
73
- const res = await fetchUserData({ pageNo: 1, pageSize: 1 }, request);
74
- const finalTempTreeData = (res === null || res === void 0 ? void 0 : res.total) > 0
72
+ // 是否展示非组织节点
73
+ let userDataTotal = 0;
74
+ if (displayUncategorizedUsers) {
75
+ const res = await fetchUserData({ pageNo: 1, pageSize: 1 }, request);
76
+ userDataTotal = res === null || res === void 0 ? void 0 : res.total;
77
+ }
78
+ const finalTempTreeData = userDataTotal > 0
75
79
  ? (tempTreeData || []).concat(isNoOrgList)
76
80
  : tempTreeData;
77
81
  return {
@@ -109,8 +109,9 @@ export function useFormInputTrait(inputParams) {
109
109
  setHidden() {
110
110
  setVisible(false);
111
111
  },
112
- initialDisabled: inputParams.disabled,
113
- setDisable(val) {
112
+ initialDisabled: statusParams.disabled,
113
+ initialReadOnly: statusParams.readOnly,
114
+ setDisabled(val) {
114
115
  const originalValue = disabled;
115
116
  const value = convertMethodParam(val);
116
117
  setDisabled(value);
@@ -43,5 +43,4 @@ const FormUploadFile = React.forwardRef(function FormUploadFile(props, ref) {
43
43
  }
44
44
  return (_jsxs(FormItemWrapper, { children: [_jsx(UploaderFile, { id: id, style: style, className: className, events: events, name: name, onChange: onChange, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, acceptTypes: acceptTypes, defaultValue: value, deleteVisible: deleteVisible, downloadVisible: downloadVisible, maxSize: maxSize, maxUploadCount: maxUploadCount, single: single }), (validateState === 'error' || validateState === 'warn') && (_jsx(Tips, { tips: validateErrorMsg, type: "warn" }))] }));
45
45
  });
46
- FormUploadFile.whyDidYouRender = true;
47
46
  export default FormUploadFile;
@@ -206,7 +206,9 @@ const FormDetailCom = forwardRef(function FormDetail(props, ref) {
206
206
  });
207
207
  }
208
208
  });
209
- parent === null || parent === void 0 ? void 0 : parent.setValue(formDetailItemValue);
209
+ if (Object.keys(parent.initialValues || {}).length == 0) {
210
+ parent === null || parent === void 0 ? void 0 : parent.setValue(formDetailItemValue);
211
+ }
210
212
  setIsInit(false);
211
213
  }
212
214
  }, [
@@ -1,13 +1,13 @@
1
- import React from 'react';
2
- if (process.env.NODE_ENV === 'development') {
3
- // eslint-disable-next-line rulesdir/no-phantom-deps, @typescript-eslint/no-var-requires
4
- import('@welldone-software/why-did-you-render').then((whyDidYouRender) => {
5
- whyDidYouRender.default(React, {
6
- trackHooks: false,
7
- trackAllPureComponents: true,
8
- });
9
- });
10
- }
1
+ // import React from 'react';
2
+ // if (process.env.NODE_ENV === 'development') {
3
+ // // eslint-disable-next-line rulesdir/no-phantom-deps, @typescript-eslint/no-var-requires
4
+ // import('@welldone-software/why-did-you-render').then((whyDidYouRender) => {
5
+ // whyDidYouRender.default(React, {
6
+ // trackHooks: false,
7
+ // trackAllPureComponents: true,
8
+ // });
9
+ // });
10
+ // }
11
11
  import '@tcwd/style-wedatheme/index.css';
12
12
  import loadable from '@loadable/component';
13
13
  import { fallback } from '../utils/loading-fallback';
@@ -6,7 +6,7 @@ const CLASS_PREFIX = 'weda-menu';
6
6
  // 标题
7
7
  export const renderTitle = (navigationStyle) => {
8
8
  const { title, titleColor, showTitle, titleFontSize } = navigationStyle;
9
- return (showTitle && (_jsx("span", { "data-testid": "navigationBar-title", style: {
9
+ return (showTitle && (_jsx("span", { "data-testid": "navigationBar-title", className: "weda-menu__title_text", style: {
10
10
  display: 'inline-block',
11
11
  color: titleColor,
12
12
  fontSize: titleFontSize,
@@ -64,7 +64,7 @@ const HorizontalMenu = ({ menuData, navigationStyle, selected, setSelected, navi
64
64
  }, children: renderMenuTitle(navigationStyle, { title }, false) }, key)) : (_jsx(List.SubMenu, { className: `${CLASS_PREFIX}__dropdown-list-item`, label: renderMenuTitle(navigationStyle, { title }, false), children: renderMenuList(children, navigationStyle) }, key));
65
65
  }) }));
66
66
  };
67
- return (_jsx(NavMenu, { style: menuStyle, className: `${CLASS_PREFIX}__nav`, left: _jsxs(_Fragment, { children: [_jsx(NavMenu.Item, { type: "logo", className: `${CLASS_PREFIX}__nav-logo`, children: _jsx(MenuLogo, { navigationStyle: navigationStyle, className: `${CLASS_PREFIX}__nav-logo--img` }) }), _jsx(NavMenu.Item, { className: `${CLASS_PREFIX}__nav-title`, children: _jsx("span", { className: `${CLASS_PREFIX}__title`, children: renderTitle(navigationStyle) }) })] }), right: _jsxs("div", { className: `${CLASS_PREFIX}__nav-wrap`, children: [_jsxs(_Fragment, { children: [showButton && position.index > 0 && (_jsxs("div", { className: `${CLASS_PREFIX}__nav-shadow leftButton`, onClick: () => {
67
+ return (_jsx(NavMenu, { style: menuStyle, className: `${CLASS_PREFIX}__nav`, left: _jsxs(_Fragment, { children: [navigationStyle.showLogo && (_jsx(NavMenu.Item, { type: "logo", className: `${CLASS_PREFIX}__nav-logo`, children: _jsx(MenuLogo, { navigationStyle: navigationStyle, className: `${CLASS_PREFIX}__nav-logo--img` }) })), _jsx(NavMenu.Item, { className: `${CLASS_PREFIX}__nav-title`, children: _jsx("span", { className: `${CLASS_PREFIX}__title`, children: renderTitle(navigationStyle) }) })] }), right: _jsxs("div", { className: `${CLASS_PREFIX}__nav-wrap`, children: [_jsxs(_Fragment, { children: [showButton && position.index > 0 && (_jsxs("div", { className: `${CLASS_PREFIX}__nav-shadow leftButton`, onClick: () => {
68
68
  const result = position.offset + menuOffset[position.index];
69
69
  setPosition({ index: position.index - 1, offset: result });
70
70
  }, children: [_jsx("div", { className: `${CLASS_PREFIX}__shadow--icon` }), _jsx("div", { className: `${CLASS_PREFIX}__shadow` }), _jsx("div", { className: `${CLASS_PREFIX}__shadow--white` })] })), _jsx("div", { className: `${CLASS_PREFIX}__nav-content box`, children: _jsx("div", { ref: navWrapRef, className: `${CLASS_PREFIX}__nav-content`, style: { transform: `translate(${position.offset}px, 0px)` }, children: menuData === null || menuData === void 0 ? void 0 : menuData.map((i) => {
@@ -301,6 +301,17 @@
301
301
  font-size: 16px;
302
302
  color: #000000;
303
303
  margin-left: 12px;
304
+ display: flex;
305
+ }
306
+ .weda-menu-horizontal
307
+ .weda-menu__nav
308
+ .weda-menu__nav-title
309
+ .weda-menu__title
310
+ .weda-menu__title_text {
311
+ white-space: nowrap;
312
+ max-width: 300px;
313
+ text-overflow: ellipsis;
314
+ overflow: hidden;
304
315
  }
305
316
 
306
317
  .weda-menu-horizontal .weda-menu__nav .wedatea2td-nav__flex-end {
@@ -155,7 +155,14 @@ export default function NavigationBar({ navigationbar, contentSlot, navigationSl
155
155
  const MenuRender = () => {
156
156
  return (_jsxs("div", { className: `${CLASS_PREFIX}__wrapper`, style: {
157
157
  background: (navigationStyle === null || navigationStyle === void 0 ? void 0 : navigationStyle.menuBackgroundColor) || '#fff',
158
- }, children: [platform !== 'h5' && !isHorizontal && (_jsx(VerticalMenu, { menuData: menuData, navigationStyle: navigationStyle, setMenuData: setMenuData, selected: selected, setSelected: setSelected, navigationSlot: navigationSlot })), platform !== 'h5' && isHorizontal && (_jsx(HorizontalMenu, { menuData: menuData, navigationStyle: navigationStyle, selected: selected, setSelected: setSelected, navigationSlot: navigationSlot })), platform === 'h5' && (_jsx(H5Menu, { menuData: isMultiTerminal ? mobileMenuData : menuData, navigationStyle: navigationStyle, setMenuData: setMenuData, className: className, selected: selected, setSelected: setSelected, navigationSlot: navigationSlot, visible: visible, setVisible: setVisible }))] }));
158
+ }, children: [platform !== 'h5' && !isHorizontal && (_jsx(VerticalMenu, { menuData: menuData, navigationStyle: navigationStyle, setMenuData: setMenuData, selected: selected, setSelected: setSelected, navigationSlot: navigationSlot })), platform !== 'h5' && isHorizontal && (_jsx(HorizontalMenu, { menuData: menuData, navigationStyle: navigationStyle, selected: selected, setSelected: setSelected, navigationSlot: navigationSlot })), platform === 'h5' && (_jsx(H5Menu, { menuData: isMultiTerminal ? mobileMenuData : menuData, navigationStyle: navigationStyle, setMenuData: (menus) => {
159
+ if (isMultiTerminal) {
160
+ setMobileMenuData(menus);
161
+ }
162
+ else {
163
+ setMenuData(menus);
164
+ }
165
+ }, className: className, selected: selected, setSelected: setSelected, navigationSlot: navigationSlot, visible: visible, setVisible: setVisible }))] }));
159
166
  };
160
167
  return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsxs("div", { className: cls, style: navigationWrapStyle, "data-testid": "navigationBar", children: [showNav && _jsx(MenuRender, {}), _jsx("div", { className: "menu-solt", children: contentSlot })] }) }));
161
168
  }
@@ -87,5 +87,5 @@ export function UploadCSVFile({ parseFile, fields, datasourceTitle, dbName, setD
87
87
  setDisableNext(true);
88
88
  }, children: "\u5220\u9664" })] }) }), children: isDragging ? ('释放鼠标') : (_jsx(Status, { className: "upload-file", icon: 'blank', size: 's', operation: _jsxs(_Fragment, { children: [_jsx("a", { onClick: open, children: "\u70B9\u51FB\u4E0A\u4F20" }), " /", ' ', _jsx(Text, { theme: "weak", children: "\u62D6\u62FD\u5230\u6B64\u533A\u57DF" })] }) })) })) }) }), _jsx("div", { className: "modal-upload-text-wrap", children: _jsxs("ul", { children: [_jsxs("li", { children: ["1\u3001\u8BF7\u4E0B\u8F7D\u4F7F\u7528", _jsx("span", { onClick: () => {
89
89
  getCSVTemplate(fields, datasourceTitle);
90
- }, children: "\u00A0 \u5BFC\u5165\u6A21\u7248" }), "\uFF0C\u5E76\u6309\u7167\u793A\u4F8B\u586B\u5199\u6570\u636E\uFF0C\u4EE5\u4FDD\u8BC1\u6570\u636E\u5BFC\u5165\u987A\u5229"] }), _jsx("li", { children: "2\u3001\u652F\u6301xlsx\u7C7B\u578B\u6587\u4EF6\uFF0C\u8981\u6C42\u6587\u4EF6\u5927\u5C0F2M\u4EE5\u5185\uFF0C\u4E0D\u80FD\u8D85\u8FC710000\u884C" }), _jsxs("li", { children: [_jsx("div", { children: "3\u3001\u5BFC\u5165\u66F4\u65B0\u8BF4\u660E" }), _jsx("div", { children: "\u00A01\uFF09\u652F\u6301\u9009\u62E9\u5F00\u542F\u552F\u4E00\u5C5E\u6027\u7684\u5B57\u6BB5\uFF0C\u7528\u4E8E\u5339\u914D\u5E76\u66F4\u65B0\u5DF2\u6709\u7684\u6570\u636E\u8BB0\u5F55" }), _jsx("div", { children: "\u00A02\uFF09\u5BFC\u5165\u6A21\u5F0F\u4E3A\u300C\u65B0\u589E\u6216\u66F4\u65B0\u300D\u65F6\uFF0C\u5982\u300C\u6570\u636E\u6807\u8BC6\u300D\u5217\u4E3A\u7A7A\uFF0C\u8BE5\u884C\u6570\u636E\u4F1A\u6267\u884C\u65B0\u589E\u64CD\u4F5C" })] }), _jsxs("li", { children: [_jsx("div", { children: "4\u3001\u6570\u636E\u683C\u5F0F\u8BF4\u660E" }), _jsx("div", { children: "\u00A0 1\uFF09\u679A\u4E3E\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u9009\u62E9\u9009\u9879\u6807\u8BC6\u6216\u9009\u9879\u503C\u8FDB\u884C\u5BFC\u5165\uFF1A\u9009\u9879\u6807\u8BC6\u4E3A\u8868\u683C\u4E2D\u5C55\u793A\u7684\u4E1A\u52A1\u540D\u79F0\uFF1B\u9009\u9879\u503C\u4E3A\u9009\u9879\u7684\u7CFB\u7EDF\u552F\u4E00\u6807\u8BC6" }), _jsx("div", { children: "\u00A02\uFF09\u5173\u8054\u5173\u7CFB\u3001\u4E3B\u5B50\u660E\u7EC6\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u9009\u62E9\u4E3B\u5217\u5B57\u6BB5\u6216\u6570\u636E\u6807\u8BC6\u8FDB\u884C\u5BFC\u5165\uFF1A\u4E3B\u5217\u5B57\u6BB5\u4E3A\u8868\u683C\u4E2D\u5C55\u793A\u7684\u5173\u8054\u6570\u636E\u4E1A\u52A1\u540D\u79F0\uFF1B\u6570\u636E\u6807\u8BC6\u4E3A\u5173\u8054\u6570\u636E\u7684\u7CFB\u7EDF\u552F\u4E00\u6807\u8BC6" }), _jsx("div", { children: "\u00A03\uFF09\u5E03\u5C14\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u5BFC\u5165\u300C\u662F/\u5426\u300D\u6216\u300Ctrue/false\u300D" }), _jsx("div", { children: "\u00A04\uFF09\u56FE\u7247\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u5BFC\u5165https\u6216cloud\u534F\u8BAE\u7684\u56FE\u7247\u5730\u5740" }), _jsx("div", { children: "\u00A05\uFF09\u6587\u4EF6\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301cloud\u534F\u8BAE\u7684\u6587\u4EF6\u5730\u5740" }), _jsx("div", { children: "\u00A06\uFF09\u5730\u7406\u4F4D\u7F6E\u7C7B\u578B\u6570\u636E\uFF1A\u6570\u636E\u683C\u5F0F\u8981\u6C42\u4E3A\u5730\u70B9\u540D\u79F0(\u5750\u6807\u7ECF\u5EA6\uFF0C\u5750\u6807\u7EF4\u5EA6)" })] })] }) })] }));
90
+ }, children: "\u00A0 \u5BFC\u5165\u6A21\u7248" }), "\uFF0C\u5E76\u6309\u7167\u793A\u4F8B\u586B\u5199\u6570\u636E\uFF0C\u4EE5\u4FDD\u8BC1\u6570\u636E\u5BFC\u5165\u987A\u5229"] }), _jsx("li", { children: "2\u3001\u652F\u6301xlsx\u7C7B\u578B\u6587\u4EF6\uFF0C\u8981\u6C42\u6587\u4EF6\u5927\u5C0F2M\u4EE5\u5185\uFF0C\u4E0D\u80FD\u8D85\u8FC710000\u884C" }), _jsxs("li", { children: [_jsx("div", { children: "3\u3001\u5BFC\u5165\u66F4\u65B0\u8BF4\u660E" }), _jsx("div", { children: "\u00A01\uFF09\u652F\u6301\u9009\u62E9\u5F00\u542F\u552F\u4E00\u5C5E\u6027\u7684\u5B57\u6BB5\uFF0C\u7528\u4E8E\u5339\u914D\u5E76\u66F4\u65B0\u5DF2\u6709\u7684\u6570\u636E\u8BB0\u5F55" }), _jsx("div", { children: "\u00A02\uFF09\u5BFC\u5165\u6A21\u5F0F\u4E3A\u300C\u65B0\u589E\u6216\u66F4\u65B0\u300D\u65F6\uFF0C\u5982\u300C\u6570\u636E\u6807\u8BC6\u300D\u5217\u4E3A\u7A7A\uFF0C\u8BE5\u884C\u6570\u636E\u4F1A\u6267\u884C\u65B0\u589E\u64CD\u4F5C" }), _jsx("div", { children: "\u00A03\uFF09\u5355\u5143\u683C\u5185\u5BB9\u4E3A\u7A7A\u65F6\uFF0C\u8BE5\u7A7A\u503C\u5C06\u8986\u76D6\u539F\u6709\u6570\u636E\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C" })] }), _jsxs("li", { children: [_jsx("div", { children: "4\u3001\u6570\u636E\u683C\u5F0F\u8BF4\u660E" }), _jsx("div", { children: "\u00A0 1\uFF09\u679A\u4E3E\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u9009\u62E9\u9009\u9879\u6807\u8BC6\u6216\u9009\u9879\u503C\u8FDB\u884C\u5BFC\u5165\uFF1A\u9009\u9879\u6807\u8BC6\u4E3A\u8868\u683C\u4E2D\u5C55\u793A\u7684\u4E1A\u52A1\u540D\u79F0\uFF1B\u9009\u9879\u503C\u4E3A\u9009\u9879\u7684\u7CFB\u7EDF\u552F\u4E00\u6807\u8BC6" }), _jsx("div", { children: "\u00A02\uFF09\u5173\u8054\u5173\u7CFB\u3001\u4E3B\u5B50\u660E\u7EC6\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u9009\u62E9\u4E3B\u5217\u5B57\u6BB5\u6216\u6570\u636E\u6807\u8BC6\u8FDB\u884C\u5BFC\u5165\uFF1A\u4E3B\u5217\u5B57\u6BB5\u4E3A\u8868\u683C\u4E2D\u5C55\u793A\u7684\u5173\u8054\u6570\u636E\u4E1A\u52A1\u540D\u79F0\uFF1B\u6570\u636E\u6807\u8BC6\u4E3A\u5173\u8054\u6570\u636E\u7684\u7CFB\u7EDF\u552F\u4E00\u6807\u8BC6" }), _jsx("div", { children: "\u00A03\uFF09\u5E03\u5C14\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u5BFC\u5165\u300C\u662F/\u5426\u300D\u6216\u300Ctrue/false\u300D" }), _jsx("div", { children: "\u00A04\uFF09\u56FE\u7247\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u5BFC\u5165https\u6216cloud\u534F\u8BAE\u7684\u56FE\u7247\u5730\u5740" }), _jsx("div", { children: "\u00A05\uFF09\u6587\u4EF6\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301cloud\u534F\u8BAE\u7684\u6587\u4EF6\u5730\u5740" }), _jsx("div", { children: "\u00A06\uFF09\u5730\u7406\u4F4D\u7F6E\u7C7B\u578B\u6570\u636E\uFF1A\u6570\u636E\u683C\u5F0F\u8981\u6C42\u4E3A\u5730\u70B9\u540D\u79F0(\u5750\u6807\u7ECF\u5EA6\uFF0C\u5750\u6807\u7EF4\u5EA6)" })] })] }) })] }));
91
91
  }
@@ -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, 500] */
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,7 @@ 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
+ const SET_VALUE_DEBOUNCE_TIMEOUT = 200;
19
20
  const logger = debug('wd-form');
20
21
  const WdForm = React.forwardRef(function WdForm(props, ref) {
21
22
  var _a;
@@ -39,6 +40,8 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
39
40
  'gsd-h5-react-form-pc': platform === 'pc',
40
41
  'wedatea2td-form': platform === 'pc',
41
42
  }, className);
43
+ const isDataModel = !['connector', 'custom-connector'].includes(datasourceType); // 是否为数据模型,兼容历史 undefined
44
+ const hasSetInitValueRef = useRef(false);
42
45
  const [initialValues, setInitialValues] = useState((_a = props.initialValues) !== null && _a !== void 0 ? _a : emptyObject);
43
46
  const eventsRef = useSyncedRef(props.events);
44
47
  const validate = useCallback(async () => {
@@ -71,6 +74,17 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
71
74
  return errObj;
72
75
  }, [formItemMap]);
73
76
  const [errors, setErrors] = useState(undefined);
77
+ const { remoteValue: fetchedInitialValues, isLoading: isLoadingInitValues, error: initValueFetchError, } = useRemoteValue({
78
+ appCloud,
79
+ formType,
80
+ _id,
81
+ // methodCreate,
82
+ methodGetItem,
83
+ // methodUpdate,
84
+ paramGetItem,
85
+ dataSourceName,
86
+ isDataModel,
87
+ });
74
88
  const submit = useCallback(async () => {
75
89
  const { submit } = eventsRef.current;
76
90
  const errorObj = await validate();
@@ -96,7 +110,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
96
110
  }
97
111
  });
98
112
  }, [eventsRef, formItemMap]);
99
- const setValue = useCallback((data, setNull) => {
113
+ const setValue = useDebouncedCallback((data, setNull) => {
100
114
  if (typeof data !== 'object' || typeof data === null) {
101
115
  console.warn('setValue data need expect a object but got', data);
102
116
  return;
@@ -115,7 +129,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
115
129
  }
116
130
  });
117
131
  updateFormContext();
118
- }, [formItemMap, updateFormContext]);
132
+ }, [formItemMap, updateFormContext], SET_VALUE_DEBOUNCE_TIMEOUT);
119
133
  const clearValidate = useCallback(() => {
120
134
  formItemMap.forEach((item) => {
121
135
  if (!item.clearValidate || typeof item.clearValidate !== 'function') {
@@ -128,6 +142,10 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
128
142
  // useWhatChanged([formItemMap, initialValues, submit, validate]);
129
143
  useLoopRenderDetect();
130
144
  const { ready } = useWedaAppContext();
145
+ const [visible, setVisible] = React.useState(false);
146
+ React.useEffect(() => {
147
+ setVisible(true);
148
+ }, []);
131
149
  const previousFormType = useRef(null);
132
150
  useEffect(() => {
133
151
  if (!ready) {
@@ -144,8 +162,16 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
144
162
  }
145
163
  else {
146
164
  formItemMap.forEach((item) => {
147
- var _a;
148
- item.setReadOnly((_a = item.initialDisabled) !== null && _a !== void 0 ? _a : false);
165
+ const { initialReadOnly, initialDisabled } = item || {};
166
+ if (initialReadOnly) {
167
+ item.setReadOnly(true);
168
+ }
169
+ else if (initialDisabled) {
170
+ item.setDisabled(true);
171
+ }
172
+ else {
173
+ item.setReadOnly(false);
174
+ }
149
175
  });
150
176
  }
151
177
  });
@@ -153,18 +179,6 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
153
179
  useMountEffect(() => {
154
180
  logger.debug('formItemMap', formItemMap);
155
181
  });
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
182
  useEffect(() => {
169
183
  if (isLoadingInitValues)
170
184
  return;
@@ -173,8 +187,13 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
173
187
  错误处理放在了 @link {onInitialValuesError}
174
188
  下面是可以拿到data了
175
189
  */
176
- // TODO: 有哪些key可以暴露
177
- setInitialValues(fetchedInitialValues);
190
+ setInitialValues((original) => {
191
+ if (hasSetInitValueRef.current) {
192
+ return original;
193
+ }
194
+ hasSetInitValueRef.current = true;
195
+ return fetchedInitialValues;
196
+ });
178
197
  setValue(fetchedInitialValues, true);
179
198
  }
180
199
  }, [fetchedInitialValues, initValueFetchError, isLoadingInitValues, setValue]);
@@ -323,10 +342,12 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
323
342
  }
324
343
  }
325
344
  updateFormContext();
326
- }, [formItemMap, initialValues, updateFormContext],
327
- // eslint-disable-next-line @typescript-eslint/no-magic-numbers
328
- 200);
345
+ }, [formItemMap, initialValues, updateFormContext], SET_VALUE_DEBOUNCE_TIMEOUT);
346
+ const lastInitValueRef = useRef(null);
329
347
  React.useEffect(() => {
348
+ if (isObjectEqual(lastInitValueRef.current, initialValues)) {
349
+ return;
350
+ }
330
351
  // 单向 Form向下设置值
331
352
  let setValueReady = false;
332
353
  const timeout = 30;
@@ -346,6 +367,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
346
367
  setInitValue();
347
368
  };
348
369
  setValueUntilReady();
370
+ lastInitValueRef.current = initialValues;
349
371
  return () => {
350
372
  if (id) {
351
373
  clearTimeout(id);
@@ -381,7 +403,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
381
403
  }
382
404
  return 'vertical-left';
383
405
  }, [layout]);
384
- return (_jsx(FormUi, { layout: layout, className: cls, style: style, id: id, labelPosition: labelPosition, children: contentSlot }));
406
+ return (_jsx(FormUi, { layout: layout, className: cls, style: style, id: id, labelPosition: labelPosition, children: visible && contentSlot }));
385
407
  });
386
408
  function getFormDataFromItemMap(formItemMap) {
387
409
  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
+ // eslint-disable-next-line complexity
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', onClick: onClick, ...propsStartWithOn }));
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
  });
@@ -40,6 +40,10 @@ export const FilterFieldItem = ({ updateFilterData, ...filterFieldItemConfig })
40
40
  const { filterType, isRange, label, options, fieldCalculation, value } = filterFieldItemConfig;
41
41
  const updateFilterConfig = (value) => {
42
42
  const lastFilterConfig = { ...filterFieldItemConfig, ...value };
43
+ // 选择为空不为空,则清空数据
44
+ if (['$empty', '$nempty'].includes(lastFilterConfig === null || lastFilterConfig === void 0 ? void 0 : lastFilterConfig.fieldCalculation.value)) {
45
+ lastFilterConfig.value = '';
46
+ }
43
47
  updateFilterData(lastFilterConfig);
44
48
  };
45
49
  useEffect(() => {
@@ -1,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--status`]: isShowLoading || isError || !(records === null || records === void 0 ? void 0 : records.length),
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: (_jsx(StatusContent, { emptyText: '数据加载中,请稍候...', component: "table", icon: "loading", isH5: isH5 })),
52
- emptyText: (_jsx(StatusContent, { emptyText: isNoDataSourceBind ? '请绑定数据源' : _emptyText, component: "table", icon: "empty", isH5: isH5 })),
53
- errorText: (_jsx(StatusContent, { emptyText: _jsxs("p", { children: ["\u6570\u636E\u52A0\u8F7D\u5931\u8D25,", _jsx("span", { className: `${classPrefix}-empty-retry-text`, onClick: () => {
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
- return (_jsx("div", { className: `${classPrefix}-table-scroll-wrap`, children: _jsx(Table, { ref: tableRef, className: classNames(className, classes), bordered: true, recordKey: recordKey, columns: columns, records: records, addons: tableAddons, bottomTip: bottomTipCompRender() }) }));
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
- loading: !error && !data,
18
+ viewLoading: !error && !data,
19
19
  };
20
20
  };