@nocobase/client 0.7.4-alpha.7 → 0.7.5-alpha.1

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 (275) hide show
  1. package/es/block-provider/TableBlockProvider.js +3 -3
  2. package/es/collection-manager/Configuration/AddFieldAction.js +38 -41
  3. package/es/collection-manager/Configuration/EditFieldAction.js +64 -41
  4. package/es/collection-manager/interfaces/email.js +4 -2
  5. package/es/collection-manager/interfaces/formula.js +1 -1
  6. package/es/collection-manager/interfaces/index.d.ts +1 -0
  7. package/es/collection-manager/interfaces/index.js +1 -0
  8. package/es/collection-manager/interfaces/input.js +4 -2
  9. package/es/collection-manager/interfaces/integer.js +4 -2
  10. package/es/collection-manager/interfaces/m2m.js +2 -2
  11. package/es/collection-manager/interfaces/m2o.js +7 -3
  12. package/es/collection-manager/interfaces/number.js +3 -2
  13. package/es/collection-manager/interfaces/o2m.js +8 -4
  14. package/es/collection-manager/interfaces/o2o.js +19 -6
  15. package/es/collection-manager/interfaces/password.js +4 -2
  16. package/es/collection-manager/interfaces/percent.js +2 -1
  17. package/es/collection-manager/interfaces/phone.js +4 -2
  18. package/es/collection-manager/interfaces/properties/index.d.ts +7 -0
  19. package/es/collection-manager/interfaces/properties/index.js +91 -0
  20. package/es/collection-manager/interfaces/sequence.d.ts +2 -0
  21. package/es/collection-manager/interfaces/sequence.js +431 -0
  22. package/es/locale/en_US.d.ts +1 -0
  23. package/es/locale/en_US.js +2 -1
  24. package/es/locale/index.js +24 -0
  25. package/es/locale/ja_JP.d.ts +590 -0
  26. package/es/locale/ja_JP.js +591 -0
  27. package/es/locale/ru_RU.d.ts +560 -0
  28. package/es/locale/ru_RU.js +559 -0
  29. package/es/locale/zh_CN.d.ts +27 -0
  30. package/es/locale/zh_CN.js +30 -3
  31. package/es/route-switch/antd/admin-layout/index.js +19 -4
  32. package/es/schema-component/antd/action/Action.js +3 -1
  33. package/es/schema-component/antd/action/ActionBar.js +8 -1
  34. package/es/schema-component/antd/cron/Cron.d.ts +6 -0
  35. package/es/schema-component/antd/cron/Cron.js +49 -0
  36. package/es/schema-component/antd/cron/index.d.ts +1 -0
  37. package/es/schema-component/antd/cron/index.js +1 -0
  38. package/es/schema-component/antd/cron/locale/zh-CN.d.ts +34 -0
  39. package/es/schema-component/antd/cron/locale/zh-CN.js +37 -0
  40. package/es/schema-component/antd/filter/Filter.Action.Designer.js +1 -0
  41. package/es/schema-component/antd/formula-input/Compute.js +1 -1
  42. package/es/schema-component/antd/grid/Grid.js +134 -25
  43. package/es/schema-component/antd/index.d.ts +1 -0
  44. package/es/schema-component/antd/index.js +1 -0
  45. package/es/schema-component/antd/record-picker/InputRecordPicker.js +4 -2
  46. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -2
  47. package/es/schema-component/antd/record-picker/util.d.ts +5 -0
  48. package/es/schema-component/antd/record-picker/util.js +37 -0
  49. package/es/schema-component/antd/upload/shared.js +6 -2
  50. package/es/schema-component/common/dnd-context/index.js +30 -4
  51. package/es/schema-component/hooks/useDesignable.d.ts +2 -2
  52. package/es/schema-component/hooks/useDesignable.js +130 -26
  53. package/es/schema-initializer/SchemaInitializer.d.ts +1 -0
  54. package/es/schema-initializer/SchemaInitializer.js +6 -2
  55. package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +2 -1
  56. package/es/schema-initializer/buttons/TabPaneInitializers.js +9 -3
  57. package/es/schema-initializer/items/ActionInitializer.d.ts +1 -0
  58. package/es/schema-initializer/items/ActionInitializer.js +13 -0
  59. package/es/schema-initializer/items/BlockInitializer.d.ts +1 -0
  60. package/es/schema-initializer/items/BlockInitializer.js +18 -0
  61. package/es/schema-initializer/items/BulkDestroyActionInitializer.d.ts +1 -0
  62. package/es/schema-initializer/items/BulkDestroyActionInitializer.js +27 -0
  63. package/es/schema-initializer/items/CalendarBlockInitializer.d.ts +1 -0
  64. package/es/schema-initializer/items/CalendarBlockInitializer.js +124 -0
  65. package/es/schema-initializer/items/CollectionFieldInitializer.d.ts +1 -0
  66. package/es/schema-initializer/items/CollectionFieldInitializer.js +15 -0
  67. package/es/schema-initializer/items/CreateActionInitializer.d.ts +1 -0
  68. package/es/schema-initializer/items/CreateActionInitializer.js +60 -0
  69. package/es/schema-initializer/items/CreateFormBlockInitializer.d.ts +1 -0
  70. package/es/schema-initializer/items/CreateFormBlockInitializer.js +102 -0
  71. package/es/schema-initializer/items/CreateSubmitActionInitializer.d.ts +1 -0
  72. package/es/schema-initializer/items/CreateSubmitActionInitializer.js +24 -0
  73. package/es/schema-initializer/items/CustomizeActionInitializer.d.ts +1 -0
  74. package/es/schema-initializer/items/CustomizeActionInitializer.js +11 -0
  75. package/es/schema-initializer/items/DataBlockInitializer.d.ts +1 -0
  76. package/es/schema-initializer/items/DataBlockInitializer.js +88 -0
  77. package/es/schema-initializer/items/DestroyActionInitializer.d.ts +1 -0
  78. package/es/schema-initializer/items/DestroyActionInitializer.js +27 -0
  79. package/es/schema-initializer/items/DetailsBlockInitializer.d.ts +1 -0
  80. package/es/schema-initializer/items/DetailsBlockInitializer.js +55 -0
  81. package/es/schema-initializer/items/FilterActionInitializer.d.ts +1 -0
  82. package/es/schema-initializer/items/FilterActionInitializer.js +24 -0
  83. package/es/schema-initializer/items/FormBlockInitializer.d.ts +1 -0
  84. package/es/schema-initializer/items/FormBlockInitializer.js +30 -0
  85. package/es/schema-initializer/items/G2PlotInitializer.d.ts +1 -0
  86. package/es/schema-initializer/items/G2PlotInitializer.js +25 -0
  87. package/es/schema-initializer/items/InitializerWithSwitch.d.ts +1 -0
  88. package/es/schema-initializer/items/InitializerWithSwitch.js +32 -0
  89. package/es/schema-initializer/items/KanbanBlockInitializer.d.ts +1 -0
  90. package/es/schema-initializer/items/KanbanBlockInitializer.js +138 -0
  91. package/es/schema-initializer/items/MarkdownBlockInitializer.d.ts +1 -0
  92. package/es/schema-initializer/items/MarkdownBlockInitializer.js +32 -0
  93. package/es/schema-initializer/items/PrintActionInitializer.d.ts +1 -0
  94. package/es/schema-initializer/items/PrintActionInitializer.js +23 -0
  95. package/es/schema-initializer/items/RecordAssociationBlockInitializer.d.ts +1 -0
  96. package/es/schema-initializer/items/RecordAssociationBlockInitializer.js +90 -0
  97. package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.d.ts +1 -0
  98. package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +160 -0
  99. package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.d.ts +1 -0
  100. package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +90 -0
  101. package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.d.ts +1 -0
  102. package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.js +112 -0
  103. package/es/schema-initializer/items/RecordFormBlockInitializer.d.ts +1 -0
  104. package/es/schema-initializer/items/RecordFormBlockInitializer.js +109 -0
  105. package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.d.ts +1 -0
  106. package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +116 -0
  107. package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.d.ts +1 -0
  108. package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +114 -0
  109. package/es/schema-initializer/items/RefreshActionInitializer.d.ts +1 -0
  110. package/es/schema-initializer/items/RefreshActionInitializer.js +23 -0
  111. package/es/schema-initializer/items/SubmitActionInitializer.d.ts +1 -0
  112. package/es/schema-initializer/items/SubmitActionInitializer.js +24 -0
  113. package/es/schema-initializer/items/TableActionColumnInitializer.d.ts +1 -0
  114. package/es/schema-initializer/items/TableActionColumnInitializer.js +34 -0
  115. package/es/schema-initializer/items/TableBlockInitializer.d.ts +1 -0
  116. package/es/schema-initializer/items/TableBlockInitializer.js +55 -0
  117. package/es/schema-initializer/items/TableCollectionFieldInitializer.d.ts +1 -0
  118. package/es/schema-initializer/items/TableCollectionFieldInitializer.js +15 -0
  119. package/es/schema-initializer/items/TableSelectorInitializer.d.ts +1 -0
  120. package/es/schema-initializer/items/TableSelectorInitializer.js +67 -0
  121. package/es/schema-initializer/items/UpdateActionInitializer.d.ts +1 -0
  122. package/es/schema-initializer/items/UpdateActionInitializer.js +59 -0
  123. package/es/schema-initializer/items/UpdateSubmitActionInitializer.d.ts +1 -0
  124. package/es/schema-initializer/items/UpdateSubmitActionInitializer.js +24 -0
  125. package/es/schema-initializer/items/ViewActionInitializer.d.ts +1 -0
  126. package/es/schema-initializer/items/ViewActionInitializer.js +58 -0
  127. package/es/schema-initializer/items/index.d.ts +35 -35
  128. package/es/schema-initializer/items/index.js +35 -1589
  129. package/es/schema-initializer/style.less +4 -0
  130. package/es/schema-templates/SchemaTemplateManagerProvider.js +2 -5
  131. package/es/system-settings/SystemSettingsShortcut.js +7 -0
  132. package/es/user/SigninPage.d.ts +11 -2
  133. package/es/user/SigninPage.js +140 -33
  134. package/es/user/SignupPage.d.ts +7 -1
  135. package/es/user/SignupPage.js +54 -10
  136. package/es/user/VerificationCode.d.ts +7 -0
  137. package/es/user/VerificationCode.js +129 -0
  138. package/lib/block-provider/TableBlockProvider.js +3 -3
  139. package/lib/collection-manager/Configuration/AddFieldAction.js +38 -40
  140. package/lib/collection-manager/Configuration/EditFieldAction.js +65 -40
  141. package/lib/collection-manager/interfaces/email.js +3 -1
  142. package/lib/collection-manager/interfaces/formula.js +1 -1
  143. package/lib/collection-manager/interfaces/index.d.ts +1 -0
  144. package/lib/collection-manager/interfaces/index.js +13 -0
  145. package/lib/collection-manager/interfaces/input.js +3 -1
  146. package/lib/collection-manager/interfaces/integer.js +3 -1
  147. package/lib/collection-manager/interfaces/m2m.js +1 -1
  148. package/lib/collection-manager/interfaces/m2o.js +6 -2
  149. package/lib/collection-manager/interfaces/number.js +4 -3
  150. package/lib/collection-manager/interfaces/o2m.js +7 -3
  151. package/lib/collection-manager/interfaces/o2o.js +18 -5
  152. package/lib/collection-manager/interfaces/password.js +3 -1
  153. package/lib/collection-manager/interfaces/percent.js +1 -0
  154. package/lib/collection-manager/interfaces/phone.js +3 -1
  155. package/lib/collection-manager/interfaces/properties/index.d.ts +7 -0
  156. package/lib/collection-manager/interfaces/properties/index.js +94 -1
  157. package/lib/collection-manager/interfaces/sequence.d.ts +2 -0
  158. package/lib/collection-manager/interfaces/sequence.js +455 -0
  159. package/lib/locale/en_US.d.ts +1 -0
  160. package/lib/locale/en_US.js +2 -1
  161. package/lib/locale/index.js +28 -0
  162. package/lib/locale/ja_JP.d.ts +590 -0
  163. package/lib/locale/ja_JP.js +598 -0
  164. package/lib/locale/ru_RU.d.ts +560 -0
  165. package/lib/locale/ru_RU.js +566 -0
  166. package/lib/locale/zh_CN.d.ts +27 -0
  167. package/lib/locale/zh_CN.js +30 -3
  168. package/lib/route-switch/antd/admin-layout/index.js +19 -4
  169. package/lib/schema-component/antd/action/Action.js +2 -0
  170. package/lib/schema-component/antd/action/ActionBar.js +9 -1
  171. package/lib/schema-component/antd/cron/Cron.d.ts +6 -0
  172. package/lib/schema-component/antd/cron/Cron.js +67 -0
  173. package/lib/schema-component/antd/cron/index.d.ts +1 -0
  174. package/lib/schema-component/antd/cron/index.js +18 -0
  175. package/lib/schema-component/antd/cron/locale/zh-CN.d.ts +34 -0
  176. package/lib/schema-component/antd/cron/locale/zh-CN.js +44 -0
  177. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +1 -0
  178. package/lib/schema-component/antd/formula-input/Compute.js +1 -1
  179. package/lib/schema-component/antd/grid/Grid.js +132 -23
  180. package/lib/schema-component/antd/index.d.ts +1 -0
  181. package/lib/schema-component/antd/index.js +13 -0
  182. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +5 -2
  183. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +6 -2
  184. package/lib/schema-component/antd/record-picker/util.d.ts +5 -0
  185. package/lib/schema-component/antd/record-picker/util.js +55 -0
  186. package/lib/schema-component/antd/upload/shared.js +5 -1
  187. package/lib/schema-component/common/dnd-context/index.js +35 -5
  188. package/lib/schema-component/hooks/useDesignable.d.ts +2 -2
  189. package/lib/schema-component/hooks/useDesignable.js +132 -28
  190. package/lib/schema-initializer/SchemaInitializer.d.ts +1 -0
  191. package/lib/schema-initializer/SchemaInitializer.js +7 -2
  192. package/lib/schema-initializer/buttons/TabPaneInitializers.d.ts +2 -1
  193. package/lib/schema-initializer/buttons/TabPaneInitializers.js +13 -4
  194. package/lib/schema-initializer/items/ActionInitializer.d.ts +1 -0
  195. package/lib/schema-initializer/items/ActionInitializer.js +26 -0
  196. package/lib/schema-initializer/items/BlockInitializer.d.ts +1 -0
  197. package/lib/schema-initializer/items/BlockInitializer.js +31 -0
  198. package/lib/schema-initializer/items/BulkDestroyActionInitializer.d.ts +1 -0
  199. package/lib/schema-initializer/items/BulkDestroyActionInitializer.js +40 -0
  200. package/lib/schema-initializer/items/CalendarBlockInitializer.d.ts +1 -0
  201. package/lib/schema-initializer/items/CalendarBlockInitializer.js +148 -0
  202. package/lib/schema-initializer/items/CollectionFieldInitializer.d.ts +1 -0
  203. package/lib/schema-initializer/items/CollectionFieldInitializer.js +28 -0
  204. package/lib/schema-initializer/items/CreateActionInitializer.d.ts +1 -0
  205. package/lib/schema-initializer/items/CreateActionInitializer.js +73 -0
  206. package/lib/schema-initializer/items/CreateFormBlockInitializer.d.ts +1 -0
  207. package/lib/schema-initializer/items/CreateFormBlockInitializer.js +120 -0
  208. package/lib/schema-initializer/items/CreateSubmitActionInitializer.d.ts +1 -0
  209. package/lib/schema-initializer/items/CreateSubmitActionInitializer.js +37 -0
  210. package/lib/schema-initializer/items/CustomizeActionInitializer.d.ts +1 -0
  211. package/lib/schema-initializer/items/CustomizeActionInitializer.js +24 -0
  212. package/lib/schema-initializer/items/DataBlockInitializer.d.ts +1 -0
  213. package/lib/schema-initializer/items/DataBlockInitializer.js +104 -0
  214. package/lib/schema-initializer/items/DestroyActionInitializer.d.ts +1 -0
  215. package/lib/schema-initializer/items/DestroyActionInitializer.js +40 -0
  216. package/lib/schema-initializer/items/DetailsBlockInitializer.d.ts +1 -0
  217. package/lib/schema-initializer/items/DetailsBlockInitializer.js +71 -0
  218. package/lib/schema-initializer/items/FilterActionInitializer.d.ts +1 -0
  219. package/lib/schema-initializer/items/FilterActionInitializer.js +37 -0
  220. package/lib/schema-initializer/items/FormBlockInitializer.d.ts +1 -0
  221. package/lib/schema-initializer/items/FormBlockInitializer.js +45 -0
  222. package/lib/schema-initializer/items/G2PlotInitializer.d.ts +1 -0
  223. package/lib/schema-initializer/items/G2PlotInitializer.js +38 -0
  224. package/lib/schema-initializer/items/InitializerWithSwitch.d.ts +1 -0
  225. package/lib/schema-initializer/items/InitializerWithSwitch.js +47 -0
  226. package/lib/schema-initializer/items/KanbanBlockInitializer.d.ts +1 -0
  227. package/lib/schema-initializer/items/KanbanBlockInitializer.js +163 -0
  228. package/lib/schema-initializer/items/MarkdownBlockInitializer.d.ts +1 -0
  229. package/lib/schema-initializer/items/MarkdownBlockInitializer.js +47 -0
  230. package/lib/schema-initializer/items/PrintActionInitializer.d.ts +1 -0
  231. package/lib/schema-initializer/items/PrintActionInitializer.js +36 -0
  232. package/lib/schema-initializer/items/RecordAssociationBlockInitializer.d.ts +1 -0
  233. package/lib/schema-initializer/items/RecordAssociationBlockInitializer.js +107 -0
  234. package/lib/schema-initializer/items/RecordAssociationCalendarBlockInitializer.d.ts +1 -0
  235. package/lib/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +185 -0
  236. package/lib/schema-initializer/items/RecordAssociationDetailsBlockInitializer.d.ts +1 -0
  237. package/lib/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +107 -0
  238. package/lib/schema-initializer/items/RecordAssociationFormBlockInitializer.d.ts +1 -0
  239. package/lib/schema-initializer/items/RecordAssociationFormBlockInitializer.js +128 -0
  240. package/lib/schema-initializer/items/RecordFormBlockInitializer.d.ts +1 -0
  241. package/lib/schema-initializer/items/RecordFormBlockInitializer.js +127 -0
  242. package/lib/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.d.ts +1 -0
  243. package/lib/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +133 -0
  244. package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.d.ts +1 -0
  245. package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +132 -0
  246. package/lib/schema-initializer/items/RefreshActionInitializer.d.ts +1 -0
  247. package/lib/schema-initializer/items/RefreshActionInitializer.js +36 -0
  248. package/lib/schema-initializer/items/SubmitActionInitializer.d.ts +1 -0
  249. package/lib/schema-initializer/items/SubmitActionInitializer.js +37 -0
  250. package/lib/schema-initializer/items/TableActionColumnInitializer.d.ts +1 -0
  251. package/lib/schema-initializer/items/TableActionColumnInitializer.js +47 -0
  252. package/lib/schema-initializer/items/TableBlockInitializer.d.ts +1 -0
  253. package/lib/schema-initializer/items/TableBlockInitializer.js +71 -0
  254. package/lib/schema-initializer/items/TableCollectionFieldInitializer.d.ts +1 -0
  255. package/lib/schema-initializer/items/TableCollectionFieldInitializer.js +28 -0
  256. package/lib/schema-initializer/items/TableSelectorInitializer.d.ts +1 -0
  257. package/lib/schema-initializer/items/TableSelectorInitializer.js +84 -0
  258. package/lib/schema-initializer/items/UpdateActionInitializer.d.ts +1 -0
  259. package/lib/schema-initializer/items/UpdateActionInitializer.js +72 -0
  260. package/lib/schema-initializer/items/UpdateSubmitActionInitializer.d.ts +1 -0
  261. package/lib/schema-initializer/items/UpdateSubmitActionInitializer.js +37 -0
  262. package/lib/schema-initializer/items/ViewActionInitializer.d.ts +1 -0
  263. package/lib/schema-initializer/items/ViewActionInitializer.js +71 -0
  264. package/lib/schema-initializer/items/index.d.ts +35 -35
  265. package/lib/schema-initializer/items/index.js +400 -1659
  266. package/lib/schema-initializer/style.less +4 -0
  267. package/lib/schema-templates/SchemaTemplateManagerProvider.js +2 -5
  268. package/lib/system-settings/SystemSettingsShortcut.js +7 -0
  269. package/lib/user/SigninPage.d.ts +11 -2
  270. package/lib/user/SigninPage.js +150 -34
  271. package/lib/user/SignupPage.d.ts +7 -1
  272. package/lib/user/SignupPage.js +56 -10
  273. package/lib/user/VerificationCode.d.ts +7 -0
  274. package/lib/user/VerificationCode.js +148 -0
  275. package/package.json +6 -4
@@ -1,1589 +1,35 @@
1
- var _excluded = ["item", "insert"],
2
- _excluded2 = ["templateWrap", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
3
- _excluded3 = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
4
- _excluded4 = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
5
- _excluded5 = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
6
- _excluded6 = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
7
- _excluded7 = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
8
- _excluded8 = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
9
- _excluded9 = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
10
- _excluded10 = ["item", "onCreateBlockSchema", "componentType", "createBlockSchema", "insert"],
11
- _excluded11 = ["onCreateBlockSchema", "componentType", "createBlockSchema", "insert"];
12
-
13
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
-
15
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
16
-
17
- 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; }
18
-
19
- 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; }
20
-
21
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
-
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24
-
25
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
-
27
- import { FormOutlined, TableOutlined } from '@ant-design/icons';
28
- import { FormDialog, FormLayout } from '@formily/antd';
29
- import { SchemaOptionsContext } from '@formily/react';
30
- import { merge } from '@formily/shared';
31
- import React, { useContext } from 'react';
32
- import { useTranslation } from 'react-i18next';
33
- import { useAPIClient } from '../../api-client';
34
- import { useBlockAssociationContext, useBlockRequestContext } from '../../block-provider';
35
- import { useCollection, useCollectionManager } from '../../collection-manager';
36
- import { SchemaComponent, SchemaComponentOptions } from '../../schema-component';
37
- import { useSchemaTemplateManager } from '../../schema-templates';
38
- import { SchemaInitializer } from '../SchemaInitializer';
39
- import { createCalendarBlockSchema, createDetailsBlockSchema, createFormBlockSchema, createKanbanBlockSchema, createReadPrettyFormBlockSchema, createTableBlockSchema, createTableSelectorSchema, useCollectionDataSourceItems, useCurrentSchema, useRecordCollectionDataSourceItems } from '../utils'; // Block
40
-
41
- export var BlockInitializer = function BlockInitializer(props) {
42
- var item = props.item,
43
- insert = props.insert;
44
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, {
45
- onClick: function onClick() {
46
- insert(_objectSpread({}, item.schema));
47
- }
48
- });
49
- };
50
- export var G2PlotInitializer = function G2PlotInitializer(props) {
51
- var item = props.item,
52
- insert = props.insert,
53
- others = _objectWithoutProperties(props, _excluded);
54
-
55
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({}, others), {}, {
56
- onClick: function onClick() {
57
- insert(_objectSpread({}, item.schema));
58
- }
59
- }));
60
- };
61
- export var CustomizeActionInitializer = function CustomizeActionInitializer(props) {
62
- return /*#__PURE__*/React.createElement(BlockInitializer, _objectSpread({}, props));
63
- };
64
- export var InitializerWithSwitch = function InitializerWithSwitch(props) {
65
- var _item$schema;
66
-
67
- var type = props.type,
68
- schema = props.schema,
69
- item = props.item,
70
- insert = props.insert;
71
-
72
- var _useCurrentSchema = useCurrentSchema((schema === null || schema === void 0 ? void 0 : schema[type]) || (item === null || item === void 0 ? void 0 : (_item$schema = item.schema) === null || _item$schema === void 0 ? void 0 : _item$schema[type]), type, item.find, item.remove),
73
- exists = _useCurrentSchema.exists,
74
- remove = _useCurrentSchema.remove;
75
-
76
- return /*#__PURE__*/React.createElement(SchemaInitializer.SwitchItem, {
77
- checked: exists,
78
- title: item.title,
79
- onClick: function onClick() {
80
- var _item$schemaInitializ;
81
-
82
- if (exists) {
83
- return remove();
84
- }
85
-
86
- var s = merge(schema || {}, item.schema || {});
87
- item === null || item === void 0 ? void 0 : (_item$schemaInitializ = item.schemaInitialize) === null || _item$schemaInitializ === void 0 ? void 0 : _item$schemaInitializ.call(item, s);
88
- insert(s);
89
- }
90
- });
91
- };
92
- export var ActionInitializer = function ActionInitializer(props) {
93
- return /*#__PURE__*/React.createElement(InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
94
- type: 'x-action'
95
- }));
96
- };
97
- export var DataBlockInitializer = function DataBlockInitializer(props) {
98
- var templateWrap = props.templateWrap,
99
- onCreateBlockSchema = props.onCreateBlockSchema,
100
- componentType = props.componentType,
101
- createBlockSchema = props.createBlockSchema,
102
- insert = props.insert,
103
- others = _objectWithoutProperties(props, _excluded2);
104
-
105
- var _useSchemaTemplateMan = useSchemaTemplateManager(),
106
- getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
107
-
108
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
109
- icon: /*#__PURE__*/React.createElement(TableOutlined, null)
110
- }, others), {}, {
111
- onClick: function () {
112
- var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
113
- var item, s;
114
- return regeneratorRuntime.wrap(function _callee$(_context) {
115
- while (1) {
116
- switch (_context.prev = _context.next) {
117
- case 0:
118
- item = _ref.item;
119
-
120
- if (!item.template) {
121
- _context.next = 8;
122
- break;
123
- }
124
-
125
- _context.next = 4;
126
- return getTemplateSchemaByMode(item);
127
-
128
- case 4:
129
- s = _context.sent;
130
- templateWrap ? insert(templateWrap(s, {
131
- item: item
132
- })) : insert(s);
133
- _context.next = 9;
134
- break;
135
-
136
- case 8:
137
- if (onCreateBlockSchema) {
138
- onCreateBlockSchema({
139
- item: item
140
- });
141
- } else if (createBlockSchema) {
142
- insert(createBlockSchema({
143
- collection: item.name
144
- }));
145
- }
146
-
147
- case 9:
148
- case "end":
149
- return _context.stop();
150
- }
151
- }
152
- }, _callee);
153
- }));
154
-
155
- function onClick(_x) {
156
- return _onClick.apply(this, arguments);
157
- }
158
-
159
- return onClick;
160
- }(),
161
- items: useCollectionDataSourceItems(componentType)
162
- }));
163
- };
164
- export var TableBlockInitializer = function TableBlockInitializer(props) {
165
- var insert = props.insert;
166
-
167
- var _useCollectionManager = useCollectionManager(),
168
- getCollection = _useCollectionManager.getCollection;
169
-
170
- return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
171
- icon: /*#__PURE__*/React.createElement(TableOutlined, null),
172
- componentType: 'Table',
173
- onCreateBlockSchema: function () {
174
- var _onCreateBlockSchema = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref2) {
175
- var item, collection, schema;
176
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
177
- while (1) {
178
- switch (_context2.prev = _context2.next) {
179
- case 0:
180
- item = _ref2.item;
181
- collection = getCollection(item.name);
182
- schema = createTableBlockSchema({
183
- collection: item.name,
184
- rowKey: collection.filterTargetKey || 'id'
185
- });
186
- insert(schema);
187
-
188
- case 4:
189
- case "end":
190
- return _context2.stop();
191
- }
192
- }
193
- }, _callee2);
194
- }));
195
-
196
- function onCreateBlockSchema(_x2) {
197
- return _onCreateBlockSchema.apply(this, arguments);
198
- }
199
-
200
- return onCreateBlockSchema;
201
- }()
202
- }));
203
- };
204
- export var FormBlockInitializer = function FormBlockInitializer(props) {
205
- return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
206
- icon: /*#__PURE__*/React.createElement(FormOutlined, null),
207
- componentType: 'FormItem',
208
- templateWrap: function templateWrap(templateSchema, _ref3) {
209
- var item = _ref3.item;
210
- var s = createFormBlockSchema({
211
- template: templateSchema,
212
- collection: item.name
213
- });
214
-
215
- if (item.template && item.mode === 'reference') {
216
- s['x-template-key'] = item.template.key;
217
- }
218
-
219
- return s;
220
- },
221
- createBlockSchema: createFormBlockSchema
222
- }));
223
- };
224
- export var DetailsBlockInitializer = function DetailsBlockInitializer(props) {
225
- var insert = props.insert;
226
-
227
- var _useCollectionManager2 = useCollectionManager(),
228
- getCollection = _useCollectionManager2.getCollection;
229
-
230
- return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
231
- icon: /*#__PURE__*/React.createElement(TableOutlined, null),
232
- componentType: 'Details',
233
- onCreateBlockSchema: function () {
234
- var _onCreateBlockSchema2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref4) {
235
- var item, collection, schema;
236
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
237
- while (1) {
238
- switch (_context3.prev = _context3.next) {
239
- case 0:
240
- item = _ref4.item;
241
- collection = getCollection(item.name);
242
- schema = createDetailsBlockSchema({
243
- collection: item.name,
244
- rowKey: collection.filterTargetKey || 'id'
245
- });
246
- insert(schema);
247
-
248
- case 4:
249
- case "end":
250
- return _context3.stop();
251
- }
252
- }
253
- }, _callee3);
254
- }));
255
-
256
- function onCreateBlockSchema(_x3) {
257
- return _onCreateBlockSchema2.apply(this, arguments);
258
- }
259
-
260
- return onCreateBlockSchema;
261
- }()
262
- }));
263
- };
264
- export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
265
- var insert = props.insert;
266
-
267
- var _useTranslation = useTranslation(),
268
- t = _useTranslation.t;
269
-
270
- var _useCollectionManager3 = useCollectionManager(),
271
- getCollection = _useCollectionManager3.getCollection;
272
-
273
- var options = useContext(SchemaOptionsContext);
274
- return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
275
- componentType: 'Calendar',
276
- icon: /*#__PURE__*/React.createElement(FormOutlined, null),
277
- onCreateBlockSchema: function () {
278
- var _onCreateBlockSchema3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref5) {
279
- var _collection$fields, _collection$fields$fi, _collection$fields2, _collection$fields2$f;
280
-
281
- var item, collection, stringFields, dateFields, values;
282
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
283
- while (1) {
284
- switch (_context4.prev = _context4.next) {
285
- case 0:
286
- item = _ref5.item;
287
- collection = getCollection(item.name);
288
- stringFields = collection === null || collection === void 0 ? void 0 : (_collection$fields = collection.fields) === null || _collection$fields === void 0 ? void 0 : (_collection$fields$fi = _collection$fields.filter(function (field) {
289
- return field.type === 'string';
290
- })) === null || _collection$fields$fi === void 0 ? void 0 : _collection$fields$fi.map(function (field) {
291
- var _field$uiSchema;
292
-
293
- return {
294
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title,
295
- value: field.name
296
- };
297
- });
298
- dateFields = collection === null || collection === void 0 ? void 0 : (_collection$fields2 = collection.fields) === null || _collection$fields2 === void 0 ? void 0 : (_collection$fields2$f = _collection$fields2.filter(function (field) {
299
- return field.type === 'date';
300
- })) === null || _collection$fields2$f === void 0 ? void 0 : _collection$fields2$f.map(function (field) {
301
- var _field$uiSchema2;
302
-
303
- return {
304
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title,
305
- value: field.name
306
- };
307
- });
308
- _context4.next = 6;
309
- return FormDialog(t('Create calendar block'), function () {
310
- return /*#__PURE__*/React.createElement(SchemaComponentOptions, {
311
- scope: options.scope,
312
- components: _objectSpread({}, options.components)
313
- }, /*#__PURE__*/React.createElement(FormLayout, {
314
- layout: 'vertical'
315
- }, /*#__PURE__*/React.createElement(SchemaComponent, {
316
- schema: {
317
- properties: {
318
- title: {
319
- title: t('Title field'),
320
- enum: stringFields,
321
- required: true,
322
- 'x-component': 'Select',
323
- 'x-decorator': 'FormItem'
324
- },
325
- start: {
326
- title: t('Start date field'),
327
- enum: dateFields,
328
- required: true,
329
- default: 'createdAt',
330
- 'x-component': 'Select',
331
- 'x-decorator': 'FormItem'
332
- },
333
- end: {
334
- title: t('End date field'),
335
- enum: dateFields,
336
- 'x-component': 'Select',
337
- 'x-decorator': 'FormItem'
338
- }
339
- }
340
- }
341
- })));
342
- }).open({
343
- initialValues: {}
344
- });
345
-
346
- case 6:
347
- values = _context4.sent;
348
- insert(createCalendarBlockSchema({
349
- collection: item.name,
350
- fieldNames: _objectSpread({}, values)
351
- }));
352
-
353
- case 8:
354
- case "end":
355
- return _context4.stop();
356
- }
357
- }
358
- }, _callee4);
359
- }));
360
-
361
- function onCreateBlockSchema(_x4) {
362
- return _onCreateBlockSchema3.apply(this, arguments);
363
- }
364
-
365
- return onCreateBlockSchema;
366
- }()
367
- }));
368
- };
369
- export var KanbanBlockInitializer = function KanbanBlockInitializer(props) {
370
- var insert = props.insert;
371
-
372
- var _useTranslation2 = useTranslation(),
373
- t = _useTranslation2.t;
374
-
375
- var _useCollectionManager4 = useCollectionManager(),
376
- getCollection = _useCollectionManager4.getCollection;
377
-
378
- var options = useContext(SchemaOptionsContext);
379
- var api = useAPIClient();
380
- return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
381
- componentType: 'Kanban',
382
- icon: /*#__PURE__*/React.createElement(FormOutlined, null),
383
- onCreateBlockSchema: function () {
384
- var _onCreateBlockSchema4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref6) {
385
- var _collection$fields3, _collection$fields3$f, _collection$fields4;
386
-
387
- var item, collection, fields, values, sortName, exists;
388
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
389
- while (1) {
390
- switch (_context5.prev = _context5.next) {
391
- case 0:
392
- item = _ref6.item;
393
- collection = getCollection(item.name);
394
- fields = collection === null || collection === void 0 ? void 0 : (_collection$fields3 = collection.fields) === null || _collection$fields3 === void 0 ? void 0 : (_collection$fields3$f = _collection$fields3.filter(function (field) {
395
- return ['select', 'radioGroup'].includes(field.interface);
396
- })) === null || _collection$fields3$f === void 0 ? void 0 : _collection$fields3$f.map(function (field) {
397
- var _field$uiSchema3;
398
-
399
- return {
400
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema3 = field.uiSchema) === null || _field$uiSchema3 === void 0 ? void 0 : _field$uiSchema3.title,
401
- value: field.name,
402
- uiSchema: _objectSpread(_objectSpread({}, field.uiSchema), {}, {
403
- name: field.name
404
- })
405
- };
406
- });
407
- _context5.next = 5;
408
- return FormDialog(t('Create kanban block'), function () {
409
- return /*#__PURE__*/React.createElement(SchemaComponentOptions, {
410
- scope: options.scope,
411
- components: _objectSpread({}, options.components)
412
- }, /*#__PURE__*/React.createElement(FormLayout, {
413
- layout: 'vertical'
414
- }, /*#__PURE__*/React.createElement(SchemaComponent, {
415
- schema: {
416
- properties: {
417
- groupField: {
418
- title: t('Grouping field'),
419
- enum: fields,
420
- required: true,
421
- description: '{{t("Single select and radio fields can be used as the grouping field")}}',
422
- 'x-component': 'Select',
423
- 'x-component-props': {
424
- objectValue: true,
425
- fieldNames: {
426
- label: 'label',
427
- value: 'value'
428
- }
429
- },
430
- 'x-decorator': 'FormItem'
431
- }
432
- }
433
- }
434
- })));
435
- }).open({
436
- initialValues: {}
437
- });
438
-
439
- case 5:
440
- values = _context5.sent;
441
- sortName = "".concat(values.groupField.value, "_sort");
442
- exists = collection === null || collection === void 0 ? void 0 : (_collection$fields4 = collection.fields) === null || _collection$fields4 === void 0 ? void 0 : _collection$fields4.find(function (field) {
443
- return field.name === sortName;
444
- });
445
-
446
- if (exists) {
447
- _context5.next = 11;
448
- break;
449
- }
450
-
451
- _context5.next = 11;
452
- return api.resource('collections.fields', item.name).create({
453
- values: {
454
- type: 'sort',
455
- name: sortName,
456
- hidden: true,
457
- scopeKey: values.groupField.value
458
- }
459
- });
460
-
461
- case 11:
462
- insert(createKanbanBlockSchema({
463
- groupField: values.groupField.value,
464
- collection: item.name,
465
- params: {
466
- sort: [sortName],
467
- paginate: false
468
- }
469
- }));
470
-
471
- case 12:
472
- case "end":
473
- return _context5.stop();
474
- }
475
- }
476
- }, _callee5);
477
- }));
478
-
479
- function onCreateBlockSchema(_x5) {
480
- return _onCreateBlockSchema4.apply(this, arguments);
481
- }
482
-
483
- return onCreateBlockSchema;
484
- }()
485
- }));
486
- };
487
- export var MarkdownBlockInitializer = function MarkdownBlockInitializer(props) {
488
- var insert = props.insert;
489
-
490
- var _useTranslation3 = useTranslation(),
491
- t = _useTranslation3.t;
492
-
493
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({}, props), {}, {
494
- icon: /*#__PURE__*/React.createElement(FormOutlined, null),
495
- onClick: function onClick() {
496
- insert({
497
- type: 'void',
498
- 'x-designer': 'Markdown.Void.Designer',
499
- 'x-decorator': 'CardItem',
500
- 'x-component': 'Markdown.Void',
501
- 'x-editable': false,
502
- 'x-component-props': {
503
- content: t('This is a demo text, **supports Markdown syntax**.')
504
- }
505
- });
506
- }
507
- }));
508
- };
509
- export var FilterActionInitializer = function FilterActionInitializer(props) {
510
- var schema = {
511
- type: 'void',
512
- title: '{{ t("Filter") }}',
513
- 'x-action': 'filter',
514
- 'x-designer': 'Filter.Action.Designer',
515
- 'x-component': 'Filter.Action',
516
- 'x-component-props': {
517
- icon: 'FilterOutlined',
518
- useProps: '{{ useFilterActionProps }}'
519
- }
520
- };
521
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
522
- schema: schema
523
- }));
524
- };
525
- export var CreateActionInitializer = function CreateActionInitializer(props) {
526
- var schema = {
527
- type: 'void',
528
- title: '{{ t("Add new") }}',
529
- 'x-action': 'create',
530
- 'x-designer': 'Action.Designer',
531
- 'x-component': 'Action',
532
- 'x-component-props': {
533
- icon: 'PlusOutlined',
534
- openMode: 'drawer',
535
- type: 'primary'
536
- },
537
- properties: {
538
- drawer: {
539
- type: 'void',
540
- title: '{{ t("Add record") }}',
541
- 'x-component': 'Action.Container',
542
- 'x-component-props': {
543
- className: 'nb-action-popup'
544
- },
545
- properties: {
546
- tabs: {
547
- type: 'void',
548
- 'x-component': 'Tabs',
549
- 'x-component-props': {},
550
- 'x-initializer': 'TabPaneInitializers',
551
- properties: {
552
- tab1: {
553
- type: 'void',
554
- title: '{{t("Add new")}}',
555
- 'x-component': 'Tabs.TabPane',
556
- 'x-designer': 'Tabs.Designer',
557
- 'x-component-props': {},
558
- properties: {
559
- grid: {
560
- type: 'void',
561
- 'x-component': 'Grid',
562
- 'x-initializer': 'CreateFormBlockInitializers',
563
- properties: {}
564
- }
565
- }
566
- }
567
- }
568
- }
569
- }
570
- }
571
- }
572
- };
573
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
574
- schema: schema
575
- }));
576
- };
577
- export var ViewActionInitializer = function ViewActionInitializer(props) {
578
- var schema = {
579
- type: 'void',
580
- title: '{{ t("View") }}',
581
- 'x-action': 'view',
582
- 'x-designer': 'Action.Designer',
583
- 'x-component': 'Action',
584
- 'x-component-props': {
585
- openMode: 'drawer'
586
- },
587
- properties: {
588
- drawer: {
589
- type: 'void',
590
- title: '{{ t("View record") }}',
591
- 'x-component': 'Action.Container',
592
- 'x-component-props': {
593
- className: 'nb-action-popup'
594
- },
595
- properties: {
596
- tabs: {
597
- type: 'void',
598
- 'x-component': 'Tabs',
599
- 'x-component-props': {},
600
- 'x-initializer': 'TabPaneInitializers',
601
- properties: {
602
- tab1: {
603
- type: 'void',
604
- title: '{{t("Details")}}',
605
- 'x-component': 'Tabs.TabPane',
606
- 'x-designer': 'Tabs.Designer',
607
- 'x-component-props': {},
608
- properties: {
609
- grid: {
610
- type: 'void',
611
- 'x-component': 'Grid',
612
- 'x-initializer': 'RecordBlockInitializers',
613
- properties: {}
614
- }
615
- }
616
- }
617
- }
618
- }
619
- }
620
- }
621
- }
622
- };
623
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
624
- schema: schema
625
- }));
626
- };
627
- export var UpdateActionInitializer = function UpdateActionInitializer(props) {
628
- var schema = {
629
- type: 'void',
630
- title: '{{ t("Edit") }}',
631
- 'x-action': 'update',
632
- 'x-designer': 'Action.Designer',
633
- 'x-component': 'Action',
634
- 'x-component-props': {
635
- openMode: 'drawer',
636
- icon: 'EditOutlined'
637
- },
638
- properties: {
639
- drawer: {
640
- type: 'void',
641
- title: '{{ t("Edit record") }}',
642
- 'x-component': 'Action.Container',
643
- 'x-component-props': {
644
- className: 'nb-action-popup'
645
- },
646
- properties: {
647
- tabs: {
648
- type: 'void',
649
- 'x-component': 'Tabs',
650
- 'x-component-props': {},
651
- 'x-initializer': 'TabPaneInitializers',
652
- properties: {
653
- tab1: {
654
- type: 'void',
655
- title: '{{t("Edit")}}',
656
- 'x-component': 'Tabs.TabPane',
657
- 'x-designer': 'Tabs.Designer',
658
- 'x-component-props': {},
659
- properties: {
660
- grid: {
661
- type: 'void',
662
- 'x-component': 'Grid',
663
- 'x-initializer': 'RecordBlockInitializers',
664
- properties: {}
665
- }
666
- }
667
- }
668
- }
669
- }
670
- }
671
- }
672
- }
673
- };
674
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
675
- schema: schema
676
- }));
677
- };
678
- export var DestroyActionInitializer = function DestroyActionInitializer(props) {
679
- var schema = {
680
- title: '{{ t("Delete") }}',
681
- 'x-action': 'destroy',
682
- 'x-component': 'Action',
683
- 'x-designer': 'Action.Designer',
684
- 'x-component-props': {
685
- icon: 'DeleteOutlined',
686
- confirm: {
687
- title: "{{t('Delete record')}}",
688
- content: "{{t('Are you sure you want to delete it?')}}"
689
- },
690
- useProps: '{{ useDestroyActionProps }}'
691
- }
692
- };
693
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
694
- schema: schema
695
- }));
696
- };
697
- export var PrintActionInitializer = function PrintActionInitializer(props) {
698
- var schema = {
699
- title: '{{ t("Print") }}',
700
- 'x-action': 'print',
701
- 'x-component': 'Action',
702
- 'x-designer': 'Action.Designer',
703
- 'x-component-props': {
704
- icon: 'PrinterOutlined',
705
- useProps: '{{ useDetailPrintActionProps }}'
706
- }
707
- };
708
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
709
- schema: schema
710
- }));
711
- };
712
- export var BulkDestroyActionInitializer = function BulkDestroyActionInitializer(props) {
713
- var schema = {
714
- title: '{{ t("Delete") }}',
715
- 'x-action': 'destroy',
716
- 'x-component': 'Action',
717
- 'x-designer': 'Action.Designer',
718
- 'x-component-props': {
719
- icon: 'DeleteOutlined',
720
- confirm: {
721
- title: "{{t('Delete record')}}",
722
- content: "{{t('Are you sure you want to delete it?')}}"
723
- },
724
- useProps: '{{ useBulkDestroyActionProps }}'
725
- }
726
- };
727
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
728
- schema: schema
729
- }));
730
- };
731
- export var RefreshActionInitializer = function RefreshActionInitializer(props) {
732
- var schema = {
733
- title: '{{ t("Refresh") }}',
734
- 'x-action': 'refresh',
735
- 'x-component': 'Action',
736
- 'x-designer': 'Action.Designer',
737
- 'x-component-props': {
738
- icon: 'ReloadOutlined',
739
- useProps: '{{ useRefreshActionProps }}'
740
- }
741
- };
742
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
743
- schema: schema
744
- }));
745
- };
746
- export var SubmitActionInitializer = function SubmitActionInitializer(props) {
747
- var schema = {
748
- title: '{{ t("Submit") }}',
749
- 'x-action': 'submit',
750
- 'x-component': 'Action',
751
- 'x-designer': 'Action.Designer',
752
- 'x-component-props': {
753
- type: 'primary',
754
- htmlType: 'submit' // useProps: '{{ bp.useSubmitActionProps }}',
755
-
756
- }
757
- };
758
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
759
- schema: schema
760
- }));
761
- };
762
- export var CreateSubmitActionInitializer = function CreateSubmitActionInitializer(props) {
763
- var schema = {
764
- title: '{{ t("Submit") }}',
765
- 'x-action': 'submit',
766
- 'x-component': 'Action',
767
- 'x-designer': 'Action.Designer',
768
- 'x-component-props': {
769
- type: 'primary',
770
- htmlType: 'submit',
771
- useProps: '{{ useCreateActionProps }}'
772
- }
773
- };
774
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
775
- schema: schema
776
- }));
777
- };
778
- export var UpdateSubmitActionInitializer = function UpdateSubmitActionInitializer(props) {
779
- var schema = {
780
- title: '{{ t("Submit") }}',
781
- 'x-action': 'submit',
782
- 'x-component': 'Action',
783
- 'x-designer': 'Action.Designer',
784
- 'x-component-props': {
785
- type: 'primary',
786
- htmlType: 'submit',
787
- useProps: '{{ useUpdateActionProps }}'
788
- }
789
- };
790
- return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
791
- schema: schema
792
- }));
793
- };
794
- export var CreateFormBlockInitializer = function CreateFormBlockInitializer(props) {
795
- var onCreateBlockSchema = props.onCreateBlockSchema,
796
- componentType = props.componentType,
797
- createBlockSchema = props.createBlockSchema,
798
- insert = props.insert,
799
- others = _objectWithoutProperties(props, _excluded3);
800
-
801
- var _useSchemaTemplateMan2 = useSchemaTemplateManager(),
802
- getTemplateSchemaByMode = _useSchemaTemplateMan2.getTemplateSchemaByMode;
803
-
804
- var association = useBlockAssociationContext();
805
- var collection = useCollection();
806
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
807
- icon: /*#__PURE__*/React.createElement(FormOutlined, null)
808
- }, others), {}, {
809
- onClick: function () {
810
- var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(_ref7) {
811
- var item, s, blockSchema;
812
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
813
- while (1) {
814
- switch (_context6.prev = _context6.next) {
815
- case 0:
816
- item = _ref7.item;
817
-
818
- if (!item.template) {
819
- _context6.next = 8;
820
- break;
821
- }
822
-
823
- _context6.next = 4;
824
- return getTemplateSchemaByMode(item);
825
-
826
- case 4:
827
- s = _context6.sent;
828
-
829
- if (item.template.componentName === 'FormItem') {
830
- blockSchema = createFormBlockSchema({
831
- actionInitializers: 'CreateFormActionInitializers',
832
- association: association,
833
- collection: collection.name,
834
- template: s
835
- });
836
-
837
- if (item.mode === 'reference') {
838
- blockSchema['x-template-key'] = item.template.key;
839
- }
840
-
841
- insert(blockSchema);
842
- } else {
843
- insert(s);
844
- }
845
-
846
- _context6.next = 9;
847
- break;
848
-
849
- case 8:
850
- insert(createFormBlockSchema({
851
- actionInitializers: 'CreateFormActionInitializers',
852
- association: association,
853
- collection: collection.name
854
- }));
855
-
856
- case 9:
857
- case "end":
858
- return _context6.stop();
859
- }
860
- }
861
- }, _callee6);
862
- }));
863
-
864
- function onClick(_x6) {
865
- return _onClick2.apply(this, arguments);
866
- }
867
-
868
- return onClick;
869
- }(),
870
- items: useRecordCollectionDataSourceItems('FormItem')
871
- }));
872
- };
873
- export var RecordFormBlockInitializer = function RecordFormBlockInitializer(props) {
874
- var onCreateBlockSchema = props.onCreateBlockSchema,
875
- componentType = props.componentType,
876
- createBlockSchema = props.createBlockSchema,
877
- insert = props.insert,
878
- others = _objectWithoutProperties(props, _excluded4);
879
-
880
- var _useSchemaTemplateMan3 = useSchemaTemplateManager(),
881
- getTemplateSchemaByMode = _useSchemaTemplateMan3.getTemplateSchemaByMode;
882
-
883
- var collection = useCollection();
884
- var association = useBlockAssociationContext();
885
- console.log('RecordFormBlockInitializer', collection, association);
886
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
887
- icon: /*#__PURE__*/React.createElement(FormOutlined, null)
888
- }, others), {}, {
889
- onClick: function () {
890
- var _onClick3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(_ref8) {
891
- var item, s, blockSchema;
892
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
893
- while (1) {
894
- switch (_context7.prev = _context7.next) {
895
- case 0:
896
- item = _ref8.item;
897
-
898
- if (!item.template) {
899
- _context7.next = 8;
900
- break;
901
- }
902
-
903
- _context7.next = 4;
904
- return getTemplateSchemaByMode(item);
905
-
906
- case 4:
907
- s = _context7.sent;
908
-
909
- if (item.template.componentName === 'FormItem') {
910
- blockSchema = createFormBlockSchema({
911
- association: association,
912
- collection: collection.name,
913
- action: 'get',
914
- useSourceId: '{{ useSourceIdFromParentRecord }}',
915
- useParams: '{{ useParamsFromRecord }}',
916
- actionInitializers: 'UpdateFormActionInitializers',
917
- template: s
918
- });
919
-
920
- if (item.mode === 'reference') {
921
- blockSchema['x-template-key'] = item.template.key;
922
- }
923
-
924
- insert(blockSchema);
925
- } else {
926
- insert(s);
927
- }
928
-
929
- _context7.next = 9;
930
- break;
931
-
932
- case 8:
933
- insert(createFormBlockSchema({
934
- association: association,
935
- collection: collection.name,
936
- action: 'get',
937
- useSourceId: '{{ useSourceIdFromParentRecord }}',
938
- useParams: '{{ useParamsFromRecord }}',
939
- actionInitializers: 'UpdateFormActionInitializers'
940
- }));
941
-
942
- case 9:
943
- case "end":
944
- return _context7.stop();
945
- }
946
- }
947
- }, _callee7);
948
- }));
949
-
950
- function onClick(_x7) {
951
- return _onClick3.apply(this, arguments);
952
- }
953
-
954
- return onClick;
955
- }(),
956
- items: useRecordCollectionDataSourceItems('FormItem')
957
- }));
958
- };
959
- export var RecordReadPrettyFormBlockInitializer = function RecordReadPrettyFormBlockInitializer(props) {
960
- var onCreateBlockSchema = props.onCreateBlockSchema,
961
- componentType = props.componentType,
962
- createBlockSchema = props.createBlockSchema,
963
- insert = props.insert,
964
- others = _objectWithoutProperties(props, _excluded5);
965
-
966
- var _useSchemaTemplateMan4 = useSchemaTemplateManager(),
967
- getTemplateSchemaByMode = _useSchemaTemplateMan4.getTemplateSchemaByMode;
968
-
969
- var collection = useCollection();
970
- var association = useBlockAssociationContext();
971
-
972
- var _useBlockRequestConte = useBlockRequestContext(),
973
- block = _useBlockRequestConte.block;
974
-
975
- var actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
976
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
977
- icon: /*#__PURE__*/React.createElement(FormOutlined, null)
978
- }, others), {}, {
979
- key: '123',
980
- onClick: function () {
981
- var _onClick4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(_ref9) {
982
- var item, s, blockSchema;
983
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
984
- while (1) {
985
- switch (_context8.prev = _context8.next) {
986
- case 0:
987
- item = _ref9.item;
988
-
989
- if (!item.template) {
990
- _context8.next = 8;
991
- break;
992
- }
993
-
994
- _context8.next = 4;
995
- return getTemplateSchemaByMode(item);
996
-
997
- case 4:
998
- s = _context8.sent;
999
-
1000
- if (item.template.componentName === 'ReadPrettyFormItem') {
1001
- blockSchema = createReadPrettyFormBlockSchema({
1002
- actionInitializers: actionInitializers,
1003
- association: association,
1004
- collection: collection.name,
1005
- action: 'get',
1006
- useSourceId: '{{ useSourceIdFromParentRecord }}',
1007
- useParams: '{{ useParamsFromRecord }}',
1008
- template: s
1009
- });
1010
-
1011
- if (item.mode === 'reference') {
1012
- blockSchema['x-template-key'] = item.template.key;
1013
- }
1014
-
1015
- insert(blockSchema);
1016
- } else {
1017
- insert(s);
1018
- }
1019
-
1020
- _context8.next = 9;
1021
- break;
1022
-
1023
- case 8:
1024
- insert(createReadPrettyFormBlockSchema({
1025
- actionInitializers: actionInitializers,
1026
- association: association,
1027
- collection: collection.name,
1028
- action: 'get',
1029
- useSourceId: '{{ useSourceIdFromParentRecord }}',
1030
- useParams: '{{ useParamsFromRecord }}'
1031
- }));
1032
-
1033
- case 9:
1034
- case "end":
1035
- return _context8.stop();
1036
- }
1037
- }
1038
- }, _callee8);
1039
- }));
1040
-
1041
- function onClick(_x8) {
1042
- return _onClick4.apply(this, arguments);
1043
- }
1044
-
1045
- return onClick;
1046
- }(),
1047
- items: useRecordCollectionDataSourceItems('ReadPrettyFormItem')
1048
- }));
1049
- };
1050
- export var RecordAssociationFormBlockInitializer = function RecordAssociationFormBlockInitializer(props) {
1051
- var item = props.item,
1052
- onCreateBlockSchema = props.onCreateBlockSchema,
1053
- componentType = props.componentType,
1054
- createBlockSchema = props.createBlockSchema,
1055
- insert = props.insert,
1056
- others = _objectWithoutProperties(props, _excluded6);
1057
-
1058
- var _useSchemaTemplateMan5 = useSchemaTemplateManager(),
1059
- getTemplateSchemaByMode = _useSchemaTemplateMan5.getTemplateSchemaByMode;
1060
-
1061
- var field = item.field;
1062
- var collection = field.target;
1063
- var resource = "".concat(field.collectionName, ".").concat(field.name);
1064
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
1065
- icon: /*#__PURE__*/React.createElement(FormOutlined, null)
1066
- }, others), {}, {
1067
- onClick: function () {
1068
- var _onClick5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(_ref10) {
1069
- var item, action, actionInitializers, s, blockSchema;
1070
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
1071
- while (1) {
1072
- switch (_context9.prev = _context9.next) {
1073
- case 0:
1074
- item = _ref10.item;
1075
- action = ['hasOne', 'belongsTo'].includes(field.type) ? 'get' : null;
1076
- actionInitializers = ['hasOne', 'belongsTo'].includes(field.type) ? 'UpdateFormActionInitializers' : 'CreateFormActionInitializers';
1077
-
1078
- if (!item.template) {
1079
- _context9.next = 10;
1080
- break;
1081
- }
1082
-
1083
- _context9.next = 6;
1084
- return getTemplateSchemaByMode(item);
1085
-
1086
- case 6:
1087
- s = _context9.sent;
1088
-
1089
- if (item.template.componentName === 'FormItem') {
1090
- blockSchema = createFormBlockSchema({
1091
- collection: collection,
1092
- resource: resource,
1093
- association: resource,
1094
- action: action,
1095
- useSourceId: '{{ useSourceIdFromParentRecord }}',
1096
- useParams: '{{ useParamsFromRecord }}',
1097
- actionInitializers: actionInitializers,
1098
- template: s
1099
- });
1100
-
1101
- if (item.mode === 'reference') {
1102
- blockSchema['x-template-key'] = item.template.key;
1103
- }
1104
-
1105
- insert(blockSchema);
1106
- } else {
1107
- insert(s);
1108
- }
1109
-
1110
- _context9.next = 11;
1111
- break;
1112
-
1113
- case 10:
1114
- insert(createFormBlockSchema({
1115
- collection: collection,
1116
- resource: resource,
1117
- association: resource,
1118
- action: action,
1119
- useSourceId: '{{ useSourceIdFromParentRecord }}',
1120
- useParams: '{{ useParamsFromRecord }}',
1121
- actionInitializers: actionInitializers
1122
- }));
1123
-
1124
- case 11:
1125
- case "end":
1126
- return _context9.stop();
1127
- }
1128
- }
1129
- }, _callee9);
1130
- }));
1131
-
1132
- function onClick(_x9) {
1133
- return _onClick5.apply(this, arguments);
1134
- }
1135
-
1136
- return onClick;
1137
- }(),
1138
- items: useRecordCollectionDataSourceItems('FormItem', item, collection, resource)
1139
- }));
1140
- };
1141
- export var RecordReadPrettyAssociationFormBlockInitializer = function RecordReadPrettyAssociationFormBlockInitializer(props) {
1142
- var item = props.item,
1143
- onCreateBlockSchema = props.onCreateBlockSchema,
1144
- componentType = props.componentType,
1145
- createBlockSchema = props.createBlockSchema,
1146
- insert = props.insert,
1147
- others = _objectWithoutProperties(props, _excluded7);
1148
-
1149
- var _useSchemaTemplateMan6 = useSchemaTemplateManager(),
1150
- getTemplateSchemaByMode = _useSchemaTemplateMan6.getTemplateSchemaByMode;
1151
-
1152
- var field = item.field;
1153
- var collection = field.target;
1154
- var resource = "".concat(field.collectionName, ".").concat(field.name);
1155
-
1156
- var _useBlockRequestConte2 = useBlockRequestContext(),
1157
- block = _useBlockRequestConte2.block;
1158
-
1159
- var actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
1160
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
1161
- icon: /*#__PURE__*/React.createElement(FormOutlined, null)
1162
- }, others), {}, {
1163
- onClick: function () {
1164
- var _onClick6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(_ref11) {
1165
- var item, s, blockSchema;
1166
- return regeneratorRuntime.wrap(function _callee10$(_context10) {
1167
- while (1) {
1168
- switch (_context10.prev = _context10.next) {
1169
- case 0:
1170
- item = _ref11.item;
1171
-
1172
- if (!item.template) {
1173
- _context10.next = 8;
1174
- break;
1175
- }
1176
-
1177
- _context10.next = 4;
1178
- return getTemplateSchemaByMode(item);
1179
-
1180
- case 4:
1181
- s = _context10.sent;
1182
-
1183
- if (item.template.componentName === 'ReadPrettyFormItem') {
1184
- blockSchema = createReadPrettyFormBlockSchema({
1185
- actionInitializers: actionInitializers,
1186
- collection: collection,
1187
- resource: resource,
1188
- association: resource,
1189
- action: 'get',
1190
- useSourceId: '{{ useSourceIdFromParentRecord }}',
1191
- useParams: '{{ useParamsFromRecord }}',
1192
- template: s
1193
- });
1194
-
1195
- if (item.mode === 'reference') {
1196
- blockSchema['x-template-key'] = item.template.key;
1197
- }
1198
-
1199
- insert(blockSchema);
1200
- } else {
1201
- insert(s);
1202
- }
1203
-
1204
- _context10.next = 9;
1205
- break;
1206
-
1207
- case 8:
1208
- insert(createReadPrettyFormBlockSchema({
1209
- actionInitializers: actionInitializers,
1210
- collection: collection,
1211
- resource: resource,
1212
- association: resource,
1213
- action: 'get',
1214
- useSourceId: '{{ useSourceIdFromParentRecord }}',
1215
- useParams: '{{ useParamsFromRecord }}'
1216
- }));
1217
-
1218
- case 9:
1219
- case "end":
1220
- return _context10.stop();
1221
- }
1222
- }
1223
- }, _callee10);
1224
- }));
1225
-
1226
- function onClick(_x10) {
1227
- return _onClick6.apply(this, arguments);
1228
- }
1229
-
1230
- return onClick;
1231
- }(),
1232
- items: useRecordCollectionDataSourceItems('ReadPrettyFormItem', item, collection, resource)
1233
- }));
1234
- };
1235
- export var RecordAssociationDetailsBlockInitializer = function RecordAssociationDetailsBlockInitializer(props) {
1236
- var item = props.item,
1237
- onCreateBlockSchema = props.onCreateBlockSchema,
1238
- componentType = props.componentType,
1239
- createBlockSchema = props.createBlockSchema,
1240
- insert = props.insert,
1241
- others = _objectWithoutProperties(props, _excluded8);
1242
-
1243
- var _useSchemaTemplateMan7 = useSchemaTemplateManager(),
1244
- getTemplateSchemaByMode = _useSchemaTemplateMan7.getTemplateSchemaByMode;
1245
-
1246
- var _useCollectionManager5 = useCollectionManager(),
1247
- getCollection = _useCollectionManager5.getCollection;
1248
-
1249
- var field = item.field;
1250
- var collection = getCollection(field.target);
1251
- var resource = "".concat(field.collectionName, ".").concat(field.name);
1252
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
1253
- icon: /*#__PURE__*/React.createElement(FormOutlined, null)
1254
- }, others), {}, {
1255
- onClick: function () {
1256
- var _onClick7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(_ref12) {
1257
- var item, s;
1258
- return regeneratorRuntime.wrap(function _callee11$(_context11) {
1259
- while (1) {
1260
- switch (_context11.prev = _context11.next) {
1261
- case 0:
1262
- item = _ref12.item;
1263
-
1264
- if (!item.template) {
1265
- _context11.next = 8;
1266
- break;
1267
- }
1268
-
1269
- _context11.next = 4;
1270
- return getTemplateSchemaByMode(item);
1271
-
1272
- case 4:
1273
- s = _context11.sent;
1274
- insert(s);
1275
- _context11.next = 9;
1276
- break;
1277
-
1278
- case 8:
1279
- insert(createDetailsBlockSchema({
1280
- collection: field.target,
1281
- resource: resource,
1282
- association: resource,
1283
- rowKey: collection.filterTargetKey || 'id'
1284
- }));
1285
-
1286
- case 9:
1287
- case "end":
1288
- return _context11.stop();
1289
- }
1290
- }
1291
- }, _callee11);
1292
- }));
1293
-
1294
- function onClick(_x11) {
1295
- return _onClick7.apply(this, arguments);
1296
- }
1297
-
1298
- return onClick;
1299
- }(),
1300
- items: useRecordCollectionDataSourceItems('Details', item, field.target, resource)
1301
- }));
1302
- };
1303
- export var RecordAssociationCalendarBlockInitializer = function RecordAssociationCalendarBlockInitializer(props) {
1304
- var item = props.item,
1305
- onCreateBlockSchema = props.onCreateBlockSchema,
1306
- componentType = props.componentType,
1307
- createBlockSchema = props.createBlockSchema,
1308
- insert = props.insert,
1309
- others = _objectWithoutProperties(props, _excluded9);
1310
-
1311
- var _useSchemaTemplateMan8 = useSchemaTemplateManager(),
1312
- getTemplateSchemaByMode = _useSchemaTemplateMan8.getTemplateSchemaByMode;
1313
-
1314
- var _useTranslation4 = useTranslation(),
1315
- t = _useTranslation4.t;
1316
-
1317
- var options = useContext(SchemaOptionsContext);
1318
-
1319
- var _useCollectionManager6 = useCollectionManager(),
1320
- getCollection = _useCollectionManager6.getCollection;
1321
-
1322
- var field = item.field;
1323
- var collection = getCollection(field.target);
1324
- var resource = "".concat(field.collectionName, ".").concat(field.name);
1325
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
1326
- icon: /*#__PURE__*/React.createElement(TableOutlined, null)
1327
- }, others), {}, {
1328
- onClick: function () {
1329
- var _onClick8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(_ref13) {
1330
- var item, s, _collection$fields5, _collection$fields5$f, _collection$fields6, _collection$fields6$f, stringFields, dateFields, values;
1331
-
1332
- return regeneratorRuntime.wrap(function _callee12$(_context12) {
1333
- while (1) {
1334
- switch (_context12.prev = _context12.next) {
1335
- case 0:
1336
- item = _ref13.item;
1337
-
1338
- if (!item.template) {
1339
- _context12.next = 8;
1340
- break;
1341
- }
1342
-
1343
- _context12.next = 4;
1344
- return getTemplateSchemaByMode(item);
1345
-
1346
- case 4:
1347
- s = _context12.sent;
1348
- insert(s);
1349
- _context12.next = 14;
1350
- break;
1351
-
1352
- case 8:
1353
- stringFields = collection === null || collection === void 0 ? void 0 : (_collection$fields5 = collection.fields) === null || _collection$fields5 === void 0 ? void 0 : (_collection$fields5$f = _collection$fields5.filter(function (field) {
1354
- return field.type === 'string';
1355
- })) === null || _collection$fields5$f === void 0 ? void 0 : _collection$fields5$f.map(function (field) {
1356
- var _field$uiSchema4;
1357
-
1358
- return {
1359
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema4 = field.uiSchema) === null || _field$uiSchema4 === void 0 ? void 0 : _field$uiSchema4.title,
1360
- value: field.name
1361
- };
1362
- });
1363
- dateFields = collection === null || collection === void 0 ? void 0 : (_collection$fields6 = collection.fields) === null || _collection$fields6 === void 0 ? void 0 : (_collection$fields6$f = _collection$fields6.filter(function (field) {
1364
- return field.type === 'date';
1365
- })) === null || _collection$fields6$f === void 0 ? void 0 : _collection$fields6$f.map(function (field) {
1366
- var _field$uiSchema5;
1367
-
1368
- return {
1369
- label: field === null || field === void 0 ? void 0 : (_field$uiSchema5 = field.uiSchema) === null || _field$uiSchema5 === void 0 ? void 0 : _field$uiSchema5.title,
1370
- value: field.name
1371
- };
1372
- });
1373
- _context12.next = 12;
1374
- return FormDialog(t('Create calendar block'), function () {
1375
- return /*#__PURE__*/React.createElement(SchemaComponentOptions, {
1376
- scope: options.scope,
1377
- components: _objectSpread({}, options.components)
1378
- }, /*#__PURE__*/React.createElement(FormLayout, {
1379
- layout: 'vertical'
1380
- }, /*#__PURE__*/React.createElement(SchemaComponent, {
1381
- schema: {
1382
- properties: {
1383
- title: {
1384
- title: t('Title field'),
1385
- enum: stringFields,
1386
- required: true,
1387
- 'x-component': 'Select',
1388
- 'x-decorator': 'FormItem'
1389
- },
1390
- start: {
1391
- title: t('Start date field'),
1392
- enum: dateFields,
1393
- required: true,
1394
- default: 'createdAt',
1395
- 'x-component': 'Select',
1396
- 'x-decorator': 'FormItem'
1397
- },
1398
- end: {
1399
- title: t('End date field'),
1400
- enum: dateFields,
1401
- 'x-component': 'Select',
1402
- 'x-decorator': 'FormItem'
1403
- }
1404
- }
1405
- }
1406
- })));
1407
- }).open({
1408
- initialValues: {}
1409
- });
1410
-
1411
- case 12:
1412
- values = _context12.sent;
1413
- insert(createCalendarBlockSchema({
1414
- collection: field.target,
1415
- resource: resource,
1416
- association: resource,
1417
- fieldNames: _objectSpread({}, values)
1418
- }));
1419
-
1420
- case 14:
1421
- case "end":
1422
- return _context12.stop();
1423
- }
1424
- }
1425
- }, _callee12);
1426
- }));
1427
-
1428
- function onClick(_x12) {
1429
- return _onClick8.apply(this, arguments);
1430
- }
1431
-
1432
- return onClick;
1433
- }(),
1434
- items: useRecordCollectionDataSourceItems('Calendar', item, field.target, resource)
1435
- }));
1436
- };
1437
- export var RecordAssociationBlockInitializer = function RecordAssociationBlockInitializer(props) {
1438
- var item = props.item,
1439
- onCreateBlockSchema = props.onCreateBlockSchema,
1440
- componentType = props.componentType,
1441
- createBlockSchema = props.createBlockSchema,
1442
- insert = props.insert,
1443
- others = _objectWithoutProperties(props, _excluded10);
1444
-
1445
- var _useSchemaTemplateMan9 = useSchemaTemplateManager(),
1446
- getTemplateSchemaByMode = _useSchemaTemplateMan9.getTemplateSchemaByMode;
1447
-
1448
- var _useCollectionManager7 = useCollectionManager(),
1449
- getCollection = _useCollectionManager7.getCollection;
1450
-
1451
- var field = item.field;
1452
- var collection = getCollection(field.target);
1453
- var resource = "".concat(field.collectionName, ".").concat(field.name);
1454
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
1455
- icon: /*#__PURE__*/React.createElement(TableOutlined, null)
1456
- }, others), {}, {
1457
- onClick: function () {
1458
- var _onClick9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(_ref14) {
1459
- var item, s;
1460
- return regeneratorRuntime.wrap(function _callee13$(_context13) {
1461
- while (1) {
1462
- switch (_context13.prev = _context13.next) {
1463
- case 0:
1464
- item = _ref14.item;
1465
-
1466
- if (!item.template) {
1467
- _context13.next = 8;
1468
- break;
1469
- }
1470
-
1471
- _context13.next = 4;
1472
- return getTemplateSchemaByMode(item);
1473
-
1474
- case 4:
1475
- s = _context13.sent;
1476
- insert(s);
1477
- _context13.next = 9;
1478
- break;
1479
-
1480
- case 8:
1481
- insert(createTableBlockSchema({
1482
- rowKey: collection.filterTargetKey,
1483
- collection: field.target,
1484
- resource: resource,
1485
- association: resource
1486
- }));
1487
-
1488
- case 9:
1489
- case "end":
1490
- return _context13.stop();
1491
- }
1492
- }
1493
- }, _callee13);
1494
- }));
1495
-
1496
- function onClick(_x13) {
1497
- return _onClick9.apply(this, arguments);
1498
- }
1499
-
1500
- return onClick;
1501
- }(),
1502
- items: useRecordCollectionDataSourceItems('Table', item, field.target, resource)
1503
- }));
1504
- };
1505
- export var TableActionColumnInitializer = function TableActionColumnInitializer(props) {
1506
- var schema = {
1507
- type: 'void',
1508
- title: '{{ t("Actions") }}',
1509
- 'x-decorator': 'TableV2.Column.ActionBar',
1510
- 'x-component': 'TableV2.Column',
1511
- 'x-designer': 'TableV2.ActionColumnDesigner',
1512
- 'x-initializer': 'TableActionColumnInitializers',
1513
- 'x-action-column': 'actions',
1514
- properties: {
1515
- actions: {
1516
- type: 'void',
1517
- 'x-decorator': 'DndContext',
1518
- 'x-component': 'Space',
1519
- 'x-component-props': {
1520
- split: '|'
1521
- },
1522
- properties: {}
1523
- }
1524
- }
1525
- };
1526
- return /*#__PURE__*/React.createElement(InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
1527
- schema: schema,
1528
- type: 'x-action-column'
1529
- }));
1530
- };
1531
- export var TableCollectionFieldInitializer = function TableCollectionFieldInitializer(props) {
1532
- var schema = {};
1533
- return /*#__PURE__*/React.createElement(InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
1534
- schema: schema,
1535
- type: 'x-collection-field'
1536
- }));
1537
- };
1538
- export var CollectionFieldInitializer = function CollectionFieldInitializer(props) {
1539
- var schema = {};
1540
- return /*#__PURE__*/React.createElement(InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
1541
- schema: schema,
1542
- type: 'x-collection-field'
1543
- }));
1544
- };
1545
- export var TableSelectorInitializer = function TableSelectorInitializer(props) {
1546
- var onCreateBlockSchema = props.onCreateBlockSchema,
1547
- componentType = props.componentType,
1548
- createBlockSchema = props.createBlockSchema,
1549
- insert = props.insert,
1550
- others = _objectWithoutProperties(props, _excluded11);
1551
-
1552
- var _useSchemaTemplateMan10 = useSchemaTemplateManager(),
1553
- getTemplateSchemaByMode = _useSchemaTemplateMan10.getTemplateSchemaByMode;
1554
-
1555
- var collection = useCollection();
1556
- return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
1557
- icon: /*#__PURE__*/React.createElement(FormOutlined, null)
1558
- }, others), {}, {
1559
- onClick: function () {
1560
- var _onClick10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(_ref15) {
1561
- var item, field;
1562
- return regeneratorRuntime.wrap(function _callee14$(_context14) {
1563
- while (1) {
1564
- switch (_context14.prev = _context14.next) {
1565
- case 0:
1566
- item = _ref15.item;
1567
- field = item.field;
1568
- insert(createTableSelectorSchema({
1569
- rowKey: collection.filterTargetKey,
1570
- collection: collection.name,
1571
- resource: collection.name
1572
- }));
1573
-
1574
- case 3:
1575
- case "end":
1576
- return _context14.stop();
1577
- }
1578
- }
1579
- }, _callee14);
1580
- }));
1581
-
1582
- function onClick(_x14) {
1583
- return _onClick10.apply(this, arguments);
1584
- }
1585
-
1586
- return onClick;
1587
- }()
1588
- }));
1589
- };
1
+ export * from './ActionInitializer';
2
+ export * from './BlockInitializer';
3
+ export * from './BulkDestroyActionInitializer';
4
+ export * from './CalendarBlockInitializer';
5
+ export * from './CollectionFieldInitializer';
6
+ export * from './CreateActionInitializer';
7
+ export * from './CreateFormBlockInitializer';
8
+ export * from './CreateSubmitActionInitializer';
9
+ export * from './CustomizeActionInitializer';
10
+ export * from './DataBlockInitializer';
11
+ export * from './DestroyActionInitializer';
12
+ export * from './DetailsBlockInitializer';
13
+ export * from './FilterActionInitializer';
14
+ export * from './FormBlockInitializer';
15
+ export * from './G2PlotInitializer';
16
+ export * from './InitializerWithSwitch';
17
+ export * from './KanbanBlockInitializer';
18
+ export * from './MarkdownBlockInitializer';
19
+ export * from './PrintActionInitializer';
20
+ export * from './RecordAssociationBlockInitializer';
21
+ export * from './RecordAssociationCalendarBlockInitializer';
22
+ export * from './RecordAssociationDetailsBlockInitializer';
23
+ export * from './RecordAssociationFormBlockInitializer';
24
+ export * from './RecordFormBlockInitializer';
25
+ export * from './RecordReadPrettyAssociationFormBlockInitializer';
26
+ export * from './RecordReadPrettyFormBlockInitializer';
27
+ export * from './RefreshActionInitializer';
28
+ export * from './SubmitActionInitializer';
29
+ export * from './TableActionColumnInitializer';
30
+ export * from './TableBlockInitializer';
31
+ export * from './TableCollectionFieldInitializer';
32
+ export * from './TableSelectorInitializer';
33
+ export * from './UpdateActionInitializer';
34
+ export * from './UpdateSubmitActionInitializer';
35
+ export * from './ViewActionInitializer';