@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
|
@@ -75,11 +75,8 @@ export var useSchemaTemplate = function useSchemaTemplate() {
|
|
|
75
75
|
|
|
76
76
|
var fieldSchema = useFieldSchema();
|
|
77
77
|
var schemaId = fieldSchema['x-uid'];
|
|
78
|
-
var templateKey = fieldSchema['x-template-key'];
|
|
79
|
-
|
|
80
|
-
schemaId: schemaId,
|
|
81
|
-
templateKey: templateKey
|
|
82
|
-
});
|
|
78
|
+
var templateKey = fieldSchema['x-template-key']; // console.log('templateKey', { schemaId, templateKey })
|
|
79
|
+
|
|
83
80
|
return useMemo(function () {
|
|
84
81
|
return getTemplateBySchema(fieldSchema);
|
|
85
82
|
}, [schemaId, templateKey]);
|
|
@@ -192,6 +192,13 @@ var schema = {
|
|
|
192
192
|
'x-component': 'Checkbox',
|
|
193
193
|
'x-decorator': 'FormItem'
|
|
194
194
|
},
|
|
195
|
+
smsAuthEnabled: {
|
|
196
|
+
type: 'boolean',
|
|
197
|
+
default: false,
|
|
198
|
+
'x-content': '{{t("Enable SMS authentication")}}',
|
|
199
|
+
'x-component': 'Checkbox',
|
|
200
|
+
'x-decorator': 'FormItem'
|
|
201
|
+
},
|
|
195
202
|
footer1: {
|
|
196
203
|
type: 'void',
|
|
197
204
|
'x-component': 'Action.Drawer.Footer',
|
package/es/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/es/user/SigninPage.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
1
7
|
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); } }
|
|
2
8
|
|
|
3
9
|
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); }); }; }
|
|
4
10
|
|
|
5
11
|
import { useForm } from '@formily/react';
|
|
6
|
-
import {
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import {
|
|
12
|
+
import { Tabs } from 'antd';
|
|
13
|
+
import React, { useCallback } from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { Link, useHistory, useLocation } from 'react-router-dom';
|
|
9
16
|
import { SchemaComponent, useAPIClient, useCurrentDocumentTitle, useSystemSettings } from '..';
|
|
10
|
-
|
|
17
|
+
import VerificationCode from './VerificationCode';
|
|
18
|
+
var passwordForm = {
|
|
11
19
|
type: 'object',
|
|
12
|
-
name:
|
|
20
|
+
name: 'passwordForm',
|
|
13
21
|
'x-component': 'FormV2',
|
|
14
22
|
properties: {
|
|
15
23
|
email: {
|
|
@@ -45,40 +53,33 @@ var schema = {
|
|
|
45
53
|
htmlType: 'submit',
|
|
46
54
|
block: true,
|
|
47
55
|
type: 'primary',
|
|
48
|
-
useAction: '{{
|
|
56
|
+
useAction: '{{ usePasswordSignIn }}',
|
|
49
57
|
style: {
|
|
50
58
|
width: '100%'
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
|
-
},
|
|
56
|
-
link: {
|
|
57
|
-
type: 'void',
|
|
58
|
-
'x-component': 'div',
|
|
59
|
-
'x-visible': '{{allowSignUp}}',
|
|
60
|
-
properties: {
|
|
61
|
-
link: {
|
|
62
|
-
title: '{{t("Create an account")}}',
|
|
63
|
-
type: 'void',
|
|
64
|
-
'x-component': 'Link',
|
|
65
|
-
'x-content': '{{t("Create an account")}}',
|
|
66
|
-
'x-component-props': {
|
|
67
|
-
to: '/signup'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
63
|
}
|
|
72
64
|
}
|
|
73
65
|
};
|
|
74
|
-
|
|
66
|
+
|
|
67
|
+
function useRedirect() {
|
|
75
68
|
var _location$query;
|
|
76
69
|
|
|
70
|
+
var next = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/admin';
|
|
77
71
|
var location = useLocation();
|
|
78
72
|
var history = useHistory();
|
|
73
|
+
var redirect = location === null || location === void 0 ? void 0 : (_location$query = location['query']) === null || _location$query === void 0 ? void 0 : _location$query.redirect;
|
|
74
|
+
return useCallback(function () {
|
|
75
|
+
history.push(redirect || '/admin');
|
|
76
|
+
}, [redirect]);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export var usePasswordSignIn = function usePasswordSignIn() {
|
|
79
80
|
var form = useForm();
|
|
80
81
|
var api = useAPIClient();
|
|
81
|
-
var redirect =
|
|
82
|
+
var redirect = useRedirect();
|
|
82
83
|
return {
|
|
83
84
|
run: function run() {
|
|
84
85
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
@@ -94,7 +95,7 @@ export var useSignin = function useSignin() {
|
|
|
94
95
|
return api.auth.signIn(form.values);
|
|
95
96
|
|
|
96
97
|
case 4:
|
|
97
|
-
|
|
98
|
+
redirect();
|
|
98
99
|
|
|
99
100
|
case 5:
|
|
100
101
|
case "end":
|
|
@@ -106,17 +107,123 @@ export var useSignin = function useSignin() {
|
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
};
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
var phoneForm = {
|
|
111
|
+
type: 'object',
|
|
112
|
+
name: 'phoneForm',
|
|
113
|
+
'x-component': 'Form',
|
|
114
|
+
properties: {
|
|
115
|
+
phone: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
required: true,
|
|
118
|
+
'x-component': 'Input',
|
|
119
|
+
'x-validator': 'phone',
|
|
120
|
+
'x-decorator': 'FormItem',
|
|
121
|
+
'x-component-props': {
|
|
122
|
+
placeholder: '{{t("Phone")}}',
|
|
123
|
+
style: {}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
code: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
required: true,
|
|
129
|
+
'x-component': 'VerificationCode',
|
|
130
|
+
'x-component-props': {
|
|
131
|
+
actionType: 'users:signin',
|
|
132
|
+
targetFieldName: 'phone'
|
|
133
|
+
},
|
|
134
|
+
'x-decorator': 'FormItem'
|
|
135
|
+
},
|
|
136
|
+
actions: {
|
|
137
|
+
title: '{{t("Sign in")}}',
|
|
138
|
+
type: 'void',
|
|
139
|
+
'x-component': 'Action',
|
|
140
|
+
'x-component-props': {
|
|
141
|
+
htmlType: 'submit',
|
|
142
|
+
block: true,
|
|
143
|
+
type: 'primary',
|
|
144
|
+
useAction: '{{ usePhoneSignIn }}',
|
|
145
|
+
style: {
|
|
146
|
+
width: '100%'
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
export function usePhoneSignIn() {
|
|
153
|
+
var form = useForm();
|
|
154
|
+
var api = useAPIClient();
|
|
155
|
+
var redirect = useRedirect();
|
|
156
|
+
return {
|
|
157
|
+
run: function run() {
|
|
158
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
159
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
160
|
+
while (1) {
|
|
161
|
+
switch (_context2.prev = _context2.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
_context2.next = 2;
|
|
164
|
+
return form.submit();
|
|
165
|
+
|
|
166
|
+
case 2:
|
|
167
|
+
_context2.next = 4;
|
|
168
|
+
return api.auth.signIn(form.values, 'sms');
|
|
169
|
+
|
|
170
|
+
case 4:
|
|
171
|
+
redirect();
|
|
172
|
+
|
|
173
|
+
case 5:
|
|
174
|
+
case "end":
|
|
175
|
+
return _context2.stop();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, _callee2);
|
|
179
|
+
}))();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
export var SigninPage = function SigninPage(props) {
|
|
184
|
+
var _ctx$data;
|
|
185
|
+
|
|
186
|
+
var _useTranslation = useTranslation(),
|
|
187
|
+
t = _useTranslation.t;
|
|
111
188
|
|
|
112
189
|
useCurrentDocumentTitle('Signin');
|
|
113
190
|
var ctx = useSystemSettings();
|
|
114
|
-
|
|
115
|
-
|
|
191
|
+
|
|
192
|
+
var _ref = (ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : _ctx$data.data) || {},
|
|
193
|
+
allowSignUp = _ref.allowSignUp,
|
|
194
|
+
smsAuthEnabled = _ref.smsAuthEnabled;
|
|
195
|
+
|
|
196
|
+
var schema = props.schema,
|
|
197
|
+
components = props.components,
|
|
198
|
+
scope = props.scope;
|
|
199
|
+
return /*#__PURE__*/React.createElement("div", null, smsAuthEnabled ? /*#__PURE__*/React.createElement(Tabs, {
|
|
200
|
+
defaultActiveKey: "password"
|
|
201
|
+
}, /*#__PURE__*/React.createElement(Tabs.TabPane, {
|
|
202
|
+
tab: t('Sign in via account'),
|
|
203
|
+
key: "password"
|
|
204
|
+
}, /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
116
205
|
scope: {
|
|
117
|
-
|
|
118
|
-
allowSignUp: allowSignUp
|
|
206
|
+
usePasswordSignIn: usePasswordSignIn
|
|
119
207
|
},
|
|
120
|
-
schema: schema
|
|
121
|
-
}))
|
|
208
|
+
schema: schema || passwordForm
|
|
209
|
+
})), /*#__PURE__*/React.createElement(Tabs.TabPane, {
|
|
210
|
+
tab: t('Sign in via phone'),
|
|
211
|
+
key: "phone"
|
|
212
|
+
}, /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
213
|
+
schema: phoneForm,
|
|
214
|
+
scope: _objectSpread({
|
|
215
|
+
usePhoneSignIn: usePhoneSignIn
|
|
216
|
+
}, scope),
|
|
217
|
+
components: _objectSpread({
|
|
218
|
+
VerificationCode: VerificationCode
|
|
219
|
+
}, components)
|
|
220
|
+
}))) : /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
221
|
+
components: _objectSpread({}, components),
|
|
222
|
+
scope: _objectSpread({
|
|
223
|
+
usePasswordSignIn: usePasswordSignIn
|
|
224
|
+
}, scope),
|
|
225
|
+
schema: schema || passwordForm
|
|
226
|
+
}), allowSignUp && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Link, {
|
|
227
|
+
to: "/signup"
|
|
228
|
+
}, t('Create an account'))));
|
|
122
229
|
};
|
package/es/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/es/user/SignupPage.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
1
7
|
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); } }
|
|
2
8
|
|
|
3
9
|
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); }); }; }
|
|
@@ -6,9 +12,11 @@ import { useForm } from '@formily/react';
|
|
|
6
12
|
import { uid } from '@formily/shared';
|
|
7
13
|
import { message } from 'antd';
|
|
8
14
|
import React from 'react';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
9
16
|
import { Redirect, useHistory } from 'react-router-dom';
|
|
10
17
|
import { SchemaComponent, useAPIClient, useCurrentDocumentTitle, useSystemSettings } from '..';
|
|
11
|
-
|
|
18
|
+
import VerificationCode from './VerificationCode';
|
|
19
|
+
var signupPageSchema = {
|
|
12
20
|
type: 'object',
|
|
13
21
|
name: uid(),
|
|
14
22
|
'x-component': 'FormV2',
|
|
@@ -24,6 +32,29 @@ var schema = {
|
|
|
24
32
|
style: {}
|
|
25
33
|
}
|
|
26
34
|
},
|
|
35
|
+
phone: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: true,
|
|
38
|
+
'x-component': 'Input',
|
|
39
|
+
'x-validator': 'phone',
|
|
40
|
+
'x-decorator': 'FormItem',
|
|
41
|
+
'x-component-props': {
|
|
42
|
+
placeholder: '{{t("Phone")}}',
|
|
43
|
+
style: {}
|
|
44
|
+
},
|
|
45
|
+
'x-visible': '{{smsAuthEnabled}}'
|
|
46
|
+
},
|
|
47
|
+
code: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
required: true,
|
|
50
|
+
'x-component': 'VerificationCode',
|
|
51
|
+
'x-component-props': {
|
|
52
|
+
actionType: 'users:signup',
|
|
53
|
+
targetFieldName: 'phone'
|
|
54
|
+
},
|
|
55
|
+
'x-decorator': 'FormItem',
|
|
56
|
+
'x-visible': '{{smsAuthEnabled}}'
|
|
57
|
+
},
|
|
27
58
|
password: {
|
|
28
59
|
type: 'string',
|
|
29
60
|
required: true,
|
|
@@ -50,7 +81,6 @@ var schema = {
|
|
|
50
81
|
'x-decorator': 'FormItem',
|
|
51
82
|
'x-component-props': {
|
|
52
83
|
placeholder: '{{t("Confirm password")}}',
|
|
53
|
-
checkStrength: true,
|
|
54
84
|
style: {}
|
|
55
85
|
},
|
|
56
86
|
'x-reactions': [{
|
|
@@ -102,6 +132,10 @@ export var useSignup = function useSignup() {
|
|
|
102
132
|
var history = useHistory();
|
|
103
133
|
var form = useForm();
|
|
104
134
|
var api = useAPIClient();
|
|
135
|
+
|
|
136
|
+
var _useTranslation = useTranslation(),
|
|
137
|
+
t = _useTranslation.t;
|
|
138
|
+
|
|
105
139
|
return {
|
|
106
140
|
run: function run() {
|
|
107
141
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
@@ -119,7 +153,7 @@ export var useSignup = function useSignup() {
|
|
|
119
153
|
});
|
|
120
154
|
|
|
121
155
|
case 4:
|
|
122
|
-
message.success('
|
|
156
|
+
message.success('Sign up successfully, and automatically jump to the sign in page');
|
|
123
157
|
setTimeout(function () {
|
|
124
158
|
history.push('/signin');
|
|
125
159
|
}, 2000);
|
|
@@ -134,12 +168,15 @@ export var useSignup = function useSignup() {
|
|
|
134
168
|
}
|
|
135
169
|
};
|
|
136
170
|
};
|
|
137
|
-
export var SignupPage = function SignupPage() {
|
|
138
|
-
var _ctx$data
|
|
171
|
+
export var SignupPage = function SignupPage(props) {
|
|
172
|
+
var _ctx$data;
|
|
139
173
|
|
|
140
174
|
useCurrentDocumentTitle('Signup');
|
|
141
175
|
var ctx = useSystemSettings();
|
|
142
|
-
|
|
176
|
+
|
|
177
|
+
var _ref = (ctx === null || ctx === void 0 ? void 0 : (_ctx$data = ctx.data) === null || _ctx$data === void 0 ? void 0 : _ctx$data.data) || {},
|
|
178
|
+
allowSignUp = _ref.allowSignUp,
|
|
179
|
+
smsAuthEnabled = _ref.smsAuthEnabled;
|
|
143
180
|
|
|
144
181
|
if (!allowSignUp) {
|
|
145
182
|
return /*#__PURE__*/React.createElement(Redirect, {
|
|
@@ -147,10 +184,17 @@ export var SignupPage = function SignupPage() {
|
|
|
147
184
|
});
|
|
148
185
|
}
|
|
149
186
|
|
|
187
|
+
var schema = props.schema,
|
|
188
|
+
components = props.components,
|
|
189
|
+
scope = props.scope;
|
|
150
190
|
return /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
151
|
-
schema: schema,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
191
|
+
schema: schema || signupPageSchema,
|
|
192
|
+
components: _objectSpread({
|
|
193
|
+
VerificationCode: VerificationCode
|
|
194
|
+
}, components),
|
|
195
|
+
scope: _objectSpread({
|
|
196
|
+
useSignup: useSignup,
|
|
197
|
+
smsAuthEnabled: smsAuthEnabled
|
|
198
|
+
}, scope)
|
|
155
199
|
});
|
|
156
200
|
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
|
|
3
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
4
|
+
|
|
5
|
+
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); } }
|
|
6
|
+
|
|
7
|
+
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); }); }; }
|
|
8
|
+
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
11
|
+
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."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
|
|
21
|
+
import { useTranslation } from "react-i18next";
|
|
22
|
+
import { css } from '@emotion/css';
|
|
23
|
+
import { useAPIClient } from "../api-client";
|
|
24
|
+
import { useForm } from "@formily/react";
|
|
25
|
+
import { useEffect, useRef, useState } from "react";
|
|
26
|
+
import { Button, Input, message } from "antd";
|
|
27
|
+
import React from "react";
|
|
28
|
+
export default function VerificationCode(_ref) {
|
|
29
|
+
var _ref$targetFieldName = _ref.targetFieldName,
|
|
30
|
+
targetFieldName = _ref$targetFieldName === void 0 ? 'phone' : _ref$targetFieldName,
|
|
31
|
+
actionType = _ref.actionType,
|
|
32
|
+
value = _ref.value,
|
|
33
|
+
onChange = _ref.onChange;
|
|
34
|
+
|
|
35
|
+
var _useTranslation = useTranslation(),
|
|
36
|
+
t = _useTranslation.t;
|
|
37
|
+
|
|
38
|
+
var api = useAPIClient();
|
|
39
|
+
var form = useForm();
|
|
40
|
+
|
|
41
|
+
var _useState = useState(0),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
count = _useState2[0],
|
|
44
|
+
setCountdown = _useState2[1];
|
|
45
|
+
|
|
46
|
+
var timer = useRef(null);
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (count <= 0 && timer.current) {
|
|
49
|
+
clearInterval(timer.current);
|
|
50
|
+
}
|
|
51
|
+
}, [count]);
|
|
52
|
+
|
|
53
|
+
function onGetCode() {
|
|
54
|
+
return _onGetCode.apply(this, arguments);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function _onGetCode() {
|
|
58
|
+
_onGetCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
59
|
+
var _yield$api$resource$c, data, expiresIn;
|
|
60
|
+
|
|
61
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
if (!(count > 0)) {
|
|
66
|
+
_context.next = 2;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return _context.abrupt("return");
|
|
71
|
+
|
|
72
|
+
case 2:
|
|
73
|
+
_context.prev = 2;
|
|
74
|
+
_context.next = 5;
|
|
75
|
+
return api.resource('verifications').create({
|
|
76
|
+
values: {
|
|
77
|
+
type: actionType,
|
|
78
|
+
phone: form.values[targetFieldName]
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
case 5:
|
|
83
|
+
_yield$api$resource$c = _context.sent;
|
|
84
|
+
data = _yield$api$resource$c.data.data;
|
|
85
|
+
message.success(t('Operation succeeded'));
|
|
86
|
+
|
|
87
|
+
if (value) {
|
|
88
|
+
onChange('');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
expiresIn = data.expiresAt ? Math.ceil((Date.parse(data.expiresAt) - Date.now()) / 1000) : 60;
|
|
92
|
+
setCountdown(expiresIn);
|
|
93
|
+
timer.current = setInterval(function () {
|
|
94
|
+
setCountdown(function (count) {
|
|
95
|
+
return count - 1;
|
|
96
|
+
});
|
|
97
|
+
}, 1000);
|
|
98
|
+
_context.next = 17;
|
|
99
|
+
break;
|
|
100
|
+
|
|
101
|
+
case 14:
|
|
102
|
+
_context.prev = 14;
|
|
103
|
+
_context.t0 = _context["catch"](2);
|
|
104
|
+
console.error(_context.t0);
|
|
105
|
+
|
|
106
|
+
case 17:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context.stop();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, _callee, null, [[2, 14]]);
|
|
112
|
+
}));
|
|
113
|
+
return _onGetCode.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
;
|
|
117
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
118
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: .5em;\n "])))
|
|
119
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
120
|
+
value: value,
|
|
121
|
+
onChange: onChange,
|
|
122
|
+
placeholder: t('Verification code')
|
|
123
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
124
|
+
onClick: onGetCode,
|
|
125
|
+
disabled: count > 0
|
|
126
|
+
}, count > 0 ? t('Retry after {{count}} seconds', {
|
|
127
|
+
count: count
|
|
128
|
+
}) : t('Send code')));
|
|
129
|
+
}
|
|
@@ -259,12 +259,12 @@ var useTableBlockProps = function useTableBlockProps() {
|
|
|
259
259
|
}))();
|
|
260
260
|
},
|
|
261
261
|
onChange: function onChange(_ref2, filters, sorter) {
|
|
262
|
-
var _ctx$service$params;
|
|
262
|
+
var _ctx$service$params, _ctx$service$params$, _ctx$service$params2;
|
|
263
263
|
|
|
264
264
|
var current = _ref2.current,
|
|
265
265
|
pageSize = _ref2.pageSize;
|
|
266
|
-
var sort = sorter.order ? sorter.order === "ascend" ? [sorter.field] : ["-".concat(sorter.field)] : globalSort || null;
|
|
267
|
-
ctx.service.run(_objectSpread(_objectSpread({}, (_ctx$service$
|
|
266
|
+
var sort = sorter.order ? sorter.order === "ascend" ? [sorter.field] : ["-".concat(sorter.field)] : globalSort || ((_ctx$service$params = ctx.service.params) === null || _ctx$service$params === void 0 ? void 0 : (_ctx$service$params$ = _ctx$service$params[0]) === null || _ctx$service$params$ === void 0 ? void 0 : _ctx$service$params$.sort);
|
|
267
|
+
ctx.service.run(_objectSpread(_objectSpread({}, (_ctx$service$params2 = ctx.service.params) === null || _ctx$service$params2 === void 0 ? void 0 : _ctx$service$params2[0]), {}, {
|
|
268
268
|
page: current,
|
|
269
269
|
pageSize: pageSize,
|
|
270
270
|
sort: sort
|