@nocobase/client 0.7.2-alpha.7 → 0.7.4-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.
- package/es/application/Application.d.ts +1 -0
- package/es/application/Application.js +7 -1
- package/es/block-provider/FormBlockProvider.js +15 -3
- package/es/block-provider/TableFieldProvider.d.ts +1 -0
- package/es/block-provider/TableFieldProvider.js +5 -2
- package/es/block-provider/TableSelectorProvider.js +42 -14
- package/es/block-provider/hooks/index.d.ts +6 -0
- package/es/block-provider/hooks/index.js +159 -65
- package/es/collection-manager/CollectionField.js +11 -4
- package/es/collection-manager/Configuration/AddFieldAction.js +6 -0
- package/es/collection-manager/Configuration/EditFieldAction.js +7 -0
- package/es/collection-manager/Configuration/index.js +5 -1
- package/es/collection-manager/Configuration/schemas/collections.js +2 -1
- package/es/collection-manager/interfaces/checkbox.js +1 -0
- package/es/collection-manager/interfaces/checkboxGroup.js +1 -0
- package/es/collection-manager/interfaces/datetime.js +1 -0
- package/es/collection-manager/interfaces/email.js +1 -0
- package/es/collection-manager/interfaces/icon.js +1 -0
- package/es/collection-manager/interfaces/input.js +104 -0
- package/es/collection-manager/interfaces/integer.js +64 -0
- package/es/collection-manager/interfaces/m2m.js +2 -0
- package/es/collection-manager/interfaces/m2o.js +1 -0
- package/es/collection-manager/interfaces/markdown.js +35 -0
- package/es/collection-manager/interfaces/multipleSelect.js +1 -0
- package/es/collection-manager/interfaces/number.js +56 -0
- package/es/collection-manager/interfaces/o2m.js +1 -0
- package/es/collection-manager/interfaces/o2o.js +3 -0
- package/es/collection-manager/interfaces/password.js +37 -1
- package/es/collection-manager/interfaces/percent.js +98 -0
- package/es/collection-manager/interfaces/phone.js +1 -0
- package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/es/collection-manager/interfaces/properties/index.js +1 -0
- package/es/collection-manager/interfaces/properties/operators.js +4 -4
- package/es/collection-manager/interfaces/radioGroup.js +1 -0
- package/es/collection-manager/interfaces/richText.js +35 -0
- package/es/collection-manager/interfaces/select.js +1 -0
- package/es/collection-manager/interfaces/textarea.js +35 -0
- package/es/collection-manager/interfaces/time.js +1 -0
- package/es/file-manager/FileStorageShortcut.js +2 -2
- package/es/locale/en_US.d.ts +8 -2
- package/es/locale/en_US.js +9 -3
- package/es/locale/zh_CN.d.ts +28 -2
- package/es/locale/zh_CN.js +29 -3
- package/es/plugin-manager/PluginManager.d.ts +1 -0
- package/es/plugin-manager/PluginManager.js +20 -6
- package/es/schema-component/antd/action/Action.Modal.js +1 -1
- package/es/schema-component/antd/calendar/Calendar.Designer.js +16 -10
- package/es/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
- package/es/schema-component/antd/date-picker/DatePicker.js +1 -1
- package/es/schema-component/antd/date-picker/ReadPretty.js +1 -1
- package/es/schema-component/antd/date-picker/util.d.ts +0 -10
- package/es/schema-component/antd/date-picker/util.js +1 -79
- package/es/schema-component/antd/form-item/FormItem.js +193 -10
- package/es/schema-component/antd/grid/Grid.js +72 -6
- package/es/schema-component/antd/input-number/InputNumber.d.ts +1 -5
- package/es/schema-component/antd/input-number/InputNumber.js +25 -1
- package/es/schema-component/antd/input-number/ReadPretty.js +2 -4
- package/es/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
- package/es/schema-component/antd/menu/Menu.js +6 -3
- package/es/schema-component/antd/percent/Percent.js +2 -2
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +27 -13
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -3
- package/es/schema-component/antd/table/Table.Array.js +2 -2
- package/es/schema-component/antd/table/Table.Void.js +11 -1
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
- package/es/schema-component/antd/table-v2/Table.d.ts +0 -11
- package/es/schema-component/antd/table-v2/Table.js +163 -92
- package/es/schema-component/antd/table-v2/TableField.js +3 -0
- package/es/schema-component/antd/tabs/Tabs.Designer.js +23 -12
- package/es/schema-component/antd/tabs/Tabs.js +7 -1
- package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
- package/es/schema-component/core/DesignableSwitch.js +7 -1
- package/es/schema-component/hooks/useDesignable.js +21 -21
- package/es/schema-component/hooks/useProps.js +1 -1
- package/es/schema-initializer/buttons/FormItemInitializers.js +14 -3
- package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
- package/es/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -3
- package/es/schema-initializer/buttons/RecordBlockInitializers.js +32 -3
- package/es/schema-initializer/buttons/TabPaneInitializers.js +11 -3
- package/es/schema-initializer/buttons/TableActionInitializers.js +11 -0
- package/es/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
- package/es/schema-initializer/components/assigned-field/AssignedField.js +255 -69
- package/es/schema-initializer/items/index.d.ts +2 -0
- package/es/schema-initializer/items/index.js +48 -2
- package/es/schema-initializer/utils.js +22 -2
- package/es/schema-settings/SchemaSettings.js +7 -0
- package/es/system-settings/SystemSettingsShortcut.js +35 -12
- package/lib/application/Application.d.ts +1 -0
- package/lib/application/Application.js +11 -2
- package/lib/block-provider/FormBlockProvider.js +15 -2
- package/lib/block-provider/TableFieldProvider.d.ts +1 -0
- package/lib/block-provider/TableFieldProvider.js +4 -1
- package/lib/block-provider/TableSelectorProvider.js +42 -14
- package/lib/block-provider/hooks/index.d.ts +6 -0
- package/lib/block-provider/hooks/index.js +168 -67
- package/lib/collection-manager/CollectionField.js +12 -4
- package/lib/collection-manager/Configuration/AddFieldAction.js +6 -0
- package/lib/collection-manager/Configuration/EditFieldAction.js +7 -0
- package/lib/collection-manager/Configuration/index.js +5 -0
- package/lib/collection-manager/Configuration/schemas/collections.js +2 -1
- package/lib/collection-manager/interfaces/checkbox.js +1 -0
- package/lib/collection-manager/interfaces/checkboxGroup.js +1 -0
- package/lib/collection-manager/interfaces/datetime.js +1 -0
- package/lib/collection-manager/interfaces/email.js +1 -0
- package/lib/collection-manager/interfaces/icon.js +1 -0
- package/lib/collection-manager/interfaces/input.js +105 -0
- package/lib/collection-manager/interfaces/integer.js +66 -0
- package/lib/collection-manager/interfaces/m2m.js +2 -0
- package/lib/collection-manager/interfaces/m2o.js +1 -0
- package/lib/collection-manager/interfaces/markdown.js +36 -0
- package/lib/collection-manager/interfaces/multipleSelect.js +1 -0
- package/lib/collection-manager/interfaces/number.js +57 -0
- package/lib/collection-manager/interfaces/o2m.js +1 -0
- package/lib/collection-manager/interfaces/o2o.js +3 -0
- package/lib/collection-manager/interfaces/password.js +38 -1
- package/lib/collection-manager/interfaces/percent.js +100 -0
- package/lib/collection-manager/interfaces/phone.js +1 -0
- package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/lib/collection-manager/interfaces/properties/index.js +1 -0
- package/lib/collection-manager/interfaces/properties/operators.js +4 -4
- package/lib/collection-manager/interfaces/radioGroup.js +1 -0
- package/lib/collection-manager/interfaces/richText.js +36 -0
- package/lib/collection-manager/interfaces/select.js +1 -0
- package/lib/collection-manager/interfaces/textarea.js +36 -0
- package/lib/collection-manager/interfaces/time.js +1 -0
- package/lib/file-manager/FileStorageShortcut.js +1 -1
- package/lib/locale/en_US.d.ts +8 -2
- package/lib/locale/en_US.js +9 -3
- package/lib/locale/zh_CN.d.ts +28 -2
- package/lib/locale/zh_CN.js +29 -3
- package/lib/plugin-manager/PluginManager.d.ts +1 -0
- package/lib/plugin-manager/PluginManager.js +23 -5
- package/lib/schema-component/antd/action/Action.Modal.js +1 -1
- package/lib/schema-component/antd/calendar/Calendar.Designer.js +16 -10
- package/lib/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
- package/lib/schema-component/antd/date-picker/DatePicker.js +2 -2
- package/lib/schema-component/antd/date-picker/ReadPretty.js +6 -6
- package/lib/schema-component/antd/date-picker/util.d.ts +0 -10
- package/lib/schema-component/antd/date-picker/util.js +6 -89
- package/lib/schema-component/antd/form-item/FormItem.js +196 -12
- package/lib/schema-component/antd/grid/Grid.js +69 -3
- package/lib/schema-component/antd/input-number/InputNumber.d.ts +1 -5
- package/lib/schema-component/antd/input-number/InputNumber.js +28 -1
- package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
- package/lib/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
- package/lib/schema-component/antd/menu/Menu.js +6 -3
- package/lib/schema-component/antd/percent/Percent.js +2 -2
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +27 -12
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +4 -2
- package/lib/schema-component/antd/table/Table.Array.js +2 -2
- package/lib/schema-component/antd/table/Table.Void.js +11 -1
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
- package/lib/schema-component/antd/table-v2/Table.d.ts +0 -11
- package/lib/schema-component/antd/table-v2/Table.js +172 -94
- package/lib/schema-component/antd/table-v2/TableField.js +3 -0
- package/lib/schema-component/antd/tabs/Tabs.Designer.js +23 -12
- package/lib/schema-component/antd/tabs/Tabs.js +8 -1
- package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
- package/lib/schema-component/core/DesignableSwitch.js +8 -1
- package/lib/schema-component/hooks/useDesignable.js +21 -21
- package/lib/schema-component/hooks/useProps.js +1 -1
- package/lib/schema-initializer/buttons/FormItemInitializers.js +14 -2
- package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
- package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -2
- package/lib/schema-initializer/buttons/RecordBlockInitializers.js +34 -4
- package/lib/schema-initializer/buttons/TabPaneInitializers.js +11 -3
- package/lib/schema-initializer/buttons/TableActionInitializers.js +11 -0
- package/lib/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +257 -66
- package/lib/schema-initializer/items/index.d.ts +2 -0
- package/lib/schema-initializer/items/index.js +54 -2
- package/lib/schema-initializer/utils.js +22 -2
- package/lib/schema-settings/SchemaSettings.js +7 -0
- package/lib/system-settings/SystemSettingsShortcut.js +37 -13
- package/package.json +7 -4
|
@@ -3,20 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useUpdateActionProps = exports.usePickActionProps = exports.useDetailsPaginationProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = void 0;
|
|
7
|
-
|
|
8
|
-
var _jsonSchema = require("@formily/json-schema");
|
|
6
|
+
exports.useUpdateActionProps = exports.useRefreshActionProps = exports.usePickActionProps = exports.useDetailsPaginationProps = exports.useDetailPrintActionProps = exports.useDestroyActionProps = exports.useCustomizeUpdateActionProps = exports.useCustomizeRequestActionProps = exports.useCreateActionProps = exports.useBulkDestroyActionProps = void 0;
|
|
9
7
|
|
|
10
8
|
var _react = require("@formily/react");
|
|
11
9
|
|
|
12
10
|
var _antd = require("antd");
|
|
13
11
|
|
|
12
|
+
var _jsonTemplates = _interopRequireDefault(require("json-templates"));
|
|
13
|
+
|
|
14
14
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
15
15
|
|
|
16
16
|
var _reactI18next = require("react-i18next");
|
|
17
17
|
|
|
18
18
|
var _reactRouterDom = require("react-router-dom");
|
|
19
19
|
|
|
20
|
+
var _reactToPrint = require("react-to-print");
|
|
21
|
+
|
|
20
22
|
var _2 = require("../..");
|
|
21
23
|
|
|
22
24
|
var _apiClient = require("../../api-client");
|
|
@@ -167,6 +169,8 @@ function getFormValues(filterByTk, field, form, fieldNames, getField, resource)
|
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
var useCreateActionProps = function useCreateActionProps() {
|
|
172
|
+
var _currentUserContext$d;
|
|
173
|
+
|
|
170
174
|
var form = (0, _react.useForm)();
|
|
171
175
|
|
|
172
176
|
var _useBlockRequestConte = (0, _BlockProvider.useBlockRequestContext)(),
|
|
@@ -192,12 +196,15 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
192
196
|
|
|
193
197
|
var compile = (0, _schemaComponent.useCompile)();
|
|
194
198
|
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
199
|
+
var currentRecord = (0, _recordProvider.useRecord)();
|
|
200
|
+
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
201
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d = currentUserContext.data) === null || _currentUserContext$d === void 0 ? void 0 : _currentUserContext$d.data;
|
|
195
202
|
return {
|
|
196
203
|
onClick: function onClick() {
|
|
197
204
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
198
205
|
var _actionSchema$xActio;
|
|
199
206
|
|
|
200
|
-
var fieldNames, _ref, assignedValues, onSuccess, overwriteValues, skipValidator, values, _parent$service, _parent$service$refre;
|
|
207
|
+
var fieldNames, _ref, _ref$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, values, _parent$service, _parent$service$refre;
|
|
201
208
|
|
|
202
209
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
203
210
|
while (1) {
|
|
@@ -206,39 +213,44 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
206
213
|
fieldNames = fields.map(function (field) {
|
|
207
214
|
return field.name;
|
|
208
215
|
});
|
|
209
|
-
_ref = (_actionSchema$xActio = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio !== void 0 ? _actionSchema$xActio : {}, assignedValues = _ref.assignedValues, onSuccess = _ref.onSuccess, overwriteValues = _ref.overwriteValues, skipValidator = _ref.skipValidator;
|
|
216
|
+
_ref = (_actionSchema$xActio = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio !== void 0 ? _actionSchema$xActio : {}, _ref$assignedValues = _ref.assignedValues, originalAssignedValues = _ref$assignedValues === void 0 ? {} : _ref$assignedValues, onSuccess = _ref.onSuccess, overwriteValues = _ref.overwriteValues, skipValidator = _ref.skipValidator;
|
|
217
|
+
assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
|
|
218
|
+
currentTime: new Date(),
|
|
219
|
+
currentRecord: currentRecord,
|
|
220
|
+
currentUser: currentUser
|
|
221
|
+
});
|
|
210
222
|
|
|
211
223
|
if (skipValidator) {
|
|
212
|
-
_context2.next =
|
|
224
|
+
_context2.next = 6;
|
|
213
225
|
break;
|
|
214
226
|
}
|
|
215
227
|
|
|
216
|
-
_context2.next =
|
|
228
|
+
_context2.next = 6;
|
|
217
229
|
return form.submit();
|
|
218
230
|
|
|
219
|
-
case
|
|
231
|
+
case 6:
|
|
220
232
|
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
221
233
|
actionField.data = field.data || {};
|
|
222
234
|
actionField.data.loading = true;
|
|
223
|
-
_context2.prev =
|
|
224
|
-
_context2.next =
|
|
235
|
+
_context2.prev = 9;
|
|
236
|
+
_context2.next = 12;
|
|
225
237
|
return resource.create({
|
|
226
238
|
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues)
|
|
227
239
|
});
|
|
228
240
|
|
|
229
|
-
case
|
|
241
|
+
case 12:
|
|
230
242
|
actionField.data.loading = false;
|
|
231
243
|
__parent === null || __parent === void 0 ? void 0 : (_parent$service = __parent.service) === null || _parent$service === void 0 ? void 0 : (_parent$service$refre = _parent$service.refresh) === null || _parent$service$refre === void 0 ? void 0 : _parent$service$refre.call(_parent$service);
|
|
232
244
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
233
245
|
|
|
234
246
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
235
|
-
_context2.next =
|
|
247
|
+
_context2.next = 17;
|
|
236
248
|
break;
|
|
237
249
|
}
|
|
238
250
|
|
|
239
251
|
return _context2.abrupt("return");
|
|
240
252
|
|
|
241
|
-
case
|
|
253
|
+
case 17:
|
|
242
254
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
243
255
|
_antd.Modal.success({
|
|
244
256
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
@@ -279,20 +291,20 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
279
291
|
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
280
292
|
}
|
|
281
293
|
|
|
282
|
-
_context2.next =
|
|
294
|
+
_context2.next = 23;
|
|
283
295
|
break;
|
|
284
296
|
|
|
285
|
-
case
|
|
286
|
-
_context2.prev =
|
|
287
|
-
_context2.t0 = _context2["catch"](
|
|
297
|
+
case 20:
|
|
298
|
+
_context2.prev = 20;
|
|
299
|
+
_context2.t0 = _context2["catch"](9);
|
|
288
300
|
actionField.data.loading = false;
|
|
289
301
|
|
|
290
|
-
case
|
|
302
|
+
case 23:
|
|
291
303
|
case "end":
|
|
292
304
|
return _context2.stop();
|
|
293
305
|
}
|
|
294
306
|
}
|
|
295
|
-
}, _callee2, null, [[
|
|
307
|
+
}, _callee2, null, [[9, 20]]);
|
|
296
308
|
}))();
|
|
297
309
|
}
|
|
298
310
|
};
|
|
@@ -301,6 +313,8 @@ var useCreateActionProps = function useCreateActionProps() {
|
|
|
301
313
|
exports.useCreateActionProps = useCreateActionProps;
|
|
302
314
|
|
|
303
315
|
var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
316
|
+
var _currentUserContext$d2;
|
|
317
|
+
|
|
304
318
|
var _useBlockRequestConte2 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
305
319
|
resource = _useBlockRequestConte2.resource,
|
|
306
320
|
__parent = _useBlockRequestConte2.__parent,
|
|
@@ -309,7 +323,8 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
309
323
|
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
310
324
|
var actionSchema = (0, _react.useFieldSchema)();
|
|
311
325
|
var currentRecord = (0, _recordProvider.useRecord)();
|
|
312
|
-
var
|
|
326
|
+
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
327
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d2 = currentUserContext.data) === null || _currentUserContext$d2 === void 0 ? void 0 : _currentUserContext$d2.data;
|
|
313
328
|
var history = (0, _reactRouterDom.useHistory)();
|
|
314
329
|
var compile = (0, _schemaComponent.useCompile)();
|
|
315
330
|
var form = (0, _react.useForm)();
|
|
@@ -318,30 +333,35 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
318
333
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
319
334
|
var _actionSchema$xActio2, _service$refresh;
|
|
320
335
|
|
|
321
|
-
var _ref2, assignedValues, onSuccess, skipValidator, _parent$service2, _parent$service2$refr;
|
|
336
|
+
var _ref2, _ref2$assignedValues, originalAssignedValues, onSuccess, skipValidator, assignedValues, _parent$service2, _parent$service2$refr;
|
|
322
337
|
|
|
323
338
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
324
339
|
while (1) {
|
|
325
340
|
switch (_context4.prev = _context4.next) {
|
|
326
341
|
case 0:
|
|
327
|
-
_ref2 = (_actionSchema$xActio2 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio2 !== void 0 ? _actionSchema$xActio2 : {}, assignedValues = _ref2.assignedValues, onSuccess = _ref2.onSuccess, skipValidator = _ref2.skipValidator;
|
|
342
|
+
_ref2 = (_actionSchema$xActio2 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio2 !== void 0 ? _actionSchema$xActio2 : {}, _ref2$assignedValues = _ref2.assignedValues, originalAssignedValues = _ref2$assignedValues === void 0 ? {} : _ref2$assignedValues, onSuccess = _ref2.onSuccess, skipValidator = _ref2.skipValidator;
|
|
343
|
+
assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
|
|
344
|
+
currentTime: new Date(),
|
|
345
|
+
currentRecord: currentRecord,
|
|
346
|
+
currentUser: currentUser
|
|
347
|
+
});
|
|
328
348
|
|
|
329
349
|
if (!(skipValidator === false)) {
|
|
330
|
-
_context4.next =
|
|
350
|
+
_context4.next = 5;
|
|
331
351
|
break;
|
|
332
352
|
}
|
|
333
353
|
|
|
334
|
-
_context4.next =
|
|
354
|
+
_context4.next = 5;
|
|
335
355
|
return form.submit();
|
|
336
356
|
|
|
337
|
-
case
|
|
338
|
-
_context4.next =
|
|
357
|
+
case 5:
|
|
358
|
+
_context4.next = 7;
|
|
339
359
|
return resource.update({
|
|
340
360
|
filterByTk: filterByTk,
|
|
341
361
|
values: _objectSpread({}, assignedValues)
|
|
342
362
|
});
|
|
343
363
|
|
|
344
|
-
case
|
|
364
|
+
case 7:
|
|
345
365
|
service === null || service === void 0 ? void 0 : (_service$refresh = service.refresh) === null || _service$refresh === void 0 ? void 0 : _service$refresh.call(service);
|
|
346
366
|
|
|
347
367
|
if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
|
|
@@ -349,13 +369,13 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
349
369
|
}
|
|
350
370
|
|
|
351
371
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
352
|
-
_context4.next =
|
|
372
|
+
_context4.next = 11;
|
|
353
373
|
break;
|
|
354
374
|
}
|
|
355
375
|
|
|
356
376
|
return _context4.abrupt("return");
|
|
357
377
|
|
|
358
|
-
case
|
|
378
|
+
case 11:
|
|
359
379
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
360
380
|
_antd.Modal.success({
|
|
361
381
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
@@ -392,7 +412,7 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
392
412
|
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
393
413
|
}
|
|
394
414
|
|
|
395
|
-
case
|
|
415
|
+
case 12:
|
|
396
416
|
case "end":
|
|
397
417
|
return _context4.stop();
|
|
398
418
|
}
|
|
@@ -406,7 +426,7 @@ var useCustomizeUpdateActionProps = function useCustomizeUpdateActionProps() {
|
|
|
406
426
|
exports.useCustomizeUpdateActionProps = useCustomizeUpdateActionProps;
|
|
407
427
|
|
|
408
428
|
var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
409
|
-
var _currentUserContext$
|
|
429
|
+
var _currentUserContext$d3;
|
|
410
430
|
|
|
411
431
|
var apiClient = (0, _apiClient.useAPIClient)();
|
|
412
432
|
var history = (0, _reactRouterDom.useHistory)();
|
|
@@ -427,7 +447,7 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
|
427
447
|
|
|
428
448
|
var currentRecord = (0, _recordProvider.useRecord)();
|
|
429
449
|
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
430
|
-
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$
|
|
450
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d3 = currentUserContext.data) === null || _currentUserContext$d3 === void 0 ? void 0 : _currentUserContext$d3.data;
|
|
431
451
|
var actionField = (0, _react.useField)();
|
|
432
452
|
|
|
433
453
|
var _useActionContext2 = (0, _schemaComponent.useActionContext)(),
|
|
@@ -484,15 +504,15 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
|
484
504
|
currentUser: currentUser
|
|
485
505
|
}),
|
|
486
506
|
method: requestSettings['method'],
|
|
487
|
-
headers:
|
|
507
|
+
headers: (0, _jsonTemplates.default)(headers)({
|
|
488
508
|
currentRecord: currentRecord,
|
|
489
509
|
currentUser: currentUser
|
|
490
510
|
}),
|
|
491
|
-
params:
|
|
511
|
+
params: (0, _jsonTemplates.default)(params)({
|
|
492
512
|
currentRecord: currentRecord,
|
|
493
513
|
currentUser: currentUser
|
|
494
514
|
}),
|
|
495
|
-
data:
|
|
515
|
+
data: (0, _jsonTemplates.default)(data)({
|
|
496
516
|
currentRecord: currentRecord,
|
|
497
517
|
currentUser: currentUser
|
|
498
518
|
})
|
|
@@ -579,6 +599,8 @@ var useCustomizeRequestActionProps = function useCustomizeRequestActionProps() {
|
|
|
579
599
|
exports.useCustomizeRequestActionProps = useCustomizeRequestActionProps;
|
|
580
600
|
|
|
581
601
|
var useUpdateActionProps = function useUpdateActionProps() {
|
|
602
|
+
var _currentUserContext$d4;
|
|
603
|
+
|
|
582
604
|
var form = (0, _react.useForm)();
|
|
583
605
|
var filterByTk = (0, _BlockProvider.useFilterByTk)();
|
|
584
606
|
|
|
@@ -592,7 +614,6 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
592
614
|
|
|
593
615
|
var actionSchema = (0, _react.useFieldSchema)();
|
|
594
616
|
var history = (0, _reactRouterDom.useHistory)();
|
|
595
|
-
var record = (0, _recordProvider.useRecord)();
|
|
596
617
|
|
|
597
618
|
var _useCollection3 = (0, _collectionManager.useCollection)(),
|
|
598
619
|
fields = _useCollection3.fields,
|
|
@@ -604,43 +625,51 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
604
625
|
var _useFormBlockContext = (0, _2.useFormBlockContext)(),
|
|
605
626
|
updateAssociationValues = _useFormBlockContext.updateAssociationValues;
|
|
606
627
|
|
|
628
|
+
var currentRecord = (0, _recordProvider.useRecord)();
|
|
629
|
+
var currentUserContext = (0, _user.useCurrentUserContext)();
|
|
630
|
+
var currentUser = currentUserContext === null || currentUserContext === void 0 ? void 0 : (_currentUserContext$d4 = currentUserContext.data) === null || _currentUserContext$d4 === void 0 ? void 0 : _currentUserContext$d4.data;
|
|
607
631
|
return {
|
|
608
632
|
onClick: function onClick() {
|
|
609
633
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
|
|
610
634
|
var _actionSchema$xActio4;
|
|
611
635
|
|
|
612
|
-
var _ref4, assignedValues, onSuccess, overwriteValues, skipValidator, fieldNames, values, _parent$service4, _parent$service4$refr, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
|
|
636
|
+
var _ref4, _ref4$assignedValues, originalAssignedValues, onSuccess, overwriteValues, skipValidator, assignedValues, fieldNames, values, _parent$service4, _parent$service4$refr, _parent$__parent, _parent$__parent$serv, _parent$__parent$serv2;
|
|
613
637
|
|
|
614
638
|
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
615
639
|
while (1) {
|
|
616
640
|
switch (_context8.prev = _context8.next) {
|
|
617
641
|
case 0:
|
|
618
|
-
_ref4 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, assignedValues = _ref4.assignedValues, onSuccess = _ref4.onSuccess, overwriteValues = _ref4.overwriteValues, skipValidator = _ref4.skipValidator;
|
|
642
|
+
_ref4 = (_actionSchema$xActio4 = actionSchema === null || actionSchema === void 0 ? void 0 : actionSchema['x-action-settings']) !== null && _actionSchema$xActio4 !== void 0 ? _actionSchema$xActio4 : {}, _ref4$assignedValues = _ref4.assignedValues, originalAssignedValues = _ref4$assignedValues === void 0 ? {} : _ref4$assignedValues, onSuccess = _ref4.onSuccess, overwriteValues = _ref4.overwriteValues, skipValidator = _ref4.skipValidator;
|
|
643
|
+
assignedValues = (0, _jsonTemplates.default)(originalAssignedValues)({
|
|
644
|
+
currentTime: new Date(),
|
|
645
|
+
currentRecord: currentRecord,
|
|
646
|
+
currentUser: currentUser
|
|
647
|
+
});
|
|
619
648
|
|
|
620
649
|
if (skipValidator) {
|
|
621
|
-
_context8.next =
|
|
650
|
+
_context8.next = 5;
|
|
622
651
|
break;
|
|
623
652
|
}
|
|
624
653
|
|
|
625
|
-
_context8.next =
|
|
654
|
+
_context8.next = 5;
|
|
626
655
|
return form.submit();
|
|
627
656
|
|
|
628
|
-
case
|
|
657
|
+
case 5:
|
|
629
658
|
fieldNames = fields.map(function (field) {
|
|
630
659
|
return field.name;
|
|
631
660
|
});
|
|
632
661
|
values = getFormValues(filterByTk, field, form, fieldNames, getField, resource);
|
|
633
662
|
actionField.data = field.data || {};
|
|
634
663
|
actionField.data.loading = true;
|
|
635
|
-
_context8.prev =
|
|
636
|
-
_context8.next =
|
|
664
|
+
_context8.prev = 9;
|
|
665
|
+
_context8.next = 12;
|
|
637
666
|
return resource.update({
|
|
638
667
|
filterByTk: filterByTk,
|
|
639
668
|
values: _objectSpread(_objectSpread(_objectSpread({}, values), overwriteValues), assignedValues),
|
|
640
669
|
updateAssociationValues: updateAssociationValues
|
|
641
670
|
});
|
|
642
671
|
|
|
643
|
-
case
|
|
672
|
+
case 12:
|
|
644
673
|
actionField.data.loading = false;
|
|
645
674
|
|
|
646
675
|
if (!(resource instanceof _TableFieldProvider.TableFieldResource)) {
|
|
@@ -651,13 +680,13 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
651
680
|
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
652
681
|
|
|
653
682
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage) {
|
|
654
|
-
_context8.next =
|
|
683
|
+
_context8.next = 18;
|
|
655
684
|
break;
|
|
656
685
|
}
|
|
657
686
|
|
|
658
687
|
return _context8.abrupt("return");
|
|
659
688
|
|
|
660
|
-
case
|
|
689
|
+
case 18:
|
|
661
690
|
if (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.manualClose) {
|
|
662
691
|
_antd.Modal.success({
|
|
663
692
|
title: compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage),
|
|
@@ -698,20 +727,20 @@ var useUpdateActionProps = function useUpdateActionProps() {
|
|
|
698
727
|
_antd.message.success(compile(onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess.successMessage));
|
|
699
728
|
}
|
|
700
729
|
|
|
701
|
-
_context8.next =
|
|
730
|
+
_context8.next = 24;
|
|
702
731
|
break;
|
|
703
732
|
|
|
704
|
-
case
|
|
705
|
-
_context8.prev =
|
|
706
|
-
_context8.t0 = _context8["catch"](
|
|
733
|
+
case 21:
|
|
734
|
+
_context8.prev = 21;
|
|
735
|
+
_context8.t0 = _context8["catch"](9);
|
|
707
736
|
actionField.data.loading = false;
|
|
708
737
|
|
|
709
|
-
case
|
|
738
|
+
case 24:
|
|
710
739
|
case "end":
|
|
711
740
|
return _context8.stop();
|
|
712
741
|
}
|
|
713
742
|
}
|
|
714
|
-
}, _callee8, null, [[
|
|
743
|
+
}, _callee8, null, [[9, 21]]);
|
|
715
744
|
}))();
|
|
716
745
|
}
|
|
717
746
|
};
|
|
@@ -724,13 +753,20 @@ var useDestroyActionProps = function useDestroyActionProps() {
|
|
|
724
753
|
|
|
725
754
|
var _useBlockRequestConte5 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
726
755
|
resource = _useBlockRequestConte5.resource,
|
|
727
|
-
service = _useBlockRequestConte5.service
|
|
756
|
+
service = _useBlockRequestConte5.service,
|
|
757
|
+
block = _useBlockRequestConte5.block,
|
|
758
|
+
__parent = _useBlockRequestConte5.__parent;
|
|
759
|
+
|
|
760
|
+
var _useActionContext4 = (0, _schemaComponent.useActionContext)(),
|
|
761
|
+
setVisible = _useActionContext4.setVisible;
|
|
728
762
|
|
|
729
763
|
return {
|
|
730
764
|
onClick: function onClick() {
|
|
731
765
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
|
|
732
766
|
var _service$refresh3;
|
|
733
767
|
|
|
768
|
+
var _parent$service5, _parent$service5$refr;
|
|
769
|
+
|
|
734
770
|
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
735
771
|
while (1) {
|
|
736
772
|
switch (_context9.prev = _context9.next) {
|
|
@@ -743,7 +779,12 @@ var useDestroyActionProps = function useDestroyActionProps() {
|
|
|
743
779
|
case 2:
|
|
744
780
|
service === null || service === void 0 ? void 0 : (_service$refresh3 = service.refresh) === null || _service$refresh3 === void 0 ? void 0 : _service$refresh3.call(service);
|
|
745
781
|
|
|
746
|
-
|
|
782
|
+
if (block !== 'TableField') {
|
|
783
|
+
__parent === null || __parent === void 0 ? void 0 : (_parent$service5 = __parent.service) === null || _parent$service5 === void 0 ? void 0 : (_parent$service5$refr = _parent$service5.refresh) === null || _parent$service5$refr === void 0 ? void 0 : _parent$service5$refr.call(_parent$service5);
|
|
784
|
+
setVisible === null || setVisible === void 0 ? void 0 : setVisible(false);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
case 4:
|
|
747
788
|
case "end":
|
|
748
789
|
return _context9.stop();
|
|
749
790
|
}
|
|
@@ -756,6 +797,38 @@ var useDestroyActionProps = function useDestroyActionProps() {
|
|
|
756
797
|
|
|
757
798
|
exports.useDestroyActionProps = useDestroyActionProps;
|
|
758
799
|
|
|
800
|
+
var useDetailPrintActionProps = function useDetailPrintActionProps() {
|
|
801
|
+
var _useFormBlockContext2 = (0, _2.useFormBlockContext)(),
|
|
802
|
+
formBlockRef = _useFormBlockContext2.formBlockRef;
|
|
803
|
+
|
|
804
|
+
var printHandler = (0, _reactToPrint.useReactToPrint)({
|
|
805
|
+
content: function content() {
|
|
806
|
+
return formBlockRef.current;
|
|
807
|
+
},
|
|
808
|
+
pageStyle: "@media print {\n * {\n margin: 0;\n }\n div.ant-formily-layout>div:first-child {\n overflow: hidden; height: 0;\n }\n\n }"
|
|
809
|
+
});
|
|
810
|
+
return {
|
|
811
|
+
onClick: function onClick() {
|
|
812
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
|
|
813
|
+
return regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
814
|
+
while (1) {
|
|
815
|
+
switch (_context10.prev = _context10.next) {
|
|
816
|
+
case 0:
|
|
817
|
+
printHandler();
|
|
818
|
+
|
|
819
|
+
case 1:
|
|
820
|
+
case "end":
|
|
821
|
+
return _context10.stop();
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}, _callee10);
|
|
825
|
+
}))();
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
exports.useDetailPrintActionProps = useDetailPrintActionProps;
|
|
831
|
+
|
|
759
832
|
var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
760
833
|
var _useBlockRequestConte6 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
761
834
|
field = _useBlockRequestConte6.field;
|
|
@@ -766,22 +839,22 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
|
766
839
|
|
|
767
840
|
return {
|
|
768
841
|
onClick: function onClick() {
|
|
769
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
842
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
|
|
770
843
|
var _field$data, _field$data$selectedR, _field$data2, _service$refresh4;
|
|
771
844
|
|
|
772
|
-
return regeneratorRuntime.wrap(function
|
|
845
|
+
return regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
773
846
|
while (1) {
|
|
774
|
-
switch (
|
|
847
|
+
switch (_context11.prev = _context11.next) {
|
|
775
848
|
case 0:
|
|
776
849
|
if (field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : (_field$data$selectedR = _field$data.selectedRowKeys) === null || _field$data$selectedR === void 0 ? void 0 : _field$data$selectedR.length) {
|
|
777
|
-
|
|
850
|
+
_context11.next = 2;
|
|
778
851
|
break;
|
|
779
852
|
}
|
|
780
853
|
|
|
781
|
-
return
|
|
854
|
+
return _context11.abrupt("return");
|
|
782
855
|
|
|
783
856
|
case 2:
|
|
784
|
-
|
|
857
|
+
_context11.next = 4;
|
|
785
858
|
return resource.destroy({
|
|
786
859
|
filterByTk: (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : _field$data2.selectedRowKeys
|
|
787
860
|
});
|
|
@@ -792,10 +865,10 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
|
792
865
|
|
|
793
866
|
case 6:
|
|
794
867
|
case "end":
|
|
795
|
-
return
|
|
868
|
+
return _context11.stop();
|
|
796
869
|
}
|
|
797
870
|
}
|
|
798
|
-
},
|
|
871
|
+
}, _callee11);
|
|
799
872
|
}))();
|
|
800
873
|
}
|
|
801
874
|
};
|
|
@@ -803,6 +876,34 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
|
803
876
|
|
|
804
877
|
exports.useBulkDestroyActionProps = useBulkDestroyActionProps;
|
|
805
878
|
|
|
879
|
+
var useRefreshActionProps = function useRefreshActionProps() {
|
|
880
|
+
var _useBlockRequestConte8 = (0, _BlockProvider.useBlockRequestContext)(),
|
|
881
|
+
service = _useBlockRequestConte8.service;
|
|
882
|
+
|
|
883
|
+
return {
|
|
884
|
+
onClick: function onClick() {
|
|
885
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
|
|
886
|
+
var _service$refresh5;
|
|
887
|
+
|
|
888
|
+
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
889
|
+
while (1) {
|
|
890
|
+
switch (_context12.prev = _context12.next) {
|
|
891
|
+
case 0:
|
|
892
|
+
service === null || service === void 0 ? void 0 : (_service$refresh5 = service.refresh) === null || _service$refresh5 === void 0 ? void 0 : _service$refresh5.call(service);
|
|
893
|
+
|
|
894
|
+
case 1:
|
|
895
|
+
case "end":
|
|
896
|
+
return _context12.stop();
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}, _callee12);
|
|
900
|
+
}))();
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
exports.useRefreshActionProps = useRefreshActionProps;
|
|
906
|
+
|
|
806
907
|
var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
807
908
|
var _ctx$service, _ctx$service$data, _ctx$service$data$met, _ctx$service2, _ctx$service2$data, _ctx$service2$data$me;
|
|
808
909
|
|
|
@@ -815,13 +916,13 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
815
916
|
total: count,
|
|
816
917
|
pageSize: 1,
|
|
817
918
|
onChange: function onChange(page) {
|
|
818
|
-
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
919
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
|
|
819
920
|
var _ctx$service3, _ctx$service3$params;
|
|
820
921
|
|
|
821
922
|
var params;
|
|
822
|
-
return regeneratorRuntime.wrap(function
|
|
923
|
+
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
823
924
|
while (1) {
|
|
824
|
-
switch (
|
|
925
|
+
switch (_context13.prev = _context13.next) {
|
|
825
926
|
case 0:
|
|
826
927
|
params = (_ctx$service3 = ctx.service) === null || _ctx$service3 === void 0 ? void 0 : (_ctx$service3$params = _ctx$service3.params) === null || _ctx$service3$params === void 0 ? void 0 : _ctx$service3$params[0];
|
|
827
928
|
ctx.service.run(_objectSpread(_objectSpread({}, params), {}, {
|
|
@@ -830,10 +931,10 @@ var useDetailsPaginationProps = function useDetailsPaginationProps() {
|
|
|
830
931
|
|
|
831
932
|
case 2:
|
|
832
933
|
case "end":
|
|
833
|
-
return
|
|
934
|
+
return _context13.stop();
|
|
834
935
|
}
|
|
835
936
|
}
|
|
836
|
-
},
|
|
937
|
+
}, _callee13);
|
|
837
938
|
}))();
|
|
838
939
|
},
|
|
839
940
|
style: {
|
|
@@ -11,6 +11,8 @@ var _react = require("@formily/react");
|
|
|
11
11
|
|
|
12
12
|
var _shared = require("@formily/shared");
|
|
13
13
|
|
|
14
|
+
var _lodash = require("lodash");
|
|
15
|
+
|
|
14
16
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
15
17
|
|
|
16
18
|
var _ = require("..");
|
|
@@ -37,8 +39,10 @@ var InternalField = function InternalField(props) {
|
|
|
37
39
|
var _useCollectionField = (0, _hooks.useCollectionField)(),
|
|
38
40
|
name = _useCollectionField.name,
|
|
39
41
|
interfaceType = _useCollectionField.interface,
|
|
40
|
-
uiSchema = _useCollectionField.uiSchema
|
|
42
|
+
uiSchema = _useCollectionField.uiSchema,
|
|
43
|
+
defaultValue = _useCollectionField.defaultValue;
|
|
41
44
|
|
|
45
|
+
var collectionField = (0, _hooks.useCollectionField)();
|
|
42
46
|
var component = (0, _.useComponent)(uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema['x-component']);
|
|
43
47
|
var compile = (0, _.useCompile)();
|
|
44
48
|
|
|
@@ -68,10 +72,14 @@ var InternalField = function InternalField(props) {
|
|
|
68
72
|
setFieldProps('content', uiSchema['x-content']);
|
|
69
73
|
setFieldProps('title', uiSchema.title);
|
|
70
74
|
setFieldProps('description', uiSchema.description);
|
|
71
|
-
setFieldProps('initialValue', uiSchema.default);
|
|
72
75
|
|
|
73
|
-
if (
|
|
74
|
-
|
|
76
|
+
if (ctx === null || ctx === void 0 ? void 0 : ctx.form) {
|
|
77
|
+
setFieldProps('initialValue', fieldSchema.default || defaultValue);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!field.validator && (uiSchema['x-validator'] || fieldSchema['x-validator'])) {
|
|
81
|
+
var concatSchema = (0, _lodash.concat)([], uiSchema['x-validator'] || [], fieldSchema['x-validator'] || []);
|
|
82
|
+
field.validator = concatSchema;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
if (fieldSchema['x-disabled'] === true) {
|
|
@@ -70,6 +70,12 @@ var getSchema = function getSchema(schema, record, compile) {
|
|
|
70
70
|
|
|
71
71
|
var properties = (0, _lodash.cloneDeep)(schema.properties);
|
|
72
72
|
|
|
73
|
+
if (schema.hasDefaultValue === true) {
|
|
74
|
+
properties['defaultValue'] = (0, _lodash.cloneDeep)(schema.default.uiSchema);
|
|
75
|
+
properties['defaultValue']['title'] = compile('{{ t("Default value") }}');
|
|
76
|
+
properties['defaultValue']['x-decorator'] = 'FormItem';
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
var initialValue = _objectSpread(_objectSpread({
|
|
74
80
|
name: "f_".concat((0, _shared.uid)())
|
|
75
81
|
}, (0, _lodash.cloneDeep)(schema.default)), {}, {
|
|
@@ -68,6 +68,13 @@ var getSchema = function getSchema(schema, record, compile) {
|
|
|
68
68
|
|
|
69
69
|
var properties = (0, _cloneDeep.default)(schema.properties);
|
|
70
70
|
properties.name['x-disabled'] = true;
|
|
71
|
+
|
|
72
|
+
if (schema.hasDefaultValue === true) {
|
|
73
|
+
properties['defaultValue'] = (0, _cloneDeep.default)(schema.default.uiSchema);
|
|
74
|
+
properties['defaultValue']['title'] = compile('{{ t("Default value") }}');
|
|
75
|
+
properties['defaultValue']['x-decorator'] = 'FormItem';
|
|
76
|
+
}
|
|
77
|
+
|
|
71
78
|
return {
|
|
72
79
|
type: 'object',
|
|
73
80
|
properties: _defineProperty({}, (0, _shared.uid)(), {
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
var _core = require("@formily/core");
|
|
8
|
+
|
|
7
9
|
var _AddFieldAction = require("./AddFieldAction");
|
|
8
10
|
|
|
9
11
|
Object.keys(_AddFieldAction).forEach(function (key) {
|
|
@@ -41,4 +43,7 @@ Object.keys(_EditFieldAction).forEach(function (key) {
|
|
|
41
43
|
return _EditFieldAction[key];
|
|
42
44
|
}
|
|
43
45
|
});
|
|
46
|
+
});
|
|
47
|
+
(0, _core.registerValidateFormats)({
|
|
48
|
+
uid: /^[A-Za-z0-9][A-Za-z0-9_-]*$/
|
|
44
49
|
});
|