@nocobase/client 0.9.2-alpha.4 → 0.9.4-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 (441) hide show
  1. package/es/acl/ACLProvider.js +2 -2
  2. package/es/acl/Configuration/RoleConfigure.js +15 -8
  3. package/es/api-client/APIClient.d.ts +2 -0
  4. package/es/api-client/APIClient.js +11 -0
  5. package/es/block-provider/BlockProvider.js +58 -17
  6. package/es/block-provider/DetailsBlockProvider.js +13 -1
  7. package/es/block-provider/FormBlockProvider.js +30 -13
  8. package/es/block-provider/hooks/index.d.ts +10 -0
  9. package/es/block-provider/hooks/index.js +521 -283
  10. package/es/collection-manager/CollectionField.js +3 -3
  11. package/es/collection-manager/CollectionFieldProvider.js +2 -1
  12. package/es/collection-manager/Configuration/AddFieldAction.js +3 -3
  13. package/es/collection-manager/Configuration/CollectionFields.d.ts +1 -1
  14. package/es/collection-manager/Configuration/CollectionFields.js +2 -5
  15. package/es/collection-manager/Configuration/ConfigurationTabs.js +7 -6
  16. package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
  17. package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  18. package/es/collection-manager/action-hooks.d.ts +1 -1
  19. package/es/collection-manager/action-hooks.js +18 -7
  20. package/es/collection-manager/hooks/useCollection.d.ts +1 -1
  21. package/es/collection-manager/hooks/useCollectionDataSource.js +4 -4
  22. package/es/collection-manager/interfaces/createdBy.js +1 -1
  23. package/es/collection-manager/interfaces/linkTo.js +3 -39
  24. package/es/collection-manager/interfaces/m2m.js +4 -38
  25. package/es/collection-manager/interfaces/m2o.js +4 -38
  26. package/es/collection-manager/interfaces/o2m.js +4 -68
  27. package/es/collection-manager/interfaces/o2o.js +25 -119
  28. package/es/collection-manager/interfaces/updatedBy.js +1 -1
  29. package/es/collection-manager/templates/expression.js +1 -1
  30. package/es/collection-manager/templates/tree.js +2 -2
  31. package/es/filter-provider/FilterProvider.js +3 -1
  32. package/es/filter-provider/utils.js +1 -1
  33. package/es/index.d.ts +1 -0
  34. package/es/index.js +1 -0
  35. package/es/locale/en_US.d.ts +19 -1
  36. package/es/locale/en_US.js +22 -4
  37. package/es/locale/es_ES.d.ts +692 -0
  38. package/es/locale/es_ES.js +691 -0
  39. package/es/locale/ja_JP.d.ts +8 -1
  40. package/es/locale/ja_JP.js +9 -2
  41. package/es/locale/pt_BR.d.ts +5 -1
  42. package/es/locale/pt_BR.js +6 -2
  43. package/es/locale/ru_RU.d.ts +5 -1
  44. package/es/locale/ru_RU.js +6 -2
  45. package/es/locale/tr_TR.d.ts +5 -1
  46. package/es/locale/tr_TR.js +6 -2
  47. package/es/locale/zh_CN.d.ts +27 -1
  48. package/es/locale/zh_CN.js +28 -2
  49. package/es/record-provider/index.d.ts +4 -0
  50. package/es/record-provider/index.js +3 -0
  51. package/es/schema-component/antd/action/Action.Designer.js +10 -8
  52. package/es/schema-component/antd/action/Action.Drawer.js +4 -1
  53. package/es/schema-component/antd/action/ActionBar.js +25 -18
  54. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  55. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +30 -0
  56. package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  57. package/es/schema-component/antd/association-field/AssociationSelect.js +63 -0
  58. package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
  59. package/es/schema-component/antd/association-field/Editable.js +112 -0
  60. package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
  61. package/es/schema-component/antd/association-field/FileManager.js +243 -0
  62. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  63. package/es/schema-component/antd/association-field/InternalNester.js +29 -0
  64. package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  65. package/es/schema-component/antd/association-field/InternalPicker.js +236 -0
  66. package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  67. package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
  68. package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  69. package/es/schema-component/antd/association-field/InternalViewer.js +112 -0
  70. package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
  71. package/es/schema-component/antd/association-field/Nester.js +71 -0
  72. package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  73. package/es/schema-component/antd/association-field/ReadPretty.js +22 -0
  74. package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
  75. package/es/schema-component/antd/association-field/SubTable.js +25 -0
  76. package/es/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
  77. package/es/schema-component/antd/association-field/components/CreateRecordAction.js +61 -0
  78. package/es/schema-component/antd/association-field/context.d.ts +8 -0
  79. package/es/schema-component/antd/association-field/context.js +2 -0
  80. package/es/schema-component/antd/association-field/hooks.d.ts +9 -0
  81. package/es/schema-component/antd/association-field/hooks.js +96 -0
  82. package/es/schema-component/antd/association-field/index.d.ts +1 -0
  83. package/es/schema-component/antd/association-field/index.js +14 -0
  84. package/es/schema-component/antd/association-field/schema.d.ts +142 -0
  85. package/es/schema-component/antd/association-field/schema.js +141 -0
  86. package/es/schema-component/antd/association-field/util.d.ts +8 -0
  87. package/es/schema-component/antd/association-field/util.js +84 -0
  88. package/es/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
  89. package/es/schema-component/antd/association-select/AssociationSelect.js +49 -231
  90. package/es/schema-component/antd/association-select/useServiceOptions.js +2 -2
  91. package/es/schema-component/antd/collection-select/CollectionSelect.js +5 -0
  92. package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  93. package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
  94. package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  95. package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
  96. package/es/schema-component/antd/expand-action/index.d.ts +1 -0
  97. package/es/schema-component/antd/expand-action/index.js +5 -0
  98. package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  99. package/es/schema-component/antd/filter/FilterItem.js +1 -1
  100. package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
  101. package/es/schema-component/antd/form/Form.js +4 -4
  102. package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
  103. package/es/schema-component/antd/form-item/FormItem.js +263 -168
  104. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +39 -61
  105. package/es/schema-component/antd/form-v2/Form.Designer.js +1 -0
  106. package/es/schema-component/antd/form-v2/Templates.d.ts +20 -0
  107. package/es/schema-component/antd/form-v2/Templates.js +40 -12
  108. package/es/schema-component/antd/form-v2/utils.js +3 -1
  109. package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  110. package/es/schema-component/antd/grid/Grid.js +34 -24
  111. package/es/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
  112. package/es/schema-component/antd/grid-card/GridCard.Decorator.js +65 -0
  113. package/es/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
  114. package/es/schema-component/antd/grid-card/GridCard.Designer.js +243 -0
  115. package/es/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
  116. package/es/schema-component/antd/grid-card/GridCard.Item.js +18 -0
  117. package/es/schema-component/antd/grid-card/GridCard.d.ts +8 -0
  118. package/es/schema-component/antd/grid-card/GridCard.js +103 -0
  119. package/es/schema-component/antd/grid-card/hooks.d.ts +4 -0
  120. package/es/schema-component/antd/grid-card/hooks.js +9 -0
  121. package/es/schema-component/antd/grid-card/index.d.ts +1 -0
  122. package/es/schema-component/antd/grid-card/index.js +1 -0
  123. package/es/schema-component/antd/grid-card/options.d.ts +20 -0
  124. package/es/schema-component/antd/grid-card/options.js +20 -0
  125. package/es/schema-component/antd/index.d.ts +5 -1
  126. package/es/schema-component/antd/index.js +5 -1
  127. package/es/schema-component/antd/list/List.Decorator.d.ts +5 -0
  128. package/es/schema-component/antd/list/List.Decorator.js +59 -0
  129. package/es/schema-component/antd/list/List.Designer.d.ts +1 -0
  130. package/es/schema-component/antd/list/List.Designer.js +205 -0
  131. package/es/schema-component/antd/list/List.Item.d.ts +1 -0
  132. package/es/schema-component/antd/list/List.Item.js +15 -0
  133. package/es/schema-component/antd/list/List.d.ts +8 -0
  134. package/es/schema-component/antd/list/List.js +83 -0
  135. package/es/schema-component/antd/list/hooks.d.ts +4 -0
  136. package/es/schema-component/antd/list/hooks.js +9 -0
  137. package/es/schema-component/antd/list/index.d.ts +1 -0
  138. package/es/schema-component/antd/list/index.js +1 -0
  139. package/es/schema-component/antd/menu/Menu.js +6 -3
  140. package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  141. package/es/schema-component/antd/record-picker/InputRecordPicker.js +32 -12
  142. package/es/schema-component/antd/remote-select/RemoteSelect.js +23 -23
  143. package/es/schema-component/antd/select/Select.js +2 -0
  144. package/es/schema-component/antd/table/Table.Void.Designer.js +1 -0
  145. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  146. package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  147. package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
  148. package/es/schema-component/antd/table-v2/Table.js +9 -5
  149. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  150. package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
  151. package/es/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
  152. package/es/schema-component/antd/table-v2/hooks/useUserVariable.js +65 -0
  153. package/es/schema-component/antd/table-v2/index.js +3 -1
  154. package/es/schema-component/antd/table-v2/utils.js +1 -1
  155. package/es/schema-component/antd/variable/Input.js +11 -8
  156. package/es/schema-component/antd/variable/TextArea.js +2 -5
  157. package/es/schema-component/common/dnd-context/index.js +3 -2
  158. package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
  159. package/es/schema-component/common/utils/uitls.js +1 -1
  160. package/es/schema-component/core/SchemaComponentProvider.js +2 -2
  161. package/es/schema-component/hooks/index.d.ts +1 -0
  162. package/es/schema-component/hooks/index.js +2 -1
  163. package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  164. package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
  165. package/es/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
  166. package/es/schema-initializer/SchemaInitializerProvider.js +23 -10
  167. package/es/schema-initializer/buttons/BlockInitializers.js +10 -0
  168. package/es/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
  169. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
  170. package/es/schema-initializer/buttons/FormActionInitializers.js +106 -100
  171. package/es/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
  172. package/es/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
  173. package/es/schema-initializer/buttons/GridCardActionInitializers.js +278 -0
  174. package/es/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
  175. package/es/schema-initializer/buttons/ListActionInitializers.js +278 -0
  176. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  177. package/es/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
  178. package/es/schema-initializer/buttons/TableActionInitializers.js +29 -35
  179. package/es/schema-initializer/buttons/TableColumnInitializers.js +4 -1
  180. package/es/schema-initializer/buttons/index.d.ts +3 -0
  181. package/es/schema-initializer/buttons/index.js +3 -0
  182. package/es/schema-initializer/components/BulkEditField.js +7 -5
  183. package/es/schema-initializer/components/CreateRecordAction.d.ts +2 -1
  184. package/es/schema-initializer/components/CreateRecordAction.js +55 -33
  185. package/es/schema-initializer/components/DeletedField.d.ts +1 -0
  186. package/es/schema-initializer/components/DeletedField.js +11 -0
  187. package/es/schema-initializer/components/assigned-field/AssignedField.js +35 -23
  188. package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  189. package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
  190. package/es/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
  191. package/es/schema-initializer/items/GridCardBlockInitializer.js +47 -0
  192. package/es/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
  193. package/es/schema-initializer/items/ListBlockInitializer.js +47 -0
  194. package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  195. package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
  196. package/es/schema-initializer/items/index.d.ts +3 -0
  197. package/es/schema-initializer/items/index.js +3 -0
  198. package/es/schema-initializer/utils.d.ts +112 -0
  199. package/es/schema-initializer/utils.js +224 -38
  200. package/es/schema-items/GeneralSchemaItems.d.ts +4 -0
  201. package/es/schema-items/GeneralSchemaItems.js +148 -0
  202. package/es/schema-items/index.d.ts +1 -0
  203. package/es/schema-items/index.js +2 -1
  204. package/es/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
  205. package/es/schema-settings/DataTemplates/FormDataTemplates.js +117 -42
  206. package/es/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
  207. package/es/schema-settings/DataTemplates/components/Designer.js +179 -0
  208. package/es/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
  209. package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -96
  210. package/es/schema-settings/GeneralSchemaDesigner.js +19 -15
  211. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  212. package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
  213. package/es/schema-settings/LinkageRules/Variables.js +7 -4
  214. package/es/schema-settings/SchemaSettings.d.ts +1 -1
  215. package/es/schema-settings/SchemaSettings.js +53 -29
  216. package/es/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
  217. package/es/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
  218. package/es/schema-settings/hooks/useIsShowMultipleSwitch.js +18 -0
  219. package/es/schema-templates/BlockTemplateDetails.js +1 -1
  220. package/es/user/CurrentUser.js +118 -10
  221. package/lib/acl/ACLProvider.js +2 -2
  222. package/lib/acl/Configuration/RoleConfigure.js +15 -8
  223. package/lib/api-client/APIClient.d.ts +2 -0
  224. package/lib/api-client/APIClient.js +11 -0
  225. package/lib/block-provider/BlockProvider.js +57 -16
  226. package/lib/block-provider/DetailsBlockProvider.js +13 -1
  227. package/lib/block-provider/FormBlockProvider.js +31 -15
  228. package/lib/block-provider/hooks/index.d.ts +10 -0
  229. package/lib/block-provider/hooks/index.js +531 -290
  230. package/lib/collection-manager/CollectionField.js +3 -3
  231. package/lib/collection-manager/CollectionFieldProvider.js +2 -1
  232. package/lib/collection-manager/Configuration/AddFieldAction.js +2 -2
  233. package/lib/collection-manager/Configuration/CollectionFields.d.ts +1 -1
  234. package/lib/collection-manager/Configuration/CollectionFields.js +2 -5
  235. package/lib/collection-manager/Configuration/ConfigurationTabs.js +7 -6
  236. package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
  237. package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  238. package/lib/collection-manager/action-hooks.d.ts +1 -1
  239. package/lib/collection-manager/action-hooks.js +18 -7
  240. package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
  241. package/lib/collection-manager/hooks/useCollectionDataSource.js +4 -4
  242. package/lib/collection-manager/interfaces/createdBy.js +1 -1
  243. package/lib/collection-manager/interfaces/linkTo.js +2 -38
  244. package/lib/collection-manager/interfaces/m2m.js +3 -37
  245. package/lib/collection-manager/interfaces/m2o.js +3 -37
  246. package/lib/collection-manager/interfaces/o2m.js +6 -70
  247. package/lib/collection-manager/interfaces/o2o.js +30 -124
  248. package/lib/collection-manager/interfaces/updatedBy.js +1 -1
  249. package/lib/collection-manager/templates/expression.js +1 -1
  250. package/lib/collection-manager/templates/tree.js +2 -2
  251. package/lib/filter-provider/FilterProvider.js +3 -1
  252. package/lib/filter-provider/utils.js +1 -1
  253. package/lib/index.d.ts +1 -0
  254. package/lib/index.js +11 -0
  255. package/lib/locale/en_US.d.ts +19 -1
  256. package/lib/locale/en_US.js +22 -4
  257. package/lib/locale/es_ES.d.ts +692 -0
  258. package/lib/locale/es_ES.js +698 -0
  259. package/lib/locale/ja_JP.d.ts +8 -1
  260. package/lib/locale/ja_JP.js +9 -2
  261. package/lib/locale/pt_BR.d.ts +5 -1
  262. package/lib/locale/pt_BR.js +6 -2
  263. package/lib/locale/ru_RU.d.ts +5 -1
  264. package/lib/locale/ru_RU.js +6 -2
  265. package/lib/locale/tr_TR.d.ts +5 -1
  266. package/lib/locale/tr_TR.js +6 -2
  267. package/lib/locale/zh_CN.d.ts +27 -1
  268. package/lib/locale/zh_CN.js +28 -2
  269. package/lib/record-provider/index.d.ts +4 -0
  270. package/lib/record-provider/index.js +5 -1
  271. package/lib/schema-component/antd/action/Action.Designer.js +10 -8
  272. package/lib/schema-component/antd/action/Action.Drawer.js +4 -1
  273. package/lib/schema-component/antd/action/ActionBar.js +23 -16
  274. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  275. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +40 -0
  276. package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  277. package/lib/schema-component/antd/association-field/AssociationSelect.js +72 -0
  278. package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
  279. package/lib/schema-component/antd/association-field/Editable.js +121 -0
  280. package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
  281. package/lib/schema-component/antd/association-field/FileManager.js +253 -0
  282. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  283. package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
  284. package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  285. package/lib/schema-component/antd/association-field/InternalPicker.js +246 -0
  286. package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  287. package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
  288. package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  289. package/lib/schema-component/antd/association-field/InternalViewer.js +123 -0
  290. package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
  291. package/lib/schema-component/antd/association-field/Nester.js +80 -0
  292. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  293. package/lib/schema-component/antd/association-field/ReadPretty.js +30 -0
  294. package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
  295. package/lib/schema-component/antd/association-field/SubTable.js +33 -0
  296. package/lib/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
  297. package/lib/schema-component/antd/association-field/components/CreateRecordAction.js +71 -0
  298. package/lib/schema-component/antd/association-field/context.d.ts +8 -0
  299. package/lib/schema-component/antd/association-field/context.js +9 -0
  300. package/lib/schema-component/antd/association-field/hooks.d.ts +9 -0
  301. package/lib/schema-component/antd/association-field/hooks.js +107 -0
  302. package/lib/schema-component/antd/association-field/index.d.ts +1 -0
  303. package/lib/schema-component/antd/association-field/index.js +21 -0
  304. package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
  305. package/lib/schema-component/antd/association-field/schema.js +148 -0
  306. package/lib/schema-component/antd/association-field/util.d.ts +8 -0
  307. package/lib/schema-component/antd/association-field/util.js +98 -0
  308. package/lib/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
  309. package/lib/schema-component/antd/association-select/AssociationSelect.js +49 -231
  310. package/lib/schema-component/antd/association-select/useServiceOptions.js +2 -2
  311. package/lib/schema-component/antd/collection-select/CollectionSelect.js +5 -0
  312. package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  313. package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
  314. package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  315. package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
  316. package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
  317. package/lib/schema-component/antd/expand-action/index.js +12 -0
  318. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  319. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  320. package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
  321. package/lib/schema-component/antd/form/Form.js +4 -4
  322. package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
  323. package/lib/schema-component/antd/form-item/FormItem.js +258 -162
  324. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +37 -59
  325. package/lib/schema-component/antd/form-v2/Form.Designer.js +1 -0
  326. package/lib/schema-component/antd/form-v2/Templates.d.ts +20 -0
  327. package/lib/schema-component/antd/form-v2/Templates.js +39 -11
  328. package/lib/schema-component/antd/form-v2/utils.js +3 -1
  329. package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  330. package/lib/schema-component/antd/grid/Grid.js +33 -23
  331. package/lib/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
  332. package/lib/schema-component/antd/grid-card/GridCard.Decorator.js +77 -0
  333. package/lib/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
  334. package/lib/schema-component/antd/grid-card/GridCard.Designer.js +253 -0
  335. package/lib/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
  336. package/lib/schema-component/antd/grid-card/GridCard.Item.js +26 -0
  337. package/lib/schema-component/antd/grid-card/GridCard.d.ts +8 -0
  338. package/lib/schema-component/antd/grid-card/GridCard.js +112 -0
  339. package/lib/schema-component/antd/grid-card/hooks.d.ts +4 -0
  340. package/lib/schema-component/antd/grid-card/hooks.js +16 -0
  341. package/lib/schema-component/antd/grid-card/index.d.ts +1 -0
  342. package/lib/schema-component/antd/grid-card/index.js +16 -0
  343. package/lib/schema-component/antd/grid-card/options.d.ts +20 -0
  344. package/lib/schema-component/antd/grid-card/options.js +31 -0
  345. package/lib/schema-component/antd/index.d.ts +5 -1
  346. package/lib/schema-component/antd/index.js +55 -11
  347. package/lib/schema-component/antd/list/List.Decorator.d.ts +5 -0
  348. package/lib/schema-component/antd/list/List.Decorator.js +71 -0
  349. package/lib/schema-component/antd/list/List.Designer.d.ts +1 -0
  350. package/lib/schema-component/antd/list/List.Designer.js +213 -0
  351. package/lib/schema-component/antd/list/List.Item.d.ts +1 -0
  352. package/lib/schema-component/antd/list/List.Item.js +23 -0
  353. package/lib/schema-component/antd/list/List.d.ts +8 -0
  354. package/lib/schema-component/antd/list/List.js +92 -0
  355. package/lib/schema-component/antd/list/hooks.d.ts +4 -0
  356. package/lib/schema-component/antd/list/hooks.js +16 -0
  357. package/lib/schema-component/antd/list/index.d.ts +1 -0
  358. package/lib/schema-component/antd/list/index.js +16 -0
  359. package/lib/schema-component/antd/menu/Menu.js +6 -3
  360. package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  361. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +34 -13
  362. package/lib/schema-component/antd/remote-select/RemoteSelect.js +22 -22
  363. package/lib/schema-component/antd/select/Select.js +2 -0
  364. package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -0
  365. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  366. package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  367. package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
  368. package/lib/schema-component/antd/table-v2/Table.js +9 -5
  369. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  370. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
  371. package/lib/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
  372. package/lib/schema-component/antd/table-v2/hooks/useUserVariable.js +73 -0
  373. package/lib/schema-component/antd/table-v2/index.js +3 -1
  374. package/lib/schema-component/antd/table-v2/utils.js +1 -1
  375. package/lib/schema-component/antd/variable/Input.js +11 -8
  376. package/lib/schema-component/antd/variable/TextArea.js +2 -5
  377. package/lib/schema-component/common/dnd-context/index.js +3 -2
  378. package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
  379. package/lib/schema-component/common/utils/uitls.js +1 -1
  380. package/lib/schema-component/core/SchemaComponentProvider.js +2 -2
  381. package/lib/schema-component/hooks/index.d.ts +1 -0
  382. package/lib/schema-component/hooks/index.js +11 -0
  383. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  384. package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
  385. package/lib/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
  386. package/lib/schema-initializer/SchemaInitializerProvider.js +22 -9
  387. package/lib/schema-initializer/buttons/BlockInitializers.js +10 -0
  388. package/lib/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
  389. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
  390. package/lib/schema-initializer/buttons/FormActionInitializers.js +106 -100
  391. package/lib/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
  392. package/lib/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
  393. package/lib/schema-initializer/buttons/GridCardActionInitializers.js +285 -0
  394. package/lib/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
  395. package/lib/schema-initializer/buttons/ListActionInitializers.js +285 -0
  396. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  397. package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
  398. package/lib/schema-initializer/buttons/TableActionInitializers.js +29 -35
  399. package/lib/schema-initializer/buttons/TableColumnInitializers.js +4 -1
  400. package/lib/schema-initializer/buttons/index.d.ts +3 -0
  401. package/lib/schema-initializer/buttons/index.js +22 -0
  402. package/lib/schema-initializer/components/BulkEditField.js +7 -5
  403. package/lib/schema-initializer/components/CreateRecordAction.d.ts +2 -1
  404. package/lib/schema-initializer/components/CreateRecordAction.js +58 -35
  405. package/lib/schema-initializer/components/DeletedField.d.ts +1 -0
  406. package/lib/schema-initializer/components/DeletedField.js +19 -0
  407. package/lib/schema-initializer/components/assigned-field/AssignedField.js +34 -22
  408. package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  409. package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
  410. package/lib/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
  411. package/lib/schema-initializer/items/GridCardBlockInitializer.js +55 -0
  412. package/lib/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
  413. package/lib/schema-initializer/items/ListBlockInitializer.js +55 -0
  414. package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  415. package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
  416. package/lib/schema-initializer/items/index.d.ts +3 -0
  417. package/lib/schema-initializer/items/index.js +33 -0
  418. package/lib/schema-initializer/utils.d.ts +112 -0
  419. package/lib/schema-initializer/utils.js +227 -39
  420. package/lib/schema-items/GeneralSchemaItems.d.ts +4 -0
  421. package/lib/schema-items/GeneralSchemaItems.js +156 -0
  422. package/lib/schema-items/index.d.ts +1 -0
  423. package/lib/schema-items/index.js +11 -0
  424. package/lib/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
  425. package/lib/schema-settings/DataTemplates/FormDataTemplates.js +119 -41
  426. package/lib/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
  427. package/lib/schema-settings/DataTemplates/components/Designer.js +188 -0
  428. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
  429. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -95
  430. package/lib/schema-settings/GeneralSchemaDesigner.js +21 -15
  431. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  432. package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
  433. package/lib/schema-settings/LinkageRules/Variables.js +7 -4
  434. package/lib/schema-settings/SchemaSettings.d.ts +1 -1
  435. package/lib/schema-settings/SchemaSettings.js +53 -29
  436. package/lib/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
  437. package/lib/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
  438. package/lib/schema-settings/hooks/useIsShowMultipleSwitch.js +24 -0
  439. package/lib/user/CurrentUser.js +116 -8
  440. package/package.json +5 -6
  441. package/tsconfig.json +8 -0
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useUpdateActionProps = exports.useResetBlockActionProps = exports.useRefreshActionProps = exports.usePickActionProps = exports.useOptionalFieldList = exports.useFilterBlockActionProps = exports.useDetailsPaginationProps = exports.useDetailPrintActionProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCustomizeBulkUpdateActionProps = exports.useCustomizeBulkEditActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = exports.useAssociationFilterProps = exports.useAssociationFilterBlockProps = exports.updateFilterTargets = exports.findFilterTargets = void 0;
6
+ exports.useUpdateActionProps = exports.useResetBlockActionProps = exports.useRemoveActionProps = exports.useRefreshActionProps = exports.usePickActionProps = exports.useOptionalFieldList = exports.useFilterBlockActionProps = exports.useDetailsPaginationProps = exports.useDetailPrintActionProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCustomizeBulkUpdateActionProps = exports.useCustomizeBulkEditActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = exports.useAssociationNames = exports.useAssociationFilterProps = exports.useAssociationFilterBlockProps = exports.useAssociationCreateActionProps = exports.updateFilterTargets = exports.findFilterTargets = void 0;
7
7
  var _react = require("@formily/react");
8
+ var _client = require("@nocobase/utils/client");
8
9
  var _antd = require("antd");
9
- var _jsonTemplates = _interopRequireDefault(require("json-templates"));
10
10
  var _lodash = require("lodash");
11
11
  var _get = _interopRequireDefault(require("lodash/get"));
12
12
  var _omit = _interopRequireDefault(require("lodash/omit"));
@@ -22,6 +22,7 @@ var _utils = require("../../filter-provider/utils");
22
22
  var _recordProvider = require("../../record-provider");
23
23
  var _schemaComponent = require("../../schema-component");
24
24
  var _components = require("../../schema-initializer/components");
25
+ var _schemaTemplates = require("../../schema-templates");
25
26
  var _user = require("../../user");
26
27
  var _BlockProvider = require("../BlockProvider");
27
28
  var _DetailsBlockProvider = require("../DetailsBlockProvider");
@@ -181,7 +182,7 @@ var useCreateActionProps = function useCreateActionProps() {
181
182
  onClick: function onClick() {
182
183
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
183
184
  var _actionSchema$xActio, _fieldSchema$xCompon;
184
- var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre;
185
+ var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name, _treeParentField$fore, treeParentField, _parent$service, _parent$service$refre, data;
185
186
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
186
187
  while (1) switch (_context2.prev = _context2.next) {
187
188
  case 0:
@@ -190,7 +191,7 @@ var useCreateActionProps = function useCreateActionProps() {
190
191
  });
191
192
  _ref = (_actionSchema$xActio = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio !== void 0 ? _actionSchema$xActio : {}, _ref$assignedValues = _ref.assignedValues, originalAssignedValues = _ref$assignedValues === void 0 ? {} : _ref$assignedValues, onSuccess = _ref.onSuccess, overwriteValues = _ref.overwriteValues, skipValidator = _ref.skipValidator;
192
193
  addChild = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.addChild;
193
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
194
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
194
195
  currentTime: new Date(),
195
196
  currentRecord: currentRecord,
196
197
  currentUser: currentUser
@@ -202,7 +203,7 @@ var useCreateActionProps = function useCreateActionProps() {
202
203
  _context2.next = 7;
203
204
  return form.submit();
204
205
  case 7:
205
- values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
206
+ values = getFormValues(filterByTk, field, form, fieldNames, getField, resource); // const values = omitBy(formValues, (value) => isEqual(JSON.stringify(value), '[{}]'));
206
207
  if (addChild) {
207
208
  treeParentField = getTreeParentField();
208
209
  values[(_treeParentField$name = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.name) !== null && _treeParentField$name !== void 0 ? _treeParentField$name : 'parent'] = currentRecord;
@@ -216,15 +217,17 @@ var useCreateActionProps = function useCreateActionProps() {
216
217
  values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
217
218
  });
218
219
  case 14:
220
+ data = _context2.sent;
219
221
  actionField.data.loading = false;
222
+ actionField.data.data = data;
220
223
  __parent === null || __parent === void 0 ? void 0 : (_parent$service = __parent.service) === null || _parent$service === void 0 ? void 0 : (_parent$service$refre = _parent$service.refresh) === null || _parent$service$refre === void 0 ? void 0 : _parent$service$refre.call(_parent$service);
221
224
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
222
225
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
223
- _context2.next = 19;
226
+ _context2.next = 21;
224
227
  break;
225
228
  }
226
229
  return _context2.abrupt("return");
227
- case 19:
230
+ case 21:
228
231
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
229
232
  _antd.Modal.success({
230
233
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
@@ -258,22 +261,109 @@ var useCreateActionProps = function useCreateActionProps() {
258
261
  } else {
259
262
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
260
263
  }
261
- _context2.next = 25;
264
+ _context2.next = 27;
262
265
  break;
263
- case 22:
264
- _context2.prev = 22;
266
+ case 24:
267
+ _context2.prev = 24;
265
268
  _context2.t0 = _context2["catch"](11);
266
269
  actionField.data.loading = false;
267
- case 25:
270
+ case 27:
268
271
  case "end":
269
272
  return _context2.stop();
270
273
  }
271
- }, _callee2, null, [[11, 22]]);
274
+ }, _callee2, null, [[11, 24]]);
272
275
  }))();
273
276
  }
274
277
  };
275
278
  };
276
279
  exports.useCreateActionProps = useCreateActionProps;
280
+ var useAssociationCreateActionProps = function useAssociationCreateActionProps() {
281
+ var _currentUserContext$d2;
282
+ var form = (0, _react.useForm)();
283
+ var _useBlockRequestConte2 = (0, _BlockProvider.useBlockRequestContext)(),
284
+ field = _useBlockRequestConte2.field,
285
+ resource = _useBlockRequestConte2.resource;
286
+ var _useActionContext2 = (0, _schemaComponent.useActionContext)(),
287
+ setVisible = _useActionContext2.setVisible,
288
+ fieldSchema = _useActionContext2.fieldSchema;
289
+ var actionSchema = (0, _react.useFieldSchema)();
290
+ var actionField = (0, _react.useField)();
291
+ var _useCollection2 = (0, _collectionManager.useCollection)(),
292
+ fields = _useCollection2.fields,
293
+ getField = _useCollection2.getField,
294
+ getTreeParentField = _useCollection2.getTreeParentField;
295
+ var compile = (0, _schemaComponent.useCompile)();
296
+ var filterByTk = (0, _BlockProvider.useFilterByTk)();
297
+ var currentRecord = (0, _recordProvider.useRecord)();
298
+ var currentUserContext = (0, _user.useCurrentUserContext)();
299
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d2 = currentUserContext.data) === null || _currentUserContext$d2 === void 0 ? void 0 : _currentUserContext$d2.data;
300
+ return {
301
+ onClick: function onClick() {
302
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
303
+ var _actionSchema$xActio2, _fieldSchema$xCompon2;
304
+ var fieldNames, _ref2, _ref2$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, addChild, assignedValues, values, _treeParentField$name2, _treeParentField$fore2, treeParentField, data;
305
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
306
+ while (1) switch (_context3.prev = _context3.next) {
307
+ case 0:
308
+ fieldNames = fields.map(function (field) {
309
+ return field.name;
310
+ });
311
+ _ref2 = (_actionSchema$xActio2 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio2 !== void 0 ? _actionSchema$xActio2 : {}, _ref2$assignedValues = _ref2.assignedValues, originalAssignedValues = _ref2$assignedValues === void 0 ? {} : _ref2$assignedValues, onSuccess = _ref2.onSuccess, overwriteValues = _ref2.overwriteValues, skipValidator = _ref2.skipValidator;
312
+ addChild = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.addChild;
313
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
314
+ currentTime: new Date(),
315
+ currentRecord: currentRecord,
316
+ currentUser: currentUser
317
+ });
318
+ if (skipValidator) {
319
+ _context3.next = 7;
320
+ break;
321
+ }
322
+ _context3.next = 7;
323
+ return form.submit();
324
+ case 7:
325
+ values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
326
+ if (addChild) {
327
+ treeParentField = getTreeParentField();
328
+ values[(_treeParentField$name2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.name) !== null && _treeParentField$name2 !== void 0 ? _treeParentField$name2 : 'parent'] = currentRecord;
329
+ values[(_treeParentField$fore2 = treeParentField === null || treeParentField === void 0 ? void 0 : treeParentField.foreignKey) !== null && _treeParentField$fore2 !== void 0 ? _treeParentField$fore2 : 'parentId'] = currentRecord.id;
330
+ }
331
+ actionField.data = field.data || {};
332
+ actionField.data.loading = true;
333
+ _context3.prev = 11;
334
+ _context3.next = 14;
335
+ return resource.create({
336
+ values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
337
+ });
338
+ case 14:
339
+ data = _context3.sent;
340
+ actionField.data.loading = false;
341
+ actionField.data.data = data;
342
+ setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
343
+ if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
344
+ _context3.next = 20;
345
+ break;
346
+ }
347
+ return _context3.abrupt("return");
348
+ case 20:
349
+ _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
350
+ _context3.next = 27;
351
+ break;
352
+ case 23:
353
+ _context3.prev = 23;
354
+ _context3.t0 = _context3["catch"](11);
355
+ actionField.data.data = null;
356
+ actionField.data.loading = false;
357
+ case 27:
358
+ case "end":
359
+ return _context3.stop();
360
+ }
361
+ }, _callee3, null, [[11, 23]]);
362
+ }))();
363
+ }
364
+ };
365
+ };
366
+ exports.useAssociationCreateActionProps = useAssociationCreateActionProps;
277
367
  var findFilterTargets = function findFilterTargets(fieldSchema) {
278
368
  while (fieldSchema) {
279
369
  if (fieldSchema['x-filter-targets']) {
@@ -303,37 +393,37 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
303
393
  var fieldSchema = (0, _react.useFieldSchema)();
304
394
  var _useFilterBlock = (0, _FilterProvider.useFilterBlock)(),
305
395
  getDataBlocks = _useFilterBlock.getDataBlocks;
306
- var _useCollection2 = (0, _collectionManager.useCollection)(),
307
- name = _useCollection2.name;
396
+ var _useCollection3 = (0, _collectionManager.useCollection)(),
397
+ name = _useCollection3.name;
308
398
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
309
399
  getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
310
400
  actionField.data = actionField.data || {};
311
401
  return {
312
402
  onClick: function onClick() {
313
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
403
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
314
404
  var _findFilterTargets, _findFilterTargets$ta, targets, uid;
315
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
316
- while (1) switch (_context4.prev = _context4.next) {
405
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
406
+ while (1) switch (_context5.prev = _context5.next) {
317
407
  case 0:
318
408
  _findFilterTargets = findFilterTargets(fieldSchema), _findFilterTargets$ta = _findFilterTargets.targets, targets = _findFilterTargets$ta === void 0 ? [] : _findFilterTargets$ta, uid = _findFilterTargets.uid;
319
409
  actionField.data.loading = true;
320
- _context4.prev = 2;
321
- _context4.next = 5;
410
+ _context5.prev = 2;
411
+ _context5.next = 5;
322
412
  return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
323
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(block) {
413
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(block) {
324
414
  var _block$service$params, _block$service$params2, _block$service$params3;
325
415
  var target, param, storedFilter, mergedFilter;
326
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
327
- while (1) switch (_context3.prev = _context3.next) {
416
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
417
+ while (1) switch (_context4.prev = _context4.next) {
328
418
  case 0:
329
419
  target = targets.find(function (target) {
330
420
  return target.uid === block.uid;
331
421
  });
332
422
  if (target) {
333
- _context3.next = 3;
423
+ _context4.next = 3;
334
424
  break;
335
425
  }
336
- return _context3.abrupt("return");
426
+ return _context4.abrupt("return");
337
427
  case 3:
338
428
  param = ((_block$service$params = block.service.params) === null || _block$service$params === void 0 ? void 0 : _block$service$params[0]) || {}; // 保留原有的 filter
339
429
  storedFilter = ((_block$service$params2 = block.service.params) === null || _block$service$params2 === void 0 ? void 0 : (_block$service$params3 = _block$service$params2[1]) === null || _block$service$params3 === void 0 ? void 0 : _block$service$params3.filters) || {};
@@ -341,7 +431,7 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
341
431
  mergedFilter = (0, _SharedFilterProvider.mergeFilter)([].concat(_toConsumableArray(Object.values(storedFilter).map(function (filter) {
342
432
  return (0, _schemaComponent.removeNullCondition)(filter);
343
433
  })), [block.defaultFilter]));
344
- return _context3.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
434
+ return _context4.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
345
435
  page: 1,
346
436
  filter: mergedFilter
347
437
  }), {
@@ -349,28 +439,28 @@ var useFilterBlockActionProps = function useFilterBlockActionProps() {
349
439
  }));
350
440
  case 8:
351
441
  case "end":
352
- return _context3.stop();
442
+ return _context4.stop();
353
443
  }
354
- }, _callee3);
444
+ }, _callee4);
355
445
  }));
356
446
  return function (_x) {
357
- return _ref2.apply(this, arguments);
447
+ return _ref3.apply(this, arguments);
358
448
  };
359
449
  }()));
360
450
  case 5:
361
451
  actionField.data.loading = false;
362
- _context4.next = 12;
452
+ _context5.next = 12;
363
453
  break;
364
454
  case 8:
365
- _context4.prev = 8;
366
- _context4.t0 = _context4["catch"](2);
367
- console.error(_context4.t0);
455
+ _context5.prev = 8;
456
+ _context5.t0 = _context5["catch"](2);
457
+ console.error(_context5.t0);
368
458
  actionField.data.loading = false;
369
459
  case 12:
370
460
  case "end":
371
- return _context4.stop();
461
+ return _context5.stop();
372
462
  }
373
- }, _callee4, null, [[2, 8]]);
463
+ }, _callee5, null, [[2, 8]]);
374
464
  }))();
375
465
  }
376
466
  };
@@ -385,37 +475,37 @@ var useResetBlockActionProps = function useResetBlockActionProps() {
385
475
  actionField.data = actionField.data || {};
386
476
  return {
387
477
  onClick: function onClick() {
388
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
478
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
389
479
  var _findFilterTargets2, targets, uid;
390
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
391
- while (1) switch (_context6.prev = _context6.next) {
480
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
481
+ while (1) switch (_context7.prev = _context7.next) {
392
482
  case 0:
393
483
  _findFilterTargets2 = findFilterTargets(fieldSchema), targets = _findFilterTargets2.targets, uid = _findFilterTargets2.uid;
394
484
  form.reset();
395
485
  actionField.data.loading = true;
396
- _context6.prev = 3;
397
- _context6.next = 6;
486
+ _context7.prev = 3;
487
+ _context7.next = 6;
398
488
  return Promise.all(getDataBlocks().map( /*#__PURE__*/function () {
399
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(block) {
489
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(block) {
400
490
  var _block$service$params4, _block$service$params5, _block$service$params6;
401
491
  var target, param, storedFilter, mergedFilter;
402
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
403
- while (1) switch (_context5.prev = _context5.next) {
492
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
493
+ while (1) switch (_context6.prev = _context6.next) {
404
494
  case 0:
405
495
  target = targets.find(function (target) {
406
496
  return target.uid === block.uid;
407
497
  });
408
498
  if (target) {
409
- _context5.next = 3;
499
+ _context6.next = 3;
410
500
  break;
411
501
  }
412
- return _context5.abrupt("return");
502
+ return _context6.abrupt("return");
413
503
  case 3:
414
504
  param = ((_block$service$params4 = block.service.params) === null || _block$service$params4 === void 0 ? void 0 : _block$service$params4[0]) || {}; // 保留原有的 filter
415
505
  storedFilter = ((_block$service$params5 = block.service.params) === null || _block$service$params5 === void 0 ? void 0 : (_block$service$params6 = _block$service$params5[1]) === null || _block$service$params6 === void 0 ? void 0 : _block$service$params6.filters) || {};
416
506
  delete storedFilter[uid];
417
507
  mergedFilter = (0, _SharedFilterProvider.mergeFilter)([].concat(_toConsumableArray(Object.values(storedFilter)), [block.defaultFilter]));
418
- return _context5.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
508
+ return _context6.abrupt("return", block.doFilter(_objectSpread(_objectSpread({}, param), {}, {
419
509
  page: 1,
420
510
  filter: mergedFilter
421
511
  }), {
@@ -423,68 +513,68 @@ var useResetBlockActionProps = function useResetBlockActionProps() {
423
513
  }));
424
514
  case 8:
425
515
  case "end":
426
- return _context5.stop();
516
+ return _context6.stop();
427
517
  }
428
- }, _callee5);
518
+ }, _callee6);
429
519
  }));
430
520
  return function (_x2) {
431
- return _ref3.apply(this, arguments);
521
+ return _ref4.apply(this, arguments);
432
522
  };
433
523
  }()));
434
524
  case 6:
435
525
  actionField.data.loading = false;
436
- _context6.next = 12;
526
+ _context7.next = 12;
437
527
  break;
438
528
  case 9:
439
- _context6.prev = 9;
440
- _context6.t0 = _context6["catch"](3);
529
+ _context7.prev = 9;
530
+ _context7.t0 = _context7["catch"](3);
441
531
  actionField.data.loading = false;
442
532
  case 12:
443
533
  case "end":
444
- return _context6.stop();
534
+ return _context7.stop();
445
535
  }
446
- }, _callee6, null, [[3, 9]]);
536
+ }, _callee7, null, [[3, 9]]);
447
537
  }))();
448
538
  }
449
539
  };
450
540
  };
451
541
  exports.useResetBlockActionProps = useResetBlockActionProps;
452
542
  var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
453
- var _currentUserContext$d2;
454
- var _useBlockRequestConte2 = (0, _BlockProvider.useBlockRequestContext)(),
455
- resource = _useBlockRequestConte2.resource,
456
- __parent = _useBlockRequestConte2.__parent,
457
- service = _useBlockRequestConte2.service;
543
+ var _currentUserContext$d3;
544
+ var _useBlockRequestConte3 = (0, _BlockProvider.useBlockRequestContext)(),
545
+ resource = _useBlockRequestConte3.resource,
546
+ __parent = _useBlockRequestConte3.__parent,
547
+ service = _useBlockRequestConte3.service;
458
548
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
459
549
  var actionSchema = (0, _react.useFieldSchema)();
460
550
  var currentRecord = (0, _recordProvider.useRecord)();
461
551
  var currentUserContext = (0, _user.useCurrentUserContext)();
462
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d2 = currentUserContext.data) === null || _currentUserContext$d2 === void 0 ? void 0 : _currentUserContext$d2.data;
552
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
463
553
  var history = (0, _reactRouterDom.useHistory)();
464
554
  var compile = (0, _schemaComponent.useCompile)();
465
555
  var form = (0, _react.useForm)();
466
556
  return {
467
557
  onClick: function onClick() {
468
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
469
- var _actionSchema$xActio2, _service$refresh;
470
- var _ref4, _ref4$assignedValues, originalAssignedValues, onSuccess, skipValidator, assignedValues, _parent$service2, _parent$service2$refr;
471
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
472
- while (1) switch (_context8.prev = _context8.next) {
558
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
559
+ var _actionSchema$xActio3, _service$refresh;
560
+ var _ref5, _ref5$assignedValues, originalAssignedValues, onSuccess, skipValidator, assignedValues, _parent$service2, _parent$service2$refr;
561
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
562
+ while (1) switch (_context9.prev = _context9.next) {
473
563
  case 0:
474
- _ref4 = (_actionSchema$xActio2 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio2 !== void 0 ? _actionSchema$xActio2 : {}, _ref4$assignedValues = _ref4.assignedValues, originalAssignedValues = _ref4$assignedValues === void 0 ? {} : _ref4$assignedValues, onSuccess = _ref4.onSuccess, skipValidator = _ref4.skipValidator;
475
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
564
+ _ref5 = (_actionSchema$xActio3 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio3 !== void 0 ? _actionSchema$xActio3 : {}, _ref5$assignedValues = _ref5.assignedValues, originalAssignedValues = _ref5$assignedValues === void 0 ? {} : _ref5$assignedValues, onSuccess = _ref5.onSuccess, skipValidator = _ref5.skipValidator;
565
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
476
566
  currentTime: new Date(),
477
567
  currentRecord: currentRecord,
478
568
  currentUser: currentUser
479
569
  });
480
570
  if (!(skipValidator === false)) {
481
- _context8.next = 5;
571
+ _context9.next = 5;
482
572
  break;
483
573
  }
484
- _context8.next = 5;
574
+ _context9.next = 5;
485
575
  return form.submit();
486
576
  case 5:
487
- _context8.next = 7;
577
+ _context9.next = 7;
488
578
  return resource.update({
489
579
  filterByTk: filterByTk,
490
580
  values: _objectSpread({}, assignedValues)
@@ -495,18 +585,18 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
495
585
  __parent === null || __parent === void 0 ? void 0 : (_parent$service2 = __parent.service) === null || _parent$service2 === void 0 ? void 0 : (_parent$service2$refr = _parent$service2.refresh) === null || _parent$service2$refr === void 0 ? void 0 : _parent$service2$refr.call(_parent$service2);
496
586
  }
497
587
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
498
- _context8.next = 11;
588
+ _context9.next = 11;
499
589
  break;
500
590
  }
501
- return _context8.abrupt("return");
591
+ return _context9.abrupt("return");
502
592
  case 11:
503
593
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
504
594
  _antd.Modal.success({
505
595
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
506
596
  onOk: function () {
507
- var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
508
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
509
- while (1) switch (_context7.prev = _context7.next) {
597
+ var _onOk2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
598
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
599
+ while (1) switch (_context8.prev = _context8.next) {
510
600
  case 0:
511
601
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
512
602
  if (isURL(onSuccess.redirectTo)) {
@@ -517,9 +607,9 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
517
607
  }
518
608
  case 1:
519
609
  case "end":
520
- return _context7.stop();
610
+ return _context8.stop();
521
611
  }
522
- }, _callee7);
612
+ }, _callee8);
523
613
  }));
524
614
  function onOk() {
525
615
  return _onOk2.apply(this, arguments);
@@ -532,28 +622,28 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
532
622
  }
533
623
  case 12:
534
624
  case "end":
535
- return _context8.stop();
625
+ return _context9.stop();
536
626
  }
537
- }, _callee8);
627
+ }, _callee9);
538
628
  }))();
539
629
  }
540
630
  };
541
631
  };
542
632
  exports.useCustomizeUpdateActionProps = useCustomizeUpdateActionProps;
543
633
  var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionProps() {
544
- var _ref5, _tableBlockContext$fi, _tableBlockContext$fi2, _tableBlockContext$fi3, _currentUserContext$d3;
545
- var _useBlockRequestConte3 = (0, _BlockProvider.useBlockRequestContext)(),
546
- field = _useBlockRequestConte3.field,
547
- resource = _useBlockRequestConte3.resource,
548
- __parent = _useBlockRequestConte3.__parent,
549
- service = _useBlockRequestConte3.service;
634
+ var _ref6, _tableBlockContext$fi, _tableBlockContext$fi2, _tableBlockContext$fi3, _currentUserContext$d4;
635
+ var _useBlockRequestConte4 = (0, _BlockProvider.useBlockRequestContext)(),
636
+ field = _useBlockRequestConte4.field,
637
+ resource = _useBlockRequestConte4.resource,
638
+ __parent = _useBlockRequestConte4.__parent,
639
+ service = _useBlockRequestConte4.service;
550
640
  var expressionScope = (0, _react2.useContext)(_react.SchemaExpressionScopeContext);
551
641
  var actionSchema = (0, _react.useFieldSchema)();
552
642
  var tableBlockContext = (0, _2.useTableBlockContext)();
553
643
  var rowKey = tableBlockContext.rowKey;
554
- var selectedRecordKeys = (_ref5 = (_tableBlockContext$fi = (_tableBlockContext$fi2 = tableBlockContext.field) === null || _tableBlockContext$fi2 === void 0 ? void 0 : (_tableBlockContext$fi3 = _tableBlockContext$fi2.data) === null || _tableBlockContext$fi3 === void 0 ? void 0 : _tableBlockContext$fi3.selectedRowKeys) !== null && _tableBlockContext$fi !== void 0 ? _tableBlockContext$fi : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref5 !== void 0 ? _ref5 : {};
644
+ var selectedRecordKeys = (_ref6 = (_tableBlockContext$fi = (_tableBlockContext$fi2 = tableBlockContext.field) === null || _tableBlockContext$fi2 === void 0 ? void 0 : (_tableBlockContext$fi3 = _tableBlockContext$fi2.data) === null || _tableBlockContext$fi3 === void 0 ? void 0 : _tableBlockContext$fi3.selectedRowKeys) !== null && _tableBlockContext$fi !== void 0 ? _tableBlockContext$fi : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref6 !== void 0 ? _ref6 : {};
555
645
  var currentUserContext = (0, _user.useCurrentUserContext)();
556
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
646
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
557
647
  var history = (0, _reactRouterDom.useHistory)();
558
648
  var compile = (0, _schemaComponent.useCompile)();
559
649
  var _useTranslation2 = (0, _reactI18next.useTranslation)(),
@@ -561,16 +651,16 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
561
651
  var actionField = (0, _react.useField)();
562
652
  return {
563
653
  onClick: function onClick() {
564
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
565
- var _actionSchema$xActio3;
566
- var _ref6, _ref6$assignedValues, originalAssignedValues, onSuccess, updateMode, assignedValues;
567
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
568
- while (1) switch (_context12.prev = _context12.next) {
654
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
655
+ var _actionSchema$xActio4;
656
+ var _ref7, _ref7$assignedValues, originalAssignedValues, onSuccess, updateMode, assignedValues;
657
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
658
+ while (1) switch (_context13.prev = _context13.next) {
569
659
  case 0:
570
- _ref6 = (_actionSchema$xActio3 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio3 !== void 0 ? _actionSchema$xActio3 : {}, _ref6$assignedValues = _ref6.assignedValues, originalAssignedValues = _ref6$assignedValues === void 0 ? {} : _ref6$assignedValues, onSuccess = _ref6.onSuccess, updateMode = _ref6.updateMode;
660
+ _ref7 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, _ref7$assignedValues = _ref7.assignedValues, originalAssignedValues = _ref7$assignedValues === void 0 ? {} : _ref7$assignedValues, onSuccess = _ref7.onSuccess, updateMode = _ref7.updateMode;
571
661
  actionField.data = field.data || {};
572
662
  actionField.data.loading = true;
573
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
663
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
574
664
  currentTime: new Date(),
575
665
  currentUser: currentUser
576
666
  });
@@ -578,29 +668,29 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
578
668
  title: t('Bulk update'),
579
669
  content: updateMode === 'selected' ? t('Update selected data?') : t('Update all data?'),
580
670
  onOk: function onOk() {
581
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
671
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
582
672
  var _service$params$, _service$params, _service$refresh2;
583
- var _ref7, filter, updateData, _parent$service3, _parent$service3$refr;
584
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
585
- while (1) switch (_context10.prev = _context10.next) {
673
+ var _ref8, filter, updateData, _parent$service3, _parent$service3$refr;
674
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
675
+ while (1) switch (_context11.prev = _context11.next) {
586
676
  case 0:
587
- _ref7 = (_service$params$ = (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params[0]) !== null && _service$params$ !== void 0 ? _service$params$ : {}, filter = _ref7.filter;
677
+ _ref8 = (_service$params$ = (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params[0]) !== null && _service$params$ !== void 0 ? _service$params$ : {}, filter = _ref8.filter;
588
678
  updateData = {
589
679
  values: _objectSpread({}, assignedValues),
590
680
  filter: filter,
591
681
  forceUpdate: false
592
682
  };
593
683
  if (!(updateMode === 'selected')) {
594
- _context10.next = 8;
684
+ _context11.next = 8;
595
685
  break;
596
686
  }
597
687
  if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
598
- _context10.next = 7;
688
+ _context11.next = 7;
599
689
  break;
600
690
  }
601
691
  _antd.message.error(t('Please select the records to be updated'));
602
692
  actionField.data.loading = false;
603
- return _context10.abrupt("return");
693
+ return _context11.abrupt("return");
604
694
  case 7:
605
695
  updateData.filter = {
606
696
  $and: [_defineProperty({}, rowKey || 'id', {
@@ -611,37 +701,37 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
611
701
  if (!updateData.filter) {
612
702
  updateData.forceUpdate = true;
613
703
  }
614
- _context10.prev = 9;
615
- _context10.next = 12;
704
+ _context11.prev = 9;
705
+ _context11.next = 12;
616
706
  return resource.update(updateData);
617
707
  case 12:
618
- _context10.next = 16;
708
+ _context11.next = 16;
619
709
  break;
620
710
  case 14:
621
- _context10.prev = 14;
622
- _context10.t0 = _context10["catch"](9);
711
+ _context11.prev = 14;
712
+ _context11.t0 = _context11["catch"](9);
623
713
  case 16:
624
- _context10.prev = 16;
714
+ _context11.prev = 16;
625
715
  actionField.data.loading = false;
626
- return _context10.finish(16);
716
+ return _context11.finish(16);
627
717
  case 19:
628
718
  service === null || service === void 0 ? void 0 : (_service$refresh2 = service.refresh) === null || _service$refresh2 === void 0 ? void 0 : _service$refresh2.call(service);
629
719
  if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
630
720
  __parent === null || __parent === void 0 ? void 0 : (_parent$service3 = __parent.service) === null || _parent$service3 === void 0 ? void 0 : (_parent$service3$refr = _parent$service3.refresh) === null || _parent$service3$refr === void 0 ? void 0 : _parent$service3$refr.call(_parent$service3);
631
721
  }
632
722
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
633
- _context10.next = 23;
723
+ _context11.next = 23;
634
724
  break;
635
725
  }
636
- return _context10.abrupt("return");
726
+ return _context11.abrupt("return");
637
727
  case 23:
638
728
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
639
729
  _antd.Modal.success({
640
730
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
641
731
  onOk: function () {
642
- var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
643
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
644
- while (1) switch (_context9.prev = _context9.next) {
732
+ var _onOk3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
733
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
734
+ while (1) switch (_context10.prev = _context10.next) {
645
735
  case 0:
646
736
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
647
737
  if (isURL(onSuccess.redirectTo)) {
@@ -652,9 +742,9 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
652
742
  }
653
743
  case 1:
654
744
  case "end":
655
- return _context9.stop();
745
+ return _context10.stop();
656
746
  }
657
- }, _callee9);
747
+ }, _callee10);
658
748
  }));
659
749
  function onOk() {
660
750
  return _onOk3.apply(this, arguments);
@@ -667,44 +757,44 @@ var useCustomizeBulkUpdateActionProps = function useCustomizeBulkUpdateActionPro
667
757
  }
668
758
  case 24:
669
759
  case "end":
670
- return _context10.stop();
760
+ return _context11.stop();
671
761
  }
672
- }, _callee10, null, [[9, 14, 16, 19]]);
762
+ }, _callee11, null, [[9, 14, 16, 19]]);
673
763
  }))();
674
764
  },
675
765
  onCancel: function onCancel() {
676
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
677
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
678
- while (1) switch (_context11.prev = _context11.next) {
766
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
767
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
768
+ while (1) switch (_context12.prev = _context12.next) {
679
769
  case 0:
680
770
  actionField.data.loading = false;
681
771
  case 1:
682
772
  case "end":
683
- return _context11.stop();
773
+ return _context12.stop();
684
774
  }
685
- }, _callee11);
775
+ }, _callee12);
686
776
  }))();
687
777
  }
688
778
  });
689
779
  case 5:
690
780
  case "end":
691
- return _context12.stop();
781
+ return _context13.stop();
692
782
  }
693
- }, _callee12);
783
+ }, _callee13);
694
784
  }))();
695
785
  }
696
786
  };
697
787
  };
698
788
  exports.useCustomizeBulkUpdateActionProps = useCustomizeBulkUpdateActionProps;
699
789
  var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps() {
700
- var _ref9, _tableBlockContext$fi4, _tableBlockContext$fi5, _tableBlockContext$fi6;
790
+ var _ref10, _tableBlockContext$fi4, _tableBlockContext$fi5, _tableBlockContext$fi6;
701
791
  var form = (0, _react.useForm)();
702
792
  var _useTranslation3 = (0, _reactI18next.useTranslation)(),
703
793
  t = _useTranslation3.t;
704
- var _useBlockRequestConte4 = (0, _BlockProvider.useBlockRequestContext)(),
705
- field = _useBlockRequestConte4.field,
706
- resource = _useBlockRequestConte4.resource,
707
- __parent = _useBlockRequestConte4.__parent;
794
+ var _useBlockRequestConte5 = (0, _BlockProvider.useBlockRequestContext)(),
795
+ field = _useBlockRequestConte5.field,
796
+ resource = _useBlockRequestConte5.resource,
797
+ __parent = _useBlockRequestConte5.__parent;
708
798
  var expressionScope = (0, _react2.useContext)(_react.SchemaExpressionScopeContext);
709
799
  var actionContext = (0, _schemaComponent.useActionContext)();
710
800
  var history = (0, _reactRouterDom.useHistory)();
@@ -712,24 +802,24 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
712
802
  var actionField = (0, _react.useField)();
713
803
  var tableBlockContext = (0, _2.useTableBlockContext)();
714
804
  var rowKey = tableBlockContext.rowKey;
715
- var selectedRecordKeys = (_ref9 = (_tableBlockContext$fi4 = (_tableBlockContext$fi5 = tableBlockContext.field) === null || _tableBlockContext$fi5 === void 0 ? void 0 : (_tableBlockContext$fi6 = _tableBlockContext$fi5.data) === null || _tableBlockContext$fi6 === void 0 ? void 0 : _tableBlockContext$fi6.selectedRowKeys) !== null && _tableBlockContext$fi4 !== void 0 ? _tableBlockContext$fi4 : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref9 !== void 0 ? _ref9 : {};
805
+ var selectedRecordKeys = (_ref10 = (_tableBlockContext$fi4 = (_tableBlockContext$fi5 = tableBlockContext.field) === null || _tableBlockContext$fi5 === void 0 ? void 0 : (_tableBlockContext$fi6 = _tableBlockContext$fi5.data) === null || _tableBlockContext$fi6 === void 0 ? void 0 : _tableBlockContext$fi6.selectedRowKeys) !== null && _tableBlockContext$fi4 !== void 0 ? _tableBlockContext$fi4 : expressionScope === null || expressionScope === void 0 ? void 0 : expressionScope.selectedRecordKeys) !== null && _ref10 !== void 0 ? _ref10 : {};
716
806
  var setVisible = actionContext.setVisible,
717
807
  actionSchema = actionContext.fieldSchema;
718
808
  return {
719
809
  onClick: function onClick() {
720
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
721
- var _actionSchema$xActio4, _parent$service$para, _parent$service$para2;
722
- var _ref10, onSuccess, skipValidator, updateMode, _ref11, filter, values, key, value, _parent$service4, _parent$service4$refr, updateData, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
723
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
724
- while (1) switch (_context14.prev = _context14.next) {
810
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
811
+ var _actionSchema$xActio5, _parent$service$para, _parent$service$para2;
812
+ var _ref11, onSuccess, skipValidator, updateMode, _ref12, filter, values, key, value, _parent$service4, _parent$service4$refr, updateData, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
813
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
814
+ while (1) switch (_context15.prev = _context15.next) {
725
815
  case 0:
726
- _ref10 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, onSuccess = _ref10.onSuccess, skipValidator = _ref10.skipValidator, updateMode = _ref10.updateMode;
727
- _ref11 = (_parent$service$para = (_parent$service$para2 = __parent.service.params) === null || _parent$service$para2 === void 0 ? void 0 : _parent$service$para2[0]) !== null && _parent$service$para !== void 0 ? _parent$service$para : {}, filter = _ref11.filter;
816
+ _ref11 = (_actionSchema$xActio5 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio5 !== void 0 ? _actionSchema$xActio5 : {}, onSuccess = _ref11.onSuccess, skipValidator = _ref11.skipValidator, updateMode = _ref11.updateMode;
817
+ _ref12 = (_parent$service$para = (_parent$service$para2 = __parent.service.params) === null || _parent$service$para2 === void 0 ? void 0 : _parent$service$para2[0]) !== null && _parent$service$para !== void 0 ? _parent$service$para : {}, filter = _ref12.filter;
728
818
  if (skipValidator) {
729
- _context14.next = 5;
819
+ _context15.next = 5;
730
820
  break;
731
821
  }
732
- _context14.next = 5;
822
+ _context15.next = 5;
733
823
  return form.submit();
734
824
  case 5:
735
825
  values = (0, _lodash.cloneDeep)(form.values);
@@ -747,22 +837,22 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
747
837
  }
748
838
  }
749
839
  }
750
- _context14.prev = 9;
840
+ _context15.prev = 9;
751
841
  updateData = {
752
842
  values: values,
753
843
  filter: filter,
754
844
  forceUpdate: false
755
845
  };
756
846
  if (!(updateMode === 'selected')) {
757
- _context14.next = 16;
847
+ _context15.next = 16;
758
848
  break;
759
849
  }
760
850
  if (selectedRecordKeys === null || selectedRecordKeys === void 0 ? void 0 : selectedRecordKeys.length) {
761
- _context14.next = 15;
851
+ _context15.next = 15;
762
852
  break;
763
853
  }
764
854
  _antd.message.error(t('Please select the records to be updated'));
765
- return _context14.abrupt("return");
855
+ return _context15.abrupt("return");
766
856
  case 15:
767
857
  updateData.filter = {
768
858
  $and: [_defineProperty({}, rowKey || 'id', {
@@ -773,7 +863,7 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
773
863
  if (!updateData.filter) {
774
864
  updateData.forceUpdate = true;
775
865
  }
776
- _context14.next = 19;
866
+ _context15.next = 19;
777
867
  return resource.update(updateData);
778
868
  case 19:
779
869
  actionField.data.loading = false;
@@ -783,20 +873,20 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
783
873
  __parent === null || __parent === void 0 ? void 0 : (_parent$service4 = __parent.service) === null || _parent$service4 === void 0 ? void 0 : (_parent$service4$refr = _parent$service4.refresh) === null || _parent$service4$refr === void 0 ? void 0 : _parent$service4$refr.call(_parent$service4);
784
874
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
785
875
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
786
- _context14.next = 25;
876
+ _context15.next = 25;
787
877
  break;
788
878
  }
789
- return _context14.abrupt("return");
879
+ return _context15.abrupt("return");
790
880
  case 25:
791
881
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
792
882
  _antd.Modal.success({
793
883
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
794
884
  onOk: function () {
795
- var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
796
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
797
- while (1) switch (_context13.prev = _context13.next) {
885
+ var _onOk4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
886
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
887
+ while (1) switch (_context14.prev = _context14.next) {
798
888
  case 0:
799
- _context13.next = 2;
889
+ _context14.next = 2;
800
890
  return form.reset();
801
891
  case 2:
802
892
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
@@ -808,9 +898,9 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
808
898
  }
809
899
  case 3:
810
900
  case "end":
811
- return _context13.stop();
901
+ return _context14.stop();
812
902
  }
813
- }, _callee13);
903
+ }, _callee14);
814
904
  }));
815
905
  function onOk() {
816
906
  return _onOk4.apply(this, arguments);
@@ -822,62 +912,62 @@ var useCustomizeBulkEditActionProps = function useCustomizeBulkEditActionProps()
822
912
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
823
913
  }
824
914
  case 26:
825
- _context14.prev = 26;
915
+ _context15.prev = 26;
826
916
  actionField.data.loading = false;
827
- return _context14.finish(26);
917
+ return _context15.finish(26);
828
918
  case 29:
829
919
  case "end":
830
- return _context14.stop();
920
+ return _context15.stop();
831
921
  }
832
- }, _callee14, null, [[9,, 26, 29]]);
922
+ }, _callee15, null, [[9,, 26, 29]]);
833
923
  }))();
834
924
  }
835
925
  };
836
926
  };
837
927
  exports.useCustomizeBulkEditActionProps = useCustomizeBulkEditActionProps;
838
928
  var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
839
- var _currentUserContext$d4;
929
+ var _currentUserContext$d5;
840
930
  var apiClient = (0, _apiClient.useAPIClient)();
841
931
  var history = (0, _reactRouterDom.useHistory)();
842
932
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
843
933
  var actionSchema = (0, _react.useFieldSchema)();
844
934
  var compile = (0, _schemaComponent.useCompile)();
845
935
  var form = (0, _react.useForm)();
846
- var _useCollection3 = (0, _collectionManager.useCollection)(),
847
- fields = _useCollection3.fields,
848
- getField = _useCollection3.getField;
849
- var _useBlockRequestConte5 = (0, _BlockProvider.useBlockRequestContext)(),
850
- field = _useBlockRequestConte5.field,
851
- resource = _useBlockRequestConte5.resource,
852
- __parent = _useBlockRequestConte5.__parent,
853
- service = _useBlockRequestConte5.service;
936
+ var _useCollection4 = (0, _collectionManager.useCollection)(),
937
+ fields = _useCollection4.fields,
938
+ getField = _useCollection4.getField;
939
+ var _useBlockRequestConte6 = (0, _BlockProvider.useBlockRequestContext)(),
940
+ field = _useBlockRequestConte6.field,
941
+ resource = _useBlockRequestConte6.resource,
942
+ __parent = _useBlockRequestConte6.__parent,
943
+ service = _useBlockRequestConte6.service;
854
944
  var currentRecord = (0, _recordProvider.useRecord)();
855
945
  var currentUserContext = (0, _user.useCurrentUserContext)();
856
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
946
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d5 = currentUserContext.data) === null || _currentUserContext$d5 === void 0 ? void 0 : _currentUserContext$d5.data;
857
947
  var actionField = (0, _react.useField)();
858
- var _useActionContext2 = (0, _schemaComponent.useActionContext)(),
859
- setVisible = _useActionContext2.setVisible;
948
+ var _useActionContext3 = (0, _schemaComponent.useActionContext)(),
949
+ setVisible = _useActionContext3.setVisible;
860
950
  return {
861
951
  onClick: function onClick() {
862
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
863
- var _actionSchema$xActio5;
864
- var _ref13, skipValidator, onSuccess, requestSettings, xAction, headers, params, data, methods, fieldNames, values, requestBody, _service$refresh3, _parent$service5, _parent$service5$refr;
865
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
866
- while (1) switch (_context16.prev = _context16.next) {
952
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
953
+ var _actionSchema$xActio6;
954
+ var _ref14, skipValidator, onSuccess, requestSettings, xAction, headers, params, data, methods, fieldNames, values, requestBody, _service$refresh3, _parent$service5, _parent$service5$refr;
955
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
956
+ while (1) switch (_context17.prev = _context17.next) {
867
957
  case 0:
868
- _ref13 = (_actionSchema$xActio5 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio5 !== void 0 ? _actionSchema$xActio5 : {}, skipValidator = _ref13.skipValidator, onSuccess = _ref13.onSuccess, requestSettings = _ref13.requestSettings;
958
+ _ref14 = (_actionSchema$xActio6 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio6 !== void 0 ? _actionSchema$xActio6 : {}, skipValidator = _ref14.skipValidator, onSuccess = _ref14.onSuccess, requestSettings = _ref14.requestSettings;
869
959
  xAction = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action'];
870
960
  if (requestSettings['url']) {
871
- _context16.next = 4;
961
+ _context17.next = 4;
872
962
  break;
873
963
  }
874
- return _context16.abrupt("return");
964
+ return _context17.abrupt("return");
875
965
  case 4:
876
966
  if (!(skipValidator !== true && xAction === 'customize:form:request')) {
877
- _context16.next = 7;
967
+ _context17.next = 7;
878
968
  break;
879
969
  }
880
- _context16.next = 7;
970
+ _context17.next = 7;
881
971
  return form.submit();
882
972
  case 7:
883
973
  headers = requestSettings['headers'] ? JSON.parse(requestSettings['headers']) : {};
@@ -897,23 +987,23 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
897
987
  currentUser: currentUser
898
988
  }),
899
989
  method: requestSettings['method'],
900
- headers: (0, _jsonTemplates.default)(headers)({
990
+ headers: (0, _client.parse)(headers)({
901
991
  currentRecord: currentRecord,
902
992
  currentUser: currentUser
903
993
  }),
904
- params: (0, _jsonTemplates.default)(params)({
994
+ params: (0, _client.parse)(params)({
905
995
  currentRecord: currentRecord,
906
996
  currentUser: currentUser
907
997
  }),
908
- data: (0, _jsonTemplates.default)(data)({
998
+ data: (0, _client.parse)(data)({
909
999
  currentRecord: currentRecord,
910
1000
  currentUser: currentUser
911
1001
  })
912
1002
  };
913
1003
  actionField.data = field.data || {};
914
1004
  actionField.data.loading = true;
915
- _context16.prev = 15;
916
- _context16.next = 18;
1005
+ _context17.prev = 15;
1006
+ _context17.next = 18;
917
1007
  return apiClient.request(_objectSpread({}, requestBody));
918
1008
  case 18:
919
1009
  actionField.data.loading = false;
@@ -925,18 +1015,18 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
925
1015
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
926
1016
  }
927
1017
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
928
- _context16.next = 24;
1018
+ _context17.next = 24;
929
1019
  break;
930
1020
  }
931
- return _context16.abrupt("return");
1021
+ return _context17.abrupt("return");
932
1022
  case 24:
933
1023
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
934
1024
  _antd.Modal.success({
935
1025
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
936
1026
  onOk: function () {
937
- var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
938
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
939
- while (1) switch (_context15.prev = _context15.next) {
1027
+ var _onOk5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1028
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1029
+ while (1) switch (_context16.prev = _context16.next) {
940
1030
  case 0:
941
1031
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
942
1032
  if (isURL(onSuccess.redirectTo)) {
@@ -947,9 +1037,9 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
947
1037
  }
948
1038
  case 1:
949
1039
  case "end":
950
- return _context15.stop();
1040
+ return _context16.stop();
951
1041
  }
952
- }, _callee15);
1042
+ }, _callee16);
953
1043
  }));
954
1044
  function onOk() {
955
1045
  return _onOk5.apply(this, arguments);
@@ -961,60 +1051,60 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
961
1051
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
962
1052
  }
963
1053
  case 25:
964
- _context16.prev = 25;
1054
+ _context17.prev = 25;
965
1055
  actionField.data.loading = false;
966
- return _context16.finish(25);
1056
+ return _context17.finish(25);
967
1057
  case 28:
968
1058
  case "end":
969
- return _context16.stop();
1059
+ return _context17.stop();
970
1060
  }
971
- }, _callee16, null, [[15,, 25, 28]]);
1061
+ }, _callee17, null, [[15,, 25, 28]]);
972
1062
  }))();
973
1063
  }
974
1064
  };
975
1065
  };
976
1066
  exports.useCustomizeRequestActionProps = useCustomizeRequestActionProps;
977
1067
  var useUpdateActionProps = function useUpdateActionProps() {
978
- var _currentUserContext$d5;
1068
+ var _currentUserContext$d6;
979
1069
  var form = (0, _react.useForm)();
980
1070
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
981
- var _useBlockRequestConte6 = (0, _BlockProvider.useBlockRequestContext)(),
982
- field = _useBlockRequestConte6.field,
983
- resource = _useBlockRequestConte6.resource,
984
- __parent = _useBlockRequestConte6.__parent;
985
- var _useActionContext3 = (0, _schemaComponent.useActionContext)(),
986
- setVisible = _useActionContext3.setVisible;
1071
+ var _useBlockRequestConte7 = (0, _BlockProvider.useBlockRequestContext)(),
1072
+ field = _useBlockRequestConte7.field,
1073
+ resource = _useBlockRequestConte7.resource,
1074
+ __parent = _useBlockRequestConte7.__parent;
1075
+ var _useActionContext4 = (0, _schemaComponent.useActionContext)(),
1076
+ setVisible = _useActionContext4.setVisible;
987
1077
  var actionSchema = (0, _react.useFieldSchema)();
988
1078
  var history = (0, _reactRouterDom.useHistory)();
989
- var _useCollection4 = (0, _collectionManager.useCollection)(),
990
- fields = _useCollection4.fields,
991
- getField = _useCollection4.getField;
1079
+ var _useCollection5 = (0, _collectionManager.useCollection)(),
1080
+ fields = _useCollection5.fields,
1081
+ getField = _useCollection5.getField;
992
1082
  var compile = (0, _schemaComponent.useCompile)();
993
1083
  var actionField = (0, _react.useField)();
994
1084
  var _useFormBlockContext = (0, _2.useFormBlockContext)(),
995
1085
  updateAssociationValues = _useFormBlockContext.updateAssociationValues;
996
1086
  var currentRecord = (0, _recordProvider.useRecord)();
997
1087
  var currentUserContext = (0, _user.useCurrentUserContext)();
998
- var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d5 = currentUserContext.data) === null || _currentUserContext$d5 === void 0 ? void 0 : _currentUserContext$d5.data;
1088
+ var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d6 = currentUserContext.data) === null || _currentUserContext$d6 === void 0 ? void 0 : _currentUserContext$d6.data;
999
1089
  return {
1000
1090
  onClick: function onClick() {
1001
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1002
- var _actionSchema$xActio6;
1003
- var _ref14, _ref14$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service6, _parent$service6$refr, _parent$__parent2, _parent$__parent2$ser, _parent$__parent2$ser2;
1004
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1005
- while (1) switch (_context18.prev = _context18.next) {
1091
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1092
+ var _actionSchema$xActio7;
1093
+ var _ref15, _ref15$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service6, _parent$service6$refr;
1094
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1095
+ while (1) switch (_context19.prev = _context19.next) {
1006
1096
  case 0:
1007
- _ref14 = (_actionSchema$xActio6 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio6 !== void 0 ? _actionSchema$xActio6 : {}, _ref14$assignedValues = _ref14.assignedValues, originalAssignedValues = _ref14$assignedValues === void 0 ? {} : _ref14$assignedValues, onSuccess = _ref14.onSuccess, overwriteValues = _ref14.overwriteValues, skipValidator = _ref14.skipValidator;
1008
- assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
1097
+ _ref15 = (_actionSchema$xActio7 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio7 !== void 0 ? _actionSchema$xActio7 : {}, _ref15$assignedValues = _ref15.assignedValues, originalAssignedValues = _ref15$assignedValues === void 0 ? {} : _ref15$assignedValues, onSuccess = _ref15.onSuccess, overwriteValues = _ref15.overwriteValues, skipValidator = _ref15.skipValidator;
1098
+ assignedValues = (0, _client.parse)(originalAssignedValues)({
1009
1099
  currentTime: new Date(),
1010
1100
  currentRecord: currentRecord,
1011
1101
  currentUser: currentUser
1012
1102
  });
1013
1103
  if (skipValidator) {
1014
- _context18.next = 5;
1104
+ _context19.next = 5;
1015
1105
  break;
1016
1106
  }
1017
- _context18.next = 5;
1107
+ _context19.next = 5;
1018
1108
  return form.submit();
1019
1109
  case 5:
1020
1110
  fieldNames = fields.map(function (field) {
@@ -1023,8 +1113,8 @@ var useUpdateActionProps = function useUpdateActionProps() {
1023
1113
  values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
1024
1114
  actionField.data = field.data || {};
1025
1115
  actionField.data.loading = true;
1026
- _context18.prev = 9;
1027
- _context18.next = 12;
1116
+ _context19.prev = 9;
1117
+ _context19.next = 12;
1028
1118
  return resource.update({
1029
1119
  filterByTk: filterByTk,
1030
1120
  values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues),
@@ -1032,26 +1122,23 @@ var useUpdateActionProps = function useUpdateActionProps() {
1032
1122
  });
1033
1123
  case 12:
1034
1124
  actionField.data.loading = false;
1035
- if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
1036
- __parent === null || __parent === void 0 ? void 0 : (_parent$__parent2 = __parent.__parent) === null || _parent$__parent2 === void 0 ? void 0 : (_parent$__parent2$ser = _parent$__parent2.service) === null || _parent$__parent2$ser === void 0 ? void 0 : (_parent$__parent2$ser2 = _parent$__parent2$ser.refresh) === null || _parent$__parent2$ser2 === void 0 ? void 0 : _parent$__parent2$ser2.call(_parent$__parent2$ser);
1037
- }
1038
1125
  __parent === null || __parent === void 0 ? void 0 : (_parent$service6 = __parent.service) === null || _parent$service6 === void 0 ? void 0 : (_parent$service6$refr = _parent$service6.refresh) === null || _parent$service6$refr === void 0 ? void 0 : _parent$service6$refr.call(_parent$service6);
1039
1126
  setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
1040
1127
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
1041
- _context18.next = 18;
1128
+ _context19.next = 17;
1042
1129
  break;
1043
1130
  }
1044
- return _context18.abrupt("return");
1045
- case 18:
1131
+ return _context19.abrupt("return");
1132
+ case 17:
1046
1133
  if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
1047
1134
  _antd.Modal.success({
1048
1135
  title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
1049
1136
  onOk: function () {
1050
- var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1051
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1052
- while (1) switch (_context17.prev = _context17.next) {
1137
+ var _onOk6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1138
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1139
+ while (1) switch (_context18.prev = _context18.next) {
1053
1140
  case 0:
1054
- _context17.next = 2;
1141
+ _context18.next = 2;
1055
1142
  return form.reset();
1056
1143
  case 2:
1057
1144
  if ((onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirecting) && (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.redirectTo)) {
@@ -1063,9 +1150,9 @@ var useUpdateActionProps = function useUpdateActionProps() {
1063
1150
  }
1064
1151
  case 3:
1065
1152
  case "end":
1066
- return _context17.stop();
1153
+ return _context18.stop();
1067
1154
  }
1068
- }, _callee17);
1155
+ }, _callee18);
1069
1156
  }));
1070
1157
  function onOk() {
1071
1158
  return _onOk6.apply(this, arguments);
@@ -1076,17 +1163,17 @@ var useUpdateActionProps = function useUpdateActionProps() {
1076
1163
  } else {
1077
1164
  _antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
1078
1165
  }
1079
- _context18.next = 24;
1166
+ _context19.next = 23;
1080
1167
  break;
1081
- case 21:
1082
- _context18.prev = 21;
1083
- _context18.t0 = _context18["catch"](9);
1168
+ case 20:
1169
+ _context19.prev = 20;
1170
+ _context19.t0 = _context19["catch"](9);
1084
1171
  actionField.data.loading = false;
1085
- case 24:
1172
+ case 23:
1086
1173
  case "end":
1087
- return _context18.stop();
1174
+ return _context19.stop();
1088
1175
  }
1089
- }, _callee18, null, [[9, 21]]);
1176
+ }, _callee19, null, [[9, 20]]);
1090
1177
  }))();
1091
1178
  }
1092
1179
  };
@@ -1094,27 +1181,27 @@ var useUpdateActionProps = function useUpdateActionProps() {
1094
1181
  exports.useUpdateActionProps = useUpdateActionProps;
1095
1182
  var useDestroyActionProps = function useDestroyActionProps() {
1096
1183
  var filterByTk = (0, _BlockProvider.useFilterByTk)();
1097
- var _useBlockRequestConte7 = (0, _BlockProvider.useBlockRequestContext)(),
1098
- resource = _useBlockRequestConte7.resource,
1099
- service = _useBlockRequestConte7.service,
1100
- block = _useBlockRequestConte7.block,
1101
- __parent = _useBlockRequestConte7.__parent;
1102
- var _useActionContext4 = (0, _schemaComponent.useActionContext)(),
1103
- setVisible = _useActionContext4.setVisible;
1184
+ var _useBlockRequestConte8 = (0, _BlockProvider.useBlockRequestContext)(),
1185
+ resource = _useBlockRequestConte8.resource,
1186
+ service = _useBlockRequestConte8.service,
1187
+ block = _useBlockRequestConte8.block,
1188
+ __parent = _useBlockRequestConte8.__parent;
1189
+ var _useActionContext5 = (0, _schemaComponent.useActionContext)(),
1190
+ setVisible = _useActionContext5.setVisible;
1104
1191
  return {
1105
1192
  onClick: function onClick() {
1106
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1193
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1107
1194
  var _service$data;
1108
- var _ref15, _ref15$count, count, _ref15$page, page, _ref15$pageSize, pageSize, _service$params2, _service$refresh4, _parent$service7, _parent$service7$refr;
1109
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1110
- while (1) switch (_context19.prev = _context19.next) {
1195
+ var _ref16, _ref16$count, count, _ref16$page, page, _ref16$pageSize, pageSize, _service$params2, _service$refresh4, _parent$service7, _parent$service7$refr;
1196
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1197
+ while (1) switch (_context20.prev = _context20.next) {
1111
1198
  case 0:
1112
- _context19.next = 2;
1199
+ _context20.next = 2;
1113
1200
  return resource.destroy({
1114
1201
  filterByTk: filterByTk
1115
1202
  });
1116
1203
  case 2:
1117
- _ref15 = (service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.meta) || {}, _ref15$count = _ref15.count, count = _ref15$count === void 0 ? 0 : _ref15$count, _ref15$page = _ref15.page, page = _ref15$page === void 0 ? 0 : _ref15$page, _ref15$pageSize = _ref15.pageSize, pageSize = _ref15$pageSize === void 0 ? 0 : _ref15$pageSize;
1204
+ _ref16 = (service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.meta) || {}, _ref16$count = _ref16.count, count = _ref16$count === void 0 ? 0 : _ref16$count, _ref16$page = _ref16.page, page = _ref16$page === void 0 ? 0 : _ref16$page, _ref16$pageSize = _ref16.pageSize, pageSize = _ref16$pageSize === void 0 ? 0 : _ref16$pageSize;
1118
1205
  if (count % pageSize === 1) {
1119
1206
  service.run(_objectSpread(_objectSpread({}, service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2[0]), {}, {
1120
1207
  page: page - 1
@@ -1128,14 +1215,38 @@ var useDestroyActionProps = function useDestroyActionProps() {
1128
1215
  }
1129
1216
  case 5:
1130
1217
  case "end":
1131
- return _context19.stop();
1218
+ return _context20.stop();
1132
1219
  }
1133
- }, _callee19);
1220
+ }, _callee20);
1134
1221
  }))();
1135
1222
  }
1136
1223
  };
1137
1224
  };
1138
1225
  exports.useDestroyActionProps = useDestroyActionProps;
1226
+ var useRemoveActionProps = function useRemoveActionProps(associationName) {
1227
+ var filterByTk = (0, _BlockProvider.useFilterByTk)();
1228
+ var api = (0, _apiClient.useAPIClient)();
1229
+ var resource = api.resource(associationName, filterByTk);
1230
+ return {
1231
+ onClick: function onClick(value) {
1232
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1233
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1234
+ while (1) switch (_context21.prev = _context21.next) {
1235
+ case 0:
1236
+ _context21.next = 2;
1237
+ return resource.remove({
1238
+ values: [value.id]
1239
+ });
1240
+ case 2:
1241
+ case "end":
1242
+ return _context21.stop();
1243
+ }
1244
+ }, _callee21);
1245
+ }))();
1246
+ }
1247
+ };
1248
+ };
1249
+ exports.useRemoveActionProps = useRemoveActionProps;
1139
1250
  var useDetailPrintActionProps = function useDetailPrintActionProps() {
1140
1251
  var _useFormBlockContext2 = (0, _2.useFormBlockContext)(),
1141
1252
  formBlockRef = _useFormBlockContext2.formBlockRef;
@@ -1147,41 +1258,41 @@ var useDetailPrintActionProps = function useDetailPrintActionProps() {
1147
1258
  });
1148
1259
  return {
1149
1260
  onClick: function onClick() {
1150
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1151
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1152
- while (1) switch (_context20.prev = _context20.next) {
1261
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1262
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1263
+ while (1) switch (_context22.prev = _context22.next) {
1153
1264
  case 0:
1154
1265
  printHandler();
1155
1266
  case 1:
1156
1267
  case "end":
1157
- return _context20.stop();
1268
+ return _context22.stop();
1158
1269
  }
1159
- }, _callee20);
1270
+ }, _callee22);
1160
1271
  }))();
1161
1272
  }
1162
1273
  };
1163
1274
  };
1164
1275
  exports.useDetailPrintActionProps = useDetailPrintActionProps;
1165
1276
  var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
1166
- var _useBlockRequestConte8 = (0, _BlockProvider.useBlockRequestContext)(),
1167
- field = _useBlockRequestConte8.field;
1168
1277
  var _useBlockRequestConte9 = (0, _BlockProvider.useBlockRequestContext)(),
1169
- resource = _useBlockRequestConte9.resource,
1170
- service = _useBlockRequestConte9.service;
1278
+ field = _useBlockRequestConte9.field;
1279
+ var _useBlockRequestConte10 = (0, _BlockProvider.useBlockRequestContext)(),
1280
+ resource = _useBlockRequestConte10.resource,
1281
+ service = _useBlockRequestConte10.service;
1171
1282
  return {
1172
1283
  onClick: function onClick() {
1173
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1284
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1174
1285
  var _field$data2, _field$data2$selected, _field$data3, _service$refresh5;
1175
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1176
- while (1) switch (_context21.prev = _context21.next) {
1286
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1287
+ while (1) switch (_context23.prev = _context23.next) {
1177
1288
  case 0:
1178
1289
  if (field === null || field === void 0 ? void 0 : (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : (_field$data2$selected = _field$data2.selectedRowKeys) === null || _field$data2$selected === void 0 ? void 0 : _field$data2$selected.length) {
1179
- _context21.next = 2;
1290
+ _context23.next = 2;
1180
1291
  break;
1181
1292
  }
1182
- return _context21.abrupt("return");
1293
+ return _context23.abrupt("return");
1183
1294
  case 2:
1184
- _context21.next = 4;
1295
+ _context23.next = 4;
1185
1296
  return resource.destroy({
1186
1297
  filterByTk: (_field$data3 = field.data) === null || _field$data3 === void 0 ? void 0 : _field$data3.selectedRowKeys
1187
1298
  });
@@ -1190,30 +1301,30 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
1190
1301
  service === null || service === void 0 ? void 0 : (_service$refresh5 = service.refresh) === null || _service$refresh5 === void 0 ? void 0 : _service$refresh5.call(service);
1191
1302
  case 6:
1192
1303
  case "end":
1193
- return _context21.stop();
1304
+ return _context23.stop();
1194
1305
  }
1195
- }, _callee21);
1306
+ }, _callee23);
1196
1307
  }))();
1197
1308
  }
1198
1309
  };
1199
1310
  };
1200
1311
  exports.useBulkDestroyActionProps = useBulkDestroyActionProps;
1201
1312
  var useRefreshActionProps = function useRefreshActionProps() {
1202
- var _useBlockRequestConte10 = (0, _BlockProvider.useBlockRequestContext)(),
1203
- service = _useBlockRequestConte10.service;
1313
+ var _useBlockRequestConte11 = (0, _BlockProvider.useBlockRequestContext)(),
1314
+ service = _useBlockRequestConte11.service;
1204
1315
  return {
1205
1316
  onClick: function onClick() {
1206
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1317
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1207
1318
  var _service$refresh6;
1208
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1209
- while (1) switch (_context22.prev = _context22.next) {
1319
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1320
+ while (1) switch (_context24.prev = _context24.next) {
1210
1321
  case 0:
1211
1322
  service === null || service === void 0 ? void 0 : (_service$refresh6 = service.refresh) === null || _service$refresh6 === void 0 ? void 0 : _service$refresh6.call(service);
1212
1323
  case 1:
1213
1324
  case "end":
1214
- return _context22.stop();
1325
+ return _context24.stop();
1215
1326
  }
1216
- }, _callee22);
1327
+ }, _callee24);
1217
1328
  }))();
1218
1329
  }
1219
1330
  };
@@ -1230,11 +1341,11 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
1230
1341
  total: count,
1231
1342
  pageSize: 1,
1232
1343
  onChange: function onChange(page) {
1233
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1344
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1234
1345
  var _ctx$service3, _ctx$service3$params;
1235
1346
  var params;
1236
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1237
- while (1) switch (_context23.prev = _context23.next) {
1347
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1348
+ while (1) switch (_context25.prev = _context25.next) {
1238
1349
  case 0:
1239
1350
  params = (_ctx$service3 = ctx.service) === null || _ctx$service3 === void 0 ? void 0 : (_ctx$service3$params = _ctx$service3.params) === null || _ctx$service3$params === void 0 ? void 0 : _ctx$service3$params[0];
1240
1351
  ctx.service.run(_objectSpread(_objectSpread({}, params), {}, {
@@ -1242,9 +1353,9 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
1242
1353
  }));
1243
1354
  case 2:
1244
1355
  case "end":
1245
- return _context23.stop();
1356
+ return _context25.stop();
1246
1357
  }
1247
- }, _callee23);
1358
+ }, _callee25);
1248
1359
  }))();
1249
1360
  },
1250
1361
  style: {
@@ -1255,14 +1366,14 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
1255
1366
  };
1256
1367
  exports.useDetailsPaginationProps = useDetailsPaginationProps;
1257
1368
  var useAssociationFilterProps = function useAssociationFilterProps() {
1258
- var _fieldSchema$xCompon2, _fieldSchema$xCompon3, _field$componentProps, _field$componentProps2;
1369
+ var _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps, _field$componentProps2;
1259
1370
  var collectionField = _2.AssociationFilter.useAssociationField();
1260
- var _useBlockRequestConte11 = (0, _BlockProvider.useBlockRequestContext)(),
1261
- service = _useBlockRequestConte11.service,
1262
- blockProps = _useBlockRequestConte11.props;
1371
+ var _useBlockRequestConte12 = (0, _BlockProvider.useBlockRequestContext)(),
1372
+ service = _useBlockRequestConte12.service,
1373
+ blockProps = _useBlockRequestConte12.props;
1263
1374
  var fieldSchema = (0, _react.useFieldSchema)();
1264
1375
  var valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
1265
- var labelKey = ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : (_fieldSchema$xCompon3 = _fieldSchema$xCompon2.fieldNames) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.label) || valueKey;
1376
+ var labelKey = ((_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : (_fieldSchema$xCompon4 = _fieldSchema$xCompon3.fieldNames) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.label) || valueKey;
1266
1377
  var field = (0, _react.useField)();
1267
1378
  var collectionFieldName = collectionField.name;
1268
1379
  var _useRequest = (0, _apiClient.useRequest)({
@@ -1313,9 +1424,9 @@ var useAssociationFilterProps = function useAssociationFilterProps() {
1313
1424
  };
1314
1425
  exports.useAssociationFilterProps = useAssociationFilterProps;
1315
1426
  var useOptionalFieldList = function useOptionalFieldList() {
1316
- var _useCollection5 = (0, _collectionManager.useCollection)(),
1317
- _useCollection5$curre = _useCollection5.currentFields,
1318
- currentFields = _useCollection5$curre === void 0 ? [] : _useCollection5$curre;
1427
+ var _useCollection6 = (0, _collectionManager.useCollection)(),
1428
+ _useCollection6$curre = _useCollection6.currentFields,
1429
+ currentFields = _useCollection6$curre === void 0 ? [] : _useCollection6$curre;
1319
1430
  return currentFields.filter(function (field) {
1320
1431
  return isOptionalField(field) && field.uiSchema.enum;
1321
1432
  });
@@ -1326,7 +1437,7 @@ var isOptionalField = function isOptionalField(field) {
1326
1437
  return optionalInterfaces.includes(field.interface);
1327
1438
  };
1328
1439
  var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
1329
- var _fieldSchema$xCompon4, _fieldSchema$xCompon5, _field$componentProps3, _field$componentProps4;
1440
+ var _fieldSchema$xCompon5, _fieldSchema$xCompon6, _field$componentProps3, _field$componentProps4;
1330
1441
  var collectionField = _2.AssociationFilter.useAssociationField();
1331
1442
  var fieldSchema = (0, _react.useFieldSchema)();
1332
1443
  var optionalFieldList = useOptionalFieldList();
@@ -1336,7 +1447,7 @@ var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
1336
1447
  var field = (0, _react.useField)();
1337
1448
  var list, onSelected, handleSearchInput, params, run, data, valueKey, labelKey, filterKey;
1338
1449
  valueKey = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetKey) || 'id';
1339
- labelKey = ((_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : (_fieldSchema$xCompon5 = _fieldSchema$xCompon4.fieldNames) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : _fieldSchema$xCompon5.label) || valueKey;
1450
+ labelKey = ((_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : (_fieldSchema$xCompon6 = _fieldSchema$xCompon5.fieldNames) === null || _fieldSchema$xCompon6 === void 0 ? void 0 : _fieldSchema$xCompon6.label) || valueKey;
1340
1451
  var _useRequest2 = (0, _apiClient.useRequest)({
1341
1452
  resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
1342
1453
  action: 'list',
@@ -1438,4 +1549,134 @@ var useAssociationFilterBlockProps = function useAssociationFilterBlockProps() {
1438
1549
  labelKey: labelKey
1439
1550
  };
1440
1551
  };
1441
- exports.useAssociationFilterBlockProps = useAssociationFilterBlockProps;
1552
+ exports.useAssociationFilterBlockProps = useAssociationFilterBlockProps;
1553
+ var getTemplateSchema = function getTemplateSchema(schema) {
1554
+ var conf = {
1555
+ url: "/uiSchemas:getJsonSchema/".concat(schema === null || schema === void 0 ? void 0 : schema.uid)
1556
+ };
1557
+ var _useRequest3 = (0, _apiClient.useRequest)(conf, {
1558
+ manual: true
1559
+ }),
1560
+ data = _useRequest3.data,
1561
+ loading = _useRequest3.loading,
1562
+ run = _useRequest3.run;
1563
+ if (loading) {}
1564
+ (0, _react2.useEffect)(function () {
1565
+ if (schema === null || schema === void 0 ? void 0 : schema.uid) {
1566
+ run();
1567
+ }
1568
+ }, [schema === null || schema === void 0 ? void 0 : schema.uid]);
1569
+ return (schema === null || schema === void 0 ? void 0 : schema.uid) ? new _react.Schema(data === null || data === void 0 ? void 0 : data.data) : null;
1570
+ };
1571
+ var useAssociationNames = function useAssociationNames(collection) {
1572
+ var _templateSchema$xCom;
1573
+ var _useCollectionManager2 = (0, _collectionManager.useCollectionManager)(),
1574
+ getCollectionJoinField = _useCollectionManager2.getCollectionJoinField;
1575
+ var _useSchemaTemplateMan = (0, _schemaTemplates.useSchemaTemplateManager)(),
1576
+ getTemplateById = _useSchemaTemplateMan.getTemplateById;
1577
+ var fieldSchema = (0, _react.useFieldSchema)();
1578
+ var associationValues = [];
1579
+ var formSchema = fieldSchema.reduceProperties(function (buf, schema) {
1580
+ if (['FormV2', 'Details', 'List', 'GridCard'].includes(schema['x-component'])) {
1581
+ return schema;
1582
+ }
1583
+ return buf;
1584
+ }, new _react.Schema({}));
1585
+ var templateSchema = formSchema.reduceProperties(function (buf, schema) {
1586
+ if (schema['x-component'] === 'BlockTemplate') {
1587
+ return schema;
1588
+ }
1589
+ return buf;
1590
+ }, null);
1591
+ var getAssociationAppends = function getAssociationAppends(schema) {
1592
+ var arr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1593
+ var data = schema.reduceProperties(function (buf, s) {
1594
+ var collectionfield = s['x-collection-field'] && getCollectionJoinField(s['x-collection-field']);
1595
+ if (collectionfield && ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(collectionfield.type) && s['x-component'] !== 'TableField') {
1596
+ var _s$xComponentProps;
1597
+ buf.push(s.name);
1598
+ if (['Nester', 'SubTable'].includes((_s$xComponentProps = s['x-component-props']) === null || _s$xComponentProps === void 0 ? void 0 : _s$xComponentProps.mode)) {
1599
+ associationValues.push(s.name);
1600
+ }
1601
+ if (s['x-component-props'].mode === 'Nester') {
1602
+ return getAssociationAppends(s, buf);
1603
+ }
1604
+ return buf;
1605
+ } else {
1606
+ if (s['x-component'] === 'Grid.Row') {
1607
+ var _buf$concat;
1608
+ var kk = buf === null || buf === void 0 ? void 0 : (_buf$concat = buf.concat) === null || _buf$concat === void 0 ? void 0 : _buf$concat.call(buf);
1609
+ return getNesterAppends(s, kk || []);
1610
+ } else {
1611
+ var _s$xComponent;
1612
+ return !((_s$xComponent = s['x-component']) === null || _s$xComponent === void 0 ? void 0 : _s$xComponent.includes('Action.')) && s['x-component'] !== 'TableField' ? getAssociationAppends(s, buf) : buf;
1613
+ }
1614
+ }
1615
+ }, arr);
1616
+ return data || [];
1617
+ };
1618
+ function flattenNestedList(nestedList) {
1619
+ var flattenedList = [];
1620
+ function flattenHelper(list, prefix) {
1621
+ for (var i = 0; i < list.length; i++) {
1622
+ if (Array.isArray(list[i])) {
1623
+ "".concat(prefix) !== "".concat(list[i][0]) && flattenHelper(list[i], "".concat(prefix, ".").concat(list[i][0]));
1624
+ } else {
1625
+ var searchTerm = ".".concat(list[i]);
1626
+ var lastIndex = prefix.lastIndexOf(searchTerm);
1627
+ var str = '';
1628
+ if (lastIndex !== -1) {
1629
+ str = prefix.slice(0, lastIndex) + prefix.slice(lastIndex + searchTerm.length);
1630
+ }
1631
+ if (!str) {
1632
+ !list.includes(str) && flattenedList.push("".concat(list[i]));
1633
+ } else {
1634
+ !list.includes(str) ? flattenedList.push("".concat(str, ".").concat(list[i])) : flattenedList.push(str);
1635
+ }
1636
+ }
1637
+ }
1638
+ }
1639
+ for (var i = 0; i < nestedList.length; i++) {
1640
+ flattenHelper(nestedList[i], nestedList[i][0]);
1641
+ }
1642
+ return (0, _lodash.uniq)(flattenedList.filter(function (obj) {
1643
+ return !(obj === null || obj === void 0 ? void 0 : obj.startsWith('.'));
1644
+ }));
1645
+ }
1646
+ var getNesterAppends = function getNesterAppends(gridSchema, data) {
1647
+ gridSchema.reduceProperties(function (buf, s) {
1648
+ buf.push(getAssociationAppends(s));
1649
+ return buf;
1650
+ }, data);
1651
+ return data.filter(function (g) {
1652
+ return g.length;
1653
+ });
1654
+ };
1655
+ var template = getTemplateById(templateSchema === null || templateSchema === void 0 ? void 0 : (_templateSchema$xCom = templateSchema['x-component-props']) === null || _templateSchema$xCom === void 0 ? void 0 : _templateSchema$xCom.templateId);
1656
+ var schema = getTemplateSchema(template);
1657
+ if (schema) {
1658
+ var associations = getAssociationAppends(schema);
1659
+ var appends = flattenNestedList(associations);
1660
+ return {
1661
+ appends: appends,
1662
+ updateAssociationValues: appends.filter(function (item) {
1663
+ return associationValues.some(function (suffix) {
1664
+ return item.endsWith(suffix);
1665
+ });
1666
+ })
1667
+ };
1668
+ }
1669
+ if (!schema) {
1670
+ var _associations = getAssociationAppends(formSchema);
1671
+ var _appends = flattenNestedList(_associations);
1672
+ return {
1673
+ appends: _appends,
1674
+ updateAssociationValues: _appends.filter(function (item) {
1675
+ return associationValues.some(function (suffix) {
1676
+ return item.endsWith(suffix);
1677
+ });
1678
+ })
1679
+ };
1680
+ }
1681
+ };
1682
+ exports.useAssociationNames = useAssociationNames;