@nocobase/client 0.9.2-alpha.4 → 0.9.4-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (441) hide show
  1. package/es/acl/ACLProvider.js +2 -2
  2. package/es/acl/Configuration/RoleConfigure.js +15 -8
  3. package/es/api-client/APIClient.d.ts +2 -0
  4. package/es/api-client/APIClient.js +11 -0
  5. package/es/block-provider/BlockProvider.js +58 -17
  6. package/es/block-provider/DetailsBlockProvider.js +13 -1
  7. package/es/block-provider/FormBlockProvider.js +30 -13
  8. package/es/block-provider/hooks/index.d.ts +10 -0
  9. package/es/block-provider/hooks/index.js +521 -283
  10. package/es/collection-manager/CollectionField.js +3 -3
  11. package/es/collection-manager/CollectionFieldProvider.js +2 -1
  12. package/es/collection-manager/Configuration/AddFieldAction.js +3 -3
  13. package/es/collection-manager/Configuration/CollectionFields.d.ts +1 -1
  14. package/es/collection-manager/Configuration/CollectionFields.js +2 -5
  15. package/es/collection-manager/Configuration/ConfigurationTabs.js +7 -6
  16. package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
  17. package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  18. package/es/collection-manager/action-hooks.d.ts +1 -1
  19. package/es/collection-manager/action-hooks.js +18 -7
  20. package/es/collection-manager/hooks/useCollection.d.ts +1 -1
  21. package/es/collection-manager/hooks/useCollectionDataSource.js +4 -4
  22. package/es/collection-manager/interfaces/createdBy.js +1 -1
  23. package/es/collection-manager/interfaces/linkTo.js +3 -39
  24. package/es/collection-manager/interfaces/m2m.js +4 -38
  25. package/es/collection-manager/interfaces/m2o.js +4 -38
  26. package/es/collection-manager/interfaces/o2m.js +4 -68
  27. package/es/collection-manager/interfaces/o2o.js +25 -119
  28. package/es/collection-manager/interfaces/updatedBy.js +1 -1
  29. package/es/collection-manager/templates/expression.js +1 -1
  30. package/es/collection-manager/templates/tree.js +2 -2
  31. package/es/filter-provider/FilterProvider.js +3 -1
  32. package/es/filter-provider/utils.js +1 -1
  33. package/es/index.d.ts +1 -0
  34. package/es/index.js +1 -0
  35. package/es/locale/en_US.d.ts +19 -1
  36. package/es/locale/en_US.js +22 -4
  37. package/es/locale/es_ES.d.ts +692 -0
  38. package/es/locale/es_ES.js +691 -0
  39. package/es/locale/ja_JP.d.ts +8 -1
  40. package/es/locale/ja_JP.js +9 -2
  41. package/es/locale/pt_BR.d.ts +5 -1
  42. package/es/locale/pt_BR.js +6 -2
  43. package/es/locale/ru_RU.d.ts +5 -1
  44. package/es/locale/ru_RU.js +6 -2
  45. package/es/locale/tr_TR.d.ts +5 -1
  46. package/es/locale/tr_TR.js +6 -2
  47. package/es/locale/zh_CN.d.ts +27 -1
  48. package/es/locale/zh_CN.js +28 -2
  49. package/es/record-provider/index.d.ts +4 -0
  50. package/es/record-provider/index.js +3 -0
  51. package/es/schema-component/antd/action/Action.Designer.js +10 -8
  52. package/es/schema-component/antd/action/Action.Drawer.js +4 -1
  53. package/es/schema-component/antd/action/ActionBar.js +25 -18
  54. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  55. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +30 -0
  56. package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  57. package/es/schema-component/antd/association-field/AssociationSelect.js +63 -0
  58. package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
  59. package/es/schema-component/antd/association-field/Editable.js +112 -0
  60. package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
  61. package/es/schema-component/antd/association-field/FileManager.js +243 -0
  62. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  63. package/es/schema-component/antd/association-field/InternalNester.js +29 -0
  64. package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  65. package/es/schema-component/antd/association-field/InternalPicker.js +236 -0
  66. package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  67. package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
  68. package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  69. package/es/schema-component/antd/association-field/InternalViewer.js +112 -0
  70. package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
  71. package/es/schema-component/antd/association-field/Nester.js +71 -0
  72. package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  73. package/es/schema-component/antd/association-field/ReadPretty.js +22 -0
  74. package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
  75. package/es/schema-component/antd/association-field/SubTable.js +25 -0
  76. package/es/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
  77. package/es/schema-component/antd/association-field/components/CreateRecordAction.js +61 -0
  78. package/es/schema-component/antd/association-field/context.d.ts +8 -0
  79. package/es/schema-component/antd/association-field/context.js +2 -0
  80. package/es/schema-component/antd/association-field/hooks.d.ts +9 -0
  81. package/es/schema-component/antd/association-field/hooks.js +96 -0
  82. package/es/schema-component/antd/association-field/index.d.ts +1 -0
  83. package/es/schema-component/antd/association-field/index.js +14 -0
  84. package/es/schema-component/antd/association-field/schema.d.ts +142 -0
  85. package/es/schema-component/antd/association-field/schema.js +141 -0
  86. package/es/schema-component/antd/association-field/util.d.ts +8 -0
  87. package/es/schema-component/antd/association-field/util.js +84 -0
  88. package/es/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
  89. package/es/schema-component/antd/association-select/AssociationSelect.js +49 -231
  90. package/es/schema-component/antd/association-select/useServiceOptions.js +2 -2
  91. package/es/schema-component/antd/collection-select/CollectionSelect.js +5 -0
  92. package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  93. package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
  94. package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  95. package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
  96. package/es/schema-component/antd/expand-action/index.d.ts +1 -0
  97. package/es/schema-component/antd/expand-action/index.js +5 -0
  98. package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  99. package/es/schema-component/antd/filter/FilterItem.js +1 -1
  100. package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
  101. package/es/schema-component/antd/form/Form.js +4 -4
  102. package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
  103. package/es/schema-component/antd/form-item/FormItem.js +263 -168
  104. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +39 -61
  105. package/es/schema-component/antd/form-v2/Form.Designer.js +1 -0
  106. package/es/schema-component/antd/form-v2/Templates.d.ts +20 -0
  107. package/es/schema-component/antd/form-v2/Templates.js +40 -12
  108. package/es/schema-component/antd/form-v2/utils.js +3 -1
  109. package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  110. package/es/schema-component/antd/grid/Grid.js +34 -24
  111. package/es/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
  112. package/es/schema-component/antd/grid-card/GridCard.Decorator.js +65 -0
  113. package/es/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
  114. package/es/schema-component/antd/grid-card/GridCard.Designer.js +243 -0
  115. package/es/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
  116. package/es/schema-component/antd/grid-card/GridCard.Item.js +18 -0
  117. package/es/schema-component/antd/grid-card/GridCard.d.ts +8 -0
  118. package/es/schema-component/antd/grid-card/GridCard.js +103 -0
  119. package/es/schema-component/antd/grid-card/hooks.d.ts +4 -0
  120. package/es/schema-component/antd/grid-card/hooks.js +9 -0
  121. package/es/schema-component/antd/grid-card/index.d.ts +1 -0
  122. package/es/schema-component/antd/grid-card/index.js +1 -0
  123. package/es/schema-component/antd/grid-card/options.d.ts +20 -0
  124. package/es/schema-component/antd/grid-card/options.js +20 -0
  125. package/es/schema-component/antd/index.d.ts +5 -1
  126. package/es/schema-component/antd/index.js +5 -1
  127. package/es/schema-component/antd/list/List.Decorator.d.ts +5 -0
  128. package/es/schema-component/antd/list/List.Decorator.js +59 -0
  129. package/es/schema-component/antd/list/List.Designer.d.ts +1 -0
  130. package/es/schema-component/antd/list/List.Designer.js +205 -0
  131. package/es/schema-component/antd/list/List.Item.d.ts +1 -0
  132. package/es/schema-component/antd/list/List.Item.js +15 -0
  133. package/es/schema-component/antd/list/List.d.ts +8 -0
  134. package/es/schema-component/antd/list/List.js +83 -0
  135. package/es/schema-component/antd/list/hooks.d.ts +4 -0
  136. package/es/schema-component/antd/list/hooks.js +9 -0
  137. package/es/schema-component/antd/list/index.d.ts +1 -0
  138. package/es/schema-component/antd/list/index.js +1 -0
  139. package/es/schema-component/antd/menu/Menu.js +6 -3
  140. package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  141. package/es/schema-component/antd/record-picker/InputRecordPicker.js +32 -12
  142. package/es/schema-component/antd/remote-select/RemoteSelect.js +23 -23
  143. package/es/schema-component/antd/select/Select.js +2 -0
  144. package/es/schema-component/antd/table/Table.Void.Designer.js +1 -0
  145. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  146. package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  147. package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
  148. package/es/schema-component/antd/table-v2/Table.js +9 -5
  149. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  150. package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
  151. package/es/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
  152. package/es/schema-component/antd/table-v2/hooks/useUserVariable.js +65 -0
  153. package/es/schema-component/antd/table-v2/index.js +3 -1
  154. package/es/schema-component/antd/table-v2/utils.js +1 -1
  155. package/es/schema-component/antd/variable/Input.js +11 -8
  156. package/es/schema-component/antd/variable/TextArea.js +2 -5
  157. package/es/schema-component/common/dnd-context/index.js +3 -2
  158. package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
  159. package/es/schema-component/common/utils/uitls.js +1 -1
  160. package/es/schema-component/core/SchemaComponentProvider.js +2 -2
  161. package/es/schema-component/hooks/index.d.ts +1 -0
  162. package/es/schema-component/hooks/index.js +2 -1
  163. package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  164. package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
  165. package/es/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
  166. package/es/schema-initializer/SchemaInitializerProvider.js +23 -10
  167. package/es/schema-initializer/buttons/BlockInitializers.js +10 -0
  168. package/es/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
  169. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
  170. package/es/schema-initializer/buttons/FormActionInitializers.js +106 -100
  171. package/es/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
  172. package/es/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
  173. package/es/schema-initializer/buttons/GridCardActionInitializers.js +278 -0
  174. package/es/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
  175. package/es/schema-initializer/buttons/ListActionInitializers.js +278 -0
  176. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  177. package/es/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
  178. package/es/schema-initializer/buttons/TableActionInitializers.js +29 -35
  179. package/es/schema-initializer/buttons/TableColumnInitializers.js +4 -1
  180. package/es/schema-initializer/buttons/index.d.ts +3 -0
  181. package/es/schema-initializer/buttons/index.js +3 -0
  182. package/es/schema-initializer/components/BulkEditField.js +7 -5
  183. package/es/schema-initializer/components/CreateRecordAction.d.ts +2 -1
  184. package/es/schema-initializer/components/CreateRecordAction.js +55 -33
  185. package/es/schema-initializer/components/DeletedField.d.ts +1 -0
  186. package/es/schema-initializer/components/DeletedField.js +11 -0
  187. package/es/schema-initializer/components/assigned-field/AssignedField.js +35 -23
  188. package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  189. package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
  190. package/es/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
  191. package/es/schema-initializer/items/GridCardBlockInitializer.js +47 -0
  192. package/es/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
  193. package/es/schema-initializer/items/ListBlockInitializer.js +47 -0
  194. package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  195. package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
  196. package/es/schema-initializer/items/index.d.ts +3 -0
  197. package/es/schema-initializer/items/index.js +3 -0
  198. package/es/schema-initializer/utils.d.ts +112 -0
  199. package/es/schema-initializer/utils.js +224 -38
  200. package/es/schema-items/GeneralSchemaItems.d.ts +4 -0
  201. package/es/schema-items/GeneralSchemaItems.js +148 -0
  202. package/es/schema-items/index.d.ts +1 -0
  203. package/es/schema-items/index.js +2 -1
  204. package/es/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
  205. package/es/schema-settings/DataTemplates/FormDataTemplates.js +117 -42
  206. package/es/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
  207. package/es/schema-settings/DataTemplates/components/Designer.js +179 -0
  208. package/es/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
  209. package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -96
  210. package/es/schema-settings/GeneralSchemaDesigner.js +19 -15
  211. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  212. package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
  213. package/es/schema-settings/LinkageRules/Variables.js +7 -4
  214. package/es/schema-settings/SchemaSettings.d.ts +1 -1
  215. package/es/schema-settings/SchemaSettings.js +53 -29
  216. package/es/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
  217. package/es/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
  218. package/es/schema-settings/hooks/useIsShowMultipleSwitch.js +18 -0
  219. package/es/schema-templates/BlockTemplateDetails.js +1 -1
  220. package/es/user/CurrentUser.js +118 -10
  221. package/lib/acl/ACLProvider.js +2 -2
  222. package/lib/acl/Configuration/RoleConfigure.js +15 -8
  223. package/lib/api-client/APIClient.d.ts +2 -0
  224. package/lib/api-client/APIClient.js +11 -0
  225. package/lib/block-provider/BlockProvider.js +57 -16
  226. package/lib/block-provider/DetailsBlockProvider.js +13 -1
  227. package/lib/block-provider/FormBlockProvider.js +31 -15
  228. package/lib/block-provider/hooks/index.d.ts +10 -0
  229. package/lib/block-provider/hooks/index.js +531 -290
  230. package/lib/collection-manager/CollectionField.js +3 -3
  231. package/lib/collection-manager/CollectionFieldProvider.js +2 -1
  232. package/lib/collection-manager/Configuration/AddFieldAction.js +2 -2
  233. package/lib/collection-manager/Configuration/CollectionFields.d.ts +1 -1
  234. package/lib/collection-manager/Configuration/CollectionFields.js +2 -5
  235. package/lib/collection-manager/Configuration/ConfigurationTabs.js +7 -6
  236. package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
  237. package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  238. package/lib/collection-manager/action-hooks.d.ts +1 -1
  239. package/lib/collection-manager/action-hooks.js +18 -7
  240. package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
  241. package/lib/collection-manager/hooks/useCollectionDataSource.js +4 -4
  242. package/lib/collection-manager/interfaces/createdBy.js +1 -1
  243. package/lib/collection-manager/interfaces/linkTo.js +2 -38
  244. package/lib/collection-manager/interfaces/m2m.js +3 -37
  245. package/lib/collection-manager/interfaces/m2o.js +3 -37
  246. package/lib/collection-manager/interfaces/o2m.js +6 -70
  247. package/lib/collection-manager/interfaces/o2o.js +30 -124
  248. package/lib/collection-manager/interfaces/updatedBy.js +1 -1
  249. package/lib/collection-manager/templates/expression.js +1 -1
  250. package/lib/collection-manager/templates/tree.js +2 -2
  251. package/lib/filter-provider/FilterProvider.js +3 -1
  252. package/lib/filter-provider/utils.js +1 -1
  253. package/lib/index.d.ts +1 -0
  254. package/lib/index.js +11 -0
  255. package/lib/locale/en_US.d.ts +19 -1
  256. package/lib/locale/en_US.js +22 -4
  257. package/lib/locale/es_ES.d.ts +692 -0
  258. package/lib/locale/es_ES.js +698 -0
  259. package/lib/locale/ja_JP.d.ts +8 -1
  260. package/lib/locale/ja_JP.js +9 -2
  261. package/lib/locale/pt_BR.d.ts +5 -1
  262. package/lib/locale/pt_BR.js +6 -2
  263. package/lib/locale/ru_RU.d.ts +5 -1
  264. package/lib/locale/ru_RU.js +6 -2
  265. package/lib/locale/tr_TR.d.ts +5 -1
  266. package/lib/locale/tr_TR.js +6 -2
  267. package/lib/locale/zh_CN.d.ts +27 -1
  268. package/lib/locale/zh_CN.js +28 -2
  269. package/lib/record-provider/index.d.ts +4 -0
  270. package/lib/record-provider/index.js +5 -1
  271. package/lib/schema-component/antd/action/Action.Designer.js +10 -8
  272. package/lib/schema-component/antd/action/Action.Drawer.js +4 -1
  273. package/lib/schema-component/antd/action/ActionBar.js +23 -16
  274. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  275. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +40 -0
  276. package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  277. package/lib/schema-component/antd/association-field/AssociationSelect.js +72 -0
  278. package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
  279. package/lib/schema-component/antd/association-field/Editable.js +121 -0
  280. package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
  281. package/lib/schema-component/antd/association-field/FileManager.js +253 -0
  282. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  283. package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
  284. package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  285. package/lib/schema-component/antd/association-field/InternalPicker.js +246 -0
  286. package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  287. package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
  288. package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  289. package/lib/schema-component/antd/association-field/InternalViewer.js +123 -0
  290. package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
  291. package/lib/schema-component/antd/association-field/Nester.js +80 -0
  292. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  293. package/lib/schema-component/antd/association-field/ReadPretty.js +30 -0
  294. package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
  295. package/lib/schema-component/antd/association-field/SubTable.js +33 -0
  296. package/lib/schema-component/antd/association-field/components/CreateRecordAction.d.ts +2 -0
  297. package/lib/schema-component/antd/association-field/components/CreateRecordAction.js +71 -0
  298. package/lib/schema-component/antd/association-field/context.d.ts +8 -0
  299. package/lib/schema-component/antd/association-field/context.js +9 -0
  300. package/lib/schema-component/antd/association-field/hooks.d.ts +9 -0
  301. package/lib/schema-component/antd/association-field/hooks.js +107 -0
  302. package/lib/schema-component/antd/association-field/index.d.ts +1 -0
  303. package/lib/schema-component/antd/association-field/index.js +21 -0
  304. package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
  305. package/lib/schema-component/antd/association-field/schema.js +148 -0
  306. package/lib/schema-component/antd/association-field/util.d.ts +8 -0
  307. package/lib/schema-component/antd/association-field/util.js +98 -0
  308. package/lib/schema-component/antd/association-filter/AssociationFilter.Item.js +3 -3
  309. package/lib/schema-component/antd/association-select/AssociationSelect.js +49 -231
  310. package/lib/schema-component/antd/association-select/useServiceOptions.js +2 -2
  311. package/lib/schema-component/antd/collection-select/CollectionSelect.js +5 -0
  312. package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  313. package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
  314. package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  315. package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
  316. package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
  317. package/lib/schema-component/antd/expand-action/index.js +12 -0
  318. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  319. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  320. package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
  321. package/lib/schema-component/antd/form/Form.js +4 -4
  322. package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
  323. package/lib/schema-component/antd/form-item/FormItem.js +258 -162
  324. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +37 -59
  325. package/lib/schema-component/antd/form-v2/Form.Designer.js +1 -0
  326. package/lib/schema-component/antd/form-v2/Templates.d.ts +20 -0
  327. package/lib/schema-component/antd/form-v2/Templates.js +39 -11
  328. package/lib/schema-component/antd/form-v2/utils.js +3 -1
  329. package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  330. package/lib/schema-component/antd/grid/Grid.js +33 -23
  331. package/lib/schema-component/antd/grid-card/GridCard.Decorator.d.ts +5 -0
  332. package/lib/schema-component/antd/grid-card/GridCard.Decorator.js +77 -0
  333. package/lib/schema-component/antd/grid-card/GridCard.Designer.d.ts +1 -0
  334. package/lib/schema-component/antd/grid-card/GridCard.Designer.js +253 -0
  335. package/lib/schema-component/antd/grid-card/GridCard.Item.d.ts +1 -0
  336. package/lib/schema-component/antd/grid-card/GridCard.Item.js +26 -0
  337. package/lib/schema-component/antd/grid-card/GridCard.d.ts +8 -0
  338. package/lib/schema-component/antd/grid-card/GridCard.js +112 -0
  339. package/lib/schema-component/antd/grid-card/hooks.d.ts +4 -0
  340. package/lib/schema-component/antd/grid-card/hooks.js +16 -0
  341. package/lib/schema-component/antd/grid-card/index.d.ts +1 -0
  342. package/lib/schema-component/antd/grid-card/index.js +16 -0
  343. package/lib/schema-component/antd/grid-card/options.d.ts +20 -0
  344. package/lib/schema-component/antd/grid-card/options.js +31 -0
  345. package/lib/schema-component/antd/index.d.ts +5 -1
  346. package/lib/schema-component/antd/index.js +55 -11
  347. package/lib/schema-component/antd/list/List.Decorator.d.ts +5 -0
  348. package/lib/schema-component/antd/list/List.Decorator.js +71 -0
  349. package/lib/schema-component/antd/list/List.Designer.d.ts +1 -0
  350. package/lib/schema-component/antd/list/List.Designer.js +213 -0
  351. package/lib/schema-component/antd/list/List.Item.d.ts +1 -0
  352. package/lib/schema-component/antd/list/List.Item.js +23 -0
  353. package/lib/schema-component/antd/list/List.d.ts +8 -0
  354. package/lib/schema-component/antd/list/List.js +92 -0
  355. package/lib/schema-component/antd/list/hooks.d.ts +4 -0
  356. package/lib/schema-component/antd/list/hooks.js +16 -0
  357. package/lib/schema-component/antd/list/index.d.ts +1 -0
  358. package/lib/schema-component/antd/list/index.js +16 -0
  359. package/lib/schema-component/antd/menu/Menu.js +6 -3
  360. package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  361. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +34 -13
  362. package/lib/schema-component/antd/remote-select/RemoteSelect.js +22 -22
  363. package/lib/schema-component/antd/select/Select.js +2 -0
  364. package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -0
  365. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  366. package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  367. package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
  368. package/lib/schema-component/antd/table-v2/Table.js +9 -5
  369. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  370. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -0
  371. package/lib/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +22 -0
  372. package/lib/schema-component/antd/table-v2/hooks/useUserVariable.js +73 -0
  373. package/lib/schema-component/antd/table-v2/index.js +3 -1
  374. package/lib/schema-component/antd/table-v2/utils.js +1 -1
  375. package/lib/schema-component/antd/variable/Input.js +11 -8
  376. package/lib/schema-component/antd/variable/TextArea.js +2 -5
  377. package/lib/schema-component/common/dnd-context/index.js +3 -2
  378. package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
  379. package/lib/schema-component/common/utils/uitls.js +1 -1
  380. package/lib/schema-component/core/SchemaComponentProvider.js +2 -2
  381. package/lib/schema-component/hooks/index.d.ts +1 -0
  382. package/lib/schema-component/hooks/index.js +11 -0
  383. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  384. package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
  385. package/lib/schema-initializer/SchemaInitializerProvider.d.ts +1 -0
  386. package/lib/schema-initializer/SchemaInitializerProvider.js +22 -9
  387. package/lib/schema-initializer/buttons/BlockInitializers.js +10 -0
  388. package/lib/schema-initializer/buttons/CustomFormItemInitializers.js +4 -2
  389. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +0 -116
  390. package/lib/schema-initializer/buttons/FormActionInitializers.js +106 -100
  391. package/lib/schema-initializer/buttons/GanttActionInitializers.d.ts +0 -19
  392. package/lib/schema-initializer/buttons/GridCardActionInitializers.d.ts +195 -0
  393. package/lib/schema-initializer/buttons/GridCardActionInitializers.js +285 -0
  394. package/lib/schema-initializer/buttons/ListActionInitializers.d.ts +195 -0
  395. package/lib/schema-initializer/buttons/ListActionInitializers.js +285 -0
  396. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +1 -1
  397. package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +0 -20
  398. package/lib/schema-initializer/buttons/TableActionInitializers.js +29 -35
  399. package/lib/schema-initializer/buttons/TableColumnInitializers.js +4 -1
  400. package/lib/schema-initializer/buttons/index.d.ts +3 -0
  401. package/lib/schema-initializer/buttons/index.js +22 -0
  402. package/lib/schema-initializer/components/BulkEditField.js +7 -5
  403. package/lib/schema-initializer/components/CreateRecordAction.d.ts +2 -1
  404. package/lib/schema-initializer/components/CreateRecordAction.js +58 -35
  405. package/lib/schema-initializer/components/DeletedField.d.ts +1 -0
  406. package/lib/schema-initializer/components/DeletedField.js +19 -0
  407. package/lib/schema-initializer/components/assigned-field/AssignedField.js +34 -22
  408. package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  409. package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
  410. package/lib/schema-initializer/items/GridCardBlockInitializer.d.ts +1 -0
  411. package/lib/schema-initializer/items/GridCardBlockInitializer.js +55 -0
  412. package/lib/schema-initializer/items/ListBlockInitializer.d.ts +1 -0
  413. package/lib/schema-initializer/items/ListBlockInitializer.js +55 -0
  414. package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  415. package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
  416. package/lib/schema-initializer/items/index.d.ts +3 -0
  417. package/lib/schema-initializer/items/index.js +33 -0
  418. package/lib/schema-initializer/utils.d.ts +112 -0
  419. package/lib/schema-initializer/utils.js +227 -39
  420. package/lib/schema-items/GeneralSchemaItems.d.ts +4 -0
  421. package/lib/schema-items/GeneralSchemaItems.js +156 -0
  422. package/lib/schema-items/index.d.ts +1 -0
  423. package/lib/schema-items/index.js +11 -0
  424. package/lib/schema-settings/DataTemplates/FormDataTemplates.d.ts +1 -0
  425. package/lib/schema-settings/DataTemplates/FormDataTemplates.js +119 -41
  426. package/lib/schema-settings/DataTemplates/components/Designer.d.ts +7 -0
  427. package/lib/schema-settings/DataTemplates/components/Designer.js +188 -0
  428. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.d.ts +6 -1
  429. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +204 -95
  430. package/lib/schema-settings/GeneralSchemaDesigner.js +21 -15
  431. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  432. package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
  433. package/lib/schema-settings/LinkageRules/Variables.js +7 -4
  434. package/lib/schema-settings/SchemaSettings.d.ts +1 -1
  435. package/lib/schema-settings/SchemaSettings.js +53 -29
  436. package/lib/schema-settings/VariableInput/hooks/useUserVariable.js +1 -1
  437. package/lib/schema-settings/hooks/useIsShowMultipleSwitch.d.ts +4 -0
  438. package/lib/schema-settings/hooks/useIsShowMultipleSwitch.js +24 -0
  439. package/lib/user/CurrentUser.js +116 -8
  440. package/package.json +5 -6
  441. package/tsconfig.json +8 -0
@@ -15,6 +15,7 @@ var _collectionManager = require("../../../collection-manager");
15
15
  var _schemaSettings = require("../../../schema-settings");
16
16
  var _hooks = require("../../hooks");
17
17
  var _useOperators = require("../filter/useOperators");
18
+ var _FormItem = require("./FormItem");
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
20
  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); }
20
21
  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; } } }; }
@@ -377,11 +378,11 @@ var EditDefaultValue = function EditDefaultValue() {
377
378
  type: 'object',
378
379
  title: t('Set default value'),
379
380
  properties: {
380
- default: _objectSpread(_objectSpread({}, collectionField.uiSchema), {}, {
381
+ default: _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema), {}, {
381
382
  name: 'default',
382
383
  title: t('Default value'),
383
384
  'x-decorator': 'FormItem',
384
- default: fieldSchema.default || collectionField.defaultValue
385
+ default: fieldSchema.default || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue)
385
386
  })
386
387
  }
387
388
  },
@@ -401,64 +402,39 @@ var EditDefaultValue = function EditDefaultValue() {
401
402
  };
402
403
  exports.EditDefaultValue = EditDefaultValue;
403
404
  var EditComponent = function EditComponent() {
405
+ var _field$componentProps;
404
406
  var _useCollectionManager4 = (0, _collectionManager.useCollectionManager)(),
405
- getInterface = _useCollectionManager4.getInterface,
406
407
  getCollectionJoinField = _useCollectionManager4.getCollectionJoinField,
407
408
  getCollection = _useCollectionManager4.getCollection;
408
409
  var _useCollection4 = (0, _collectionManager.useCollection)(),
409
- getField = _useCollection4.getField,
410
- template = _useCollection4.template;
411
- var tk = (0, _blockProvider.useFilterByTk)();
412
- var _useFormBlockContext3 = (0, _blockProvider.useFormBlockContext)(),
413
- form = _useFormBlockContext3.form;
410
+ getField = _useCollection4.getField;
414
411
  var field = (0, _react.useField)();
415
412
  var fieldSchema = (0, _react.useFieldSchema)();
416
413
  var _useTranslation7 = (0, _reactI18next.useTranslation)(),
417
414
  t = _useTranslation7.t;
418
415
  var _useDesignable7 = (0, _hooks.useDesignable)(),
419
- dn = _useDesignable7.dn,
420
- insertAdjacent = _useDesignable7.insertAdjacent;
416
+ dn = _useDesignable7.dn;
421
417
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
422
- var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
423
- var fieldComponentOptions = (0, _hooks.useFieldComponentOptions)();
424
- var isSubFormAssociationField = field.address.segments.includes('__form_grid');
425
- return form && !isSubFormAssociationField && fieldComponentOptions ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
426
- title: t('Field component'),
427
- options: fieldComponentOptions,
428
- value: fieldSchema['x-component'],
429
- onChange: function onChange(type) {
430
- var _collectionField$uiSc4, _interfaceConfig$sche;
431
- var schema = {
432
- name: collectionField.name,
433
- type: 'void',
434
- required: fieldSchema['required'],
435
- description: fieldSchema['description'],
436
- default: fieldSchema['default'],
437
- 'x-decorator': 'FormItem',
438
- 'x-designer': 'FormItem.Designer',
439
- 'x-component': type,
440
- 'x-validator': fieldSchema['x-validator'],
441
- 'x-collection-field': fieldSchema['x-collection-field'],
442
- 'x-decorator-props': fieldSchema['x-decorator-props'],
443
- 'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['x-component-props']), fieldSchema['x-component-props'])
444
- };
445
- interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
446
- field: collectionField,
447
- block: 'Form',
448
- readPretty: field.readPretty,
449
- action: tk ? 'get' : null,
450
- targetCollection: getCollection(collectionField.target)
451
- });
452
- insertAdjacent('beforeBegin', divWrap(schema), {
453
- onSuccess: function onSuccess() {
454
- dn.remove(null, {
455
- removeParentsIfNoChildren: true,
456
- breakRemoveOn: {
457
- 'x-component': 'Grid'
458
- }
459
- });
460
- }
418
+ var fieldModeOptions = (0, _hooks.useFieldModeOptions)();
419
+ var isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.type);
420
+ var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
421
+ var isFileField = (0, _FormItem.isFileCollection)(targetCollection);
422
+ return isAssociationField && fieldModeOptions ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
423
+ key: "field-mode",
424
+ title: t('Field mode'),
425
+ options: fieldModeOptions,
426
+ value: (field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : _field$componentProps['mode']) || (isFileField ? 'FileManager' : 'Select'),
427
+ onChange: function onChange(mode) {
428
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
429
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
430
+ fieldSchema['x-component-props']['mode'] = mode;
431
+ schema['x-component-props'] = fieldSchema['x-component-props'];
432
+ field.componentProps = field.componentProps || {};
433
+ field.componentProps.mode = mode;
434
+ dn.emit('patch', {
435
+ schema: schema
461
436
  });
437
+ dn.refresh();
462
438
  }
463
439
  }) : null;
464
440
  };
@@ -468,8 +444,8 @@ var EditPattern = function EditPattern() {
468
444
  getCollectionJoinField = _useCollectionManager5.getCollectionJoinField;
469
445
  var _useCollection5 = (0, _collectionManager.useCollection)(),
470
446
  getField = _useCollection5.getField;
471
- var _useFormBlockContext4 = (0, _blockProvider.useFormBlockContext)(),
472
- form = _useFormBlockContext4.form;
447
+ var _useFormBlockContext3 = (0, _blockProvider.useFormBlockContext)(),
448
+ form = _useFormBlockContext3.form;
473
449
  var field = (0, _react.useField)();
474
450
  var fieldSchema = (0, _react.useFieldSchema)();
475
451
  var _useTranslation8 = (0, _reactI18next.useTranslation)(),
@@ -562,7 +538,8 @@ var EditOperator = function EditOperator() {
562
538
  dn = _useDesignable9.dn;
563
539
  var operatorList = (0, _useOperators.useOperatorList)();
564
540
  var _findFilterOperators2 = findFilterOperators(fieldSchema),
565
- storedOperators = _findFilterOperators2.operators,
541
+ _findFilterOperators3 = _findFilterOperators2.operators,
542
+ storedOperators = _findFilterOperators3 === void 0 ? {} : _findFilterOperators3,
566
543
  uid = _findFilterOperators2.uid;
567
544
  if (operatorList.length && !storedOperators[fieldSchema.name]) {
568
545
  storedOperators[fieldSchema.name] = operatorList[0].value;
@@ -573,9 +550,9 @@ var EditOperator = function EditOperator() {
573
550
  value: storedOperators[fieldSchema.name],
574
551
  options: compile(operatorList),
575
552
  onChange: function onChange(v) {
576
- var _schema5;
553
+ var _schema6;
577
554
  storedOperators[fieldSchema.name] = v;
578
- var schema = (_schema5 = {}, _defineProperty(_schema5, 'x-uid', uid), _defineProperty(_schema5, 'x-filter-operators', storedOperators), _schema5);
555
+ var schema = (_schema6 = {}, _defineProperty(_schema6, 'x-uid', uid), _defineProperty(_schema6, 'x-filter-operators', storedOperators), _schema6);
579
556
  dn.emit('patch', {
580
557
  schema: schema
581
558
  });
@@ -585,7 +562,7 @@ var EditOperator = function EditOperator() {
585
562
  };
586
563
  exports.EditOperator = EditOperator;
587
564
  var EditTitleField = function EditTitleField() {
588
- var _getCollectionFields, _field$componentProps, _field$componentProps2;
565
+ var _getCollectionFields, _field$componentProps2, _field$componentProps3;
589
566
  var _useCollectionManager6 = (0, _collectionManager.useCollectionManager)(),
590
567
  getCollectionFields = _useCollectionManager6.getCollectionFields,
591
568
  getCollectionJoinField = _useCollectionManager6.getCollectionJoinField;
@@ -599,7 +576,7 @@ var EditTitleField = function EditTitleField() {
599
576
  dn = _useDesignable10.dn;
600
577
  var compile = (0, _hooks.useCompile)();
601
578
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
602
- 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 : [];
579
+ 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 : [];
603
580
  var options = targetFields.filter(function (field) {
604
581
  return !(field === null || field === void 0 ? void 0 : field.target) && field.type !== 'boolean';
605
582
  }).map(function (field) {
@@ -613,16 +590,17 @@ var EditTitleField = function EditTitleField() {
613
590
  key: "title-field",
614
591
  title: t('Title field'),
615
592
  options: options,
616
- value: field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.fieldNames) === null || _field$componentProps2 === void 0 ? void 0 : _field$componentProps2.label,
593
+ value: field === null || field === void 0 ? void 0 : (_field$componentProps2 = field.componentProps) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.fieldNames) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.label,
617
594
  onChange: function onChange(label) {
618
- var _collectionField$uiSc5, _collectionField$uiSc6;
595
+ var _collectionField$uiSc4, _collectionField$uiSc5;
619
596
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
620
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
597
+ 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), {}, {
621
598
  label: label
622
599
  });
623
600
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
624
601
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
625
602
  schema['x-component-props'] = fieldSchema['x-component-props'];
603
+ field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
626
604
  dn.emit('patch', {
627
605
  schema: schema
628
606
  });
@@ -171,6 +171,7 @@ var DetailsDesigner = function DetailsDesigner() {
171
171
  field: {
172
172
  type: 'string',
173
173
  enum: sortFields,
174
+ required: true,
174
175
  'x-decorator': 'FormItem',
175
176
  'x-component': 'Select',
176
177
  '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;
@@ -40,6 +40,24 @@ var useDataTemplates = function useDataTemplates() {
40
40
  items = _findDataTemplates$it === void 0 ? [] : _findDataTemplates$it,
41
41
  _findDataTemplates$di = _findDataTemplates.display,
42
42
  display = _findDataTemplates$di === void 0 ? true : _findDataTemplates$di;
43
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
44
+ getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
45
+ // 过滤掉已经被删除的字段
46
+ items.forEach(function (item) {
47
+ try {
48
+ var _item$fields;
49
+ item.fields = (_item$fields = item.fields) === null || _item$fields === void 0 ? void 0 : _item$fields.map(function (field) {
50
+ var joinField = getCollectionJoinField("".concat(item.collection, ".").concat(field));
51
+ if (joinField) {
52
+ return field;
53
+ }
54
+ return '';
55
+ }).filter(Boolean);
56
+ } catch (err) {
57
+ (0, _client.error)(err);
58
+ item.fields = [];
59
+ }
60
+ });
43
61
  var templates = [{
44
62
  key: 'none',
45
63
  title: t('None')
@@ -55,7 +73,9 @@ var useDataTemplates = function useDataTemplates() {
55
73
  templates: templates,
56
74
  display: display,
57
75
  defaultTemplate: defaultTemplate,
58
- enabled: items.length > 0
76
+ enabled: items.length > 0 && items.every(function (item) {
77
+ return item.dataId !== undefined;
78
+ })
59
79
  };
60
80
  };
61
81
  var Templates = function Templates(_ref) {
@@ -67,8 +87,6 @@ var Templates = function Templates(_ref) {
67
87
  display = _useDataTemplates.display,
68
88
  enabled = _useDataTemplates.enabled,
69
89
  defaultTemplate = _useDataTemplates.defaultTemplate;
70
- var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
71
- getCollectionField = _useCollectionManager.getCollectionField;
72
90
  var _React$useState = _react2.default.useState((defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.key) || 'none'),
73
91
  _React$useState2 = _slicedToArray(_React$useState, 2),
74
92
  value = _React$useState2[0],
@@ -77,15 +95,16 @@ var Templates = function Templates(_ref) {
77
95
  var _useTranslation2 = (0, _reactI18next.useTranslation)(),
78
96
  t = _useTranslation2.t;
79
97
  (0, _react2.useEffect)(function () {
80
- if (defaultTemplate) {
81
- fetchTemplateData(api, defaultTemplate).then(function (data) {
82
- if (form) {
98
+ if (enabled && defaultTemplate) {
99
+ fetchTemplateData(api, defaultTemplate, t).then(function (data) {
100
+ if (form && data) {
83
101
  (0, _client.forEach)(data, function (value, key) {
84
102
  if (value) {
85
103
  form.values[key] = value;
86
104
  }
87
105
  });
88
106
  }
107
+ return data;
89
108
  }).catch(function (err) {
90
109
  console.error(err);
91
110
  });
@@ -98,14 +117,17 @@ var Templates = function Templates(_ref) {
98
117
  case 0:
99
118
  setValue(value);
100
119
  if (option.key !== 'none') {
101
- fetchTemplateData(api, option).then(function (data) {
102
- if (form) {
120
+ fetchTemplateData(api, option, t).then(function (data) {
121
+ if (form && data) {
103
122
  (0, _client.forEach)(data, function (value, key) {
104
123
  if (value) {
105
124
  form.values[key] = value;
106
125
  }
107
126
  });
108
127
  }
128
+ return data;
129
+ }).catch(function (err) {
130
+ console.error(err);
109
131
  });
110
132
  } else {
111
133
  form === null || form === void 0 ? void 0 : form.reset();
@@ -158,14 +180,20 @@ function findDataTemplates(fieldSchema) {
158
180
  }
159
181
  return {};
160
182
  }
161
- function fetchTemplateData(_x4, _x5) {
183
+ function fetchTemplateData(_x4, _x5, _x6) {
162
184
  return _fetchTemplateData.apply(this, arguments);
163
185
  }
164
186
  function _fetchTemplateData() {
165
- _fetchTemplateData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(api, template) {
187
+ _fetchTemplateData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(api, template, t) {
166
188
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
167
189
  while (1) switch (_context2.prev = _context2.next) {
168
190
  case 0:
191
+ if (!(template.fields.length === 0)) {
192
+ _context2.next = 2;
193
+ break;
194
+ }
195
+ return _context2.abrupt("return");
196
+ case 2:
169
197
  return _context2.abrupt("return", api.resource(template.collection).get({
170
198
  filterByTk: template.dataId,
171
199
  fields: template.fields,
@@ -174,7 +202,7 @@ function _fetchTemplateData() {
174
202
  var _data$data;
175
203
  return (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.data;
176
204
  }));
177
- case 1:
205
+ case 3:
178
206
  case "end":
179
207
  return _context2.stop();
180
208
  }
@@ -76,7 +76,9 @@ var linkageMergeAction = function linkageMergeAction(_ref, field, condition, val
76
76
  }
77
77
  }));
78
78
  valueResult.push(result);
79
- } catch (error) {}
79
+ } catch (error) {
80
+ console.log(error);
81
+ }
80
82
  } else if ((value === null || value === void 0 ? void 0 : value.mode) === 'constant') {
81
83
  valueResult.push((value === null || value === void 0 ? void 0 : value.value) || value);
82
84
  } else {
@@ -107,7 +107,7 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
107
107
  }
108
108
  }, task.name, ": ", (0, _otherHelper.getYmd)(task.start), " ~ ", (0, _otherHelper.getYmd)(task.end)), task.end.getTime() - task.start.getTime() !== 0 && /*#__PURE__*/_react.default.createElement("p", {
109
109
  className: (0, _css.cx)(_style.tooltipDefaultContainerParagraph)
110
- }, "Duration: ".concat(~~((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)), " day(s)")), /*#__PURE__*/_react.default.createElement("p", {
110
+ }, "Duration: ".concat(Math.round((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24) * 10) / 10, " day(s)")), /*#__PURE__*/_react.default.createElement("p", {
111
111
  className: (0, _css.cx)(_style.tooltipDefaultContainerParagraph)
112
112
  }, !!task.progress && "Progress: ".concat(task.progress, "%")));
113
113
  };
@@ -242,21 +242,25 @@ var wrapColSchema = function wrapColSchema(schema) {
242
242
  };
243
243
  var useRowProperties = function useRowProperties() {
244
244
  var fieldSchema = (0, _react.useFieldSchema)();
245
- return fieldSchema.reduceProperties(function (buf, s) {
246
- if (s['x-component'] === 'Grid.Row' && !s['x-hidden']) {
247
- buf.push(s);
248
- }
249
- return buf;
250
- }, []);
245
+ return (0, _react2.useMemo)(function () {
246
+ return fieldSchema.reduceProperties(function (buf, s) {
247
+ if (s['x-component'] === 'Grid.Row' && !s['x-hidden']) {
248
+ buf.push(s);
249
+ }
250
+ return buf;
251
+ }, []);
252
+ }, [Object.keys(fieldSchema.properties || {}).join(',')]);
251
253
  };
252
254
  var useColProperties = function useColProperties() {
253
255
  var fieldSchema = (0, _react.useFieldSchema)();
254
- return fieldSchema.reduceProperties(function (buf, s) {
255
- if (s['x-component'] === 'Grid.Col' && !s['x-hidden']) {
256
- buf.push(s);
257
- }
258
- return buf;
259
- }, []);
256
+ return (0, _react2.useMemo)(function () {
257
+ return fieldSchema.reduceProperties(function (buf, s) {
258
+ if (s['x-component'] === 'Grid.Col' && !s['x-hidden']) {
259
+ buf.push(s);
260
+ }
261
+ return buf;
262
+ }, []);
263
+ }, [Object.keys(fieldSchema.properties || {}).join(',')]);
260
264
  };
261
265
  var DndWrapper = function DndWrapper(props) {
262
266
  if (props.dndContext === false) {
@@ -277,7 +281,8 @@ var Grid = (0, _react.observer)(function (props) {
277
281
  var field = (0, _react.useField)();
278
282
  var fieldSchema = (0, _react.useFieldSchema)();
279
283
  var _useSchemaInitializer = (0, _.useSchemaInitializer)(fieldSchema['x-initializer']),
280
- render = _useSchemaInitializer.render;
284
+ render = _useSchemaInitializer.render,
285
+ InitializerComponent = _useSchemaInitializer.InitializerComponent;
281
286
  var addr = field.address.toString();
282
287
  var rows = useRowProperties();
283
288
  var _useFormBlockContext = (0, _.useFormBlockContext)(),
@@ -289,7 +294,8 @@ var Grid = (0, _react.observer)(function (props) {
289
294
  value: {
290
295
  ref: gridRef,
291
296
  fieldSchema: fieldSchema,
292
- renderSchemaInitializer: render
297
+ renderSchemaInitializer: render,
298
+ InitializerComponent: InitializerComponent
293
299
  }
294
300
  }, /*#__PURE__*/_react2.default.createElement("div", {
295
301
  className: 'nb-grid',
@@ -311,7 +317,7 @@ var Grid = (0, _react.observer)(function (props) {
311
317
  }
312
318
  }), rows.map(function (schema, index) {
313
319
  return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, {
314
- key: schema.name
320
+ key: index
315
321
  }, /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
316
322
  name: schema.name,
317
323
  schema: schema
@@ -326,7 +332,7 @@ var Grid = (0, _react.observer)(function (props) {
326
332
  schema: schema
327
333
  }
328
334
  }));
329
- })), render()));
335
+ })), /*#__PURE__*/_react2.default.createElement(InitializerComponent, null)));
330
336
  });
331
337
  exports.Grid = Grid;
332
338
  Grid.Row = (0, _react.observer)(function () {
@@ -353,7 +359,7 @@ Grid.Row = (0, _react.observer)(function () {
353
359
  }
354
360
  }), cols.map(function (schema, index) {
355
361
  return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, {
356
- key: schema.name
362
+ key: index
357
363
  }, /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
358
364
  name: schema.name,
359
365
  schema: schema
@@ -372,17 +378,21 @@ Grid.Row = (0, _react.observer)(function () {
372
378
  })));
373
379
  });
374
380
  Grid.Col = (0, _react.observer)(function (props) {
381
+ var _schema$xComponentP2;
375
382
  var _useContext = (0, _react2.useContext)(GridRowContext),
376
383
  _useContext$cols = _useContext.cols,
377
384
  cols = _useContext$cols === void 0 ? [] : _useContext$cols;
378
385
  var schema = (0, _react.useFieldSchema)();
379
386
  var field = (0, _react.useField)();
380
- var width = '';
381
- if (cols === null || cols === void 0 ? void 0 : cols.length) {
382
- var _schema$xComponentP;
383
- var w = (schema === null || schema === void 0 ? void 0 : (_schema$xComponentP = schema['x-component-props']) === null || _schema$xComponentP === void 0 ? void 0 : _schema$xComponentP['width']) || 100 / cols.length;
384
- width = "calc(".concat(w, "% - var(--nb-spacing) * ").concat((cols.length + 1) / cols.length, ")");
385
- }
387
+ var width = (0, _react2.useMemo)(function () {
388
+ var width = '';
389
+ if (cols === null || cols === void 0 ? void 0 : cols.length) {
390
+ var _schema$xComponentP;
391
+ var w = (schema === null || schema === void 0 ? void 0 : (_schema$xComponentP = schema['x-component-props']) === null || _schema$xComponentP === void 0 ? void 0 : _schema$xComponentP['width']) || 100 / cols.length;
392
+ width = "calc(".concat(w, "% - var(--nb-spacing) * ").concat((cols.length + 1) / cols.length, ")");
393
+ }
394
+ return width;
395
+ }, [cols === null || cols === void 0 ? void 0 : cols.length, schema === null || schema === void 0 ? void 0 : (_schema$xComponentP2 = schema['x-component-props']) === null || _schema$xComponentP2 === void 0 ? void 0 : _schema$xComponentP2['width']]);
386
396
  var _useDroppable3 = (0, _core.useDroppable)({
387
397
  id: field.address.toString(),
388
398
  data: {
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const GridCardBlockContext: React.Context<any>;
3
+ export declare const GridCardBlockProvider: (props: any) => JSX.Element;
4
+ export declare const useGridCardBlockContext: () => any;
5
+ export declare const useGridCardItemProps: () => {};
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useGridCardItemProps = exports.useGridCardBlockContext = exports.GridCardBlockProvider = exports.GridCardBlockContext = void 0;
8
+ var _core = require("@formily/core");
9
+ var _react = require("@formily/react");
10
+ var _react2 = _interopRequireWildcard(require("react"));
11
+ var _blockProvider = require("../../../block-provider");
12
+ var _antd = require("@formily/antd");
13
+ var _css = require("@emotion/css");
14
+ var _hooks = require("../../../block-provider/hooks");
15
+ var _templateObject;
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
+ 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; }
19
+ 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; }
20
+ 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; }
21
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
22
+ 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); }
23
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
24
+ var GridCardBlockContext = /*#__PURE__*/(0, _react2.createContext)({});
25
+ exports.GridCardBlockContext = GridCardBlockContext;
26
+ var InternalGridCardBlockProvider = function InternalGridCardBlockProvider(props) {
27
+ var _service$data2;
28
+ var _useBlockRequestConte = (0, _blockProvider.useBlockRequestContext)(),
29
+ resource = _useBlockRequestConte.resource,
30
+ service = _useBlockRequestConte.service;
31
+ var field = (0, _react.useField)();
32
+ var form = (0, _react2.useMemo)(function () {
33
+ return (0, _core.createForm)({
34
+ readPretty: true
35
+ });
36
+ }, []);
37
+ (0, _react2.useEffect)(function () {
38
+ if (!(service === null || service === void 0 ? void 0 : service.loading)) {
39
+ var _service$data;
40
+ form.setValuesIn(field.address.concat('list').toString(), service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.data);
41
+ }
42
+ }, [service === null || service === void 0 ? void 0 : (_service$data2 = service.data) === null || _service$data2 === void 0 ? void 0 : _service$data2.data, service === null || service === void 0 ? void 0 : service.loading]);
43
+ return /*#__PURE__*/_react2.default.createElement(GridCardBlockContext.Provider, {
44
+ value: {
45
+ service: service,
46
+ resource: resource,
47
+ columnCount: props.columnCount
48
+ }
49
+ }, /*#__PURE__*/_react2.default.createElement(_react.FormContext.Provider, {
50
+ value: form
51
+ }, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
52
+ layout: 'vertical'
53
+ }, /*#__PURE__*/_react2.default.createElement("div", {
54
+ className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & > .nb-block-item {\n margin-bottom: var(--nb-spacing);\n & > .nb-action-bar:has(:first-child:not(:empty)) {\n padding: var(--nb-spacing);\n background: #fff;\n }\n .ant-list-pagination {\n padding: var(--nb-spacing);\n background: #fff;\n }\n }\n "])))
55
+ }, props.children))));
56
+ };
57
+ var GridCardBlockProvider = function GridCardBlockProvider(props) {
58
+ var params = _objectSpread({}, props.params);
59
+ var collection = props.collection;
60
+ var _useAssociationNames = (0, _hooks.useAssociationNames)(collection),
61
+ appends = _useAssociationNames.appends;
62
+ if (!Object.keys(params).includes('appends')) {
63
+ params['appends'] = appends;
64
+ }
65
+ return /*#__PURE__*/_react2.default.createElement(_blockProvider.BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
66
+ params: params
67
+ }), /*#__PURE__*/_react2.default.createElement(InternalGridCardBlockProvider, _objectSpread({}, props)));
68
+ };
69
+ exports.GridCardBlockProvider = GridCardBlockProvider;
70
+ var useGridCardBlockContext = function useGridCardBlockContext() {
71
+ return (0, _react2.useContext)(GridCardBlockContext);
72
+ };
73
+ exports.useGridCardBlockContext = useGridCardBlockContext;
74
+ var useGridCardItemProps = function useGridCardItemProps() {
75
+ return {};
76
+ };
77
+ exports.useGridCardItemProps = useGridCardItemProps;
@@ -0,0 +1 @@
1
+ export declare const GridCardDesigner: () => JSX.Element;