@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
@@ -1,6 +1,7 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  var _excluded = ["onRowSelectionChange", "rowKey"],
3
- _excluded2 = ["value", "multiple", "onChange", "quickUpload", "selectFile"];
3
+ _excluded2 = ["value", "multiple", "onChange", "quickUpload", "selectFile"],
4
+ _excluded3 = ["multiple", "onChange", "selectedRows", "setSelectedRows", "options", "collectionField"];
4
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
6
  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."); }
6
7
  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; } }
@@ -63,7 +64,7 @@ var useTableSelectorProps = function useTableSelectorProps() {
63
64
  rowKey: rowKey,
64
65
  rowSelection: {
65
66
  type: multiple ? 'checkbox' : 'radio',
66
- selectedRowKeys: rcSelectRows.filter(function (item) {
67
+ selectedRowKeys: rcSelectRows === null || rcSelectRows === void 0 ? void 0 : rcSelectRows.filter(function (item) {
67
68
  return options.every(function (row) {
68
69
  return row[rowKey] !== item[rowKey];
69
70
  });
@@ -211,6 +212,7 @@ export var InputRecordPicker = function InputRecordPicker(props) {
211
212
  var _value = multiple ? [] : null;
212
213
  _onChange(_value);
213
214
  setSelectedRows(_value);
215
+ setOptions([]);
214
216
  } else if (Array.isArray(changed)) {
215
217
  if (!changed.length) {
216
218
  _onChange([]);
@@ -239,6 +241,25 @@ export var InputRecordPicker = function InputRecordPicker(props) {
239
241
  options: options
240
242
  }));
241
243
  };
244
+ export var RecordPickerProvider = function RecordPickerProvider(props) {
245
+ var multiple = props.multiple,
246
+ onChange = props.onChange,
247
+ selectedRows = props.selectedRows,
248
+ setSelectedRows = props.setSelectedRows,
249
+ options = props.options,
250
+ collectionField = props.collectionField,
251
+ other = _objectWithoutProperties(props, _excluded3);
252
+ return /*#__PURE__*/React.createElement(RecordPickerContext.Provider, {
253
+ value: _objectSpread({
254
+ multiple: multiple,
255
+ onChange: onChange,
256
+ selectedRows: selectedRows,
257
+ setSelectedRows: setSelectedRows,
258
+ options: options,
259
+ collectionField: collectionField
260
+ }, other)
261
+ }, props.children);
262
+ };
242
263
  var Drawer = function Drawer(_ref) {
243
264
  var multiple = _ref.multiple,
244
265
  onChange = _ref.onChange,
@@ -259,16 +280,15 @@ var Drawer = function Drawer(_ref) {
259
280
  } : {};
260
281
  return filter;
261
282
  };
262
- return /*#__PURE__*/React.createElement(RecordPickerContext.Provider, {
263
- value: {
264
- multiple: multiple,
265
- onChange: onChange,
266
- selectedRows: selectedRows,
267
- setSelectedRows: setSelectedRows,
268
- options: options,
269
- collectionField: collectionField
270
- }
271
- }, /*#__PURE__*/React.createElement(CollectionProvider, {
283
+ var recordPickerProps = {
284
+ multiple: multiple,
285
+ onChange: onChange,
286
+ selectedRows: selectedRows,
287
+ setSelectedRows: setSelectedRows,
288
+ options: options,
289
+ collectionField: collectionField
290
+ };
291
+ return /*#__PURE__*/React.createElement(RecordPickerProvider, _objectSpread({}, recordPickerProps), /*#__PURE__*/React.createElement(CollectionProvider, {
272
292
  allowNull: true,
273
293
  name: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
274
294
  }, /*#__PURE__*/React.createElement(ActionContext.Provider, {
@@ -11,9 +11,10 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
11
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12
12
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
13
13
  import { LoadingOutlined } from '@ant-design/icons';
14
- import { connect, mapProps, mapReadPretty, useFieldSchema } from '@formily/react';
14
+ import { connect, mapProps, mapReadPretty, useFieldSchema, useField } from '@formily/react';
15
15
  import { Tag } from 'antd';
16
16
  import moment from 'moment';
17
+ import { uniqBy } from 'lodash';
17
18
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
18
19
  import { useRequest } from '../../../api-client';
19
20
  import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
@@ -22,7 +23,7 @@ import { useCompile } from '../../hooks';
22
23
  import { Select, defaultFieldNames } from '../select';
23
24
  import { ReadPretty } from './ReadPretty';
24
25
  var InternalRemoteSelect = connect(function (props) {
25
- var _service$params;
26
+ var _field$componentProps, _field$componentProps2, _field$componentProps3, _service$params;
26
27
  var _props$fieldNames = props.fieldNames,
27
28
  fieldNames = _props$fieldNames === void 0 ? {} : _props$fieldNames,
28
29
  _props$service = props.service,
@@ -39,6 +40,7 @@ var InternalRemoteSelect = connect(function (props) {
39
40
  var compile = useCompile();
40
41
  var firstRun = useRef(false);
41
42
  var fieldSchema = useFieldSchema();
43
+ var field = useField();
42
44
  var _useCollection = useCollection(),
43
45
  getField = _useCollection.getField;
44
46
  var _useCollectionManager = useCollectionManager(),
@@ -56,7 +58,7 @@ var InternalRemoteSelect = connect(function (props) {
56
58
  var mapOptionsToTags = useCallback(function (options) {
57
59
  try {
58
60
  return options.map(function (option) {
59
- var _targetField$uiSchema, _ref;
61
+ var _targetField$uiSchema, _objectSpread2;
60
62
  var label = option[fieldNames.label];
61
63
  if (targetField === null || targetField === void 0 ? void 0 : (_targetField$uiSchema = targetField.uiSchema) === null || _targetField$uiSchema === void 0 ? void 0 : _targetField$uiSchema.enum) {
62
64
  if (Array.isArray(label)) {
@@ -94,7 +96,7 @@ var InternalRemoteSelect = connect(function (props) {
94
96
  var _mapOptions;
95
97
  return mapOptions((_mapOptions = {}, _defineProperty(_mapOptions, fieldNames.label, label), _defineProperty(_mapOptions, fieldNames.value, option[fieldNames.value]), _mapOptions));
96
98
  }
97
- return _ref = {}, _defineProperty(_ref, fieldNames.label, label || option[fieldNames.value]), _defineProperty(_ref, fieldNames.value, option[fieldNames.value]), _ref;
99
+ return _objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, fieldNames.label, label || option[fieldNames.value]), _defineProperty(_objectSpread2, fieldNames.value, option[fieldNames.value]), _objectSpread2));
98
100
  });
99
101
  } catch (err) {
100
102
  console.error(err);
@@ -109,7 +111,7 @@ var InternalRemoteSelect = connect(function (props) {
109
111
  }, service === null || service === void 0 ? void 0 : service.params), {}, {
110
112
  // fields: [fieldNames.label, fieldNames.value, ...(service?.params?.fields || [])],
111
113
  // search needs
112
- filter: mergeFilter([service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter])
114
+ filter: mergeFilter([((_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) || (service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter)])
113
115
  })
114
116
  }), {
115
117
  manual: manual,
@@ -131,13 +133,13 @@ var InternalRemoteSelect = connect(function (props) {
131
133
  }
132
134
  }, [runDep]);
133
135
  var onSearch = /*#__PURE__*/function () {
134
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
135
- var _service$params2;
136
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
137
+ var _field$componentProps4, _field$componentProps5, _field$componentProps6, _service$params2;
136
138
  return _regeneratorRuntime().wrap(function _callee$(_context) {
137
139
  while (1) switch (_context.prev = _context.next) {
138
140
  case 0:
139
141
  run({
140
- filter: mergeFilter([_defineProperty({}, fieldNames.label, _defineProperty({}, operator, search)), service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter])
142
+ filter: mergeFilter([_defineProperty({}, fieldNames.label, _defineProperty({}, operator, search)), ((_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.filter) || (service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter)])
141
143
  });
142
144
  case 1:
143
145
  case "end":
@@ -146,32 +148,28 @@ var InternalRemoteSelect = connect(function (props) {
146
148
  }, _callee);
147
149
  }));
148
150
  return function onSearch(_x) {
149
- return _ref2.apply(this, arguments);
151
+ return _ref.apply(this, arguments);
150
152
  };
151
153
  }();
152
154
  var getOptionsByFieldNames = useCallback(function (item) {
153
155
  return Object.keys(fieldNames).reduce(function (obj, key) {
154
- var value = item[fieldNames[key]];
155
- if (value) {
156
- // support hidden, disabled, etc.
157
- obj[['label', 'value', 'options'].includes(key) ? fieldNames[key] : key] = key === 'label' ? compile(value) : value;
158
- }
159
156
  return obj;
160
157
  }, {});
161
158
  }, [fieldNames]);
162
159
  var normalizeOptions = useCallback(function (obj) {
163
- var _ref4;
160
+ var _ref3;
164
161
  if (objectValue || _typeof(obj) === 'object') {
165
162
  return getOptionsByFieldNames(obj);
166
163
  }
167
- return _ref4 = {}, _defineProperty(_ref4, fieldNames.value, obj), _defineProperty(_ref4, fieldNames.label, obj), _ref4;
164
+ return _ref3 = {}, _defineProperty(_ref3, fieldNames.value, obj), _defineProperty(_ref3, fieldNames.label, obj), _ref3;
168
165
  }, [objectValue, getOptionsByFieldNames]);
169
166
  var options = useMemo(function () {
170
167
  var _data$data, _data$data2;
171
168
  if (!(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.length)) {
172
- return value !== undefined && value !== null ? Array.isArray(value) ? value.map(normalizeOptions) : [normalizeOptions(value)] : [];
169
+ return value !== undefined && value !== null ? Array.isArray(value) ? value : [value] : [];
173
170
  }
174
- return (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.map(getOptionsByFieldNames)) || [];
171
+ var valueOptions = value !== undefined && value !== null && (Array.isArray(value) ? value : [value]) || [];
172
+ return uniqBy((data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.concat(valueOptions)) || [], fieldNames.value);
175
173
  }, [data === null || data === void 0 ? void 0 : data.data, getOptionsByFieldNames, normalizeOptions, value]);
176
174
  var onDropdownVisibleChange = function onDropdownVisibleChange() {
177
175
  if (firstRun.current) {
@@ -31,12 +31,13 @@ var useLabelFields = function useLabelFields(collectionName) {
31
31
  });
32
32
  };
33
33
  export var TableColumnDesigner = function TableColumnDesigner(props) {
34
- var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$targ, _collectionField$uiSc, _columnSchema$xCompo, _fieldSchema$xCompon2, _fieldSchema$xCompon3;
34
+ var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$targ, _collectionField$uiSc, _columnSchema$xCompo, _fieldSchema$xCompon2;
35
35
  var uiSchema = props.uiSchema,
36
36
  fieldSchema = props.fieldSchema,
37
37
  collectionField = props.collectionField;
38
38
  var _useCollectionManager2 = useCollectionManager(),
39
- getInterface = _useCollectionManager2.getInterface;
39
+ getInterface = _useCollectionManager2.getInterface,
40
+ getCollection = _useCollectionManager2.getCollection;
40
41
  var field = useField();
41
42
  var _useTranslation = useTranslation(),
42
43
  t = _useTranslation.t;
@@ -46,6 +47,8 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
46
47
  var fieldNames = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['fieldNames']) || (uiSchema === null || uiSchema === void 0 ? void 0 : (_uiSchema$xComponent = uiSchema['x-component-props']) === null || _uiSchema$xComponent === void 0 ? void 0 : _uiSchema$xComponent['fieldNames']);
47
48
  var options = useLabelFields((_collectionField$targ = collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) !== null && _collectionField$targ !== void 0 ? _collectionField$targ : collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection);
48
49
  var intefaceCfg = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
50
+ var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
51
+ var isFileField = isFileCollection(targetCollection);
49
52
  return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, {
50
53
  disableInitializer: true
51
54
  }, /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
@@ -120,17 +123,20 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
120
123
  });
121
124
  dn.refresh();
122
125
  }
123
- }), ['linkTo', 'm2m', 'm2o', 'o2m', 'obo', 'oho', 'snapshot', 'createdBy', 'updatedBy'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
126
+ }), ['linkTo', 'm2m', 'm2o', 'o2m', 'obo', 'oho', 'snapshot', 'createdBy', 'updatedBy'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && !isFileField && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
124
127
  title: t('Enable link'),
125
- checked: ((_fieldSchema$xCompon2 = (_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.mode) !== null && _fieldSchema$xCompon2 !== void 0 ? _fieldSchema$xCompon2 : 'links') === 'links',
128
+ checked: ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.enableLink) !== false,
126
129
  onChange: function onChange(flag) {
127
130
  fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
128
- mode: flag ? 'links' : 'tags'
131
+ enableLink: flag
132
+ });
133
+ field.componentProps = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
134
+ enableLink: flag
129
135
  });
130
136
  dn.emit('patch', {
131
137
  schema: {
132
138
  'x-uid': fieldSchema['x-uid'],
133
- 'x-component-props': _objectSpread({}, fieldSchema['x-component-props'])
139
+ 'x-component-props': _objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props'])
134
140
  }
135
141
  });
136
142
  dn.refresh();
@@ -140,8 +146,8 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
140
146
  options: options,
141
147
  value: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames['label'],
142
148
  onChange: function onChange(label) {
143
- var _collectionField$uiSc2, _fieldSchema$xCompon4;
144
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2['x-component-props']['fieldNames']), fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4['fieldNames']), {}, {
149
+ var _collectionField$uiSc2, _fieldSchema$xCompon3;
150
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc2 = collectionField.uiSchema) === null || _collectionField$uiSc2 === void 0 ? void 0 : _collectionField$uiSc2['x-component-props']['fieldNames']), fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3['fieldNames']), {}, {
145
151
  label: label
146
152
  });
147
153
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
@@ -165,4 +171,7 @@ export var TableColumnDesigner = function TableColumnDesigner(props) {
165
171
  title: t('Delete table column')
166
172
  }
167
173
  }));
168
- };
174
+ };
175
+ function isFileCollection(collection) {
176
+ return (collection === null || collection === void 0 ? void 0 : collection.template) === 'file';
177
+ }
@@ -0,0 +1 @@
1
+ export declare const TableIndex: (props: any) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { useRecordIndex } from '../../../record-provider';
3
+ export var TableIndex = function TableIndex(props) {
4
+ var recordIndex = useRecordIndex();
5
+ return /*#__PURE__*/React.createElement("div", null, recordIndex + 1);
6
+ };
@@ -35,9 +35,13 @@ import { DndContext, useDesignable, useTableSize } from '../..';
35
35
  import { RecordIndexProvider, RecordProvider, useSchemaInitializer, useTableBlockContext, useTableSelectorContext } from '../../../';
36
36
  import { useACLFieldWhitelist } from '../../../acl/ACLProvider';
37
37
  import { extractIndex, getIdsWithChildren, isCollectionFieldComponent, isColumnComponent } from './utils';
38
- var useTableColumns = function useTableColumns() {
39
- var _schema$reducePropert;
38
+ var useArrayField = function useArrayField(props) {
40
39
  var field = useField();
40
+ return props.field || field;
41
+ };
42
+ var useTableColumns = function useTableColumns(props) {
43
+ var _schema$reducePropert;
44
+ var field = useArrayField(props);
41
45
  var schema = useFieldSchema();
42
46
  var _useACLFieldWhitelist = useACLFieldWhitelist(),
43
47
  schemaInWhitelist = _useACLFieldWhitelist.schemaInWhitelist;
@@ -78,8 +82,8 @@ var useTableColumns = function useTableColumns() {
78
82
  }, /*#__PURE__*/React.createElement(RecordProvider, {
79
83
  record: record
80
84
  }, /*#__PURE__*/React.createElement(RecursionField, {
85
+ basePath: field.address.concat(record.__index || index),
81
86
  schema: s,
82
- name: record.__index || index,
83
87
  onlyRenderProperties: true
84
88
  })));
85
89
  }
@@ -179,8 +183,6 @@ var useValidator = function useValidator(validator) {
179
183
  };
180
184
  export var Table = observer(function (props) {
181
185
  var _schema$parent, _schema$parent2, _field$data, _fieldSchema$parent, _fieldSchema$parent$x, _field$value4, _field$value4$slice;
182
- var field = useField();
183
- var columns = useTableColumns();
184
186
  var pagination1 = props.pagination,
185
187
  useProps = props.useProps,
186
188
  onChange = props.onChange,
@@ -201,6 +203,8 @@ export var Table = observer(function (props) {
201
203
  required = _others1$others.required,
202
204
  _onExpand = _others1$others.onExpand,
203
205
  others = _objectWithoutProperties(_others1$others, _excluded3);
206
+ var field = useArrayField(others);
207
+ var columns = useTableColumns(others);
204
208
  var schema = useFieldSchema();
205
209
  var isTableSelector = (schema === null || schema === void 0 ? void 0 : (_schema$parent = schema.parent) === null || _schema$parent === void 0 ? void 0 : _schema$parent['x-decorator']) === 'TableSelectorProvider';
206
210
  var ctx = isTableSelector ? useTableSelectorContext() : useTableBlockContext();
@@ -4,6 +4,7 @@ import { TableColumn } from './Table.Column';
4
4
  import { TableColumnActionBar } from './Table.Column.ActionBar';
5
5
  import { TableColumnDecorator } from './Table.Column.Decorator';
6
6
  import { TableColumnDesigner } from './Table.Column.Designer';
7
+ import { TableIndex } from './Table.Index';
7
8
  import { TableSelector } from './TableSelector';
8
9
  export * from './TableBlockDesigner';
9
10
  export * from './TableField';
@@ -14,4 +15,5 @@ TableV2.Column.ActionBar = TableColumnActionBar;
14
15
  TableV2.Column.Decorator = TableColumnDecorator;
15
16
  TableV2.Column.Designer = TableColumnDesigner;
16
17
  TableV2.ActionColumnDesigner = TableActionColumnDesigner;
17
- TableV2.Selector = TableSelector;
18
+ TableV2.Selector = TableSelector;
19
+ TableV2.Index = TableIndex;
@@ -31,7 +31,7 @@ export function getIdsWithChildren(nodes) {
31
31
  var node = _step.value;
32
32
  if (node.children && node.children.length > 0) {
33
33
  ids.push(node.id);
34
- ids.push.apply(ids, _toConsumableArray(getIdsWithChildren(node.children)));
34
+ ids.push.apply(ids, _toConsumableArray(getIdsWithChildren(node === null || node === void 0 ? void 0 : node.children)));
35
35
  }
36
36
  }
37
37
  } catch (err) {
@@ -45,7 +45,7 @@ var ConstantTypes = {
45
45
  string: {
46
46
  label: "{{t(\"String\")}}",
47
47
  value: 'string',
48
- component: function component(_ref) {
48
+ component: function StringComponent(_ref) {
49
49
  var _onChange = _ref.onChange,
50
50
  value = _ref.value;
51
51
  return /*#__PURE__*/React.createElement(AntInput, {
@@ -60,7 +60,7 @@ var ConstantTypes = {
60
60
  number: {
61
61
  label: '{{t("Number")}}',
62
62
  value: 'number',
63
- component: function component(_ref2) {
63
+ component: function NumberComponent(_ref2) {
64
64
  var onChange = _ref2.onChange,
65
65
  value = _ref2.value;
66
66
  return /*#__PURE__*/React.createElement(InputNumber, {
@@ -73,7 +73,7 @@ var ConstantTypes = {
73
73
  boolean: {
74
74
  label: "{{t(\"Boolean\")}}",
75
75
  value: 'boolean',
76
- component: function Com(_ref3) {
76
+ component: function BooleanComponent(_ref3) {
77
77
  var onChange = _ref3.onChange,
78
78
  value = _ref3.value;
79
79
  var _useTranslation = useTranslation(),
@@ -96,7 +96,7 @@ var ConstantTypes = {
96
96
  date: {
97
97
  label: '{{t("Date")}}',
98
98
  value: 'date',
99
- component: function component(_ref4) {
99
+ component: function DateComponent(_ref4) {
100
100
  var _onChange2 = _ref4.onChange,
101
101
  value = _ref4.value;
102
102
  return /*#__PURE__*/React.createElement(DatePicker, {
@@ -116,7 +116,7 @@ var ConstantTypes = {
116
116
  null: {
117
117
  label: "{{t(\"Null\")}}",
118
118
  value: 'null',
119
- component: function Com() {
119
+ component: function NullComponent() {
120
120
  var _useTranslation2 = useTranslation(),
121
121
  t = _useTranslation2.t;
122
122
  return /*#__PURE__*/React.createElement(AntInput, {
@@ -15,7 +15,6 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
15
15
  import { Input } from 'antd';
16
16
  import { useForm } from '@formily/react';
17
17
  import { cx, css } from '@emotion/css';
18
- import { useTranslation } from 'react-i18next';
19
18
  import * as sanitizeHTML from 'sanitize-html';
20
19
  import { EllipsisWithTooltip, useCompile } from '../..';
21
20
  import { VariableSelect } from './VariableSelect';
@@ -215,8 +214,6 @@ export function TextArea(props) {
215
214
  _props$multiline = props.multiline,
216
215
  multiline = _props$multiline === void 0 ? true : _props$multiline;
217
216
  var compile = useCompile();
218
- var _useTranslation = useTranslation(),
219
- t = _useTranslation.t;
220
217
  var inputRef = useRef(null);
221
218
  var options = compile((_ref2 = typeof scope === 'function' ? scope() : scope) !== null && _ref2 !== void 0 ? _ref2 : []);
222
219
  var form = useForm();
@@ -334,7 +331,7 @@ export function TextArea(props) {
334
331
  if (ev.key === 'Enter') {
335
332
  ev.preventDefault();
336
333
  }
337
- setIME(ev.keyCode === 229);
334
+ setIME(ev.keyCode === 229 && ![' ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'Enter'].includes(ev.key));
338
335
  // if (ev.key === 'Control') {
339
336
  // console.debug(getSelection().getRangeAt(0));
340
337
  // }
@@ -392,7 +389,7 @@ export function TextArea(props) {
392
389
  onInsert: onInsert
393
390
  }) : null);
394
391
  }
395
- TextArea.ReadPretty = function (props) {
392
+ TextArea.ReadPretty = function ReadPretty(props) {
396
393
  var _ref5;
397
394
  var value = props.value,
398
395
  _props$multiline2 = props.multiline,
@@ -23,7 +23,7 @@ var useDragEnd = function useDragEnd(props) {
23
23
  var _useTranslation = useTranslation(),
24
24
  t = _useTranslation.t;
25
25
  return function (event) {
26
- var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current, _over$data5, _over$data5$current;
26
+ var _active$data, _active$data$current, _over$data, _over$data$current, _over$data2, _over$data2$current, _over$data3, _over$data3$current, _over$data4, _over$data4$current, _over$data5, _over$data5$current, _over$data$current$re;
27
27
  var active = event.active,
28
28
  over = event.over;
29
29
  var activeSchema = active === null || active === void 0 ? void 0 : (_active$data = active.data) === null || _active$data === void 0 ? void 0 : (_active$data$current = _active$data.current) === null || _active$data$current === void 0 ? void 0 : _active$data$current.schema;
@@ -32,6 +32,7 @@ var useDragEnd = function useDragEnd(props) {
32
32
  var breakRemoveOn = over === null || over === void 0 ? void 0 : (_over$data3 = over.data) === null || _over$data3 === void 0 ? void 0 : (_over$data3$current = _over$data3.current) === null || _over$data3$current === void 0 ? void 0 : _over$data3$current.breakRemoveOn;
33
33
  var wrapSchema = over === null || over === void 0 ? void 0 : (_over$data4 = over.data) === null || _over$data4 === void 0 ? void 0 : (_over$data4$current = _over$data4.current) === null || _over$data4$current === void 0 ? void 0 : _over$data4$current.wrapSchema;
34
34
  var onSuccess = over === null || over === void 0 ? void 0 : (_over$data5 = over.data) === null || _over$data5 === void 0 ? void 0 : (_over$data5$current = _over$data5.current) === null || _over$data5$current === void 0 ? void 0 : _over$data5$current.onSuccess;
35
+ var removeParentsIfNoChildren = (_over$data$current$re = over.data.current.removeParentsIfNoChildren) !== null && _over$data$current$re !== void 0 ? _over$data$current$re : true;
35
36
  if (!activeSchema || !overSchema) {
36
37
  var _props$onDragEnd;
37
38
  props === null || props === void 0 ? void 0 : (_props$onDragEnd = props.onDragEnd) === null || _props$onDragEnd === void 0 ? void 0 : _props$onDragEnd.call(props, event);
@@ -60,7 +61,7 @@ var useDragEnd = function useDragEnd(props) {
60
61
  dn.insertAdjacent(insertAdjacent, activeSchema, {
61
62
  wrap: wrapSchema,
62
63
  breakRemoveOn: breakRemoveOn,
63
- removeParentsIfNoChildren: true,
64
+ removeParentsIfNoChildren: removeParentsIfNoChildren,
64
65
  onSuccess: onSuccess
65
66
  });
66
67
  props === null || props === void 0 ? void 0 : (_props$onDragEnd4 = props.onDragEnd) === null || _props$onDragEnd4 === void 0 ? void 0 : _props$onDragEnd4.call(props, event);
@@ -72,15 +72,18 @@ var useSortableItemId = function useSortableItemId(props) {
72
72
  return field.address.toString();
73
73
  };
74
74
  export var SortableItem = observer(function (props) {
75
+ var _others$removeParents;
75
76
  var _useSortableItemProps = useSortableItemProps(props),
76
77
  schema = _useSortableItemProps.schema,
77
78
  id = _useSortableItemProps.id,
78
79
  others = _objectWithoutProperties(_useSortableItemProps, _excluded2);
80
+ var removeParentsIfNoChildren = (_others$removeParents = others.removeParentsIfNoChildren) !== null && _others$removeParents !== void 0 ? _others$removeParents : true;
79
81
  return /*#__PURE__*/React.createElement(SortableProvider, {
80
82
  id: id,
81
83
  data: {
82
84
  insertAdjacent: 'afterEnd',
83
- schema: schema
85
+ schema: schema,
86
+ removeParentsIfNoChildren: removeParentsIfNoChildren
84
87
  }
85
88
  }, /*#__PURE__*/React.createElement(Sortable, _objectSpread({}, others), props.children));
86
89
  });
@@ -62,7 +62,7 @@ var getValue = function getValue(str, values) {
62
62
  var regex = /{{(.*?)}}/;
63
63
  var matches = str === null || str === void 0 ? void 0 : (_str$match3 = str.match) === null || _str$match3 === void 0 ? void 0 : _str$match3.call(str, regex);
64
64
  if (matches) {
65
- return getVariableValue(str, values);
65
+ return getVariableValue(str, flat(values));
66
66
  } else {
67
67
  return str;
68
68
  }
@@ -9,3 +9,4 @@ export * from './useFieldComponentOptions';
9
9
  export * from './useFieldTitle';
10
10
  export * from './useProps';
11
11
  export * from './useTableSize';
12
+ export * from './useFieldModeOptions';
@@ -8,4 +8,5 @@ export * from './useSchemaComponentContext';
8
8
  export * from './useFieldComponentOptions';
9
9
  export * from './useFieldTitle';
10
10
  export * from './useProps';
11
- export * from './useTableSize';
11
+ export * from './useTableSize';
12
+ export * from './useFieldModeOptions';
@@ -0,0 +1,4 @@
1
+ export declare const useFieldModeOptions: () => {
2
+ label: string;
3
+ value: string;
4
+ }[];
@@ -0,0 +1,105 @@
1
+ import { useFieldSchema, useField } from '@formily/react';
2
+ import { useMemo } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useCollection, useCollectionManager } from '../../collection-manager';
5
+ export var useFieldModeOptions = function useFieldModeOptions() {
6
+ var _fieldSchema$xCompon;
7
+ var _useCollectionManager = useCollectionManager(),
8
+ getCollectionJoinField = _useCollectionManager.getCollectionJoinField,
9
+ getCollection = _useCollectionManager.getCollection;
10
+ var fieldSchema = useFieldSchema();
11
+ var field = useField();
12
+ var isReadPretty = field.readPretty;
13
+ var _useCollection = useCollection(),
14
+ getField = _useCollection.getField;
15
+ var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
16
+ var _useTranslation = useTranslation(),
17
+ t = _useTranslation.t;
18
+ var _ref = ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.fieldNames) || {},
19
+ label = _ref.label;
20
+ var fieldModeOptions = useMemo(function () {
21
+ if (!collectionField || !(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface)) {
22
+ return;
23
+ }
24
+ if (!['o2o', 'oho', 'obo', 'o2m', 'linkTo', 'm2o', 'm2m'].includes(collectionField.interface)) return;
25
+ var collection = getCollection(collectionField.target);
26
+ if ((collection === null || collection === void 0 ? void 0 : collection.template) === 'file') {
27
+ return isReadPretty ? [{
28
+ label: t('Title'),
29
+ value: 'Select'
30
+ }, {
31
+ label: t('File manager'),
32
+ value: 'FileManager'
33
+ }] : [{
34
+ label: t('File manager'),
35
+ value: 'FileManager'
36
+ }, {
37
+ label: t('Record picker'),
38
+ value: 'Picker'
39
+ }, {
40
+ label: t('Select'),
41
+ value: 'Select'
42
+ }];
43
+ }
44
+ switch (collectionField.interface) {
45
+ case 'o2m':
46
+ return isReadPretty ? [{
47
+ label: t('Title'),
48
+ value: 'Select'
49
+ },
50
+ // { label: t('Subtable'), value: 'SubTable' },
51
+ {
52
+ label: t('Sub-details'),
53
+ value: 'Nester'
54
+ }] : [{
55
+ label: t('Record picker'),
56
+ value: 'Picker'
57
+ },
58
+ // { label: t('Subtable'), value: 'SubTable' },
59
+ {
60
+ label: t('Select'),
61
+ value: 'Select'
62
+ }, {
63
+ label: t('Subform'),
64
+ value: 'Nester'
65
+ }];
66
+ case 'm2o':
67
+ case 'm2m':
68
+ case 'linkTo':
69
+ return isReadPretty ? [{
70
+ label: t('Title'),
71
+ value: 'Select'
72
+ }, {
73
+ label: t('Sub-details'),
74
+ value: 'Nester'
75
+ }] : [{
76
+ label: t('Record picker'),
77
+ value: 'Picker'
78
+ }, {
79
+ label: t('Select'),
80
+ value: 'Select'
81
+ }, {
82
+ label: t('Subform'),
83
+ value: 'Nester'
84
+ }];
85
+ default:
86
+ return isReadPretty ? [{
87
+ label: t('Title'),
88
+ value: 'Select'
89
+ }, {
90
+ label: t('Sub-details'),
91
+ value: 'Nester'
92
+ }] : [{
93
+ label: t('Record picker'),
94
+ value: 'Picker'
95
+ }, {
96
+ label: t('Select'),
97
+ value: 'Select'
98
+ }, {
99
+ label: t('Subform'),
100
+ value: 'Nester'
101
+ }];
102
+ }
103
+ }, [t, collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface, label]);
104
+ return fieldModeOptions;
105
+ };
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  export declare const actionDesignerCss: string;
3
- export declare const CreateRecordAction: React.MemoExoticComponent<React.FunctionComponent<unknown>>;
3
+ export declare const CreateRecordAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
@@ -108,6 +108,7 @@ export var CreateRecordAction = observer(function (props) {
108
108
  var compile = useCompile();
109
109
  var _useDesignable = useDesignable(),
110
110
  designable = _useDesignable.designable;
111
+ var icon = props.icon || /*#__PURE__*/React.createElement(PlusOutlined, null);
111
112
  var menu = /*#__PURE__*/React.createElement(Menu, null, inheritsCollections.map(function (option) {
112
113
  return /*#__PURE__*/React.createElement(Menu.Item, {
113
114
  key: option.name,
@@ -151,16 +152,16 @@ export var CreateRecordAction = observer(function (props) {
151
152
  setVisible(true);
152
153
  setCurrentCollection(collection.name);
153
154
  }
154
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), props.children) : /*#__PURE__*/React.createElement(Dropdown, {
155
+ }, icon, props.children) : /*#__PURE__*/React.createElement(Dropdown, {
155
156
  overlay: menu
156
157
  }, /*#__PURE__*/React.createElement(Button, {
157
- icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
158
+ icon: icon,
158
159
  type: 'primary'
159
160
  }, props.children, " ", /*#__PURE__*/React.createElement(DownOutlined, null))) : /*#__PURE__*/React.createElement(Button, {
160
161
  type: componentType,
161
162
  disabled: field.disabled,
162
163
  danger: componentType === 'danger',
163
- icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
164
+ icon: icon,
164
165
  onClick: function onClick(info) {
165
166
  setVisible(true);
166
167
  setCurrentCollection(collection.name);