proje-react-panel 1.0.15 → 1.0.17-test-8
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/.vscode/launch.json +10 -0
- package/dist/components/components/FormField.d.ts +6 -1
- package/dist/components/components/InnerForm.d.ts +9 -4
- package/dist/components/components/Uploader.d.ts +8 -0
- package/dist/components/components/index.d.ts +1 -1
- package/dist/components/components/list/Datagrid.d.ts +9 -0
- package/dist/components/components/list/EmptyList.d.ts +2 -0
- package/dist/components/components/list/FilterPopup.d.ts +11 -0
- package/dist/components/components/list/ListPage.d.ts +20 -0
- package/dist/components/components/list/Pagination.d.ts +11 -0
- package/dist/components/components/list/index.d.ts +0 -0
- package/dist/components/list/Datagrid.d.ts +8 -4
- package/dist/components/list/EmptyList.d.ts +2 -0
- package/dist/components/list/FilterPopup.d.ts +10 -0
- package/dist/components/pages/FormPage.d.ts +10 -3
- package/dist/components/pages/ListPage.d.ts +2 -1
- package/dist/decorators/form/Input.d.ts +8 -3
- package/dist/decorators/list/Cell.d.ts +14 -2
- package/dist/decorators/list/List.d.ts +26 -4
- package/dist/decorators/list/ListData.d.ts +4 -4
- package/dist/decorators/list/getListFields.d.ts +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.esm.js +1 -1
- package/dist/types/AnyClass.d.ts +1 -1
- package/dist/types/ScreenCreatorData.d.ts +5 -5
- package/package.json +9 -3
- package/src/assets/icons/svg/create.svg +9 -0
- package/src/assets/icons/svg/filter.svg +3 -0
- package/src/assets/icons/svg/pencil.svg +8 -0
- package/src/assets/icons/svg/search.svg +8 -0
- package/src/assets/icons/svg/trash.svg +8 -0
- package/src/components/components/FormField.tsx +52 -9
- package/src/components/components/InnerForm.tsx +53 -15
- package/src/components/components/Uploader.tsx +66 -0
- package/src/components/components/index.ts +2 -2
- package/src/components/components/list/Datagrid.tsx +135 -0
- package/src/components/components/list/EmptyList.tsx +26 -0
- package/src/components/components/list/FilterPopup.tsx +202 -0
- package/src/components/components/list/ListPage.tsx +176 -0
- package/src/components/pages/FormPage.tsx +12 -3
- package/src/decorators/form/Input.ts +7 -4
- package/src/decorators/form/getFormFields.ts +1 -0
- package/src/decorators/list/Cell.ts +24 -14
- package/src/decorators/list/List.ts +26 -11
- package/src/decorators/list/ListData.ts +5 -5
- package/src/decorators/list/getListFields.ts +8 -8
- package/src/index.ts +8 -3
- package/src/styles/filter-popup.scss +134 -0
- package/src/styles/form.scss +2 -4
- package/src/styles/index.scss +18 -22
- package/src/styles/list.scss +151 -8
- package/src/styles/uploader.scss +86 -0
- package/src/types/AnyClass.ts +3 -1
- package/src/types/ScreenCreatorData.ts +12 -12
- package/src/types/svg.d.ts +5 -0
- package/src/components/components/ImageUploader.tsx +0 -301
- package/src/components/list/Datagrid.tsx +0 -101
- package/src/components/pages/ListPage.tsx +0 -85
- /package/src/components/{list → components/list}/Pagination.tsx +0 -0
- /package/src/components/{list → components/list}/index.ts +0 -0
- /package/src/styles/{_scrollbar.scss → utils/scrollbar.scss} +0 -0
package/.vscode/launch.json
CHANGED
@@ -12,6 +12,16 @@
|
|
12
12
|
"runtimeArgs": ["build"],
|
13
13
|
"console": "integratedTerminal",
|
14
14
|
"internalConsoleOptions": "neverOpen"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"type": "node",
|
18
|
+
"request": "launch",
|
19
|
+
"name": "Run Example Dev Server",
|
20
|
+
"runtimeExecutable": "yarn",
|
21
|
+
"runtimeArgs": ["dev"],
|
22
|
+
"cwd": "${workspaceFolder}/examples",
|
23
|
+
"console": "integratedTerminal",
|
24
|
+
"internalConsoleOptions": "neverOpen"
|
15
25
|
}
|
16
26
|
]
|
17
27
|
}
|
@@ -7,6 +7,11 @@ interface FormFieldProps {
|
|
7
7
|
error?: {
|
8
8
|
message?: string;
|
9
9
|
};
|
10
|
+
baseName?: string;
|
11
|
+
onSelectPreloader?: (inputOptions: InputOptions) => Promise<{
|
12
|
+
label: string;
|
13
|
+
value: string;
|
14
|
+
}[]>;
|
10
15
|
}
|
11
|
-
export declare function FormField({ input, register, error }: FormFieldProps): React.JSX.Element;
|
16
|
+
export declare function FormField({ input, register, error, baseName, onSelectPreloader }: FormFieldProps): React.JSX.Element;
|
12
17
|
export {};
|
@@ -1,12 +1,17 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { InputOptions } from '../../decorators/form/Input';
|
2
3
|
import { FormOptions } from '../../decorators/form/FormOptions';
|
3
|
-
import { AnyClass } from '../../types/AnyClass';
|
4
4
|
import { OnSubmitFN, GetDetailsDataFN } from '../pages/FormPage';
|
5
|
-
interface InnerFormProps<T
|
5
|
+
interface InnerFormProps<T> {
|
6
6
|
formOptions: FormOptions;
|
7
7
|
onSubmit: OnSubmitFN<T>;
|
8
|
-
redirect?: string;
|
9
8
|
getDetailsData?: GetDetailsDataFN<T>;
|
9
|
+
redirectBackOnSuccess?: boolean;
|
10
|
+
onSelectPreloader?: (inputOptions: InputOptions) => Promise<{
|
11
|
+
label: string;
|
12
|
+
value: string;
|
13
|
+
}[]>;
|
14
|
+
type?: 'json' | 'formData';
|
10
15
|
}
|
11
|
-
export declare function InnerForm<T
|
16
|
+
export declare function InnerForm<T>({ formOptions, onSubmit, getDetailsData, redirectBackOnSuccess, onSelectPreloader, type, }: InnerFormProps<T>): React.JSX.Element;
|
12
17
|
export {};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { InputOptions } from '../../decorators/form/Input';
|
3
|
+
interface UploaderProps {
|
4
|
+
input: InputOptions;
|
5
|
+
maxLength?: number;
|
6
|
+
}
|
7
|
+
export declare function Uploader({ input, maxLength }: UploaderProps): React.JSX.Element;
|
8
|
+
export {};
|
@@ -2,7 +2,7 @@ export { InnerForm } from './InnerForm';
|
|
2
2
|
export { FormField } from './FormField';
|
3
3
|
export { LoadingScreen } from './LoadingScreen';
|
4
4
|
export { Counter } from './Counter';
|
5
|
-
export {
|
5
|
+
export { Uploader } from './Uploader';
|
6
6
|
export { ErrorComponent } from './ErrorComponent';
|
7
7
|
export { Label } from './Label';
|
8
8
|
export { ErrorBoundary } from './ErrorBoundary';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ListData } from '../../../decorators/list/ListData';
|
3
|
+
interface DatagridProps<T> {
|
4
|
+
data: T[];
|
5
|
+
listData: ListData<T>;
|
6
|
+
onRemoveItem?: (item: T) => Promise<void>;
|
7
|
+
}
|
8
|
+
export declare function Datagrid<T>({ data, listData, onRemoveItem }: DatagridProps<T>): React.JSX.Element;
|
9
|
+
export {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ListData } from '../../../decorators/list/ListData';
|
3
|
+
interface FilterPopupProps<T> {
|
4
|
+
isOpen: boolean;
|
5
|
+
onClose: () => void;
|
6
|
+
onApplyFilters: (filters: Record<string, string>) => void;
|
7
|
+
listData: ListData<T>;
|
8
|
+
activeFilters?: Record<string, string>;
|
9
|
+
}
|
10
|
+
export declare function FilterPopup<T>({ isOpen, onClose, onApplyFilters, listData, activeFilters, }: FilterPopupProps<T>): React.ReactElement | null;
|
11
|
+
export {};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { AnyClass } from '../../../types/AnyClass';
|
3
|
+
export interface GetDataParams {
|
4
|
+
page?: number;
|
5
|
+
limit?: number;
|
6
|
+
filters?: Record<string, any>;
|
7
|
+
}
|
8
|
+
export interface PaginatedResponse<T> {
|
9
|
+
data: T[];
|
10
|
+
total: number;
|
11
|
+
page: number;
|
12
|
+
limit: number;
|
13
|
+
}
|
14
|
+
export type GetDataForList<T> = (params: GetDataParams) => Promise<PaginatedResponse<T>>;
|
15
|
+
export declare function ListPage<T extends AnyClass>({ model, getData, onRemoveItem, customHeader, }: {
|
16
|
+
model: any;
|
17
|
+
getData: GetDataForList<T>;
|
18
|
+
customHeader?: React.ReactNode;
|
19
|
+
onRemoveItem?: (item: T) => Promise<void>;
|
20
|
+
}): React.JSX.Element;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface PaginationProps {
|
3
|
+
pagination: {
|
4
|
+
total: number;
|
5
|
+
page: number;
|
6
|
+
limit: number;
|
7
|
+
};
|
8
|
+
onPageChange: (page: number) => void;
|
9
|
+
}
|
10
|
+
export declare function Pagination({ pagination, onPageChange }: PaginationProps): React.JSX.Element | null;
|
11
|
+
export {};
|
File without changes
|
@@ -1,8 +1,12 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
3
|
-
interface ListProps<T
|
2
|
+
import { ListData } from '../../decorators/list/ListData';
|
3
|
+
interface ListProps<T extends {
|
4
|
+
id: string;
|
5
|
+
}> {
|
4
6
|
data: T[];
|
5
|
-
|
7
|
+
listData: ListData;
|
6
8
|
}
|
7
|
-
export declare function Datagrid<T
|
9
|
+
export declare function Datagrid<T extends {
|
10
|
+
id: string;
|
11
|
+
}>({ data, listData }: ListProps<T>): React.JSX.Element;
|
8
12
|
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { CellOptions } from '../../decorators/list/Cell';
|
3
|
+
interface FilterPopupProps {
|
4
|
+
isOpen: boolean;
|
5
|
+
onClose: () => void;
|
6
|
+
onApplyFilters: (filters: any) => void;
|
7
|
+
fields: CellOptions[];
|
8
|
+
}
|
9
|
+
export declare const FilterPopup: React.FC<FilterPopupProps>;
|
10
|
+
export {};
|
@@ -1,11 +1,18 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { AnyClass } from '../../types/AnyClass';
|
3
|
-
|
3
|
+
import { InputOptions } from '../../decorators/form/Input';
|
4
|
+
export type GetDetailsDataFN<T> = (param: Record<string, string>) => Promise<T>;
|
4
5
|
export type OnSubmitFN<T> = (data: T) => Promise<T>;
|
5
6
|
export interface FormPageProps<T extends AnyClass> {
|
6
|
-
model:
|
7
|
+
model: any;
|
7
8
|
getDetailsData?: GetDetailsDataFN<T>;
|
8
9
|
redirect?: string;
|
9
10
|
onSubmit: OnSubmitFN<T>;
|
11
|
+
onSelectPreloader?: (inputOptions: InputOptions) => Promise<{
|
12
|
+
label: string;
|
13
|
+
value: string;
|
14
|
+
}[]>;
|
15
|
+
redirectBackOnSuccess?: boolean;
|
16
|
+
type?: 'json' | 'formData';
|
10
17
|
}
|
11
|
-
export declare function FormPage<T extends AnyClass>({ model, getDetailsData, onSubmit, redirect, ...rest }: FormPageProps<T>): React.JSX.Element;
|
18
|
+
export declare function FormPage<T extends AnyClass>({ model, getDetailsData, onSubmit, redirect, onSelectPreloader, redirectBackOnSuccess, type, ...rest }: FormPageProps<T>): React.JSX.Element;
|
@@ -3,6 +3,7 @@ import { AnyClass } from '../../types/AnyClass';
|
|
3
3
|
export interface PaginationParams {
|
4
4
|
page?: number;
|
5
5
|
limit?: number;
|
6
|
+
filters?: Record<string, any>;
|
6
7
|
}
|
7
8
|
export interface PaginatedResponse<T> {
|
8
9
|
data: T[];
|
@@ -10,7 +11,7 @@ export interface PaginatedResponse<T> {
|
|
10
11
|
page: number;
|
11
12
|
limit: number;
|
12
13
|
}
|
13
|
-
export type GetDataForList<T> = (
|
14
|
+
export type GetDataForList<T> = (params: PaginationParams) => Promise<PaginatedResponse<T>>;
|
14
15
|
export declare function ListPage<T extends AnyClass>({ model, getData, }: {
|
15
16
|
model: T;
|
16
17
|
getData: GetDataForList<T>;
|
@@ -1,13 +1,18 @@
|
|
1
1
|
import 'reflect-metadata';
|
2
2
|
import { AnyClass } from '../../types/AnyClass';
|
3
3
|
export interface InputOptions {
|
4
|
+
type?: 'input' | 'select' | 'textarea' | 'file-upload' | 'checkbox' | 'hidden' | 'nested';
|
5
|
+
inputType?: 'text' | 'email' | 'tel' | 'password' | 'number' | 'date';
|
4
6
|
name?: string;
|
5
7
|
label?: string;
|
6
8
|
placeholder?: string;
|
7
|
-
inputType?: 'text' | 'email' | 'tel' | 'password' | 'number' | 'date';
|
8
|
-
type?: 'input' | 'select' | 'textarea' | 'file-upload' | 'checkbox' | 'hidden';
|
9
|
-
selectOptions?: string[];
|
10
9
|
cancelPasswordValidationOnEdit?: boolean;
|
10
|
+
options?: {
|
11
|
+
value: string;
|
12
|
+
label: string;
|
13
|
+
}[];
|
14
|
+
optionsPreload?: boolean;
|
15
|
+
nestedFields?: InputOptions[];
|
11
16
|
}
|
12
17
|
export declare function Input(options?: InputOptions): PropertyDecorator;
|
13
18
|
export declare function getInputFields<T extends AnyClass>(entityClass: T): InputOptions[];
|
@@ -1,9 +1,21 @@
|
|
1
|
-
import
|
1
|
+
import 'reflect-metadata';
|
2
2
|
export declare const CELL_KEY: unique symbol;
|
3
|
+
interface Filter {
|
4
|
+
type: 'string' | 'number' | 'date' | 'static-select';
|
5
|
+
}
|
6
|
+
export interface StaticSelectFilter extends Filter {
|
7
|
+
type: 'static-select';
|
8
|
+
options: {
|
9
|
+
value: string;
|
10
|
+
label: string;
|
11
|
+
}[];
|
12
|
+
}
|
3
13
|
export interface CellOptions {
|
4
14
|
name?: string;
|
5
15
|
title?: string;
|
6
|
-
type?:
|
16
|
+
type?: 'string' | 'date' | 'image' | 'number';
|
7
17
|
placeHolder?: string;
|
18
|
+
filter?: Filter | StaticSelectFilter;
|
8
19
|
}
|
9
20
|
export declare function Cell(options?: CellOptions): PropertyDecorator;
|
21
|
+
export {};
|
@@ -1,5 +1,27 @@
|
|
1
|
-
import
|
2
|
-
export interface
|
1
|
+
import 'reflect-metadata';
|
2
|
+
export interface ListHeaderOptions {
|
3
|
+
title?: string;
|
4
|
+
create?: {
|
5
|
+
path: string;
|
6
|
+
label: string;
|
7
|
+
};
|
3
8
|
}
|
4
|
-
export
|
5
|
-
|
9
|
+
export interface ListCellOptions<T> {
|
10
|
+
details?: {
|
11
|
+
path: string;
|
12
|
+
label: string;
|
13
|
+
};
|
14
|
+
edit?: {
|
15
|
+
path: string;
|
16
|
+
label: string;
|
17
|
+
};
|
18
|
+
delete?: {
|
19
|
+
label: string;
|
20
|
+
};
|
21
|
+
}
|
22
|
+
export interface ListOptions<T> {
|
23
|
+
headers?: ListHeaderOptions;
|
24
|
+
cells?: ((item: T) => ListCellOptions<T>) | ListCellOptions<T>;
|
25
|
+
}
|
26
|
+
export declare function List<T>(options?: ListOptions<T> | ((item: T) => ListOptions<T>)): ClassDecorator;
|
27
|
+
export declare function getClassListData<T>(entityClass: T): ListOptions<T> | undefined;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { ListOptions } from
|
2
|
-
import { CellOptions } from
|
3
|
-
export interface ListData {
|
4
|
-
list?: ListOptions
|
1
|
+
import { ListOptions } from './List';
|
2
|
+
import { CellOptions } from './Cell';
|
3
|
+
export interface ListData<T> {
|
4
|
+
list?: ListOptions<T>;
|
5
5
|
cells: CellOptions[];
|
6
6
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { ListData } from
|
2
|
-
export declare function getListFields<T>(entityClass: T): ListData
|
1
|
+
import { ListData } from './ListData';
|
2
|
+
export declare function getListFields<T>(entityClass: T): ListData<T>;
|