@cloudbase/weda-ui 3.24.1 → 3.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/configs/components/dataView.js +1 -0
  2. package/dist/configs/components/listView.js +1 -0
  3. package/dist/configs/components/wd-form-arr.js +4 -1
  4. package/dist/configs/components/wd-image.js +1 -1
  5. package/dist/configs/components/wd-select-multiple.js +1 -0
  6. package/dist/configs/components/wd-select.js +1 -0
  7. package/dist/configs/components/wd-table.d.ts +5 -0
  8. package/dist/configs/components/wd-table.js +12 -0
  9. package/dist/configs/components/wd-text.js +2 -2
  10. package/dist/configs/components/wxOpenApi/userInfo.d.ts +2 -2
  11. package/dist/configs/index.d.ts +12 -2
  12. package/dist/configs/type-utils/type-form.js +6 -4
  13. package/dist/configs/utils/field.d.ts +1 -0
  14. package/dist/configs/utils/field.js +151 -0
  15. package/dist/style/index.css +7 -2
  16. package/dist/style/index.scss +1 -1
  17. package/dist/style/weda-ui.min.css +4 -4
  18. package/dist/web/components/form/uploader/upload/index.js +3 -1
  19. package/dist/web/components/form/uploader/uploader.pc.js +3 -1
  20. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +25 -17
  21. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +26 -17
  22. package/dist/web/components/form/userOrgSelect/component/depart-breadcrumb.js +3 -1
  23. package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.d.ts +2 -2
  24. package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +8 -4
  25. package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +10 -3
  26. package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +6 -6
  27. package/dist/web/components/form/userOrgSelect/component/error-tips.d.ts +1 -1
  28. package/dist/web/components/form/userOrgSelect/component/error-tips.js +7 -4
  29. package/dist/web/components/form/userOrgSelect/component/modal-search-h5.js +3 -1
  30. package/dist/web/components/form/userOrgSelect/component/modal-search.js +4 -1
  31. package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +8 -11
  32. package/dist/web/components/form/userOrgSelect/component/org-tree.js +3 -1
  33. package/dist/web/components/form/userOrgSelect/component/selected-list-h5.js +8 -8
  34. package/dist/web/components/form/userOrgSelect/component/selected-list.js +5 -10
  35. package/dist/web/components/form/userOrgSelect/component/user-org-list.js +12 -21
  36. package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-list-h5.js +6 -10
  37. package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.d.ts +1 -1
  38. package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +5 -1
  39. package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.d.ts +1 -1
  40. package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.js +4 -2
  41. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +4 -2
  42. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.d.ts +2 -2
  43. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +6 -2
  44. package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.d.ts +2 -2
  45. package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +12 -11
  46. package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +9 -9
  47. package/dist/web/components/form-input-hooks/index.js +12 -4
  48. package/dist/web/components/form-input-hooks/validator.js +1 -1
  49. package/dist/web/components/formdetail/index.js +1 -0
  50. package/dist/web/components/index.d.ts +1 -0
  51. package/dist/web/components/index.js +1 -0
  52. package/dist/web/components/richText/const.d.ts +57 -0
  53. package/dist/web/components/richText/const.js +57 -0
  54. package/dist/web/components/richText/index.css +3 -1
  55. package/dist/web/components/richText/index.d.ts +1 -2
  56. package/dist/web/components/richText/index.js +26 -20
  57. package/dist/web/components/table/ImportFileModal/index.css +21 -69
  58. package/dist/web/components/uploaderFileView/index.js +2 -0
  59. package/dist/web/components/uploaderView/index.js +6 -3
  60. package/dist/web/components/wd-button/wd-button.js +5 -5
  61. package/dist/web/components/wd-config-provider/wd-config-context.d.ts +9 -0
  62. package/dist/web/components/wd-config-provider/wd-config-context.js +2 -0
  63. package/dist/web/components/wd-config-provider/wd-config-provider.js +8 -9
  64. package/dist/web/components/wd-form/hoc/form-container-decorator.js +2 -2
  65. package/dist/web/components/wd-form/hooks/use-remote-value.js +1 -1
  66. package/dist/web/components/wd-form-item/wd-form-item.js +9 -11
  67. package/dist/web/components/wd-image/ImagePreview.js +5 -1
  68. package/dist/web/components/wd-rich-text/wd-rich-text.js +1 -1
  69. package/dist/web/components/wd-table/table-with-form.js +28 -14
  70. package/dist/web/components/wd-table/wd-table.js +14 -4
  71. package/dist/web/components/wd-tree/utils.d.ts +1 -1
  72. package/dist/web/components/wd-upload-file/wd-upload-file.js +5 -1
  73. package/dist/web/utils/config-context/use-config.d.ts +1 -0
  74. package/dist/web/utils/config-context/use-config.js +2 -1
  75. package/dist/web/utils/hooks/useCanPreview.js +1 -1
  76. package/dist/web/utils/i18n/index.d.ts +1 -0
  77. package/dist/web/utils/i18n/index.js +1 -0
  78. package/dist/web/utils/i18n/locale/en_US.d.ts +119 -0
  79. package/dist/web/utils/i18n/locale/en_US.js +187 -0
  80. package/dist/web/utils/i18n/locale/zh_CN.d.ts +120 -0
  81. package/dist/web/utils/i18n/locale/zh_CN.js +188 -0
  82. package/dist/web/utils/i18n/translation.d.ts +9 -0
  83. package/dist/web/utils/i18n/translation.js +28 -0
  84. package/dist/web/utils/i18n/translationMap.d.ts +15 -0
  85. package/dist/web/utils/i18n/translationMap.js +10 -0
  86. package/package.json +4 -3
@@ -1,13 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { WdConfigContext } from './wd-config-context';
4
- const configStore = {};
2
+ import { useMemo } from 'react';
3
+ import { WdConfigContext, DEFAULT_CLASS_PREFIX, DEFAULT_LOCALE } from './wd-config-context';
4
+ const configStore = { classPrefix: DEFAULT_CLASS_PREFIX, locale: DEFAULT_LOCALE };
5
5
  export function ConfigProvider({ children, ...configProps }) {
6
- useEffect(() => {
7
- Object.assign(configStore, { ...configProps, ...configStore });
8
- // eslint-disable-next-line react-hooks/exhaustive-deps
9
- }, [configProps.classPrefix]);
10
6
  // props 优先级高于全局配置
11
- const config = Object.assign({}, configStore, configProps);
12
- return (_jsx(WdConfigContext.Provider, { value: config, children: children }));
7
+ const config = useMemo(() => {
8
+ // 合并全局配置和组件props,props优先级更高
9
+ return { ...configStore, ...configProps };
10
+ }, [configProps]); // 依赖项为 configProps
11
+ return _jsx(WdConfigContext.Provider, { value: config, children: children });
13
12
  }
@@ -15,7 +15,7 @@ import { useFormFieldObj } from '../contexts/form-field-obj-context';
15
15
  */
16
16
  export function withFormContainer(Component) {
17
17
  const WithFormContainer = React.forwardRef((props, ref) => {
18
- var _a, _b;
18
+ var _a;
19
19
  const { ...componentProps } = props;
20
20
  const formField = useFormField();
21
21
  const formFieldObjsContext = useFormFieldObj();
@@ -54,7 +54,7 @@ export function withFormContainer(Component) {
54
54
  // 顶层没有表单容器,则组件自己管理值
55
55
  // 非table组件,直接渲染原始组件,值交给顶层表单容器管理
56
56
  // 在表单容器内,table组件,如果结合嵌套组件使用,则将组件值交给顶层表单容器管理,否则自己管理
57
- const shouldUseProvider = formField ? !formFieldObjsContext && ((_b = props === null || props === void 0 ? void 0 : props.id) === null || _b === void 0 ? void 0 : _b.includes('table')) : true;
57
+ const shouldUseProvider = formField ? !formFieldObjsContext && (props === null || props === void 0 ? void 0 : props.componentType) === 'table' : true;
58
58
  if (!shouldUseProvider) {
59
59
  return _jsx(Component, { ...props, ref: ref, isInformContainer: true });
60
60
  }
@@ -226,7 +226,7 @@ export function useRemoteParamsFromValue({ dataSourceProfile, formData, formType
226
226
  const format = (_c = (_b = (_a = dataSourceProfile.schema) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b[cur]) === null || _c === void 0 ? void 0 : _c.format;
227
227
  acc[cur] = formData[cur];
228
228
  if (SINGLE_SELECT_FORMATS.includes(format)) {
229
- acc[cur] = { _id: formData[cur] || '' };
229
+ acc[cur] = { _id: formData[cur] };
230
230
  }
231
231
  if (MULTI_SELECT_FORMATS.includes(format)) {
232
232
  acc[cur] = (_d = acc[cur]) === null || _d === void 0 ? void 0 : _d.map((_id) => ({ _id }));
@@ -17,24 +17,21 @@ const Label = React.memo(function Label({ labelCls, labelStyle, itemWrap, inputI
17
17
  const Item = React.memo(function Item({ itemWrap, testId, controlWrapCls, readOnly, before, after, readValue, readBeforeAfter, format, value, children, }) {
18
18
  return (_jsx("div", { className: `${itemWrap}__control`, "data-testid": testId, children: _jsx("div", { className: controlWrapCls, children: _jsx(WdFormItemReadOnly, { readOnly: readOnly, readValue: readValue, version: "wd", before: before, after: after, readBeforeAfter: readBeforeAfter, format: format, value: value, children: children }) }) }));
19
19
  });
20
- const LabelContainer = React.memo(function LabelContainer(props) {
21
- const { mode, labelProps, itemProps, children } = props || {};
20
+ const LabelContainerComp = React.memo(function LabelContainer(props) {
21
+ const { isH5, isRoot, labelVisible, mode, labelProps, itemProps, children } = props || {};
22
22
  const cardRef = React.createRef();
23
23
  const [iconName, setIconName] = useState('chevronup');
24
24
  const headerSlot = (_jsxs(_Fragment, { children: [_jsx(WdIcon, { name: iconName, events: {
25
25
  tap: () => {
26
26
  setIconName(iconName === 'chevrondown' ? 'chevronup' : 'chevrondown');
27
27
  },
28
- } }), _jsx(Label, { ...labelProps })] }));
29
- if (mode === 'custom' || mode === 'table') {
30
- return _jsx(Item, { ...itemProps, children: children });
28
+ } }), (labelVisible || (!isH5 && isRoot)) && _jsx(Label, { ...labelProps })] }));
29
+ const showLabel = isRoot && labelVisible;
30
+ if (mode === 'custom' || mode === 'table' || mode === 'web-table') {
31
+ return (_jsxs(_Fragment, { children: [showLabel && _jsx(Label, { ...labelProps }), _jsx(Item, { ...itemProps, children: children }), ' '] }));
31
32
  }
32
33
  const contentSlot = _jsx(Item, { ...itemProps, children: children });
33
- return (_jsx(WdCard, { ref: cardRef, className: iconName === 'chevrondown' ? 'wd-card-content__hidden' : '', showContent: true, headerSlot: headerSlot, contentSlot: contentSlot, events: { tap: () => { } } }));
34
- });
35
- const LabelContainerComp = React.memo(function LabelContainerComp({ isRoot, isH5, mode, labelProps, itemProps, children, }) {
36
- const showLabel = isRoot && !isH5;
37
- return (_jsxs(_Fragment, { children: [showLabel && _jsx(Label, { ...labelProps }), _jsx(LabelContainer, { isRoot: isRoot, labelProps: labelProps, itemProps: itemProps, mode: mode, children: children })] }));
34
+ return (_jsxs(_Fragment, { children: [showLabel && !isH5 && _jsx(Label, { ...labelProps }), ' ', _jsx(WdCard, { ref: cardRef, className: iconName === 'chevrondown' ? 'wd-card-content__hidden' : '', showContent: true, headerSlot: headerSlot, contentSlot: contentSlot, events: { tap: () => { } } })] }));
38
35
  });
39
36
  /**
40
37
  * 表单项包裹,包括标题、文本提示、校验
@@ -152,5 +149,6 @@ export const WdFormItem = React.memo(function WdFormItem(props) {
152
149
  };
153
150
  if (!visible)
154
151
  return null;
155
- return (_jsxs("div", { className: cls, id: isRoot ? id : null, style: style, children: [_jsx("div", { className: itemWrap, children: hasLabelContainer ? (_jsx(LabelContainerComp, { isRoot: isRoot, isH5: isH5, mode: props === null || props === void 0 ? void 0 : props.mode, labelProps: labelProps, itemProps: itemProps, children: children })) : (_jsxs(_Fragment, { children: [labelVisible && _jsx(Label, { ...labelProps }), _jsx(Item, { ...itemProps, children: children })] })) }), Message, Help] }));
152
+ const labelClass = classNames({ [`${itemWrap}`]: true, [`${itemWrap}__vertical`]: hasLabelContainer && isH5 });
153
+ return (_jsxs("div", { className: cls, id: isRoot ? id : null, style: style, children: [_jsx("div", { className: labelClass, children: hasLabelContainer ? (_jsx(LabelContainerComp, { isRoot: isRoot, isH5: isH5, mode: props === null || props === void 0 ? void 0 : props.mode, labelProps: labelProps, itemProps: itemProps, labelVisible: labelVisible, children: children })) : (_jsxs(_Fragment, { children: [labelVisible && _jsx(Label, { ...labelProps }), _jsx(Item, { ...itemProps, children: children })] })) }), Message, Help] }));
156
154
  });
@@ -95,7 +95,11 @@ export const ImagePreview = (props) => {
95
95
  setCurrentImg(previewImageList[index]);
96
96
  });
97
97
  }, [children, index, previewImageList, setCurrentImg]);
98
- return (_jsxs(_Fragment, { children: [child, visible && (_jsx(Portal, { type: "div", portalContainer: portalContainer, children: _jsx("div", { "data-testid": "portal-container", style: { zIndex: 1010, position: 'relative' }, className: `${classPrefix}-image-preview-container`, children: _jsxs("div", { className: `${classPrefix}-image-mask`, onClick: onMaskClick, children: [_jsx("div", { onClick: (e) => {
98
+ return (_jsxs(_Fragment, { children: [child, visible && (_jsx(Portal, { type: "div", portalContainer: portalContainer, children: _jsx("div", { "data-testid": "portal-container", style: { zIndex: 1010, position: 'relative' }, className: `${classPrefix}-image-preview-container`, children: _jsxs("div", { className: `${classPrefix}-image-mask`, onDoubleClick: (e) => {
99
+ e.stopPropagation();
100
+ }, onClick: onMaskClick, children: [_jsx("div", { onDoubleClick: (e) => {
101
+ e.stopPropagation();
102
+ }, onClick: (e) => {
99
103
  if (isStopPropagation) {
100
104
  e.stopPropagation();
101
105
  }
@@ -26,5 +26,5 @@ export const WdRichText = forwardRef(function WdRichText(props, ref) {
26
26
  };
27
27
  if (!visible)
28
28
  return null;
29
- return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(RichText, { placeholder: true, events: events, acceptTypes: acceptTypes, maxSize: maxSize, readOnly: readOnly, disabled: disabled, value: value, decorator: null, onChange: onChange, id: props.id, storageType: storageType }) }));
29
+ return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(RichText, { events: events, acceptTypes: acceptTypes, maxSize: maxSize, readOnly: readOnly, disabled: disabled, value: value, decorator: null, onChange: onChange, id: props.id, storageType: storageType }) }));
30
30
  });
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
2
+ import React, { forwardRef, useMemo, useState } from 'react';
3
3
  import { useDeepCompareEffect } from '@react-hookz/web';
4
4
  import { Table } from './components';
5
5
  // eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
@@ -7,26 +7,40 @@ import { withFormContainer } from '../wd-form/hoc/form-container-decorator';
7
7
  import { useFormField } from '../wd-form/contexts/form-field-context';
8
8
  import { useFormFieldObj } from '../wd-form/contexts/form-field-obj-context';
9
9
  import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
10
- export const TableWithForm = withFormContainer(forwardRef(function TableComp(tableProps, ref) {
10
+ import isObjectEqual from '../../utils/isObjectEqual';
11
+ export const TableWithForm = withFormContainer(React.memo(forwardRef(function TableComp(tableProps, ref) {
12
+ var _a, _b;
11
13
  const { records = [] } = tableProps;
12
14
  const formField = useFormField();
13
- const { formFieldsValue = [], setFieldValue, setFormFieldsValue } = formField || {};
15
+ const { formFieldsValue = [], setFieldValue, setFormFieldsValue, getFieldValue } = formField || {};
14
16
  const formFieldObjsContext = useFormFieldObj();
17
+ const [columns, setColumns] = useState(tableProps.columns);
18
+ const isEditorMode = (_b = (_a = window.$w) === null || _a === void 0 ? void 0 : _a.wedaContext) === null || _b === void 0 ? void 0 : _b.isEditorMode;
19
+ const parentNamePath = tableProps.isInformContainer && (formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.isChildField) ? formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath : null;
20
+ const tableValue = useMemo(() => {
21
+ return parentNamePath && getFieldValue ? getFieldValue({ namePath: parentNamePath }) : formFieldsValue;
22
+ }, [formFieldsValue, getFieldValue, parentNamePath]);
15
23
  useDeepCompareEffect(() => {
24
+ if (!isObjectEqual(tableProps.columns, columns, true)) {
25
+ setColumns(tableProps.columns);
26
+ }
27
+ }, [tableProps.columns]);
28
+ useDeepCompareEffect(() => {
29
+ // records变化时,同步更新value
16
30
  const value = [...records];
17
- if (tableProps.isInformContainer) {
18
- if (setFieldValue) {
19
- // 在表单容器内,表格作为子表单,结合嵌套组件使用,通过顶层表单容器实现值管理
20
- const parentNamePath = (formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.isChildField) ? formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath : [];
21
- setFieldValue({ namePath: parentNamePath, value });
22
- }
31
+ const parentNamePath = tableProps.isInformContainer && (formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.isChildField) ? formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath : null;
32
+ if (setFieldValue && parentNamePath && !isObjectEqual(tableValue, value)) {
33
+ // 情况1: 在表单容器内且是子字段,通过父路径设置值
34
+ setFieldValue({ namePath: parentNamePath, value });
23
35
  }
24
- else if (setFormFieldsValue) {
36
+ else if (setFormFieldsValue && !isObjectEqual(tableValue, value)) {
37
+ // 情况2: 不在表单容器内,或者是表单容器但非子字段,直接设置表单值
25
38
  setFormFieldsValue(value);
26
39
  }
27
40
  }, [formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath, records, tableProps.isInformContainer, formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.isChildField]);
28
41
  useSetWidgetApi(() => ({
29
- value: formFieldsValue,
30
- }), [formFieldsValue], ref);
31
- return _jsx(Table, { ...tableProps });
32
- }));
42
+ value: tableValue,
43
+ }), [tableValue], ref);
44
+ // 非编辑模式缓存columns
45
+ return _jsx(Table, { ...tableProps, columns: isEditorMode ? tableProps.columns : columns });
46
+ })));
@@ -75,7 +75,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
75
75
  isSupportMultipleSort = false, // 是否支持多字段排序
76
76
  sorter, // 排序规则
77
77
  __innerSlot, enableRelationTag = true, // 关联关系字段是否开启关联标签
78
- enableBottomTipSlot = false, row__bottom__slot, ...props } = tableProps;
78
+ enableBottomTipSlot = false, row__bottom__slot, rowDisabled, ...props } = tableProps;
79
79
  const wList = convertWhere(props, supportManyRelated); // 查询参数
80
80
  const { classPrefix } = useConfig();
81
81
  const platform = usePlatform();
@@ -552,7 +552,16 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
552
552
  },
553
553
  // 设置选中项
554
554
  setSelectedKeys: (params) => {
555
- setSelectedKeys(params.selectedKeys);
555
+ var _a, _b;
556
+ if (!(params === null || params === void 0 ? void 0 : params.selectedKeys) || params.selectedKeys.length === 0) {
557
+ onSelectChange([], {}, true);
558
+ return;
559
+ }
560
+ const recordsMap = new Map(dataRef.current.tableRecords.map((item) => [item[recordKey], item]));
561
+ const records = (_b = (_a = params === null || params === void 0 ? void 0 : params.selectedKeys) === null || _a === void 0 ? void 0 : _a.map((key) => recordsMap.get(key))) === null || _b === void 0 ? void 0 : _b.filter(Boolean);
562
+ const context = { record: records, selectedRecords: records };
563
+ const validSelectedKeys = (records === null || records === void 0 ? void 0 : records.map((record) => record[recordKey])) || [];
564
+ onSelectChange(validSelectedKeys, context, false);
556
565
  },
557
566
  // 当前页数据
558
567
  records: isExpression && !enableTotal && enablePagination
@@ -682,6 +691,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
682
691
  const onSelectChange = (keys, context, empty = false) => {
683
692
  if (empty) {
684
693
  setSelectedKeys([]);
694
+ setSelectedRecords([]);
685
695
  return;
686
696
  }
687
697
  setSelectedKeys([].concat(keys));
@@ -728,7 +738,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
728
738
  pageIndex: 1,
729
739
  }));
730
740
  }
731
- events === null || events === void 0 ? void 0 : events.onFilterChange({ searchValues });
741
+ events === null || events === void 0 ? void 0 : events.onFilterChange({ searchValues, filterConfig });
732
742
  };
733
743
  const errorStatus = isError || fieldsError;
734
744
  const errorMsg = isError ? errorObj : fieldsError;
@@ -737,7 +747,7 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
737
747
  setOpenMobileFilter(true);
738
748
  }, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination }) }))] })), isH5 && (enablePagination || enableRefreshBtn || enableTableHeightSizeBtn || hasFilterButton) && (_jsx(ToolBar, { hasFilterButton: hasFilterButton, total: total, refreshTable: onRefreshBtnClick, setTableHightSize: setTableHightSize, currentSize: tableHightSize, setOpenMobileFilter: () => {
739
749
  setOpenMobileFilter(true);
740
- }, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(TableWithForm, { ref: ref, events: events, emptyText: emptyText, isH5: isH5, isNoDataSourceBind: isNoDataSourceBind, className: tableClassList, recordKey: recordKey, currentSize: tableHightSize, defaultPageIndex: defaultPageIndex, defaultPageSize: defaultPageSize, sortColumns: sortColumns, enablePagination: !isH5 && enablePagination, columnSelectType: columnSelectType, columns: visibleColumns, setColumns: setColumns, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: onSelectChange, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, onQueryChange: onQueryChange, rowClick: rowClick, cellClick: cellClick, isError: errorStatus, errorObj: errorMsg, __innerSlot: __innerSlot, bottomTip: row__bottom__slot, enableBottomTipSlot: enableBottomTipSlot }), isH5 && enableGlobalButton && !isNoDataSourceBind && (_jsx("div", { className: `${classPrefix}-h5-table-wrap-footer`, children: _jsx(GlobalButton, { classPrefix: classPrefix, slots: slots === null || slots === void 0 ? void 0 : slots.globalButton }) }))] }), _jsx(ImportFileModal, { columnSets: columnSets, dbName: dbName, datasourceTitle: datasourceTitle, fields: fields, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, isImportFileModalByApiVisible: isImportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, refresh: refreshTable, supportManyRelated: supportManyRelated }), _jsx(ExportFileModal, { whereList: wList, fields: fields, columns: mapColumKey(columns), isExportFileModalByApiVisible: isExportFileModalByApiVisible, selectedKeys: selectedKeys, dbName: dbName, query: query, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, supportManyRelated: supportManyRelated }), _jsx(InOrOutRecordModal, { dbName: dbName, isInOrOutRecordModalVisible: isInOrOutRecordModalVisible, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), isH5 && (_jsx(Modal, { overlayClassName: `${classPrefix}-h5-table-overlay`, className: `${classPrefix}-h5-table-option-modal-wrap`, disableCloseIcon: true, title: "\u64CD\u4F5C", visible: isMobileOptionVisible, outerRef: modalRef, events: {
750
+ }, enableRefreshBtn: enableRefreshBtn, enableTableHeightSizeBtn: enableTableHeightSizeBtn, enablePagination: enablePagination })), _jsx(TableWithForm, { ref: ref, events: events, emptyText: emptyText, isH5: isH5, isNoDataSourceBind: isNoDataSourceBind, className: tableClassList, recordKey: recordKey, currentSize: tableHightSize, defaultPageIndex: defaultPageIndex, defaultPageSize: defaultPageSize, sortColumns: sortColumns, enablePagination: !isH5 && enablePagination, columnSelectType: columnSelectType, columns: visibleColumns, setColumns: setColumns, records: tableRecords, sort: queryParams.sort, selectedKeys: selectedKeys, onSelectChange: onSelectChange, isLoading: isTableLoading, rowColor: rowColor, queryParams: queryParams, total: total, onQueryChange: onQueryChange, rowClick: rowClick, cellClick: cellClick, isError: errorStatus, errorObj: errorMsg, __innerSlot: __innerSlot, bottomTip: row__bottom__slot, enableBottomTipSlot: enableBottomTipSlot, componentType: "table", rowDisabled: rowDisabled }), isH5 && enableGlobalButton && !isNoDataSourceBind && (_jsx("div", { className: `${classPrefix}-h5-table-wrap-footer`, children: _jsx(GlobalButton, { classPrefix: classPrefix, slots: slots === null || slots === void 0 ? void 0 : slots.globalButton }) }))] }), _jsx(ImportFileModal, { columnSets: columnSets, dbName: dbName, datasourceTitle: datasourceTitle, fields: fields, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, isImportFileModalByApiVisible: isImportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, refresh: refreshTable, supportManyRelated: supportManyRelated }), _jsx(ExportFileModal, { whereList: wList, fields: fields, columns: mapColumKey(columns), isExportFileModalByApiVisible: isExportFileModalByApiVisible, selectedKeys: selectedKeys, dbName: dbName, query: query, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible, supportManyRelated: supportManyRelated }), _jsx(InOrOutRecordModal, { dbName: dbName, isInOrOutRecordModalVisible: isInOrOutRecordModalVisible, setIsImportFileModalByApiVisible: setIsImportFileModalByApiVisible, setIsExportFileModalByApiVisible: setIsExportFileModalByApiVisible, setIsInOrOutRecordModalVisible: setIsInOrOutRecordModalVisible }), isH5 && (_jsx(Modal, { overlayClassName: `${classPrefix}-h5-table-overlay`, className: `${classPrefix}-h5-table-option-modal-wrap`, disableCloseIcon: true, title: "\u64CD\u4F5C", visible: isMobileOptionVisible, outerRef: modalRef, events: {
741
751
  close: () => {
742
752
  setIsMobileOptionVisible(false);
743
753
  },
@@ -148,8 +148,8 @@ declare const getTreeInfo: (params: IFindNodeParams, checkable: boolean) => {
148
148
  expandedtate?: boolean;
149
149
  expanded: string[];
150
150
  event: string;
151
- checked: string[];
152
151
  selected: string[];
152
+ checked: string[];
153
153
  currentNode: {
154
154
  data?: {
155
155
  label: string;
@@ -7,12 +7,16 @@ import UploaderFile from '../form/uploaderFile';
7
7
  import { emptyObject } from '../../utils/constant';
8
8
  import { convertSingleValue } from '../../utils/tool';
9
9
  import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default';
10
+ import { useTranslation } from '../../utils/i18n/translation';
10
11
  import './style';
11
12
  /**
12
13
  * 文件上传-标准化
13
14
  */
14
15
  export const WdUploadFile = forwardRef(function WdUploadFile(props, ref) {
15
- const { classRoot = 'upload-file', acceptTypes: _acceptTypes = X_RUNTIME_DEFAULT._acceptTypesInFile, maxSize = X_RUNTIME_DEFAULT.maxSize, single = X_RUNTIME_DEFAULT.single, maxUploadCount = X_RUNTIME_DEFAULT.maxUploadCount, events = emptyObject, deleteVisible = X_RUNTIME_DEFAULT.deleteVisible, downloadVisible = X_RUNTIME_DEFAULT.downloadVisible, callbacks, uploadButtonText = X_RUNTIME_DEFAULT._uploadButtonText, uploadTipText = X_RUNTIME_DEFAULT._uploadTipText, storageType = 'cloudID', } = props;
16
+ const { classRoot = 'upload-file', acceptTypes: _acceptTypes = X_RUNTIME_DEFAULT._acceptTypesInFile, maxSize = X_RUNTIME_DEFAULT.maxSize, single = X_RUNTIME_DEFAULT.single, maxUploadCount = X_RUNTIME_DEFAULT.maxUploadCount, events = emptyObject, deleteVisible = X_RUNTIME_DEFAULT.deleteVisible, downloadVisible = X_RUNTIME_DEFAULT.downloadVisible, callbacks, uploadButtonText: _uploadButtonText, uploadTipText: _uploadTipText, storageType = 'cloudID', } = props;
17
+ const t = useTranslation();
18
+ const uploadButtonText = _uploadButtonText !== null && _uploadButtonText !== void 0 ? _uploadButtonText : t.clickToUpload;
19
+ const uploadTipText = _uploadTipText !== null && _uploadTipText !== void 0 ? _uploadTipText : t.supportBatchUpload;
16
20
  const acceptTypes = useMemo(() => convertAcceptTypes(_acceptTypes), [_acceptTypes]);
17
21
  // 强制转换初始值
18
22
  const initRef = useRef(false);
@@ -1,3 +1,4 @@
1
1
  export declare function useConfig(): {
2
2
  classPrefix: string;
3
+ locale: "zh" | "en";
3
4
  };
@@ -1,9 +1,10 @@
1
1
  import { useContext } from 'react';
2
- import { WdConfigContext, DEFAULT_CLASS_PREFIX, } from '../../components/wd-config-provider/wd-config-context';
2
+ import { WdConfigContext, DEFAULT_CLASS_PREFIX, DEFAULT_LOCALE, } from '../../components/wd-config-provider/wd-config-context';
3
3
  export function useConfig() {
4
4
  const context = useContext(WdConfigContext) || {};
5
5
  return {
6
6
  classPrefix: DEFAULT_CLASS_PREFIX,
7
+ locale: DEFAULT_LOCALE,
7
8
  ...context,
8
9
  };
9
10
  }
@@ -15,5 +15,5 @@ export function useCanPreview() {
15
15
  dispose();
16
16
  };
17
17
  }, [dispose]);
18
- return (((_b = (_a = window.$w) === null || _a === void 0 ? void 0 : _a.wedaContext) === null || _b === void 0 ? void 0 : _b.isEditorMode) || (editorPlatforms === null || editorPlatforms === void 0 ? void 0 : editorPlatforms.includes('MP')));
18
+ return ((_b = (_a = window.$w) === null || _a === void 0 ? void 0 : _a.wedaContext) === null || _b === void 0 ? void 0 : _b.isEditorMode) || (editorPlatforms === null || editorPlatforms === void 0 ? void 0 : editorPlatforms.includes('MP'));
19
19
  }
@@ -0,0 +1 @@
1
+ export { useTranslation } from './translation';
@@ -0,0 +1 @@
1
+ export { useTranslation } from './translation';
@@ -0,0 +1,119 @@
1
+ declare const _default: {
2
+ locale: string;
3
+ okText: string;
4
+ cancelText: string;
5
+ loadingText: string;
6
+ loadErrorText: string;
7
+ loadRetryText: string;
8
+ closeText: string;
9
+ helpText: string;
10
+ cleanText: string;
11
+ resetText: string;
12
+ searchText: string;
13
+ emptyText: string;
14
+ selectAllText: string;
15
+ paginationRecordCount: (count: any) => JSX.Element;
16
+ paginationPrevPage: string;
17
+ paginationNextPage: string;
18
+ paginationToFirstPage: string;
19
+ paginationToLastPage: string;
20
+ paginationAtFirst: string;
21
+ paginationAtLast: string;
22
+ paginationRecordPerPage: string;
23
+ paginationPageCount: (count: any) => string;
24
+ pleaseSelect: string;
25
+ foundText: string;
26
+ foundManyText: (count: any) => string;
27
+ foundManyTextWithKeyword: (keyword: any, count: any) => string;
28
+ foundNothingWithKeyword: (keyword: any) => string;
29
+ clearResultText: string;
30
+ tagSearchBoxTips: string;
31
+ tagSearchBoxEditingTips: string;
32
+ tagSearchBoxSelectTitle: string;
33
+ today: string;
34
+ curMonth: string;
35
+ prevMonth: string;
36
+ nextMonth: string;
37
+ curYear: string;
38
+ prevYear: string;
39
+ nextYear: string;
40
+ curTwentyYears: string;
41
+ prevTwentyYears: string;
42
+ nextTwentyYears: string;
43
+ monthBeforeYear: boolean;
44
+ yearFormat: string;
45
+ selectTime: string;
46
+ startTime: string;
47
+ endTime: string;
48
+ selectDate: string;
49
+ guideCancel: string;
50
+ guideBack: string;
51
+ guideNext: string;
52
+ guideFinish: string;
53
+ copy: string;
54
+ copied: string;
55
+ clickToEnlarge: string;
56
+ expand: string;
57
+ collapse: string;
58
+ recentlyVisited: string;
59
+ member: string;
60
+ department: string;
61
+ directMember: string;
62
+ memberPlaceholder: string;
63
+ memberLabel: string;
64
+ memberSelect: string;
65
+ organization: string;
66
+ selected: string;
67
+ multiple: string;
68
+ departmentLabel: string;
69
+ departmentPlaceholder: string;
70
+ selectDepartment: string;
71
+ noDepartmentData: string;
72
+ pleaseSelectDepartment: string;
73
+ loadingFailed: string;
74
+ noImage: string;
75
+ uploadFile: string;
76
+ clickToUpload: string;
77
+ supportBatchUpload: string;
78
+ fileName: string;
79
+ fileSize: string;
80
+ fileStatus: string;
81
+ fileOperation: string;
82
+ pendingUpload: string;
83
+ uploading: string;
84
+ uploadSuccess: string;
85
+ uploadFailed: string;
86
+ delete: string;
87
+ reupload: string;
88
+ download: string;
89
+ waitingUpload: string;
90
+ fileTotalExceed: string;
91
+ fileTypeError: string;
92
+ fileSizeExceed: string;
93
+ clickTopBtn: string;
94
+ richTextTitle: string;
95
+ richTextPlaceholder: string;
96
+ fileSizeExceedsLimit: string;
97
+ uploadImageFailed: string;
98
+ copySuccess: string;
99
+ fileFormatNotSupported: string;
100
+ headingH1: string;
101
+ headingH2: string;
102
+ headingH3: string;
103
+ headingH4: string;
104
+ headingH5: string;
105
+ headingH6: string;
106
+ normal: string;
107
+ sourceHanSans: string;
108
+ richTextErrorMessage: string;
109
+ batchSelect: string;
110
+ unrelatedUser: string;
111
+ unselectedMembers: string;
112
+ unselectedDepartments: string;
113
+ noMoreData: string;
114
+ noSelectableMembers: string;
115
+ noRelated: string;
116
+ noSelectable: string;
117
+ uploadImage: string;
118
+ };
119
+ export default _default;
@@ -0,0 +1,187 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
3
+ // prettier-ignore
4
+ // eslint-disable-next-line
5
+ export default {
6
+ locale: 'en_US',
7
+ // 操作:确定按钮
8
+ okText: ('OK'),
9
+ // 操作:取消按钮
10
+ cancelText: ('Cancel'),
11
+ // 文案:数据加载中
12
+ loadingText: ('Loading…'),
13
+ // 文案:数据加载失败
14
+ loadErrorText: ('Loading failed'),
15
+ // 操作:重试数据加载
16
+ loadRetryText: ('Retry'),
17
+ // 操作:关闭
18
+ closeText: ('Close'),
19
+ // 文案:帮助
20
+ helpText: ('Help'),
21
+ // 操作:清空
22
+ cleanText: ('Clear'),
23
+ // 操作:重置
24
+ resetText: ('Reset'),
25
+ // 操作:搜索
26
+ searchText: ('Search'),
27
+ // 文案:数据为空
28
+ emptyText: ('No data yet'),
29
+ // 操作:全选
30
+ selectAllText: ('Select all'),
31
+ // 文案:分页组件显示总记录数
32
+ paginationRecordCount: (count) => (_jsxs(Fragment, { children: ["Total items: ", _jsx("strong", { children: count }), " "] })),
33
+ // 操作:跳到上一页
34
+ paginationPrevPage: ('Previous'),
35
+ // 操作:跳到下一页
36
+ paginationNextPage: ('Next'),
37
+ // 操作:跳到第一页
38
+ paginationToFirstPage: ('First page'),
39
+ // 操作:跳到最后一页
40
+ paginationToLastPage: ('Last page'),
41
+ // 文案:提醒用户当前已经在第一页,无法再跳到上一页
42
+ paginationAtFirst: ('This is the first page'),
43
+ // 文案:提醒用户当前已经在最后一页,无法再跳到上一页
44
+ paginationAtLast: ('This is the last page'),
45
+ // 文案:表示分页组件每页显示多少行记录,后接行数选项
46
+ paginationRecordPerPage: ('/ page'),
47
+ // 文案:表示分页组件总共有多少页,前面是当前的页码
48
+ paginationPageCount: (count) => (count > 1 ? ` / ${count} pages` : ` / ${count} page`),
49
+ // 文案:下拉选择组件默认的提示文案
50
+ pleaseSelect: ('Please select'),
51
+ // 文案:查询到结果
52
+ foundText: ('Found the following results'),
53
+ // 文案:表格中,用于显示找到多少条结果,后面会拼接「返回原列表」
54
+ foundManyText: (count) => (count > 1 ? `${count} results found` : `${count} result found`),
55
+ // 文案:同 resultText,不过是在有关键字的情况下显示
56
+ foundManyTextWithKeyword: (keyword, count) => (count > 1 ? `${count} results found for "${keyword}"` : `${count} result found for "${keyword}"`),
57
+ // 文案:搜索某个关键字的情况下,没有找到结果
58
+ foundNothingWithKeyword: (keyword) => (`No results found for "${keyword}"`),
59
+ // 操作:表格中清空当前筛选结果,返回源列表
60
+ clearResultText: ('Back to list'),
61
+ // 文案:tagSearchBox 使用提示
62
+ tagSearchBoxTips: ('Separate keywords with "|"; press Enter to separate filter tags'),
63
+ // 文案:tagSearchBox 使用提示
64
+ tagSearchBoxEditingTips: ('Click to modify. Press Enter to finish.'),
65
+ // 文案:tagSearchBox 选择框标题
66
+ tagSearchBoxSelectTitle: ('Select a filter'),
67
+ // 文案:今天
68
+ today: ('Today'),
69
+ // 文案:本月
70
+ curMonth: ('This month'),
71
+ // 文案:下个月
72
+ prevMonth: ('Previous month'),
73
+ // 文案:下个月
74
+ nextMonth: ('Next month'),
75
+ // 文案:今年
76
+ curYear: ('This year'),
77
+ // 文案:下一年
78
+ prevYear: ('Previous year'),
79
+ // 文案:下一年
80
+ nextYear: ('Next year'),
81
+ // 文案:当前二十年
82
+ curTwentyYears: ('Latest 20 years'),
83
+ // 文案:上二十年
84
+ prevTwentyYears: ('Previous 20 years'),
85
+ // 文案:下二十年
86
+ nextTwentyYears: ('Next 20 years'),
87
+ // 变量:该语言日期表达中 [月] 是否在 [年] 之前,是的话为 - true,否则 - false
88
+ monthBeforeYear: (true),
89
+ // 变量:该语言日期表达中 [年] 的表达方式,其中 YYYY 为年份数字
90
+ yearFormat: (' YYYY'),
91
+ // 文案:选择时间
92
+ selectTime: ('Select time'),
93
+ // 文案:开始时间
94
+ startTime: ('Start time'),
95
+ // 文案:结束时间
96
+ endTime: ('End time'),
97
+ // 文案:选择日期
98
+ selectDate: ('Select date'),
99
+ // 文案:跳过
100
+ guideCancel: ("Skip"),
101
+ // 文案:上一步
102
+ guideBack: ("Back"),
103
+ // 文案:下一步
104
+ guideNext: ("Next"),
105
+ // 文案:完成
106
+ guideFinish: ("Done"),
107
+ // 文案:复制
108
+ copy: ("Copy"),
109
+ // 文案:复制成功
110
+ copied: ("Copied"),
111
+ // 文案:点击查看大图
112
+ clickToEnlarge: ('Click to enlarge'),
113
+ // 文案:展开
114
+ expand: ('Expand'),
115
+ // 文案:收起
116
+ collapse: ('Collapse'),
117
+ // 文案:最近访问
118
+ recentlyVisited: ('Recently Visited'),
119
+ member: ('Member'),
120
+ department: ('Department'),
121
+ directMember: ('Direct Member'),
122
+ // Member selection placeholder
123
+ memberPlaceholder: ('Please select member'),
124
+ memberLabel: ('Member Selection'),
125
+ memberSelect: ('Select Member'),
126
+ // Organization structure
127
+ organization: ('Organization'),
128
+ selected: ('Selected'),
129
+ // Multiple selection
130
+ multiple: ('Multiple'),
131
+ // Department selection
132
+ departmentLabel: ('Department Selection'),
133
+ departmentPlaceholder: ('Please select department'),
134
+ selectDepartment: ('Select Department'),
135
+ noDepartmentData: ('No department data'),
136
+ pleaseSelectDepartment: ('Please select department'),
137
+ // UploaderView component
138
+ loadingFailed: ('[Loading Failed]'),
139
+ noImage: ('No Image'),
140
+ // UploaderFileView component
141
+ uploadFile: ('Upload File'),
142
+ clickToUpload: ('Click to Upload'),
143
+ supportBatchUpload: ('Batch Upload Supported'),
144
+ fileName: ('File Name'),
145
+ fileSize: ('Size'),
146
+ fileStatus: ('Status'),
147
+ fileOperation: ('Operation'),
148
+ pendingUpload: ('Pending Upload'),
149
+ uploading: ('Uploading'),
150
+ uploadSuccess: ('Upload Success'),
151
+ uploadFailed: ('Upload Failed'),
152
+ delete: ('Delete'),
153
+ reupload: ('Re-upload'),
154
+ download: ('Download'),
155
+ waitingUpload: ('Waiting to Upload'),
156
+ fileTotalExceed: ('Total number of files cannot exceed {count}'),
157
+ fileTypeError: ('File type error'),
158
+ fileSizeExceed: ('File size cannot exceed {size}M'),
159
+ // Click above
160
+ clickTopBtn: ('Click the "{btn}" button above'),
161
+ // RichText component
162
+ richTextTitle: 'Title',
163
+ richTextPlaceholder: 'Please enter',
164
+ fileSizeExceedsLimit: 'File size exceeds limit',
165
+ uploadImageFailed: 'Failed to upload image',
166
+ copySuccess: 'Copied successfully',
167
+ fileFormatNotSupported: 'File format not supported',
168
+ headingH1: 'Heading H1',
169
+ headingH2: 'Heading H2',
170
+ headingH3: 'Heading H3',
171
+ headingH4: 'Heading H4',
172
+ headingH5: 'Heading H5',
173
+ headingH6: 'Heading H6',
174
+ normal: 'Normal',
175
+ sourceHanSans: 'Source Han Sans',
176
+ richTextErrorMessage: ('Rich text is too long and may fail to save. Current length is'),
177
+ batchSelect: ('Batch Select'),
178
+ unrelatedUser: ('Unrelated User'),
179
+ unselectedMembers: ('Unselected Members'),
180
+ unselectedDepartments: ('Unselected Departments'),
181
+ noMoreData: ('No more data'),
182
+ noSelectableMembers: ('No selectable members'),
183
+ noRelated: ('No Related '),
184
+ noSelectable: ('None Available'),
185
+ // UploaderPC component
186
+ uploadImage: ('Upload Image'),
187
+ };