@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
@@ -15,6 +15,7 @@ var _collectionManager = require("../../../collection-manager");
15
15
  var _schemaSettings = require("../../../schema-settings");
16
16
  var _hooks = require("../../hooks");
17
17
  var _useOperators = require("../filter/useOperators");
18
+ var _FormItem = require("./FormItem");
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
20
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
20
21
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -401,64 +402,39 @@ var EditDefaultValue = function EditDefaultValue() {
401
402
  };
402
403
  exports.EditDefaultValue = EditDefaultValue;
403
404
  var EditComponent = function EditComponent() {
405
+ var _field$componentProps;
404
406
  var _useCollectionManager4 = (0, _collectionManager.useCollectionManager)(),
405
- getInterface = _useCollectionManager4.getInterface,
406
407
  getCollectionJoinField = _useCollectionManager4.getCollectionJoinField,
407
408
  getCollection = _useCollectionManager4.getCollection;
408
409
  var _useCollection4 = (0, _collectionManager.useCollection)(),
409
- getField = _useCollection4.getField,
410
- template = _useCollection4.template;
411
- var tk = (0, _blockProvider.useFilterByTk)();
412
- var _useFormBlockContext3 = (0, _blockProvider.useFormBlockContext)(),
413
- form = _useFormBlockContext3.form;
410
+ getField = _useCollection4.getField;
414
411
  var field = (0, _react.useField)();
415
412
  var fieldSchema = (0, _react.useFieldSchema)();
416
413
  var _useTranslation7 = (0, _reactI18next.useTranslation)(),
417
414
  t = _useTranslation7.t;
418
415
  var _useDesignable7 = (0, _hooks.useDesignable)(),
419
- dn = _useDesignable7.dn,
420
- insertAdjacent = _useDesignable7.insertAdjacent;
416
+ dn = _useDesignable7.dn;
421
417
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
422
- var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
423
- var fieldComponentOptions = (0, _hooks.useFieldComponentOptions)();
424
- var isSubFormAssociationField = field.address.segments.includes('__form_grid');
425
- return form && !isSubFormAssociationField && fieldComponentOptions ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
426
- title: t('Field component'),
427
- options: fieldComponentOptions,
428
- value: fieldSchema['x-component'],
429
- onChange: function onChange(type) {
430
- var _collectionField$uiSc4, _interfaceConfig$sche;
431
- var schema = {
432
- name: collectionField.name,
433
- type: 'void',
434
- required: fieldSchema['required'],
435
- description: fieldSchema['description'],
436
- default: fieldSchema['default'],
437
- 'x-decorator': 'FormItem',
438
- 'x-designer': 'FormItem.Designer',
439
- 'x-component': type,
440
- 'x-validator': fieldSchema['x-validator'],
441
- 'x-collection-field': fieldSchema['x-collection-field'],
442
- 'x-decorator-props': fieldSchema['x-decorator-props'],
443
- 'x-component-props': _objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4['x-component-props']), fieldSchema['x-component-props'])
444
- };
445
- interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$sche = interfaceConfig.schemaInitialize) === null || _interfaceConfig$sche === void 0 ? void 0 : _interfaceConfig$sche.call(interfaceConfig, schema, {
446
- field: collectionField,
447
- block: 'Form',
448
- readPretty: field.readPretty,
449
- action: tk ? 'get' : null,
450
- targetCollection: getCollection(collectionField.target)
451
- });
452
- insertAdjacent('beforeBegin', divWrap(schema), {
453
- onSuccess: function onSuccess() {
454
- dn.remove(null, {
455
- removeParentsIfNoChildren: true,
456
- breakRemoveOn: {
457
- 'x-component': 'Grid'
458
- }
459
- });
460
- }
418
+ var fieldModeOptions = (0, _hooks.useFieldModeOptions)();
419
+ var isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.type);
420
+ var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
421
+ var isFileField = (0, _FormItem.isFileCollection)(targetCollection);
422
+ return isAssociationField && fieldModeOptions ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
423
+ key: "field-mode",
424
+ title: t('Field mode'),
425
+ options: fieldModeOptions,
426
+ value: (field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : _field$componentProps['mode']) || (isFileField ? 'FileManager' : 'Select'),
427
+ onChange: function onChange(mode) {
428
+ var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
429
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
430
+ fieldSchema['x-component-props']['mode'] = mode;
431
+ schema['x-component-props'] = fieldSchema['x-component-props'];
432
+ field.componentProps = field.componentProps || {};
433
+ field.componentProps.mode = mode;
434
+ dn.emit('patch', {
435
+ schema: schema
461
436
  });
437
+ dn.refresh();
462
438
  }
463
439
  }) : null;
464
440
  };
@@ -468,8 +444,8 @@ var EditPattern = function EditPattern() {
468
444
  getCollectionJoinField = _useCollectionManager5.getCollectionJoinField;
469
445
  var _useCollection5 = (0, _collectionManager.useCollection)(),
470
446
  getField = _useCollection5.getField;
471
- var _useFormBlockContext4 = (0, _blockProvider.useFormBlockContext)(),
472
- form = _useFormBlockContext4.form;
447
+ var _useFormBlockContext3 = (0, _blockProvider.useFormBlockContext)(),
448
+ form = _useFormBlockContext3.form;
473
449
  var field = (0, _react.useField)();
474
450
  var fieldSchema = (0, _react.useFieldSchema)();
475
451
  var _useTranslation8 = (0, _reactI18next.useTranslation)(),
@@ -562,7 +538,8 @@ var EditOperator = function EditOperator() {
562
538
  dn = _useDesignable9.dn;
563
539
  var operatorList = (0, _useOperators.useOperatorList)();
564
540
  var _findFilterOperators2 = findFilterOperators(fieldSchema),
565
- storedOperators = _findFilterOperators2.operators,
541
+ _findFilterOperators3 = _findFilterOperators2.operators,
542
+ storedOperators = _findFilterOperators3 === void 0 ? {} : _findFilterOperators3,
566
543
  uid = _findFilterOperators2.uid;
567
544
  if (operatorList.length && !storedOperators[fieldSchema.name]) {
568
545
  storedOperators[fieldSchema.name] = operatorList[0].value;
@@ -573,9 +550,9 @@ var EditOperator = function EditOperator() {
573
550
  value: storedOperators[fieldSchema.name],
574
551
  options: compile(operatorList),
575
552
  onChange: function onChange(v) {
576
- var _schema5;
553
+ var _schema6;
577
554
  storedOperators[fieldSchema.name] = v;
578
- var schema = (_schema5 = {}, _defineProperty(_schema5, 'x-uid', uid), _defineProperty(_schema5, 'x-filter-operators', storedOperators), _schema5);
555
+ var schema = (_schema6 = {}, _defineProperty(_schema6, 'x-uid', uid), _defineProperty(_schema6, 'x-filter-operators', storedOperators), _schema6);
579
556
  dn.emit('patch', {
580
557
  schema: schema
581
558
  });
@@ -585,7 +562,7 @@ var EditOperator = function EditOperator() {
585
562
  };
586
563
  exports.EditOperator = EditOperator;
587
564
  var EditTitleField = function EditTitleField() {
588
- var _getCollectionFields, _field$componentProps, _field$componentProps2;
565
+ var _getCollectionFields, _field$componentProps2, _field$componentProps3;
589
566
  var _useCollectionManager6 = (0, _collectionManager.useCollectionManager)(),
590
567
  getCollectionFields = _useCollectionManager6.getCollectionFields,
591
568
  getCollectionJoinField = _useCollectionManager6.getCollectionJoinField;
@@ -613,16 +590,17 @@ var EditTitleField = function EditTitleField() {
613
590
  key: "title-field",
614
591
  title: t('Title field'),
615
592
  options: options,
616
- value: field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.fieldNames) === null || _field$componentProps2 === void 0 ? void 0 : _field$componentProps2.label,
593
+ value: field === null || field === void 0 ? void 0 : (_field$componentProps2 = field.componentProps) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.fieldNames) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.label,
617
594
  onChange: function onChange(label) {
618
- var _collectionField$uiSc5, _collectionField$uiSc6;
595
+ var _collectionField$uiSc4, _collectionField$uiSc5;
619
596
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
620
- var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
597
+ var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : (_collectionField$uiSc5 = _collectionField$uiSc4['x-component-props']) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['fieldNames']), field.componentProps.fieldNames), {}, {
621
598
  label: label
622
599
  });
623
600
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
624
601
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
625
602
  schema['x-component-props'] = fieldSchema['x-component-props'];
603
+ field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
626
604
  dn.emit('patch', {
627
605
  schema: schema
628
606
  });
@@ -76,7 +76,9 @@ var linkageMergeAction = function linkageMergeAction(_ref, field, condition, val
76
76
  }
77
77
  }));
78
78
  valueResult.push(result);
79
- } catch (error) {}
79
+ } catch (error) {
80
+ console.log(error);
81
+ }
80
82
  } else if ((value === null || value === void 0 ? void 0 : value.mode) === 'constant') {
81
83
  valueResult.push((value === null || value === void 0 ? void 0 : value.value) || value);
82
84
  } else {
@@ -107,7 +107,7 @@ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
107
107
  }
108
108
  }, task.name, ": ", (0, _otherHelper.getYmd)(task.start), " ~ ", (0, _otherHelper.getYmd)(task.end)), task.end.getTime() - task.start.getTime() !== 0 && /*#__PURE__*/_react.default.createElement("p", {
109
109
  className: (0, _css.cx)(_style.tooltipDefaultContainerParagraph)
110
- }, "Duration: ".concat(~~((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)), " day(s)")), /*#__PURE__*/_react.default.createElement("p", {
110
+ }, "Duration: ".concat(Math.round((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24) * 10) / 10, " day(s)")), /*#__PURE__*/_react.default.createElement("p", {
111
111
  className: (0, _css.cx)(_style.tooltipDefaultContainerParagraph)
112
112
  }, !!task.progress && "Progress: ".concat(task.progress, "%")));
113
113
  };
@@ -1,4 +1,5 @@
1
1
  export * from './action';
2
+ export * from './association-field';
2
3
  export * from './association-select';
3
4
  export * from './block-item';
4
5
  export * from './calendar';
@@ -10,11 +11,13 @@ export * from './color-select';
10
11
  export * from './cron';
11
12
  export * from './date-picker';
12
13
  export * from './details';
14
+ export * from './expand-action';
13
15
  export * from './filter';
14
16
  export * from './form';
15
17
  export * from './form-item';
16
18
  export * from './form-v2';
17
19
  export * from './g2plot';
20
+ export * from './gantt';
18
21
  export * from './grid';
19
22
  export * from './icon-picker';
20
23
  export * from './input';
@@ -40,5 +43,4 @@ export * from './time-picker';
40
43
  export * from './tree-select';
41
44
  export * from './upload';
42
45
  export * from './variable';
43
- export * from './gantt';
44
46
  import './index.less';
@@ -14,6 +14,17 @@ Object.keys(_action).forEach(function (key) {
14
14
  }
15
15
  });
16
16
  });
17
+ var _associationField = require("./association-field");
18
+ Object.keys(_associationField).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _associationField[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _associationField[key];
25
+ }
26
+ });
27
+ });
17
28
  var _associationSelect = require("./association-select");
18
29
  Object.keys(_associationSelect).forEach(function (key) {
19
30
  if (key === "default" || key === "__esModule") return;
@@ -135,6 +146,17 @@ Object.keys(_details).forEach(function (key) {
135
146
  }
136
147
  });
137
148
  });
149
+ var _expandAction = require("./expand-action");
150
+ Object.keys(_expandAction).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _expandAction[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function get() {
156
+ return _expandAction[key];
157
+ }
158
+ });
159
+ });
138
160
  var _filter = require("./filter");
139
161
  Object.keys(_filter).forEach(function (key) {
140
162
  if (key === "default" || key === "__esModule") return;
@@ -190,6 +212,17 @@ Object.keys(_g2plot).forEach(function (key) {
190
212
  }
191
213
  });
192
214
  });
215
+ var _gantt = require("./gantt");
216
+ Object.keys(_gantt).forEach(function (key) {
217
+ if (key === "default" || key === "__esModule") return;
218
+ if (key in exports && exports[key] === _gantt[key]) return;
219
+ Object.defineProperty(exports, key, {
220
+ enumerable: true,
221
+ get: function get() {
222
+ return _gantt[key];
223
+ }
224
+ });
225
+ });
193
226
  var _grid = require("./grid");
194
227
  Object.keys(_grid).forEach(function (key) {
195
228
  if (key === "default" || key === "__esModule") return;
@@ -465,15 +498,4 @@ Object.keys(_variable).forEach(function (key) {
465
498
  }
466
499
  });
467
500
  });
468
- var _gantt = require("./gantt");
469
- Object.keys(_gantt).forEach(function (key) {
470
- if (key === "default" || key === "__esModule") return;
471
- if (key in exports && exports[key] === _gantt[key]) return;
472
- Object.defineProperty(exports, key, {
473
- enumerable: true,
474
- get: function get() {
475
- return _gantt[key];
476
- }
477
- });
478
- });
479
501
  require("./index.less");
@@ -241,7 +241,8 @@ Menu.Item = (0, _react.observer)(function (props) {
241
241
  eventKey: schema.name,
242
242
  schema: schema
243
243
  }), /*#__PURE__*/_react2.default.createElement(_.SortableItem, {
244
- className: designerCss
244
+ className: designerCss,
245
+ removeParentsIfNoChildren: false
245
246
  }, /*#__PURE__*/_react2.default.createElement(_2.Icon, {
246
247
  type: icon
247
248
  }), /*#__PURE__*/_react2.default.createElement("span", {
@@ -263,7 +264,8 @@ Menu.URL = (0, _react.observer)(function (props) {
263
264
  window.open(props.href, '_blank');
264
265
  }
265
266
  }), /*#__PURE__*/_react2.default.createElement(_.SortableItem, {
266
- className: designerCss
267
+ className: designerCss,
268
+ removeParentsIfNoChildren: false
267
269
  }, /*#__PURE__*/_react2.default.createElement(_2.Icon, {
268
270
  type: icon
269
271
  }), /*#__PURE__*/_react2.default.createElement("span", {
@@ -285,7 +287,8 @@ Menu.SubMenu = (0, _react.observer)(function (props) {
285
287
  key: schema.name,
286
288
  eventKey: schema.name,
287
289
  title: /*#__PURE__*/_react2.default.createElement(_.SortableItem, {
288
- className: subMenuDesignerCss
290
+ className: subMenuDesignerCss,
291
+ removeParentsIfNoChildren: false
289
292
  }, /*#__PURE__*/_react2.default.createElement(_2.Icon, {
290
293
  type: icon
291
294
  }), field.title, /*#__PURE__*/_react2.default.createElement(Designer, null))
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  export declare const RecordPickerContext: React.Context<any>;
3
3
  export declare const InputRecordPicker: React.FC<any>;
4
+ export declare const RecordPickerProvider: (props: any) => JSX.Element;
4
5
  export declare function isShowFilePicker(labelUiSchema: any): boolean;
@@ -4,7 +4,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.RecordPickerContext = exports.InputRecordPicker = void 0;
7
+ exports.RecordPickerProvider = exports.RecordPickerContext = exports.InputRecordPicker = void 0;
8
8
  exports.isShowFilePicker = isShowFilePicker;
9
9
  var _react = require("@formily/react");
10
10
  var _antd = require("antd");
@@ -19,7 +19,8 @@ var _preview = require("../preview");
19
19
  var _useFieldNames = require("./useFieldNames");
20
20
  var _util = require("./util");
21
21
  var _excluded = ["onRowSelectionChange", "rowKey"],
22
- _excluded2 = ["value", "multiple", "onChange", "quickUpload", "selectFile"];
22
+ _excluded2 = ["value", "multiple", "onChange", "quickUpload", "selectFile"],
23
+ _excluded3 = ["multiple", "onChange", "selectedRows", "setSelectedRows", "options", "collectionField"];
23
24
  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); }
24
25
  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; }
25
26
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -73,7 +74,7 @@ var useTableSelectorProps = function useTableSelectorProps() {
73
74
  rowKey: rowKey,
74
75
  rowSelection: {
75
76
  type: multiple ? 'checkbox' : 'radio',
76
- selectedRowKeys: rcSelectRows.filter(function (item) {
77
+ selectedRowKeys: rcSelectRows === null || rcSelectRows === void 0 ? void 0 : rcSelectRows.filter(function (item) {
77
78
  return options.every(function (row) {
78
79
  return row[rowKey] !== item[rowKey];
79
80
  });
@@ -221,6 +222,7 @@ var InputRecordPicker = function InputRecordPicker(props) {
221
222
  var _value = multiple ? [] : null;
222
223
  _onChange(_value);
223
224
  setSelectedRows(_value);
225
+ setOptions([]);
224
226
  } else if (Array.isArray(changed)) {
225
227
  if (!changed.length) {
226
228
  _onChange([]);
@@ -250,6 +252,26 @@ var InputRecordPicker = function InputRecordPicker(props) {
250
252
  }));
251
253
  };
252
254
  exports.InputRecordPicker = InputRecordPicker;
255
+ var RecordPickerProvider = function RecordPickerProvider(props) {
256
+ var multiple = props.multiple,
257
+ onChange = props.onChange,
258
+ selectedRows = props.selectedRows,
259
+ setSelectedRows = props.setSelectedRows,
260
+ options = props.options,
261
+ collectionField = props.collectionField,
262
+ other = _objectWithoutProperties(props, _excluded3);
263
+ return /*#__PURE__*/_react2.default.createElement(RecordPickerContext.Provider, {
264
+ value: _objectSpread({
265
+ multiple: multiple,
266
+ onChange: onChange,
267
+ selectedRows: selectedRows,
268
+ setSelectedRows: setSelectedRows,
269
+ options: options,
270
+ collectionField: collectionField
271
+ }, other)
272
+ }, props.children);
273
+ };
274
+ exports.RecordPickerProvider = RecordPickerProvider;
253
275
  var Drawer = function Drawer(_ref) {
254
276
  var multiple = _ref.multiple,
255
277
  onChange = _ref.onChange,
@@ -270,16 +292,15 @@ var Drawer = function Drawer(_ref) {
270
292
  } : {};
271
293
  return filter;
272
294
  };
273
- return /*#__PURE__*/_react2.default.createElement(RecordPickerContext.Provider, {
274
- value: {
275
- multiple: multiple,
276
- onChange: onChange,
277
- selectedRows: selectedRows,
278
- setSelectedRows: setSelectedRows,
279
- options: options,
280
- collectionField: collectionField
281
- }
282
- }, /*#__PURE__*/_react2.default.createElement(_collectionManager.CollectionProvider, {
295
+ var recordPickerProps = {
296
+ multiple: multiple,
297
+ onChange: onChange,
298
+ selectedRows: selectedRows,
299
+ setSelectedRows: setSelectedRows,
300
+ options: options,
301
+ collectionField: collectionField
302
+ };
303
+ return /*#__PURE__*/_react2.default.createElement(RecordPickerProvider, _objectSpread({}, recordPickerProps), /*#__PURE__*/_react2.default.createElement(_collectionManager.CollectionProvider, {
283
304
  allowNull: true,
284
305
  name: collectionField === null || collectionField === void 0 ? void 0 : collectionField.target
285
306
  }, /*#__PURE__*/_react2.default.createElement(_action.ActionContext.Provider, {
@@ -8,6 +8,7 @@ var _icons = require("@ant-design/icons");
8
8
  var _react = require("@formily/react");
9
9
  var _antd = require("antd");
10
10
  var _moment = _interopRequireDefault(require("moment"));
11
+ var _lodash = require("lodash");
11
12
  var _react2 = _interopRequireWildcard(require("react"));
12
13
  var _apiClient = require("../../../api-client");
13
14
  var _SharedFilterProvider = require("../../../block-provider/SharedFilterProvider");
@@ -31,7 +32,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
31
32
  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; }
32
33
  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; }
33
34
  var InternalRemoteSelect = (0, _react.connect)(function (props) {
34
- var _service$params;
35
+ var _field$componentProps, _field$componentProps2, _field$componentProps3, _service$params;
35
36
  var _props$fieldNames = props.fieldNames,
36
37
  fieldNames = _props$fieldNames === void 0 ? {} : _props$fieldNames,
37
38
  _props$service = props.service,
@@ -48,6 +49,7 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
48
49
  var compile = (0, _hooks.useCompile)();
49
50
  var firstRun = (0, _react2.useRef)(false);
50
51
  var fieldSchema = (0, _react.useFieldSchema)();
52
+ var field = (0, _react.useField)();
51
53
  var _useCollection = (0, _collectionManager.useCollection)(),
52
54
  getField = _useCollection.getField;
53
55
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
@@ -65,7 +67,7 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
65
67
  var mapOptionsToTags = (0, _react2.useCallback)(function (options) {
66
68
  try {
67
69
  return options.map(function (option) {
68
- var _targetField$uiSchema, _ref;
70
+ var _targetField$uiSchema, _objectSpread2;
69
71
  var label = option[fieldNames.label];
70
72
  if (targetField === null || targetField === void 0 ? void 0 : (_targetField$uiSchema = targetField.uiSchema) === null || _targetField$uiSchema === void 0 ? void 0 : _targetField$uiSchema.enum) {
71
73
  if (Array.isArray(label)) {
@@ -103,7 +105,7 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
103
105
  var _mapOptions;
104
106
  return mapOptions((_mapOptions = {}, _defineProperty(_mapOptions, fieldNames.label, label), _defineProperty(_mapOptions, fieldNames.value, option[fieldNames.value]), _mapOptions));
105
107
  }
106
- return _ref = {}, _defineProperty(_ref, fieldNames.label, label || option[fieldNames.value]), _defineProperty(_ref, fieldNames.value, option[fieldNames.value]), _ref;
108
+ return _objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, fieldNames.label, label || option[fieldNames.value]), _defineProperty(_objectSpread2, fieldNames.value, option[fieldNames.value]), _objectSpread2));
107
109
  });
108
110
  } catch (err) {
109
111
  console.error(err);
@@ -118,7 +120,7 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
118
120
  }, service === null || service === void 0 ? void 0 : service.params), {}, {
119
121
  // fields: [fieldNames.label, fieldNames.value, ...(service?.params?.fields || [])],
120
122
  // search needs
121
- filter: (0, _SharedFilterProvider.mergeFilter)([service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter])
123
+ filter: (0, _SharedFilterProvider.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)])
122
124
  })
123
125
  }), {
124
126
  manual: manual,
@@ -140,13 +142,13 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
140
142
  }
141
143
  }, [runDep]);
142
144
  var onSearch = /*#__PURE__*/function () {
143
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
144
- var _service$params2;
145
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
146
+ var _field$componentProps4, _field$componentProps5, _field$componentProps6, _service$params2;
145
147
  return _regeneratorRuntime().wrap(function _callee$(_context) {
146
148
  while (1) switch (_context.prev = _context.next) {
147
149
  case 0:
148
150
  run({
149
- filter: (0, _SharedFilterProvider.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])
151
+ filter: (0, _SharedFilterProvider.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)])
150
152
  });
151
153
  case 1:
152
154
  case "end":
@@ -155,32 +157,28 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
155
157
  }, _callee);
156
158
  }));
157
159
  return function onSearch(_x) {
158
- return _ref2.apply(this, arguments);
160
+ return _ref.apply(this, arguments);
159
161
  };
160
162
  }();
161
163
  var getOptionsByFieldNames = (0, _react2.useCallback)(function (item) {
162
164
  return Object.keys(fieldNames).reduce(function (obj, key) {
163
- var value = item[fieldNames[key]];
164
- if (value) {
165
- // support hidden, disabled, etc.
166
- obj[['label', 'value', 'options'].includes(key) ? fieldNames[key] : key] = key === 'label' ? compile(value) : value;
167
- }
168
165
  return obj;
169
166
  }, {});
170
167
  }, [fieldNames]);
171
168
  var normalizeOptions = (0, _react2.useCallback)(function (obj) {
172
- var _ref4;
169
+ var _ref3;
173
170
  if (objectValue || _typeof(obj) === 'object') {
174
171
  return getOptionsByFieldNames(obj);
175
172
  }
176
- return _ref4 = {}, _defineProperty(_ref4, fieldNames.value, obj), _defineProperty(_ref4, fieldNames.label, obj), _ref4;
173
+ return _ref3 = {}, _defineProperty(_ref3, fieldNames.value, obj), _defineProperty(_ref3, fieldNames.label, obj), _ref3;
177
174
  }, [objectValue, getOptionsByFieldNames]);
178
175
  var options = (0, _react2.useMemo)(function () {
179
176
  var _data$data, _data$data2;
180
177
  if (!(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.length)) {
181
- return value !== undefined && value !== null ? Array.isArray(value) ? value.map(normalizeOptions) : [normalizeOptions(value)] : [];
178
+ return value !== undefined && value !== null ? Array.isArray(value) ? value : [value] : [];
182
179
  }
183
- return (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.map(getOptionsByFieldNames)) || [];
180
+ var valueOptions = value !== undefined && value !== null && (Array.isArray(value) ? value : [value]) || [];
181
+ return (0, _lodash.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);
184
182
  }, [data === null || data === void 0 ? void 0 : data.data, getOptionsByFieldNames, normalizeOptions, value]);
185
183
  var onDropdownVisibleChange = function onDropdownVisibleChange() {
186
184
  if (firstRun.current) {
@@ -38,12 +38,13 @@ var useLabelFields = function useLabelFields(collectionName) {
38
38
  });
39
39
  };
40
40
  var TableColumnDesigner = function TableColumnDesigner(props) {
41
- var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$targ, _collectionField$uiSc, _columnSchema$xCompo, _fieldSchema$xCompon2, _fieldSchema$xCompon3;
41
+ var _fieldSchema$xCompon, _uiSchema$xComponent, _collectionField$targ, _collectionField$uiSc, _columnSchema$xCompo, _fieldSchema$xCompon2;
42
42
  var uiSchema = props.uiSchema,
43
43
  fieldSchema = props.fieldSchema,
44
44
  collectionField = props.collectionField;
45
45
  var _useCollectionManager2 = (0, _collectionManager.useCollectionManager)(),
46
- getInterface = _useCollectionManager2.getInterface;
46
+ getInterface = _useCollectionManager2.getInterface,
47
+ getCollection = _useCollectionManager2.getCollection;
47
48
  var field = (0, _react.useField)();
48
49
  var _useTranslation = (0, _reactI18next.useTranslation)(),
49
50
  t = _useTranslation.t;
@@ -53,6 +54,8 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
53
54
  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']);
54
55
  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);
55
56
  var intefaceCfg = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
57
+ var targetCollection = getCollection(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
58
+ var isFileField = isFileCollection(targetCollection);
56
59
  return /*#__PURE__*/_react2.default.createElement(_schemaSettings.GeneralSchemaDesigner, {
57
60
  disableInitializer: true
58
61
  }, /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
@@ -127,17 +130,20 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
127
130
  });
128
131
  dn.refresh();
129
132
  }
130
- }), ['linkTo', 'm2m', 'm2o', 'o2m', 'obo', 'oho', 'snapshot', 'createdBy', 'updatedBy'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
133
+ }), ['linkTo', 'm2m', 'm2o', 'o2m', 'obo', 'oho', 'snapshot', 'createdBy', 'updatedBy'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && !isFileField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
131
134
  title: t('Enable link'),
132
- 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',
135
+ checked: ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.enableLink) !== false,
133
136
  onChange: function onChange(flag) {
134
137
  fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
135
- mode: flag ? 'links' : 'tags'
138
+ enableLink: flag
139
+ });
140
+ field.componentProps = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
141
+ enableLink: flag
136
142
  });
137
143
  dn.emit('patch', {
138
144
  schema: {
139
145
  'x-uid': fieldSchema['x-uid'],
140
- 'x-component-props': _objectSpread({}, fieldSchema['x-component-props'])
146
+ 'x-component-props': _objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props'])
141
147
  }
142
148
  });
143
149
  dn.refresh();
@@ -147,8 +153,8 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
147
153
  options: options,
148
154
  value: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames['label'],
149
155
  onChange: function onChange(label) {
150
- var _collectionField$uiSc2, _fieldSchema$xCompon4;
151
- 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']), {}, {
156
+ var _collectionField$uiSc2, _fieldSchema$xCompon3;
157
+ 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']), {}, {
152
158
  label: label
153
159
  });
154
160
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
@@ -173,4 +179,7 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
173
179
  }
174
180
  }));
175
181
  };
176
- exports.TableColumnDesigner = TableColumnDesigner;
182
+ exports.TableColumnDesigner = TableColumnDesigner;
183
+ function isFileCollection(collection) {
184
+ return (collection === null || collection === void 0 ? void 0 : collection.template) === 'file';
185
+ }
@@ -0,0 +1 @@
1
+ export declare const TableIndex: (props: any) => JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TableIndex = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _recordProvider = require("../../../record-provider");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ var TableIndex = function TableIndex(props) {
11
+ var recordIndex = (0, _recordProvider.useRecordIndex)();
12
+ return /*#__PURE__*/_react.default.createElement("div", null, recordIndex + 1);
13
+ };
14
+ exports.TableIndex = TableIndex;