cc1-form 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.
@@ -0,0 +1,32 @@
1
+ import type { App } from 'vue';
2
+ import { type CurdConfig, type CurdConfigColumn, type CurdOption } from './components/TCurd';
3
+ import TColumn from './components/TCurd/com/form/column.vue';
4
+ import TFormList from './components/TCurd/com/form/list.vue';
5
+ import './components/TCurd/index.less';
6
+ import TCurd from './components/TCurd/index.vue';
7
+ import ArrUtil from './utils/ArrUtil';
8
+ import ExcelUtil from './utils/ExcelUtil';
9
+ import TForm from './utils/TForm';
10
+ import TSys from './utils/TSys';
11
+ export declare const install: (app: App, options?: {
12
+ /**
13
+ * 自定义组件
14
+ */
15
+ customComponent?: {
16
+ [key: string]: any;
17
+ };
18
+ }) => void;
19
+ export { ArrUtil, ExcelUtil, TColumn, TCurd, TForm, TFormList, TSys, type CurdConfig, type CurdConfigColumn, type CurdOption };
20
+
21
+ export {}
22
+
23
+ /* prettier-ignore */
24
+ declare module 'vue' {
25
+ export interface GlobalComponents {
26
+ TCurd: typeof TCurd
27
+ TColumn: typeof TColumn
28
+ TFormList: typeof TFormList
29
+ }
30
+ export interface ComponentCustomProperties {
31
+ }
32
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 数组工具类
3
+ */
4
+ export default class ArrUtil {
5
+ /**
6
+ * 获取id函数-可以直接覆盖
7
+ */
8
+ static getIdFun: () => string;
9
+ /**
10
+ * 设置数组元素id
11
+ * @param field 字段名
12
+ * @param row 行数据
13
+ */
14
+ static setId: (field: string, row: any, itemFields: any[]) => void;
15
+ /**
16
+ * 添加数组元素
17
+ * @param field 字段-如:list
18
+ * @param row 行数据-如:{list:[]}
19
+ * @param itemFields 元素字段-如:[{label:'',value:''}]
20
+ * @param callback 回调函数
21
+ */
22
+ static add: (field: string, row: any, itemFields: any[], callback?: Function) => void;
23
+ /**
24
+ * 删除数组元素
25
+ * @param field 字段-如:list
26
+ * @param row 行数据-如:{list:[]}
27
+ * @param item 元素-如:{_id:''}
28
+ * @param callback 回调函数
29
+ */
30
+ static remove: (field: string, row: any, item: any, callback?: Function) => void;
31
+ /**
32
+ * 获取没有id的数据
33
+ * @param data 数组数据
34
+ * @param childernField 子级字段-如:list、children
35
+ * @returns 没有id的数据
36
+ */
37
+ static getNoIdData: (data: any[], childernField?: string) => any[];
38
+ }
@@ -0,0 +1,9 @@
1
+ export default class ExcelUtil {
2
+ /**
3
+ * 导出Excel
4
+ * @param data 数据
5
+ * @param columns 列
6
+ * @param fileName 文件名
7
+ */
8
+ static exportToExcel: (data: any[], columns: any[], fileName?: string | (() => string)) => Promise<void>;
9
+ }
@@ -0,0 +1,44 @@
1
+ export default class TForm {
2
+ /**
3
+ * 自定义组件
4
+ */
5
+ static customComponent: {
6
+ [key: string]: any;
7
+ };
8
+ /**
9
+ * 查找组件对应的options配置
10
+ * @param option
11
+ * @param field
12
+ * @returns
13
+ */
14
+ static findOptions: (option: any, field: string) => any;
15
+ /**
16
+ * 更新组件数据
17
+ * @param option
18
+ * @param field
19
+ * @param data
20
+ *
21
+ * @example
22
+ * TForm.setOptionsData(
23
+ conf.option,
24
+ 'url',
25
+ list.map(item => ({
26
+ label: item.path,
27
+ value: item.path,
28
+ }))
29
+ )
30
+ */
31
+ static setOptionsData: (option: any, field: string, data: any) => void;
32
+ static form: {
33
+ openBefore: {
34
+ /**
35
+ * 对于处理父级id的插件
36
+ * @param data 当前数据
37
+ * @param update curd组件实例
38
+ * @param treeData 树形数据
39
+ * @param option 组件配置
40
+ */
41
+ parentId: (data: any, update: any, treeData: any[], option: any) => void;
42
+ };
43
+ };
44
+ }
@@ -0,0 +1,97 @@
1
+ import { type Router } from 'vue-router';
2
+ export default class TSys {
3
+ /**
4
+ * 路由
5
+ */
6
+ static router: Router;
7
+ /**
8
+ * 原始路由列表
9
+ */
10
+ static routes: any[];
11
+ /**
12
+ * 获取路由路径
13
+ */
14
+ static getRouterPath: () => any;
15
+ static EDialog: {
16
+ Insert: any;
17
+ Update: any;
18
+ Remove: any;
19
+ };
20
+ /**
21
+ * 判断是否是函数,是就执行返回,否则返回本身
22
+ * @param fun 函数
23
+ * @param data 数据
24
+ * @returns 是否显示
25
+ */
26
+ static isFun: (fun: any, data?: any) => any;
27
+ /**
28
+ * 获取路由参数,自动获取query、params中的参数, 哪个有就返回哪个
29
+ */
30
+ static getRouterParams: () => any;
31
+ /**
32
+ * 模块赋值
33
+ */
34
+ static moduleObj: any;
35
+ /**
36
+ * 加载模块
37
+ * @param module
38
+ */
39
+ static loadModule: (module: any) => Promise<any>;
40
+ /**
41
+ * 提示信息对象管理
42
+ */
43
+ static tipMessages: {
44
+ [key: string]: number;
45
+ };
46
+ /**
47
+ * 提示信息间隔时间
48
+ */
49
+ static tipMessagesGap: number;
50
+ /**
51
+ * 显示提示信息
52
+ * @param content 消息内容
53
+ * @param type 消息类型
54
+ * @param options 其他选项
55
+ */
56
+ static showMessage(content: string, type: 'error' | 'success', options?: any): void;
57
+ /**
58
+ * 失败提示
59
+ * @param content
60
+ * @param options
61
+ */
62
+ static fail: (content: string, options?: any) => void;
63
+ /**
64
+ * 成功提示
65
+ * @param content
66
+ * @param options
67
+ */
68
+ static success: (content: string, options?: any) => void;
69
+ private static loadingObj;
70
+ private static loadingTimer;
71
+ /**
72
+ * 加载中
73
+ * @param show
74
+ * @param text
75
+ */
76
+ static loading: (show?: boolean, text?: string) => void;
77
+ /**
78
+ * 使用window.open打开新地址
79
+ * @param url 地址
80
+ * @param isCenter 是否居中
81
+ */
82
+ static openUrl: (url: string, isCenter?: boolean) => void;
83
+ /**
84
+ * 根据dom id截图并返回图片数据
85
+ * @param param
86
+ * @returns
87
+ */
88
+ static getImgPic: (param: {
89
+ id: string;
90
+ windowWidth?: number;
91
+ windowHeight?: number;
92
+ }) => Promise<string>;
93
+ /**
94
+ * 下载文件
95
+ */
96
+ static download(content: string, name?: string): Promise<void>;
97
+ }
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "cc1-form",
3
+ "version": "1.0.0",
4
+ "description": "我来助你-表单组件库",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://cc1.cc"
8
+ },
9
+ "homepage": "https://cc1.cc",
10
+ "author": "VeigarChen",
11
+ "license": "MIT",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "type": "module",
16
+ "main": "./dist/cc1-form.umd.cjs",
17
+ "module": "./dist/cc1-form.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/cc1-form.js",
23
+ "require": "./dist/cc1-form.umd.cjs"
24
+ },
25
+ "./index.css": "./dist/index.css"
26
+ },
27
+ "scripts": {
28
+ "build": "npm run build:package && npm run build:types",
29
+ "build:package": "vite build",
30
+ "build:types": "vue-tsc --declaration --emitDeclarationOnly && tsc-alias -p tsconfig.json && npm run addtype",
31
+ "format": "prettier --write . ",
32
+ "typecheck": "vue-tsc --noEmit",
33
+ "addtype": "tsx ./build/buildTypes.ts"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "22.15.2",
37
+ "@vitejs/plugin-vue": "5.2.1",
38
+ "@vue/tsconfig": "0.7.0",
39
+ "less": "4.3.0",
40
+ "prettier": "3.2.5",
41
+ "tsc-alias": "1.8.11",
42
+ "tsx": "4.19.4",
43
+ "typescript": "5.8.2",
44
+ "vite": "6.2.2",
45
+ "vue-tsc": "2.2.8"
46
+ },
47
+ "dependencies": {
48
+ "@vueuse/core": "12.8.2",
49
+ "element-plus": "2.9.7",
50
+ "cc1-js": "*",
51
+ "cc1-vue3": "*",
52
+ "vue-router": "4.5.1",
53
+ "xlsx": "0.18.5",
54
+ "vue": "3.5.x"
55
+ },
56
+ "engines": {
57
+ "node": ">=18.x",
58
+ "npm": ">=10.x"
59
+ }
60
+ }