@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
@@ -1,5 +1,5 @@
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
- var _templateObject, _templateObject2;
2
+ var _templateObject, _templateObject2, _templateObject3;
3
3
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
4
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
5
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -9,27 +9,30 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
9
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
10
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
11
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
12
- import { css } from '@emotion/css';
13
- import { ArrayCollapse, FormLayout, FormItem as Item, ArrayItems } from '@formily/antd';
12
+ import { css, cx } from '@emotion/css';
13
+ import { ArrayCollapse, ArrayItems, FormLayout, FormItem as Item } from '@formily/antd';
14
14
  import { observer, useField, useFieldSchema } from '@formily/react';
15
15
  import { uid } from '@formily/shared';
16
+ import { Select } from 'antd';
16
17
  import _ from 'lodash';
17
18
  import moment from 'moment';
18
19
  import React, { useContext, useEffect } from 'react';
19
20
  import { useTranslation } from 'react-i18next';
20
21
  import { ACLCollectionFieldProvider } from '../../../acl/ACLProvider';
21
- import { BlockRequestContext, useFilterByTk, useFormBlockContext } from '../../../block-provider';
22
- import { useCollection, useCollectionManager, useSortFields, useCollectionFilterOptions } from '../../../collection-manager';
22
+ import { BlockRequestContext, useFormBlockContext } from '../../../block-provider';
23
+ import { useCollection, useCollectionFilterOptions, useCollectionManager, useSortFields } from '../../../collection-manager';
23
24
  import { isTitleField } from '../../../collection-manager/Configuration/CollectionFields';
25
+ import { GeneralSchemaItems } from '../../../schema-items/GeneralSchemaItems';
24
26
  import { GeneralSchemaDesigner, SchemaSettings, isPatternDisabled, isShowDefaultValue } from '../../../schema-settings';
25
27
  import { VariableInput } from '../../../schema-settings/VariableInput/VariableInput';
26
- import { FilterDynamicComponent } from '../table-v2/FilterDynamicComponent';
28
+ import { useIsShowMultipleSwitch } from '../../../schema-settings/hooks/useIsShowMultipleSwitch';
27
29
  import { isVariable, parseVariables, useVariablesCtx } from '../../common/utils/uitls';
28
30
  import { SchemaComponent } from '../../core';
29
- import { removeNullCondition } from '../filter';
30
31
  import { useCompile, useDesignable, useFieldModeOptions } from '../../hooks';
31
32
  import { BlockItem } from '../block-item';
33
+ import { removeNullCondition } from '../filter';
32
34
  import { HTMLEncode } from '../input/shared';
35
+ import { FilterDynamicComponent } from '../table-v2/FilterDynamicComponent';
33
36
  import { isInvariable } from '../variable';
34
37
  import { FilterFormDesigner } from './FormItem.FilterFormDesigner';
35
38
  import { useEnsureOperatorsValid } from './SchemaSettingOptions';
@@ -62,10 +65,12 @@ export var FormItem = observer(function (props) {
62
65
  }
63
66
  }
64
67
  }, []);
68
+ var _props$showTitle = props.showTitle,
69
+ showTitle = _props$showTitle === void 0 ? true : _props$showTitle;
65
70
  return /*#__PURE__*/React.createElement(ACLCollectionFieldProvider, null, /*#__PURE__*/React.createElement(BlockItem, {
66
71
  className: 'nb-form-item'
67
72
  }, /*#__PURE__*/React.createElement(Item, _objectSpread(_objectSpread({
68
- className: "".concat(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]))))
73
+ className: cx(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]))), _defineProperty({}, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n > .ant-formily-item-label {\n display: none;\n }\n "]))), showTitle === false))
69
74
  }, props), {}, {
70
75
  extra: typeof field.description === 'string' ? /*#__PURE__*/React.createElement("div", {
71
76
  dangerouslySetInnerHTML: {
@@ -75,7 +80,7 @@ export var FormItem = observer(function (props) {
75
80
  }))));
76
81
  });
77
82
  FormItem.Designer = function Designer() {
78
- var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _field$componentProps, _field$componentProps2, _field$componentProps3, _field$componentProps4, _field$componentProps5, _field$componentProps6, _field$componentProps7, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps8, _field$componentProps9;
83
+ var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _field$componentProps, _field$componentProps2, _field$componentProps3, _field$componentProps4, _field$componentProps5, _field$componentProps6, _field$componentProps7, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _fieldSchema$xCompon6, _fieldSchema$xCompon7, _fieldSchema$xCompon8, _fieldSchema$xCompon9, _fieldSchema$xCompon10, _field$componentProps8, _field$componentProps9;
79
84
  var _useCollectionManager = useCollectionManager(),
80
85
  getCollectionFields = _useCollectionManager.getCollectionFields,
81
86
  getInterface = _useCollectionManager.getInterface,
@@ -83,7 +88,6 @@ FormItem.Designer = function Designer() {
83
88
  getCollection = _useCollectionManager.getCollection;
84
89
  var _useCollection = useCollection(),
85
90
  getField = _useCollection.getField;
86
- var tk = useFilterByTk();
87
91
  var _useFormBlockContext = useFormBlockContext(),
88
92
  form = _useFormBlockContext.form;
89
93
  var field = useField();
@@ -96,6 +100,7 @@ FormItem.Designer = function Designer() {
96
100
  insertAdjacent = _useDesignable.insertAdjacent;
97
101
  var compile = useCompile();
98
102
  var variablesCtx = useVariablesCtx();
103
+ var IsShowMultipleSwitch = useIsShowMultipleSwitch();
99
104
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
100
105
  var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
101
106
  var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
@@ -135,7 +140,7 @@ FormItem.Designer = function Designer() {
135
140
  var fieldMode = (field === null || field === void 0 ? void 0 : (_field$componentProps7 = field.componentProps) === null || _field$componentProps7 === void 0 ? void 0 : _field$componentProps7['mode']) || (isFileField ? 'FileManager' : 'Select');
136
141
  var isSelectFieldMode = fieldMode === 'Select';
137
142
  var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
138
- return item.startsWith('-') ? {
143
+ return (item === null || item === void 0 ? void 0 : item.startsWith('-')) ? {
139
144
  field: item.substring(1),
140
145
  direction: 'desc'
141
146
  } : {
@@ -143,111 +148,15 @@ FormItem.Designer = function Designer() {
143
148
  direction: 'asc'
144
149
  };
145
150
  });
146
- return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, null, collectionField && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
147
- key: "edit-field-title",
148
- title: t('Edit field title'),
149
- schema: {
150
- type: 'object',
151
- title: t('Edit field title'),
152
- properties: {
153
- title: {
154
- title: t('Field title'),
155
- default: field === null || field === void 0 ? void 0 : field.title,
156
- description: "".concat(t('Original field title: ')).concat(collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2.title),
157
- 'x-decorator': 'FormItem',
158
- 'x-component': 'Input',
159
- 'x-component-props': {}
160
- }
161
- }
162
- },
163
- onSubmit: function onSubmit(_ref) {
164
- var title = _ref.title;
165
- if (title) {
166
- field.title = title;
167
- fieldSchema.title = title;
168
- dn.emit('patch', {
169
- schema: {
170
- 'x-uid': fieldSchema['x-uid'],
171
- title: fieldSchema.title
172
- }
173
- });
174
- }
175
- dn.refresh();
176
- }
177
- }), !field.readPretty && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
178
- key: "edit-description",
179
- title: t('Edit description'),
180
- schema: {
181
- type: 'object',
182
- title: t('Edit description'),
183
- properties: {
184
- description: {
185
- // title: t('Description'),
186
- default: field === null || field === void 0 ? void 0 : field.description,
187
- 'x-decorator': 'FormItem',
188
- 'x-component': 'Input.TextArea',
189
- 'x-component-props': {}
190
- }
191
- }
192
- },
193
- onSubmit: function onSubmit(_ref2) {
194
- var description = _ref2.description;
195
- field.description = description;
196
- fieldSchema.description = description;
197
- dn.emit('patch', {
198
- schema: {
199
- 'x-uid': fieldSchema['x-uid'],
200
- description: fieldSchema.description
201
- }
202
- });
203
- dn.refresh();
204
- }
205
- }), field.readPretty && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
206
- key: "edit-tooltip",
207
- title: t('Edit tooltip'),
208
- schema: {
209
- type: 'object',
210
- title: t('Edit description'),
211
- properties: {
212
- tooltip: {
213
- default: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : _fieldSchema$xDecora.tooltip,
214
- 'x-decorator': 'FormItem',
215
- 'x-component': 'Input.TextArea',
216
- 'x-component-props': {}
217
- }
218
- }
219
- },
220
- onSubmit: function onSubmit(_ref3) {
221
- var tooltip = _ref3.tooltip;
222
- field.decoratorProps.tooltip = tooltip;
223
- fieldSchema['x-decorator-props'] = fieldSchema['x-decorator-props'] || {};
224
- fieldSchema['x-decorator-props']['tooltip'] = tooltip;
225
- dn.emit('patch', {
226
- schema: {
227
- 'x-uid': fieldSchema['x-uid'],
228
- 'x-decorator-props': fieldSchema['x-decorator-props']
229
- }
230
- });
231
- dn.refresh();
232
- }
233
- }), !field.readPretty && fieldSchema['x-component'] !== 'FormField' && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
234
- key: "required",
235
- title: t('Required'),
236
- checked: fieldSchema.required,
237
- onChange: function onChange(required) {
238
- var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
239
- field.required = required;
240
- fieldSchema['required'] = required;
241
- schema['required'] = required;
242
- dn.emit('patch', {
243
- schema: schema
244
- });
245
- refresh();
246
- }
247
- }), !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
151
+ var fieldSchemaWithoutRequired = _.omit(fieldSchema, 'required');
152
+ var isSubFormMode = ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.mode) === 'Nester';
153
+ var isPickerMode = ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.mode) === 'Picker';
154
+ var showFieldMode = isAssociationField && fieldModeOptions && !isTableField;
155
+ var showModeSelect = showFieldMode && isPickerMode;
156
+ return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, null, /*#__PURE__*/React.createElement(GeneralSchemaItems, null), !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
248
157
  key: "quick-upload",
249
158
  title: t('Quick upload'),
250
- checked: ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.quickUpload) !== false,
159
+ checked: ((_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.quickUpload) !== false,
251
160
  onChange: function onChange(value) {
252
161
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
253
162
  field.componentProps.quickUpload = value;
@@ -262,7 +171,7 @@ FormItem.Designer = function Designer() {
262
171
  }) : null, !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
263
172
  key: "select-file",
264
173
  title: t('Select file'),
265
- checked: ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.selectFile) !== false,
174
+ checked: ((_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.selectFile) !== false,
266
175
  onChange: function onChange(value) {
267
176
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
268
177
  field.componentProps.selectFile = value;
@@ -362,7 +271,7 @@ FormItem.Designer = function Designer() {
362
271
  }
363
272
  },
364
273
  onSubmit: function onSubmit(v) {
365
- var _collectionField$uiSc3;
274
+ var _collectionField$uiSc2;
366
275
  var rules = [];
367
276
  var _iterator = _createForOfIteratorHelper(v.rules),
368
277
  _step;
@@ -400,7 +309,7 @@ FormItem.Designer = function Designer() {
400
309
  _iterator2.f();
401
310
  }
402
311
  }
403
- var concatValidator = _.concat([], (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc3 = collectionField.uiSchema) === null || _collectionField$uiSc3 === void 0 ? void 0 : _collectionField$uiSc3['x-validator']) || [], rules);
312
+ var concatValidator = _.concat([], (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2['x-validator']) || [], rules);
404
313
  field.validator = concatValidator;
405
314
  fieldSchema['x-validator'] = rules;
406
315
  schema['x-validator'] = rules;
@@ -421,10 +330,10 @@ FormItem.Designer = function Designer() {
421
330
  type: 'object',
422
331
  title: t('Set default value'),
423
332
  properties: {
424
- default: isInvariable(interfaceConfig) ? _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
333
+ default: isInvariable(interfaceConfig) ? _objectSpread(_objectSpread({}, fieldSchemaWithoutRequired || {}), {}, {
425
334
  'x-decorator': 'FormItem',
426
335
  'x-component-props': _objectSpread(_objectSpread({}, fieldSchema['x-component-props']), {}, {
427
- component: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) && collectionField.interface !== 'chinaRegion' ? 'AssociationSelect' : undefined,
336
+ component: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) && (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) !== 'chinaRegion' ? 'AssociationSelect' : undefined,
428
337
  service: {
429
338
  resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
430
339
  },
@@ -438,7 +347,7 @@ FormItem.Designer = function Designer() {
438
347
  default: getFieldDefaultValue(fieldSchema, collectionField),
439
348
  'x-read-pretty': false,
440
349
  'x-disabled': false
441
- }) : _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
350
+ }) : _objectSpread(_objectSpread({}, fieldSchemaWithoutRequired || {}), {}, {
442
351
  'x-decorator': 'FormItem',
443
352
  'x-component': 'VariableInput',
444
353
  'x-component-props': _objectSpread(_objectSpread({}, (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']) || {}), {}, {
@@ -446,7 +355,7 @@ FormItem.Designer = function Designer() {
446
355
  schema: collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema,
447
356
  className: defaultInputStyle,
448
357
  renderSchemaComponent: function Com(props) {
449
- var s = _.cloneDeep(fieldSchema) || {};
358
+ var s = _.cloneDeep(fieldSchemaWithoutRequired) || {};
450
359
  s.title = '';
451
360
  s['x-read-pretty'] = false;
452
361
  s['x-disabled'] = false;
@@ -502,15 +411,15 @@ FormItem.Designer = function Designer() {
502
411
  }
503
412
  }
504
413
  },
505
- onSubmit: function onSubmit(_ref4) {
506
- var _schema6;
507
- var filter = _ref4.filter;
414
+ onSubmit: function onSubmit(_ref) {
415
+ var _schema5;
416
+ var filter = _ref.filter;
508
417
  filter = removeNullCondition(filter);
509
418
  _.set(field.componentProps, 'service.params.filter', filter);
510
419
  fieldSchema['x-component-props'] = field.componentProps;
511
420
  field.componentProps = field.componentProps;
512
421
  dn.emit('patch', {
513
- schema: (_schema6 = {}, _defineProperty(_schema6, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema6, 'x-component-props', field.componentProps), _schema6)
422
+ schema: (_schema5 = {}, _defineProperty(_schema5, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema5, 'x-component-props', field.componentProps), _schema5)
514
423
  });
515
424
  }
516
425
  }), isSelectFieldMode && !field.readPretty && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
@@ -542,6 +451,7 @@ FormItem.Designer = function Designer() {
542
451
  field: {
543
452
  type: 'string',
544
453
  enum: sortFields,
454
+ required: true,
545
455
  'x-decorator': 'FormItem',
546
456
  'x-component': 'Select',
547
457
  'x-component-props': {
@@ -584,19 +494,19 @@ FormItem.Designer = function Designer() {
584
494
  }
585
495
  }
586
496
  },
587
- onSubmit: function onSubmit(_ref5) {
588
- var _schema7;
589
- var sort = _ref5.sort;
497
+ onSubmit: function onSubmit(_ref2) {
498
+ var _schema6;
499
+ var sort = _ref2.sort;
590
500
  var sortArr = sort.map(function (item) {
591
501
  return item.direction === 'desc' ? "-".concat(item.field) : item.field;
592
502
  });
593
503
  _.set(field.componentProps, 'service.params.sort', sortArr);
594
504
  fieldSchema['x-component-props'] = field.componentProps;
595
505
  dn.emit('patch', {
596
- schema: (_schema7 = {}, _defineProperty(_schema7, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema7, 'x-component-props', field.componentProps), _schema7)
506
+ schema: (_schema6 = {}, _defineProperty(_schema6, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema6, 'x-component-props', field.componentProps), _schema6)
597
507
  });
598
508
  }
599
- }), isAssociationField && fieldModeOptions && !isTableField && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
509
+ }), showFieldMode && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
600
510
  key: "field-mode",
601
511
  title: t('Field mode'),
602
512
  options: fieldModeOptions,
@@ -608,20 +518,75 @@ FormItem.Designer = function Designer() {
608
518
  schema['x-component-props'] = fieldSchema['x-component-props'];
609
519
  field.componentProps = field.componentProps || {};
610
520
  field.componentProps.mode = mode;
611
- if (mode === 'Nester') {
612
- var initValue = ['o2m', 'm2m'].includes(collectionField.interface) ? [] : {};
613
- field.value = field.value || initValue;
614
- }
521
+ // if (mode === 'Nester') {
522
+ // const initValue = ['hasMany', 'belongsToMany'].includes(collectionField?.type) ? [{}] : {};
523
+ // field.value = field.value || initValue;
524
+ // }
615
525
  dn.emit('patch', {
616
526
  schema: schema
617
527
  });
618
528
  dn.refresh();
619
529
  }
620
- }), !field.readPretty && isAssociationField && ['Select', 'Picker'].includes(fieldMode) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
530
+ }), showModeSelect && /*#__PURE__*/React.createElement(SchemaSettings.Item, null, /*#__PURE__*/React.createElement("div", {
531
+ style: {
532
+ alignItems: 'center',
533
+ display: 'flex',
534
+ justifyContent: 'space-between'
535
+ }
536
+ }, t('Popup size'), /*#__PURE__*/React.createElement(Select, {
537
+ bordered: false,
538
+ options: [{
539
+ label: t('Small'),
540
+ value: 'small'
541
+ }, {
542
+ label: t('Middle'),
543
+ value: 'middle'
544
+ }, {
545
+ label: t('Large'),
546
+ value: 'large'
547
+ }],
548
+ value: (_fieldSchema$xCompon5 = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon6 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon6 === void 0 ? void 0 : _fieldSchema$xCompon6['openSize']) !== null && _fieldSchema$xCompon5 !== void 0 ? _fieldSchema$xCompon5 : (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon7 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon7 === void 0 ? void 0 : _fieldSchema$xCompon7['openMode']) == 'modal' ? 'large' : 'middle',
549
+ onChange: function onChange(value) {
550
+ field.componentProps.openSize = value;
551
+ fieldSchema['x-component-props'] = field.componentProps;
552
+ dn.emit('patch', {
553
+ schema: {
554
+ 'x-uid': fieldSchema['x-uid'],
555
+ 'x-component-props': fieldSchema['x-component-props']
556
+ }
557
+ });
558
+ dn.refresh();
559
+ },
560
+ style: {
561
+ textAlign: 'right',
562
+ minWidth: 100
563
+ }
564
+ }))), !field.readPretty && isAssociationField && ['Select', 'Picker'].includes(fieldMode) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
621
565
  key: "allowAddNew",
622
566
  title: t('Allow add new data'),
623
567
  checked: fieldSchema['x-add-new'],
624
568
  onChange: function onChange(allowAddNew) {
569
+ var hasAddNew = fieldSchema.reduceProperties(function (buf, schema) {
570
+ if (schema['x-component'] === 'Action') {
571
+ return schema;
572
+ }
573
+ return buf;
574
+ }, null);
575
+ if (!hasAddNew) {
576
+ var addNewActionschema = {
577
+ 'x-action': 'create',
578
+ title: "{{t('Add new')}}",
579
+ 'x-designer': 'Action.Designer',
580
+ 'x-component': 'Action',
581
+ 'x-decorator': 'ACLActionProvider',
582
+ 'x-component-props': {
583
+ openMode: 'drawer',
584
+ type: 'default',
585
+ component: 'CreateRecordAction'
586
+ }
587
+ };
588
+ insertAdjacent('afterBegin', addNewActionschema);
589
+ }
625
590
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
626
591
  field['x-add-new'] = allowAddNew;
627
592
  fieldSchema['x-add-new'] = allowAddNew;
@@ -631,10 +596,10 @@ FormItem.Designer = function Designer() {
631
596
  });
632
597
  refresh();
633
598
  }
634
- }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && ['o2m', 'm2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && fieldSchema['x-component'] !== 'TableField' && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
599
+ }), IsShowMultipleSwitch() ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
635
600
  key: "multiple",
636
- title: t('Multiple'),
637
- checked: ((_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.multiple) === undefined ? true : fieldSchema['x-component-props'].multiple,
601
+ title: t('Allow multiple'),
602
+ checked: ((_fieldSchema$xCompon8 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon8 === void 0 ? void 0 : _fieldSchema$xCompon8.multiple) === undefined ? true : fieldSchema['x-component-props'].multiple,
638
603
  onChange: function onChange(value) {
639
604
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
640
605
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
@@ -647,9 +612,25 @@ FormItem.Designer = function Designer() {
647
612
  });
648
613
  refresh();
649
614
  }
650
- }), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && !isFileField && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
615
+ }) : null, IsShowMultipleSwitch() && isSubFormMode ? /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
616
+ key: "allowDissociate",
617
+ title: t('Allow dissociate'),
618
+ checked: ((_fieldSchema$xCompon9 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon9 === void 0 ? void 0 : _fieldSchema$xCompon9.allowDissociate) !== false,
619
+ onChange: function onChange(value) {
620
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
621
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
622
+ field.componentProps = field.componentProps || {};
623
+ fieldSchema['x-component-props'].allowDissociate = value;
624
+ field.componentProps.allowDissociate = value;
625
+ schema['x-component-props'] = fieldSchema['x-component-props'];
626
+ dn.emit('patch', {
627
+ schema: schema
628
+ });
629
+ refresh();
630
+ }
631
+ }) : null, field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && !isFileField && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
651
632
  title: t('Enable link'),
652
- checked: ((_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.enableLink) !== false,
633
+ checked: ((_fieldSchema$xCompon10 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon10 === void 0 ? void 0 : _fieldSchema$xCompon10.enableLink) !== false,
653
634
  onChange: function onChange(flag) {
654
635
  fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
655
636
  enableLink: flag
@@ -715,15 +696,15 @@ FormItem.Designer = function Designer() {
715
696
  });
716
697
  dn.refresh();
717
698
  }
718
- }), options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
699
+ }), options.length > 0 && isAssociationField && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
719
700
  key: "title-field",
720
701
  title: t('Title field'),
721
702
  options: options,
722
703
  value: field === null || field === void 0 ? void 0 : (_field$componentProps8 = field.componentProps) === null || _field$componentProps8 === void 0 ? void 0 : (_field$componentProps9 = _field$componentProps8.fieldNames) === null || _field$componentProps9 === void 0 ? void 0 : _field$componentProps9.label,
723
704
  onChange: function onChange(label) {
724
- var _collectionField$uiSc4, _collectionField$uiSc5;
705
+ var _collectionField$uiSc3, _collectionField$uiSc4;
725
706
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
726
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : (_collectionField$uiSc5 = _collectionField$uiSc4['x-component-props']) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['fieldNames']), field.componentProps.fieldNames), {}, {
707
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc3 = collectionField.uiSchema) === null || _collectionField$uiSc3 === void 0 ? void 0 : (_collectionField$uiSc4 = _collectionField$uiSc3['x-component-props']) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['fieldNames']), field.componentProps.fieldNames), {}, {
727
708
  label: label
728
709
  });
729
710
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
@@ -751,9 +732,9 @@ export function isFileCollection(collection) {
751
732
  }
752
733
  FormItem.FilterFormDesigner = FilterFormDesigner;
753
734
  export function getFieldDefaultValue(fieldSchema, collectionField) {
754
- var _collectionField$uiSc6;
735
+ var _collectionField$uiSc5;
755
736
  var result = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default) || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue);
756
- if ((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc6 = collectionField.uiSchema) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['x-component']) === 'DatePicker' && result) {
737
+ if ((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['x-component']) === 'DatePicker' && result) {
757
738
  return moment(result);
758
739
  }
759
740
  return result;
@@ -365,11 +365,11 @@ export var EditDefaultValue = function EditDefaultValue() {
365
365
  type: 'object',
366
366
  title: t('Set default value'),
367
367
  properties: {
368
- default: _objectSpread(_objectSpread({}, collectionField.uiSchema), {}, {
368
+ default: _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema), {}, {
369
369
  name: 'default',
370
370
  title: t('Default value'),
371
371
  'x-decorator': 'FormItem',
372
- default: fieldSchema.default || collectionField.defaultValue
372
+ default: fieldSchema.default || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue)
373
373
  })
374
374
  }
375
375
  },
@@ -558,7 +558,7 @@ export var EditTitleField = function EditTitleField() {
558
558
  dn = _useDesignable10.dn;
559
559
  var compile = useCompile();
560
560
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
561
- var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField.target) : (_getCollectionFields = getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection)) !== null && _getCollectionFields !== void 0 ? _getCollectionFields : [];
561
+ var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) : (_getCollectionFields = getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection)) !== null && _getCollectionFields !== void 0 ? _getCollectionFields : [];
562
562
  var options = targetFields.filter(function (field) {
563
563
  return !(field === null || field === void 0 ? void 0 : field.target) && field.type !== 'boolean';
564
564
  }).map(function (field) {
@@ -162,6 +162,7 @@ export var DetailsDesigner = function DetailsDesigner() {
162
162
  field: {
163
163
  type: 'string',
164
164
  enum: sortFields,
165
+ required: true,
165
166
  'x-decorator': 'FormItem',
166
167
  'x-component': 'Select',
167
168
  'x-component-props': {
@@ -1,3 +1,23 @@
1
+ export interface ITemplate {
2
+ config?: {
3
+ [key: string]: {
4
+ /** 设置的数据范围 */
5
+ filter?: any;
6
+ /** 设置的标题字段 */
7
+ titleField?: string;
8
+ };
9
+ };
10
+ items: {
11
+ key: string;
12
+ title: string;
13
+ collection: string;
14
+ dataId: number;
15
+ fields: string[];
16
+ default?: boolean;
17
+ }[];
18
+ /** 是否在 Form 区块显示模板选择器 */
19
+ display: boolean;
20
+ }
1
21
  export declare const Templates: ({ style, form }: {
2
22
  style?: {};
3
23
  form: any;