@vtj/charts 0.8.6

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 陈华春
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.mjs ADDED
@@ -0,0 +1,71 @@
1
+ import { ref as o, onMounted as u, unref as c, markRaw as h, onUnmounted as p, watch as f, defineComponent as l, toRefs as v, computed as d, h as m } from "vue";
2
+ import * as R from "echarts";
3
+ import { useResizeObserver as g } from "@vueuse/core";
4
+ import { debounce as y } from "@vtj/utils";
5
+ /**!
6
+ * Copyright (c) 2024, VTJ.PRO All rights reserved.
7
+ * @name @vtj/charts
8
+ * @author CHC chenhuachun1549@dingtalk.com
9
+ * @version 0.8.5
10
+ * @license <a href="https://vtj.pro/license.html">MIT License</a>
11
+ */
12
+ const S = "0.8.5";
13
+ function w(s, r, n) {
14
+ const e = o();
15
+ return u(() => {
16
+ const t = c(r);
17
+ t && (e.value || (e.value = h(s.init(t))), e.value && e.value.setOption(n.value || {}));
18
+ }), p(() => {
19
+ e.value && e.value.dispose();
20
+ }), f(
21
+ n,
22
+ (t) => {
23
+ e.value && e.value.setOption(t || {});
24
+ },
25
+ { deep: !0 }
26
+ ), g(
27
+ r,
28
+ y(() => {
29
+ e.value && e.value.resize();
30
+ }, 150)
31
+ ), {
32
+ echartsInstance: e
33
+ };
34
+ }
35
+ const C = l({
36
+ name: "XChart",
37
+ props: {
38
+ width: {
39
+ type: String,
40
+ default: "100%"
41
+ },
42
+ height: {
43
+ type: String,
44
+ default: "400px"
45
+ },
46
+ option: {
47
+ type: Object
48
+ }
49
+ },
50
+ setup(s) {
51
+ const { width: r, height: n, option: e } = v(s), t = o(), a = d(() => ({
52
+ width: r.value,
53
+ height: n.value
54
+ })), { echartsInstance: i } = w(R, t, e);
55
+ return {
56
+ chartRef: t,
57
+ option: e,
58
+ styles: a,
59
+ echartsInstance: i
60
+ };
61
+ },
62
+ render() {
63
+ return m("div", { class: "x-chart", ref: "chartRef", style: this.styles });
64
+ },
65
+ expose: ["chartRef", "option", "echartsInstance"]
66
+ }), b = [C];
67
+ export {
68
+ S as VTJ_CHARTS_VERSION,
69
+ C as XChart,
70
+ b as components
71
+ };
@@ -0,0 +1,7 @@
1
+ (function(t,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(t=typeof globalThis<"u"?globalThis:t||self,i(t.VtjCharts={}))})(this,function(t){"use strict";/**!
2
+ * Copyright (c) 2024, VTJ.PRO All rights reserved.
3
+ * @name @vtj/charts
4
+ * @author CHC chenhuachun1549@dingtalk.com
5
+ * @version 0.8.5
6
+ * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
+ */const i="0.8.5";function f(u,n,o){const e=Vue.ref();return Vue.onMounted(()=>{const s=Vue.unref(n);s&&(e.value||(e.value=Vue.markRaw(u.init(s))),e.value&&e.value.setOption(o.value||{}))}),Vue.onUnmounted(()=>{e.value&&e.value.dispose()}),Vue.watch(o,s=>{e.value&&e.value.setOption(s||{})},{deep:!0}),VueUse.useResizeObserver(n,VtjUtils.debounce(()=>{e.value&&e.value.resize()},150)),{echartsInstance:e}}const a=Vue.defineComponent({name:"XChart",props:{width:{type:String,default:"100%"},height:{type:String,default:"400px"},option:{type:Object}},setup(u){const{width:n,height:o,option:e}=Vue.toRefs(u),s=Vue.ref(),l=Vue.computed(()=>({width:n.value,height:o.value})),{echartsInstance:d}=f(echarts,s,e);return{chartRef:s,option:e,styles:l,echartsInstance:d}},render(){return Vue.h("div",{class:"x-chart",ref:"chartRef",style:this.styles})},expose:["chartRef","option","echartsInstance"]}),c=[a],r=Symbol("INSTALLED_KEY");function h(u){u[r]||(u[r]=!0,c.forEach(n=>{n.name&&u.component(n.name,n)}))}t.INSTALLED_KEY=r,t.VTJ_CHARTS_VERSION=i,t.XChart=a,t.components=c,t.install=h,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@vtj/charts",
3
+ "private": false,
4
+ "version": "0.8.6",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=16.0.0"
8
+ },
9
+ "dependencies": {
10
+ "@vueuse/core": "~10.9.0",
11
+ "echarts": "~5.5.0",
12
+ "@vtj/icons": "0.8.6",
13
+ "@vtj/utils": "0.8.6"
14
+ },
15
+ "devDependencies": {
16
+ "@vtj/cli": "0.8.2"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "types"
21
+ ],
22
+ "main": "dist/index.umd.js",
23
+ "module": "dist/index.mjs",
24
+ "types": "types/index.d.ts",
25
+ "exports": {
26
+ "./dist/style.css": "./dist/style.css",
27
+ ".": {
28
+ "types": "./types/index.d.ts",
29
+ "import": "./dist/index.mjs",
30
+ "require": "./dist/index.umd.js"
31
+ }
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "gitHead": "d03843144f07c2d98c1e0c72c8c6eb1117c01722",
37
+ "scripts": {
38
+ "build": "vue-tsc && vite build && npm run build:umd",
39
+ "build:umd": "cross-env UMD=true vite build",
40
+ "test": "vitest run",
41
+ "vitest": "vitest",
42
+ "coverage": "vitest run --coverage"
43
+ }
44
+ }
@@ -0,0 +1,42 @@
1
+ import { EChartsOption, ECharts } from 'echarts';
2
+ import { PropType, DefineComponent, Ref, ComputedRef, ComponentOptionsMixin, PublicProps, ExtractPropTypes } from 'vue';
3
+
4
+ export type ChartOption = EChartsOption;
5
+ export type EChartsInstance = ECharts;
6
+ declare const _default: DefineComponent<{
7
+ width: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ height: {
12
+ type: StringConstructor;
13
+ default: string;
14
+ };
15
+ option: {
16
+ type: PropType<EChartsOption>;
17
+ };
18
+ }, {
19
+ chartRef: Ref<any>;
20
+ option: Ref<EChartsOption | undefined>;
21
+ styles: ComputedRef<{
22
+ width: string;
23
+ height: string;
24
+ }>;
25
+ echartsInstance: Ref<ECharts | undefined>;
26
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
27
+ width: {
28
+ type: StringConstructor;
29
+ default: string;
30
+ };
31
+ height: {
32
+ type: StringConstructor;
33
+ default: string;
34
+ };
35
+ option: {
36
+ type: PropType<EChartsOption>;
37
+ };
38
+ }>>, {
39
+ width: string;
40
+ height: string;
41
+ }, {}>;
42
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { default as XChart } from './Chart';
2
+
3
+ export declare const components: any[];
4
+ export { XChart };
@@ -0,0 +1 @@
1
+ export * from './useChart';
@@ -0,0 +1,6 @@
1
+ import { ECharts, EChartsOption } from 'echarts';
2
+ import { MaybeRef, Ref } from 'vue';
3
+
4
+ export declare function useChart(echarts: any, el: MaybeRef<HTMLElement>, option: Ref<EChartsOption | undefined>): {
5
+ echartsInstance: Ref<ECharts | undefined>;
6
+ };
@@ -0,0 +1,3 @@
1
+
2
+ export { version as VTJ_CHARTS_VERSION } from './version';
3
+ export * from './components';
@@ -0,0 +1,5 @@
1
+ import { App } from 'vue';
2
+
3
+ export declare const INSTALLED_KEY: unique symbol;
4
+ export declare function install(app: App): void;
5
+ export * from './index';
@@ -0,0 +1,8 @@
1
+ /**!
2
+ * Copyright (c) 2024, VTJ.PRO All rights reserved.
3
+ * @name @vtj/charts
4
+ * @author CHC chenhuachun1549@dingtalk.com
5
+ * @version 0.8.5
6
+ * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
+ */
8
+ export declare const version = "0.8.5";