@dakataa/crud-react 1.0.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.
- package/.env +3 -0
- package/README.md +58 -0
- package/babel-plugin-macros.config.js +5 -0
- package/index.html +12 -0
- package/package.json +74 -0
- package/public/favicon.ico +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/Crud.tsx +29 -0
- package/src/CrudContext.tsx +21 -0
- package/src/CrudLoader.tsx +27 -0
- package/src/assets/images/alert/denied.json +1 -0
- package/src/assets/images/alert/info.json +1 -0
- package/src/assets/images/alert/success.json +1 -0
- package/src/assets/images/alert/warning.json +1 -0
- package/src/assets/style/alert.scss +97 -0
- package/src/component/Animation.tsx +50 -0
- package/src/component/BaseButton.tsx +26 -0
- package/src/component/Button.tsx +15 -0
- package/src/component/Dropdown.tsx +55 -0
- package/src/component/EmptyView.tsx +5 -0
- package/src/component/Link.tsx +11 -0
- package/src/component/Modal.tsx +174 -0
- package/src/component/ModifyForm.tsx +139 -0
- package/src/component/TemplateBlock.tsx +21 -0
- package/src/component/TemplateExtend.tsx +17 -0
- package/src/component/TemplateParentBlock.tsx +7 -0
- package/src/component/Translation.tsx +7 -0
- package/src/component/ViewLoader.tsx +33 -0
- package/src/component/crud/DynamicView.tsx +42 -0
- package/src/component/crud/FormView.tsx +29 -0
- package/src/component/crud/GridTableView.tsx +205 -0
- package/src/component/crud/PaginatorView.tsx +80 -0
- package/src/component/error/ErrorBoundary.tsx +78 -0
- package/src/component/error/Exception.tsx +17 -0
- package/src/component/error/HttpException.tsx +24 -0
- package/src/component/form/Choice.tsx +119 -0
- package/src/component/form/Form.tsx +233 -0
- package/src/component/form/FormAlert.tsx +19 -0
- package/src/component/form/FormFieldError.tsx +16 -0
- package/src/component/form/FormGroup.tsx +53 -0
- package/src/component/form/FormWidget.tsx +34 -0
- package/src/component/form/Input.tsx +63 -0
- package/src/component/form/constraint/Contraint.tsx +8 -0
- package/src/component/form/constraint/NotBlank.tsx +20 -0
- package/src/component/hooks/GetData.tsx +137 -0
- package/src/context/ActionContext.tsx +99 -0
- package/src/context/AlertContext.tsx +181 -0
- package/src/context/ModalContext.tsx +56 -0
- package/src/context/SessionContext.tsx +97 -0
- package/src/helper/ObjectUtils.tsx +36 -0
- package/src/helper/RouterUtils.tsx +24 -0
- package/src/helper/StingUtils.tsx +25 -0
- package/src/index.tsx +23 -0
- package/src/layout/default/Base.tsx +15 -0
- package/src/layout/default/Error.tsx +27 -0
- package/src/layout/default/Main.tsx +64 -0
- package/src/layout/default/component/Navigation.tsx +197 -0
- package/src/page/List.tsx +268 -0
- package/src/page/Modify.tsx +156 -0
- package/src/react-app-env.d.ts +2 -0
- package/src/setupTests.ts +5 -0
- package/src/type/ActionType.tsx +10 -0
- package/src/type/ColumnType.tsx +18 -0
- package/src/type/ExceptionType.tsx +7 -0
- package/src/type/FormType.tsx +6 -0
- package/src/type/FormViewType.tsx +37 -0
- package/src/type/ListMetaType.tsx +7 -0
- package/src/type/ListType.tsx +20 -0
- package/src/type/ModifyType.tsx +10 -0
- package/src/type/RedirectType.tsx +6 -0
- package/src/type/RouteType.tsx +5 -0
- package/tsconfig.app.json +46 -0
- package/tsconfig.json +11 -0
- package/tsconfig.node.json +15 -0
- package/vite.config.ts +33 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type FormViewType = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
full_name: string
|
|
5
|
+
label: string | undefined;
|
|
6
|
+
label_attr?: { [key: string]: string } | Function;
|
|
7
|
+
label_html?: boolean;
|
|
8
|
+
placeholder?: string | undefined;
|
|
9
|
+
placeholder_attr?: { [key: string]: string } | Function;
|
|
10
|
+
placeholder_in_choices?: boolean;
|
|
11
|
+
help?: string | null | undefined;
|
|
12
|
+
help_attr?: { [key: string]: string } | Function;
|
|
13
|
+
help_html?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
submitted?: boolean;
|
|
17
|
+
expanded?: boolean;
|
|
18
|
+
multiple?: boolean;
|
|
19
|
+
checked?: boolean;
|
|
20
|
+
priority?: number;
|
|
21
|
+
type: 'form' | string;
|
|
22
|
+
valid?: boolean;
|
|
23
|
+
errors?: string[];
|
|
24
|
+
children?: { [key: string]: FormViewType };
|
|
25
|
+
choices?: ChoiceType[];
|
|
26
|
+
choice_attr?: {[key: string]: {[key: string]: string}} | Function
|
|
27
|
+
preferred_choices?: { [key: string]: any };
|
|
28
|
+
attr?: { [key: string]: string } | Function;
|
|
29
|
+
data?: any;
|
|
30
|
+
rendered?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ChoiceType = {
|
|
34
|
+
value: string | number | null | Function;
|
|
35
|
+
label: string | (() => string);
|
|
36
|
+
attr?: {[key: string]: {[key: string]: string}} | Function;
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {ColumnType} from "@src/type/ColumnType";
|
|
2
|
+
import {ActionType} from "@src/type/ActionType";
|
|
3
|
+
import {ListMetaType} from "@src/type/ListMetaType";
|
|
4
|
+
import {FormType} from "@src/type/FormType";
|
|
5
|
+
|
|
6
|
+
export type ListType = {
|
|
7
|
+
title: string | null;
|
|
8
|
+
entity: {
|
|
9
|
+
name: string;
|
|
10
|
+
columns: ColumnType[];
|
|
11
|
+
primaryColumn: ColumnType;
|
|
12
|
+
data: {
|
|
13
|
+
items: [{ [key: string]: any }],
|
|
14
|
+
meta: ListMetaType
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
form: { [key: string]: FormType, filter: FormType, batch: FormType },
|
|
18
|
+
sort: { [key: string]: 'ASC' | 'DESC' | null },
|
|
19
|
+
action: { [key: string]: ActionType }
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {FormType} from "@src/type/FormType";
|
|
2
|
+
import {RedirectType} from "@src/type/RedirectType";
|
|
3
|
+
|
|
4
|
+
export type ModifyType = {
|
|
5
|
+
title: string | null;
|
|
6
|
+
object: { [key: string]: any } | null,
|
|
7
|
+
form: { [key: string]: FormType },
|
|
8
|
+
messages: { [key: string]: string[] },
|
|
9
|
+
redirect?: RedirectType
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
"target": "ES2020",
|
|
6
|
+
"useDefineForClassFields": true,
|
|
7
|
+
"lib": [
|
|
8
|
+
"ESNext",
|
|
9
|
+
"DOM",
|
|
10
|
+
"DOM.Iterable"
|
|
11
|
+
],
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"types": [
|
|
15
|
+
"react",
|
|
16
|
+
"vite/client"
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
/* Bundler mode */
|
|
20
|
+
"moduleResolution": "bundler",
|
|
21
|
+
"allowImportingTsExtensions": true,
|
|
22
|
+
"resolveJsonModule": true,
|
|
23
|
+
"isolatedModules": true,
|
|
24
|
+
"moduleDetection": "force",
|
|
25
|
+
"noEmit": true,
|
|
26
|
+
"jsx": "react-jsx",
|
|
27
|
+
|
|
28
|
+
/* Linting */
|
|
29
|
+
"strict": true,
|
|
30
|
+
"noUnusedLocals": false,
|
|
31
|
+
"noUnusedParameters": false,
|
|
32
|
+
"noFallthroughCasesInSwitch": true,
|
|
33
|
+
/* Paths */
|
|
34
|
+
"baseUrl": ".",
|
|
35
|
+
"paths": {
|
|
36
|
+
"@src/*": [
|
|
37
|
+
"./src/*"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"allowSyntheticDefaultImports": true
|
|
41
|
+
},
|
|
42
|
+
"include": [
|
|
43
|
+
"src",
|
|
44
|
+
"crud"
|
|
45
|
+
]
|
|
46
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"composite": true,
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noEmit": true
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"vite.config.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
4
|
+
import path, {join} from "path";
|
|
5
|
+
|
|
6
|
+
export default defineConfig(() => {
|
|
7
|
+
return {
|
|
8
|
+
build: {
|
|
9
|
+
outDir: 'build',
|
|
10
|
+
},
|
|
11
|
+
plugins: [react(), tsconfigPaths()],
|
|
12
|
+
envPrefix: 'CRUD_',
|
|
13
|
+
resolve: {
|
|
14
|
+
alias: [
|
|
15
|
+
{
|
|
16
|
+
find: /~(.+)/,
|
|
17
|
+
replacement: join(process.cwd(), 'node_modules/$1'),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
find: /^@crud\/(.+)/,
|
|
21
|
+
replacement: join(process.cwd(), '/crud/$1'),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
find: /^@src\/(.+)/,
|
|
25
|
+
replacement: join(process.cwd(), '/src/$1'),
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
optimizeDeps: {
|
|
30
|
+
exclude: ['@dakataa/requester']
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
});
|