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

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 (291) hide show
  1. package/es/acl/ACLProvider.js +4 -7
  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 +3 -1
  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.js +3 -1
  33. package/es/collection-manager/context.d.ts +4 -0
  34. package/es/collection-manager/context.js +5 -1
  35. package/es/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  36. package/es/collection-manager/hooks/useCollectionManager.js +51 -6
  37. package/es/collection-manager/interfaces/m2m.js +2 -2
  38. package/es/collection-manager/interfaces/properties/index.d.ts +0 -56
  39. package/es/collection-manager/interfaces/properties/index.js +1 -2
  40. package/es/collection-manager/templates/calendar.js +1 -1
  41. package/es/collection-manager/templates/general.js +1 -1
  42. package/es/collection-manager/templates/properties/index.d.ts +12 -1
  43. package/es/collection-manager/templates/properties/index.js +11 -0
  44. package/es/i18n/i18n.js +3 -1
  45. package/es/locale/en_US.d.ts +23 -0
  46. package/es/locale/en_US.js +23 -0
  47. package/es/locale/ja_JP.d.ts +23 -0
  48. package/es/locale/ja_JP.js +24 -1
  49. package/es/locale/ru_RU.d.ts +1 -0
  50. package/es/locale/ru_RU.js +1 -0
  51. package/es/locale/zh_CN.d.ts +43 -4
  52. package/es/locale/zh_CN.js +44 -5
  53. package/es/route-switch/antd/admin-layout/index.js +13 -33
  54. package/es/schema-component/antd/action/Action.Designer.js +22 -15
  55. package/es/schema-component/antd/action/Action.js +25 -3
  56. package/es/schema-component/antd/action/utils.d.ts +1 -0
  57. package/es/schema-component/antd/action/utils.js +49 -0
  58. package/es/schema-component/antd/association-filter/AssociationFilter.js +4 -4
  59. package/es/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  60. package/es/schema-component/antd/association-select/useServiceOptions.js +47 -6
  61. package/es/schema-component/antd/calendar/Calendar.Designer.js +17 -36
  62. package/es/schema-component/antd/checkbox/Checkbox.js +9 -8
  63. package/es/schema-component/antd/date-picker/util.d.ts +1 -1
  64. package/es/schema-component/antd/date-picker/util.js +1 -1
  65. package/es/schema-component/antd/filter/DynamicComponent.js +3 -1
  66. package/es/schema-component/antd/filter/Filter.js +2 -1
  67. package/es/schema-component/antd/filter/FilterGroup.js +7 -4
  68. package/es/schema-component/antd/filter/FilterItem.js +3 -2
  69. package/es/schema-component/antd/filter/context.d.ts +1 -0
  70. package/es/schema-component/antd/filter/useValues.js +14 -11
  71. package/es/schema-component/antd/form/Form.js +11 -5
  72. package/es/schema-component/antd/form-item/FormItem.js +17 -8
  73. package/es/schema-component/antd/form-v2/Form.Designer.js +2 -0
  74. package/es/schema-component/antd/form-v2/Form.js +90 -7
  75. package/es/schema-component/antd/form-v2/utils.d.ts +5 -0
  76. package/es/schema-component/antd/form-v2/utils.js +161 -0
  77. package/es/schema-component/antd/grid/Grid.js +10 -5
  78. package/es/schema-component/antd/icon-picker/IconPicker.js +1 -0
  79. package/es/schema-component/antd/index.d.ts +1 -0
  80. package/es/schema-component/antd/index.js +1 -0
  81. package/es/schema-component/antd/input/Input.d.ts +2 -1
  82. package/es/schema-component/antd/input/Json.d.ts +5 -3
  83. package/es/schema-component/antd/input/Json.js +3 -2
  84. package/es/schema-component/antd/input-number/InputNumber.js +3 -1
  85. package/es/schema-component/antd/page/FixedBlock.js +3 -1
  86. package/es/schema-component/antd/page/Page.js +11 -5
  87. package/es/schema-component/antd/page/PageTabDesigner.js +3 -3
  88. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  89. package/es/schema-component/antd/record-picker/RecordPicker.js +1 -2
  90. package/es/schema-component/antd/record-picker/util.js +7 -0
  91. package/es/schema-component/antd/remote-select/RemoteSelect.js +76 -36
  92. package/es/schema-component/antd/rich-text/RichText.js +4 -2
  93. package/es/schema-component/antd/select/Select.js +14 -4
  94. package/es/schema-component/antd/table/Table.Array.js +10 -3
  95. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  96. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  97. package/es/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  98. package/es/schema-component/antd/time-picker/TimePicker.js +1 -1
  99. package/es/schema-component/antd/variable/Input.d.ts +2 -0
  100. package/es/schema-component/antd/variable/Input.js +244 -0
  101. package/es/schema-component/antd/variable/JSONInput.d.ts +2 -0
  102. package/es/schema-component/antd/variable/JSONInput.js +82 -0
  103. package/es/schema-component/antd/variable/TextArea.d.ts +2 -0
  104. package/es/schema-component/antd/variable/TextArea.js +322 -0
  105. package/es/schema-component/antd/variable/Variable.d.ts +8 -0
  106. package/es/schema-component/antd/variable/Variable.js +11 -0
  107. package/es/schema-component/antd/variable/index.d.ts +1 -0
  108. package/es/schema-component/antd/variable/index.js +1 -0
  109. package/es/schema-component/common/sortable-item/SortableItem.js +36 -6
  110. package/es/schema-component/common/utils/logic.js +523 -0
  111. package/es/schema-component/common/utils/uitls.d.ts +1 -0
  112. package/es/schema-component/common/utils/uitls.js +89 -0
  113. package/es/schema-initializer/SchemaInitializer.js +0 -1
  114. package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  115. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
  116. package/es/schema-initializer/index.d.ts +2 -1
  117. package/es/schema-initializer/index.js +2 -1
  118. package/es/schema-initializer/items/CalendarBlockInitializer.js +24 -41
  119. package/es/schema-initializer/utils.js +22 -7
  120. package/es/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  121. package/es/schema-settings/LinkageRules/DynamicComponent.js +113 -0
  122. package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  123. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +15 -0
  124. package/es/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  125. package/es/schema-settings/LinkageRules/LinkageRuleAction.js +162 -0
  126. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  127. package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.js +71 -0
  128. package/es/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  129. package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +82 -0
  130. package/es/schema-settings/LinkageRules/Variables.d.ts +7 -0
  131. package/es/schema-settings/LinkageRules/Variables.js +115 -0
  132. package/es/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  133. package/es/schema-settings/LinkageRules/action-hooks.js +115 -0
  134. package/es/schema-settings/LinkageRules/context.d.ts +13 -0
  135. package/es/schema-settings/LinkageRules/context.js +4 -0
  136. package/es/schema-settings/LinkageRules/index.d.ts +2 -0
  137. package/es/schema-settings/LinkageRules/index.js +132 -0
  138. package/es/schema-settings/LinkageRules/type.d.ts +13 -0
  139. package/es/schema-settings/LinkageRules/type.js +15 -0
  140. package/es/schema-settings/LinkageRules/useValues.d.ts +1 -0
  141. package/es/schema-settings/LinkageRules/useValues.js +84 -0
  142. package/es/schema-settings/SchemaSettings.d.ts +4 -1
  143. package/es/schema-settings/SchemaSettings.js +153 -26
  144. package/es/schema-templates/BlockTemplate.js +9 -1
  145. package/es/system-settings/SystemSettingsShortcut.js +1 -1
  146. package/lib/acl/ACLProvider.js +4 -7
  147. package/lib/api-client/APIClient.js +6 -0
  148. package/lib/block-provider/BlockProvider.js +9 -6
  149. package/lib/block-provider/FormBlockProvider.js +3 -1
  150. package/lib/block-provider/KanbanBlockProvider.js +1 -1
  151. package/lib/block-provider/SharedFilterProvider.js +9 -3
  152. package/lib/block-provider/TableBlockProvider.js +1 -1
  153. package/lib/block-provider/TableSelectorProvider.js +2 -2
  154. package/lib/block-provider/hooks/index.js +23 -7
  155. package/lib/collection-manager/CollectionManagerProvider.d.ts +1 -0
  156. package/lib/collection-manager/CollectionManagerProvider.js +81 -16
  157. package/lib/collection-manager/CollectionManagerShortcut.js +36 -23
  158. package/lib/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
  159. package/lib/collection-manager/Configuration/AddCategoryAction.js +145 -0
  160. package/lib/collection-manager/Configuration/AddCollectionAction.js +8 -3
  161. package/lib/collection-manager/Configuration/AddFieldAction.js +1 -0
  162. package/lib/collection-manager/Configuration/ConfigurationTable.js +34 -4
  163. package/lib/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
  164. package/lib/collection-manager/Configuration/ConfigurationTabs.js +407 -0
  165. package/lib/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
  166. package/lib/collection-manager/Configuration/EditCategoryAction.js +178 -0
  167. package/lib/collection-manager/Configuration/EditCollectionAction.js +6 -2
  168. package/lib/collection-manager/Configuration/OverridingCollectionField.js +17 -8
  169. package/lib/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
  170. package/lib/collection-manager/Configuration/components/CollectionCategory.js +27 -0
  171. package/lib/collection-manager/Configuration/index.d.ts +3 -0
  172. package/lib/collection-manager/Configuration/index.js +39 -0
  173. package/lib/collection-manager/Configuration/schemas/collections.d.ts +3 -0
  174. package/lib/collection-manager/Configuration/schemas/collections.js +316 -178
  175. package/lib/collection-manager/Configuration/templates.d.ts +1 -0
  176. package/lib/collection-manager/Configuration/templates.js +2 -0
  177. package/lib/collection-manager/action-hooks.js +3 -1
  178. package/lib/collection-manager/context.d.ts +4 -0
  179. package/lib/collection-manager/context.js +7 -2
  180. package/lib/collection-manager/hooks/useCollectionManager.d.ts +7 -0
  181. package/lib/collection-manager/hooks/useCollectionManager.js +52 -6
  182. package/lib/collection-manager/interfaces/m2m.js +2 -2
  183. package/lib/collection-manager/interfaces/properties/index.d.ts +0 -56
  184. package/lib/collection-manager/interfaces/properties/index.js +1 -2
  185. package/lib/collection-manager/templates/calendar.js +1 -1
  186. package/lib/collection-manager/templates/general.js +1 -1
  187. package/lib/collection-manager/templates/properties/index.d.ts +12 -1
  188. package/lib/collection-manager/templates/properties/index.js +11 -0
  189. package/lib/i18n/i18n.js +3 -1
  190. package/lib/locale/en_US.d.ts +23 -0
  191. package/lib/locale/en_US.js +23 -0
  192. package/lib/locale/ja_JP.d.ts +23 -0
  193. package/lib/locale/ja_JP.js +24 -1
  194. package/lib/locale/ru_RU.d.ts +1 -0
  195. package/lib/locale/ru_RU.js +1 -0
  196. package/lib/locale/zh_CN.d.ts +43 -4
  197. package/lib/locale/zh_CN.js +44 -5
  198. package/lib/route-switch/antd/admin-layout/index.js +13 -33
  199. package/lib/schema-component/antd/action/Action.Designer.js +24 -14
  200. package/lib/schema-component/antd/action/Action.js +27 -2
  201. package/lib/schema-component/antd/action/utils.d.ts +1 -0
  202. package/lib/schema-component/antd/action/utils.js +58 -2
  203. package/lib/schema-component/antd/association-filter/AssociationFilter.js +3 -3
  204. package/lib/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
  205. package/lib/schema-component/antd/association-select/useServiceOptions.js +47 -4
  206. package/lib/schema-component/antd/calendar/Calendar.Designer.js +15 -33
  207. package/lib/schema-component/antd/checkbox/Checkbox.js +8 -7
  208. package/lib/schema-component/antd/date-picker/util.d.ts +1 -1
  209. package/lib/schema-component/antd/date-picker/util.js +1 -1
  210. package/lib/schema-component/antd/filter/DynamicComponent.js +3 -1
  211. package/lib/schema-component/antd/filter/Filter.js +2 -1
  212. package/lib/schema-component/antd/filter/FilterGroup.js +7 -4
  213. package/lib/schema-component/antd/filter/FilterItem.js +3 -2
  214. package/lib/schema-component/antd/filter/context.d.ts +1 -0
  215. package/lib/schema-component/antd/filter/useValues.js +15 -11
  216. package/lib/schema-component/antd/form/Form.js +9 -3
  217. package/lib/schema-component/antd/form-item/FormItem.js +21 -7
  218. package/lib/schema-component/antd/form-v2/Form.Designer.js +2 -0
  219. package/lib/schema-component/antd/form-v2/Form.js +89 -5
  220. package/lib/schema-component/antd/form-v2/utils.d.ts +5 -0
  221. package/lib/schema-component/antd/form-v2/utils.js +181 -0
  222. package/lib/schema-component/antd/grid/Grid.js +10 -5
  223. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -0
  224. package/lib/schema-component/antd/index.d.ts +1 -0
  225. package/lib/schema-component/antd/index.js +13 -0
  226. package/lib/schema-component/antd/input/Input.d.ts +2 -1
  227. package/lib/schema-component/antd/input/Json.d.ts +5 -3
  228. package/lib/schema-component/antd/input/Json.js +6 -3
  229. package/lib/schema-component/antd/input-number/InputNumber.js +2 -0
  230. package/lib/schema-component/antd/page/FixedBlock.js +3 -1
  231. package/lib/schema-component/antd/page/Page.js +14 -5
  232. package/lib/schema-component/antd/page/PageTabDesigner.js +1 -1
  233. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  234. package/lib/schema-component/antd/record-picker/RecordPicker.js +1 -2
  235. package/lib/schema-component/antd/record-picker/util.js +7 -0
  236. package/lib/schema-component/antd/remote-select/RemoteSelect.js +76 -37
  237. package/lib/schema-component/antd/rich-text/RichText.js +4 -2
  238. package/lib/schema-component/antd/select/Select.js +14 -4
  239. package/lib/schema-component/antd/table/Table.Array.js +8 -1
  240. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  241. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
  242. package/lib/schema-component/antd/tabs/Tabs.Designer.js +1 -0
  243. package/lib/schema-component/antd/time-picker/TimePicker.js +1 -1
  244. package/lib/schema-component/antd/variable/Input.d.ts +2 -0
  245. package/lib/schema-component/antd/variable/Input.js +262 -0
  246. package/lib/schema-component/antd/variable/JSONInput.d.ts +2 -0
  247. package/lib/schema-component/antd/variable/JSONInput.js +100 -0
  248. package/lib/schema-component/antd/variable/TextArea.d.ts +2 -0
  249. package/lib/schema-component/antd/variable/TextArea.js +341 -0
  250. package/lib/schema-component/antd/variable/Variable.d.ts +8 -0
  251. package/lib/schema-component/antd/variable/Variable.js +25 -0
  252. package/lib/schema-component/antd/variable/index.d.ts +1 -0
  253. package/lib/schema-component/antd/variable/index.js +18 -0
  254. package/lib/schema-component/common/sortable-item/SortableItem.js +36 -6
  255. package/lib/schema-component/common/utils/logic.js +525 -0
  256. package/lib/schema-component/common/utils/uitls.d.ts +1 -0
  257. package/lib/schema-component/common/utils/uitls.js +103 -0
  258. package/lib/schema-initializer/SchemaInitializer.js +0 -1
  259. package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
  260. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
  261. package/lib/schema-initializer/index.d.ts +2 -1
  262. package/lib/schema-initializer/index.js +51 -2
  263. package/lib/schema-initializer/items/CalendarBlockInitializer.js +16 -33
  264. package/lib/schema-initializer/utils.js +22 -6
  265. package/lib/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
  266. package/lib/schema-settings/LinkageRules/DynamicComponent.js +139 -0
  267. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
  268. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +27 -0
  269. package/lib/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
  270. package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +190 -0
  271. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
  272. package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.js +90 -0
  273. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
  274. package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +104 -0
  275. package/lib/schema-settings/LinkageRules/Variables.d.ts +7 -0
  276. package/lib/schema-settings/LinkageRules/Variables.js +124 -0
  277. package/lib/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
  278. package/lib/schema-settings/LinkageRules/action-hooks.js +127 -0
  279. package/lib/schema-settings/LinkageRules/context.d.ts +13 -0
  280. package/lib/schema-settings/LinkageRules/context.js +15 -0
  281. package/lib/schema-settings/LinkageRules/index.d.ts +2 -0
  282. package/lib/schema-settings/LinkageRules/index.js +149 -0
  283. package/lib/schema-settings/LinkageRules/type.d.ts +13 -0
  284. package/lib/schema-settings/LinkageRules/type.js +22 -0
  285. package/lib/schema-settings/LinkageRules/useValues.d.ts +1 -0
  286. package/lib/schema-settings/LinkageRules/useValues.js +95 -0
  287. package/lib/schema-settings/SchemaSettings.d.ts +4 -1
  288. package/lib/schema-settings/SchemaSettings.js +176 -48
  289. package/lib/schema-templates/BlockTemplate.js +9 -1
  290. package/lib/system-settings/SystemSettingsShortcut.js +1 -1
  291. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
2
2
 
3
3
  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
4
 
@@ -21,12 +21,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  import { css } from '@emotion/css';
24
+ import { useMutationObserver } from 'ahooks';
24
25
  import { Layout, Spin } from 'antd';
25
26
  import React, { createContext, useContext, useMemo, useRef, useState } from 'react';
26
27
  import { useHistory, useRouteMatch } from 'react-router-dom';
27
- import { ACLRolesCheckProvider, CurrentUser, CurrentUserProvider, CurrentAppInfoProvider, findByUid, findMenuItem, RemoteCollectionManagerProvider, RemotePluginManagerToolbar, RemoteSchemaTemplateManagerProvider, SchemaComponent, useACLRoleContext, useDocumentTitle, useRequest, useRoute, useSystemSettings } from '../../../';
28
+ import { ACLRolesCheckProvider, CurrentAppInfoProvider, CurrentUser, CurrentUserProvider, findByUid, findMenuItem, RemoteCollectionManagerProvider, RemotePluginManagerToolbar, RemoteSchemaTemplateManagerProvider, SchemaComponent, useACLRoleContext, useDocumentTitle, useRequest, useRoute, useSystemSettings } from '../../../';
28
29
  import { useCollectionManager } from '../../../collection-manager';
29
- import { useMutationObserver } from 'ahooks';
30
30
 
31
31
  var filterByACL = function filterByACL(schema, options) {
32
32
  var allowAll = options.allowAll,
@@ -183,56 +183,36 @@ export var InternalAdminLayout = function InternalAdminLayout(props) {
183
183
  return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Layout.Header, {
184
184
  className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-menu.ant-menu-dark .ant-menu-item-selected,\n .ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected {\n background-color: rgba(255, 255, 255, 0.1);\n }\n .ant-menu-dark.ant-menu-horizontal > .ant-menu-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n }\n\n position: fixed;\n width: 100%;\n height: 46px;\n line-height: 46px;\n padding: 0;\n z-index: 100;\n "])))
185
185
  }, /*#__PURE__*/React.createElement("div", {
186
- className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n height: 100%;\n "])))
186
+ className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n "])))
187
187
  }, /*#__PURE__*/React.createElement("div", {
188
- style: {
189
- position: 'relative',
190
- zIndex: 1,
191
- display: 'flex',
192
- height: '100%',
193
- width: 'calc(100vw - 300px)'
194
- }
188
+ className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n z-index: 1;\n flex: 1 1 auto;\n display: flex;\n height: 100%;\n "])))
195
189
  }, /*#__PURE__*/React.createElement("div", {
196
- style: {
197
- width: 200,
198
- display: 'inline-flex',
199
- color: '#fff',
200
- padding: '0',
201
- alignItems: 'center'
202
- }
190
+ className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 200px;\n display: inline-flex;\n flex-shrink: 0;\n color: #fff;\n padding: 0;\n align-items: center;\n "])))
203
191
  }, /*#__PURE__*/React.createElement("img", {
204
- className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 0 16px;\n object-fit: contain;\n width: 100%;\n height: 100%;\n "]))),
192
+ className: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: 0 16px;\n object-fit: contain;\n width: 100%;\n height: 100%;\n "]))),
205
193
  src: result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : (_result$data$data = _result$data.data) === null || _result$data$data === void 0 ? void 0 : (_result$data$data$log = _result$data$data.logo) === null || _result$data$data$log === void 0 ? void 0 : _result$data$data$log.url
206
194
  })), /*#__PURE__*/React.createElement("div", {
207
- style: {
208
- width: 'calc(100% - 590px)'
209
- }
195
+ className: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n width: 0;\n "])))
210
196
  }, /*#__PURE__*/React.createElement(MenuEditor, {
211
197
  sideMenuRef: sideMenuRef
212
198
  }))), /*#__PURE__*/React.createElement("div", {
213
- style: {
214
- position: 'absolute',
215
- height: '100%',
216
- zIndex: 10,
217
- top: 0,
218
- right: 0
219
- }
199
+ className: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n flex-shrink: 0;\n height: 100%;\n z-index: 10;\n "])))
220
200
  }, /*#__PURE__*/React.createElement(RemotePluginManagerToolbar, null), /*#__PURE__*/React.createElement(CurrentUser, null)))), /*#__PURE__*/React.createElement("div", {
221
201
  style: {
222
202
  '--side-menu-width': "".concat(sideMenuWidth, "px")
223
203
  },
224
- className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: var(--side-menu-width);\n overflow: hidden;\n flex: 0 0 var(--side-menu-width);\n max-width: var(--side-menu-width);\n min-width: var(--side-menu-width);\n pointer-events: none;\n transition: background-color 0.3s ease 0s, min-width 0.3s ease 0s,\n max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;\n "])))
204
+ className: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: var(--side-menu-width);\n overflow: hidden;\n flex: 0 0 var(--side-menu-width);\n max-width: var(--side-menu-width);\n min-width: var(--side-menu-width);\n pointer-events: none;\n /* transition: background-color 0.3s ease 0s, min-width 0.3s ease 0s,\n max-width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1) 0s; */\n "])))
225
205
  }), /*#__PURE__*/React.createElement(Layout.Sider, {
226
- className: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n height: 100%;\n position: fixed;\n padding-top: 46px;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 100;\n "]))),
206
+ className: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n height: 100%;\n position: fixed;\n padding-top: 46px;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0);\n z-index: 100;\n "]))),
227
207
  style: {
228
208
  display: 'none'
229
209
  },
230
210
  theme: 'light',
231
211
  ref: sideMenuRef
232
212
  }), /*#__PURE__*/React.createElement(Layout.Content, {
233
- className: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n overflow-y: auto;\n height: 100vh;\n max-height: 100vh;\n > div {\n position: relative;\n // z-index: 1;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "])))
213
+ className: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n overflow-y: auto;\n height: 100vh;\n max-height: 100vh;\n > div {\n position: relative;\n // z-index: 1;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "])))
234
214
  }, /*#__PURE__*/React.createElement("header", {
235
- className: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 46px;\n line-height: 46px;\n background: transparent;\n pointer-events: none;\n "])))
215
+ className: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n height: 46px;\n line-height: 46px;\n background: transparent;\n pointer-events: none;\n "])))
236
216
  }), service.contentLoading ? /*#__PURE__*/React.createElement(Spin, null) : props.children));
237
217
  };
238
218
  export var AdminLayout = function AdminLayout(props) {
@@ -27,8 +27,11 @@ import { isValid, uid } from '@formily/shared';
27
27
  import { Menu, Select } from 'antd';
28
28
  import React, { useEffect, useState } from 'react';
29
29
  import { useTranslation } from 'react-i18next';
30
- import { useActionContext, useCompile, useDesignable } from '../..';
30
+ import { useDesignable } from '../..';
31
31
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
32
+ import { useCollection } from '../../../collection-manager';
33
+ import { useRecord } from '../../../record-provider';
34
+ import { useFormBlockContext } from '../../../block-provider/FormBlockProvider';
32
35
  import { requestSettingsSchema } from './utils';
33
36
 
34
37
  var MenuGroup = function MenuGroup(props) {
@@ -56,7 +59,7 @@ var MenuGroup = function MenuGroup(props) {
56
59
  };
57
60
 
58
61
  export var ActionDesigner = function ActionDesigner(props) {
59
- var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _fieldSchema$xCompon6, _fieldSchema$xCompon7, _fieldSchema$xCompon8, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7, _fieldSchema$xAction8, _fieldSchema$xAction9, _fieldSchema$xAction10;
62
+ var _fieldSchema$xAction, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _fieldSchema$xCompon6, _fieldSchema$xCompon7, _fieldSchema$xCompon8, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7, _fieldSchema$xAction8, _fieldSchema$xAction9, _fieldSchema$xAction10, _fieldSchema$xAction11;
60
63
 
61
64
  var modalTip = props.modalTip,
62
65
  restProps = _objectWithoutProperties(props, _excluded);
@@ -64,23 +67,25 @@ export var ActionDesigner = function ActionDesigner(props) {
64
67
  var field = useField();
65
68
  var fieldSchema = useFieldSchema();
66
69
 
70
+ var _useCollection = useCollection(),
71
+ name = _useCollection.name;
72
+
67
73
  var _useDesignable = useDesignable(),
68
74
  dn = _useDesignable.dn;
69
75
 
70
76
  var _useTranslation2 = useTranslation(),
71
77
  t = _useTranslation2.t;
72
78
 
73
- var compile = useCompile();
74
79
  var isPopupAction = ['create', 'update', 'view', 'customize:popup'].includes(fieldSchema['x-action'] || '');
75
80
  var isUpdateModePopupAction = ['customize:bulkUpdate', 'customize:bulkEdit'].includes(fieldSchema['x-action']);
76
- var context = useActionContext();
77
81
 
78
82
  var _useState = useState(),
79
83
  _useState2 = _slicedToArray(_useState, 2),
80
84
  initialSchema = _useState2[0],
81
85
  setInitialSchema = _useState2[1];
82
86
 
83
- var actionType = fieldSchema['x-action'] || '';
87
+ var actionType = (_fieldSchema$xAction = fieldSchema['x-action']) !== null && _fieldSchema$xAction !== void 0 ? _fieldSchema$xAction : '';
88
+ var isLinkageAction = Object.keys(useFormBlockContext()).length > 0 && Object.keys(useRecord()).length > 0;
84
89
  useEffect(function () {
85
90
  var schemaUid = uid();
86
91
  var schema = {
@@ -160,6 +165,8 @@ export var ActionDesigner = function ActionDesigner(props) {
160
165
  dn.refresh();
161
166
  }
162
167
  }
168
+ }), isLinkageAction && /*#__PURE__*/React.createElement(SchemaSettings.LinkageRules, {
169
+ collectionName: name
163
170
  }), isPopupAction && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
164
171
  title: t('Open mode'),
165
172
  options: [{
@@ -226,7 +233,7 @@ export var ActionDesigner = function ActionDesigner(props) {
226
233
  label: t('All'),
227
234
  value: 'all'
228
235
  }],
229
- value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction === void 0 ? void 0 : _fieldSchema$xAction['updateMode'],
236
+ value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction2 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction2 === void 0 ? void 0 : _fieldSchema$xAction2['updateMode'],
230
237
  onChange: function onChange(value) {
231
238
  fieldSchema['x-action-settings']['updateMode'] = value;
232
239
  dn.emit('patch', {
@@ -237,12 +244,12 @@ export var ActionDesigner = function ActionDesigner(props) {
237
244
  });
238
245
  dn.refresh();
239
246
  }
240
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction2 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction2 === void 0 ? void 0 : _fieldSchema$xAction2.assignedValues) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
247
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction3 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction3 === void 0 ? void 0 : _fieldSchema$xAction3.assignedValues) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
241
248
  title: t('Assign field values'),
242
249
  initialSchema: initialSchema,
243
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction3 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction3 === void 0 ? void 0 : _fieldSchema$xAction3.assignedValues,
250
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.assignedValues,
244
251
  modalTip: tips[actionType],
245
- uid: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.schemaUid,
252
+ uid: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.schemaUid,
246
253
  onSubmit: function onSubmit(assignedValues) {
247
254
  var _schema2;
248
255
 
@@ -252,10 +259,10 @@ export var ActionDesigner = function ActionDesigner(props) {
252
259
  });
253
260
  dn.refresh();
254
261
  }
255
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.requestSettings) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
262
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction6 === void 0 ? void 0 : _fieldSchema$xAction6.requestSettings) && /*#__PURE__*/React.createElement(SchemaSettings.ActionModalItem, {
256
263
  title: t('Request settings'),
257
264
  schema: requestSettingsSchema,
258
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction6 === void 0 ? void 0 : _fieldSchema$xAction6.requestSettings,
265
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7.requestSettings,
259
266
  onSubmit: function onSubmit(requestSettings) {
260
267
  var _schema3;
261
268
 
@@ -265,9 +272,9 @@ export var ActionDesigner = function ActionDesigner(props) {
265
272
  });
266
273
  dn.refresh();
267
274
  }
268
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7.skipValidator) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
275
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction8 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction8 === void 0 ? void 0 : _fieldSchema$xAction8.skipValidator) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
269
276
  title: t('Skip required validation'),
270
- checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction8 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction8 === void 0 ? void 0 : _fieldSchema$xAction8.skipValidator),
277
+ checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9.skipValidator),
271
278
  onChange: function onChange(value) {
272
279
  var _schema4;
273
280
 
@@ -276,7 +283,7 @@ export var ActionDesigner = function ActionDesigner(props) {
276
283
  schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-action-settings', _objectSpread({}, fieldSchema['x-action-settings'])), _schema4)
277
284
  });
278
285
  }
279
- }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9['onSuccess']) && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
286
+ }), isValid(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction10 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction10 === void 0 ? void 0 : _fieldSchema$xAction10['onSuccess']) && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
280
287
  title: {
281
288
  'customize:save': t('After successful save'),
282
289
  'customize:update': t('After successful update'),
@@ -284,7 +291,7 @@ export var ActionDesigner = function ActionDesigner(props) {
284
291
  'customize:form:request': t('After successful request'),
285
292
  'customize:bulkUpdate': t('After successful bulk update')
286
293
  }[actionType],
287
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction10 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction10 === void 0 ? void 0 : _fieldSchema$xAction10['onSuccess'],
294
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction11 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction11 === void 0 ? void 0 : _fieldSchema$xAction11['onSuccess'],
288
295
  schema: {
289
296
  type: 'object',
290
297
  title: {
@@ -1,4 +1,4 @@
1
- var _excluded = ["popover", "confirm", "containerRefKey", "component", "useAction", "className", "icon", "title"];
1
+ var _excluded = ["popover", "confirm", "openMode", "containerRefKey", "component", "useAction", "className", "icon", "title"];
2
2
 
3
3
  var _templateObject, _templateObject2;
4
4
 
@@ -30,12 +30,13 @@ import { css } from '@emotion/css';
30
30
  import { observer, RecursionField, useField, useFieldSchema, useForm } from '@formily/react';
31
31
  import { Button, Modal, Popover } from 'antd';
32
32
  import classnames from 'classnames';
33
- import React, { useState } from 'react';
33
+ import React, { useState, useEffect } from 'react';
34
34
  import { useActionContext } from '../..';
35
35
  import { Icon } from '../../../icon';
36
36
  import { SortableItem } from '../../common';
37
37
  import { useCompile, useDesigner } from '../../hooks';
38
38
  import { useProps } from '../../hooks/useProps';
39
+ import { useRecord } from '../../../record-provider';
39
40
  import ActionContainer from './Action.Container';
40
41
  import { ActionDesigner } from './Action.Designer';
41
42
  import { ActionDrawer } from './Action.Drawer';
@@ -44,12 +45,15 @@ import { ActionModal } from './Action.Modal';
44
45
  import { ActionPage } from './Action.Page';
45
46
  import { ActionContext } from './context';
46
47
  import { useA } from './hooks';
48
+ import { useDesignable } from '../../';
49
+ import { linkageAction } from './utils';
47
50
  export var actionDesignerCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.nb-action-link {\n > .general-schema-designer {\n top: -10px;\n bottom: -10px;\n left: -10px;\n right: -10px;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(241, 139, 98, 0.06);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n"])));
48
51
  export var Action = observer(function (props) {
49
52
  var _fieldSchema$xCompon, _fieldSchema$xCompon2;
50
53
 
51
54
  var popover = props.popover,
52
55
  confirm = props.confirm,
56
+ om = props.openMode,
53
57
  containerRefKey = props.containerRefKey,
54
58
  component = props.component,
55
59
  _props$useAction = props.useAction,
@@ -81,13 +85,28 @@ export var Action = observer(function (props) {
81
85
  var fieldSchema = useFieldSchema();
82
86
  var compile = useCompile();
83
87
  var form = useForm();
88
+ var values = useRecord();
84
89
  var designerProps = fieldSchema['x-designer-props'];
85
90
  var openMode = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['openMode'];
86
91
  var disabled = form.disabled || field.disabled;
87
92
  var openSize = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2['openSize'];
93
+ var linkageRules = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']) || [];
94
+
95
+ var _useDesignable = useDesignable(),
96
+ designable = _useDesignable.designable;
97
+
98
+ useEffect(function () {
99
+ linkageRules.map(function (v) {
100
+ var _v$actions;
101
+
102
+ return (_v$actions = v.actions) === null || _v$actions === void 0 ? void 0 : _v$actions.map(function (h) {
103
+ linkageAction(h.operator, field, v.condition, values, designable);
104
+ });
105
+ });
106
+ }, [linkageRules]);
88
107
 
89
108
  var renderButton = function renderButton() {
90
- var _field$data;
109
+ var _field$data, _field$data2;
91
110
 
92
111
  return /*#__PURE__*/React.createElement(SortableItem, _objectSpread(_objectSpread({}, others), {}, {
93
112
  loading: field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.loading,
@@ -95,6 +114,9 @@ export var Action = observer(function (props) {
95
114
  type: icon
96
115
  }),
97
116
  disabled: disabled,
117
+ style: {
118
+ border: (field === null || field === void 0 ? void 0 : (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : _field$data2.hidden) && '1px dashed #ede9e9'
119
+ },
98
120
  onClick: function onClick(e) {
99
121
  if (!disabled) {
100
122
  e.preventDefault();
@@ -1,2 +1,3 @@
1
1
  import type { ISchema } from '@formily/react';
2
2
  export declare const requestSettingsSchema: ISchema;
3
+ export declare const linkageAction: (operator: any, field: any, condition: any, values: any, designable: any) => any;
@@ -1,3 +1,6 @@
1
+ import { last } from 'lodash';
2
+ import { conditionAnalyse } from '../../common/utils/uitls';
3
+ import { ActionType } from '../../../schema-settings/LinkageRules/type';
1
4
  var validateJSON = {
2
5
  validator: "{{(value, rule)=> {\n if (!value) {\n return '';\n }\n try {\n const val = JSON.parse(value);\n if(!isNaN(val)) {\n return false;\n }\n return true;\n } catch(error) {\n console.error(error);\n return false;\n }\n }}}",
3
6
  message: '{{t("Invalid JSON format")}}'
@@ -57,4 +60,50 @@ export var requestSettingsSchema = {
57
60
  'x-validator': validateJSON
58
61
  }
59
62
  }
63
+ };
64
+ export var linkageAction = function linkageAction(operator, field, condition, values, designable) {
65
+ var displayResult = [field.display];
66
+ var disableResult = [field.disabled];
67
+
68
+ switch (operator) {
69
+ case ActionType.Visible:
70
+ if (conditionAnalyse(condition, values)) {
71
+ displayResult.push(operator);
72
+ }
73
+
74
+ field.display = last(displayResult);
75
+ break;
76
+
77
+ case ActionType.Hidden:
78
+ if (conditionAnalyse(condition, values)) {
79
+ if (!designable) {
80
+ displayResult.push(operator);
81
+ } else {
82
+ field.data = field.data || {};
83
+ field.data.hidden = true;
84
+ }
85
+ }
86
+
87
+ field.display = last(displayResult);
88
+ break;
89
+
90
+ case ActionType.Disabled:
91
+ if (conditionAnalyse(condition, values)) {
92
+ disableResult.push(true);
93
+ }
94
+
95
+ field.disabled = last(disableResult);
96
+ break;
97
+
98
+ case ActionType.Active:
99
+ if (conditionAnalyse(condition, values)) {
100
+ disableResult.push(false);
101
+ }
102
+
103
+ field.disabled = last(disableResult);
104
+ break;
105
+
106
+ default:
107
+ return null;
108
+ }
60
109
  };
@@ -8,7 +8,7 @@ import cls from 'classnames';
8
8
  import React from 'react';
9
9
  import { useCollection } from '../../../collection-manager';
10
10
  import { useSchemaInitializer } from '../../../schema-initializer';
11
- import { SortableItem } from '../../common';
11
+ import { DndContext, SortableItem } from '../../common';
12
12
  import { useDesigner } from '../../hooks';
13
13
  import { AssociationFilterInitializer } from './AssociationFilter.Initializer';
14
14
  import { AssociationFilterItem } from './AssociationFilter.Item';
@@ -21,9 +21,9 @@ export var AssociationFilter = function AssociationFilter(props) {
21
21
  exists = _useSchemaInitializer.exists,
22
22
  render = _useSchemaInitializer.render;
23
23
 
24
- return /*#__PURE__*/React.createElement(SortableItem, {
25
- className: cls('nb-block-item', props.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.nb-form-item:hover {\n > .general-schema-designer {\n background: rgba(241, 139, 98, 0.06) !important;\n border: 0 !important;\n top: -5px !important;\n bottom: -5px !important;\n left: -5px !important;\n right: -5px !important;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n border: 2px solid rgba(241, 139, 98, 0.3);\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n "]))))
26
- }, /*#__PURE__*/React.createElement(Designer, null), props.children, render());
24
+ return /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(SortableItem, {
25
+ className: cls('nb-block-item', props.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n &.nb-form-item:hover {\n > .general-schema-designer {\n background: rgba(241, 139, 98, 0.06) !important;\n border: 0 !important;\n top: -5px !important;\n bottom: -5px !important;\n left: -5px !important;\n right: -5px !important;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n border: 2px solid rgba(241, 139, 98, 0.3);\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n "]))))
26
+ }, /*#__PURE__*/React.createElement(Designer, null), props.children, render()));
27
27
  };
28
28
  AssociationFilter.Initializer = AssociationFilterInitializer;
29
29
  AssociationFilter.Item = AssociationFilterItem;
@@ -4,9 +4,9 @@ export declare type AssociationSelectProps<P = any> = RemoteSelectProps<P> & {
4
4
  action?: string;
5
5
  multiple?: boolean;
6
6
  };
7
- interface RemoteSelectInterface {
7
+ interface AssociationSelectInterface {
8
8
  (props: any): React.ReactElement;
9
9
  Designer: React.FC;
10
10
  }
11
- export declare const AssociationSelect: RemoteSelectInterface;
11
+ export declare const AssociationSelect: AssociationSelectInterface;
12
12
  export default AssociationSelect;
@@ -4,25 +4,66 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  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; }
6
6
 
7
+ 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); }
8
+
7
9
  import { useFieldSchema } from '@formily/react';
8
- import { useMemo } from 'react';
9
- import { useCollection } from '../../../collection-manager';
10
+ import { useCallback, useMemo } from 'react';
11
+ import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
12
+ import { useCollection, useCollectionManager } from '../../../collection-manager';
13
+ import { useRecord } from '../../../record-provider';
10
14
  export default function useServiceOptions(props) {
11
15
  var _props$action = props.action,
12
16
  action = _props$action === void 0 ? 'list' : _props$action,
13
- service = props.service;
17
+ service = props.service,
18
+ fieldNames = props.fieldNames;
19
+ var params = (service === null || service === void 0 ? void 0 : service.params) || {};
14
20
  var fieldSchema = useFieldSchema();
15
21
 
16
22
  var _useCollection = useCollection(),
17
23
  getField = _useCollection.getField;
18
24
 
25
+ var _useCollectionManager = useCollectionManager(),
26
+ getCollectionFields = _useCollectionManager.getCollectionFields;
27
+
28
+ var record = useRecord();
29
+ var normalizeValues = useCallback(function (obj) {
30
+ if (obj && _typeof(obj) === 'object') {
31
+ return obj[fieldNames.value];
32
+ }
33
+
34
+ return obj;
35
+ }, [fieldNames.value]);
36
+ var value = useMemo(function () {
37
+ if (props.value === undefined || props.value === null) {
38
+ return;
39
+ }
40
+
41
+ if (Array.isArray(props.value)) {
42
+ return props.value.map(normalizeValues);
43
+ } else {
44
+ return [normalizeValues(props.value)];
45
+ }
46
+ }, [props.value, normalizeValues]);
19
47
  var collectionField = useMemo(function () {
20
48
  return getField(fieldSchema.name);
21
49
  }, [fieldSchema.name]);
50
+ var sourceValue = record === null || record === void 0 ? void 0 : record[collectionField === null || collectionField === void 0 ? void 0 : collectionField.sourceKey];
51
+ var filter = useMemo(function () {
52
+ var isOToAny = ['oho', 'o2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
53
+ return mergeFilter([mergeFilter([isOToAny ? _defineProperty({}, collectionField.foreignKey, {
54
+ $is: null
55
+ }) : null, params === null || params === void 0 ? void 0 : params.filter]), isOToAny && sourceValue !== undefined && sourceValue !== null ? _defineProperty({}, collectionField.foreignKey, {
56
+ $eq: sourceValue
57
+ }) : null, (params === null || params === void 0 ? void 0 : params.filter) && value ? _defineProperty({}, fieldNames.value, _defineProperty({}, '$in', value)) : null], '$or');
58
+ }, [params === null || params === void 0 ? void 0 : params.filter, getCollectionFields, collectionField, sourceValue, value, fieldNames.value]);
22
59
  return useMemo(function () {
23
- return _objectSpread({
60
+ return _objectSpread(_objectSpread({
24
61
  resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
25
62
  action: action
26
- }, service);
27
- }, [collectionField === null || collectionField === void 0 ? void 0 : collectionField.target, action, service]);
63
+ }, service), {}, {
64
+ params: _objectSpread(_objectSpread({}, service === null || service === void 0 ? void 0 : service.params), {}, {
65
+ filter: filter
66
+ })
67
+ });
68
+ }, [collectionField === null || collectionField === void 0 ? void 0 : collectionField.target, action, filter, service]);
28
69
  }
@@ -7,45 +7,24 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
7
7
  import { useField, useFieldSchema } from '@formily/react';
8
8
  import React from 'react';
9
9
  import { useTranslation } from 'react-i18next';
10
- import { useCompile, useDesignable } from '../..';
10
+ import { useDesignable } from '../..';
11
11
  import { useCalendarBlockContext } from '../../../block-provider';
12
- import { useCollection } from '../../../collection-manager';
12
+ import { useCollection, useCollectionManager } from '../../../collection-manager';
13
13
  import { useCollectionFilterOptions } from '../../../collection-manager/action-hooks';
14
14
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
15
15
  import { useSchemaTemplate } from '../../../schema-templates';
16
-
17
- var useOptions = function useOptions() {
18
- var _fields$filter;
19
-
20
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'string';
21
- var compile = useCompile();
22
-
23
- var _useCollection = useCollection(),
24
- fields = _useCollection.fields;
25
-
26
- var options = fields === null || fields === void 0 ? void 0 : (_fields$filter = fields.filter(function (field) {
27
- return field.type === type;
28
- })) === null || _fields$filter === void 0 ? void 0 : _fields$filter.map(function (field) {
29
- var _field$uiSchema;
30
-
31
- return {
32
- value: field.name,
33
- label: compile(field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title)
34
- };
35
- });
36
- return options;
37
- };
38
-
39
16
  export var CalendarDesigner = function CalendarDesigner() {
40
17
  var _fieldSchema$xDecora, _fieldSchema$xDecora$, _fieldSchema$xDecora2, _fieldSchema$xDecora3;
41
18
 
42
19
  var field = useField();
43
20
  var fieldSchema = useFieldSchema();
44
21
 
45
- var _useCollection2 = useCollection(),
46
- name = _useCollection2.name,
47
- title = _useCollection2.title,
48
- fields = _useCollection2.fields;
22
+ var _useCollection = useCollection(),
23
+ name = _useCollection.name,
24
+ title = _useCollection.title;
25
+
26
+ var _useCollectionManager = useCollectionManager(),
27
+ getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
49
28
 
50
29
  var dataSource = useCollectionFilterOptions(name);
51
30
 
@@ -55,8 +34,6 @@ export var CalendarDesigner = function CalendarDesigner() {
55
34
  var _useDesignable = useDesignable(),
56
35
  dn = _useDesignable.dn;
57
36
 
58
- var compile = useCompile();
59
-
60
37
  var _useTranslation = useTranslation(),
61
38
  t = _useTranslation.t;
62
39
 
@@ -70,7 +47,7 @@ export var CalendarDesigner = function CalendarDesigner() {
70
47
  }, /*#__PURE__*/React.createElement(SchemaSettings.BlockTitleItem, null), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
71
48
  title: t('Title field'),
72
49
  value: fieldNames.title,
73
- options: useOptions('string'),
50
+ options: getCollectionFieldsOptions(name, 'string'),
74
51
  onChange: function onChange(title) {
75
52
  var _schema;
76
53
 
@@ -99,10 +76,12 @@ export var CalendarDesigner = function CalendarDesigner() {
99
76
  });
100
77
  dn.refresh();
101
78
  }
102
- }), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
79
+ }), /*#__PURE__*/React.createElement(SchemaSettings.CascaderItem, {
103
80
  title: t('Start date field'),
104
81
  value: fieldNames.start,
105
- options: useOptions('date'),
82
+ options: getCollectionFieldsOptions(name, 'date', {
83
+ association: ['o2o', 'obo', 'oho', 'm2o']
84
+ }),
106
85
  onChange: function onChange(start) {
107
86
  var _schema3;
108
87
 
@@ -116,10 +95,12 @@ export var CalendarDesigner = function CalendarDesigner() {
116
95
  });
117
96
  dn.refresh();
118
97
  }
119
- }), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
98
+ }), /*#__PURE__*/React.createElement(SchemaSettings.CascaderItem, {
120
99
  title: t('End date field'),
121
100
  value: fieldNames.end,
122
- options: useOptions('date'),
101
+ options: getCollectionFieldsOptions(name, 'date', {
102
+ association: ['o2o', 'obo', 'oho', 'm2o']
103
+ }),
123
104
  onChange: function onChange(end) {
124
105
  var _schema4;
125
106
 
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  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; }
6
6
 
7
- import { CheckOutlined } from '@ant-design/icons';
7
+ import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
8
8
  import { connect, mapProps, mapReadPretty, useField } from '@formily/react';
9
9
  import { isValid } from '@formily/shared';
10
10
  import { Checkbox as AntdCheckbox, Tag } from 'antd';
@@ -21,17 +21,18 @@ export var Checkbox = connect(function (props) {
21
21
  }, mapProps({
22
22
  value: 'checked',
23
23
  onInput: 'onChange'
24
- }, function (props, field) {
25
- // console.log({ props, field });
26
- return _objectSpread({}, props);
27
24
  }), mapReadPretty(function (props) {
28
- if (!isValid(props.value)) {
29
- return null;
25
+ if (props.value) {
26
+ return /*#__PURE__*/React.createElement(CheckOutlined, {
27
+ style: {
28
+ color: '#52c41a'
29
+ }
30
+ });
30
31
  }
31
32
 
32
- return props.value ? /*#__PURE__*/React.createElement(CheckOutlined, {
33
+ return props.showUnchecked ? /*#__PURE__*/React.createElement(CloseOutlined, {
33
34
  style: {
34
- color: '#52c41a'
35
+ color: '#ff4d4f'
35
36
  }
36
37
  }) : null;
37
38
  }));
@@ -5,4 +5,4 @@ export interface Moment2strOptions {
5
5
  picker?: 'year' | 'month' | 'week' | 'quarter';
6
6
  }
7
7
  export declare const moment2str: (value?: moment.Moment | moment.Moment[], options?: Moment2strOptions) => string | string[] | moment.Moment | moment.Moment[];
8
- export declare const mapDateFormat: () => (props: any) => any;
8
+ export declare const mapDateFormat: () => (props: any, field: any) => any;
@@ -60,7 +60,7 @@ export var moment2str = function moment2str(value) {
60
60
  return toGmtByPicker(value, picker);
61
61
  };
62
62
  export var mapDateFormat = function mapDateFormat() {
63
- return function (props) {
63
+ return function (props, field) {
64
64
  var format = getDefaultFormat(props);
65
65
  var _onChange = props.onChange;
66
66
  return _objectSpread(_objectSpread({}, props), {}, {