@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/es/acl/ACLProvider.js +7 -8
  2. package/es/api-client/APIClient.js +6 -0
  3. package/es/block-provider/BlockProvider.js +9 -6
  4. package/es/block-provider/FormBlockProvider.js +18 -9
  5. package/es/block-provider/KanbanBlockProvider.js +1 -1
  6. package/es/block-provider/SharedFilterProvider.js +9 -1
  7. package/es/block-provider/TableBlockProvider.js +1 -1
  8. package/es/block-provider/TableSelectorProvider.js +2 -2
  9. package/es/block-provider/hooks/index.js +22 -7
  10. package/es/collection-manager/CollectionManagerProvider.d.ts +1 -0
  11. package/es/collection-manager/CollectionManagerProvider.js +71 -9
  12. package/es/collection-manager/CollectionManagerShortcut.js +36 -23
  13. package/es/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  14. package/es/collection-manager/Configuration/AddCategoryAction.js +117 -0
  15. package/es/collection-manager/Configuration/AddCollectionAction.js +8 -3
  16. package/es/collection-manager/Configuration/AddFieldAction.js +1 -0
  17. package/es/collection-manager/Configuration/ConfigurationTable.js +33 -4
  18. package/es/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  19. package/es/collection-manager/Configuration/ConfigurationTabs.js +381 -0
  20. package/es/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  21. package/es/collection-manager/Configuration/EditCategoryAction.js +150 -0
  22. package/es/collection-manager/Configuration/EditCollectionAction.js +6 -2
  23. package/es/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  24. package/es/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  25. package/es/collection-manager/Configuration/components/CollectionCategory.js +13 -0
  26. package/es/collection-manager/Configuration/index.d.ts +3 -0
  27. package/es/collection-manager/Configuration/index.js +3 -0
  28. package/es/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  29. package/es/collection-manager/Configuration/schemas/collections.js +309 -176
  30. package/es/collection-manager/Configuration/templates.d.ts +1 -0
  31. package/es/collection-manager/Configuration/templates.js +1 -1
  32. package/es/collection-manager/action-hooks.d.ts +4 -0
  33. package/es/collection-manager/action-hooks.js +26 -12
  34. package/es/collection-manager/context.d.ts +4 -0
  35. package/es/collection-manager/context.js +5 -1
  36. package/es/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  37. package/es/collection-manager/hooks/useCollectionManager.js +52 -7
  38. package/es/collection-manager/interfaces/m2m.js +2 -2
  39. package/es/collection-manager/interfaces/properties/index.d.ts +0 -56
  40. package/es/collection-manager/interfaces/properties/index.js +1 -2
  41. package/es/collection-manager/templates/calendar.js +1 -1
  42. package/es/collection-manager/templates/general.js +1 -1
  43. package/es/collection-manager/templates/properties/index.d.ts +12 -1
  44. package/es/collection-manager/templates/properties/index.js +11 -0
  45. package/es/i18n/i18n.js +3 -1
  46. package/es/locale/en_US.d.ts +23 -0
  47. package/es/locale/en_US.js +23 -0
  48. package/es/locale/ja_JP.d.ts +23 -0
  49. package/es/locale/ja_JP.js +24 -1
  50. package/es/locale/ru_RU.d.ts +1 -0
  51. package/es/locale/ru_RU.js +1 -0
  52. package/es/locale/zh_CN.d.ts +43 -4
  53. package/es/locale/zh_CN.js +44 -5
  54. package/es/route-switch/antd/admin-layout/index.js +13 -33
  55. package/es/schema-component/antd/action/Action.Designer.js +28 -15
  56. package/es/schema-component/antd/action/Action.js +28 -5
  57. package/es/schema-component/antd/action/utils.d.ts +1 -0
  58. package/es/schema-component/antd/action/utils.js +49 -0
  59. package/es/schema-component/antd/association-filter/AssociationFilter.js +4 -4
  60. package/es/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  61. package/es/schema-component/antd/association-select/useServiceOptions.js +47 -6
  62. package/es/schema-component/antd/calendar/Calendar.Designer.js +17 -36
  63. package/es/schema-component/antd/checkbox/Checkbox.js +9 -8
  64. package/es/schema-component/antd/date-picker/util.d.ts +1 -1
  65. package/es/schema-component/antd/date-picker/util.js +1 -1
  66. package/es/schema-component/antd/filter/DynamicComponent.js +3 -1
  67. package/es/schema-component/antd/filter/Filter.js +2 -1
  68. package/es/schema-component/antd/filter/FilterGroup.js +7 -4
  69. package/es/schema-component/antd/filter/FilterItem.js +3 -2
  70. package/es/schema-component/antd/filter/context.d.ts +1 -0
  71. package/es/schema-component/antd/filter/useValues.js +14 -11
  72. package/es/schema-component/antd/form/Form.js +11 -5
  73. package/es/schema-component/antd/form-item/FormItem.js +17 -8
  74. package/es/schema-component/antd/form-v2/Form.Designer.js +2 -0
  75. package/es/schema-component/antd/form-v2/Form.js +94 -7
  76. package/es/schema-component/antd/form-v2/utils.d.ts +5 -0
  77. package/es/schema-component/antd/form-v2/utils.js +161 -0
  78. package/es/schema-component/antd/g2plot/G2Plot.js +3 -1
  79. package/es/schema-component/antd/grid/Grid.js +10 -5
  80. package/es/schema-component/antd/icon-picker/IconPicker.js +1 -0
  81. package/es/schema-component/antd/index.d.ts +1 -0
  82. package/es/schema-component/antd/index.js +1 -0
  83. package/es/schema-component/antd/input/Input.d.ts +2 -1
  84. package/es/schema-component/antd/input/Json.d.ts +5 -3
  85. package/es/schema-component/antd/input/Json.js +3 -2
  86. package/es/schema-component/antd/input/ReadPretty.js +1 -1
  87. package/es/schema-component/antd/input-number/InputNumber.js +3 -1
  88. package/es/schema-component/antd/page/FixedBlock.js +3 -1
  89. package/es/schema-component/antd/page/Page.js +11 -5
  90. package/es/schema-component/antd/page/PageTabDesigner.js +3 -3
  91. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  92. package/es/schema-component/antd/record-picker/RecordPicker.js +1 -2
  93. package/es/schema-component/antd/record-picker/util.js +7 -0
  94. package/es/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  95. package/es/schema-component/antd/remote-select/RemoteSelect.js +78 -36
  96. package/es/schema-component/antd/rich-text/RichText.js +4 -2
  97. package/es/schema-component/antd/select/Select.js +14 -4
  98. package/es/schema-component/antd/table/Table.Array.js +10 -3
  99. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  100. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  101. package/es/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  102. package/es/schema-component/antd/tabs/Tabs.js +1 -0
  103. package/es/schema-component/antd/time-picker/TimePicker.js +1 -1
  104. package/es/schema-component/antd/variable/Input.d.ts +2 -0
  105. package/es/schema-component/antd/variable/Input.js +244 -0
  106. package/es/schema-component/antd/variable/JSONInput.d.ts +2 -0
  107. package/es/schema-component/antd/variable/JSONInput.js +82 -0
  108. package/es/schema-component/antd/variable/TextArea.d.ts +2 -0
  109. package/es/schema-component/antd/variable/TextArea.js +322 -0
  110. package/es/schema-component/antd/variable/Variable.d.ts +8 -0
  111. package/es/schema-component/antd/variable/Variable.js +11 -0
  112. package/es/schema-component/antd/variable/index.d.ts +1 -0
  113. package/es/schema-component/antd/variable/index.js +1 -0
  114. package/es/schema-component/common/sortable-item/SortableItem.js +36 -6
  115. package/es/schema-component/common/utils/logic.js +523 -0
  116. package/es/schema-component/common/utils/uitls.d.ts +1 -0
  117. package/es/schema-component/common/utils/uitls.js +89 -0
  118. package/es/schema-initializer/SchemaInitializer.js +9 -4
  119. package/es/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
  120. package/es/schema-initializer/buttons/BlockInitializers.js +1 -102
  121. package/es/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
  122. package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  123. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
  124. package/es/schema-initializer/components/CreateRecordAction.d.ts +3 -0
  125. package/es/schema-initializer/components/CreateRecordAction.js +174 -0
  126. package/es/schema-initializer/components/index.d.ts +1 -0
  127. package/es/schema-initializer/components/index.js +2 -1
  128. package/es/schema-initializer/index.d.ts +2 -1
  129. package/es/schema-initializer/index.js +2 -1
  130. package/es/schema-initializer/items/CalendarBlockInitializer.js +24 -41
  131. package/es/schema-initializer/items/CreateActionInitializer.js +3 -3
  132. package/es/schema-initializer/items/RecordFormBlockInitializer.js +9 -9
  133. package/es/schema-initializer/items/index.d.ts +4 -4
  134. package/es/schema-initializer/items/index.js +6 -6
  135. package/es/schema-initializer/utils.js +22 -7
  136. package/es/schema-settings/EnableChildCollections/index.d.ts +2 -0
  137. package/es/schema-settings/EnableChildCollections/index.js +141 -0
  138. package/es/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  139. package/es/schema-settings/LinkageRules/DynamicComponent.js +113 -0
  140. package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  141. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +15 -0
  142. package/es/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  143. package/es/schema-settings/LinkageRules/LinkageRuleAction.js +162 -0
  144. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  145. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.js +71 -0
  146. package/es/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  147. package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +82 -0
  148. package/es/schema-settings/LinkageRules/Variables.d.ts +7 -0
  149. package/es/schema-settings/LinkageRules/Variables.js +115 -0
  150. package/es/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  151. package/es/schema-settings/LinkageRules/action-hooks.js +115 -0
  152. package/es/schema-settings/LinkageRules/context.d.ts +13 -0
  153. package/es/schema-settings/LinkageRules/context.js +4 -0
  154. package/es/schema-settings/LinkageRules/index.d.ts +2 -0
  155. package/es/schema-settings/LinkageRules/index.js +132 -0
  156. package/es/schema-settings/LinkageRules/type.d.ts +13 -0
  157. package/es/schema-settings/LinkageRules/type.js +15 -0
  158. package/es/schema-settings/LinkageRules/useValues.d.ts +1 -0
  159. package/es/schema-settings/LinkageRules/useValues.js +84 -0
  160. package/es/schema-settings/SchemaSettings.d.ts +4 -1
  161. package/es/schema-settings/SchemaSettings.js +219 -26
  162. package/es/schema-templates/BlockTemplate.js +9 -1
  163. package/es/system-settings/SystemSettingsShortcut.js +1 -1
  164. package/lib/acl/ACLProvider.js +7 -8
  165. package/lib/api-client/APIClient.js +6 -0
  166. package/lib/block-provider/BlockProvider.js +9 -6
  167. package/lib/block-provider/FormBlockProvider.js +17 -8
  168. package/lib/block-provider/KanbanBlockProvider.js +1 -1
  169. package/lib/block-provider/SharedFilterProvider.js +9 -3
  170. package/lib/block-provider/TableBlockProvider.js +1 -1
  171. package/lib/block-provider/TableSelectorProvider.js +2 -2
  172. package/lib/block-provider/hooks/index.js +23 -7
  173. package/lib/collection-manager/CollectionManagerProvider.d.ts +1 -0
  174. package/lib/collection-manager/CollectionManagerProvider.js +81 -16
  175. package/lib/collection-manager/CollectionManagerShortcut.js +36 -23
  176. package/lib/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  177. package/lib/collection-manager/Configuration/AddCategoryAction.js +145 -0
  178. package/lib/collection-manager/Configuration/AddCollectionAction.js +8 -3
  179. package/lib/collection-manager/Configuration/AddFieldAction.js +1 -0
  180. package/lib/collection-manager/Configuration/ConfigurationTable.js +34 -4
  181. package/lib/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  182. package/lib/collection-manager/Configuration/ConfigurationTabs.js +407 -0
  183. package/lib/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  184. package/lib/collection-manager/Configuration/EditCategoryAction.js +178 -0
  185. package/lib/collection-manager/Configuration/EditCollectionAction.js +6 -2
  186. package/lib/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  187. package/lib/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  188. package/lib/collection-manager/Configuration/components/CollectionCategory.js +27 -0
  189. package/lib/collection-manager/Configuration/index.d.ts +3 -0
  190. package/lib/collection-manager/Configuration/index.js +39 -0
  191. package/lib/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  192. package/lib/collection-manager/Configuration/schemas/collections.js +316 -178
  193. package/lib/collection-manager/Configuration/templates.d.ts +1 -0
  194. package/lib/collection-manager/Configuration/templates.js +2 -0
  195. package/lib/collection-manager/action-hooks.d.ts +4 -0
  196. package/lib/collection-manager/action-hooks.js +30 -13
  197. package/lib/collection-manager/context.d.ts +4 -0
  198. package/lib/collection-manager/context.js +7 -2
  199. package/lib/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  200. package/lib/collection-manager/hooks/useCollectionManager.js +52 -6
  201. package/lib/collection-manager/interfaces/m2m.js +2 -2
  202. package/lib/collection-manager/interfaces/properties/index.d.ts +0 -56
  203. package/lib/collection-manager/interfaces/properties/index.js +1 -2
  204. package/lib/collection-manager/templates/calendar.js +1 -1
  205. package/lib/collection-manager/templates/general.js +1 -1
  206. package/lib/collection-manager/templates/properties/index.d.ts +12 -1
  207. package/lib/collection-manager/templates/properties/index.js +11 -0
  208. package/lib/i18n/i18n.js +3 -1
  209. package/lib/locale/en_US.d.ts +23 -0
  210. package/lib/locale/en_US.js +23 -0
  211. package/lib/locale/ja_JP.d.ts +23 -0
  212. package/lib/locale/ja_JP.js +24 -1
  213. package/lib/locale/ru_RU.d.ts +1 -0
  214. package/lib/locale/ru_RU.js +1 -0
  215. package/lib/locale/zh_CN.d.ts +43 -4
  216. package/lib/locale/zh_CN.js +44 -5
  217. package/lib/route-switch/antd/admin-layout/index.js +13 -33
  218. package/lib/schema-component/antd/action/Action.Designer.js +30 -14
  219. package/lib/schema-component/antd/action/Action.js +29 -3
  220. package/lib/schema-component/antd/action/utils.d.ts +1 -0
  221. package/lib/schema-component/antd/action/utils.js +58 -2
  222. package/lib/schema-component/antd/association-filter/AssociationFilter.js +3 -3
  223. package/lib/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  224. package/lib/schema-component/antd/association-select/useServiceOptions.js +47 -4
  225. package/lib/schema-component/antd/calendar/Calendar.Designer.js +15 -33
  226. package/lib/schema-component/antd/checkbox/Checkbox.js +8 -7
  227. package/lib/schema-component/antd/date-picker/util.d.ts +1 -1
  228. package/lib/schema-component/antd/date-picker/util.js +1 -1
  229. package/lib/schema-component/antd/filter/DynamicComponent.js +3 -1
  230. package/lib/schema-component/antd/filter/Filter.js +2 -1
  231. package/lib/schema-component/antd/filter/FilterGroup.js +7 -4
  232. package/lib/schema-component/antd/filter/FilterItem.js +3 -2
  233. package/lib/schema-component/antd/filter/context.d.ts +1 -0
  234. package/lib/schema-component/antd/filter/useValues.js +15 -11
  235. package/lib/schema-component/antd/form/Form.js +9 -3
  236. package/lib/schema-component/antd/form-item/FormItem.js +21 -7
  237. package/lib/schema-component/antd/form-v2/Form.Designer.js +2 -0
  238. package/lib/schema-component/antd/form-v2/Form.js +93 -5
  239. package/lib/schema-component/antd/form-v2/utils.d.ts +5 -0
  240. package/lib/schema-component/antd/form-v2/utils.js +181 -0
  241. package/lib/schema-component/antd/g2plot/G2Plot.js +3 -1
  242. package/lib/schema-component/antd/grid/Grid.js +10 -5
  243. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -0
  244. package/lib/schema-component/antd/index.d.ts +1 -0
  245. package/lib/schema-component/antd/index.js +13 -0
  246. package/lib/schema-component/antd/input/Input.d.ts +2 -1
  247. package/lib/schema-component/antd/input/Json.d.ts +5 -3
  248. package/lib/schema-component/antd/input/Json.js +6 -3
  249. package/lib/schema-component/antd/input/ReadPretty.js +1 -1
  250. package/lib/schema-component/antd/input-number/InputNumber.js +2 -0
  251. package/lib/schema-component/antd/page/FixedBlock.js +3 -1
  252. package/lib/schema-component/antd/page/Page.js +14 -5
  253. package/lib/schema-component/antd/page/PageTabDesigner.js +1 -1
  254. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  255. package/lib/schema-component/antd/record-picker/RecordPicker.js +1 -2
  256. package/lib/schema-component/antd/record-picker/util.js +7 -0
  257. package/lib/schema-component/antd/remote-select/RemoteSelect.d.ts +2 -0
  258. package/lib/schema-component/antd/remote-select/RemoteSelect.js +78 -37
  259. package/lib/schema-component/antd/rich-text/RichText.js +4 -2
  260. package/lib/schema-component/antd/select/Select.js +14 -4
  261. package/lib/schema-component/antd/table/Table.Array.js +8 -1
  262. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  263. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  264. package/lib/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  265. package/lib/schema-component/antd/tabs/Tabs.js +1 -0
  266. package/lib/schema-component/antd/time-picker/TimePicker.js +1 -1
  267. package/lib/schema-component/antd/variable/Input.d.ts +2 -0
  268. package/lib/schema-component/antd/variable/Input.js +262 -0
  269. package/lib/schema-component/antd/variable/JSONInput.d.ts +2 -0
  270. package/lib/schema-component/antd/variable/JSONInput.js +100 -0
  271. package/lib/schema-component/antd/variable/TextArea.d.ts +2 -0
  272. package/lib/schema-component/antd/variable/TextArea.js +341 -0
  273. package/lib/schema-component/antd/variable/Variable.d.ts +8 -0
  274. package/lib/schema-component/antd/variable/Variable.js +25 -0
  275. package/lib/schema-component/antd/variable/index.d.ts +1 -0
  276. package/lib/schema-component/antd/variable/index.js +18 -0
  277. package/lib/schema-component/common/sortable-item/SortableItem.js +36 -6
  278. package/lib/schema-component/common/utils/logic.js +525 -0
  279. package/lib/schema-component/common/utils/uitls.d.ts +1 -0
  280. package/lib/schema-component/common/utils/uitls.js +103 -0
  281. package/lib/schema-initializer/SchemaInitializer.js +9 -4
  282. package/lib/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
  283. package/lib/schema-initializer/buttons/BlockInitializers.js +0 -108
  284. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
  285. package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  286. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
  287. package/lib/schema-initializer/components/CreateRecordAction.d.ts +3 -0
  288. package/lib/schema-initializer/components/CreateRecordAction.js +199 -0
  289. package/lib/schema-initializer/components/index.d.ts +1 -0
  290. package/lib/schema-initializer/components/index.js +13 -0
  291. package/lib/schema-initializer/index.d.ts +2 -1
  292. package/lib/schema-initializer/index.js +51 -2
  293. package/lib/schema-initializer/items/CalendarBlockInitializer.js +16 -33
  294. package/lib/schema-initializer/items/CreateActionInitializer.js +3 -3
  295. package/lib/schema-initializer/items/RecordFormBlockInitializer.js +3 -3
  296. package/lib/schema-initializer/items/index.d.ts +4 -4
  297. package/lib/schema-initializer/items/index.js +52 -52
  298. package/lib/schema-initializer/utils.js +22 -6
  299. package/lib/schema-settings/EnableChildCollections/index.d.ts +2 -0
  300. package/lib/schema-settings/EnableChildCollections/index.js +156 -0
  301. package/lib/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  302. package/lib/schema-settings/LinkageRules/DynamicComponent.js +139 -0
  303. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  304. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +27 -0
  305. package/lib/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  306. package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +190 -0
  307. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  308. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.js +90 -0
  309. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  310. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +104 -0
  311. package/lib/schema-settings/LinkageRules/Variables.d.ts +7 -0
  312. package/lib/schema-settings/LinkageRules/Variables.js +124 -0
  313. package/lib/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  314. package/lib/schema-settings/LinkageRules/action-hooks.js +127 -0
  315. package/lib/schema-settings/LinkageRules/context.d.ts +13 -0
  316. package/lib/schema-settings/LinkageRules/context.js +15 -0
  317. package/lib/schema-settings/LinkageRules/index.d.ts +2 -0
  318. package/lib/schema-settings/LinkageRules/index.js +149 -0
  319. package/lib/schema-settings/LinkageRules/type.d.ts +13 -0
  320. package/lib/schema-settings/LinkageRules/type.js +22 -0
  321. package/lib/schema-settings/LinkageRules/useValues.d.ts +1 -0
  322. package/lib/schema-settings/LinkageRules/useValues.js +95 -0
  323. package/lib/schema-settings/SchemaSettings.d.ts +4 -1
  324. package/lib/schema-settings/SchemaSettings.js +243 -48
  325. package/lib/schema-templates/BlockTemplate.js +9 -1
  326. package/lib/system-settings/SystemSettingsShortcut.js +1 -1
  327. package/package.json +4 -4
@@ -0,0 +1,322 @@
1
+ var _templateObject, _templateObject2, _templateObject3;
2
+
3
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
4
+
5
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
+
7
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+
9
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
+
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+
13
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
+
15
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
+
17
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
+
19
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
+
21
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
22
+
23
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
24
+
25
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
26
+
27
+ import React, { useState, useEffect, useRef, useMemo } from 'react';
28
+ import { Input, Cascader, Tooltip, Button } from 'antd';
29
+ import { useForm } from '@formily/react';
30
+ import { cx, css } from '@emotion/css';
31
+ import { useTranslation } from 'react-i18next';
32
+ import { useCompile } from '../..';
33
+ var VARIABLE_RE = /{{\s*([^{}]+)\s*}}/g;
34
+
35
+ function pasteHtml(container, html, _ref) {
36
+ var _window$getSelection, _window;
37
+
38
+ var _ref$selectPastedCont = _ref.selectPastedContent,
39
+ selectPastedContent = _ref$selectPastedCont === void 0 ? false : _ref$selectPastedCont,
40
+ indexes = _ref.range;
41
+ // IE9 and non-IE
42
+ var sel = (_window$getSelection = (_window = window).getSelection) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.call(_window);
43
+
44
+ if (!(sel === null || sel === void 0 ? void 0 : sel.getRangeAt) || !sel.rangeCount) {
45
+ return;
46
+ }
47
+
48
+ var range = sel.getRangeAt(0);
49
+
50
+ if (!range) {
51
+ return;
52
+ }
53
+
54
+ var children = Array.from(container.childNodes);
55
+
56
+ if (indexes[0] === -1) {
57
+ if (indexes[1]) {
58
+ range.setStartAfter(children[indexes[1] - 1]);
59
+ }
60
+ } else {
61
+ range.setStart(children[indexes[0]], indexes[1]);
62
+ }
63
+
64
+ if (indexes[2] === -1) {
65
+ if (indexes[3]) {
66
+ range.setEndAfter(children[indexes[3] - 1]);
67
+ }
68
+ } else {
69
+ range.setEnd(children[indexes[2]], indexes[3]);
70
+ }
71
+
72
+ range.deleteContents(); // Range.createContextualFragment() would be useful here but is
73
+ // only relatively recently standardized and is not supported in
74
+ // some browsers (IE9, for one)
75
+
76
+ var el = document.createElement('div');
77
+ el.innerHTML = html;
78
+ var frag = document.createDocumentFragment();
79
+ var lastNode;
80
+
81
+ while (el.firstChild) {
82
+ lastNode = frag.appendChild(el.firstChild);
83
+ }
84
+
85
+ var firstChild = frag.firstChild;
86
+ range.insertNode(frag); // Preserve the selection
87
+
88
+ if (lastNode) {
89
+ var next = range.cloneRange();
90
+ next.setStartAfter(lastNode);
91
+
92
+ if (selectPastedContent) {
93
+ if (firstChild) {
94
+ next.setStartBefore(firstChild);
95
+ }
96
+ } else {
97
+ next.collapse(true);
98
+ }
99
+
100
+ sel.removeAllRanges();
101
+ sel.addRange(next);
102
+ }
103
+ }
104
+
105
+ function getValue(el) {
106
+ var values = [];
107
+
108
+ var _iterator = _createForOfIteratorHelper(el.childNodes),
109
+ _step;
110
+
111
+ try {
112
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
113
+ var node = _step.value;
114
+
115
+ if (node.nodeName === 'SPAN') {
116
+ values.push("{{".concat(node['dataset']['key'], "}}"));
117
+ } else {
118
+ var _node$textContent, _node$textContent$tri;
119
+
120
+ values.push((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : (_node$textContent$tri = _node$textContent.trim) === null || _node$textContent$tri === void 0 ? void 0 : _node$textContent$tri.call(_node$textContent));
121
+ }
122
+ }
123
+ } catch (err) {
124
+ _iterator.e(err);
125
+ } finally {
126
+ _iterator.f();
127
+ }
128
+
129
+ return values.join(' ').replace(/\s+/g, ' ').trim();
130
+ }
131
+
132
+ function renderHTML(exp, keyLabelMap) {
133
+ return exp.replace(VARIABLE_RE, function (_, i) {
134
+ var _createVariableTagHTM;
135
+
136
+ var key = i.trim();
137
+ return (_createVariableTagHTM = createVariableTagHTML(key, keyLabelMap)) !== null && _createVariableTagHTM !== void 0 ? _createVariableTagHTM : '';
138
+ });
139
+ }
140
+
141
+ function createOptionsValueLabelMap(options) {
142
+ var map = new Map();
143
+
144
+ var _iterator2 = _createForOfIteratorHelper(options),
145
+ _step2;
146
+
147
+ try {
148
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
149
+ var option = _step2.value;
150
+ map.set(option.value, [option.label]);
151
+
152
+ if (option.children) {
153
+ var _iterator3 = _createForOfIteratorHelper(createOptionsValueLabelMap(option.children)),
154
+ _step3;
155
+
156
+ try {
157
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
158
+ var _step3$value = _slicedToArray(_step3.value, 2),
159
+ value = _step3$value[0],
160
+ labels = _step3$value[1];
161
+
162
+ map.set("".concat(option.value, ".").concat(value), [option.label].concat(_toConsumableArray(labels)));
163
+ }
164
+ } catch (err) {
165
+ _iterator3.e(err);
166
+ } finally {
167
+ _iterator3.f();
168
+ }
169
+ }
170
+ }
171
+ } catch (err) {
172
+ _iterator2.e(err);
173
+ } finally {
174
+ _iterator2.f();
175
+ }
176
+
177
+ return map;
178
+ }
179
+
180
+ function createVariableTagHTML(variable, keyLabelMap) {
181
+ var labels = keyLabelMap.get(variable);
182
+ return "<span class=\"ant-tag ant-tag-blue\" contentEditable=\"false\" data-key=\"".concat(variable, "\">").concat(labels === null || labels === void 0 ? void 0 : labels.join(' / '), "</span>");
183
+ }
184
+
185
+ export function TextArea(props) {
186
+ var _ref2;
187
+
188
+ var _props$value = props.value,
189
+ value = _props$value === void 0 ? '' : _props$value,
190
+ scope = props.scope,
191
+ onChange = props.onChange,
192
+ _props$multiline = props.multiline,
193
+ multiline = _props$multiline === void 0 ? true : _props$multiline,
194
+ button = props.button;
195
+ var compile = useCompile();
196
+
197
+ var _useTranslation = useTranslation(),
198
+ t = _useTranslation.t;
199
+
200
+ var inputRef = useRef(null);
201
+ var options = compile((_ref2 = typeof scope === 'function' ? scope() : scope) !== null && _ref2 !== void 0 ? _ref2 : []);
202
+ var form = useForm();
203
+ var keyLabelMap = useMemo(function () {
204
+ return createOptionsValueLabelMap(options);
205
+ }, [scope]);
206
+
207
+ var _useState = useState(false),
208
+ _useState2 = _slicedToArray(_useState, 2),
209
+ changed = _useState2[0],
210
+ setChanged = _useState2[1];
211
+
212
+ var _useState3 = useState(function () {
213
+ return renderHTML(value !== null && value !== void 0 ? value : '', keyLabelMap);
214
+ }),
215
+ _useState4 = _slicedToArray(_useState3, 2),
216
+ html = _useState4[0],
217
+ setHtml = _useState4[1]; // [startElementIndex, startOffset, endElementIndex, endOffset]
218
+
219
+
220
+ var _useState5 = useState([-1, 0, -1, 0]),
221
+ _useState6 = _slicedToArray(_useState5, 2),
222
+ range = _useState6[0],
223
+ setRange = _useState6[1];
224
+
225
+ useEffect(function () {
226
+ if (changed) {
227
+ return;
228
+ }
229
+
230
+ setHtml(renderHTML(value !== null && value !== void 0 ? value : '', keyLabelMap));
231
+ }, [value]);
232
+ useEffect(function () {
233
+ var current = inputRef.current;
234
+
235
+ if (!current || changed) {
236
+ return;
237
+ }
238
+
239
+ var nextRange = new Range();
240
+ var lastChild = current.lastChild;
241
+
242
+ if (lastChild) {
243
+ nextRange.setStartAfter(lastChild);
244
+ nextRange.setEndAfter(lastChild);
245
+ var nodes = Array.from(current.childNodes);
246
+ var startElementIndex = nextRange.startContainer === current ? -1 : nodes.indexOf(lastChild);
247
+ var endElementIndex = nextRange.startContainer === current ? -1 : nodes.indexOf(lastChild);
248
+ setRange([startElementIndex, nextRange.startOffset, endElementIndex, nextRange.endOffset]);
249
+ }
250
+ }, [html]);
251
+
252
+ function onInsert(keyPath) {
253
+ var variable = keyPath.filter(function (key) {
254
+ return Boolean(key.trim());
255
+ });
256
+ var current = inputRef.current;
257
+
258
+ if (!current || !variable) {
259
+ return;
260
+ }
261
+
262
+ current.focus();
263
+ pasteHtml(current, createVariableTagHTML(variable.join('.'), keyLabelMap), {
264
+ range: range
265
+ });
266
+ setChanged(true);
267
+ onChange(getValue(current));
268
+ }
269
+
270
+ function onInput(_ref3) {
271
+ var currentTarget = _ref3.currentTarget;
272
+ setChanged(true);
273
+ onChange(getValue(currentTarget));
274
+ }
275
+
276
+ function onBlur(_ref4) {
277
+ var _window$getSelection2, _window2;
278
+
279
+ var currentTarget = _ref4.currentTarget;
280
+ var sel = (_window$getSelection2 = (_window2 = window).getSelection) === null || _window$getSelection2 === void 0 ? void 0 : _window$getSelection2.call(_window2);
281
+
282
+ if (!(sel === null || sel === void 0 ? void 0 : sel.getRangeAt) || !sel.rangeCount) {
283
+ return;
284
+ }
285
+
286
+ var r = sel.getRangeAt(0);
287
+ var nodes = Array.from(currentTarget.childNodes);
288
+ var startElementIndex = nodes.indexOf(r.startContainer);
289
+ var endElementIndex = nodes.indexOf(r.endContainer);
290
+ setRange([startElementIndex, r.startOffset, endElementIndex, r.endOffset]);
291
+ }
292
+
293
+ var disabled = props.disabled || form.disabled;
294
+ return /*#__PURE__*/React.createElement(Input.Group, {
295
+ compact: true,
296
+ className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.ant-input-group.ant-input-group-compact {\n display: flex;\n .ant-input {\n flex-grow: 1;\n min-width: 200px;\n }\n .ant-input-disabled {\n .ant-tag {\n color: #bfbfbf;\n border-color: #d9d9d9;\n }\n }\n }\n "])))
297
+ }, /*#__PURE__*/React.createElement("div", {
298
+ onInput: onInput,
299
+ onBlur: onBlur,
300
+ onKeyDown: function onKeyDown(e) {
301
+ if (e.key === 'Enter') {
302
+ e.preventDefault();
303
+ }
304
+ },
305
+ className: cx('ant-input', {
306
+ 'ant-input-disabled': disabled
307
+ }, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: auto;\n white-space: ", ";\n\n .ant-tag {\n display: inline;\n line-height: 19px;\n margin: 0 0.5em;\n padding: 2px 7px;\n border-radius: 10px;\n }\n "])), multiline ? 'normal' : 'nowrap')),
308
+ ref: inputRef,
309
+ contentEditable: !disabled,
310
+ dangerouslySetInnerHTML: {
311
+ __html: html
312
+ }
313
+ }), /*#__PURE__*/React.createElement(Tooltip, {
314
+ title: t('Use variable')
315
+ }, /*#__PURE__*/React.createElement(Cascader, {
316
+ value: [],
317
+ options: options,
318
+ onChange: onInsert
319
+ }, button !== null && button !== void 0 ? button : /*#__PURE__*/React.createElement(Button, {
320
+ className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-style: italic;\n font-family: 'New York', 'Times New Roman', Times, serif;\n "])))
321
+ }, "x"))));
322
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare function Variable(): any;
3
+ export declare namespace Variable {
4
+ var Input: import("react").ForwardRefExoticComponent<Pick<Partial<any>, string | number | symbol> & import("react").RefAttributes<unknown>>;
5
+ var TextArea: import("react").ForwardRefExoticComponent<Pick<Partial<any>, string | number | symbol> & import("react").RefAttributes<unknown>>;
6
+ var JSON: import("react").ForwardRefExoticComponent<Pick<Partial<any>, string | number | symbol> & import("react").RefAttributes<unknown>>;
7
+ }
8
+ export default Variable;
@@ -0,0 +1,11 @@
1
+ import { connect } from '@formily/react';
2
+ import { Input } from "./Input";
3
+ import { TextArea } from "./TextArea";
4
+ import { JSONInput } from "./JSONInput";
5
+ export function Variable() {
6
+ return null;
7
+ }
8
+ Variable.Input = connect(Input);
9
+ Variable.TextArea = connect(TextArea);
10
+ Variable.JSON = connect(JSONInput);
11
+ export default Variable;
@@ -0,0 +1 @@
1
+ export * from './Variable';
@@ -0,0 +1 @@
1
+ export * from './Variable';
@@ -1,4 +1,5 @@
1
- var _excluded = ["component", "style", "children", "openMode"];
1
+ var _excluded = ["component", "style", "children", "openMode"],
2
+ _excluded2 = ["schema", "id"];
2
3
 
3
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
5
 
@@ -58,16 +59,45 @@ export var Sortable = function Sortable(props) {
58
59
  style: droppableStyle
59
60
  }), children);
60
61
  };
61
- export var SortableItem = observer(function (props) {
62
+
63
+ var useSortableItemProps = function useSortableItemProps(props) {
64
+ var id = useSortableItemId(props);
65
+
66
+ if (props.schema) {
67
+ return _objectSpread(_objectSpread({}, props), {}, {
68
+ id: id
69
+ });
70
+ }
71
+
72
+ var schema = useFieldSchema();
73
+ return _objectSpread(_objectSpread({}, props), {}, {
74
+ id: id,
75
+ schema: schema
76
+ });
77
+ };
78
+
79
+ var useSortableItemId = function useSortableItemId(props) {
80
+ if (props.id) {
81
+ return props.id;
82
+ }
83
+
62
84
  var field = useField();
63
- var fieldSchema = useFieldSchema();
85
+ return field.address.toString();
86
+ };
87
+
88
+ export var SortableItem = observer(function (props) {
89
+ var _useSortableItemProps = useSortableItemProps(props),
90
+ schema = _useSortableItemProps.schema,
91
+ id = _useSortableItemProps.id,
92
+ others = _objectWithoutProperties(_useSortableItemProps, _excluded2);
93
+
64
94
  return /*#__PURE__*/React.createElement(SortableProvider, {
65
- id: field.address.toString(),
95
+ id: id,
66
96
  data: {
67
97
  insertAdjacent: 'afterEnd',
68
- schema: fieldSchema
98
+ schema: schema
69
99
  }
70
- }, /*#__PURE__*/React.createElement(Sortable, _objectSpread({}, props), props.children));
100
+ }, /*#__PURE__*/React.createElement(Sortable, _objectSpread({}, others), props.children));
71
101
  });
72
102
  export var DragHandler = function DragHandler(props) {
73
103
  var _useContext2 = useContext(SortableContext),