gd-web-core 0.0.1 → 0.0.3
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 +31 -88
- package/dist/index.d.ts +0 -1
- package/dist/index.js +135 -172
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -12
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/useLoading.d.ts +0 -11
- package/dist/hooks/useToggle.d.ts +0 -11
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# gd-web-core
|
|
2
2
|
|
|
3
3
|
Vue 3 基座能力封装库,提供通用组件和工具函数。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pnpm add
|
|
8
|
+
pnpm add gd-web-core
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## 快速开始
|
|
@@ -14,8 +14,8 @@ pnpm add @gdxx/web-core
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { createApp } from 'vue'
|
|
17
|
-
import YourOrgCore from '
|
|
18
|
-
import '
|
|
17
|
+
import YourOrgCore from 'gd-web-core'
|
|
18
|
+
import 'gd-web-core/style.css'
|
|
19
19
|
import App from './App.vue'
|
|
20
20
|
|
|
21
21
|
const app = createApp(App)
|
|
@@ -30,24 +30,21 @@ app.mount('#app')
|
|
|
30
30
|
#### 方式 1: 从主入口导入(推荐)
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
import { Echarts, STable, formatDate
|
|
34
|
-
import '
|
|
33
|
+
import { Echarts, STable, formatDate } from 'gd-web-core'
|
|
34
|
+
import 'gd-web-core/style.css'
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
#### 方式 2: 从子路径导入(更语义化)
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
40
|
// 仅导入组件
|
|
41
|
-
import { Echarts, STable } from '
|
|
41
|
+
import { Echarts, STable } from 'gd-web-core/components'
|
|
42
42
|
|
|
43
43
|
// 仅导入工具函数
|
|
44
|
-
import { formatDate, formatNumber } from '
|
|
45
|
-
|
|
46
|
-
// 仅导入 Hooks
|
|
47
|
-
import { useLoading, useToggle } from '@gdxx/web-core/hooks'
|
|
44
|
+
import { formatDate, formatNumber } from 'gd-web-core/utils'
|
|
48
45
|
|
|
49
46
|
// 导入样式
|
|
50
|
-
import '
|
|
47
|
+
import 'gd-web-core/style.css'
|
|
51
48
|
```
|
|
52
49
|
|
|
53
50
|
#### Tree-shaking 原理
|
|
@@ -56,7 +53,7 @@ import '@gdxx/web-core/style.css'
|
|
|
56
53
|
|
|
57
54
|
```ts
|
|
58
55
|
// 只会打包 formatDate 相关代码,其他工具函数不会被打包
|
|
59
|
-
import { formatDate } from '
|
|
56
|
+
import { formatDate } from 'gd-web-core'
|
|
60
57
|
```
|
|
61
58
|
|
|
62
59
|
**工作条件**:
|
|
@@ -100,7 +97,7 @@ pnpm build
|
|
|
100
97
|
pnpm dev
|
|
101
98
|
|
|
102
99
|
# 在浏览器控制台查看
|
|
103
|
-
import { formatDate } from '
|
|
100
|
+
import { formatDate } from 'gd-web-core'
|
|
104
101
|
// 只会加载 formatDate 相关模块
|
|
105
102
|
```
|
|
106
103
|
|
|
@@ -122,27 +119,6 @@ ls -lh dist/
|
|
|
122
119
|
|
|
123
120
|
## 组件
|
|
124
121
|
|
|
125
|
-
### Button 按钮
|
|
126
|
-
|
|
127
|
-
```vue
|
|
128
|
-
<template>
|
|
129
|
-
<Button type="primary" size="medium" @click="handleClick">
|
|
130
|
-
点击按钮
|
|
131
|
-
</Button>
|
|
132
|
-
</template>
|
|
133
|
-
|
|
134
|
-
<script setup lang="ts">
|
|
135
|
-
import { Button } from '@gdxx/web-core'
|
|
136
|
-
</script>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
| 属性 | 类型 | 默认值 | 说明 |
|
|
140
|
-
|------|------|--------|------|
|
|
141
|
-
| type | `'primary' \| 'secondary' \| 'danger'` | `'primary'` | 按钮类型 |
|
|
142
|
-
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | 按钮尺寸 |
|
|
143
|
-
| disabled | `boolean` | `false` | 是否禁用 |
|
|
144
|
-
| loading | `boolean` | `false` | 是否加载中 |
|
|
145
|
-
|
|
146
122
|
### Echarts 图表
|
|
147
123
|
|
|
148
124
|
需要安装 `echarts` 依赖。
|
|
@@ -153,7 +129,7 @@ import { Button } from '@gdxx/web-core'
|
|
|
153
129
|
</template>
|
|
154
130
|
|
|
155
131
|
<script setup lang="ts">
|
|
156
|
-
import { Echarts } from '
|
|
132
|
+
import { Echarts } from 'gd-web-core'
|
|
157
133
|
|
|
158
134
|
const chartOptions = {
|
|
159
135
|
xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
|
|
@@ -182,7 +158,7 @@ const chartOptions = {
|
|
|
182
158
|
</template>
|
|
183
159
|
|
|
184
160
|
<script setup lang="ts">
|
|
185
|
-
import { ScrollContainer } from '
|
|
161
|
+
import { ScrollContainer } from 'gd-web-core'
|
|
186
162
|
</script>
|
|
187
163
|
```
|
|
188
164
|
|
|
@@ -202,7 +178,7 @@ import { ScrollContainer } from '@gdxx/web-core'
|
|
|
202
178
|
</template>
|
|
203
179
|
|
|
204
180
|
<script setup lang="ts">
|
|
205
|
-
import { STable } from '
|
|
181
|
+
import { STable } from 'gd-web-core'
|
|
206
182
|
|
|
207
183
|
const columns = [
|
|
208
184
|
{ title: '姓名', dataIndex: 'name' },
|
|
@@ -216,34 +192,12 @@ const loadData = async (params) => {
|
|
|
216
192
|
</script>
|
|
217
193
|
```
|
|
218
194
|
|
|
219
|
-
## Hooks
|
|
220
|
-
|
|
221
|
-
### useLoading
|
|
222
|
-
|
|
223
|
-
```ts
|
|
224
|
-
import { useLoading } from '@gdxx/web-core'
|
|
225
|
-
|
|
226
|
-
const { loading, startLoading, stopLoading, withLoading } = useLoading()
|
|
227
|
-
|
|
228
|
-
await withLoading(async () => {
|
|
229
|
-
await fetchData()
|
|
230
|
-
})
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### useToggle
|
|
234
|
-
|
|
235
|
-
```ts
|
|
236
|
-
import { useToggle } from '@gdxx/web-core'
|
|
237
|
-
|
|
238
|
-
const { value, toggle, setTrue, setFalse } = useToggle(false)
|
|
239
|
-
```
|
|
240
|
-
|
|
241
195
|
## 工具函数
|
|
242
196
|
|
|
243
197
|
### 日期格式化
|
|
244
198
|
|
|
245
199
|
```ts
|
|
246
|
-
import { formatDate, dateFormat } from '
|
|
200
|
+
import { formatDate, dateFormat } from 'gd-web-core'
|
|
247
201
|
|
|
248
202
|
formatDate(new Date()) // '2026-02-02 10:30:00'
|
|
249
203
|
formatDate('2026-01-01', 'YYYY/MM/DD') // '2026/01/01'
|
|
@@ -253,7 +207,7 @@ dateFormat('YY-mm-dd HH:MM:SS', new Date()) // '2026-02-02 10:30:00'
|
|
|
253
207
|
### 数字处理
|
|
254
208
|
|
|
255
209
|
```ts
|
|
256
|
-
import { formatNumber, formatFileSize, toFixed, round } from '
|
|
210
|
+
import { formatNumber, formatFileSize, toFixed, round } from 'gd-web-core'
|
|
257
211
|
|
|
258
212
|
formatNumber(1234567.89) // '1,234,567.89'
|
|
259
213
|
formatFileSize(1048576) // '1 MB'
|
|
@@ -264,7 +218,7 @@ round(0.7 * 3, 2) // 2.1 (四舍五入,精度安全)
|
|
|
264
218
|
### Storage 封装
|
|
265
219
|
|
|
266
220
|
```ts
|
|
267
|
-
import { storage, createStorage } from '
|
|
221
|
+
import { storage, createStorage } from 'gd-web-core'
|
|
268
222
|
|
|
269
223
|
storage.set('token', 'xxx', 3600000) // 1小时后过期
|
|
270
224
|
storage.get('token')
|
|
@@ -275,7 +229,7 @@ const myStorage = createStorage('session', { prefix: 'myapp' })
|
|
|
275
229
|
### 防抖节流
|
|
276
230
|
|
|
277
231
|
```ts
|
|
278
|
-
import { debounce, throttle, createDebounce } from '
|
|
232
|
+
import { debounce, throttle, createDebounce } from 'gd-web-core'
|
|
279
233
|
|
|
280
234
|
// Promise 防抖
|
|
281
235
|
await debounce('search', 300)
|
|
@@ -290,7 +244,7 @@ const debouncedFn = createDebounce(fn, 300)
|
|
|
290
244
|
### URL 参数
|
|
291
245
|
|
|
292
246
|
```ts
|
|
293
|
-
import { useUrlParams, updateUrlParams } from '
|
|
247
|
+
import { useUrlParams, updateUrlParams } from 'gd-web-core'
|
|
294
248
|
|
|
295
249
|
const params = useUrlParams()
|
|
296
250
|
updateUrlParams({ page: '2' })
|
|
@@ -299,7 +253,7 @@ updateUrlParams({ page: '2' })
|
|
|
299
253
|
### DOM 操作
|
|
300
254
|
|
|
301
255
|
```ts
|
|
302
|
-
import { scrollView, setHtmlTitle, print } from '
|
|
256
|
+
import { scrollView, setHtmlTitle, print } from 'gd-web-core'
|
|
303
257
|
|
|
304
258
|
scrollView('element-id')
|
|
305
259
|
setHtmlTitle('新标题')
|
|
@@ -309,7 +263,7 @@ await print('#print-area')
|
|
|
309
263
|
### 加密
|
|
310
264
|
|
|
311
265
|
```ts
|
|
312
|
-
import { useRsa, useAes, disuseAes } from '
|
|
266
|
+
import { useRsa, useAes, disuseAes } from 'gd-web-core'
|
|
313
267
|
|
|
314
268
|
const encrypted = await useRsa('data', publicKey)
|
|
315
269
|
const aesEncrypted = await useAes('data', key)
|
|
@@ -319,7 +273,7 @@ const decrypted = await disuseAes(aesEncrypted, key)
|
|
|
319
273
|
### 页面可见性
|
|
320
274
|
|
|
321
275
|
```ts
|
|
322
|
-
import { onVisibilityChange } from '
|
|
276
|
+
import { onVisibilityChange } from 'gd-web-core'
|
|
323
277
|
|
|
324
278
|
const unsubscribe = onVisibilityChange((hidden) => {
|
|
325
279
|
console.log('页面隐藏:', hidden)
|
|
@@ -329,7 +283,7 @@ const unsubscribe = onVisibilityChange((hidden) => {
|
|
|
329
283
|
### Excel 导入导出
|
|
330
284
|
|
|
331
285
|
```ts
|
|
332
|
-
import { importExcel, importExcelAll, exportJsonToExcel } from '
|
|
286
|
+
import { importExcel, importExcelAll, exportJsonToExcel } from 'gd-web-core'
|
|
333
287
|
|
|
334
288
|
// 导入
|
|
335
289
|
const data = await importExcel(file)
|
|
@@ -342,7 +296,7 @@ await exportJsonToExcel(['姓名', '年龄'], [['张三', 25]], '用户列表')
|
|
|
342
296
|
### 后端数据解析
|
|
343
297
|
|
|
344
298
|
```ts
|
|
345
|
-
import { rowSet, pageRowSet } from '
|
|
299
|
+
import { rowSet, pageRowSet } from 'gd-web-core'
|
|
346
300
|
|
|
347
301
|
const { colKey, data } = rowSet(result)
|
|
348
302
|
const { colKey, data, total } = pageRowSet(pageResult)
|
|
@@ -353,7 +307,7 @@ const { colKey, data, total } = pageRowSet(pageResult)
|
|
|
353
307
|
### 为什么按需引入后打包体积还是很大?
|
|
354
308
|
|
|
355
309
|
1. **检查样式文件**:CSS 是全量加载的,确保只在入口文件导入一次
|
|
356
|
-
2. **检查导入方式**:避免使用 `import * as Core from '
|
|
310
|
+
2. **检查导入方式**:避免使用 `import * as Core from 'gd-web-core'`
|
|
357
311
|
3. **检查生产模式**:确保打包工具运行在生产模式 (`NODE_ENV=production`)
|
|
358
312
|
4. **检查打包配置**:确认 Tree-shaking 已启用
|
|
359
313
|
|
|
@@ -374,7 +328,7 @@ const { colKey, data, total } = pageRowSet(pageResult)
|
|
|
374
328
|
|
|
375
329
|
```bash
|
|
376
330
|
# 最小安装
|
|
377
|
-
pnpm add
|
|
331
|
+
pnpm add gd-web-core vue
|
|
378
332
|
|
|
379
333
|
# 使用 Echarts 组件
|
|
380
334
|
pnpm add echarts
|
|
@@ -388,10 +342,10 @@ pnpm add ant-design-vue @surely-vue/table
|
|
|
388
342
|
完全支持。所有类型定义都会正确推导:
|
|
389
343
|
|
|
390
344
|
```ts
|
|
391
|
-
import { formatDate } from '
|
|
345
|
+
import { formatDate } from 'gd-web-core'
|
|
392
346
|
// formatDate 函数会有完整的类型提示
|
|
393
347
|
|
|
394
|
-
import type { EchartsProps } from '
|
|
348
|
+
import type { EchartsProps } from 'gd-web-core'
|
|
395
349
|
// 可以单独导入类型
|
|
396
350
|
```
|
|
397
351
|
|
|
@@ -400,13 +354,9 @@ import type { EchartsProps } from '@gdxx/web-core'
|
|
|
400
354
|
```
|
|
401
355
|
src/
|
|
402
356
|
├── components/
|
|
403
|
-
│ ├── Button/
|
|
404
357
|
│ ├── Echarts/
|
|
405
358
|
│ ├── ScrollContainer/
|
|
406
359
|
│ └── STable/
|
|
407
|
-
├── hooks/
|
|
408
|
-
│ ├── useLoading.ts
|
|
409
|
-
│ └── useToggle.ts
|
|
410
360
|
├── utils/
|
|
411
361
|
│ ├── format.ts
|
|
412
362
|
│ ├── storage.ts
|
|
@@ -457,9 +407,6 @@ pnpm install
|
|
|
457
407
|
# 启动开发服务器(带 playground 预览)
|
|
458
408
|
pnpm dev
|
|
459
409
|
|
|
460
|
-
# 运行测试
|
|
461
|
-
pnpm test
|
|
462
|
-
|
|
463
410
|
# 构建库
|
|
464
411
|
pnpm build
|
|
465
412
|
|
|
@@ -473,18 +420,15 @@ pnpm release:patch # 或 minor、major
|
|
|
473
420
|
|
|
474
421
|
**快速发布**:
|
|
475
422
|
```bash
|
|
476
|
-
# 1.
|
|
477
|
-
pnpm test:run
|
|
478
|
-
|
|
479
|
-
# 2. 构建
|
|
423
|
+
# 1. 构建
|
|
480
424
|
pnpm build
|
|
481
425
|
|
|
482
|
-
#
|
|
426
|
+
# 2. 发布(自动更新版本号)
|
|
483
427
|
pnpm release:patch # Bug 修复 (0.0.1 -> 0.0.2)
|
|
484
428
|
pnpm release:minor # 新功能 (0.0.2 -> 0.1.0)
|
|
485
429
|
pnpm release:major # 破坏性变更 (0.1.0 -> 1.0.0)
|
|
486
430
|
|
|
487
|
-
#
|
|
431
|
+
# 3. 推送 tag
|
|
488
432
|
git push origin main --tags
|
|
489
433
|
```
|
|
490
434
|
|
|
@@ -492,7 +436,6 @@ git push origin main --tags
|
|
|
492
436
|
|
|
493
437
|
- `src/` - 库源代码
|
|
494
438
|
- `playground/` - 开发预览应用
|
|
495
|
-
- `test/` - 测试文件
|
|
496
439
|
- `dist/` - 构建输出
|
|
497
440
|
|
|
498
441
|
## License
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as ne, ref as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as ne, ref as U, shallowRef as me, watch as ae, onMounted as oe, nextTick as de, onUnmounted as he, openBlock as $, createElementBlock as F, normalizeStyle as V, computed as M, reactive as ee, onBeforeUnmount as we, normalizeClass as ie, createElementVNode as I, renderSlot as te, withModifiers as J, createCommentVNode as le, defineAsyncComponent as ge, resolveComponent as Q, createVNode as j, withCtx as Y, unref as ve, mergeProps as ye, createSlots as Se, renderList as xe, normalizeProps as be, guardReactiveProps as Ee, createTextVNode as ce } from "vue";
|
|
2
|
+
import { useRoute as _e } from "vue-router";
|
|
3
|
+
const Te = /* @__PURE__ */ ne({
|
|
4
4
|
__name: "Echarts",
|
|
5
5
|
props: {
|
|
6
6
|
options: {},
|
|
@@ -10,7 +10,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
10
10
|
},
|
|
11
11
|
emits: ["click"],
|
|
12
12
|
setup(n, { expose: o, emit: t }) {
|
|
13
|
-
const e = n, a = t, r =
|
|
13
|
+
const e = n, a = t, r = U(null), s = me(null);
|
|
14
14
|
let l = null;
|
|
15
15
|
const f = () => {
|
|
16
16
|
r.value && l && (s.value = l.init(r.value, e.theme || void 0), s.value.setOption(e.options), s.value.on("click", (b) => {
|
|
@@ -42,13 +42,13 @@ const Le = /* @__PURE__ */ ne({
|
|
|
42
42
|
chartInstance: s,
|
|
43
43
|
resize: d,
|
|
44
44
|
setOption: S
|
|
45
|
-
}), (b, E) => (
|
|
45
|
+
}), (b, E) => ($(), F("div", {
|
|
46
46
|
ref_key: "chartRef",
|
|
47
47
|
ref: r,
|
|
48
48
|
style: V({ width: e.width, height: e.height })
|
|
49
49
|
}, null, 4));
|
|
50
50
|
}
|
|
51
|
-
}),
|
|
51
|
+
}), Le = 4, Ce = 0.1, ze = /* @__PURE__ */ ne({
|
|
52
52
|
__name: "ScrollContainer",
|
|
53
53
|
props: {
|
|
54
54
|
height: { default: "100%" },
|
|
@@ -58,7 +58,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
58
58
|
viewClass: { default: "" }
|
|
59
59
|
},
|
|
60
60
|
setup(n, { expose: o }) {
|
|
61
|
-
const t = n, e =
|
|
61
|
+
const t = n, e = U(null), a = U(null);
|
|
62
62
|
let r = null;
|
|
63
63
|
const s = M(() => {
|
|
64
64
|
const i = {};
|
|
@@ -68,7 +68,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
68
68
|
moveY: 0,
|
|
69
69
|
sizeX: 0,
|
|
70
70
|
moveX: 0
|
|
71
|
-
}), f = (i, u, p) => Math.min(p, Math.max(u, i)), d = (i) => Math.max(i -
|
|
71
|
+
}), f = (i, u, p) => Math.min(p, Math.max(u, i)), d = (i) => Math.max(i - Le, 0), S = (i, u, p) => {
|
|
72
72
|
if (u <= 0 || i <= 0 || u <= i || p <= 0)
|
|
73
73
|
return 0;
|
|
74
74
|
const m = p * i / u, h = p * Ce;
|
|
@@ -82,25 +82,25 @@ const Le = /* @__PURE__ */ ne({
|
|
|
82
82
|
const u = i.clientHeight, p = i.scrollHeight, m = i.clientWidth, h = i.scrollWidth;
|
|
83
83
|
if (t.direction === "y" || t.direction === "both")
|
|
84
84
|
if (p > 0 && u > 0 && u < p) {
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
l.sizeY =
|
|
85
|
+
const _ = d(u), T = S(u, p, _);
|
|
86
|
+
if (T > 0) {
|
|
87
|
+
const L = p - u, C = Math.max(_ - T, 0), G = L > 0 ? i.scrollTop / L * C : 0;
|
|
88
|
+
l.sizeY = T, l.moveY = f(G, 0, C);
|
|
89
89
|
} else
|
|
90
90
|
l.sizeY = 0, l.moveY = 0;
|
|
91
91
|
} else
|
|
92
92
|
l.sizeY = 0, l.moveY = 0;
|
|
93
93
|
if (t.direction === "x" || t.direction === "both")
|
|
94
94
|
if (h > 0 && m > 0 && m < h) {
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
98
|
-
l.sizeX =
|
|
95
|
+
const _ = d(m), T = S(m, h, _);
|
|
96
|
+
if (T > 0) {
|
|
97
|
+
const L = h - m, C = Math.max(_ - T, 0), G = L > 0 ? i.scrollLeft / L * C : 0;
|
|
98
|
+
l.sizeX = T, l.moveX = f(G, 0, C);
|
|
99
99
|
} else
|
|
100
100
|
l.sizeX = 0, l.moveX = 0;
|
|
101
101
|
} else
|
|
102
102
|
l.sizeX = 0, l.moveX = 0;
|
|
103
|
-
},
|
|
103
|
+
}, k = () => {
|
|
104
104
|
E();
|
|
105
105
|
}, O = (i, u) => {
|
|
106
106
|
const p = e.value;
|
|
@@ -111,7 +111,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
111
111
|
}
|
|
112
112
|
p.scrollLeft += i.deltaX || i.deltaY;
|
|
113
113
|
}
|
|
114
|
-
},
|
|
114
|
+
}, w = ee({
|
|
115
115
|
dragging: !1,
|
|
116
116
|
axis: null,
|
|
117
117
|
startX: 0,
|
|
@@ -119,50 +119,50 @@ const Le = /* @__PURE__ */ ne({
|
|
|
119
119
|
startScrollTop: 0,
|
|
120
120
|
startScrollLeft: 0
|
|
121
121
|
});
|
|
122
|
-
let
|
|
123
|
-
const
|
|
122
|
+
let R = null, H = null;
|
|
123
|
+
const D = (i) => {
|
|
124
124
|
i.preventDefault();
|
|
125
125
|
}, re = () => {
|
|
126
126
|
const i = document.body;
|
|
127
|
-
|
|
127
|
+
R = i.style.userSelect, H = i.style.cursor, i.style.userSelect = "none", i.style.cursor = "default", document.addEventListener("selectstart", D), document.addEventListener("dragstart", D);
|
|
128
128
|
}, K = () => {
|
|
129
|
-
document.removeEventListener("selectstart",
|
|
129
|
+
document.removeEventListener("selectstart", D), document.removeEventListener("dragstart", D);
|
|
130
130
|
const i = document.body;
|
|
131
|
-
|
|
131
|
+
R !== null && (i.style.userSelect = R), H !== null && (i.style.cursor = H), R = null, H = null;
|
|
132
132
|
}, P = (i) => {
|
|
133
|
-
if (!
|
|
133
|
+
if (!w.dragging) return;
|
|
134
134
|
i.preventDefault();
|
|
135
135
|
const u = e.value;
|
|
136
136
|
if (u) {
|
|
137
|
-
if (
|
|
138
|
-
const p = i.clientY -
|
|
137
|
+
if (w.axis === "y") {
|
|
138
|
+
const p = i.clientY - w.startY, m = u.clientHeight, h = u.scrollHeight;
|
|
139
139
|
if (h <= m || m === 0) return;
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
140
|
+
const _ = d(m), T = S(m, h, _), L = b(m, h, _, T);
|
|
141
|
+
if (L === null) return;
|
|
142
142
|
const C = h - m;
|
|
143
|
-
u.scrollTop = f(
|
|
144
|
-
} else if (
|
|
145
|
-
const p = i.clientX -
|
|
143
|
+
u.scrollTop = f(w.startScrollTop + p * L, 0, C);
|
|
144
|
+
} else if (w.axis === "x") {
|
|
145
|
+
const p = i.clientX - w.startX, m = u.clientWidth, h = u.scrollWidth;
|
|
146
146
|
if (h <= m || m === 0) return;
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
147
|
+
const _ = d(m), T = S(m, h, _), L = b(m, h, _, T);
|
|
148
|
+
if (L === null) return;
|
|
149
149
|
const C = h - m;
|
|
150
|
-
u.scrollLeft = f(
|
|
150
|
+
u.scrollLeft = f(w.startScrollLeft + p * L, 0, C);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}, A = () => {
|
|
154
|
-
|
|
154
|
+
w.dragging = !1, w.axis = null, document.removeEventListener("mousemove", P), document.removeEventListener("mouseup", A), K();
|
|
155
155
|
}, W = (i, u) => {
|
|
156
156
|
i.stopPropagation(), i.preventDefault(), E();
|
|
157
157
|
const p = e.value;
|
|
158
|
-
p && (
|
|
158
|
+
p && (w.dragging = !0, w.axis = u, w.startX = i.clientX, w.startY = i.clientY, w.startScrollTop = p.scrollTop, w.startScrollLeft = p.scrollLeft, re(), document.addEventListener("mousemove", P), document.addEventListener("mouseup", A));
|
|
159
159
|
}, c = (i) => {
|
|
160
160
|
W(i, "y");
|
|
161
161
|
}, v = (i) => {
|
|
162
162
|
W(i, "x");
|
|
163
163
|
}, x = M(
|
|
164
164
|
() => (t.direction === "y" || t.direction === "both") && l.sizeY > 0
|
|
165
|
-
),
|
|
165
|
+
), g = M(
|
|
166
166
|
() => (t.direction === "x" || t.direction === "both") && l.sizeX > 0
|
|
167
167
|
), y = M(() => l.sizeY ? {
|
|
168
168
|
height: `${l.sizeY}px`,
|
|
@@ -185,14 +185,14 @@ const Le = /* @__PURE__ */ ne({
|
|
|
185
185
|
getScrollWrap: () => e.value
|
|
186
186
|
}), oe(() => {
|
|
187
187
|
const i = e.value;
|
|
188
|
-
i && i.addEventListener("scroll",
|
|
188
|
+
i && i.addEventListener("scroll", k, { passive: !0 }), typeof ResizeObserver < "u" && (r = new ResizeObserver(() => {
|
|
189
189
|
E();
|
|
190
190
|
}), e.value && r.observe(e.value), a.value && r.observe(a.value)), de(() => E()), window.addEventListener("resize", E);
|
|
191
|
-
}),
|
|
191
|
+
}), we(() => {
|
|
192
192
|
const i = e.value;
|
|
193
|
-
i && i.removeEventListener("scroll",
|
|
194
|
-
}), (i, u) => (
|
|
195
|
-
class: ie(["scroll-container", [{ "is-dragging":
|
|
193
|
+
i && i.removeEventListener("scroll", k), r && (r.disconnect(), r = null), window.removeEventListener("resize", E), A();
|
|
194
|
+
}), (i, u) => ($(), F("div", {
|
|
195
|
+
class: ie(["scroll-container", [{ "is-dragging": w.dragging }, t.wrapClass]])
|
|
196
196
|
}, [
|
|
197
197
|
I("div", {
|
|
198
198
|
ref_key: "wrapRef",
|
|
@@ -208,7 +208,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
208
208
|
te(i.$slots, "default", {}, void 0, !0)
|
|
209
209
|
], 2)
|
|
210
210
|
], 4),
|
|
211
|
-
x.value ? (
|
|
211
|
+
x.value ? ($(), F("div", {
|
|
212
212
|
key: 0,
|
|
213
213
|
class: "scrollbar scrollbar--vertical",
|
|
214
214
|
onMousedown: u[0] || (u[0] = J(() => {
|
|
@@ -221,7 +221,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
221
221
|
onMousedown: c
|
|
222
222
|
}, null, 36)
|
|
223
223
|
], 32)) : le("", !0),
|
|
224
|
-
|
|
224
|
+
g.value ? ($(), F("div", {
|
|
225
225
|
key: 1,
|
|
226
226
|
class: "scrollbar scrollbar--horizontal",
|
|
227
227
|
onMousedown: u[2] || (u[2] = J(() => {
|
|
@@ -260,10 +260,10 @@ const Le = /* @__PURE__ */ ne({
|
|
|
260
260
|
},
|
|
261
261
|
emits: ["update:pageNum", "update:pageSize", "change", "export-page", "export-all"],
|
|
262
262
|
setup(n, { expose: o, emit: t }) {
|
|
263
|
-
const e =
|
|
263
|
+
const e = U(null), a = ge({
|
|
264
264
|
loader: () => import("@surely-vue/table").then((c) => (c.setLicenseKey(He), c.STable)),
|
|
265
265
|
loadingComponent: void 0
|
|
266
|
-
}), r = n, s = t, l =
|
|
266
|
+
}), r = n, s = t, l = U([]), f = U(!1), d = ee({
|
|
267
267
|
current: r.pageNum,
|
|
268
268
|
pageSize: r.pageSize,
|
|
269
269
|
total: 0,
|
|
@@ -275,7 +275,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
275
275
|
if (!r.rowAutoHeight)
|
|
276
276
|
c = r.columns || [];
|
|
277
277
|
else {
|
|
278
|
-
const x = (
|
|
278
|
+
const x = (g) => (g || []).map((y) => {
|
|
279
279
|
const z = { ...y, autoHeight: !0 };
|
|
280
280
|
return Array.isArray(y.children) && y.children.length > 0 && (z.children = x(y.children)), z;
|
|
281
281
|
});
|
|
@@ -288,78 +288,78 @@ const Le = /* @__PURE__ */ ne({
|
|
|
288
288
|
align: "center",
|
|
289
289
|
width: 80
|
|
290
290
|
}, ...c] : c;
|
|
291
|
-
}),
|
|
291
|
+
}), k = async (c = {}, v = {}, x = {}) => {
|
|
292
292
|
f.value = !0;
|
|
293
|
-
const
|
|
293
|
+
const g = {
|
|
294
294
|
pageNo: c.current || d.current,
|
|
295
295
|
pageSize: c.pageSize || d.pageSize,
|
|
296
296
|
export: c.export || !1,
|
|
297
297
|
...v
|
|
298
298
|
};
|
|
299
|
-
x.field && (
|
|
299
|
+
x.field && (g.sortField = x.field, g.sortOrder = x.order);
|
|
300
300
|
try {
|
|
301
|
-
const y = await r.data(
|
|
301
|
+
const y = await r.data(g), z = y.data || y.rows || [], B = y.total || y.totalCount || 0, N = g.pageNo || 1, se = g.pageSize || d.pageSize || 10;
|
|
302
302
|
if (z.forEach((q, i) => {
|
|
303
303
|
q.__rowkey = `${N}-${i}`, q.__index = (N - 1) * se + i + 1;
|
|
304
304
|
}), c.export)
|
|
305
305
|
return y;
|
|
306
|
-
l.value = z, d.total = B, d.current =
|
|
306
|
+
l.value = z, d.total = B, d.current = g.pageNo, d.pageSize = g.pageSize;
|
|
307
307
|
} catch (y) {
|
|
308
308
|
console.error("Table load data error:", y), l.value = [], d.total = 0;
|
|
309
309
|
} finally {
|
|
310
310
|
f.value = !1;
|
|
311
311
|
}
|
|
312
|
-
}, O = (c, v, x, ...
|
|
313
|
-
d.current = c.current, d.pageSize = c.pageSize, s("update:pageNum", c.current), s("update:pageSize", c.pageSize), s("change", c, v, x, ...
|
|
314
|
-
},
|
|
312
|
+
}, O = (c, v, x, ...g) => {
|
|
313
|
+
d.current = c.current, d.pageSize = c.pageSize, s("update:pageNum", c.current), s("update:pageSize", c.pageSize), s("change", c, v, x, ...g), k(c, v, x);
|
|
314
|
+
}, w = (c) => {
|
|
315
315
|
const v = l.value;
|
|
316
316
|
if (!v.length)
|
|
317
317
|
return [];
|
|
318
318
|
if (!S.value || v && v.length <= d.pageSize)
|
|
319
319
|
return l.value;
|
|
320
|
-
const
|
|
321
|
-
return v.slice(
|
|
322
|
-
},
|
|
323
|
-
let
|
|
320
|
+
const g = ((c || d.current) - 1) * d.pageSize;
|
|
321
|
+
return v.slice(g, g + d.pageSize);
|
|
322
|
+
}, R = () => l.value;
|
|
323
|
+
let H = () => {
|
|
324
324
|
};
|
|
325
|
-
const
|
|
326
|
-
e.value = c,
|
|
325
|
+
const D = (c) => {
|
|
326
|
+
e.value = c, H();
|
|
327
327
|
}, K = new Promise((c) => {
|
|
328
|
-
|
|
328
|
+
H = c;
|
|
329
329
|
}), P = async () => (await K, e.value?.$el), A = ({ key: c }) => {
|
|
330
330
|
c === "page" && s("export-page"), c === "all" && s("export-all");
|
|
331
331
|
}, W = (c = !1) => {
|
|
332
|
-
c && (d.current = 1),
|
|
332
|
+
c && (d.current = 1), k();
|
|
333
333
|
};
|
|
334
334
|
return oe(() => {
|
|
335
|
-
|
|
335
|
+
k();
|
|
336
336
|
}), o({
|
|
337
337
|
get _columns() {
|
|
338
338
|
return E.value;
|
|
339
339
|
},
|
|
340
340
|
getEl: P,
|
|
341
|
-
getData:
|
|
342
|
-
getPageData:
|
|
341
|
+
getData: R,
|
|
342
|
+
getPageData: w,
|
|
343
343
|
refresh: W,
|
|
344
|
-
loadData:
|
|
344
|
+
loadData: k
|
|
345
345
|
}), (c, v) => {
|
|
346
|
-
const x = Q("a-menu-item"),
|
|
347
|
-
return
|
|
346
|
+
const x = Q("a-menu-item"), g = Q("a-menu"), y = Q("a-dropdown");
|
|
347
|
+
return $(), F("div", ke, [
|
|
348
348
|
j(y, {
|
|
349
349
|
trigger: r.enableContextExport ? ["contextmenu"] : []
|
|
350
350
|
}, {
|
|
351
|
-
overlay:
|
|
351
|
+
overlay: Y(() => [
|
|
352
352
|
te(c.$slots, "contextmenuOverlay", {}, () => [
|
|
353
|
-
j(
|
|
354
|
-
default:
|
|
353
|
+
j(g, { onClick: A }, {
|
|
354
|
+
default: Y(() => [
|
|
355
355
|
j(x, { key: "page" }, {
|
|
356
|
-
default:
|
|
356
|
+
default: Y(() => [...v[0] || (v[0] = [
|
|
357
357
|
ce("导出本页", -1)
|
|
358
358
|
])]),
|
|
359
359
|
_: 1
|
|
360
360
|
}),
|
|
361
361
|
j(x, { key: "all" }, {
|
|
362
|
-
default:
|
|
362
|
+
default: Y(() => [...v[1] || (v[1] = [
|
|
363
363
|
ce("导出全部", -1)
|
|
364
364
|
])]),
|
|
365
365
|
_: 1
|
|
@@ -369,8 +369,8 @@ const Le = /* @__PURE__ */ ne({
|
|
|
369
369
|
})
|
|
370
370
|
], !0)
|
|
371
371
|
]),
|
|
372
|
-
default:
|
|
373
|
-
j(ve(a), ye({ ref:
|
|
372
|
+
default: Y(() => [
|
|
373
|
+
j(ve(a), ye({ ref: D }, c.$attrs, {
|
|
374
374
|
"range-selection": !1,
|
|
375
375
|
columns: E.value,
|
|
376
376
|
"data-source": l.value,
|
|
@@ -381,7 +381,7 @@ const Le = /* @__PURE__ */ ne({
|
|
|
381
381
|
}), Se({ _: 2 }, [
|
|
382
382
|
xe(c.$slots, (z, B) => ({
|
|
383
383
|
name: B,
|
|
384
|
-
fn:
|
|
384
|
+
fn: Y((N) => [
|
|
385
385
|
te(c.$slots, B, be(Ee(N || {})), void 0, !0)
|
|
386
386
|
])
|
|
387
387
|
}))
|
|
@@ -393,46 +393,11 @@ const Le = /* @__PURE__ */ ne({
|
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
395
|
}), Re = /* @__PURE__ */ fe(Xe, [["__scopeId", "data-v-db83a2fc"]]);
|
|
396
|
-
function
|
|
397
|
-
const o = k(n), t = () => {
|
|
398
|
-
o.value = !0;
|
|
399
|
-
}, e = () => {
|
|
400
|
-
o.value = !1;
|
|
401
|
-
};
|
|
402
|
-
return {
|
|
403
|
-
loading: o,
|
|
404
|
-
startLoading: t,
|
|
405
|
-
stopLoading: e,
|
|
406
|
-
withLoading: async (r) => {
|
|
407
|
-
t();
|
|
408
|
-
try {
|
|
409
|
-
return await r();
|
|
410
|
-
} finally {
|
|
411
|
-
e();
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
function Oe(n = !1) {
|
|
417
|
-
const o = k(n);
|
|
418
|
-
return {
|
|
419
|
-
value: o,
|
|
420
|
-
toggle: () => {
|
|
421
|
-
o.value = !o.value;
|
|
422
|
-
},
|
|
423
|
-
setTrue: () => {
|
|
424
|
-
o.value = !0;
|
|
425
|
-
},
|
|
426
|
-
setFalse: () => {
|
|
427
|
-
o.value = !1;
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
function Pe(n, o = "YYYY-MM-DD HH:mm:ss") {
|
|
396
|
+
function Fe(n, o = "YYYY-MM-DD HH:mm:ss") {
|
|
432
397
|
const t = new Date(n), e = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0"), s = String(t.getHours()).padStart(2, "0"), l = String(t.getMinutes()).padStart(2, "0"), f = String(t.getSeconds()).padStart(2, "0");
|
|
433
398
|
return o.replace("YYYY", String(e)).replace("MM", a).replace("DD", r).replace("HH", s).replace("mm", l).replace("ss", f);
|
|
434
399
|
}
|
|
435
|
-
function
|
|
400
|
+
function Oe(n, o) {
|
|
436
401
|
const t = {
|
|
437
402
|
"Y+": o.getFullYear().toString(),
|
|
438
403
|
"m+": (o.getMonth() + 1).toString(),
|
|
@@ -453,13 +418,13 @@ function We(n, o) {
|
|
|
453
418
|
}
|
|
454
419
|
return n;
|
|
455
420
|
}
|
|
456
|
-
function
|
|
421
|
+
function Pe(n, o = 2) {
|
|
457
422
|
return n.toLocaleString("en-US", {
|
|
458
423
|
minimumFractionDigits: o,
|
|
459
424
|
maximumFractionDigits: o
|
|
460
425
|
});
|
|
461
426
|
}
|
|
462
|
-
function
|
|
427
|
+
function We(n) {
|
|
463
428
|
if (n === 0) return "0 B";
|
|
464
429
|
const o = ["B", "KB", "MB", "GB", "TB"], t = 1024, e = Math.floor(Math.log(n) / Math.log(t));
|
|
465
430
|
return `${parseFloat((n / Math.pow(t, e)).toFixed(2))} ${o[e]}`;
|
|
@@ -492,8 +457,8 @@ function De(n = "local", o = {}) {
|
|
|
492
457
|
}
|
|
493
458
|
};
|
|
494
459
|
}
|
|
495
|
-
const
|
|
496
|
-
async function
|
|
460
|
+
const Ie = De("local"), Z = /* @__PURE__ */ new Map();
|
|
461
|
+
async function X(n, o = "script", t = null) {
|
|
497
462
|
/^\.?\/sdk/.test(n) && window._sdkBaseUrl && (n = n.replace(/^\.?\/?/, ""), n = window._sdkBaseUrl.replace(/\/$/, "") + "/" + n);
|
|
498
463
|
const e = window.urlRandom || "";
|
|
499
464
|
e && (n.includes("?") ? n += "&urlRandom=" + e : n += "?urlRandom=" + e);
|
|
@@ -509,10 +474,10 @@ async function R(n, o = "script", t = null) {
|
|
|
509
474
|
});
|
|
510
475
|
return Z.set(a, s), s;
|
|
511
476
|
}
|
|
512
|
-
function
|
|
477
|
+
function Je(n) {
|
|
513
478
|
document.querySelector("#" + n)?.scrollIntoView();
|
|
514
479
|
}
|
|
515
|
-
function
|
|
480
|
+
function Ve(n) {
|
|
516
481
|
let o = window.top?.window.document.querySelector("head title") || window.document.querySelector("head title");
|
|
517
482
|
if (o)
|
|
518
483
|
o.textContent = n || o.textContent;
|
|
@@ -523,7 +488,7 @@ function qe(n) {
|
|
|
523
488
|
e && e.appendChild(t);
|
|
524
489
|
}
|
|
525
490
|
}
|
|
526
|
-
function
|
|
491
|
+
function Ke(n, o = {}) {
|
|
527
492
|
return new Promise((t, e) => {
|
|
528
493
|
typeof n == "string" && (n = document.querySelector(n));
|
|
529
494
|
const a = (o.hideEles || []).concat(["#app"]).map((s) => s instanceof HTMLElement ? s : typeof s == "string" ? document.querySelector(s) : null).filter((s) => !!s), r = a.map((s) => s.style.display);
|
|
@@ -540,16 +505,16 @@ function Ge(n, o = {}) {
|
|
|
540
505
|
e("未找到需要打印的元素");
|
|
541
506
|
});
|
|
542
507
|
}
|
|
543
|
-
function
|
|
508
|
+
function qe() {
|
|
544
509
|
const n = new URLSearchParams(window.location.search), o = Object.fromEntries(n.entries());
|
|
545
510
|
try {
|
|
546
|
-
const t =
|
|
511
|
+
const t = _e();
|
|
547
512
|
return Object.assign(o, t.query);
|
|
548
513
|
} catch {
|
|
549
514
|
return o;
|
|
550
515
|
}
|
|
551
516
|
}
|
|
552
|
-
function
|
|
517
|
+
function Ge(n, o = !1, t = !0) {
|
|
553
518
|
const e = new URL(window.location.href);
|
|
554
519
|
if (o) {
|
|
555
520
|
let a = e.hash.substring(1);
|
|
@@ -567,15 +532,15 @@ function Ze(n, o = !1, t = !0) {
|
|
|
567
532
|
}
|
|
568
533
|
t ? window.history.replaceState(null, "", e) : window.history.pushState(null, "", e);
|
|
569
534
|
}
|
|
570
|
-
function
|
|
535
|
+
function Qe(n, o) {
|
|
571
536
|
return ~~(Math.pow(10, o) * n) / Math.pow(10, o);
|
|
572
537
|
}
|
|
573
|
-
function
|
|
538
|
+
function Ze(n, o) {
|
|
574
539
|
const t = +`${n}e${o}`;
|
|
575
540
|
return +(Math.round(t) + "e-" + o);
|
|
576
541
|
}
|
|
577
542
|
const ue = /* @__PURE__ */ new Map();
|
|
578
|
-
function
|
|
543
|
+
function et(n, o = 600) {
|
|
579
544
|
return new Promise((t) => {
|
|
580
545
|
const e = ue.get(n);
|
|
581
546
|
e && clearTimeout(e);
|
|
@@ -585,7 +550,7 @@ function nt(n, o = 600) {
|
|
|
585
550
|
ue.set(n, a);
|
|
586
551
|
});
|
|
587
552
|
}
|
|
588
|
-
function
|
|
553
|
+
function tt(n, o = 30) {
|
|
589
554
|
let t = !0, e = null;
|
|
590
555
|
return function(...a) {
|
|
591
556
|
if (t) {
|
|
@@ -597,7 +562,7 @@ function ot(n, o = 30) {
|
|
|
597
562
|
}, o));
|
|
598
563
|
};
|
|
599
564
|
}
|
|
600
|
-
function
|
|
565
|
+
function nt(n, o = 300) {
|
|
601
566
|
let t = null;
|
|
602
567
|
return function(...e) {
|
|
603
568
|
t && clearTimeout(t), t = setTimeout(() => {
|
|
@@ -605,23 +570,23 @@ function rt(n, o = 300) {
|
|
|
605
570
|
}, o);
|
|
606
571
|
};
|
|
607
572
|
}
|
|
608
|
-
async function
|
|
609
|
-
window.JSEncrypt || await
|
|
573
|
+
async function ot(n, o) {
|
|
574
|
+
window.JSEncrypt || await X("./assets/jsencrypt/jsencrypt.min.js", "script");
|
|
610
575
|
const t = new window.JSEncrypt();
|
|
611
576
|
return t.setPublicKey(o), t.encrypt(n);
|
|
612
577
|
}
|
|
613
|
-
async function
|
|
614
|
-
return window.CryptoJS || await
|
|
578
|
+
async function rt(n, o) {
|
|
579
|
+
return window.CryptoJS || await X("./assets/crypto-js/crypto-js.min.js", "script"), window.CryptoJS.AES.encrypt(n, o).toString();
|
|
615
580
|
}
|
|
616
|
-
async function
|
|
617
|
-
window.CryptoJS || await
|
|
581
|
+
async function st(n, o) {
|
|
582
|
+
window.CryptoJS || await X("./assets/crypto-js/crypto-js.min.js", "script");
|
|
618
583
|
try {
|
|
619
584
|
return window.CryptoJS.AES.decrypt(n, o).toString(window.CryptoJS.enc.Utf8);
|
|
620
585
|
} catch {
|
|
621
586
|
return "";
|
|
622
587
|
}
|
|
623
588
|
}
|
|
624
|
-
function
|
|
589
|
+
function at(n) {
|
|
625
590
|
const o = document;
|
|
626
591
|
let t, e;
|
|
627
592
|
if (typeof o.hidden < "u")
|
|
@@ -653,7 +618,7 @@ function Ye(n) {
|
|
|
653
618
|
data: a
|
|
654
619
|
};
|
|
655
620
|
}
|
|
656
|
-
function
|
|
621
|
+
function it(n) {
|
|
657
622
|
const { colKey: o, data: t } = Ye(n.data);
|
|
658
623
|
return {
|
|
659
624
|
colKey: o,
|
|
@@ -695,8 +660,8 @@ async function Be(n, o, t) {
|
|
|
695
660
|
const e = document.createElement("a");
|
|
696
661
|
e.href = n, e.download = o || "", e.dispatchEvent(new MouseEvent("click"));
|
|
697
662
|
}
|
|
698
|
-
async function
|
|
699
|
-
window.XLSX || await
|
|
663
|
+
async function lt(n, o, t, e = !1, a) {
|
|
664
|
+
window.XLSX || await X("./assets/xlsx/xlsx.full.min.js", "script"), a && !window.XlsxPopulate && await X("./assets/xlsx-populate/xlsx-populate.min.js", "script");
|
|
700
665
|
const r = [...o];
|
|
701
666
|
r.unshift(n);
|
|
702
667
|
const s = "Sheet", l = {
|
|
@@ -723,22 +688,22 @@ function pe(n) {
|
|
|
723
688
|
}, e.onerror = t, e.readAsArrayBuffer(n);
|
|
724
689
|
});
|
|
725
690
|
}
|
|
726
|
-
async function
|
|
727
|
-
window.XLSX || await
|
|
691
|
+
async function ct(n) {
|
|
692
|
+
window.XLSX || await X("./assets/xlsx/xlsx.full.min.js", "script");
|
|
728
693
|
const o = await pe(n), t = new Uint8Array(o), e = window.XLSX.read(t, { type: "buffer" }), a = e.SheetNames[0];
|
|
729
694
|
if (!a) return [];
|
|
730
695
|
const r = e.Sheets[a];
|
|
731
696
|
return r ? window.XLSX.utils.sheet_to_json(r) : [];
|
|
732
697
|
}
|
|
733
|
-
async function
|
|
734
|
-
window.XLSX || await
|
|
698
|
+
async function ut(n) {
|
|
699
|
+
window.XLSX || await X("./assets/xlsx/xlsx.full.min.js", "script");
|
|
735
700
|
const o = await pe(n), t = new Uint8Array(o), e = window.XLSX.read(t, { type: "buffer" }), a = {};
|
|
736
701
|
return e.SheetNames.forEach((r) => {
|
|
737
702
|
const s = e.Sheets[r];
|
|
738
703
|
s && (a[r] = window.XLSX.utils.sheet_to_json(s));
|
|
739
704
|
}), a;
|
|
740
705
|
}
|
|
741
|
-
const Ne = [
|
|
706
|
+
const Ne = [Te, Me, Re], dt = {
|
|
742
707
|
install(n) {
|
|
743
708
|
Ne.forEach((o) => {
|
|
744
709
|
n.component(o.name ?? o.__name ?? "UnnamedComponent", o);
|
|
@@ -746,40 +711,38 @@ const Ne = [Le, Me, Re], pt = {
|
|
|
746
711
|
}
|
|
747
712
|
};
|
|
748
713
|
export {
|
|
749
|
-
|
|
714
|
+
Te as Echarts,
|
|
750
715
|
Re as STable,
|
|
751
716
|
Me as ScrollContainer,
|
|
752
|
-
|
|
717
|
+
nt as createDebounce,
|
|
753
718
|
De as createStorage,
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
719
|
+
Oe as dateFormat,
|
|
720
|
+
et as debounce,
|
|
721
|
+
dt as default,
|
|
722
|
+
st as disuseAes,
|
|
723
|
+
lt as exportJsonToExcel,
|
|
724
|
+
Fe as formatDate,
|
|
725
|
+
We as formatFileSize,
|
|
726
|
+
Pe as formatNumber,
|
|
727
|
+
ct as importExcel,
|
|
728
|
+
ut as importExcelAll,
|
|
729
|
+
X as loadRemote,
|
|
730
|
+
at as onVisibilityChange,
|
|
766
731
|
Be as openDownloadDialog,
|
|
767
|
-
|
|
768
|
-
|
|
732
|
+
it as pageRowSet,
|
|
733
|
+
Ke as print,
|
|
769
734
|
pe as readFileAsync,
|
|
770
|
-
|
|
735
|
+
Ze as round,
|
|
771
736
|
Ye as rowSet,
|
|
772
737
|
Ae as s2ab,
|
|
773
|
-
|
|
774
|
-
|
|
738
|
+
Je as scrollView,
|
|
739
|
+
Ve as setHtmlTitle,
|
|
775
740
|
Ue as sheetFromArrayOfArrays,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
Oe as useToggle,
|
|
784
|
-
Qe as useUrlParams
|
|
741
|
+
Ie as storage,
|
|
742
|
+
tt as throttle,
|
|
743
|
+
Qe as toFixed,
|
|
744
|
+
Ge as updateUrlParams,
|
|
745
|
+
rt as useAes,
|
|
746
|
+
ot as useRsa,
|
|
747
|
+
qe as useUrlParams
|
|
785
748
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],s):(u=typeof globalThis<"u"?globalThis:u||self,s(u.YourOrgCore={},u.Vue,u.VueRouter))})(this,(function(u,s,se){"use strict";const I=s.defineComponent({__name:"Echarts",props:{options:{},width:{default:"100%"},height:{default:"300px"},theme:{default:""}},emits:["click"],setup(n,{expose:o,emit:t}){const e=n,i=t,r=s.ref(null),a=s.shallowRef(null);let c=null;const m=()=>{r.value&&c&&(a.value=c.init(r.value,e.theme||void 0),a.value.setOption(e.options),a.value.on("click",T=>{i("click",T)}))},p=()=>{a.value?.resize()},x=T=>{a.value?.setOption(T)};return s.watch(()=>e.options,T=>{a.value?.setOption(T)},{deep:!0}),s.watch(()=>e.theme,()=>{a.value&&(a.value.dispose(),m())}),s.onMounted(async()=>{c=await import("echarts"),s.nextTick(()=>{m(),window.addEventListener("resize",p)})}),s.onUnmounted(()=>{a.value&&(a.value.dispose(),a.value=null),window.removeEventListener("resize",p)}),o({chartInstance:a,resize:p,setOption:x}),(T,C)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"chartRef",ref:r,style:s.normalizeStyle({width:e.width,height:e.height})},null,4))}}),ae=4,ie=.1,le=s.defineComponent({__name:"ScrollContainer",props:{height:{default:"100%"},maxHeight:{default:void 0},direction:{default:"y"},wrapClass:{default:""},viewClass:{default:""}},setup(n,{expose:o}){const t=n,e=s.ref(null),i=s.ref(null);let r=null;const a=s.computed(()=>{const l={};return t.height!==null&&t.height!==void 0&&(l.height=typeof t.height=="number"?`${t.height}px`:t.height),t.maxHeight!==null&&t.maxHeight!==void 0&&(l.maxHeight=typeof t.maxHeight=="number"?`${t.maxHeight}px`:t.maxHeight),l}),c=s.reactive({sizeY:0,moveY:0,sizeX:0,moveX:0}),m=(l,f,h)=>Math.min(h,Math.max(f,l)),p=l=>Math.max(l-ae,0),x=(l,f,h)=>{if(f<=0||l<=0||f<=l||h<=0)return 0;const g=h*l/f,w=h*ie;return Math.max(g,w)},T=(l,f,h,g)=>{const w=h-g;return w<=0?null:(f-l)/w},C=()=>{const l=e.value;if(!l)return;const f=l.clientHeight,h=l.scrollHeight,g=l.clientWidth,w=l.scrollWidth;if(t.direction==="y"||t.direction==="both")if(h>0&&f>0&&f<h){const _=p(f),L=x(f,h,_);if(L>0){const z=h-f,M=Math.max(_-L,0),W=z>0?l.scrollTop/z*M:0;c.sizeY=L,c.moveY=m(W,0,M)}else c.sizeY=0,c.moveY=0}else c.sizeY=0,c.moveY=0;if(t.direction==="x"||t.direction==="both")if(w>0&&g>0&&g<w){const _=p(g),L=x(g,w,_);if(L>0){const z=w-g,M=Math.max(_-L,0),W=z>0?l.scrollLeft/z*M:0;c.sizeX=L,c.moveX=m(W,0,M)}else c.sizeX=0,c.moveX=0}else c.sizeX=0,c.moveX=0},H=()=>{C()},U=(l,f)=>{const h=e.value;if(h){if(f==="y"){h.scrollTop+=l.deltaY;return}h.scrollLeft+=l.deltaX||l.deltaY}},y=s.reactive({dragging:!1,axis:null,startX:0,startY:0,startScrollTop:0,startScrollLeft:0});let D=null,X=null;const N=l=>{l.preventDefault()},oe=()=>{const l=document.body;D=l.style.userSelect,X=l.style.cursor,l.style.userSelect="none",l.style.cursor="default",document.addEventListener("selectstart",N),document.addEventListener("dragstart",N)},$=()=>{document.removeEventListener("selectstart",N),document.removeEventListener("dragstart",N);const l=document.body;D!==null&&(l.style.userSelect=D),X!==null&&(l.style.cursor=X),D=null,X=null},F=l=>{if(!y.dragging)return;l.preventDefault();const f=e.value;if(f){if(y.axis==="y"){const h=l.clientY-y.startY,g=f.clientHeight,w=f.scrollHeight;if(w<=g||g===0)return;const _=p(g),L=x(g,w,_),z=T(g,w,_,L);if(z===null)return;const M=w-g;f.scrollTop=m(y.startScrollTop+h*z,0,M)}else if(y.axis==="x"){const h=l.clientX-y.startX,g=f.clientWidth,w=f.scrollWidth;if(w<=g||g===0)return;const _=p(g),L=x(g,w,_),z=T(g,w,_,L);if(z===null)return;const M=w-g;f.scrollLeft=m(y.startScrollLeft+h*z,0,M)}}},B=()=>{y.dragging=!1,y.axis=null,document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",B),$()},j=(l,f)=>{l.stopPropagation(),l.preventDefault(),C();const h=e.value;h&&(y.dragging=!0,y.axis=f,y.startX=l.clientX,y.startY=l.clientY,y.startScrollTop=h.scrollTop,y.startScrollLeft=h.scrollLeft,oe(),document.addEventListener("mousemove",F),document.addEventListener("mouseup",B))},d=l=>{j(l,"y")},b=l=>{j(l,"x")},E=s.computed(()=>(t.direction==="y"||t.direction==="both")&&c.sizeY>0),S=s.computed(()=>(t.direction==="x"||t.direction==="both")&&c.sizeX>0),v=s.computed(()=>c.sizeY?{height:`${c.sizeY}px`,transform:`translateY(${c.moveY}px)`}:{display:"none"}),R=s.computed(()=>c.sizeX?{width:`${c.sizeX}px`,transform:`translateX(${c.moveX}px)`}:{display:"none"});return o({update:C,scrollTo:l=>{e.value?.scrollTo(l)},setScrollTop:l=>{e.value&&(e.value.scrollTop=l)},setScrollLeft:l=>{e.value&&(e.value.scrollLeft=l)},getScrollWrap:()=>e.value}),s.onMounted(()=>{const l=e.value;l&&l.addEventListener("scroll",H,{passive:!0}),typeof ResizeObserver<"u"&&(r=new ResizeObserver(()=>{C()}),e.value&&r.observe(e.value),i.value&&r.observe(i.value)),s.nextTick(()=>C()),window.addEventListener("resize",C)}),s.onBeforeUnmount(()=>{const l=e.value;l&&l.removeEventListener("scroll",H),r&&(r.disconnect(),r=null),window.removeEventListener("resize",C),B()}),(l,f)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["scroll-container",[{"is-dragging":y.dragging},t.wrapClass]])},[s.createElementVNode("div",{ref_key:"wrapRef",ref:e,class:"scroll-container__wrap",style:s.normalizeStyle(a.value)},[s.createElementVNode("div",{ref_key:"viewRef",ref:i,class:s.normalizeClass(["scroll-container__view",t.viewClass])},[s.renderSlot(l.$slots,"default",{},void 0,!0)],2)],4),E.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"scrollbar scrollbar--vertical",onMousedown:f[0]||(f[0]=s.withModifiers(()=>{},["stop","prevent"])),onWheel:f[1]||(f[1]=s.withModifiers(h=>U(h,"y"),["prevent"]))},[s.createElementVNode("div",{class:"scrollbar__thumb",style:s.normalizeStyle(v.value),onMousedown:d},null,36)],32)):s.createCommentVNode("",!0),S.value?(s.openBlock(),s.createElementBlock("div",{key:1,class:"scrollbar scrollbar--horizontal",onMousedown:f[2]||(f[2]=s.withModifiers(()=>{},["stop","prevent"])),onWheel:f[3]||(f[3]=s.withModifiers(h=>U(h,"x"),["prevent"]))},[s.createElementVNode("div",{class:"scrollbar__thumb",style:s.normalizeStyle(R.value),onMousedown:b},null,36)],32)):s.createCommentVNode("",!0)],2))}}),J=(n,o)=>{const t=n.__vccOpts||n;for(const[e,i]of o)t[e]=i;return t},q=J(le,[["__scopeId","data-v-53718297"]]),ce={class:"s-table"},ue="dc6971e24ccba02c71a375b9511b2a59T1JERVI6MTAwMDI5LEVYUElSWT0xNjk0MjE3NjAwMDAwLERPTUFJTj1zdXJlbHkuY29vbCxVTFRJTUFURT0xLEtFWVZFUlNJT049MQ==",K=J(s.defineComponent({name:"STable",inheritAttrs:!1,__name:"STable",props:{columns:{},data:{},pageNum:{default:1},pageSize:{default:10},showPagination:{type:[String,Boolean],default:"auto"},pageSizeOptions:{default:()=>["10","20","50","100"]},rowAutoHeight:{type:Boolean,default:!1},exportName:{default:""},showIndex:{type:Boolean,default:!1},enableContextExport:{type:Boolean,default:!0},rowKey:{type:[String,Function],default:"__rowkey"}},emits:["update:pageNum","update:pageSize","change","export-page","export-all"],setup(n,{expose:o,emit:t}){const e=s.ref(null),i=s.defineAsyncComponent({loader:()=>import("@surely-vue/table").then(d=>(d.setLicenseKey(ue),d.STable)),loadingComponent:void 0}),r=n,a=t,c=s.ref([]),m=s.ref(!1),p=s.reactive({current:r.pageNum,pageSize:r.pageSize,total:0,showSizeChanger:!0,pageSizeOptions:r.pageSizeOptions,showTotal:d=>`共 ${d} 条`}),x=s.computed(()=>r.showPagination==="auto"||r.showPagination===!0),T=s.computed(()=>x.value?p:!1),C=s.computed(()=>{let d;if(!r.rowAutoHeight)d=r.columns||[];else{const E=S=>(S||[]).map(v=>{const R={...v,autoHeight:!0};return Array.isArray(v.children)&&v.children.length>0&&(R.children=E(v.children)),R});d=E(r.columns)}return r.showIndex?[{title:"序号",dataIndex:"__index",key:"__index",align:"center",width:80},...d]:d}),H=async(d={},b={},E={})=>{m.value=!0;const S={pageNo:d.current||p.current,pageSize:d.pageSize||p.pageSize,export:d.export||!1,...b};E.field&&(S.sortField=E.field,S.sortOrder=E.order);try{const v=await r.data(S),R=v.data||v.rows||[],A=v.total||v.totalCount||0,Y=S.pageNo||1,re=S.pageSize||p.pageSize||10;if(R.forEach((V,l)=>{V.__rowkey=`${Y}-${l}`,V.__index=(Y-1)*re+l+1}),d.export)return v;c.value=R,p.total=A,p.current=S.pageNo,p.pageSize=S.pageSize}catch(v){console.error("Table load data error:",v),c.value=[],p.total=0}finally{m.value=!1}},U=(d,b,E,...S)=>{p.current=d.current,p.pageSize=d.pageSize,a("update:pageNum",d.current),a("update:pageSize",d.pageSize),a("change",d,b,E,...S),H(d,b,E)},y=d=>{const b=c.value;if(!b.length)return[];if(!x.value||b&&b.length<=p.pageSize)return c.value;const S=((d||p.current)-1)*p.pageSize;return b.slice(S,S+p.pageSize)},D=()=>c.value;let X=()=>{};const N=d=>{e.value=d,X()},$=new Promise(d=>{X=d}),F=async()=>(await $,e.value?.$el),B=({key:d})=>{d==="page"&&a("export-page"),d==="all"&&a("export-all")},j=(d=!1)=>{d&&(p.current=1),H()};return s.onMounted(()=>{H()}),o({get _columns(){return C.value},getEl:F,getData:D,getPageData:y,refresh:j,loadData:H}),(d,b)=>{const E=s.resolveComponent("a-menu-item"),S=s.resolveComponent("a-menu"),v=s.resolveComponent("a-dropdown");return s.openBlock(),s.createElementBlock("div",ce,[s.createVNode(v,{trigger:r.enableContextExport?["contextmenu"]:[]},{overlay:s.withCtx(()=>[s.renderSlot(d.$slots,"contextmenuOverlay",{},()=>[s.createVNode(S,{onClick:B},{default:s.withCtx(()=>[s.createVNode(E,{key:"page"},{default:s.withCtx(()=>[...b[0]||(b[0]=[s.createTextVNode("导出本页",-1)])]),_:1}),s.createVNode(E,{key:"all"},{default:s.withCtx(()=>[...b[1]||(b[1]=[s.createTextVNode("导出全部",-1)])]),_:1})]),_:1})],!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(i),s.mergeProps({ref:N},d.$attrs,{"range-selection":!1,columns:C.value,"data-source":c.value,pagination:T.value,loading:m.value,"row-key":n.rowKey,onChange:U}),s.createSlots({_:2},[s.renderList(d.$slots,(R,A)=>({name:A,fn:s.withCtx(Y=>[s.renderSlot(d.$slots,A,s.normalizeProps(s.guardReactiveProps(Y||{})),void 0,!0)])}))]),1040,["columns","data-source","pagination","loading","row-key"])]),_:3},8,["trigger"])])}}}),[["__scopeId","data-v-db83a2fc"]]);function de(n=!1){const o=s.ref(n),t=()=>{o.value=!0},e=()=>{o.value=!1};return{loading:o,startLoading:t,stopLoading:e,withLoading:async r=>{t();try{return await r()}finally{e()}}}}function fe(n=!1){const o=s.ref(n);return{value:o,toggle:()=>{o.value=!o.value},setTrue:()=>{o.value=!0},setFalse:()=>{o.value=!1}}}function pe(n,o="YYYY-MM-DD HH:mm:ss"){const t=new Date(n),e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),c=String(t.getMinutes()).padStart(2,"0"),m=String(t.getSeconds()).padStart(2,"0");return o.replace("YYYY",String(e)).replace("MM",i).replace("DD",r).replace("HH",a).replace("mm",c).replace("ss",m)}function me(n,o){const t={"Y+":o.getFullYear().toString(),"m+":(o.getMonth()+1).toString(),"d+":o.getDate().toString(),"H+":o.getHours().toString(),"M+":o.getMinutes().toString(),"S+":o.getSeconds().toString()};for(const e in t){const i=new RegExp("("+e+")").exec(n);if(i&&i[1]){const r=t[e]??"";n=n.replace(i[1],i[1].length===1?r:r.padStart(i[1].length,"0"))}}return n}function he(n,o=2){return n.toLocaleString("en-US",{minimumFractionDigits:o,maximumFractionDigits:o})}function ge(n){if(n===0)return"0 B";const o=["B","KB","MB","GB","TB"],t=1024,e=Math.floor(Math.log(n)/Math.log(t));return`${parseFloat((n/Math.pow(t,e)).toFixed(2))} ${o[e]}`}function G(n="local",o={}){const t=n==="local"?localStorage:sessionStorage,{prefix:e=""}=o,i=r=>e?`${e}_${r}`:r;return{get(r,a){const c=t.getItem(i(r));if(!c)return a;try{const m=JSON.parse(c);return m.expires&&Date.now()>m.expires?(t.removeItem(i(r)),a):m.value}catch{return a}},set(r,a,c){const m={value:a,expires:c?Date.now()+c:void 0};t.setItem(i(r),JSON.stringify(m))},remove(r){t.removeItem(i(r))},clear(){e?Object.keys(t).filter(r=>r.startsWith(e)).forEach(r=>t.removeItem(r)):t.clear()}}}const we=G("local"),O=new Map;async function k(n,o="script",t=null){/^\.?\/sdk/.test(n)&&window._sdkBaseUrl&&(n=n.replace(/^\.?\/?/,""),n=window._sdkBaseUrl.replace(/\/$/,"")+"/"+n);const e=window.urlRandom||"";e&&(n.includes("?")?n+="&urlRandom="+e:n+="?urlRandom="+e);const i=encodeURIComponent(n);if(O.has(i)){await O.get(i);return}const r=o==="css"?document.createElement("link"):document.createElement("script");r.id=i,r instanceof HTMLLinkElement?(r.rel="stylesheet",r.href=n,t?t.appendChild(r):document.head.appendChild(r)):(r.src=n,window.iframeDocument?window.iframeDocument.body.appendChild(r):document.body.appendChild(r));const a=new Promise((c,m)=>{r.onload=()=>c(),r.onerror=p=>m(p)});return O.set(i,a),a}function ye(n){document.querySelector("#"+n)?.scrollIntoView()}function Se(n){let o=window.top?.window.document.querySelector("head title")||window.document.querySelector("head title");if(o)o.textContent=n||o.textContent;else{const t=document.createElement("title");t.textContent=n||"";const e=window.top?.window.document.head||window.document.head;e&&e.appendChild(t)}}function be(n,o={}){return new Promise((t,e)=>{typeof n=="string"&&(n=document.querySelector(n));const i=(o.hideEles||[]).concat(["#app"]).map(a=>a instanceof HTMLElement?a:typeof a=="string"?document.querySelector(a):null).filter(a=>!!a),r=i.map(a=>a.style.display);if(n&&n instanceof HTMLElement){const a=n,c=a.parentNode,m=a.nextSibling,p=o.wrapEl&&o.wrapEl instanceof HTMLElement;p&&o.wrapEl&&(o.appendHandler&&o.appendHandler instanceof Function?o.appendHandler(o.wrapEl,a):o.wrapEl.appendChild(a)),i.forEach(x=>{x.style.display="none"}),document.body.appendChild(p&&o.wrapEl?o.wrapEl:a),setTimeout(()=>{window.print(),m?c?.insertBefore(a,m):c?.appendChild(a),p&&o.wrapEl&&o.wrapEl.remove(),i.forEach((x,T)=>{x.style.display=r[T]??""}),t(!0)},20)}else e("未找到需要打印的元素")})}function ve(){const n=new URLSearchParams(window.location.search),o=Object.fromEntries(n.entries());try{const t=se.useRoute();return Object.assign(o,t.query)}catch{return o}}function xe(n,o=!1,t=!0){const e=new URL(window.location.href);if(o){let i=e.hash.substring(1);const r=i.split("?");i=r[1]||"";const a=new URLSearchParams(i);Object.entries(n).forEach(([c,m])=>{m==null?a.delete(c):a.set(c,m)}),e.hash=a.toString()?`#${r[0]}?${a.toString()}`:""}else{const i=e.searchParams;Object.entries(n).forEach(([r,a])=>{a==null?i.delete(r):i.set(r,a)}),e.search=i.toString()}t?window.history.replaceState(null,"",e):window.history.pushState(null,"",e)}function Ee(n,o){return~~(Math.pow(10,o)*n)/Math.pow(10,o)}function Te(n,o){const t=+`${n}e${o}`;return+(Math.round(t)+"e-"+o)}const Q=new Map;function Ce(n,o=600){return new Promise(t=>{const e=Q.get(n);e&&clearTimeout(e);const i=setTimeout(()=>{t(!0)},o);Q.set(n,i)})}function _e(n,o=30){let t=!0,e=null;return function(...i){if(t){n.apply(this,i),t=!1;return}e||(e=setTimeout(()=>{e&&(clearTimeout(e),e=null),n.apply(this,i)},o))}}function Le(n,o=300){let t=null;return function(...e){t&&clearTimeout(t),t=setTimeout(()=>{n.apply(this,e)},o)}}async function ze(n,o){window.JSEncrypt||await k("./assets/jsencrypt/jsencrypt.min.js","script");const t=new window.JSEncrypt;return t.setPublicKey(o),t.encrypt(n)}async function Me(n,o){return window.CryptoJS||await k("./assets/crypto-js/crypto-js.min.js","script"),window.CryptoJS.AES.encrypt(n,o).toString()}async function ke(n,o){window.CryptoJS||await k("./assets/crypto-js/crypto-js.min.js","script");try{return window.CryptoJS.AES.decrypt(n,o).toString(window.CryptoJS.enc.Utf8)}catch{return""}}function Re(n){const o=document;let t,e;if(typeof o.hidden<"u")t="hidden",e="visibilitychange";else if(typeof o.msHidden<"u")t="msHidden",e="msvisibilitychange";else if(typeof o.webkitHidden<"u")t="webkitHidden",e="webkitvisibilitychange";else return()=>{};const i=()=>{n(!!o[t])};return typeof document.addEventListener<"u"&&e?(document.addEventListener(e,i,!1),()=>{document.removeEventListener(e,i,!1)}):()=>{}}function Z(n){const o=n.meta,t=n.vRow,e=[],i=[];for(let r=0;r<t.length;r++){i[r]={};for(let a=0;a<o.length;a++)e.length!==o.length&&e.push(o[a].name.toLowerCase()),i[r][o[a].name.toLowerCase()]=t[r][a]}return{colKey:e,data:i}}function He(n){const{colKey:o,data:t}=Z(n.data);return{colKey:o,data:t,total:n.totalCount}}function ee(n){const o={},t={s:{c:1e7,r:1e7},e:{c:0,r:0}};for(let e=0;e<n.length;e++){const i=n[e];if(i)for(let r=0;r<i.length;r++){t.s.r>e&&(t.s.r=e),t.s.c>r&&(t.s.c=r),t.e.r<e&&(t.e.r=e),t.e.c<r&&(t.e.c=r);const a={v:i[r]};if(a.v==null)continue;const c=window.XLSX.utils.encode_cell({c:r,r:e});typeof a.v=="number"?a.t="n":typeof a.v=="boolean"?a.t="b":a.t="s",o[c]=a}}return t.s.c<1e7&&(o["!ref"]=window.XLSX.utils.encode_range(t)),o}function te(n){const o=new ArrayBuffer(n.length),t=new Uint8Array(o);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e)&255;return o}async function ne(n,o,t){if(t&&typeof n=="object"&&n instanceof Blob){window.gdUtils?.loading?.show();const r=await(await window.XlsxPopulate.fromDataAsync(n)).outputAsync({password:t,type:"blob"});window.gdUtils?.loading?.close(),n=URL.createObjectURL(r)}typeof n=="object"&&n instanceof Blob&&(n=URL.createObjectURL(n));const e=document.createElement("a");e.href=n,e.download=o||"",e.dispatchEvent(new MouseEvent("click"))}async function Xe(n,o,t,e=!1,i){window.XLSX||await k("./assets/xlsx/xlsx.full.min.js","script"),i&&!window.XlsxPopulate&&await k("./assets/xlsx-populate/xlsx-populate.min.js","script");const r=[...o];r.unshift(n);const a="Sheet",c={SheetNames:[],Sheets:{}},m=ee(r);e&&(m["!freeze"]={state:"frozen",xSplit:0,ySplit:typeof e=="boolean"?1:e}),c.SheetNames.push(a),c.Sheets[a]=m;const p=window.XLSX.write(c,{bookType:"xlsx",bookSST:!1,type:"binary"}),x=t||"列表";await ne(new Blob([te(p)],{type:"application/octet-stream"}),x+".xlsx",i)}function P(n){return new Promise((o,t)=>{const e=new FileReader;e.onload=i=>{o(i.target?.result)},e.onerror=t,e.readAsArrayBuffer(n)})}async function De(n){window.XLSX||await k("./assets/xlsx/xlsx.full.min.js","script");const o=await P(n),t=new Uint8Array(o),e=window.XLSX.read(t,{type:"buffer"}),i=e.SheetNames[0];if(!i)return[];const r=e.Sheets[i];return r?window.XLSX.utils.sheet_to_json(r):[]}async function Ne(n){window.XLSX||await k("./assets/xlsx/xlsx.full.min.js","script");const o=await P(n),t=new Uint8Array(o),e=window.XLSX.read(t,{type:"buffer"}),i={};return e.SheetNames.forEach(r=>{const a=e.Sheets[r];a&&(i[r]=window.XLSX.utils.sheet_to_json(a))}),i}const Be=[I,q,K],Ae={install(n){Be.forEach(o=>{n.component(o.name??o.__name??"UnnamedComponent",o)})}};u.Echarts=I,u.STable=K,u.ScrollContainer=q,u.createDebounce=Le,u.createStorage=G,u.dateFormat=me,u.debounce=Ce,u.default=Ae,u.disuseAes=ke,u.exportJsonToExcel=Xe,u.formatDate=pe,u.formatFileSize=ge,u.formatNumber=he,u.importExcel=De,u.importExcelAll=Ne,u.loadRemote=k,u.onVisibilityChange=Re,u.openDownloadDialog=ne,u.pageRowSet=He,u.print=be,u.readFileAsync=P,u.round=Te,u.rowSet=Z,u.s2ab=te,u.scrollView=ye,u.setHtmlTitle=Se,u.sheetFromArrayOfArrays=ee,u.storage=we,u.throttle=_e,u.toFixed=Ee,u.updateUrlParams=xe,u.useAes=Me,u.useLoading=de,u.useRsa=ze,u.useToggle=fe,u.useUrlParams=ve,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.YourOrgCore={},d.Vue,d.VueRouter))})(this,(function(d,s,se){"use strict";const I=s.defineComponent({__name:"Echarts",props:{options:{},width:{default:"100%"},height:{default:"300px"},theme:{default:""}},emits:["click"],setup(n,{expose:o,emit:t}){const e=n,i=t,r=s.ref(null),a=s.shallowRef(null);let c=null;const m=()=>{r.value&&c&&(a.value=c.init(r.value,e.theme||void 0),a.value.setOption(e.options),a.value.on("click",T=>{i("click",T)}))},p=()=>{a.value?.resize()},v=T=>{a.value?.setOption(T)};return s.watch(()=>e.options,T=>{a.value?.setOption(T)},{deep:!0}),s.watch(()=>e.theme,()=>{a.value&&(a.value.dispose(),m())}),s.onMounted(async()=>{c=await import("echarts"),s.nextTick(()=>{m(),window.addEventListener("resize",p)})}),s.onUnmounted(()=>{a.value&&(a.value.dispose(),a.value=null),window.removeEventListener("resize",p)}),o({chartInstance:a,resize:p,setOption:v}),(T,C)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"chartRef",ref:r,style:s.normalizeStyle({width:e.width,height:e.height})},null,4))}}),ae=4,ie=.1,le=s.defineComponent({__name:"ScrollContainer",props:{height:{default:"100%"},maxHeight:{default:void 0},direction:{default:"y"},wrapClass:{default:""},viewClass:{default:""}},setup(n,{expose:o}){const t=n,e=s.ref(null),i=s.ref(null);let r=null;const a=s.computed(()=>{const l={};return t.height!==null&&t.height!==void 0&&(l.height=typeof t.height=="number"?`${t.height}px`:t.height),t.maxHeight!==null&&t.maxHeight!==void 0&&(l.maxHeight=typeof t.maxHeight=="number"?`${t.maxHeight}px`:t.maxHeight),l}),c=s.reactive({sizeY:0,moveY:0,sizeX:0,moveX:0}),m=(l,f,h)=>Math.min(h,Math.max(f,l)),p=l=>Math.max(l-ae,0),v=(l,f,h)=>{if(f<=0||l<=0||f<=l||h<=0)return 0;const w=h*l/f,g=h*ie;return Math.max(w,g)},T=(l,f,h,w)=>{const g=h-w;return g<=0?null:(f-l)/g},C=()=>{const l=e.value;if(!l)return;const f=l.clientHeight,h=l.scrollHeight,w=l.clientWidth,g=l.scrollWidth;if(t.direction==="y"||t.direction==="both")if(h>0&&f>0&&f<h){const _=p(f),L=v(f,h,_);if(L>0){const z=h-f,M=Math.max(_-L,0),W=z>0?l.scrollTop/z*M:0;c.sizeY=L,c.moveY=m(W,0,M)}else c.sizeY=0,c.moveY=0}else c.sizeY=0,c.moveY=0;if(t.direction==="x"||t.direction==="both")if(g>0&&w>0&&w<g){const _=p(w),L=v(w,g,_);if(L>0){const z=g-w,M=Math.max(_-L,0),W=z>0?l.scrollLeft/z*M:0;c.sizeX=L,c.moveX=m(W,0,M)}else c.sizeX=0,c.moveX=0}else c.sizeX=0,c.moveX=0},H=()=>{C()},U=(l,f)=>{const h=e.value;if(h){if(f==="y"){h.scrollTop+=l.deltaY;return}h.scrollLeft+=l.deltaX||l.deltaY}},y=s.reactive({dragging:!1,axis:null,startX:0,startY:0,startScrollTop:0,startScrollLeft:0});let D=null,X=null;const N=l=>{l.preventDefault()},oe=()=>{const l=document.body;D=l.style.userSelect,X=l.style.cursor,l.style.userSelect="none",l.style.cursor="default",document.addEventListener("selectstart",N),document.addEventListener("dragstart",N)},$=()=>{document.removeEventListener("selectstart",N),document.removeEventListener("dragstart",N);const l=document.body;D!==null&&(l.style.userSelect=D),X!==null&&(l.style.cursor=X),D=null,X=null},j=l=>{if(!y.dragging)return;l.preventDefault();const f=e.value;if(f){if(y.axis==="y"){const h=l.clientY-y.startY,w=f.clientHeight,g=f.scrollHeight;if(g<=w||w===0)return;const _=p(w),L=v(w,g,_),z=T(w,g,_,L);if(z===null)return;const M=g-w;f.scrollTop=m(y.startScrollTop+h*z,0,M)}else if(y.axis==="x"){const h=l.clientX-y.startX,w=f.clientWidth,g=f.scrollWidth;if(g<=w||w===0)return;const _=p(w),L=v(w,g,_),z=T(w,g,_,L);if(z===null)return;const M=g-w;f.scrollLeft=m(y.startScrollLeft+h*z,0,M)}}},B=()=>{y.dragging=!1,y.axis=null,document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",B),$()},F=(l,f)=>{l.stopPropagation(),l.preventDefault(),C();const h=e.value;h&&(y.dragging=!0,y.axis=f,y.startX=l.clientX,y.startY=l.clientY,y.startScrollTop=h.scrollTop,y.startScrollLeft=h.scrollLeft,oe(),document.addEventListener("mousemove",j),document.addEventListener("mouseup",B))},u=l=>{F(l,"y")},b=l=>{F(l,"x")},E=s.computed(()=>(t.direction==="y"||t.direction==="both")&&c.sizeY>0),S=s.computed(()=>(t.direction==="x"||t.direction==="both")&&c.sizeX>0),x=s.computed(()=>c.sizeY?{height:`${c.sizeY}px`,transform:`translateY(${c.moveY}px)`}:{display:"none"}),R=s.computed(()=>c.sizeX?{width:`${c.sizeX}px`,transform:`translateX(${c.moveX}px)`}:{display:"none"});return o({update:C,scrollTo:l=>{e.value?.scrollTo(l)},setScrollTop:l=>{e.value&&(e.value.scrollTop=l)},setScrollLeft:l=>{e.value&&(e.value.scrollLeft=l)},getScrollWrap:()=>e.value}),s.onMounted(()=>{const l=e.value;l&&l.addEventListener("scroll",H,{passive:!0}),typeof ResizeObserver<"u"&&(r=new ResizeObserver(()=>{C()}),e.value&&r.observe(e.value),i.value&&r.observe(i.value)),s.nextTick(()=>C()),window.addEventListener("resize",C)}),s.onBeforeUnmount(()=>{const l=e.value;l&&l.removeEventListener("scroll",H),r&&(r.disconnect(),r=null),window.removeEventListener("resize",C),B()}),(l,f)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["scroll-container",[{"is-dragging":y.dragging},t.wrapClass]])},[s.createElementVNode("div",{ref_key:"wrapRef",ref:e,class:"scroll-container__wrap",style:s.normalizeStyle(a.value)},[s.createElementVNode("div",{ref_key:"viewRef",ref:i,class:s.normalizeClass(["scroll-container__view",t.viewClass])},[s.renderSlot(l.$slots,"default",{},void 0,!0)],2)],4),E.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"scrollbar scrollbar--vertical",onMousedown:f[0]||(f[0]=s.withModifiers(()=>{},["stop","prevent"])),onWheel:f[1]||(f[1]=s.withModifiers(h=>U(h,"y"),["prevent"]))},[s.createElementVNode("div",{class:"scrollbar__thumb",style:s.normalizeStyle(x.value),onMousedown:u},null,36)],32)):s.createCommentVNode("",!0),S.value?(s.openBlock(),s.createElementBlock("div",{key:1,class:"scrollbar scrollbar--horizontal",onMousedown:f[2]||(f[2]=s.withModifiers(()=>{},["stop","prevent"])),onWheel:f[3]||(f[3]=s.withModifiers(h=>U(h,"x"),["prevent"]))},[s.createElementVNode("div",{class:"scrollbar__thumb",style:s.normalizeStyle(R.value),onMousedown:b},null,36)],32)):s.createCommentVNode("",!0)],2))}}),J=(n,o)=>{const t=n.__vccOpts||n;for(const[e,i]of o)t[e]=i;return t},q=J(le,[["__scopeId","data-v-53718297"]]),ce={class:"s-table"},de="dc6971e24ccba02c71a375b9511b2a59T1JERVI6MTAwMDI5LEVYUElSWT0xNjk0MjE3NjAwMDAwLERPTUFJTj1zdXJlbHkuY29vbCxVTFRJTUFURT0xLEtFWVZFUlNJT049MQ==",K=J(s.defineComponent({name:"STable",inheritAttrs:!1,__name:"STable",props:{columns:{},data:{},pageNum:{default:1},pageSize:{default:10},showPagination:{type:[String,Boolean],default:"auto"},pageSizeOptions:{default:()=>["10","20","50","100"]},rowAutoHeight:{type:Boolean,default:!1},exportName:{default:""},showIndex:{type:Boolean,default:!1},enableContextExport:{type:Boolean,default:!0},rowKey:{type:[String,Function],default:"__rowkey"}},emits:["update:pageNum","update:pageSize","change","export-page","export-all"],setup(n,{expose:o,emit:t}){const e=s.ref(null),i=s.defineAsyncComponent({loader:()=>import("@surely-vue/table").then(u=>(u.setLicenseKey(de),u.STable)),loadingComponent:void 0}),r=n,a=t,c=s.ref([]),m=s.ref(!1),p=s.reactive({current:r.pageNum,pageSize:r.pageSize,total:0,showSizeChanger:!0,pageSizeOptions:r.pageSizeOptions,showTotal:u=>`共 ${u} 条`}),v=s.computed(()=>r.showPagination==="auto"||r.showPagination===!0),T=s.computed(()=>v.value?p:!1),C=s.computed(()=>{let u;if(!r.rowAutoHeight)u=r.columns||[];else{const E=S=>(S||[]).map(x=>{const R={...x,autoHeight:!0};return Array.isArray(x.children)&&x.children.length>0&&(R.children=E(x.children)),R});u=E(r.columns)}return r.showIndex?[{title:"序号",dataIndex:"__index",key:"__index",align:"center",width:80},...u]:u}),H=async(u={},b={},E={})=>{m.value=!0;const S={pageNo:u.current||p.current,pageSize:u.pageSize||p.pageSize,export:u.export||!1,...b};E.field&&(S.sortField=E.field,S.sortOrder=E.order);try{const x=await r.data(S),R=x.data||x.rows||[],A=x.total||x.totalCount||0,Y=S.pageNo||1,re=S.pageSize||p.pageSize||10;if(R.forEach((V,l)=>{V.__rowkey=`${Y}-${l}`,V.__index=(Y-1)*re+l+1}),u.export)return x;c.value=R,p.total=A,p.current=S.pageNo,p.pageSize=S.pageSize}catch(x){console.error("Table load data error:",x),c.value=[],p.total=0}finally{m.value=!1}},U=(u,b,E,...S)=>{p.current=u.current,p.pageSize=u.pageSize,a("update:pageNum",u.current),a("update:pageSize",u.pageSize),a("change",u,b,E,...S),H(u,b,E)},y=u=>{const b=c.value;if(!b.length)return[];if(!v.value||b&&b.length<=p.pageSize)return c.value;const S=((u||p.current)-1)*p.pageSize;return b.slice(S,S+p.pageSize)},D=()=>c.value;let X=()=>{};const N=u=>{e.value=u,X()},$=new Promise(u=>{X=u}),j=async()=>(await $,e.value?.$el),B=({key:u})=>{u==="page"&&a("export-page"),u==="all"&&a("export-all")},F=(u=!1)=>{u&&(p.current=1),H()};return s.onMounted(()=>{H()}),o({get _columns(){return C.value},getEl:j,getData:D,getPageData:y,refresh:F,loadData:H}),(u,b)=>{const E=s.resolveComponent("a-menu-item"),S=s.resolveComponent("a-menu"),x=s.resolveComponent("a-dropdown");return s.openBlock(),s.createElementBlock("div",ce,[s.createVNode(x,{trigger:r.enableContextExport?["contextmenu"]:[]},{overlay:s.withCtx(()=>[s.renderSlot(u.$slots,"contextmenuOverlay",{},()=>[s.createVNode(S,{onClick:B},{default:s.withCtx(()=>[s.createVNode(E,{key:"page"},{default:s.withCtx(()=>[...b[0]||(b[0]=[s.createTextVNode("导出本页",-1)])]),_:1}),s.createVNode(E,{key:"all"},{default:s.withCtx(()=>[...b[1]||(b[1]=[s.createTextVNode("导出全部",-1)])]),_:1})]),_:1})],!0)]),default:s.withCtx(()=>[s.createVNode(s.unref(i),s.mergeProps({ref:N},u.$attrs,{"range-selection":!1,columns:C.value,"data-source":c.value,pagination:T.value,loading:m.value,"row-key":n.rowKey,onChange:U}),s.createSlots({_:2},[s.renderList(u.$slots,(R,A)=>({name:A,fn:s.withCtx(Y=>[s.renderSlot(u.$slots,A,s.normalizeProps(s.guardReactiveProps(Y||{})),void 0,!0)])}))]),1040,["columns","data-source","pagination","loading","row-key"])]),_:3},8,["trigger"])])}}}),[["__scopeId","data-v-db83a2fc"]]);function ue(n,o="YYYY-MM-DD HH:mm:ss"){const t=new Date(n),e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),c=String(t.getMinutes()).padStart(2,"0"),m=String(t.getSeconds()).padStart(2,"0");return o.replace("YYYY",String(e)).replace("MM",i).replace("DD",r).replace("HH",a).replace("mm",c).replace("ss",m)}function fe(n,o){const t={"Y+":o.getFullYear().toString(),"m+":(o.getMonth()+1).toString(),"d+":o.getDate().toString(),"H+":o.getHours().toString(),"M+":o.getMinutes().toString(),"S+":o.getSeconds().toString()};for(const e in t){const i=new RegExp("("+e+")").exec(n);if(i&&i[1]){const r=t[e]??"";n=n.replace(i[1],i[1].length===1?r:r.padStart(i[1].length,"0"))}}return n}function pe(n,o=2){return n.toLocaleString("en-US",{minimumFractionDigits:o,maximumFractionDigits:o})}function me(n){if(n===0)return"0 B";const o=["B","KB","MB","GB","TB"],t=1024,e=Math.floor(Math.log(n)/Math.log(t));return`${parseFloat((n/Math.pow(t,e)).toFixed(2))} ${o[e]}`}function G(n="local",o={}){const t=n==="local"?localStorage:sessionStorage,{prefix:e=""}=o,i=r=>e?`${e}_${r}`:r;return{get(r,a){const c=t.getItem(i(r));if(!c)return a;try{const m=JSON.parse(c);return m.expires&&Date.now()>m.expires?(t.removeItem(i(r)),a):m.value}catch{return a}},set(r,a,c){const m={value:a,expires:c?Date.now()+c:void 0};t.setItem(i(r),JSON.stringify(m))},remove(r){t.removeItem(i(r))},clear(){e?Object.keys(t).filter(r=>r.startsWith(e)).forEach(r=>t.removeItem(r)):t.clear()}}}const he=G("local"),O=new Map;async function k(n,o="script",t=null){/^\.?\/sdk/.test(n)&&window._sdkBaseUrl&&(n=n.replace(/^\.?\/?/,""),n=window._sdkBaseUrl.replace(/\/$/,"")+"/"+n);const e=window.urlRandom||"";e&&(n.includes("?")?n+="&urlRandom="+e:n+="?urlRandom="+e);const i=encodeURIComponent(n);if(O.has(i)){await O.get(i);return}const r=o==="css"?document.createElement("link"):document.createElement("script");r.id=i,r instanceof HTMLLinkElement?(r.rel="stylesheet",r.href=n,t?t.appendChild(r):document.head.appendChild(r)):(r.src=n,window.iframeDocument?window.iframeDocument.body.appendChild(r):document.body.appendChild(r));const a=new Promise((c,m)=>{r.onload=()=>c(),r.onerror=p=>m(p)});return O.set(i,a),a}function we(n){document.querySelector("#"+n)?.scrollIntoView()}function ge(n){let o=window.top?.window.document.querySelector("head title")||window.document.querySelector("head title");if(o)o.textContent=n||o.textContent;else{const t=document.createElement("title");t.textContent=n||"";const e=window.top?.window.document.head||window.document.head;e&&e.appendChild(t)}}function ye(n,o={}){return new Promise((t,e)=>{typeof n=="string"&&(n=document.querySelector(n));const i=(o.hideEles||[]).concat(["#app"]).map(a=>a instanceof HTMLElement?a:typeof a=="string"?document.querySelector(a):null).filter(a=>!!a),r=i.map(a=>a.style.display);if(n&&n instanceof HTMLElement){const a=n,c=a.parentNode,m=a.nextSibling,p=o.wrapEl&&o.wrapEl instanceof HTMLElement;p&&o.wrapEl&&(o.appendHandler&&o.appendHandler instanceof Function?o.appendHandler(o.wrapEl,a):o.wrapEl.appendChild(a)),i.forEach(v=>{v.style.display="none"}),document.body.appendChild(p&&o.wrapEl?o.wrapEl:a),setTimeout(()=>{window.print(),m?c?.insertBefore(a,m):c?.appendChild(a),p&&o.wrapEl&&o.wrapEl.remove(),i.forEach((v,T)=>{v.style.display=r[T]??""}),t(!0)},20)}else e("未找到需要打印的元素")})}function Se(){const n=new URLSearchParams(window.location.search),o=Object.fromEntries(n.entries());try{const t=se.useRoute();return Object.assign(o,t.query)}catch{return o}}function be(n,o=!1,t=!0){const e=new URL(window.location.href);if(o){let i=e.hash.substring(1);const r=i.split("?");i=r[1]||"";const a=new URLSearchParams(i);Object.entries(n).forEach(([c,m])=>{m==null?a.delete(c):a.set(c,m)}),e.hash=a.toString()?`#${r[0]}?${a.toString()}`:""}else{const i=e.searchParams;Object.entries(n).forEach(([r,a])=>{a==null?i.delete(r):i.set(r,a)}),e.search=i.toString()}t?window.history.replaceState(null,"",e):window.history.pushState(null,"",e)}function xe(n,o){return~~(Math.pow(10,o)*n)/Math.pow(10,o)}function ve(n,o){const t=+`${n}e${o}`;return+(Math.round(t)+"e-"+o)}const Q=new Map;function Ee(n,o=600){return new Promise(t=>{const e=Q.get(n);e&&clearTimeout(e);const i=setTimeout(()=>{t(!0)},o);Q.set(n,i)})}function Te(n,o=30){let t=!0,e=null;return function(...i){if(t){n.apply(this,i),t=!1;return}e||(e=setTimeout(()=>{e&&(clearTimeout(e),e=null),n.apply(this,i)},o))}}function Ce(n,o=300){let t=null;return function(...e){t&&clearTimeout(t),t=setTimeout(()=>{n.apply(this,e)},o)}}async function _e(n,o){window.JSEncrypt||await k("./assets/jsencrypt/jsencrypt.min.js","script");const t=new window.JSEncrypt;return t.setPublicKey(o),t.encrypt(n)}async function Le(n,o){return window.CryptoJS||await k("./assets/crypto-js/crypto-js.min.js","script"),window.CryptoJS.AES.encrypt(n,o).toString()}async function ze(n,o){window.CryptoJS||await k("./assets/crypto-js/crypto-js.min.js","script");try{return window.CryptoJS.AES.decrypt(n,o).toString(window.CryptoJS.enc.Utf8)}catch{return""}}function Me(n){const o=document;let t,e;if(typeof o.hidden<"u")t="hidden",e="visibilitychange";else if(typeof o.msHidden<"u")t="msHidden",e="msvisibilitychange";else if(typeof o.webkitHidden<"u")t="webkitHidden",e="webkitvisibilitychange";else return()=>{};const i=()=>{n(!!o[t])};return typeof document.addEventListener<"u"&&e?(document.addEventListener(e,i,!1),()=>{document.removeEventListener(e,i,!1)}):()=>{}}function Z(n){const o=n.meta,t=n.vRow,e=[],i=[];for(let r=0;r<t.length;r++){i[r]={};for(let a=0;a<o.length;a++)e.length!==o.length&&e.push(o[a].name.toLowerCase()),i[r][o[a].name.toLowerCase()]=t[r][a]}return{colKey:e,data:i}}function ke(n){const{colKey:o,data:t}=Z(n.data);return{colKey:o,data:t,total:n.totalCount}}function ee(n){const o={},t={s:{c:1e7,r:1e7},e:{c:0,r:0}};for(let e=0;e<n.length;e++){const i=n[e];if(i)for(let r=0;r<i.length;r++){t.s.r>e&&(t.s.r=e),t.s.c>r&&(t.s.c=r),t.e.r<e&&(t.e.r=e),t.e.c<r&&(t.e.c=r);const a={v:i[r]};if(a.v==null)continue;const c=window.XLSX.utils.encode_cell({c:r,r:e});typeof a.v=="number"?a.t="n":typeof a.v=="boolean"?a.t="b":a.t="s",o[c]=a}}return t.s.c<1e7&&(o["!ref"]=window.XLSX.utils.encode_range(t)),o}function te(n){const o=new ArrayBuffer(n.length),t=new Uint8Array(o);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e)&255;return o}async function ne(n,o,t){if(t&&typeof n=="object"&&n instanceof Blob){window.gdUtils?.loading?.show();const r=await(await window.XlsxPopulate.fromDataAsync(n)).outputAsync({password:t,type:"blob"});window.gdUtils?.loading?.close(),n=URL.createObjectURL(r)}typeof n=="object"&&n instanceof Blob&&(n=URL.createObjectURL(n));const e=document.createElement("a");e.href=n,e.download=o||"",e.dispatchEvent(new MouseEvent("click"))}async function Re(n,o,t,e=!1,i){window.XLSX||await k("./assets/xlsx/xlsx.full.min.js","script"),i&&!window.XlsxPopulate&&await k("./assets/xlsx-populate/xlsx-populate.min.js","script");const r=[...o];r.unshift(n);const a="Sheet",c={SheetNames:[],Sheets:{}},m=ee(r);e&&(m["!freeze"]={state:"frozen",xSplit:0,ySplit:typeof e=="boolean"?1:e}),c.SheetNames.push(a),c.Sheets[a]=m;const p=window.XLSX.write(c,{bookType:"xlsx",bookSST:!1,type:"binary"}),v=t||"列表";await ne(new Blob([te(p)],{type:"application/octet-stream"}),v+".xlsx",i)}function P(n){return new Promise((o,t)=>{const e=new FileReader;e.onload=i=>{o(i.target?.result)},e.onerror=t,e.readAsArrayBuffer(n)})}async function He(n){window.XLSX||await k("./assets/xlsx/xlsx.full.min.js","script");const o=await P(n),t=new Uint8Array(o),e=window.XLSX.read(t,{type:"buffer"}),i=e.SheetNames[0];if(!i)return[];const r=e.Sheets[i];return r?window.XLSX.utils.sheet_to_json(r):[]}async function Xe(n){window.XLSX||await k("./assets/xlsx/xlsx.full.min.js","script");const o=await P(n),t=new Uint8Array(o),e=window.XLSX.read(t,{type:"buffer"}),i={};return e.SheetNames.forEach(r=>{const a=e.Sheets[r];a&&(i[r]=window.XLSX.utils.sheet_to_json(a))}),i}const De=[I,q,K],Ne={install(n){De.forEach(o=>{n.component(o.name??o.__name??"UnnamedComponent",o)})}};d.Echarts=I,d.STable=K,d.ScrollContainer=q,d.createDebounce=Ce,d.createStorage=G,d.dateFormat=fe,d.debounce=Ee,d.default=Ne,d.disuseAes=ze,d.exportJsonToExcel=Re,d.formatDate=ue,d.formatFileSize=me,d.formatNumber=pe,d.importExcel=He,d.importExcelAll=Xe,d.loadRemote=k,d.onVisibilityChange=Me,d.openDownloadDialog=ne,d.pageRowSet=ke,d.print=ye,d.readFileAsync=P,d.round=ve,d.rowSet=Z,d.s2ab=te,d.scrollView=we,d.setHtmlTitle=ge,d.sheetFromArrayOfArrays=ee,d.storage=he,d.throttle=Te,d.toFixed=xe,d.updateUrlParams=be,d.useAes=Le,d.useRsa=_e,d.useUrlParams=Se,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gd-web-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Vue 3 基座能力封装库 - 组件与工具函数",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -19,10 +19,6 @@
|
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"import": "./dist/index.js"
|
|
21
21
|
},
|
|
22
|
-
"./hooks": {
|
|
23
|
-
"types": "./dist/index.d.ts",
|
|
24
|
-
"import": "./dist/index.js"
|
|
25
|
-
},
|
|
26
22
|
"./utils": {
|
|
27
23
|
"types": "./dist/index.d.ts",
|
|
28
24
|
"import": "./dist/index.js"
|
|
@@ -39,9 +35,6 @@
|
|
|
39
35
|
"build:check": "vue-tsc --noEmit && vite build",
|
|
40
36
|
"build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
41
37
|
"preview": "vite preview",
|
|
42
|
-
"test": "vitest",
|
|
43
|
-
"test:ui": "vitest --ui",
|
|
44
|
-
"test:coverage": "vitest --coverage",
|
|
45
38
|
"prepublishOnly": "pnpm build",
|
|
46
39
|
"release:patch": "npm version patch && npm publish",
|
|
47
40
|
"release:minor": "npm version minor && npm publish",
|
|
@@ -66,17 +59,13 @@
|
|
|
66
59
|
"@types/node": "^25.2.0",
|
|
67
60
|
"@types/prismjs": "^1.26.5",
|
|
68
61
|
"@vitejs/plugin-vue": "^6.0.4",
|
|
69
|
-
"@vitest/ui": "^2.1.0",
|
|
70
|
-
"@vue/test-utils": "^2.4.0",
|
|
71
62
|
"ant-design-vue": "^4.2.0",
|
|
72
63
|
"echarts": "^5.5.0",
|
|
73
|
-
"happy-dom": "^15.0.0",
|
|
74
64
|
"typescript": "~5.6.0",
|
|
75
65
|
"unplugin-auto-import": "^21.0.0",
|
|
76
66
|
"unplugin-vue-components": "^31.0.0",
|
|
77
67
|
"vite": "^7.2.0",
|
|
78
68
|
"vite-plugin-dts": "^4.2.0",
|
|
79
|
-
"vitest": "^2.1.0",
|
|
80
69
|
"vue": "^3.5.0",
|
|
81
70
|
"vue-router": "^4.4.0",
|
|
82
71
|
"vue-tsc": "^2.1.0"
|
package/dist/hooks/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
export interface UseLoadingReturn {
|
|
3
|
-
loading: Ref<boolean>;
|
|
4
|
-
startLoading: () => void;
|
|
5
|
-
stopLoading: () => void;
|
|
6
|
-
withLoading: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* 加载状态管理 hook
|
|
10
|
-
*/
|
|
11
|
-
export declare function useLoading(initialValue?: boolean): UseLoadingReturn;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
export interface UseToggleReturn {
|
|
3
|
-
value: Ref<boolean>;
|
|
4
|
-
toggle: () => void;
|
|
5
|
-
setTrue: () => void;
|
|
6
|
-
setFalse: () => void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* 布尔值切换 hook
|
|
10
|
-
*/
|
|
11
|
-
export declare function useToggle(initialValue?: boolean): UseToggleReturn;
|