@nocobase/client 0.9.2-alpha.3 → 0.9.3-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 (237) hide show
  1. package/es/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
  2. package/es/api-client/hooks/useRequest.d.ts +1 -14
  3. package/es/api-client/hooks/useRequest.js +48 -53
  4. package/es/block-provider/DetailsBlockProvider.js +13 -1
  5. package/es/block-provider/FormBlockProvider.js +30 -13
  6. package/es/block-provider/hooks/index.d.ts +11 -1
  7. package/es/block-provider/hooks/index.js +527 -301
  8. package/es/collection-manager/Configuration/CollectionFields.js +1 -2
  9. package/es/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
  10. package/es/collection-manager/action-hooks.d.ts +4 -43
  11. package/es/collection-manager/action-hooks.js +18 -7
  12. package/es/collection-manager/interfaces/createdBy.js +1 -1
  13. package/es/collection-manager/interfaces/linkTo.js +5 -40
  14. package/es/collection-manager/interfaces/m2m.js +6 -39
  15. package/es/collection-manager/interfaces/m2o.js +6 -39
  16. package/es/collection-manager/interfaces/o2m.js +6 -69
  17. package/es/collection-manager/interfaces/o2o.js +31 -122
  18. package/es/collection-manager/interfaces/types.d.ts +2 -0
  19. package/es/collection-manager/interfaces/updatedBy.js +1 -1
  20. package/es/collection-manager/sub-table.d.ts +1 -14
  21. package/es/collection-manager/templates/tree.js +2 -2
  22. package/es/filter-provider/FilterProvider.js +3 -1
  23. package/es/locale/en_US.d.ts +4 -1
  24. package/es/locale/en_US.js +6 -3
  25. package/es/locale/ja_JP.d.ts +4 -1
  26. package/es/locale/ja_JP.js +4 -1
  27. package/es/locale/pt_BR.d.ts +1 -1
  28. package/es/locale/pt_BR.js +1 -1
  29. package/es/locale/zh_CN.d.ts +5 -1
  30. package/es/locale/zh_CN.js +5 -1
  31. package/es/schema-component/antd/action/Action.Designer.js +4 -5
  32. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  33. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +19 -0
  34. package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  35. package/es/schema-component/antd/association-field/AssociationSelect.js +118 -0
  36. package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
  37. package/es/schema-component/antd/association-field/Editable.js +88 -0
  38. package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
  39. package/es/schema-component/antd/association-field/FileManager.js +243 -0
  40. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  41. package/es/schema-component/antd/association-field/InternalNester.js +28 -0
  42. package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  43. package/es/schema-component/antd/association-field/InternalPicker.js +267 -0
  44. package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  45. package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
  46. package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  47. package/es/schema-component/antd/association-field/InternalViewer.js +115 -0
  48. package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
  49. package/es/schema-component/antd/association-field/Nester.js +80 -0
  50. package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  51. package/es/schema-component/antd/association-field/ReadPretty.js +38 -0
  52. package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
  53. package/es/schema-component/antd/association-field/SubTable.js +25 -0
  54. package/es/schema-component/antd/association-field/context.d.ts +7 -0
  55. package/es/schema-component/antd/association-field/context.js +2 -0
  56. package/es/schema-component/antd/association-field/hooks.d.ts +8 -0
  57. package/es/schema-component/antd/association-field/hooks.js +96 -0
  58. package/es/schema-component/antd/association-field/index.d.ts +1 -0
  59. package/es/schema-component/antd/association-field/index.js +14 -0
  60. package/es/schema-component/antd/association-field/schema.d.ts +142 -0
  61. package/es/schema-component/antd/association-field/schema.js +141 -0
  62. package/es/schema-component/antd/association-field/util.d.ts +8 -0
  63. package/es/schema-component/antd/association-field/util.js +84 -0
  64. package/es/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
  65. package/es/schema-component/antd/association-select/AssociationSelect.js +11 -2
  66. package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  67. package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
  68. package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  69. package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
  70. package/es/schema-component/antd/expand-action/index.d.ts +1 -0
  71. package/es/schema-component/antd/expand-action/index.js +5 -0
  72. package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  73. package/es/schema-component/antd/filter/FilterItem.js +1 -1
  74. package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
  75. package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
  76. package/es/schema-component/antd/form-item/FormItem.js +206 -58
  77. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
  78. package/es/schema-component/antd/form-v2/utils.js +6 -4
  79. package/es/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
  80. package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  81. package/es/schema-component/antd/index.d.ts +3 -1
  82. package/es/schema-component/antd/index.js +3 -1
  83. package/es/schema-component/antd/menu/Menu.js +6 -3
  84. package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  85. package/es/schema-component/antd/record-picker/InputRecordPicker.js +40 -17
  86. package/es/schema-component/antd/remote-select/RemoteSelect.js +16 -18
  87. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  88. package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  89. package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
  90. package/es/schema-component/antd/table-v2/Table.js +9 -5
  91. package/es/schema-component/antd/table-v2/index.js +3 -1
  92. package/es/schema-component/antd/table-v2/utils.js +1 -1
  93. package/es/schema-component/antd/variable/Input.js +15 -16
  94. package/es/schema-component/antd/variable/TextArea.js +2 -5
  95. package/es/schema-component/antd/variable/Variable.d.ts +2 -0
  96. package/es/schema-component/antd/variable/Variable.js +5 -2
  97. package/es/schema-component/common/dnd-context/index.js +3 -2
  98. package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
  99. package/es/schema-component/common/utils/uitls.js +1 -1
  100. package/es/schema-component/hooks/index.d.ts +1 -0
  101. package/es/schema-component/hooks/index.js +2 -1
  102. package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  103. package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
  104. package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  105. package/es/schema-initializer/components/CreateRecordAction.js +4 -3
  106. package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  107. package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
  108. package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  109. package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
  110. package/es/schema-initializer/items/index.d.ts +1 -0
  111. package/es/schema-initializer/items/index.js +2 -1
  112. package/es/schema-initializer/utils.js +57 -43
  113. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  114. package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
  115. package/es/schema-settings/LinkageRules/Variables.js +7 -4
  116. package/es/schema-settings/SchemaSettings.js +3 -3
  117. package/es/schema-settings/VariableInput/VariableInput.d.ts +3 -2
  118. package/es/schema-settings/VariableInput/VariableInput.js +3 -1
  119. package/lib/acl/Configuration/schemas/useRoleResourceValues.d.ts +1 -14
  120. package/lib/api-client/hooks/useRequest.d.ts +1 -14
  121. package/lib/api-client/hooks/useRequest.js +48 -53
  122. package/lib/block-provider/DetailsBlockProvider.js +13 -1
  123. package/lib/block-provider/FormBlockProvider.js +31 -15
  124. package/lib/block-provider/hooks/index.d.ts +11 -1
  125. package/lib/block-provider/hooks/index.js +537 -308
  126. package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
  127. package/lib/collection-manager/Configuration/EditCollectionAction.d.ts +1 -14
  128. package/lib/collection-manager/action-hooks.d.ts +4 -43
  129. package/lib/collection-manager/action-hooks.js +18 -7
  130. package/lib/collection-manager/interfaces/createdBy.js +1 -1
  131. package/lib/collection-manager/interfaces/linkTo.js +4 -39
  132. package/lib/collection-manager/interfaces/m2m.js +5 -38
  133. package/lib/collection-manager/interfaces/m2o.js +5 -38
  134. package/lib/collection-manager/interfaces/o2m.js +8 -71
  135. package/lib/collection-manager/interfaces/o2o.js +36 -127
  136. package/lib/collection-manager/interfaces/types.d.ts +2 -0
  137. package/lib/collection-manager/interfaces/updatedBy.js +1 -1
  138. package/lib/collection-manager/sub-table.d.ts +1 -14
  139. package/lib/collection-manager/templates/tree.js +2 -2
  140. package/lib/filter-provider/FilterProvider.js +3 -1
  141. package/lib/locale/en_US.d.ts +4 -1
  142. package/lib/locale/en_US.js +6 -3
  143. package/lib/locale/ja_JP.d.ts +4 -1
  144. package/lib/locale/ja_JP.js +4 -1
  145. package/lib/locale/pt_BR.d.ts +1 -1
  146. package/lib/locale/pt_BR.js +1 -1
  147. package/lib/locale/zh_CN.d.ts +5 -1
  148. package/lib/locale/zh_CN.js +5 -1
  149. package/lib/schema-component/antd/action/Action.Designer.js +4 -5
  150. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  151. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +28 -0
  152. package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  153. package/lib/schema-component/antd/association-field/AssociationSelect.js +129 -0
  154. package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
  155. package/lib/schema-component/antd/association-field/Editable.js +97 -0
  156. package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
  157. package/lib/schema-component/antd/association-field/FileManager.js +253 -0
  158. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  159. package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
  160. package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  161. package/lib/schema-component/antd/association-field/InternalPicker.js +277 -0
  162. package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  163. package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
  164. package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  165. package/lib/schema-component/antd/association-field/InternalViewer.js +126 -0
  166. package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
  167. package/lib/schema-component/antd/association-field/Nester.js +89 -0
  168. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  169. package/lib/schema-component/antd/association-field/ReadPretty.js +47 -0
  170. package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
  171. package/lib/schema-component/antd/association-field/SubTable.js +33 -0
  172. package/lib/schema-component/antd/association-field/context.d.ts +7 -0
  173. package/lib/schema-component/antd/association-field/context.js +9 -0
  174. package/lib/schema-component/antd/association-field/hooks.d.ts +8 -0
  175. package/lib/schema-component/antd/association-field/hooks.js +107 -0
  176. package/lib/schema-component/antd/association-field/index.d.ts +1 -0
  177. package/lib/schema-component/antd/association-field/index.js +21 -0
  178. package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
  179. package/lib/schema-component/antd/association-field/schema.js +148 -0
  180. package/lib/schema-component/antd/association-field/util.d.ts +8 -0
  181. package/lib/schema-component/antd/association-field/util.js +98 -0
  182. package/lib/schema-component/antd/association-filter/AssociationFilter.FilterBlockInitializer.js +2 -2
  183. package/lib/schema-component/antd/association-select/AssociationSelect.js +10 -1
  184. package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  185. package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
  186. package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  187. package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
  188. package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
  189. package/lib/schema-component/antd/expand-action/index.js +12 -0
  190. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  191. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  192. package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
  193. package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
  194. package/lib/schema-component/antd/form-item/FormItem.js +204 -55
  195. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
  196. package/lib/schema-component/antd/form-v2/utils.js +6 -5
  197. package/lib/schema-component/antd/gantt/components/gantt/gantt.js +3 -3
  198. package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  199. package/lib/schema-component/antd/index.d.ts +3 -1
  200. package/lib/schema-component/antd/index.js +33 -11
  201. package/lib/schema-component/antd/menu/Menu.js +6 -3
  202. package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  203. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +42 -18
  204. package/lib/schema-component/antd/remote-select/RemoteSelect.js +15 -17
  205. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  206. package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  207. package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
  208. package/lib/schema-component/antd/table-v2/Table.js +9 -5
  209. package/lib/schema-component/antd/table-v2/index.js +3 -1
  210. package/lib/schema-component/antd/table-v2/utils.js +1 -1
  211. package/lib/schema-component/antd/variable/Input.js +15 -16
  212. package/lib/schema-component/antd/variable/TextArea.js +2 -5
  213. package/lib/schema-component/antd/variable/Variable.d.ts +2 -0
  214. package/lib/schema-component/antd/variable/Variable.js +6 -2
  215. package/lib/schema-component/common/dnd-context/index.js +3 -2
  216. package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
  217. package/lib/schema-component/common/utils/uitls.js +1 -1
  218. package/lib/schema-component/hooks/index.d.ts +1 -0
  219. package/lib/schema-component/hooks/index.js +11 -0
  220. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  221. package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
  222. package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  223. package/lib/schema-initializer/components/CreateRecordAction.js +4 -3
  224. package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  225. package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
  226. package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  227. package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
  228. package/lib/schema-initializer/items/index.d.ts +1 -0
  229. package/lib/schema-initializer/items/index.js +11 -0
  230. package/lib/schema-initializer/utils.js +56 -42
  231. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  232. package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
  233. package/lib/schema-settings/LinkageRules/Variables.js +7 -4
  234. package/lib/schema-settings/SchemaSettings.js +4 -4
  235. package/lib/schema-settings/VariableInput/VariableInput.d.ts +3 -2
  236. package/lib/schema-settings/VariableInput/VariableInput.js +3 -1
  237. package/package.json +5 -6
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.FormItem = void 0;
7
8
  exports.getFieldDefaultValue = getFieldDefaultValue;
9
+ exports.isFileCollection = isFileCollection;
8
10
  var _css = require("@emotion/css");
9
11
  var _antd = require("@formily/antd");
10
12
  var _react = require("@formily/react");
11
13
  var _shared = require("@formily/shared");
12
14
  var _lodash = _interopRequireDefault(require("lodash"));
15
+ var _moment = _interopRequireDefault(require("moment"));
13
16
  var _react2 = _interopRequireWildcard(require("react"));
14
17
  var _reactI18next = require("react-i18next");
15
18
  var _ACLProvider = require("../../../acl/ACLProvider");
@@ -18,27 +21,30 @@ var _collectionManager = require("../../../collection-manager");
18
21
  var _CollectionFields = require("../../../collection-manager/Configuration/CollectionFields");
19
22
  var _schemaSettings = require("../../../schema-settings");
20
23
  var _VariableInput = require("../../../schema-settings/VariableInput/VariableInput");
24
+ var _FilterDynamicComponent = require("../table-v2/FilterDynamicComponent");
21
25
  var _uitls = require("../../common/utils/uitls");
22
26
  var _core = require("../../core");
27
+ var _filter = require("../filter");
23
28
  var _hooks = require("../../hooks");
24
29
  var _blockItem = require("../block-item");
25
30
  var _shared2 = require("../input/shared");
31
+ var _variable = require("../variable");
26
32
  var _FormItem = require("./FormItem.FilterFormDesigner");
27
33
  var _SchemaSettingOptions = require("./SchemaSettingOptions");
28
- var _templateObject;
34
+ var _templateObject, _templateObject2;
29
35
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
36
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
- 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); }
33
38
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
34
39
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
40
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
36
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
37
41
  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; }
38
42
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
43
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
40
44
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
41
45
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
46
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
47
+ var defaultInputStyle = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & > .nb-form-item {\n flex: 1;\n }\n"])));
42
48
  var divWrap = function divWrap(schema) {
43
49
  return {
44
50
  type: 'void',
@@ -70,7 +76,7 @@ var FormItem = (0, _react.observer)(function (props) {
70
76
  return /*#__PURE__*/_react2.default.createElement(_ACLProvider.ACLCollectionFieldProvider, null, /*#__PURE__*/_react2.default.createElement(_blockItem.BlockItem, {
71
77
  className: 'nb-form-item'
72
78
  }, /*#__PURE__*/_react2.default.createElement(_antd.FormItem, _objectSpread(_objectSpread({
73
- className: "".concat((0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]))))
79
+ className: "".concat((0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & .ant-space {\n flex-wrap: wrap;\n }\n "]))))
74
80
  }, props), {}, {
75
81
  extra: typeof field.description === 'string' ? /*#__PURE__*/_react2.default.createElement("div", {
76
82
  dangerouslySetInnerHTML: {
@@ -81,7 +87,7 @@ var FormItem = (0, _react.observer)(function (props) {
81
87
  });
82
88
  exports.FormItem = FormItem;
83
89
  FormItem.Designer = function Designer() {
84
- var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5, _field$componentProps, _field$componentProps2;
90
+ var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _field$componentProps, _field$componentProps2, _field$componentProps3, _field$componentProps4, _field$componentProps5, _field$componentProps6, _field$componentProps7, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps8, _field$componentProps9;
85
91
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
86
92
  getCollectionFields = _useCollectionManager.getCollectionFields,
87
93
  getInterface = _useCollectionManager.getInterface,
@@ -108,8 +114,10 @@ FormItem.Designer = function Designer() {
108
114
  var validateSchema = interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$vali = interfaceConfig['validateSchema']) === null || _interfaceConfig$vali === void 0 ? void 0 : _interfaceConfig$vali.call(interfaceConfig, fieldSchema);
109
115
  var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title;
110
116
  var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) : (_getCollectionFields = getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection)) !== null && _getCollectionFields !== void 0 ? _getCollectionFields : [];
111
- var fieldComponentOptions = (0, _hooks.useFieldComponentOptions)();
112
- var isSubFormAssociationField = field.address.segments.includes('__form_grid');
117
+ var fieldModeOptions = (0, _hooks.useFieldModeOptions)();
118
+ var isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.type);
119
+ var isTableField = fieldSchema['x-component'] === 'TableField';
120
+ var isFileField = isFileCollection(targetCollection);
113
121
  var initialValue = {
114
122
  title: field.title === originalTitle ? undefined : field.title
115
123
  };
@@ -132,6 +140,21 @@ FormItem.Designer = function Designer() {
132
140
  if (fieldSchema['x-read-pretty'] === true) {
133
141
  readOnlyMode = 'read-pretty';
134
142
  }
143
+ var dataSource = (0, _collectionManager.useCollectionFilterOptions)(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
144
+ var defaultFilter = ((_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.service) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.params) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.filter) || {};
145
+ var sortFields = (0, _collectionManager.useSortFields)(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
146
+ var defaultSort = ((_field$componentProps4 = field.componentProps) === null || _field$componentProps4 === void 0 ? void 0 : (_field$componentProps5 = _field$componentProps4.service) === null || _field$componentProps5 === void 0 ? void 0 : (_field$componentProps6 = _field$componentProps5.params) === null || _field$componentProps6 === void 0 ? void 0 : _field$componentProps6.sort) || [];
147
+ var fieldMode = (field === null || field === void 0 ? void 0 : (_field$componentProps7 = field.componentProps) === null || _field$componentProps7 === void 0 ? void 0 : _field$componentProps7['mode']) || (isFileField ? 'FileManager' : 'Select');
148
+ var isSelectFieldMode = fieldMode === 'Select';
149
+ var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
150
+ return item.startsWith('-') ? {
151
+ field: item.substring(1),
152
+ direction: 'desc'
153
+ } : {
154
+ field: item,
155
+ direction: 'asc'
156
+ };
157
+ });
135
158
  return /*#__PURE__*/_react2.default.createElement(_schemaSettings.GeneralSchemaDesigner, null, collectionField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
136
159
  key: "edit-field-title",
137
160
  title: t('Edit field title'),
@@ -233,10 +256,10 @@ FormItem.Designer = function Designer() {
233
256
  });
234
257
  refresh();
235
258
  }
236
- }), !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileCollection(targetCollection) ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
259
+ }), !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
237
260
  key: "quick-upload",
238
261
  title: t('Quick upload'),
239
- checked: (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.quickUpload,
262
+ checked: ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.quickUpload) !== false,
240
263
  onChange: function onChange(value) {
241
264
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
242
265
  field.componentProps.quickUpload = value;
@@ -248,10 +271,10 @@ FormItem.Designer = function Designer() {
248
271
  });
249
272
  refresh();
250
273
  }
251
- }) : null, !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileCollection(targetCollection) ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
274
+ }) : null, !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
252
275
  key: "select-file",
253
276
  title: t('Select file'),
254
- checked: (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.selectFile,
277
+ checked: ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.selectFile) !== false,
255
278
  onChange: function onChange(value) {
256
279
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
257
280
  field.componentProps.selectFile = value;
@@ -410,27 +433,35 @@ FormItem.Designer = function Designer() {
410
433
  type: 'object',
411
434
  title: t('Set default value'),
412
435
  properties: {
413
- // 关系字段不支持设置变量
414
- default: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
436
+ default: (0, _variable.isInvariable)(interfaceConfig) ? _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
415
437
  'x-decorator': 'FormItem',
416
438
  'x-component-props': _objectSpread(_objectSpread({}, fieldSchema['x-component-props']), {}, {
417
439
  component: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) && collectionField.interface !== 'chinaRegion' ? 'AssociationSelect' : undefined,
418
440
  service: {
419
441
  resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
442
+ },
443
+ style: {
444
+ width: '100%',
445
+ verticalAlign: 'top'
420
446
  }
421
447
  }),
422
448
  name: 'default',
423
449
  title: t('Default value'),
424
- default: getFieldDefaultValue(fieldSchema, collectionField)
450
+ default: getFieldDefaultValue(fieldSchema, collectionField),
451
+ 'x-read-pretty': false,
452
+ 'x-disabled': false
425
453
  }) : _objectSpread(_objectSpread({}, fieldSchema || {}), {}, {
426
454
  'x-decorator': 'FormItem',
427
455
  'x-component': 'VariableInput',
428
456
  'x-component-props': _objectSpread(_objectSpread({}, (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']) || {}), {}, {
429
457
  collectionName: collectionField === null || collectionField === void 0 ? void 0 : collectionField.collectionName,
430
458
  schema: collectionField === null || collectionField === void 0 ? void 0 : collectionField.uiSchema,
459
+ className: defaultInputStyle,
431
460
  renderSchemaComponent: function Com(props) {
432
461
  var s = _lodash.default.cloneDeep(fieldSchema) || {};
433
462
  s.title = '';
463
+ s['x-read-pretty'] = false;
464
+ s['x-disabled'] = false;
434
465
  return /*#__PURE__*/_react2.default.createElement(_core.SchemaComponent, {
435
466
  schema: _objectSpread(_objectSpread({}, s || {}), {}, {
436
467
  'x-component-props': _objectSpread(_objectSpread({}, s['x-component-props']), {}, {
@@ -438,7 +469,8 @@ FormItem.Designer = function Designer() {
438
469
  value: props.value,
439
470
  defaultValue: getFieldDefaultValue(s, collectionField),
440
471
  style: {
441
- width: '100%'
472
+ width: '100%',
473
+ verticalAlign: 'top'
442
474
  }
443
475
  })
444
476
  })
@@ -463,43 +495,153 @@ FormItem.Designer = function Designer() {
463
495
  });
464
496
  refresh();
465
497
  }
466
- }), form && !isSubFormAssociationField && fieldComponentOptions && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
467
- title: t('Field component'),
468
- options: fieldComponentOptions,
469
- value: fieldSchema['x-component'],
470
- onChange: function onChange(type) {
471
- var _collectionField$uiSc4, _interfaceConfig$sche;
472
- var schema = {
473
- name: collectionField === null || collectionField === void 0 ? void 0 : collectionField.name,
474
- type: 'void',
475
- required: fieldSchema['required'],
476
- description: fieldSchema['description'],
477
- default: fieldSchema['default'],
478
- 'x-decorator': 'FormItem',
479
- 'x-designer': 'FormItem.Designer',
480
- 'x-component': type,
481
- 'x-validator': fieldSchema['x-validator'],
482
- 'x-collection-field': fieldSchema['x-collection-field'],
483
- 'x-decorator-props': fieldSchema['x-decorator-props'],
484
- 'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['x-component-props']), fieldSchema['x-component-props'])
485
- };
486
- interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
487
- field: collectionField,
488
- block: 'Form',
489
- readPretty: field.readPretty,
490
- action: tk ? 'get' : null,
491
- targetCollection: targetCollection
498
+ }), isSelectFieldMode && !field.readPretty && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
499
+ title: t('Set the data scope'),
500
+ schema: {
501
+ type: 'object',
502
+ title: t('Set the data scope'),
503
+ properties: {
504
+ filter: {
505
+ default: defaultFilter,
506
+ // title: '数据范围',
507
+ enum: dataSource,
508
+ 'x-component': 'Filter',
509
+ 'x-component-props': {
510
+ dynamicComponent: function dynamicComponent(props) {
511
+ return (0, _FilterDynamicComponent.FilterDynamicComponent)(_objectSpread({}, props));
512
+ }
513
+ }
514
+ }
515
+ }
516
+ },
517
+ onSubmit: function onSubmit(_ref4) {
518
+ var _schema6;
519
+ var filter = _ref4.filter;
520
+ filter = (0, _filter.removeNullCondition)(filter);
521
+ _lodash.default.set(field.componentProps, 'service.params.filter', filter);
522
+ fieldSchema['x-component-props'] = field.componentProps;
523
+ field.componentProps = field.componentProps;
524
+ dn.emit('patch', {
525
+ schema: (_schema6 = {}, _defineProperty(_schema6, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema6, 'x-component-props', field.componentProps), _schema6)
492
526
  });
493
- insertAdjacent('beforeBegin', divWrap(schema), {
494
- onSuccess: function onSuccess() {
495
- dn.remove(null, {
496
- removeParentsIfNoChildren: true,
497
- breakRemoveOn: {
498
- 'x-component': 'Grid'
527
+ }
528
+ }), isSelectFieldMode && !field.readPretty && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
529
+ title: t('Set default sorting rules'),
530
+ components: {
531
+ ArrayItems: _antd.ArrayItems
532
+ },
533
+ schema: {
534
+ type: 'object',
535
+ title: t('Set default sorting rules'),
536
+ properties: {
537
+ sort: {
538
+ type: 'array',
539
+ default: sort,
540
+ 'x-component': 'ArrayItems',
541
+ 'x-decorator': 'FormItem',
542
+ items: {
543
+ type: 'object',
544
+ properties: {
545
+ space: {
546
+ type: 'void',
547
+ 'x-component': 'Space',
548
+ properties: {
549
+ sort: {
550
+ type: 'void',
551
+ 'x-decorator': 'FormItem',
552
+ 'x-component': 'ArrayItems.SortHandle'
553
+ },
554
+ field: {
555
+ type: 'string',
556
+ enum: sortFields,
557
+ 'x-decorator': 'FormItem',
558
+ 'x-component': 'Select',
559
+ 'x-component-props': {
560
+ style: {
561
+ width: 260
562
+ }
563
+ }
564
+ },
565
+ direction: {
566
+ type: 'string',
567
+ 'x-decorator': 'FormItem',
568
+ 'x-component': 'Radio.Group',
569
+ 'x-component-props': {
570
+ optionType: 'button'
571
+ },
572
+ enum: [{
573
+ label: t('ASC'),
574
+ value: 'asc'
575
+ }, {
576
+ label: t('DESC'),
577
+ value: 'desc'
578
+ }]
579
+ },
580
+ remove: {
581
+ type: 'void',
582
+ 'x-decorator': 'FormItem',
583
+ 'x-component': 'ArrayItems.Remove'
584
+ }
585
+ }
586
+ }
499
587
  }
500
- });
588
+ },
589
+ properties: {
590
+ add: {
591
+ type: 'void',
592
+ title: t('Add sort field'),
593
+ 'x-component': 'ArrayItems.Addition'
594
+ }
595
+ }
501
596
  }
597
+ }
598
+ },
599
+ onSubmit: function onSubmit(_ref5) {
600
+ var _schema7;
601
+ var sort = _ref5.sort;
602
+ var sortArr = sort.map(function (item) {
603
+ return item.direction === 'desc' ? "-".concat(item.field) : item.field;
604
+ });
605
+ _lodash.default.set(field.componentProps, 'service.params.sort', sortArr);
606
+ fieldSchema['x-component-props'] = field.componentProps;
607
+ dn.emit('patch', {
608
+ schema: (_schema7 = {}, _defineProperty(_schema7, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema7, 'x-component-props', field.componentProps), _schema7)
609
+ });
610
+ }
611
+ }), isAssociationField && fieldModeOptions && !isTableField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
612
+ key: "field-mode",
613
+ title: t('Field mode'),
614
+ options: fieldModeOptions,
615
+ value: fieldMode,
616
+ onChange: function onChange(mode) {
617
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
618
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
619
+ fieldSchema['x-component-props']['mode'] = mode;
620
+ schema['x-component-props'] = fieldSchema['x-component-props'];
621
+ field.componentProps = field.componentProps || {};
622
+ field.componentProps.mode = mode;
623
+ if (mode === 'Nester') {
624
+ var initValue = ['o2m', 'm2m'].includes(collectionField.interface) ? [] : {};
625
+ field.value = field.value || initValue;
626
+ }
627
+ dn.emit('patch', {
628
+ schema: schema
502
629
  });
630
+ dn.refresh();
631
+ }
632
+ }), !field.readPretty && isAssociationField && ['Select', 'Picker'].includes(fieldMode) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
633
+ key: "allowAddNew",
634
+ title: t('Allow add new data'),
635
+ checked: fieldSchema['x-add-new'],
636
+ onChange: function onChange(allowAddNew) {
637
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
638
+ field['x-add-new'] = allowAddNew;
639
+ fieldSchema['x-add-new'] = allowAddNew;
640
+ schema['x-add-new'] = allowAddNew;
641
+ dn.emit('patch', {
642
+ schema: schema
643
+ });
644
+ refresh();
503
645
  }
504
646
  }), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && ['o2m', 'm2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && fieldSchema['x-component'] !== 'TableField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
505
647
  key: "multiple",
@@ -517,13 +659,14 @@ FormItem.Designer = function Designer() {
517
659
  });
518
660
  refresh();
519
661
  }
520
- }), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
662
+ }), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && !isFileField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
521
663
  title: t('Enable link'),
522
- checked: ((_fieldSchema$xCompon4 = (_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : _fieldSchema$xCompon5.mode) !== null && _fieldSchema$xCompon4 !== void 0 ? _fieldSchema$xCompon4 : 'links') === 'links',
664
+ checked: ((_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.enableLink) !== false,
523
665
  onChange: function onChange(flag) {
524
666
  fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
525
- mode: flag ? 'links' : 'tags'
667
+ enableLink: flag
526
668
  });
669
+ field.componentProps['enableLink'] = flag;
527
670
  dn.emit('patch', {
528
671
  schema: {
529
672
  'x-uid': fieldSchema['x-uid'],
@@ -588,16 +731,17 @@ FormItem.Designer = function Designer() {
588
731
  key: "title-field",
589
732
  title: t('Title field'),
590
733
  options: options,
591
- value: field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.fieldNames) === null || _field$componentProps2 === void 0 ? void 0 : _field$componentProps2.label,
734
+ value: field === null || field === void 0 ? void 0 : (_field$componentProps8 = field.componentProps) === null || _field$componentProps8 === void 0 ? void 0 : (_field$componentProps9 = _field$componentProps8.fieldNames) === null || _field$componentProps9 === void 0 ? void 0 : _field$componentProps9.label,
592
735
  onChange: function onChange(label) {
593
- var _collectionField$uiSc5, _collectionField$uiSc6;
736
+ var _collectionField$uiSc4, _collectionField$uiSc5;
594
737
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
595
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
738
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : (_collectionField$uiSc5 = _collectionField$uiSc4['x-component-props']) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['fieldNames']), field.componentProps.fieldNames), {}, {
596
739
  label: label
597
740
  });
598
741
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
599
742
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
600
743
  schema['x-component-props'] = fieldSchema['x-component-props'];
744
+ field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
601
745
  dn.emit('patch', {
602
746
  schema: schema
603
747
  });
@@ -619,5 +763,10 @@ function isFileCollection(collection) {
619
763
  }
620
764
  FormItem.FilterFormDesigner = _FormItem.FilterFormDesigner;
621
765
  function getFieldDefaultValue(fieldSchema, collectionField) {
622
- return (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default) || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue);
766
+ var _collectionField$uiSc6;
767
+ var result = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default) || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue);
768
+ if ((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc6 = collectionField.uiSchema) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['x-component']) === 'DatePicker' && result) {
769
+ return (0, _moment.default)(result);
770
+ }
771
+ return result;
623
772
  }
@@ -15,6 +15,7 @@ var _collectionManager = require("../../../collection-manager");
15
15
  var _schemaSettings = require("../../../schema-settings");
16
16
  var _hooks = require("../../hooks");
17
17
  var _useOperators = require("../filter/useOperators");
18
+ var _FormItem = require("./FormItem");
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
20
  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); }
20
21
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -401,64 +402,39 @@ var EditDefaultValue = function EditDefaultValue() {
401
402
  };
402
403
  exports.EditDefaultValue = EditDefaultValue;
403
404
  var EditComponent = function EditComponent() {
405
+ var _field$componentProps;
404
406
  var _useCollectionManager4 = (0, _collectionManager.useCollectionManager)(),
405
- getInterface = _useCollectionManager4.getInterface,
406
407
  getCollectionJoinField = _useCollectionManager4.getCollectionJoinField,
407
408
  getCollection = _useCollectionManager4.getCollection;
408
409
  var _useCollection4 = (0, _collectionManager.useCollection)(),
409
- getField = _useCollection4.getField,
410
- template = _useCollection4.template;
411
- var tk = (0, _blockProvider.useFilterByTk)();
412
- var _useFormBlockContext3 = (0, _blockProvider.useFormBlockContext)(),
413
- form = _useFormBlockContext3.form;
410
+ getField = _useCollection4.getField;
414
411
  var field = (0, _react.useField)();
415
412
  var fieldSchema = (0, _react.useFieldSchema)();
416
413
  var _useTranslation7 = (0, _reactI18next.useTranslation)(),
417
414
  t = _useTranslation7.t;
418
415
  var _useDesignable7 = (0, _hooks.useDesignable)(),
419
- dn = _useDesignable7.dn,
420
- insertAdjacent = _useDesignable7.insertAdjacent;
416
+ dn = _useDesignable7.dn;
421
417
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
422
- var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
423
- var fieldComponentOptions = (0, _hooks.useFieldComponentOptions)();
424
- var isSubFormAssociationField = field.address.segments.includes('__form_grid');
425
- return form && !isSubFormAssociationField && fieldComponentOptions ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
426
- title: t('Field component'),
427
- options: fieldComponentOptions,
428
- value: fieldSchema['x-component'],
429
- onChange: function onChange(type) {
430
- var _collectionField$uiSc4, _interfaceConfig$sche;
431
- var schema = {
432
- name: collectionField.name,
433
- type: 'void',
434
- required: fieldSchema['required'],
435
- description: fieldSchema['description'],
436
- default: fieldSchema['default'],
437
- 'x-decorator': 'FormItem',
438
- 'x-designer': 'FormItem.Designer',
439
- 'x-component': type,
440
- 'x-validator': fieldSchema['x-validator'],
441
- 'x-collection-field': fieldSchema['x-collection-field'],
442
- 'x-decorator-props': fieldSchema['x-decorator-props'],
443
- 'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['x-component-props']), fieldSchema['x-component-props'])
444
- };
445
- interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
446
- field: collectionField,
447
- block: 'Form',
448
- readPretty: field.readPretty,
449
- action: tk ? 'get' : null,
450
- targetCollection: getCollection(collectionField.target)
451
- });
452
- insertAdjacent('beforeBegin', divWrap(schema), {
453
- onSuccess: function onSuccess() {
454
- dn.remove(null, {
455
- removeParentsIfNoChildren: true,
456
- breakRemoveOn: {
457
- 'x-component': 'Grid'
458
- }
459
- });
460
- }
418
+ var fieldModeOptions = (0, _hooks.useFieldModeOptions)();
419
+ var isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.type);
420
+ var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
421
+ var isFileField = (0, _FormItem.isFileCollection)(targetCollection);
422
+ return isAssociationField && fieldModeOptions ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
423
+ key: "field-mode",
424
+ title: t('Field mode'),
425
+ options: fieldModeOptions,
426
+ value: (field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : _field$componentProps['mode']) || (isFileField ? 'FileManager' : 'Select'),
427
+ onChange: function onChange(mode) {
428
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
429
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
430
+ fieldSchema['x-component-props']['mode'] = mode;
431
+ schema['x-component-props'] = fieldSchema['x-component-props'];
432
+ field.componentProps = field.componentProps || {};
433
+ field.componentProps.mode = mode;
434
+ dn.emit('patch', {
435
+ schema: schema
461
436
  });
437
+ dn.refresh();
462
438
  }
463
439
  }) : null;
464
440
  };
@@ -468,8 +444,8 @@ var EditPattern = function EditPattern() {
468
444
  getCollectionJoinField = _useCollectionManager5.getCollectionJoinField;
469
445
  var _useCollection5 = (0, _collectionManager.useCollection)(),
470
446
  getField = _useCollection5.getField;
471
- var _useFormBlockContext4 = (0, _blockProvider.useFormBlockContext)(),
472
- form = _useFormBlockContext4.form;
447
+ var _useFormBlockContext3 = (0, _blockProvider.useFormBlockContext)(),
448
+ form = _useFormBlockContext3.form;
473
449
  var field = (0, _react.useField)();
474
450
  var fieldSchema = (0, _react.useFieldSchema)();
475
451
  var _useTranslation8 = (0, _reactI18next.useTranslation)(),
@@ -562,7 +538,8 @@ var EditOperator = function EditOperator() {
562
538
  dn = _useDesignable9.dn;
563
539
  var operatorList = (0, _useOperators.useOperatorList)();
564
540
  var _findFilterOperators2 = findFilterOperators(fieldSchema),
565
- storedOperators = _findFilterOperators2.operators,
541
+ _findFilterOperators3 = _findFilterOperators2.operators,
542
+ storedOperators = _findFilterOperators3 === void 0 ? {} : _findFilterOperators3,
566
543
  uid = _findFilterOperators2.uid;
567
544
  if (operatorList.length && !storedOperators[fieldSchema.name]) {
568
545
  storedOperators[fieldSchema.name] = operatorList[0].value;
@@ -573,9 +550,9 @@ var EditOperator = function EditOperator() {
573
550
  value: storedOperators[fieldSchema.name],
574
551
  options: compile(operatorList),
575
552
  onChange: function onChange(v) {
576
- var _schema5;
553
+ var _schema6;
577
554
  storedOperators[fieldSchema.name] = v;
578
- var schema = (_schema5 = {}, _defineProperty(_schema5, 'x-uid', uid), _defineProperty(_schema5, 'x-filter-operators', storedOperators), _schema5);
555
+ var schema = (_schema6 = {}, _defineProperty(_schema6, 'x-uid', uid), _defineProperty(_schema6, 'x-filter-operators', storedOperators), _schema6);
579
556
  dn.emit('patch', {
580
557
  schema: schema
581
558
  });
@@ -585,7 +562,7 @@ var EditOperator = function EditOperator() {
585
562
  };
586
563
  exports.EditOperator = EditOperator;
587
564
  var EditTitleField = function EditTitleField() {
588
- var _getCollectionFields, _field$componentProps, _field$componentProps2;
565
+ var _getCollectionFields, _field$componentProps2, _field$componentProps3;
589
566
  var _useCollectionManager6 = (0, _collectionManager.useCollectionManager)(),
590
567
  getCollectionFields = _useCollectionManager6.getCollectionFields,
591
568
  getCollectionJoinField = _useCollectionManager6.getCollectionJoinField;
@@ -613,16 +590,17 @@ var EditTitleField = function EditTitleField() {
613
590
  key: "title-field",
614
591
  title: t('Title field'),
615
592
  options: options,
616
- value: field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.fieldNames) === null || _field$componentProps2 === void 0 ? void 0 : _field$componentProps2.label,
593
+ value: field === null || field === void 0 ? void 0 : (_field$componentProps2 = field.componentProps) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.fieldNames) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.label,
617
594
  onChange: function onChange(label) {
618
- var _collectionField$uiSc5, _collectionField$uiSc6;
595
+ var _collectionField$uiSc4, _collectionField$uiSc5;
619
596
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
620
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
597
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : (_collectionField$uiSc5 = _collectionField$uiSc4['x-component-props']) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['fieldNames']), field.componentProps.fieldNames), {}, {
621
598
  label: label
622
599
  });
623
600
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
624
601
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
625
602
  schema['x-component-props'] = fieldSchema['x-component-props'];
603
+ field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
626
604
  dn.emit('patch', {
627
605
  schema: schema
628
606
  });
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.linkageMergeAction = void 0;
7
+ var _client = require("@nocobase/evaluators/client");
7
8
  var _lodash = require("lodash");
8
- var _uitls = require("../../common/utils/uitls");
9
9
  var _type = require("../../../schema-settings/LinkageRules/type");
10
- var _client = _interopRequireDefault(require("@nocobase/evaluators/client"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ var _uitls = require("../../common/utils/uitls");
12
11
  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); }
13
12
  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; }
14
13
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -23,7 +22,7 @@ var linkageMergeAction = function linkageMergeAction(_ref, field, condition, val
23
22
  var displayResult = (field === null || field === void 0 ? void 0 : (_field$linkagePropert2 = field.linkageProperty) === null || _field$linkagePropert2 === void 0 ? void 0 : _field$linkagePropert2.display) || [field === null || field === void 0 ? void 0 : (_field$initProperty2 = field.initProperty) === null || _field$initProperty2 === void 0 ? void 0 : _field$initProperty2.display];
24
23
  var patternResult = (field === null || field === void 0 ? void 0 : (_field$linkagePropert3 = field.linkageProperty) === null || _field$linkagePropert3 === void 0 ? void 0 : _field$linkagePropert3.pattern) || [field === null || field === void 0 ? void 0 : (_field$initProperty3 = field.initProperty) === null || _field$initProperty3 === void 0 ? void 0 : _field$initProperty3.pattern];
25
24
  var valueResult = (field === null || field === void 0 ? void 0 : (_field$linkagePropert4 = field.linkageProperty) === null || _field$linkagePropert4 === void 0 ? void 0 : _field$linkagePropert4.value) || [field.value || (field === null || field === void 0 ? void 0 : (_field$initProperty4 = field.initProperty) === null || _field$initProperty4 === void 0 ? void 0 : _field$initProperty4.value)];
26
- var _evaluators$get = _client.default.get('formula.js'),
25
+ var _evaluators$get = _client.evaluators.get('formula.js'),
27
26
  evaluate = _evaluators$get.evaluate;
28
27
  switch (operator) {
29
28
  case _type.ActionType.Required:
@@ -77,7 +76,9 @@ var linkageMergeAction = function linkageMergeAction(_ref, field, condition, val
77
76
  }
78
77
  }));
79
78
  valueResult.push(result);
80
- } catch (error) {}
79
+ } catch (error) {
80
+ console.log(error);
81
+ }
81
82
  } else if ((value === null || value === void 0 ? void 0 : value.mode) === 'constant') {
82
83
  valueResult.push((value === null || value === void 0 ? void 0 : value.value) || value);
83
84
  } else {