joy-admin-components 0.2.104 → 0.2.106

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.
@@ -17,10 +17,9 @@ export interface ValidatorOptions {
17
17
  */
18
18
  export function creatValidator(
19
19
  type: 'phone' | 'password' | 'email',
20
- opt?: ValidatorOptions
20
+ opt?: ValidatorOptions,
21
21
  ): boolean | ((rule: any, value: any, callback: any) => void);
22
22
 
23
-
24
23
  // Excel 工具类型
25
24
  export interface ImportExcelOptions {
26
25
  /** 其他选项 */
@@ -50,7 +49,7 @@ export function exportExcel(
50
49
  tableName: string,
51
50
  tableHeader: any[],
52
51
  tableData?: any[],
53
- options?: ExportExcelOptions
52
+ options?: ExportExcelOptions,
54
53
  ): Promise<void>;
55
54
 
56
55
  /**
@@ -73,7 +72,7 @@ export interface ImportExcelMuiltiOptions {
73
72
  */
74
73
  export function importExcelMuilti(
75
74
  file: File,
76
- options: ImportExcelMuiltiOptions
75
+ options: ImportExcelMuiltiOptions,
77
76
  ): Promise<Record<string, any[]>>;
78
77
 
79
78
  /**
@@ -115,7 +114,7 @@ export interface ExportExcelMuiltiSheet {
115
114
  */
116
115
  export function exportExcelMuilti(
117
116
  tableName: string,
118
- sheets: Record<string, ExportExcelMuiltiSheet>
117
+ sheets: Record<string, ExportExcelMuiltiSheet>,
119
118
  ): Promise<void>;
120
119
 
121
120
  // 单点登录 SDK 类型
@@ -142,7 +141,7 @@ export function formatNumber(
142
141
  num: number | string,
143
142
  decimals?: number,
144
143
  decimalSeparator?: string,
145
- thousandSeparator?: string
144
+ thousandSeparator?: string,
146
145
  ): string;
147
146
 
148
147
  /**
@@ -324,7 +323,7 @@ export interface UseRequestOptions {
324
323
  */
325
324
  export function useRequest(
326
325
  apiHandle: (params?: any) => Promise<any>,
327
- opt?: UseRequestOptions
326
+ opt?: UseRequestOptions,
328
327
  ): [Ref<boolean>, Ref<any>, (params?: any) => void];
329
328
 
330
329
  /**
@@ -422,7 +421,7 @@ export function useI18nReState<T>(state: () => T, otherWatch?: any[]): Ref<T>;
422
421
  export function getLocaleValue(
423
422
  sourceData: Record<string, any> | null | undefined,
424
423
  zh?: string,
425
- en?: string
424
+ en?: string,
426
425
  ): string;
427
426
 
428
427
  // storeHook.js hooks
@@ -433,7 +432,10 @@ export function getLocaleValue(
433
432
  * @param mapper state 映射对象或数组
434
433
  * @returns 响应式 state 对象
435
434
  */
436
- export function useState(moduleName: string, mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
435
+ export function useState(
436
+ moduleName: string,
437
+ mapper: string[] | Record<string, any>,
438
+ ): Record<string, Ref<any>>;
437
439
  export function useState(mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
438
440
 
439
441
  /**
@@ -442,7 +444,10 @@ export function useState(mapper: string[] | Record<string, any>): Record<string,
442
444
  * @param mapper getters 映射对象或数组
443
445
  * @returns 响应式 getters 对象
444
446
  */
445
- export function useGetters(moduleName: string, mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
447
+ export function useGetters(
448
+ moduleName: string,
449
+ mapper: string[] | Record<string, any>,
450
+ ): Record<string, Ref<any>>;
446
451
  export function useGetters(mapper: string[] | Record<string, any>): Record<string, Ref<any>>;
447
452
 
448
453
  /**
@@ -451,5 +456,89 @@ export function useGetters(mapper: string[] | Record<string, any>): Record<strin
451
456
  * @param mapper actions 映射对象或数组
452
457
  * @returns actions 对象
453
458
  */
454
- export function useActions(moduleName: string, mapper: string[] | Record<string, any>): Record<string, (...args: any[]) => any>;
459
+ export function useActions(
460
+ moduleName: string,
461
+ mapper: string[] | Record<string, any>,
462
+ ): Record<string, (...args: any[]) => any>;
455
463
  export function useActions(mapper: string[] | Record<string, any>): Record<string, (...args: any[]) => any>;
464
+
465
+ /**
466
+ * 将下拉列表国际化
467
+ * 根据当前语言环境自动切换 label/labelEn 的显示
468
+ * @param arr 数据源数组(支持 Ref 或普通数组)
469
+ * @param keys 字段映射 [label, value, labelEn],默认 ['label', 'value', 'labelEn']
470
+ * @returns 计算属性,包含国际化后的列表数据
471
+ *
472
+ * @example
473
+ * ```ts
474
+ * const statusList = ref([
475
+ * { label: '启用', value: 1, labelEn: 'Enabled' },
476
+ * { label: '禁用', value: 0, labelEn: 'Disabled' }
477
+ * ]);
478
+ * const options = useVxeEditRenderStatus(statusList, ['label', 'value', 'labelEn']);
479
+ * ```
480
+ */
481
+ export function useVxeEditRenderStatus(
482
+ arr: any[] | Ref<any[]>,
483
+ keys?: [string?, string?, string?],
484
+ ): import('vue').ComputedRef<Array<{ label: string; value: any; [key: string]: any }>>;
485
+
486
+ // ============== Excel 额外工具函数类型 ==============
487
+
488
+ /**
489
+ * 根据列下标获取列头字母
490
+ * @param index 列下标,从 0 开始
491
+ * @returns 对应的列头字母,如 A, B, ..., Z, AA, AB...
492
+ *
493
+ * @example
494
+ * getColumnLetterByIndex(0) // 'A'
495
+ * getColumnLetterByIndex(25) // 'Z'
496
+ * getColumnLetterByIndex(26) // 'AA'
497
+ */
498
+ export function getColumnLetterByIndex(index: number): string;
499
+
500
+ /**
501
+ * 将 base64 图片转换为 Blob 对象
502
+ * @param base64 base64 格式的图片数据
503
+ * @returns Blob 对象
504
+ */
505
+ export function base64ToBlob(base64: string): Blob;
506
+
507
+ /**
508
+ * 将 base64 图片转换为 File 对象
509
+ * @param base64 base64 格式的图片数据
510
+ * @param filename 文件名,默认 'image.png'
511
+ * @returns File 对象
512
+ */
513
+ export function base64ToFile(base64: string, filename?: string): File;
514
+
515
+ /**
516
+ * 将 base64 图片转换为 FormData 对象,可直接用于上传接口
517
+ * @param base64 base64 格式的图片数据
518
+ * @param filename 文件名,默认根据图片类型自动生成
519
+ * @returns FormData 对象
520
+ */
521
+ export function base64ToFormData(base64: string, filename?: string): FormData;
522
+
523
+ /**
524
+ * 获取 VxeTable 当前显示的列字段列表
525
+ *
526
+ * 从 localStorage 中读取 VxeTable 的自定义列配置(VXE_CUSTOM_STORE),
527
+ * 返回当前表格排序后且可见的列字段 key 数组(排除 checkbox、action/actions 列)。
528
+ *
529
+ * @param tableId ListPage 的 id,用于匹配 localStorage 中的配置
530
+ * @returns 当前显示的列字段 key 数组
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * import { getTableShowColumn } from 'joy-admin-components';
535
+ *
536
+ * // 获取 id 为 'orderList' 的表格当前显示列
537
+ * const showColumns = getTableShowColumn('orderList');
538
+ * // ['orderNo', 'customerName', 'amount', 'status', 'createTime']
539
+ *
540
+ * // 配合导出功能,只导出用户可见的列
541
+ * const exportHeaders = allHeaders.filter(h => showColumns.includes(h.key));
542
+ * ```
543
+ */
544
+ export function getTableShowColumn(tableId?: string): string[];