@nocobase/client 0.9.2-alpha.4 → 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 (211) hide show
  1. package/es/block-provider/DetailsBlockProvider.js +13 -1
  2. package/es/block-provider/FormBlockProvider.js +30 -13
  3. package/es/block-provider/hooks/index.d.ts +10 -0
  4. package/es/block-provider/hooks/index.js +498 -281
  5. package/es/collection-manager/Configuration/CollectionFields.js +1 -2
  6. package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
  7. package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  8. package/es/collection-manager/action-hooks.d.ts +1 -1
  9. package/es/collection-manager/action-hooks.js +18 -7
  10. package/es/collection-manager/interfaces/createdBy.js +1 -1
  11. package/es/collection-manager/interfaces/linkTo.js +3 -39
  12. package/es/collection-manager/interfaces/m2m.js +4 -38
  13. package/es/collection-manager/interfaces/m2o.js +4 -38
  14. package/es/collection-manager/interfaces/o2m.js +4 -68
  15. package/es/collection-manager/interfaces/o2o.js +25 -119
  16. package/es/collection-manager/interfaces/updatedBy.js +1 -1
  17. package/es/collection-manager/templates/tree.js +2 -2
  18. package/es/filter-provider/FilterProvider.js +3 -1
  19. package/es/locale/en_US.d.ts +3 -0
  20. package/es/locale/en_US.js +5 -2
  21. package/es/locale/ja_JP.d.ts +3 -0
  22. package/es/locale/ja_JP.js +3 -0
  23. package/es/locale/zh_CN.d.ts +4 -0
  24. package/es/locale/zh_CN.js +4 -0
  25. package/es/schema-component/antd/action/Action.Designer.js +4 -5
  26. package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  27. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +19 -0
  28. package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  29. package/es/schema-component/antd/association-field/AssociationSelect.js +118 -0
  30. package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
  31. package/es/schema-component/antd/association-field/Editable.js +88 -0
  32. package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
  33. package/es/schema-component/antd/association-field/FileManager.js +243 -0
  34. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  35. package/es/schema-component/antd/association-field/InternalNester.js +28 -0
  36. package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  37. package/es/schema-component/antd/association-field/InternalPicker.js +267 -0
  38. package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  39. package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
  40. package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  41. package/es/schema-component/antd/association-field/InternalViewer.js +115 -0
  42. package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
  43. package/es/schema-component/antd/association-field/Nester.js +80 -0
  44. package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  45. package/es/schema-component/antd/association-field/ReadPretty.js +38 -0
  46. package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
  47. package/es/schema-component/antd/association-field/SubTable.js +25 -0
  48. package/es/schema-component/antd/association-field/context.d.ts +7 -0
  49. package/es/schema-component/antd/association-field/context.js +2 -0
  50. package/es/schema-component/antd/association-field/hooks.d.ts +8 -0
  51. package/es/schema-component/antd/association-field/hooks.js +96 -0
  52. package/es/schema-component/antd/association-field/index.d.ts +1 -0
  53. package/es/schema-component/antd/association-field/index.js +14 -0
  54. package/es/schema-component/antd/association-field/schema.d.ts +142 -0
  55. package/es/schema-component/antd/association-field/schema.js +141 -0
  56. package/es/schema-component/antd/association-field/util.d.ts +8 -0
  57. package/es/schema-component/antd/association-field/util.js +84 -0
  58. package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  59. package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
  60. package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  61. package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
  62. package/es/schema-component/antd/expand-action/index.d.ts +1 -0
  63. package/es/schema-component/antd/expand-action/index.js +5 -0
  64. package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  65. package/es/schema-component/antd/filter/FilterItem.js +1 -1
  66. package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
  67. package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
  68. package/es/schema-component/antd/form-item/FormItem.js +183 -52
  69. package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
  70. package/es/schema-component/antd/form-v2/utils.js +3 -1
  71. package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  72. package/es/schema-component/antd/index.d.ts +3 -1
  73. package/es/schema-component/antd/index.js +3 -1
  74. package/es/schema-component/antd/menu/Menu.js +6 -3
  75. package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  76. package/es/schema-component/antd/record-picker/InputRecordPicker.js +32 -12
  77. package/es/schema-component/antd/remote-select/RemoteSelect.js +16 -18
  78. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  79. package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  80. package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
  81. package/es/schema-component/antd/table-v2/Table.js +9 -5
  82. package/es/schema-component/antd/table-v2/index.js +3 -1
  83. package/es/schema-component/antd/table-v2/utils.js +1 -1
  84. package/es/schema-component/antd/variable/Input.js +5 -5
  85. package/es/schema-component/antd/variable/TextArea.js +2 -5
  86. package/es/schema-component/common/dnd-context/index.js +3 -2
  87. package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
  88. package/es/schema-component/common/utils/uitls.js +1 -1
  89. package/es/schema-component/hooks/index.d.ts +1 -0
  90. package/es/schema-component/hooks/index.js +2 -1
  91. package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  92. package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
  93. package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  94. package/es/schema-initializer/components/CreateRecordAction.js +4 -3
  95. package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  96. package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
  97. package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  98. package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
  99. package/es/schema-initializer/items/index.d.ts +1 -0
  100. package/es/schema-initializer/items/index.js +2 -1
  101. package/es/schema-initializer/utils.js +20 -8
  102. package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  103. package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
  104. package/es/schema-settings/LinkageRules/Variables.js +7 -4
  105. package/es/schema-settings/SchemaSettings.js +2 -2
  106. package/lib/block-provider/DetailsBlockProvider.js +13 -1
  107. package/lib/block-provider/FormBlockProvider.js +31 -15
  108. package/lib/block-provider/hooks/index.d.ts +10 -0
  109. package/lib/block-provider/hooks/index.js +509 -289
  110. package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
  111. package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
  112. package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
  113. package/lib/collection-manager/action-hooks.d.ts +1 -1
  114. package/lib/collection-manager/action-hooks.js +18 -7
  115. package/lib/collection-manager/interfaces/createdBy.js +1 -1
  116. package/lib/collection-manager/interfaces/linkTo.js +2 -38
  117. package/lib/collection-manager/interfaces/m2m.js +3 -37
  118. package/lib/collection-manager/interfaces/m2o.js +3 -37
  119. package/lib/collection-manager/interfaces/o2m.js +6 -70
  120. package/lib/collection-manager/interfaces/o2o.js +30 -124
  121. package/lib/collection-manager/interfaces/updatedBy.js +1 -1
  122. package/lib/collection-manager/templates/tree.js +2 -2
  123. package/lib/filter-provider/FilterProvider.js +3 -1
  124. package/lib/locale/en_US.d.ts +3 -0
  125. package/lib/locale/en_US.js +5 -2
  126. package/lib/locale/ja_JP.d.ts +3 -0
  127. package/lib/locale/ja_JP.js +3 -0
  128. package/lib/locale/zh_CN.d.ts +4 -0
  129. package/lib/locale/zh_CN.js +4 -0
  130. package/lib/schema-component/antd/action/Action.Designer.js +4 -5
  131. package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
  132. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +28 -0
  133. package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
  134. package/lib/schema-component/antd/association-field/AssociationSelect.js +129 -0
  135. package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
  136. package/lib/schema-component/antd/association-field/Editable.js +97 -0
  137. package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
  138. package/lib/schema-component/antd/association-field/FileManager.js +253 -0
  139. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
  140. package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
  141. package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
  142. package/lib/schema-component/antd/association-field/InternalPicker.js +277 -0
  143. package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
  144. package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
  145. package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
  146. package/lib/schema-component/antd/association-field/InternalViewer.js +126 -0
  147. package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
  148. package/lib/schema-component/antd/association-field/Nester.js +89 -0
  149. package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
  150. package/lib/schema-component/antd/association-field/ReadPretty.js +47 -0
  151. package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
  152. package/lib/schema-component/antd/association-field/SubTable.js +33 -0
  153. package/lib/schema-component/antd/association-field/context.d.ts +7 -0
  154. package/lib/schema-component/antd/association-field/context.js +9 -0
  155. package/lib/schema-component/antd/association-field/hooks.d.ts +8 -0
  156. package/lib/schema-component/antd/association-field/hooks.js +107 -0
  157. package/lib/schema-component/antd/association-field/index.d.ts +1 -0
  158. package/lib/schema-component/antd/association-field/index.js +21 -0
  159. package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
  160. package/lib/schema-component/antd/association-field/schema.js +148 -0
  161. package/lib/schema-component/antd/association-field/util.d.ts +8 -0
  162. package/lib/schema-component/antd/association-field/util.js +98 -0
  163. package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
  164. package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
  165. package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
  166. package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
  167. package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
  168. package/lib/schema-component/antd/expand-action/index.js +12 -0
  169. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
  170. package/lib/schema-component/antd/filter/FilterItem.js +1 -1
  171. package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
  172. package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
  173. package/lib/schema-component/antd/form-item/FormItem.js +180 -48
  174. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
  175. package/lib/schema-component/antd/form-v2/utils.js +3 -1
  176. package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
  177. package/lib/schema-component/antd/index.d.ts +3 -1
  178. package/lib/schema-component/antd/index.js +33 -11
  179. package/lib/schema-component/antd/menu/Menu.js +6 -3
  180. package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
  181. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +34 -13
  182. package/lib/schema-component/antd/remote-select/RemoteSelect.js +15 -17
  183. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
  184. package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
  185. package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
  186. package/lib/schema-component/antd/table-v2/Table.js +9 -5
  187. package/lib/schema-component/antd/table-v2/index.js +3 -1
  188. package/lib/schema-component/antd/table-v2/utils.js +1 -1
  189. package/lib/schema-component/antd/variable/Input.js +5 -5
  190. package/lib/schema-component/antd/variable/TextArea.js +2 -5
  191. package/lib/schema-component/common/dnd-context/index.js +3 -2
  192. package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
  193. package/lib/schema-component/common/utils/uitls.js +1 -1
  194. package/lib/schema-component/hooks/index.d.ts +1 -0
  195. package/lib/schema-component/hooks/index.js +11 -0
  196. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
  197. package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
  198. package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -1
  199. package/lib/schema-initializer/components/CreateRecordAction.js +4 -3
  200. package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
  201. package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
  202. package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
  203. package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
  204. package/lib/schema-initializer/items/index.d.ts +1 -0
  205. package/lib/schema-initializer/items/index.js +11 -0
  206. package/lib/schema-initializer/utils.js +20 -8
  207. package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
  208. package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
  209. package/lib/schema-settings/LinkageRules/Variables.js +7 -4
  210. package/lib/schema-settings/SchemaSettings.js +3 -3
  211. package/package.json +5 -6
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SubTable = void 0;
7
+ var _react = require("@formily/react");
8
+ var _antd = require("antd");
9
+ var _react2 = _interopRequireDefault(require("react"));
10
+ var _Table = require("../table-v2/Table");
11
+ var _hooks = require("./hooks");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ var SubTable = (0, _react.observer)(function (props) {
14
+ var _useAssociationFieldC = (0, _hooks.useAssociationFieldContext)(),
15
+ field = _useAssociationFieldC.field;
16
+ return /*#__PURE__*/_react2.default.createElement("div", null, /*#__PURE__*/_react2.default.createElement(_Table.Table, {
17
+ size: 'small',
18
+ showIndex: true,
19
+ field: field,
20
+ pagination: false
21
+ }), field.editable && /*#__PURE__*/_react2.default.createElement(_antd.Button, {
22
+ type: 'dashed',
23
+ block: true,
24
+ style: {
25
+ marginTop: 12
26
+ },
27
+ onClick: function onClick() {
28
+ field.value = field.value || [];
29
+ field.value.push({});
30
+ }
31
+ }, "Add new"));
32
+ });
33
+ exports.SubTable = SubTable;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { GeneralField } from '@formily/core';
3
+ export interface AssociationFieldContextProps {
4
+ options: any;
5
+ field: GeneralField;
6
+ }
7
+ export declare const AssociationFieldContext: import("react").Context<AssociationFieldContextProps>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AssociationFieldContext = void 0;
7
+ var _react = require("react");
8
+ var AssociationFieldContext = /*#__PURE__*/(0, _react.createContext)(null);
9
+ exports.AssociationFieldContext = AssociationFieldContext;
@@ -0,0 +1,8 @@
1
+ import { GeneralField } from '@formily/core';
2
+ export declare const useInsertSchema: (component: any) => (ss: any) => void;
3
+ export declare function useAssociationFieldContext<F extends GeneralField>(): {
4
+ options: any;
5
+ field: F;
6
+ };
7
+ export default function useServiceOptions(props: any): any;
8
+ export declare const useFieldNames: (props: any) => any;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useServiceOptions;
7
+ exports.useAssociationFieldContext = useAssociationFieldContext;
8
+ exports.useInsertSchema = exports.useFieldNames = void 0;
9
+ var _react = require("@formily/react");
10
+ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
11
+ var _react2 = require("react");
12
+ var _hooks = require("../../hooks");
13
+ var _SharedFilterProvider = require("../../../block-provider/SharedFilterProvider");
14
+ var _context = require("./context");
15
+ var _recordProvider = require("../../../record-provider");
16
+ var _filterProvider = require("../../../filter-provider");
17
+ var _collectionManager = require("../../../collection-manager");
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+ 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; }
20
+ 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; }
21
+ 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; }
22
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
23
+ 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); }
24
+ 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); }
25
+ var useInsertSchema = function useInsertSchema(component) {
26
+ var fieldSchema = (0, _react.useFieldSchema)();
27
+ var _useDesignable = (0, _hooks.useDesignable)(),
28
+ insertAfterBegin = _useDesignable.insertAfterBegin;
29
+ var insert = (0, _react2.useCallback)(function (ss) {
30
+ var schema = fieldSchema.reduceProperties(function (buf, s) {
31
+ if (s['x-component'] === 'AssociationField.' + component) {
32
+ return s;
33
+ }
34
+ return buf;
35
+ }, null);
36
+ if (!schema) {
37
+ insertAfterBegin((0, _cloneDeep.default)(ss));
38
+ }
39
+ }, [component]);
40
+ return insert;
41
+ };
42
+ exports.useInsertSchema = useInsertSchema;
43
+ function useAssociationFieldContext() {
44
+ return (0, _react2.useContext)(_context.AssociationFieldContext);
45
+ }
46
+ function useServiceOptions(props) {
47
+ var _props$action = props.action,
48
+ action = _props$action === void 0 ? 'list' : _props$action,
49
+ service = props.service,
50
+ fieldNames = props.fieldNames;
51
+ var params = (service === null || service === void 0 ? void 0 : service.params) || {};
52
+ var fieldSchema = (0, _react.useFieldSchema)();
53
+ var _useCollection = (0, _collectionManager.useCollection)(),
54
+ getField = _useCollection.getField,
55
+ fields = _useCollection.fields;
56
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
57
+ getCollectionFields = _useCollectionManager.getCollectionFields;
58
+ var record = (0, _recordProvider.useRecord)();
59
+ var normalizeValues = (0, _react2.useCallback)(function (obj) {
60
+ if (obj && _typeof(obj) === 'object') {
61
+ return obj[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value];
62
+ }
63
+ return obj;
64
+ }, [fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value]);
65
+ var value = (0, _react2.useMemo)(function () {
66
+ if (props.value === undefined || props.value === null) {
67
+ return;
68
+ }
69
+ if (Array.isArray(props.value)) {
70
+ return props.value.map(normalizeValues);
71
+ } else {
72
+ return [normalizeValues(props.value)];
73
+ }
74
+ }, [props.value, normalizeValues]);
75
+ var collectionField = (0, _react2.useMemo)(function () {
76
+ return getField(fieldSchema.name);
77
+ }, [fieldSchema.name]);
78
+ var sourceValue = record === null || record === void 0 ? void 0 : record[collectionField === null || collectionField === void 0 ? void 0 : collectionField.sourceKey];
79
+ var filter = (0, _react2.useMemo)(function () {
80
+ var isOToAny = ['oho', 'o2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
81
+ return (0, _SharedFilterProvider.mergeFilter)([(0, _SharedFilterProvider.mergeFilter)([isOToAny && !(0, _filterProvider.isInFilterFormBlock)(fieldSchema) ? _defineProperty({}, collectionField.foreignKey, {
82
+ $is: null
83
+ }) : null, params === null || params === void 0 ? void 0 : params.filter]), isOToAny && sourceValue !== undefined && sourceValue !== null && !(0, _filterProvider.isInFilterFormBlock)(fieldSchema) ? _defineProperty({}, collectionField.foreignKey, {
84
+ $eq: sourceValue
85
+ }) : null, (params === null || params === void 0 ? void 0 : params.filter) && value ? _defineProperty({}, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value, _defineProperty({}, '$in', value)) : null], '$or');
86
+ }, [params === null || params === void 0 ? void 0 : params.filter, getCollectionFields, collectionField, sourceValue, value, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value]);
87
+ return (0, _react2.useMemo)(function () {
88
+ return _objectSpread(_objectSpread({
89
+ resource: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target,
90
+ action: action
91
+ }, service), {}, {
92
+ params: _objectSpread(_objectSpread({}, service === null || service === void 0 ? void 0 : service.params), {}, {
93
+ filter: filter
94
+ })
95
+ });
96
+ }, [collectionField === null || collectionField === void 0 ? void 0 : collectionField.target, action, filter, service]);
97
+ }
98
+ var useFieldNames = function useFieldNames(props) {
99
+ var _fieldSchema$xCompon, _fieldSchema$xCompon$, _fieldSchema$xCompon$2, _fieldSchema$xCompon$3, _fieldSchema$xCompon2;
100
+ var fieldSchema = (0, _react.useFieldSchema)();
101
+ var fieldNames = ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : (_fieldSchema$xCompon$ = _fieldSchema$xCompon['field']) === null || _fieldSchema$xCompon$ === void 0 ? void 0 : (_fieldSchema$xCompon$2 = _fieldSchema$xCompon$['uiSchema']) === null || _fieldSchema$xCompon$2 === void 0 ? void 0 : (_fieldSchema$xCompon$3 = _fieldSchema$xCompon$2['x-component-props']) === null || _fieldSchema$xCompon$3 === void 0 ? void 0 : _fieldSchema$xCompon$3['fieldNames']) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2['fieldNames']) || props.fieldNames;
102
+ return _objectSpread({
103
+ label: 'label',
104
+ value: 'value'
105
+ }, fieldNames);
106
+ };
107
+ exports.useFieldNames = useFieldNames;
@@ -0,0 +1 @@
1
+ export declare const AssociationField: any;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AssociationField = void 0;
7
+ var _react = require("@formily/react");
8
+ var _action = require("../action");
9
+ var _Editable = require("./Editable");
10
+ var _InternalPicker = require("./InternalPicker");
11
+ var _Nester = require("./Nester");
12
+ var _ReadPretty = require("./ReadPretty");
13
+ var _SubTable = require("./SubTable");
14
+ var AssociationField = (0, _react.connect)(_Editable.Editable, (0, _react.mapReadPretty)(_ReadPretty.ReadPretty));
15
+ exports.AssociationField = AssociationField;
16
+ AssociationField.SubTable = _SubTable.SubTable;
17
+ AssociationField.Nester = _Nester.Nester;
18
+ AssociationField.AddNewer = _action.Action.Container;
19
+ AssociationField.Selector = _action.Action.Container;
20
+ AssociationField.Viewer = _action.Action.Container;
21
+ AssociationField.InternalSelect = _InternalPicker.InternalPicker;
@@ -0,0 +1,142 @@
1
+ declare const _default: {
2
+ Nester: {
3
+ type: string;
4
+ 'x-component': string;
5
+ properties: {
6
+ grid: {
7
+ type: string;
8
+ 'x-component': string;
9
+ 'x-initializer': string;
10
+ };
11
+ };
12
+ };
13
+ AddNewer: {
14
+ type: string;
15
+ 'x-component': string;
16
+ 'x-action': string;
17
+ title: string;
18
+ 'x-component-props': {
19
+ className: string;
20
+ };
21
+ properties: {
22
+ tabs: {
23
+ type: string;
24
+ 'x-component': string;
25
+ 'x-component-props': {};
26
+ 'x-initializer': string;
27
+ properties: {
28
+ tab1: {
29
+ type: string;
30
+ title: string;
31
+ 'x-component': string;
32
+ 'x-designer': string;
33
+ 'x-component-props': {};
34
+ properties: {
35
+ grid: {
36
+ type: string;
37
+ 'x-component': string;
38
+ 'x-initializer': string;
39
+ properties: {};
40
+ };
41
+ };
42
+ };
43
+ };
44
+ };
45
+ };
46
+ };
47
+ Selector: {
48
+ type: string;
49
+ 'x-component': string;
50
+ title: string;
51
+ 'x-component-props': {
52
+ className: string;
53
+ };
54
+ properties: {
55
+ grid: {
56
+ type: string;
57
+ 'x-component': string;
58
+ 'x-initializer': string;
59
+ properties: {};
60
+ };
61
+ footer: {
62
+ 'x-component': string;
63
+ 'x-component-props': {};
64
+ properties: {
65
+ actions: {
66
+ type: string;
67
+ 'x-component': string;
68
+ 'x-component-props': {};
69
+ properties: {
70
+ submit: {
71
+ title: string;
72
+ 'x-action': string;
73
+ 'x-component': string;
74
+ 'x-designer': string;
75
+ 'x-component-props': {
76
+ type: string;
77
+ htmlType: string;
78
+ useProps: string;
79
+ };
80
+ };
81
+ };
82
+ };
83
+ };
84
+ };
85
+ };
86
+ };
87
+ Viewer: {
88
+ type: string;
89
+ title: string;
90
+ 'x-component': string;
91
+ 'x-component-props': {
92
+ className: string;
93
+ };
94
+ properties: {
95
+ tabs: {
96
+ type: string;
97
+ 'x-component': string;
98
+ 'x-component-props': {};
99
+ 'x-initializer': string;
100
+ properties: {
101
+ tab1: {
102
+ type: string;
103
+ title: string;
104
+ 'x-component': string;
105
+ 'x-designer': string;
106
+ 'x-component-props': {};
107
+ properties: {
108
+ grid: {
109
+ type: string;
110
+ 'x-component': string;
111
+ 'x-initializer': string;
112
+ properties: {};
113
+ };
114
+ };
115
+ };
116
+ };
117
+ };
118
+ };
119
+ };
120
+ SubTable: {
121
+ type: string;
122
+ 'x-component': string;
123
+ 'x-initializer': string;
124
+ properties: {
125
+ indexCol: {
126
+ type: string;
127
+ 'x-component': string;
128
+ 'x-component-props': {
129
+ width: number;
130
+ };
131
+ properties: {
132
+ __index__: {
133
+ type: string;
134
+ 'x-component': string;
135
+ 'x-read-pretty': boolean;
136
+ };
137
+ };
138
+ };
139
+ };
140
+ };
141
+ };
142
+ export default _default;
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ Nester: {
9
+ type: 'void',
10
+ 'x-component': 'AssociationField.Nester',
11
+ properties: {
12
+ grid: {
13
+ type: 'void',
14
+ 'x-component': 'Grid',
15
+ 'x-initializer': 'FormItemInitializers'
16
+ }
17
+ }
18
+ },
19
+ AddNewer: {
20
+ type: 'void',
21
+ 'x-component': 'AssociationField.AddNewer',
22
+ 'x-action': 'create',
23
+ title: '{{ t("Add record") }}',
24
+ 'x-component-props': {
25
+ className: 'nb-action-popup'
26
+ },
27
+ properties: {
28
+ tabs: {
29
+ type: 'void',
30
+ 'x-component': 'Tabs',
31
+ 'x-component-props': {},
32
+ 'x-initializer': 'TabPaneInitializersForCreateFormBlock',
33
+ properties: {
34
+ tab1: {
35
+ type: 'void',
36
+ title: '{{t("Add new")}}',
37
+ 'x-component': 'Tabs.TabPane',
38
+ 'x-designer': 'Tabs.Designer',
39
+ 'x-component-props': {},
40
+ properties: {
41
+ grid: {
42
+ type: 'void',
43
+ 'x-component': 'Grid',
44
+ 'x-initializer': 'CreateFormBlockInitializers',
45
+ properties: {}
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ },
53
+ Selector: {
54
+ type: 'void',
55
+ 'x-component': 'AssociationField.Selector',
56
+ title: '{{ t("Select record") }}',
57
+ 'x-component-props': {
58
+ className: 'nb-record-picker-selector'
59
+ },
60
+ properties: {
61
+ grid: {
62
+ type: 'void',
63
+ 'x-component': 'Grid',
64
+ 'x-initializer': 'TableSelectorInitializers',
65
+ properties: {}
66
+ },
67
+ footer: {
68
+ 'x-component': 'Action.Container.Footer',
69
+ 'x-component-props': {},
70
+ properties: {
71
+ actions: {
72
+ type: 'void',
73
+ 'x-component': 'ActionBar',
74
+ 'x-component-props': {},
75
+ properties: {
76
+ submit: {
77
+ title: '{{ t("Submit") }}',
78
+ 'x-action': 'submit',
79
+ 'x-component': 'Action',
80
+ 'x-designer': 'Action.Designer',
81
+ 'x-component-props': {
82
+ type: 'primary',
83
+ htmlType: 'submit',
84
+ useProps: '{{ usePickActionProps }}'
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ },
93
+ Viewer: {
94
+ type: 'void',
95
+ title: '{{ t("View record") }}',
96
+ 'x-component': 'AssociationField.Viewer',
97
+ 'x-component-props': {
98
+ className: 'nb-action-popup'
99
+ },
100
+ properties: {
101
+ tabs: {
102
+ type: 'void',
103
+ 'x-component': 'Tabs',
104
+ 'x-component-props': {},
105
+ 'x-initializer': 'TabPaneInitializers',
106
+ properties: {
107
+ tab1: {
108
+ type: 'void',
109
+ title: '{{t("Details")}}',
110
+ 'x-component': 'Tabs.TabPane',
111
+ 'x-designer': 'Tabs.Designer',
112
+ 'x-component-props': {},
113
+ properties: {
114
+ grid: {
115
+ type: 'void',
116
+ 'x-component': 'Grid',
117
+ 'x-initializer': 'RecordBlockInitializers',
118
+ properties: {}
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ SubTable: {
127
+ type: 'void',
128
+ 'x-component': 'AssociationField.SubTable',
129
+ 'x-initializer': 'TableColumnInitializers',
130
+ properties: {
131
+ indexCol: {
132
+ type: 'void',
133
+ 'x-component': 'TableV2.Column',
134
+ 'x-component-props': {
135
+ width: 80
136
+ },
137
+ properties: {
138
+ __index__: {
139
+ type: 'void',
140
+ 'x-component': 'TableV2.Index',
141
+ 'x-read-pretty': true
142
+ }
143
+ }
144
+ }
145
+ }
146
+ }
147
+ };
148
+ exports.default = _default;
@@ -0,0 +1,8 @@
1
+ import { ISchema } from '@formily/react';
2
+ import { CollectionFieldOptions } from '../../../collection-manager';
3
+ export declare const useLabelUiSchema: (collectionField: CollectionFieldOptions, label: string) => ISchema;
4
+ export declare const getDatePickerLabels: (props: any) => string;
5
+ export declare const getLabelFormatValue: (labelUiSchema: ISchema, value: any, isTag?: boolean) => any;
6
+ export declare function flatData(data: any): any[];
7
+ export declare function isShowFilePicker(labelUiSchema: any): boolean;
8
+ export declare const toValue: (value: any, placeholder: any) => any;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.flatData = flatData;
7
+ exports.getLabelFormatValue = exports.getDatePickerLabels = void 0;
8
+ exports.isShowFilePicker = isShowFilePicker;
9
+ exports.useLabelUiSchema = exports.toValue = void 0;
10
+ var _shared = require("@formily/shared");
11
+ var _client = require("@nocobase/utils/client");
12
+ var _antd = require("antd");
13
+ var _react = _interopRequireDefault(require("react"));
14
+ var _collectionManager = require("../../../collection-manager");
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ 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); }
17
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
18
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+ 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); }
20
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
21
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
+ 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; }
23
+ 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; }
24
+ 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; }
25
+ 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; }
26
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
27
+ 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); }
28
+ var useLabelUiSchema = function useLabelUiSchema(collectionField, label) {
29
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
30
+ getCollectionJoinField = _useCollectionManager.getCollectionJoinField;
31
+ if (!collectionField) {
32
+ return;
33
+ }
34
+ var labelField = getCollectionJoinField("".concat(collectionField.target, ".").concat(label));
35
+ return labelField === null || labelField === void 0 ? void 0 : labelField.uiSchema;
36
+ };
37
+ exports.useLabelUiSchema = useLabelUiSchema;
38
+ var getDatePickerLabels = function getDatePickerLabels(props) {
39
+ var format = (0, _client.getDefaultFormat)(props);
40
+ var m = (0, _client.str2moment)(props.value, props);
41
+ var labels = m && m.isValid() ? m.format(format) : props.value;
42
+ return (0, _shared.isArr)(labels) ? labels.join('~') : labels;
43
+ };
44
+ exports.getDatePickerLabels = getDatePickerLabels;
45
+ var toArr = function toArr(v) {
46
+ if (!v) {
47
+ return [];
48
+ }
49
+ return Array.isArray(v) ? v : [v];
50
+ };
51
+ var getLabelFormatValue = function getLabelFormatValue(labelUiSchema, value) {
52
+ var isTag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
53
+ var options = labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema.enum;
54
+ if (Array.isArray(options) && value) {
55
+ var values = toArr(value).map(function (val) {
56
+ var opt = options.find(function (option) {
57
+ return option.value === val;
58
+ });
59
+ if (isTag) {
60
+ return /*#__PURE__*/_react.default.createElement(_antd.Tag, {
61
+ color: opt === null || opt === void 0 ? void 0 : opt.color
62
+ }, opt === null || opt === void 0 ? void 0 : opt.label);
63
+ }
64
+ return opt === null || opt === void 0 ? void 0 : opt.label;
65
+ });
66
+ return isTag ? values : values.join(', ');
67
+ }
68
+ switch (labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component']) {
69
+ case 'DatePicker':
70
+ return getDatePickerLabels(_objectSpread(_objectSpread({}, labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component-props']), {}, {
71
+ value: value
72
+ }));
73
+ default:
74
+ return value;
75
+ }
76
+ };
77
+ exports.getLabelFormatValue = getLabelFormatValue;
78
+ function flatData(data) {
79
+ var newArr = [];
80
+ for (var i = 0; i < data.length; i++) {
81
+ var children = data[i]['children'];
82
+ if (Array.isArray(children)) {
83
+ newArr.push.apply(newArr, _toConsumableArray(flatData(children)));
84
+ }
85
+ newArr.push(_objectSpread({}, data[i]));
86
+ }
87
+ return newArr;
88
+ }
89
+ function isShowFilePicker(labelUiSchema) {
90
+ return (labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component']) === 'Preview';
91
+ }
92
+ var toValue = function toValue(value, placeholder) {
93
+ if (value === null || value === undefined) {
94
+ return placeholder;
95
+ }
96
+ return value;
97
+ };
98
+ exports.toValue = toValue;
@@ -0,0 +1 @@
1
+ export declare const ExpandActionDesign: (props: any) => JSX.Element;