@devtable/settings-form 4.18.0 → 4.19.0

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.
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { IStyles } from './styles';
3
+ import { ISettingsFormConfig } from './types';
4
+ interface IAccountList {
5
+ styles?: IStyles;
6
+ config: ISettingsFormConfig;
7
+ }
8
+ export declare function AccountList({ styles, config }: IAccountList): JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { IStyles } from './styles';
3
+ interface IAddAccount {
4
+ styles?: IStyles;
5
+ onSuccess: () => void;
6
+ initialRoleID: number;
7
+ }
8
+ export declare function AddAccount({ onSuccess, styles, initialRoleID }: IAddAccount): JSX.Element;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { IStyles } from './styles';
3
+ interface IDeleteAccount {
4
+ id: string;
5
+ name: string;
6
+ onSuccess: () => void;
7
+ styles?: IStyles;
8
+ }
9
+ export declare function DeleteAccount({ id, name, onSuccess, styles }: IDeleteAccount): JSX.Element;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { IAccount } from '../api-caller/account.typed';
3
+ import { IStyles } from './styles';
4
+ interface IEditAccount {
5
+ styles?: IStyles;
6
+ onSuccess: () => void;
7
+ account: IAccount;
8
+ }
9
+ export declare function EditAccount({ account, onSuccess, styles }: IEditAccount): JSX.Element;
10
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './add-account';
2
+ export * from './account-list';
3
+ export * from './delete-account';
4
+ export * from './login';
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ILoginResp } from '../../api-caller/account.typed';
3
+ import { IStyles } from '../styles';
4
+ interface ILoginForm {
5
+ postSubmit: (resp: ILoginResp) => void;
6
+ styles?: IStyles;
7
+ }
8
+ export declare function LoginForm({ postSubmit, styles }: ILoginForm): JSX.Element;
9
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { IStyles } from '../styles';
3
+ import { ISettingsFormConfig } from '../types';
4
+ import { ILoginResp } from '../../api-caller/account.typed';
5
+ interface ILogin {
6
+ styles?: IStyles;
7
+ config: ISettingsFormConfig;
8
+ onSuccess: (resp: ILoginResp) => void;
9
+ }
10
+ export declare function Login({ styles, config, onSuccess }: ILogin): JSX.Element;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { IStyles } from './styles';
3
+ interface IRoleSelector {
4
+ value: number;
5
+ onChange: (v: number) => void;
6
+ styles: IStyles;
7
+ }
8
+ export declare const RoleSelector: import("react").ForwardRefExoticComponent<IRoleSelector & import("react").RefAttributes<unknown>>;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { MantineSize } from '@mantine/core';
2
+ export interface IStyles {
3
+ size: MantineSize;
4
+ spacing: MantineSize;
5
+ button: {
6
+ size: MantineSize;
7
+ };
8
+ }
9
+ export declare const defaultStyles: IStyles;
@@ -0,0 +1,3 @@
1
+ export interface ISettingsFormConfig {
2
+ apiBaseURL: string;
3
+ }
@@ -0,0 +1,21 @@
1
+ import { IAccount, IEditAccountPayload, ILoginResp } from './account.typed';
2
+ import { PaginationResponse } from './types';
3
+ export declare const account: {
4
+ login: (name: string, password: string) => Promise<ILoginResp>;
5
+ list: () => Promise<PaginationResponse<IAccount>>;
6
+ /**
7
+ * get current account
8
+ */
9
+ get: () => Promise<IAccount>;
10
+ /**
11
+ * update current account
12
+ */
13
+ update: (name: string, email: string) => Promise<IAccount>;
14
+ /**
15
+ * change current account's password
16
+ */
17
+ changepassword: (old_password: string, new_password: string) => Promise<IAccount>;
18
+ create: (name: string, email: string, password: string, role_id: number) => Promise<IAccount>;
19
+ edit: (payload: IEditAccountPayload) => Promise<IAccount>;
20
+ delete: (id: string) => Promise<void>;
21
+ };
@@ -0,0 +1,20 @@
1
+ export interface IAccount {
2
+ id: string;
3
+ name: string;
4
+ email: string;
5
+ role_id: number;
6
+ create_time: string;
7
+ update_time: string;
8
+ }
9
+ export interface IEditAccountPayload {
10
+ id: string;
11
+ name: string;
12
+ email: string;
13
+ role_id: number;
14
+ reset_password: boolean;
15
+ new_password?: string;
16
+ }
17
+ export interface ILoginResp {
18
+ account: IAccount;
19
+ token: string;
20
+ }
@@ -4,4 +4,17 @@ export declare const APICaller: {
4
4
  create: (type: import("./datasource.typed").DataSourceType, key: string, config: import("./datasource.typed").IDataSourceConfig) => Promise<false | import("./types").PaginationResponse<import("./datasource.typed").IDataSource>>;
5
5
  delete: (id: string) => Promise<void>;
6
6
  };
7
+ account: {
8
+ login: (name: string, password: string) => Promise<import("./account.typed").ILoginResp>;
9
+ list: () => Promise<import("./types").PaginationResponse<import("./account.typed").IAccount>>;
10
+ get: () => Promise<import("./account.typed").IAccount>;
11
+ update: (name: string, email: string) => Promise<import("./account.typed").IAccount>;
12
+ changepassword: (old_password: string, new_password: string) => Promise<import("./account.typed").IAccount>;
13
+ create: (name: string, email: string, password: string, role_id: number) => Promise<import("./account.typed").IAccount>;
14
+ edit: (payload: import("./account.typed").IEditAccountPayload) => Promise<import("./account.typed").IAccount>;
15
+ delete: (id: string) => Promise<void>;
16
+ };
17
+ role: {
18
+ list: () => Promise<import("./role.typed").IRole[]>;
19
+ };
7
20
  };
@@ -0,0 +1,4 @@
1
+ import { IRole } from './role.typed';
2
+ export declare const role: {
3
+ list: () => Promise<IRole[]>;
4
+ };
@@ -0,0 +1,5 @@
1
+ export interface IRole {
2
+ id: number;
3
+ name: string;
4
+ description: string;
5
+ }
@@ -2,5 +2,8 @@ import { MantineSize } from '@mantine/core';
2
2
  export interface IStyles {
3
3
  size: MantineSize;
4
4
  spacing: MantineSize;
5
+ button: {
6
+ size: MantineSize;
7
+ };
5
8
  }
6
9
  export declare const defaultStyles: IStyles;
package/dist/index.d.ts CHANGED
@@ -1 +1,5 @@
1
1
  export * from './datasource';
2
+ export * from './account';
3
+ export * from './api-caller/account.typed';
4
+ export * from './api-caller/datasource.typed';
5
+ export * from './api-caller/role.typed';