@pisell/materials 1.0.594 → 1.0.596

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 (51) 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/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.js +20 -34
  8. package/build/lowcode/view.js +19 -33
  9. package/es/components/dataSourceComponents/dataSourceForm/utils.js +116 -38
  10. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +0 -1
  11. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +75 -30
  12. package/es/components/dataSourceComponents/fields/Input.Mobile/index.js +11 -1
  13. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +0 -1
  14. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +73 -19
  15. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +2 -1
  16. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +112 -54
  17. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +2 -1
  18. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.js +2 -2
  19. package/es/components/dataSourceComponents/fields/index.d.ts +4 -2
  20. package/es/components/form/index.js +12 -0
  21. package/es/locales/en-US.d.ts +9 -0
  22. package/es/locales/en-US.js +11 -1
  23. package/es/locales/zh-CN.d.ts +8 -0
  24. package/es/locales/zh-CN.js +11 -2
  25. package/es/locales/zh-TW.d.ts +7 -0
  26. package/es/locales/zh-TW.js +9 -1
  27. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +143 -41
  28. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +0 -1
  29. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +31 -26
  30. package/lib/components/dataSourceComponents/fields/Input.Mobile/index.js +11 -1
  31. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +0 -1
  32. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +34 -17
  33. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +2 -1
  34. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +53 -31
  35. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +2 -1
  36. package/lib/components/dataSourceComponents/fields/index.d.ts +4 -2
  37. package/lib/components/form/index.js +10 -1
  38. package/lib/locales/en-US.d.ts +9 -0
  39. package/lib/locales/en-US.js +11 -1
  40. package/lib/locales/zh-CN.d.ts +8 -0
  41. package/lib/locales/zh-CN.js +11 -2
  42. package/lib/locales/zh-TW.d.ts +7 -0
  43. package/lib/locales/zh-TW.js +9 -1
  44. package/lowcode/_utils/defaultSchema.ts +11 -0
  45. package/lowcode/form-item-input.mobile/meta.ts +30 -54
  46. package/lowcode/form-item-input.mobile/snippets.ts +1 -1
  47. package/lowcode/form-item-input.phone/meta.ts +1 -49
  48. package/lowcode/form-item-input.subdomain/meta.ts +0 -2
  49. package/lowcode/form-item-input.subdomain/snippets.ts +8 -9
  50. package/lowcode/form.item/meta.ts +48 -0
  51. package/package.json +1 -1
@@ -5,7 +5,6 @@ export interface PhoneInputProps extends Omit<InputProps, 'value' | 'onChange'>
5
5
  renderMode: ModeType;
6
6
  value?: string;
7
7
  onChange?: (value: string) => void;
8
- isVerification?: boolean;
9
8
  }
10
9
  declare const MobileNumberInputWithMode: React.FC<PhoneInputProps & import("../../dataSourceForm/utils").WithModeProps>;
11
10
  export default MobileNumberInputWithMode;
@@ -41,7 +41,7 @@ var import_ReadPretty = __toESM(require("./ReadPretty"));
41
41
  var import_utils2 = require("../../dataSourceForm/utils");
42
42
  var import_useTranslationOriginal = __toESM(require("../../../../hooks/useTranslationOriginal"));
43
43
  var { Option } = import_select.default;
44
- var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled, ...props }) => {
44
+ var MobileNumberInput = ({ value: propsValue, onChange, disabled, ...props }) => {
45
45
  const { data: countries = [] } = (0, import_serve.useCountries)();
46
46
  const translationOriginal = (0, import_useTranslationOriginal.default)();
47
47
  const value = (0, import_react.useMemo)(() => {
@@ -80,10 +80,38 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
80
80
  }, [value, countries]);
81
81
  const handleCountryChange = (value2) => {
82
82
  setCountryCode(value2);
83
+ const selectedCountry = countries.find(
84
+ (c) => c.code === value2
85
+ );
86
+ const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
87
+ const newValue = `${prefix}${phoneNumber}`;
88
+ onChange == null ? void 0 : onChange(newValue);
89
+ setTimeout(() => {
90
+ const formInstance = props.form;
91
+ const fieldName = props.fieldKey;
92
+ if (formInstance && fieldName) {
93
+ formInstance.validateFields([fieldName]);
94
+ }
95
+ });
83
96
  };
84
97
  const handlePhoneNumberChange = (e) => {
85
98
  const cleanNumber = e.target.value.replace(/\D/g, "");
86
99
  setPhoneNumber(cleanNumber);
100
+ const selectedCountry = countries.find(
101
+ (c) => c.code === countryCode
102
+ );
103
+ const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
104
+ const newValue = cleanNumber ? `${prefix}${cleanNumber}` : "";
105
+ onChange == null ? void 0 : onChange(newValue);
106
+ if (!cleanNumber) {
107
+ setTimeout(() => {
108
+ const formInstance = props.form;
109
+ const fieldName = props.fieldKey;
110
+ if (formInstance && fieldName) {
111
+ formInstance.validateFields([fieldName]);
112
+ }
113
+ });
114
+ }
87
115
  };
88
116
  const concatenatedNumber = (0, import_react.useMemo)(() => {
89
117
  const selectedCountry = countries.find(
@@ -96,30 +124,9 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
96
124
  return `${prefix}${phoneNumber}`;
97
125
  }, [countryCode, phoneNumber, countries]);
98
126
  const handleBlur = () => {
99
- onChange == null ? void 0 : onChange(concatenatedNumber);
127
+ const finalValue = concatenatedNumber;
128
+ onChange == null ? void 0 : onChange(finalValue);
100
129
  };
101
- const status = (0, import_react.useMemo)(() => {
102
- if (!phoneNumber || !isVerification) {
103
- return void 0;
104
- }
105
- if (countryCode === "AU") {
106
- const auRegex = /^(04\d{8}|\d{9})$/.test(phoneNumber);
107
- if (!auRegex) {
108
- return "error";
109
- }
110
- } else if (countryCode === "CN") {
111
- const cnRegex = /^1\d{10}$/.test(phoneNumber);
112
- if (!cnRegex) {
113
- return "error";
114
- }
115
- } else {
116
- const otherRegex = /^\d{1,15}$/.test(phoneNumber);
117
- if (!otherRegex) {
118
- return "error";
119
- }
120
- }
121
- return void 0;
122
- }, [concatenatedNumber, phoneNumber, isVerification, countryCode]);
123
130
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(
124
131
  import_select.default,
125
132
  {
@@ -127,7 +134,6 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
127
134
  value: countryCode,
128
135
  onChange: handleCountryChange,
129
136
  style: { width: "90px" },
130
- onBlur: handleBlur,
131
137
  popupMatchSelectWidth: false,
132
138
  optionLabelProp: "inputValue",
133
139
  optionFilterProp: "label",
@@ -143,7 +149,6 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
143
149
  {
144
150
  ...props,
145
151
  disabled,
146
- status,
147
152
  type: "tel",
148
153
  value: phoneNumber,
149
154
  onChange: handlePhoneNumberChange,
@@ -34,5 +34,15 @@ __export(Input_exports, {
34
34
  module.exports = __toCommonJS(Input_exports);
35
35
  var import_utils = require("../../dataSourceForm/utils");
36
36
  var import_WithMode = __toESM(require("./WithMode"));
37
- var Mobile = (0, import_utils.withFormItem)(import_WithMode.default);
37
+ var Mobile = (0, import_utils.withFormItem)(import_WithMode.default, {
38
+ otherFormItemProps: {
39
+ validateTrigger: ["onChange", "onBlur"]
40
+ },
41
+ innerProps: {
42
+ typeobj: {
43
+ type: "mobile",
44
+ enabled: true
45
+ }
46
+ }
47
+ });
38
48
  var Input_default = Mobile;
@@ -5,7 +5,6 @@ export interface PhoneInputProps extends Omit<InputProps, 'value' | 'onChange'>
5
5
  renderMode: ModeType;
6
6
  value?: string;
7
7
  onChange?: (value: string) => void;
8
- isVerification?: boolean;
9
8
  }
10
9
  declare const PhoneNumberInputWithMode: React.FC<PhoneInputProps & import("../../dataSourceForm/utils").WithModeProps>;
11
10
  export default PhoneNumberInputWithMode;
@@ -34,7 +34,6 @@ __export(WithMode_exports, {
34
34
  module.exports = __toCommonJS(WithMode_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
- var import_libphonenumber_js = require("libphonenumber-js");
38
37
  var import_utils = require("@pisell/utils");
39
38
  var import_select = __toESM(require("../../../select"));
40
39
  var import_serve = require("./serve");
@@ -42,7 +41,7 @@ var import_ReadPretty = __toESM(require("./ReadPretty"));
42
41
  var import_utils2 = require("../../dataSourceForm/utils");
43
42
  var import_useTranslationOriginal = __toESM(require("../../../../hooks/useTranslationOriginal"));
44
43
  var { Option } = import_select.default;
45
- var PhoneNumberInput = ({ value: propsValue, onChange, isVerification, disabled, ...props }) => {
44
+ var PhoneNumberInput = ({ value: propsValue, onChange, disabled, ...props }) => {
46
45
  const { data: countries = [] } = (0, import_serve.useCountries)();
47
46
  const translationOriginal = (0, import_useTranslationOriginal.default)();
48
47
  const value = (0, import_react.useMemo)(() => {
@@ -79,12 +78,40 @@ var PhoneNumberInput = ({ value: propsValue, onChange, isVerification, disabled,
79
78
  setCountryCode(newCountryCode);
80
79
  setPhoneNumber(newPhoneNumber);
81
80
  }, [value, countries]);
82
- const handleCountryChange = (value2) => {
83
- setCountryCode(value2);
84
- };
85
81
  const handlePhoneNumberChange = (e) => {
86
82
  const cleanNumber = e.target.value.replace(/\D/g, "");
87
83
  setPhoneNumber(cleanNumber);
84
+ const selectedCountry = countries.find(
85
+ (c) => c.code === countryCode
86
+ );
87
+ const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
88
+ const newValue = cleanNumber ? `${prefix}${cleanNumber}` : "";
89
+ onChange == null ? void 0 : onChange(newValue);
90
+ if (!cleanNumber) {
91
+ setTimeout(() => {
92
+ const formInstance = props.form;
93
+ const fieldName = props.fieldKey;
94
+ if (formInstance && fieldName) {
95
+ formInstance.validateFields([fieldName]);
96
+ }
97
+ });
98
+ }
99
+ };
100
+ const handleCountryChange = (value2) => {
101
+ setCountryCode(value2);
102
+ const selectedCountry = countries.find(
103
+ (c) => c.code === value2
104
+ );
105
+ const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
106
+ const newValue = `${prefix}${phoneNumber}`;
107
+ onChange == null ? void 0 : onChange(newValue);
108
+ setTimeout(() => {
109
+ const formInstance = props.form;
110
+ const fieldName = props.fieldKey;
111
+ if (formInstance && fieldName) {
112
+ formInstance.validateFields([fieldName]);
113
+ }
114
+ });
88
115
  };
89
116
  const concatenatedNumber = (0, import_react.useMemo)(() => {
90
117
  const selectedCountry = countries.find(
@@ -97,17 +124,9 @@ var PhoneNumberInput = ({ value: propsValue, onChange, isVerification, disabled,
97
124
  return `${prefix}${phoneNumber}`;
98
125
  }, [countryCode, phoneNumber, countries]);
99
126
  const handleBlur = () => {
100
- onChange == null ? void 0 : onChange(concatenatedNumber);
127
+ const finalValue = concatenatedNumber;
128
+ onChange == null ? void 0 : onChange(finalValue);
101
129
  };
102
- const status = (0, import_react.useMemo)(() => {
103
- var _a;
104
- if (!phoneNumber || !isVerification) {
105
- return void 0;
106
- }
107
- const cleanedNumber = concatenatedNumber.replace(/\s|\(|\)/g, "");
108
- const isValid = (0, import_libphonenumber_js.isValidPhoneNumber)(cleanedNumber) && ((_a = (0, import_libphonenumber_js.parsePhoneNumberFromString)(cleanedNumber)) == null ? void 0 : _a.isValid());
109
- return isValid ? void 0 : "error";
110
- }, [concatenatedNumber, phoneNumber, isVerification]);
111
130
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(
112
131
  import_select.default,
113
132
  {
@@ -115,7 +134,6 @@ var PhoneNumberInput = ({ value: propsValue, onChange, isVerification, disabled,
115
134
  value: countryCode,
116
135
  onChange: handleCountryChange,
117
136
  style: { width: "90px" },
118
- onBlur: handleBlur,
119
137
  popupMatchSelectWidth: false,
120
138
  optionLabelProp: "inputValue",
121
139
  optionFilterProp: "label",
@@ -131,7 +149,6 @@ var PhoneNumberInput = ({ value: propsValue, onChange, isVerification, disabled,
131
149
  {
132
150
  ...props,
133
151
  disabled,
134
- status,
135
152
  type: "tel",
136
153
  value: phoneNumber,
137
154
  onChange: handlePhoneNumberChange,
@@ -6,7 +6,8 @@ declare const SubdomainlWithMode: React.FC<InputProps & {
6
6
  rootDomain: 'xzero' | 'saas' | 'custom';
7
7
  customDomain?: string | undefined;
8
8
  value?: string | undefined;
9
- isVerification?: boolean | undefined;
10
9
  tenantId: string;
10
+ name?: string | undefined;
11
+ fieldKey?: string | undefined;
11
12
  } & import("../../dataSourceForm/utils").WithModeProps>;
12
13
  export default SubdomainlWithMode;
@@ -39,57 +39,79 @@ var import_ReadPretty = __toESM(require("./ReadPretty"));
39
39
  var import_utils = require("../../dataSourceForm/utils");
40
40
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
41
41
  var Subdomain = (props) => {
42
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
43
42
  const {
44
43
  onBlur: propsOnBlur,
45
44
  onChange: propsOnChange,
46
45
  rootDomain = "xzero",
47
- // 默认值为 'xzero'
48
46
  customDomain,
49
47
  value,
50
48
  tenantId,
49
+ fieldKey,
51
50
  ...rest
52
51
  } = props;
53
52
  const context = (0, import_useEngineContext.default)();
54
- const coreData = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = context.appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.data) == null ? void 0 : _d.store) == null ? void 0 : _e.getStore) == null ? void 0 : _f.call(_e)) == null ? void 0 : _g.getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
55
- const tenantData = rootDomain === "saas" ? (0, import_serve.useTenantData)(coreData ? (_i = coreData == null ? void 0 : coreData.tenant) == null ? void 0 : _i.id : "") : void 0;
56
- const parseExternalValue = (val) => {
53
+ const [subdomain, setSubdomain] = (0, import_react.useState)("");
54
+ const [suffix, setSuffix] = (0, import_react.useState)("");
55
+ const coreData = (0, import_react.useMemo)(() => {
56
+ var _a, _b, _c, _d, _e, _f, _g, _h;
57
+ return (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = context.appHelper.utils) == null ? void 0 : _a.getApp) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.data) == null ? void 0 : _d.store) == null ? void 0 : _e.getStore) == null ? void 0 : _f.call(_e)) == null ? void 0 : _g.getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
58
+ }, [context]);
59
+ const tenantData = (0, import_react.useMemo)(() => {
60
+ var _a;
61
+ if (rootDomain === "saas" && ((_a = coreData == null ? void 0 : coreData.tenant) == null ? void 0 : _a.id)) {
62
+ return (0, import_serve.useTenantData)(coreData.tenant.id);
63
+ }
64
+ return void 0;
65
+ }, [rootDomain, coreData]);
66
+ const parseExternalValue = (0, import_react.useCallback)((val) => {
57
67
  if (!val)
58
68
  return { subdomain: "", suffix: coreData ? coreData.tenant_domain : "" };
59
69
  const parts = val.split(".");
60
70
  const subdomain2 = parts.length > 1 ? parts[0] : val;
61
71
  const suffix2 = parts.length > 1 ? `.${parts.slice(1).join(".")}` : coreData ? coreData.tenant_domain : "";
62
- return {
63
- subdomain: subdomain2,
64
- suffix: suffix2
65
- };
66
- };
67
- const [subdomain, setSubdomain] = (0, import_react.useState)("");
68
- const [suffix, setSuffix] = (0, import_react.useState)("");
72
+ return { subdomain: subdomain2, suffix: suffix2 };
73
+ }, [coreData]);
69
74
  (0, import_react.useEffect)(() => {
70
- if (value) {
71
- const { subdomain: subdomain2, suffix: suffix2 } = parseExternalValue(value);
72
- setSubdomain(subdomain2);
73
- setSuffix(suffix2);
74
- } else {
75
- if (rootDomain === "xzero") {
76
- setSuffix(coreData ? `.${coreData.tenant_domain}` : "");
77
- } else if (rootDomain === "saas") {
78
- setSuffix(tenantData ? `.${tenantData["saas.domain"]}` : "");
75
+ try {
76
+ if (value) {
77
+ const { subdomain: newSubdomain, suffix: newSuffix } = parseExternalValue(value);
78
+ setSubdomain(newSubdomain);
79
+ setSuffix(newSuffix);
79
80
  } else {
80
- setSuffix(customDomain ? customDomain.startsWith(".") ? customDomain : `.${customDomain}` : "");
81
+ let newSuffix = "";
82
+ switch (rootDomain) {
83
+ case "xzero":
84
+ newSuffix = coreData ? `.${coreData.tenant_domain}` : "";
85
+ break;
86
+ case "saas":
87
+ newSuffix = tenantData ? `.${tenantData["saas.domain"]}` : "";
88
+ break;
89
+ default:
90
+ newSuffix = customDomain ? customDomain.startsWith(".") ? customDomain : `.${customDomain}` : "";
91
+ }
92
+ setSuffix(newSuffix);
81
93
  }
94
+ } catch (error) {
95
+ console.error("Error updating domain:", error);
96
+ }
97
+ }, [value, rootDomain, customDomain, tenantData, coreData, parseExternalValue]);
98
+ const handleChange = (0, import_react.useCallback)((e) => {
99
+ try {
100
+ const inputValue = e.target.value.toLowerCase();
101
+ const { subdomain: newSubdomain } = parseExternalValue(inputValue);
102
+ setSubdomain(newSubdomain);
103
+ propsOnChange == null ? void 0 : propsOnChange(newSubdomain + suffix);
104
+ } catch (error) {
105
+ console.error("Error handling change:", error);
82
106
  }
83
- }, [value, rootDomain, customDomain, tenantData, coreData]);
84
- const handleChange = (e) => {
85
- const inputValue = e.target.value.toLowerCase();
86
- const { subdomain: subdomain2 } = parseExternalValue(inputValue);
87
- setSubdomain(subdomain2);
88
- propsOnChange == null ? void 0 : propsOnChange(subdomain2 + suffix);
89
- };
107
+ }, [suffix, propsOnChange, parseExternalValue]);
90
108
  const onBlur = (0, import_react.useCallback)((e) => {
91
- propsOnBlur == null ? void 0 : propsOnBlur(e);
92
- propsOnChange(subdomain + suffix);
109
+ try {
110
+ propsOnBlur == null ? void 0 : propsOnBlur(e);
111
+ propsOnChange == null ? void 0 : propsOnChange(subdomain + suffix);
112
+ } catch (error) {
113
+ console.error("Error handling blur:", error);
114
+ }
93
115
  }, [propsOnBlur, propsOnChange, subdomain, suffix]);
94
116
  return /* @__PURE__ */ import_react.default.createElement(
95
117
  import_antd.Input,
@@ -5,7 +5,8 @@ declare const Subdomain: React.FC<import("antd").InputProps & {
5
5
  rootDomain: "custom" | "xzero" | "saas";
6
6
  customDomain?: string | undefined;
7
7
  value?: string | undefined;
8
- isVerification?: boolean | undefined;
9
8
  tenantId: string;
9
+ name?: string | undefined;
10
+ fieldKey?: string | undefined;
10
11
  } & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps>;
11
12
  export default Subdomain;
@@ -23,8 +23,9 @@ declare const formFieldMap: {
23
23
  rootDomain: "custom" | "xzero" | "saas";
24
24
  customDomain?: string | undefined;
25
25
  value?: string | undefined;
26
- isVerification?: boolean | undefined;
27
26
  tenantId: string;
27
+ name?: string | undefined;
28
+ fieldKey?: string | undefined;
28
29
  } & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
29
30
  };
30
31
  FormItemRadio: import("react").FC<{}> & {
@@ -80,8 +81,9 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
80
81
  rootDomain: "custom" | "xzero" | "saas";
81
82
  customDomain?: string | undefined;
82
83
  value?: string | undefined;
83
- isVerification?: boolean | undefined;
84
84
  tenantId: string;
85
+ name?: string | undefined;
86
+ fieldKey?: string | undefined;
85
87
  } & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
86
88
  }) | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
87
89
  Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
@@ -76,7 +76,7 @@ var Form = class extends import_react.Component {
76
76
  }
77
77
  };
78
78
  Form.Item = (props) => {
79
- const { name, rules: propsRules, requiredobj, typeobj, patternobj, lenobj, validator } = props;
79
+ const { name, rules: propsRules, requiredobj, typeobj, patternobj, subdomainobj, phoneobj, mobileobj, lenobj, validator } = props;
80
80
  const rules = (0, import_utils.isArr)(propsRules) ? propsRules : [];
81
81
  if (requiredobj && requiredobj.required) {
82
82
  rules.push(requiredobj);
@@ -87,6 +87,15 @@ Form.Item = (props) => {
87
87
  if (patternobj && patternobj.pattern) {
88
88
  rules.push(patternobj);
89
89
  }
90
+ if (subdomainobj && subdomainobj.subdomain) {
91
+ rules.push(subdomainobj);
92
+ }
93
+ if (phoneobj && phoneobj.phone) {
94
+ rules.push(phoneobj);
95
+ }
96
+ if (mobileobj && mobileobj.mobile) {
97
+ rules.push(mobileobj);
98
+ }
90
99
  if (lenobj && (lenobj.max || lenobj.min)) {
91
100
  rules.push(lenobj);
92
101
  }
@@ -143,6 +143,8 @@ declare const _default: {
143
143
  'pisell-data-source-form-max-length-message': (maxLength: number) => string;
144
144
  'pisell-data-source-form-min-value-message': (minValue: number) => string;
145
145
  'pisell-data-source-form-max-value-message': (maxValue: number) => string;
146
+ 'pisell-data-source-form-mobile-message': string;
147
+ 'pisell-data-source-form-pattern-message': string;
146
148
  'pisell-number-format-thousand': string;
147
149
  'pisell-number-format-million': string;
148
150
  'pisell-number-format-billion': string;
@@ -194,5 +196,12 @@ declare const _default: {
194
196
  'pisell-icon-select-iconfont': string;
195
197
  'pisell-icon-select-search': string;
196
198
  'pisell-icon-select-select': string;
199
+ 'subdomain-error-too-short': string;
200
+ 'subdomain-error-too-long': string;
201
+ 'subdomain-error-pattern': string;
202
+ 'subdomain-error-numbers-only': string;
203
+ 'subdomain-error-hyphen-ends': string;
204
+ 'subdomain-error-consecutive-hyphens': string;
205
+ 'subdomain-error-required': string;
197
206
  };
198
207
  export default _default;
@@ -178,6 +178,8 @@ var en_US_default = {
178
178
  "pisell-data-source-form-max-length-message": (maxLength) => `Length must be at most ${maxLength} character`,
179
179
  "pisell-data-source-form-min-value-message": (minValue) => `Value must be greater than or equal to ${minValue}`,
180
180
  "pisell-data-source-form-max-value-message": (maxValue) => `Value must be less than or equal to ${maxValue}`,
181
+ "pisell-data-source-form-mobile-message": "Please enter a valid mobile number",
182
+ "pisell-data-source-form-pattern-message": "Please enter the correct format",
181
183
  // Number formatting
182
184
  "pisell-number-format-thousand": "K",
183
185
  "pisell-number-format-million": "M",
@@ -234,5 +236,13 @@ var en_US_default = {
234
236
  "pisell-icon-select-two-tone": "Two-tone",
235
237
  "pisell-icon-select-iconfont": "Iconfont",
236
238
  "pisell-icon-select-search": "Search icon",
237
- "pisell-icon-select-select": "Select icon"
239
+ "pisell-icon-select-select": "Select icon",
240
+ // 子域名校验错误
241
+ "subdomain-error-too-short": "Subdomain must be at least 2 characters long",
242
+ "subdomain-error-too-long": "Subdomain cannot exceed 60 characters",
243
+ "subdomain-error-pattern": "Subdomain can only contain lowercase letters, numbers and hyphens",
244
+ "subdomain-error-numbers-only": "Subdomain cannot contain only numbers",
245
+ "subdomain-error-hyphen-ends": "Subdomain cannot start or end with a hyphen",
246
+ "subdomain-error-consecutive-hyphens": "Subdomain cannot contain consecutive hyphens",
247
+ "subdomain-error-required": "Please enter subdomain"
238
248
  };
@@ -143,6 +143,8 @@ declare const _default: {
143
143
  'pisell-data-source-form-max-length-message': (maxLength: number) => string;
144
144
  'pisell-data-source-form-min-value-message': (minValue: number) => string;
145
145
  'pisell-data-source-form-max-value-message': (maxValue: number) => string;
146
+ 'pisell-data-source-form-mobile-message': string;
147
+ 'pisell-data-source-form-pattern-message': string;
146
148
  'pisell-number-format-thousand': string;
147
149
  'pisell-number-format-million': string;
148
150
  'pisell-number-format-billion': string;
@@ -194,5 +196,11 @@ declare const _default: {
194
196
  'pisell-icon-select-iconfont': string;
195
197
  'pisell-icon-select-search': string;
196
198
  'pisell-icon-select-select': string;
199
+ 'subdomain-error-too-short': string;
200
+ 'subdomain-error-too-long': string;
201
+ 'subdomain-error-pattern': string;
202
+ 'subdomain-error-numbers-only': string;
203
+ 'subdomain-error-hyphen-ends': string;
204
+ 'subdomain-error-consecutive-hyphens': string;
197
205
  };
198
206
  export default _default;
@@ -172,11 +172,13 @@ var zh_CN_default = {
172
172
  "pisell-data-source-form-email-message": "请输入有效的电子邮件地址",
173
173
  "pisell-data-source-form-domain-message": "请输入有效的域名",
174
174
  "pisell-data-source-form-url-message": "请输入正确的网址",
175
- "pisell-data-source-form-phone-message": "请输入有效的电话号码",
175
+ "pisell-data-source-form-phone-message": "请输入正确的电话号码",
176
176
  "pisell-data-source-form-min-length-message": (minLength) => `长度必须至少为${minLength}个字符`,
177
177
  "pisell-data-source-form-max-length-message": (maxLength) => `长度必须最多为${maxLength}个字符`,
178
178
  "pisell-data-source-form-min-value-message": (minValue) => `值必须大于或等于${minValue}`,
179
179
  "pisell-data-source-form-max-value-message": (maxValue) => `值必须小于或等于${maxValue}`,
180
+ "pisell-data-source-form-mobile-message": "请输入正确的手机号",
181
+ "pisell-data-source-form-pattern-message": "请输入正确的格式",
180
182
  // 数字格式化
181
183
  "pisell-number-format-thousand": "千",
182
184
  "pisell-number-format-million": "百万",
@@ -233,5 +235,12 @@ var zh_CN_default = {
233
235
  "pisell-icon-select-two-tone": "双色风格",
234
236
  "pisell-icon-select-iconfont": "Iconfont",
235
237
  "pisell-icon-select-search": "搜索图标",
236
- "pisell-icon-select-select": "选择图标"
238
+ "pisell-icon-select-select": "选择图标",
239
+ // 子域名校验错误
240
+ "subdomain-error-too-short": "子域名长度不能小于2个字符",
241
+ "subdomain-error-too-long": "子域名长度不能超过60个字符",
242
+ "subdomain-error-pattern": "子域名只能包含小写字母、数字和连字符",
243
+ "subdomain-error-numbers-only": "子域名不能全为数字",
244
+ "subdomain-error-hyphen-ends": "子域名不能以连字符开头或结尾",
245
+ "subdomain-error-consecutive-hyphens": "子域名不能包含连续的连字符"
237
246
  };
@@ -143,6 +143,7 @@ declare const _default: {
143
143
  'pisell-data-source-form-max-length-message': (maxLength: number) => string;
144
144
  'pisell-data-source-form-min-value-message': (minValue: number) => string;
145
145
  'pisell-data-source-form-max-value-message': (maxValue: number) => string;
146
+ 'pisell-data-source-form-mobile-message': string;
146
147
  'pisell-number-format-thousand': string;
147
148
  'pisell-number-format-million': string;
148
149
  'pisell-number-format-billion': string;
@@ -194,5 +195,11 @@ declare const _default: {
194
195
  'pisell-icon-select-iconfont': string;
195
196
  'pisell-icon-select-search': string;
196
197
  'pisell-icon-select-select': string;
198
+ 'subdomain-error-too-short': string;
199
+ 'subdomain-error-too-long': string;
200
+ 'subdomain-error-pattern': string;
201
+ 'subdomain-error-numbers-only': string;
202
+ 'subdomain-error-hyphen-ends': string;
203
+ 'subdomain-error-consecutive-hyphens': string;
197
204
  };
198
205
  export default _default;
@@ -178,6 +178,7 @@ var zh_TW_default = {
178
178
  "pisell-data-source-form-max-length-message": (maxLength) => `長度必須最多為${maxLength}个字符`,
179
179
  "pisell-data-source-form-min-value-message": (minValue) => `值必須大於或等於${minValue}`,
180
180
  "pisell-data-source-form-max-value-message": (maxValue) => `值必須小於或等於${maxValue}`,
181
+ "pisell-data-source-form-mobile-message": "請輸入正確的手機號",
181
182
  // 數字格式化
182
183
  "pisell-number-format-thousand": "千",
183
184
  "pisell-number-format-million": "百萬",
@@ -234,5 +235,12 @@ var zh_TW_default = {
234
235
  "pisell-icon-select-two-tone": "雙色風格",
235
236
  "pisell-icon-select-iconfont": "Iconfont",
236
237
  "pisell-icon-select-search": "搜索圖標",
237
- "pisell-icon-select-select": "選擇圖標"
238
+ "pisell-icon-select-select": "選擇圖標",
239
+ // 子域名校验错误
240
+ "subdomain-error-too-short": "子域名長度不能小於2個字符",
241
+ "subdomain-error-too-long": "子域名長度不能超過60個字符",
242
+ "subdomain-error-pattern": "子域名只能包含小寫字母、數字和連字符",
243
+ "subdomain-error-numbers-only": "子域名不能全為數字",
244
+ "subdomain-error-hyphen-ends": "子域名不能以連字符開頭或結尾",
245
+ "subdomain-error-consecutive-hyphens": "子域名不能包含連續的連字符"
238
246
  };
@@ -462,6 +462,9 @@ export const generalItemMap = {
462
462
  { title: '网址', value: 'url' },
463
463
  { title: '域名', value: 'domain' },
464
464
  { title: '正则', value: 'pattern' },
465
+ { title: '手机号', value: 'mobile' },
466
+ { title: '电话号码', value: 'phone' },
467
+ { title: '子域名', value: 'subdomain' },
465
468
  ],
466
469
  },
467
470
  },
@@ -477,6 +480,7 @@ export const generalItemMap = {
477
480
  condition: (target: any) => {
478
481
  return target.parent.getPropValue('type') === 'pattern';
479
482
  },
483
+ isRequired: true,
480
484
  },
481
485
  {
482
486
  name: 'message',
@@ -487,6 +491,9 @@ export const generalItemMap = {
487
491
  },
488
492
  propType: 'string',
489
493
  setter: 'PisellI18nSetter',
494
+ condition: (target: any) => {
495
+ return !(['mobile','phone','subdomain'].includes(target.parent.getPropValue('type')));
496
+ },
490
497
  },
491
498
  ],
492
499
  },
@@ -1319,6 +1326,9 @@ export const formItemGeneralProps = [
1319
1326
  { title: '网址', value: 'url' },
1320
1327
  { title: '域名', value: 'domain' },
1321
1328
  { title: '正则', value: 'pattern' },
1329
+ { title: '手机号', value: 'mobile' },
1330
+ { title: '电话号码', value: 'phone' },
1331
+ { title: '子域名', value: 'subdomain' },
1322
1332
  ],
1323
1333
  },
1324
1334
  },
@@ -1334,6 +1344,7 @@ export const formItemGeneralProps = [
1334
1344
  condition: (target: any) => {
1335
1345
  return target.parent.getPropValue('type') === 'pattern';
1336
1346
  },
1347
+ isRequired: true,
1337
1348
  },
1338
1349
  {
1339
1350
  name: 'message',