@zl-ui-kit/components 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -56,6 +56,14 @@ import { ZlFilePreview, ZlFileViewer } from '@zl-ui-kit/components/file-preview'
|
|
|
56
56
|
> 例外:`ZlPdfViewer` 没有重型依赖,仍留在主入口,`import { ZlPdfViewer } from '@zl-ui-kit/components'`。
|
|
57
57
|
> `app.use(ZlUI)` 全量注册**不含**上述子入口组件,需要的话手动 `app.component('ZlChart', ZlChart)`。
|
|
58
58
|
|
|
59
|
+
**关于 `echarts` 版本**(`peerDependencies: "^5.6.0 || ^6.0.0"`,5.6+ 与 6.x 均支持):
|
|
60
|
+
|
|
61
|
+
- `ZlChart` 内部是 `import * as echarts from 'echarts'`(全量包,开箱即用、无需自己 `use()` 注册图表类型);
|
|
62
|
+
若宿主用 `echarts/core` + 按需注册,两者是两份独立实例,产物会同时含两份 echarts(实测约 +600KB)。
|
|
63
|
+
此时可按需改用宿主实例自绘,或在构建里把 `echarts` 设为 external 由宿主提供。
|
|
64
|
+
- 升级到 **echarts 6** 后默认主题变了(配色、legend 默认挪到画布底部、轴标签防溢出默认开启),
|
|
65
|
+
想保持 v5 观感:`import 'echarts/theme/v5'` + `<ZlChart theme="v5" ... />`(`theme` prop 见 §6 ⑧)。
|
|
66
|
+
|
|
59
67
|
接入:
|
|
60
68
|
|
|
61
69
|
```ts
|
|
@@ -445,6 +453,13 @@ const chartOption = computed(() => {
|
|
|
445
453
|
<ZlChart v-bind="chartOption" />
|
|
446
454
|
```
|
|
447
455
|
|
|
456
|
+
| Prop | 类型 | 说明 |
|
|
457
|
+
| --- | --- | --- |
|
|
458
|
+
| `series` | `object \| object[]` | 系列(单个或数组);其余 option 字段经 attrs 透传 |
|
|
459
|
+
| `theme` | `string` | 主题名,initialize 时指定。需先注册,如 `import 'echarts/theme/v5'` 后传 `theme="v5"`;echarts 6 想保留 v5 观感时用 |
|
|
460
|
+
|
|
461
|
+
> 暴露方法:`clear()`(模板 ref 调用)。尺寸自适应由 `useResizeObserver` 负责,容器需有明确高度。
|
|
462
|
+
|
|
448
463
|
#### ⑨ `useRequest` 生命周期面板
|
|
449
464
|
```ts
|
|
450
465
|
const req = useRequest(getResourcePageMaybeFail, { defaultParams: [{ pageNum: 1, pageSize: 5 }] })
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
/** 系列(单对象或数组);其余图表配置经 attrs 透传(title/xAxis/yAxis/tooltip 等,可用 src/utils/echarts 工具构造) */
|
|
3
3
|
series?: Record<string, any> | Array<Record<string, any>>;
|
|
4
|
+
/** 主题名:先 `import 'echarts/theme/v5'` 之类注册主题,再传 `theme="v5"`。升级到 echarts 6 后想保持 v5 观感时用 */
|
|
5
|
+
theme?: string;
|
|
4
6
|
};
|
|
5
7
|
declare function clear(): void;
|
|
6
8
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as v, useAttrs as h, computed as d, shallowRef as _, ref as x, watch as c, onMounted as k, onScopeDispose as w, openBlock as R, createElementBlock as y, nextTick as i } from "vue";
|
|
2
2
|
import { useResizeObserver as z } from "@vueuse/core";
|
|
3
3
|
import * as O from "echarts";
|
|
4
|
-
const C = /* @__PURE__ */
|
|
4
|
+
const C = /* @__PURE__ */ v({
|
|
5
5
|
name: "ZlChart",
|
|
6
6
|
inheritAttrs: !1,
|
|
7
7
|
__name: "index",
|
|
8
8
|
props: {
|
|
9
|
-
series: {}
|
|
9
|
+
series: {},
|
|
10
|
+
theme: {}
|
|
10
11
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
const { series:
|
|
12
|
+
setup(l, { expose: u }) {
|
|
13
|
+
const s = l, p = h(), r = d(() => {
|
|
14
|
+
const { series: m, ...a } = p;
|
|
14
15
|
return {
|
|
15
|
-
...
|
|
16
|
-
series: [].concat(
|
|
16
|
+
...a,
|
|
17
|
+
series: [].concat(s.series ?? [])
|
|
17
18
|
};
|
|
18
|
-
}), e =
|
|
19
|
-
async function
|
|
20
|
-
await
|
|
19
|
+
}), e = _(), t = x();
|
|
20
|
+
async function n() {
|
|
21
|
+
await i(), e.value?.setOption(r.value);
|
|
21
22
|
}
|
|
22
|
-
async function
|
|
23
|
-
await
|
|
23
|
+
async function o() {
|
|
24
|
+
await i(), t.value && (e.value = O.init(t.value, s.theme), n());
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function f() {
|
|
26
27
|
e.value?.clear();
|
|
27
28
|
}
|
|
28
29
|
return z(t, () => {
|
|
29
30
|
e.value?.resize();
|
|
30
|
-
}),
|
|
31
|
-
|
|
31
|
+
}), c(() => r.value, () => {
|
|
32
|
+
n();
|
|
33
|
+
}), c(() => s.theme, () => {
|
|
34
|
+
e.value?.dispose(), e.value = void 0, o();
|
|
32
35
|
}), k(() => {
|
|
33
|
-
|
|
36
|
+
o();
|
|
34
37
|
}), w(() => {
|
|
35
38
|
e.value?.dispose();
|
|
36
|
-
}),
|
|
37
|
-
clear:
|
|
38
|
-
}), (
|
|
39
|
+
}), u({
|
|
40
|
+
clear: f
|
|
41
|
+
}), (m, a) => (R(), y("div", {
|
|
39
42
|
ref_key: "chartRef",
|
|
40
43
|
ref: t,
|
|
41
44
|
class: "zl-chart"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zl-ui-kit/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ZL UI 业务组件库(Element Plus 体系,Zl 前缀)——首批:Icon/AutoTooltip/Tag/CornerTag/Text/Title/Copy/Empty/Pagination/DictTag",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"file-type": "^20.4.1",
|
|
40
40
|
"dt-sql-parser": "^4.3.1",
|
|
41
41
|
"sql-formatter": "^15.4.2",
|
|
42
|
-
"@zl-ui-kit/
|
|
43
|
-
"@zl-ui-kit/utils": "0.
|
|
44
|
-
"@zl-ui-kit/
|
|
42
|
+
"@zl-ui-kit/icons": "0.4.0",
|
|
43
|
+
"@zl-ui-kit/utils": "0.4.0",
|
|
44
|
+
"@zl-ui-kit/composables": "0.4.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@vueuse/core": "^12.3.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@vue-office/excel": "1.7.14",
|
|
53
53
|
"@vue-office/pdf": "^2.0.10",
|
|
54
54
|
"@vue-office/pptx": "1.0.1",
|
|
55
|
-
"echarts": "^5.6.0"
|
|
55
|
+
"echarts": "^5.6.0 || ^6.0.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"monaco-editor": {
|
|
@@ -98,10 +98,10 @@
|
|
|
98
98
|
"@vue-office/pdf": "^2.0.10",
|
|
99
99
|
"@vue-office/pptx": "1.0.1",
|
|
100
100
|
"echarts": "^5.6.0",
|
|
101
|
-
"@jichuang/vite-config": "1.0.0",
|
|
102
101
|
"@jichuang/tsconfig": "1.0.0",
|
|
103
102
|
"@jichuang/eslint-config": "1.0.0",
|
|
104
|
-
"@
|
|
103
|
+
"@jichuang/vite-config": "1.0.0",
|
|
104
|
+
"@zl-ui-kit/theme": "0.4.0"
|
|
105
105
|
},
|
|
106
106
|
"repository": {
|
|
107
107
|
"type": "git",
|