@jnrs/vue-core 1.2.10 → 1.2.12

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 CHANGED
@@ -19,9 +19,9 @@ pnpm add @jnrs/vue-core
19
19
 
20
20
  ## 🔍 使用示例
21
21
  ```typescript
22
- import type { User, DictItem } from '@jnrs/vue-core'
22
+ import type { IPageData } from '@jnrs/vue-core'
23
23
  import { useRouter, useRoute } from '@jnrs/vue-core/router'
24
- import { useAuthStore } from '@jnrs/vue-core/pinia'
24
+ import { useSystemStore } from '@jnrs/vue-core/pinia'
25
25
  ```
26
26
 
27
27
  ## 📋 API
@@ -41,7 +41,7 @@ import { useAuthStore } from '@jnrs/vue-core/pinia'
41
41
  可选值:'default' | 'primary' | 'success' | 'info' | 'warning' | 'text' | 'danger'
42
42
  ```
43
43
 
44
- - MenuItem 菜单项
44
+ - IMenuItem 菜单项
45
45
 
46
46
  | 属性名 | 描述 | 类型 |
47
47
  |--------|------|------|
@@ -50,7 +50,7 @@ import { useAuthStore } from '@jnrs/vue-core/pinia'
50
50
  | name | 名称(可选) | `string` |
51
51
  | component | 组件路径(可选) | `string` |
52
52
  | redirect | 重定向路径(可选) | `string` |
53
- | children | 子菜单项(可选) | `MenuItem[]` |
53
+ | children | 子菜单项(可选) | `IMenuItem[]` |
54
54
 
55
55
  - Attachment(文件信息)
56
56
 
@@ -70,7 +70,7 @@ import { useAuthStore } from '@jnrs/vue-core/pinia'
70
70
  | pageNo | 当前页码 | `number` |
71
71
  | pageSize | 每页大小 | `number` |
72
72
 
73
- - PageTableDataT(分页列表数据)继承自 Pagination
73
+ - IPageData<T>(分页列表数据)继承自 IPagination
74
74
 
75
75
  | 属性名 | 描述 | 类型 |
76
76
  |--------|------|------|
@@ -92,17 +92,6 @@ import { useAuthStore } from '@jnrs/vue-core/pinia'
92
92
  */
93
93
  ```
94
94
  ``` typescript
95
- /**
96
- * useAuthStore 权限仓库
97
- * @returns hasAuthenticated 是否已登录
98
- * @returns token 登录凭证
99
- * @returns userInfo 用户信息
100
- * @returns dict 字典
101
- * @methods asyncSetAuth 设置权限信息
102
- * @methods clearAuth 清除权限信息
103
- */
104
- ```
105
- ``` typescript
106
95
  /**
107
96
  * useMenuStore 菜单仓库
108
97
  * @returns hasFetchedAsyncMenus 菜单是否已获取
@@ -142,7 +131,7 @@ Vue 组件
142
131
  | showIndexColumn | 是否显示序号列 | `boolean` | `false` |
143
132
  | showSelectionColumn | 是否显示选择列 | `boolean` | `false` |
144
133
  | showMouseSelection | 是否开启鼠标框选 | `boolean` | `false` |
145
- | pagination | 当前页码和每页大小(用于序号计算) | `Pagination` | `{ pageNo: 0, pageSize: 0 }` |
134
+ | pagination | 当前页码和每页大小(用于序号计算) | `IPagination` | `{ pageNo: 0, pageSize: 0 }` |
146
135
 
147
136
  - JnSelectTemplate 选择组件通用模板
148
137
 
@@ -178,7 +167,7 @@ Vue 组件
178
167
 
179
168
  | 属性名 | 描述 | 类型 | 默认值 |
180
169
  |--------|------|------|--------|
181
- | fileList | 文件列表 | `FileItem[]` | `[]` |
170
+ | fileList | 文件列表 | `IFileItem[]` | `[]` |
182
171
  | showFileName | 是否显示文件名 | `boolean` | `true` |
183
172
  | isPdf | 是否是 pdf 文件(pdf 文件直接预览,其他文件下载) | `boolean` | `false` |
184
173
  | windowWidth | 预览窗口宽度 | `number` | `800` |
@@ -188,7 +177,7 @@ Vue 组件
188
177
 
189
178
  | 属性名 | 描述 | 类型 | 默认值 |
190
179
  |--------|------|------|--------|
191
- | modelValue | 分页模型值 | `Pagination` | `{ pageNo: 1, pageSize: 20 }` |
180
+ | modelValue | 分页模型值 | `IPagination` | `{ pageNo: 1, pageSize: 20 }` |
192
181
  | total | 总条数 | `number` | `0` |
193
182
  | size | 按钮尺寸 | `ComponentSize` | `'small'` |
194
183
  | background | 是否带背景色 | `boolean` | `true` |
@@ -199,7 +188,7 @@ Vue 组件
199
188
  | 属性名 | 描述 | 类型 | 默认值 |
200
189
  |--------|------|------|--------|
201
190
  | importTemplateApi | 下载导入模板文件的 api 函数 | `() => Promise<Blob>` | — |
202
- | importApi | 数据导入 api 函数 | `(data: FormData) => Promise<BusinessResponse>` | — |
191
+ | importApi | 数据导入 api 函数 | `(data: FormData) => Promise<IBusinessResponse>` | — |
203
192
  | importFieldName | 数据导入的字段名 | `string` | `'file'` |
204
193
  | importParams | 导入的参数 | `Record<string, unknown>` | — |
205
194
  | fileUploadConfig | 导入的文件上传配置 | `{ accept: string; limit: number }` | `{ accept: '.xls,.xlsx', limit: 1 }` |
@@ -223,7 +212,7 @@ Vue 组件
223
212
  | 属性名 | 描述 | 类型 | 默认值 |
224
213
  |--------|------|------|--------|
225
214
  | src | 图片源地址,同原生属性一致 | `string` | `''` |
226
- | previewSrcList | 开启图片预览功能 | `FileItem[]` | `[]` |
215
+ | previewSrcList | 开启图片预览功能 | `IFileItem[]` | `[]` |
227
216
  | preview | 是否开启预览功能 | `boolean` | `false` |
228
217
  | height | 图片高度 | `string` | — |
229
218
  | maxHeight | 图片最大高度 | `string` | `'200px'` |
@@ -243,7 +232,7 @@ Vue 组件
243
232
  | size | Element Plus 组件的尺寸 | `'' \| 'small' \| 'default' \| 'large'` | `'small'` |
244
233
  | formRef | 父级组件的表单引用 | `FormInstance` | — |
245
234
  | validateFieldName | 父级表单中用于校验的字段名 | `string` | `''` |
246
- | downloadFileFn | 文件下载的函数 | `(data: Attachment) => void` | — |
235
+ | downloadFileFn | 文件下载的函数 | `(data: IAttachment) => void` | — |
247
236
  | autoUploadApi | 自动上传文件的 api 函数 | `(data: File) => void` | — |
248
237
 
249
238
  - JnDialog 表格编辑组件
@@ -1,7 +1,7 @@
1
1
  import { UploadRawFile, UploadFile, FormInstance } from 'element-plus';
2
- import { Attachment } from '../types/base';
2
+ import { IAttachment } from '../types/base';
3
3
  import { nextTick } from 'vue';
4
- type MixedUploadFile = Attachment | UploadRawFile | Blob;
4
+ type MixedUploadFile = IAttachment | UploadRawFile | Blob;
5
5
  export interface Props {
6
6
  /**
7
7
  * 绑定的模型值(文件列表),默认为空数组
@@ -50,7 +50,7 @@ export interface Props {
50
50
  /**
51
51
  * 文件下载的函数,默认为 undefined
52
52
  */
53
- downloadFileFn?: (data: Attachment) => void;
53
+ downloadFileFn?: (data: IAttachment) => void;
54
54
  /**
55
55
  * 自动上传文件的 api 函数
56
56
  */
@@ -1,4 +1,4 @@
1
- import { FileItem } from '@jnrs/shared';
1
+ import { IFileItem } from '@jnrs/shared';
2
2
  interface JnImageViewProps {
3
3
  /**
4
4
  * 图片源地址,同原生属性一致
@@ -7,7 +7,7 @@ interface JnImageViewProps {
7
7
  /**
8
8
  * 开启图片预览功能
9
9
  */
10
- previewSrcList?: FileItem[];
10
+ previewSrcList?: IFileItem[];
11
11
  /**
12
12
  * 是否开启预览功能
13
13
  */
@@ -1,5 +1,5 @@
1
+ import { IBusinessResponse } from '@jnrs/shared';
1
2
  import { ElSize, ElButtonType } from '../types/base';
2
- import { BusinessResponse } from '@jnrs/shared/request';
3
3
  import { nextTick } from 'vue';
4
4
  export interface Props {
5
5
  /**
@@ -9,7 +9,7 @@ export interface Props {
9
9
  /**
10
10
  * 数据导入 api 函数
11
11
  */
12
- importApi?: (data: FormData) => Promise<BusinessResponse>;
12
+ importApi?: (data: FormData) => Promise<IBusinessResponse>;
13
13
  /**
14
14
  * 数据导入的字段名
15
15
  */
@@ -1,7 +1,7 @@
1
- import { Pagination } from '../types/base';
1
+ import { IPagination } from '../types/base';
2
2
  import { ComponentSize } from 'element-plus';
3
3
  interface PaginationProps {
4
- modelValue?: Pagination;
4
+ modelValue?: IPagination;
5
5
  total: number;
6
6
  size?: ComponentSize;
7
7
  background?: boolean;
@@ -21,7 +21,7 @@ declare const _default: import('vue').DefineComponent<PaginationProps, {}, {}, {
21
21
  onChange?: (() => any) | undefined;
22
22
  }>, {
23
23
  size: ComponentSize;
24
- modelValue: Pagination;
24
+ modelValue: IPagination;
25
25
  background: boolean;
26
26
  total: number;
27
27
  marginTop: string;
@@ -1,9 +1,9 @@
1
- import { FileItem } from '@jnrs/shared';
1
+ import { IFileItem } from '@jnrs/shared';
2
2
  interface JnPdfViewProps {
3
3
  /**
4
4
  * 文件列表
5
5
  */
6
- fileList?: FileItem[];
6
+ fileList?: IFileItem[];
7
7
  /**
8
8
  * 是否显示文件名
9
9
  */
@@ -1,4 +1,4 @@
1
- import { Pagination } from '../types/base';
1
+ import { IPagination } from '../types/base';
2
2
  import { UseReactivityTableHeightOptions } from '../composables/useReactivityTableHeight';
3
3
  export interface Props {
4
4
  /**
@@ -43,7 +43,7 @@ export interface Props {
43
43
  /**
44
44
  * 当前页码和每页大小(用于序号计算)
45
45
  */
46
- pagination?: Pagination;
46
+ pagination?: IPagination;
47
47
  }
48
48
  declare function __VLS_template(): {
49
49
  attrs: Partial<{}>;
@@ -1,8 +1,8 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".jn_globalSetting_header{margin-bottom:0;padding-bottom:20px}.jn_globalSetting_item[data-v-c92f56b2]{margin-bottom:20px}.jn_imageView[data-v-8977f80c]{display:block;width:100%;height:100%}.jn_imageView .jn_imageView_error[data-v-8977f80c]{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:.8em;line-height:1.1em;text-align:center;filter:opacity(.7)}.jn_image_view_icon[data-v-8977f80c]:hover{color:var(--jnrs-color-primary);transform:scale(1.2);transition:all .3s ease}.jn_fileView[data-v-d95b99b8]{display:block;width:100%;height:100%;line-height:1em;cursor:pointer}.jn_fileView:hover .jn_fileView_button[data-v-d95b99b8]{color:var(--jnrs-color-primary)}.jn_fileView .jn_fileView_fileName[data-v-d95b99b8]{font-size:.8em;color:var(--jnrs-font-primary-06);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.jn_fileView .jn_fileView_button[data-v-d95b99b8]{height:auto;padding:0;text-decoration:underline;font-size:.9em;transition:all .3s ease}.jn_fileUpload[data-v-004820d2]{position:relative;width:100%;color:var(--jnrs-font-primary-06)}.jn_fileUpload[data-v-004820d2] .el-upload-dragger{padding:30px 0 10px}.jn_fileUpload .jn_uploadTips[data-v-004820d2]{display:block;width:100%;margin-top:5px;line-height:1.2em}.jn_fileUpload .jn_uploadTips span[data-v-004820d2]{display:inline-block;margin-right:10px}.jn_fileUpload .jn_uploadTips b[data-v-004820d2]{color:var(--el-color-danger, #ff3300)}.jn_fileUpload .jn_uploadTips_isDrag[data-v-004820d2]{position:absolute;top:4px;left:0;text-align:center}.jn_fileUpload .jn_fileList[data-v-004820d2]{width:100%}.jn_fileUpload .jn_fileList .jn_fileLis_item[data-v-004820d2]{display:flex;align-items:center;justify-content:space-between;width:100%;margin-top:8px;padding:5px 0;border:1px solid var(--jnrs-font-primary-03);background:var(--jnrs-background-primary)}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_left[data-v-004820d2]{flex:1;position:relative;display:flex;align-items:center;justify-content:flex-start;padding-right:50px;line-height:1.1em}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_right[data-v-004820d2]{flex-shrink:0;width:60px;display:flex;align-items:center;justify-content:flex-end;padding-right:4px}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_index[data-v-004820d2]{flex-shrink:0;width:20px;height:20px;line-height:20px;text-align:center}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_icon[data-v-004820d2]{flex-shrink:0;width:20px;height:20px}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_name[data-v-004820d2]{padding:0 4px;word-break:break-all}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_size[data-v-004820d2]{position:absolute;right:0;width:50px;color:#999;white-space:nowrap;text-align:right}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_btn[data-v-004820d2]{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin:0 2px;border-radius:3px;font-size:16px;color:var(--el-color-primary, #5887f7);transition:all .3s ease;cursor:pointer}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_btn[data-v-004820d2]:hover{background-color:var(--jnrs-card-primary)}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_btn_danger[data-v-004820d2]{color:var(--el-color-danger, #ff3300)}.jnImportAndExport_button.is-text[data-v-80709b7b]{padding:0}.jnImportAndExport_underlineBtn[data-v-80709b7b]{display:inline-block;margin-right:36px;color:#3697fc;text-decoration:underline;cursor:pointer}.jnImportAndExport_underlineBtn[data-v-80709b7b]:hover{opacity:.8}.jn_table[data-v-89d959fb]{width:100%}.jn_table[data-v-89d959fb] .jn_table_header{color:var(--jnrs-font-primary)!important;background:var(--jnrs-background-head)!important}.jn_table[data-v-89d959fb] .jn_table_header .cell{padding:0 8px;line-height:1.2em}.jn_selectTemplate[data-v-6ec9d84c]{display:flex;align-items:center;font-size:0}.jn_selectTemplate .jn_select[data-v-6ec9d84c]{flex:1;right:-1px;z-index:1}.jn_selectTemplate .jn_select[data-v-6ec9d84c] .el-select__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.jn_selectTemplate .jn_select_button[data-v-6ec9d84c]{border-radius:0 3px 3px 0}.jn_selectTemplate .jn_select_button[data-v-6ec9d84c]:hover{z-index:1}.t_select_button_only[data-v-6ec9d84c]{margin-left:0;border-top-left-radius:3px;border-bottom-left-radius:3px}.jn_dialog_header[data-v-6ec9d84c]{display:flex;align-items:center}[data-v-6ec9d84c] .el-input__validateIcon{display:none}[data-v-6ec9d84c] th .el-checkbox--small{display:none!important}[data-v-6ec9d84c] .el-table__row{cursor:pointer}.tableIsSingle[data-v-6ec9d84c] .el-checkbox__inner{border-radius:50%}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".jn_globalSetting_header{margin-bottom:0;padding-bottom:20px}.jn_globalSetting_item[data-v-2b8b00a5]{margin-bottom:20px}.jn_imageView[data-v-1e2b2aae]{display:block;width:100%;height:100%}.jn_imageView .jn_imageView_error[data-v-1e2b2aae]{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:.8em;line-height:1.1em;text-align:center;filter:opacity(.7)}.jn_image_view_icon[data-v-1e2b2aae]:hover{color:var(--jnrs-color-primary);transform:scale(1.2);transition:all .3s ease}.jn_fileView[data-v-a380f9e9]{display:block;width:100%;height:100%;line-height:1em;cursor:pointer}.jn_fileView:hover .jn_fileView_button[data-v-a380f9e9]{color:var(--jnrs-color-primary)}.jn_fileView .jn_fileView_fileName[data-v-a380f9e9]{font-size:.8em;color:var(--jnrs-font-primary-06);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.jn_fileView .jn_fileView_button[data-v-a380f9e9]{height:auto;padding:0;text-decoration:underline;font-size:.9em;transition:all .3s ease}.jn_fileUpload[data-v-7e67b4eb]{position:relative;width:100%;color:var(--jnrs-font-primary-06)}.jn_fileUpload[data-v-7e67b4eb] .el-upload-dragger{padding:30px 0 10px}.jn_fileUpload .jn_uploadTips[data-v-7e67b4eb]{display:block;width:100%;margin-top:5px;line-height:1.2em}.jn_fileUpload .jn_uploadTips span[data-v-7e67b4eb]{display:inline-block;margin-right:10px}.jn_fileUpload .jn_uploadTips b[data-v-7e67b4eb]{color:var(--el-color-danger, #ff3300)}.jn_fileUpload .jn_uploadTips_isDrag[data-v-7e67b4eb]{position:absolute;top:4px;left:0;text-align:center}.jn_fileUpload .jn_fileList[data-v-7e67b4eb]{width:100%}.jn_fileUpload .jn_fileList .jn_fileLis_item[data-v-7e67b4eb]{display:flex;align-items:center;justify-content:space-between;width:100%;margin-top:8px;padding:5px 0;border:1px solid var(--jnrs-font-primary-03);background:var(--jnrs-background-primary)}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_left[data-v-7e67b4eb]{flex:1;position:relative;display:flex;align-items:center;justify-content:flex-start;padding-right:50px;line-height:1.1em}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_right[data-v-7e67b4eb]{flex-shrink:0;width:60px;display:flex;align-items:center;justify-content:flex-end;padding-right:4px}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_index[data-v-7e67b4eb]{flex-shrink:0;width:20px;height:20px;line-height:20px;text-align:center}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_icon[data-v-7e67b4eb]{flex-shrink:0;width:20px;height:20px}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_name[data-v-7e67b4eb]{padding:0 4px;word-break:break-all}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_size[data-v-7e67b4eb]{position:absolute;right:0;width:50px;color:#999;white-space:nowrap;text-align:right}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_btn[data-v-7e67b4eb]{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:20px;height:20px;margin:0 2px;border-radius:3px;font-size:16px;color:var(--el-color-primary, #5887f7);transition:all .3s ease;cursor:pointer}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_btn[data-v-7e67b4eb]:hover{background-color:var(--jnrs-card-primary)}.jn_fileUpload .jn_fileList .jn_fileLis_item .fileLis_item_btn_danger[data-v-7e67b4eb]{color:var(--el-color-danger, #ff3300)}.jnImportAndExport_button.is-text[data-v-447ad008]{padding:0}.jnImportAndExport_underlineBtn[data-v-447ad008]{display:inline-block;margin-right:36px;color:#3697fc;text-decoration:underline;cursor:pointer}.jnImportAndExport_underlineBtn[data-v-447ad008]:hover{opacity:.8}.jn_table[data-v-1671453b]{width:100%}.jn_table[data-v-1671453b] .jn_table_header{color:var(--jnrs-font-primary)!important;background:var(--jnrs-background-head)!important}.jn_table[data-v-1671453b] .jn_table_header .cell{padding:0 8px;line-height:1.2em}.jn_selectTemplate[data-v-6ec9d84c]{display:flex;align-items:center;font-size:0}.jn_selectTemplate .jn_select[data-v-6ec9d84c]{flex:1;right:-1px;z-index:1}.jn_selectTemplate .jn_select[data-v-6ec9d84c] .el-select__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.jn_selectTemplate .jn_select_button[data-v-6ec9d84c]{border-radius:0 3px 3px 0}.jn_selectTemplate .jn_select_button[data-v-6ec9d84c]:hover{z-index:1}.t_select_button_only[data-v-6ec9d84c]{margin-left:0;border-top-left-radius:3px;border-bottom-left-radius:3px}.jn_dialog_header[data-v-6ec9d84c]{display:flex;align-items:center}[data-v-6ec9d84c] .el-input__validateIcon{display:none}[data-v-6ec9d84c] th .el-checkbox--small{display:none!important}[data-v-6ec9d84c] .el-table__row{cursor:pointer}.tableIsSingle[data-v-6ec9d84c] .el-checkbox__inner{border-radius:50%}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
2
  import { defineComponent as H, ref as B, createBlock as U, openBlock as h, unref as i, withCtx as f, createElementVNode as p, createVNode as v, toDisplayString as y, isRef as zt, createElementBlock as E, Fragment as X, renderList as ee, createTextVNode as D, computed as N, normalizeStyle as Ie, createCommentVNode as P, renderSlot as le, withDirectives as ke, normalizeClass as Pe, vShow as Vt, nextTick as te, withModifiers as Be, watch as Ae, onMounted as Ft, mergeProps as Xt } from "vue";
3
3
  import { storeToRefs as Ht } from "pinia";
4
4
  import { ElDrawer as xt, ElSwitch as Ot, ElRadioGroup as Ee, ElRadio as pe, ElImage as Kt, ElIcon as L, ElButton as V, ElDialog as mt, ElUpload as Mt, vLoading as De, ElMessage as G, ElForm as vt, ElFormItem as Rt, ElMessageBox as Ke, ElLoading as Qe, ElPagination as ht, ElTable as It, ElTableColumn as fe, ElSelect as Gt, ElOption as Nt, ElCheckbox as Jt } from "element-plus";
5
- import { u as qt, a as Yt, L as Zt, M as Wt, C as $t } from "../index-BFtkMENx.js";
5
+ import { u as qt, a as Yt, L as Zt, M as Wt, C as $t } from "../index-DRbGqK4D.js";
6
6
  import { Back as _t, Right as ea, DArrowRight as ta, ZoomOut as aa, ZoomIn as na, Switch as la, RefreshLeft as ia, Refresh as oa, Download as Fe, Delete as Me, Upload as ra } from "@element-plus/icons-vue";
7
7
  import { downloadByUrl as Ct, downloadByBlob as Re, objectToFormData as sa } from "@jnrs/shared";
8
8
  import { useI18n as ua } from "vue-i18n";
@@ -10,7 +10,7 @@ import { i as Ce, b as se, r as K, a as J, f as ca, S as ge, u as Aa, c as da, d
10
10
  const ga = { class: "jn_globalSetting_item" }, ma = { class: "jn_globalSetting_item" }, va = { class: "jn_globalSetting_item" }, ha = { class: "jn_globalSetting_item" }, Ia = /* @__PURE__ */ H({
11
11
  __name: "GlobalSetting",
12
12
  setup(e, { expose: t }) {
13
- const { isMock: a } = Ht(qt()), { theme: n, setLocale: s, setMode: l, setPrimaryColor: c } = Yt(), m = B(!1);
13
+ const { useMockServe: a } = Ht(qt()), { theme: n, setLocale: s, setMode: l, setPrimaryColor: c } = Yt(), m = B(!1);
14
14
  return t({ handleShow: () => {
15
15
  m.value = !0;
16
16
  } }), (u, d) => (h(), U(i(xt), {
@@ -100,7 +100,7 @@ const ga = { class: "jn_globalSetting_item" }, ma = { class: "jn_globalSetting_i
100
100
  for (const [n, s] of t)
101
101
  a[n] = s;
102
102
  return a;
103
- }, wr = /* @__PURE__ */ Y(Ia, [["__scopeId", "data-v-c92f56b2"]]), Ca = {
103
+ }, wr = /* @__PURE__ */ Y(Ia, [["__scopeId", "data-v-2b8b00a5"]]), Ca = {
104
104
  key: 0,
105
105
  class: "jn_imageView_error"
106
106
  }, ya = { key: 1 }, ba = /* @__PURE__ */ H({
@@ -215,7 +215,7 @@ const ga = { class: "jn_globalSetting_item" }, ma = { class: "jn_globalSetting_i
215
215
  _: 1
216
216
  }, 8, ["style", "src", "preview-src-list"]));
217
217
  }
218
- }), Sr = /* @__PURE__ */ Y(ba, [["__scopeId", "data-v-8977f80c"]]), Ea = ["title", "onClick"], pa = {
218
+ }), Sr = /* @__PURE__ */ Y(ba, [["__scopeId", "data-v-1e2b2aae"]]), Ea = ["title", "onClick"], pa = {
219
219
  key: 0,
220
220
  class: "jn_fileView_fileName"
221
221
  }, Qa = /* @__PURE__ */ H({
@@ -259,7 +259,7 @@ const ga = { class: "jn_globalSetting_item" }, ma = { class: "jn_globalSetting_i
259
259
  })
260
260
  ], 8, Ea))), 128));
261
261
  }
262
- }), kr = /* @__PURE__ */ Y(Qa, [["__scopeId", "data-v-d95b99b8"]]), ja = /* @__PURE__ */ H({
262
+ }), kr = /* @__PURE__ */ Y(Qa, [["__scopeId", "data-v-a380f9e9"]]), ja = /* @__PURE__ */ H({
263
263
  __name: "JnDialog",
264
264
  props: {
265
265
  title: { default: "" },
@@ -506,7 +506,7 @@ const ga = { class: "jn_globalSetting_item" }, ma = { class: "jn_globalSetting_i
506
506
  ]) : P("", !0)
507
507
  ]));
508
508
  }
509
- }), dn = /* @__PURE__ */ Y(An, [["__scopeId", "data-v-004820d2"]]), fn = /* @__PURE__ */ H({
509
+ }), dn = /* @__PURE__ */ Y(An, [["__scopeId", "data-v-7e67b4eb"]]), fn = /* @__PURE__ */ H({
510
510
  __name: "JnImportAndExport",
511
511
  props: {
512
512
  importTemplateApi: { type: Function },
@@ -724,7 +724,7 @@ const ga = { class: "jn_globalSetting_item" }, ma = { class: "jn_globalSetting_i
724
724
  ], 64)) : P("", !0)
725
725
  ], 64));
726
726
  }
727
- }), Pr = /* @__PURE__ */ Y(fn, [["__scopeId", "data-v-80709b7b"]]), gn = { style: { opacity: "0.7", "font-size": "0.9em" } }, mn = { key: 1 }, Br = /* @__PURE__ */ H({
727
+ }), Pr = /* @__PURE__ */ Y(fn, [["__scopeId", "data-v-447ad008"]]), gn = { style: { opacity: "0.7", "font-size": "0.9em" } }, mn = { key: 1 }, Br = /* @__PURE__ */ H({
728
728
  __name: "JnDatetime",
729
729
  props: {
730
730
  value: { default: "" },
@@ -1489,7 +1489,7 @@ const sr = /* @__PURE__ */ H({
1489
1489
  _: 3
1490
1490
  }, 8, ["row-key", "data", "height", "showScrollbar-always-on", "onMousedown"]));
1491
1491
  }
1492
- }), Tr = /* @__PURE__ */ Y(sr, [["__scopeId", "data-v-89d959fb"]]), ur = { key: 0 }, cr = { style: { float: "left" } }, Ar = {
1492
+ }), Tr = /* @__PURE__ */ Y(sr, [["__scopeId", "data-v-1671453b"]]), ur = { key: 0 }, cr = { style: { float: "left" } }, Ar = {
1493
1493
  key: 0,
1494
1494
  style: { float: "right", color: "var(--el-text-color-secondary)", "font-size": "0.8em", "padding-left": "2em" }
1495
1495
  }, dr = { key: 0 }, fr = { class: "jn_dialog_header" }, gr = { style: { color: "#999", "font-size": "0.8em" } }, mr = {
@@ -1,31 +1,31 @@
1
- import { c as G, u as K } from "../useMouseSelection-DU3qQWIm.js";
2
- import { ref as p, onDeactivated as x, onActivated as A, onUnmounted as D } from "vue";
1
+ import { c as B, u as F } from "../useMouseSelection-DU3qQWIm.js";
2
+ import { ref as p, onDeactivated as x, onActivated as D, onUnmounted as L } from "vue";
3
3
  import { ElMessage as v } from "element-plus";
4
- import { b as L, u as _ } from "../index-BFtkMENx.js";
5
- const { token: H } = L(), { isMock: R } = _();
6
- function z(O) {
4
+ import { u as _ } from "../index-DRbGqK4D.js";
5
+ const { useMockServe: A } = _();
6
+ function j(O) {
7
7
  const {
8
8
  url: S,
9
- token: b = H,
9
+ token: b,
10
10
  connectionTimeoutDuration: C = 6e4,
11
11
  heartbeat: k = !1,
12
- heartbeatInterval: T = 3e4,
12
+ heartbeatInterval: y = 3e4,
13
13
  heartbeatTimeout: N = 1e4,
14
14
  showLog: i = !1,
15
15
  showMessage: c = !0,
16
16
  onOpen: E,
17
17
  onMessage: M,
18
18
  onClose: I,
19
- onError: y
19
+ onError: T
20
20
  } = O, e = p(null), f = p(!0), s = p(!1), u = p("未连接");
21
- let h = "", o = "", r = null, a = null, t = null;
22
- R && (h = S.startsWith("/mock") ? S : "/mock" + S);
21
+ let h = "", o = "", r = null, l = null, t = null;
22
+ A && (h = S.startsWith("/mock") ? S : "/mock" + S);
23
23
  const g = () => {
24
- r && clearTimeout(r), a && clearTimeout(a), r = null, a = null;
24
+ r && clearTimeout(r), l && clearTimeout(l), r = null, l = null;
25
25
  }, W = () => {
26
26
  if (!(!e.value || e.value.readyState !== WebSocket.OPEN))
27
27
  try {
28
- e.value.send(JSON.stringify({ type: "ping" })), a = setTimeout(() => {
28
+ e.value.send(JSON.stringify({ type: "ping" })), l = setTimeout(() => {
29
29
  o = "WebSocket 连接不稳定,正在重连...", i && console.warn(o), c && v({
30
30
  message: o,
31
31
  type: "warning",
@@ -50,7 +50,7 @@ function z(O) {
50
50
  grouping: !0,
51
51
  showClose: !0,
52
52
  duration: 0
53
- }), e.value?.close(), e.value = null, y?.(new Event("timeout")));
53
+ }), e.value?.close(), e.value = null, T?.(new Event("timeout")));
54
54
  }, C), e.value.onopen = () => {
55
55
  t && (clearTimeout(t), t = null), f.value = !1, s.value = !0, u.value = "连接成功", o = "WebSocket 连接成功", i && console.log(o), c && v({
56
56
  message: o,
@@ -58,21 +58,21 @@ function z(O) {
58
58
  grouping: !0,
59
59
  showClose: !0,
60
60
  duration: 3e3
61
- }), E?.(), k && (g(), r = setInterval(W, T));
62
- }, e.value.onmessage = (l) => {
63
- if (u.value = "数据接收中", typeof l.data == "string")
61
+ }), E?.(), k && (g(), r = setInterval(W, y));
62
+ }, e.value.onmessage = (a) => {
63
+ if (u.value = "数据接收中", typeof a.data == "string")
64
64
  try {
65
- if (JSON.parse(l.data).type === "pong") {
66
- a && (clearTimeout(a), a = null);
65
+ if (JSON.parse(a.data).type === "pong") {
66
+ l && (clearTimeout(l), l = null);
67
67
  return;
68
68
  }
69
69
  } catch {
70
70
  }
71
71
  try {
72
- const m = JSON.parse(l.data);
72
+ const m = JSON.parse(a.data);
73
73
  M?.(m);
74
74
  } catch (m) {
75
- console.error("WebSocket 消息解析失败:", l.data, m);
75
+ console.error("WebSocket 消息解析失败:", a.data, m);
76
76
  }
77
77
  }, e.value.onclose = () => {
78
78
  f.value = !1, s.value = !1, u.value = "连接已关闭", g(), t && (clearTimeout(t), t = null), o = "WebSocket 连接已关闭", i && console.log(o), c && v({
@@ -82,14 +82,14 @@ function z(O) {
82
82
  showClose: !0,
83
83
  duration: 3e3
84
84
  }), I?.();
85
- }, e.value.onerror = (l) => {
86
- f.value = !1, s.value = !1, u.value = "连接失败", t && (clearTimeout(t), t = null), o = "WebSocket 连接失败", i && console.error(o, l), c && v({
85
+ }, e.value.onerror = (a) => {
86
+ f.value = !1, s.value = !1, u.value = "连接失败", t && (clearTimeout(t), t = null), o = "WebSocket 连接失败", i && console.error(o, a), c && v({
87
87
  message: o,
88
88
  type: "error",
89
89
  grouping: !0,
90
90
  showClose: !0,
91
91
  duration: 3e3
92
- }), y?.(l);
92
+ }), T?.(a);
93
93
  };
94
94
  }, J = (n) => {
95
95
  if (!e.value || e.value.readyState !== WebSocket.OPEN) {
@@ -102,16 +102,16 @@ function z(O) {
102
102
  });
103
103
  return;
104
104
  }
105
- const l = typeof n == "string" ? n : JSON.stringify(n);
106
- e.value.send(l);
105
+ const a = typeof n == "string" ? n : JSON.stringify(n);
106
+ e.value.send(a);
107
107
  }, d = () => {
108
108
  e.value && (e.value.close(), e.value = null), f.value = !1, s.value = !1, u.value = "手动关闭连接", g(), t && (clearTimeout(t), t = null);
109
109
  };
110
110
  return w(), x(() => {
111
- r && (clearInterval(r), r = null), a && (clearTimeout(a), a = null);
112
- }), A(() => {
113
- s.value && k && (r = setInterval(W, T));
111
+ r && (clearInterval(r), r = null), l && (clearTimeout(l), l = null);
114
112
  }), D(() => {
113
+ s.value && k && (r = setInterval(W, y));
114
+ }), L(() => {
115
115
  d();
116
116
  }), {
117
117
  ws: e,
@@ -123,7 +123,7 @@ function z(O) {
123
123
  };
124
124
  }
125
125
  export {
126
- G as useMouseSelection,
127
- K as useReactivityTableHeight,
128
- z as useWebSocket
126
+ B as useMouseSelection,
127
+ F as useReactivityTableHeight,
128
+ j as useWebSocket
129
129
  };
@@ -0,0 +1,167 @@
1
+ import "pinia-plugin-persistedstate";
2
+ import { defineStore as m } from "pinia";
3
+ import { ref as u, computed as b, watch as h } from "vue";
4
+ import { Fullscreen as S } from "@jnrs/shared";
5
+ import { usePreferredDark as f } from "@vueuse/core";
6
+ import { a as k } from "./index-GnfhAnhF.js";
7
+ const O = m(
8
+ "@jnrs/vue-core/pinia:mock",
9
+ () => ({ useMockServe: u(!1) }),
10
+ {
11
+ persist: {
12
+ pick: ["useMockServe"]
13
+ }
14
+ }
15
+ ), j = [
16
+ { value: "zhCn", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.zhCn" },
17
+ { value: "en", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.en" }
18
+ ], C = [
19
+ { value: "auto", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.auto" },
20
+ { value: "light", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.light" },
21
+ { value: "dark", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.dark" }
22
+ ], M = [
23
+ { value: "oklch(0.6 0.19 41)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jnrs" },
24
+ {
25
+ value: "oklch(0.51 0.21 264)",
26
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.azure"
27
+ },
28
+ {
29
+ value: "oklch(0.90 0.16 98)",
30
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.moonYellow"
31
+ },
32
+ { value: "oklch(0.63 0.25 27)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jdRed" },
33
+ {
34
+ value: "oklch(0.65 0.24 33)",
35
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.taobaoRed"
36
+ },
37
+ {
38
+ value: "oklch(0.61 0.20 261)",
39
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.dingtalkBlue"
40
+ },
41
+ {
42
+ value: "oklch(0.70 0.12 152)",
43
+ label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.wechatGreen"
44
+ }
45
+ ];
46
+ function w(e) {
47
+ return e === "zhCn" || e === "en";
48
+ }
49
+ function G(e) {
50
+ return e === "light" || e === "dark" || e === "auto";
51
+ }
52
+ function U(e) {
53
+ return typeof e == "string" && e.trim() !== "";
54
+ }
55
+ const x = m(
56
+ "@jnrs/vue-core/pinia:system",
57
+ () => {
58
+ const e = u(!1), o = () => e.value = !e.value, s = new S(), r = u(!1), p = async () => {
59
+ await s.toggle(), r.value = s.isFullscreen();
60
+ }, t = u({
61
+ locale: j[0].value,
62
+ mode: C[0].value,
63
+ primaryColor: M[0].value
64
+ }), a = b(() => t.value.mode === "auto" ? d.value ? "dark" : "light" : t.value.mode), d = f();
65
+ return h(
66
+ [() => t.value.mode, d, () => t.value.primaryColor],
67
+ ([l, y, v]) => {
68
+ const c = document.documentElement;
69
+ c.classList.remove("light", "dark"), l === "auto" ? c.classList.add(y ? "dark" : "light") : c.classList.add(l), v ? c.style.setProperty("--jnrs-color-primary", v) : c.style.removeProperty("--jnrs-color-primary");
70
+ },
71
+ { immediate: !0 }
72
+ ), {
73
+ theme: t,
74
+ computedThemeMode: a,
75
+ menuCollapse: e,
76
+ documentFullscreen: r,
77
+ toggleCollapse: o,
78
+ toggleFullScreen: p,
79
+ setLocale: (l) => {
80
+ w(l) && (t.value.locale = l);
81
+ },
82
+ setMode: (l) => {
83
+ G(l) && (t.value.mode = l);
84
+ },
85
+ setPrimaryColor: (l) => {
86
+ U(l) && (t.value.primaryColor = l);
87
+ }
88
+ };
89
+ },
90
+ {
91
+ persist: {
92
+ pick: ["theme", "menuCollapse"]
93
+ }
94
+ }
95
+ ), n = [];
96
+ for (let e = 0; e < 256; ++e)
97
+ n.push((e + 256).toString(16).slice(1));
98
+ function L(e, o = 0) {
99
+ return (n[e[o + 0]] + n[e[o + 1]] + n[e[o + 2]] + n[e[o + 3]] + "-" + n[e[o + 4]] + n[e[o + 5]] + "-" + n[e[o + 6]] + n[e[o + 7]] + "-" + n[e[o + 8]] + n[e[o + 9]] + "-" + n[e[o + 10]] + n[e[o + 11]] + n[e[o + 12]] + n[e[o + 13]] + n[e[o + 14]] + n[e[o + 15]]).toLowerCase();
100
+ }
101
+ let i;
102
+ const P = new Uint8Array(16);
103
+ function R() {
104
+ if (!i) {
105
+ if (typeof crypto > "u" || !crypto.getRandomValues)
106
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
107
+ i = crypto.getRandomValues.bind(crypto);
108
+ }
109
+ return i(P);
110
+ }
111
+ const D = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), g = { randomUUID: D };
112
+ function I(e, o, s) {
113
+ e = e || {};
114
+ const r = e.random ?? e.rng?.() ?? R();
115
+ if (r.length < 16)
116
+ throw new Error("Random bytes length must be >= 16");
117
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, L(r);
118
+ }
119
+ function _(e, o, s) {
120
+ return g.randomUUID && !e ? g.randomUUID() : I(e);
121
+ }
122
+ const T = m(
123
+ "@jnrs/vue-core/pinia:menu",
124
+ () => {
125
+ const e = u(!1), o = u([]), s = async (t) => {
126
+ if (e.value)
127
+ return o.value;
128
+ r(t), o.value = t, e.value = !0;
129
+ try {
130
+ await k(o.value);
131
+ } catch (a) {
132
+ throw a;
133
+ }
134
+ return o.value;
135
+ }, r = (t) => {
136
+ for (const a of t)
137
+ a.meta.uuid = _(), a.children && r(a.children);
138
+ };
139
+ return { hasFetchedAsyncMenus: e, menus: o, asyncSetMenus: s, clearMenu: () => {
140
+ e.value = !1, o.value = [];
141
+ } };
142
+ }
143
+ // {
144
+ // persist: {
145
+ // pick: ['menus']
146
+ // }
147
+ // }
148
+ );
149
+ console.log(
150
+ "%c✨ 欢迎使用 @jnrs/vue-core/pinia",
151
+ 'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
152
+ );
153
+ const q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154
+ __proto__: null,
155
+ useMenuStore: T,
156
+ useMockStore: O,
157
+ useSystemStore: x
158
+ }, Symbol.toStringTag, { value: "Module" }));
159
+ export {
160
+ M as C,
161
+ j as L,
162
+ C as M,
163
+ x as a,
164
+ T as b,
165
+ q as i,
166
+ O as u
167
+ };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c as r } from "./index-GnfhAnhF.js";
2
- import { i } from "./index-BFtkMENx.js";
2
+ import { i } from "./index-DRbGqK4D.js";
3
3
  console.log(
4
4
  "%c✨ 欢迎使用 @jnrs/vue-core",
5
5
  'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
@@ -1,4 +1,4 @@
1
- import { Locale, ThemeMode } from '@jnrs/shared';
2
- export declare function isLocale(value: unknown): value is Locale;
3
- export declare function isThemeMode(value: unknown): value is ThemeMode;
1
+ import { ILocale, IThemeMode } from '@jnrs/shared';
2
+ export declare function isLocale(value: unknown): value is ILocale;
3
+ export declare function isThemeMode(value: unknown): value is IThemeMode;
4
4
  export declare function isValidColor(value: unknown): value is string;
@@ -1,4 +1,4 @@
1
- import { MenuItem } from '../../types/base';
1
+ import { IMenuItem } from '../../types/base';
2
2
  /**
3
3
  * useMenuStore 菜单仓库
4
4
  * @returns hasFetchedAsyncMenus 菜单是否已获取
@@ -27,7 +27,7 @@ export declare const useMenuStore: import('pinia').StoreDefinition<"@jnrs/vue-co
27
27
  component?: string | undefined;
28
28
  redirect?: string | undefined;
29
29
  children?: /*elided*/ any[] | undefined;
30
- }[], MenuItem[] | {
30
+ }[], IMenuItem[] | {
31
31
  meta: {
32
32
  [x: string]: unknown;
33
33
  [x: number]: unknown;
@@ -47,7 +47,7 @@ export declare const useMenuStore: import('pinia').StoreDefinition<"@jnrs/vue-co
47
47
  redirect?: string | undefined;
48
48
  children?: /*elided*/ any[] | undefined;
49
49
  }[]>;
50
- asyncSetMenus: (res: MenuItem[]) => Promise<{
50
+ asyncSetMenus: (res: IMenuItem[]) => Promise<{
51
51
  meta: {
52
52
  [x: string]: unknown;
53
53
  [x: number]: unknown;
@@ -89,7 +89,7 @@ export declare const useMenuStore: import('pinia').StoreDefinition<"@jnrs/vue-co
89
89
  component?: string | undefined;
90
90
  redirect?: string | undefined;
91
91
  children?: /*elided*/ any[] | undefined;
92
- }[], MenuItem[] | {
92
+ }[], IMenuItem[] | {
93
93
  meta: {
94
94
  [x: string]: unknown;
95
95
  [x: number]: unknown;
@@ -109,7 +109,7 @@ export declare const useMenuStore: import('pinia').StoreDefinition<"@jnrs/vue-co
109
109
  redirect?: string | undefined;
110
110
  children?: /*elided*/ any[] | undefined;
111
111
  }[]>;
112
- asyncSetMenus: (res: MenuItem[]) => Promise<{
112
+ asyncSetMenus: (res: IMenuItem[]) => Promise<{
113
113
  meta: {
114
114
  [x: string]: unknown;
115
115
  [x: number]: unknown;
@@ -151,7 +151,7 @@ export declare const useMenuStore: import('pinia').StoreDefinition<"@jnrs/vue-co
151
151
  component?: string | undefined;
152
152
  redirect?: string | undefined;
153
153
  children?: /*elided*/ any[] | undefined;
154
- }[], MenuItem[] | {
154
+ }[], IMenuItem[] | {
155
155
  meta: {
156
156
  [x: string]: unknown;
157
157
  [x: number]: unknown;
@@ -171,7 +171,7 @@ export declare const useMenuStore: import('pinia').StoreDefinition<"@jnrs/vue-co
171
171
  redirect?: string | undefined;
172
172
  children?: /*elided*/ any[] | undefined;
173
173
  }[]>;
174
- asyncSetMenus: (res: MenuItem[]) => Promise<{
174
+ asyncSetMenus: (res: IMenuItem[]) => Promise<{
175
175
  meta: {
176
176
  [x: string]: unknown;
177
177
  [x: number]: unknown;
@@ -1,7 +1,7 @@
1
- import { Locale, ThemeMode } from '@jnrs/shared';
1
+ import { ILocale, IThemeMode } from '@jnrs/shared';
2
2
  type Theme = {
3
- locale: Locale;
4
- mode: ThemeMode;
3
+ locale: ILocale;
4
+ mode: IThemeMode;
5
5
  primaryColor: string;
6
6
  };
7
7
  /**
@@ -15,12 +15,12 @@ type Theme = {
15
15
  */
16
16
  export declare const useSystemStore: import('pinia').StoreDefinition<"@jnrs/vue-core/pinia:system", Pick<{
17
17
  theme: import('vue').Ref<{
18
- locale: Locale;
19
- mode: ThemeMode;
18
+ locale: ILocale;
19
+ mode: IThemeMode;
20
20
  primaryColor: string;
21
21
  }, Theme | {
22
- locale: Locale;
23
- mode: ThemeMode;
22
+ locale: ILocale;
23
+ mode: IThemeMode;
24
24
  primaryColor: string;
25
25
  }>;
26
26
  computedThemeMode: import('vue').ComputedRef<"light" | "dark">;
@@ -33,12 +33,12 @@ export declare const useSystemStore: import('pinia').StoreDefinition<"@jnrs/vue-
33
33
  setPrimaryColor: (value: unknown) => void;
34
34
  }, "theme" | "menuCollapse" | "documentFullscreen">, Pick<{
35
35
  theme: import('vue').Ref<{
36
- locale: Locale;
37
- mode: ThemeMode;
36
+ locale: ILocale;
37
+ mode: IThemeMode;
38
38
  primaryColor: string;
39
39
  }, Theme | {
40
- locale: Locale;
41
- mode: ThemeMode;
40
+ locale: ILocale;
41
+ mode: IThemeMode;
42
42
  primaryColor: string;
43
43
  }>;
44
44
  computedThemeMode: import('vue').ComputedRef<"light" | "dark">;
@@ -51,12 +51,12 @@ export declare const useSystemStore: import('pinia').StoreDefinition<"@jnrs/vue-
51
51
  setPrimaryColor: (value: unknown) => void;
52
52
  }, "computedThemeMode">, Pick<{
53
53
  theme: import('vue').Ref<{
54
- locale: Locale;
55
- mode: ThemeMode;
54
+ locale: ILocale;
55
+ mode: IThemeMode;
56
56
  primaryColor: string;
57
57
  }, Theme | {
58
- locale: Locale;
59
- mode: ThemeMode;
58
+ locale: ILocale;
59
+ mode: IThemeMode;
60
60
  primaryColor: string;
61
61
  }>;
62
62
  computedThemeMode: import('vue').ComputedRef<"light" | "dark">;
@@ -1,4 +1,3 @@
1
1
  export * from './mock';
2
2
  export * from './base/system';
3
- export * from './base/auth';
4
3
  export * from './base/menu';
@@ -1,8 +1,7 @@
1
1
  import "pinia-plugin-persistedstate";
2
- import { b as t, c as r, u, a } from "../index-BFtkMENx.js";
2
+ import { b as r, u as t, a as u } from "../index-DRbGqK4D.js";
3
3
  export {
4
- t as useAuthStore,
5
4
  r as useMenuStore,
6
- u as useMockStore,
7
- a as useSystemStore
5
+ t as useMockStore,
6
+ u as useSystemStore
8
7
  };
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Mock仓库
3
- * @returns isMock 是否使用mock数据
3
+ * @returns useMockServe 是否使用mock数据
4
4
  */
5
- export declare const useMockStore: import('pinia').StoreDefinition<"jnrs-app-mock", Pick<{
6
- isMock: import('vue').Ref<boolean, boolean>;
7
- }, "isMock">, Pick<{
8
- isMock: import('vue').Ref<boolean, boolean>;
5
+ export declare const useMockStore: import('pinia').StoreDefinition<"@jnrs/vue-core/pinia:mock", Pick<{
6
+ useMockServe: import('vue').Ref<boolean, boolean>;
7
+ }, "useMockServe">, Pick<{
8
+ useMockServe: import('vue').Ref<boolean, boolean>;
9
9
  }, never>, Pick<{
10
- isMock: import('vue').Ref<boolean, boolean>;
10
+ useMockServe: import('vue').Ref<boolean, boolean>;
11
11
  }, never>>;
@@ -2,13 +2,13 @@ import { RouteMeta } from 'vue-router';
2
2
  /**
3
3
  * 定义菜单项接口
4
4
  */
5
- export interface MenuItem {
5
+ export interface IMenuItem {
6
6
  meta: RouteMeta;
7
7
  path: string;
8
8
  name?: string;
9
9
  component?: string;
10
10
  redirect?: string;
11
- children?: MenuItem[];
11
+ children?: IMenuItem[];
12
12
  }
13
13
  /**
14
14
  * Element 尺寸
@@ -21,7 +21,7 @@ export type ElButtonType = 'default' | 'primary' | 'success' | 'info' | 'warning
21
21
  /**
22
22
  * 文件信息
23
23
  */
24
- export interface Attachment {
24
+ export interface IAttachment {
25
25
  /**
26
26
  * 数据 id
27
27
  */
@@ -50,7 +50,7 @@ export interface Attachment {
50
50
  /**
51
51
  * 分页
52
52
  */
53
- export interface Pagination {
53
+ export interface IPagination {
54
54
  /**
55
55
  * 当前页码
56
56
  */
@@ -63,7 +63,7 @@ export interface Pagination {
63
63
  /**
64
64
  * 分页列表数据
65
65
  */
66
- export interface PageTableData<T> extends Pagination {
66
+ export interface IPageData<T> extends IPagination {
67
67
  /**
68
68
  * 数据列表
69
69
  */
@@ -1,5 +1,5 @@
1
1
  import { Router, RouteLocationRaw } from 'vue-router';
2
- import { MenuItem } from '../types/base';
2
+ import { IMenuItem } from '../types/base';
3
3
  import { CreateVueRouter } from './types';
4
4
  /**
5
5
  * 创建 vue-router 实例
@@ -23,6 +23,6 @@ declare const handleRouter: (to: RouteLocationRaw, type?: "push" | "replace") =>
23
23
  * @param menus 菜单项
24
24
  * @param parent 父级菜单项
25
25
  */
26
- declare const asyncGenerateRoute: (menus: MenuItem[], parent?: MenuItem) => Promise<void>;
27
- declare const getRoutes: () => MenuItem[];
26
+ declare const asyncGenerateRoute: (menus: IMenuItem[], parent?: IMenuItem) => Promise<void>;
27
+ declare const getRoutes: () => IMenuItem[];
28
28
  export { createVueRouter, asyncGenerateRoute, handleRouter, getRoutes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jnrs/vue-core",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "description": "巨能前端工程化开发,Vue 专用核心功能包。",
5
5
  "keywords": [
6
6
  "jnrs",
@@ -58,7 +58,7 @@
58
58
  "vue": "^3.5.22",
59
59
  "vue-router": "^4.5.1",
60
60
  "vue-i18n": "^11.2.8",
61
- "@jnrs/shared": "1.1.15"
61
+ "@jnrs/shared": "1.1.17"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@vitejs/plugin-vue": "^6.0.1",
@@ -1,201 +0,0 @@
1
- import "pinia-plugin-persistedstate";
2
- import { defineStore as p } from "pinia";
3
- import { ref as s, computed as k, watch as S } from "vue";
4
- import { Fullscreen as j } from "@jnrs/shared";
5
- import { usePreferredDark as O } from "@vueuse/core";
6
- import { a as C } from "./index-GnfhAnhF.js";
7
- const M = p(
8
- "jnrs-app-mock",
9
- () => ({ isMock: s(!1) }),
10
- {
11
- persist: {
12
- pick: ["isMock"]
13
- }
14
- }
15
- ), w = [
16
- { value: "zhCn", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.zhCn" },
17
- { value: "en", label: "@jnrs/vue-core.components.GlobalSetting.languageOptions.en" }
18
- ], G = [
19
- { value: "auto", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.auto" },
20
- { value: "light", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.light" },
21
- { value: "dark", label: "@jnrs/vue-core.components.GlobalSetting.themeOptions.dark" }
22
- ], U = [
23
- { value: "oklch(0.6 0.19 41)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jnrs" },
24
- {
25
- value: "oklch(0.51 0.21 264)",
26
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.azure"
27
- },
28
- {
29
- value: "oklch(0.90 0.16 98)",
30
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.moonYellow"
31
- },
32
- { value: "oklch(0.63 0.25 27)", label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.jdRed" },
33
- {
34
- value: "oklch(0.65 0.24 33)",
35
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.taobaoRed"
36
- },
37
- {
38
- value: "oklch(0.61 0.20 261)",
39
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.dingtalkBlue"
40
- },
41
- {
42
- value: "oklch(0.70 0.12 152)",
43
- label: "@jnrs/vue-core.components.GlobalSetting.primaryColorOptions.wechatGreen"
44
- }
45
- ];
46
- function I(e) {
47
- return e === "zhCn" || e === "en";
48
- }
49
- function x(e) {
50
- return e === "light" || e === "dark" || e === "auto";
51
- }
52
- function L(e) {
53
- return typeof e == "string" && e.trim() !== "";
54
- }
55
- const R = p(
56
- "@jnrs/vue-core/pinia:system",
57
- () => {
58
- const e = s(!1), o = () => e.value = !e.value, a = new j(), n = s(!1), i = async () => {
59
- await a.toggle(), n.value = a.isFullscreen();
60
- }, l = s({
61
- locale: w[0].value,
62
- mode: G[0].value,
63
- primaryColor: U[0].value
64
- }), u = k(() => l.value.mode === "auto" ? d.value ? "dark" : "light" : l.value.mode), d = O();
65
- return S(
66
- [() => l.value.mode, d, () => l.value.primaryColor],
67
- ([r, f, g]) => {
68
- const m = document.documentElement;
69
- m.classList.remove("light", "dark"), r === "auto" ? m.classList.add(f ? "dark" : "light") : m.classList.add(r), g ? m.style.setProperty("--jnrs-color-primary", g) : m.style.removeProperty("--jnrs-color-primary");
70
- },
71
- { immediate: !0 }
72
- ), {
73
- theme: l,
74
- computedThemeMode: u,
75
- menuCollapse: e,
76
- documentFullscreen: n,
77
- toggleCollapse: o,
78
- toggleFullScreen: i,
79
- setLocale: (r) => {
80
- I(r) && (l.value.locale = r);
81
- },
82
- setMode: (r) => {
83
- x(r) && (l.value.mode = r);
84
- },
85
- setPrimaryColor: (r) => {
86
- L(r) && (l.value.primaryColor = r);
87
- }
88
- };
89
- },
90
- {
91
- persist: {
92
- pick: ["theme", "menuCollapse"]
93
- }
94
- }
95
- ), D = p(
96
- "@jnrs/vue-core/pinia:auth",
97
- () => {
98
- const e = s(!1), o = s(null), a = s(null), n = s(), i = s([]);
99
- return {
100
- hasAuthenticated: e,
101
- token: o,
102
- userInfo: a,
103
- dict: n,
104
- role: i,
105
- setUserInfo: (c) => {
106
- a.value = c;
107
- },
108
- setToken: (c) => {
109
- o.value = c, e.value = !0;
110
- },
111
- setDict: (c) => {
112
- n.value = c;
113
- },
114
- setRole: (c) => {
115
- i.value = c;
116
- },
117
- clearAuth: () => {
118
- o.value = null, a.value = null, n.value = void 0, i.value = [], e.value = !1;
119
- }
120
- };
121
- },
122
- {
123
- persist: {
124
- pick: ["hasAuthenticated", "token", "userInfo", "dict"]
125
- }
126
- }
127
- ), t = [];
128
- for (let e = 0; e < 256; ++e)
129
- t.push((e + 256).toString(16).slice(1));
130
- function P(e, o = 0) {
131
- return (t[e[o + 0]] + t[e[o + 1]] + t[e[o + 2]] + t[e[o + 3]] + "-" + t[e[o + 4]] + t[e[o + 5]] + "-" + t[e[o + 6]] + t[e[o + 7]] + "-" + t[e[o + 8]] + t[e[o + 9]] + "-" + t[e[o + 10]] + t[e[o + 11]] + t[e[o + 12]] + t[e[o + 13]] + t[e[o + 14]] + t[e[o + 15]]).toLowerCase();
132
- }
133
- let v;
134
- const T = new Uint8Array(16);
135
- function A() {
136
- if (!v) {
137
- if (typeof crypto > "u" || !crypto.getRandomValues)
138
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
139
- v = crypto.getRandomValues.bind(crypto);
140
- }
141
- return v(T);
142
- }
143
- const _ = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), h = { randomUUID: _ };
144
- function z(e, o, a) {
145
- e = e || {};
146
- const n = e.random ?? e.rng?.() ?? A();
147
- if (n.length < 16)
148
- throw new Error("Random bytes length must be >= 16");
149
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, P(n);
150
- }
151
- function E(e, o, a) {
152
- return h.randomUUID && !e ? h.randomUUID() : z(e);
153
- }
154
- const F = p(
155
- "@jnrs/vue-core/pinia:menu",
156
- () => {
157
- const e = s(!1), o = s([]), a = async (l) => {
158
- if (e.value)
159
- return o.value;
160
- n(l), o.value = l, e.value = !0;
161
- try {
162
- await C(o.value);
163
- } catch (u) {
164
- throw u;
165
- }
166
- return o.value;
167
- }, n = (l) => {
168
- for (const u of l)
169
- u.meta.uuid = E(), u.children && n(u.children);
170
- };
171
- return { hasFetchedAsyncMenus: e, menus: o, asyncSetMenus: a, clearMenu: () => {
172
- e.value = !1, o.value = [];
173
- } };
174
- }
175
- // {
176
- // persist: {
177
- // pick: ['menus']
178
- // }
179
- // }
180
- );
181
- console.log(
182
- "%c✨ 欢迎使用 @jnrs/vue-core/pinia",
183
- 'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
184
- );
185
- const J = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
186
- __proto__: null,
187
- useAuthStore: D,
188
- useMenuStore: F,
189
- useMockStore: M,
190
- useSystemStore: R
191
- }, Symbol.toStringTag, { value: "Module" }));
192
- export {
193
- U as C,
194
- w as L,
195
- G as M,
196
- R as a,
197
- D as b,
198
- F as c,
199
- J as i,
200
- M as u
201
- };
@@ -1,135 +0,0 @@
1
- import { Dict, User, Role } from '@jnrs/shared';
2
- /**
3
- * useAuthStore 权限仓库
4
- * @returns hasAuthenticated 是否已身份验证
5
- * @returns token 身份验证凭证
6
- * @returns userInfo 用户信息
7
- * @returns dict 字典
8
- * @returns role 角色权限
9
- * @methods asyncSetAuth 设置权限信息
10
- * @methods clearAuth 清除权限信息
11
- */
12
- export declare const useAuthStore: import('pinia').StoreDefinition<"@jnrs/vue-core/pinia:auth", Pick<{
13
- hasAuthenticated: import('vue').Ref<boolean, boolean>;
14
- token: import('vue').Ref<string | null, string | null>;
15
- userInfo: import('vue').Ref<{
16
- [x: string]: unknown;
17
- id: number;
18
- name: string;
19
- role: number;
20
- permissions?: string[] | undefined;
21
- jobTitle?: number | undefined;
22
- workNo?: string | undefined;
23
- workgroup?: string | undefined;
24
- avatarFileName?: string | undefined;
25
- } | null, User | {
26
- [x: string]: unknown;
27
- id: number;
28
- name: string;
29
- role: number;
30
- permissions?: string[] | undefined;
31
- jobTitle?: number | undefined;
32
- workNo?: string | undefined;
33
- workgroup?: string | undefined;
34
- avatarFileName?: string | undefined;
35
- } | null>;
36
- dict: import('vue').Ref<Dict | undefined, Dict | undefined>;
37
- role: import('vue').Ref<{
38
- [x: string]: unknown;
39
- label: string;
40
- value: string | number;
41
- permissions?: string[] | undefined;
42
- }[], Role[] | {
43
- [x: string]: unknown;
44
- label: string;
45
- value: string | number;
46
- permissions?: string[] | undefined;
47
- }[]>;
48
- setUserInfo: (d: User) => void;
49
- setToken: (d: string) => void;
50
- setDict: (d: Dict) => void;
51
- setRole: (d: Role[]) => void;
52
- clearAuth: () => void;
53
- }, "role" | "hasAuthenticated" | "token" | "userInfo" | "dict">, Pick<{
54
- hasAuthenticated: import('vue').Ref<boolean, boolean>;
55
- token: import('vue').Ref<string | null, string | null>;
56
- userInfo: import('vue').Ref<{
57
- [x: string]: unknown;
58
- id: number;
59
- name: string;
60
- role: number;
61
- permissions?: string[] | undefined;
62
- jobTitle?: number | undefined;
63
- workNo?: string | undefined;
64
- workgroup?: string | undefined;
65
- avatarFileName?: string | undefined;
66
- } | null, User | {
67
- [x: string]: unknown;
68
- id: number;
69
- name: string;
70
- role: number;
71
- permissions?: string[] | undefined;
72
- jobTitle?: number | undefined;
73
- workNo?: string | undefined;
74
- workgroup?: string | undefined;
75
- avatarFileName?: string | undefined;
76
- } | null>;
77
- dict: import('vue').Ref<Dict | undefined, Dict | undefined>;
78
- role: import('vue').Ref<{
79
- [x: string]: unknown;
80
- label: string;
81
- value: string | number;
82
- permissions?: string[] | undefined;
83
- }[], Role[] | {
84
- [x: string]: unknown;
85
- label: string;
86
- value: string | number;
87
- permissions?: string[] | undefined;
88
- }[]>;
89
- setUserInfo: (d: User) => void;
90
- setToken: (d: string) => void;
91
- setDict: (d: Dict) => void;
92
- setRole: (d: Role[]) => void;
93
- clearAuth: () => void;
94
- }, never>, Pick<{
95
- hasAuthenticated: import('vue').Ref<boolean, boolean>;
96
- token: import('vue').Ref<string | null, string | null>;
97
- userInfo: import('vue').Ref<{
98
- [x: string]: unknown;
99
- id: number;
100
- name: string;
101
- role: number;
102
- permissions?: string[] | undefined;
103
- jobTitle?: number | undefined;
104
- workNo?: string | undefined;
105
- workgroup?: string | undefined;
106
- avatarFileName?: string | undefined;
107
- } | null, User | {
108
- [x: string]: unknown;
109
- id: number;
110
- name: string;
111
- role: number;
112
- permissions?: string[] | undefined;
113
- jobTitle?: number | undefined;
114
- workNo?: string | undefined;
115
- workgroup?: string | undefined;
116
- avatarFileName?: string | undefined;
117
- } | null>;
118
- dict: import('vue').Ref<Dict | undefined, Dict | undefined>;
119
- role: import('vue').Ref<{
120
- [x: string]: unknown;
121
- label: string;
122
- value: string | number;
123
- permissions?: string[] | undefined;
124
- }[], Role[] | {
125
- [x: string]: unknown;
126
- label: string;
127
- value: string | number;
128
- permissions?: string[] | undefined;
129
- }[]>;
130
- setUserInfo: (d: User) => void;
131
- setToken: (d: string) => void;
132
- setDict: (d: Dict) => void;
133
- setRole: (d: Role[]) => void;
134
- clearAuth: () => void;
135
- }, "setUserInfo" | "setToken" | "setDict" | "setRole" | "clearAuth">>;