@para-ui/core 4.0.3 → 4.0.4

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.
@@ -161,14 +161,30 @@ var FormItem = function FormItem(props) {
161
161
  * @param {*} ReactNode
162
162
  */
163
163
  var getTextField = function getTextField() {
164
+ var selectList = typeof list === 'function' ? list && list(rowIndex, id, name, valueList) : list || [];
165
+ var mergedProps = Object.assign({}, otherPropsCom);
166
+ if (selectList.length > 0 && mergedProps.fetchSuggestions === undefined) {
167
+ mergedProps.fetchSuggestions = function (value, cb) {
168
+ if (selectList.length > 0) {
169
+ cb(selectList.filter(function (item) {
170
+ var label = (item === null || item === void 0 ? void 0 : item.label) || (item === null || item === void 0 ? void 0 : item.value) || item;
171
+ if (typeof label === 'string') return label.toLowerCase().indexOf(value.toLowerCase()) > -1;
172
+ return false;
173
+ }));
174
+ } else cb([]);
175
+ };
176
+ }
164
177
  return jsx(TextField, Object.assign({}, rest, {
165
178
  required: false,
166
179
  label: "",
167
180
  disabled: disabled,
168
181
  onChange: function onChange(e) {
169
182
  return inputChange(e.target.value);
183
+ },
184
+ onSelect: function onSelect(value) {
185
+ inputChange((value === null || value === void 0 ? void 0 : value.value) || value);
170
186
  }
171
- }, otherPropsCom));
187
+ }, mergedProps));
172
188
  };
173
189
  /**
174
190
  * @description: 返回下拉框组件
@@ -10,6 +10,7 @@ import { EmptyProps } from '../Empty';
10
10
  import { QueryingProps } from '../Querying';
11
11
  import { SelectorProps } from '../Selector/interface';
12
12
  import { ComboSelectProps } from '../ComboSelect/interface';
13
+ import { InputLangProps } from '../InputLang';
13
14
  interface ComponentsProps {
14
15
  Select?: Partial<SelectProps>;
15
16
  TextField?: Partial<TextFieldProps>;
@@ -18,6 +19,7 @@ interface ComponentsProps {
18
19
  Querying?: Partial<QueryingProps>;
19
20
  Selector?: Partial<SelectorProps>;
20
21
  ComboSelect?: Partial<ComboSelectProps>;
22
+ InputLang?: Partial<InputLangProps>;
21
23
  [name: string]: any;
22
24
  }
23
25
  export default ComponentsProps;
@@ -39,11 +39,11 @@ export interface InputLangProps extends HelperTextDetailProps {
39
39
  /** 弹出框样式class */
40
40
  popoverClassName?: string;
41
41
  /** 默认值 不受控 */
42
- defaultValue?: valueProps;
42
+ defaultValue?: string | valueProps;
43
43
  /** 值 */
44
- value?: valueProps;
44
+ value?: string | valueProps;
45
45
  /** 改变值 */
46
- onChange?: (val: valueProps) => void;
46
+ onChange?: (val: string | valueProps) => void;
47
47
  /** 语言列表 */
48
48
  langList?: (string | {
49
49
  label: string;
@@ -57,6 +57,10 @@ export interface InputLangProps extends HelperTextDetailProps {
57
57
  disabledDelete?: boolean;
58
58
  /** 禁用key */
59
59
  disabledKey?: boolean | string[];
60
+ /** 输出类型 */
61
+ typeOutput?: 'string' | 'object';
62
+ /** i18n标识 */
63
+ i18n?: boolean;
60
64
  }
61
65
  export declare const InputLang: FunctionComponent<InputLangProps>;
62
66
  export default InputLang;
@@ -9,6 +9,7 @@ import Internet from '@para-ui/icons/Internet';
9
9
  import { GetLanguage, ArrayToObject } from '@paraview/lib';
10
10
  import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
11
11
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
12
+ import { u as useGlobalProps } from '../_verture/useGlobalProps-1e416658.js';
12
13
  import '../_verture/tslib.es6-55ed4bd2.js';
13
14
  import '../Label/index.js';
14
15
  import '../Help/index.js';
@@ -23,8 +24,6 @@ import '@para-ui/icons/PreviewOpen';
23
24
  import '@para-ui/icons/CloseCircleF';
24
25
  import '../Loading/index.js';
25
26
  import '@para-ui/icons/LoadingF';
26
- import '../_verture/useGlobalProps-1e416658.js';
27
- import '@para-ui/core/GlobalContext';
28
27
  import '../_verture/index-389675ab.js';
29
28
  import 'rc-dropdown';
30
29
  import '../_verture/usePopupContainer-635f66f4.js';
@@ -32,6 +31,7 @@ import 'dayjs';
32
31
  import '@para-ui/icons/Delete';
33
32
  import '@para-ui/icons/PlusCircleF';
34
33
  import '../_verture/useFormatMessage-eb13cf56.js';
34
+ import '@para-ui/core/GlobalContext';
35
35
 
36
36
  var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-input-lang {\n display: inline-block;\n width: 100%;\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n}\n.paraui-v4-input-lang .input-lang-text-field > .text-field-content > .text-field-content-before .lang-key {\n max-width: 100px;\n}\n.paraui-v4-input-lang .input-lang-text-field > .text-field-content > .text-field-content-within > .right-icon .lang-list-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.paraui-v4-input-lang .input-lang-text-field > .text-field-content > .text-field-content-within > .right-icon .lang-list-icon:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-input-lang .input-lang-text-field > .paraui-v4-helper-text {\n display: none;\n}\n\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner {\n padding: 20px;\n line-height: 0;\n}\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner .input-lang-multi-box {\n padding-bottom: 0;\n}\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-content .multi-box-content-item .multi-box-content-item-input .multi-box-text-field:first-child {\n flex: 1;\n}\n.paraui-v4-input-lang-popover > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-content .multi-box-content-item .multi-box-content-item-input .multi-box-text-field:last-child {\n flex: 3;\n}\n.paraui-v4-input-lang-popover.paraui-v4-input-lang-popover-disabled-add > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-add {\n display: none;\n}\n.paraui-v4-input-lang-popover.paraui-v4-input-lang-popover-disabled-delete > .component-popover-content > .component-popover-inner .input-lang-multi-box .multi-box-content > .multi-box-content-item .opera-box {\n display: none;\n}";
37
37
  styleInject(css_248z);
@@ -60,8 +60,10 @@ const InputLang = props => {
60
60
  defaultLang,
61
61
  disabledDelete,
62
62
  disabledAdd,
63
- disabledKey
64
- } = props;
63
+ disabledKey,
64
+ typeOutput = 'object',
65
+ i18n
66
+ } = useGlobalProps(props, 'InputLang');
65
67
  const [open, setOpen] = useState(false); // 打开弹窗
66
68
  const [lang, setLang] = useState(GetLanguage() || 'zh'); // 当前语言
67
69
  const [langMapping, setLangMapping] = useState({});
@@ -76,6 +78,8 @@ const InputLang = props => {
76
78
  const refDom = useRef(null);
77
79
  constData.current.lang = lang;
78
80
  constData.current.disabledDelete = disabledDelete;
81
+ constData.current.typeOutput = typeOutput;
82
+ constData.current.i18n = typeOutput === "string" && i18n === undefined ? true : i18n;
79
83
  useEffect(() => {
80
84
  if (props.defaultValue !== undefined) {
81
85
  handValue(props.defaultValue);
@@ -123,7 +127,19 @@ const InputLang = props => {
123
127
  * 处理值
124
128
  */
125
129
  const handValue = val => {
126
- const valueCopy = Object.assign({}, val || constData.current.valueCom);
130
+ let jsonVal;
131
+ if (val) {
132
+ try {
133
+ if (typeof val === "string") jsonVal = JSON.parse(val);else jsonVal = val || {};
134
+ } catch (e) {
135
+ jsonVal = {};
136
+ }
137
+ if (constData.current.i18n === true) {
138
+ constData.current._i18n = jsonVal._i18n || 1;
139
+ delete jsonVal._i18n;
140
+ }
141
+ }
142
+ const valueCopy = Object.assign({}, jsonVal || constData.current.valueCom);
127
143
  const arr = [];
128
144
  const json = {};
129
145
  if (constData.current.disabledDelete) {
@@ -163,11 +179,20 @@ const InputLang = props => {
163
179
  * 向外抛值
164
180
  * */
165
181
  const outValue = val => {
182
+ let valHand = Object.assign({}, val);
166
183
  if (props.value === undefined) {
167
- constData.current.valueCom = Object.assign({}, val);
168
- setValueCom(val);
184
+ constData.current.valueCom = Object.assign({}, valHand);
185
+ setValueCom(valHand);
186
+ }
187
+ if (constData.current.typeOutput === 'string') {
188
+ try {
189
+ if (constData.current.i18n === true) {
190
+ valHand._i18n = constData.current._i18n || 1;
191
+ }
192
+ valHand = JSON.stringify(valHand);
193
+ } catch (e) {}
169
194
  }
170
- onChange && onChange(val);
195
+ onChange && onChange(valHand);
171
196
  };
172
197
  /**
173
198
  * 改变当前语言
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 版本: 4.0.4
2
+ para-ui/core@4.0.4 发布
3
+ 【国际化输入框-InputLang】支持输出输入为string | object, 是否带有i18n标识
4
+ 【DynamicMultibox】动态多值框中输入框支持联想下拉列表
5
+
1
6
  ## 版本: 4.0.3
2
7
  para-ui/core@4.0.3 发布
3
8
  【周期选择器-CycleSelector】新增周期选择器-CycleSelector
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@para-ui/core",
3
3
  "private": false,
4
- "version": "4.0.3",
4
+ "version": "4.0.4",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
7
7
  "description": "Powered by Para FED",