@nocobase/client 0.12.0-alpha.2 → 0.12.0-alpha.4

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 (161) hide show
  1. package/es/api-client/hooks/useRequest.js +16 -1
  2. package/es/block-provider/BlockProvider.js +2 -2
  3. package/es/block-provider/hooks/index.js +16 -18
  4. package/es/collection-manager/Configuration/AddCollectionAction.js +2 -2
  5. package/es/collection-manager/Configuration/AddFieldAction.js +2 -1
  6. package/es/collection-manager/Configuration/EditFieldAction.js +2 -1
  7. package/es/collection-manager/action-hooks.js +3 -1
  8. package/es/global-theme/AntdAppProvider.js +5 -1
  9. package/es/locale/en_US.d.ts +4 -0
  10. package/es/locale/en_US.js +4 -0
  11. package/es/locale/ja_JP.d.ts +1 -0
  12. package/es/locale/ja_JP.js +1 -0
  13. package/es/locale/zh_CN.d.ts +6 -0
  14. package/es/locale/zh_CN.js +7 -1
  15. package/es/pm/Card.js +6 -1
  16. package/es/schema-component/antd/action/Action.Designer.js +243 -54
  17. package/es/schema-component/antd/action/Action.Drawer.js +2 -2
  18. package/es/schema-component/antd/action/Action.Modal.js +1 -1
  19. package/es/schema-component/antd/action/Action.js +15 -19
  20. package/es/schema-component/antd/appends-tree-select/AppendsTreeSelect.d.ts +8 -2
  21. package/es/schema-component/antd/appends-tree-select/AppendsTreeSelect.js +67 -36
  22. package/es/schema-component/antd/association-field/AssociationFieldProvider.js +3 -15
  23. package/es/schema-component/antd/association-field/Editable.js +2 -1
  24. package/es/schema-component/antd/association-field/FileManager.js +4 -3
  25. package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -1
  26. package/es/schema-component/antd/association-field/InternalNester.js +6 -4
  27. package/es/schema-component/antd/association-field/InternalPicker.js +2 -1
  28. package/es/schema-component/antd/association-field/InternalPopoverNester.d.ts +2 -0
  29. package/es/schema-component/antd/association-field/InternalPopoverNester.js +95 -0
  30. package/es/schema-component/antd/association-field/InternalSubTable.js +2 -5
  31. package/es/schema-component/antd/association-field/InternalViewer.js +1 -1
  32. package/es/schema-component/antd/association-field/hooks.js +77 -5
  33. package/es/schema-component/antd/association-field/util.d.ts +4 -0
  34. package/es/schema-component/antd/association-field/util.js +32 -1
  35. package/es/schema-component/antd/color-picker/ReadPretty.js +1 -1
  36. package/es/schema-component/antd/form-item/FormItem.js +36 -112
  37. package/es/schema-component/antd/form-v2/Templates.js +12 -5
  38. package/es/schema-component/antd/grid-card/GridCard.Item.js +4 -4
  39. package/es/schema-component/antd/input/EllipsisWithTooltip.js +2 -1
  40. package/es/schema-component/antd/list/List.Item.js +3 -3
  41. package/es/schema-component/antd/markdown/Markdown.Void.js +6 -1
  42. package/es/schema-component/antd/markdown/Markdown.js +6 -1
  43. package/es/schema-component/antd/markdown/style.js +2 -4
  44. package/es/schema-component/antd/quick-edit/QuickEdit.js +5 -3
  45. package/es/schema-component/antd/remote-select/RemoteSelect.js +11 -79
  46. package/es/schema-component/antd/rich-text/RichText.js +7 -2
  47. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +45 -35
  48. package/es/schema-component/antd/table-v2/Table.js +12 -10
  49. package/es/schema-component/antd/table-v2/utils.d.ts +5 -0
  50. package/es/schema-component/antd/table-v2/utils.js +14 -1
  51. package/es/schema-component/antd/variable/Input.js +2 -1
  52. package/es/schema-component/antd/variable/TextArea.js +1 -1
  53. package/es/schema-component/common/utils/uitls.js +19 -2
  54. package/es/schema-component/hooks/useFieldModeOptions.d.ts +1 -1
  55. package/es/schema-component/hooks/useFieldModeOptions.js +23 -9
  56. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +75 -0
  57. package/es/schema-initializer/buttons/FormActionInitializers.js +39 -11
  58. package/es/schema-initializer/buttons/RecordBlockInitializers.js +12 -0
  59. package/es/schema-initializer/items/CreateActionInitializer.js +2 -1
  60. package/es/schema-initializer/items/CreateSubmitActionInitializer.js +3 -0
  61. package/es/schema-initializer/items/RecordAssociationGridCardBlockInitializer.d.ts +2 -0
  62. package/es/schema-initializer/items/RecordAssociationGridCardBlockInitializer.js +74 -0
  63. package/es/schema-initializer/items/RecordAssociationListBlockInitializer.d.ts +2 -0
  64. package/es/schema-initializer/items/RecordAssociationListBlockInitializer.js +74 -0
  65. package/es/schema-initializer/items/RecordFormBlockInitializer.js +3 -2
  66. package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +3 -2
  67. package/es/schema-initializer/items/UpdateSubmitActionInitializer.js +3 -0
  68. package/es/schema-initializer/items/index.d.ts +2 -0
  69. package/es/schema-initializer/items/index.js +2 -0
  70. package/es/schema-initializer/utils.js +6 -4
  71. package/es/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -2
  72. package/es/schema-settings/DataTemplates/utils.js +1 -1
  73. package/es/schema-settings/LinkageRules/components/LinkageHeader.js +2 -2
  74. package/es/schema-settings/SchemaSettings.js +132 -19
  75. package/es/schema-settings/VariableInput/VariableInput.js +6 -3
  76. package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.d.ts +4 -1
  77. package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.js +22 -5
  78. package/es/schema-templates/SchemaTemplateManagerProvider.js +6 -1
  79. package/lib/api-client/hooks/useRequest.js +16 -1
  80. package/lib/block-provider/BlockProvider.js +2 -2
  81. package/lib/block-provider/hooks/index.js +21 -23
  82. package/lib/collection-manager/Configuration/AddCollectionAction.js +2 -2
  83. package/lib/collection-manager/Configuration/AddFieldAction.js +2 -1
  84. package/lib/collection-manager/Configuration/EditFieldAction.js +2 -1
  85. package/lib/collection-manager/action-hooks.js +3 -1
  86. package/lib/global-theme/AntdAppProvider.js +5 -1
  87. package/lib/locale/en_US.d.ts +4 -0
  88. package/lib/locale/en_US.js +4 -0
  89. package/lib/locale/ja_JP.d.ts +1 -0
  90. package/lib/locale/ja_JP.js +1 -0
  91. package/lib/locale/zh_CN.d.ts +6 -0
  92. package/lib/locale/zh_CN.js +7 -1
  93. package/lib/pm/Card.js +6 -1
  94. package/lib/schema-component/antd/action/Action.Designer.js +242 -53
  95. package/lib/schema-component/antd/action/Action.Drawer.js +2 -2
  96. package/lib/schema-component/antd/action/Action.Modal.js +1 -1
  97. package/lib/schema-component/antd/action/Action.js +15 -19
  98. package/lib/schema-component/antd/appends-tree-select/AppendsTreeSelect.d.ts +8 -2
  99. package/lib/schema-component/antd/appends-tree-select/AppendsTreeSelect.js +66 -35
  100. package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +3 -15
  101. package/lib/schema-component/antd/association-field/Editable.js +2 -1
  102. package/lib/schema-component/antd/association-field/FileManager.js +4 -3
  103. package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -1
  104. package/lib/schema-component/antd/association-field/InternalNester.js +5 -3
  105. package/lib/schema-component/antd/association-field/InternalPicker.js +2 -1
  106. package/lib/schema-component/antd/association-field/InternalPopoverNester.d.ts +2 -0
  107. package/lib/schema-component/antd/association-field/InternalPopoverNester.js +104 -0
  108. package/lib/schema-component/antd/association-field/InternalSubTable.js +1 -4
  109. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
  110. package/lib/schema-component/antd/association-field/hooks.js +76 -4
  111. package/lib/schema-component/antd/association-field/util.d.ts +4 -0
  112. package/lib/schema-component/antd/association-field/util.js +37 -2
  113. package/lib/schema-component/antd/color-picker/ReadPretty.js +1 -1
  114. package/lib/schema-component/antd/form-item/FormItem.js +34 -110
  115. package/lib/schema-component/antd/form-v2/Templates.js +12 -5
  116. package/lib/schema-component/antd/grid-card/GridCard.Item.js +3 -3
  117. package/lib/schema-component/antd/input/EllipsisWithTooltip.js +2 -1
  118. package/lib/schema-component/antd/list/List.Item.js +2 -2
  119. package/lib/schema-component/antd/markdown/Markdown.Void.js +6 -1
  120. package/lib/schema-component/antd/markdown/Markdown.js +6 -1
  121. package/lib/schema-component/antd/markdown/style.js +2 -4
  122. package/lib/schema-component/antd/quick-edit/QuickEdit.js +5 -3
  123. package/lib/schema-component/antd/remote-select/RemoteSelect.js +11 -79
  124. package/lib/schema-component/antd/rich-text/RichText.js +6 -1
  125. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +44 -34
  126. package/lib/schema-component/antd/table-v2/Table.js +11 -9
  127. package/lib/schema-component/antd/table-v2/utils.d.ts +5 -0
  128. package/lib/schema-component/antd/table-v2/utils.js +16 -2
  129. package/lib/schema-component/antd/variable/Input.js +2 -1
  130. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  131. package/lib/schema-component/common/utils/uitls.js +19 -2
  132. package/lib/schema-component/hooks/useFieldModeOptions.d.ts +1 -1
  133. package/lib/schema-component/hooks/useFieldModeOptions.js +23 -9
  134. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +75 -0
  135. package/lib/schema-initializer/buttons/FormActionInitializers.js +39 -11
  136. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +12 -0
  137. package/lib/schema-initializer/items/CreateActionInitializer.js +2 -1
  138. package/lib/schema-initializer/items/CreateSubmitActionInitializer.js +3 -0
  139. package/lib/schema-initializer/items/RecordAssociationGridCardBlockInitializer.d.ts +2 -0
  140. package/lib/schema-initializer/items/RecordAssociationGridCardBlockInitializer.js +82 -0
  141. package/lib/schema-initializer/items/RecordAssociationListBlockInitializer.d.ts +2 -0
  142. package/lib/schema-initializer/items/RecordAssociationListBlockInitializer.js +82 -0
  143. package/lib/schema-initializer/items/RecordFormBlockInitializer.js +3 -2
  144. package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +3 -2
  145. package/lib/schema-initializer/items/UpdateSubmitActionInitializer.js +3 -0
  146. package/lib/schema-initializer/items/index.d.ts +2 -0
  147. package/lib/schema-initializer/items/index.js +22 -0
  148. package/lib/schema-initializer/utils.js +6 -4
  149. package/lib/schema-settings/DataTemplates/hooks/useCollectionState.js +2 -2
  150. package/lib/schema-settings/DataTemplates/utils.js +1 -1
  151. package/lib/schema-settings/LinkageRules/components/LinkageHeader.js +1 -1
  152. package/lib/schema-settings/SchemaSettings.js +131 -18
  153. package/lib/schema-settings/VariableInput/VariableInput.js +5 -2
  154. package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.d.ts +4 -1
  155. package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +24 -6
  156. package/lib/schema-templates/SchemaTemplateManagerProvider.js +6 -1
  157. package/package.json +5 -5
  158. package/es/schema-component/antd/remote-select/utils.d.ts +0 -4
  159. package/es/schema-component/antd/remote-select/utils.js +0 -31
  160. package/lib/schema-component/antd/remote-select/utils.d.ts +0 -4
  161. package/lib/schema-component/antd/remote-select/utils.js +0 -41
@@ -9,18 +9,14 @@ var _icons = require("@ant-design/icons");
9
9
  var _react = require("@formily/react");
10
10
  var _dayjs = _interopRequireDefault(require("dayjs"));
11
11
  var _antd = require("antd");
12
- var _flat = _interopRequireDefault(require("flat"));
13
- var _lodash = _interopRequireWildcard(require("lodash"));
12
+ var _lodash = require("lodash");
14
13
  var _react2 = _interopRequireWildcard(require("react"));
15
14
  var _apiClient = require("../../../api-client");
16
- var _BlockProvider = require("../../../block-provider/BlockProvider");
17
15
  var _SharedFilterProvider = require("../../../block-provider/SharedFilterProvider");
18
16
  var _collectionManager = require("../../../collection-manager");
19
- var _uitls = require("../../common/utils/uitls");
20
17
  var _hooks = require("../../hooks");
21
18
  var _select = require("../select");
22
19
  var _ReadPretty = require("./ReadPretty");
23
- var _utils = require("./utils");
24
20
  var _excluded = ["fieldNames", "service", "wait", "value", "defaultValue", "objectValue", "manual", "mapOptions", "targetField", "CustomDropdownRender"];
25
21
  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); }
26
22
  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; }
@@ -43,7 +39,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
43
39
  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; }
44
40
  var EMPTY = 'N/A';
45
41
  var InternalRemoteSelect = (0, _react.connect)(function (props) {
46
- var _fieldSchema$xCompon, _ctx$props, _field$componentProps4, _field$componentProps5, _field$componentProps6, _service$params2;
42
+ var _fieldSchema$xCompon, _service$params;
47
43
  var _props$fieldNames = props.fieldNames,
48
44
  fieldNames = _props$fieldNames === void 0 ? {} : _props$fieldNames,
49
45
  _props$service = props.service,
@@ -68,7 +64,6 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
68
64
  var fieldSchema = (0, _react.useFieldSchema)();
69
65
  var isQuickAdd = ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.addMode) === 'quickAdd';
70
66
  var field = (0, _react.useField)();
71
- var ctx = (0, _BlockProvider.useBlockRequestContext)();
72
67
  var _useCollection = (0, _collectionManager.useCollection)(),
73
68
  getField = _useCollection.getField;
74
69
  var searchData = (0, _react2.useRef)(null);
@@ -135,80 +130,16 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
135
130
  return options;
136
131
  }
137
132
  }, [targetField === null || targetField === void 0 ? void 0 : targetField.uiSchema, fieldNames]);
138
- var parseFilter = (0, _react2.useCallback)(function (rules) {
139
- if (!rules) {
140
- return undefined;
141
- }
142
- if (typeof rules === 'string') {
143
- return rules;
144
- }
145
- var type = Object.keys(rules)[0] || '$and';
146
- var conditions = rules[type];
147
- var results = [];
148
- conditions === null || conditions === void 0 ? void 0 : conditions.forEach(function (c) {
149
- var _jsonlogic$value, _jsonlogic$value$matc;
150
- var jsonlogic = (0, _uitls.getInnermostKeyAndValue)(c);
151
- var regex = /{{(.*?)}}/;
152
- var matches = (_jsonlogic$value = jsonlogic.value) === null || _jsonlogic$value === void 0 ? void 0 : (_jsonlogic$value$matc = _jsonlogic$value.match) === null || _jsonlogic$value$matc === void 0 ? void 0 : _jsonlogic$value$matc.call(_jsonlogic$value, regex);
153
- if (!matches || !matches[1].includes('$form') && !matches[1].includes('$iteration')) {
154
- results.push(c);
155
- return;
156
- }
157
- var associationfield = (0, _utils.extractFilterfield)(matches[1]);
158
- var filterCollectionField = getCollectionJoinField("".concat(ctx.props.collection, ".").concat(associationfield));
159
- if (['o2m', 'm2m'].includes(filterCollectionField === null || filterCollectionField === void 0 ? void 0 : filterCollectionField.interface)) {
160
- // 对多子表单
161
- var pattern = (0, _utils.generatePattern)(matches === null || matches === void 0 ? void 0 : matches[1], associationfield);
162
- var parseValue = (0, _utils.extractValuesByPattern)((0, _flat.default)(form.values), pattern);
163
- var filters = parseValue.map(function (v) {
164
- return JSON.parse(JSON.stringify(c).replace(jsonlogic.value, v));
165
- });
166
- results.push({
167
- $or: filters
168
- });
169
- } else {
170
- var variablesCtx = {
171
- $form: form.values,
172
- $iteration: form.values
173
- };
174
- var str = matches === null || matches === void 0 ? void 0 : matches[1];
175
- if (str.includes('$iteration')) {
176
- var path = field.path.segments.concat([]);
177
- path.pop();
178
- str = str.replace('$iteration.', "$iteration.".concat(path.join('.'), "."));
179
- }
180
- var _parseValue = (0, _utils.parseVariables)(str, variablesCtx);
181
- if (Array.isArray(_parseValue)) {
182
- var _filters = _parseValue.map(function (v) {
183
- return JSON.parse(JSON.stringify(c).replace(jsonlogic.value, v));
184
- });
185
- results.push({
186
- $or: _filters
187
- });
188
- } else {
189
- var filterObj = JSON.parse(JSON.stringify(c).replace(jsonlogic.value, str.endsWith('id') ? _parseValue !== null && _parseValue !== void 0 ? _parseValue : 0 : _parseValue));
190
- results.push(filterObj);
191
- }
192
- }
193
- });
194
- return _defineProperty({}, type, results);
195
- }, [(_ctx$props = ctx.props) === null || _ctx$props === void 0 ? void 0 : _ctx$props.collection, field.path.segments, form.values, getCollectionJoinField]);
196
- var filter = (0, _react2.useMemo)(function () {
197
- var _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps, _field$componentProps2, _field$componentProps3, _fieldSchema$xCompon5, _fieldSchema$xCompon6, _fieldSchema$xCompon7, _service$params;
198
- var filterFromSchema = _lodash.default.isString(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : (_fieldSchema$xCompon3 = _fieldSchema$xCompon2.service) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : (_fieldSchema$xCompon4 = _fieldSchema$xCompon3.params) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.filter) ? (_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 : fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : (_fieldSchema$xCompon6 = _fieldSchema$xCompon5.service) === null || _fieldSchema$xCompon6 === void 0 ? void 0 : (_fieldSchema$xCompon7 = _fieldSchema$xCompon6.params) === null || _fieldSchema$xCompon7 === void 0 ? void 0 : _fieldSchema$xCompon7.filter;
199
- return (0, _SharedFilterProvider.mergeFilter)([parseFilter(filterFromSchema) || (service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter)]);
200
- }, [(_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, fieldSchema, parseFilter, service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter]);
201
133
  var _useRequest = (0, _apiClient.useRequest)(_objectSpread(_objectSpread({
202
134
  action: 'list'
203
135
  }, service), {}, {
204
136
  params: _objectSpread(_objectSpread({
205
137
  pageSize: 200
206
138
  }, service === null || service === void 0 ? void 0 : service.params), {}, {
207
- // search needs
208
- filter: filter
139
+ filter: service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter
209
140
  })
210
141
  }), {
211
- manual: manual,
142
+ manual: manual && Object.prototype.toString.call(value) === '[object Object]',
212
143
  debounceWait: wait
213
144
  }),
214
145
  data = _useRequest.data,
@@ -239,12 +170,13 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
239
170
  }
240
171
  }, [runDep]);
241
172
  var onSearch = /*#__PURE__*/function () {
242
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
173
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(search) {
174
+ var _service$params2;
243
175
  return _regeneratorRuntime().wrap(function _callee$(_context) {
244
176
  while (1) switch (_context.prev = _context.next) {
245
177
  case 0:
246
178
  run({
247
- filter: (0, _SharedFilterProvider.mergeFilter)([search ? _defineProperty({}, fieldNames.label, _defineProperty({}, operator, search)) : {}, filter])
179
+ filter: (0, _SharedFilterProvider.mergeFilter)([search ? _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])
248
180
  });
249
181
  searchData.current = search;
250
182
  case 2:
@@ -254,7 +186,7 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
254
186
  }, _callee);
255
187
  }));
256
188
  return function onSearch(_x2) {
257
- return _ref2.apply(this, arguments);
189
+ return _ref.apply(this, arguments);
258
190
  };
259
191
  }();
260
192
  var options = (0, _react2.useMemo)(function () {
@@ -263,7 +195,7 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
263
195
  if (!(data !== null && data !== void 0 && (_data$data = data.data) !== null && _data$data !== void 0 && _data$data.length)) {
264
196
  return v != null ? Array.isArray(v) ? v : [v] : [];
265
197
  }
266
- var valueOptions = v != null && (Array.isArray(v) ? v : [v]) || [];
198
+ var valueOptions = v != null && (Array.isArray(v) ? v : [_objectSpread(_objectSpread({}, v), {}, _defineProperty({}, fieldNames.value, v[fieldNames.value] || v))]) || [];
267
199
  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);
268
200
  }, [value, defaultValue, data === null || data === void 0 ? void 0 : data.data, fieldNames.value]);
269
201
  var onDropdownVisibleChange = function onDropdownVisibleChange(visible) {
@@ -304,10 +236,10 @@ var InternalRemoteSelect = (0, _react.connect)(function (props) {
304
236
  }, (0, _react.mapProps)({
305
237
  dataSource: 'options'
306
238
  }, function (props, field) {
307
- var _fieldSchema$xCompon8;
239
+ var _fieldSchema$xCompon2;
308
240
  var fieldSchema = (0, _react.useFieldSchema)();
309
241
  return _objectSpread(_objectSpread({}, props), {}, {
310
- fieldNames: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _select.defaultFieldNames), props.fieldNames), field.componentProps.fieldNames), (_fieldSchema$xCompon8 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon8 === void 0 ? void 0 : _fieldSchema$xCompon8.fieldNames),
242
+ fieldNames: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _select.defaultFieldNames), props.fieldNames), field.componentProps.fieldNames), (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.fieldNames),
311
243
  suffixIcon: field !== null && field !== void 0 && field['loading'] || field !== null && field !== void 0 && field['validating'] ? /*#__PURE__*/_react2.default.createElement(_icons.LoadingOutlined, null) : props.suffixIcon
312
244
  });
313
245
  }), (0, _react.mapReadPretty)(_ReadPretty.ReadPretty));
@@ -40,7 +40,12 @@ var RichText = (0, _react.connect)(function (props) {
40
40
  onChange: onChange,
41
41
  readOnly: disabled
42
42
  }));
43
- }, (0, _react.mapReadPretty)(function (props) {
43
+ }, (0, _react.mapProps)(function (props) {
44
+ var value = props.value;
45
+ return _objectSpread(_objectSpread({}, props), {}, {
46
+ value: _typeof(value) === 'object' ? value === null || value === void 0 ? void 0 : value.default : value
47
+ });
48
+ }), (0, _react.mapReadPretty)(function (props) {
44
49
  return /*#__PURE__*/_react2.default.createElement(_input.ReadPretty.Html, _objectSpread({}, props));
45
50
  }));
46
51
  exports.RichText = RichText;
@@ -83,11 +83,14 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
83
83
  var isFileField = isFileCollection(targetCollection);
84
84
  var isSubTableColumn = ['QuickEdit', 'FormItem'].includes(fieldSchema['x-decorator']);
85
85
  var _useAssociationFieldC = (0, _hooks2.useAssociationFieldContext)(),
86
- currentMode = _useAssociationFieldC.currentMode,
87
- tableField = _useAssociationFieldC.field;
86
+ currentMode = _useAssociationFieldC.currentMode;
88
87
  var defaultFilter = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : (_fieldSchema$xCompon3 = _fieldSchema$xCompon2.service) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : (_fieldSchema$xCompon4 = _fieldSchema$xCompon3.params) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.filter) || {};
89
88
  var dataSource = (0, _collectionManager.useCollectionFilterOptions)(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
90
89
  var isDateField = ['datetime', 'createdAt', 'updatedAt'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
90
+ var isAssociationField = ['obo', 'oho', 'o2o', 'o2m', 'm2m', 'm2o', 'snapshot'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
91
+ var fieldModeOptions = (0, _hooks.useFieldModeOptions)({
92
+ fieldSchema: fieldSchema
93
+ });
91
94
  var fieldMode = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon5 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon5 === void 0 ? void 0 : _fieldSchema$xCompon5['mode']) || 'Select';
92
95
  var readOnlyMode = 'editable';
93
96
  if (fieldSchema['x-disabled'] === true) {
@@ -96,6 +99,7 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
96
99
  if (fieldSchema['x-read-pretty'] === true) {
97
100
  readOnlyMode = 'read-pretty';
98
101
  }
102
+ var isSelectFieldMode = isAssociationField && fieldMode === 'Select';
99
103
  return /*#__PURE__*/_react2.default.createElement(_schemaSettings.GeneralSchemaDesigner, {
100
104
  disableInitializer: true
101
105
  }, /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
@@ -128,7 +132,7 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
128
132
  }
129
133
  dn.refresh();
130
134
  }
131
- }), currentMode && !field.readPretty && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
135
+ }), isSelectFieldMode && !field.readPretty && !(uiSchema !== null && uiSchema !== void 0 && uiSchema['x-read-pretty']) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
132
136
  title: t('Set the data scope'),
133
137
  schema: {
134
138
  type: 'object',
@@ -153,10 +157,11 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
153
157
  (0, _lodash.set)(field.componentProps, 'service.params.filter', filter);
154
158
  fieldSchema['x-component-props'] = field.componentProps;
155
159
  var path = (_field$path = field.path) === null || _field$path === void 0 ? void 0 : _field$path.splice(((_field$path2 = field.path) === null || _field$path2 === void 0 ? void 0 : _field$path2.length) - 1, 1);
156
- tableField === null || tableField === void 0 ? void 0 : tableField.value.map(function (_, index) {
157
- field.form.query("".concat(path.concat("".concat(index, ".") + fieldSchema.name))).take(function (f) {
158
- (0, _lodash.set)(f.componentProps, 'service.params.filter', filter);
159
- });
160
+ field.form.query("".concat(path.concat("*." + fieldSchema.name))).forEach(function (f) {
161
+ f.componentProps.service = f.componentProps.service || {
162
+ params: {}
163
+ };
164
+ f.componentProps.service.params.filter = filter;
160
165
  });
161
166
  dn.emit('patch', {
162
167
  schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, 'x-component-props', field.componentProps), _schema)
@@ -227,12 +232,13 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
227
232
  options: options,
228
233
  value: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames['label'],
229
234
  onChange: function onChange(label) {
230
- var _collectionField$uiSc2, _fieldSchema$xCompon7;
235
+ var _collectionField$uiSc2, _fieldSchema$xCompon7, _field$path3, _field$path4;
231
236
  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$xCompon7 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon7 === void 0 ? void 0 : _fieldSchema$xCompon7['fieldNames']), {}, {
232
237
  label: label
233
238
  });
234
239
  fieldSchema['x-component-props']['fieldNames'] = fieldNames;
235
- field.query(".*.".concat(fieldSchema.name)).take(function (f) {
240
+ var path = (_field$path3 = field.path) === null || _field$path3 === void 0 ? void 0 : _field$path3.splice(((_field$path4 = field.path) === null || _field$path4 === void 0 ? void 0 : _field$path4.length) - 1, 1);
241
+ field.form.query("".concat(path.concat("*." + fieldSchema.name))).forEach(function (f) {
236
242
  f.componentProps.fieldNames = fieldNames;
237
243
  });
238
244
  dn.emit('patch', {
@@ -243,16 +249,16 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
243
249
  });
244
250
  dn.refresh();
245
251
  }
246
- }), readOnlyMode === 'read-pretty' && ['linkTo', 'm2m', 'm2o', 'o2m', 'obo', 'oho', 'snapshot'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
252
+ }), isAssociationField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
247
253
  key: "field-mode",
248
254
  title: t('Field component'),
249
- options: [{
255
+ options: readOnlyMode === 'read-pretty' ? [{
250
256
  label: t('Title'),
251
257
  value: 'Select'
252
258
  }, {
253
259
  label: t('Tag'),
254
260
  value: 'Tag'
255
- }],
261
+ }] : fieldModeOptions,
256
262
  value: fieldMode,
257
263
  onChange: function onChange(mode) {
258
264
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
@@ -287,15 +293,13 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
287
293
  title: t('Required'),
288
294
  checked: fieldSchema.required,
289
295
  onChange: function onChange(required) {
290
- var _field$path3, _field$path4;
296
+ var _field$path5, _field$path6;
291
297
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
292
298
  fieldSchema['required'] = required;
293
299
  schema['required'] = required;
294
- var path = (_field$path3 = field.path) === null || _field$path3 === void 0 ? void 0 : _field$path3.splice(((_field$path4 = field.path) === null || _field$path4 === void 0 ? void 0 : _field$path4.length) - 1, 1);
295
- tableField === null || tableField === void 0 ? void 0 : tableField.value.map(function (_, index) {
296
- field.form.query("".concat(path.concat("".concat(index, ".") + fieldSchema.name))).take(function (f) {
297
- f.required = required;
298
- });
300
+ var path = (_field$path5 = field.path) === null || _field$path5 === void 0 ? void 0 : _field$path5.splice(((_field$path6 = field.path) === null || _field$path6 === void 0 ? void 0 : _field$path6.length) - 1, 1);
301
+ field.form.query("".concat(path.concat("*." + fieldSchema.name))).forEach(function (f) {
302
+ f.required = required;
299
303
  });
300
304
  dn.emit('patch', {
301
305
  schema: schema
@@ -317,9 +321,9 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
317
321
  }],
318
322
  value: readOnlyMode,
319
323
  onChange: function onChange(v) {
320
- var _field$path5, _field$path6;
324
+ var _field$path7, _field$path8;
321
325
  var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
322
- var path = (_field$path5 = field.path) === null || _field$path5 === void 0 ? void 0 : _field$path5.splice(((_field$path6 = field.path) === null || _field$path6 === void 0 ? void 0 : _field$path6.length) - 1, 1);
326
+ var path = (_field$path7 = field.path) === null || _field$path7 === void 0 ? void 0 : _field$path7.splice(((_field$path8 = field.path) === null || _field$path8 === void 0 ? void 0 : _field$path8.length) - 1, 1);
323
327
  switch (v) {
324
328
  case 'readonly':
325
329
  {
@@ -327,11 +331,9 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
327
331
  fieldSchema['x-disabled'] = true;
328
332
  schema['x-read-pretty'] = false;
329
333
  schema['x-disabled'] = true;
330
- tableField === null || tableField === void 0 ? void 0 : tableField.value.map(function (_, index) {
331
- field.form.query("".concat(path.concat("".concat(index, ".") + fieldSchema.name))).take(function (f) {
332
- f.readonly = true;
333
- f.disabled = true;
334
- });
334
+ field.form.query("".concat(path.concat("*." + fieldSchema.name))).forEach(function (f) {
335
+ f.readonly = true;
336
+ f.disabled = true;
335
337
  });
336
338
  break;
337
339
  }
@@ -341,10 +343,8 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
341
343
  fieldSchema['x-disabled'] = false;
342
344
  schema['x-read-pretty'] = true;
343
345
  schema['x-disabled'] = false;
344
- tableField === null || tableField === void 0 ? void 0 : tableField.value.map(function (_, index) {
345
- field.form.query("".concat(path.concat("".concat(index, ".") + fieldSchema.name))).take(function (f) {
346
- f.readPretty = true;
347
- });
346
+ field.form.query("".concat(path.concat("*." + fieldSchema.name))).forEach(function (f) {
347
+ f.readPretty = true;
348
348
  });
349
349
  break;
350
350
  }
@@ -354,11 +354,9 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
354
354
  fieldSchema['x-disabled'] = false;
355
355
  schema['x-read-pretty'] = false;
356
356
  schema['x-disabled'] = false;
357
- tableField === null || tableField === void 0 ? void 0 : tableField.value.map(function (_, index) {
358
- field.form.query("".concat(path.concat("".concat(index, ".") + fieldSchema.name))).take(function (f) {
359
- f.readPretty = false;
360
- f.disabled + false;
361
- });
357
+ field.form.query("".concat(path.concat("*." + fieldSchema.name))).forEach(function (f) {
358
+ f.readPretty = false;
359
+ f.disabled + false;
362
360
  });
363
361
  break;
364
362
  }
@@ -370,6 +368,18 @@ var TableColumnDesigner = function TableColumnDesigner(props) {
370
368
  }
371
369
  }), isDateField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.DataFormat, {
372
370
  fieldSchema: fieldSchema
371
+ }), isSubTableColumn && !(field !== null && field !== void 0 && field.readPretty) && ['obo', 'oho', 'o2o', 'o2m', 'm2m', 'm2o'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SortingRule, {
372
+ fieldSchema: fieldSchema,
373
+ onSubmitCallBack: function onSubmitCallBack(sortArr) {
374
+ var _field$path9, _field$path10;
375
+ var path = (_field$path9 = field.path) === null || _field$path9 === void 0 ? void 0 : _field$path9.splice(((_field$path10 = field.path) === null || _field$path10 === void 0 ? void 0 : _field$path10.length) - 1, 1);
376
+ field.form.query("".concat(path.concat("*." + fieldSchema.name))).forEach(function (f) {
377
+ f.componentProps.service = f.componentProps.service || {
378
+ params: {}
379
+ };
380
+ f.componentProps.service.params.sort = sortArr;
381
+ });
382
+ }
373
383
  }), isSubTableColumn && !(field !== null && field !== void 0 && field.readPretty) && (0, _schemaSettings.isShowDefaultValue)(collectionField, getInterface) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.DefaultValue, {
374
384
  fieldSchema: fieldSchema
375
385
  }), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Divider, null), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Remove, {
@@ -283,8 +283,11 @@ var Table = (0, _react.observer)(function (props) {
283
283
  if (onClickRow) {
284
284
  onRow = function onRow(record) {
285
285
  return {
286
- onClick: function onClick() {
287
- return onClickRow(record, setSelectedRow, selectedRow);
286
+ onClick: function onClick(e) {
287
+ if ((0, _utils.isPortalInBody)(e.target)) {
288
+ return;
289
+ }
290
+ onClickRow(record, setSelectedRow, selectedRow);
288
291
  }
289
292
  };
290
293
  };
@@ -337,7 +340,7 @@ var Table = (0, _react.observer)(function (props) {
337
340
  },
338
341
  cell: function cell(props) {
339
342
  return /*#__PURE__*/_react2.default.createElement("td", _objectSpread(_objectSpread({}, props), {}, {
340
- className: (0, _classnames.default)(props.className, (0, _css.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-width: 300px;\n white-space: nowrap;\n .nb-read-pretty-input-number {\n text-align: right;\n }\n .ant-color-picker-trigger{\n position:absolute;\n top:50%;\n transform: translateY(-50%);\n }\n "]))))
343
+ className: (0, _classnames.default)(props.className, (0, _css.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n max-width: 300px;\n white-space: nowrap;\n .nb-read-pretty-input-number {\n text-align: right;\n }\n .ant-color-picker-trigger {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n }\n "]))))
341
344
  }));
342
345
  }
343
346
  }
@@ -399,11 +402,8 @@ var Table = (0, _react.observer)(function (props) {
399
402
  var _field$value4, _field$value4$map;
400
403
  var children = _ref3.children;
401
404
  return dragSort ? /*#__PURE__*/_react2.default.createElement(_sortable.SortableContext, {
402
- items: ((_field$value4 = field.value) === null || _field$value4 === void 0 ? void 0 : (_field$value4$map = _field$value4.map) === null || _field$value4$map === void 0 ? void 0 : _field$value4$map.call(_field$value4, getRowKey)) || [],
403
- children: children
404
- }) : /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, {
405
- children: children
406
- });
405
+ items: ((_field$value4 = field.value) === null || _field$value4 === void 0 ? void 0 : (_field$value4$map = _field$value4.map) === null || _field$value4$map === void 0 ? void 0 : _field$value4$map.call(_field$value4, getRowKey)) || []
406
+ }, children) : /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, {}, children);
407
407
  }, [field, dragSort]);
408
408
  var fieldSchema = (0, _react.useFieldSchema)();
409
409
  var fixedBlock = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$parent = fieldSchema.parent) === null || _fieldSchema$parent === void 0 ? void 0 : (_fieldSchema$parent$x = _fieldSchema$parent['x-decorator-props']) === null || _fieldSchema$parent$x === void 0 ? void 0 : _fieldSchema$parent$x.fixedBlock;
@@ -451,7 +451,9 @@ var Table = (0, _react.observer)(function (props) {
451
451
  className: "ant-formily-item-error-help ant-formily-item-help ant-formily-item-help-enter ant-formily-item-help-enter-active"
452
452
  }, field.errors.map(function (error) {
453
453
  return error.messages.map(function (message) {
454
- return /*#__PURE__*/_react2.default.createElement("div", null, message);
454
+ return /*#__PURE__*/_react2.default.createElement("div", {
455
+ key: message
456
+ }, message);
455
457
  });
456
458
  })));
457
459
  }, {
@@ -2,3 +2,8 @@ import { ISchema, Schema } from '@formily/react';
2
2
  export declare const isCollectionFieldComponent: (schema: ISchema) => boolean;
3
3
  export declare const isColumnComponent: (schema: Schema) => boolean;
4
4
  export declare function extractIndex(str: any): string;
5
+ /**
6
+ * 判断一个 DOM 对象是否是由 createPortal 挂在到了 body 上
7
+ * @param domNode DOM 对象
8
+ */
9
+ export declare const isPortalInBody: (dom: HTMLElement) => boolean;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.extractIndex = extractIndex;
7
- exports.isColumnComponent = exports.isCollectionFieldComponent = void 0;
7
+ exports.isPortalInBody = exports.isColumnComponent = exports.isCollectionFieldComponent = void 0;
8
8
  var isCollectionFieldComponent = function isCollectionFieldComponent(schema) {
9
9
  return schema['x-component'] === 'CollectionField';
10
10
  };
@@ -22,4 +22,18 @@ function extractIndex(str) {
22
22
  }
23
23
  });
24
24
  return numbers.join('.');
25
- }
25
+ }
26
+ /**
27
+ * 判断一个 DOM 对象是否是由 createPortal 挂在到了 body 上
28
+ * @param domNode DOM 对象
29
+ */
30
+ var isPortalInBody = function isPortalInBody(dom) {
31
+ while (dom) {
32
+ if (dom.id === 'root') {
33
+ return false;
34
+ }
35
+ dom = dom.parentNode;
36
+ }
37
+ return true;
38
+ };
39
+ exports.isPortalInBody = isPortalInBody;
@@ -235,12 +235,13 @@ function Input(props) {
235
235
  }, [scope]);
236
236
  var loadData = /*#__PURE__*/function () {
237
237
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(selectedOptions) {
238
+ var _option$children;
238
239
  var option;
239
240
  return _regeneratorRuntime().wrap(function _callee$(_context) {
240
241
  while (1) switch (_context.prev = _context.next) {
241
242
  case 0:
242
243
  option = selectedOptions[selectedOptions.length - 1];
243
- if (!(!option.children && !option.isLeaf && option.loadChildren)) {
244
+ if (!(!((_option$children = option.children) !== null && _option$children !== void 0 && _option$children.length) && !option.isLeaf && option.loadChildren)) {
244
245
  _context.next = 5;
245
246
  break;
246
247
  }
@@ -391,7 +391,7 @@ function TextArea(props) {
391
391
  var disabled = props.disabled || form.disabled;
392
392
  return wrapSSR( /*#__PURE__*/_react2.default.createElement(_antd.Input.Group, {
393
393
  compact: true,
394
- className: (0, _css.cx)(componentCls, hashId, (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.ant-input-group.ant-input-group-compact {\n display: flex;\n .ant-input {\n flex-grow: 1;\n min-width: 200px;\n }\n .ant-input-disabled {\n .ant-tag {\n color: #bfbfbf;\n border-color: #d9d9d9;\n }\n }\n }\n "]))))
394
+ className: (0, _css.cx)(componentCls, hashId, (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.ant-input-group.ant-input-group-compact {\n display: flex;\n .ant-input {\n flex-grow: 1;\n min-width: 200px;\n }\n .ant-input-disabled {\n .ant-tag {\n color: #bfbfbf;\n border-color: #d9d9d9;\n }\n }\n }\n\n > .x-button {\n height: min-content;\n }\n "]))))
395
395
  }, /*#__PURE__*/_react2.default.createElement("div", {
396
396
  onInput: onInput,
397
397
  onBlur: onBlur,
@@ -13,6 +13,7 @@ var _react = require("react");
13
13
  var _blockProvider = require("../../../block-provider");
14
14
  var _user = require("../../../user");
15
15
  var _logic = _interopRequireDefault(require("../../common/utils/logic"));
16
+ var _excluded = ["children"];
16
17
  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); }
17
18
  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; }
18
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -22,14 +23,30 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
22
23
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
23
24
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
24
25
  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); }
26
+ 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; }
27
+ 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; }
28
+ function flattenDeep(data) {
29
+ var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
30
+ for (var i = 0; i < (data === null || data === void 0 ? void 0 : data.length); i++) {
31
+ var _data$i = data[i],
32
+ children = _data$i.children,
33
+ rest = _objectWithoutProperties(_data$i, _excluded);
34
+ result.push(rest);
35
+ if (children) {
36
+ flattenDeep(children, result);
37
+ }
38
+ }
39
+ return result;
40
+ }
25
41
  var useVariablesCtx = function useVariablesCtx() {
26
- var _service$data, _service$data$data, _currentUser$data2;
42
+ var _service$data, _currentUser$data2;
27
43
  var currentUser = (0, _user.useCurrentUserContext)();
28
44
  var _useTableBlockContext = (0, _blockProvider.useTableBlockContext)(),
29
45
  field = _useTableBlockContext.field,
30
46
  service = _useTableBlockContext.service,
31
47
  rowKey = _useTableBlockContext.rowKey;
32
- var contextData = service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : (_service$data$data = _service$data.data) === null || _service$data$data === void 0 ? void 0 : _service$data$data.filter(function (v) {
48
+ var tableData = flattenDeep(service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.data);
49
+ var contextData = tableData === null || tableData === void 0 ? void 0 : tableData.filter(function (v) {
33
50
  var _ref, _field$data;
34
51
  return (_ref = (field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.selectedRowKeys) || []) === null || _ref === void 0 ? void 0 : _ref.includes(v[rowKey]);
35
52
  });
@@ -1,4 +1,4 @@
1
- export declare const useFieldModeOptions: () => {
1
+ export declare const useFieldModeOptions: (props?: any) => {
2
2
  label: string;
3
3
  value: string;
4
4
  }[];
@@ -8,14 +8,16 @@ var _react = require("@formily/react");
8
8
  var _react2 = require("react");
9
9
  var _reactI18next = require("react-i18next");
10
10
  var _collectionManager = require("../../collection-manager");
11
- var useFieldModeOptions = function useFieldModeOptions() {
11
+ var useFieldModeOptions = function useFieldModeOptions(props) {
12
12
  var _fieldSchema$xCompon;
13
13
  var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
14
14
  getCollectionJoinField = _useCollectionManager.getCollectionJoinField,
15
15
  getCollection = _useCollectionManager.getCollection;
16
- var fieldSchema = (0, _react.useFieldSchema)();
16
+ var currentFieldSchema = (0, _react.useFieldSchema)();
17
+ var fieldSchema = (props === null || props === void 0 ? void 0 : props.fieldSchema) || currentFieldSchema;
17
18
  var field = (0, _react.useField)();
18
19
  var isReadPretty = field.readPretty;
20
+ var isSubTableField = props === null || props === void 0 ? void 0 : props.fieldSchema;
19
21
  var _useCollection = (0, _collectionManager.useCollection)(),
20
22
  getField = _useCollection.getField;
21
23
  var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
@@ -45,7 +47,7 @@ var useFieldModeOptions = function useFieldModeOptions() {
45
47
  }, {
46
48
  label: t('Record picker'),
47
49
  value: 'Picker'
48
- }, {
50
+ }, !isSubTableField && {
49
51
  label: t('File manager'),
50
52
  value: 'FileManager'
51
53
  }];
@@ -70,10 +72,13 @@ var useFieldModeOptions = function useFieldModeOptions() {
70
72
  }, {
71
73
  label: t('Record picker'),
72
74
  value: 'Picker'
73
- }, {
75
+ }, !isSubTableField && {
74
76
  label: t('Sub-form'),
75
77
  value: 'Nester'
76
78
  }, {
79
+ label: t('Sub-form(Popover)'),
80
+ value: 'PopoverNester'
81
+ }, !isSubTableField && {
77
82
  label: t('Sub-table'),
78
83
  value: 'SubTable'
79
84
  }];
@@ -96,12 +101,15 @@ var useFieldModeOptions = function useFieldModeOptions() {
96
101
  }, {
97
102
  label: t('Record picker'),
98
103
  value: 'Picker'
99
- }, {
104
+ }, !isSubTableField && {
100
105
  label: t('Sub-table'),
101
106
  value: 'SubTable'
102
- }, {
107
+ }, !isSubTableField && {
103
108
  label: t('Sub-form'),
104
109
  value: 'Nester'
110
+ }, {
111
+ label: t('Sub-form(Popover)'),
112
+ value: 'PopoverNester'
105
113
  }];
106
114
  case 'm2o':
107
115
  case 'linkTo':
@@ -120,9 +128,12 @@ var useFieldModeOptions = function useFieldModeOptions() {
120
128
  }, {
121
129
  label: t('Record picker'),
122
130
  value: 'Picker'
123
- }, {
131
+ }, !isSubTableField && {
124
132
  label: t('Sub-form'),
125
133
  value: 'Nester'
134
+ }, {
135
+ label: t('Sub-form(Popover)'),
136
+ value: 'PopoverNester'
126
137
  }];
127
138
  default:
128
139
  return isReadPretty ? [{
@@ -140,12 +151,15 @@ var useFieldModeOptions = function useFieldModeOptions() {
140
151
  }, {
141
152
  label: t('Record picker'),
142
153
  value: 'Picker'
143
- }, {
154
+ }, !isSubTableField && {
144
155
  label: t('Sub-form'),
145
156
  value: 'Nester'
157
+ }, {
158
+ label: t('Sub-form(Popover)'),
159
+ value: 'PopoverNester'
146
160
  }];
147
161
  }
148
162
  }, [t, collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface, label]);
149
- return fieldModeOptions;
163
+ return (fieldModeOptions || []).filter(Boolean);
150
164
  };
151
165
  exports.useFieldModeOptions = useFieldModeOptions;