jgy-public-component 0.0.4 → 0.0.7

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,60 @@
1
+ /**
2
+ * 将对象的 key 从小驼峰转为下划线格式(支持深度嵌套)
3
+ * @param obj 需要转换的对象
4
+ * @param excludeKeys 不需要转换的 key 数组(可选)
5
+ */
6
+ export declare function toSnakeCase<T extends Record<string, any>>(obj: T, excludeKeys?: string[]): Record<string, any>;
7
+ /**
8
+ * 将对象的 key 从下划线格式转为小驼峰(支持深度嵌套)
9
+ * @param obj 需要转换的对象
10
+ * @param excludeKeys 不需要转换的 key 数组(可选)
11
+ */
12
+ export declare function toCamelCase<T extends Record<string, any>>(obj: T, excludeKeys?: string[]): Record<string, any>;
13
+ /**
14
+ * 从对象中提取指定的 key
15
+ * @param obj 源对象
16
+ * @param keys 要提取的 key 数组
17
+ */
18
+ export declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
19
+ /**
20
+ * 从对象中排除指定的 key
21
+ * @param obj 源对象
22
+ * @param keys 要排除的 key 数组
23
+ */
24
+ export declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
25
+ /**
26
+ * 深拷贝对象
27
+ * @param obj 需要拷贝的对象
28
+ */
29
+ export declare function deepClone<T>(obj: T): T;
30
+ /**
31
+ * 过滤对象中的空值(null、undefined、空字符串)
32
+ * @param obj 需要过滤的对象
33
+ * @param deep 是否递归过滤嵌套对象,默认 false
34
+ */
35
+ export declare function filterEmpty<T extends Record<string, any>>(obj: T, deep?: boolean): Partial<T>;
36
+ /**
37
+ * 将嵌套对象扁平化为单层对象
38
+ * @param obj 需要扁平化的对象
39
+ * @param prefix key 前缀,默认为空
40
+ * @param separator 分隔符,默认为 '.'
41
+ * @example flatten({ a: { b: 1, c: { d: 2 } } }) => { 'a.b': 1, 'a.c.d': 2 }
42
+ */
43
+ export declare function flatten(obj: Record<string, any>, prefix?: string, separator?: string): Record<string, any>;
44
+ /**
45
+ * 将扁平化的对象还原为嵌套对象
46
+ * @param obj 扁平化的对象
47
+ * @param separator 分隔符,默认为 '.'
48
+ * @example unflatten({ 'a.b': 1, 'a.c.d': 2 }) => { a: { b: 1, c: { d: 2 } } }
49
+ */
50
+ export declare function unflatten(obj: Record<string, any>, separator?: string): Record<string, any>;
51
+ /**
52
+ * 将 { key: label } 对象转换为 el-table-column 所需的表头数组
53
+ * @param fieldMap 字段映射对象
54
+ * @example toTableColumns({ id: '主键', name: '名称' }) => [{ id: 'id', label: '主键', prop: 'id' }, ...]
55
+ */
56
+ export declare function toTableColumns(fieldMap: Record<string, string>): {
57
+ id: string;
58
+ label: string;
59
+ prop: string;
60
+ }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jgy-public-component",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "description": "JGY 公共 Vue 3 组件库",
5
5
  "keywords": [
6
6
  "vue3",
@@ -59,6 +59,10 @@
59
59
  "vite-plugin-dts": "^3.7.0",
60
60
  "vue": "^3.4.0",
61
61
  "vue-tsc": "^2.0.0",
62
- "vuedraggable": "^4.1.0"
62
+ "vuedraggable": "^4.1.0",
63
+ "xlsx": "^0.18.5"
64
+ },
65
+ "dependencies": {
66
+ "xlsx": "^0.18.5"
63
67
  }
64
68
  }