@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
@@ -31,7 +31,7 @@ var findOption = function findOption() {
31
31
  var options = arguments.length > 1 ? arguments[1] : undefined;
32
32
  var items = options;
33
33
  var option;
34
- dataIndex === null || dataIndex === void 0 ? void 0 : (_dataIndex$forEach = dataIndex.forEach) === null || _dataIndex$forEach === void 0 ? void 0 : _dataIndex$forEach.call(dataIndex, function (name, index) {
34
+ dataIndex === null || dataIndex === void 0 ? void 0 : (_dataIndex$forEach = dataIndex.forEach) === null || _dataIndex$forEach === void 0 ? void 0 : _dataIndex$forEach.call(dataIndex, function (name) {
35
35
  var item = items.find(function (item) {
36
36
  return item.name === name;
37
37
  });
@@ -44,9 +44,8 @@ var findOption = function findOption() {
44
44
  };
45
45
  var useValues = function useValues() {
46
46
  var field = (0, _react.useField)();
47
- var logic = (0, _react2.useContext)(_context.FilterLogicContext);
48
- var _useContext = (0, _react2.useContext)(_context.FilterContext),
49
- options = _useContext.options;
47
+ var _ref = (0, _react2.useContext)(_context.FilterContext) || {},
48
+ options = _ref.options;
50
49
  var data2value = function data2value() {
51
50
  var _field$data$dataIndex, _field$data, _field$data$operator, _field$data2;
52
51
  field.value = _flat.default.unflatten(_defineProperty({}, "".concat((_field$data$dataIndex = field.data.dataIndex) === null || _field$data$dataIndex === void 0 ? void 0 : _field$data$dataIndex.join('.'), ".").concat((_field$data = field.data) === null || _field$data === void 0 ? void 0 : (_field$data$operator = _field$data.operator) === null || _field$data$operator === void 0 ? void 0 : _field$data$operator.value), (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : _field$data2.value));
@@ -56,7 +55,7 @@ var useValues = function useValues() {
56
55
  field.data = field.data || {};
57
56
  var values = (0, _flat.default)(field.value);
58
57
  var path = Object.keys(values).shift() || '';
59
- if (!path) {
58
+ if (!path || !options) {
60
59
  return;
61
60
  }
62
61
  var _path$split = path.split('.$'),
@@ -80,10 +79,10 @@ var useValues = function useValues() {
80
79
  field.data.schema = (0, _shared.merge)(option === null || option === void 0 ? void 0 : option.schema, operator === null || operator === void 0 ? void 0 : operator.schema);
81
80
  field.data.value = (0, _get.default)(field.value, "".concat(fieldPath, ".$").concat(operatorValue));
82
81
  };
83
- (0, _react2.useEffect)(value2data, [logic]);
82
+ (0, _react2.useEffect)(value2data, [field.path.entire]);
84
83
  return _objectSpread(_objectSpread({
85
84
  fields: options
86
- }, field.data), {}, {
85
+ }, (field === null || field === void 0 ? void 0 : field.data) || {}), {}, {
87
86
  setDataIndex: function setDataIndex(dataIndex) {
88
87
  var _option$operators;
89
88
  var option = findOption(dataIndex, options);
@@ -1 +1,4 @@
1
+ import { ISchema } from '@formily/react';
2
+ import { CollectionFieldOptions } from '../../../collection-manager';
1
3
  export declare const FormItem: any;
4
+ export declare function getFieldDefaultValue(fieldSchema: ISchema, collectionField: CollectionFieldOptions): any;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.FormItem = void 0;
7
+ exports.getFieldDefaultValue = getFieldDefaultValue;
7
8
  var _css = require("@emotion/css");
8
9
  var _antd = require("@formily/antd");
9
10
  var _react = require("@formily/react");
@@ -14,7 +15,11 @@ var _reactI18next = require("react-i18next");
14
15
  var _ACLProvider = require("../../../acl/ACLProvider");
15
16
  var _blockProvider = require("../../../block-provider");
16
17
  var _collectionManager = require("../../../collection-manager");
18
+ var _CollectionFields = require("../../../collection-manager/Configuration/CollectionFields");
17
19
  var _schemaSettings = require("../../../schema-settings");
20
+ var _VariableInput = require("../../../schema-settings/VariableInput/VariableInput");
21
+ var _uitls = require("../../common/utils/uitls");
22
+ var _core = require("../../core");
18
23
  var _hooks = require("../../hooks");
19
24
  var _blockItem = require("../block-item");
20
25
  var _shared2 = require("../input/shared");
@@ -49,11 +54,17 @@ var FormItem = (0, _react.observer)(function (props) {
49
54
  var field = (0, _react.useField)();
50
55
  var ctx = (0, _react2.useContext)(_blockProvider.BlockRequestContext);
51
56
  var schema = (0, _react.useFieldSchema)();
57
+ var variablesCtx = (0, _uitls.useVariablesCtx)();
52
58
  (0, _react2.useEffect)(function () {
53
59
  if ((ctx === null || ctx === void 0 ? void 0 : ctx.block) === 'form') {
54
60
  ctx.field.data = ctx.field.data || {};
55
61
  ctx.field.data.activeFields = ctx.field.data.activeFields || new Set();
56
62
  ctx.field.data.activeFields.add(schema.name);
63
+ // 如果默认值是一个变量,则需要解析之后再显示出来
64
+ if ((0, _uitls.isVariable)(schema === null || schema === void 0 ? void 0 : schema.default)) {
65
+ var _field$setInitialValu;
66
+ (_field$setInitialValu = field.setInitialValue) === null || _field$setInitialValu === void 0 ? void 0 : _field$setInitialValu.call(field, (0, _uitls.parseVariables)(schema.default, variablesCtx));
67
+ }
57
68
  }
58
69
  }, []);
59
70
  return /*#__PURE__*/_react2.default.createElement(_ACLProvider.ACLCollectionFieldProvider, null, /*#__PURE__*/_react2.default.createElement(_blockItem.BlockItem, {
@@ -69,8 +80,8 @@ var FormItem = (0, _react.observer)(function (props) {
69
80
  }))));
70
81
  });
71
82
  exports.FormItem = FormItem;
72
- FormItem.Designer = function () {
73
- var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _collectionField$uiSc4, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _field$componentProps, _field$componentProps2;
83
+ FormItem.Designer = function Designer() {
84
+ var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _field$componentProps, _field$componentProps2;
74
85
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
75
86
  getCollectionFields = _useCollectionManager.getCollectionFields,
76
87
  getInterface = _useCollectionManager.getInterface,
@@ -90,6 +101,7 @@ FormItem.Designer = function () {
90
101
  refresh = _useDesignable.refresh,
91
102
  insertAdjacent = _useDesignable.insertAdjacent;
92
103
  var compile = (0, _hooks.useCompile)();
104
+ var variablesCtx = (0, _uitls.useVariablesCtx)();
93
105
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
94
106
  var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
95
107
  var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
@@ -105,7 +117,7 @@ FormItem.Designer = function () {
105
117
  initialValue['required'] = field.required;
106
118
  }
107
119
  var options = targetFields.filter(function (field) {
108
- return !(field === null || field === void 0 ? void 0 : field.target) && field.type !== 'boolean';
120
+ return (0, _CollectionFields.isTitleField)(field);
109
121
  }).map(function (field) {
110
122
  var _field$uiSchema;
111
123
  return {
@@ -386,28 +398,63 @@ FormItem.Designer = function () {
386
398
  });
387
399
  refresh();
388
400
  }
389
- }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4.type) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
401
+ }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (0, _schemaSettings.isShowDefaultValue)(collectionField, getInterface) && !(0, _schemaSettings.isPatternDisabled)(fieldSchema) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
390
402
  title: t('Set default value'),
391
403
  components: {
392
404
  ArrayCollapse: _antd.ArrayCollapse,
393
- FormLayout: _antd.FormLayout
405
+ FormLayout: _antd.FormLayout,
406
+ VariableInput: _VariableInput.VariableInput
394
407
  },
408
+ width: 800,
395
409
  schema: {
396
410
  type: 'object',
397
411
  title: t('Set default value'),
398
412
  properties: {
399
- default: _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema), {}, {
413
+ // 关系字段不支持设置变量
414
+ default: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
415
+ 'x-decorator': 'FormItem',
416
+ 'x-component-props': _objectSpread(_objectSpread({}, fieldSchema['x-component-props']), {}, {
417
+ component: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) && collectionField.interface !== 'chinaRegion' ? 'AssociationSelect' : undefined,
418
+ service: {
419
+ resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
420
+ }
421
+ }),
400
422
  name: 'default',
401
423
  title: t('Default value'),
424
+ default: getFieldDefaultValue(fieldSchema, collectionField)
425
+ }) : _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
402
426
  'x-decorator': 'FormItem',
403
- default: fieldSchema.default || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue)
427
+ 'x-component': 'VariableInput',
428
+ 'x-component-props': _objectSpread(_objectSpread({}, (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']) || {}), {}, {
429
+ collectionName: collectionField === null || collectionField === void 0 ? void 0 : collectionField.collectionName,
430
+ schema: collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema,
431
+ renderSchemaComponent: function Com(props) {
432
+ var s = _lodash.default.cloneDeep(fieldSchema) || {};
433
+ s.title = '';
434
+ return /*#__PURE__*/_react2.default.createElement(_core.SchemaComponent, {
435
+ schema: _objectSpread(_objectSpread({}, s || {}), {}, {
436
+ 'x-component-props': _objectSpread(_objectSpread({}, s['x-component-props']), {}, {
437
+ onChange: props.onChange,
438
+ value: props.value,
439
+ defaultValue: getFieldDefaultValue(s, collectionField),
440
+ style: {
441
+ width: '100%'
442
+ }
443
+ })
444
+ })
445
+ });
446
+ }
447
+ }),
448
+ name: 'default',
449
+ title: t('Default value'),
450
+ default: getFieldDefaultValue(fieldSchema, collectionField)
404
451
  })
405
452
  }
406
453
  },
407
454
  onSubmit: function onSubmit(v) {
408
455
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
409
456
  if (field.value !== v.default) {
410
- field.value = v.default;
457
+ field.value = (0, _uitls.parseVariables)(v.default, variablesCtx);
411
458
  }
412
459
  fieldSchema.default = v.default;
413
460
  schema.default = v.default;
@@ -421,7 +468,7 @@ FormItem.Designer = function () {
421
468
  options: fieldComponentOptions,
422
469
  value: fieldSchema['x-component'],
423
470
  onChange: function onChange(type) {
424
- var _collectionField$uiSc5, _interfaceConfig$sche;
471
+ var _collectionField$uiSc4, _interfaceConfig$sche;
425
472
  var schema = {
426
473
  name: collectionField === null || collectionField === void 0 ? void 0 : collectionField.name,
427
474
  type: 'void',
@@ -434,7 +481,7 @@ FormItem.Designer = function () {
434
481
  'x-validator': fieldSchema['x-validator'],
435
482
  'x-collection-field': fieldSchema['x-collection-field'],
436
483
  'x-decorator-props': fieldSchema['x-decorator-props'],
437
- 'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['x-component-props']), fieldSchema['x-component-props'])
484
+ 'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['x-component-props']), fieldSchema['x-component-props'])
438
485
  };
439
486
  interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
440
487
  field: collectionField,
@@ -454,9 +501,25 @@ FormItem.Designer = function () {
454
501
  }
455
502
  });
456
503
  }
504
+ }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && ['o2m', 'm2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && fieldSchema['x-component'] !== 'TableField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
505
+ key: "multiple",
506
+ title: t('Multiple'),
507
+ checked: ((_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.multiple) === undefined ? true : fieldSchema['x-component-props'].multiple,
508
+ onChange: function onChange(value) {
509
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
510
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
511
+ field.componentProps = field.componentProps || {};
512
+ fieldSchema['x-component-props'].multiple = value;
513
+ field.componentProps.multiple = value;
514
+ schema['x-component-props'] = fieldSchema['x-component-props'];
515
+ dn.emit('patch', {
516
+ schema: schema
517
+ });
518
+ refresh();
519
+ }
457
520
  }), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
458
521
  title: t('Enable link'),
459
- checked: ((_fieldSchema$xCompon3 = (_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.mode) !== null && _fieldSchema$xCompon3 !== void 0 ? _fieldSchema$xCompon3 : 'links') === 'links',
522
+ checked: ((_fieldSchema$xCompon4 = (_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : _fieldSchema$xCompon5.mode) !== null && _fieldSchema$xCompon4 !== void 0 ? _fieldSchema$xCompon4 : 'links') === 'links',
460
523
  onChange: function onChange(flag) {
461
524
  fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
462
525
  mode: flag ? 'links' : 'tags'
@@ -469,7 +532,7 @@ FormItem.Designer = function () {
469
532
  });
470
533
  dn.refresh();
471
534
  }
472
- }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) !== 'o2m' && (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : _fieldSchema$xCompon5['pattern-disable']) != true && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
535
+ }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) !== 'o2m' && !(0, _schemaSettings.isPatternDisabled)(fieldSchema) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
473
536
  key: "pattern",
474
537
  title: t('Pattern'),
475
538
  options: [{
@@ -527,9 +590,9 @@ FormItem.Designer = function () {
527
590
  options: options,
528
591
  value: field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.fieldNames) === null || _field$componentProps2 === void 0 ? void 0 : _field$componentProps2.label,
529
592
  onChange: function onChange(label) {
530
- var _collectionField$uiSc6, _collectionField$uiSc7;
593
+ var _collectionField$uiSc5, _collectionField$uiSc6;
531
594
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
532
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc6 = collectionField.uiSchema) === null || _collectionField$uiSc6 === void 0 ? void 0 : (_collectionField$uiSc7 = _collectionField$uiSc6['x-component-props']) === null || _collectionField$uiSc7 === void 0 ? void 0 : _collectionField$uiSc7['fieldNames']), field.componentProps.fieldNames), {}, {
595
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
533
596
  label: label
534
597
  });
535
598
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
@@ -554,4 +617,7 @@ FormItem.Designer = function () {
554
617
  function isFileCollection(collection) {
555
618
  return (collection === null || collection === void 0 ? void 0 : collection.template) === 'file';
556
619
  }
557
- FormItem.FilterFormDesigner = _FormItem.FilterFormDesigner;
620
+ FormItem.FilterFormDesigner = _FormItem.FilterFormDesigner;
621
+ function getFieldDefaultValue(fieldSchema, collectionField) {
622
+ return (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default) || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue);
623
+ }
@@ -464,7 +464,6 @@ var EditComponent = function EditComponent() {
464
464
  };
465
465
  exports.EditComponent = EditComponent;
466
466
  var EditPattern = function EditPattern() {
467
- var _fieldSchema$xCompon;
468
467
  var _useCollectionManager5 = (0, _collectionManager.useCollectionManager)(),
469
468
  getCollectionJoinField = _useCollectionManager5.getCollectionJoinField;
470
469
  var _useCollection5 = (0, _collectionManager.useCollection)(),
@@ -485,7 +484,7 @@ var EditPattern = function EditPattern() {
485
484
  if (fieldSchema['x-read-pretty'] === true) {
486
485
  readOnlyMode = 'read-pretty';
487
486
  }
488
- return form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) !== 'o2m' && (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['pattern-disable']) != true ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
487
+ return form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) !== 'o2m' && !(0, _schemaSettings.isPatternDisabled)(fieldSchema) ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
489
488
  key: "pattern",
490
489
  title: t('Pattern'),
491
490
  options: [{
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Templates = void 0;
7
7
  var _react = require("@formily/react");
8
+ var _client = require("@nocobase/utils/client");
8
9
  var _antd = require("antd");
9
10
  var _lodash = _interopRequireDefault(require("lodash"));
10
11
  var _react2 = _interopRequireWildcard(require("react"));
11
12
  var _reactI18next = require("react-i18next");
12
13
  var _apiClient = require("../../../api-client");
13
14
  var _blockProvider = require("../../../block-provider");
15
+ var _collectionManager = require("../../../collection-manager");
14
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -65,6 +67,8 @@ var Templates = function Templates(_ref) {
65
67
  display = _useDataTemplates.display,
66
68
  enabled = _useDataTemplates.enabled,
67
69
  defaultTemplate = _useDataTemplates.defaultTemplate;
70
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
71
+ getCollectionField = _useCollectionManager.getCollectionField;
68
72
  var _React$useState = _react2.default.useState((defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.key) || 'none'),
69
73
  _React$useState2 = _slicedToArray(_React$useState, 2),
70
74
  value = _React$useState2[0],
@@ -76,8 +80,14 @@ var Templates = function Templates(_ref) {
76
80
  if (defaultTemplate) {
77
81
  fetchTemplateData(api, defaultTemplate).then(function (data) {
78
82
  if (form) {
79
- form.values = data;
83
+ (0, _client.forEach)(data, function (value, key) {
84
+ if (value) {
85
+ form.values[key] = value;
86
+ }
87
+ });
80
88
  }
89
+ }).catch(function (err) {
90
+ console.error(err);
81
91
  });
82
92
  }
83
93
  }, []);
@@ -87,24 +97,20 @@ var Templates = function Templates(_ref) {
87
97
  while (1) switch (_context.prev = _context.next) {
88
98
  case 0:
89
99
  setValue(value);
90
- if (!(option.key !== 'none')) {
91
- _context.next = 8;
92
- break;
93
- }
94
- if (!form) {
95
- _context.next = 6;
96
- break;
100
+ if (option.key !== 'none') {
101
+ fetchTemplateData(api, option).then(function (data) {
102
+ if (form) {
103
+ (0, _client.forEach)(data, function (value, key) {
104
+ if (value) {
105
+ form.values[key] = value;
106
+ }
107
+ });
108
+ }
109
+ });
110
+ } else {
111
+ form === null || form === void 0 ? void 0 : form.reset();
97
112
  }
98
- _context.next = 5;
99
- return fetchTemplateData(api, option);
100
- case 5:
101
- form.values = _context.sent;
102
- case 6:
103
- _context.next = 9;
104
- break;
105
- case 8:
106
- form === null || form === void 0 ? void 0 : form.reset();
107
- case 9:
113
+ case 2:
108
114
  case "end":
109
115
  return _context.stop();
110
116
  }
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare type TopPartOfCalendarProps = {
3
3
  value: string;
4
4
  x1Line: number;
@@ -23,9 +23,9 @@ var TopPartOfCalendar = function TopPartOfCalendar(_ref) {
23
23
  x2: x1Line,
24
24
  y2: y2Line,
25
25
  className: (0, _css.cx)(_style.calendarTopTick),
26
- key: value + "line"
26
+ key: value + 'line'
27
27
  }), /*#__PURE__*/_react.default.createElement("text", {
28
- key: value + "text",
28
+ key: value + 'text',
29
29
  y: yText,
30
30
  x: xText,
31
31
  className: (0, _css.cx)(_style.calendarTopText)
@@ -7,7 +7,7 @@ exports.wrapper = exports.horizontalContainer = exports.ganttVerticalContainer =
7
7
  var _css = require("@emotion/css");
8
8
  var _templateObject, _templateObject2, _templateObject3;
9
9
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
10
- var ganttVerticalContainer = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n font-size: 0;\n margin: 0;\n padding: 0;\n width:100%;\n border-left: 2px solid #f4f2f2;\n"])));
10
+ var ganttVerticalContainer = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n font-size: 0;\n margin: 0;\n padding: 0;\n width: 100%;\n border-left: 2px solid #f4f2f2;\n"])));
11
11
  exports.ganttVerticalContainer = ganttVerticalContainer;
12
12
  var horizontalContainer = (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n overflow: hidden;\n"])));
13
13
  exports.horizontalContainer = horizontalContainer;
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import { GridBodyProps } from "./grid-body";
1
+ import React from 'react';
2
+ import { GridBodyProps } from './grid-body';
3
3
  export declare type GridProps = GridBodyProps;
4
4
  export declare const Grid: React.FC<GridProps>;
@@ -11,7 +11,7 @@ var gridRow = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplat
11
11
  exports.gridRow = gridRow;
12
12
  var gridHeightRow = (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n fill: #e6f7ff;\n border-color: rgba(0, 0, 0, 0.03);\n"])));
13
13
  exports.gridHeightRow = gridHeightRow;
14
- var gridRowLine = (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n stroke: #f0f0f0;\n stroke-width:0;\n border-bottom: 1px solid #f0f0f0;\n"])));
14
+ var gridRowLine = (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n stroke: #f0f0f0;\n stroke-width: 0;\n border-bottom: 1px solid #f0f0f0;\n"])));
15
15
  exports.gridRowLine = gridRowLine;
16
16
  var gridTick = (0, _css.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n stroke: #f0f0f0;\n"])));
17
17
  exports.gridTick = gridTick;
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { BarTask } from "../../types/bar-task";
1
+ import React from 'react';
2
+ import { BarTask } from '../../types/bar-task';
3
3
  declare type ArrowProps = {
4
4
  taskFrom: BarTask;
5
5
  taskTo: BarTask;
@@ -47,7 +47,7 @@ var drownPathAndTriangle = function drownPathAndTriangle(taskFrom, taskTo, rowHe
47
47
  var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
48
48
  var taskToEndPosition = taskTo.y + taskHeight / 2;
49
49
  var taskFromEndPosition = taskFrom.x2 + arrowIndent * 2;
50
- var taskFromHorizontalOffsetValue = taskFromEndPosition < taskTo.x1 ? "" : "H ".concat(taskTo.x1 - arrowIndent);
50
+ var taskFromHorizontalOffsetValue = taskFromEndPosition < taskTo.x1 ? '' : "H ".concat(taskTo.x1 - arrowIndent);
51
51
  var taskToHorizontalOffsetValue = taskFromEndPosition > taskTo.x1 ? arrowIndent : taskTo.x1 - taskFrom.x2 - arrowIndent;
52
52
  var path = "M ".concat(taskFrom.x2, " ").concat(taskFrom.y + taskHeight / 2, " \n h ").concat(arrowIndent, " \n v ").concat(indexCompare * rowHeight / 2, " \n ").concat(taskFromHorizontalOffsetValue, "\n V ").concat(taskToEndPosition, " \n h ").concat(taskToHorizontalOffsetValue);
53
53
  var trianglePoints = "".concat(taskTo.x1, ",").concat(taskToEndPosition, " \n ").concat(taskTo.x1 - 5, ",").concat(taskToEndPosition - 5, " \n ").concat(taskTo.x1 - 5, ",").concat(taskToEndPosition + 5);
@@ -57,7 +57,7 @@ var drownPathAndTriangleRTL = function drownPathAndTriangleRTL(taskFrom, taskTo,
57
57
  var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
58
58
  var taskToEndPosition = taskTo.y + taskHeight / 2;
59
59
  var taskFromEndPosition = taskFrom.x1 - arrowIndent * 2;
60
- var taskFromHorizontalOffsetValue = taskFromEndPosition > taskTo.x2 ? "" : "H ".concat(taskTo.x2 + arrowIndent);
60
+ var taskFromHorizontalOffsetValue = taskFromEndPosition > taskTo.x2 ? '' : "H ".concat(taskTo.x2 + arrowIndent);
61
61
  var taskToHorizontalOffsetValue = taskFromEndPosition < taskTo.x2 ? -arrowIndent : taskTo.x2 - taskFrom.x1 + arrowIndent;
62
62
  var path = "M ".concat(taskFrom.x1, " ").concat(taskFrom.y + taskHeight / 2, " \n h ").concat(-arrowIndent, " \n v ").concat(indexCompare * rowHeight / 2, " \n ").concat(taskFromHorizontalOffsetValue, "\n V ").concat(taskToEndPosition, " \n h ").concat(taskToHorizontalOffsetValue);
63
63
  var trianglePoints = "".concat(taskTo.x2, ",").concat(taskToEndPosition, " \n ").concat(taskTo.x2 + 5, ",").concat(taskToEndPosition + 5, " \n ").concat(taskTo.x2 + 5, ",").concat(taskToEndPosition - 5);
@@ -1,4 +1,4 @@
1
- import React, { SyntheticEvent } from "react";
1
+ import React, { SyntheticEvent } from 'react';
2
2
  export declare const HorizontalScroll: React.FC<{
3
3
  scroll: number;
4
4
  svgWidth: number;
@@ -7,7 +7,7 @@ exports.verticalScroll = exports.tooltipDetailsContainerHidden = exports.tooltip
7
7
  var _css = require("@emotion/css");
8
8
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
9
9
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
10
- var scrollWrapper = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: auto;\n position: absolute;\n bottom: -4px;\n max-width: 100%;\n /*firefox*/\n scrollbar-width: thin;\n /*iPad*/\n height: 1.2rem;\n &::-webkit-scrollbar {\n width: 1.1rem;\n height: 1.1rem;\n }\n &::-webkit-scrollbar-corner {\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n border: 5px solid transparent;\n background: #5c5858cc;\n border-radius: 10px;\n background-clip: padding-box;\n }\n &::-webkit-scrollbar-thumb:hover {\n border: 4px solid transparent;\n background: #5c5858bd;\n background-clip: padding-box;\n }\n"])));
10
+ var scrollWrapper = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: auto;\n position: absolute;\n bottom: -4px;\n max-width: 100%;\n /*firefox*/\n scrollbar-width: thin;\n /*iPad*/\n height: 1.2rem;\n &::-webkit-scrollbar {\n width: 1.1rem;\n height: 1.1rem;\n }\n &::-webkit-scrollbar-corner {\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n border: 5px solid transparent;\n background: #5c5858cc;\n border-radius: 10px;\n background-clip: padding-box;\n }\n &::-webkit-scrollbar-thumb:hover {\n border: 4px solid transparent;\n background: #5c5858bd;\n background-clip: padding-box;\n }\n"])));
11
11
  exports.scrollWrapper = scrollWrapper;
12
12
  var horizontalScroll = (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 1px;\n"])));
13
13
  exports.horizontalScroll = horizontalScroll;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare type BarDisplayProps = {
3
3
  x: number;
4
4
  y: number;
@@ -1,3 +1,3 @@
1
- import React from "react";
2
- import { TaskItemProps } from "../task-item";
1
+ import React from 'react';
2
+ import { TaskItemProps } from '../task-item';
3
3
  export declare const BarSmall: React.FC<TaskItemProps>;
@@ -32,14 +32,14 @@ var BarSmall = function BarSmall(_ref) {
32
32
  styles: task.styles,
33
33
  isSelected: isSelected,
34
34
  onMouseDown: function onMouseDown(e) {
35
- isDateChangeable && onEventStart("move", task, e);
35
+ isDateChangeable && onEventStart('move', task, e);
36
36
  }
37
37
  }), /*#__PURE__*/_react.default.createElement("g", {
38
38
  className: "handleGroup"
39
39
  }, isProgressChangeable && /*#__PURE__*/_react.default.createElement(_barProgressHandle.BarProgressHandle, {
40
40
  progressPoint: progressPoint,
41
41
  onMouseDown: function onMouseDown(e) {
42
- onEventStart("progress", task, e);
42
+ onEventStart('progress', task, e);
43
43
  }
44
44
  })));
45
45
  };
@@ -1,3 +1,3 @@
1
- import React from "react";
2
- import { TaskItemProps } from "../task-item";
1
+ import React from 'react';
2
+ import { TaskItemProps } from '../task-item';
3
3
  export declare const Bar: React.FC<TaskItemProps>;
@@ -36,7 +36,7 @@ var Bar = function Bar(_ref) {
36
36
  styles: task.styles,
37
37
  isSelected: isSelected,
38
38
  onMouseDown: function onMouseDown(e) {
39
- isDateChangeable && onEventStart("move", task, e);
39
+ isDateChangeable && onEventStart('move', task, e);
40
40
  }
41
41
  }), /*#__PURE__*/_react.default.createElement("g", {
42
42
  className: "handleGroup"
@@ -47,7 +47,7 @@ var Bar = function Bar(_ref) {
47
47
  height: handleHeight,
48
48
  barCornerRadius: task.barCornerRadius,
49
49
  onMouseDown: function onMouseDown(e) {
50
- onEventStart("start", task, e);
50
+ onEventStart('start', task, e);
51
51
  }
52
52
  }), /*#__PURE__*/_react.default.createElement(_barDateHandle.BarDateHandle, {
53
53
  x: task.x2 - task.handleWidth - 1,
@@ -56,12 +56,12 @@ var Bar = function Bar(_ref) {
56
56
  height: handleHeight,
57
57
  barCornerRadius: task.barCornerRadius,
58
58
  onMouseDown: function onMouseDown(e) {
59
- onEventStart("end", task, e);
59
+ onEventStart('end', task, e);
60
60
  }
61
61
  })), isProgressChangeable && /*#__PURE__*/_react.default.createElement(_barProgressHandle.BarProgressHandle, {
62
62
  progressPoint: progressPoint,
63
63
  onMouseDown: function onMouseDown(e) {
64
- onEventStart("progress", task, e);
64
+ onEventStart('progress', task, e);
65
65
  }
66
66
  })));
67
67
  };
@@ -7,7 +7,7 @@ exports.barWrapper = exports.barBackground = void 0;
7
7
  var _css = require("@emotion/css");
8
8
  var _templateObject, _templateObject2;
9
9
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
10
- var barWrapper = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n outline: none;\n .barHandle{\n fill: #ddd;\n cursor: ew-resize;\n opacity: 0;\n visibility: hidden;\n }\n &:hover .barHandle {\n visibility: visible;\n opacity: 1;\n }\n"])));
10
+ var barWrapper = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n outline: none;\n .barHandle {\n fill: #ddd;\n cursor: ew-resize;\n opacity: 0;\n visibility: hidden;\n }\n &:hover .barHandle {\n visibility: visible;\n opacity: 1;\n }\n"])));
11
11
  exports.barWrapper = barWrapper;
12
- var barBackground = (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n user-select: none;\n stroke-width: 0;\n opacity: .6;\n"])));
12
+ var barBackground = (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n user-select: none;\n stroke-width: 0;\n opacity: 0.6;\n"])));
13
13
  exports.barBackground = barBackground;
@@ -1,3 +1,3 @@
1
- import React from "react";
2
- import { TaskItemProps } from "../task-item";
1
+ import React from 'react';
2
+ import { TaskItemProps } from '../task-item';
3
3
  export declare const Milestone: React.FC<TaskItemProps>;
@@ -31,7 +31,7 @@ var Milestone = function Milestone(_ref) {
31
31
  transform: transform,
32
32
  className: (0, _css.cx)(_style.milestoneBackground),
33
33
  onMouseDown: function onMouseDown(e) {
34
- isDateChangeable && onEventStart("move", task, e);
34
+ isDateChangeable && onEventStart('move', task, e);
35
35
  }
36
36
  }));
37
37
  };
@@ -1,4 +1,4 @@
1
- import { Task, TaskType } from "./public-types";
1
+ import { Task, TaskType } from './public-types';
2
2
  export interface BarTask extends Task {
3
3
  index: number;
4
4
  typeInternal: TaskTypeInternal;
@@ -19,4 +19,4 @@ export interface BarTask extends Task {
19
19
  progressSelectedColor: string;
20
20
  };
21
21
  }
22
- export declare type TaskTypeInternal = TaskType | "smalltask";
22
+ export declare type TaskTypeInternal = TaskType | 'smalltask';
@@ -1,4 +1,4 @@
1
- import { ViewMode } from "./public-types";
1
+ import { ViewMode } from './public-types';
2
2
  export interface DateSetup {
3
3
  dates: Date[];
4
4
  viewMode: ViewMode;
@@ -1,6 +1,6 @@
1
- import { BarTask } from "./bar-task";
2
- export declare type BarMoveAction = "progress" | "end" | "start" | "move";
3
- export declare type GanttContentMoveAction = "mouseenter" | "mouseleave" | "delete" | "dblclick" | "click" | "select" | "" | BarMoveAction;
1
+ import { BarTask } from './bar-task';
2
+ export declare type BarMoveAction = 'progress' | 'end' | 'start' | 'move';
3
+ export declare type GanttContentMoveAction = 'mouseenter' | 'mouseleave' | 'delete' | 'dblclick' | 'click' | 'select' | '' | BarMoveAction;
4
4
  export declare type GanttEvent = {
5
5
  changedTask?: BarTask;
6
6
  originalSelectedTask?: BarTask;
@@ -10,7 +10,7 @@ export declare enum ViewMode {
10
10
  QuarterYear = "quarterYear",
11
11
  Year = "year"
12
12
  }
13
- export declare type TaskType = "task" | "milestone" | "project";
13
+ export declare type TaskType = 'task' | 'milestone' | 'project';
14
14
  export interface Task {
15
15
  id: string;
16
16
  type: TaskType;