@nocobase/client 0.7.2-alpha.6 → 0.7.4-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/application/Application.d.ts +1 -0
- package/es/application/Application.js +7 -1
- package/es/block-provider/FormBlockProvider.js +8 -3
- package/es/block-provider/TableFieldProvider.d.ts +1 -0
- package/es/block-provider/TableFieldProvider.js +5 -2
- package/es/block-provider/TableSelectorProvider.js +41 -13
- 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 +4 -2
- package/es/collection-manager/Configuration/index.js +5 -1
- package/es/collection-manager/Configuration/schemas/collections.js +2 -1
- package/es/collection-manager/interfaces/input.js +103 -0
- package/es/collection-manager/interfaces/integer.js +63 -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 +34 -0
- package/es/collection-manager/interfaces/number.js +55 -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 +36 -1
- package/es/collection-manager/interfaces/percent.js +97 -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/richText.js +34 -0
- package/es/collection-manager/interfaces/textarea.js +34 -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 +26 -2
- package/es/locale/zh_CN.js +27 -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 +161 -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/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 +7 -2
- package/lib/block-provider/TableFieldProvider.d.ts +1 -0
- package/lib/block-provider/TableFieldProvider.js +4 -1
- package/lib/block-provider/TableSelectorProvider.js +41 -13
- 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 +5 -2
- package/lib/collection-manager/Configuration/index.js +5 -0
- package/lib/collection-manager/Configuration/schemas/collections.js +2 -1
- package/lib/collection-manager/interfaces/input.js +104 -0
- package/lib/collection-manager/interfaces/integer.js +65 -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 +35 -0
- package/lib/collection-manager/interfaces/number.js +56 -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 +37 -1
- package/lib/collection-manager/interfaces/percent.js +99 -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/richText.js +35 -0
- package/lib/collection-manager/interfaces/textarea.js +35 -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 +26 -2
- package/lib/locale/zh_CN.js +27 -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 +164 -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/system-settings/SystemSettingsShortcut.js +37 -13
- package/package.json +7 -4
|
@@ -31,7 +31,7 @@ import { merge } from '@formily/shared';
|
|
|
31
31
|
import React, { useContext } from 'react';
|
|
32
32
|
import { useTranslation } from 'react-i18next';
|
|
33
33
|
import { useAPIClient } from '../../api-client';
|
|
34
|
-
import { useBlockAssociationContext } from '../../block-provider';
|
|
34
|
+
import { useBlockAssociationContext, useBlockRequestContext } from '../../block-provider';
|
|
35
35
|
import { useCollection, useCollectionManager } from '../../collection-manager';
|
|
36
36
|
import { SchemaComponent, SchemaComponentOptions } from '../../schema-component';
|
|
37
37
|
import { useSchemaTemplateManager } from '../../schema-templates';
|
|
@@ -415,9 +415,10 @@ export var KanbanBlockInitializer = function KanbanBlockInitializer(props) {
|
|
|
415
415
|
schema: {
|
|
416
416
|
properties: {
|
|
417
417
|
groupField: {
|
|
418
|
-
title: t('
|
|
418
|
+
title: t('Grouping field'),
|
|
419
419
|
enum: fields,
|
|
420
420
|
required: true,
|
|
421
|
+
description: '{{t("Single select and radio fields can be used as the grouping field")}}',
|
|
421
422
|
'x-component': 'Select',
|
|
422
423
|
'x-component-props': {
|
|
423
424
|
objectValue: true,
|
|
@@ -693,6 +694,21 @@ export var DestroyActionInitializer = function DestroyActionInitializer(props) {
|
|
|
693
694
|
schema: schema
|
|
694
695
|
}));
|
|
695
696
|
};
|
|
697
|
+
export var PrintActionInitializer = function PrintActionInitializer(props) {
|
|
698
|
+
var schema = {
|
|
699
|
+
title: '{{ t("Print") }}',
|
|
700
|
+
'x-action': 'print',
|
|
701
|
+
'x-component': 'Action',
|
|
702
|
+
'x-designer': 'Action.Designer',
|
|
703
|
+
'x-component-props': {
|
|
704
|
+
icon: 'PrinterOutlined',
|
|
705
|
+
useProps: '{{ useDetailPrintActionProps }}'
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
709
|
+
schema: schema
|
|
710
|
+
}));
|
|
711
|
+
};
|
|
696
712
|
export var BulkDestroyActionInitializer = function BulkDestroyActionInitializer(props) {
|
|
697
713
|
var schema = {
|
|
698
714
|
title: '{{ t("Delete") }}',
|
|
@@ -712,6 +728,21 @@ export var BulkDestroyActionInitializer = function BulkDestroyActionInitializer(
|
|
|
712
728
|
schema: schema
|
|
713
729
|
}));
|
|
714
730
|
};
|
|
731
|
+
export var RefreshActionInitializer = function RefreshActionInitializer(props) {
|
|
732
|
+
var schema = {
|
|
733
|
+
title: '{{ t("Refresh") }}',
|
|
734
|
+
'x-action': 'refresh',
|
|
735
|
+
'x-component': 'Action',
|
|
736
|
+
'x-designer': 'Action.Designer',
|
|
737
|
+
'x-component-props': {
|
|
738
|
+
icon: 'ReloadOutlined',
|
|
739
|
+
useProps: '{{ useRefreshActionProps }}'
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
return /*#__PURE__*/React.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
743
|
+
schema: schema
|
|
744
|
+
}));
|
|
745
|
+
};
|
|
715
746
|
export var SubmitActionInitializer = function SubmitActionInitializer(props) {
|
|
716
747
|
var schema = {
|
|
717
748
|
title: '{{ t("Submit") }}',
|
|
@@ -851,6 +882,7 @@ export var RecordFormBlockInitializer = function RecordFormBlockInitializer(prop
|
|
|
851
882
|
|
|
852
883
|
var collection = useCollection();
|
|
853
884
|
var association = useBlockAssociationContext();
|
|
885
|
+
console.log('RecordFormBlockInitializer', collection, association);
|
|
854
886
|
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
855
887
|
icon: /*#__PURE__*/React.createElement(FormOutlined, null)
|
|
856
888
|
}, others), {}, {
|
|
@@ -936,6 +968,11 @@ export var RecordReadPrettyFormBlockInitializer = function RecordReadPrettyFormB
|
|
|
936
968
|
|
|
937
969
|
var collection = useCollection();
|
|
938
970
|
var association = useBlockAssociationContext();
|
|
971
|
+
|
|
972
|
+
var _useBlockRequestConte = useBlockRequestContext(),
|
|
973
|
+
block = _useBlockRequestConte.block;
|
|
974
|
+
|
|
975
|
+
var actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
|
|
939
976
|
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
940
977
|
icon: /*#__PURE__*/React.createElement(FormOutlined, null)
|
|
941
978
|
}, others), {}, {
|
|
@@ -962,6 +999,7 @@ export var RecordReadPrettyFormBlockInitializer = function RecordReadPrettyFormB
|
|
|
962
999
|
|
|
963
1000
|
if (item.template.componentName === 'ReadPrettyFormItem') {
|
|
964
1001
|
blockSchema = createReadPrettyFormBlockSchema({
|
|
1002
|
+
actionInitializers: actionInitializers,
|
|
965
1003
|
association: association,
|
|
966
1004
|
collection: collection.name,
|
|
967
1005
|
action: 'get',
|
|
@@ -984,6 +1022,7 @@ export var RecordReadPrettyFormBlockInitializer = function RecordReadPrettyFormB
|
|
|
984
1022
|
|
|
985
1023
|
case 8:
|
|
986
1024
|
insert(createReadPrettyFormBlockSchema({
|
|
1025
|
+
actionInitializers: actionInitializers,
|
|
987
1026
|
association: association,
|
|
988
1027
|
collection: collection.name,
|
|
989
1028
|
action: 'get',
|
|
@@ -1113,6 +1152,11 @@ export var RecordReadPrettyAssociationFormBlockInitializer = function RecordRead
|
|
|
1113
1152
|
var field = item.field;
|
|
1114
1153
|
var collection = field.target;
|
|
1115
1154
|
var resource = "".concat(field.collectionName, ".").concat(field.name);
|
|
1155
|
+
|
|
1156
|
+
var _useBlockRequestConte2 = useBlockRequestContext(),
|
|
1157
|
+
block = _useBlockRequestConte2.block;
|
|
1158
|
+
|
|
1159
|
+
var actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
|
|
1116
1160
|
return /*#__PURE__*/React.createElement(SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
1117
1161
|
icon: /*#__PURE__*/React.createElement(FormOutlined, null)
|
|
1118
1162
|
}, others), {}, {
|
|
@@ -1138,6 +1182,7 @@ export var RecordReadPrettyAssociationFormBlockInitializer = function RecordRead
|
|
|
1138
1182
|
|
|
1139
1183
|
if (item.template.componentName === 'ReadPrettyFormItem') {
|
|
1140
1184
|
blockSchema = createReadPrettyFormBlockSchema({
|
|
1185
|
+
actionInitializers: actionInitializers,
|
|
1141
1186
|
collection: collection,
|
|
1142
1187
|
resource: resource,
|
|
1143
1188
|
association: resource,
|
|
@@ -1161,6 +1206,7 @@ export var RecordReadPrettyAssociationFormBlockInitializer = function RecordRead
|
|
|
1161
1206
|
|
|
1162
1207
|
case 8:
|
|
1163
1208
|
insert(createReadPrettyFormBlockSchema({
|
|
1209
|
+
actionInitializers: actionInitializers,
|
|
1164
1210
|
collection: collection,
|
|
1165
1211
|
resource: resource,
|
|
1166
1212
|
association: resource,
|
|
@@ -260,8 +260,9 @@ export var useAssociatedFormItemInitializerFields = function useAssociatedFormIt
|
|
|
260
260
|
_ref2$block = _ref2.block,
|
|
261
261
|
block = _ref2$block === void 0 ? 'Form' : _ref2$block;
|
|
262
262
|
|
|
263
|
+
var interfaces = block === 'Form' ? ['m2o'] : ['o2o', 'oho', 'obo', 'm2o'];
|
|
263
264
|
var groups = fields === null || fields === void 0 ? void 0 : (_fields$filter3 = fields.filter(function (field) {
|
|
264
|
-
return
|
|
265
|
+
return interfaces.includes(field.interface);
|
|
265
266
|
})) === null || _fields$filter3 === void 0 ? void 0 : _fields$filter3.map(function (field) {
|
|
266
267
|
var _subFields$filter2, _field$uiSchema4;
|
|
267
268
|
|
|
@@ -278,7 +279,10 @@ export var useAssociatedFormItemInitializerFields = function useAssociatedFormIt
|
|
|
278
279
|
// title: subField?.uiSchema?.title || subField.name,
|
|
279
280
|
'x-designer': 'FormItem.Designer',
|
|
280
281
|
'x-component': 'CollectionField',
|
|
281
|
-
'x-
|
|
282
|
+
'x-read-pretty': readPretty,
|
|
283
|
+
'x-component-props': {
|
|
284
|
+
'pattern-disable': block === 'Form' && readPretty
|
|
285
|
+
},
|
|
282
286
|
'x-decorator': 'FormItem',
|
|
283
287
|
'x-collection-field': "".concat(name, ".").concat(field.name, ".").concat(subField.name)
|
|
284
288
|
}; // interfaceConfig?.schemaInitialize?.(schema, { field, block: 'Form', readPretty: form.readPretty });
|
|
@@ -384,11 +388,27 @@ var removeSchema = function removeSchema(schema, cb) {
|
|
|
384
388
|
return cb(schema);
|
|
385
389
|
};
|
|
386
390
|
|
|
391
|
+
var recursiveParent = function recursiveParent(schema) {
|
|
392
|
+
if (!schema.parent) return null;
|
|
393
|
+
if (schema.parent['x-initializer']) return schema.parent;
|
|
394
|
+
return recursiveParent(schema.parent);
|
|
395
|
+
};
|
|
396
|
+
|
|
387
397
|
export var useCurrentSchema = function useCurrentSchema(action, key) {
|
|
398
|
+
var _fieldSchema;
|
|
399
|
+
|
|
388
400
|
var find = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : findSchema;
|
|
389
401
|
var rm = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : removeSchema;
|
|
390
402
|
var fieldSchema = useFieldSchema();
|
|
391
403
|
|
|
404
|
+
if (!((_fieldSchema = fieldSchema) === null || _fieldSchema === void 0 ? void 0 : _fieldSchema['x-initializer'])) {
|
|
405
|
+
var recursiveInitializerSchema = recursiveParent(fieldSchema);
|
|
406
|
+
|
|
407
|
+
if (recursiveInitializerSchema) {
|
|
408
|
+
fieldSchema = recursiveInitializerSchema;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
392
412
|
var _useDesignable = useDesignable(),
|
|
393
413
|
_remove = _useDesignable.remove;
|
|
394
414
|
|
|
@@ -23,10 +23,11 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
23
23
|
import { SettingOutlined } from '@ant-design/icons';
|
|
24
24
|
import { useForm } from '@formily/react';
|
|
25
25
|
import { uid } from '@formily/shared';
|
|
26
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
26
27
|
import React, { useState } from 'react';
|
|
27
28
|
import { useTranslation } from 'react-i18next';
|
|
28
29
|
import { useSystemSettings } from '.';
|
|
29
|
-
import { PluginManager, useAPIClient, useRequest } from '..';
|
|
30
|
+
import { i18n, PluginManager, useAPIClient, useRequest } from '..';
|
|
30
31
|
import locale from '../locale';
|
|
31
32
|
import { ActionContext, SchemaComponent, useActionContext } from '../schema-component';
|
|
32
33
|
var langs = Object.keys(locale).map(function (lang) {
|
|
@@ -86,6 +87,9 @@ var useSaveSystemSettingsValues = function useSaveSystemSettingsValues() {
|
|
|
86
87
|
return {
|
|
87
88
|
run: function run() {
|
|
88
89
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
90
|
+
var _values$enabledLangua;
|
|
91
|
+
|
|
92
|
+
var values, lang;
|
|
89
93
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
90
94
|
while (1) {
|
|
91
95
|
switch (_context2.prev = _context2.next) {
|
|
@@ -94,18 +98,28 @@ var useSaveSystemSettingsValues = function useSaveSystemSettingsValues() {
|
|
|
94
98
|
return form.submit();
|
|
95
99
|
|
|
96
100
|
case 2:
|
|
97
|
-
|
|
101
|
+
values = cloneDeep(form.values);
|
|
98
102
|
mutate({
|
|
99
|
-
data: _objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.data),
|
|
103
|
+
data: _objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.data), values)
|
|
100
104
|
});
|
|
101
105
|
_context2.next = 6;
|
|
102
106
|
return api.request({
|
|
103
107
|
url: 'systemSettings:update/1',
|
|
104
108
|
method: 'post',
|
|
105
|
-
data:
|
|
109
|
+
data: values
|
|
106
110
|
});
|
|
107
111
|
|
|
108
112
|
case 6:
|
|
113
|
+
lang = ((_values$enabledLangua = values.enabledLanguages) === null || _values$enabledLangua === void 0 ? void 0 : _values$enabledLangua[0]) || 'en-US';
|
|
114
|
+
|
|
115
|
+
if (values.enabledLanguages.length < 2 && api.auth.getLocale() !== lang) {
|
|
116
|
+
api.auth.setLocale('');
|
|
117
|
+
window.location.reload();
|
|
118
|
+
} else {
|
|
119
|
+
setVisible(false);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
case 8:
|
|
109
123
|
case "end":
|
|
110
124
|
return _context2.stop();
|
|
111
125
|
}
|
|
@@ -153,14 +167,23 @@ var schema = {
|
|
|
153
167
|
mode: 'multiple'
|
|
154
168
|
},
|
|
155
169
|
'x-decorator': 'FormItem',
|
|
156
|
-
enum: langs
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
enum: langs,
|
|
171
|
+
'x-reactions': function xReactions(field) {
|
|
172
|
+
field.dataSource = langs.map(function (item) {
|
|
173
|
+
var _field$value;
|
|
174
|
+
|
|
175
|
+
var label = item.label;
|
|
176
|
+
|
|
177
|
+
if (((_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value[0]) === item.value) {
|
|
178
|
+
label += "(".concat(i18n.t('Default'), ")");
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
label: label,
|
|
183
|
+
value: item.value
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
}
|
|
164
187
|
},
|
|
165
188
|
allowSignUp: {
|
|
166
189
|
type: 'boolean',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Application = void 0;
|
|
6
|
+
exports.getCurrentTimezone = exports.Application = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -79,6 +79,14 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
79
79
|
|
|
80
80
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
81
81
|
|
|
82
|
+
var getCurrentTimezone = function getCurrentTimezone() {
|
|
83
|
+
var timezoneOffset = new Date().getTimezoneOffset() / -60;
|
|
84
|
+
var timezone = String(timezoneOffset).padStart(2, '0') + ':00';
|
|
85
|
+
return (timezoneOffset > 0 ? '+' : '-') + timezone;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.getCurrentTimezone = getCurrentTimezone;
|
|
89
|
+
|
|
82
90
|
var Application = /*#__PURE__*/function () {
|
|
83
91
|
function Application(options) {
|
|
84
92
|
var _window, _window$location;
|
|
@@ -93,7 +101,8 @@ var Application = /*#__PURE__*/function () {
|
|
|
93
101
|
this.apiClient = new _apiClient.APIClient(_objectSpread({
|
|
94
102
|
baseURL: process.env.API_BASE_URL,
|
|
95
103
|
headers: {
|
|
96
|
-
'X-Hostname': (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname
|
|
104
|
+
'X-Hostname': (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname,
|
|
105
|
+
'X-Timezone': getCurrentTimezone()
|
|
97
106
|
}
|
|
98
107
|
}, options.apiClient));
|
|
99
108
|
this.i18n = options.i18n || _i18n.i18n;
|
|
@@ -44,6 +44,8 @@ var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
|
|
|
44
44
|
resource = _useBlockRequestConte.resource,
|
|
45
45
|
service = _useBlockRequestConte.service;
|
|
46
46
|
|
|
47
|
+
var formBlockRef = (0, _react2.useRef)();
|
|
48
|
+
|
|
47
49
|
if (service.loading) {
|
|
48
50
|
return /*#__PURE__*/_react2.default.createElement(_antd.Spin, null);
|
|
49
51
|
}
|
|
@@ -55,9 +57,12 @@ var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
|
|
|
55
57
|
field: field,
|
|
56
58
|
service: service,
|
|
57
59
|
resource: resource,
|
|
58
|
-
updateAssociationValues: []
|
|
60
|
+
updateAssociationValues: [],
|
|
61
|
+
formBlockRef: formBlockRef
|
|
59
62
|
}
|
|
60
|
-
},
|
|
63
|
+
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
64
|
+
ref: formBlockRef
|
|
65
|
+
}, props.children));
|
|
61
66
|
};
|
|
62
67
|
|
|
63
68
|
var FormBlockProvider = function FormBlockProvider(props) {
|
|
@@ -49,6 +49,7 @@ var InternalTableFieldProvider = function InternalTableFieldProvider(props) {
|
|
|
49
49
|
dragSort = props.dragSort,
|
|
50
50
|
fieldName = props.fieldName;
|
|
51
51
|
var field = (0, _react.useField)();
|
|
52
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
52
53
|
|
|
53
54
|
var _useBlockRequestConte = (0, _BlockProvider.useBlockRequestContext)(),
|
|
54
55
|
resource = _useBlockRequestConte.resource,
|
|
@@ -70,6 +71,7 @@ var InternalTableFieldProvider = function InternalTableFieldProvider(props) {
|
|
|
70
71
|
return /*#__PURE__*/_react2.default.createElement(TableFieldContext.Provider, {
|
|
71
72
|
value: {
|
|
72
73
|
field: field,
|
|
74
|
+
fieldSchema: fieldSchema,
|
|
73
75
|
service: service,
|
|
74
76
|
resource: resource,
|
|
75
77
|
params: params,
|
|
@@ -306,7 +308,7 @@ var useTableFieldContext = function useTableFieldContext() {
|
|
|
306
308
|
exports.useTableFieldContext = useTableFieldContext;
|
|
307
309
|
|
|
308
310
|
var useTableFieldProps = function useTableFieldProps() {
|
|
309
|
-
var _ctx$service3, _ctx$service4;
|
|
311
|
+
var _ctx$service3, _ctx$service4, _ctx$fieldSchema, _ctx$fieldSchema$pare;
|
|
310
312
|
|
|
311
313
|
var field = (0, _react.useField)();
|
|
312
314
|
var ctx = useTableFieldContext();
|
|
@@ -327,6 +329,7 @@ var useTableFieldProps = function useTableFieldProps() {
|
|
|
327
329
|
showIndex: ctx.showIndex,
|
|
328
330
|
dragSort: ctx.dragSort,
|
|
329
331
|
pagination: false,
|
|
332
|
+
required: ctx === null || ctx === void 0 ? void 0 : (_ctx$fieldSchema = ctx.fieldSchema) === null || _ctx$fieldSchema === void 0 ? void 0 : (_ctx$fieldSchema$pare = _ctx$fieldSchema.parent) === null || _ctx$fieldSchema$pare === void 0 ? void 0 : _ctx$fieldSchema$pare.required,
|
|
330
333
|
rowKey: function rowKey(record) {
|
|
331
334
|
var _field$value, _field$value$indexOf;
|
|
332
335
|
|
|
@@ -82,7 +82,8 @@ var TableSelectorProvider = function TableSelectorProvider(props) {
|
|
|
82
82
|
var ctx = (0, _FormBlockProvider.useFormBlockContext)();
|
|
83
83
|
|
|
84
84
|
var _useCollectionManager2 = (0, _collectionManager.useCollectionManager)(),
|
|
85
|
-
getCollectionJoinField = _useCollectionManager2.getCollectionJoinField
|
|
85
|
+
getCollectionJoinField = _useCollectionManager2.getCollectionJoinField,
|
|
86
|
+
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
86
87
|
|
|
87
88
|
var record = (0, _recordProvider.useRecord)();
|
|
88
89
|
var collectionFieldSchema = recursiveParent(fieldSchema, 'CollectionField'); // const value = ctx.form.query(collectionFieldSchema?.name).value();
|
|
@@ -104,16 +105,43 @@ var TableSelectorProvider = function TableSelectorProvider(props) {
|
|
|
104
105
|
|
|
105
106
|
if (collectionField) {
|
|
106
107
|
if (['oho', 'o2m'].includes(collectionField.interface)) {
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
if (record === null || record === void 0 ? void 0 : record[collectionField.sourceKey]) {
|
|
109
|
+
params['filter'] = {
|
|
110
|
+
$or: [_defineProperty({}, collectionField.foreignKey, {
|
|
111
|
+
$is: null
|
|
112
|
+
}), _defineProperty({}, collectionField.foreignKey, {
|
|
113
|
+
$eq: record === null || record === void 0 ? void 0 : record[collectionField.sourceKey]
|
|
114
|
+
})]
|
|
115
|
+
};
|
|
116
|
+
} else {
|
|
117
|
+
params['filter'] = _defineProperty({}, collectionField.foreignKey, {
|
|
109
118
|
$is: null
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
})]
|
|
113
|
-
};
|
|
119
|
+
});
|
|
120
|
+
}
|
|
114
121
|
}
|
|
115
122
|
|
|
116
|
-
if (['obo'].includes(collectionField.interface)) {
|
|
123
|
+
if (['obo'].includes(collectionField.interface)) {
|
|
124
|
+
var fields = getCollectionFields(collectionField.target);
|
|
125
|
+
var targetField = fields.find(function (f) {
|
|
126
|
+
return f.foreignKey && f.foreignKey === collectionField.foreignKey;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (targetField) {
|
|
130
|
+
if (record === null || record === void 0 ? void 0 : record[collectionField.foreignKey]) {
|
|
131
|
+
params['filter'] = {
|
|
132
|
+
$or: [_defineProperty({}, "".concat(targetField.name, ".").concat(targetField.foreignKey), {
|
|
133
|
+
$is: null
|
|
134
|
+
}), _defineProperty({}, "".concat(targetField.name, ".").concat(targetField.foreignKey), {
|
|
135
|
+
$eq: record === null || record === void 0 ? void 0 : record[collectionField.foreignKey]
|
|
136
|
+
})]
|
|
137
|
+
};
|
|
138
|
+
} else {
|
|
139
|
+
params['filter'] = _defineProperty({}, "".concat(targetField.name, ".").concat(targetField.foreignKey), {
|
|
140
|
+
$is: null
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
117
145
|
}
|
|
118
146
|
|
|
119
147
|
return /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -166,14 +194,14 @@ var useTableSelectorProps = function useTableSelectorProps() {
|
|
|
166
194
|
ctx.field.data = (ctx === null || ctx === void 0 ? void 0 : (_ctx$field2 = ctx.field) === null || _ctx$field2 === void 0 ? void 0 : _ctx$field2.data) || {};
|
|
167
195
|
ctx.field.data.selectedRowKeys = selectedRowKeys;
|
|
168
196
|
},
|
|
169
|
-
onRowDragEnd: function onRowDragEnd(
|
|
197
|
+
onRowDragEnd: function onRowDragEnd(_ref5) {
|
|
170
198
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
171
199
|
var from, to;
|
|
172
200
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
173
201
|
while (1) {
|
|
174
202
|
switch (_context.prev = _context.next) {
|
|
175
203
|
case 0:
|
|
176
|
-
from =
|
|
204
|
+
from = _ref5.from, to = _ref5.to;
|
|
177
205
|
_context.next = 3;
|
|
178
206
|
return ctx.resource.move({
|
|
179
207
|
sourceId: from[ctx.rowKey || 'id'],
|
|
@@ -191,11 +219,11 @@ var useTableSelectorProps = function useTableSelectorProps() {
|
|
|
191
219
|
}, _callee);
|
|
192
220
|
}))();
|
|
193
221
|
},
|
|
194
|
-
onChange: function onChange(
|
|
222
|
+
onChange: function onChange(_ref6) {
|
|
195
223
|
var _ctx$service$params;
|
|
196
224
|
|
|
197
|
-
var current =
|
|
198
|
-
pageSize =
|
|
225
|
+
var current = _ref6.current,
|
|
226
|
+
pageSize = _ref6.pageSize;
|
|
199
227
|
ctx.service.run(_objectSpread(_objectSpread({}, (_ctx$service$params = ctx.service.params) === null || _ctx$service$params === void 0 ? void 0 : _ctx$service$params[0]), {}, {
|
|
200
228
|
page: current,
|
|
201
229
|
pageSize: pageSize
|
|
@@ -16,9 +16,15 @@ export declare const useUpdateActionProps: () => {
|
|
|
16
16
|
export declare const useDestroyActionProps: () => {
|
|
17
17
|
onClick(): Promise<void>;
|
|
18
18
|
};
|
|
19
|
+
export declare const useDetailPrintActionProps: () => {
|
|
20
|
+
onClick(): Promise<void>;
|
|
21
|
+
};
|
|
19
22
|
export declare const useBulkDestroyActionProps: () => {
|
|
20
23
|
onClick(): Promise<void>;
|
|
21
24
|
};
|
|
25
|
+
export declare const useRefreshActionProps: () => {
|
|
26
|
+
onClick(): Promise<void>;
|
|
27
|
+
};
|
|
22
28
|
export declare const useDetailsPaginationProps: () => {
|
|
23
29
|
simple: boolean;
|
|
24
30
|
hidden: boolean;
|