@nocobase/client 0.7.4-alpha.7 → 0.7.5-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/block-provider/TableBlockProvider.js +3 -3
- package/es/collection-manager/Configuration/AddFieldAction.js +38 -41
- package/es/collection-manager/Configuration/EditFieldAction.js +64 -41
- package/es/collection-manager/interfaces/email.js +4 -2
- package/es/collection-manager/interfaces/formula.js +1 -1
- package/es/collection-manager/interfaces/index.d.ts +1 -0
- package/es/collection-manager/interfaces/index.js +1 -0
- package/es/collection-manager/interfaces/input.js +4 -2
- package/es/collection-manager/interfaces/integer.js +4 -2
- package/es/collection-manager/interfaces/m2m.js +2 -2
- package/es/collection-manager/interfaces/m2o.js +7 -3
- package/es/collection-manager/interfaces/number.js +3 -2
- package/es/collection-manager/interfaces/o2m.js +8 -4
- package/es/collection-manager/interfaces/o2o.js +19 -6
- package/es/collection-manager/interfaces/password.js +4 -2
- package/es/collection-manager/interfaces/percent.js +2 -1
- package/es/collection-manager/interfaces/phone.js +4 -2
- package/es/collection-manager/interfaces/properties/index.d.ts +7 -0
- package/es/collection-manager/interfaces/properties/index.js +91 -0
- package/es/collection-manager/interfaces/sequence.d.ts +2 -0
- package/es/collection-manager/interfaces/sequence.js +431 -0
- package/es/locale/en_US.d.ts +1 -0
- package/es/locale/en_US.js +2 -1
- package/es/locale/index.js +24 -0
- package/es/locale/ja_JP.d.ts +590 -0
- package/es/locale/ja_JP.js +591 -0
- package/es/locale/ru_RU.d.ts +560 -0
- package/es/locale/ru_RU.js +559 -0
- package/es/locale/zh_CN.d.ts +27 -0
- package/es/locale/zh_CN.js +30 -3
- package/es/route-switch/antd/admin-layout/index.js +19 -4
- package/es/schema-component/antd/action/Action.js +3 -1
- package/es/schema-component/antd/action/ActionBar.js +8 -1
- package/es/schema-component/antd/cron/Cron.d.ts +6 -0
- package/es/schema-component/antd/cron/Cron.js +49 -0
- package/es/schema-component/antd/cron/index.d.ts +1 -0
- package/es/schema-component/antd/cron/index.js +1 -0
- package/es/schema-component/antd/cron/locale/zh-CN.d.ts +34 -0
- package/es/schema-component/antd/cron/locale/zh-CN.js +37 -0
- package/es/schema-component/antd/filter/Filter.Action.Designer.js +1 -0
- package/es/schema-component/antd/formula-input/Compute.js +1 -1
- package/es/schema-component/antd/grid/Grid.js +134 -25
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.js +1 -0
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +4 -2
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -2
- package/es/schema-component/antd/record-picker/util.d.ts +5 -0
- package/es/schema-component/antd/record-picker/util.js +37 -0
- package/es/schema-component/antd/upload/shared.js +6 -2
- package/es/schema-component/common/dnd-context/index.js +30 -4
- package/es/schema-component/hooks/useDesignable.d.ts +2 -2
- package/es/schema-component/hooks/useDesignable.js +130 -26
- package/es/schema-initializer/SchemaInitializer.d.ts +1 -0
- package/es/schema-initializer/SchemaInitializer.js +6 -2
- package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +2 -1
- package/es/schema-initializer/buttons/TabPaneInitializers.js +9 -3
- package/es/schema-initializer/items/ActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/ActionInitializer.js +13 -0
- package/es/schema-initializer/items/BlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/BlockInitializer.js +18 -0
- package/es/schema-initializer/items/BulkDestroyActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/BulkDestroyActionInitializer.js +27 -0
- package/es/schema-initializer/items/CalendarBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CalendarBlockInitializer.js +124 -0
- package/es/schema-initializer/items/CollectionFieldInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CollectionFieldInitializer.js +15 -0
- package/es/schema-initializer/items/CreateActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CreateActionInitializer.js +60 -0
- package/es/schema-initializer/items/CreateFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CreateFormBlockInitializer.js +102 -0
- package/es/schema-initializer/items/CreateSubmitActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CreateSubmitActionInitializer.js +24 -0
- package/es/schema-initializer/items/CustomizeActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/CustomizeActionInitializer.js +11 -0
- package/es/schema-initializer/items/DataBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/DataBlockInitializer.js +88 -0
- package/es/schema-initializer/items/DestroyActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/DestroyActionInitializer.js +27 -0
- package/es/schema-initializer/items/DetailsBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/DetailsBlockInitializer.js +55 -0
- package/es/schema-initializer/items/FilterActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/FilterActionInitializer.js +24 -0
- package/es/schema-initializer/items/FormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/FormBlockInitializer.js +30 -0
- package/es/schema-initializer/items/G2PlotInitializer.d.ts +1 -0
- package/es/schema-initializer/items/G2PlotInitializer.js +25 -0
- package/es/schema-initializer/items/InitializerWithSwitch.d.ts +1 -0
- package/es/schema-initializer/items/InitializerWithSwitch.js +32 -0
- package/es/schema-initializer/items/KanbanBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/KanbanBlockInitializer.js +138 -0
- package/es/schema-initializer/items/MarkdownBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/MarkdownBlockInitializer.js +32 -0
- package/es/schema-initializer/items/PrintActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/PrintActionInitializer.js +23 -0
- package/es/schema-initializer/items/RecordAssociationBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationBlockInitializer.js +90 -0
- package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +160 -0
- package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +90 -0
- package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordAssociationFormBlockInitializer.js +112 -0
- package/es/schema-initializer/items/RecordFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordFormBlockInitializer.js +109 -0
- package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +116 -0
- package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +114 -0
- package/es/schema-initializer/items/RefreshActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/RefreshActionInitializer.js +23 -0
- package/es/schema-initializer/items/SubmitActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/SubmitActionInitializer.js +24 -0
- package/es/schema-initializer/items/TableActionColumnInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableActionColumnInitializer.js +34 -0
- package/es/schema-initializer/items/TableBlockInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableBlockInitializer.js +55 -0
- package/es/schema-initializer/items/TableCollectionFieldInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableCollectionFieldInitializer.js +15 -0
- package/es/schema-initializer/items/TableSelectorInitializer.d.ts +1 -0
- package/es/schema-initializer/items/TableSelectorInitializer.js +67 -0
- package/es/schema-initializer/items/UpdateActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/UpdateActionInitializer.js +59 -0
- package/es/schema-initializer/items/UpdateSubmitActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/UpdateSubmitActionInitializer.js +24 -0
- package/es/schema-initializer/items/ViewActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/ViewActionInitializer.js +58 -0
- package/es/schema-initializer/items/index.d.ts +35 -35
- package/es/schema-initializer/items/index.js +35 -1589
- package/es/schema-initializer/style.less +4 -0
- package/es/schema-templates/SchemaTemplateManagerProvider.js +2 -5
- package/es/system-settings/SystemSettingsShortcut.js +7 -0
- package/es/user/SigninPage.d.ts +11 -2
- package/es/user/SigninPage.js +140 -33
- package/es/user/SignupPage.d.ts +7 -1
- package/es/user/SignupPage.js +54 -10
- package/es/user/VerificationCode.d.ts +7 -0
- package/es/user/VerificationCode.js +129 -0
- package/lib/block-provider/TableBlockProvider.js +3 -3
- package/lib/collection-manager/Configuration/AddFieldAction.js +38 -40
- package/lib/collection-manager/Configuration/EditFieldAction.js +65 -40
- package/lib/collection-manager/interfaces/email.js +3 -1
- package/lib/collection-manager/interfaces/formula.js +1 -1
- package/lib/collection-manager/interfaces/index.d.ts +1 -0
- package/lib/collection-manager/interfaces/index.js +13 -0
- package/lib/collection-manager/interfaces/input.js +3 -1
- package/lib/collection-manager/interfaces/integer.js +3 -1
- package/lib/collection-manager/interfaces/m2m.js +1 -1
- package/lib/collection-manager/interfaces/m2o.js +6 -2
- package/lib/collection-manager/interfaces/number.js +4 -3
- package/lib/collection-manager/interfaces/o2m.js +7 -3
- package/lib/collection-manager/interfaces/o2o.js +18 -5
- package/lib/collection-manager/interfaces/password.js +3 -1
- package/lib/collection-manager/interfaces/percent.js +1 -0
- package/lib/collection-manager/interfaces/phone.js +3 -1
- package/lib/collection-manager/interfaces/properties/index.d.ts +7 -0
- package/lib/collection-manager/interfaces/properties/index.js +94 -1
- package/lib/collection-manager/interfaces/sequence.d.ts +2 -0
- package/lib/collection-manager/interfaces/sequence.js +455 -0
- package/lib/locale/en_US.d.ts +1 -0
- package/lib/locale/en_US.js +2 -1
- package/lib/locale/index.js +28 -0
- package/lib/locale/ja_JP.d.ts +590 -0
- package/lib/locale/ja_JP.js +598 -0
- package/lib/locale/ru_RU.d.ts +560 -0
- package/lib/locale/ru_RU.js +566 -0
- package/lib/locale/zh_CN.d.ts +27 -0
- package/lib/locale/zh_CN.js +30 -3
- package/lib/route-switch/antd/admin-layout/index.js +19 -4
- package/lib/schema-component/antd/action/Action.js +2 -0
- package/lib/schema-component/antd/action/ActionBar.js +9 -1
- package/lib/schema-component/antd/cron/Cron.d.ts +6 -0
- package/lib/schema-component/antd/cron/Cron.js +67 -0
- package/lib/schema-component/antd/cron/index.d.ts +1 -0
- package/lib/schema-component/antd/cron/index.js +18 -0
- package/lib/schema-component/antd/cron/locale/zh-CN.d.ts +34 -0
- package/lib/schema-component/antd/cron/locale/zh-CN.js +44 -0
- package/lib/schema-component/antd/filter/Filter.Action.Designer.js +1 -0
- package/lib/schema-component/antd/formula-input/Compute.js +1 -1
- package/lib/schema-component/antd/grid/Grid.js +132 -23
- package/lib/schema-component/antd/index.d.ts +1 -0
- package/lib/schema-component/antd/index.js +13 -0
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +5 -2
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +6 -2
- package/lib/schema-component/antd/record-picker/util.d.ts +5 -0
- package/lib/schema-component/antd/record-picker/util.js +55 -0
- package/lib/schema-component/antd/upload/shared.js +5 -1
- package/lib/schema-component/common/dnd-context/index.js +35 -5
- package/lib/schema-component/hooks/useDesignable.d.ts +2 -2
- package/lib/schema-component/hooks/useDesignable.js +132 -28
- package/lib/schema-initializer/SchemaInitializer.d.ts +1 -0
- package/lib/schema-initializer/SchemaInitializer.js +7 -2
- package/lib/schema-initializer/buttons/TabPaneInitializers.d.ts +2 -1
- package/lib/schema-initializer/buttons/TabPaneInitializers.js +13 -4
- package/lib/schema-initializer/items/ActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/ActionInitializer.js +26 -0
- package/lib/schema-initializer/items/BlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/BlockInitializer.js +31 -0
- package/lib/schema-initializer/items/BulkDestroyActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/BulkDestroyActionInitializer.js +40 -0
- package/lib/schema-initializer/items/CalendarBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CalendarBlockInitializer.js +148 -0
- package/lib/schema-initializer/items/CollectionFieldInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CollectionFieldInitializer.js +28 -0
- package/lib/schema-initializer/items/CreateActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CreateActionInitializer.js +73 -0
- package/lib/schema-initializer/items/CreateFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CreateFormBlockInitializer.js +120 -0
- package/lib/schema-initializer/items/CreateSubmitActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CreateSubmitActionInitializer.js +37 -0
- package/lib/schema-initializer/items/CustomizeActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/CustomizeActionInitializer.js +24 -0
- package/lib/schema-initializer/items/DataBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/DataBlockInitializer.js +104 -0
- package/lib/schema-initializer/items/DestroyActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/DestroyActionInitializer.js +40 -0
- package/lib/schema-initializer/items/DetailsBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/DetailsBlockInitializer.js +71 -0
- package/lib/schema-initializer/items/FilterActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/FilterActionInitializer.js +37 -0
- package/lib/schema-initializer/items/FormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/FormBlockInitializer.js +45 -0
- package/lib/schema-initializer/items/G2PlotInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/G2PlotInitializer.js +38 -0
- package/lib/schema-initializer/items/InitializerWithSwitch.d.ts +1 -0
- package/lib/schema-initializer/items/InitializerWithSwitch.js +47 -0
- package/lib/schema-initializer/items/KanbanBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/KanbanBlockInitializer.js +163 -0
- package/lib/schema-initializer/items/MarkdownBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/MarkdownBlockInitializer.js +47 -0
- package/lib/schema-initializer/items/PrintActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/PrintActionInitializer.js +36 -0
- package/lib/schema-initializer/items/RecordAssociationBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationBlockInitializer.js +107 -0
- package/lib/schema-initializer/items/RecordAssociationCalendarBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationCalendarBlockInitializer.js +185 -0
- package/lib/schema-initializer/items/RecordAssociationDetailsBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationDetailsBlockInitializer.js +107 -0
- package/lib/schema-initializer/items/RecordAssociationFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordAssociationFormBlockInitializer.js +128 -0
- package/lib/schema-initializer/items/RecordFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordFormBlockInitializer.js +127 -0
- package/lib/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordReadPrettyAssociationFormBlockInitializer.js +133 -0
- package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RecordReadPrettyFormBlockInitializer.js +132 -0
- package/lib/schema-initializer/items/RefreshActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/RefreshActionInitializer.js +36 -0
- package/lib/schema-initializer/items/SubmitActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/SubmitActionInitializer.js +37 -0
- package/lib/schema-initializer/items/TableActionColumnInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableActionColumnInitializer.js +47 -0
- package/lib/schema-initializer/items/TableBlockInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableBlockInitializer.js +71 -0
- package/lib/schema-initializer/items/TableCollectionFieldInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableCollectionFieldInitializer.js +28 -0
- package/lib/schema-initializer/items/TableSelectorInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/TableSelectorInitializer.js +84 -0
- package/lib/schema-initializer/items/UpdateActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/UpdateActionInitializer.js +72 -0
- package/lib/schema-initializer/items/UpdateSubmitActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/UpdateSubmitActionInitializer.js +37 -0
- package/lib/schema-initializer/items/ViewActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/ViewActionInitializer.js +71 -0
- package/lib/schema-initializer/items/index.d.ts +35 -35
- package/lib/schema-initializer/items/index.js +400 -1659
- package/lib/schema-initializer/style.less +4 -0
- package/lib/schema-templates/SchemaTemplateManagerProvider.js +2 -5
- package/lib/system-settings/SystemSettingsShortcut.js +7 -0
- package/lib/user/SigninPage.d.ts +11 -2
- package/lib/user/SigninPage.js +150 -34
- package/lib/user/SignupPage.d.ts +7 -1
- package/lib/user/SignupPage.js +56 -10
- package/lib/user/VerificationCode.d.ts +7 -0
- package/lib/user/VerificationCode.js +148 -0
- package/package.json +6 -4
|
@@ -100,11 +100,8 @@ var useSchemaTemplate = function useSchemaTemplate() {
|
|
|
100
100
|
|
|
101
101
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
102
102
|
var schemaId = fieldSchema['x-uid'];
|
|
103
|
-
var templateKey = fieldSchema['x-template-key'];
|
|
104
|
-
|
|
105
|
-
schemaId: schemaId,
|
|
106
|
-
templateKey: templateKey
|
|
107
|
-
});
|
|
103
|
+
var templateKey = fieldSchema['x-template-key']; // console.log('templateKey', { schemaId, templateKey })
|
|
104
|
+
|
|
108
105
|
return (0, _react2.useMemo)(function () {
|
|
109
106
|
return getTemplateBySchema(fieldSchema);
|
|
110
107
|
}, [schemaId, templateKey]);
|
|
@@ -217,6 +217,13 @@ var schema = {
|
|
|
217
217
|
'x-component': 'Checkbox',
|
|
218
218
|
'x-decorator': 'FormItem'
|
|
219
219
|
},
|
|
220
|
+
smsAuthEnabled: {
|
|
221
|
+
type: 'boolean',
|
|
222
|
+
default: false,
|
|
223
|
+
'x-content': '{{t("Enable SMS authentication")}}',
|
|
224
|
+
'x-component': 'Checkbox',
|
|
225
|
+
'x-decorator': 'FormItem'
|
|
226
|
+
},
|
|
220
227
|
footer1: {
|
|
221
228
|
type: 'void',
|
|
222
229
|
'x-component': 'Action.Drawer.Footer',
|
package/lib/user/SigninPage.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { ISchema } from '@formily/react';
|
|
2
|
+
export declare const usePasswordSignIn: () => {
|
|
2
3
|
run(): Promise<void>;
|
|
3
4
|
};
|
|
4
|
-
export declare
|
|
5
|
+
export declare function usePhoneSignIn(): {
|
|
6
|
+
run(): Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export interface SigninPageProps {
|
|
9
|
+
schema?: ISchema;
|
|
10
|
+
components?: any;
|
|
11
|
+
scope?: any;
|
|
12
|
+
}
|
|
13
|
+
export declare const SigninPage: (props: SigninPageProps) => JSX.Element;
|
package/lib/user/SigninPage.js
CHANGED
|
@@ -1,29 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.
|
|
8
|
+
exports.usePasswordSignIn = exports.SigninPage = void 0;
|
|
9
|
+
exports.usePhoneSignIn = usePhoneSignIn;
|
|
7
10
|
|
|
8
11
|
var _react = require("@formily/react");
|
|
9
12
|
|
|
10
|
-
var
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
|
|
15
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
11
16
|
|
|
12
|
-
var
|
|
17
|
+
var _reactI18next = require("react-i18next");
|
|
13
18
|
|
|
14
19
|
var _reactRouterDom = require("react-router-dom");
|
|
15
20
|
|
|
16
21
|
var _ = require("..");
|
|
17
22
|
|
|
23
|
+
var _VerificationCode = _interopRequireDefault(require("./VerificationCode"));
|
|
24
|
+
|
|
18
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
26
|
|
|
27
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
|
+
|
|
29
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
|
+
|
|
31
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
|
+
|
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
|
+
|
|
35
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
36
|
+
|
|
20
37
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
38
|
|
|
22
39
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
23
40
|
|
|
24
|
-
var
|
|
41
|
+
var passwordForm = {
|
|
25
42
|
type: 'object',
|
|
26
|
-
name:
|
|
43
|
+
name: 'passwordForm',
|
|
27
44
|
'x-component': 'FormV2',
|
|
28
45
|
properties: {
|
|
29
46
|
email: {
|
|
@@ -59,41 +76,33 @@ var schema = {
|
|
|
59
76
|
htmlType: 'submit',
|
|
60
77
|
block: true,
|
|
61
78
|
type: 'primary',
|
|
62
|
-
useAction: '{{
|
|
79
|
+
useAction: '{{ usePasswordSignIn }}',
|
|
63
80
|
style: {
|
|
64
81
|
width: '100%'
|
|
65
82
|
}
|
|
66
83
|
}
|
|
67
84
|
}
|
|
68
85
|
}
|
|
69
|
-
},
|
|
70
|
-
link: {
|
|
71
|
-
type: 'void',
|
|
72
|
-
'x-component': 'div',
|
|
73
|
-
'x-visible': '{{allowSignUp}}',
|
|
74
|
-
properties: {
|
|
75
|
-
link: {
|
|
76
|
-
title: '{{t("Create an account")}}',
|
|
77
|
-
type: 'void',
|
|
78
|
-
'x-component': 'Link',
|
|
79
|
-
'x-content': '{{t("Create an account")}}',
|
|
80
|
-
'x-component-props': {
|
|
81
|
-
to: '/signup'
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
function useRedirect() {
|
|
90
91
|
var _location$query;
|
|
91
92
|
|
|
93
|
+
var next = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/admin';
|
|
92
94
|
var location = (0, _reactRouterDom.useLocation)();
|
|
93
95
|
var history = (0, _reactRouterDom.useHistory)();
|
|
96
|
+
var redirect = location === null || location === void 0 ? void 0 : (_location$query = location['query']) === null || _location$query === void 0 ? void 0 : _location$query.redirect;
|
|
97
|
+
return (0, _react2.useCallback)(function () {
|
|
98
|
+
history.push(redirect || '/admin');
|
|
99
|
+
}, [redirect]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var usePasswordSignIn = function usePasswordSignIn() {
|
|
94
103
|
var form = (0, _react.useForm)();
|
|
95
104
|
var api = (0, _.useAPIClient)();
|
|
96
|
-
var redirect =
|
|
105
|
+
var redirect = useRedirect();
|
|
97
106
|
return {
|
|
98
107
|
run: function run() {
|
|
99
108
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
@@ -109,7 +118,7 @@ var useSignin = function useSignin() {
|
|
|
109
118
|
return api.auth.signIn(form.values);
|
|
110
119
|
|
|
111
120
|
case 4:
|
|
112
|
-
|
|
121
|
+
redirect();
|
|
113
122
|
|
|
114
123
|
case 5:
|
|
115
124
|
case "end":
|
|
@@ -122,21 +131,128 @@ var useSignin = function useSignin() {
|
|
|
122
131
|
};
|
|
123
132
|
};
|
|
124
133
|
|
|
125
|
-
exports.
|
|
134
|
+
exports.usePasswordSignIn = usePasswordSignIn;
|
|
135
|
+
var phoneForm = {
|
|
136
|
+
type: 'object',
|
|
137
|
+
name: 'phoneForm',
|
|
138
|
+
'x-component': 'Form',
|
|
139
|
+
properties: {
|
|
140
|
+
phone: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
required: true,
|
|
143
|
+
'x-component': 'Input',
|
|
144
|
+
'x-validator': 'phone',
|
|
145
|
+
'x-decorator': 'FormItem',
|
|
146
|
+
'x-component-props': {
|
|
147
|
+
placeholder: '{{t("Phone")}}',
|
|
148
|
+
style: {}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
code: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
required: true,
|
|
154
|
+
'x-component': 'VerificationCode',
|
|
155
|
+
'x-component-props': {
|
|
156
|
+
actionType: 'users:signin',
|
|
157
|
+
targetFieldName: 'phone'
|
|
158
|
+
},
|
|
159
|
+
'x-decorator': 'FormItem'
|
|
160
|
+
},
|
|
161
|
+
actions: {
|
|
162
|
+
title: '{{t("Sign in")}}',
|
|
163
|
+
type: 'void',
|
|
164
|
+
'x-component': 'Action',
|
|
165
|
+
'x-component-props': {
|
|
166
|
+
htmlType: 'submit',
|
|
167
|
+
block: true,
|
|
168
|
+
type: 'primary',
|
|
169
|
+
useAction: '{{ usePhoneSignIn }}',
|
|
170
|
+
style: {
|
|
171
|
+
width: '100%'
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
function usePhoneSignIn() {
|
|
179
|
+
var form = (0, _react.useForm)();
|
|
180
|
+
var api = (0, _.useAPIClient)();
|
|
181
|
+
var redirect = useRedirect();
|
|
182
|
+
return {
|
|
183
|
+
run: function run() {
|
|
184
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
185
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
186
|
+
while (1) {
|
|
187
|
+
switch (_context2.prev = _context2.next) {
|
|
188
|
+
case 0:
|
|
189
|
+
_context2.next = 2;
|
|
190
|
+
return form.submit();
|
|
191
|
+
|
|
192
|
+
case 2:
|
|
193
|
+
_context2.next = 4;
|
|
194
|
+
return api.auth.signIn(form.values, 'sms');
|
|
195
|
+
|
|
196
|
+
case 4:
|
|
197
|
+
redirect();
|
|
198
|
+
|
|
199
|
+
case 5:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context2.stop();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, _callee2);
|
|
205
|
+
}))();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var SigninPage = function SigninPage(props) {
|
|
211
|
+
var _ctx$data;
|
|
126
212
|
|
|
127
|
-
var
|
|
128
|
-
|
|
213
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
214
|
+
t = _useTranslation.t;
|
|
129
215
|
|
|
130
216
|
(0, _.useCurrentDocumentTitle)('Signin');
|
|
131
217
|
var ctx = (0, _.useSystemSettings)();
|
|
132
|
-
|
|
133
|
-
|
|
218
|
+
|
|
219
|
+
var _ref = (ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : _ctx$data.data) || {},
|
|
220
|
+
allowSignUp = _ref.allowSignUp,
|
|
221
|
+
smsAuthEnabled = _ref.smsAuthEnabled;
|
|
222
|
+
|
|
223
|
+
var schema = props.schema,
|
|
224
|
+
components = props.components,
|
|
225
|
+
scope = props.scope;
|
|
226
|
+
return /*#__PURE__*/_react2.default.createElement("div", null, smsAuthEnabled ? /*#__PURE__*/_react2.default.createElement(_antd.Tabs, {
|
|
227
|
+
defaultActiveKey: "password"
|
|
228
|
+
}, /*#__PURE__*/_react2.default.createElement(_antd.Tabs.TabPane, {
|
|
229
|
+
tab: t('Sign in via account'),
|
|
230
|
+
key: "password"
|
|
231
|
+
}, /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
|
|
134
232
|
scope: {
|
|
135
|
-
|
|
136
|
-
allowSignUp: allowSignUp
|
|
233
|
+
usePasswordSignIn: usePasswordSignIn
|
|
137
234
|
},
|
|
138
|
-
schema: schema
|
|
139
|
-
}))
|
|
235
|
+
schema: schema || passwordForm
|
|
236
|
+
})), /*#__PURE__*/_react2.default.createElement(_antd.Tabs.TabPane, {
|
|
237
|
+
tab: t('Sign in via phone'),
|
|
238
|
+
key: "phone"
|
|
239
|
+
}, /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
|
|
240
|
+
schema: phoneForm,
|
|
241
|
+
scope: _objectSpread({
|
|
242
|
+
usePhoneSignIn: usePhoneSignIn
|
|
243
|
+
}, scope),
|
|
244
|
+
components: _objectSpread({
|
|
245
|
+
VerificationCode: _VerificationCode.default
|
|
246
|
+
}, components)
|
|
247
|
+
}))) : /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
|
|
248
|
+
components: _objectSpread({}, components),
|
|
249
|
+
scope: _objectSpread({
|
|
250
|
+
usePasswordSignIn: usePasswordSignIn
|
|
251
|
+
}, scope),
|
|
252
|
+
schema: schema || passwordForm
|
|
253
|
+
}), allowSignUp && /*#__PURE__*/_react2.default.createElement("div", null, /*#__PURE__*/_react2.default.createElement(_reactRouterDom.Link, {
|
|
254
|
+
to: "/signup"
|
|
255
|
+
}, t('Create an account'))));
|
|
140
256
|
};
|
|
141
257
|
|
|
142
258
|
exports.SigninPage = SigninPage;
|
package/lib/user/SignupPage.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { ISchema } from '@formily/react';
|
|
1
2
|
export declare const useSignup: () => {
|
|
2
3
|
run(): Promise<void>;
|
|
3
4
|
};
|
|
4
|
-
export
|
|
5
|
+
export interface SignupPageProps {
|
|
6
|
+
schema?: ISchema;
|
|
7
|
+
components?: any;
|
|
8
|
+
scope?: any;
|
|
9
|
+
}
|
|
10
|
+
export declare const SignupPage: (props: SignupPageProps) => JSX.Element;
|
package/lib/user/SignupPage.js
CHANGED
|
@@ -13,17 +13,27 @@ var _antd = require("antd");
|
|
|
13
13
|
|
|
14
14
|
var _react2 = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
+
var _reactI18next = require("react-i18next");
|
|
17
|
+
|
|
16
18
|
var _reactRouterDom = require("react-router-dom");
|
|
17
19
|
|
|
18
20
|
var _ = require("..");
|
|
19
21
|
|
|
22
|
+
var _VerificationCode = _interopRequireDefault(require("./VerificationCode"));
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
+
|
|
30
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
|
|
22
32
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
23
33
|
|
|
24
34
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
25
35
|
|
|
26
|
-
var
|
|
36
|
+
var signupPageSchema = {
|
|
27
37
|
type: 'object',
|
|
28
38
|
name: (0, _shared.uid)(),
|
|
29
39
|
'x-component': 'FormV2',
|
|
@@ -39,6 +49,29 @@ var schema = {
|
|
|
39
49
|
style: {}
|
|
40
50
|
}
|
|
41
51
|
},
|
|
52
|
+
phone: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
required: true,
|
|
55
|
+
'x-component': 'Input',
|
|
56
|
+
'x-validator': 'phone',
|
|
57
|
+
'x-decorator': 'FormItem',
|
|
58
|
+
'x-component-props': {
|
|
59
|
+
placeholder: '{{t("Phone")}}',
|
|
60
|
+
style: {}
|
|
61
|
+
},
|
|
62
|
+
'x-visible': '{{smsAuthEnabled}}'
|
|
63
|
+
},
|
|
64
|
+
code: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
required: true,
|
|
67
|
+
'x-component': 'VerificationCode',
|
|
68
|
+
'x-component-props': {
|
|
69
|
+
actionType: 'users:signup',
|
|
70
|
+
targetFieldName: 'phone'
|
|
71
|
+
},
|
|
72
|
+
'x-decorator': 'FormItem',
|
|
73
|
+
'x-visible': '{{smsAuthEnabled}}'
|
|
74
|
+
},
|
|
42
75
|
password: {
|
|
43
76
|
type: 'string',
|
|
44
77
|
required: true,
|
|
@@ -65,7 +98,6 @@ var schema = {
|
|
|
65
98
|
'x-decorator': 'FormItem',
|
|
66
99
|
'x-component-props': {
|
|
67
100
|
placeholder: '{{t("Confirm password")}}',
|
|
68
|
-
checkStrength: true,
|
|
69
101
|
style: {}
|
|
70
102
|
},
|
|
71
103
|
'x-reactions': [{
|
|
@@ -118,6 +150,10 @@ var useSignup = function useSignup() {
|
|
|
118
150
|
var history = (0, _reactRouterDom.useHistory)();
|
|
119
151
|
var form = (0, _react.useForm)();
|
|
120
152
|
var api = (0, _.useAPIClient)();
|
|
153
|
+
|
|
154
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
155
|
+
t = _useTranslation.t;
|
|
156
|
+
|
|
121
157
|
return {
|
|
122
158
|
run: function run() {
|
|
123
159
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
@@ -135,7 +171,7 @@ var useSignup = function useSignup() {
|
|
|
135
171
|
});
|
|
136
172
|
|
|
137
173
|
case 4:
|
|
138
|
-
_antd.message.success('
|
|
174
|
+
_antd.message.success('Sign up successfully, and automatically jump to the sign in page');
|
|
139
175
|
|
|
140
176
|
setTimeout(function () {
|
|
141
177
|
history.push('/signin');
|
|
@@ -154,12 +190,15 @@ var useSignup = function useSignup() {
|
|
|
154
190
|
|
|
155
191
|
exports.useSignup = useSignup;
|
|
156
192
|
|
|
157
|
-
var SignupPage = function SignupPage() {
|
|
158
|
-
var _ctx$data
|
|
193
|
+
var SignupPage = function SignupPage(props) {
|
|
194
|
+
var _ctx$data;
|
|
159
195
|
|
|
160
196
|
(0, _.useCurrentDocumentTitle)('Signup');
|
|
161
197
|
var ctx = (0, _.useSystemSettings)();
|
|
162
|
-
|
|
198
|
+
|
|
199
|
+
var _ref = (ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : _ctx$data.data) || {},
|
|
200
|
+
allowSignUp = _ref.allowSignUp,
|
|
201
|
+
smsAuthEnabled = _ref.smsAuthEnabled;
|
|
163
202
|
|
|
164
203
|
if (!allowSignUp) {
|
|
165
204
|
return /*#__PURE__*/_react2.default.createElement(_reactRouterDom.Redirect, {
|
|
@@ -167,11 +206,18 @@ var SignupPage = function SignupPage() {
|
|
|
167
206
|
});
|
|
168
207
|
}
|
|
169
208
|
|
|
209
|
+
var schema = props.schema,
|
|
210
|
+
components = props.components,
|
|
211
|
+
scope = props.scope;
|
|
170
212
|
return /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
|
|
171
|
-
schema: schema,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
213
|
+
schema: schema || signupPageSchema,
|
|
214
|
+
components: _objectSpread({
|
|
215
|
+
VerificationCode: _VerificationCode.default
|
|
216
|
+
}, components),
|
|
217
|
+
scope: _objectSpread({
|
|
218
|
+
useSignup: useSignup,
|
|
219
|
+
smsAuthEnabled: smsAuthEnabled
|
|
220
|
+
}, scope)
|
|
175
221
|
});
|
|
176
222
|
};
|
|
177
223
|
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = VerificationCode;
|
|
9
|
+
|
|
10
|
+
var _reactI18next = require("react-i18next");
|
|
11
|
+
|
|
12
|
+
var _css = require("@emotion/css");
|
|
13
|
+
|
|
14
|
+
var _apiClient = require("../api-client");
|
|
15
|
+
|
|
16
|
+
var _react = require("@formily/react");
|
|
17
|
+
|
|
18
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _antd = require("antd");
|
|
21
|
+
|
|
22
|
+
var _templateObject;
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
+
|
|
30
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
31
|
+
|
|
32
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
+
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
+
|
|
40
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
41
|
+
|
|
42
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
function VerificationCode(_ref) {
|
|
47
|
+
var _ref$targetFieldName = _ref.targetFieldName,
|
|
48
|
+
targetFieldName = _ref$targetFieldName === void 0 ? 'phone' : _ref$targetFieldName,
|
|
49
|
+
actionType = _ref.actionType,
|
|
50
|
+
value = _ref.value,
|
|
51
|
+
onChange = _ref.onChange;
|
|
52
|
+
|
|
53
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
54
|
+
t = _useTranslation.t;
|
|
55
|
+
|
|
56
|
+
var api = (0, _apiClient.useAPIClient)();
|
|
57
|
+
var form = (0, _react.useForm)();
|
|
58
|
+
|
|
59
|
+
var _useState = (0, _react2.useState)(0),
|
|
60
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
61
|
+
count = _useState2[0],
|
|
62
|
+
setCountdown = _useState2[1];
|
|
63
|
+
|
|
64
|
+
var timer = (0, _react2.useRef)(null);
|
|
65
|
+
(0, _react2.useEffect)(function () {
|
|
66
|
+
if (count <= 0 && timer.current) {
|
|
67
|
+
clearInterval(timer.current);
|
|
68
|
+
}
|
|
69
|
+
}, [count]);
|
|
70
|
+
|
|
71
|
+
function onGetCode() {
|
|
72
|
+
return _onGetCode.apply(this, arguments);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function _onGetCode() {
|
|
76
|
+
_onGetCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
77
|
+
var _yield$api$resource$c, data, expiresIn;
|
|
78
|
+
|
|
79
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
80
|
+
while (1) {
|
|
81
|
+
switch (_context.prev = _context.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
if (!(count > 0)) {
|
|
84
|
+
_context.next = 2;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return _context.abrupt("return");
|
|
89
|
+
|
|
90
|
+
case 2:
|
|
91
|
+
_context.prev = 2;
|
|
92
|
+
_context.next = 5;
|
|
93
|
+
return api.resource('verifications').create({
|
|
94
|
+
values: {
|
|
95
|
+
type: actionType,
|
|
96
|
+
phone: form.values[targetFieldName]
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
case 5:
|
|
101
|
+
_yield$api$resource$c = _context.sent;
|
|
102
|
+
data = _yield$api$resource$c.data.data;
|
|
103
|
+
|
|
104
|
+
_antd.message.success(t('Operation succeeded'));
|
|
105
|
+
|
|
106
|
+
if (value) {
|
|
107
|
+
onChange('');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
expiresIn = data.expiresAt ? Math.ceil((Date.parse(data.expiresAt) - Date.now()) / 1000) : 60;
|
|
111
|
+
setCountdown(expiresIn);
|
|
112
|
+
timer.current = setInterval(function () {
|
|
113
|
+
setCountdown(function (count) {
|
|
114
|
+
return count - 1;
|
|
115
|
+
});
|
|
116
|
+
}, 1000);
|
|
117
|
+
_context.next = 17;
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
case 14:
|
|
121
|
+
_context.prev = 14;
|
|
122
|
+
_context.t0 = _context["catch"](2);
|
|
123
|
+
console.error(_context.t0);
|
|
124
|
+
|
|
125
|
+
case 17:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context.stop();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, _callee, null, [[2, 14]]);
|
|
131
|
+
}));
|
|
132
|
+
return _onGetCode.apply(this, arguments);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
;
|
|
136
|
+
return /*#__PURE__*/_react2.default.createElement("fieldset", {
|
|
137
|
+
className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: .5em;\n "])))
|
|
138
|
+
}, /*#__PURE__*/_react2.default.createElement(_antd.Input, {
|
|
139
|
+
value: value,
|
|
140
|
+
onChange: onChange,
|
|
141
|
+
placeholder: t('Verification code')
|
|
142
|
+
}), /*#__PURE__*/_react2.default.createElement(_antd.Button, {
|
|
143
|
+
onClick: onGetCode,
|
|
144
|
+
disabled: count > 0
|
|
145
|
+
}, count > 0 ? t('Retry after {{count}} seconds', {
|
|
146
|
+
count: count
|
|
147
|
+
}) : t('Send code')));
|
|
148
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5-alpha.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"licenses": [
|
|
6
6
|
{
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
"@formily/antd": "2.0.20",
|
|
20
20
|
"@formily/core": "2.0.20",
|
|
21
21
|
"@formily/react": "2.0.20",
|
|
22
|
-
"@nocobase/sdk": "0.7.
|
|
23
|
-
"@nocobase/utils": "0.7.
|
|
22
|
+
"@nocobase/sdk": "0.7.5-alpha.1",
|
|
23
|
+
"@nocobase/utils": "0.7.5-alpha.1",
|
|
24
24
|
"ahooks": "^3.0.5",
|
|
25
25
|
"antd": "~4.19.5",
|
|
26
26
|
"axios": "^0.26.1",
|
|
27
27
|
"classnames": "^2.3.1",
|
|
28
|
+
"cronstrue": "^2.11.0",
|
|
28
29
|
"file-saver": "^2.0.5",
|
|
29
30
|
"i18next": "^21.6.0",
|
|
30
31
|
"json-templates": "^4.2.0",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"react-hotkeys-hook": "^3.4.7",
|
|
39
40
|
"react-i18next": "^11.15.1",
|
|
40
41
|
"react-image-lightbox": "^5.1.4",
|
|
42
|
+
"react-js-cron": "^1.4.0",
|
|
41
43
|
"react-quill": "^1.3.5",
|
|
42
44
|
"react-router-dom": "^5.2.0",
|
|
43
45
|
"react-to-print": "^2.14.7",
|
|
@@ -55,5 +57,5 @@
|
|
|
55
57
|
"@types/marked": "^4.0.1",
|
|
56
58
|
"axios-mock-adapter": "^1.20.0"
|
|
57
59
|
},
|
|
58
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "f6eb27b68185bb0c0b4c2cfca1df84205a9b9173"
|
|
59
61
|
}
|