@nocobase/client 0.7.0-alpha.80 → 0.7.0-alpha.83
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/acl/ACLProvider.js +10 -15
- package/es/antd-config-provider/index.js +7 -4
- package/es/api-client/APIClient.d.ts +2 -30
- package/es/api-client/APIClient.js +30 -158
- package/es/api-client/hooks/useResource.d.ts +1 -1
- package/es/block-provider/hooks/index.d.ts +3 -0
- package/es/block-provider/hooks/index.js +233 -168
- package/es/collection-manager/Configuration/AddFieldAction.js +27 -9
- package/es/collection-manager/Configuration/EditFieldAction.js +25 -8
- package/es/collection-manager/hooks/useCollection.d.ts +1 -1
- package/es/i18n/i18n.js +3 -3
- package/es/locale/en_US.d.ts +10 -0
- package/es/locale/en_US.js +11 -1
- package/es/locale/index.d.ts +44 -0
- package/es/locale/zh_CN.d.ts +34 -0
- package/es/locale/zh_CN.js +35 -1
- package/es/schema-component/antd/action/Action.Designer.js +33 -13
- package/es/schema-component/antd/action/utils.d.ts +2 -0
- package/es/schema-component/antd/action/utils.js +60 -0
- package/es/schema-component/antd/date-picker/util.d.ts +2 -1
- package/es/schema-component/antd/date-picker/util.js +4 -2
- package/es/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
- package/es/schema-initializer/buttons/FormActionInitializers.js +63 -0
- package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
- package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
- package/es/schema-settings/SchemaSettings.js +48 -16
- package/es/user/CurrentUser.js +1 -1
- package/es/user/LanguageSettings.js +4 -3
- package/es/user/SigninPage.js +3 -14
- package/es/user/SwitchRole.js +2 -26
- package/es/workflow/triggers/collection.js +1 -0
- package/es/workflow/triggers/index.js +2 -0
- package/es/workflow/triggers/schedule.d.ts +25 -0
- package/es/workflow/triggers/schedule.js +531 -0
- package/lib/acl/ACLProvider.js +9 -15
- package/lib/antd-config-provider/index.js +6 -3
- package/lib/api-client/APIClient.d.ts +2 -30
- package/lib/api-client/APIClient.js +26 -160
- package/lib/api-client/hooks/useResource.d.ts +1 -1
- package/lib/block-provider/hooks/index.d.ts +3 -0
- package/lib/block-provider/hooks/index.js +238 -169
- package/lib/collection-manager/Configuration/AddFieldAction.js +27 -9
- package/lib/collection-manager/Configuration/EditFieldAction.js +25 -8
- package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
- package/lib/i18n/i18n.js +3 -3
- package/lib/locale/en_US.d.ts +10 -0
- package/lib/locale/en_US.js +11 -1
- package/lib/locale/index.d.ts +44 -0
- package/lib/locale/zh_CN.d.ts +34 -0
- package/lib/locale/zh_CN.js +35 -1
- package/lib/schema-component/antd/action/Action.Designer.js +34 -13
- package/lib/schema-component/antd/action/utils.d.ts +2 -0
- package/lib/schema-component/antd/action/utils.js +67 -0
- package/lib/schema-component/antd/date-picker/util.d.ts +2 -1
- package/lib/schema-component/antd/date-picker/util.js +6 -1
- package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
- package/lib/schema-initializer/buttons/FormActionInitializers.js +63 -0
- package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
- package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
- package/lib/schema-settings/SchemaSettings.js +49 -16
- package/lib/user/CurrentUser.js +1 -1
- package/lib/user/LanguageSettings.js +4 -3
- package/lib/user/SigninPage.js +3 -14
- package/lib/user/SwitchRole.js +2 -27
- package/lib/workflow/triggers/collection.js +1 -0
- package/lib/workflow/triggers/index.js +3 -0
- package/lib/workflow/triggers/schedule.d.ts +25 -0
- package/lib/workflow/triggers/schedule.js +554 -0
- package/package.json +4 -3
- package/src/acl/ACLProvider.tsx +4 -5
- package/src/antd-config-provider/index.tsx +4 -2
- package/src/api-client/APIClient.ts +2 -120
- package/src/block-provider/hooks/index.ts +106 -69
- package/src/collection-manager/Configuration/AddFieldAction.tsx +18 -0
- package/src/collection-manager/Configuration/EditFieldAction.tsx +19 -0
- package/src/i18n/i18n.ts +3 -3
- package/src/locale/en_US.ts +11 -1
- package/src/locale/zh_CN.ts +39 -1
- package/src/schema-component/antd/action/Action.Designer.tsx +33 -1
- package/src/schema-component/antd/action/utils.ts +68 -0
- package/src/schema-component/antd/date-picker/util.ts +4 -3
- package/src/schema-initializer/SchemaInitializer.tsx +2 -2
- package/src/schema-initializer/buttons/FormActionInitializers.tsx +66 -0
- package/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx +22 -0
- package/src/schema-initializer/buttons/TableActionColumnInitializers.tsx +22 -0
- package/src/schema-settings/SchemaSettings.tsx +40 -29
- package/src/user/CurrentUser.tsx +1 -1
- package/src/user/LanguageSettings.tsx +1 -0
- package/src/user/SigninPage.tsx +2 -7
- package/src/user/SwitchRole.tsx +2 -6
- package/src/workflow/triggers/collection.tsx +1 -1
- package/src/workflow/triggers/index.tsx +2 -0
- package/src/workflow/triggers/schedule.tsx +422 -0
|
@@ -101,6 +101,28 @@ export const FormActionInitializers = {
|
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
},
|
|
104
|
+
{
|
|
105
|
+
type: 'item',
|
|
106
|
+
title: '{{t("Custom request")}}',
|
|
107
|
+
component: 'CustomizeActionInitializer',
|
|
108
|
+
schema: {
|
|
109
|
+
title: '{{ t("Custom request") }}',
|
|
110
|
+
'x-component': 'Action',
|
|
111
|
+
'x-action': 'customize:form:request',
|
|
112
|
+
'x-designer': 'Action.Designer',
|
|
113
|
+
'x-action-settings': {
|
|
114
|
+
requestSettings: {},
|
|
115
|
+
onSuccess: {
|
|
116
|
+
manualClose: false,
|
|
117
|
+
redirecting: false,
|
|
118
|
+
successMessage: '{{t("Request success")}}',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
'x-component-props': {
|
|
122
|
+
useProps: '{{ useCustomizeRequestActionProps }}',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
104
126
|
],
|
|
105
127
|
},
|
|
106
128
|
],
|
|
@@ -208,6 +230,28 @@ export const CreateFormActionInitializers = {
|
|
|
208
230
|
},
|
|
209
231
|
},
|
|
210
232
|
},
|
|
233
|
+
{
|
|
234
|
+
type: 'item',
|
|
235
|
+
title: '{{t("Custom request")}}',
|
|
236
|
+
component: 'CustomizeActionInitializer',
|
|
237
|
+
schema: {
|
|
238
|
+
title: '{{ t("Custom request") }}',
|
|
239
|
+
'x-component': 'Action',
|
|
240
|
+
'x-action': 'customize:form:request',
|
|
241
|
+
'x-designer': 'Action.Designer',
|
|
242
|
+
'x-action-settings': {
|
|
243
|
+
requestSettings: {},
|
|
244
|
+
onSuccess: {
|
|
245
|
+
manualClose: false,
|
|
246
|
+
redirecting: false,
|
|
247
|
+
successMessage: '{{t("Request success")}}',
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
'x-component-props': {
|
|
251
|
+
useProps: '{{ useCustomizeRequestActionProps }}',
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
},
|
|
211
255
|
],
|
|
212
256
|
},
|
|
213
257
|
],
|
|
@@ -315,6 +359,28 @@ export const UpdateFormActionInitializers = {
|
|
|
315
359
|
},
|
|
316
360
|
},
|
|
317
361
|
},
|
|
362
|
+
{
|
|
363
|
+
type: 'item',
|
|
364
|
+
title: '{{t("Custom request")}}',
|
|
365
|
+
component: 'CustomizeActionInitializer',
|
|
366
|
+
schema: {
|
|
367
|
+
title: '{{ t("Custom request") }}',
|
|
368
|
+
'x-component': 'Action',
|
|
369
|
+
'x-action': 'customize:form:request',
|
|
370
|
+
'x-designer': 'Action.Designer',
|
|
371
|
+
'x-action-settings': {
|
|
372
|
+
requestSettings: {},
|
|
373
|
+
onSuccess: {
|
|
374
|
+
manualClose: false,
|
|
375
|
+
redirecting: false,
|
|
376
|
+
successMessage: '{{t("Request success")}}',
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
'x-component-props': {
|
|
380
|
+
useProps: '{{ useCustomizeRequestActionProps }}',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
318
384
|
],
|
|
319
385
|
},
|
|
320
386
|
],
|
|
@@ -113,6 +113,28 @@ export const ReadPrettyFormActionInitializers = {
|
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
|
+
{
|
|
117
|
+
type: 'item',
|
|
118
|
+
title: '{{t("Custom request")}}',
|
|
119
|
+
component: 'CustomizeActionInitializer',
|
|
120
|
+
schema: {
|
|
121
|
+
title: '{{ t("Custom request") }}',
|
|
122
|
+
'x-component': 'Action',
|
|
123
|
+
'x-action': 'customize:form:request',
|
|
124
|
+
'x-designer': 'Action.Designer',
|
|
125
|
+
'x-action-settings': {
|
|
126
|
+
requestSettings: {},
|
|
127
|
+
onSuccess: {
|
|
128
|
+
manualClose: false,
|
|
129
|
+
redirecting: false,
|
|
130
|
+
successMessage: '{{t("Request success")}}',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
'x-component-props': {
|
|
134
|
+
useProps: '{{ useCustomizeRequestActionProps }}',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
116
138
|
],
|
|
117
139
|
},
|
|
118
140
|
],
|
|
@@ -149,6 +149,28 @@ export const TableActionColumnInitializers = (props: any) => {
|
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
151
|
},
|
|
152
|
+
{
|
|
153
|
+
type: 'item',
|
|
154
|
+
title: '{{t("Custom request")}}',
|
|
155
|
+
component: 'CustomizeActionInitializer',
|
|
156
|
+
schema: {
|
|
157
|
+
title: '{{ t("Custom request") }}',
|
|
158
|
+
'x-component': 'Action.Link',
|
|
159
|
+
'x-action': 'customize:table:request',
|
|
160
|
+
'x-designer': 'Action.Designer',
|
|
161
|
+
'x-action-settings': {
|
|
162
|
+
requestSettings: {},
|
|
163
|
+
onSuccess: {
|
|
164
|
+
manualClose: false,
|
|
165
|
+
redirecting: false,
|
|
166
|
+
successMessage: '{{t("Request success")}}',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
'x-component-props': {
|
|
170
|
+
useProps: '{{ useCustomizeRequestActionProps }}',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
152
174
|
],
|
|
153
175
|
},
|
|
154
176
|
]}
|
|
@@ -7,6 +7,7 @@ import { Alert, Button, Dropdown, Menu, MenuItemProps, Modal, Select, Space, Swi
|
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { cloneDeep } from 'lodash';
|
|
9
9
|
import React, { createContext, useContext, useMemo, useState } from 'react';
|
|
10
|
+
import { createPortal } from 'react-dom';
|
|
10
11
|
import { useTranslation } from 'react-i18next';
|
|
11
12
|
import {
|
|
12
13
|
ActionContext,
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
useActionContext,
|
|
20
21
|
useAPIClient,
|
|
21
22
|
useCollection,
|
|
22
|
-
useCompile
|
|
23
|
+
useCompile,
|
|
23
24
|
} from '..';
|
|
24
25
|
import { useSchemaTemplateManager } from '../schema-templates';
|
|
25
26
|
import { useBlockTemplateContext } from '../schema-templates/BlockTemplate';
|
|
@@ -466,7 +467,7 @@ SchemaSettings.PopupItem = (props) => {
|
|
|
466
467
|
};
|
|
467
468
|
|
|
468
469
|
SchemaSettings.ActionModalItem = React.memo((props: any) => {
|
|
469
|
-
const { title, onSubmit, initialValues, initialSchema, modalTip, ...others } = props;
|
|
470
|
+
const { title, onSubmit, initialValues, initialSchema, schema, modalTip, components, ...others } = props;
|
|
470
471
|
const [visible, setVisible] = useState(false);
|
|
471
472
|
const [schemaUid, setSchemaUid] = useState<string>(props.uid);
|
|
472
473
|
const { t } = useTranslation();
|
|
@@ -487,13 +488,14 @@ SchemaSettings.ActionModalItem = React.memo((props: any) => {
|
|
|
487
488
|
setVisible(false);
|
|
488
489
|
};
|
|
489
490
|
|
|
490
|
-
const submitHandler = () => {
|
|
491
|
+
const submitHandler = async () => {
|
|
492
|
+
await form.submit();
|
|
491
493
|
onSubmit?.(cloneDeep(form.values));
|
|
492
494
|
setVisible(false);
|
|
493
495
|
};
|
|
494
496
|
|
|
495
497
|
const openAssignedFieldValueHandler = async () => {
|
|
496
|
-
if (!schemaUid && initialSchema['x-uid']) {
|
|
498
|
+
if (!schemaUid && initialSchema?.['x-uid']) {
|
|
497
499
|
fieldSchema['x-action-settings'].schemaUid = initialSchema['x-uid'];
|
|
498
500
|
dn.emit('patch', { schema: fieldSchema });
|
|
499
501
|
await api.resource('uiSchemas').insert({ values: initialSchema });
|
|
@@ -509,31 +511,40 @@ SchemaSettings.ActionModalItem = React.memo((props: any) => {
|
|
|
509
511
|
<SchemaSettings.Item {...others} onClick={openAssignedFieldValueHandler}>
|
|
510
512
|
{props.children || props.title}
|
|
511
513
|
</SchemaSettings.Item>
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
514
|
+
{createPortal(
|
|
515
|
+
<div
|
|
516
|
+
onClick={(e) => {
|
|
517
|
+
e.stopPropagation();
|
|
518
|
+
}}
|
|
519
|
+
>
|
|
520
|
+
<Modal
|
|
521
|
+
width={'50%'}
|
|
522
|
+
title={compile(title)}
|
|
523
|
+
{...others}
|
|
524
|
+
destroyOnClose
|
|
525
|
+
visible={visible}
|
|
526
|
+
onCancel={cancelHandler}
|
|
527
|
+
footer={
|
|
528
|
+
<Space>
|
|
529
|
+
<Button onClick={cancelHandler}>{t('Cancel')}</Button>
|
|
530
|
+
<Button type="primary" onClick={submitHandler}>
|
|
531
|
+
{t('Submit')}
|
|
532
|
+
</Button>
|
|
533
|
+
</Space>
|
|
534
|
+
}
|
|
535
|
+
>
|
|
536
|
+
<FormProvider form={form}>
|
|
537
|
+
<FormLayout layout={'vertical'}>
|
|
538
|
+
{modalTip && <Alert message={modalTip} />}
|
|
539
|
+
{modalTip && <br />}
|
|
540
|
+
{visible && schemaUid && <RemoteSchemaComponent noForm components={components} uid={schemaUid} />}
|
|
541
|
+
{visible && schema && <SchemaComponent components={components} schema={schema} />}
|
|
542
|
+
</FormLayout>
|
|
543
|
+
</FormProvider>
|
|
544
|
+
</Modal>
|
|
545
|
+
</div>,
|
|
546
|
+
document.body,
|
|
547
|
+
)}
|
|
537
548
|
</>
|
|
538
549
|
);
|
|
539
550
|
});
|
package/src/user/CurrentUser.tsx
CHANGED
package/src/user/SigninPage.tsx
CHANGED
|
@@ -68,13 +68,8 @@ const useSignin = () => {
|
|
|
68
68
|
return {
|
|
69
69
|
async run() {
|
|
70
70
|
await form.submit();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
if (response?.data?.data?.token) {
|
|
75
|
-
api.setBearerToken(response?.data?.data?.token);
|
|
76
|
-
history.push(redirect || '/admin');
|
|
77
|
-
}
|
|
71
|
+
await api.auth.signIn(form.values);
|
|
72
|
+
history.push(redirect || '/admin');
|
|
78
73
|
},
|
|
79
74
|
};
|
|
80
75
|
};
|
package/src/user/SwitchRole.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useCookieState } from 'ahooks';
|
|
2
1
|
import { Menu, Select } from 'antd';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
@@ -30,9 +29,6 @@ export const SwitchRole = () => {
|
|
|
30
29
|
const api = useAPIClient();
|
|
31
30
|
const roles = useCurrentRoles();
|
|
32
31
|
const { t } = useTranslation();
|
|
33
|
-
const [roleName, setRoleName] = useCookieState('currentRoleName', {
|
|
34
|
-
defaultValue: roles?.find((role) => role.default)?.name,
|
|
35
|
-
});
|
|
36
32
|
if (roles.length <= 1) {
|
|
37
33
|
return null;
|
|
38
34
|
}
|
|
@@ -47,9 +43,9 @@ export const SwitchRole = () => {
|
|
|
47
43
|
value: 'name',
|
|
48
44
|
}}
|
|
49
45
|
options={roles}
|
|
50
|
-
value={
|
|
46
|
+
value={api.auth.role}
|
|
51
47
|
onChange={async (roleName) => {
|
|
52
|
-
|
|
48
|
+
api.auth.setRole(roleName);
|
|
53
49
|
await api.resource('users').setDefaultRole({ values: { roleName } });
|
|
54
50
|
window.location.href = '/';
|
|
55
51
|
}}
|
|
@@ -26,7 +26,7 @@ const FieldsSelect = observer((props) => {
|
|
|
26
26
|
&& (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true)
|
|
27
27
|
))
|
|
28
28
|
.map(field => (
|
|
29
|
-
<Select.Option value={field.name}>{compile(field.uiSchema?.title)}</Select.Option>
|
|
29
|
+
<Select.Option key={field.name} value={field.name}>{compile(field.uiSchema?.title)}</Select.Option>
|
|
30
30
|
))}
|
|
31
31
|
</Select>
|
|
32
32
|
);
|
|
@@ -8,6 +8,7 @@ import { message, Tag } from "antd";
|
|
|
8
8
|
import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRecord, useRequest, useResourceActionContext } from '../../';
|
|
9
9
|
import collection from './collection';
|
|
10
10
|
import { nodeCardClass, nodeMetaClass } from "../style";
|
|
11
|
+
import schedule from "./schedule";
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
function useUpdateConfigAction() {
|
|
@@ -50,6 +51,7 @@ export interface Trigger {
|
|
|
50
51
|
export const triggers = new Registry<Trigger>();
|
|
51
52
|
|
|
52
53
|
triggers.register(collection.type, collection);
|
|
54
|
+
triggers.register(schedule.type, schedule);
|
|
53
55
|
|
|
54
56
|
export const TriggerConfig = () => {
|
|
55
57
|
const { t } = useTranslation();
|