@pisell/materials 1.0.1012 → 1.0.1014

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 (35) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +2 -2
  6. package/build/lowcode/view.js +2 -2
  7. package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
  8. package/es/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +2 -2
  9. package/es/components/dataSourceComponents/fields/Input.Email/index.d.ts +2 -2
  10. package/es/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
  11. package/es/components/dataSourceComponents/fields/Input.TextArea/index.d.ts +2 -2
  12. package/es/components/dataSourceComponents/fields/Input.Url/index.d.ts +2 -2
  13. package/es/components/dataSourceComponents/fields/Radio/WithMode.d.ts +2 -2
  14. package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
  15. package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.js +5 -3
  16. package/es/components/dataSourceComponents/fields/Translation/type.d.ts +2 -0
  17. package/es/components/date-picker/index.d.ts +2 -2
  18. package/es/components/pisellDataSourceContainer/components/Pagination/index.d.ts +2 -2
  19. package/es/components/pisellDataSourceContainer/components/Table/index.d.ts +2 -2
  20. package/es/components/productCard/cartSkuCard/components/MultiDay/index.js +2 -2
  21. package/es/components/time-picker/index.d.ts +2 -2
  22. package/es/components/upload/index.d.ts +2 -2
  23. package/lib/components/PisellCards/index.d.ts +6 -6
  24. package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +2 -2
  25. package/lib/components/dataSourceComponents/fields/Input.Email/index.d.ts +2 -2
  26. package/lib/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
  27. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +2 -2
  28. package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
  29. package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.js +5 -3
  30. package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +2 -0
  31. package/lib/components/pisellDatePicker/index.d.ts +2 -2
  32. package/lib/components/productCard/cartSkuCard/components/MultiDay/index.js +2 -2
  33. package/lowcode/_utils/defaultSchema.ts +45 -24
  34. package/lowcode/data-source-form/utils.ts +62 -3
  35. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import * as react2 from "react";
2
+ import * as react1 from "react";
3
3
 
4
4
  //#region src/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts
5
- declare const DataSourceQRCode: (props: any) => react2.JSX.Element;
5
+ declare const DataSourceQRCode: (props: any) => react1.JSX.Element;
6
6
  //#endregion
7
7
  export { DataSourceQRCode };
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckboxGroupProps } from "./type.js";
3
3
  import { WithModeProps } from "../../dataSourceForm/utils.js";
4
- import * as react23 from "react";
4
+ import * as react22 from "react";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts
7
7
  type CheckboxComponent = React.FC & {
8
8
  Group: typeof CheckboxGroupWithMode;
9
9
  };
10
10
  declare const CheckboxWithMode: CheckboxComponent;
11
- declare const CheckboxGroupWithMode: react23.FC<CheckboxGroupProps & WithModeProps>;
11
+ declare const CheckboxGroupWithMode: react22.FC<CheckboxGroupProps & WithModeProps>;
12
12
  //#endregion
13
13
  export { CheckboxWithMode };
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
- import * as antd19 from "antd";
2
+ import * as antd21 from "antd";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/components/dataSourceComponents/fields/Input.Email/index.d.ts
6
- declare const Email: React.FC<antd19.InputProps & {
6
+ declare const Email: React.FC<antd21.InputProps & {
7
7
  onChange: (value: string) => void;
8
8
  } & WithModeProps & WithFormItemProps>;
9
9
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
2
  import * as antd18 from "antd";
3
3
  import React from "react";
4
- import * as antd_es_input4 from "antd/es/input";
4
+ import * as antd_es_input3 from "antd/es/input";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Input.Password/index.d.ts
7
- declare const Password: React.FC<antd_es_input4.PasswordProps & React.RefAttributes<antd18.InputRef> & WithModeProps & WithFormItemProps>;
7
+ declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<antd18.InputRef> & WithModeProps & WithFormItemProps>;
8
8
  //#endregion
9
9
  export { Password };
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
2
  import React from "react";
3
- import * as antd_es_input3 from "antd/es/input";
3
+ import * as antd_es_input4 from "antd/es/input";
4
4
  import * as antd_es_input_TextArea0 from "antd/es/input/TextArea";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Input.TextArea/index.d.ts
7
- declare const TextArea: React.FC<antd_es_input3.TextAreaProps & React.RefAttributes<antd_es_input_TextArea0.TextAreaRef> & WithModeProps & WithFormItemProps>;
7
+ declare const TextArea: React.FC<antd_es_input4.TextAreaProps & React.RefAttributes<antd_es_input_TextArea0.TextAreaRef> & WithModeProps & WithFormItemProps>;
8
8
  //#endregion
9
9
  export { TextArea };
@@ -1,8 +1,8 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
- import * as antd20 from "antd";
2
+ import * as antd19 from "antd";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/components/dataSourceComponents/fields/Input.Url/index.d.ts
6
- declare const Url: React.FC<antd20.InputProps & React.RefAttributes<antd20.InputRef> & WithModeProps & WithFormItemProps>;
6
+ declare const Url: React.FC<antd19.InputProps & React.RefAttributes<antd19.InputRef> & WithModeProps & WithFormItemProps>;
7
7
  //#endregion
8
8
  export { Url };
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { WithModeProps } from "../../dataSourceForm/utils.js";
3
3
  import { RadioGroupProps } from "./type.js";
4
- import * as react22 from "react";
4
+ import * as react23 from "react";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Radio/WithMode.d.ts
7
7
  type RadioComponent = React.FC & {
8
8
  Group: typeof RadioGroupWithMode;
9
9
  };
10
10
  declare const RadioWithMode: RadioComponent;
11
- declare const RadioGroupWithMode: react22.FC<RadioGroupProps & WithModeProps>;
11
+ declare const RadioGroupWithMode: react23.FC<RadioGroupProps & WithModeProps>;
12
12
  //#endregion
13
13
  export { RadioWithMode };
@@ -6,7 +6,7 @@ import * as antd_es_select0 from "antd/es/select";
6
6
  //#region src/components/dataSourceComponents/fields/Select/index.d.ts
7
7
  declare const SelectWithDataSource: (props: antd0.SelectProps<any, antd_es_select0.DefaultOptionType> & WithModeProps & WithFormItemProps & {
8
8
  options?: any;
9
- optionSourceType?: "custom" | "default" | "api" | undefined;
9
+ optionSourceType?: "default" | "custom" | "api" | undefined;
10
10
  labelField: string;
11
11
  valueField: string;
12
12
  extraParams?: Record<string, any> | undefined;
@@ -30,7 +30,7 @@ const languageConfig = [
30
30
  label: "繁體中文"
31
31
  }
32
32
  ];
33
- const Translation = ({ value = defaultValue, onChange, placeholder, disabled, type = "text", maxLength }) => {
33
+ const Translation = ({ value = defaultValue, onChange, placeholder, disabled, type = "text", maxLength, inputStyle }) => {
34
34
  const [open, setOpen] = useState(false);
35
35
  const InputComponent = useCallback(() => {
36
36
  switch (type) {
@@ -57,7 +57,8 @@ const Translation = ({ value = defaultValue, onChange, placeholder, disabled, ty
57
57
  value: (value === null || value === void 0 ? void 0 : value[key]) || "",
58
58
  onChange: handleInputChange(key),
59
59
  allowClear: true,
60
- maxLength
60
+ maxLength,
61
+ style: inputStyle || {}
61
62
  })))));
62
63
  return /* @__PURE__ */ React.createElement("div", { className: "translation-wrapper" }, /* @__PURE__ */ React.createElement(InputComponent, {
63
64
  value: (value === null || value === void 0 ? void 0 : value.original) || "",
@@ -65,7 +66,8 @@ const Translation = ({ value = defaultValue, onChange, placeholder, disabled, ty
65
66
  placeholder,
66
67
  disabled,
67
68
  className: "translation-input",
68
- maxLength
69
+ maxLength,
70
+ style: inputStyle || {}
69
71
  }), /* @__PURE__ */ React.createElement(Popover, {
70
72
  content,
71
73
  trigger: "click",
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ModeType } from "../../dataSourceForm/type.js";
2
3
 
3
4
  //#region src/components/dataSourceComponents/fields/Translation/type.d.ts
@@ -16,6 +17,7 @@ interface TranslationProps {
16
17
  className?: string;
17
18
  type?: 'text' | 'textarea';
18
19
  maxLength?: number;
20
+ inputStyle?: React.CSSProperties;
19
21
  }
20
22
  //#endregion
21
23
  export { TranslationProps };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import * as react1 from "react";
2
+ import * as react2 from "react";
3
3
 
4
4
  //#region src/components/date-picker/index.d.ts
5
- declare const DatePicker: (props: any) => react1.JSX.Element;
5
+ declare const DatePicker: (props: any) => react2.JSX.Element;
6
6
  //#endregion
7
7
  export { DatePicker };
@@ -1,9 +1,9 @@
1
1
  import { DataSourceContainerContextType } from "../../type.js";
2
- import * as antd24 from "antd";
2
+ import * as antd23 from "antd";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/components/pisellDataSourceContainer/components/Pagination/index.d.ts
6
- declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd24.PaginationProps> & DataSourceContainerContextType & React.RefAttributes<unknown> & {
6
+ declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd23.PaginationProps> & DataSourceContainerContextType & React.RefAttributes<unknown> & {
7
7
  refId?: string | undefined;
8
8
  }, "ref"> & React.RefAttributes<any>>;
9
9
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { DataSourceContainerContextType } from "../../type.js";
2
- import * as antd23 from "antd";
2
+ import * as antd24 from "antd";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/components/pisellDataSourceContainer/components/Table/index.d.ts
6
- declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd23.TableProps<any>> & DataSourceContainerContextType & {
6
+ declare const _default: React.ForwardRefExoticComponent<Omit<Partial<antd24.TableProps<any>> & DataSourceContainerContextType & {
7
7
  scopeId?: string | undefined;
8
8
  __id?: string | undefined;
9
9
  } & React.RefAttributes<unknown> & {
@@ -25,8 +25,8 @@ const MultiDay = ({ dataSource, hideDivider }) => {
25
25
  * @Date: 2024-12-28 23:00
26
26
  */
27
27
  const lists = useMemo(() => {
28
- return formatDateRanges([dataSource]);
29
- }, [items, dataSource]);
28
+ return formatDateRanges(items);
29
+ }, [items]);
30
30
  return /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}__multi-day-wrap`) }, lists === null || lists === void 0 ? void 0 : lists.map((m, index) => {
31
31
  return /* @__PURE__ */ React.createElement("div", { key: index }, /* @__PURE__ */ React.createElement(Divider, { style: { margin: "4px 0" } }), /* @__PURE__ */ React.createElement("div", { className: classNames(`${PREFIX}__multi-day`) }, /* @__PURE__ */ React.createElement("div", null, formatMultiDayDate(_objectSpread2(_objectSpread2({}, m), {}, { locale }))), /* @__PURE__ */ React.createElement(AmountFooter_default, {
32
32
  item: _objectSpread2(_objectSpread2({}, m), {}, { symbol }),
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import * as react20 from "react";
2
+ import * as react21 from "react";
3
3
 
4
4
  //#region src/components/time-picker/index.d.ts
5
- declare const TimePicker: (props: any) => react20.JSX.Element;
5
+ declare const TimePicker: (props: any) => react21.JSX.Element;
6
6
  //#endregion
7
7
  export { TimePicker };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import * as react21 from "react";
2
+ import * as react20 from "react";
3
3
 
4
4
  //#region src/components/upload/index.d.ts
5
- declare const Upload: (props: any) => react21.JSX.Element;
5
+ declare const Upload: (props: any) => react20.JSX.Element;
6
6
  //#endregion
7
7
  export { Upload };
@@ -6,15 +6,15 @@ import "./components/GraphicTextCard/index.js";
6
6
  import "./components/PisellImageCard/index.js";
7
7
  import { BadgeConfig, TabCardProps } from "./components/TabCard/types.js";
8
8
  import { MultilevelCardProps } from "./components/MultilevelCard/types.js";
9
- import * as react11 from "react";
9
+ import * as react12 from "react";
10
10
 
11
11
  //#region src/components/PisellCards/index.d.ts
12
12
  declare const PisellCards: {
13
- TabCard: (props: any) => react11.JSX.Element;
14
- TextCard: (props: any) => react11.JSX.Element;
15
- GraphicTextCard: (props: GraphicTextCardProps) => react11.JSX.Element;
16
- MultilevelCard: (props: any) => react11.JSX.Element;
17
- PisellImageCard: (props: PisellImageCardProps) => react11.JSX.Element;
13
+ TabCard: (props: any) => react12.JSX.Element;
14
+ TextCard: (props: any) => react12.JSX.Element;
15
+ GraphicTextCard: (props: GraphicTextCardProps) => react12.JSX.Element;
16
+ MultilevelCard: (props: any) => react12.JSX.Element;
17
+ PisellImageCard: (props: PisellImageCardProps) => react12.JSX.Element;
18
18
  };
19
19
  //#endregion
20
20
  export { PisellCards };
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckboxGroupProps } from "./type.js";
3
3
  import { WithModeProps } from "../../dataSourceForm/utils.js";
4
- import * as react22 from "react";
4
+ import * as react23 from "react";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts
7
7
  type CheckboxComponent = React.FC & {
8
8
  Group: typeof CheckboxGroupWithMode;
9
9
  };
10
10
  declare const CheckboxWithMode: CheckboxComponent;
11
- declare const CheckboxGroupWithMode: react22.FC<CheckboxGroupProps & WithModeProps>;
11
+ declare const CheckboxGroupWithMode: react23.FC<CheckboxGroupProps & WithModeProps>;
12
12
  //#endregion
13
13
  export { CheckboxWithMode };
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
- import * as antd18 from "antd";
2
+ import * as antd21 from "antd";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/components/dataSourceComponents/fields/Input.Email/index.d.ts
6
- declare const Email: React.FC<antd18.InputProps & {
6
+ declare const Email: React.FC<antd21.InputProps & {
7
7
  onChange: (value: string) => void;
8
8
  } & WithModeProps & WithFormItemProps>;
9
9
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
- import * as antd22 from "antd";
2
+ import * as antd18 from "antd";
3
3
  import React from "react";
4
4
  import * as antd_es_input3 from "antd/es/input";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Input.Password/index.d.ts
7
- declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<antd22.InputRef> & WithModeProps & WithFormItemProps>;
7
+ declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<antd18.InputRef> & WithModeProps & WithFormItemProps>;
8
8
  //#endregion
9
9
  export { Password };
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
- import * as antd21 from "antd";
2
+ import * as antd22 from "antd";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts
6
- declare const Subdomain: React.FC<antd21.InputProps & {
6
+ declare const Subdomain: React.FC<antd22.InputProps & {
7
7
  onChange: (value: string) => void;
8
8
  onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
9
9
  rootDomain: "custom" | "saas" | "xzero";
@@ -6,7 +6,7 @@ import * as antd_es_select0 from "antd/es/select";
6
6
  //#region src/components/dataSourceComponents/fields/Select/index.d.ts
7
7
  declare const SelectWithDataSource: (props: antd0.SelectProps<any, antd_es_select0.DefaultOptionType> & WithModeProps & WithFormItemProps & {
8
8
  options?: any;
9
- optionSourceType?: "custom" | "default" | "api" | undefined;
9
+ optionSourceType?: "default" | "custom" | "api" | undefined;
10
10
  labelField: string;
11
11
  valueField: string;
12
12
  extraParams?: Record<string, any> | undefined;
@@ -32,7 +32,7 @@ const languageConfig = [
32
32
  label: "繁體中文"
33
33
  }
34
34
  ];
35
- const Translation = ({ value = defaultValue, onChange, placeholder, disabled, type = "text", maxLength }) => {
35
+ const Translation = ({ value = defaultValue, onChange, placeholder, disabled, type = "text", maxLength, inputStyle }) => {
36
36
  const [open, setOpen] = (0, react.useState)(false);
37
37
  const InputComponent = (0, react.useCallback)(() => {
38
38
  switch (type) {
@@ -59,7 +59,8 @@ const Translation = ({ value = defaultValue, onChange, placeholder, disabled, ty
59
59
  value: (value === null || value === void 0 ? void 0 : value[key]) || "",
60
60
  onChange: handleInputChange(key),
61
61
  allowClear: true,
62
- maxLength
62
+ maxLength,
63
+ style: inputStyle || {}
63
64
  })))));
64
65
  return /* @__PURE__ */ react.default.createElement("div", { className: "translation-wrapper" }, /* @__PURE__ */ react.default.createElement(InputComponent, {
65
66
  value: (value === null || value === void 0 ? void 0 : value.original) || "",
@@ -67,7 +68,8 @@ const Translation = ({ value = defaultValue, onChange, placeholder, disabled, ty
67
68
  placeholder,
68
69
  disabled,
69
70
  className: "translation-input",
70
- maxLength
71
+ maxLength,
72
+ style: inputStyle || {}
71
73
  }), /* @__PURE__ */ react.default.createElement(antd.Popover, {
72
74
  content,
73
75
  trigger: "click",
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ModeType } from "../../dataSourceForm/type.js";
2
3
 
3
4
  //#region src/components/dataSourceComponents/fields/Translation/type.d.ts
@@ -16,6 +17,7 @@ interface TranslationProps {
16
17
  className?: string;
17
18
  type?: 'text' | 'textarea';
18
19
  maxLength?: number;
20
+ inputStyle?: React.CSSProperties;
19
21
  }
20
22
  //#endregion
21
23
  export { TranslationProps };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import * as react16 from "react";
2
+ import * as react11 from "react";
3
3
 
4
4
  //#region src/components/pisellDatePicker/index.d.ts
5
- declare const PisellDatePicker: (props: any) => react16.JSX.Element;
5
+ declare const PisellDatePicker: (props: any) => react11.JSX.Element;
6
6
  //#endregion
7
7
  export { PisellDatePicker };
@@ -28,8 +28,8 @@ const MultiDay = ({ dataSource, hideDivider }) => {
28
28
  * @Date: 2024-12-28 23:00
29
29
  */
30
30
  const lists = (0, react.useMemo)(() => {
31
- return require_utils$1.formatDateRanges([dataSource]);
32
- }, [items, dataSource]);
31
+ return require_utils$1.formatDateRanges(items);
32
+ }, [items]);
33
33
  return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${require_index$1.PREFIX}__multi-day-wrap`) }, lists === null || lists === void 0 ? void 0 : lists.map((m, index) => {
34
34
  return /* @__PURE__ */ react.default.createElement("div", { key: index }, /* @__PURE__ */ react.default.createElement(antd.Divider, { style: { margin: "4px 0" } }), /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${require_index$1.PREFIX}__multi-day`) }, /* @__PURE__ */ react.default.createElement("div", null, require_utils.formatMultiDayDate(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, m), {}, { locale }))), /* @__PURE__ */ react.default.createElement(require_index.default, {
35
35
  item: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, m), {}, { symbol }),
@@ -47,7 +47,8 @@ export const generalItemMap = {
47
47
  },
48
48
  tip: {
49
49
  type: 'i18n',
50
- 'en-US': 'The text displayed in the label of the form item, corresponding to Label.',
50
+ 'en-US':
51
+ 'The text displayed in the label of the form item, corresponding to Label.',
51
52
  'zh-CN': '用于显示在表单项的标签文本,对应Label。',
52
53
  },
53
54
  },
@@ -164,8 +165,10 @@ export const generalItemMap = {
164
165
  },
165
166
  tip: {
166
167
  type: 'i18n',
167
- 'en-US': 'Whether to hide the Label of the component, including title and tooltip, but not including helper text.',
168
- 'zh-CN': '是否隐藏组件的Label,包括titletooltip,但是不包括helper text',
168
+ 'en-US':
169
+ 'Whether to hide the Label of the component, including title and tooltip, but not including helper text.',
170
+ 'zh-CN':
171
+ '是否隐藏组件的Label,包括title和tooltip,但是不包括helper text。',
169
172
  },
170
173
  },
171
174
  propType: 'bool',
@@ -511,7 +514,9 @@ export const generalItemMap = {
511
514
  propType: 'string',
512
515
  setter: 'PisellI18nSetter',
513
516
  condition: (target: any) => {
514
- return !(['subdomain', 'appIdentifier'].includes(target.parent.getPropValue('type')));
517
+ return !['subdomain', 'appIdentifier'].includes(
518
+ target.parent.getPropValue('type')
519
+ );
515
520
  },
516
521
  },
517
522
  ],
@@ -676,7 +681,7 @@ export const formItemGeneralDataGroup = {
676
681
  disabled: true,
677
682
  filters: {
678
683
  tables: 'all',
679
- variables: {}
684
+ variables: {},
680
685
  },
681
686
  },
682
687
  },
@@ -701,15 +706,32 @@ export const formItemGeneralOptionTypeGroup = {
701
706
  'en-US': 'Type',
702
707
  'zh-CN': '类型',
703
708
  },
704
- setter: {
705
- componentName: 'SelectSetter',
706
- props: {
707
- options: [
708
- { title: '默认', value: 'default' },
709
- { title: '自定义', value: 'custom' },
710
- { title: 'API', value: 'api' },
711
- ],
712
- },
709
+ setter: (target: any) => {
710
+ const parentForm = getParentForm(target);
711
+ const fields = getVariable(parentForm, 'currentFields');
712
+
713
+ // 获取当前表单项的 name
714
+ const currentFieldName = target.getProps().getPropValue('name');
715
+
716
+ // 在 currentFields 中查找对应的字段配置
717
+ const fieldConfig = fields?.find(
718
+ (item: any) => item.name === currentFieldName
719
+ );
720
+
721
+ // 检查字段配置中是否有 x-data-source,如果有说明 optionSourceType 是从数据源设置的
722
+ const dataSourceType = fieldConfig?.uiSchema?.['x-data-source']?.type;
723
+
724
+ return {
725
+ componentName: 'PisellSelectSetter',
726
+ props: {
727
+ disabled: !!dataSourceType,
728
+ options: [
729
+ { label: '默认', value: 'default' },
730
+ { label: '自定义', value: 'custom' },
731
+ { label: 'API', value: 'api' },
732
+ ],
733
+ },
734
+ };
713
735
  },
714
736
  },
715
737
  {
@@ -747,7 +769,7 @@ export const formItemGeneralOptionTypeGroup = {
747
769
  mode: 'list',
748
770
  filters: {
749
771
  tables: 'all',
750
- variables: {}
772
+ variables: {},
751
773
  },
752
774
  },
753
775
  },
@@ -765,7 +787,7 @@ export const formItemGeneralOptionTypeGroup = {
765
787
  'en-US': 'Extra Params',
766
788
  'zh-CN': '额外参数',
767
789
  },
768
- setter: 'JsonSetter'
790
+ setter: 'JsonSetter',
769
791
  },
770
792
  {
771
793
  name: 'labelField',
@@ -852,7 +874,7 @@ export const formItemGeneralOptionTypeGroup = {
852
874
  itemSetter: {
853
875
  componentName: 'ObjectSetter',
854
876
  initialValue: () => {
855
- return {}
877
+ return {};
856
878
  },
857
879
  props: {
858
880
  config: {
@@ -1554,7 +1576,7 @@ export const genGeneralVariablesSetting = ({
1554
1576
  props: (target: any) => {
1555
1577
  return {
1556
1578
  filters: {
1557
- variables: {}
1579
+ variables: {},
1558
1580
  },
1559
1581
  variables: getCptValuesVariables(target),
1560
1582
  };
@@ -1563,38 +1585,37 @@ export const genGeneralVariablesSetting = ({
1563
1585
  };
1564
1586
  };
1565
1587
 
1566
-
1567
1588
  export const inputPlaceholder = {
1568
1589
  type: 'i18n',
1569
- 'en': 'Enter',
1590
+ en: 'Enter',
1570
1591
  'zh-CN': '请输入',
1571
1592
  'zh-HK': '請輸入',
1572
1593
  };
1573
1594
 
1574
1595
  export const selectPlaceholder = {
1575
1596
  type: 'i18n',
1576
- 'en': 'Select an option',
1597
+ en: 'Select an option',
1577
1598
  'zh-CN': '请选择一个选项',
1578
1599
  'zh-HK': '請選擇一個選項',
1579
1600
  };
1580
1601
 
1581
1602
  export const selectMultiplePlaceholder = {
1582
1603
  type: 'i18n',
1583
- 'en': 'Select one or more options',
1604
+ en: 'Select one or more options',
1584
1605
  'zh-CN': '请选择一个或多个选项',
1585
1606
  'zh-HK': '請選擇一個或多個選項',
1586
1607
  };
1587
1608
 
1588
1609
  export const datePickerPlaceholder = {
1589
1610
  type: 'i18n',
1590
- 'en': 'Select a date',
1611
+ en: 'Select a date',
1591
1612
  'zh-CN': '请选择日期',
1592
1613
  'zh-HK': '請選擇日期',
1593
1614
  };
1594
1615
 
1595
1616
  export const timePickerPlaceholder = {
1596
1617
  type: 'i18n',
1597
- 'en': 'Select a time',
1618
+ en: 'Select a time',
1598
1619
  'zh-CN': '请选择时间',
1599
1620
  'zh-HK': '請選擇時間',
1600
1621
  };
@@ -16,6 +16,19 @@ type UiSchema = {
16
16
  'x-validator'?: string;
17
17
  'x-display'?: 'visible' | 'hidden' | 'none';
18
18
  'x-pattern'?: 'editable' | 'disabled' | 'readPretty';
19
+ 'x-data-source'?: {
20
+ sourceType?: string;
21
+ type?: string;
22
+ options?: Array<{
23
+ id?: string;
24
+ label: string | any; // 支持字符串或多语言对象
25
+ value: string;
26
+ color?: string;
27
+ }>;
28
+ labelField?: string;
29
+ valueField?: string;
30
+ dataSource?: any;
31
+ };
19
32
  type: 'string' | 'number' | 'boolean' | 'array' | 'object';
20
33
  };
21
34
 
@@ -290,9 +303,12 @@ export const createFormItemSchema = (
290
303
  componentName = 'Translation';
291
304
  }
292
305
 
306
+ // 获取选项配置
307
+ const dataSourceConfig = (uiSchema as any)?.['x-data-source'];
308
+
293
309
  if (
294
310
  ['Select', 'Radio.Group', 'Checkbox.Group'].includes(xComponent) &&
295
- uiSchema?.enum?.length > 0
311
+ (uiSchema?.enum?.length > 0 || dataSourceConfig)
296
312
  ) {
297
313
  if (['Radio.Group', 'Checkbox.Group'].includes(xComponent)) {
298
314
  props.direction = 'horizontal';
@@ -319,8 +335,51 @@ export const createFormItemSchema = (
319
335
  };
320
336
  }
321
337
  }
322
- props.optionSourceType = 'default';
323
- props.options = uiSchema?.enum || [];
338
+
339
+ // 统一的选项配置处理
340
+ const optionConfig = dataSourceConfig || {};
341
+
342
+ // 设置 optionSourceType
343
+ props.optionSourceType = optionConfig?.type || 'default';
344
+
345
+ // 根据 sourceType 设置不同的配置
346
+ if (props.optionSourceType === 'default') {
347
+ // 优先使用 optionConfig.options,其次兼容旧的 enum 格式
348
+ const rawOptions = optionConfig.options || uiSchema?.enum || [];
349
+
350
+ // 转换多语言格式的 label 为组件可识别的 i18n 格式
351
+ props.options = rawOptions.map((option: any) => {
352
+ const label = option.label;
353
+
354
+ // 如果 label 是多语言对象格式,转换为 i18n 格式
355
+ if (label && typeof label === 'object' && !label.type) {
356
+ return {
357
+ ...option,
358
+ label: {
359
+ type: 'i18n',
360
+ 'en': label.en || label.original || '',
361
+ 'zh-CN': label['zh-CN'] || label.original || '',
362
+ 'zh-HK': label['zh-HK'] || label.original || '',
363
+ }
364
+ };
365
+ }
366
+
367
+ // 如果已经是 i18n 格式或者是字符串,直接返回
368
+ return option;
369
+ });
370
+ } else if (props.optionSourceType === 'api') {
371
+ // API 类型需要设置 labelField 和 valueField
372
+ if (optionConfig.labelField) {
373
+ props.labelField = optionConfig.labelField;
374
+ }
375
+ if (optionConfig.valueField) {
376
+ props.valueField = optionConfig.valueField;
377
+ }
378
+ // dataSource 如果有配置也可以传递
379
+ if (optionConfig.dataSource) {
380
+ props.dataSource = optionConfig.dataSource;
381
+ }
382
+ }
324
383
  }
325
384
 
326
385
  if (xComponent === 'TimePicker') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.1012",
3
+ "version": "1.0.1014",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",