@nocobase/client 0.9.2-alpha.1 → 0.9.2-alpha.3

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 (315) hide show
  1. package/es/acl/Configuration/FilterDynamicComponent.d.ts +2 -0
  2. package/es/{schema-component/antd/table-v2/hooks/useUserVariable.js → acl/Configuration/FilterDynamicComponent.js} +32 -4
  3. package/es/acl/Configuration/schemas/scopes.js +3 -0
  4. package/es/application/Application.d.ts +1 -0
  5. package/es/application/Application.js +12 -2
  6. package/es/block-provider/FormFieldProvider.js +9 -1
  7. package/es/block-provider/TableSelectorProvider.js +3 -2
  8. package/es/block-provider/hooks/index.js +18 -13
  9. package/es/board/CardAdder.js +1 -1
  10. package/es/board/ColumnForm.js +4 -4
  11. package/es/board/DefaultColumnHeader.d.ts +1 -1
  12. package/es/board/DefaultColumnHeader.js +6 -6
  13. package/es/collection-manager/CollectionField.js +16 -13
  14. package/es/collection-manager/CollectionManagerProvider.js +10 -2
  15. package/es/collection-manager/Configuration/AddCollectionAction.js +1 -1
  16. package/es/collection-manager/Configuration/CollectionFields.d.ts +2 -0
  17. package/es/collection-manager/Configuration/CollectionFields.js +458 -0
  18. package/es/collection-manager/Configuration/CollectionFieldsTableArray.js +3 -3
  19. package/es/collection-manager/Configuration/ConfigurationTable.js +4 -2
  20. package/es/collection-manager/Configuration/ConfigurationTabs.js +6 -2
  21. package/es/collection-manager/Configuration/EditCollectionAction.js +4 -4
  22. package/es/collection-manager/Configuration/EditFieldAction.js +1 -1
  23. package/es/collection-manager/Configuration/OverridingCollectionField.js +1 -1
  24. package/es/collection-manager/Configuration/schemas/collectionFields.d.ts +2 -0
  25. package/es/collection-manager/Configuration/schemas/collectionFields.js +1 -1
  26. package/es/collection-manager/Configuration/schemas/collections.js +8 -5
  27. package/es/collection-manager/action-hooks.d.ts +2 -1
  28. package/es/collection-manager/action-hooks.js +10 -7
  29. package/es/collection-manager/hooks/useCollectionDataSource.js +2 -2
  30. package/es/collection-manager/hooks/useCollectionManager.d.ts +1 -0
  31. package/es/collection-manager/hooks/useCollectionManager.js +2 -0
  32. package/es/collection-manager/interfaces/checkbox.js +7 -0
  33. package/es/collection-manager/interfaces/checkboxGroup.js +7 -0
  34. package/es/collection-manager/interfaces/components/index.js +1 -1
  35. package/es/collection-manager/interfaces/createdBy.js +5 -1
  36. package/es/collection-manager/interfaces/email.js +7 -0
  37. package/es/collection-manager/interfaces/linkTo.js +6 -0
  38. package/es/collection-manager/interfaces/m2m.js +6 -0
  39. package/es/collection-manager/interfaces/m2o.js +6 -0
  40. package/es/collection-manager/interfaces/multipleSelect.js +10 -0
  41. package/es/collection-manager/interfaces/o2m.js +8 -1
  42. package/es/collection-manager/interfaces/o2o.js +6 -0
  43. package/es/collection-manager/interfaces/percent.js +10 -0
  44. package/es/collection-manager/interfaces/select.js +10 -0
  45. package/es/collection-manager/interfaces/updatedBy.js +5 -1
  46. package/es/collection-manager/types.d.ts +1 -0
  47. package/es/filter-provider/utils.d.ts +8 -3
  48. package/es/filter-provider/utils.js +42 -27
  49. package/es/locale/en_US.d.ts +7 -0
  50. package/es/locale/en_US.js +8 -1
  51. package/es/locale/ja_JP.d.ts +15 -0
  52. package/es/locale/ja_JP.js +17 -2
  53. package/es/locale/pt_BR.d.ts +16 -0
  54. package/es/locale/pt_BR.js +18 -2
  55. package/es/locale/ru_RU.d.ts +15 -0
  56. package/es/locale/ru_RU.js +17 -2
  57. package/es/locale/tr_TR.d.ts +16 -1
  58. package/es/locale/tr_TR.js +18 -3
  59. package/es/locale/zh_CN.d.ts +16 -0
  60. package/es/locale/zh_CN.js +17 -1
  61. package/es/pm/PluginManagerLink.js +5 -3
  62. package/es/pm/index.js +1 -1
  63. package/es/schema-component/antd/action/Action.js +1 -1
  64. package/es/schema-component/antd/association-select/AssociationSelect.js +56 -35
  65. package/es/schema-component/antd/association-select/useServiceOptions.js +3 -2
  66. package/es/schema-component/antd/checkbox/Checkbox.js +4 -3
  67. package/es/schema-component/antd/collection-select/CollectionSelect.d.ts +2 -2
  68. package/es/schema-component/antd/collection-select/CollectionSelect.js +6 -6
  69. package/es/schema-component/antd/error-fallback/ErrorFallback.d.ts +3 -0
  70. package/es/schema-component/antd/error-fallback/ErrorFallback.js +47 -0
  71. package/es/schema-component/antd/error-fallback/index.d.ts +1 -0
  72. package/es/schema-component/antd/error-fallback/index.js +1 -0
  73. package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -0
  74. package/es/schema-component/antd/filter/useFilterActionProps.js +127 -7
  75. package/es/schema-component/antd/filter/useValues.js +7 -8
  76. package/es/schema-component/antd/form-item/FormItem.d.ts +3 -0
  77. package/es/schema-component/antd/form-item/FormItem.js +81 -16
  78. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +2 -3
  79. package/es/schema-component/antd/form-v2/Templates.js +24 -18
  80. package/es/schema-component/antd/gantt/components/calendar/top-part-of-calendar.d.ts +1 -1
  81. package/es/schema-component/antd/gantt/components/calendar/top-part-of-calendar.js +3 -3
  82. package/es/schema-component/antd/gantt/components/gantt/style.js +1 -1
  83. package/es/schema-component/antd/gantt/components/grid/grid.d.ts +2 -2
  84. package/es/schema-component/antd/gantt/components/grid/grid.js +2 -2
  85. package/es/schema-component/antd/gantt/components/grid/style.js +1 -1
  86. package/es/schema-component/antd/gantt/components/other/arrow.d.ts +2 -2
  87. package/es/schema-component/antd/gantt/components/other/arrow.js +3 -3
  88. package/es/schema-component/antd/gantt/components/other/horizontal-scroll.d.ts +1 -1
  89. package/es/schema-component/antd/gantt/components/other/horizontal-scroll.js +1 -1
  90. package/es/schema-component/antd/gantt/components/other/style.js +1 -1
  91. package/es/schema-component/antd/gantt/components/task-item/bar/bar-display.d.ts +1 -1
  92. package/es/schema-component/antd/gantt/components/task-item/bar/bar-display.js +1 -1
  93. package/es/schema-component/antd/gantt/components/task-item/bar/bar-small.d.ts +2 -2
  94. package/es/schema-component/antd/gantt/components/task-item/bar/bar-small.js +6 -6
  95. package/es/schema-component/antd/gantt/components/task-item/bar/bar.d.ts +2 -2
  96. package/es/schema-component/antd/gantt/components/task-item/bar/bar.js +9 -9
  97. package/es/schema-component/antd/gantt/components/task-item/bar/style.js +2 -2
  98. package/es/schema-component/antd/gantt/components/task-item/milestone/milestone.d.ts +2 -2
  99. package/es/schema-component/antd/gantt/components/task-item/milestone/milestone.js +2 -2
  100. package/es/schema-component/antd/gantt/types/bar-task.d.ts +2 -2
  101. package/es/schema-component/antd/gantt/types/date-setup.d.ts +1 -1
  102. package/es/schema-component/antd/gantt/types/gantt-task-actions.d.ts +3 -3
  103. package/es/schema-component/antd/gantt/types/public-types.d.ts +1 -1
  104. package/es/schema-component/antd/grid/Grid.js +23 -9
  105. package/es/schema-component/antd/icon-picker/IconPicker.js +1 -1
  106. package/es/schema-component/antd/input/EllipsisWithTooltip.js +21 -2
  107. package/es/schema-component/antd/menu/util.js +0 -1
  108. package/es/schema-component/antd/page/Page.js +10 -2
  109. package/es/schema-component/antd/pagination/index.js +8 -1
  110. package/es/schema-component/antd/record-picker/InputRecordPicker.js +3 -4
  111. package/es/schema-component/antd/record-picker/useFieldNames.js +1 -1
  112. package/es/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  113. package/es/schema-component/antd/remote-select/RemoteSelect.js +75 -13
  114. package/es/schema-component/antd/select/ReadPretty.js +5 -2
  115. package/es/schema-component/antd/select/Select.js +3 -9
  116. package/es/schema-component/antd/table/Table.Array.js +2 -2
  117. package/es/schema-component/antd/table-v2/FilterDynamicComponent.js +2 -138
  118. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +6 -5
  119. package/es/schema-component/antd/table-v2/Table.js +2 -2
  120. package/es/schema-component/antd/upload/ReadPretty.js +2 -1
  121. package/es/schema-component/antd/variable/Input.js +11 -5
  122. package/es/schema-component/antd/variable/JSONInput.js +4 -4
  123. package/es/schema-component/antd/variable/TextArea.js +1 -1
  124. package/es/schema-component/antd/variable/Variable.js +3 -3
  125. package/es/schema-component/antd/variable/VariableSelect.js +8 -8
  126. package/es/schema-component/antd/variable/XButton.d.ts +1 -1
  127. package/es/schema-component/antd/variable/XButton.js +4 -4
  128. package/es/schema-component/common/utils/uitls.d.ts +9 -0
  129. package/es/schema-component/common/utils/uitls.js +37 -3
  130. package/es/schema-component/core/DesignableSwitch.js +5 -3
  131. package/es/schema-component/hooks/useComponent.js +2 -2
  132. package/es/schema-component/hooks/useDesignable.js +2 -2
  133. package/es/schema-component/hooks/useFieldTitle.js +4 -4
  134. package/es/schema-initializer/SchemaInitializer.js +2 -2
  135. package/es/schema-initializer/buttons/BulkEditFormItemInitializers.js +14 -7
  136. package/es/schema-initializer/items/DestroyActionInitializer.js +2 -2
  137. package/es/schema-initializer/items/FilterActionInitializer.js +2 -2
  138. package/es/schema-initializer/items/FormBlockInitializer.js +3 -3
  139. package/es/schema-initializer/items/G2PlotInitializer.js +1 -1
  140. package/es/schema-initializer/items/KanbanBlockInitializer.js +9 -9
  141. package/es/schema-initializer/items/MarkdownBlockInitializer.js +3 -3
  142. package/es/schema-initializer/items/PrintActionInitializer.js +2 -2
  143. package/es/schema-initializer/items/RecordAssociationBlockInitializer.js +5 -5
  144. package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +9 -9
  145. package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +5 -5
  146. package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.js +4 -4
  147. package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +5 -5
  148. package/es/schema-initializer/items/RefreshActionInitializer.js +2 -2
  149. package/es/schema-initializer/items/SubmitActionInitializer.js +2 -2
  150. package/es/schema-initializer/items/TableActionColumnInitializer.js +2 -2
  151. package/es/schema-initializer/items/TableCollectionFieldInitializer.js +2 -2
  152. package/es/schema-initializer/items/TableSelectorInitializer.js +5 -5
  153. package/es/schema-initializer/items/UpdateActionInitializer.js +2 -2
  154. package/es/schema-initializer/items/UpdateSubmitActionInitializer.js +2 -2
  155. package/es/schema-initializer/items/ViewActionInitializer.js +2 -2
  156. package/es/schema-initializer/utils.js +17 -10
  157. package/es/schema-settings/DataTemplates/FormDataTemplates.js +28 -12
  158. package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -1
  159. package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +9 -2
  160. package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +2 -1
  161. package/es/schema-settings/SchemaSettings.d.ts +4 -1
  162. package/es/schema-settings/SchemaSettings.js +32 -19
  163. package/es/schema-settings/VariableInput/VariableInput.d.ts +13 -0
  164. package/es/schema-settings/VariableInput/VariableInput.js +37 -0
  165. package/es/schema-settings/VariableInput/hooks/useDateVariable.d.ts +4 -0
  166. package/es/schema-settings/VariableInput/hooks/useDateVariable.js +129 -0
  167. package/es/schema-settings/VariableInput/hooks/useUserVariable.d.ts +5 -0
  168. package/es/schema-settings/VariableInput/hooks/useUserVariable.js +68 -0
  169. package/es/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +1 -0
  170. package/es/schema-settings/VariableInput/hooks/useVariableOptions.js +18 -0
  171. package/es/user/VerificationCode.js +7 -8
  172. package/lib/acl/Configuration/FilterDynamicComponent.d.ts +2 -0
  173. package/lib/{schema-component/antd/table-v2/hooks/useUserVariable.js → acl/Configuration/FilterDynamicComponent.js} +32 -4
  174. package/lib/acl/Configuration/schemas/scopes.js +3 -0
  175. package/lib/application/Application.d.ts +1 -0
  176. package/lib/application/Application.js +12 -2
  177. package/lib/block-provider/FormFieldProvider.js +9 -1
  178. package/lib/block-provider/TableSelectorProvider.js +3 -2
  179. package/lib/block-provider/hooks/index.js +17 -12
  180. package/lib/board/CardAdder.js +1 -1
  181. package/lib/board/ColumnForm.js +4 -4
  182. package/lib/board/DefaultColumnHeader.d.ts +1 -1
  183. package/lib/board/DefaultColumnHeader.js +6 -6
  184. package/lib/collection-manager/CollectionField.js +16 -13
  185. package/lib/collection-manager/CollectionManagerProvider.js +10 -2
  186. package/lib/collection-manager/Configuration/AddCollectionAction.js +1 -1
  187. package/lib/collection-manager/Configuration/CollectionFields.d.ts +2 -0
  188. package/lib/collection-manager/Configuration/CollectionFields.js +468 -0
  189. package/lib/collection-manager/Configuration/CollectionFieldsTableArray.js +3 -3
  190. package/lib/collection-manager/Configuration/ConfigurationTable.js +4 -2
  191. package/lib/collection-manager/Configuration/ConfigurationTabs.js +5 -1
  192. package/lib/collection-manager/Configuration/EditCollectionAction.js +4 -4
  193. package/lib/collection-manager/Configuration/EditFieldAction.js +1 -1
  194. package/lib/collection-manager/Configuration/OverridingCollectionField.js +1 -1
  195. package/lib/collection-manager/Configuration/schemas/collectionFields.d.ts +2 -0
  196. package/lib/collection-manager/Configuration/schemas/collectionFields.js +2 -1
  197. package/lib/collection-manager/Configuration/schemas/collections.js +8 -5
  198. package/lib/collection-manager/action-hooks.d.ts +2 -1
  199. package/lib/collection-manager/action-hooks.js +13 -9
  200. package/lib/collection-manager/hooks/useCollectionManager.d.ts +1 -0
  201. package/lib/collection-manager/hooks/useCollectionManager.js +2 -0
  202. package/lib/collection-manager/interfaces/checkbox.js +7 -0
  203. package/lib/collection-manager/interfaces/checkboxGroup.js +7 -0
  204. package/lib/collection-manager/interfaces/components/index.js +1 -1
  205. package/lib/collection-manager/interfaces/createdBy.js +5 -1
  206. package/lib/collection-manager/interfaces/email.js +7 -0
  207. package/lib/collection-manager/interfaces/linkTo.js +6 -0
  208. package/lib/collection-manager/interfaces/m2m.js +6 -0
  209. package/lib/collection-manager/interfaces/m2o.js +6 -0
  210. package/lib/collection-manager/interfaces/multipleSelect.js +10 -0
  211. package/lib/collection-manager/interfaces/o2m.js +8 -1
  212. package/lib/collection-manager/interfaces/o2o.js +6 -0
  213. package/lib/collection-manager/interfaces/percent.js +10 -0
  214. package/lib/collection-manager/interfaces/select.js +10 -0
  215. package/lib/collection-manager/interfaces/updatedBy.js +5 -1
  216. package/lib/collection-manager/types.d.ts +1 -0
  217. package/lib/filter-provider/utils.d.ts +8 -3
  218. package/lib/filter-provider/utils.js +44 -28
  219. package/lib/locale/en_US.d.ts +7 -0
  220. package/lib/locale/en_US.js +8 -1
  221. package/lib/locale/ja_JP.d.ts +15 -0
  222. package/lib/locale/ja_JP.js +17 -2
  223. package/lib/locale/pt_BR.d.ts +16 -0
  224. package/lib/locale/pt_BR.js +18 -2
  225. package/lib/locale/ru_RU.d.ts +15 -0
  226. package/lib/locale/ru_RU.js +17 -2
  227. package/lib/locale/tr_TR.d.ts +16 -1
  228. package/lib/locale/tr_TR.js +18 -3
  229. package/lib/locale/zh_CN.d.ts +16 -0
  230. package/lib/locale/zh_CN.js +17 -1
  231. package/lib/pm/PluginManagerLink.js +4 -2
  232. package/lib/pm/index.js +1 -1
  233. package/lib/schema-component/antd/action/Action.js +1 -1
  234. package/lib/schema-component/antd/association-select/AssociationSelect.js +55 -34
  235. package/lib/schema-component/antd/association-select/useServiceOptions.js +3 -2
  236. package/lib/schema-component/antd/checkbox/Checkbox.js +4 -3
  237. package/lib/schema-component/antd/collection-select/CollectionSelect.d.ts +2 -2
  238. package/lib/schema-component/antd/error-fallback/ErrorFallback.d.ts +3 -0
  239. package/lib/schema-component/antd/error-fallback/ErrorFallback.js +55 -0
  240. package/lib/schema-component/antd/error-fallback/index.d.ts +1 -0
  241. package/lib/schema-component/antd/error-fallback/index.js +16 -0
  242. package/lib/schema-component/antd/filter/useFilterActionProps.d.ts +2 -0
  243. package/lib/schema-component/antd/filter/useFilterActionProps.js +130 -8
  244. package/lib/schema-component/antd/filter/useValues.js +6 -7
  245. package/lib/schema-component/antd/form-item/FormItem.d.ts +3 -0
  246. package/lib/schema-component/antd/form-item/FormItem.js +81 -15
  247. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +1 -2
  248. package/lib/schema-component/antd/form-v2/Templates.js +24 -18
  249. package/lib/schema-component/antd/gantt/components/calendar/top-part-of-calendar.d.ts +1 -1
  250. package/lib/schema-component/antd/gantt/components/calendar/top-part-of-calendar.js +2 -2
  251. package/lib/schema-component/antd/gantt/components/gantt/style.js +1 -1
  252. package/lib/schema-component/antd/gantt/components/grid/grid.d.ts +2 -2
  253. package/lib/schema-component/antd/gantt/components/grid/style.js +1 -1
  254. package/lib/schema-component/antd/gantt/components/other/arrow.d.ts +2 -2
  255. package/lib/schema-component/antd/gantt/components/other/arrow.js +2 -2
  256. package/lib/schema-component/antd/gantt/components/other/horizontal-scroll.d.ts +1 -1
  257. package/lib/schema-component/antd/gantt/components/other/style.js +1 -1
  258. package/lib/schema-component/antd/gantt/components/task-item/bar/bar-display.d.ts +1 -1
  259. package/lib/schema-component/antd/gantt/components/task-item/bar/bar-small.d.ts +2 -2
  260. package/lib/schema-component/antd/gantt/components/task-item/bar/bar-small.js +2 -2
  261. package/lib/schema-component/antd/gantt/components/task-item/bar/bar.d.ts +2 -2
  262. package/lib/schema-component/antd/gantt/components/task-item/bar/bar.js +4 -4
  263. package/lib/schema-component/antd/gantt/components/task-item/bar/style.js +2 -2
  264. package/lib/schema-component/antd/gantt/components/task-item/milestone/milestone.d.ts +2 -2
  265. package/lib/schema-component/antd/gantt/components/task-item/milestone/milestone.js +1 -1
  266. package/lib/schema-component/antd/gantt/types/bar-task.d.ts +2 -2
  267. package/lib/schema-component/antd/gantt/types/date-setup.d.ts +1 -1
  268. package/lib/schema-component/antd/gantt/types/gantt-task-actions.d.ts +3 -3
  269. package/lib/schema-component/antd/gantt/types/public-types.d.ts +1 -1
  270. package/lib/schema-component/antd/grid/Grid.js +23 -9
  271. package/lib/schema-component/antd/input/EllipsisWithTooltip.js +20 -1
  272. package/lib/schema-component/antd/menu/util.js +0 -1
  273. package/lib/schema-component/antd/page/Page.js +9 -1
  274. package/lib/schema-component/antd/pagination/index.js +8 -1
  275. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +3 -4
  276. package/lib/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  277. package/lib/schema-component/antd/remote-select/RemoteSelect.js +75 -12
  278. package/lib/schema-component/antd/select/ReadPretty.js +5 -2
  279. package/lib/schema-component/antd/select/Select.js +3 -9
  280. package/lib/schema-component/antd/table-v2/FilterDynamicComponent.js +3 -139
  281. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +6 -5
  282. package/lib/schema-component/antd/table-v2/Table.js +2 -2
  283. package/lib/schema-component/antd/upload/ReadPretty.js +2 -1
  284. package/lib/schema-component/antd/variable/Input.js +10 -4
  285. package/lib/schema-component/antd/variable/JSONInput.js +2 -2
  286. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  287. package/lib/schema-component/antd/variable/VariableSelect.js +4 -4
  288. package/lib/schema-component/antd/variable/XButton.d.ts +1 -1
  289. package/lib/schema-component/antd/variable/XButton.js +1 -1
  290. package/lib/schema-component/common/utils/uitls.d.ts +9 -0
  291. package/lib/schema-component/common/utils/uitls.js +43 -4
  292. package/lib/schema-component/core/DesignableSwitch.js +4 -2
  293. package/lib/schema-component/hooks/useComponent.js +2 -2
  294. package/lib/schema-component/hooks/useDesignable.js +2 -2
  295. package/lib/schema-initializer/SchemaInitializer.js +2 -2
  296. package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.js +14 -7
  297. package/lib/schema-initializer/utils.js +17 -10
  298. package/lib/schema-settings/DataTemplates/FormDataTemplates.js +28 -12
  299. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -1
  300. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +9 -2
  301. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +2 -1
  302. package/lib/schema-settings/SchemaSettings.d.ts +4 -1
  303. package/lib/schema-settings/SchemaSettings.js +37 -21
  304. package/lib/schema-settings/VariableInput/VariableInput.d.ts +13 -0
  305. package/lib/schema-settings/VariableInput/VariableInput.js +47 -0
  306. package/lib/schema-settings/VariableInput/hooks/useDateVariable.d.ts +4 -0
  307. package/lib/schema-settings/VariableInput/hooks/useDateVariable.js +136 -0
  308. package/lib/schema-settings/VariableInput/hooks/useUserVariable.d.ts +5 -0
  309. package/lib/schema-settings/VariableInput/hooks/useUserVariable.js +75 -0
  310. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.d.ts +1 -0
  311. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +25 -0
  312. package/lib/user/VerificationCode.js +1 -2
  313. package/package.json +6 -5
  314. package/es/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +0 -10
  315. package/lib/schema-component/antd/table-v2/hooks/useUserVariable.d.ts +0 -10
@@ -41,14 +41,13 @@ import _, { cloneDeep } from 'lodash';
41
41
  import React, { createContext, useCallback, useContext, useMemo, useState } from 'react';
42
42
  import { createPortal } from 'react-dom';
43
43
  import { useTranslation } from 'react-i18next';
44
- import { APIClientProvider, ActionContext, CollectionManagerContext, FormProvider, RemoteSchemaComponent, SchemaComponent, SchemaComponentOptions, createDesignable, findFormBlock, useAPIClient, useCollection, useLinkageCollectionFilterOptions, useCollectionManager, useCompile, useDesignable } from '..';
44
+ import { APIClientProvider, ActionContext, CollectionManagerContext, FormProvider, RemoteSchemaComponent, SchemaComponent, SchemaComponentOptions, createDesignable, findFormBlock, useAPIClient, useCollection, useCollectionManager, useCompile, useDesignable, useLinkageCollectionFilterOptions } from '..';
45
45
  import { findFilterTargets, updateFilterTargets } from '../block-provider/hooks';
46
46
  import { isSameCollection, useSupportedBlocks } from '../filter-provider/utils';
47
47
  import { getTargetKey } from '../schema-component/antd/association-filter/utilts';
48
48
  import { useSchemaTemplateManager } from '../schema-templates';
49
49
  import { useBlockTemplateContext } from '../schema-templates/BlockTemplate';
50
50
  import { FormDataTemplates } from './DataTemplates';
51
- import { EnableChildCollections } from './EnableChildCollections';
52
51
  import { FormLinkageRules } from './LinkageRules';
53
52
  import { useLinkageCollectionFieldOptions } from './LinkageRules/action-hooks';
54
53
  var SchemaSettingsContext = /*#__PURE__*/createContext(null);
@@ -97,7 +96,7 @@ export var SchemaSettings = function SchemaSettings(props) {
97
96
  }
98
97
  return DropdownMenu;
99
98
  };
100
- SchemaSettings.Template = function (props) {
99
+ SchemaSettings.Template = function Template(props) {
101
100
  var componentName = props.componentName,
102
101
  collectionName = props.collectionName,
103
102
  resourceName = props.resourceName;
@@ -269,7 +268,7 @@ var findBlockTemplateSchema = function findBlockTemplateSchema(fieldSchema) {
269
268
  return buf;
270
269
  }, null);
271
270
  };
272
- SchemaSettings.FormItemTemplate = function (props) {
271
+ SchemaSettings.FormItemTemplate = function FormItemTemplate(props) {
273
272
  var _props$insertAdjacent = props.insertAdjacentPosition,
274
273
  insertAdjacentPosition = _props$insertAdjacent === void 0 ? 'afterBegin' : _props$insertAdjacent,
275
274
  componentName = props.componentName,
@@ -444,7 +443,7 @@ SchemaSettings.FormItemTemplate = function (props) {
444
443
  }()
445
444
  }, t('Save as block template'));
446
445
  };
447
- SchemaSettings.Item = function (props) {
446
+ SchemaSettings.Item = function Item(props) {
448
447
  var eventKey = props.eventKey;
449
448
  var key = useMemo(function () {
450
449
  return uid();
@@ -473,7 +472,7 @@ SchemaSettings.SubMenu = function (props) {
473
472
  SchemaSettings.Divider = function (props) {
474
473
  return /*#__PURE__*/React.createElement(Menu.Divider, _objectSpread({}, props));
475
474
  };
476
- SchemaSettings.Remove = function (props) {
475
+ SchemaSettings.Remove = function Remove(props) {
477
476
  var confirm = props.confirm,
478
477
  removeParentsIfNoChildren = props.removeParentsIfNoChildren,
479
478
  breakRemoveOn = props.breakRemoveOn;
@@ -513,7 +512,7 @@ SchemaSettings.Remove = function (props) {
513
512
  }
514
513
  }, t('Delete'));
515
514
  };
516
- SchemaSettings.ConnectDataBlocks = function (props) {
515
+ SchemaSettings.ConnectDataBlocks = function ConnectDataBlocks(props) {
517
516
  var type = props.type,
518
517
  emptyDescription = props.emptyDescription;
519
518
  var fieldSchema = useFieldSchema();
@@ -638,7 +637,7 @@ SchemaSettings.ConnectDataBlocks = function (props) {
638
637
  image: Empty.PRESENTED_IMAGE_SIMPLE
639
638
  }));
640
639
  };
641
- SchemaSettings.SelectItem = function (props) {
640
+ SchemaSettings.SelectItem = function SelectItem(props) {
642
641
  var title = props.title,
643
642
  options = props.options,
644
643
  value = props.value,
@@ -657,11 +656,12 @@ SchemaSettings.SelectItem = function (props) {
657
656
  }
658
657
  _onClick === null || _onClick === void 0 ? void 0 : _onClick.apply(void 0, args);
659
658
  };
659
+ var onMouseEnter = useCallback(function () {
660
+ return setOpen(true);
661
+ }, []);
660
662
  // 鼠标 hover 时,打开下拉框
661
663
  var moreProps = openOnHover ? {
662
- onMouseEnter: useCallback(function () {
663
- return setOpen(true);
664
- }, []),
664
+ onMouseEnter: onMouseEnter,
665
665
  open: open
666
666
  } : {};
667
667
  return /*#__PURE__*/React.createElement(SchemaSettings.Item, _objectSpread({}, others), /*#__PURE__*/React.createElement("div", {
@@ -707,7 +707,7 @@ SchemaSettings.CascaderItem = function (props) {
707
707
  }
708
708
  })));
709
709
  };
710
- SchemaSettings.SwitchItem = function (props) {
710
+ SchemaSettings.SwitchItem = function SwitchItem(props) {
711
711
  var title = props.title,
712
712
  onChange = props.onChange,
713
713
  others = _objectWithoutProperties(props, _excluded5);
@@ -734,7 +734,7 @@ SchemaSettings.SwitchItem = function (props) {
734
734
  }
735
735
  })));
736
736
  };
737
- SchemaSettings.PopupItem = function (props) {
737
+ SchemaSettings.PopupItem = function PopupItem(props) {
738
738
  var schema = props.schema,
739
739
  others = _objectWithoutProperties(props, _excluded6);
740
740
  var _useState7 = useState(false),
@@ -885,7 +885,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
885
885
  schema: schema
886
886
  }))))), document.body));
887
887
  });
888
- SchemaSettings.ModalItem = function (props) {
888
+ SchemaSettings.ModalItem = function ModalItem(props) {
889
889
  var hidden = props.hidden,
890
890
  title = props.title,
891
891
  components = props.components,
@@ -965,7 +965,7 @@ SchemaSettings.ModalItem = function (props) {
965
965
  }()
966
966
  }), props.children || props.title);
967
967
  };
968
- SchemaSettings.BlockTitleItem = function () {
968
+ SchemaSettings.BlockTitleItem = function BlockTitleItem() {
969
969
  var _fieldSchema$xCompon;
970
970
  var field = useField();
971
971
  var fieldSchema = useFieldSchema();
@@ -1002,7 +1002,7 @@ SchemaSettings.BlockTitleItem = function () {
1002
1002
  }
1003
1003
  });
1004
1004
  };
1005
- SchemaSettings.DefaultSortingRules = function (props) {
1005
+ SchemaSettings.DefaultSortingRules = function DefaultSortingRules(props) {
1006
1006
  var sort = props.sort,
1007
1007
  sortFields = props.sortFields,
1008
1008
  onSubmit = props.onSubmit;
@@ -1082,7 +1082,7 @@ SchemaSettings.DefaultSortingRules = function (props) {
1082
1082
  onSubmit: onSubmit
1083
1083
  });
1084
1084
  };
1085
- SchemaSettings.LinkageRules = function (props) {
1085
+ SchemaSettings.LinkageRules = function LinkageRules(props) {
1086
1086
  var collectionName = props.collectionName;
1087
1087
  var fieldSchema = useFieldSchema();
1088
1088
  var _useDesignable3 = useDesignable(),
@@ -1154,7 +1154,7 @@ export var useDataTemplates = function useDataTemplates() {
1154
1154
  templateData: _.cloneDeep(formSchema === null || formSchema === void 0 ? void 0 : formSchema['x-data-templates'])
1155
1155
  };
1156
1156
  };
1157
- SchemaSettings.DataTemplates = function (props) {
1157
+ SchemaSettings.DataTemplates = function DataTemplates(props) {
1158
1158
  var collectionName = props.collectionName;
1159
1159
  var fieldSchema = useFieldSchema();
1160
1160
  var _useDesignable4 = useDesignable(),
@@ -1200,7 +1200,7 @@ SchemaSettings.DataTemplates = function (props) {
1200
1200
  }
1201
1201
  });
1202
1202
  };
1203
- SchemaSettings.EnableChildCollections = function (props) {
1203
+ SchemaSettings.EnableChildCollections = function EnableChildCollections(props) {
1204
1204
  var collectionName = props.collectionName;
1205
1205
  var fieldSchema = useFieldSchema();
1206
1206
  var _useDesignable5 = useDesignable(),
@@ -1274,4 +1274,17 @@ SchemaSettings.EnableChildCollections = function (props) {
1274
1274
  dn.refresh();
1275
1275
  }
1276
1276
  });
1277
+ };
1278
+ // 是否显示默认值配置项
1279
+ export var isShowDefaultValue = function isShowDefaultValue(collectionField, getInterface) {
1280
+ return !['o2o', 'oho', 'obo', 'o2m', 'attachment'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && !isSystemField(collectionField, getInterface);
1281
+ };
1282
+ // 是否是系统字段
1283
+ export var isSystemField = function isSystemField(collectionField, getInterface) {
1284
+ var i = getInterface === null || getInterface === void 0 ? void 0 : getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
1285
+ return (i === null || i === void 0 ? void 0 : i.group) === 'systemInfo';
1286
+ };
1287
+ export var isPatternDisabled = function isPatternDisabled(fieldSchema) {
1288
+ var _fieldSchema$xCompon2;
1289
+ return (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2['pattern-disable']) == true;
1277
1290
  };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ value: any;
4
+ onChange: (value: any) => void;
5
+ collectionName: string;
6
+ renderSchemaComponent?: (props: any) => any;
7
+ style: React.CSSProperties;
8
+ schema: any;
9
+ operator: any;
10
+ children: any;
11
+ };
12
+ export declare const VariableInput: (props: Props) => JSX.Element;
13
+ export {};
@@ -0,0 +1,37 @@
1
+ import React, { useMemo } from 'react';
2
+ import { Variable, useCompile } from '../../schema-component';
3
+ import { useUserVariable } from './hooks/useUserVariable';
4
+ export var VariableInput = function VariableInput(props) {
5
+ var value = props.value,
6
+ onChange = props.onChange,
7
+ RenderSchemaComponent = props.renderSchemaComponent,
8
+ style = props.style,
9
+ schema = props.schema;
10
+ var compile = useCompile();
11
+ var userVariable = useUserVariable({
12
+ schema: schema,
13
+ level: 1
14
+ });
15
+ var scope = useMemo(function () {
16
+ return [userVariable, compile({
17
+ label: "{{t(\"Date variables\")}}",
18
+ value: '$date',
19
+ key: '$date',
20
+ disabled: schema['x-component'] !== 'DatePicker',
21
+ children: [{
22
+ key: 'now',
23
+ value: 'now',
24
+ label: "{{t(\"Now\")}}"
25
+ }]
26
+ })];
27
+ }, []);
28
+ return /*#__PURE__*/React.createElement(Variable.Input, {
29
+ value: value,
30
+ onChange: onChange,
31
+ scope: scope,
32
+ style: style
33
+ }, /*#__PURE__*/React.createElement(RenderSchemaComponent, {
34
+ value: value,
35
+ onChange: onChange
36
+ }));
37
+ };
@@ -0,0 +1,4 @@
1
+ export declare const useDateVariable: ({ operator, schema }: {
2
+ operator: any;
3
+ schema: any;
4
+ }) => any;
@@ -0,0 +1,129 @@
1
+ import { useCompile } from '../../../schema-component';
2
+ export var useDateVariable = function useDateVariable(_ref) {
3
+ var operator = _ref.operator,
4
+ schema = _ref.schema;
5
+ var compile = useCompile();
6
+ var operatorValue = (operator === null || operator === void 0 ? void 0 : operator.value) || '';
7
+ if (!operator || !schema) return null;
8
+ var disabled = !['DatePicker', 'DatePicker.RangePicker'].includes(schema['x-component']);
9
+ var dateOptions = [{
10
+ key: 'now',
11
+ value: 'now',
12
+ label: "{{t(\"Now\")}}",
13
+ disabled: schema['x-component'] !== 'DatePicker' || operatorValue === '$dateBetween'
14
+ }, {
15
+ key: 'yesterday',
16
+ value: 'yesterday',
17
+ label: "{{t(\"Yesterday\")}}",
18
+ disabled: disabled
19
+ }, {
20
+ key: 'today',
21
+ value: 'today',
22
+ label: "{{t(\"Today\")}}",
23
+ disabled: disabled
24
+ }, {
25
+ key: 'tomorrow',
26
+ value: 'tomorrow',
27
+ label: "{{t(\"Tomorrow\")}}",
28
+ disabled: disabled
29
+ }, {
30
+ key: 'lastIsoWeek',
31
+ value: 'lastIsoWeek',
32
+ label: "{{t(\"Last week\")}}",
33
+ disabled: disabled
34
+ }, {
35
+ key: 'thisIsoWeek',
36
+ value: 'thisIsoWeek',
37
+ label: "{{t(\"This week\")}}",
38
+ disabled: disabled
39
+ }, {
40
+ key: 'nextIsoWeek',
41
+ value: 'nextIsoWeek',
42
+ label: "{{t(\"Next week\")}}",
43
+ disabled: disabled
44
+ }, {
45
+ key: 'lastMonth',
46
+ value: 'lastMonth',
47
+ label: "{{t(\"Last month\")}}",
48
+ disabled: disabled
49
+ }, {
50
+ key: 'thisMonth',
51
+ value: 'thisMonth',
52
+ label: "{{t(\"This month\")}}",
53
+ disabled: disabled
54
+ }, {
55
+ key: 'nextMonth',
56
+ value: 'nextMonth',
57
+ label: "{{t(\"Next month\")}}",
58
+ disabled: disabled
59
+ }, {
60
+ key: 'lastQuarter',
61
+ value: 'lastQuarter',
62
+ label: "{{t(\"Last quarter\")}}",
63
+ disabled: disabled
64
+ }, {
65
+ key: 'thisQuarter',
66
+ value: 'thisQuarter',
67
+ label: "{{t(\"This quarter\")}}",
68
+ disabled: disabled
69
+ }, {
70
+ key: 'nextQuarter',
71
+ value: 'nextQuarter',
72
+ label: "{{t(\"Next quarter\")}}",
73
+ disabled: disabled
74
+ }, {
75
+ key: 'lastYear',
76
+ value: 'lastYear',
77
+ label: "{{t(\"Last year\")}}",
78
+ disabled: disabled
79
+ }, {
80
+ key: 'thisYear',
81
+ value: 'thisYear',
82
+ label: "{{t(\"This year\")}}",
83
+ disabled: disabled
84
+ }, {
85
+ key: 'nextYear',
86
+ value: 'nextYear',
87
+ label: "{{t(\"Next year\")}}",
88
+ disabled: disabled
89
+ }, {
90
+ key: 'last7Days',
91
+ value: 'last7Days',
92
+ label: "{{t(\"Last 7 days\")}}",
93
+ disabled: disabled
94
+ }, {
95
+ key: 'next7Days',
96
+ value: 'next7Days',
97
+ label: "{{t(\"Next 7 days\")}}",
98
+ disabled: disabled
99
+ }, {
100
+ key: 'last30Days',
101
+ value: 'last30Days',
102
+ label: "{{t(\"Last 30 days\")}}",
103
+ disabled: disabled
104
+ }, {
105
+ key: 'next30Days',
106
+ value: 'next30Days',
107
+ label: "{{t(\"Next 30 days\")}}",
108
+ disabled: disabled
109
+ }, {
110
+ key: 'last90Days',
111
+ value: 'last90Days',
112
+ label: "{{t(\"Last 90 days\")}}",
113
+ disabled: disabled
114
+ }, {
115
+ key: 'next90Days',
116
+ value: 'next90Days',
117
+ label: "{{t(\"Next 90 days\")}}",
118
+ disabled: disabled
119
+ }];
120
+ return compile({
121
+ label: "{{t(\"Date variables\")}}",
122
+ value: '$date',
123
+ key: '$date',
124
+ disabled: dateOptions.every(function (option) {
125
+ return option.disabled;
126
+ }),
127
+ children: dateOptions
128
+ });
129
+ };
@@ -0,0 +1,5 @@
1
+ export declare const useUserVariable: ({ operator, schema, level }: {
2
+ operator?: any;
3
+ schema: any;
4
+ level?: number;
5
+ }) => any;
@@ -0,0 +1,68 @@
1
+ import { useMemo } from 'react';
2
+ import { useCompile, useGetFilterOptions } from '../../../schema-component';
3
+ var getChildren = function getChildren(options, _ref) {
4
+ var schema = _ref.schema,
5
+ operator = _ref.operator,
6
+ maxDepth = _ref.maxDepth,
7
+ _ref$count = _ref.count,
8
+ count = _ref$count === void 0 ? 1 : _ref$count,
9
+ getFilterOptions = _ref.getFilterOptions;
10
+ if (count > maxDepth) {
11
+ return [];
12
+ }
13
+ var result = options.map(function (option) {
14
+ if (option.type !== 'belongsTo' && option.type !== 'hasOne' || !option.target) {
15
+ var _option$schema;
16
+ return {
17
+ key: option.name,
18
+ value: option.name,
19
+ label: option.title,
20
+ // TODO: 现在是通过组件的名称来过滤能够被选择的选项,这样的坏处是不够精确,后续可以优化
21
+ disabled: (schema === null || schema === void 0 ? void 0 : schema['x-component']) !== ((_option$schema = option.schema) === null || _option$schema === void 0 ? void 0 : _option$schema['x-component'])
22
+ };
23
+ }
24
+ var children = getChildren(getFilterOptions(option.target), {
25
+ schema: schema,
26
+ operator: operator,
27
+ maxDepth: maxDepth,
28
+ count: count + 1,
29
+ getFilterOptions: getFilterOptions
30
+ }) || [];
31
+ return {
32
+ key: option.name,
33
+ value: option.name,
34
+ label: option.title,
35
+ children: children,
36
+ disabled: children.every(function (child) {
37
+ return child.disabled;
38
+ })
39
+ };
40
+ });
41
+ return result;
42
+ };
43
+ export var useUserVariable = function useUserVariable(_ref2) {
44
+ var operator = _ref2.operator,
45
+ schema = _ref2.schema,
46
+ level = _ref2.level;
47
+ var compile = useCompile();
48
+ var getFilterOptions = useGetFilterOptions();
49
+ var children = useMemo(function () {
50
+ return getChildren(getFilterOptions('users'), {
51
+ schema: schema,
52
+ operator: operator,
53
+ maxDepth: level || 3,
54
+ getFilterOptions: getFilterOptions
55
+ }) || [];
56
+ }, [operator, schema]);
57
+ return useMemo(function () {
58
+ return compile({
59
+ label: "{{t(\"Current user\")}}",
60
+ value: '$user',
61
+ key: '$user',
62
+ disabled: children.every(function (option) {
63
+ return option.disabled;
64
+ }),
65
+ children: children
66
+ });
67
+ }, [children]);
68
+ };
@@ -0,0 +1 @@
1
+ export declare const useVariableOptions: () => any[];
@@ -0,0 +1,18 @@
1
+ import { useValues } from '../../../schema-component/antd/filter/useValues';
2
+ import { useDateVariable } from './useDateVariable';
3
+ import { useUserVariable } from './useUserVariable';
4
+ export var useVariableOptions = function useVariableOptions() {
5
+ var _useValues = useValues(),
6
+ operator = _useValues.operator,
7
+ schema = _useValues.schema;
8
+ var userVariable = useUserVariable({
9
+ operator: operator,
10
+ schema: schema
11
+ });
12
+ var dateVariable = useDateVariable({
13
+ operator: operator,
14
+ schema: schema
15
+ });
16
+ if (!operator || !schema) return [];
17
+ return [userVariable, dateVariable];
18
+ };
@@ -10,13 +10,13 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  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; }
11
11
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { useTranslation } from "react-i18next";
13
+ import { useTranslation } from 'react-i18next';
14
14
  import { css } from '@emotion/css';
15
- import { useAPIClient } from "../api-client";
16
- import { useForm } from "@formily/react";
17
- import { useEffect, useRef, useState } from "react";
18
- import { Button, Input, message } from "antd";
19
- import React from "react";
15
+ import { useAPIClient } from '../api-client';
16
+ import { useForm } from '@formily/react';
17
+ import { useEffect, useRef, useState } from 'react';
18
+ import { Button, Input, message } from 'antd';
19
+ import React from 'react';
20
20
  export default function VerificationCode(_ref) {
21
21
  var _ref$targetFieldName = _ref.targetFieldName,
22
22
  targetFieldName = _ref$targetFieldName === void 0 ? 'phone' : _ref$targetFieldName,
@@ -88,9 +88,8 @@ export default function VerificationCode(_ref) {
88
88
  }));
89
89
  return _onGetCode.apply(this, arguments);
90
90
  }
91
- ;
92
91
  return /*#__PURE__*/React.createElement("fieldset", {
93
- className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: .5em;\n "])))
92
+ className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 0.5em;\n "])))
94
93
  }, /*#__PURE__*/React.createElement(Input, {
95
94
  value: value,
96
95
  onChange: onChange,
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function FilterDynamicComponent(props: any): JSX.Element;
@@ -3,8 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useUserVariable = void 0;
7
- var _filter = require("../../filter");
6
+ exports.FilterDynamicComponent = FilterDynamicComponent;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _schemaComponent = require("../../schema-component");
9
+ var _filter = require("../../schema-component/antd/filter");
10
+ var _useValues2 = require("../../schema-component/antd/filter/useValues");
11
+ var _variable = require("../../schema-component/antd/variable");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
13
  var useOptions = function useOptions(collectionName, _ref) {
9
14
  var schema = _ref.schema,
10
15
  operator = _ref.operator,
@@ -48,7 +53,7 @@ var useUserVariable = function useUserVariable(_ref2) {
48
53
  var options = useOptions('users', {
49
54
  schema: schema,
50
55
  operator: operator,
51
- maxDepth: 3
56
+ maxDepth: 1
52
57
  }) || [];
53
58
  return {
54
59
  label: "{{t(\"Current user\")}}",
@@ -60,4 +65,27 @@ var useUserVariable = function useUserVariable(_ref2) {
60
65
  children: options
61
66
  };
62
67
  };
63
- exports.useUserVariable = useUserVariable;
68
+ var useVariableOptions = function useVariableOptions() {
69
+ var _useValues = (0, _useValues2.useValues)(),
70
+ operator = _useValues.operator,
71
+ schema = _useValues.schema;
72
+ var userVariable = useUserVariable({
73
+ schema: schema,
74
+ operator: operator
75
+ });
76
+ if (!operator || !schema) return [];
77
+ return [userVariable];
78
+ };
79
+ function FilterDynamicComponent(props) {
80
+ var value = props.value,
81
+ onChange = props.onChange,
82
+ renderSchemaComponent = props.renderSchemaComponent;
83
+ var options = useVariableOptions();
84
+ var compile = (0, _schemaComponent.useCompile)();
85
+ var scope = compile(options);
86
+ return /*#__PURE__*/_react.default.createElement(_variable.Variable.Input, {
87
+ value: value,
88
+ onChange: onChange,
89
+ scope: scope
90
+ }, renderSchemaComponent());
91
+ }
@@ -7,6 +7,7 @@ exports.scopesSchema = exports.rolesResourcesScopesCollection = void 0;
7
7
  var _react = require("react");
8
8
  var _blockProvider = require("../../../block-provider");
9
9
  var _schemaComponent = require("../../../schema-component");
10
+ var _FilterDynamicComponent = require("../FilterDynamicComponent");
10
11
  var _RolesResourcesActions = require("../RolesResourcesActions");
11
12
  var rolesResourcesScopesCollection = {
12
13
  name: 'rolesResourcesScopes',
@@ -146,6 +147,7 @@ var scopesSchema = {
146
147
  'x-decorator': 'FormItem',
147
148
  'x-component': 'Filter',
148
149
  'x-component-props': {
150
+ dynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
149
151
  useProps: function useProps() {
150
152
  var ctx = (0, _react.useContext)(_RolesResourcesActions.RoleResourceCollectionContext);
151
153
  var options = (0, _schemaComponent.useFilterOptions)(ctx.name);
@@ -274,6 +276,7 @@ var scopesSchema = {
274
276
  'x-decorator': 'FormItem',
275
277
  'x-component': 'Filter',
276
278
  'x-component-props': {
279
+ dynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
277
280
  useProps: function useProps() {
278
281
  var ctx = (0, _react.useContext)(_RolesResourcesActions.RoleResourceCollectionContext);
279
282
  var options = (0, _schemaComponent.useFilterOptions)(ctx.name);
@@ -22,5 +22,6 @@ export declare class Application {
22
22
  * TODO
23
23
  */
24
24
  plugin(plugin: PluginCallback): void;
25
+ handleErrors(error: any): void;
25
26
  render(): (props: any) => JSX.Element;
26
27
  }
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getCurrentTimezone = exports.Application = void 0;
8
8
  var _antd = require("antd");
9
9
  var _react = _interopRequireWildcard(require("react"));
10
+ var _reactErrorBoundary = require("react-error-boundary");
10
11
  var _reactI18next = require("react-i18next");
11
12
  var _reactRouterDom = require("react-router-dom");
12
13
  var _acl = require("../acl");
@@ -19,6 +20,7 @@ var _pluginManager = require("../plugin-manager");
19
20
  var _pm = _interopRequireWildcard(require("../pm"));
20
21
  var _routeSwitch = require("../route-switch");
21
22
  var _schemaComponent = require("../schema-component");
23
+ var _errorFallback = require("../schema-component/antd/error-fallback");
22
24
  var _schemaInitializer = require("../schema-initializer");
23
25
  var _schemaTemplates = require("../schema-templates");
24
26
  var _systemSettings = require("../system-settings");
@@ -165,6 +167,11 @@ var Application = /*#__PURE__*/function () {
165
167
  value: function plugin(_plugin) {
166
168
  this.plugins.push(_plugin);
167
169
  }
170
+ }, {
171
+ key: "handleErrors",
172
+ value: function handleErrors(error) {
173
+ console.error(error);
174
+ }
168
175
  }, {
169
176
  key: "render",
170
177
  value: function render() {
@@ -235,9 +242,12 @@ var Application = /*#__PURE__*/function () {
235
242
  if (loading) {
236
243
  return /*#__PURE__*/_react.default.createElement(_antd.Spin, null);
237
244
  }
238
- return /*#__PURE__*/_react.default.createElement(App, {
245
+ return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
246
+ FallbackComponent: _errorFallback.ErrorFallback,
247
+ onError: _this.handleErrors
248
+ }, /*#__PURE__*/_react.default.createElement(App, {
239
249
  providers: _this.providers
240
- });
250
+ }));
241
251
  };
242
252
  }
243
253
  }]);
@@ -7,6 +7,7 @@ exports.useFormFieldProps = exports.useFormFieldContext = exports.WithoutFormFie
7
7
  var _core = require("@formily/core");
8
8
  var _react = require("@formily/react");
9
9
  var _reactive = require("@formily/reactive");
10
+ var _client = require("@nocobase/utils/client");
10
11
  var _antd = require("antd");
11
12
  var _react2 = _interopRequireWildcard(require("react"));
12
13
  var _recordProvider = require("../record-provider");
@@ -48,7 +49,14 @@ var InternalFormFieldProvider = function InternalFormFieldProvider(props) {
48
49
  (0, _react2.useEffect)(function () {
49
50
  var dispose = (0, _reactive.autorun)(function () {
50
51
  var _formBlockCtx$form2;
51
- form.values = (formBlockCtx === null || formBlockCtx === void 0 ? void 0 : (_formBlockCtx$form2 = formBlockCtx.form) === null || _formBlockCtx$form2 === void 0 ? void 0 : _formBlockCtx$form2.values[fieldName]) || form.values;
52
+ var data = (formBlockCtx === null || formBlockCtx === void 0 ? void 0 : (_formBlockCtx$form2 = formBlockCtx.form) === null || _formBlockCtx$form2 === void 0 ? void 0 : _formBlockCtx$form2.values[fieldName]) || {};
53
+ // 先清空表单值,再赋值,避免当值为空时,表单未被清空
54
+ form.reset();
55
+ (0, _client.forEach)(data, function (value, key) {
56
+ if (value) {
57
+ form.values[key] = value;
58
+ }
59
+ });
52
60
  });
53
61
  return dispose;
54
62
  }, []);