@nocobase/client 0.9.3-alpha.1 → 0.9.4-alpha.2

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 (331) 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/hooks/index.js +81 -60
  7. package/es/collection-manager/CollectionField.js +3 -3
  8. package/es/collection-manager/CollectionFieldProvider.js +2 -1
  9. package/es/collection-manager/Configuration/AddFieldAction.js +3 -3
  10. package/es/collection-manager/Configuration/CollectionFields.d.ts +1 -1
  11. package/es/collection-manager/Configuration/CollectionFields.js +1 -3
  12. package/es/collection-manager/Configuration/ConfigurationTabs.js +7 -6
  13. package/es/collection-manager/hooks/useCollection.d.ts +1 -1
  14. package/es/collection-manager/hooks/useCollectionDataSource.js +4 -4
  15. package/es/collection-manager/interfaces/m2m.js +1 -1
  16. package/es/collection-manager/interfaces/m2o.js +1 -1
  17. package/es/collection-manager/interfaces/o2m.js +1 -1
  18. package/es/collection-manager/interfaces/o2o.js +2 -2
  19. package/es/collection-manager/templates/expression.js +1 -1
  20. package/es/filter-provider/utils.js +1 -1
  21. package/es/index.d.ts +1 -0
  22. package/es/index.js +1 -0
  23. package/es/locale/en_US.d.ts +16 -1
  24. package/es/locale/en_US.js +17 -2
  25. package/es/locale/es_ES.d.ts +692 -0
  26. package/es/locale/es_ES.js +691 -0
  27. package/es/locale/ja_JP.d.ts +5 -1
  28. package/es/locale/ja_JP.js +6 -2
  29. package/es/locale/pt_BR.d.ts +5 -1
  30. package/es/locale/pt_BR.js +6 -2
  31. package/es/locale/ru_RU.d.ts +5 -1
  32. package/es/locale/ru_RU.js +6 -2
  33. package/es/locale/tr_TR.d.ts +5 -1
  34. package/es/locale/tr_TR.js +6 -2
  35. package/es/locale/zh_CN.d.ts +25 -2
  36. package/es/locale/zh_CN.js +26 -3
  37. package/es/pm/PluginManagerLink.js +22 -14
  38. package/es/record-provider/index.d.ts +4 -0
  39. package/es/record-provider/index.js +3 -0
  40. package/es/schema-component/antd/action/Action.Designer.js +6 -3
  41. package/es/schema-component/antd/action/Action.Drawer.js +5 -2
  42. package/es/schema-component/antd/action/Action.js +2 -2
  43. package/es/schema-component/antd/action/ActionBar.js +25 -18
  44. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -2
  45. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +62 -9
  46. package/es/schema-component/antd/association-field/AssociationSelect.js +10 -65
  47. package/es/schema-component/antd/association-field/Editable.d.ts +1 -1
  48. package/es/schema-component/antd/association-field/Editable.js +32 -40
  49. package/es/schema-component/antd/association-field/InternalNester.js +4 -3
  50. package/es/schema-component/antd/association-field/InternalPicker.js +29 -60
  51. package/es/schema-component/antd/association-field/InternalViewer.js +9 -12
  52. package/es/schema-component/antd/association-field/Nester.js +19 -21
  53. package/es/schema-component/antd/association-field/ReadPretty.d.ts +1 -1
  54. package/es/schema-component/antd/association-field/ReadPretty.js +9 -25
  55. package/es/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
  56. package/es/schema-component/antd/association-field/components/CreateRecordAction.js +61 -0
  57. package/es/schema-component/antd/association-field/context.d.ts +5 -2
  58. package/es/schema-component/antd/association-field/context.js +1 -1
  59. package/es/schema-component/antd/association-field/hooks.d.ts +3 -0
  60. package/es/schema-component/antd/association-field/hooks.js +10 -10
  61. package/es/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
  62. package/es/schema-component/antd/association-select/AssociationSelect.js +49 -231
  63. package/es/schema-component/antd/association-select/useServiceOptions.js +2 -2
  64. package/es/schema-component/antd/collection-select/CollectionSelect.js +5 -0
  65. package/es/schema-component/antd/filter/FilterAction.js +2 -2
  66. package/es/schema-component/antd/form/Form.js +4 -4
  67. package/es/schema-component/antd/form-item/FormItem.js +126 -145
  68. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +3 -3
  69. package/es/schema-component/antd/form-v2/Form.Designer.js +1 -0
  70. package/es/schema-component/antd/form-v2/Templates.d.ts +20 -0
  71. package/es/schema-component/antd/form-v2/Templates.js +42 -12
  72. package/es/schema-component/antd/grid/Grid.js +34 -24
  73. package/es/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
  74. package/es/schema-component/antd/grid-card/GridCard.Decorator.js +65 -0
  75. package/es/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
  76. package/es/schema-component/antd/grid-card/GridCard.Designer.js +243 -0
  77. package/es/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
  78. package/es/schema-component/antd/grid-card/GridCard.Item.js +18 -0
  79. package/es/schema-component/antd/grid-card/GridCard.d.ts +8 -0
  80. package/es/schema-component/antd/grid-card/GridCard.js +103 -0
  81. package/es/schema-component/antd/grid-card/hooks.d.ts +4 -0
  82. package/es/schema-component/antd/grid-card/hooks.js +9 -0
  83. package/es/schema-component/antd/grid-card/index.d.ts +1 -0
  84. package/es/schema-component/antd/grid-card/index.js +1 -0
  85. package/es/schema-component/antd/grid-card/options.d.ts +20 -0
  86. package/es/schema-component/antd/grid-card/options.js +20 -0
  87. package/es/schema-component/antd/icon-picker/IconPicker.js +2 -2
  88. package/es/schema-component/antd/index.d.ts +2 -0
  89. package/es/schema-component/antd/index.js +2 -0
  90. package/es/schema-component/antd/input/EllipsisWithTooltip.js +2 -2
  91. package/es/schema-component/antd/list/List.Decorator.d.ts +5 -0
  92. package/es/schema-component/antd/list/List.Decorator.js +59 -0
  93. package/es/schema-component/antd/list/List.Designer.d.ts +1 -0
  94. package/es/schema-component/antd/list/List.Designer.js +205 -0
  95. package/es/schema-component/antd/list/List.Item.d.ts +1 -0
  96. package/es/schema-component/antd/list/List.Item.js +15 -0
  97. package/es/schema-component/antd/list/List.d.ts +8 -0
  98. package/es/schema-component/antd/list/List.js +83 -0
  99. package/es/schema-component/antd/list/hooks.d.ts +4 -0
  100. package/es/schema-component/antd/list/hooks.js +9 -0
  101. package/es/schema-component/antd/list/index.d.ts +1 -0
  102. package/es/schema-component/antd/list/index.js +1 -0
  103. package/es/schema-component/antd/remote-select/RemoteSelect.js +12 -10
  104. package/es/schema-component/antd/select/Select.js +15 -4
  105. package/es/schema-component/antd/table/Table.Void.Designer.js +1 -0
  106. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  107. package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
  108. package/es/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
  109. package/es/schema-component/antd/table-v2/hooks/useUserVariable.js +65 -0
  110. package/es/schema-component/antd/variable/Input.js +6 -3
  111. package/es/schema-component/common/dnd-context/index.js +2 -2
  112. package/es/schema-component/common/sortable-item/SortableItem.js +3 -4
  113. package/es/schema-component/core/SchemaComponentProvider.js +2 -2
  114. package/es/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
  115. package/es/schema-initializer/SchemaInitializerProvider.js +23 -10
  116. package/es/schema-initializer/buttons/BlockInitializers.js +10 -0
  117. package/es/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
  118. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
  119. package/es/schema-initializer/buttons/FormActionInitializers.js +106 -100
  120. package/es/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
  121. package/es/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
  122. package/es/schema-initializer/buttons/GridCardActionInitializers.js +278 -0
  123. package/es/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
  124. package/es/schema-initializer/buttons/ListActionInitializers.js +278 -0
  125. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  126. package/es/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
  127. package/es/schema-initializer/buttons/TableActionInitializers.js +29 -35
  128. package/es/schema-initializer/buttons/TableColumnInitializers.js +4 -1
  129. package/es/schema-initializer/buttons/index.d.ts +3 -0
  130. package/es/schema-initializer/buttons/index.js +3 -0
  131. package/es/schema-initializer/components/BulkEditField.js +7 -5
  132. package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -0
  133. package/es/schema-initializer/components/CreateRecordAction.js +51 -30
  134. package/es/schema-initializer/components/DeletedField.d.ts +1 -0
  135. package/es/schema-initializer/components/DeletedField.js +11 -0
  136. package/es/schema-initializer/components/assigned-field/AssignedField.js +35 -23
  137. package/es/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
  138. package/es/schema-initializer/items/GridCardBlockInitializer.js +47 -0
  139. package/es/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
  140. package/es/schema-initializer/items/ListBlockInitializer.js +47 -0
  141. package/es/schema-initializer/items/index.d.ts +3 -1
  142. package/es/schema-initializer/items/index.js +4 -2
  143. package/es/schema-initializer/utils.d.ts +112 -0
  144. package/es/schema-initializer/utils.js +206 -32
  145. package/es/schema-items/GeneralSchemaItems.d.ts +4 -0
  146. package/es/schema-items/GeneralSchemaItems.js +148 -0
  147. package/es/schema-items/index.d.ts +1 -0
  148. package/es/schema-items/index.js +2 -1
  149. package/es/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
  150. package/es/schema-settings/DataTemplates/FormDataTemplates.js +117 -42
  151. package/es/schema-settings/DataTemplates/components/AsDefaultTemplate.js +1 -1
  152. package/es/schema-settings/DataTemplates/components/DataTemplateTitle.js +9 -13
  153. package/es/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
  154. package/es/schema-settings/DataTemplates/components/Designer.js +179 -0
  155. package/es/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
  156. package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -96
  157. package/es/schema-settings/GeneralSchemaDesigner.js +19 -15
  158. package/es/schema-settings/SchemaSettings.d.ts +1 -1
  159. package/es/schema-settings/SchemaSettings.js +54 -30
  160. package/es/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
  161. package/es/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
  162. package/es/schema-settings/hooks/useIsShowMultipleSwitch.js +18 -0
  163. package/es/schema-templates/BlockTemplateDetails.js +1 -1
  164. package/es/settings-form/SettingsForm.js +2 -2
  165. package/es/user/CurrentUser.js +120 -12
  166. package/lib/acl/ACLProvider.js +2 -2
  167. package/lib/acl/Configuration/RoleConfigure.js +15 -8
  168. package/lib/api-client/APIClient.d.ts +2 -0
  169. package/lib/api-client/APIClient.js +11 -0
  170. package/lib/block-provider/BlockProvider.js +57 -16
  171. package/lib/block-provider/hooks/index.js +80 -59
  172. package/lib/collection-manager/CollectionField.js +3 -3
  173. package/lib/collection-manager/CollectionFieldProvider.js +2 -1
  174. package/lib/collection-manager/Configuration/AddFieldAction.js +2 -2
  175. package/lib/collection-manager/Configuration/CollectionFields.d.ts +1 -1
  176. package/lib/collection-manager/Configuration/CollectionFields.js +1 -3
  177. package/lib/collection-manager/Configuration/ConfigurationTabs.js +7 -6
  178. package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
  179. package/lib/collection-manager/hooks/useCollectionDataSource.js +4 -4
  180. package/lib/collection-manager/interfaces/m2m.js +1 -1
  181. package/lib/collection-manager/interfaces/m2o.js +1 -1
  182. package/lib/collection-manager/interfaces/o2m.js +1 -1
  183. package/lib/collection-manager/interfaces/o2o.js +2 -2
  184. package/lib/collection-manager/templates/expression.js +1 -1
  185. package/lib/filter-provider/utils.js +1 -1
  186. package/lib/index.d.ts +1 -0
  187. package/lib/index.js +11 -0
  188. package/lib/locale/en_US.d.ts +16 -1
  189. package/lib/locale/en_US.js +17 -2
  190. package/lib/locale/es_ES.d.ts +692 -0
  191. package/lib/locale/es_ES.js +698 -0
  192. package/lib/locale/ja_JP.d.ts +5 -1
  193. package/lib/locale/ja_JP.js +6 -2
  194. package/lib/locale/pt_BR.d.ts +5 -1
  195. package/lib/locale/pt_BR.js +6 -2
  196. package/lib/locale/ru_RU.d.ts +5 -1
  197. package/lib/locale/ru_RU.js +6 -2
  198. package/lib/locale/tr_TR.d.ts +5 -1
  199. package/lib/locale/tr_TR.js +6 -2
  200. package/lib/locale/zh_CN.d.ts +25 -2
  201. package/lib/locale/zh_CN.js +26 -3
  202. package/lib/pm/PluginManagerLink.js +21 -13
  203. package/lib/record-provider/index.d.ts +4 -0
  204. package/lib/record-provider/index.js +5 -1
  205. package/lib/schema-component/antd/action/Action.Designer.js +6 -3
  206. package/lib/schema-component/antd/action/Action.Drawer.js +5 -2
  207. package/lib/schema-component/antd/action/Action.js +2 -2
  208. package/lib/schema-component/antd/action/ActionBar.js +23 -16
  209. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -2
  210. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +62 -8
  211. package/lib/schema-component/antd/association-field/AssociationSelect.js +9 -66
  212. package/lib/schema-component/antd/association-field/Editable.d.ts +1 -1
  213. package/lib/schema-component/antd/association-field/Editable.js +33 -42
  214. package/lib/schema-component/antd/association-field/InternalNester.js +2 -2
  215. package/lib/schema-component/antd/association-field/InternalPicker.js +25 -56
  216. package/lib/schema-component/antd/association-field/InternalViewer.js +7 -10
  217. package/lib/schema-component/antd/association-field/Nester.js +19 -21
  218. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +1 -1
  219. package/lib/schema-component/antd/association-field/ReadPretty.js +10 -27
  220. package/lib/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
  221. package/lib/schema-component/antd/association-field/components/CreateRecordAction.js +71 -0
  222. package/lib/schema-component/antd/association-field/context.d.ts +5 -2
  223. package/lib/schema-component/antd/association-field/context.js +1 -1
  224. package/lib/schema-component/antd/association-field/hooks.d.ts +3 -0
  225. package/lib/schema-component/antd/association-field/hooks.js +10 -10
  226. package/lib/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
  227. package/lib/schema-component/antd/association-select/AssociationSelect.js +49 -231
  228. package/lib/schema-component/antd/association-select/useServiceOptions.js +2 -2
  229. package/lib/schema-component/antd/collection-select/CollectionSelect.js +5 -0
  230. package/lib/schema-component/antd/filter/FilterAction.js +2 -2
  231. package/lib/schema-component/antd/form/Form.js +4 -4
  232. package/lib/schema-component/antd/form-item/FormItem.js +122 -141
  233. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +3 -3
  234. package/lib/schema-component/antd/form-v2/Form.Designer.js +1 -0
  235. package/lib/schema-component/antd/form-v2/Templates.d.ts +20 -0
  236. package/lib/schema-component/antd/form-v2/Templates.js +41 -11
  237. package/lib/schema-component/antd/grid/Grid.js +33 -23
  238. package/lib/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
  239. package/lib/schema-component/antd/grid-card/GridCard.Decorator.js +77 -0
  240. package/lib/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
  241. package/lib/schema-component/antd/grid-card/GridCard.Designer.js +253 -0
  242. package/lib/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
  243. package/lib/schema-component/antd/grid-card/GridCard.Item.js +26 -0
  244. package/lib/schema-component/antd/grid-card/GridCard.d.ts +8 -0
  245. package/lib/schema-component/antd/grid-card/GridCard.js +112 -0
  246. package/lib/schema-component/antd/grid-card/hooks.d.ts +4 -0
  247. package/lib/schema-component/antd/grid-card/hooks.js +16 -0
  248. package/lib/schema-component/antd/grid-card/index.d.ts +1 -0
  249. package/lib/schema-component/antd/grid-card/index.js +16 -0
  250. package/lib/schema-component/antd/grid-card/options.d.ts +20 -0
  251. package/lib/schema-component/antd/grid-card/options.js +31 -0
  252. package/lib/schema-component/antd/icon-picker/IconPicker.js +2 -2
  253. package/lib/schema-component/antd/index.d.ts +2 -0
  254. package/lib/schema-component/antd/index.js +22 -0
  255. package/lib/schema-component/antd/input/EllipsisWithTooltip.js +2 -2
  256. package/lib/schema-component/antd/list/List.Decorator.d.ts +5 -0
  257. package/lib/schema-component/antd/list/List.Decorator.js +71 -0
  258. package/lib/schema-component/antd/list/List.Designer.d.ts +1 -0
  259. package/lib/schema-component/antd/list/List.Designer.js +213 -0
  260. package/lib/schema-component/antd/list/List.Item.d.ts +1 -0
  261. package/lib/schema-component/antd/list/List.Item.js +23 -0
  262. package/lib/schema-component/antd/list/List.d.ts +8 -0
  263. package/lib/schema-component/antd/list/List.js +92 -0
  264. package/lib/schema-component/antd/list/hooks.d.ts +4 -0
  265. package/lib/schema-component/antd/list/hooks.js +16 -0
  266. package/lib/schema-component/antd/list/index.d.ts +1 -0
  267. package/lib/schema-component/antd/list/index.js +16 -0
  268. package/lib/schema-component/antd/remote-select/RemoteSelect.js +11 -9
  269. package/lib/schema-component/antd/select/Select.js +14 -3
  270. package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -0
  271. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  272. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
  273. package/lib/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
  274. package/lib/schema-component/antd/table-v2/hooks/useUserVariable.js +73 -0
  275. package/lib/schema-component/antd/variable/Input.js +6 -3
  276. package/lib/schema-component/common/dnd-context/index.js +2 -2
  277. package/lib/schema-component/common/sortable-item/SortableItem.js +3 -4
  278. package/lib/schema-component/core/SchemaComponentProvider.js +2 -2
  279. package/lib/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
  280. package/lib/schema-initializer/SchemaInitializerProvider.js +22 -9
  281. package/lib/schema-initializer/buttons/BlockInitializers.js +10 -0
  282. package/lib/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
  283. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
  284. package/lib/schema-initializer/buttons/FormActionInitializers.js +106 -100
  285. package/lib/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
  286. package/lib/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
  287. package/lib/schema-initializer/buttons/GridCardActionInitializers.js +285 -0
  288. package/lib/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
  289. package/lib/schema-initializer/buttons/ListActionInitializers.js +285 -0
  290. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  291. package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
  292. package/lib/schema-initializer/buttons/TableActionInitializers.js +29 -35
  293. package/lib/schema-initializer/buttons/TableColumnInitializers.js +4 -1
  294. package/lib/schema-initializer/buttons/index.d.ts +3 -0
  295. package/lib/schema-initializer/buttons/index.js +22 -0
  296. package/lib/schema-initializer/components/BulkEditField.js +7 -5
  297. package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -0
  298. package/lib/schema-initializer/components/CreateRecordAction.js +54 -32
  299. package/lib/schema-initializer/components/DeletedField.d.ts +1 -0
  300. package/lib/schema-initializer/components/DeletedField.js +19 -0
  301. package/lib/schema-initializer/components/assigned-field/AssignedField.js +34 -22
  302. package/lib/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
  303. package/lib/schema-initializer/items/GridCardBlockInitializer.js +55 -0
  304. package/lib/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
  305. package/lib/schema-initializer/items/ListBlockInitializer.js +55 -0
  306. package/lib/schema-initializer/items/index.d.ts +3 -1
  307. package/lib/schema-initializer/items/index.js +33 -11
  308. package/lib/schema-initializer/utils.d.ts +112 -0
  309. package/lib/schema-initializer/utils.js +209 -33
  310. package/lib/schema-items/GeneralSchemaItems.d.ts +4 -0
  311. package/lib/schema-items/GeneralSchemaItems.js +156 -0
  312. package/lib/schema-items/index.d.ts +1 -0
  313. package/lib/schema-items/index.js +11 -0
  314. package/lib/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
  315. package/lib/schema-settings/DataTemplates/FormDataTemplates.js +119 -41
  316. package/lib/schema-settings/DataTemplates/components/AsDefaultTemplate.js +1 -1
  317. package/lib/schema-settings/DataTemplates/components/DataTemplateTitle.js +10 -14
  318. package/lib/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
  319. package/lib/schema-settings/DataTemplates/components/Designer.js +188 -0
  320. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
  321. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -95
  322. package/lib/schema-settings/GeneralSchemaDesigner.js +21 -15
  323. package/lib/schema-settings/SchemaSettings.d.ts +1 -1
  324. package/lib/schema-settings/SchemaSettings.js +53 -29
  325. package/lib/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
  326. package/lib/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
  327. package/lib/schema-settings/hooks/useIsShowMultipleSwitch.js +24 -0
  328. package/lib/settings-form/SettingsForm.js +2 -2
  329. package/lib/user/CurrentUser.js +118 -10
  330. package/package.json +5 -5
  331. package/tsconfig.json +8 -0
@@ -11,17 +11,17 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
11
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12
12
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
13
13
  import { LoadingOutlined } from '@ant-design/icons';
14
- import { connect, mapProps, mapReadPretty, useFieldSchema, useField } from '@formily/react';
14
+ import { connect, mapProps, mapReadPretty, useField, useFieldSchema } from '@formily/react';
15
15
  import { Tag } from 'antd';
16
- import moment from 'moment';
17
16
  import { uniqBy } from 'lodash';
17
+ import moment from 'moment';
18
18
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
19
19
  import { useRequest } from '../../../api-client';
20
20
  import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
21
21
  import { useCollection, useCollectionManager } from '../../../collection-manager';
22
- import { useCompile } from '../../hooks';
23
22
  import { Select, defaultFieldNames } from '../select';
24
23
  import { ReadPretty } from './ReadPretty';
24
+ var EMPTY = 'N/A';
25
25
  var InternalRemoteSelect = connect(function (props) {
26
26
  var _field$componentProps, _field$componentProps2, _field$componentProps3, _service$params;
27
27
  var _props$fieldNames = props.fieldNames,
@@ -37,7 +37,6 @@ var InternalRemoteSelect = connect(function (props) {
37
37
  mapOptions = props.mapOptions,
38
38
  _targetField = props.targetField,
39
39
  others = _objectWithoutProperties(props, _excluded);
40
- var compile = useCompile();
41
40
  var firstRun = useRef(false);
42
41
  var fieldSchema = useFieldSchema();
43
42
  var field = useField();
@@ -75,7 +74,9 @@ var InternalRemoteSelect = connect(function (props) {
75
74
  }
76
75
  }, (option === null || option === void 0 ? void 0 : option.label) || item);
77
76
  } else {
78
- return /*#__PURE__*/React.createElement(Tag, null, item);
77
+ return /*#__PURE__*/React.createElement(Tag, {
78
+ key: item
79
+ }, item);
79
80
  }
80
81
  }).reverse();
81
82
  } else {
@@ -94,10 +95,10 @@ var InternalRemoteSelect = connect(function (props) {
94
95
  }
95
96
  if (mapOptions) {
96
97
  var _mapOptions;
97
- return mapOptions((_mapOptions = {}, _defineProperty(_mapOptions, fieldNames.label, label), _defineProperty(_mapOptions, fieldNames.value, option[fieldNames.value]), _mapOptions));
98
+ return mapOptions((_mapOptions = {}, _defineProperty(_mapOptions, fieldNames.label, label || EMPTY), _defineProperty(_mapOptions, fieldNames.value, option[fieldNames.value]), _mapOptions));
98
99
  }
99
- return _objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, fieldNames.label, label || option[fieldNames.value]), _defineProperty(_objectSpread2, fieldNames.value, option[fieldNames.value]), _objectSpread2));
100
- });
100
+ return _objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, fieldNames.label, label || EMPTY), _defineProperty(_objectSpread2, fieldNames.value, option[fieldNames.value]), _objectSpread2));
101
+ }).filter(Boolean);
101
102
  } catch (err) {
102
103
  console.error(err);
103
104
  return options;
@@ -139,7 +140,7 @@ var InternalRemoteSelect = connect(function (props) {
139
140
  while (1) switch (_context.prev = _context.next) {
140
141
  case 0:
141
142
  run({
142
- filter: mergeFilter([_defineProperty({}, fieldNames.label, _defineProperty({}, operator, search)), ((_field$componentProps4 = field.componentProps) === null || _field$componentProps4 === void 0 ? void 0 : (_field$componentProps5 = _field$componentProps4.service) === null || _field$componentProps5 === void 0 ? void 0 : (_field$componentProps6 = _field$componentProps5.params) === null || _field$componentProps6 === void 0 ? void 0 : _field$componentProps6.filter) || (service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter)])
143
+ filter: mergeFilter([search ? _defineProperty({}, fieldNames.label, _defineProperty({}, operator, search)) : {}, ((_field$componentProps4 = field.componentProps) === null || _field$componentProps4 === void 0 ? void 0 : (_field$componentProps5 = _field$componentProps4.service) === null || _field$componentProps5 === void 0 ? void 0 : (_field$componentProps6 = _field$componentProps5.params) === null || _field$componentProps6 === void 0 ? void 0 : _field$componentProps6.filter) || (service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter)])
143
144
  });
144
145
  case 1:
145
146
  case "end":
@@ -179,6 +180,7 @@ var InternalRemoteSelect = connect(function (props) {
179
180
  firstRun.current = true;
180
181
  };
181
182
  return /*#__PURE__*/React.createElement(Select, _objectSpread(_objectSpread({
183
+ dropdownMatchSelectWidth: false,
182
184
  autoClearSearchValue: true,
183
185
  filterOption: false,
184
186
  filterSort: null,
@@ -188,7 +190,7 @@ var InternalRemoteSelect = connect(function (props) {
188
190
  objectValue: objectValue,
189
191
  value: value
190
192
  }, others), {}, {
191
- loading: loading,
193
+ loading: data ? loading : true,
192
194
  options: mapOptionsToTags(options)
193
195
  }));
194
196
  }, mapProps({
@@ -1,5 +1,5 @@
1
- var _excluded = ["value", "options", "onChange", "fieldNames", "mode"],
2
- _excluded2 = ["objectValue", "value"];
1
+ var _excluded = ["value", "options", "onChange", "fieldNames", "mode", "loading"],
2
+ _excluded2 = ["objectValue", "loading", "value"];
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -11,7 +11,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
11
11
  import { LoadingOutlined } from '@ant-design/icons';
12
12
  import { connect, mapProps, mapReadPretty } from '@formily/react';
13
13
  import { isValid, toArr } from '@formily/shared';
14
- import { Select as AntdSelect } from 'antd';
14
+ import { Select as AntdSelect, Spin, Empty } from 'antd';
15
15
  import React from 'react';
16
16
  import { ReadPretty } from './ReadPretty';
17
17
  import { defaultFieldNames, getCurrentOptions } from './shared';
@@ -24,6 +24,7 @@ var ObjectSelect = function ObjectSelect(props) {
24
24
  _onChange = props.onChange,
25
25
  fieldNames = props.fieldNames,
26
26
  mode = props.mode,
27
+ loading = props.loading,
27
28
  others = _objectWithoutProperties(props, _excluded);
28
29
  var toValue = function toValue(v) {
29
30
  var _getCurrentOptions;
@@ -50,9 +51,13 @@ var ObjectSelect = function ObjectSelect(props) {
50
51
  value: toValue(value),
51
52
  allowClear: true,
52
53
  labelInValue: true,
54
+ notFoundContent: loading ? /*#__PURE__*/React.createElement(Spin, null) : /*#__PURE__*/React.createElement(Empty, {
55
+ image: Empty.PRESENTED_IMAGE_SIMPLE
56
+ }),
53
57
  options: options,
54
58
  fieldNames: fieldNames,
55
59
  showSearch: true,
60
+ dropdownMatchSelectWidth: false,
56
61
  filterOption: function filterOption(input, option) {
57
62
  var _option;
58
63
  return ((_option = option === null || option === void 0 ? void 0 : option[fieldNames.label || 'label']) !== null && _option !== void 0 ? _option : '').includes(input);
@@ -80,6 +85,7 @@ var filterOption = function filterOption(input, option) {
80
85
  };
81
86
  var InternalSelect = connect(function (props) {
82
87
  var objectValue = props.objectValue,
88
+ loading = props.loading,
83
89
  value = props.value,
84
90
  others = _objectWithoutProperties(props, _excluded2);
85
91
  var mode = props.multiple ? 'multiple' : props.mode;
@@ -89,13 +95,18 @@ var InternalSelect = connect(function (props) {
89
95
  if (objectValue) {
90
96
  return /*#__PURE__*/React.createElement(ObjectSelect, _objectSpread(_objectSpread({}, others), {}, {
91
97
  value: value,
92
- mode: mode
98
+ mode: mode,
99
+ loading: loading
93
100
  }));
94
101
  }
95
102
  return /*#__PURE__*/React.createElement(AntdSelect, _objectSpread(_objectSpread({
96
103
  showSearch: true,
97
104
  filterOption: filterOption,
98
105
  allowClear: true,
106
+ dropdownMatchSelectWidth: false,
107
+ notFoundContent: loading ? /*#__PURE__*/React.createElement(Spin, null) : /*#__PURE__*/React.createElement(Empty, {
108
+ image: Empty.PRESENTED_IMAGE_SIMPLE
109
+ }),
99
110
  value: value
100
111
  }, others), {}, {
101
112
  onChange: function onChange(changed) {
@@ -114,6 +114,7 @@ export var TableVoidDesigner = function TableVoidDesigner() {
114
114
  field: {
115
115
  type: 'string',
116
116
  enum: sortFields,
117
+ required: true,
117
118
  'x-decorator': 'FormItem',
118
119
  'x-component': 'Select',
119
120
  'x-component-props': {
@@ -48,7 +48,7 @@ export var TableBlockDesigner = function TableBlockDesigner() {
48
48
  var defaultResource = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora4 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora4 === void 0 ? void 0 : _fieldSchema$xDecora4.resource;
49
49
  var supportTemplate = !(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora5 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora5 === void 0 ? void 0 : _fieldSchema$xDecora5.disableTemplate);
50
50
  var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
51
- return item.startsWith('-') ? {
51
+ return (item === null || item === void 0 ? void 0 : item.startsWith('-')) ? {
52
52
  field: item.substring(1),
53
53
  direction: 'desc'
54
54
  } : {
@@ -163,6 +163,7 @@ export var TableBlockDesigner = function TableBlockDesigner() {
163
163
  field: {
164
164
  type: 'string',
165
165
  enum: sortFields,
166
+ required: true,
166
167
  'x-decorator': 'FormItem',
167
168
  'x-component': 'Select',
168
169
  'x-component-props': {
@@ -143,6 +143,7 @@ export var TableSelectorDesigner = function TableSelectorDesigner() {
143
143
  field: {
144
144
  type: 'string',
145
145
  enum: sortFields,
146
+ required: true,
146
147
  'x-decorator': 'FormItem',
147
148
  'x-component': 'Select',
148
149
  'x-component-props': {
@@ -0,0 +1,22 @@
1
+ interface Operator {
2
+ label: string;
3
+ value: string;
4
+ }
5
+ interface GetOptionsParams {
6
+ schema: any;
7
+ operator: Operator;
8
+ maxDepth: number;
9
+ count?: number;
10
+ }
11
+ export declare const useOptions: (collectionName: string, { schema, operator, maxDepth, count }: GetOptionsParams) => any;
12
+ export declare const useUserVariable: ({ schema, operator }: {
13
+ schema: any;
14
+ operator: any;
15
+ }) => {
16
+ label: string;
17
+ value: string;
18
+ key: string;
19
+ disabled: any;
20
+ children: any;
21
+ };
22
+ export {};
@@ -0,0 +1,65 @@
1
+ import { useFilterOptions } from '../../filter';
2
+ var isOperatorSupportMultiRelation = function isOperatorSupportMultiRelation(operator) {
3
+ if (!operator) return false;
4
+ return ['$eq', '$ne'].includes(operator.value);
5
+ };
6
+ var isSingleRelationField = function isSingleRelationField(field) {
7
+ if (!field) return false;
8
+ return field.type === 'belongsTo' || field.type === 'hasOne';
9
+ };
10
+ export var useOptions = function useOptions(collectionName, _ref) {
11
+ var schema = _ref.schema,
12
+ operator = _ref.operator,
13
+ maxDepth = _ref.maxDepth,
14
+ _ref$count = _ref.count,
15
+ count = _ref$count === void 0 ? 1 : _ref$count;
16
+ if (count > maxDepth) {
17
+ return [];
18
+ }
19
+ var result = useFilterOptions(collectionName).map(function (option) {
20
+ if (!option.target) {
21
+ var _option$schema;
22
+ return {
23
+ key: option.name,
24
+ value: option.name,
25
+ label: option.title,
26
+ // TODO: 现在是通过组件的名称来过滤能够被选择的选项,这样的坏处是不够精确,后续可以优化
27
+ disabled: (schema === null || schema === void 0 ? void 0 : schema['x-component']) !== ((_option$schema = option.schema) === null || _option$schema === void 0 ? void 0 : _option$schema['x-component'])
28
+ };
29
+ }
30
+ var children = useOptions(option.target, {
31
+ schema: schema,
32
+ operator: operator,
33
+ maxDepth: maxDepth,
34
+ count: count + 1
35
+ }) || [];
36
+ return {
37
+ key: option.name,
38
+ value: option.name,
39
+ label: option.title,
40
+ children: children,
41
+ disabled: !isSingleRelationField(option) && !isOperatorSupportMultiRelation(operator) || children.every(function (child) {
42
+ return child.disabled;
43
+ })
44
+ };
45
+ });
46
+ return result;
47
+ };
48
+ export var useUserVariable = function useUserVariable(_ref2) {
49
+ var schema = _ref2.schema,
50
+ operator = _ref2.operator;
51
+ var options = useOptions('users', {
52
+ schema: schema,
53
+ operator: operator,
54
+ maxDepth: 3
55
+ }) || [];
56
+ return {
57
+ label: "{{t(\"Current user\")}}",
58
+ value: '$user',
59
+ key: '$user',
60
+ disabled: options.every(function (option) {
61
+ return option.disabled;
62
+ }),
63
+ children: options
64
+ };
65
+ };
@@ -128,12 +128,15 @@ var ConstantTypes = {
128
128
  default: null
129
129
  }
130
130
  };
131
- function getTypedConstantOption(type) {
131
+ function getTypedConstantOption(type, types) {
132
132
  var _ConstantTypes$type;
133
+ var allTypes = Object.values(ConstantTypes);
133
134
  return {
134
135
  value: '',
135
136
  label: '{{t("Constant")}}',
136
- children: Object.values(ConstantTypes),
137
+ children: types ? allTypes.filter(function (item) {
138
+ return Array.isArray(types) && types.includes(item.value) || types === true;
139
+ }) : allTypes,
137
140
  component: (_ConstantTypes$type = ConstantTypes[type]) === null || _ConstantTypes$type === void 0 ? void 0 : _ConstantTypes$type.component
138
141
  };
139
142
  }
@@ -158,7 +161,7 @@ export function Input(props) {
158
161
  var _ref5 = children ? {
159
162
  value: '',
160
163
  label: '{{t("Constant")}}'
161
- } : useTypedConstant ? getTypedConstantOption(type) : {
164
+ } : useTypedConstant ? getTypedConstantOption(type, useTypedConstant) : {
162
165
  value: '',
163
166
  label: '{{t("Null")}}',
164
167
  component: ConstantTypes.null.component
@@ -23,7 +23,7 @@ var useDragEnd = function useDragEnd(props) {
23
23
  var _useTranslation = useTranslation(),
24
24
  t = _useTranslation.t;
25
25
  return function (event) {
26
- var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current, _over$data5, _over$data5$current, _over$data$current$re;
26
+ var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current, _over$data5, _over$data5$current, _over$data$current$re, _over$data6, _over$data6$current;
27
27
  var active = event.active,
28
28
  over = event.over;
29
29
  var activeSchema = active === null || active === void 0 ? void 0 : (_active$data = active.data) === null || _active$data === void 0 ? void 0 : (_active$data$current = _active$data.current) === null || _active$data$current === void 0 ? void 0 : _active$data$current.schema;
@@ -32,7 +32,7 @@ var useDragEnd = function useDragEnd(props) {
32
32
  var breakRemoveOn = over === null || over === void 0 ? void 0 : (_over$data3 = over.data) === null || _over$data3 === void 0 ? void 0 : (_over$data3$current = _over$data3.current) === null || _over$data3$current === void 0 ? void 0 : _over$data3$current.breakRemoveOn;
33
33
  var wrapSchema = over === null || over === void 0 ? void 0 : (_over$data4 = over.data) === null || _over$data4 === void 0 ? void 0 : (_over$data4$current = _over$data4.current) === null || _over$data4$current === void 0 ? void 0 : _over$data4$current.wrapSchema;
34
34
  var onSuccess = over === null || over === void 0 ? void 0 : (_over$data5 = over.data) === null || _over$data5 === void 0 ? void 0 : (_over$data5$current = _over$data5.current) === null || _over$data5$current === void 0 ? void 0 : _over$data5$current.onSuccess;
35
- var removeParentsIfNoChildren = (_over$data$current$re = over.data.current.removeParentsIfNoChildren) !== null && _over$data$current$re !== void 0 ? _over$data$current$re : true;
35
+ var removeParentsIfNoChildren = (_over$data$current$re = over === null || over === void 0 ? void 0 : (_over$data6 = over.data) === null || _over$data6 === void 0 ? void 0 : (_over$data6$current = _over$data6.current) === null || _over$data6$current === void 0 ? void 0 : _over$data6$current.removeParentsIfNoChildren) !== null && _over$data$current$re !== void 0 ? _over$data$current$re : true;
36
36
  if (!activeSchema || !overSchema) {
37
37
  var _props$onDragEnd;
38
38
  props === null || props === void 0 ? void 0 : (_props$onDragEnd = props.onDragEnd) === null || _props$onDragEnd === void 0 ? void 0 : _props$onDragEnd.call(props, event);
@@ -1,6 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  var _excluded = ["component", "style", "children", "openMode"],
3
- _excluded2 = ["schema", "id"];
3
+ _excluded2 = ["schema", "id", "removeParentsIfNoChildren"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -72,18 +72,17 @@ var useSortableItemId = function useSortableItemId(props) {
72
72
  return field.address.toString();
73
73
  };
74
74
  export var SortableItem = observer(function (props) {
75
- var _others$removeParents;
76
75
  var _useSortableItemProps = useSortableItemProps(props),
77
76
  schema = _useSortableItemProps.schema,
78
77
  id = _useSortableItemProps.id,
78
+ removeParentsIfNoChildren = _useSortableItemProps.removeParentsIfNoChildren,
79
79
  others = _objectWithoutProperties(_useSortableItemProps, _excluded2);
80
- var removeParentsIfNoChildren = (_others$removeParents = others.removeParentsIfNoChildren) !== null && _others$removeParents !== void 0 ? _others$removeParents : true;
81
80
  return /*#__PURE__*/React.createElement(SortableProvider, {
82
81
  id: id,
83
82
  data: {
84
83
  insertAdjacent: 'afterEnd',
85
84
  schema: schema,
86
- removeParentsIfNoChildren: removeParentsIfNoChildren
85
+ removeParentsIfNoChildren: removeParentsIfNoChildren !== null && removeParentsIfNoChildren !== void 0 ? removeParentsIfNoChildren : true
87
86
  }
88
87
  }, /*#__PURE__*/React.createElement(Sortable, _objectSpread({}, others), props.children));
89
88
  });
@@ -50,8 +50,8 @@ export var SchemaComponentProvider = function SchemaComponentProvider(props) {
50
50
  _useState4 = _slicedToArray(_useState3, 2),
51
51
  formId = _useState4[0],
52
52
  setFormId = _useState4[1];
53
- var form = props.form || useMemo(function () {
54
- return createForm();
53
+ var form = useMemo(function () {
54
+ return props.form || createForm();
55
55
  }, [formId]);
56
56
  var _useTranslation = useTranslation(),
57
57
  t = _useTranslation.t;
@@ -6,6 +6,7 @@ export interface SchemaInitializerProviderProps {
6
6
  }
7
7
  export declare const useSchemaInitializer: (name: string, props?: {}) => {
8
8
  exists: boolean;
9
+ InitializerComponent: (p: any) => JSX.Element;
9
10
  render: (props?: any) => React.CElement<any, React.Component<any, any, any>>;
10
11
  };
11
12
  export declare const SchemaInitializerPluginContext: React.Context<any>;
@@ -7,7 +7,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
7
7
  import { useFieldSchema } from '@formily/react';
8
8
  import { isPlainObj } from '@formily/shared';
9
9
  import get from 'lodash/get';
10
- import React, { createContext, useContext } from 'react';
10
+ import React, { createContext, useContext, useMemo, useRef } from 'react';
11
11
  import { SchemaComponentOptions } from '../schema-component';
12
12
  import { SchemaInitializer } from './SchemaInitializer';
13
13
  import * as globals from './buttons';
@@ -21,19 +21,30 @@ export var useSchemaInitializer = function useSchemaInitializer(name) {
21
21
  var _render = function render(component, props) {
22
22
  return component && /*#__PURE__*/React.createElement(component, props);
23
23
  };
24
- if (!name) {
25
- return {
26
- exists: false,
27
- render: function render(props) {
28
- return _render(null);
29
- }
30
- };
31
- }
32
- var initializer = get(initializers, name || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-initializer']));
24
+ var initializerPropsRef = useRef({});
25
+ var initializer = name ? get(initializers, name || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-initializer'])) : null;
33
26
  var initializerProps = _objectSpread(_objectSpread({}, props), fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-initializer-props']);
27
+ initializerPropsRef.current = initializerProps;
28
+ var InitializerComponent = useMemo(function () {
29
+ var C = React.Fragment;
30
+ if (!initializer) {
31
+ return C;
32
+ } else if (isPlainObj(initializer)) {
33
+ C = initializer.component || SchemaInitializer.Button;
34
+ return function (p) {
35
+ return /*#__PURE__*/React.createElement(C, _objectSpread(_objectSpread(_objectSpread({}, initializer), initializerPropsRef.current), p));
36
+ };
37
+ } else {
38
+ C = initializer;
39
+ return function (p) {
40
+ return /*#__PURE__*/React.createElement(C, _objectSpread(_objectSpread({}, initializerPropsRef.current), p));
41
+ };
42
+ }
43
+ }, [initializer]);
34
44
  if (!initializer) {
35
45
  return {
36
46
  exists: false,
47
+ InitializerComponent: InitializerComponent,
37
48
  render: function render(props) {
38
49
  return _render(null);
39
50
  }
@@ -42,6 +53,7 @@ export var useSchemaInitializer = function useSchemaInitializer(name) {
42
53
  if (isPlainObj(initializer)) {
43
54
  return {
44
55
  exists: true,
56
+ InitializerComponent: InitializerComponent,
45
57
  render: function render(props) {
46
58
  var component = initializer.component || SchemaInitializer.Button;
47
59
  return _render(component, _objectSpread(_objectSpread(_objectSpread({}, initializer), initializerProps), props));
@@ -50,6 +62,7 @@ export var useSchemaInitializer = function useSchemaInitializer(name) {
50
62
  }
51
63
  return {
52
64
  exists: true,
65
+ InitializerComponent: InitializerComponent,
53
66
  render: function render(props) {
54
67
  return _render(initializer, _objectSpread(_objectSpread({}, initializerProps), props));
55
68
  }
@@ -23,6 +23,16 @@ export var BlockInitializers = {
23
23
  type: 'item',
24
24
  title: '{{t("Details")}}',
25
25
  component: 'DetailsBlockInitializer'
26
+ }, {
27
+ key: 'List',
28
+ type: 'item',
29
+ title: '{{t("List")}}',
30
+ component: 'ListBlockInitializer'
31
+ }, {
32
+ key: 'GridCard',
33
+ type: 'item',
34
+ title: '{{t("Grid Card")}}',
35
+ component: 'GridCardBlockInitializer'
26
36
  }, {
27
37
  key: 'calendar',
28
38
  type: 'item',
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
+ import { useCompile } from '../../schema-component';
3
4
  import { SchemaInitializer } from '../SchemaInitializer';
4
5
  import { gridRowColWrap, useCustomFormItemInitializerFields, useInheritsFormItemInitializerFields } from '../utils';
5
- import { useCompile } from '../../schema-component';
6
6
  // 表单里配置字段
7
7
  export var CustomFormItemInitializers = function CustomFormItemInitializers(props) {
8
8
  var _useTranslation = useTranslation(),
@@ -10,7 +10,9 @@ export var CustomFormItemInitializers = function CustomFormItemInitializers(prop
10
10
  var compile = useCompile();
11
11
  var insertPosition = props.insertPosition,
12
12
  component = props.component;
13
- var inheritFields = useInheritsFormItemInitializerFields();
13
+ var inheritFields = useInheritsFormItemInitializerFields({
14
+ component: 'AssignedField'
15
+ });
14
16
  var fieldItems = [{
15
17
  type: 'itemGroup',
16
18
  title: t('Configure fields'),
@@ -20,58 +20,6 @@ export declare const FormActionInitializers: {
20
20
  type: string;
21
21
  title: string;
22
22
  children: ({
23
- type: string;
24
- title: string;
25
- component: string;
26
- schema: {
27
- type: string;
28
- title: string;
29
- 'x-action': string;
30
- 'x-designer': string;
31
- 'x-component': string;
32
- 'x-component-props': {
33
- openMode: string;
34
- useProps?: undefined;
35
- };
36
- properties: {
37
- drawer: {
38
- type: string;
39
- title: string;
40
- 'x-component': string;
41
- 'x-component-props': {
42
- className: string;
43
- };
44
- properties: {
45
- tabs: {
46
- type: string;
47
- 'x-component': string;
48
- 'x-component-props': {};
49
- 'x-initializer': string;
50
- properties: {
51
- tab1: {
52
- type: string;
53
- title: string;
54
- 'x-component': string;
55
- 'x-designer': string;
56
- 'x-component-props': {};
57
- properties: {
58
- grid: {
59
- type: string;
60
- 'x-component': string;
61
- 'x-initializer': string;
62
- properties: {};
63
- };
64
- };
65
- };
66
- };
67
- };
68
- };
69
- };
70
- };
71
- 'x-designer-props'?: undefined;
72
- 'x-action-settings'?: undefined;
73
- };
74
- } | {
75
23
  type: string;
76
24
  title: string;
77
25
  component: string;
@@ -95,10 +43,7 @@ export declare const FormActionInitializers: {
95
43
  };
96
44
  'x-component-props': {
97
45
  useProps: string;
98
- openMode?: undefined;
99
46
  };
100
- type?: undefined;
101
- properties?: undefined;
102
47
  };
103
48
  } | {
104
49
  type: string;
@@ -121,10 +66,7 @@ export declare const FormActionInitializers: {
121
66
  };
122
67
  'x-component-props': {
123
68
  useProps: string;
124
- openMode?: undefined;
125
69
  };
126
- type?: undefined;
127
- properties?: undefined;
128
70
  'x-designer-props'?: undefined;
129
71
  };
130
72
  })[];
@@ -152,58 +94,6 @@ export declare const CreateFormActionInitializers: {
152
94
  type: string;
153
95
  title: string;
154
96
  children: ({
155
- type: string;
156
- title: string;
157
- component: string;
158
- schema: {
159
- type: string;
160
- title: string;
161
- 'x-action': string;
162
- 'x-designer': string;
163
- 'x-component': string;
164
- 'x-component-props': {
165
- openMode: string;
166
- useProps?: undefined;
167
- };
168
- properties: {
169
- drawer: {
170
- type: string;
171
- title: string;
172
- 'x-component': string;
173
- 'x-component-props': {
174
- className: string;
175
- };
176
- properties: {
177
- tabs: {
178
- type: string;
179
- 'x-component': string;
180
- 'x-component-props': {};
181
- 'x-initializer': string;
182
- properties: {
183
- tab1: {
184
- type: string;
185
- title: string;
186
- 'x-component': string;
187
- 'x-designer': string;
188
- 'x-component-props': {};
189
- properties: {
190
- grid: {
191
- type: string;
192
- 'x-component': string;
193
- 'x-initializer': string;
194
- properties: {};
195
- };
196
- };
197
- };
198
- };
199
- };
200
- };
201
- };
202
- };
203
- 'x-designer-props'?: undefined;
204
- 'x-action-settings'?: undefined;
205
- };
206
- } | {
207
97
  type: string;
208
98
  title: string;
209
99
  component: string;
@@ -227,10 +117,7 @@ export declare const CreateFormActionInitializers: {
227
117
  };
228
118
  'x-component-props': {
229
119
  useProps: string;
230
- openMode?: undefined;
231
120
  };
232
- type?: undefined;
233
- properties?: undefined;
234
121
  };
235
122
  } | {
236
123
  type: string;
@@ -253,10 +140,7 @@ export declare const CreateFormActionInitializers: {
253
140
  };
254
141
  'x-component-props': {
255
142
  useProps: string;
256
- openMode?: undefined;
257
143
  };
258
- type?: undefined;
259
- properties?: undefined;
260
144
  'x-designer-props'?: undefined;
261
145
  };
262
146
  })[];