@cloudbase/weda-ui 3.22.3 → 3.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/configs/components/wd-tabbar.d.ts +16 -0
  2. package/dist/configs/components/wd-tabbar.js +6 -0
  3. package/dist/configs/components/wd-table.d.ts +1 -0
  4. package/dist/configs/components/wd-table.js +14 -1
  5. package/dist/configs/components/wd-upload-image.js +1 -1
  6. package/dist/configs/index.d.ts +34 -0
  7. package/dist/style/index.css +27 -0
  8. package/dist/style/index.scss +1 -1
  9. package/dist/style/weda-ui.min.css +2 -2
  10. package/dist/web/components/form-input-hooks/index.d.ts +0 -1
  11. package/dist/web/components/form-input-hooks/index.js +8 -14
  12. package/dist/web/components/wd-form/contexts/form-field-context.d.ts +6 -2
  13. package/dist/web/components/wd-form/contexts/form-field-context.js +18 -2
  14. package/dist/web/components/wd-form/contexts/form-field-obj-context.d.ts +2 -2
  15. package/dist/web/components/wd-form/contexts/form-field-obj-context.js +2 -2
  16. package/dist/web/components/wd-form/hoc/form-container-decorator.d.ts +11 -0
  17. package/dist/web/components/wd-form/hoc/form-container-decorator.js +61 -0
  18. package/dist/web/components/wd-form/index.d.ts +4 -49
  19. package/dist/web/components/wd-form/index.js +53 -70
  20. package/dist/web/components/wd-form-obj/base-form-obj.d.ts +5 -1
  21. package/dist/web/components/wd-form-obj/base-form-obj.js +19 -38
  22. package/dist/web/components/wd-input/wd-input.d.ts +2 -0
  23. package/dist/web/components/wd-input/wd-input.js +70 -18
  24. package/dist/web/components/wd-input-number/wd-input-number.js +15 -15
  25. package/dist/web/components/wd-tabbar/wd-tabbar.js +4 -6
  26. package/dist/web/components/wd-table/components/FieldRender/index.d.ts +9 -1
  27. package/dist/web/components/wd-table/components/FieldRender/index.js +33 -4
  28. package/dist/web/components/wd-table/components/FilterFieldsPanel/Fields.d.ts +3 -1
  29. package/dist/web/components/wd-table/components/FilterFieldsPanel/Fields.js +7 -3
  30. package/dist/web/components/wd-table/components/FilterFieldsPanel/FilterFieldItem.js +4 -1
  31. package/dist/web/components/wd-table/components/FilterFieldsPanel/filterFieldsGenerate.d.ts +6 -15
  32. package/dist/web/components/wd-table/components/FilterFieldsPanel/filterFieldsGenerate.js +47 -16
  33. package/dist/web/components/wd-table/components/FilterFieldsPanel/index.js +15 -5
  34. package/dist/web/components/wd-table/utils/index.d.ts +5 -2
  35. package/dist/web/components/wd-table/utils/index.js +12 -1
  36. package/dist/web/components/wd-table/wd-table.d.ts +5 -19
  37. package/dist/web/components/wd-table/wd-table.js +22 -2
  38. package/dist/web/components/wd-tree/utils.js +1 -1
  39. package/dist/web/utils/hooks/useFormLegacy.js +5 -12
  40. package/package.json +5 -5
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /* eslint max-lines: [error, 500] */
3
3
  import { forwardRef, useImperativeHandle, useEffect, useMemo, useRef, useState, useCallback } from 'react';
4
+ import { Tag } from 'tea-component';
4
5
  import { WdFormItem, WdInputGroup } from '../wd-form-item';
5
6
  import { useFormInputTrait } from '../form-input-hooks';
6
7
  import WdIcon from '../wd-icon';
@@ -14,16 +15,46 @@ import isEqual from 'lodash.isequal';
14
15
  import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default';
15
16
  import { usePlatform } from '../../utils/platform';
16
17
  const inputTypes = { idcard: 'text', digit: 'number' };
18
+ const InputComponent = forwardRef(function InputComponent({ isTagInput, contentCls, ...props }, ref) {
19
+ var _a;
20
+ const tagInputValue = isTagInput ? (_a = [].concat(props.tagInputValue)) === null || _a === void 0 ? void 0 : _a.filter((i) => !!i) : [];
21
+ const [inputValue, setInputValue] = useState('');
22
+ const onChange = (e) => {
23
+ setInputValue(e.target.value);
24
+ };
25
+ const onKeyDown = (e) => {
26
+ if (e.key === 'enter' || e.keyCode === KEY_DOWN_CODE) {
27
+ props.onChange([...tagInputValue, e.target.value]);
28
+ setInputValue('');
29
+ }
30
+ };
31
+ useImperativeHandle(ref, () => ({
32
+ clearInput: () => setInputValue(''),
33
+ }), []);
34
+ return isTagInput ? (_jsx("div", { className: contentCls, onFocus: props.onFocus, onBlur: props.onBlur, children: _jsxs(Tag.Group, { children: [tagInputValue === null || tagInputValue === void 0 ? void 0 : tagInputValue.map((value, index) => (_jsx(Tag, { onClose: () => {
35
+ const newValue = tagInputValue.filter((tag, valueIndex) => valueIndex !== index);
36
+ props.onChange(newValue);
37
+ }, children: value }, index))), _jsx("input", { disabled: props.disabled, value: inputValue, onChange: onChange, onKeyDown: onKeyDown, placeholder: "\u56DE\u8F66\u952E\u6DFB\u52A0", onBlur: (e) => {
38
+ var _a;
39
+ if ((_a = e.target.value) === null || _a === void 0 ? void 0 : _a.trim()) {
40
+ props.onChange([...tagInputValue, e.target.value]);
41
+ }
42
+ setInputValue('');
43
+ } })] }) })) : (_jsx("div", { className: contentCls, children: _jsx("input", { ...props }) }));
44
+ });
17
45
  /**
18
46
  * 标准化:单行输入组件
19
47
  */
48
+ // eslint-disable-next-line complexity
20
49
  export const WdInput = forwardRef(function WdInput(props, ref) {
21
- const { name, password = X_RUNTIME_DEFAULT.password, type = X_RUNTIME_DEFAULT.type, placeholder, focus: _focus = X_RUNTIME_DEFAULT.focus, maxLength = X_RUNTIME_DEFAULT.maxLength, clearable = X_RUNTIME_DEFAULT.clearable, events, isUnionValue = X_RUNTIME_DEFAULT.isUnionValue, prefixType, prefixIcon, prefixSrc = X_RUNTIME_DEFAULT.prefixSrc, suffixType, suffixIcon, suffixSrc = X_RUNTIME_DEFAULT.suffixSrc, classRoot = 'input', wrapClassName = '', counterVisible = X_RUNTIME_DEFAULT.counterVisible, label, required = X_RUNTIME_DEFAULT.required, inputPattern, template, isConvert = true, } = props;
50
+ const { name, password = X_RUNTIME_DEFAULT.password, type = X_RUNTIME_DEFAULT.type, placeholder, focus: _focus = X_RUNTIME_DEFAULT.focus, maxLength = X_RUNTIME_DEFAULT.maxLength, clearable = X_RUNTIME_DEFAULT.clearable, events, isUnionValue = X_RUNTIME_DEFAULT.isUnionValue, prefixType, prefixIcon, prefixSrc = X_RUNTIME_DEFAULT.prefixSrc, suffixType, suffixIcon, suffixSrc = X_RUNTIME_DEFAULT.suffixSrc, classRoot = 'input', wrapClassName = '', counterVisible = X_RUNTIME_DEFAULT.counterVisible, label, required = X_RUNTIME_DEFAULT.required, inputPattern, template, isConvert = true, isTagInput = false, } = props;
22
51
  const zhRef = useRef(false); // 判断是否输入中文
23
52
  const { before, after, inputValue } = useStringProp(props);
24
53
  const [innerHandle, setInnerHandle] = useState({}); // hook里挂出的属性
25
54
  const [currentInputValue, setCurrentInputValue] = useSyncValue(inputValue); // 监听inputValue
26
- const formValue = useMemo(() => converValueFix(inputValue, before, after, type, isUnionValue, isConvert), [inputValue, before, after, type, isUnionValue, isConvert]);
55
+ const initTagInputValue = useMemo(() => { var _a, _b; return (_b = (_a = [].concat(props.inputValue)) === null || _a === void 0 ? void 0 : _a.filter((i) => !!i)) !== null && _b !== void 0 ? _b : []; }, [props.inputValue]);
56
+ const [tagInputValue, setTagInputValue] = useSyncValue(initTagInputValue);
57
+ const formValue = useMemo(() => (isTagInput ? props.inputValue : converValueFix(inputValue, before, after, type, isUnionValue, isConvert)), [isTagInput, props.inputValue, inputValue, before, after, type, isUnionValue, isConvert]);
27
58
  const rules = useRules(props); // 含前后缀和必填时,仅对输入框校验
28
59
  const traitProps = {
29
60
  ...props,
@@ -34,6 +65,7 @@ export const WdInput = forwardRef(function WdInput(props, ref) {
34
65
  };
35
66
  const { value, // 代表组件值,含前后缀
36
67
  onChange: _onChange, disabled, readOnly, validateErrorMsg, validateState, visible, } = useFormInputTrait(traitProps);
68
+ const tagInputRef = useRef(null);
37
69
  const wrapRef = useRef(null);
38
70
  const valueRef = useRef(null);
39
71
  const size = useSize(props);
@@ -43,7 +75,8 @@ export const WdInput = forwardRef(function WdInput(props, ref) {
43
75
  const inputId = useMemo(() => getUuid(), []);
44
76
  const [focus, setFocus] = useSyncValue(_focus);
45
77
  const inputType = password ? 'password' : inputTypes[type] || type;
46
- const hasClearIcon = clearable && focus && !disabled && (currentInputValue === null || currentInputValue === void 0 ? void 0 : currentInputValue.length) > 0;
78
+ const hasValue = isTagInput ? (tagInputValue === null || tagInputValue === void 0 ? void 0 : tagInputValue.length) > 0 : (currentInputValue === null || currentInputValue === void 0 ? void 0 : currentInputValue.length) > 0;
79
+ const hasClearIcon = clearable && focus && !disabled && hasValue;
47
80
  const counter = typeof currentInputValue === 'string' ? currentInputValue.length : 0;
48
81
  const root = `${classPrefix}-${classRoot}`;
49
82
  const inputWrap = `${classPrefix}-form-input-wrap`;
@@ -59,6 +92,7 @@ export const WdInput = forwardRef(function WdInput(props, ref) {
59
92
  [`${inputWrap}--no-radius-left`]: before,
60
93
  [`${inputWrap}--no-radius-right`]: after,
61
94
  [`${inputWrap}--no-radius`]: before && after,
95
+ [`${classPrefix}-form-tag-input-wrap`]: isTagInput,
62
96
  });
63
97
  const countCls = `${classPrefix}-input__limit-number`;
64
98
  const platform = usePlatform();
@@ -69,8 +103,9 @@ export const WdInput = forwardRef(function WdInput(props, ref) {
69
103
  return; // 监听非输入引起的value变化,比如调用 setValue, clearValue
70
104
  const currentInputValue = converInputValue(value, before, after, isUnionValue);
71
105
  setCurrentInputValue(currentInputValue);
106
+ setTagInputValue(value);
72
107
  valueRef.current = value;
73
- }, [value, before, after, isUnionValue, setCurrentInputValue]);
108
+ }, [value, before, after, isUnionValue, setCurrentInputValue, setTagInputValue]);
74
109
  const changeForm = useCallback((val) => {
75
110
  valueRef.current = val;
76
111
  _onChange(val);
@@ -80,42 +115,59 @@ export const WdInput = forwardRef(function WdInput(props, ref) {
80
115
  return converValueFix(val, before, after, type, isUnionValue, isConvert);
81
116
  };
82
117
  const onChange = (e) => {
83
- var _a;
84
- const text = typeof e === 'string' ? e : e.target.value;
85
- const reg = new RegExp(inputPattern);
86
- if (inputPattern && !reg.test(text)) {
87
- return;
118
+ var _a, _b, _c;
119
+ let text = (_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value;
120
+ if (isTagInput) {
121
+ text = Array.isArray(e) ? e : [].concat(text);
122
+ setTagInputValue(text);
123
+ changeForm(text);
124
+ (_b = events.change) === null || _b === void 0 ? void 0 : _b.call(events, { value: text }, { originEvent: e });
88
125
  }
89
- setCurrentInputValue(text);
90
- if (!zhRef.current) {
91
- const newValue = converValueFixWrap(text);
92
- changeForm(newValue);
93
- (_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: newValue }, { originEvent: e });
126
+ else {
127
+ text = typeof e === 'string' ? e : text;
128
+ const reg = new RegExp(inputPattern);
129
+ // 只针对非标签输入框做校验
130
+ if (inputPattern && !reg.test(text)) {
131
+ return;
132
+ }
133
+ setCurrentInputValue(text);
134
+ if (!zhRef.current) {
135
+ const newValue = converValueFixWrap(text);
136
+ changeForm(newValue);
137
+ (_c = events.change) === null || _c === void 0 ? void 0 : _c.call(events, { value: newValue }, { originEvent: e });
138
+ }
94
139
  }
95
140
  };
96
141
  const onClear = (e) => {
97
142
  var _a, _b;
98
143
  setCurrentInputValue('');
144
+ setTagInputValue(null);
99
145
  const newValue = converValueFixWrap('');
100
146
  changeForm(newValue);
101
147
  (_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: newValue }, { originEvent: e });
102
148
  (_b = events.clear) === null || _b === void 0 ? void 0 : _b.call(events, { originValue: value }, { originEvent: e });
103
149
  e.preventDefault();
150
+ if (tagInputRef.current && isTagInput) {
151
+ tagInputRef.current.clearInput();
152
+ }
104
153
  };
105
154
  const onKeyDown = (e) => {
155
+ var _a;
106
156
  if (e.key === 'enter' || e.keyCode === KEY_DOWN_CODE) {
107
- events.confirm({ value: converValueFixWrap(e.target.value) }, { originEvent: e });
157
+ (_a = events === null || events === void 0 ? void 0 : events.confirm) === null || _a === void 0 ? void 0 : _a.call(events, { value: converValueFixWrap(e.target.value) }, { originEvent: e });
108
158
  }
109
159
  if (inputType === 'number' && e.key === 'e') {
110
160
  e.preventDefault();
111
161
  }
112
162
  };
113
163
  const onFocus = (e) => {
114
- (events === null || events === void 0 ? void 0 : events.focus) && events.focus({ value: converValueFixWrap(e.target.value) }, { originEvent: e });
164
+ (events === null || events === void 0 ? void 0 : events.focus) &&
165
+ events.focus({ value: isTagInput ? tagInputValue : converValueFixWrap(e.target.value) }, { originEvent: e });
115
166
  setFocus(true);
116
167
  };
117
168
  const onBlur = (e) => {
118
- (events === null || events === void 0 ? void 0 : events.blur) && events.blur({ value: converValueFixWrap(e.target.value) }, { originEvent: e });
169
+ (events === null || events === void 0 ? void 0 : events.blur) &&
170
+ events.blur({ value: isTagInput ? tagInputValue : converValueFixWrap(e.target.value) }, { originEvent: e });
119
171
  setFocus(false);
120
172
  };
121
173
  const handleZhStart = () => {
@@ -172,5 +224,5 @@ export const WdInput = forwardRef(function WdInput(props, ref) {
172
224
  return null;
173
225
  return (_jsx(WdFormItem, { ...formItemProps, children: _jsxs(_Fragment, { children: [_jsx(WdInputGroup, { ...inputGroupProps, children: _jsxs("div", { className: `${cls} ${template === 'greySearchBox' ? 'wd-input-input-search template search-box color-grey is-pc-bordered' : ''} ${template === 'whiteSearchBox'
174
226
  ? 'wd-input-input-search template search-box color-white is-pc-bordered'
175
- : ''} ${isH5 ? 'is-h5-borderless' : ''}`, ref: wrapRef, onFocus: () => { var _a, _b; return (_b = (_a = wrapRef.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add('is-focused'); }, onBlur: () => { var _a, _b; return (_b = (_a = wrapRef.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.remove('is-focused'); }, children: [prefixType && (_jsx("div", { className: prefixCls, onClick: () => inputAdornmentClick('prefix'), children: _jsx(WdIcon, { size: iconSize, name: prefixIcon, type: prefixType, src: prefixSrc, className: prefixIconCls }) })), _jsx("div", { className: contentCls, children: _jsx("input", { id: inputId, className: inputCls, type: currentInputType, placeholder: placeholder, value: currentInputValue !== null && currentInputValue !== void 0 ? currentInputValue : '', disabled: disabled, name: name, autoFocus: focus, autoComplete: "off", maxLength: maxLength, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onCompositionStart: handleZhStart, onCompositionEnd: handleZhEnd, ...startWithOnProps }) }), hasClearIcon && (_jsx("div", { className: suffixCls, children: _jsx(WdIcon, { size: iconSize, className: `${classPrefix}-icon__trigger`, name: "td:close-circle-filled", onMouseDown: onClear }) })), !hasClearIcon && suffixType && (_jsx("div", { className: suffixCls, onClick: () => inputAdornmentClick('suffix'), children: _jsx(WdIcon, { size: iconSize, name: suffixIcon, type: suffixType, src: suffixSrc, className: suffixIconCls }) })), counterVisible && (_jsxs("span", { className: countCls, children: [counter, "/", maxLength] }))] }) }), password && passwordIconRender()] }) }));
227
+ : ''} ${isH5 ? 'is-h5-borderless' : ''}`, ref: wrapRef, onFocus: () => { var _a, _b; return (_b = (_a = wrapRef.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add('is-focused'); }, onBlur: () => { var _a, _b; return (_b = (_a = wrapRef.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.remove('is-focused'); }, children: [prefixType && (_jsx("div", { className: prefixCls, onClick: () => inputAdornmentClick('prefix'), children: _jsx(WdIcon, { size: iconSize, name: prefixIcon, type: prefixType, src: prefixSrc, className: prefixIconCls }) })), _jsx(InputComponent, { ref: tagInputRef, contentCls: contentCls, isTagInput: isTagInput, id: inputId, className: inputCls, type: currentInputType, placeholder: placeholder, value: currentInputValue !== null && currentInputValue !== void 0 ? currentInputValue : '', tagInputValue: tagInputValue !== null && tagInputValue !== void 0 ? tagInputValue : [], disabled: disabled, name: name, autoFocus: focus, autoComplete: "off", maxLength: maxLength, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onCompositionStart: handleZhStart, onCompositionEnd: handleZhEnd, ...startWithOnProps }), hasClearIcon && (_jsx("div", { className: suffixCls, children: _jsx(WdIcon, { size: iconSize, className: `${classPrefix}-icon__trigger`, name: "td:close-circle-filled", onMouseDown: onClear }) })), !hasClearIcon && suffixType && (_jsx("div", { className: suffixCls, onClick: () => inputAdornmentClick('suffix'), children: _jsx(WdIcon, { size: iconSize, name: suffixIcon, type: suffixType, src: suffixSrc, className: suffixIconCls }) })), counterVisible && (_jsxs("span", { className: countCls, children: [counter, "/", maxLength] }))] }) }), password && passwordIconRender()] }) }));
176
228
  });
@@ -68,6 +68,7 @@ const coverValueFix = (value, props) => {
68
68
  export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
69
69
  const { clearable = X_RUNTIME_DEFAULT.clearable } = props;
70
70
  const inputValueRef = useRef(props.inputValue);
71
+ const valueRef = useRef(null);
71
72
  const [showValue, setShowValue] = useState(() => {
72
73
  return coverValueFix(`${props.inputValue}`, props);
73
74
  }); // 显示值
@@ -199,7 +200,8 @@ export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
199
200
  if (value === '')
200
201
  return null;
201
202
  const v = dealPercent(value, props.format === 'percent' ? 'del' : '');
202
- return Number(v.replace(/,/g, ''));
203
+ const numValue = Number(v.replace(/,/g, ''));
204
+ return isNaN(numValue) ? null : numValue;
203
205
  }, [props.format]);
204
206
  const changeForm = useCallback((val) => {
205
207
  valueRef.current = val;
@@ -215,8 +217,7 @@ export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
215
217
  if (toReal === realValue)
216
218
  return;
217
219
  setRealValue(toReal);
218
- changeForm(toReal);
219
- }, [changeForm, getRealValue, getShowValue, props.format, realValue]);
220
+ }, [getRealValue, getShowValue, props.format, realValue]);
220
221
  // 与计算值相关的配置变化时,去重新计算显示值和真实值
221
222
  useEffect(() => {
222
223
  dealValueChange(isNumber(value) ? value : props.inputValue);
@@ -231,6 +232,17 @@ export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
231
232
  inputValueRef.current = props.inputValue;
232
233
  // eslint-disable-next-line react-hooks/exhaustive-deps
233
234
  }, [props.inputValue]);
235
+ /**
236
+ * 监听非输入引起的value变化,比如调用 setValue, clearValue
237
+ */
238
+ useEffect(() => {
239
+ if (valueRef.current !== value) {
240
+ setRealValue(value);
241
+ setShowValue(getShowValue(`${value}`, props.format));
242
+ valueRef.current = value;
243
+ }
244
+ // eslint-disable-next-line react-hooks/exhaustive-deps
245
+ }, [value]);
234
246
  // max、min变化时,去判断当前值是否超出范围
235
247
  useEffect(() => {
236
248
  if (showValue === 'null' || showValue === 'undefined')
@@ -247,7 +259,6 @@ export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
247
259
  }
248
260
  initValidate(validState, validMsg);
249
261
  }, [showValue, props.min, props.max, max, min, initValidate, validMsgObj.max, validMsgObj.min]);
250
- const valueRef = useRef(null);
251
262
  const [focus, setFocus] = useSyncValue(props.focus);
252
263
  const hasClearIcon = getHasClearIcon(clearable, focus, disabled, readOnly, realValue);
253
264
  const isRow = props.stepOption === 'both'; // 右侧调整只在pc端生效
@@ -320,17 +331,6 @@ export const WdInputNumber = forwardRef(function WdInputNumber(props, ref) {
320
331
  return false;
321
332
  return +props.min >= +realValue;
322
333
  }, [editDisabled, realValue, props.min]);
323
- /**
324
- * 监听非输入引起的value变化,比如调用 setValue, clearValue
325
- */
326
- useEffect(() => {
327
- if (valueRef.current !== value) {
328
- setRealValue(value);
329
- setShowValue(getShowValue(`${value}`, props.format));
330
- valueRef.current = value;
331
- }
332
- // eslint-disable-next-line react-hooks/exhaustive-deps
333
- }, [value]);
334
334
  /**
335
335
  * 显示值变化
336
336
  * @param e
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /* eslint-disable @typescript-eslint/no-magic-numbers */
3
- import { forwardRef, useMemo, useState, useImperativeHandle, useEffect, useCallback, } from 'react';
3
+ import { forwardRef, useMemo, useState, useImperativeHandle, useEffect, useCallback } from 'react';
4
4
  import { useConfig } from '../../utils/config-context';
5
5
  import WdIcon from '../wd-icon';
6
6
  import WdLink from '../wd-link';
@@ -17,7 +17,7 @@ export const WdTabBar = forwardRef(function WdTabBar(props, ref) {
17
17
  const tabsData = useMemo(() => {
18
18
  return getMenuList(props.tabs);
19
19
  }, [props.tabs]);
20
- const setSelectTab = useCallback(({ key, isNavigate = true, } = {}) => {
20
+ const setSelectTab = useCallback(({ key, isNavigate = true } = {}) => {
21
21
  const selectItem = findSelectItem(tabsData || [], key);
22
22
  if (!selectItem) {
23
23
  setInit(true);
@@ -63,14 +63,12 @@ export const WdTabBar = forwardRef(function WdTabBar(props, ref) {
63
63
  const getTitleShow = (item, isInit) => {
64
64
  var _a;
65
65
  const show = (_jsxs(_Fragment, { children: [_jsx("div", { className: `${classPrefix}-tabbar__item-icon`, children: getIconShow(item, selectedKey, isInit) }), _jsx("div", { className: `${classPrefix}-tabbar__item-text`, children: item.title })] }));
66
- const url = (item === null || item === void 0 ? void 0 : item.type) === 'link' && item.linkUrl
67
- ? item.linkUrl
68
- : (_a = item === null || item === void 0 ? void 0 : item.path) === null || _a === void 0 ? void 0 : _a.replace('/', '');
66
+ const url = (item === null || item === void 0 ? void 0 : item.type) === 'link' && item.linkUrl ? item.linkUrl : (_a = item === null || item === void 0 ? void 0 : item.path) === null || _a === void 0 ? void 0 : _a.replace('/', '');
69
67
  return url ? (_jsx(WdLink, { style: { color: 'unset', fontSize: 'unset' }, packageName: item === null || item === void 0 ? void 0 : item.subPackageName, url: url, params: [], disabled: true, contentSlot: show, content: '' })) : (show);
70
68
  };
71
69
  return (_jsx("div", { id: props.id, style: props.style, className: classNames(`${classPrefix}-tabbar`, `${classPrefix}-${platform}-tabbar`, props.className), "data-testid": "wd-tabbar-test", children: tabsData.map((item) => (_jsx("div", { "data-testid": "wd-tabbar-node", className: `${classPrefix}-tabbar__item ${selectedKey === item.key ? 'is-selected' : ''}`, onClick: () => {
72
70
  var _a;
73
- (_a = props.events) === null || _a === void 0 ? void 0 : _a.tap();
71
+ (_a = props.events) === null || _a === void 0 ? void 0 : _a.tap({ tab: item });
74
72
  if (item.disabled || selectedKey === item.key)
75
73
  return;
76
74
  setSelectedKey(item.key);
@@ -102,7 +102,14 @@ export declare const formatDataToXlsx: (datas: any, fields: any, enumOptions?: {
102
102
  */
103
103
  export declare const getSearchAttributes: (fields: any) => any;
104
104
  export declare const getFieldValue: (name: any, _record: any, relatedFieldName?: any, isManyField?: any) => any;
105
- export declare const slotRender: (Slot: any, props?: {}) => any;
105
+ interface SlotRenderProps {
106
+ recordIndex?: number | string;
107
+ record?: any;
108
+ rowKey?: string;
109
+ column?: any;
110
+ columnIndex?: number | string;
111
+ }
112
+ export declare const slotRender: (Slot: any, props?: SlotRenderProps) => any;
106
113
  /**
107
114
  * 根据列管理,过滤表格列信息
108
115
  * columns: { key, header, width, align, render,fixed }[] Tea Table 的列
@@ -150,3 +157,4 @@ export declare const getTableColumns: ({ fields, columnSets, slots, fixedFront,
150
157
  showRelationWithTag?: boolean;
151
158
  }) => any;
152
159
  export declare const mapColumKey: (columnSets: any) => any;
160
+ export {};
@@ -25,6 +25,8 @@ import { textToString } from '../../../../utils/platform';
25
25
  import { getWhereParam, getSortColumns } from '../../utils';
26
26
  import lodashGet from 'lodash.get';
27
27
  import { convertMoment } from '../../../../utils/moment';
28
+ import { FormFieldObjProvider, useFormFieldObj } from '../../../wd-form/contexts/form-field-obj-context';
29
+ import { useFormField } from '../../../wd-form/contexts/form-field-context';
28
30
  const MODAL_SIZE = '80%';
29
31
  // 文字提示框包裹组件
30
32
  export const TextWrap = React.memo(function TextWrapComp(props) {
@@ -726,10 +728,35 @@ export const getFieldValue = (name, _record, relatedFieldName, isManyField) => {
726
728
  }
727
729
  return record === null || record === void 0 ? void 0 : record[name];
728
730
  };
729
- export const slotRender = (Slot, props = {}) => {
731
+ const FunctionSlotRenderer = ({ Slot, ...props }) => {
732
+ var _a;
733
+ const formField = useFormField();
734
+ const { formFieldsValue = [], getFieldValue } = formField || {};
735
+ const formFieldObjsContext = useFormFieldObj();
736
+ const parentNamePath = (formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.isChildField) ? formFieldObjsContext === null || formFieldObjsContext === void 0 ? void 0 : formFieldObjsContext.namePath : [];
737
+ const recordIndex = props.recordIndex;
738
+ const namePath = useMemo(() => [...parentNamePath, recordIndex], [parentNamePath, recordIndex]);
739
+ const _formFieldValues = useMemo(() => {
740
+ try {
741
+ return (parentNamePath === null || parentNamePath === void 0 ? void 0 : parentNamePath.length) && getFieldValue ? getFieldValue === null || getFieldValue === void 0 ? void 0 : getFieldValue({ namePath: parentNamePath }) : formFieldsValue;
742
+ }
743
+ catch (error) {
744
+ errorHandler({
745
+ code: 'FormFieldValuesError',
746
+ error,
747
+ });
748
+ return [];
749
+ }
750
+ }, [parentNamePath, formFieldsValue, getFieldValue]);
751
+ const providerProps = useMemo(() => ({
752
+ namePath,
753
+ isChildField: true,
754
+ }), [namePath]);
755
+ return (_jsx(FormFieldObjProvider, { ...providerProps, children: _jsx(Slot, { ...props, value: _formFieldValues, rowValue: (_a = _formFieldValues === null || _formFieldValues === void 0 ? void 0 : _formFieldValues[recordIndex]) !== null && _a !== void 0 ? _a : {} }) }));
756
+ };
757
+ export const slotRender = (Slot, props = { recordIndex: 0 }) => {
730
758
  if (typeof Slot === 'function') {
731
- // console.log(Slot, 'slot', props, 'props');
732
- return _jsx(Slot, { ...props });
759
+ return _jsx(FunctionSlotRenderer, { Slot: Slot, ...props });
733
760
  }
734
761
  return Slot !== null && Slot !== void 0 ? Slot : null;
735
762
  };
@@ -828,7 +855,9 @@ export const filterCustomColumns = ({ columns, columnSets, slots, fields, isH5,
828
855
  if (genre === 'slot') {
829
856
  // 拿到列对应的插槽
830
857
  const slot = slots[`${TABLE_SLOT_PREFIX}${(item2 === null || item2 === void 0 ? void 0 : item2.slotKey) || key}`];
831
- customColumn.render = (record, rowKey, recordIndex, column, columnIndex) => (_jsx(TableSlotCell, { record: record, rowKey: rowKey, recordIndex: recordIndex, column: column, columnIndex: columnIndex, slot: slot }));
858
+ customColumn.render = (record, rowKey, recordIndex, column, columnIndex) => {
859
+ return (_jsx(TableSlotCell, { record: record, rowKey: rowKey, recordIndex: recordIndex, column: column, columnIndex: columnIndex, slot: slot }));
860
+ };
832
861
  }
833
862
  return customColumn;
834
863
  });
@@ -13,10 +13,12 @@ export declare const TimePickerField: ({ disabled, isRange, updateValue, value }
13
13
  updateValue: any;
14
14
  value: any;
15
15
  }) => JSX.Element;
16
- export declare const InputField: ({ disabled, value, updateValue }: {
16
+ export declare const arrayInputType: string[];
17
+ export declare const InputField: ({ disabled, value, updateValue, fieldCalculation }: {
17
18
  disabled?: boolean;
18
19
  value: any;
19
20
  updateValue: any;
21
+ fieldCalculation: any;
20
22
  }) => JSX.Element;
21
23
  export declare const MultipleNumber: ({ disabled, value, updateValue }: {
22
24
  disabled?: boolean;
@@ -6,11 +6,11 @@ import { SelectSearch } from './SelectSearch';
6
6
  import { WdDate, WdDateRange, WdTime, WdInput, WdSelectMultiple, WdSelect } from '../../../../components';
7
7
  export { SelectSearch };
8
8
  // 时间日期
9
- export const DatePickerField = ({ disabled = false, showTime = false, isRange, updateValue, value }) => isRange ? (_jsx(Tooltip, { title: value && `${value[0]}~${value[1]}`, children: _jsx(WdDateRange, { status: disabled ? 'disabled' : 'edit', value: value ? [moment(value[0]), moment(value[1])] : null, mode: showTime ? 'datetime' : 'date', "$widget": { closest: () => { } }, events: {
9
+ export const DatePickerField = ({ disabled = false, showTime = false, isRange, updateValue, value }) => isRange ? (_jsx(Tooltip, { title: value && `${value[0]}~${value[1]}`, children: _jsx(WdDateRange, { status: disabled ? 'disabled' : 'edit', value: value ? [moment(value[0]), moment(value[1])] : null, mode: showTime ? 'datetime' : 'day', "$widget": { closest: () => { } }, events: {
10
10
  change: ({ value }) => {
11
11
  updateValue({ value });
12
12
  },
13
- }, labelVisible: false, startPlaceholder: "\u5F00\u59CB\u65F6\u95F4", endPlaceholder: "\u7ED3\u675F\u65F6\u95F4", suffixIcon: "td:calendar", suffixType: "inner" }) })) : (_jsx(Tooltip, { title: value, children: _jsx(WdDate, { status: disabled ? 'disabled' : 'edit', clearable: true, value: value ? moment(value) : null, mode: showTime ? 'datetime' : 'date', events: {
13
+ }, labelVisible: false, startPlaceholder: "\u5F00\u59CB\u65F6\u95F4", endPlaceholder: "\u7ED3\u675F\u65F6\u95F4", suffixIcon: "td:calendar", suffixType: "inner" }) })) : (_jsx(Tooltip, { title: value, children: _jsx(WdDate, { status: disabled ? 'disabled' : 'edit', clearable: true, value: value ? moment(value) : null, mode: showTime ? 'datetime' : 'day', events: {
14
14
  change: ({ value }) => {
15
15
  updateValue({ value });
16
16
  },
@@ -27,7 +27,11 @@ export const TimePickerField = ({ disabled = false, isRange, updateValue, value
27
27
  },
28
28
  }, "$widget": { closest: () => { } }, suffixIcon: "pending", suffixType: "inner" }));
29
29
  // 文本输入框
30
- export const InputField = ({ disabled = false, value, updateValue }) => (_jsx(WdInput, { status: disabled ? 'disabled' : 'edit', size: "full", inputValue: value, "$widget": { closest: () => { } }, events: { change: updateValue }, labelVisible: false, placeholder: "\u8BF7\u8F93\u5165" }));
30
+ export const arrayInputType = ['in', 'nin', 'search_ci', 'nsearch_ci'];
31
+ export const InputField = ({ disabled = false, value, updateValue, fieldCalculation }) => {
32
+ const isTagInput = arrayInputType.includes(fieldCalculation === null || fieldCalculation === void 0 ? void 0 : fieldCalculation.value);
33
+ return (_jsx(WdInput, { clearable: true, isTagInput: isTagInput, status: disabled ? 'disabled' : 'edit', size: "full", inputValue: value, "$widget": { closest: () => { } }, events: { change: updateValue }, labelVisible: false, placeholder: "\u8BF7\u8F93\u5165" }));
34
+ };
31
35
  // 数字范围输入
32
36
  export const MultipleNumber = ({ disabled = false, value, updateValue }) => {
33
37
  const val1 = value ? value[0] : '';
@@ -57,6 +57,7 @@ export const FilterFieldItem = ({ supportManyRelated, updateFilterData, ...filte
57
57
  if (!supportManyRelated && NEW_RELATION_FORMATS.includes(filterType)) {
58
58
  return (_jsx(InputAdornment, { label: label, before: null, children: _jsx(Input, { size: "full", disabled: true, defaultValue: '该类型暂不支持表格筛选器' }) }));
59
59
  }
60
+ // eslint-disable-next-line complexity
60
61
  const renderFieldItem = () => {
61
62
  switch (filterType) {
62
63
  case 'datetime':
@@ -66,7 +67,7 @@ export const FilterFieldItem = ({ supportManyRelated, updateFilterData, ...filte
66
67
  case 'time':
67
68
  return (_jsx(InputAdornment, { label: label, before: _jsx(CalculationSelect, { fieldCalculationOption: fieldCalculationOption, arg: fieldCalculation, cb: updateFilterConfig, isDate: true }), children: _jsx(TimePickerField, { disabled: disabled, value: value, isRange: isRange, updateValue: updateFilterConfig }) }));
68
69
  case 'string':
69
- return (_jsx(InputAdornment, { label: label, before: _jsx(CalculationSelect, { fieldCalculationOption: fieldCalculationOption, arg: fieldCalculation, cb: updateFilterConfig }), children: _jsx(InputField, { updateValue: updateFilterConfig, value: value, disabled: disabled }) }));
70
+ return (_jsx(InputAdornment, { label: label, before: _jsx(CalculationSelect, { fieldCalculationOption: fieldCalculationOption, arg: fieldCalculation, cb: updateFilterConfig }), children: _jsx(InputField, { updateValue: updateFilterConfig, value: value, disabled: disabled, fieldCalculation: fieldCalculation }) }));
70
71
  case 'number':
71
72
  return (_jsx(InputAdornment, { label: label, before: _jsx(CalculationSelect, { fieldCalculationOption: fieldCalculationOption, arg: fieldCalculation, cb: updateFilterConfig }), children: _jsx(NumberField, { updateValue: updateFilterConfig, value: value, isRange: isRange, disabled: disabled }) }));
72
73
  case 'boolean':
@@ -93,6 +94,8 @@ export const FilterFieldItem = ({ supportManyRelated, updateFilterData, ...filte
93
94
  return (_jsx(InputAdornment, { label: label, before: _jsx(CalculationSelect, { fieldCalculationOption: fieldCalculationOption, arg: fieldCalculation, cb: updateFilterConfig }), children: _jsx(SelectSearch, { format: filterType, childDbName: filterFieldItemConfig.childDbName, value: value, updateValue: updateFilterConfig, disabled: disabled, primaryColumn: filterFieldItemConfig.primaryColumn, name: filterFieldItemConfig.name, multiple: true }) }));
94
95
  case 'x-area-code':
95
96
  return (_jsx(InputAdornment, { label: label, before: _jsx(CalculationSelect, { fieldCalculationOption: fieldCalculationOption, arg: fieldCalculation, cb: updateFilterConfig }), children: _jsx(SelectSearch, { format: filterType, childDbName: filterFieldItemConfig.childDbName, value: value, updateValue: updateFilterConfig, disabled: disabled, primaryColumn: filterFieldItemConfig.primaryColumn, name: filterFieldItemConfig.name, regionType: filterFieldItemConfig.regionType }) }));
97
+ case 'array':
98
+ return (_jsx(InputAdornment, { label: label, before: _jsx(CalculationSelect, { fieldCalculationOption: fieldCalculationOption, arg: fieldCalculation, cb: updateFilterConfig }), children: _jsx(InputField, { updateValue: updateFilterConfig, value: value, disabled: disabled, fieldCalculation: fieldCalculation }) }));
96
99
  default:
97
100
  return (_jsx(InputAdornment, { label: label, before: null, children: _jsx(Input, { size: "full", disabled: true, defaultValue: '该类型暂不支持表格筛选器' }) }));
98
101
  }
@@ -8,26 +8,17 @@ export declare const fieldCalculations: {
8
8
  text: string;
9
9
  value: string;
10
10
  }[];
11
- radio: {
11
+ array: {
12
+ value: string;
13
+ text: string;
14
+ }[];
15
+ singleSelect: {
12
16
  text: string;
13
17
  value: string;
14
18
  }[];
15
- checkbox: {
19
+ multipleSelect: {
16
20
  text: string;
17
21
  value: string;
18
22
  }[];
19
23
  };
20
- /**
21
- * 生成筛选配置
22
- * 1、过滤不支持搜索的字段
23
- * 2、生成配置
24
- * 3、枚举/数字需要特殊处理(即format,用于处理查询数据转换)
25
- * { filterType: 'datetime' | 'date' | 'time' | 'string' |'number' | 'x-enumObj' , isRange: boolean }
26
- *
27
- *
28
- * field?.type === 'array' && field?.format === '' 非关联关系 数组类型 不支持搜索
29
- * field?.type === 'object' && field?.format === '' 非关联关系 对象类型 不支持搜索
30
- * field?.name === '_departmentList' && field?.format === '' 所属部门 系统字段 不支持搜索
31
- * ['x-markdown', 'x-location', 'x-music', 'x-json', 'x-video', 'x-file', 'x-image', 'x-rtf', 'function'] 不支持搜索
32
- */
33
24
  export declare const filterFieldsGenerate: (fields: any) => any;
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable complexity */
2
+ import { getUuid } from '../../../../utils/tool';
2
3
  const NEW_SINGLE_RELATION_FORMATS = ['many-one', 'one-one', 'one-one-r'];
3
4
  const NEW_MULTIPLE_RELATION_FORMATS = ['many-many', 'one-many'];
4
5
  export const NEW_RELATION_FORMATS = ['many-one', 'one-one', 'one-one-r', 'many-many', 'one-many'];
@@ -24,15 +25,19 @@ export const fieldCalculations = {
24
25
  // { text: '为空', value: '$empty' },
25
26
  // { text: '不为空', value: '$nempty' },
26
27
  ],
27
- radio: [
28
+ array: [
29
+ { value: 'in', text: '包含其一' },
30
+ { value: 'nin', text: '不包含' },
31
+ ],
32
+ singleSelect: [
28
33
  { text: '等于', value: 'eq' },
29
34
  { text: '不等于', value: 'neq' },
30
35
  // { text: '为空', value: '$empty' },
31
36
  // { text: '不为空', value: '$nempty' },
32
37
  ],
33
- checkbox: [
34
- { text: '等于任意一个', value: 'in' },
35
- { text: '不等于任意一个', value: 'nin' },
38
+ multipleSelect: [
39
+ { text: '包含其一', value: 'in' },
40
+ { text: '不包含', value: 'nin' },
36
41
  // { text: '为空', value: '$empty' },
37
42
  // { text: '不为空', value: '$nempty' },
38
43
  ],
@@ -45,21 +50,39 @@ export const fieldCalculations = {
45
50
  * { filterType: 'datetime' | 'date' | 'time' | 'string' |'number' | 'x-enumObj' , isRange: boolean }
46
51
  *
47
52
  *
53
+ * field?.type === 'array' && field?.items?.type === 'string'&& !['x-markdown','x-location','x-music','x-json','x-video','x-file','x-image','x-rtf','function'].includes(this?.items?.format)) 文本数组支持查询
48
54
  * field?.type === 'array' && field?.format === '' 非关联关系 数组类型 不支持搜索
49
55
  * field?.type === 'object' && field?.format === '' 非关联关系 对象类型 不支持搜索
50
56
  * field?.name === '_departmentList' && field?.format === '' 所属部门 系统字段 不支持搜索
51
57
  * ['x-markdown', 'x-location', 'x-music', 'x-json', 'x-video', 'x-file', 'x-image', 'x-rtf', 'function'] 不支持搜索
52
58
  */
59
+ const unsupportedSearchFieldsFormats = [
60
+ 'x-markdown',
61
+ 'x-location',
62
+ 'x-music',
63
+ 'x-json',
64
+ 'x-video',
65
+ 'x-file',
66
+ 'x-image',
67
+ 'x-rtf',
68
+ 'function',
69
+ ];
53
70
  export const filterFieldsGenerate = (fields) => {
54
71
  var _a;
55
72
  return (_a = fields === null || fields === void 0 ? void 0 : fields.filter((field) => {
73
+ var _a, _b;
56
74
  // 不支持搜索的类型
57
75
  if (!field)
58
76
  return false;
77
+ if ((field === null || field === void 0 ? void 0 : field.type) === 'array' &&
78
+ ((_a = field === null || field === void 0 ? void 0 : field.items) === null || _a === void 0 ? void 0 : _a.type) === 'string' &&
79
+ !unsupportedSearchFieldsFormats.includes((_b = field === null || field === void 0 ? void 0 : field.items) === null || _b === void 0 ? void 0 : _b.format)) {
80
+ return true;
81
+ }
59
82
  if (((field === null || field === void 0 ? void 0 : field.type) === 'array' && (field === null || field === void 0 ? void 0 : field.format) === '') ||
60
83
  ((field === null || field === void 0 ? void 0 : field.type) === 'object' && (field === null || field === void 0 ? void 0 : field.format) === '') ||
61
84
  ((field === null || field === void 0 ? void 0 : field.name) === '_departmentList' && (field === null || field === void 0 ? void 0 : field.format) === '') ||
62
- ['x-markdown', 'x-location', 'x-music', 'x-json', 'x-video', 'x-file', 'x-image', 'x-rtf', 'function'].includes(field === null || field === void 0 ? void 0 : field.format)) {
85
+ unsupportedSearchFieldsFormats.includes(field === null || field === void 0 ? void 0 : field.format)) {
63
86
  return false;
64
87
  }
65
88
  return true;
@@ -70,7 +93,7 @@ export const filterFieldsGenerate = (fields) => {
70
93
  ? { type: i.type, value: fieldCalculations[i.type][0].value }
71
94
  : {};
72
95
  const filterFieldItemConfig = {
73
- id: i['x-id'],
96
+ id: getUuid(),
74
97
  name: i.name,
75
98
  value: '',
76
99
  isRange: typeof i.isRange === 'boolean' ? i.isRange : true,
@@ -86,17 +109,17 @@ export const filterFieldsGenerate = (fields) => {
86
109
  filterFieldItemConfig.isRange = false;
87
110
  }
88
111
  }
89
- if (i.type === 'boolean') {
112
+ else if (i.type === 'boolean') {
90
113
  filterFieldItemConfig.filterType = i.type;
91
114
  filterFieldItemConfig.options = [
92
115
  { value: true, text: '是', label: '是' },
93
116
  { value: false, text: '否', label: '否' },
94
117
  { value: null, text: '空', label: '空' },
95
118
  ];
96
- filterFieldItemConfig.fieldCalculation.type = 'checkbox';
119
+ filterFieldItemConfig.fieldCalculation.type = 'multipleSelect';
97
120
  filterFieldItemConfig.fieldCalculation.value = 'in';
98
121
  }
99
- if ((_a = i['x-enumObj']) === null || _a === void 0 ? void 0 : _a.length) {
122
+ else if ((_a = i['x-enumObj']) === null || _a === void 0 ? void 0 : _a.length) {
100
123
  filterFieldItemConfig.filterType = 'x-enumObj';
101
124
  filterFieldItemConfig.options = i['x-enumObj'].map((enumItem) => ({
102
125
  value: enumItem === null || enumItem === void 0 ? void 0 : enumItem.value,
@@ -105,34 +128,42 @@ export const filterFieldsGenerate = (fields) => {
105
128
  }));
106
129
  filterFieldItemConfig.options.push({ value: null, text: '空', label: '空' });
107
130
  }
108
- if (i.format === 'x-enum') {
131
+ else if (i.format === 'x-enum') {
109
132
  filterFieldItemConfig.fieldCalculation.value = 'eq';
110
133
  filterFieldItemConfig.filterType = i.format;
111
134
  filterFieldItemConfig.xMultiSelect = i['x-multi-select'];
112
135
  filterFieldItemConfig.xOptionName = i['x-option-name'];
113
- filterFieldItemConfig.fieldCalculation.type = filterFieldItemConfig.xMultiSelect ? 'checkbox' : 'radio';
136
+ filterFieldItemConfig.fieldCalculation.type = filterFieldItemConfig.xMultiSelect
137
+ ? 'multipleSelect'
138
+ : 'singleSelect';
114
139
  filterFieldItemConfig.fieldCalculation.value = filterFieldItemConfig.xMultiSelect ? 'in' : 'eq';
115
140
  }
116
- if (NEW_SINGLE_RELATION_FORMATS.includes(i.format) || i.format === 'father-son' || i.format === 'related') {
141
+ else if (NEW_SINGLE_RELATION_FORMATS.includes(i.format) ||
142
+ i.format === 'father-son' ||
143
+ i.format === 'related') {
117
144
  filterFieldItemConfig.filterType = i.format;
118
145
  filterFieldItemConfig.childDbName = (_b = i['x-parent']) === null || _b === void 0 ? void 0 : _b.parentDataSourceName;
119
146
  filterFieldItemConfig.primaryColumn = (_d = (_c = i === null || i === void 0 ? void 0 : i.parentDatasource) === null || _c === void 0 ? void 0 : _c.schema) === null || _d === void 0 ? void 0 : _d['x-primary-column'];
120
- filterFieldItemConfig.fieldCalculation.type = 'radio';
147
+ filterFieldItemConfig.fieldCalculation.type = 'singleSelect';
121
148
  filterFieldItemConfig.fieldCalculation.value = 'eq';
122
149
  }
123
- if (NEW_MULTIPLE_RELATION_FORMATS.includes(i.format)) {
150
+ else if (NEW_MULTIPLE_RELATION_FORMATS.includes(i.format)) {
124
151
  filterFieldItemConfig.filterType = i.format;
125
152
  filterFieldItemConfig.childDbName = (_e = i['x-parent']) === null || _e === void 0 ? void 0 : _e.parentDataSourceName;
126
153
  filterFieldItemConfig.primaryColumn = (_g = (_f = i === null || i === void 0 ? void 0 : i.parentDatasource) === null || _f === void 0 ? void 0 : _f.schema) === null || _g === void 0 ? void 0 : _g['x-primary-column'];
127
- filterFieldItemConfig.fieldCalculation.type = 'checkbox';
154
+ filterFieldItemConfig.fieldCalculation.type = 'multipleSelect';
128
155
  filterFieldItemConfig.fieldCalculation.value = 'in';
129
156
  }
130
- if (i.format === 'x-area-code') {
157
+ else if (i.format === 'x-area-code') {
131
158
  filterFieldItemConfig.filterType = i.format;
132
159
  filterFieldItemConfig.regionType = i['x-area-code-type'];
133
160
  filterFieldItemConfig.fieldCalculation.type = 'string';
134
161
  filterFieldItemConfig.fieldCalculation.value = 'search_ci';
135
162
  }
163
+ else if (i.type === 'array') {
164
+ filterFieldItemConfig.fieldCalculation.type = 'array';
165
+ filterFieldItemConfig.fieldCalculation.value = 'in';
166
+ }
136
167
  const fieldCalculationOption = fieldCalculations[filterFieldItemConfig.fieldCalculation.type];
137
168
  filterFieldItemConfig.fieldCalculationOption = fieldCalculationOption;
138
169
  // 用户自定义配置