@pisell/materials 6.0.10 → 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 (270) 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 +7 -7
  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/index.d.ts +4 -0
  29. package/es/components/dataSourceComponents/fields/Input/index.js +5 -1
  30. package/es/components/dataSourceComponents/fields/Input.Mobile/ReadPretty.d.ts +5 -0
  31. package/es/components/dataSourceComponents/fields/Input.Mobile/ReadPretty.js +28 -0
  32. package/es/components/dataSourceComponents/fields/Input.Mobile/ReadPretty.less +11 -0
  33. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +10 -0
  34. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +212 -0
  35. package/es/components/dataSourceComponents/fields/Input.Mobile/index.d.ts +3 -0
  36. package/es/components/dataSourceComponents/fields/Input.Mobile/index.js +14 -0
  37. package/es/components/dataSourceComponents/fields/Input.Mobile/serve.d.ts +24 -0
  38. package/es/components/dataSourceComponents/fields/Input.Mobile/serve.js +59 -0
  39. package/es/components/dataSourceComponents/fields/Input.Mobile/type.d.ts +5 -0
  40. package/es/components/dataSourceComponents/fields/Input.Mobile/type.js +1 -0
  41. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -3
  42. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +76 -19
  43. package/es/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.d.ts +5 -0
  44. package/es/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.js +13 -0
  45. package/es/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.less +11 -0
  46. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +13 -0
  47. package/es/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +206 -0
  48. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +12 -0
  49. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.js +4 -0
  50. package/es/components/dataSourceComponents/fields/Input.Subdomain/serve.d.ts +11 -0
  51. package/es/components/dataSourceComponents/fields/Input.Subdomain/serve.js +63 -0
  52. package/es/components/dataSourceComponents/fields/Input.Subdomain/type.d.ts +5 -0
  53. package/es/components/dataSourceComponents/fields/Input.Subdomain/type.js +1 -0
  54. package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.js +15 -4
  55. package/es/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
  56. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +17 -13
  57. package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
  58. package/es/components/dataSourceComponents/fields/Upload/ReadPretty.js +4 -2
  59. package/es/components/dataSourceComponents/fields/Upload/WithMode.js +5 -4
  60. package/es/components/dataSourceComponents/fields/Upload/index.less +1 -1
  61. package/es/components/dataSourceComponents/fields/Upload/serve.d.ts +1 -1
  62. package/es/components/dataSourceComponents/fields/Upload/serve.js +5 -5
  63. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +8 -0
  64. package/es/components/dataSourceComponents/fields/index.d.ts +25 -2
  65. package/es/components/dataSourceComponents/fields/index.js +1 -0
  66. package/es/components/dataSourceComponents/fields/type.d.ts +1 -0
  67. package/es/components/dataSourceComponents/fields/utils.js +1 -0
  68. package/es/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
  69. package/es/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
  70. package/es/components/dataSourceComponents/provider/actions/ActionsProvider.js +0 -1
  71. package/es/components/form/index.js +12 -0
  72. package/es/components/iconfont/index.js +1 -1
  73. package/es/components/pisellDraggable/components/Action/Action.d.ts +10 -0
  74. package/es/components/pisellDraggable/components/Action/Action.js +31 -0
  75. package/es/components/pisellDraggable/components/Action/Action.less +50 -0
  76. package/es/components/pisellDraggable/components/Action/index.d.ts +2 -0
  77. package/es/components/pisellDraggable/components/Action/index.js +1 -0
  78. package/es/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
  79. package/es/components/pisellDraggable/components/Handle/Handle.js +15 -0
  80. package/es/components/pisellDraggable/components/Handle/index.d.ts +1 -0
  81. package/es/components/pisellDraggable/components/Handle/index.js +1 -0
  82. package/es/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
  83. package/es/components/pisellDraggable/components/Remove/Remove.js +17 -0
  84. package/es/components/pisellDraggable/components/Remove/index.d.ts +1 -0
  85. package/es/components/pisellDraggable/components/Remove/index.js +1 -0
  86. package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
  87. package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +51 -0
  88. package/es/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
  89. package/es/components/pisellDraggable/components/TreeItem/TreeItem.js +57 -0
  90. package/es/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
  91. package/es/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
  92. package/es/components/pisellDraggable/components/TreeItem/index.js +2 -0
  93. package/es/components/pisellDraggable/components/index.d.ts +4 -0
  94. package/es/components/pisellDraggable/components/index.js +4 -0
  95. package/es/components/pisellDraggable/index.d.ts +27 -0
  96. package/es/components/pisellDraggable/index.js +380 -0
  97. package/es/components/pisellDraggable/types.d.ts +17 -0
  98. package/es/components/pisellDraggable/types.js +1 -0
  99. package/es/components/pisellDraggable/utilities.d.ts +17 -0
  100. package/es/components/pisellDraggable/utilities.js +230 -0
  101. package/es/components/pisellLayout/content.d.ts +8 -0
  102. package/es/components/pisellLayout/content.js +29 -0
  103. package/es/components/pisellLayout/footer.d.ts +7 -0
  104. package/es/components/pisellLayout/footer.js +12 -0
  105. package/es/components/pisellLayout/header.d.ts +7 -0
  106. package/es/components/pisellLayout/header.js +12 -0
  107. package/es/components/pisellLayout/index.d.ts +14 -0
  108. package/es/components/pisellLayout/index.js +15 -0
  109. package/es/components/pisellLayout/sider.d.ts +7 -0
  110. package/es/components/pisellLayout/sider.js +12 -0
  111. package/es/components/pisellMenu/PisellMenu.d.ts +5 -0
  112. package/es/components/pisellMenu/PisellMenu.js +55 -0
  113. package/es/components/pisellMenu/PisellMenu.less +53 -0
  114. package/es/components/pisellMenu/index.d.ts +3 -0
  115. package/es/components/pisellMenu/index.js +2 -0
  116. package/es/components/pisellMenu/types.d.ts +30 -0
  117. package/es/components/pisellMenu/types.js +1 -0
  118. package/es/components/pisellModal/components/functions/index.less +3 -0
  119. package/es/components/table/Table/utils.d.ts +1 -1
  120. package/es/components/versionModal/index.d.ts +15 -0
  121. package/es/components/versionModal/index.js +192 -0
  122. package/es/components/versionModal/index.less +3 -0
  123. package/es/index.d.ts +92 -120
  124. package/es/index.js +92 -144
  125. package/es/locales/en-US.d.ts +22 -0
  126. package/es/locales/en-US.js +24 -1
  127. package/es/locales/zh-CN.d.ts +21 -0
  128. package/es/locales/zh-CN.js +24 -2
  129. package/es/locales/zh-TW.d.ts +20 -0
  130. package/es/locales/zh-TW.js +23 -2
  131. package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +77 -4
  132. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +1 -0
  133. package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +8 -0
  134. package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -0
  135. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +138 -41
  136. package/lib/components/dataSourceComponents/dataSourceMenu/index.d.ts +2 -0
  137. package/lib/components/dataSourceComponents/dataSourceMenu/index.js +45 -0
  138. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +14 -2
  139. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
  140. package/lib/components/dataSourceComponents/fields/Input/index.d.ts +4 -0
  141. package/lib/components/dataSourceComponents/fields/Input/index.js +4 -0
  142. package/lib/components/dataSourceComponents/fields/Input.Mobile/ReadPretty.d.ts +5 -0
  143. package/lib/components/dataSourceComponents/fields/Input.Mobile/ReadPretty.js +58 -0
  144. package/lib/components/dataSourceComponents/fields/Input.Mobile/ReadPretty.less +11 -0
  145. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +10 -0
  146. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +171 -0
  147. package/lib/components/dataSourceComponents/fields/Input.Mobile/index.d.ts +3 -0
  148. package/lib/components/dataSourceComponents/fields/Input.Mobile/index.js +48 -0
  149. package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.d.ts +24 -0
  150. package/lib/components/dataSourceComponents/fields/Input.Mobile/serve.js +55 -0
  151. package/lib/components/dataSourceComponents/fields/Input.Mobile/type.d.ts +5 -0
  152. package/lib/components/dataSourceComponents/fields/Input.Mobile/type.js +17 -0
  153. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -3
  154. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +36 -17
  155. package/lib/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.d.ts +5 -0
  156. package/lib/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.js +50 -0
  157. package/lib/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.less +11 -0
  158. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.d.ts +13 -0
  159. package/lib/components/dataSourceComponents/fields/Input.Subdomain/WithMode.js +167 -0
  160. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +12 -0
  161. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.js +38 -0
  162. package/lib/components/dataSourceComponents/fields/Input.Subdomain/serve.d.ts +11 -0
  163. package/lib/components/dataSourceComponents/fields/Input.Subdomain/serve.js +65 -0
  164. package/lib/components/dataSourceComponents/fields/Input.Subdomain/type.d.ts +5 -0
  165. package/lib/components/dataSourceComponents/fields/Input.Subdomain/type.js +17 -0
  166. package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.js +15 -4
  167. package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +1 -0
  168. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +5 -3
  169. package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
  170. package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.js +2 -2
  171. package/lib/components/dataSourceComponents/fields/Upload/WithMode.js +4 -4
  172. package/lib/components/dataSourceComponents/fields/Upload/index.less +1 -1
  173. package/lib/components/dataSourceComponents/fields/Upload/serve.d.ts +1 -1
  174. package/lib/components/dataSourceComponents/fields/Upload/serve.js +5 -5
  175. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +8 -0
  176. package/lib/components/dataSourceComponents/fields/index.d.ts +25 -2
  177. package/lib/components/dataSourceComponents/fields/index.js +1 -0
  178. package/lib/components/dataSourceComponents/fields/type.d.ts +1 -0
  179. package/lib/components/dataSourceComponents/fields/utils.js +1 -0
  180. package/lib/components/dataSourceComponents/provider/actions/ActionsContext.d.ts +6 -1
  181. package/lib/components/dataSourceComponents/provider/actions/ActionsProvider.d.ts +4 -1
  182. package/lib/components/form/index.js +10 -1
  183. package/lib/components/iconfont/index.js +1 -1
  184. package/lib/components/pisellDraggable/components/Action/Action.d.ts +10 -0
  185. package/lib/components/pisellDraggable/components/Action/Action.js +60 -0
  186. package/lib/components/pisellDraggable/components/Action/Action.less +50 -0
  187. package/lib/components/pisellDraggable/components/Action/index.d.ts +2 -0
  188. package/lib/components/pisellDraggable/components/Action/index.js +29 -0
  189. package/lib/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
  190. package/lib/components/pisellDraggable/components/Handle/Handle.js +54 -0
  191. package/lib/components/pisellDraggable/components/Handle/index.d.ts +1 -0
  192. package/lib/components/pisellDraggable/components/Handle/index.js +29 -0
  193. package/lib/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
  194. package/lib/components/pisellDraggable/components/Remove/Remove.js +53 -0
  195. package/lib/components/pisellDraggable/components/Remove/index.d.ts +1 -0
  196. package/lib/components/pisellDraggable/components/Remove/index.js +29 -0
  197. package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
  198. package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +83 -0
  199. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
  200. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.js +93 -0
  201. package/lib/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
  202. package/lib/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
  203. package/lib/components/pisellDraggable/components/TreeItem/index.js +32 -0
  204. package/lib/components/pisellDraggable/components/index.d.ts +4 -0
  205. package/lib/components/pisellDraggable/components/index.js +40 -0
  206. package/lib/components/pisellDraggable/index.d.ts +27 -0
  207. package/lib/components/pisellDraggable/index.js +271 -0
  208. package/lib/components/pisellDraggable/types.d.ts +17 -0
  209. package/lib/components/pisellDraggable/types.js +17 -0
  210. package/lib/components/pisellDraggable/utilities.d.ts +17 -0
  211. package/lib/components/pisellDraggable/utilities.js +190 -0
  212. package/lib/components/pisellLayout/content.d.ts +8 -0
  213. package/lib/components/pisellLayout/content.js +50 -0
  214. package/lib/components/pisellLayout/footer.d.ts +7 -0
  215. package/lib/components/pisellLayout/footer.js +42 -0
  216. package/lib/components/pisellLayout/header.d.ts +7 -0
  217. package/lib/components/pisellLayout/header.js +42 -0
  218. package/lib/components/pisellLayout/index.d.ts +14 -0
  219. package/lib/components/pisellLayout/index.js +45 -0
  220. package/lib/components/pisellLayout/sider.d.ts +7 -0
  221. package/lib/components/pisellLayout/sider.js +42 -0
  222. package/lib/components/pisellMenu/PisellMenu.d.ts +5 -0
  223. package/lib/components/pisellMenu/PisellMenu.js +91 -0
  224. package/lib/components/pisellMenu/PisellMenu.less +53 -0
  225. package/lib/components/pisellMenu/index.d.ts +3 -0
  226. package/lib/components/pisellMenu/index.js +36 -0
  227. package/lib/components/pisellMenu/types.d.ts +30 -0
  228. package/lib/components/pisellMenu/types.js +17 -0
  229. package/lib/components/pisellModal/components/functions/index.less +3 -0
  230. package/lib/components/table/Table/utils.d.ts +1 -1
  231. package/lib/components/versionModal/index.d.ts +15 -0
  232. package/lib/components/versionModal/index.js +219 -0
  233. package/lib/components/versionModal/index.less +3 -0
  234. package/lib/index.d.ts +92 -120
  235. package/lib/index.js +146 -157
  236. package/lib/locales/en-US.d.ts +22 -0
  237. package/lib/locales/en-US.js +24 -1
  238. package/lib/locales/zh-CN.d.ts +21 -0
  239. package/lib/locales/zh-CN.js +24 -2
  240. package/lib/locales/zh-TW.d.ts +20 -0
  241. package/lib/locales/zh-TW.js +23 -2
  242. package/lowcode/_utils/defaultSchema.ts +23 -2
  243. package/lowcode/button/meta.ts +4 -20
  244. package/lowcode/data-source-form/constants.ts +4 -0
  245. package/lowcode/data-source-form/meta.ts +138 -1
  246. package/lowcode/data-source-form/snippets.ts +54 -0
  247. package/lowcode/data-source-form/utils.ts +5 -1
  248. package/lowcode/data-source-menu/meta.ts +122 -0
  249. package/lowcode/data-source-table/meta.ts +32 -27
  250. package/lowcode/data-source-table/utils.tsx +33 -1
  251. package/lowcode/data-source-wrapper/meta.ts +6 -2
  252. package/lowcode/form-group/meta.ts +5 -1
  253. package/lowcode/form-item-input.mobile/__screenshots__/mobile.png +0 -0
  254. package/lowcode/form-item-input.mobile/meta.ts +301 -0
  255. package/lowcode/form-item-input.mobile/snippets.ts +27 -0
  256. package/lowcode/form-item-input.phone/meta.ts +9 -43
  257. package/lowcode/form-item-input.phone/snippets.ts +8 -2
  258. package/lowcode/form-item-input.subdomain/__screenshots__/subdomain.png +0 -0
  259. package/lowcode/form-item-input.subdomain/meta.ts +318 -0
  260. package/lowcode/form-item-input.subdomain/snippets.ts +27 -0
  261. package/lowcode/form.item/meta.ts +48 -0
  262. package/lowcode/pisell-content/meta.ts +86 -0
  263. package/lowcode/pisell-draggable/meta.ts +190 -0
  264. package/lowcode/pisell-footer/meta.ts +81 -0
  265. package/lowcode/pisell-header/meta.ts +83 -0
  266. package/lowcode/pisell-layout/meta.ts +174 -0
  267. package/lowcode/pisell-menu/meta.ts +112 -0
  268. package/lowcode/pisell-sider/meta.ts +142 -0
  269. package/lowcode/pisell-text/meta.ts +9 -8080
  270. package/package.json +1 -1
@@ -0,0 +1,48 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/dataSourceComponents/fields/Input.Mobile/index.tsx
30
+ var Input_exports = {};
31
+ __export(Input_exports, {
32
+ default: () => Input_default
33
+ });
34
+ module.exports = __toCommonJS(Input_exports);
35
+ var import_utils = require("../../dataSourceForm/utils");
36
+ var import_WithMode = __toESM(require("./WithMode"));
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
+ });
48
+ var Input_default = Mobile;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 获取nocobase数据列表
3
+ */
4
+ export declare const getCountryDataList: () => Promise<any>;
5
+ export interface Country {
6
+ id: number;
7
+ name: {
8
+ en: string;
9
+ "zh-CN": string;
10
+ "zh-HK": string;
11
+ original: string;
12
+ };
13
+ code: string;
14
+ calling_code: string;
15
+ currency_code: string;
16
+ sort: number;
17
+ status: string;
18
+ created_at: string;
19
+ updated_at: string;
20
+ prefix: string;
21
+ }
22
+ export declare const useCountries: () => {
23
+ data: Country[];
24
+ };
@@ -0,0 +1,55 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/dataSourceComponents/fields/Input.Mobile/serve.ts
20
+ var serve_exports = {};
21
+ __export(serve_exports, {
22
+ getCountryDataList: () => getCountryDataList,
23
+ useCountries: () => useCountries
24
+ });
25
+ module.exports = __toCommonJS(serve_exports);
26
+ var import_ahooks = require("ahooks");
27
+ var import_utils = require("../../../table/utils");
28
+ var getCountryDataList = async () => {
29
+ const { data } = await import_utils.request.getRequest().get(`/country:list`, {}, {
30
+ isNocobase: true,
31
+ fullResult: true,
32
+ headers: {
33
+ "x-data-source": "pisell2"
34
+ }
35
+ });
36
+ return data.map((item) => ({
37
+ ...item,
38
+ prefix: `+${item.calling_code}`
39
+ }));
40
+ };
41
+ var useCountries = () => {
42
+ const { data } = (0, import_ahooks.useRequest)(getCountryDataList, {
43
+ cacheKey: "phone-countries",
44
+ staleTime: 1e3 * 60 * 5,
45
+ // 5分钟后数据过期
46
+ cacheTime: 1e3 * 60 * 60
47
+ // 1小时后清除缓存
48
+ });
49
+ return { data };
50
+ };
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ getCountryDataList,
54
+ useCountries
55
+ });
@@ -0,0 +1,5 @@
1
+ import { InputProps as AntInputProps } from 'antd';
2
+ import { ModeType } from "../../dataSourceForm/type";
3
+ export interface InputProps extends AntInputProps {
4
+ renderMode: ModeType;
5
+ }
@@ -0,0 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // src/components/dataSourceComponents/fields/Input.Mobile/type.ts
16
+ var type_exports = {};
17
+ module.exports = __toCommonJS(type_exports);
@@ -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
- declare const PhoneWithMode: React.FC<PhoneInputProps & import("../../dataSourceForm/utils").WithModeProps>;
11
- export default PhoneWithMode;
9
+ declare const PhoneNumberInputWithMode: React.FC<PhoneInputProps & import("../../dataSourceForm/utils").WithModeProps>;
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 PhoneInput = ({ 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 PhoneInput = ({ value: propsValue, onChange, isVerification, disabled, ...pr
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,15 +124,9 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, disabled, ...pr
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
- return (0, import_libphonenumber_js.isValidPhoneNumber)(concatenatedNumber) && ((_a = (0, import_libphonenumber_js.parsePhoneNumberFromString)(concatenatedNumber)) == null ? void 0 : _a.isValid()) ? void 0 : "error";
108
- }, [concatenatedNumber, phoneNumber, isVerification]);
109
130
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { block: true }, /* @__PURE__ */ import_react.default.createElement(
110
131
  import_select.default,
111
132
  {
@@ -113,7 +134,6 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, disabled, ...pr
113
134
  value: countryCode,
114
135
  onChange: handleCountryChange,
115
136
  style: { width: "90px" },
116
- onBlur: handleBlur,
117
137
  popupMatchSelectWidth: false,
118
138
  optionLabelProp: "inputValue",
119
139
  optionFilterProp: "label",
@@ -129,7 +149,6 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, disabled, ...pr
129
149
  {
130
150
  ...props,
131
151
  disabled,
132
- status,
133
152
  type: "tel",
134
153
  value: phoneNumber,
135
154
  onChange: handlePhoneNumberChange,
@@ -138,5 +157,5 @@ var PhoneInput = ({ value: propsValue, onChange, isVerification, disabled, ...pr
138
157
  }
139
158
  ));
140
159
  };
141
- var PhoneWithMode = (0, import_utils2.withMode)(PhoneInput, import_ReadPretty.default);
142
- var WithMode_default = PhoneWithMode;
160
+ var PhoneNumberInputWithMode = (0, import_utils2.withMode)(PhoneNumberInput, import_ReadPretty.default);
161
+ var WithMode_default = PhoneNumberInputWithMode;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { InputProps } from './type';
3
+ import './ReadPretty.less';
4
+ declare const InputReadPretty: (props: InputProps) => React.JSX.Element;
5
+ export default InputReadPretty;
@@ -0,0 +1,50 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/dataSourceComponents/fields/Input.Subdomain/ReadPretty.tsx
30
+ var ReadPretty_exports = {};
31
+ __export(ReadPretty_exports, {
32
+ default: () => ReadPretty_default
33
+ });
34
+ module.exports = __toCommonJS(ReadPretty_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_classnames = __toESM(require("classnames"));
37
+ var import_ReadPretty = require("./ReadPretty.less");
38
+ var InputReadPretty = (props) => {
39
+ const { value, renderMode } = props;
40
+ return /* @__PURE__ */ import_react.default.createElement(
41
+ "span",
42
+ {
43
+ className: (0, import_classnames.default)("pisell-input-email-read-pretty", {
44
+ "pisell-input-email-read-pretty-table-view": renderMode === "tableView"
45
+ })
46
+ },
47
+ value
48
+ );
49
+ };
50
+ var ReadPretty_default = InputReadPretty;
@@ -0,0 +1,11 @@
1
+ .pisell-input-email-read-pretty {
2
+ color: var(--Gray-900, #101828);
3
+ font-size: 16px;
4
+ font-weight: 600;
5
+ line-height: 24px; /* 150% */
6
+ }
7
+
8
+ .pisell-input-email-read-pretty-table-view {
9
+ font-size: 14px;
10
+ font-weight: 400;
11
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { InputProps } from 'antd';
3
+ declare const SubdomainlWithMode: React.FC<InputProps & {
4
+ onChange: (value: string) => void;
5
+ onBlur?: ((e: React.FocusEvent<HTMLInputElement>) => void) | undefined;
6
+ rootDomain: 'xzero' | 'saas' | 'custom';
7
+ customDomain?: string | undefined;
8
+ value?: string | undefined;
9
+ tenantId: string;
10
+ name?: string | undefined;
11
+ fieldKey?: string | undefined;
12
+ } & import("../../dataSourceForm/utils").WithModeProps>;
13
+ export default SubdomainlWithMode;
@@ -0,0 +1,167 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/dataSourceComponents/fields/Input.Subdomain/WithMode.tsx
30
+ var WithMode_exports = {};
31
+ __export(WithMode_exports, {
32
+ default: () => WithMode_default
33
+ });
34
+ module.exports = __toCommonJS(WithMode_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_serve = require("./serve");
38
+ var import_ReadPretty = __toESM(require("./ReadPretty"));
39
+ var import_utils = require("../../dataSourceForm/utils");
40
+ var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
41
+ var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
42
+ var Subdomain = (props) => {
43
+ var _a;
44
+ const {
45
+ onBlur: propsOnBlur,
46
+ onChange: propsOnChange,
47
+ rootDomain = "xzero",
48
+ customDomain,
49
+ value,
50
+ tenantId,
51
+ fieldKey,
52
+ ...rest
53
+ } = props;
54
+ const { __designMode } = (0, import_useDataSource.default)();
55
+ const context = (0, import_useEngineContext.default)();
56
+ const [subdomain, setSubdomain] = (0, import_react.useState)("");
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
+ };
97
+ (0, import_react.useEffect)(() => {
98
+ try {
99
+ if (value) {
100
+ const { subdomain: newSubdomain, suffix: newSuffix } = parseExternalValue(value);
101
+ setSubdomain(newSubdomain);
102
+ setSuffix(newSuffix);
103
+ } else {
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);
124
+ }
125
+ } catch (error) {
126
+ console.error("Error updating domain:", error);
127
+ setSuffix(suffixEmpty());
128
+ }
129
+ }, [value, rootDomain, customDomain, tenantData, coreData]);
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 + suffix);
136
+ } catch (error) {
137
+ console.error("Error handling change:", error);
138
+ }
139
+ }, [suffix, propsOnChange, parseExternalValue]);
140
+ const onBlur = (0, import_react.useCallback)((e) => {
141
+ try {
142
+ propsOnBlur == null ? void 0 : propsOnBlur(e);
143
+ propsOnChange == null ? void 0 : propsOnChange(subdomain + suffix);
144
+ } catch (error) {
145
+ console.error("Error handling blur:", error);
146
+ }
147
+ }, [propsOnBlur, propsOnChange, subdomain, suffix]);
148
+ const suffixEmpty = () => {
149
+ if (__designMode === "design") {
150
+ return ".root-domain.example";
151
+ } else {
152
+ return "error";
153
+ }
154
+ };
155
+ return /* @__PURE__ */ import_react.default.createElement(
156
+ import_antd.Input,
157
+ {
158
+ ...rest,
159
+ value: subdomain,
160
+ onChange: handleChange,
161
+ onBlur,
162
+ addonAfter: suffix
163
+ }
164
+ );
165
+ };
166
+ var SubdomainlWithMode = (0, import_utils.withMode)(Subdomain, import_ReadPretty.default);
167
+ var WithMode_default = SubdomainlWithMode;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ declare const Subdomain: React.FC<import("antd").InputProps & {
3
+ onChange: (value: string) => void;
4
+ onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
5
+ rootDomain: "custom" | "saas" | "xzero";
6
+ customDomain?: string | undefined;
7
+ value?: string | undefined;
8
+ tenantId: string;
9
+ name?: string | undefined;
10
+ fieldKey?: string | undefined;
11
+ } & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps>;
12
+ export default Subdomain;
@@ -0,0 +1,38 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/dataSourceComponents/fields/Input.Subdomain/index.tsx
30
+ var Input_exports = {};
31
+ __export(Input_exports, {
32
+ default: () => Input_default
33
+ });
34
+ module.exports = __toCommonJS(Input_exports);
35
+ var import_utils = require("../../dataSourceForm/utils");
36
+ var import_WithMode = __toESM(require("./WithMode"));
37
+ var Subdomain = (0, import_utils.withFormItem)(import_WithMode.default);
38
+ var Input_default = Subdomain;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 获取nocobase数据列表 获取域名后缀
3
+ */
4
+ export declare const getTenantData: (id: string) => Promise<TenantData>;
5
+ export interface TenantData {
6
+ 'saas.domain': string;
7
+ }
8
+ /**
9
+ * 自定义 Hook,用于获取租户数据
10
+ */
11
+ export declare const useTenantData: (rootDomain: string, tenantId?: string) => TenantData | undefined;
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/dataSourceComponents/fields/Input.Subdomain/serve.ts
20
+ var serve_exports = {};
21
+ __export(serve_exports, {
22
+ getTenantData: () => getTenantData,
23
+ useTenantData: () => useTenantData
24
+ });
25
+ module.exports = __toCommonJS(serve_exports);
26
+ var import_ahooks = require("ahooks");
27
+ var import_utils = require("../../../table/utils");
28
+ var getTenantData = async (id) => {
29
+ try {
30
+ const { data } = await import_utils.request.getRequest().get(`/tenant/core/meta/tenant/${id}/saas`, {}, {
31
+ isNocobase: false,
32
+ fullResult: true,
33
+ headers: {
34
+ "x-data-source": "pisell2"
35
+ }
36
+ });
37
+ return data;
38
+ } catch (error) {
39
+ console.error("Failed to fetch tenant data:", error);
40
+ throw error;
41
+ }
42
+ };
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
+ );
59
+ return data;
60
+ };
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ getTenantData,
64
+ useTenantData
65
+ });
@@ -0,0 +1,5 @@
1
+ import { InputProps as AntInputProps } from 'antd';
2
+ import { ModeType } from "../../dataSourceForm/type";
3
+ export interface InputProps extends AntInputProps {
4
+ renderMode: ModeType;
5
+ }