@pisell/materials 6.0.11 → 6.0.13

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 (207) hide show
  1. package/build/lowcode/assets-daily.json +11 -15
  2. package/build/lowcode/assets-dev.json +2 -6
  3. package/build/lowcode/assets-prod.json +11 -15
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +7 -7
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +18 -18
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -18
  11. package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +94 -3
  12. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +7 -6
  13. package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +8 -0
  14. package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
  15. package/es/components/dataSourceComponents/dataSourceForm/utils.js +117 -38
  16. package/es/components/dataSourceComponents/dataSourceMenu/index.d.ts +2 -0
  17. package/es/components/dataSourceComponents/dataSourceMenu/index.js +19 -0
  18. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +46 -8
  19. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
  20. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +0 -1
  21. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +90 -35
  22. package/es/components/dataSourceComponents/fields/Input.Mobile/index.js +11 -1
  23. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +0 -1
  24. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +73 -19
  25. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +4 -2
  26. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +163 -52
  27. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +4 -2
  28. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.js +2 -2
  29. package/es/components/dataSourceComponents/fields/Input.Subdomain/serve.d.ts +3 -13
  30. package/es/components/dataSourceComponents/fields/Input.Subdomain/serve.js +15 -13
  31. package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.js +15 -4
  32. package/es/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
  33. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +17 -13
  34. package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
  35. package/es/components/dataSourceComponents/fields/Upload/ReadPretty.js +4 -2
  36. package/es/components/dataSourceComponents/fields/Upload/WithMode.js +5 -4
  37. package/es/components/dataSourceComponents/fields/Upload/index.less +1 -1
  38. package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +1 -1
  39. package/es/components/dataSourceComponents/fields/Upload/serve.js +5 -5
  40. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +8 -0
  41. package/es/components/dataSourceComponents/fields/index.d.ts +8 -4
  42. package/es/components/dataSourceComponents/fields/type.d.ts +1 -0
  43. package/es/components/dataSourceComponents/fields/utils.js +1 -0
  44. package/es/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
  45. package/es/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
  46. package/es/components/dataSourceComponents/provider/actions/ActionsProvider.js +0 -1
  47. package/es/components/form/index.js +12 -0
  48. package/es/components/iconfont/index.js +1 -1
  49. package/es/components/pisellDraggable/components/Action/Action.d.ts +10 -0
  50. package/es/components/pisellDraggable/components/Action/Action.js +31 -0
  51. package/es/components/pisellDraggable/components/Action/Action.less +50 -0
  52. package/es/components/pisellDraggable/components/Action/index.d.ts +2 -0
  53. package/es/components/pisellDraggable/components/Action/index.js +1 -0
  54. package/es/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
  55. package/es/components/pisellDraggable/components/Handle/Handle.js +15 -0
  56. package/es/components/pisellDraggable/components/Handle/index.d.ts +1 -0
  57. package/es/components/pisellDraggable/components/Handle/index.js +1 -0
  58. package/es/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
  59. package/es/components/pisellDraggable/components/Remove/Remove.js +17 -0
  60. package/es/components/pisellDraggable/components/Remove/index.d.ts +1 -0
  61. package/es/components/pisellDraggable/components/Remove/index.js +1 -0
  62. package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
  63. package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +51 -0
  64. package/es/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
  65. package/es/components/pisellDraggable/components/TreeItem/TreeItem.js +57 -0
  66. package/es/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
  67. package/es/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
  68. package/es/components/pisellDraggable/components/TreeItem/index.js +2 -0
  69. package/es/components/pisellDraggable/components/index.d.ts +4 -0
  70. package/es/components/pisellDraggable/components/index.js +4 -0
  71. package/es/components/pisellDraggable/index.d.ts +27 -0
  72. package/es/components/pisellDraggable/index.js +380 -0
  73. package/es/components/pisellDraggable/types.d.ts +17 -0
  74. package/es/components/pisellDraggable/types.js +1 -0
  75. package/es/components/pisellDraggable/utilities.d.ts +17 -0
  76. package/es/components/pisellDraggable/utilities.js +230 -0
  77. package/es/components/pisellLayout/content.d.ts +1 -0
  78. package/es/components/pisellLayout/content.js +19 -2
  79. package/es/components/pisellMenu/PisellMenu.d.ts +5 -0
  80. package/es/components/pisellMenu/PisellMenu.js +55 -0
  81. package/es/components/pisellMenu/PisellMenu.less +53 -0
  82. package/es/components/pisellMenu/index.d.ts +3 -0
  83. package/es/components/pisellMenu/index.js +2 -0
  84. package/es/components/pisellMenu/types.d.ts +30 -0
  85. package/es/components/pisellMenu/types.js +1 -0
  86. package/es/components/pisellModal/components/functions/index.less +3 -0
  87. package/es/components/versionModal/index.d.ts +15 -0
  88. package/es/components/versionModal/index.js +192 -0
  89. package/es/components/versionModal/index.less +3 -0
  90. package/es/index.d.ts +5 -0
  91. package/es/index.js +5 -1
  92. package/es/locales/en-US.d.ts +22 -0
  93. package/es/locales/en-US.js +24 -1
  94. package/es/locales/zh-CN.d.ts +21 -0
  95. package/es/locales/zh-CN.js +24 -2
  96. package/es/locales/zh-TW.d.ts +20 -0
  97. package/es/locales/zh-TW.js +23 -2
  98. package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +77 -4
  99. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +1 -0
  100. package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +8 -0
  101. package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
  102. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +132 -41
  103. package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +2 -0
  104. package/lib/components/dataSourceComponents/dataSourceMenu/index.js +45 -0
  105. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +14 -2
  106. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -2
  107. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +0 -1
  108. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +44 -29
  109. package/lib/components/dataSourceComponents/fields/Input.Mobile/index.js +11 -1
  110. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +0 -1
  111. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +34 -17
  112. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +4 -2
  113. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +96 -36
  114. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +4 -2
  115. package/lib/components/dataSourceComponents/fields/Input.Subdomain/serve.d.ts +3 -13
  116. package/lib/components/dataSourceComponents/fields/Input.Subdomain/serve.js +19 -14
  117. package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.js +15 -4
  118. package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
  119. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +5 -3
  120. package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
  121. package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.js +2 -2
  122. package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +4 -4
  123. package/lib/components/dataSourceComponents/fields/Upload/index.less +1 -1
  124. package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +1 -1
  125. package/lib/components/dataSourceComponents/fields/Upload/serve.js +5 -5
  126. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +8 -0
  127. package/lib/components/dataSourceComponents/fields/index.d.ts +8 -4
  128. package/lib/components/dataSourceComponents/fields/type.d.ts +1 -0
  129. package/lib/components/dataSourceComponents/fields/utils.js +1 -0
  130. package/lib/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
  131. package/lib/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
  132. package/lib/components/form/index.js +10 -1
  133. package/lib/components/iconfont/index.js +1 -1
  134. package/lib/components/pisellDraggable/components/Action/Action.d.ts +10 -0
  135. package/lib/components/pisellDraggable/components/Action/Action.js +60 -0
  136. package/lib/components/pisellDraggable/components/Action/Action.less +50 -0
  137. package/lib/components/pisellDraggable/components/Action/index.d.ts +2 -0
  138. package/lib/components/pisellDraggable/components/Action/index.js +29 -0
  139. package/lib/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
  140. package/lib/components/pisellDraggable/components/Handle/Handle.js +54 -0
  141. package/lib/components/pisellDraggable/components/Handle/index.d.ts +1 -0
  142. package/lib/components/pisellDraggable/components/Handle/index.js +29 -0
  143. package/lib/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
  144. package/lib/components/pisellDraggable/components/Remove/Remove.js +53 -0
  145. package/lib/components/pisellDraggable/components/Remove/index.d.ts +1 -0
  146. package/lib/components/pisellDraggable/components/Remove/index.js +29 -0
  147. package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
  148. package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +83 -0
  149. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
  150. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.js +93 -0
  151. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
  152. package/lib/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
  153. package/lib/components/pisellDraggable/components/TreeItem/index.js +32 -0
  154. package/lib/components/pisellDraggable/components/index.d.ts +4 -0
  155. package/lib/components/pisellDraggable/components/index.js +40 -0
  156. package/lib/components/pisellDraggable/index.d.ts +27 -0
  157. package/lib/components/pisellDraggable/index.js +271 -0
  158. package/lib/components/pisellDraggable/types.d.ts +17 -0
  159. package/lib/components/pisellDraggable/types.js +17 -0
  160. package/lib/components/pisellDraggable/utilities.d.ts +17 -0
  161. package/lib/components/pisellDraggable/utilities.js +190 -0
  162. package/lib/components/pisellLayout/content.d.ts +1 -0
  163. package/lib/components/pisellLayout/content.js +9 -1
  164. package/lib/components/pisellMenu/PisellMenu.d.ts +5 -0
  165. package/lib/components/pisellMenu/PisellMenu.js +91 -0
  166. package/lib/components/pisellMenu/PisellMenu.less +53 -0
  167. package/lib/components/pisellMenu/index.d.ts +3 -0
  168. package/lib/components/pisellMenu/index.js +36 -0
  169. package/lib/components/pisellMenu/types.d.ts +30 -0
  170. package/lib/components/pisellMenu/types.js +17 -0
  171. package/lib/components/pisellModal/components/functions/index.less +3 -0
  172. package/lib/components/versionModal/index.d.ts +15 -0
  173. package/lib/components/versionModal/index.js +219 -0
  174. package/lib/components/versionModal/index.less +3 -0
  175. package/lib/index.d.ts +5 -0
  176. package/lib/index.js +12 -0
  177. package/lib/locales/en-US.d.ts +22 -0
  178. package/lib/locales/en-US.js +24 -1
  179. package/lib/locales/zh-CN.d.ts +21 -0
  180. package/lib/locales/zh-CN.js +24 -2
  181. package/lib/locales/zh-TW.d.ts +20 -0
  182. package/lib/locales/zh-TW.js +23 -2
  183. package/lowcode/_utils/defaultSchema.ts +23 -2
  184. package/lowcode/button/meta.ts +4 -20
  185. package/lowcode/data-source-form/meta.ts +138 -1
  186. package/lowcode/data-source-form/snippets.ts +54 -0
  187. package/lowcode/data-source-menu/meta.ts +122 -0
  188. package/lowcode/data-source-table/meta.ts +32 -27
  189. package/lowcode/data-source-table/utils.tsx +33 -1
  190. package/lowcode/data-source-wrapper/meta.ts +6 -2
  191. package/lowcode/form-group/meta.ts +5 -1
  192. package/lowcode/form-item-input.mobile/__screenshots__/mobile.png +0 -0
  193. package/lowcode/form-item-input.mobile/meta.ts +36 -46
  194. package/lowcode/form-item-input.mobile/snippets.ts +8 -2
  195. package/lowcode/form-item-input.phone/meta.ts +8 -42
  196. package/lowcode/form-item-input.phone/snippets.ts +6 -0
  197. package/lowcode/form-item-input.subdomain/__screenshots__/subdomain.png +0 -0
  198. package/lowcode/form-item-input.subdomain/meta.ts +20 -6
  199. package/lowcode/form-item-input.subdomain/snippets.ts +10 -11
  200. package/lowcode/form-item-translation/meta.ts +59 -1
  201. package/lowcode/form.item/meta.ts +48 -0
  202. package/lowcode/pisell-content/meta.ts +12 -9
  203. package/lowcode/pisell-draggable/meta.ts +190 -0
  204. package/lowcode/pisell-layout/meta.ts +9 -9
  205. package/lowcode/pisell-menu/meta.ts +112 -0
  206. package/package.json +2 -2
  207. package/lowcode/form-item-input.mobile/__screenshots__/phone.png +0 -0
@@ -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)(() => {
@@ -74,16 +74,54 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
74
74
  () => parseExternalValue(value).phoneNumber
75
75
  );
76
76
  (0, import_react.useEffect)(() => {
77
- const { countryCode: newCountryCode, phoneNumber: newPhoneNumber } = parseExternalValue(value);
78
- setCountryCode(newCountryCode);
79
- setPhoneNumber(newPhoneNumber);
77
+ if (value) {
78
+ const { countryCode: newCountryCode, phoneNumber: newPhoneNumber } = parseExternalValue(value);
79
+ setCountryCode(newCountryCode);
80
+ setPhoneNumber(newPhoneNumber);
81
+ } else {
82
+ setPhoneNumber("");
83
+ }
80
84
  }, [value, countries]);
81
85
  const handleCountryChange = (value2) => {
82
86
  setCountryCode(value2);
87
+ const selectedCountry = countries.find(
88
+ (c) => c.code === value2
89
+ );
90
+ const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
91
+ const newValue = `${prefix}${phoneNumber}`;
92
+ onChange == null ? void 0 : onChange(newValue);
93
+ setTimeout(() => {
94
+ const formInstance = props.form;
95
+ const fieldName = props.fieldKey;
96
+ if (formInstance && fieldName) {
97
+ formInstance.validateFields([fieldName]);
98
+ }
99
+ });
83
100
  };
84
101
  const handlePhoneNumberChange = (e) => {
85
102
  const cleanNumber = e.target.value.replace(/\D/g, "");
86
103
  setPhoneNumber(cleanNumber);
104
+ const selectedCountry = countries.find(
105
+ (c) => c.code === countryCode
106
+ );
107
+ const prefix = (selectedCountry == null ? void 0 : selectedCountry.prefix) || "";
108
+ const newValue = cleanNumber ? `${prefix}${cleanNumber}` : "";
109
+ onChange == null ? void 0 : onChange(newValue);
110
+ if (!cleanNumber) {
111
+ const formInstance = props.form;
112
+ const fieldName = props.fieldKey;
113
+ if (formInstance && fieldName) {
114
+ formInstance.setFields([
115
+ {
116
+ name: fieldName,
117
+ errors: [],
118
+ // 清除错误信息
119
+ validating: false
120
+ // 停止验证状态
121
+ }
122
+ ]);
123
+ }
124
+ }
87
125
  };
88
126
  const concatenatedNumber = (0, import_react.useMemo)(() => {
89
127
  const selectedCountry = countries.find(
@@ -96,30 +134,9 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
96
134
  return `${prefix}${phoneNumber}`;
97
135
  }, [countryCode, phoneNumber, countries]);
98
136
  const handleBlur = () => {
99
- onChange == null ? void 0 : onChange(concatenatedNumber);
137
+ const finalValue = concatenatedNumber;
138
+ onChange == null ? void 0 : onChange(finalValue);
100
139
  };
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
140
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(
124
141
  import_select.default,
125
142
  {
@@ -127,7 +144,6 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
127
144
  value: countryCode,
128
145
  onChange: handleCountryChange,
129
146
  style: { width: "90px" },
130
- onBlur: handleBlur,
131
147
  popupMatchSelectWidth: false,
132
148
  optionLabelProp: "inputValue",
133
149
  optionFilterProp: "label",
@@ -143,7 +159,6 @@ var MobileNumberInput = ({ value: propsValue, onChange, isVerification, disabled
143
159
  {
144
160
  ...props,
145
161
  disabled,
146
- status,
147
162
  type: "tel",
148
163
  value: phoneNumber,
149
164
  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,
@@ -3,9 +3,11 @@ import { InputProps } from 'antd';
3
3
  declare const SubdomainlWithMode: React.FC<InputProps & {
4
4
  onChange: (value: string) => void;
5
5
  onBlur?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
6
- rootDomain: string;
6
+ rootDomain: 'xzero' | 'saas' | 'custom';
7
7
  customDomain?: string | undefined;
8
8
  value?: string | undefined;
9
- isVerification?: boolean | undefined;
9
+ tenantId: string;
10
+ name?: string | undefined;
11
+ fieldKey?: string | undefined;
10
12
  } & import("../../dataSourceForm/utils").WithModeProps>;
11
13
  export default SubdomainlWithMode;
@@ -37,61 +37,121 @@ var import_antd = require("antd");
37
37
  var import_serve = require("./serve");
38
38
  var import_ReadPretty = __toESM(require("./ReadPretty"));
39
39
  var import_utils = require("../../dataSourceForm/utils");
40
+ var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
40
41
  var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
41
42
  var Subdomain = (props) => {
42
- var _a, _b, _c, _d, _e, _f, _g, _h;
43
+ var _a;
43
44
  const {
44
45
  onBlur: propsOnBlur,
45
46
  onChange: propsOnChange,
46
- rootDomain = "",
47
+ rootDomain = "xzero",
47
48
  customDomain,
48
49
  value,
50
+ tenantId,
51
+ fieldKey,
49
52
  ...rest
50
53
  } = props;
54
+ const { __designMode } = (0, import_useDataSource.default)();
51
55
  const context = (0, import_useEngineContext.default)();
52
- 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");
53
- const tenantData = (0, import_serve.useTenantData)();
54
- const parseExternalValue = (val) => {
55
- if (!val)
56
- return { subdomain: "", suffix: coreData ? coreData.tenant_domain : "" };
57
- const parts = val.split(".");
58
- const subdomain2 = parts.length > 1 ? parts[0] : val;
59
- const suffix2 = parts.length > 1 ? `.${parts.slice(1).join(".")}` : coreData ? coreData.tenant_domain : "";
60
- return {
61
- subdomain: subdomain2,
62
- suffix: suffix2
63
- };
64
- };
65
56
  const [subdomain, setSubdomain] = (0, import_react.useState)("");
66
57
  const [suffix, setSuffix] = (0, import_react.useState)("");
58
+ const coreData = (0, import_react.useMemo)(() => {
59
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
60
+ return (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a2 = context.appHelper.utils) == null ? void 0 : _a2.getApp) == null ? void 0 : _b.call(_a2)) == 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");
61
+ }, [context]);
62
+ const tenantData = (0, import_serve.useTenantData)(rootDomain, (_a = coreData == null ? void 0 : coreData.tenant) == null ? void 0 : _a.id);
63
+ const parseExternalValue = (val) => {
64
+ if (!val || !val.trim() || val.trim() === ".") {
65
+ return {
66
+ subdomain: "",
67
+ suffix: suffixEmpty()
68
+ };
69
+ }
70
+ try {
71
+ const normalizedVal = val.replace(/\.+/g, ".");
72
+ const parts = normalizedVal.split(".");
73
+ if (parts[0] === "" && parts.length > 1) {
74
+ return {
75
+ subdomain: "",
76
+ suffix: `.${parts.slice(1).join(".")}`
77
+ };
78
+ }
79
+ if (parts.length === 1) {
80
+ return {
81
+ subdomain: parts[0].trim(),
82
+ suffix: suffixEmpty()
83
+ };
84
+ }
85
+ return {
86
+ subdomain: parts[0].trim(),
87
+ suffix: `.${parts.slice(1).join(".")}`
88
+ };
89
+ } catch (error) {
90
+ console.error("Error parsing value:", error);
91
+ return {
92
+ subdomain: "",
93
+ suffix: suffixEmpty()
94
+ };
95
+ }
96
+ };
67
97
  (0, import_react.useEffect)(() => {
68
- if (value) {
69
- const { subdomain: subdomain2, suffix: suffix2 } = parseExternalValue(value);
70
- setSubdomain(subdomain2);
71
- setSuffix(suffix2);
72
- } else {
73
- if (rootDomain === "1") {
74
- setSuffix(coreData ? `.${coreData.tenant_domain}` : "");
75
- } else if (rootDomain === "2") {
76
- const { default_domain = "" } = tenantData || {};
77
- const firstDotIndex = default_domain.indexOf(".");
78
- const result = `.${default_domain.slice(firstDotIndex + 1)}`;
79
- setSuffix(result);
98
+ try {
99
+ if (value) {
100
+ const { subdomain: newSubdomain, suffix: newSuffix } = parseExternalValue(value);
101
+ setSubdomain(newSubdomain);
102
+ setSuffix(newSuffix);
80
103
  } else {
81
- setSuffix(customDomain ? customDomain.startsWith(".") ? customDomain : `.${customDomain}` : "");
104
+ let newSuffix = "";
105
+ switch (rootDomain) {
106
+ case "xzero":
107
+ newSuffix = (coreData == null ? void 0 : coreData.tenant_domain) ? `.${coreData.tenant_domain}` : suffixEmpty();
108
+ break;
109
+ case "saas":
110
+ newSuffix = tenantData ? `.${tenantData["saas.domain"]}` : suffixEmpty();
111
+ break;
112
+ case "custom":
113
+ if (customDomain) {
114
+ const normalizedDomain = customDomain.replace(/\.+/g, ".");
115
+ newSuffix = normalizedDomain.startsWith(".") ? normalizedDomain : `.${normalizedDomain}`;
116
+ } else {
117
+ newSuffix = suffixEmpty();
118
+ }
119
+ break;
120
+ default:
121
+ newSuffix = suffixEmpty();
122
+ }
123
+ setSuffix(newSuffix);
82
124
  }
125
+ } catch (error) {
126
+ console.error("Error updating domain:", error);
127
+ setSuffix(suffixEmpty());
83
128
  }
84
129
  }, [value, rootDomain, customDomain, tenantData, coreData]);
85
- const handleChange = (e) => {
86
- const inputValue = e.target.value.toLowerCase();
87
- const { subdomain: subdomain2 } = parseExternalValue(inputValue);
88
- setSubdomain(subdomain2);
89
- propsOnChange == null ? void 0 : propsOnChange(subdomain2 + suffix);
90
- };
130
+ const handleChange = (0, import_react.useCallback)((e) => {
131
+ try {
132
+ const inputValue = e.target.value.toLowerCase();
133
+ const { subdomain: newSubdomain } = parseExternalValue(inputValue);
134
+ setSubdomain(newSubdomain);
135
+ propsOnChange == null ? void 0 : propsOnChange(newSubdomain ? newSubdomain + suffix : "");
136
+ } catch (error) {
137
+ console.error("Error handling change:", error);
138
+ }
139
+ }, [suffix, propsOnChange, parseExternalValue]);
91
140
  const onBlur = (0, import_react.useCallback)((e) => {
92
- propsOnBlur == null ? void 0 : propsOnBlur(e);
93
- propsOnChange(subdomain + suffix);
141
+ try {
142
+ propsOnBlur == null ? void 0 : propsOnBlur(e);
143
+ propsOnChange == null ? void 0 : propsOnChange(subdomain ? subdomain + suffix : "");
144
+ } catch (error) {
145
+ console.error("Error handling blur:", error);
146
+ }
94
147
  }, [propsOnBlur, propsOnChange, subdomain, suffix]);
148
+ const suffixEmpty = () => {
149
+ if (__designMode === "design") {
150
+ return ".root-domain.example";
151
+ } else {
152
+ return "error";
153
+ }
154
+ };
95
155
  return /* @__PURE__ */ import_react.default.createElement(
96
156
  import_antd.Input,
97
157
  {
@@ -2,9 +2,11 @@ import React from 'react';
2
2
  declare const Subdomain: React.FC<import("antd").InputProps & {
3
3
  onChange: (value: string) => void;
4
4
  onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
5
- rootDomain: string;
5
+ rootDomain: "custom" | "saas" | "xzero";
6
6
  customDomain?: string | undefined;
7
7
  value?: string | undefined;
8
- isVerification?: boolean | undefined;
8
+ tenantId: string;
9
+ name?: string | undefined;
10
+ fieldKey?: string | undefined;
9
11
  } & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps>;
10
12
  export default Subdomain;
@@ -1,21 +1,11 @@
1
1
  /**
2
2
  * 获取nocobase数据列表 获取域名后缀
3
3
  */
4
- export declare const getTenantData: () => Promise<TenantData>;
4
+ export declare const getTenantData: (id: string) => Promise<TenantData>;
5
5
  export interface TenantData {
6
- id: number;
7
- name: {
8
- en: string;
9
- "zh-CN": string;
10
- "zh-HK": string;
11
- original: string;
12
- };
13
- default_domain: string;
14
- created_at: string;
15
- locale: string;
16
- updated_at: string;
6
+ 'saas.domain': string;
17
7
  }
18
8
  /**
19
9
  * 自定义 Hook,用于获取租户数据
20
10
  */
21
- export declare const useTenantData: () => TenantData | undefined;
11
+ export declare const useTenantData: (rootDomain: string, tenantId?: string) => TenantData | undefined;
@@ -25,10 +25,10 @@ __export(serve_exports, {
25
25
  module.exports = __toCommonJS(serve_exports);
26
26
  var import_ahooks = require("ahooks");
27
27
  var import_utils = require("../../../table/utils");
28
- var getTenantData = async () => {
28
+ var getTenantData = async (id) => {
29
29
  try {
30
- const { data } = await import_utils.request.getRequest().get(`/tenant:get`, {}, {
31
- isNocobase: true,
30
+ const { data } = await import_utils.request.getRequest().get(`/tenant/core/meta/tenant/${id}/saas`, {}, {
31
+ isNocobase: false,
32
32
  fullResult: true,
33
33
  headers: {
34
34
  "x-data-source": "pisell2"
@@ -40,17 +40,22 @@ var getTenantData = async () => {
40
40
  throw error;
41
41
  }
42
42
  };
43
- var useTenantData = () => {
44
- const { data, error } = (0, import_ahooks.useRequest)(getTenantData, {
45
- cacheKey: "tenant-data",
46
- staleTime: 1e3 * 60 * 5,
47
- // 5分钟后数据过期
48
- cacheTime: 1e3 * 60 * 60
49
- // 1小时后清除缓存
50
- });
51
- if (error) {
52
- console.error("Error fetching tenant data:", error);
53
- }
43
+ var useTenantData = (rootDomain, tenantId) => {
44
+ const { data } = (0, import_ahooks.useRequest)(
45
+ () => {
46
+ if (rootDomain === "saas" && tenantId) {
47
+ return getTenantData(tenantId);
48
+ }
49
+ return Promise.resolve(void 0);
50
+ },
51
+ {
52
+ cacheKey: `tenant-data-${tenantId}`,
53
+ staleTime: 1e3 * 60 * 5,
54
+ // 5分钟后数据过期
55
+ cacheTime: 1e3 * 60 * 60
56
+ // 1小时后清除缓存
57
+ }
58
+ );
54
59
  return data;
55
60
  };
56
61
  // Annotate the CommonJS export names for ESM import in node:
@@ -53,9 +53,20 @@ var Translation = ({
53
53
  value = defaultValue,
54
54
  onChange,
55
55
  placeholder,
56
- disabled
56
+ disabled,
57
+ type = "text"
58
+ // 默认为普通文本输入
57
59
  }) => {
58
60
  const [open, setOpen] = (0, import_react.useState)(false);
61
+ const getInputComponent = (0, import_react.useCallback)(() => {
62
+ switch (type) {
63
+ case "textarea":
64
+ return import_antd.Input.TextArea;
65
+ default:
66
+ return import_antd.Input;
67
+ }
68
+ }, [type]);
69
+ const InputComponent = getInputComponent();
59
70
  const hasAnyTranslation = (0, import_react.useCallback)(() => {
60
71
  if (!value) {
61
72
  return false;
@@ -73,7 +84,7 @@ var Translation = ({
73
84
  [value, onChange]
74
85
  );
75
86
  const content = /* @__PURE__ */ import_react.default.createElement("div", { className: "translation-popover" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { direction: "vertical", style: { width: "100%" }, size: 16 }, languageConfig.map(({ key, label }) => /* @__PURE__ */ import_react.default.createElement("div", { key, className: "translation-field" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "translation-label" }, label), /* @__PURE__ */ import_react.default.createElement(
76
- import_antd.Input,
87
+ InputComponent,
77
88
  {
78
89
  value: (value == null ? void 0 : value[key]) || "",
79
90
  onChange: handleInputChange(key),
@@ -81,7 +92,7 @@ var Translation = ({
81
92
  }
82
93
  )))));
83
94
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "translation-wrapper" }, /* @__PURE__ */ import_react.default.createElement(
84
- import_antd.Input,
95
+ InputComponent,
85
96
  {
86
97
  value: (value == null ? void 0 : value.original) || "",
87
98
  onChange: handleInputChange("original"),
@@ -101,7 +112,7 @@ var Translation = ({
101
112
  }
102
113
  setOpen(open2);
103
114
  },
104
- placement: "bottomRight"
115
+ placement: "bottom"
105
116
  },
106
117
  /* @__PURE__ */ import_react.default.createElement(
107
118
  "div",
@@ -12,4 +12,5 @@ export interface TranslationProps {
12
12
  disabled?: boolean;
13
13
  placeholder?: string;
14
14
  className?: string;
15
+ type?: 'text' | 'textarea';
15
16
  }
@@ -63,6 +63,8 @@ var BaseUpload = (props) => {
63
63
  typeMaxSizeMap,
64
64
  enableMultilingual,
65
65
  onChange,
66
+ mediaUploadUrl: propsMediaUploadUrl,
67
+ getHeaders: propsGetHeaders,
66
68
  ...restProps
67
69
  } = props;
68
70
  const [fileList, setFileList] = (0, import_react.useState)([]);
@@ -78,7 +80,7 @@ var BaseUpload = (props) => {
78
80
  fileListRef.current = fileList;
79
81
  }, [fileList]);
80
82
  const { appHelper } = (0, import_useEngineContext.default)();
81
- const { mediaUploadUrl, getHeaders } = appHelper == null ? void 0 : appHelper.constants;
83
+ const { mediaUploadUrl, getHeaders } = (appHelper == null ? void 0 : appHelper.constants) || {};
82
84
  const handleImageError = (0, import_react.useCallback)((file) => {
83
85
  setErrorImageMap((prev) => ({
84
86
  ...prev,
@@ -482,7 +484,7 @@ var BaseUpload = (props) => {
482
484
  iconRender: () => /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "pisell2-a-BlueFile1" }),
483
485
  listType: "picture-card",
484
486
  onChange: handleChange,
485
- action: mediaUploadUrl,
487
+ action: propsMediaUploadUrl || mediaUploadUrl,
486
488
  method: "post",
487
489
  accept,
488
490
  name: "file",
@@ -494,7 +496,7 @@ var BaseUpload = (props) => {
494
496
  group_id: 0,
495
497
  ...(0, import_utils2.getFileMetadataParams)(file)
496
498
  }),
497
- headers: getHeaders == null ? void 0 : getHeaders(),
499
+ headers: (propsGetHeaders == null ? void 0 : propsGetHeaders()) || (getHeaders == null ? void 0 : getHeaders()),
498
500
  beforeUpload,
499
501
  className: "pisell-data-source-upload"
500
502
  // itemRender: (originNode: React.ReactElement, file: UploadFile) => {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { UploadProps } from './type';
3
3
  import './ReadPretty.less';
4
- declare const UploadReadPretty: (props: UploadProps) => React.JSX.Element[] | null;
4
+ declare const UploadReadPretty: (props: UploadProps) => React.JSX.Element | null;
5
5
  export default UploadReadPretty;
@@ -59,7 +59,7 @@ var UploadReadPretty = (props) => {
59
59
  if (!normalizedValue.length) {
60
60
  return null;
61
61
  }
62
- return normalizedValue.map((item, index) => /* @__PURE__ */ import_react.default.createElement(
62
+ return /* @__PURE__ */ import_react.default.createElement("div", null, normalizedValue.map((item, index) => /* @__PURE__ */ import_react.default.createElement(
63
63
  import_antd.Image,
64
64
  {
65
65
  key: `${String(item)}-${index}`,
@@ -72,6 +72,6 @@ var UploadReadPretty = (props) => {
72
72
  maskClassName: "pisell-upload-read-pretty-mask"
73
73
  }
74
74
  }
75
- ));
75
+ )));
76
76
  };
77
77
  var ReadPretty_default = UploadReadPretty;
@@ -39,11 +39,11 @@ var import_BaseUpload = __toESM(require("./BaseUpload"));
39
39
  var import_serve = require("./serve");
40
40
  var import_utils2 = require("@pisell/utils");
41
41
  var Upload = (props) => {
42
- const { presetType } = props;
42
+ const { presetType, mediaConfig: propsMediaConfig } = props;
43
43
  const { getExtensionsByIds, getMaxSizeByIds } = (0, import_serve.useMediaTypes)();
44
- const { data: mediaConfig } = (0, import_serve.useMediaConfig)();
45
- const presetTypeString = getExtensionsByIds(presetType);
46
- const maxSizeMap = getMaxSizeByIds(presetType);
44
+ const { data: mediaConfig } = (0, import_serve.useMediaConfig)(propsMediaConfig);
45
+ const presetTypeString = getExtensionsByIds(presetType || []);
46
+ const maxSizeMap = getMaxSizeByIds(presetType || []);
47
47
  const maxCount = (0, import_react.useMemo)(() => {
48
48
  const minArr = [];
49
49
  if ((0, import_utils2.isNumber)(mediaConfig == null ? void 0 : mediaConfig.upload_onetime_limit)) {
@@ -31,7 +31,7 @@
31
31
  .pisell-lowcode-upload-list-item-container {
32
32
  .pisell-lowcode-upload-list-item-action {
33
33
  &:hover {
34
- background: none;
34
+ background: none !important;
35
35
  }
36
36
  }
37
37
  }
@@ -7,7 +7,7 @@ export interface MediaType {
7
7
  name: string;
8
8
  maxsize: number;
9
9
  }
10
- export declare const useMediaConfig: () => {
10
+ export declare const useMediaConfig: (mediaConfig?: any) => {
11
11
  data: {
12
12
  upload_onetime_limit: any;
13
13
  upload_maxsize: any;