@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
@@ -4,81 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.oho = exports.obo = exports.o2o = void 0;
7
- var _lodash = require("lodash");
8
- var _properties2 = require("./properties");
7
+ var _properties = require("./properties");
9
8
  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); }
10
9
  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; }
11
10
  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; }
12
11
  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; }
13
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
13
  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); }
15
- var internalSchameInitialize = function internalSchameInitialize(schema, _ref) {
16
- var field = _ref.field,
17
- block = _ref.block,
18
- readPretty = _ref.readPretty,
19
- action = _ref.action;
20
- if (block === 'Form') {
21
- if (schema['x-component'] === 'FormField') {
22
- var association = "".concat(field.collectionName, ".").concat(field.name);
23
- schema.type = 'void';
24
- schema.properties = {
25
- block: {
26
- type: 'void',
27
- 'x-decorator': 'FormFieldProvider',
28
- 'x-decorator-props': {
29
- collection: field.target,
30
- association: association,
31
- resource: association,
32
- action: action,
33
- fieldName: field.name,
34
- readPretty: readPretty
35
- },
36
- 'x-component': 'CardItem',
37
- 'x-component-props': {
38
- bordered: true
39
- },
40
- properties: _defineProperty({}, field.name, {
41
- type: 'object',
42
- 'x-component': 'FormV2',
43
- 'x-component-props': {
44
- useProps: '{{ useFormFieldProps }}'
45
- },
46
- properties: {
47
- __form_grid: {
48
- type: 'void',
49
- 'x-component': 'Grid',
50
- 'x-initializer': 'FormItemInitializers',
51
- properties: {}
52
- }
53
- }
54
- })
55
- }
56
- };
57
- } else if (schema['x-component'] === 'AssociationSelect') {
58
- Object.assign(schema, {
59
- type: 'string',
60
- 'x-designer': 'AssociationSelect.Designer'
61
- });
62
- } else {
63
- schema.type = 'string';
64
- schema['properties'] = {
65
- viewer: (0, _lodash.cloneDeep)(_properties2.recordPickerViewer),
66
- selector: (0, _lodash.cloneDeep)(_properties2.recordPickerSelector)
67
- };
68
- }
69
- return schema;
70
- }
71
- schema.type = 'string';
72
- if (readPretty) {
73
- schema['properties'] = {
74
- viewer: (0, _lodash.cloneDeep)(_properties2.recordPickerViewer)
75
- };
76
- } else {
77
- schema['properties'] = {
78
- selector: (0, _lodash.cloneDeep)(_properties2.recordPickerSelector)
79
- };
80
- }
81
- };
82
14
  var o2o = {
83
15
  name: 'o2o',
84
16
  type: 'object',
@@ -92,7 +24,7 @@ var o2o = {
92
24
  // name,
93
25
  uiSchema: {
94
26
  // title,
95
- 'x-component': 'RecordPicker',
27
+ 'x-component': 'AssociationField',
96
28
  'x-component-props': {
97
29
  // mode: 'tags',
98
30
  multiple: false,
@@ -109,7 +41,7 @@ var o2o = {
109
41
  // name,
110
42
  uiSchema: {
111
43
  // title,
112
- 'x-component': 'RecordPicker',
44
+ 'x-component': 'AssociationField',
113
45
  'x-component-props': {
114
46
  // mode: 'tags',
115
47
  multiple: false,
@@ -122,17 +54,11 @@ var o2o = {
122
54
  }
123
55
  },
124
56
  availableTypes: ['hasOne'],
125
- schemaInitialize: function schemaInitialize(schema, _ref2) {
126
- var field = _ref2.field,
127
- block = _ref2.block,
128
- readPretty = _ref2.readPretty,
129
- action = _ref2.action;
130
- internalSchameInitialize(schema, {
131
- field: field,
132
- block: block,
133
- readPretty: readPretty,
134
- action: action
135
- });
57
+ schemaInitialize: function schemaInitialize(schema, _ref) {
58
+ var field = _ref.field,
59
+ block = _ref.block,
60
+ readPretty = _ref.readPretty,
61
+ action = _ref.action;
136
62
  if (['Table', 'Kanban'].includes(block)) {
137
63
  schema['x-component-props'] = schema['x-component-props'] || {};
138
64
  schema['x-component-props']['ellipsis'] = true;
@@ -157,7 +83,7 @@ var o2o = {
157
83
  'x-component': 'Input',
158
84
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
159
85
  },
160
- type: _properties2.relationshipType,
86
+ type: _properties.relationshipType,
161
87
  grid: {
162
88
  type: 'void',
163
89
  'x-component': 'Grid',
@@ -277,7 +203,7 @@ var oho = {
277
203
  // name,
278
204
  uiSchema: {
279
205
  // title,
280
- 'x-component': 'RecordPicker',
206
+ 'x-component': 'AssociationField',
281
207
  'x-component-props': {
282
208
  // mode: 'tags',
283
209
  multiple: false,
@@ -294,7 +220,7 @@ var oho = {
294
220
  // name,
295
221
  uiSchema: {
296
222
  // title,
297
- 'x-component': 'RecordPicker',
223
+ 'x-component': 'AssociationField',
298
224
  'x-component-props': {
299
225
  // mode: 'tags',
300
226
  multiple: false,
@@ -306,17 +232,12 @@ var oho = {
306
232
  }
307
233
  }
308
234
  },
309
- schemaInitialize: function schemaInitialize(schema, _ref3) {
310
- var field = _ref3.field,
311
- block = _ref3.block,
312
- readPretty = _ref3.readPretty,
313
- action = _ref3.action;
314
- internalSchameInitialize(schema, {
315
- field: field,
316
- block: block,
317
- readPretty: readPretty,
318
- action: action
319
- });
235
+ schemaInitialize: function schemaInitialize(schema, _ref2) {
236
+ var field = _ref2.field,
237
+ block = _ref2.block,
238
+ readPretty = _ref2.readPretty,
239
+ action = _ref2.action;
240
+ schema['type'] = 'object';
320
241
  if (['Table', 'Kanban'].includes(block)) {
321
242
  schema['x-component-props'] = schema['x-component-props'] || {};
322
243
  schema['x-component-props']['ellipsis'] = true;
@@ -341,7 +262,7 @@ var oho = {
341
262
  'x-component': 'Input',
342
263
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
343
264
  },
344
- type: _properties2.relationshipType,
265
+ type: _properties.relationshipType,
345
266
  grid: {
346
267
  type: 'void',
347
268
  'x-component': 'Grid',
@@ -417,7 +338,7 @@ var oho = {
417
338
  }
418
339
  }
419
340
  }
420
- }, _properties2.constraintsProps), _properties2.reverseFieldProperties),
341
+ }, _properties.constraintsProps), _properties.reverseFieldProperties),
421
342
  filterable: {
422
343
  nested: true,
423
344
  children: [
@@ -452,7 +373,7 @@ var obo = {
452
373
  // name,
453
374
  uiSchema: {
454
375
  // title,
455
- 'x-component': 'RecordPicker',
376
+ 'x-component': 'AssociationField',
456
377
  'x-component-props': {
457
378
  // mode: 'tags',
458
379
  multiple: false,
@@ -468,7 +389,7 @@ var obo = {
468
389
  // name,
469
390
  uiSchema: {
470
391
  // title,
471
- 'x-component': 'RecordPicker',
392
+ 'x-component': 'AssociationField',
472
393
  'x-component-props': {
473
394
  // mode: 'tags',
474
395
  multiple: false,
@@ -480,18 +401,13 @@ var obo = {
480
401
  }
481
402
  }
482
403
  },
483
- schemaInitialize: function schemaInitialize(schema, _ref4) {
484
- var field = _ref4.field,
485
- block = _ref4.block,
486
- readPretty = _ref4.readPretty,
487
- action = _ref4.action,
488
- targetCollection = _ref4.targetCollection;
489
- internalSchameInitialize(schema, {
490
- field: field,
491
- block: block,
492
- readPretty: readPretty,
493
- action: action
494
- });
404
+ schemaInitialize: function schemaInitialize(schema, _ref3) {
405
+ var field = _ref3.field,
406
+ block = _ref3.block,
407
+ readPretty = _ref3.readPretty,
408
+ action = _ref3.action,
409
+ targetCollection = _ref3.targetCollection;
410
+ schema['type'] = 'object';
495
411
  if (['Table', 'Kanban'].includes(block)) {
496
412
  schema['x-component-props'] = schema['x-component-props'] || {};
497
413
  schema['x-component-props']['ellipsis'] = true;
@@ -504,16 +420,6 @@ var obo = {
504
420
  };
505
421
  schema['x-component-props'].fieldNames.label = targetCollection.titleField;
506
422
  }
507
- if ((targetCollection === null || targetCollection === void 0 ? void 0 : targetCollection.template) === 'file') {
508
- var fieldNames = schema['x-component-props']['fieldNames'] || {
509
- label: 'preview',
510
- value: 'id'
511
- };
512
- fieldNames.label = 'preview';
513
- schema['x-component-props']['fieldNames'] = fieldNames;
514
- schema['x-component-props'].quickUpload = true;
515
- schema['x-component-props'].selectFile = true;
516
- }
517
423
  },
518
424
  properties: _objectSpread(_objectSpread({
519
425
  'uiSchema.title': {
@@ -532,7 +438,7 @@ var obo = {
532
438
  'x-component': 'Input',
533
439
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
534
440
  },
535
- type: _properties2.relationshipType,
441
+ type: _properties.relationshipType,
536
442
  grid: {
537
443
  type: 'void',
538
444
  'x-component': 'Grid',
@@ -609,7 +515,7 @@ var obo = {
609
515
  }
610
516
  }
611
517
  }
612
- }, _properties2.constraintsProps), _properties2.reverseFieldProperties),
518
+ }, _properties.constraintsProps), _properties.reverseFieldProperties),
613
519
  filterable: {
614
520
  nested: true,
615
521
  children: [
@@ -26,7 +26,7 @@ var updatedBy = {
26
26
  uiSchema: {
27
27
  type: 'object',
28
28
  title: '{{t("Last updated by")}}',
29
- 'x-component': 'RecordPicker',
29
+ 'x-component': 'AssociationField',
30
30
  'x-component-props': {
31
31
  fieldNames: {
32
32
  value: 'id',
@@ -32,7 +32,7 @@ var tree = {
32
32
  onDelete: 'CASCADE',
33
33
  uiSchema: {
34
34
  title: '{{t("Parent")}}',
35
- 'x-component': 'RecordPicker',
35
+ 'x-component': 'AssociationField',
36
36
  'x-component-props': {
37
37
  // mode: 'tags',
38
38
  multiple: false,
@@ -51,7 +51,7 @@ var tree = {
51
51
  onDelete: 'CASCADE',
52
52
  uiSchema: {
53
53
  title: '{{t("Children")}}',
54
- 'x-component': 'RecordPicker',
54
+ 'x-component': 'AssociationField',
55
55
  'x-component-props': {
56
56
  // mode: 'tags',
57
57
  multiple: true,
@@ -12,6 +12,7 @@ var _SharedFilterProvider = require("../block-provider/SharedFilterProvider");
12
12
  var _collectionManager = require("../collection-manager");
13
13
  var _schemaComponent = require("../schema-component");
14
14
  var _utils = require("./utils");
15
+ var _lodash = require("lodash");
15
16
  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); }
16
17
  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; }
17
18
  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; }
@@ -131,8 +132,9 @@ var useFilterBlock = function useFilterBlock() {
131
132
  existingBlock.defaultFilter = block.defaultFilter;
132
133
  return;
133
134
  }
135
+ // 由于 setDataBlocks 是异步操作,所以上面的 existingBlock 在判断时有可能用的是旧的 dataBlocks,所以下面还需要根据 uid 进行去重操作
134
136
  setDataBlocks(function (prev) {
135
- return [].concat(_toConsumableArray(prev), [block]);
137
+ return (0, _lodash.uniqBy)([].concat(_toConsumableArray(prev), [block]), 'uid');
136
138
  });
137
139
  };
138
140
  var getDataBlocks = function getDataBlocks() {
@@ -241,6 +241,7 @@ declare const _default: {
241
241
  "Link to": string;
242
242
  "Link to description": string;
243
243
  "Sub-table": string;
244
+ "Sub-details": string;
244
245
  "System info": string;
245
246
  "Created at": string;
246
247
  "Last updated at": string;
@@ -282,6 +283,8 @@ declare const _default: {
282
283
  "Field component": string;
283
284
  Subtable: string;
284
285
  Subform: string;
286
+ "Field mode": string;
287
+ "Allow add new data": string;
285
288
  "Record picker": string;
286
289
  "Toggles the subfield mode": string;
287
290
  "Selector mode": string;
@@ -247,6 +247,7 @@ var _default = {
247
247
  "Link to": "Link to",
248
248
  "Link to description": "Used to create collection relationships quickly and compatible with most common scenarios. Suitable for non-developer use. When present as a field, it is a drop-down selection used to select records from the target collection. Once created, it will simultaneously generate the associated fields of the current collection in the target collection.",
249
249
  "Sub-table": "Sub-table",
250
+ "Sub-details": "Sub-details",
250
251
  "System info": "System info",
251
252
  "Created at": "Created at",
252
253
  "Last updated at": "Last updated at",
@@ -287,12 +288,14 @@ var _default = {
287
288
  "Display field title": "Display field title",
288
289
  "Field component": "Field component",
289
290
  "Subtable": "Subtable",
290
- "Subform": "Subform",
291
+ "Subform": "Sub-form",
292
+ "Field mode": "Field mode",
293
+ "Allow add new data": "Allow add new data",
291
294
  "Record picker": "Record picker",
292
295
  "Toggles the subfield mode": "Toggles the subfield mode",
293
296
  "Selector mode": "Selector mode",
294
297
  "Subtable mode": "Subtable mode",
295
- "Subform mode": "Subform mode",
298
+ "Subform mode": "Sub-form mode",
296
299
  "Edit block title": "Edit block title",
297
300
  "Block title": "Block title",
298
301
  "Pattern": "Pattern",
@@ -556,6 +556,9 @@ declare const _default: {
556
556
  "Field component": string;
557
557
  Subtable: string;
558
558
  Subform: string;
559
+ "Sub-details": string;
560
+ "Field mode": string;
561
+ "Allow add new data": string;
559
562
  "Regular expression": string;
560
563
  "Enabled languages": string;
561
564
  "View all plugins": string;
@@ -562,6 +562,9 @@ var _default = {
562
562
  "Field component": "フィールドコンポーネント",
563
563
  "Subtable": "サブテーブル",
564
564
  "Subform": "サブフォーム",
565
+ "Sub-details": "サブリスト",
566
+ "Field mode": "フィールドコンポーネント",
567
+ "Allow add new data": "データの追加を許可",
565
568
  "Regular expression": "正規表現",
566
569
  "Enabled languages": "利用可能な言語",
567
570
  "View all plugins": "すべてのプラグラインを見る",
@@ -214,6 +214,7 @@ declare const _default: {
214
214
  "Edit collection": string;
215
215
  "Configure fields": string;
216
216
  "Configure columns": string;
217
+ "Please select the records you want to delete": string;
217
218
  "Edit field": string;
218
219
  Override: string;
219
220
  "Override field": string;
@@ -300,11 +301,14 @@ declare const _default: {
300
301
  "Field component": string;
301
302
  Subtable: string;
302
303
  Subform: string;
304
+ "Sub-details": string;
303
305
  "Record picker": string;
304
306
  "Toggles the subfield mode": string;
305
307
  "Selector mode": string;
306
308
  "Subtable mode": string;
307
309
  "Subform mode": string;
310
+ "Field mode": string;
311
+ "Allow add new data": string;
308
312
  "Edit block title": string;
309
313
  "Block title": string;
310
314
  Pattern: string;
@@ -220,6 +220,7 @@ var _default = {
220
220
  "Edit collection": "编辑数据表",
221
221
  "Configure fields": "配置字段",
222
222
  "Configure columns": "配置字段",
223
+ "Please select the records you want to delete": "请选择要删除的记录",
223
224
  "Edit field": "编辑字段",
224
225
  "Override": "重写",
225
226
  "Override field": "重写字段",
@@ -306,11 +307,14 @@ var _default = {
306
307
  "Field component": "字段组件",
307
308
  "Subtable": "子表格",
308
309
  "Subform": "子表单",
310
+ "Sub-details": "子详情",
309
311
  "Record picker": "数据选择器",
310
312
  "Toggles the subfield mode": "切换子字段模式",
311
313
  "Selector mode": "选择器模式",
312
314
  "Subtable mode": "子表格模式",
313
315
  "Subform mode": "子表单模式",
316
+ "Field mode": "字段组件",
317
+ "Allow add new data": "允许添加数据",
314
318
  "Edit block title": "编辑区块标题",
315
319
  "Block title": "区块标题",
316
320
  "Pattern": "模式",
@@ -66,6 +66,7 @@ var ActionDesigner = function ActionDesigner(props) {
66
66
  dn = _useDesignable.dn;
67
67
  var _useTranslation2 = (0, _reactI18next.useTranslation)(),
68
68
  t = _useTranslation2.t;
69
+ var isAction = (0, _hooks.useLinkageAction)();
69
70
  var isPopupAction = ['create', 'update', 'view', 'customize:popup'].includes(fieldSchema['x-action'] || '');
70
71
  var isUpdateModePopupAction = ['customize:bulkUpdate', 'customize:bulkEdit'].includes(fieldSchema['x-action']);
71
72
  var _useState = (0, _react2.useState)(),
@@ -73,9 +74,8 @@ var ActionDesigner = function ActionDesigner(props) {
73
74
  initialSchema = _useState2[0],
74
75
  setInitialSchema = _useState2[1];
75
76
  var actionType = (_fieldSchema$xAction = fieldSchema['x-action']) !== null && _fieldSchema$xAction !== void 0 ? _fieldSchema$xAction : '';
76
- var isLinkageAction = linkageAction || (0, _hooks.useLinkageAction)();
77
+ var isLinkageAction = linkageAction || isAction;
77
78
  var isChildCollectionAction = getChildrenCollections(name).length > 0 && fieldSchema['x-action'] === 'create';
78
- var isSupportEditButton = fieldSchema['x-action'] !== 'expandAll';
79
79
  var isLink = fieldSchema['x-component'] === 'Action.Link';
80
80
  (0, _react2.useEffect)(function () {
81
81
  var schemaUid = (0, _shared.uid)();
@@ -104,8 +104,7 @@ var ActionDesigner = function ActionDesigner(props) {
104
104
  'x-component': 'Input',
105
105
  title: t('Button title'),
106
106
  default: fieldSchema.title,
107
- 'x-component-props': {},
108
- 'x-visible': isSupportEditButton
107
+ 'x-component-props': {}
109
108
  // description: `原字段标题:${collectionField?.uiSchema?.title}`,
110
109
  },
111
110
 
@@ -115,7 +114,7 @@ var ActionDesigner = function ActionDesigner(props) {
115
114
  title: t('Button icon'),
116
115
  default: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.icon,
117
116
  'x-component-props': {},
118
- 'x-visible': isSupportEditButton && !isLink
117
+ 'x-visible': !isLink
119
118
  // description: `原字段标题:${collectionField?.uiSchema?.title}`,
120
119
  },
121
120
 
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function AssociationFieldProvider(props: any): JSX.Element;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AssociationFieldProvider = AssociationFieldProvider;
8
+ var _react = require("@formily/react");
9
+ var _react2 = _interopRequireWildcard(require("react"));
10
+ var _collectionManager = require("../../../collection-manager");
11
+ var _context = require("./context");
12
+ 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); }
13
+ 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; }
14
+ function AssociationFieldProvider(props) {
15
+ var field = (0, _react.useField)();
16
+ var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
17
+ getCollectionField = _useCollectionManager.getCollectionField;
18
+ var fieldSchema = (0, _react.useFieldSchema)();
19
+ var collectionField = (0, _react2.useMemo)(function () {
20
+ return getCollectionField(fieldSchema['x-collection-field']);
21
+ }, [fieldSchema['x-collection-field']]);
22
+ return /*#__PURE__*/_react2.default.createElement(_context.AssociationFieldContext.Provider, {
23
+ value: {
24
+ options: collectionField,
25
+ field: field
26
+ }
27
+ }, props.children);
28
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { RemoteSelectProps } from '../remote-select';
3
+ export declare type AssociationSelectProps<P = any> = RemoteSelectProps<P> & {
4
+ action?: string;
5
+ multiple?: boolean;
6
+ };
7
+ interface AssociationSelectInterface {
8
+ (props: any): React.ReactElement;
9
+ Designer: React.FC;
10
+ FilterDesigner: React.FC;
11
+ }
12
+ export declare const AssociationSelect: AssociationSelectInterface;
13
+ export declare const AssociationSelectReadPretty: React.ForwardRefExoticComponent<Pick<Partial<any>, string | number | symbol> & React.RefAttributes<unknown>>;
14
+ export {};
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AssociationSelectReadPretty = exports.AssociationSelect = void 0;
7
+ var _icons = require("@ant-design/icons");
8
+ var _react = require("@formily/react");
9
+ var _antd = require("antd");
10
+ var _react2 = _interopRequireWildcard(require("react"));
11
+ var _reactI18next = require("react-i18next");
12
+ var _collectionManager = require("../../../collection-manager");
13
+ var _hooks = require("../../hooks");
14
+ var _action = require("../action");
15
+ var _remoteSelect = require("../remote-select");
16
+ var _hooks2 = _interopRequireWildcard(require("./hooks"));
17
+ var _schema = _interopRequireDefault(require("./schema"));
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+ 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); }
20
+ 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; }
21
+ 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; }
22
+ 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
+ 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; }
24
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
25
+ 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); }
26
+ 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); }
27
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
28
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
+ 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); }
30
+ 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; }
31
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
32
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
33
+ var InternalAssociationSelect = (0, _react.observer)(function (props) {
34
+ var fieldNames = props.fieldNames,
35
+ _props$objectValue = props.objectValue,
36
+ objectValue = _props$objectValue === void 0 ? true : _props$objectValue;
37
+ var field = (0, _react.useField)();
38
+ var _useState = (0, _react2.useState)(false),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ visibleAddNewer = _useState2[0],
41
+ setVisibleAddNewer = _useState2[1];
42
+ var _useCollection = (0, _collectionManager.useCollection)(),
43
+ getField = _useCollection.getField;
44
+ var collectionField = getField(field.props.name);
45
+ var service = (0, _hooks2.default)(props);
46
+ var fieldSchema = (0, _react.useFieldSchema)();
47
+ var isFilterForm = fieldSchema['x-designer'] === 'FormItem.FilterFormDesigner';
48
+ var isAllowAddNew = fieldSchema['x-add-new'];
49
+ var insertAddNewer = (0, _hooks2.useInsertSchema)('AddNewer');
50
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
51
+ t = _useTranslation.t;
52
+ var normalizeValues = (0, _react2.useCallback)(function (obj) {
53
+ if (!objectValue && _typeof(obj) === 'object') {
54
+ return obj[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value];
55
+ }
56
+ return obj;
57
+ }, [objectValue, fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value]);
58
+ var value = (0, _react2.useMemo)(function () {
59
+ if (props.value === undefined || props.value === null || !Object.keys(props.value).length) {
60
+ return;
61
+ }
62
+ if (Array.isArray(props.value)) {
63
+ return props.value;
64
+ } else {
65
+ return props.value;
66
+ }
67
+ }, [props.value, normalizeValues]);
68
+ (0, _react2.useEffect)(function () {
69
+ field.value = value;
70
+ }, []);
71
+ return /*#__PURE__*/_react2.default.createElement("div", {
72
+ key: fieldSchema.name
73
+ }, /*#__PURE__*/_react2.default.createElement(_antd.Input.Group, {
74
+ compact: true,
75
+ style: {
76
+ display: 'flex'
77
+ }
78
+ }, /*#__PURE__*/_react2.default.createElement(_remoteSelect.RemoteSelect, _objectSpread(_objectSpread({
79
+ style: {
80
+ width: '100%'
81
+ }
82
+ }, props), {}, {
83
+ objectValue: objectValue,
84
+ value: value,
85
+ service: service
86
+ })), isAllowAddNew && !field.readPretty && !isFilterForm && /*#__PURE__*/_react2.default.createElement(_antd.Button, {
87
+ type: 'default',
88
+ onClick: function onClick() {
89
+ insertAddNewer(_schema.default.AddNewer);
90
+ setVisibleAddNewer(true);
91
+ }
92
+ }, t('Add new'))), /*#__PURE__*/_react2.default.createElement(_action.ActionContext.Provider, {
93
+ value: {
94
+ openMode: 'drawer',
95
+ visible: visibleAddNewer,
96
+ setVisible: setVisibleAddNewer
97
+ }
98
+ }, /*#__PURE__*/_react2.default.createElement(_collectionManager.CollectionProvider, {
99
+ name: collectionField.target
100
+ }, /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
101
+ onlyRenderProperties: true,
102
+ basePath: field.address,
103
+ schema: fieldSchema,
104
+ filterProperties: function filterProperties(s) {
105
+ return s['x-component'] === 'AssociationField.AddNewer';
106
+ }
107
+ }))));
108
+ });
109
+ var AssociationSelect = InternalAssociationSelect;
110
+ exports.AssociationSelect = AssociationSelect;
111
+ var AssociationSelectReadPretty = (0, _react.connect)(function (props) {
112
+ if (props.fieldNames) {
113
+ var service = (0, _hooks2.default)(props);
114
+ (0, _hooks.useFieldTitle)();
115
+ return /*#__PURE__*/_react2.default.createElement(_remoteSelect.RemoteSelect.ReadPretty, _objectSpread(_objectSpread({}, props), {}, {
116
+ service: service
117
+ }));
118
+ }
119
+ return null;
120
+ }, (0, _react.mapProps)({
121
+ dataSource: 'options',
122
+ loading: true
123
+ }, function (props, field) {
124
+ return _objectSpread(_objectSpread({}, props), {}, {
125
+ fieldNames: props.fieldNames && _objectSpread(_objectSpread({}, props.fieldNames), field.componentProps.fieldNames),
126
+ suffixIcon: (field === null || field === void 0 ? void 0 : field['loading']) || (field === null || field === void 0 ? void 0 : field['validating']) ? /*#__PURE__*/_react2.default.createElement(_icons.LoadingOutlined, null) : props.suffixIcon
127
+ });
128
+ }));
129
+ exports.AssociationSelectReadPretty = AssociationSelectReadPretty;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Editable: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;