@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
|
@@ -51,6 +51,11 @@ import { BlockTemplateDetails, BlockTemplatePage, SchemaTemplateShortcut } from
|
|
|
51
51
|
import { SystemSettingsProvider, SystemSettingsShortcut } from '../system-settings';
|
|
52
52
|
import { SigninPage, SignupPage } from '../user';
|
|
53
53
|
import { compose } from './compose';
|
|
54
|
+
export var getCurrentTimezone = function getCurrentTimezone() {
|
|
55
|
+
var timezoneOffset = new Date().getTimezoneOffset() / -60;
|
|
56
|
+
var timezone = String(timezoneOffset).padStart(2, '0') + ':00';
|
|
57
|
+
return (timezoneOffset > 0 ? '+' : '-') + timezone;
|
|
58
|
+
};
|
|
54
59
|
export var Application = /*#__PURE__*/function () {
|
|
55
60
|
function Application(options) {
|
|
56
61
|
var _window, _window$location;
|
|
@@ -65,7 +70,8 @@ export var Application = /*#__PURE__*/function () {
|
|
|
65
70
|
this.apiClient = new APIClient(_objectSpread({
|
|
66
71
|
baseURL: process.env.API_BASE_URL,
|
|
67
72
|
headers: {
|
|
68
|
-
'X-Hostname': (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname
|
|
73
|
+
'X-Hostname': (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname,
|
|
74
|
+
'X-Timezone': getCurrentTimezone()
|
|
69
75
|
}
|
|
70
76
|
}, options.apiClient));
|
|
71
77
|
this.i18n = options.i18n || i18n;
|
|
@@ -7,7 +7,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
import { createForm } from '@formily/core';
|
|
8
8
|
import { useField } from '@formily/react';
|
|
9
9
|
import { Spin } from 'antd';
|
|
10
|
-
import React, { createContext, useContext, useEffect, useMemo } from 'react';
|
|
10
|
+
import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react';
|
|
11
11
|
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
|
12
12
|
export var FormBlockContext = /*#__PURE__*/createContext({});
|
|
13
13
|
|
|
@@ -25,6 +25,8 @@ var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
|
|
|
25
25
|
resource = _useBlockRequestConte.resource,
|
|
26
26
|
service = _useBlockRequestConte.service;
|
|
27
27
|
|
|
28
|
+
var formBlockRef = useRef();
|
|
29
|
+
|
|
28
30
|
if (service.loading) {
|
|
29
31
|
return /*#__PURE__*/React.createElement(Spin, null);
|
|
30
32
|
}
|
|
@@ -36,9 +38,12 @@ var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
|
|
|
36
38
|
field: field,
|
|
37
39
|
service: service,
|
|
38
40
|
resource: resource,
|
|
39
|
-
updateAssociationValues: []
|
|
41
|
+
updateAssociationValues: [],
|
|
42
|
+
formBlockRef: formBlockRef
|
|
40
43
|
}
|
|
41
|
-
},
|
|
44
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
ref: formBlockRef
|
|
46
|
+
}, props.children));
|
|
42
47
|
};
|
|
43
48
|
|
|
44
49
|
export var FormBlockProvider = function FormBlockProvider(props) {
|
|
@@ -14,7 +14,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
14
14
|
|
|
15
15
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
16
|
|
|
17
|
-
import { useField } from '@formily/react';
|
|
17
|
+
import { useField, useFieldSchema } from '@formily/react';
|
|
18
18
|
import React, { createContext, useContext, useEffect } from 'react';
|
|
19
19
|
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
|
20
20
|
import { useFormBlockContext } from './FormBlockProvider';
|
|
@@ -30,6 +30,7 @@ var InternalTableFieldProvider = function InternalTableFieldProvider(props) {
|
|
|
30
30
|
dragSort = props.dragSort,
|
|
31
31
|
fieldName = props.fieldName;
|
|
32
32
|
var field = useField();
|
|
33
|
+
var fieldSchema = useFieldSchema();
|
|
33
34
|
|
|
34
35
|
var _useBlockRequestConte = useBlockRequestContext(),
|
|
35
36
|
resource = _useBlockRequestConte.resource,
|
|
@@ -51,6 +52,7 @@ var InternalTableFieldProvider = function InternalTableFieldProvider(props) {
|
|
|
51
52
|
return /*#__PURE__*/React.createElement(TableFieldContext.Provider, {
|
|
52
53
|
value: {
|
|
53
54
|
field: field,
|
|
55
|
+
fieldSchema: fieldSchema,
|
|
54
56
|
service: service,
|
|
55
57
|
resource: resource,
|
|
56
58
|
params: params,
|
|
@@ -277,7 +279,7 @@ export var useTableFieldContext = function useTableFieldContext() {
|
|
|
277
279
|
return useContext(TableFieldContext);
|
|
278
280
|
};
|
|
279
281
|
export var useTableFieldProps = function useTableFieldProps() {
|
|
280
|
-
var _ctx$service3, _ctx$service4;
|
|
282
|
+
var _ctx$service3, _ctx$service4, _ctx$fieldSchema, _ctx$fieldSchema$pare;
|
|
281
283
|
|
|
282
284
|
var field = useField();
|
|
283
285
|
var ctx = useTableFieldContext();
|
|
@@ -298,6 +300,7 @@ export var useTableFieldProps = function useTableFieldProps() {
|
|
|
298
300
|
showIndex: ctx.showIndex,
|
|
299
301
|
dragSort: ctx.dragSort,
|
|
300
302
|
pagination: false,
|
|
303
|
+
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,
|
|
301
304
|
rowKey: function rowKey(record) {
|
|
302
305
|
var _field$value, _field$value$indexOf;
|
|
303
306
|
|
|
@@ -62,7 +62,8 @@ export var TableSelectorProvider = function TableSelectorProvider(props) {
|
|
|
62
62
|
var ctx = useFormBlockContext();
|
|
63
63
|
|
|
64
64
|
var _useCollectionManager2 = useCollectionManager(),
|
|
65
|
-
getCollectionJoinField = _useCollectionManager2.getCollectionJoinField
|
|
65
|
+
getCollectionJoinField = _useCollectionManager2.getCollectionJoinField,
|
|
66
|
+
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
66
67
|
|
|
67
68
|
var record = useRecord();
|
|
68
69
|
var collectionFieldSchema = recursiveParent(fieldSchema, 'CollectionField'); // const value = ctx.form.query(collectionFieldSchema?.name).value();
|
|
@@ -84,16 +85,43 @@ export var TableSelectorProvider = function TableSelectorProvider(props) {
|
|
|
84
85
|
|
|
85
86
|
if (collectionField) {
|
|
86
87
|
if (['oho', 'o2m'].includes(collectionField.interface)) {
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
if (record === null || record === void 0 ? void 0 : record[collectionField.sourceKey]) {
|
|
89
|
+
params['filter'] = {
|
|
90
|
+
$or: [_defineProperty({}, collectionField.foreignKey, {
|
|
91
|
+
$is: null
|
|
92
|
+
}), _defineProperty({}, collectionField.foreignKey, {
|
|
93
|
+
$eq: record === null || record === void 0 ? void 0 : record[collectionField.sourceKey]
|
|
94
|
+
})]
|
|
95
|
+
};
|
|
96
|
+
} else {
|
|
97
|
+
params['filter'] = _defineProperty({}, collectionField.foreignKey, {
|
|
89
98
|
$is: null
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
})]
|
|
93
|
-
};
|
|
99
|
+
});
|
|
100
|
+
}
|
|
94
101
|
}
|
|
95
102
|
|
|
96
|
-
if (['obo'].includes(collectionField.interface)) {
|
|
103
|
+
if (['obo'].includes(collectionField.interface)) {
|
|
104
|
+
var fields = getCollectionFields(collectionField.target);
|
|
105
|
+
var targetField = fields.find(function (f) {
|
|
106
|
+
return f.foreignKey && f.foreignKey === collectionField.foreignKey;
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (targetField) {
|
|
110
|
+
if (record === null || record === void 0 ? void 0 : record[collectionField.foreignKey]) {
|
|
111
|
+
params['filter'] = {
|
|
112
|
+
$or: [_defineProperty({}, "".concat(targetField.name, ".").concat(targetField.foreignKey), {
|
|
113
|
+
$is: null
|
|
114
|
+
}), _defineProperty({}, "".concat(targetField.name, ".").concat(targetField.foreignKey), {
|
|
115
|
+
$eq: record === null || record === void 0 ? void 0 : record[collectionField.foreignKey]
|
|
116
|
+
})]
|
|
117
|
+
};
|
|
118
|
+
} else {
|
|
119
|
+
params['filter'] = _defineProperty({}, "".concat(targetField.name, ".").concat(targetField.foreignKey), {
|
|
120
|
+
$is: null
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
97
125
|
}
|
|
98
126
|
|
|
99
127
|
return /*#__PURE__*/React.createElement(BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -140,14 +168,14 @@ export var useTableSelectorProps = function useTableSelectorProps() {
|
|
|
140
168
|
ctx.field.data = (ctx === null || ctx === void 0 ? void 0 : (_ctx$field2 = ctx.field) === null || _ctx$field2 === void 0 ? void 0 : _ctx$field2.data) || {};
|
|
141
169
|
ctx.field.data.selectedRowKeys = selectedRowKeys;
|
|
142
170
|
},
|
|
143
|
-
onRowDragEnd: function onRowDragEnd(
|
|
171
|
+
onRowDragEnd: function onRowDragEnd(_ref5) {
|
|
144
172
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
145
173
|
var from, to;
|
|
146
174
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
147
175
|
while (1) {
|
|
148
176
|
switch (_context.prev = _context.next) {
|
|
149
177
|
case 0:
|
|
150
|
-
from =
|
|
178
|
+
from = _ref5.from, to = _ref5.to;
|
|
151
179
|
_context.next = 3;
|
|
152
180
|
return ctx.resource.move({
|
|
153
181
|
sourceId: from[ctx.rowKey || 'id'],
|
|
@@ -165,11 +193,11 @@ export var useTableSelectorProps = function useTableSelectorProps() {
|
|
|
165
193
|
}, _callee);
|
|
166
194
|
}))();
|
|
167
195
|
},
|
|
168
|
-
onChange: function onChange(
|
|
196
|
+
onChange: function onChange(_ref6) {
|
|
169
197
|
var _ctx$service$params;
|
|
170
198
|
|
|
171
|
-
var current =
|
|
172
|
-
pageSize =
|
|
199
|
+
var current = _ref6.current,
|
|
200
|
+
pageSize = _ref6.pageSize;
|
|
173
201
|
ctx.service.run(_objectSpread(_objectSpread({}, (_ctx$service$params = ctx.service.params) === null || _ctx$service$params === void 0 ? void 0 : _ctx$service$params[0]), {}, {
|
|
174
202
|
page: current,
|
|
175
203
|
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;
|