@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
@@ -19,12 +19,13 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
19
19
  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); }
20
20
  var useLabelFields = function useLabelFields(collectionName) {
21
21
  var _targetFields$filter, _targetFields$filter$, _targetFields$filter$2;
22
- if (!collectionName) {
23
- return [];
24
- }
22
+ // 需要在组件顶层调用
25
23
  var compile = (0, _hooks.useCompile)();
26
24
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
27
25
  getCollectionFields = _useCollectionManager.getCollectionFields;
26
+ if (!collectionName) {
27
+ return [];
28
+ }
28
29
  var targetFields = getCollectionFields(collectionName);
29
30
  return targetFields === null || targetFields === void 0 ? void 0 : (_targetFields$filter = targetFields.filter) === null || _targetFields$filter === void 0 ? void 0 : (_targetFields$filter$ = _targetFields$filter.call(targetFields, function (field) {
30
31
  return (field === null || field === void 0 ? void 0 : field.interface) && !(field === null || field === void 0 ? void 0 : field.target) && field.type !== 'boolean' && !field.isForeignKey;
@@ -61,9 +62,9 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
61
62
  title: t('Custom column title'),
62
63
  properties: {
63
64
  title: {
64
- // title: t('Column title'),
65
+ title: t('Column title'),
65
66
  default: columnSchema === null || columnSchema === void 0 ? void 0 : columnSchema.title,
66
- description: "".concat(t('Original title: ')).concat((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.title)),
67
+ description: "".concat(t('Original field title: ')).concat((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.title)),
67
68
  'x-decorator': 'FormItem',
68
69
  'x-component': 'Input',
69
70
  'x-component-props': {}
@@ -257,8 +257,8 @@ var Table = (0, _react.observer)(function (props) {
257
257
  }, [requiredValidator]);
258
258
  (0, _react2.useEffect)(function () {
259
259
  if (treeTable !== false) {
260
- var _field$value2;
261
- var keys = (0, _utils.getIdsWithChildren)((_field$value2 = field.value) === null || _field$value2 === void 0 ? void 0 : _field$value2.slice());
260
+ var _field$value2, _field$value2$slice;
261
+ var keys = (0, _utils.getIdsWithChildren)((_field$value2 = field.value) === null || _field$value2 === void 0 ? void 0 : (_field$value2$slice = _field$value2.slice) === null || _field$value2$slice === void 0 ? void 0 : _field$value2$slice.call(_field$value2));
262
262
  setAllIncludesChildren(keys);
263
263
  }
264
264
  }, [field.value]);
@@ -144,7 +144,8 @@ ReadPretty.Upload = function (props) {
144
144
  return (field.value || []).map(function (item) {
145
145
  return /*#__PURE__*/_react2.default.createElement("div", null, item.url ? /*#__PURE__*/_react2.default.createElement("a", {
146
146
  target: '_blank',
147
- href: item.url
147
+ href: item.url,
148
+ rel: "noreferrer"
148
149
  }, item.name) : /*#__PURE__*/_react2.default.createElement("span", null, item.name));
149
150
  });
150
151
  };
@@ -153,7 +153,8 @@ function Input(props) {
153
153
  onChange = props.onChange,
154
154
  children = props.children,
155
155
  button = props.button,
156
- useTypedConstant = props.useTypedConstant;
156
+ useTypedConstant = props.useTypedConstant,
157
+ style = props.style;
157
158
  var parsed = parseValue(value);
158
159
  var isConstant = typeof parsed === 'string';
159
160
  var type = isConstant ? parsed : '';
@@ -198,9 +199,14 @@ function Input(props) {
198
199
  var disabled = props.disabled || form.disabled;
199
200
  return /*#__PURE__*/_react2.default.createElement(_antd.Input.Group, {
200
201
  compact: true,
202
+ style: style,
201
203
  className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: auto;\n display: flex !important;\n .ant-input-disabled {\n .ant-tag {\n color: #bfbfbf;\n border-color: #d9d9d9;\n }\n }\n .ant-input.null-value {\n width: 4em;\n min-width: 4em;\n }\n "])))
204
+ }, /*#__PURE__*/_react2.default.createElement("div", {
205
+ style: {
206
+ flex: 1
207
+ }
202
208
  }, variable ? /*#__PURE__*/_react2.default.createElement("div", {
203
- className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n line-height: 0;\n\n &:hover {\n .ant-select-clear {\n opacity: 0.8;\n }\n }\n\n .ant-input {\n overflow: auto;\n white-space: nowrap;\n ", "\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0;\n padding: 2px 7px;\n border-radius: 10px;\n }\n }\n "])), disabled ? '' : 'padding-right: 28px;')
209
+ className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n line-height: 0;\n\n &:hover {\n .ant-select-clear {\n opacity: 0.8;\n }\n }\n\n .ant-input {\n overflow: auto;\n white-space: nowrap;\n ", "\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0;\n padding: 2px 7px;\n border-radius: 10px;\n }\n }\n "])), disabled ? '' : 'padding-right: 28px;')
204
210
  }, /*#__PURE__*/_react2.default.createElement("div", {
205
211
  onInput: function onInput(e) {
206
212
  return e.preventDefault();
@@ -221,7 +227,7 @@ function Input(props) {
221
227
  contentEditable: false,
222
228
  color: "blue"
223
229
  }, variableText)), !disabled ? /*#__PURE__*/_react2.default.createElement("span", {
224
- className: (0, _css.cx)('ant-select-clear', (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n user-select: 'none';\n "])))),
230
+ className: (0, _css.cx)('ant-select-clear', (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n user-select: 'none';\n "])))),
225
231
  unselectable: "on",
226
232
  "aria-hidden": true,
227
233
  onClick: function onClick() {
@@ -230,7 +236,7 @@ function Input(props) {
230
236
  }, /*#__PURE__*/_react2.default.createElement(_icons.CloseCircleFilled, null)) : null) : children !== null && children !== void 0 ? children : /*#__PURE__*/_react2.default.createElement(ConstantComponent, {
231
237
  value: value,
232
238
  onChange: onChange
233
- }), options.length > 1 ? /*#__PURE__*/_react2.default.createElement(_antd.Cascader, {
239
+ })), options.length > 1 ? /*#__PURE__*/_react2.default.createElement(_antd.Cascader, {
234
240
  options: options,
235
241
  value: variable !== null && variable !== void 0 ? variable : [''].concat(_toConsumableArray(children || !((_constantOption$child = constantOption.children) === null || _constantOption$child === void 0 ? void 0 : _constantOption$child.length) ? [] : [type])),
236
242
  onChange: onSwitch,
@@ -64,11 +64,11 @@ function JSONInput(props) {
64
64
  textArea.focus();
65
65
  }
66
66
  return /*#__PURE__*/_react.default.createElement("div", {
67
- className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n .ant-input{\n width: 100%;\n }\n "])))
67
+ className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n .ant-input {\n width: 100%;\n }\n "])))
68
68
  }, /*#__PURE__*/_react.default.createElement(_input.Input.JSON, _objectSpread(_objectSpread({}, props), {}, {
69
69
  ref: inputRef
70
70
  })), /*#__PURE__*/_react.default.createElement(_antd.Button.Group, {
71
- className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n right: 0;\n top: 0;\n .ant-btn-sm{\n font-size: 85%;\n }\n "])))
71
+ className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n right: 0;\n top: 0;\n .ant-btn-sm {\n font-size: 85%;\n }\n "])))
72
72
  }, /*#__PURE__*/_react.default.createElement(_antd.Button, {
73
73
  onClick: onFormat
74
74
  }, t('Prettify')), /*#__PURE__*/_react.default.createElement(_VariableSelect.VariableSelect, {
@@ -417,7 +417,7 @@ TextArea.ReadPretty = function (props) {
417
417
  dangerouslySetInnerHTML: {
418
418
  __html: html
419
419
  },
420
- className: (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: auto;\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0 .25em;\n padding: 2px 7px;\n border-radius: 10px;\n }\n "])))
420
+ className: (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: auto;\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0 0.25em;\n padding: 2px 7px;\n border-radius: 10px;\n }\n "])))
421
421
  });
422
422
  return /*#__PURE__*/_react.default.createElement(_2.EllipsisWithTooltip, {
423
423
  ellipsis: true,
@@ -32,9 +32,9 @@ function VariableSelect(props) {
32
32
  setSelectedVar([]);
33
33
  }, [options]);
34
34
  return /*#__PURE__*/_react.default.createElement(_antd.Button, {
35
- className: (0, _css.cx)('x-button', (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n .ant-select.ant-cascader{\n position: absolute;\n top: -1px;\n left: -1px;\n min-width: auto;\n width: calc(100% + 2px);\n height: calc(100% + 2px);\n overflow: hidden;\n opacity: 0;\n }\n "]))))
35
+ className: (0, _css.cx)('x-button', (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n .ant-select.ant-cascader {\n position: absolute;\n top: -1px;\n left: -1px;\n min-width: auto;\n width: calc(100% + 2px);\n height: calc(100% + 2px);\n overflow: hidden;\n opacity: 0;\n }\n "]))))
36
36
  }, /*#__PURE__*/_react.default.createElement("span", {
37
- className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-style: italic;\n font-family: \"New York\", \"Times New Roman\", Times, serif;\n "])))
37
+ className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-style: italic;\n font-family: 'New York', 'Times New Roman', Times, serif;\n "])))
38
38
  }, "x"), /*#__PURE__*/_react.default.createElement(_antd.Cascader, {
39
39
  placeholder: t('Select a variable'),
40
40
  value: [],
@@ -64,10 +64,10 @@ function VariableSelect(props) {
64
64
  }
65
65
  }
66
66
  },
67
- dropdownClassName: (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-cascader-menu{\n margin-bottom: 0;\n }\n "]))),
67
+ dropdownClassName: (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .ant-cascader-menu {\n margin-bottom: 0;\n }\n "]))),
68
68
  dropdownRender: function dropdownRender(menu) {
69
69
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, menu, /*#__PURE__*/_react.default.createElement("div", {
70
- className: (0, _css.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: .5em;\n border-top: 1px solid rgba(0, 0, 0, .06);\n color: rgba(0, 0, 0, .45);\n "])))
70
+ className: (0, _css.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 0.5em;\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n color: rgba(0, 0, 0, 0.45);\n "])))
71
71
  }, t('Double click to choose entire object')));
72
72
  }
73
73
  }));
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  export declare const XButton: React.ForwardRefExoticComponent<Partial<{
3
3
  href: string;
4
4
  target?: string;
@@ -20,7 +20,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
20
20
  var XButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
21
21
  return /*#__PURE__*/_react.default.createElement(_antd.Button, _objectSpread({
22
22
  ref: ref,
23
- className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-style: italic;\n font-family: \"New York\", \"Times New Roman\", Times, serif;\n "])))
23
+ className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-style: italic;\n font-family: 'New York', 'Times New Roman', Times, serif;\n "])))
24
24
  }, props), "x");
25
25
  });
26
26
  exports.XButton = XButton;
@@ -1 +1,10 @@
1
+ declare type VariablesCtx = {
2
+ /** 当前登录的用户 */
3
+ $user: Record<string, any>;
4
+ $date: Record<string, any>;
5
+ };
6
+ export declare const useVariablesCtx: () => VariablesCtx;
7
+ export declare const isVariable: (str: unknown) => boolean;
8
+ export declare const parseVariables: (str: string, ctx: VariablesCtx) => any;
1
9
  export declare const conditionAnalyse: (rules: any, values: any) => boolean;
10
+ export {};
@@ -3,15 +3,54 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.conditionAnalyse = void 0;
7
- var _lodash = require("lodash");
6
+ exports.useVariablesCtx = exports.parseVariables = exports.isVariable = exports.conditionAnalyse = void 0;
8
7
  var _flat2 = _interopRequireDefault(require("flat"));
8
+ var _lodash = _interopRequireWildcard(require("lodash"));
9
+ var _moment = _interopRequireDefault(require("moment"));
10
+ var _user = require("../../../user");
9
11
  var _logic = _interopRequireDefault(require("../../common/utils/logic"));
12
+ 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); }
13
+ 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; }
10
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
15
  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; }
12
16
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
17
  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); }
14
18
  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); }
19
+ var useVariablesCtx = function useVariablesCtx() {
20
+ var _ref = (0, _user.useCurrentUserContext)() || {},
21
+ data = _ref.data;
22
+ return {
23
+ $user: (data === null || data === void 0 ? void 0 : data.data) || {},
24
+ $date: {
25
+ now: function now() {
26
+ return (0, _moment.default)().toISOString();
27
+ }
28
+ }
29
+ };
30
+ };
31
+ exports.useVariablesCtx = useVariablesCtx;
32
+ var isVariable = function isVariable(str) {
33
+ var _str$match;
34
+ if (typeof str !== 'string') {
35
+ return false;
36
+ }
37
+ var regex = /{{(.*?)}}/;
38
+ var matches = str === null || str === void 0 ? void 0 : (_str$match = str.match) === null || _str$match === void 0 ? void 0 : _str$match.call(str, regex);
39
+ return matches ? true : false;
40
+ };
41
+ exports.isVariable = isVariable;
42
+ var parseVariables = function parseVariables(str, ctx) {
43
+ var _str$match2;
44
+ var regex = /{{(.*?)}}/;
45
+ var matches = str === null || str === void 0 ? void 0 : (_str$match2 = str.match) === null || _str$match2 === void 0 ? void 0 : _str$match2.call(str, regex);
46
+ if (matches) {
47
+ var result = _lodash.default.get(ctx, matches[1]);
48
+ return _lodash.default.isFunction(result) ? result() : result;
49
+ } else {
50
+ return str;
51
+ }
52
+ };
53
+ exports.parseVariables = parseVariables;
15
54
  function getInnermostKeyAndValue(obj) {
16
55
  if (_typeof(obj) !== 'object' || obj === null) {
17
56
  return null;
@@ -31,9 +70,9 @@ function getInnermostKeyAndValue(obj) {
31
70
  return null;
32
71
  }
33
72
  var getValue = function getValue(str, values) {
34
- var _str$match;
73
+ var _str$match3;
35
74
  var regex = /{{(.*?)}}/;
36
- var matches = str === null || str === void 0 ? void 0 : (_str$match = str.match) === null || _str$match === void 0 ? void 0 : _str$match.call(str, regex);
75
+ var matches = str === null || str === void 0 ? void 0 : (_str$match3 = str.match) === null || _str$match3 === void 0 ? void 0 : _str$match3.call(str, regex);
37
76
  if (matches) {
38
77
  return getVariableValue(str, values);
39
78
  } else {
@@ -25,7 +25,9 @@ var DesignableSwitch = function DesignableSwitch() {
25
25
  (0, _reactHotkeysHook.useHotkeys)('Ctrl+Shift+U', function () {
26
26
  return setDesignable(!designable);
27
27
  }, [designable]);
28
- return /*#__PURE__*/_react.default.createElement(_antd.Button
28
+ return /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
29
+ title: t('UI Editor')
30
+ }, /*#__PURE__*/_react.default.createElement(_antd.Button
29
31
  // selected={designable}
30
32
  , {
31
33
  // selected={designable}
@@ -36,6 +38,6 @@ var DesignableSwitch = function DesignableSwitch() {
36
38
  onClick: function onClick() {
37
39
  setDesignable(!designable);
38
40
  }
39
- });
41
+ }));
40
42
  };
41
43
  exports.DesignableSwitch = DesignableSwitch;
@@ -8,14 +8,14 @@ var _react = require("@formily/react");
8
8
  var _lodash = require("lodash");
9
9
  var _react2 = require("react");
10
10
  var useComponent = function useComponent(component, defaults) {
11
+ var _useContext = (0, _react2.useContext)(_react.SchemaOptionsContext),
12
+ components = _useContext.components;
11
13
  if (!component) {
12
14
  return defaults;
13
15
  }
14
16
  if (typeof component !== 'string') {
15
17
  return component;
16
18
  }
17
- var _useContext = (0, _react2.useContext)(_react.SchemaOptionsContext),
18
- components = _useContext.components;
19
19
  return (0, _lodash.get)(components, component) || defaults;
20
20
  };
21
21
  exports.useComponent = useComponent;
@@ -150,10 +150,10 @@ var Designable = /*#__PURE__*/function () {
150
150
  onSuccess = _ref.onSuccess, current = _ref.current, position = _ref.position, schema = _ref.schema, wrap = _ref.wrap, wrapped = _ref.wrapped, removed = _ref.removed;
151
151
  schemas = [];
152
152
  if ((wrapped === null || wrapped === void 0 ? void 0 : wrapped['x-component']) === 'Grid.Col') {
153
- schemas = updateColumnSize(wrapped.parent);
153
+ schemas = schemas.concat(updateColumnSize(wrapped.parent));
154
154
  }
155
155
  if ((removed === null || removed === void 0 ? void 0 : removed['x-component']) === 'Grid.Col') {
156
- schemas = updateColumnSize(removed.parent);
156
+ schemas = schemas.concat(updateColumnSize(removed.parent));
157
157
  }
158
158
  refresh();
159
159
  if (current['x-uid']) {
@@ -141,8 +141,8 @@ SchemaInitializer.Button = (0, _react.observer)(function (props) {
141
141
  className: (0, _classnames.default)('nb-schema-initializer-button'),
142
142
  openClassName: "nb-schema-initializer-button-open",
143
143
  overlayClassName: (0, _classnames.default)('nb-schema-initializer-button-overlay', (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-dropdown-menu-item-group-list {\n max-height: 40vh;\n overflow: auto;\n }\n "])))),
144
- visible: visible,
145
- onVisibleChange: function onVisibleChange(visible) {
144
+ open: visible,
145
+ onOpenChange: function onOpenChange(visible) {
146
146
  setVisible(visible);
147
147
  }
148
148
  }, dropdown), {}, {
@@ -26,13 +26,20 @@ var BulkEditFormItemInitializers = function BulkEditFormItemInitializers(props)
26
26
  type: 'itemGroup',
27
27
  title: t('Display fields'),
28
28
  children: (0, _utils.useCustomBulkEditFormItemInitializerFields)()
29
- }], associationFields.length > 0 ? [{
30
- type: 'divider'
31
- }, {
32
- type: 'itemGroup',
33
- title: t('Display association fields'),
34
- children: associationFields
35
- }] : [], [{
29
+ }],
30
+ // associationFields.length > 0
31
+ // ? [
32
+ // {
33
+ // type: 'divider',
34
+ // },
35
+ // {
36
+ // type: 'itemGroup',
37
+ // title: t('Display association fields'),
38
+ // children: associationFields,
39
+ // },
40
+ // ]
41
+ // : [],
42
+ [{
36
43
  type: 'divider'
37
44
  }, {
38
45
  type: 'item',
@@ -360,10 +360,10 @@ var useFilterFormItemInitializerFields = function useFilterFormItemInitializerFi
360
360
  var _field$uiSchema5;
361
361
  schema = {
362
362
  type: 'string',
363
- name: field.name,
363
+ name: "".concat(field.name),
364
364
  required: false,
365
- 'x-designer': 'AssociationSelect.FilterDesigner',
366
- 'x-component': 'AssociationSelect',
365
+ 'x-designer': 'FormItem.FilterFormDesigner',
366
+ 'x-component': 'CollectionField',
367
367
  'x-decorator': 'FormItem',
368
368
  'x-collection-field': "".concat(name, ".").concat(field.name),
369
369
  'x-component-props': (_field$uiSchema5 = field.uiSchema) === null || _field$uiSchema5 === void 0 ? void 0 : _field$uiSchema5['x-component-props']
@@ -464,7 +464,12 @@ var getItem = function getItem(field, schemaName, collectionName, getCollectionF
464
464
  type: 'subMenu',
465
465
  title: (_field$uiSchema8 = field.uiSchema) === null || _field$uiSchema8 === void 0 ? void 0 : _field$uiSchema8.title,
466
466
  children: subFields.map(function (subField) {
467
- return getItem(subField, "".concat(schemaName, ".").concat(subField.name), collectionName, getCollectionFields, [].concat(_toConsumableArray(processedCollections), [field.target]));
467
+ return (
468
+ // 使用 | 分隔,是为了防止 form.values 中出现 { a: { b: 1 } } 的情况
469
+ // 使用 | 分隔后,form.values 中会出现 { 'a|b': 1 } 的情况,这种情况下
470
+ // 就可以知道该字段是一个关系字段中的输入框,进而特殊处理
471
+ getItem(subField, "".concat(schemaName, ".").concat(subField.name), collectionName, getCollectionFields, [].concat(_toConsumableArray(processedCollections), [field.target]))
472
+ );
468
473
  }).filter(Boolean)
469
474
  };
470
475
  }
@@ -509,8 +514,7 @@ var useFilterAssociatedFormItemInitializerFields = function useFilterAssociatedF
509
514
  exports.useFilterAssociatedFormItemInitializerFields = useFilterAssociatedFormItemInitializerFields;
510
515
  var useInheritsFormItemInitializerFields = function useInheritsFormItemInitializerFields(options) {
511
516
  var _useCollection8 = (0, _collectionManager.useCollection)(),
512
- name = _useCollection8.name,
513
- template = _useCollection8.template;
517
+ name = _useCollection8.name;
514
518
  var _useCollectionManager8 = (0, _collectionManager.useCollectionManager)(),
515
519
  getInterface = _useCollectionManager8.getInterface,
516
520
  getInheritCollections = _useCollectionManager8.getInheritCollections,
@@ -519,17 +523,17 @@ var useInheritsFormItemInitializerFields = function useInheritsFormItemInitializ
519
523
  var inherits = getInheritCollections(name);
520
524
  var _useActionContext3 = (0, _schemaComponent.useActionContext)(),
521
525
  snapshot = _useActionContext3.snapshot;
526
+ var form = (0, _react.useForm)();
522
527
  return inherits === null || inherits === void 0 ? void 0 : inherits.map(function (v) {
523
528
  var _fields$filter4;
524
529
  var fields = getParentCollectionFields(v, name);
525
- var form = (0, _react.useForm)();
526
530
  var _ref5 = options || {},
527
531
  _ref5$readPretty = _ref5.readPretty,
528
532
  readPretty = _ref5$readPretty === void 0 ? form.readPretty : _ref5$readPretty,
529
533
  _ref5$block = _ref5.block,
530
534
  block = _ref5$block === void 0 ? 'Form' : _ref5$block;
531
535
  var targetCollection = getCollection(v);
532
- return _defineProperty({}, targetCollection.title, fields === null || fields === void 0 ? void 0 : (_fields$filter4 = fields.filter(function (field) {
536
+ return _defineProperty({}, targetCollection === null || targetCollection === void 0 ? void 0 : targetCollection.title, fields === null || fields === void 0 ? void 0 : (_fields$filter4 = fields.filter(function (field) {
533
537
  return (field === null || field === void 0 ? void 0 : field.interface) && !(field === null || field === void 0 ? void 0 : field.isForeignKey);
534
538
  })) === null || _fields$filter4 === void 0 ? void 0 : _fields$filter4.map(function (field) {
535
539
  var _field$uiSchema10, _field$uiSchema11, _field$uiSchema12;
@@ -843,7 +847,8 @@ var useCollectionDataSourceItems = function useCollectionDataSourceItems(compone
843
847
  var _useTranslation2 = (0, _reactI18next.useTranslation)(),
844
848
  t = _useTranslation2.t;
845
849
  var _useCollectionManager12 = (0, _collectionManager.useCollectionManager)(),
846
- collections = _useCollectionManager12.collections;
850
+ collections = _useCollectionManager12.collections,
851
+ getCollectionFields = _useCollectionManager12.getCollectionFields;
847
852
  var _useSchemaTemplateMan2 = (0, _schemaTemplates.useSchemaTemplateManager)(),
848
853
  getTemplatesByCollection = _useSchemaTemplateMan2.getTemplatesByCollection;
849
854
  var _useState = (0, _react2.useState)([]),
@@ -870,7 +875,9 @@ var useCollectionDataSourceItems = function useCollectionDataSourceItems(compone
870
875
  var b = !value || selected.includes(item.name);
871
876
  if (item.inherit) {
872
877
  return false;
873
- } else if (item.autoGenId === false && !item.fields.find(function (v) {
878
+ }
879
+ var fields = getCollectionFields(item.name);
880
+ if (item.autoGenId === false && !fields.find(function (v) {
874
881
  return v.primaryKey;
875
882
  })) {
876
883
  return false;
@@ -7,6 +7,8 @@ exports.FormDataTemplates = void 0;
7
7
  var _react = require("@formily/react");
8
8
  var _antd = require("antd");
9
9
  var _react2 = _interopRequireDefault(require("react"));
10
+ var _reactI18next = require("react-i18next");
11
+ var _collectionManager = require("../../collection-manager");
10
12
  var _schemaComponent = require("../../schema-component");
11
13
  var _AsDefaultTemplate = require("./components/AsDefaultTemplate");
12
14
  var _DataTemplateTitle = require("./components/DataTemplateTitle");
@@ -25,6 +27,13 @@ var FormDataTemplates = (0, _react.observer)(function (props) {
25
27
  var _useCollectionState = (0, _useCollectionState2.useCollectionState)(collectionName),
26
28
  collectionList = _useCollectionState.collectionList,
27
29
  getEnableFieldTree = _useCollectionState.getEnableFieldTree;
30
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
31
+ getCollection = _useCollectionManager.getCollection,
32
+ getCollectionField = _useCollectionManager.getCollectionField;
33
+ var collection = getCollection(collectionName);
34
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
35
+ t = _useTranslation.t;
36
+ var field = getCollectionField("".concat(collectionName, ".").concat((collection === null || collection === void 0 ? void 0 : collection.titleField) || 'id'));
28
37
  return /*#__PURE__*/_react2.default.createElement(_schemaComponent.SchemaComponent, {
29
38
  components: {
30
39
  ArrayCollapse: _DataTemplateTitle.ArrayCollapse
@@ -62,7 +71,7 @@ var FormDataTemplates = (0, _react.observer)(function (props) {
62
71
  type: 'string',
63
72
  title: '{{ t("Collection") }}',
64
73
  required: true,
65
- description: '当前表有继承关系时,可选择继承链路上的表作为模板来源',
74
+ description: t('If collection inherits, choose inherited collections as templates'),
66
75
  default: collectionName,
67
76
  'x-display': collectionList.length > 1 ? 'visible' : 'hidden',
68
77
  'x-decorator': 'FormItem',
@@ -75,7 +84,7 @@ var FormDataTemplates = (0, _react.observer)(function (props) {
75
84
  type: 'number',
76
85
  title: '{{ t("Template Data") }}',
77
86
  required: true,
78
- description: '选择一条已有的数据作为表单的初始化数据',
87
+ description: t('Select an existing piece of data as the initialization data for the form'),
79
88
  'x-decorator': 'FormItem',
80
89
  'x-component': _schemaComponent.AssociationSelect,
81
90
  'x-component-props': {
@@ -86,16 +95,20 @@ var FormDataTemplates = (0, _react.observer)(function (props) {
86
95
  multiple: false,
87
96
  objectValue: false,
88
97
  manual: false,
89
- mapOptions: function mapOptions(item) {
90
- // TODO: 应该使用 item.title 字段的值作为 label
91
- return {
92
- label: item.id,
93
- value: item.id
94
- };
98
+ targetField: field,
99
+ mapOptions: function mapOptions(option) {
100
+ try {
101
+ var label = getLabel(collection);
102
+ option[label] = /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, "#", option.id, " ", option[label]);
103
+ return option;
104
+ } catch (error) {
105
+ console.error(error);
106
+ return option;
107
+ }
95
108
  },
96
109
  fieldNames: {
97
- label: 'label',
98
- value: 'value'
110
+ label: getLabel(collection),
111
+ value: 'id'
99
112
  }
100
113
  },
101
114
  'x-reactions': [{
@@ -116,7 +129,7 @@ var FormDataTemplates = (0, _react.observer)(function (props) {
116
129
  type: 'array',
117
130
  title: '{{ t("Data fields") }}',
118
131
  required: true,
119
- description: '仅选择的字段才会作为表单的初始化数据',
132
+ description: t('Only the selected fields will be used as the initialization data for the form'),
120
133
  'x-decorator': 'FormItem',
121
134
  'x-component': Tree,
122
135
  'x-component-props': {
@@ -179,4 +192,7 @@ var FormDataTemplates = (0, _react.observer)(function (props) {
179
192
  }
180
193
  });
181
194
  });
182
- exports.FormDataTemplates = FormDataTemplates;
195
+ exports.FormDataTemplates = FormDataTemplates;
196
+ function getLabel(collection) {
197
+ return !(collection === null || collection === void 0 ? void 0 : collection.titleField) || collection.titleField === 'id' ? 'label' : collection === null || collection === void 0 ? void 0 : collection.titleField;
198
+ }
@@ -35,8 +35,9 @@ var useCollectionState = function useCollectionState(currentCollectionName) {
35
35
  function getCollectionList() {
36
36
  var collections = getAllCollectionsInheritChain(currentCollectionName);
37
37
  return collections.map(function (name) {
38
+ var _getCollection;
38
39
  return {
39
- label: getCollection(name).title,
40
+ label: (_getCollection = getCollection(name)) === null || _getCollection === void 0 ? void 0 : _getCollection.title,
40
41
  value: name
41
42
  };
42
43
  });
@@ -1,2 +1,9 @@
1
- /// <reference types="react" />
2
- export declare function FilterDynamicComponent(props: any): JSX.Element;
1
+ import React from 'react';
2
+ declare type Props = {
3
+ value: any;
4
+ onChange: (value: any) => void;
5
+ renderSchemaComponent: () => React.ReactNode;
6
+ collectionName: string;
7
+ };
8
+ export declare function FilterDynamicComponent(props: Props): JSX.Element;
9
+ export {};
@@ -94,7 +94,8 @@ var ValueDynamicComponent = function ValueDynamicComponent(props) {
94
94
  className: 'ant-formily-item-extra'
95
95
  }, t('Syntax references'), ":"), /*#__PURE__*/_react.default.createElement("a", {
96
96
  href: "https://formulajs.info/functions/",
97
- target: "_blank"
97
+ target: "_blank",
98
+ rel: "noreferrer"
98
99
  }, "Formula.js"))) : null);
99
100
  };
100
101
  exports.ValueDynamicComponent = ValueDynamicComponent;
@@ -2,7 +2,7 @@ import { GeneralField } from '@formily/core';
2
2
  import { ISchema, Schema } from '@formily/react';
3
3
  import { CascaderProps, MenuItemProps } from 'antd';
4
4
  import React from 'react';
5
- import { Designable } from '..';
5
+ import { CollectionFieldOptions, Designable } from '..';
6
6
  interface SchemaSettingsProps {
7
7
  title?: any;
8
8
  dn?: Designable;
@@ -56,4 +56,7 @@ interface SwitchItemProps extends Omit<MenuItemProps, 'onChange'> {
56
56
  export declare const useDataTemplates: () => {
57
57
  templateData: any;
58
58
  };
59
+ export declare const isShowDefaultValue: (collectionField: CollectionFieldOptions, getInterface: any) => boolean;
60
+ export declare const isSystemField: (collectionField: CollectionFieldOptions, getInterface: any) => boolean;
61
+ export declare const isPatternDisabled: (fieldSchema: Schema) => boolean;
59
62
  export {};