@pisell/materials 6.0.11 → 6.0.12

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 (216) 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 +22 -22
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +22 -22
  11. package/dist/umd/materials.min.css +1 -0
  12. package/dist/umd/materials.min.js +1 -0
  13. package/dist/umd/static/DotsSix.57d66266.svg +1 -0
  14. package/dist/umd/static/arrow-left.e542294f.svg +1 -0
  15. package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
  16. package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
  17. package/dist/umd/static/help-circle.31c9be40.svg +1 -0
  18. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
  19. package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +94 -3
  20. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +7 -6
  21. package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +8 -0
  22. package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
  23. package/es/components/dataSourceComponents/dataSourceForm/utils.js +120 -38
  24. package/es/components/dataSourceComponents/dataSourceMenu/index.d.ts +2 -0
  25. package/es/components/dataSourceComponents/dataSourceMenu/index.js +19 -0
  26. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +46 -8
  27. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
  28. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +0 -1
  29. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +90 -35
  30. package/es/components/dataSourceComponents/fields/Input.Mobile/index.js +11 -1
  31. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +0 -1
  32. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +73 -19
  33. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +4 -2
  34. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +161 -52
  35. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +4 -2
  36. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.js +2 -2
  37. package/es/components/dataSourceComponents/fields/Input.Subdomain/serve.d.ts +3 -13
  38. package/es/components/dataSourceComponents/fields/Input.Subdomain/serve.js +15 -13
  39. package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.js +15 -4
  40. package/es/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
  41. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +17 -13
  42. package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
  43. package/es/components/dataSourceComponents/fields/Upload/ReadPretty.js +4 -2
  44. package/es/components/dataSourceComponents/fields/Upload/WithMode.js +5 -4
  45. package/es/components/dataSourceComponents/fields/Upload/index.less +1 -1
  46. package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +1 -1
  47. package/es/components/dataSourceComponents/fields/Upload/serve.js +5 -5
  48. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +8 -0
  49. package/es/components/dataSourceComponents/fields/index.d.ts +9 -5
  50. package/es/components/dataSourceComponents/fields/type.d.ts +1 -0
  51. package/es/components/dataSourceComponents/fields/utils.js +1 -0
  52. package/es/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
  53. package/es/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
  54. package/es/components/dataSourceComponents/provider/actions/ActionsProvider.js +0 -1
  55. package/es/components/form/index.js +12 -0
  56. package/es/components/iconfont/index.js +1 -1
  57. package/es/components/pisellDraggable/components/Action/Action.d.ts +10 -0
  58. package/es/components/pisellDraggable/components/Action/Action.js +31 -0
  59. package/es/components/pisellDraggable/components/Action/Action.less +50 -0
  60. package/es/components/pisellDraggable/components/Action/index.d.ts +2 -0
  61. package/es/components/pisellDraggable/components/Action/index.js +1 -0
  62. package/es/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
  63. package/es/components/pisellDraggable/components/Handle/Handle.js +15 -0
  64. package/es/components/pisellDraggable/components/Handle/index.d.ts +1 -0
  65. package/es/components/pisellDraggable/components/Handle/index.js +1 -0
  66. package/es/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
  67. package/es/components/pisellDraggable/components/Remove/Remove.js +17 -0
  68. package/es/components/pisellDraggable/components/Remove/index.d.ts +1 -0
  69. package/es/components/pisellDraggable/components/Remove/index.js +1 -0
  70. package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
  71. package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +51 -0
  72. package/es/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
  73. package/es/components/pisellDraggable/components/TreeItem/TreeItem.js +57 -0
  74. package/es/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
  75. package/es/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
  76. package/es/components/pisellDraggable/components/TreeItem/index.js +2 -0
  77. package/es/components/pisellDraggable/components/index.d.ts +4 -0
  78. package/es/components/pisellDraggable/components/index.js +4 -0
  79. package/es/components/pisellDraggable/index.d.ts +27 -0
  80. package/es/components/pisellDraggable/index.js +380 -0
  81. package/es/components/pisellDraggable/types.d.ts +17 -0
  82. package/es/components/pisellDraggable/types.js +1 -0
  83. package/es/components/pisellDraggable/utilities.d.ts +17 -0
  84. package/es/components/pisellDraggable/utilities.js +230 -0
  85. package/es/components/pisellLayout/content.d.ts +1 -0
  86. package/es/components/pisellLayout/content.js +19 -2
  87. package/es/components/pisellMenu/PisellMenu.d.ts +5 -0
  88. package/es/components/pisellMenu/PisellMenu.js +55 -0
  89. package/es/components/pisellMenu/PisellMenu.less +53 -0
  90. package/es/components/pisellMenu/index.d.ts +3 -0
  91. package/es/components/pisellMenu/index.js +2 -0
  92. package/es/components/pisellMenu/types.d.ts +30 -0
  93. package/es/components/pisellMenu/types.js +1 -0
  94. package/es/components/pisellModal/components/functions/index.less +3 -0
  95. package/es/components/table/Table/utils.d.ts +1 -1
  96. package/es/components/versionModal/index.d.ts +15 -0
  97. package/es/components/versionModal/index.js +192 -0
  98. package/es/components/versionModal/index.less +3 -0
  99. package/es/index.d.ts +5 -0
  100. package/es/index.js +5 -1
  101. package/es/locales/en-US.d.ts +22 -0
  102. package/es/locales/en-US.js +24 -1
  103. package/es/locales/zh-CN.d.ts +21 -0
  104. package/es/locales/zh-CN.js +24 -2
  105. package/es/locales/zh-TW.d.ts +20 -0
  106. package/es/locales/zh-TW.js +23 -2
  107. package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +77 -4
  108. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +1 -0
  109. package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +8 -0
  110. package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
  111. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +138 -41
  112. package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +2 -0
  113. package/lib/components/dataSourceComponents/dataSourceMenu/index.js +45 -0
  114. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +14 -2
  115. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
  116. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +0 -1
  117. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +44 -29
  118. package/lib/components/dataSourceComponents/fields/Input.Mobile/index.js +11 -1
  119. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +0 -1
  120. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +34 -17
  121. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +4 -2
  122. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +96 -36
  123. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +4 -2
  124. package/lib/components/dataSourceComponents/fields/Input.Subdomain/serve.d.ts +3 -13
  125. package/lib/components/dataSourceComponents/fields/Input.Subdomain/serve.js +19 -14
  126. package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.js +15 -4
  127. package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
  128. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +5 -3
  129. package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
  130. package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.js +2 -2
  131. package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +4 -4
  132. package/lib/components/dataSourceComponents/fields/Upload/index.less +1 -1
  133. package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +1 -1
  134. package/lib/components/dataSourceComponents/fields/Upload/serve.js +5 -5
  135. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +8 -0
  136. package/lib/components/dataSourceComponents/fields/index.d.ts +9 -5
  137. package/lib/components/dataSourceComponents/fields/type.d.ts +1 -0
  138. package/lib/components/dataSourceComponents/fields/utils.js +1 -0
  139. package/lib/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
  140. package/lib/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
  141. package/lib/components/form/index.js +10 -1
  142. package/lib/components/iconfont/index.js +1 -1
  143. package/lib/components/pisellDraggable/components/Action/Action.d.ts +10 -0
  144. package/lib/components/pisellDraggable/components/Action/Action.js +60 -0
  145. package/lib/components/pisellDraggable/components/Action/Action.less +50 -0
  146. package/lib/components/pisellDraggable/components/Action/index.d.ts +2 -0
  147. package/lib/components/pisellDraggable/components/Action/index.js +29 -0
  148. package/lib/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
  149. package/lib/components/pisellDraggable/components/Handle/Handle.js +54 -0
  150. package/lib/components/pisellDraggable/components/Handle/index.d.ts +1 -0
  151. package/lib/components/pisellDraggable/components/Handle/index.js +29 -0
  152. package/lib/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
  153. package/lib/components/pisellDraggable/components/Remove/Remove.js +53 -0
  154. package/lib/components/pisellDraggable/components/Remove/index.d.ts +1 -0
  155. package/lib/components/pisellDraggable/components/Remove/index.js +29 -0
  156. package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
  157. package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +83 -0
  158. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
  159. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.js +93 -0
  160. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
  161. package/lib/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
  162. package/lib/components/pisellDraggable/components/TreeItem/index.js +32 -0
  163. package/lib/components/pisellDraggable/components/index.d.ts +4 -0
  164. package/lib/components/pisellDraggable/components/index.js +40 -0
  165. package/lib/components/pisellDraggable/index.d.ts +27 -0
  166. package/lib/components/pisellDraggable/index.js +271 -0
  167. package/lib/components/pisellDraggable/types.d.ts +17 -0
  168. package/lib/components/pisellDraggable/types.js +17 -0
  169. package/lib/components/pisellDraggable/utilities.d.ts +17 -0
  170. package/lib/components/pisellDraggable/utilities.js +190 -0
  171. package/lib/components/pisellLayout/content.d.ts +1 -0
  172. package/lib/components/pisellLayout/content.js +9 -1
  173. package/lib/components/pisellMenu/PisellMenu.d.ts +5 -0
  174. package/lib/components/pisellMenu/PisellMenu.js +91 -0
  175. package/lib/components/pisellMenu/PisellMenu.less +53 -0
  176. package/lib/components/pisellMenu/index.d.ts +3 -0
  177. package/lib/components/pisellMenu/index.js +36 -0
  178. package/lib/components/pisellMenu/types.d.ts +30 -0
  179. package/lib/components/pisellMenu/types.js +17 -0
  180. package/lib/components/pisellModal/components/functions/index.less +3 -0
  181. package/lib/components/table/Table/utils.d.ts +1 -1
  182. package/lib/components/versionModal/index.d.ts +15 -0
  183. package/lib/components/versionModal/index.js +219 -0
  184. package/lib/components/versionModal/index.less +3 -0
  185. package/lib/index.d.ts +5 -0
  186. package/lib/index.js +12 -0
  187. package/lib/locales/en-US.d.ts +22 -0
  188. package/lib/locales/en-US.js +24 -1
  189. package/lib/locales/zh-CN.d.ts +21 -0
  190. package/lib/locales/zh-CN.js +24 -2
  191. package/lib/locales/zh-TW.d.ts +20 -0
  192. package/lib/locales/zh-TW.js +23 -2
  193. package/lowcode/_utils/defaultSchema.ts +23 -2
  194. package/lowcode/button/meta.ts +4 -20
  195. package/lowcode/data-source-form/meta.ts +138 -1
  196. package/lowcode/data-source-form/snippets.ts +54 -0
  197. package/lowcode/data-source-menu/meta.ts +122 -0
  198. package/lowcode/data-source-table/meta.ts +32 -27
  199. package/lowcode/data-source-table/utils.tsx +33 -1
  200. package/lowcode/data-source-wrapper/meta.ts +6 -2
  201. package/lowcode/form-group/meta.ts +5 -1
  202. package/lowcode/form-item-input.mobile/__screenshots__/mobile.png +0 -0
  203. package/lowcode/form-item-input.mobile/meta.ts +36 -46
  204. package/lowcode/form-item-input.mobile/snippets.ts +8 -2
  205. package/lowcode/form-item-input.phone/meta.ts +8 -42
  206. package/lowcode/form-item-input.phone/snippets.ts +6 -0
  207. package/lowcode/form-item-input.subdomain/__screenshots__/subdomain.png +0 -0
  208. package/lowcode/form-item-input.subdomain/meta.ts +20 -6
  209. package/lowcode/form-item-input.subdomain/snippets.ts +10 -11
  210. package/lowcode/form.item/meta.ts +48 -0
  211. package/lowcode/pisell-content/meta.ts +12 -9
  212. package/lowcode/pisell-draggable/meta.ts +190 -0
  213. package/lowcode/pisell-layout/meta.ts +9 -9
  214. package/lowcode/pisell-menu/meta.ts +112 -0
  215. package/package.json +1 -1
  216. package/lowcode/form-item-input.mobile/__screenshots__/phone.png +0 -0
@@ -1,4 +1,4 @@
1
- var _excluded = ["value", "onChange", "isVerification", "disabled"];
1
+ var _excluded = ["value", "onChange", "disabled"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -17,10 +17,38 @@ import ReadPretty from "./ReadPretty";
17
17
  import { withMode } from "../../dataSourceForm/utils";
18
18
  import useTranslationOriginal from "../../../../hooks/useTranslationOriginal";
19
19
  var Option = Select.Option;
20
+ /**
21
+ * 手机号码输入组件
22
+ *
23
+ * 校验规则:
24
+ * 1. AU(+61) 验证规则:
25
+ * - 10位或9位数字
26
+ * - 前两位是04或者第一位是4
27
+ * - 格式示例:0412345678 或 412345678
28
+ *
29
+ * 2. CN(+86) 验证规则:
30
+ * - 11位数字
31
+ * - 第一位必须是1
32
+ * - 格式示例:13812345678
33
+ *
34
+ * 3. 其他国家验证规则:
35
+ * - 15位以内数字
36
+ * - 格式示例:123456789
37
+ *
38
+ * 使用方式:
39
+ * <Mobile
40
+ * name="mobile"
41
+ * label="手机号"
42
+ * typeobj={{
43
+ * type: 'mobile',
44
+ * enabled: true
45
+ * }}
46
+ * />
47
+ */
48
+
20
49
  var MobileNumberInput = function MobileNumberInput(_ref) {
21
50
  var propsValue = _ref.value,
22
51
  onChange = _ref.onChange,
23
- isVerification = _ref.isVerification,
24
52
  disabled = _ref.disabled,
25
53
  props = _objectWithoutProperties(_ref, _excluded);
26
54
  var _useCountries = useCountries(),
@@ -69,19 +97,72 @@ var MobileNumberInput = function MobileNumberInput(_ref) {
69
97
 
70
98
  // 监听外部value变化
71
99
  useEffect(function () {
72
- var _parseExternalValue = parseExternalValue(value),
73
- newCountryCode = _parseExternalValue.countryCode,
74
- newPhoneNumber = _parseExternalValue.phoneNumber;
75
- setCountryCode(newCountryCode);
76
- setPhoneNumber(newPhoneNumber);
100
+ // 只有当 value 不是空字符串时才更新状态
101
+ if (value) {
102
+ var _parseExternalValue = parseExternalValue(value),
103
+ newCountryCode = _parseExternalValue.countryCode,
104
+ newPhoneNumber = _parseExternalValue.phoneNumber;
105
+ setCountryCode(newCountryCode);
106
+ setPhoneNumber(newPhoneNumber);
107
+ } else {
108
+ // 当 value 为空时,只清空号码,保持国家代码不变
109
+ setPhoneNumber('');
110
+ }
77
111
  }, [value, countries]);
78
112
  var handleCountryChange = function handleCountryChange(value) {
79
113
  setCountryCode(value);
114
+
115
+ // 在选择国家时也触发 onChange
116
+ var selectedCountry = countries.find(function (c) {
117
+ return c.code === value;
118
+ });
119
+ var prefix = (selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.prefix) || "";
120
+ var newValue = "".concat(prefix).concat(phoneNumber);
121
+
122
+ // 先更新值
123
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
124
+
125
+ // 使用 setTimeout 确保值更新后再触发验证
126
+ setTimeout(function () {
127
+ // 手动触发表单验证
128
+ var formInstance = props.form;
129
+ var fieldName = props.fieldKey;
130
+ if (formInstance && fieldName) {
131
+ formInstance.validateFields([fieldName]);
132
+ }
133
+ });
80
134
  };
81
135
  var handlePhoneNumberChange = function handlePhoneNumberChange(e) {
82
136
  var cleanNumber = e.target.value.replace(/\D/g, '');
83
137
  setPhoneNumber(cleanNumber);
138
+
139
+ // 在输入时就触发 onChange
140
+ var selectedCountry = countries.find(function (c) {
141
+ return c.code === countryCode;
142
+ });
143
+ var prefix = (selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.prefix) || "";
144
+
145
+ // 只有当实际输入的号码部分不为空时,才包含区号
146
+ var newValue = cleanNumber ? "".concat(prefix).concat(cleanNumber) : '';
147
+
148
+ // 更新值
149
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
150
+
151
+ // 如果号码为空,只清除校验信息,不重置国家代码
152
+ if (!cleanNumber) {
153
+ var formInstance = props.form;
154
+ var fieldName = props.fieldKey;
155
+ if (formInstance && fieldName) {
156
+ formInstance.setFields([{
157
+ name: fieldName,
158
+ errors: [],
159
+ // 清除错误信息
160
+ validating: false // 停止验证状态
161
+ }]);
162
+ }
163
+ }
84
164
  };
165
+
85
166
  var concatenatedNumber = useMemo(function () {
86
167
  var selectedCountry = countries.find(function (c) {
87
168
  return c.code === countryCode;
@@ -93,33 +174,9 @@ var MobileNumberInput = function MobileNumberInput(_ref) {
93
174
  return "".concat(prefix).concat(phoneNumber);
94
175
  }, [countryCode, phoneNumber, countries]);
95
176
  var handleBlur = function handleBlur() {
96
- onChange === null || onChange === void 0 ? void 0 : onChange(concatenatedNumber);
177
+ var finalValue = concatenatedNumber;
178
+ onChange === null || onChange === void 0 ? void 0 : onChange(finalValue);
97
179
  };
98
- var status = useMemo(function () {
99
- if (!phoneNumber || !isVerification) {
100
- return undefined;
101
- }
102
- if (countryCode === 'AU') {
103
- // AU(+61) 验证规则:10位或9位数字,前两位是04或者第一位是4
104
- var auRegex = /^(04\d{8}|\d{9})$/.test(phoneNumber);
105
- if (!auRegex) {
106
- return 'error';
107
- }
108
- } else if (countryCode === 'CN') {
109
- // CN(+86) 验证规则:11位数字,第一位是1
110
- var cnRegex = /^1\d{10}$/.test(phoneNumber);
111
- if (!cnRegex) {
112
- return 'error';
113
- }
114
- } else {
115
- // 其他国家验证规则:15位以内数字
116
- var otherRegex = /^\d{1,15}$/.test(phoneNumber);
117
- if (!otherRegex) {
118
- return 'error';
119
- }
120
- }
121
- return undefined;
122
- }, [concatenatedNumber, phoneNumber, isVerification, countryCode]);
123
180
  return /*#__PURE__*/React.createElement(Space.Compact, {
124
181
  block: true
125
182
  }, /*#__PURE__*/React.createElement(Select, {
@@ -129,7 +186,6 @@ var MobileNumberInput = function MobileNumberInput(_ref) {
129
186
  style: {
130
187
  width: '90px'
131
188
  },
132
- onBlur: handleBlur,
133
189
  popupMatchSelectWidth: false,
134
190
  optionLabelProp: "inputValue",
135
191
  optionFilterProp: "label",
@@ -143,7 +199,6 @@ var MobileNumberInput = function MobileNumberInput(_ref) {
143
199
  })
144
200
  }), /*#__PURE__*/React.createElement(Input, _extends({}, props, {
145
201
  disabled: disabled,
146
- status: status,
147
202
  type: "tel",
148
203
  value: phoneNumber,
149
204
  onChange: handlePhoneNumberChange,
@@ -1,4 +1,14 @@
1
1
  import { withFormItem } from "../../dataSourceForm/utils";
2
2
  import MobileWithMode from "./WithMode";
3
- var Mobile = withFormItem(MobileWithMode);
3
+ var Mobile = withFormItem(MobileWithMode, {
4
+ otherFormItemProps: {
5
+ validateTrigger: ['onChange', 'onBlur']
6
+ },
7
+ innerProps: {
8
+ typeobj: {
9
+ type: 'mobile',
10
+ enabled: true
11
+ }
12
+ }
13
+ });
4
14
  export 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;
@@ -1,4 +1,4 @@
1
- var _excluded = ["value", "onChange", "isVerification", "disabled"];
1
+ var _excluded = ["value", "onChange", "disabled"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -10,7 +10,6 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
11
  import React, { useState, useEffect, useMemo } from 'react';
12
12
  import { Input, Space } from 'antd';
13
- import { isValidPhoneNumber, parsePhoneNumberFromString } from 'libphonenumber-js';
14
13
  import { isNumber } from '@pisell/utils';
15
14
  import Select from "../../../select";
16
15
  import { useCountries } from "./serve";
@@ -18,10 +17,33 @@ import ReadPretty from "./ReadPretty";
18
17
  import { withMode } from "../../dataSourceForm/utils";
19
18
  import useTranslationOriginal from "../../../../hooks/useTranslationOriginal";
20
19
  var Option = Select.Option;
20
+ /**
21
+ * 电话号码输入组件
22
+ *
23
+ * 校验规则:
24
+ * 使用 libphonenumber-js 进行校验
25
+ * 1. 清除所有空格和括号等特殊字符
26
+ * 2. 验证是否符合 E.164 格式
27
+ * 3. 验证号码是否在对应国家有效
28
+ *
29
+ * 格式示例:
30
+ * - 国际格式:+86 10 1234 5678
31
+ * - 国内格式:010 1234 5678
32
+ *
33
+ * 使用方式:
34
+ * <Phone
35
+ * name="phone"
36
+ * label="电话号码"
37
+ * typeobj={{
38
+ * type: 'phone',
39
+ * enabled: true
40
+ * }}
41
+ * />
42
+ */
43
+
21
44
  var PhoneNumberInput = function PhoneNumberInput(_ref) {
22
45
  var propsValue = _ref.value,
23
46
  onChange = _ref.onChange,
24
- isVerification = _ref.isVerification,
25
47
  disabled = _ref.disabled,
26
48
  props = _objectWithoutProperties(_ref, _excluded);
27
49
  var _useCountries = useCountries(),
@@ -76,12 +98,55 @@ var PhoneNumberInput = function PhoneNumberInput(_ref) {
76
98
  setCountryCode(newCountryCode);
77
99
  setPhoneNumber(newPhoneNumber);
78
100
  }, [value, countries]);
79
- var handleCountryChange = function handleCountryChange(value) {
80
- setCountryCode(value);
81
- };
82
101
  var handlePhoneNumberChange = function handlePhoneNumberChange(e) {
83
102
  var cleanNumber = e.target.value.replace(/\D/g, '');
84
103
  setPhoneNumber(cleanNumber);
104
+
105
+ // 在输入时就触发 onChange
106
+ var selectedCountry = countries.find(function (c) {
107
+ return c.code === countryCode;
108
+ });
109
+ var prefix = (selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.prefix) || "";
110
+
111
+ // 只有当实际输入的号码部分不为空时,才包含区号
112
+ var newValue = cleanNumber ? "".concat(prefix).concat(cleanNumber) : '';
113
+
114
+ // 更新值
115
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
116
+
117
+ // 如果实际号码部分为空,立即触发验证以清除错误信息
118
+ if (!cleanNumber) {
119
+ setTimeout(function () {
120
+ var formInstance = props.form;
121
+ var fieldName = props.fieldKey;
122
+ if (formInstance && fieldName) {
123
+ formInstance.validateFields([fieldName]);
124
+ }
125
+ });
126
+ }
127
+ };
128
+ var handleCountryChange = function handleCountryChange(value) {
129
+ setCountryCode(value);
130
+
131
+ // 在选择国家时也触发 onChange
132
+ var selectedCountry = countries.find(function (c) {
133
+ return c.code === value;
134
+ });
135
+ var prefix = (selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.prefix) || "";
136
+ var newValue = "".concat(prefix).concat(phoneNumber);
137
+
138
+ // 先更新值
139
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
140
+
141
+ // 使用 setTimeout 确保值更新后再触发验证
142
+ setTimeout(function () {
143
+ // 手动触发表单验证
144
+ var formInstance = props.form;
145
+ var fieldName = props.fieldKey;
146
+ if (formInstance && fieldName) {
147
+ formInstance.validateFields([fieldName]);
148
+ }
149
+ });
85
150
  };
86
151
  var concatenatedNumber = useMemo(function () {
87
152
  var selectedCountry = countries.find(function (c) {
@@ -94,18 +159,9 @@ var PhoneNumberInput = function PhoneNumberInput(_ref) {
94
159
  return "".concat(prefix).concat(phoneNumber);
95
160
  }, [countryCode, phoneNumber, countries]);
96
161
  var handleBlur = function handleBlur() {
97
- onChange === null || onChange === void 0 ? void 0 : onChange(concatenatedNumber);
162
+ var finalValue = concatenatedNumber;
163
+ onChange === null || onChange === void 0 ? void 0 : onChange(finalValue);
98
164
  };
99
- var status = useMemo(function () {
100
- var _parsePhoneNumberFrom;
101
- if (!phoneNumber || !isVerification) {
102
- return undefined;
103
- }
104
- // 宽松的 E.164 格式校验
105
- var cleanedNumber = concatenatedNumber.replace(/\s|\(|\)/g, '');
106
- var isValid = isValidPhoneNumber(cleanedNumber) && ((_parsePhoneNumberFrom = parsePhoneNumberFromString(cleanedNumber)) === null || _parsePhoneNumberFrom === void 0 ? void 0 : _parsePhoneNumberFrom.isValid());
107
- return isValid ? undefined : 'error';
108
- }, [concatenatedNumber, phoneNumber, isVerification]);
109
165
  return /*#__PURE__*/React.createElement(Space.Compact, {
110
166
  block: true
111
167
  }, /*#__PURE__*/React.createElement(Select, {
@@ -115,7 +171,6 @@ var PhoneNumberInput = function PhoneNumberInput(_ref) {
115
171
  style: {
116
172
  width: '90px'
117
173
  },
118
- onBlur: handleBlur,
119
174
  popupMatchSelectWidth: false,
120
175
  optionLabelProp: "inputValue",
121
176
  optionFilterProp: "label",
@@ -129,7 +184,6 @@ var PhoneNumberInput = function PhoneNumberInput(_ref) {
129
184
  })
130
185
  }), /*#__PURE__*/React.createElement(Input, _extends({}, props, {
131
186
  disabled: disabled,
132
- status: status,
133
187
  type: "tel",
134
188
  value: phoneNumber,
135
189
  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;
@@ -1,4 +1,4 @@
1
- var _excluded = ["onBlur", "onChange", "rootDomain", "customDomain", "value"];
1
+ var _excluded = ["onBlur", "onChange", "rootDomain", "customDomain", "value", "tenantId", "fieldKey"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -8,41 +8,64 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
8
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
- import React, { useCallback, useState, useEffect } from 'react';
11
+ import React, { useCallback, useState, useEffect, useMemo } from 'react';
12
12
  import { Input as AntInput } from 'antd';
13
13
  import { useTenantData } from "./serve";
14
14
  import ReadPretty from "./ReadPretty";
15
15
  import { withMode } from "../../dataSourceForm/utils";
16
+ import useDataSource from "../../hooks/useDataSource";
16
17
  import useEngineContext from "../../../../hooks/useEngineContext";
18
+
19
+ // 定义组件的属性类型
20
+
21
+ /**
22
+ * 子域名输入组件
23
+ *
24
+ * 校验规则:
25
+ * 1. 长度限制:
26
+ * - 最小长度:2个字符
27
+ * - 最大长度:60个字符
28
+ *
29
+ * 2. 字符限制:
30
+ * - 只允许小写字母、数字和连字符(-)
31
+ * - 不能全为数字
32
+ * - 不能以连字符开头或结尾
33
+ * - 不能包含连续的连字符(--)
34
+ *
35
+ * 格式示例:
36
+ * - 有效:my-subdomain
37
+ * - 有效:web123
38
+ * - 无效:123 (全数字)
39
+ * - 无效:-subdomain (以连字符开头)
40
+ * - 无效:subdomain- (以连字符结尾)
41
+ * - 无效:sub--domain (包含连续连字符)
42
+ *
43
+ * 使用方式:
44
+ * <Subdomain
45
+ * name="subdomain"
46
+ * label="子域名"
47
+ * typeobj={{
48
+ * type: 'subdomain',
49
+ * enabled: true
50
+ * }}
51
+ * />
52
+ */
17
53
  var Subdomain = function Subdomain(props) {
18
- var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6, _context$appHelper$ut7, _context$appHelper$ut8;
54
+ var _coreData$tenant;
19
55
  var propsOnBlur = props.onBlur,
20
56
  propsOnChange = props.onChange,
21
57
  _props$rootDomain = props.rootDomain,
22
- rootDomain = _props$rootDomain === void 0 ? '' : _props$rootDomain,
58
+ rootDomain = _props$rootDomain === void 0 ? 'xzero' : _props$rootDomain,
23
59
  customDomain = props.customDomain,
24
60
  value = props.value,
61
+ tenantId = props.tenantId,
62
+ fieldKey = props.fieldKey,
25
63
  rest = _objectWithoutProperties(props, _excluded);
26
- var context = useEngineContext();
27
- var coreData = (_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut3 === void 0 ? void 0 : (_context$appHelper$ut4 = _context$appHelper$ut3.data) === null || _context$appHelper$ut4 === void 0 ? void 0 : (_context$appHelper$ut5 = _context$appHelper$ut4.store) === null || _context$appHelper$ut5 === void 0 ? void 0 : (_context$appHelper$ut6 = _context$appHelper$ut5.getStore) === null || _context$appHelper$ut6 === void 0 ? void 0 : (_context$appHelper$ut7 = _context$appHelper$ut6.call(_context$appHelper$ut5)) === null || _context$appHelper$ut7 === void 0 ? void 0 : (_context$appHelper$ut8 = _context$appHelper$ut7.getDataByModel) === null || _context$appHelper$ut8 === void 0 ? void 0 : _context$appHelper$ut8.call(_context$appHelper$ut7, 'core', 'core');
28
- var tenantData = useTenantData();
29
-
30
- // 解析外部传入的value
31
- var parseExternalValue = function parseExternalValue(val) {
32
- if (!val) return {
33
- subdomain: '',
34
- suffix: coreData ? coreData.tenant_domain : ''
35
- };
36
- var parts = val.split('.');
37
- var subdomain = parts.length > 1 ? parts[0] : val;
38
- var suffix = parts.length > 1 ? ".".concat(parts.slice(1).join('.')) : coreData ? coreData.tenant_domain : '';
39
- return {
40
- subdomain: subdomain,
41
- suffix: suffix
42
- };
43
- };
44
64
 
45
- // 使用状态管理子域名和后缀
65
+ // 1. 所有的 hooks 调用放在最前面
66
+ var _useDataSource = useDataSource(),
67
+ __designMode = _useDataSource.__designMode;
68
+ var context = useEngineContext();
46
69
  var _useState = useState(''),
47
70
  _useState2 = _slicedToArray(_useState, 2),
48
71
  subdomain = _useState2[0],
@@ -51,41 +74,125 @@ var Subdomain = function Subdomain(props) {
51
74
  _useState4 = _slicedToArray(_useState3, 2),
52
75
  suffix = _useState4[0],
53
76
  setSuffix = _useState4[1];
77
+
78
+ // 2. 获取 coreData
79
+ var coreData = useMemo(function () {
80
+ var _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _context$appHelper$ut4, _context$appHelper$ut5, _context$appHelper$ut6, _context$appHelper$ut7, _context$appHelper$ut8;
81
+ return (_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut3 === void 0 ? void 0 : (_context$appHelper$ut4 = _context$appHelper$ut3.data) === null || _context$appHelper$ut4 === void 0 ? void 0 : (_context$appHelper$ut5 = _context$appHelper$ut4.store) === null || _context$appHelper$ut5 === void 0 ? void 0 : (_context$appHelper$ut6 = _context$appHelper$ut5.getStore) === null || _context$appHelper$ut6 === void 0 ? void 0 : (_context$appHelper$ut7 = _context$appHelper$ut6.call(_context$appHelper$ut5)) === null || _context$appHelper$ut7 === void 0 ? void 0 : (_context$appHelper$ut8 = _context$appHelper$ut7.getDataByModel) === null || _context$appHelper$ut8 === void 0 ? void 0 : _context$appHelper$ut8.call(_context$appHelper$ut7, 'core', 'core');
82
+ }, [context]);
83
+ // 3. 获取 tenantData
84
+ var tenantData = useTenantData(rootDomain, coreData === null || coreData === void 0 ? void 0 : (_coreData$tenant = coreData.tenant) === null || _coreData$tenant === void 0 ? void 0 : _coreData$tenant.id);
85
+
86
+ // 4. parseExternalValue 函数
87
+ var parseExternalValue = function parseExternalValue(val) {
88
+ // 如果值为空或只有空格或只有点号,返回默认值
89
+ if (!val || !val.trim() || val.trim() === '.') {
90
+ return {
91
+ subdomain: '',
92
+ suffix: suffixEmpty()
93
+ };
94
+ }
95
+ try {
96
+ // 将连续的点替换为单个点
97
+ var normalizedVal = val.replace(/\.+/g, '.');
98
+ var parts = normalizedVal.split('.');
99
+
100
+ // 如果第一部分为空(以点号开头),且有后续部分
101
+ if (parts[0] === '' && parts.length > 1) {
102
+ return {
103
+ subdomain: '',
104
+ suffix: ".".concat(parts.slice(1).join('.'))
105
+ };
106
+ }
107
+
108
+ // 如果只有一个部分,作为子域名
109
+ if (parts.length === 1) {
110
+ return {
111
+ subdomain: parts[0].trim(),
112
+ suffix: suffixEmpty()
113
+ };
114
+ }
115
+
116
+ // 有多个部分,第一个作为子域名,其余作为后缀
117
+ return {
118
+ subdomain: parts[0].trim(),
119
+ suffix: ".".concat(parts.slice(1).join('.'))
120
+ };
121
+ } catch (error) {
122
+ console.error('Error parsing value:', error);
123
+ return {
124
+ subdomain: '',
125
+ suffix: suffixEmpty()
126
+ };
127
+ }
128
+ };
129
+
130
+ // 5. 处理 value 和 domain 变化
54
131
  useEffect(function () {
55
- if (value) {
56
- // 如果传入值存在,解析并更新子域名和后缀
57
- var _parseExternalValue = parseExternalValue(value),
58
- _subdomain = _parseExternalValue.subdomain,
59
- _suffix = _parseExternalValue.suffix;
60
- setSubdomain(_subdomain);
61
- setSuffix(_suffix);
62
- } else {
63
- // 根据 rootDomain 获取后缀
64
- if (rootDomain === '1') {
65
- setSuffix(coreData ? ".".concat(coreData.tenant_domain) : '');
66
- } else if (rootDomain === '2') {
67
- var _ref = tenantData || {},
68
- _ref$default_domain = _ref.default_domain,
69
- default_domain = _ref$default_domain === void 0 ? '' : _ref$default_domain;
70
- var firstDotIndex = default_domain.indexOf('.');
71
- var result = ".".concat(default_domain.slice(firstDotIndex + 1));
72
- setSuffix(result);
132
+ try {
133
+ if (value) {
134
+ var _parseExternalValue = parseExternalValue(value),
135
+ newSubdomain = _parseExternalValue.subdomain,
136
+ newSuffix = _parseExternalValue.suffix;
137
+ setSubdomain(newSubdomain);
138
+ setSuffix(newSuffix);
73
139
  } else {
74
- setSuffix(customDomain ? customDomain.startsWith('.') ? customDomain : ".".concat(customDomain) : '');
140
+ var _newSuffix = '';
141
+ switch (rootDomain) {
142
+ case 'xzero':
143
+ _newSuffix = coreData !== null && coreData !== void 0 && coreData.tenant_domain ? ".".concat(coreData.tenant_domain) : suffixEmpty();
144
+ break;
145
+ case 'saas':
146
+ _newSuffix = tenantData ? ".".concat(tenantData['saas.domain']) : suffixEmpty();
147
+ break;
148
+ case 'custom':
149
+ if (customDomain) {
150
+ var normalizedDomain = customDomain.replace(/\.+/g, '.');
151
+ _newSuffix = normalizedDomain.startsWith('.') ? normalizedDomain : ".".concat(normalizedDomain);
152
+ } else {
153
+ _newSuffix = suffixEmpty();
154
+ }
155
+ break;
156
+ default:
157
+ _newSuffix = suffixEmpty();
158
+ }
159
+ setSuffix(_newSuffix);
75
160
  }
161
+ } catch (error) {
162
+ console.error('Error updating domain:', error);
163
+ setSuffix(suffixEmpty());
76
164
  }
77
165
  }, [value, rootDomain, customDomain, tenantData, coreData]);
78
- var handleChange = function handleChange(e) {
79
- var inputValue = e.target.value.toLowerCase();
80
- var _parseExternalValue2 = parseExternalValue(inputValue),
81
- subdomain = _parseExternalValue2.subdomain;
82
- setSubdomain(subdomain);
83
- propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(subdomain + suffix);
84
- };
166
+
167
+ // 6. 处理输入变化
168
+ var handleChange = useCallback(function (e) {
169
+ try {
170
+ var inputValue = e.target.value.toLowerCase();
171
+ var _parseExternalValue2 = parseExternalValue(inputValue),
172
+ newSubdomain = _parseExternalValue2.subdomain;
173
+ setSubdomain(newSubdomain);
174
+ propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(newSubdomain + suffix);
175
+ } catch (error) {
176
+ console.error('Error handling change:', error);
177
+ }
178
+ }, [suffix, propsOnChange, parseExternalValue]);
179
+
180
+ // 7. 处理失焦
85
181
  var onBlur = useCallback(function (e) {
86
- propsOnBlur === null || propsOnBlur === void 0 ? void 0 : propsOnBlur(e);
87
- propsOnChange(subdomain + suffix);
182
+ try {
183
+ propsOnBlur === null || propsOnBlur === void 0 ? void 0 : propsOnBlur(e);
184
+ propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(subdomain + suffix);
185
+ } catch (error) {
186
+ console.error('Error handling blur:', error);
187
+ }
88
188
  }, [propsOnBlur, propsOnChange, subdomain, suffix]);
189
+ var suffixEmpty = function suffixEmpty() {
190
+ if (__designMode === 'design') {
191
+ return '.root-domain.example';
192
+ } else {
193
+ return 'error';
194
+ }
195
+ };
89
196
  return /*#__PURE__*/React.createElement(AntInput, _extends({}, rest, {
90
197
  value: subdomain,
91
198
  onChange: handleChange,
@@ -93,5 +200,7 @@ var Subdomain = function Subdomain(props) {
93
200
  addonAfter: suffix
94
201
  }));
95
202
  };
203
+
204
+ // 使用 withMode 高阶组件包装 Subdomain 组件
96
205
  var SubdomainlWithMode = withMode(Subdomain, ReadPretty);
97
- export default SubdomainlWithMode;
206
+ export default SubdomainlWithMode; // 导出组件
@@ -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,4 +1,4 @@
1
1
  import { withFormItem } from "../../dataSourceForm/utils";
2
- import EmailWithMode from "./WithMode";
3
- var Subdomain = withFormItem(EmailWithMode);
2
+ import SubdomainMode from "./WithMode";
3
+ var Subdomain = withFormItem(SubdomainMode);
4
4
  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;