xladmin 0.1.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/README.md +51 -0
- package/dist/client.d.ts +46 -0
- package/dist/components/AdminFieldEditor.d.ts +18 -0
- package/dist/components/AdminFormDialog.d.ts +16 -0
- package/dist/components/AdminHome.d.ts +7 -0
- package/dist/components/AdminModelPage.d.ts +8 -0
- package/dist/components/AdminObjectPage.d.ts +8 -0
- package/dist/components/AdminShell.d.ts +14 -0
- package/dist/components/AdminSidebar.d.ts +7 -0
- package/dist/hooks/useAdminRequest.d.ts +6 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1670 -0
- package/dist/theme/defaultAdminTheme.d.ts +6 -0
- package/dist/types/index.d.ts +66 -0
- package/dist/utils/adminFields.d.ts +7 -0
- package/package.json +70 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type AdminFieldMeta = {
|
|
2
|
+
name: string;
|
|
3
|
+
label: string;
|
|
4
|
+
help_text: string | null;
|
|
5
|
+
nullable: boolean;
|
|
6
|
+
read_only: boolean;
|
|
7
|
+
hidden_in_list: boolean;
|
|
8
|
+
hidden_in_detail: boolean;
|
|
9
|
+
hidden_in_form: boolean;
|
|
10
|
+
type: string;
|
|
11
|
+
input_kind: string;
|
|
12
|
+
is_primary_key: boolean;
|
|
13
|
+
is_virtual: boolean;
|
|
14
|
+
has_choices: boolean;
|
|
15
|
+
is_relation: boolean;
|
|
16
|
+
is_relation_many: boolean;
|
|
17
|
+
is_sortable: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type AdminBulkActionMeta = {
|
|
20
|
+
slug: string;
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
export type AdminObjectActionMeta = {
|
|
24
|
+
slug: string;
|
|
25
|
+
label: string;
|
|
26
|
+
};
|
|
27
|
+
export type AdminModelMeta = {
|
|
28
|
+
slug: string;
|
|
29
|
+
title: string;
|
|
30
|
+
pk_field: string;
|
|
31
|
+
display_field: string | null;
|
|
32
|
+
page_size: number;
|
|
33
|
+
list_fields: string[];
|
|
34
|
+
detail_fields: string[];
|
|
35
|
+
create_fields: string[];
|
|
36
|
+
update_fields: string[];
|
|
37
|
+
bulk_actions: AdminBulkActionMeta[];
|
|
38
|
+
object_actions: AdminObjectActionMeta[];
|
|
39
|
+
fields: AdminFieldMeta[];
|
|
40
|
+
};
|
|
41
|
+
export type AdminListResponse = {
|
|
42
|
+
meta: AdminModelMeta;
|
|
43
|
+
pagination: {
|
|
44
|
+
limit: number;
|
|
45
|
+
offset: number;
|
|
46
|
+
total: number;
|
|
47
|
+
};
|
|
48
|
+
items: Record<string, unknown>[];
|
|
49
|
+
};
|
|
50
|
+
export type AdminDetailResponse = {
|
|
51
|
+
meta: AdminModelMeta;
|
|
52
|
+
item: Record<string, unknown>;
|
|
53
|
+
};
|
|
54
|
+
export type AdminObjectActionResponse = {
|
|
55
|
+
item: Record<string, unknown>;
|
|
56
|
+
result: Record<string, unknown>;
|
|
57
|
+
};
|
|
58
|
+
export type AdminModelsResponse = {
|
|
59
|
+
items: AdminModelMeta[];
|
|
60
|
+
};
|
|
61
|
+
export type AdminChoicesResponse = {
|
|
62
|
+
items: Array<{
|
|
63
|
+
id: string | number;
|
|
64
|
+
label: string;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AdminFieldMeta } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Готовит payload для create/patch так, чтобы nullable-поля можно было очищать,
|
|
4
|
+
* а служебные пустые поля вроде пароля не улетали в API без необходимости.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildAdminPayload(values: Record<string, unknown>, fields: AdminFieldMeta[]): Record<string, unknown>;
|
|
7
|
+
export declare function formatAdminValue(value: unknown): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "xladmin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generic React + MUI admin frontend for xladmin.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/Artasov/xladmin.git",
|
|
13
|
+
"directory": "xladmin-frontend"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/Artasov/xladmin/tree/main/xladmin-frontend",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Artasov/xladmin/issues"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsup src/index.ts --format esm && tsc --emitDeclarationOnly --declaration --outDir .tmp-types -p tsconfig.json && node ./scripts/postbuild.mjs",
|
|
34
|
+
"check": "tsc --noEmit -p tsconfig.json"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@emotion/react": ">=11.14.0 <12.0.0",
|
|
38
|
+
"@emotion/styled": ">=11.14.0 <12.0.0",
|
|
39
|
+
"@mui/icons-material": ">=7.0.0 <8.0.0",
|
|
40
|
+
"@mui/material": ">=7.0.0 <8.0.0",
|
|
41
|
+
"@mui/x-date-pickers": ">=8.0.0 <9.0.0",
|
|
42
|
+
"axios": ">=1.0.0 <2.0.0",
|
|
43
|
+
"dayjs": ">=1.11.0 <2.0.0",
|
|
44
|
+
"next": ">=15.0.0 <17.0.0",
|
|
45
|
+
"react": ">=19.0.0 <20.0.0",
|
|
46
|
+
"react-dom": ">=19.0.0 <20.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"axios": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@emotion/react": "^11.14.0",
|
|
55
|
+
"@emotion/styled": "^11.14.0",
|
|
56
|
+
"@mui/icons-material": "^7.0.0",
|
|
57
|
+
"@mui/material": "^7.0.0",
|
|
58
|
+
"@mui/x-date-pickers": "^8.27.0",
|
|
59
|
+
"@types/node": "^24.5.2",
|
|
60
|
+
"@types/react": "^19.1.13",
|
|
61
|
+
"@types/react-dom": "^19.1.9",
|
|
62
|
+
"axios": "^1.12.2",
|
|
63
|
+
"dayjs": "^1.11.19",
|
|
64
|
+
"next": "^15.5.4",
|
|
65
|
+
"react": "^19.1.1",
|
|
66
|
+
"react-dom": "^19.1.1",
|
|
67
|
+
"tsup": "^8.5.0",
|
|
68
|
+
"typescript": "^5.9.2"
|
|
69
|
+
}
|
|
70
|
+
}
|