@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,523 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+
3
+ /* globals define,module */
4
+
5
+ /*
6
+ Using a Universal Module Loader that should be browser, require, and AMD friendly
7
+ http://ricostacruz.com/cheatsheets/umdjs.html
8
+ */
9
+ (function (root, factory) {
10
+ if (typeof define === 'function' && define.amd) {
11
+ define(factory);
12
+ } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') {
13
+ module.exports = factory();
14
+ } else {
15
+ root.jsonLogic = factory();
16
+ }
17
+ })(this, function () {
18
+ 'use strict';
19
+ /* globals console:false */
20
+
21
+ if (!Array.isArray) {
22
+ Array.isArray = function (arg) {
23
+ return Object.prototype.toString.call(arg) === '[object Array]';
24
+ };
25
+ }
26
+ /**
27
+ * Return an array that contains no duplicates (original not modified)
28
+ * @param {array} array Original reference array
29
+ * @return {array} New array with no duplicates
30
+ */
31
+
32
+
33
+ function arrayUnique(array) {
34
+ var a = [];
35
+
36
+ for (var i = 0, l = array.length; i < l; i++) {
37
+ if (a.indexOf(array[i]) === -1) {
38
+ a.push(array[i]);
39
+ }
40
+ }
41
+
42
+ return a;
43
+ }
44
+
45
+ var jsonLogic = {};
46
+ var operations = {
47
+ $is: function $is(a, b) {
48
+ return a == b;
49
+ },
50
+ $eq: function $eq(a, b) {
51
+ return a === b;
52
+ },
53
+ $ne: function $ne(a, b) {
54
+ return a != b;
55
+ },
56
+ '!==': function _(a, b) {
57
+ return a !== b;
58
+ },
59
+ $gt: function $gt(a, b) {
60
+ return a > b;
61
+ },
62
+ $gte: function $gte(a, b) {
63
+ return a >= b;
64
+ },
65
+ $lt: function $lt(a, b, c) {
66
+ return c === undefined ? a < b : a < b && b < c;
67
+ },
68
+ $lte: function $lte(a, b, c) {
69
+ return c === undefined ? a <= b : a <= b && b <= c;
70
+ },
71
+ $notEmpty: function $notEmpty(a) {
72
+ return jsonLogic.truthy(a);
73
+ },
74
+ $empty: function $empty(a) {
75
+ return !jsonLogic.truthy(a);
76
+ },
77
+ '%': function _(a, b) {
78
+ return a % b;
79
+ },
80
+ log: function log(a) {
81
+ console.log(a);
82
+ return a;
83
+ },
84
+ $in: function $in(a, b) {
85
+ if (!b || typeof b.indexOf === 'undefined') return false;
86
+ return b.indexOf(a) !== -1;
87
+ },
88
+ $notIn: function $notIn(a, b) {
89
+ if (!b || typeof b.indexOf === 'undefined') return false;
90
+ return !(b.indexOf(a) !== -1);
91
+ },
92
+ $includes: function $includes(a, b) {
93
+ if (!a || typeof a.indexOf === 'undefined') return false;
94
+ return a.indexOf(b) !== -1;
95
+ },
96
+ $notIncludes: function $notIncludes(a, b) {
97
+ if (!a || typeof a.indexOf === 'undefined') return false;
98
+ return !(a.indexOf(b) !== -1);
99
+ },
100
+ cat: function cat() {
101
+ return Array.prototype.join.call(arguments, '');
102
+ },
103
+ substr: function substr(source, start, end) {
104
+ if (end < 0) {
105
+ // JavaScript doesn't support negative end, this emulates PHP behavior
106
+ var temp = String(source).substr(start);
107
+ return temp.substr(0, temp.length + end);
108
+ }
109
+
110
+ return String(source).substr(start, end);
111
+ },
112
+ '+': function _() {
113
+ return Array.prototype.reduce.call(arguments, function (a, b) {
114
+ return parseFloat(a, 10) + parseFloat(b, 10);
115
+ }, 0);
116
+ },
117
+ '*': function _() {
118
+ return Array.prototype.reduce.call(arguments, function (a, b) {
119
+ return parseFloat(a, 10) * parseFloat(b, 10);
120
+ });
121
+ },
122
+ '-': function _(a, b) {
123
+ if (b === undefined) {
124
+ return -a;
125
+ } else {
126
+ return a - b;
127
+ }
128
+ },
129
+ '/': function _(a, b) {
130
+ return a / b;
131
+ },
132
+ min: function min() {
133
+ return Math.min.apply(this, arguments);
134
+ },
135
+ max: function max() {
136
+ return Math.max.apply(this, arguments);
137
+ },
138
+ merge: function merge() {
139
+ return Array.prototype.reduce.call(arguments, function (a, b) {
140
+ return a.concat(b);
141
+ }, []);
142
+ },
143
+ var: function _var(a, b) {
144
+ var not_found = b === undefined ? null : b;
145
+ var data = this;
146
+
147
+ if (typeof a === 'undefined' || a === '' || a === null) {
148
+ return data;
149
+ }
150
+
151
+ var sub_props = String(a).split('.');
152
+
153
+ for (var i = 0; i < sub_props.length; i++) {
154
+ if (data === null || data === undefined) {
155
+ return not_found;
156
+ } // Descending into data
157
+
158
+
159
+ data = data[sub_props[i]];
160
+
161
+ if (data === undefined) {
162
+ return not_found;
163
+ }
164
+ }
165
+
166
+ return data;
167
+ },
168
+ missing: function missing() {
169
+ /*
170
+ Missing can receive many keys as many arguments, like {"missing:[1,2]}
171
+ Missing can also receive *one* argument that is an array of keys,
172
+ which typically happens if it's actually acting on the output of another command
173
+ (like 'if' or 'merge')
174
+ */
175
+ var missing = [];
176
+ var keys = Array.isArray(arguments[0]) ? arguments[0] : arguments;
177
+
178
+ for (var i = 0; i < keys.length; i++) {
179
+ var key = keys[i];
180
+ var value = jsonLogic.apply({
181
+ var: key
182
+ }, this);
183
+
184
+ if (value === null || value === '') {
185
+ missing.push(key);
186
+ }
187
+ }
188
+
189
+ return missing;
190
+ },
191
+ missing_some: function missing_some(need_count, options) {
192
+ // missing_some takes two arguments, how many (minimum) items must be present, and an array of keys (just like 'missing') to check for presence.
193
+ var are_missing = jsonLogic.apply({
194
+ missing: options
195
+ }, this);
196
+
197
+ if (options.length - are_missing.length >= need_count) {
198
+ return [];
199
+ } else {
200
+ return are_missing;
201
+ }
202
+ }
203
+ };
204
+
205
+ jsonLogic.is_logic = function (logic) {
206
+ return _typeof(logic) === 'object' && // An object
207
+ logic !== null && // but not null
208
+ !Array.isArray(logic) && // and not an array
209
+ Object.keys(logic).length === 1 // with exactly one key
210
+ ;
211
+ };
212
+ /*
213
+ This helper will defer to the JsonLogic spec as a tie-breaker when different language interpreters define different behavior for the truthiness of primitives. E.g., PHP considers empty arrays to be falsy, but Javascript considers them to be truthy. JsonLogic, as an ecosystem, needs one consistent answer.
214
+
215
+ Spec and rationale here: http://jsonlogic.com/truthy
216
+ */
217
+
218
+
219
+ jsonLogic.truthy = function (value) {
220
+ if (Array.isArray(value) && value.length === 0) {
221
+ return false;
222
+ }
223
+
224
+ return !!value;
225
+ };
226
+
227
+ jsonLogic.get_operator = function (logic) {
228
+ return Object.keys(logic)[0];
229
+ };
230
+
231
+ jsonLogic.get_values = function (logic) {
232
+ return logic[jsonLogic.get_operator(logic)];
233
+ };
234
+
235
+ jsonLogic.apply = function (logic, data) {
236
+ // Does this array contain logic? Only one way to find out.
237
+ if (Array.isArray(logic)) {
238
+ return logic.map(function (l) {
239
+ return jsonLogic.apply(l, data);
240
+ });
241
+ } // You've recursed to a primitive, stop!
242
+
243
+
244
+ if (!jsonLogic.is_logic(logic)) {
245
+ return logic;
246
+ }
247
+
248
+ var op = jsonLogic.get_operator(logic);
249
+ var values = logic[op];
250
+ var i;
251
+ var current;
252
+ var scopedLogic;
253
+ var scopedData;
254
+ var initial; // easy syntax for unary operators, like {"var" : "x"} instead of strict {"var" : ["x"]}
255
+
256
+ if (!Array.isArray(values)) {
257
+ values = [values];
258
+ } // 'if', 'and', and 'or' violate the normal rule of depth-first calculating consequents, let each manage recursion as needed.
259
+
260
+
261
+ if (op === 'if' || op == '?:') {
262
+ /* 'if' should be called with a odd number of parameters, 3 or greater
263
+ This works on the pattern:
264
+ if( 0 ){ 1 }else{ 2 };
265
+ if( 0 ){ 1 }else if( 2 ){ 3 }else{ 4 };
266
+ if( 0 ){ 1 }else if( 2 ){ 3 }else if( 4 ){ 5 }else{ 6 };
267
+ The implementation is:
268
+ For pairs of values (0,1 then 2,3 then 4,5 etc)
269
+ If the first evaluates truthy, evaluate and return the second
270
+ If the first evaluates falsy, jump to the next pair (e.g, 0,1 to 2,3)
271
+ given one parameter, evaluate and return it. (it's an Else and all the If/ElseIf were false)
272
+ given 0 parameters, return NULL (not great practice, but there was no Else)
273
+ */
274
+ for (i = 0; i < values.length - 1; i += 2) {
275
+ if (jsonLogic.truthy(jsonLogic.apply(values[i], data))) {
276
+ return jsonLogic.apply(values[i + 1], data);
277
+ }
278
+ }
279
+
280
+ if (values.length === i + 1) {
281
+ return jsonLogic.apply(values[i], data);
282
+ }
283
+
284
+ return null;
285
+ } else if (op === '$and') {
286
+ // Return first falsy, or last
287
+ for (i = 0; i < values.length; i += 1) {
288
+ current = jsonLogic.apply(values[i], data);
289
+
290
+ if (!jsonLogic.truthy(current)) {
291
+ return current;
292
+ }
293
+ }
294
+
295
+ return current; // Last
296
+ } else if (op === 'or') {
297
+ // Return first truthy, or last
298
+ for (i = 0; i < values.length; i += 1) {
299
+ current = jsonLogic.apply(values[i], data);
300
+
301
+ if (jsonLogic.truthy(current)) {
302
+ return current;
303
+ }
304
+ }
305
+
306
+ return current; // Last
307
+ } else if (op === 'filter') {
308
+ scopedData = jsonLogic.apply(values[0], data);
309
+ scopedLogic = values[1];
310
+
311
+ if (!Array.isArray(scopedData)) {
312
+ return [];
313
+ } // Return only the elements from the array in the first argument,
314
+ // that return truthy when passed to the logic in the second argument.
315
+ // For parity with JavaScript, reindex the returned array
316
+
317
+
318
+ return scopedData.filter(function (datum) {
319
+ return jsonLogic.truthy(jsonLogic.apply(scopedLogic, datum));
320
+ });
321
+ } else if (op === 'map') {
322
+ scopedData = jsonLogic.apply(values[0], data);
323
+ scopedLogic = values[1];
324
+
325
+ if (!Array.isArray(scopedData)) {
326
+ return [];
327
+ }
328
+
329
+ return scopedData.map(function (datum) {
330
+ return jsonLogic.apply(scopedLogic, datum);
331
+ });
332
+ } else if (op === 'reduce') {
333
+ scopedData = jsonLogic.apply(values[0], data);
334
+ scopedLogic = values[1];
335
+ initial = typeof values[2] !== 'undefined' ? values[2] : null;
336
+
337
+ if (!Array.isArray(scopedData)) {
338
+ return initial;
339
+ }
340
+
341
+ return scopedData.reduce(function (accumulator, current) {
342
+ return jsonLogic.apply(scopedLogic, {
343
+ current: current,
344
+ accumulator: accumulator
345
+ });
346
+ }, initial);
347
+ } else if (op === 'all') {
348
+ scopedData = jsonLogic.apply(values[0], data);
349
+ scopedLogic = values[1]; // All of an empty set is false. Note, some and none have correct fallback after the for loop
350
+
351
+ if (!Array.isArray(scopedData) || !scopedData.length) {
352
+ return false;
353
+ }
354
+
355
+ for (i = 0; i < scopedData.length; i += 1) {
356
+ if (!jsonLogic.truthy(jsonLogic.apply(scopedLogic, scopedData[i]))) {
357
+ return false; // First falsy, short circuit
358
+ }
359
+ }
360
+
361
+ return true; // All were truthy
362
+ } else if (op === 'none') {
363
+ scopedData = jsonLogic.apply(values[0], data);
364
+ scopedLogic = values[1];
365
+
366
+ if (!Array.isArray(scopedData) || !scopedData.length) {
367
+ return true;
368
+ }
369
+
370
+ for (i = 0; i < scopedData.length; i += 1) {
371
+ if (jsonLogic.truthy(jsonLogic.apply(scopedLogic, scopedData[i]))) {
372
+ return false; // First truthy, short circuit
373
+ }
374
+ }
375
+
376
+ return true; // None were truthy
377
+ } else if (op === 'some') {
378
+ scopedData = jsonLogic.apply(values[0], data);
379
+ scopedLogic = values[1];
380
+
381
+ if (!Array.isArray(scopedData) || !scopedData.length) {
382
+ return false;
383
+ }
384
+
385
+ for (i = 0; i < scopedData.length; i += 1) {
386
+ if (jsonLogic.truthy(jsonLogic.apply(scopedLogic, scopedData[i]))) {
387
+ return true; // First truthy, short circuit
388
+ }
389
+ }
390
+
391
+ return false; // None were truthy
392
+ } // Everyone else gets immediate depth-first recursion
393
+
394
+
395
+ values = values.map(function (val) {
396
+ return jsonLogic.apply(val, data);
397
+ }); // The operation is called with "data" bound to its "this" and "values" passed as arguments.
398
+ // Structured commands like % or > can name formal arguments while flexible commands (like missing or merge) can operate on the pseudo-array arguments
399
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments
400
+
401
+ if (operations.hasOwnProperty(op) && typeof operations[op] === 'function') {
402
+ return operations[op].apply(data, values);
403
+ } else if (op.indexOf('.') > 0) {
404
+ // Contains a dot, and not in the 0th position
405
+ var sub_ops = String(op).split('.');
406
+ var operation = operations;
407
+
408
+ for (i = 0; i < sub_ops.length; i++) {
409
+ if (!operation.hasOwnProperty(sub_ops[i])) {
410
+ throw new Error('Unrecognized operation ' + op + ' (failed at ' + sub_ops.slice(0, i + 1).join('.') + ')');
411
+ } // Descending into operations
412
+
413
+
414
+ operation = operation[sub_ops[i]];
415
+ }
416
+
417
+ return operation.apply(data, values);
418
+ }
419
+
420
+ throw new Error('Unrecognized operation ' + op);
421
+ };
422
+
423
+ jsonLogic.uses_data = function (logic) {
424
+ var collection = [];
425
+
426
+ if (jsonLogic.is_logic(logic)) {
427
+ var op = jsonLogic.get_operator(logic);
428
+ var values = logic[op];
429
+
430
+ if (!Array.isArray(values)) {
431
+ values = [values];
432
+ }
433
+
434
+ if (op === 'var') {
435
+ // This doesn't cover the case where the arg to var is itself a rule.
436
+ collection.push(values[0]);
437
+ } else {
438
+ // Recursion!
439
+ values.forEach(function (val) {
440
+ collection.push.apply(collection, jsonLogic.uses_data(val));
441
+ });
442
+ }
443
+ }
444
+
445
+ return arrayUnique(collection);
446
+ };
447
+
448
+ jsonLogic.add_operation = function (name, code) {
449
+ operations[name] = code;
450
+ };
451
+
452
+ jsonLogic.rm_operation = function (name) {
453
+ delete operations[name];
454
+ };
455
+
456
+ jsonLogic.rule_like = function (rule, pattern) {
457
+ // console.log("Is ". JSON.stringify(rule) . " like " . JSON.stringify(pattern) . "?");
458
+ if (pattern === rule) {
459
+ return true;
460
+ } // TODO : Deep object equivalency?
461
+
462
+
463
+ if (pattern === '@') {
464
+ return true;
465
+ } // Wildcard!
466
+
467
+
468
+ if (pattern === 'number') {
469
+ return typeof rule === 'number';
470
+ }
471
+
472
+ if (pattern === 'string') {
473
+ return typeof rule === 'string';
474
+ }
475
+
476
+ if (pattern === 'array') {
477
+ // !logic test might be superfluous in JavaScript
478
+ return Array.isArray(rule) && !jsonLogic.is_logic(rule);
479
+ }
480
+
481
+ if (jsonLogic.is_logic(pattern)) {
482
+ if (jsonLogic.is_logic(rule)) {
483
+ var pattern_op = jsonLogic.get_operator(pattern);
484
+ var rule_op = jsonLogic.get_operator(rule);
485
+
486
+ if (pattern_op === '@' || pattern_op === rule_op) {
487
+ // echo "\nOperators match, go deeper\n";
488
+ return jsonLogic.rule_like(jsonLogic.get_values(rule, false), jsonLogic.get_values(pattern, false));
489
+ }
490
+ }
491
+
492
+ return false; // pattern is logic, rule isn't, can't be eq
493
+ }
494
+
495
+ if (Array.isArray(pattern)) {
496
+ if (Array.isArray(rule)) {
497
+ if (pattern.length !== rule.length) {
498
+ return false;
499
+ }
500
+ /*
501
+ Note, array order MATTERS, because we're using this array test logic to consider arguments, where order can matter. (e.g., + is commutative, but '-' or 'if' or 'var' are NOT)
502
+ */
503
+
504
+
505
+ for (var i = 0; i < pattern.length; i += 1) {
506
+ // If any fail, we fail
507
+ if (!jsonLogic.rule_like(rule[i], pattern[i])) {
508
+ return false;
509
+ }
510
+ }
511
+
512
+ return true; // If they *all* passed, we pass
513
+ } else {
514
+ return false; // Pattern is array, rule isn't
515
+ }
516
+ } // Not logic, not array, not a === match for rule.
517
+
518
+
519
+ return false;
520
+ };
521
+
522
+ return jsonLogic;
523
+ });
@@ -0,0 +1 @@
1
+ export declare const conditionAnalyse: (rules: any, values: any) => boolean;
@@ -0,0 +1,89 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ import { every, some } from 'lodash';
6
+ import flat from 'flat';
7
+ import jsonLogic from '../../common/utils/logic';
8
+
9
+ function getDeepestProperty(obj) {
10
+ var deepest = {
11
+ operator: null,
12
+ value: null
13
+ };
14
+ var deepestLevel = 0;
15
+
16
+ function traverse(obj, level) {
17
+ for (var key in obj) {
18
+ if (obj.hasOwnProperty(key)) {
19
+ if (_typeof(obj[key]) === 'object') {
20
+ traverse(obj[key], level + 1);
21
+ } else {
22
+ if (level > deepestLevel) {
23
+ deepestLevel = level;
24
+ deepest.operator = key;
25
+ deepest.value = obj[key];
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+
32
+ traverse(obj, 1);
33
+ return deepest;
34
+ }
35
+
36
+ var getValue = function getValue(str, values) {
37
+ var _str$match;
38
+
39
+ var regex = /{{(.*?)}}/;
40
+ var matches = str === null || str === void 0 ? void 0 : (_str$match = str.match) === null || _str$match === void 0 ? void 0 : _str$match.call(str, regex);
41
+
42
+ if (matches) {
43
+ return getVariableValue(str, values);
44
+ } else {
45
+ return str;
46
+ }
47
+ };
48
+
49
+ var getVariableValue = function getVariableValue(str, values) {
50
+ var regex = /{{[^.]+\.([^}]+)}}/;
51
+ var match = regex.exec(str);
52
+ return values[match === null || match === void 0 ? void 0 : match[1]];
53
+ };
54
+
55
+ export var conditionAnalyse = function conditionAnalyse(rules, values) {
56
+ var type = Object.keys(rules)[0] || '$and';
57
+ var conditions = rules[type];
58
+ var results = conditions.map(function (c) {
59
+ var _Object$keys$, _Object$keys$$replace;
60
+
61
+ var jsonlogic = getDeepestProperty(c);
62
+ var operator = jsonlogic.operator;
63
+ var value = getValue(jsonlogic.value, values);
64
+ var targetField = (_Object$keys$ = Object.keys(flat(c))[0]) === null || _Object$keys$ === void 0 ? void 0 : (_Object$keys$$replace = _Object$keys$.replace) === null || _Object$keys$$replace === void 0 ? void 0 : _Object$keys$$replace.call(_Object$keys$, ".".concat(operator), '');
65
+
66
+ if (!operator) {
67
+ return true;
68
+ }
69
+
70
+ try {
71
+ var _flat;
72
+
73
+ var result = jsonLogic.apply(_defineProperty({}, operator, [(_flat = flat(values)) === null || _flat === void 0 ? void 0 : _flat[targetField], value]));
74
+ return result;
75
+ } catch (error) {
76
+ console.error(error);
77
+ }
78
+ });
79
+
80
+ if (type === '$and') {
81
+ return every(results, function (v) {
82
+ return v;
83
+ });
84
+ } else {
85
+ return some(results, function (v) {
86
+ return v;
87
+ });
88
+ }
89
+ };
@@ -201,7 +201,6 @@ SchemaInitializer.Item = function (props) {
201
201
  }
202
202
 
203
203
  if (item.type === 'itemGroup') {
204
- console.log(item.children);
205
204
  return /*#__PURE__*/React.createElement(Menu.ItemGroup // @ts-ignore
206
205
  , {
207
206
  // @ts-ignore
@@ -230,9 +229,15 @@ SchemaInitializer.Item = function (props) {
230
229
 
231
230
  item === null || item === void 0 ? void 0 : (_item$clearKeywords = item.clearKeywords) === null || _item$clearKeywords === void 0 ? void 0 : _item$clearKeywords.call(item);
232
231
 
233
- _onClick(_objectSpread(_objectSpread({}, info), {}, {
234
- item: item
235
- }));
232
+ if (item.onClick) {
233
+ item.onClick(_objectSpread(_objectSpread({}, info), {}, {
234
+ item: item
235
+ }));
236
+ } else {
237
+ _onClick(_objectSpread(_objectSpread({}, info), {}, {
238
+ item: item
239
+ }));
240
+ }
236
241
  }
237
242
  }, compile(item.title));
238
243
  });