@wecode-team/we0-cms 1.0.18

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.
Files changed (42) hide show
  1. package/README.md +450 -0
  2. package/dist/components/componets/message.d.ts +42 -0
  3. package/dist/components/filters/DynamicFilters.d.ts +7 -0
  4. package/dist/components/json/JsonField.d.ts +11 -0
  5. package/dist/components/json/json-utils.d.ts +19 -0
  6. package/dist/components/page-shadcn.d.ts +16 -0
  7. package/dist/components/pages/admin.d.ts +2 -0
  8. package/dist/components/pages/data-list.d.ts +2 -0
  9. package/dist/components/pages/data-manage.d.ts +3 -0
  10. package/dist/components/pages/login.d.ts +6 -0
  11. package/dist/components/pages/model-create.d.ts +2 -0
  12. package/dist/components/pages/test-json.d.ts +2 -0
  13. package/dist/components/prase.d.ts +5 -0
  14. package/dist/components/routes.d.ts +12 -0
  15. package/dist/components/types.d.ts +69 -0
  16. package/dist/components/ui/badge.d.ts +9 -0
  17. package/dist/components/ui/button.d.ts +11 -0
  18. package/dist/components/ui/card.d.ts +8 -0
  19. package/dist/components/ui/dialog.d.ts +19 -0
  20. package/dist/components/ui/dropdown-menu.d.ts +27 -0
  21. package/dist/components/ui/input.d.ts +3 -0
  22. package/dist/components/ui/label.d.ts +5 -0
  23. package/dist/components/ui/select.d.ts +13 -0
  24. package/dist/components/ui/separator.d.ts +4 -0
  25. package/dist/components/ui/sheet.d.ts +25 -0
  26. package/dist/components/ui/sidebar.d.ts +50 -0
  27. package/dist/components/ui/skeleton.d.ts +3 -0
  28. package/dist/components/ui/switch.d.ts +4 -0
  29. package/dist/components/ui/table.d.ts +10 -0
  30. package/dist/components/ui/textarea.d.ts +3 -0
  31. package/dist/components/ui/tooltip.d.ts +7 -0
  32. package/dist/hooks/use-mobile.d.ts +1 -0
  33. package/dist/index.css +3 -0
  34. package/dist/index.d.ts +7 -0
  35. package/dist/index.esm.js +11 -0
  36. package/dist/index.esm.js.map +1 -0
  37. package/dist/index.js +11 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/lib/utils.d.ts +2 -0
  40. package/dist/request.d.ts +14 -0
  41. package/dist/services/index.d.ts +121 -0
  42. package/package.json +89 -0
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * CMS Request 网络请求工具
3
+ * 专用于CMS系统的独立请求实例
4
+ * 基于 axios 封装
5
+ */
6
+ import { AxiosInstance, AxiosRequestConfig } from 'axios';
7
+ declare const request: {
8
+ get: (url: string, params?: any, config?: AxiosRequestConfig) => Promise<any>;
9
+ post: (url: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
10
+ put: (url: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
11
+ delete: (url: string, config?: AxiosRequestConfig) => Promise<any>;
12
+ instance: AxiosInstance;
13
+ };
14
+ export default request;
@@ -0,0 +1,121 @@
1
+ export interface ApiResponse<T = any> {
2
+ success: boolean;
3
+ message?: string;
4
+ data?: T;
5
+ error?: string;
6
+ }
7
+ export type RelationType = 'belongsTo' | 'hasMany' | 'belongsToMany';
8
+ export interface RelationConfig {
9
+ type: RelationType;
10
+ target: string;
11
+ foreignKey?: string;
12
+ targetKey?: string;
13
+ through?: string;
14
+ displayField?: string;
15
+ showInList?: boolean;
16
+ }
17
+ export interface RelationOption {
18
+ id: number | string;
19
+ label: string;
20
+ [key: string]: any;
21
+ }
22
+ export interface SchemaField {
23
+ name: string;
24
+ type: string;
25
+ required?: boolean;
26
+ unique?: boolean;
27
+ maxLength?: number;
28
+ defaultValue?: any;
29
+ comment?: string;
30
+ relation?: RelationConfig;
31
+ }
32
+ export interface CmsModel {
33
+ id: number;
34
+ name: string;
35
+ table_name: string;
36
+ json_schema: {
37
+ fields: SchemaField[];
38
+ };
39
+ created_at: string;
40
+ updated_at: string;
41
+ }
42
+ export interface TableData {
43
+ [key: string]: any;
44
+ }
45
+ export interface PaginatedData<T> {
46
+ data: T[];
47
+ total: number;
48
+ current: number;
49
+ pageSize: number;
50
+ }
51
+ export interface SupabaseFilter {
52
+ column: string;
53
+ operator: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "ilike" | "in" | "is";
54
+ value: any;
55
+ }
56
+ export declare function setSessionId(sessionId: string): void;
57
+ export declare const modelApi: {
58
+ getModels: () => Promise<ApiResponse<CmsModel[]>>;
59
+ createModel: (data: Partial<CmsModel>) => Promise<ApiResponse<CmsModel>>;
60
+ updateModel: (data: {
61
+ id: string;
62
+ } & Partial<CmsModel>) => Promise<ApiResponse<CmsModel>>;
63
+ deleteModel: (id: string) => Promise<ApiResponse<void>>;
64
+ };
65
+ export interface TableDataParams {
66
+ page?: number;
67
+ limit?: number;
68
+ search?: string;
69
+ filters?: string | SupabaseFilter[];
70
+ }
71
+ export interface LoginRequest {
72
+ username: string;
73
+ password: string;
74
+ }
75
+ export interface LoginResponse {
76
+ token: string;
77
+ user: {
78
+ id: string;
79
+ username: string;
80
+ role: string;
81
+ session_id?: string;
82
+ };
83
+ }
84
+ export interface User {
85
+ id: string;
86
+ username: string;
87
+ role: string;
88
+ session_id?: string;
89
+ created_at: string;
90
+ updated_at: string;
91
+ }
92
+ export declare const authApi: {
93
+ signupStatus: () => Promise<ApiResponse<{
94
+ session_id: string;
95
+ hasAdmin: boolean;
96
+ allowSignup: boolean;
97
+ }>>;
98
+ signup: (data: LoginRequest) => Promise<ApiResponse<LoginResponse>>;
99
+ login: (data: LoginRequest) => Promise<ApiResponse<LoginResponse>>;
100
+ verifyAuth: () => Promise<ApiResponse<any>>;
101
+ getCurrentUser: () => Promise<ApiResponse<User>>;
102
+ logout: () => void;
103
+ getToken: () => string | null;
104
+ getStoredUser: () => User | null;
105
+ isLoggedIn: () => boolean;
106
+ };
107
+ export interface RelationOptionsParams {
108
+ displayField?: string;
109
+ limit?: number;
110
+ search?: string;
111
+ }
112
+ export declare const dataApi: {
113
+ getTableData: (tableName: string, params?: TableDataParams) => Promise<ApiResponse<PaginatedData<TableData>>>;
114
+ getTableDataWithRelations: (tableName: string, params?: TableDataParams) => Promise<ApiResponse<PaginatedData<TableData>>>;
115
+ getRelationOptions: (tableName: string, params?: RelationOptionsParams) => Promise<ApiResponse<RelationOption[]>>;
116
+ createData: (tableName: string, data: TableData) => Promise<ApiResponse<TableData>>;
117
+ updateData: (tableName: string, data: {
118
+ id: string;
119
+ } & TableData) => Promise<ApiResponse<TableData>>;
120
+ deleteData: (tableName: string, id: string) => Promise<ApiResponse<void>>;
121
+ };
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@wecode-team/we0-cms",
3
+ "version": "1.0.18",
4
+ "description": "A CMS component for React applications with shadcn/ui",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.esm.js",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.esm.js"
14
+ },
15
+ "./dist/index.css": "./dist/index.css"
16
+ },
17
+ "style": "dist/index.css",
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "build": "rollup -c --bundleConfigAsCjs",
24
+ "prepublishOnly": "npm run build",
25
+ "test": "echo \"Error: no test specified\" && exit 1"
26
+ },
27
+ "keywords": [
28
+ "react",
29
+ "cms",
30
+ "component",
31
+ "shadcn",
32
+ "tailwindcss"
33
+ ],
34
+ "author": "wecode-team",
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/wecode-team/wequicksandbox.git",
39
+ "directory": "packages/we0-cms"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public",
43
+ "git-checks": false
44
+ },
45
+ "peerDependencies": {
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0"
48
+ },
49
+ "dependencies": {
50
+ "@radix-ui/react-dialog": "^1.1.15",
51
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
52
+ "@radix-ui/react-label": "^2.1.8",
53
+ "@radix-ui/react-select": "^2.2.6",
54
+ "@radix-ui/react-separator": "^1.1.8",
55
+ "@radix-ui/react-slot": "^1.2.4",
56
+ "@radix-ui/react-switch": "^1.2.6",
57
+ "@radix-ui/react-tooltip": "^1.2.8",
58
+ "antd": "^5.12.8",
59
+ "class-variance-authority": "^0.7.0",
60
+ "clsx": "^2.1.0",
61
+ "lucide-react": "^0.344.0",
62
+ "tailwind-merge": "^2.2.0"
63
+ },
64
+ "devDependencies": {
65
+ "@babel/core": "^7.22.5",
66
+ "@babel/plugin-transform-runtime": "^7.22.5",
67
+ "@babel/preset-env": "^7.22.5",
68
+ "@babel/preset-react": "^7.22.5",
69
+ "@babel/runtime": "^7.22.5",
70
+ "@rollup/plugin-babel": "^6.0.3",
71
+ "@rollup/plugin-commonjs": "^25.0.0",
72
+ "@rollup/plugin-json": "^6.1.0",
73
+ "@rollup/plugin-node-resolve": "^15.1.0",
74
+ "@rollup/plugin-terser": "^0.4.4",
75
+ "@rollup/plugin-typescript": "^11.1.1",
76
+ "@types/react": "18.3.27",
77
+ "@types/react-dom": "18.3.1",
78
+ "autoprefixer": "^10.4.20",
79
+ "axios": "^1.0.0",
80
+ "dayjs": "^1.11.0",
81
+ "postcss": "^8.4.47",
82
+ "rollup": "^3.25.1",
83
+ "rollup-plugin-postcss": "^4.0.2",
84
+ "tailwindcss": "^3.4.13",
85
+ "tailwindcss-animate": "^1.0.7",
86
+ "typescript": "^5.1.3",
87
+ "uuid": "^11.1.0"
88
+ }
89
+ }