@vtj/ui 0.0.5 → 0.0.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/lib/cdn/index.cjs.js +1 -1
- package/lib/cdn/index.es.js +71 -52
- package/lib/cdn/index.umd.js +1 -1
- package/lib/index.cjs.js +1 -1
- package/lib/index.es.js +91 -72
- package/lib/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/XChart/Chart.vue +2 -2
- package/src/components/XChartBar/Bar.vue +2 -2
- package/src/components/XChartLine/Line.vue +2 -2
- package/src/components/XChartPie/Pie.vue +2 -2
- package/src/components/XElement/Element.vue +14 -0
- package/src/components/XElement/index.ts +8 -0
- package/src/index.ts +3 -1
- package/types/src/components/XChart/Chart.vue.d.ts +1 -1
- package/types/src/components/XChartBar/Bar.vue.d.ts +1 -1
- package/types/src/components/XChartLine/Line.vue.d.ts +1 -1
- package/types/src/components/XChartPie/Pie.vue.d.ts +1 -1
- package/types/src/components/XElement/Element.vue.d.ts +23 -0
- package/types/src/components/XElement/index.d.ts +2 -0
- package/types/src/index.d.ts +2 -1
package/lib/cdn/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var C=Object.defineProperty,F=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var v=(e,t,n)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))B.call(t,n)&&v(e,n,t[n]);if(k)for(var n of k(t))S.call(t,n)&&v(e,n,t[n]);return e},V=(e,t)=>F(e,x(t));var p=(e,t,n)=>new Promise((o,s)=>{var u=r=>{try{c(n.next(r))}catch(l){s(l)}},i=r=>{try{c(n.throw(r))}catch(l){s(l)}},c=r=>r.done?o(r.value):Promise.resolve(r.value).then(u,i);c((n=n.apply(e,t)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E={class:"x-test-suit"},w=Vue.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),X={class:"x-test-suit__body"},b={class:"x-test-suit_props"},A={class:"x-test-suit_slots"},N=Vue.createTextVNode(" Default Slot"),$={key:0},y=Vue.defineComponent({__name:"TestSuit",props:{p1:null,p2:null,p3:{type:Boolean},p4:null},emits:["click"],setup(e,{emit:t}){const n=e,o=Vue.computed(()=>[{name:"p1",value:n.p1},{name:"p2",value:n.p2},{name:"p3",value:n.p3},{name:"p4",value:n.p4}]),s=()=>{t("click")};return(u,i)=>(Vue.openBlock(),Vue.createElementBlock("div",E,[w,Vue.createElementVNode("div",X,[Vue.createElementVNode("div",b,[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(Vue.unref(o),c=>(Vue.openBlock(),Vue.createElementBlock("div",null,Vue.toDisplayString(c.name)+": "+Vue.toDisplayString(JSON.stringify(c.value)),1))),256))]),Vue.createElementVNode("div",{class:"x-test-suit_events"},[Vue.createElementVNode("button",{onClick:s},"Tigger Click Event")]),Vue.createElementVNode("div",A,[Vue.createElementVNode("div",null,[Vue.renderSlot(u.$slots,"default",{},()=>[N])]),u.$slots.footer?(Vue.openBlock(),Vue.createElementBlock("div",$,[Vue.renderSlot(u.$slots,"footer")])):Vue.createCommentVNode("",!0)])])]))}});y.install=function(e){e.component("XTestSuit",y)};const m=Vue.defineComponent({__name:"Element",props:{tag:{default:"div"}},setup(e){const t=e;return(n,o)=>(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(t.tag),null,{default:Vue.withCtx(()=>[Vue.renderSlot(n.$slots,"default")]),_:3}))}});m.install=function(e){e.component("XElement",m)};function T(e,t={}){const n=Vue.ref(!1);let o=null;const s=c=>p(this,null,function*(){o=echarts.init(e.value);const r=c||VtjUtils.merge({},t.option,t.optionFactory?yield t.optionFactory(t.option):{});o.setOption(r)}),u=()=>{o==null||o.dispose(),s()},i=VtjUtils.debounce(()=>{if(!n.value){n.value=!0;return}o==null||o.resize()},100);return Vue.onMounted(s),Vue.watch(()=>[t.option,t.optionFactory],u),VueUse.useResizeObserver(e,i),{getChart:()=>o,echarts,reset:u,resize:i}}const a=Vue.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(e,{expose:t}){const n=e,o=Vue.ref(),s=Vue.computed(()=>({width:n.width,height:n.height})),{getChart:u,reset:i,resize:c,echarts:r}=T(o,n);return t({getChart:u,echarts:r,reset:i,resize:c}),(l,j)=>(Vue.openBlock(),Vue.createElementBlock("div",{ref_key:"container",ref:o,style:Vue.normalizeStyle(Vue.unref(s))},"Chart",4))}});a.install=function(e){e.component("XChart",a)};function g(e,t){const n=s=>p(this,null,function*(){const u=V(d({},s),{title:{},xAxis:{},yAxis:{}});e.category==="x"?(u.xAxis={type:"category"},u.yAxis={}):(u.xAxis={},u.yAxis={type:"category"}),u.dataset={dimensions:e.dimensions,source:typeof e.source=="function"?yield e.source():e.source};const i=(e.dimensions||[]).length;if(i>1){const c=new Array(i-1);c.fill({type:t}),u.series=c}return VtjUtils.merge(u,e.optionFactory?yield e.optionFactory(u):{})}),o=Vue.ref(Symbol("key"));return Vue.watch(()=>[e.category,e.dimensions,e.source,e.optionFactory],()=>{o.value=Symbol("key")}),{optionFactory:n,key:o}}const f=Vue.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:n,key:o}=g(t,"bar");return(s,u)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(a),{key:Vue.unref(o),optionFactory:Vue.unref(n)},null,8,["optionFactory"]))}});f.install=function(e){e.component("XChartBar",f)};const _=Vue.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:n,key:o}=g(t,"line");return(s,u)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(a),{key:Vue.unref(o),optionFactory:Vue.unref(n)},null,8,["optionFactory"]))}});_.install=function(e){e.component("XChartLine",_)};const h=Vue.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,n=Vue.ref(Symbol("key")),o=s=>p(this,null,function*(){const u=V(d({},s),{dataset:{dimensions:t.dimensions,source:typeof t.source=="function"?yield t.source():t.source},series:[{type:"pie"}]});return VtjUtils.merge(u,t.optionFactory?yield t.optionFactory(u):{})});return Vue.watch(()=>[t.dimensions,t.source,t.optionFactory],()=>{n.value=Symbol("key")}),(s,u)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(a),{key:n.value,optionFactory:o}))}});h.install=function(e){e.component("XChartPie",h)};exports.XChart=a;exports.XChartBar=f;exports.XChartLine=_;exports.XChartPie=h;exports.XElement=m;exports.XTestSuit=y;
|
package/lib/cdn/index.es.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C = Object.defineProperty, F = Object.defineProperties;
|
|
2
2
|
var g = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var m = (e, t, n) => t in e ?
|
|
3
|
+
var y = Object.getOwnPropertySymbols;
|
|
4
|
+
var B = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var m = (e, t, n) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, d = (e, t) => {
|
|
6
6
|
for (var n in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var n of
|
|
10
|
-
|
|
7
|
+
B.call(t, n) && m(e, n, t[n]);
|
|
8
|
+
if (y)
|
|
9
|
+
for (var n of y(t))
|
|
10
|
+
E.call(t, n) && m(e, n, t[n]);
|
|
11
11
|
return e;
|
|
12
|
-
},
|
|
12
|
+
}, V = (e, t) => F(e, g(t));
|
|
13
13
|
var p = (e, t, n) => new Promise((o, u) => {
|
|
14
|
-
var s = (
|
|
14
|
+
var s = (r) => {
|
|
15
15
|
try {
|
|
16
|
-
c(n.next(
|
|
16
|
+
c(n.next(r));
|
|
17
17
|
} catch (l) {
|
|
18
18
|
u(l);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, i = (r) => {
|
|
21
21
|
try {
|
|
22
|
-
c(n.throw(
|
|
22
|
+
c(n.throw(r));
|
|
23
23
|
} catch (l) {
|
|
24
24
|
u(l);
|
|
25
25
|
}
|
|
26
|
-
}, c = (
|
|
26
|
+
}, c = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(s, i);
|
|
27
27
|
c((n = n.apply(e, t)).next());
|
|
28
28
|
});
|
|
29
|
-
const S = { class: "x-test-suit" },
|
|
29
|
+
const S = { class: "x-test-suit" }, w = /* @__PURE__ */ Vue.createElementVNode("div", { class: "x-test-suit__header" }, "XTestSuit", -1), X = { class: "x-test-suit__body" }, A = { class: "x-test-suit_props" }, N = { class: "x-test-suit_slots" }, b = /* @__PURE__ */ Vue.createTextVNode(" Default Slot"), $ = { key: 0 }, f = /* @__PURE__ */ Vue.defineComponent({
|
|
30
30
|
__name: "TestSuit",
|
|
31
31
|
props: {
|
|
32
32
|
p1: null,
|
|
@@ -44,22 +44,22 @@ const S = { class: "x-test-suit" }, E = /* @__PURE__ */ Vue.createElementVNode("
|
|
|
44
44
|
]), u = () => {
|
|
45
45
|
t("click");
|
|
46
46
|
};
|
|
47
|
-
return (s,
|
|
48
|
-
|
|
49
|
-
Vue.createElementVNode("div",
|
|
50
|
-
Vue.createElementVNode("div",
|
|
47
|
+
return (s, i) => (Vue.openBlock(), Vue.createElementBlock("div", S, [
|
|
48
|
+
w,
|
|
49
|
+
Vue.createElementVNode("div", X, [
|
|
50
|
+
Vue.createElementVNode("div", A, [
|
|
51
51
|
(Vue.openBlock(!0), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(Vue.unref(o), (c) => (Vue.openBlock(), Vue.createElementBlock("div", null, Vue.toDisplayString(c.name) + ": " + Vue.toDisplayString(JSON.stringify(c.value)), 1))), 256))
|
|
52
52
|
]),
|
|
53
53
|
Vue.createElementVNode("div", { class: "x-test-suit_events" }, [
|
|
54
54
|
Vue.createElementVNode("button", { onClick: u }, "Tigger Click Event")
|
|
55
55
|
]),
|
|
56
|
-
Vue.createElementVNode("div",
|
|
56
|
+
Vue.createElementVNode("div", N, [
|
|
57
57
|
Vue.createElementVNode("div", null, [
|
|
58
58
|
Vue.renderSlot(s.$slots, "default", {}, () => [
|
|
59
|
-
|
|
59
|
+
b
|
|
60
60
|
])
|
|
61
61
|
]),
|
|
62
|
-
s.$slots.footer ? (Vue.openBlock(), Vue.createElementBlock("div",
|
|
62
|
+
s.$slots.footer ? (Vue.openBlock(), Vue.createElementBlock("div", $, [
|
|
63
63
|
Vue.renderSlot(s.$slots, "footer")
|
|
64
64
|
])) : Vue.createCommentVNode("", !0)
|
|
65
65
|
])
|
|
@@ -70,31 +70,49 @@ const S = { class: "x-test-suit" }, E = /* @__PURE__ */ Vue.createElementVNode("
|
|
|
70
70
|
f.install = function(e) {
|
|
71
71
|
e.component("XTestSuit", f);
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
const _ = /* @__PURE__ */ Vue.defineComponent({
|
|
74
|
+
__name: "Element",
|
|
75
|
+
props: {
|
|
76
|
+
tag: { default: "div" }
|
|
77
|
+
},
|
|
78
|
+
setup(e) {
|
|
79
|
+
const t = e;
|
|
80
|
+
return (n, o) => (Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(t.tag), null, {
|
|
81
|
+
default: Vue.withCtx(() => [
|
|
82
|
+
Vue.renderSlot(n.$slots, "default")
|
|
83
|
+
]),
|
|
84
|
+
_: 3
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
_.install = function(e) {
|
|
89
|
+
e.component("XElement", _);
|
|
90
|
+
};
|
|
91
|
+
function T(e, t = {}) {
|
|
74
92
|
const n = Vue.ref(!1);
|
|
75
93
|
let o = null;
|
|
76
94
|
const u = (c) => p(this, null, function* () {
|
|
77
95
|
o = echarts.init(e.value);
|
|
78
|
-
const
|
|
96
|
+
const r = c || VtjUtils.merge(
|
|
79
97
|
{},
|
|
80
98
|
t.option,
|
|
81
99
|
t.optionFactory ? yield t.optionFactory(t.option) : {}
|
|
82
100
|
);
|
|
83
|
-
o.setOption(
|
|
101
|
+
o.setOption(r);
|
|
84
102
|
}), s = () => {
|
|
85
103
|
o == null || o.dispose(), u();
|
|
86
|
-
},
|
|
104
|
+
}, i = VtjUtils.debounce(() => {
|
|
87
105
|
if (!n.value) {
|
|
88
106
|
n.value = !0;
|
|
89
107
|
return;
|
|
90
108
|
}
|
|
91
109
|
o == null || o.resize();
|
|
92
110
|
}, 100);
|
|
93
|
-
return Vue.onMounted(u), Vue.watch(() => [t.option, t.optionFactory], s), VueUse.useResizeObserver(e,
|
|
111
|
+
return Vue.onMounted(u), Vue.watch(() => [t.option, t.optionFactory], s), VueUse.useResizeObserver(e, i), {
|
|
94
112
|
getChart: () => o,
|
|
95
113
|
echarts,
|
|
96
114
|
reset: s,
|
|
97
|
-
resize:
|
|
115
|
+
resize: i
|
|
98
116
|
};
|
|
99
117
|
}
|
|
100
118
|
const a = /* @__PURE__ */ Vue.defineComponent({
|
|
@@ -109,13 +127,13 @@ const a = /* @__PURE__ */ Vue.defineComponent({
|
|
|
109
127
|
const n = e, o = Vue.ref(), u = Vue.computed(() => ({
|
|
110
128
|
width: n.width,
|
|
111
129
|
height: n.height
|
|
112
|
-
})), { getChart: s, reset:
|
|
130
|
+
})), { getChart: s, reset: i, resize: c, echarts: r } = T(o, n);
|
|
113
131
|
return t({
|
|
114
132
|
getChart: s,
|
|
115
|
-
echarts:
|
|
116
|
-
reset:
|
|
133
|
+
echarts: r,
|
|
134
|
+
reset: i,
|
|
117
135
|
resize: c
|
|
118
|
-
}), (l,
|
|
136
|
+
}), (l, z) => (Vue.openBlock(), Vue.createElementBlock("div", {
|
|
119
137
|
ref_key: "container",
|
|
120
138
|
ref: o,
|
|
121
139
|
style: Vue.normalizeStyle(Vue.unref(u))
|
|
@@ -125,9 +143,9 @@ const a = /* @__PURE__ */ Vue.defineComponent({
|
|
|
125
143
|
a.install = function(e) {
|
|
126
144
|
e.component("XChart", a);
|
|
127
145
|
};
|
|
128
|
-
function
|
|
146
|
+
function x(e, t) {
|
|
129
147
|
const n = (u) => p(this, null, function* () {
|
|
130
|
-
const s = d(
|
|
148
|
+
const s = V(d({}, u), {
|
|
131
149
|
title: {},
|
|
132
150
|
xAxis: {},
|
|
133
151
|
yAxis: {}
|
|
@@ -136,9 +154,9 @@ function F(e, t) {
|
|
|
136
154
|
dimensions: e.dimensions,
|
|
137
155
|
source: typeof e.source == "function" ? yield e.source() : e.source
|
|
138
156
|
};
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
141
|
-
const c = new Array(
|
|
157
|
+
const i = (e.dimensions || []).length;
|
|
158
|
+
if (i > 1) {
|
|
159
|
+
const c = new Array(i - 1);
|
|
142
160
|
c.fill({ type: t }), s.series = c;
|
|
143
161
|
}
|
|
144
162
|
return VtjUtils.merge(
|
|
@@ -156,7 +174,7 @@ function F(e, t) {
|
|
|
156
174
|
key: o
|
|
157
175
|
};
|
|
158
176
|
}
|
|
159
|
-
const
|
|
177
|
+
const h = /* @__PURE__ */ Vue.defineComponent({
|
|
160
178
|
__name: "Bar",
|
|
161
179
|
props: {
|
|
162
180
|
category: { default: "x" },
|
|
@@ -165,17 +183,17 @@ const _ = /* @__PURE__ */ Vue.defineComponent({
|
|
|
165
183
|
optionFactory: null
|
|
166
184
|
},
|
|
167
185
|
setup(e) {
|
|
168
|
-
const t = e, { optionFactory: n, key: o } =
|
|
186
|
+
const t = e, { optionFactory: n, key: o } = x(t, "bar");
|
|
169
187
|
return (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
|
|
170
188
|
key: Vue.unref(o),
|
|
171
189
|
optionFactory: Vue.unref(n)
|
|
172
190
|
}, null, 8, ["optionFactory"]));
|
|
173
191
|
}
|
|
174
192
|
});
|
|
175
|
-
|
|
176
|
-
e.component("XChartBar",
|
|
193
|
+
h.install = function(e) {
|
|
194
|
+
e.component("XChartBar", h);
|
|
177
195
|
};
|
|
178
|
-
const
|
|
196
|
+
const k = /* @__PURE__ */ Vue.defineComponent({
|
|
179
197
|
__name: "Line",
|
|
180
198
|
props: {
|
|
181
199
|
category: { default: "x" },
|
|
@@ -184,17 +202,17 @@ const h = /* @__PURE__ */ Vue.defineComponent({
|
|
|
184
202
|
optionFactory: null
|
|
185
203
|
},
|
|
186
204
|
setup(e) {
|
|
187
|
-
const t = e, { optionFactory: n, key: o } =
|
|
205
|
+
const t = e, { optionFactory: n, key: o } = x(t, "line");
|
|
188
206
|
return (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
|
|
189
207
|
key: Vue.unref(o),
|
|
190
208
|
optionFactory: Vue.unref(n)
|
|
191
209
|
}, null, 8, ["optionFactory"]));
|
|
192
210
|
}
|
|
193
211
|
});
|
|
194
|
-
|
|
195
|
-
e.component("XChartLine",
|
|
212
|
+
k.install = function(e) {
|
|
213
|
+
e.component("XChartLine", k);
|
|
196
214
|
};
|
|
197
|
-
const
|
|
215
|
+
const v = /* @__PURE__ */ Vue.defineComponent({
|
|
198
216
|
__name: "Pie",
|
|
199
217
|
props: {
|
|
200
218
|
dimensions: { default: () => [] },
|
|
@@ -203,7 +221,7 @@ const k = /* @__PURE__ */ Vue.defineComponent({
|
|
|
203
221
|
},
|
|
204
222
|
setup(e) {
|
|
205
223
|
const t = e, n = Vue.ref(Symbol("key")), o = (u) => p(this, null, function* () {
|
|
206
|
-
const s = d(
|
|
224
|
+
const s = V(d({}, u), {
|
|
207
225
|
dataset: {
|
|
208
226
|
dimensions: t.dimensions,
|
|
209
227
|
source: typeof t.source == "function" ? yield t.source() : t.source
|
|
@@ -230,13 +248,14 @@ const k = /* @__PURE__ */ Vue.defineComponent({
|
|
|
230
248
|
}));
|
|
231
249
|
}
|
|
232
250
|
});
|
|
233
|
-
|
|
234
|
-
e.component("XChartPie",
|
|
251
|
+
v.install = function(e) {
|
|
252
|
+
e.component("XChartPie", v);
|
|
235
253
|
};
|
|
236
254
|
export {
|
|
237
255
|
a as XChart,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
256
|
+
h as XChartBar,
|
|
257
|
+
k as XChartLine,
|
|
258
|
+
v as XChartPie,
|
|
259
|
+
_ as XElement,
|
|
241
260
|
f as XTestSuit
|
|
242
261
|
};
|
package/lib/cdn/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(o,i){typeof exports=="object"&&typeof module!="undefined"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(o=typeof globalThis!="undefined"?globalThis:o||self,i(o.VtjUI={}))})(this,function(o){"use strict";var A=Object.defineProperty,N=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var X=(o,i,c)=>i in o?A(o,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[i]=c,x=(o,i)=>{for(var c in i||(i={}))$.call(i,c)&&X(o,c,i[c]);if(w)for(var c of w(i))j.call(i,c)&&X(o,c,i[c]);return o},S=(o,i)=>N(o,T(i));var m=(o,i,c)=>new Promise((_,y)=>{var h=a=>{try{f(c.next(a))}catch(p){y(p)}},k=a=>{try{f(c.throw(a))}catch(p){y(p)}},f=a=>a.done?_(a.value):Promise.resolve(a.value).then(h,k);f((c=c.apply(o,i)).next())});const i="",c={class:"x-test-suit"},_=Vue.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),y={class:"x-test-suit__body"},h={class:"x-test-suit_props"},k={class:"x-test-suit_slots"},f=Vue.createTextVNode(" Default Slot"),a={key:0},p=Vue.defineComponent({__name:"TestSuit",props:{p1:null,p2:null,p3:{type:Boolean},p4:null},emits:["click"],setup(e,{emit:t}){const s=e,n=Vue.computed(()=>[{name:"p1",value:s.p1},{name:"p2",value:s.p2},{name:"p3",value:s.p3},{name:"p4",value:s.p4}]),r=()=>{t("click")};return(u,d)=>(Vue.openBlock(),Vue.createElementBlock("div",c,[_,Vue.createElementVNode("div",y,[Vue.createElementVNode("div",h,[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(Vue.unref(n),l=>(Vue.openBlock(),Vue.createElementBlock("div",null,Vue.toDisplayString(l.name)+": "+Vue.toDisplayString(JSON.stringify(l.value)),1))),256))]),Vue.createElementVNode("div",{class:"x-test-suit_events"},[Vue.createElementVNode("button",{onClick:r},"Tigger Click Event")]),Vue.createElementVNode("div",k,[Vue.createElementVNode("div",null,[Vue.renderSlot(u.$slots,"default",{},()=>[f])]),u.$slots.footer?(Vue.openBlock(),Vue.createElementBlock("div",a,[Vue.renderSlot(u.$slots,"footer")])):Vue.createCommentVNode("",!0)])])]))}});p.install=function(e){e.component("XTestSuit",p)};const v=Vue.defineComponent({__name:"Element",props:{tag:{default:"div"}},setup(e){const t=e;return(s,n)=>(Vue.openBlock(),Vue.createBlock(Vue.resolveDynamicComponent(t.tag),null,{default:Vue.withCtx(()=>[Vue.renderSlot(s.$slots,"default")]),_:3}))}});v.install=function(e){e.component("XElement",v)};function b(e,t={}){const s=Vue.ref(!1);let n=null;const r=l=>m(this,null,function*(){n=echarts.init(e.value);const B=l||VtjUtils.merge({},t.option,t.optionFactory?yield t.optionFactory(t.option):{});n.setOption(B)}),u=()=>{n==null||n.dispose(),r()},d=VtjUtils.debounce(()=>{if(!s.value){s.value=!0;return}n==null||n.resize()},100);return Vue.onMounted(r),Vue.watch(()=>[t.option,t.optionFactory],u),VueUse.useResizeObserver(e,d),{getChart:()=>n,echarts,reset:u,resize:d}}const V=Vue.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(e,{expose:t}){const s=e,n=Vue.ref(),r=Vue.computed(()=>({width:s.width,height:s.height})),{getChart:u,reset:d,resize:l,echarts:B}=b(n,s);return t({getChart:u,echarts:B,reset:d,resize:l}),(U,z)=>(Vue.openBlock(),Vue.createElementBlock("div",{ref_key:"container",ref:n,style:Vue.normalizeStyle(Vue.unref(r))},"Chart",4))}});V.install=function(e){e.component("XChart",V)};function E(e,t){const s=r=>m(this,null,function*(){const u=S(x({},r),{title:{},xAxis:{},yAxis:{}});e.category==="x"?(u.xAxis={type:"category"},u.yAxis={}):(u.xAxis={},u.yAxis={type:"category"}),u.dataset={dimensions:e.dimensions,source:typeof e.source=="function"?yield e.source():e.source};const d=(e.dimensions||[]).length;if(d>1){const l=new Array(d-1);l.fill({type:t}),u.series=l}return VtjUtils.merge(u,e.optionFactory?yield e.optionFactory(u):{})}),n=Vue.ref(Symbol("key"));return Vue.watch(()=>[e.category,e.dimensions,e.source,e.optionFactory],()=>{n.value=Symbol("key")}),{optionFactory:s,key:n}}const g=Vue.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:s,key:n}=E(t,"bar");return(r,u)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(V),{key:Vue.unref(n),optionFactory:Vue.unref(s)},null,8,["optionFactory"]))}});g.install=function(e){e.component("XChartBar",g)};const C=Vue.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:s,key:n}=E(t,"line");return(r,u)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(V),{key:Vue.unref(n),optionFactory:Vue.unref(s)},null,8,["optionFactory"]))}});C.install=function(e){e.component("XChartLine",C)};const F=Vue.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,s=Vue.ref(Symbol("key")),n=r=>m(this,null,function*(){const u=S(x({},r),{dataset:{dimensions:t.dimensions,source:typeof t.source=="function"?yield t.source():t.source},series:[{type:"pie"}]});return VtjUtils.merge(u,t.optionFactory?yield t.optionFactory(u):{})});return Vue.watch(()=>[t.dimensions,t.source,t.optionFactory],()=>{s.value=Symbol("key")}),(r,u)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(V),{key:s.value,optionFactory:n}))}});F.install=function(e){e.component("XChartPie",F)},o.XChart=V,o.XChartBar=g,o.XChartLine=C,o.XChartPie=F,o.XElement=v,o.XTestSuit=p,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/lib/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var S=Object.defineProperty,b=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var F=(t,n,o)=>n in t?S(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,m=(t,n)=>{for(var o in n||(n={}))w.call(n,o)&&F(t,o,n[o]);if(C)for(var o of C(n))X.call(n,o)&&F(t,o,n[o]);return t},f=(t,n)=>b(t,E(n));var d=(t,n,o)=>new Promise((r,s)=>{var c=a=>{try{i(o.next(a))}catch(p){s(p)}},l=a=>{try{i(o.throw(a))}catch(p){s(p)}},i=a=>a.done?r(a.value):Promise.resolve(a.value).then(c,l);i((o=o.apply(t,n)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("echarts"),A=require("@vueuse/core"),y=require("@vtj/utils");function O(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const x=O(N);const V={class:"x-test-suit"},$=e.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),T={class:"x-test-suit__body"},j={class:"x-test-suit_props"},z={class:"x-test-suit_slots"},P=e.createTextVNode(" Default Slot"),D={key:0},_=e.defineComponent({__name:"TestSuit",props:{p1:null,p2:null,p3:{type:Boolean},p4:null},emits:["click"],setup(t,{emit:n}){const o=t,r=e.computed(()=>[{name:"p1",value:o.p1},{name:"p2",value:o.p2},{name:"p3",value:o.p3},{name:"p4",value:o.p4}]),s=()=>{n("click")};return(c,l)=>(e.openBlock(),e.createElementBlock("div",V,[$,e.createElementVNode("div",T,[e.createElementVNode("div",j,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),i=>(e.openBlock(),e.createElementBlock("div",null,e.toDisplayString(i.name)+": "+e.toDisplayString(JSON.stringify(i.value)),1))),256))]),e.createElementVNode("div",{class:"x-test-suit_events"},[e.createElementVNode("button",{onClick:s},"Tigger Click Event")]),e.createElementVNode("div",z,[e.createElementVNode("div",null,[e.renderSlot(c.$slots,"default",{},()=>[P])]),c.$slots.footer?(e.openBlock(),e.createElementBlock("div",D,[e.renderSlot(c.$slots,"footer")])):e.createCommentVNode("",!0)])])]))}});_.install=function(t){t.component("XTestSuit",_)};const h=e.defineComponent({__name:"Element",props:{tag:{default:"div"}},setup(t){const n=t;return(o,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.tag),null,{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3}))}});h.install=function(t){t.component("XElement",h)};function L(t,n={}){const o=e.ref(!1);let r=null;const s=i=>d(this,null,function*(){r=x.init(t.value);const a=i||y.merge({},n.option,n.optionFactory?yield n.optionFactory(n.option):{});r.setOption(a)}),c=()=>{r==null||r.dispose(),s()},l=y.debounce(()=>{if(!o.value){o.value=!0;return}r==null||r.resize()},100);return e.onMounted(s),e.watch(()=>[n.option,n.optionFactory],c),A.useResizeObserver(t,l),{getChart:()=>r,echarts:x,reset:c,resize:l}}const u=e.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(t,{expose:n}){const o=t,r=e.ref(),s=e.computed(()=>({width:o.width,height:o.height})),{getChart:c,reset:l,resize:i,echarts:a}=L(r,o);return n({getChart:c,echarts:a,reset:l,resize:i}),(p,M)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"container",ref:r,style:e.normalizeStyle(e.unref(s))},"Chart",4))}});u.install=function(t){t.component("XChart",u)};function B(t,n){const o=s=>d(this,null,function*(){const c=f(m({},s),{title:{},xAxis:{},yAxis:{}});t.category==="x"?(c.xAxis={type:"category"},c.yAxis={}):(c.xAxis={},c.yAxis={type:"category"}),c.dataset={dimensions:t.dimensions,source:typeof t.source=="function"?yield t.source():t.source};const l=(t.dimensions||[]).length;if(l>1){const i=new Array(l-1);i.fill({type:n}),c.series=i}return y.merge(c,t.optionFactory?yield t.optionFactory(c):{})}),r=e.ref(Symbol("key"));return e.watch(()=>[t.category,t.dimensions,t.source,t.optionFactory],()=>{r.value=Symbol("key")}),{optionFactory:o,key:r}}const k=e.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(t){const n=t,{optionFactory:o,key:r}=B(n,"bar");return(s,c)=>(e.openBlock(),e.createBlock(e.unref(u),{key:e.unref(r),optionFactory:e.unref(o)},null,8,["optionFactory"]))}});k.install=function(t){t.component("XChartBar",k)};const v=e.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(t){const n=t,{optionFactory:o,key:r}=B(n,"line");return(s,c)=>(e.openBlock(),e.createBlock(e.unref(u),{key:e.unref(r),optionFactory:e.unref(o)},null,8,["optionFactory"]))}});v.install=function(t){t.component("XChartLine",v)};const g=e.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(t){const n=t,o=e.ref(Symbol("key")),r=s=>d(this,null,function*(){const c=f(m({},s),{dataset:{dimensions:n.dimensions,source:typeof n.source=="function"?yield n.source():n.source},series:[{type:"pie"}]});return y.merge(c,n.optionFactory?yield n.optionFactory(c):{})});return e.watch(()=>[n.dimensions,n.source,n.optionFactory],()=>{o.value=Symbol("key")}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(u),{key:o.value,optionFactory:r}))}});g.install=function(t){t.component("XChartPie",g)};exports.XChart=u;exports.XChartBar=k;exports.XChartLine=v;exports.XChartPie=g;exports.XElement=h;exports.XTestSuit=_;
|
package/lib/index.es.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
var
|
|
1
|
+
var N = Object.defineProperty, D = Object.defineProperties;
|
|
2
2
|
var O = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var S = Object.getOwnPropertySymbols;
|
|
4
4
|
var P = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var
|
|
5
|
+
var X = (t, e, o) => e in t ? N(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, x = (t, e) => {
|
|
6
6
|
for (var o in e || (e = {}))
|
|
7
|
-
P.call(e, o) &&
|
|
8
|
-
if (
|
|
9
|
-
for (var o of
|
|
10
|
-
V.call(e, o) &&
|
|
7
|
+
P.call(e, o) && X(t, o, e[o]);
|
|
8
|
+
if (S)
|
|
9
|
+
for (var o of S(e))
|
|
10
|
+
V.call(e, o) && X(t, o, e[o]);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
12
|
+
}, F = (t, e) => D(t, O(e));
|
|
13
13
|
var f = (t, e, o) => new Promise((n, i) => {
|
|
14
|
-
var s = (
|
|
14
|
+
var s = (r) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
16
|
+
a(o.next(r));
|
|
17
17
|
} catch (_) {
|
|
18
18
|
i(_);
|
|
19
19
|
}
|
|
20
|
-
}, c = (
|
|
20
|
+
}, c = (r) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
a(o.throw(r));
|
|
23
23
|
} catch (_) {
|
|
24
24
|
i(_);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, a = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(s, c);
|
|
27
|
+
a((o = o.apply(t, e)).next());
|
|
28
28
|
});
|
|
29
|
-
import { defineComponent as
|
|
29
|
+
import { defineComponent as y, computed as z, openBlock as u, createElementBlock as d, createElementVNode as p, Fragment as R, renderList as J, unref as l, toDisplayString as w, renderSlot as g, createCommentVNode as M, createTextVNode as j, createBlock as h, resolveDynamicComponent as q, withCtx as G, ref as v, onMounted as H, watch as k, normalizeStyle as I } from "vue";
|
|
30
30
|
import * as A from "echarts";
|
|
31
|
-
import { useResizeObserver as
|
|
32
|
-
import { debounce as
|
|
33
|
-
const
|
|
31
|
+
import { useResizeObserver as K } from "@vueuse/core";
|
|
32
|
+
import { debounce as Q, merge as C } from "@vtj/utils";
|
|
33
|
+
const U = { class: "x-test-suit" }, W = /* @__PURE__ */ p("div", { class: "x-test-suit__header" }, "XTestSuit", -1), Y = { class: "x-test-suit__body" }, Z = { class: "x-test-suit_props" }, tt = { class: "x-test-suit_slots" }, et = /* @__PURE__ */ j(" Default Slot"), ot = { key: 0 }, b = /* @__PURE__ */ y({
|
|
34
34
|
__name: "TestSuit",
|
|
35
35
|
props: {
|
|
36
36
|
p1: null,
|
|
@@ -48,24 +48,24 @@ const I = { class: "x-test-suit" }, K = /* @__PURE__ */ y("div", { class: "x-tes
|
|
|
48
48
|
]), i = () => {
|
|
49
49
|
e("click");
|
|
50
50
|
};
|
|
51
|
-
return (s, c) => (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(
|
|
51
|
+
return (s, c) => (u(), d("div", U, [
|
|
52
|
+
W,
|
|
53
|
+
p("div", Y, [
|
|
54
|
+
p("div", Z, [
|
|
55
|
+
(u(!0), d(R, null, J(l(n), (a) => (u(), d("div", null, w(a.name) + ": " + w(JSON.stringify(a.value)), 1))), 256))
|
|
56
56
|
]),
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
p("div", { class: "x-test-suit_events" }, [
|
|
58
|
+
p("button", { onClick: i }, "Tigger Click Event")
|
|
59
59
|
]),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
p("div", tt, [
|
|
61
|
+
p("div", null, [
|
|
62
|
+
g(s.$slots, "default", {}, () => [
|
|
63
|
+
et
|
|
64
64
|
])
|
|
65
65
|
]),
|
|
66
|
-
s.$slots.footer ? (
|
|
67
|
-
|
|
68
|
-
])) :
|
|
66
|
+
s.$slots.footer ? (u(), d("div", ot, [
|
|
67
|
+
g(s.$slots, "footer")
|
|
68
|
+
])) : M("", !0)
|
|
69
69
|
])
|
|
70
70
|
])
|
|
71
71
|
]));
|
|
@@ -74,34 +74,52 @@ const I = { class: "x-test-suit" }, K = /* @__PURE__ */ y("div", { class: "x-tes
|
|
|
74
74
|
b.install = function(t) {
|
|
75
75
|
t.component("XTestSuit", b);
|
|
76
76
|
};
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const $ = /* @__PURE__ */ y({
|
|
78
|
+
__name: "Element",
|
|
79
|
+
props: {
|
|
80
|
+
tag: { default: "div" }
|
|
81
|
+
},
|
|
82
|
+
setup(t) {
|
|
83
|
+
const e = t;
|
|
84
|
+
return (o, n) => (u(), h(q(e.tag), null, {
|
|
85
|
+
default: G(() => [
|
|
86
|
+
g(o.$slots, "default")
|
|
87
|
+
]),
|
|
88
|
+
_: 3
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
$.install = function(t) {
|
|
93
|
+
t.component("XElement", $);
|
|
94
|
+
};
|
|
95
|
+
function nt(t, e = {}) {
|
|
96
|
+
const o = v(!1);
|
|
79
97
|
let n = null;
|
|
80
|
-
const i = (
|
|
98
|
+
const i = (a) => f(this, null, function* () {
|
|
81
99
|
n = A.init(t.value);
|
|
82
|
-
const
|
|
100
|
+
const r = a || C(
|
|
83
101
|
{},
|
|
84
102
|
e.option,
|
|
85
103
|
e.optionFactory ? yield e.optionFactory(e.option) : {}
|
|
86
104
|
);
|
|
87
|
-
n.setOption(
|
|
105
|
+
n.setOption(r);
|
|
88
106
|
}), s = () => {
|
|
89
107
|
n == null || n.dispose(), i();
|
|
90
|
-
}, c =
|
|
108
|
+
}, c = Q(() => {
|
|
91
109
|
if (!o.value) {
|
|
92
110
|
o.value = !0;
|
|
93
111
|
return;
|
|
94
112
|
}
|
|
95
113
|
n == null || n.resize();
|
|
96
114
|
}, 100);
|
|
97
|
-
return
|
|
115
|
+
return H(i), k(() => [e.option, e.optionFactory], s), K(t, c), {
|
|
98
116
|
getChart: () => n,
|
|
99
117
|
echarts: A,
|
|
100
118
|
reset: s,
|
|
101
119
|
resize: c
|
|
102
120
|
};
|
|
103
121
|
}
|
|
104
|
-
const
|
|
122
|
+
const m = /* @__PURE__ */ y({
|
|
105
123
|
__name: "Chart",
|
|
106
124
|
props: {
|
|
107
125
|
width: { default: "100%" },
|
|
@@ -110,28 +128,28 @@ const d = /* @__PURE__ */ m({
|
|
|
110
128
|
optionFactory: null
|
|
111
129
|
},
|
|
112
130
|
setup(t, { expose: e }) {
|
|
113
|
-
const o = t, n =
|
|
131
|
+
const o = t, n = v(), i = z(() => ({
|
|
114
132
|
width: o.width,
|
|
115
133
|
height: o.height
|
|
116
|
-
})), { getChart: s, reset: c, resize:
|
|
134
|
+
})), { getChart: s, reset: c, resize: a, echarts: r } = nt(n, o);
|
|
117
135
|
return e({
|
|
118
136
|
getChart: s,
|
|
119
|
-
echarts:
|
|
137
|
+
echarts: r,
|
|
120
138
|
reset: c,
|
|
121
|
-
resize:
|
|
122
|
-
}), (_,
|
|
139
|
+
resize: a
|
|
140
|
+
}), (_, st) => (u(), d("div", {
|
|
123
141
|
ref_key: "container",
|
|
124
142
|
ref: n,
|
|
125
|
-
style:
|
|
143
|
+
style: I(l(i))
|
|
126
144
|
}, "Chart", 4));
|
|
127
145
|
}
|
|
128
146
|
});
|
|
129
|
-
|
|
130
|
-
t.component("XChart",
|
|
147
|
+
m.install = function(t) {
|
|
148
|
+
t.component("XChart", m);
|
|
131
149
|
};
|
|
132
150
|
function L(t, e) {
|
|
133
151
|
const o = (i) => f(this, null, function* () {
|
|
134
|
-
const s =
|
|
152
|
+
const s = F(x({}, i), {
|
|
135
153
|
title: {},
|
|
136
154
|
xAxis: {},
|
|
137
155
|
yAxis: {}
|
|
@@ -142,15 +160,15 @@ function L(t, e) {
|
|
|
142
160
|
};
|
|
143
161
|
const c = (t.dimensions || []).length;
|
|
144
162
|
if (c > 1) {
|
|
145
|
-
const
|
|
146
|
-
|
|
163
|
+
const a = new Array(c - 1);
|
|
164
|
+
a.fill({ type: e }), s.series = a;
|
|
147
165
|
}
|
|
148
|
-
return
|
|
166
|
+
return C(
|
|
149
167
|
s,
|
|
150
168
|
t.optionFactory ? yield t.optionFactory(s) : {}
|
|
151
169
|
);
|
|
152
|
-
}), n =
|
|
153
|
-
return
|
|
170
|
+
}), n = v(Symbol("key"));
|
|
171
|
+
return k(
|
|
154
172
|
() => [t.category, t.dimensions, t.source, t.optionFactory],
|
|
155
173
|
() => {
|
|
156
174
|
n.value = Symbol("key");
|
|
@@ -160,7 +178,7 @@ function L(t, e) {
|
|
|
160
178
|
key: n
|
|
161
179
|
};
|
|
162
180
|
}
|
|
163
|
-
const B = /* @__PURE__ */
|
|
181
|
+
const B = /* @__PURE__ */ y({
|
|
164
182
|
__name: "Bar",
|
|
165
183
|
props: {
|
|
166
184
|
category: { default: "x" },
|
|
@@ -170,16 +188,16 @@ const B = /* @__PURE__ */ m({
|
|
|
170
188
|
},
|
|
171
189
|
setup(t) {
|
|
172
190
|
const e = t, { optionFactory: o, key: n } = L(e, "bar");
|
|
173
|
-
return (i, s) => (
|
|
174
|
-
key:
|
|
175
|
-
optionFactory:
|
|
191
|
+
return (i, s) => (u(), h(l(m), {
|
|
192
|
+
key: l(n),
|
|
193
|
+
optionFactory: l(o)
|
|
176
194
|
}, null, 8, ["optionFactory"]));
|
|
177
195
|
}
|
|
178
196
|
});
|
|
179
197
|
B.install = function(t) {
|
|
180
198
|
t.component("XChartBar", B);
|
|
181
199
|
};
|
|
182
|
-
const
|
|
200
|
+
const E = /* @__PURE__ */ y({
|
|
183
201
|
__name: "Line",
|
|
184
202
|
props: {
|
|
185
203
|
category: { default: "x" },
|
|
@@ -189,16 +207,16 @@ const $ = /* @__PURE__ */ m({
|
|
|
189
207
|
},
|
|
190
208
|
setup(t) {
|
|
191
209
|
const e = t, { optionFactory: o, key: n } = L(e, "line");
|
|
192
|
-
return (i, s) => (
|
|
193
|
-
key:
|
|
194
|
-
optionFactory:
|
|
210
|
+
return (i, s) => (u(), h(l(m), {
|
|
211
|
+
key: l(n),
|
|
212
|
+
optionFactory: l(o)
|
|
195
213
|
}, null, 8, ["optionFactory"]));
|
|
196
214
|
}
|
|
197
215
|
});
|
|
198
|
-
|
|
199
|
-
t.component("XChartLine",
|
|
216
|
+
E.install = function(t) {
|
|
217
|
+
t.component("XChartLine", E);
|
|
200
218
|
};
|
|
201
|
-
const T = /* @__PURE__ */
|
|
219
|
+
const T = /* @__PURE__ */ y({
|
|
202
220
|
__name: "Pie",
|
|
203
221
|
props: {
|
|
204
222
|
dimensions: { default: () => [] },
|
|
@@ -206,8 +224,8 @@ const T = /* @__PURE__ */ m({
|
|
|
206
224
|
optionFactory: null
|
|
207
225
|
},
|
|
208
226
|
setup(t) {
|
|
209
|
-
const e = t, o =
|
|
210
|
-
const s =
|
|
227
|
+
const e = t, o = v(Symbol("key")), n = (i) => f(this, null, function* () {
|
|
228
|
+
const s = F(x({}, i), {
|
|
211
229
|
dataset: {
|
|
212
230
|
dimensions: e.dimensions,
|
|
213
231
|
source: typeof e.source == "function" ? yield e.source() : e.source
|
|
@@ -218,17 +236,17 @@ const T = /* @__PURE__ */ m({
|
|
|
218
236
|
}
|
|
219
237
|
]
|
|
220
238
|
});
|
|
221
|
-
return
|
|
239
|
+
return C(
|
|
222
240
|
s,
|
|
223
241
|
e.optionFactory ? yield e.optionFactory(s) : {}
|
|
224
242
|
);
|
|
225
243
|
});
|
|
226
|
-
return
|
|
244
|
+
return k(
|
|
227
245
|
() => [e.dimensions, e.source, e.optionFactory],
|
|
228
246
|
() => {
|
|
229
247
|
o.value = Symbol("key");
|
|
230
248
|
}
|
|
231
|
-
), (i, s) => (
|
|
249
|
+
), (i, s) => (u(), h(l(m), {
|
|
232
250
|
key: o.value,
|
|
233
251
|
optionFactory: n
|
|
234
252
|
}));
|
|
@@ -238,9 +256,10 @@ T.install = function(t) {
|
|
|
238
256
|
t.component("XChartPie", T);
|
|
239
257
|
};
|
|
240
258
|
export {
|
|
241
|
-
|
|
259
|
+
m as XChart,
|
|
242
260
|
B as XChartBar,
|
|
243
|
-
|
|
261
|
+
E as XChartLine,
|
|
244
262
|
T as XChartPie,
|
|
263
|
+
$ as XElement,
|
|
245
264
|
b as XTestSuit
|
|
246
265
|
};
|
package/lib/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(o,
|
|
1
|
+
(function(o,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("echarts"),require("@vueuse/core"),require("@vtj/utils")):typeof define=="function"&&define.amd?define(["exports","vue","echarts","@vueuse/core","@vtj/utils"],t):(o=typeof globalThis!="undefined"?globalThis:o||self,t(o.VtjUI={},o.vue,o.echarts,o.core,o.utils))})(this,function(o,t,i,k,p){"use strict";var P=Object.defineProperty,D=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var A=(o,t,i)=>t in o?P(o,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[t]=i,b=(o,t)=>{for(var i in t||(t={}))M.call(t,i)&&A(o,i,t[i]);if(N)for(var i of N(t))q.call(t,i)&&A(o,i,t[i]);return o},w=(o,t)=>D(o,L(t));var h=(o,t,i)=>new Promise((k,p)=>{var g=l=>{try{_(i.next(l))}catch(y){p(y)}},m=l=>{try{_(i.throw(l))}catch(y){p(y)}},_=l=>l.done?k(l.value):Promise.resolve(l.value).then(g,m);_((i=i.apply(o,t)).next())});function g(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,c.get?c:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const m=g(i),_="",l={class:"x-test-suit"},y=t.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),T={class:"x-test-suit__body"},V={class:"x-test-suit_props"},j={class:"x-test-suit_slots"},O=t.createTextVNode(" Default Slot"),$={key:0},C=t.defineComponent({__name:"TestSuit",props:{p1:null,p2:null,p3:{type:Boolean},p4:null},emits:["click"],setup(e,{emit:n}){const r=e,c=t.computed(()=>[{name:"p1",value:r.p1},{name:"p2",value:r.p2},{name:"p3",value:r.p3},{name:"p4",value:r.p4}]),a=()=>{n("click")};return(s,d)=>(t.openBlock(),t.createElementBlock("div",l,[y,t.createElementVNode("div",T,[t.createElementVNode("div",V,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(c),u=>(t.openBlock(),t.createElementBlock("div",null,t.toDisplayString(u.name)+": "+t.toDisplayString(JSON.stringify(u.value)),1))),256))]),t.createElementVNode("div",{class:"x-test-suit_events"},[t.createElementVNode("button",{onClick:a},"Tigger Click Event")]),t.createElementVNode("div",j,[t.createElementVNode("div",null,[t.renderSlot(s.$slots,"default",{},()=>[O])]),s.$slots.footer?(t.openBlock(),t.createElementBlock("div",$,[t.renderSlot(s.$slots,"footer")])):t.createCommentVNode("",!0)])])]))}});C.install=function(e){e.component("XTestSuit",C)};const F=t.defineComponent({__name:"Element",props:{tag:{default:"div"}},setup(e){const n=e;return(r,c)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.tag),null,{default:t.withCtx(()=>[t.renderSlot(r.$slots,"default")]),_:3}))}});F.install=function(e){e.component("XElement",F)};function z(e,n={}){const r=t.ref(!1);let c=null;const a=u=>h(this,null,function*(){c=m.init(e.value);const E=u||p.merge({},n.option,n.optionFactory?yield n.optionFactory(n.option):{});c.setOption(E)}),s=()=>{c==null||c.dispose(),a()},d=p.debounce(()=>{if(!r.value){r.value=!0;return}c==null||c.resize()},100);return t.onMounted(a),t.watch(()=>[n.option,n.optionFactory],s),k.useResizeObserver(e,d),{getChart:()=>c,echarts:m,reset:s,resize:d}}const f=t.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(e,{expose:n}){const r=e,c=t.ref(),a=t.computed(()=>({width:r.width,height:r.height})),{getChart:s,reset:d,resize:u,echarts:E}=z(c,r);return n({getChart:s,echarts:E,reset:d,resize:u}),(R,I)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:c,style:t.normalizeStyle(t.unref(a))},"Chart",4))}});f.install=function(e){e.component("XChart",f)};function X(e,n){const r=a=>h(this,null,function*(){const s=w(b({},a),{title:{},xAxis:{},yAxis:{}});e.category==="x"?(s.xAxis={type:"category"},s.yAxis={}):(s.xAxis={},s.yAxis={type:"category"}),s.dataset={dimensions:e.dimensions,source:typeof e.source=="function"?yield e.source():e.source};const d=(e.dimensions||[]).length;if(d>1){const u=new Array(d-1);u.fill({type:n}),s.series=u}return p.merge(s,e.optionFactory?yield e.optionFactory(s):{})}),c=t.ref(Symbol("key"));return t.watch(()=>[e.category,e.dimensions,e.source,e.optionFactory],()=>{c.value=Symbol("key")}),{optionFactory:r,key:c}}const B=t.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const n=e,{optionFactory:r,key:c}=X(n,"bar");return(a,s)=>(t.openBlock(),t.createBlock(t.unref(f),{key:t.unref(c),optionFactory:t.unref(r)},null,8,["optionFactory"]))}});B.install=function(e){e.component("XChartBar",B)};const x=t.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const n=e,{optionFactory:r,key:c}=X(n,"line");return(a,s)=>(t.openBlock(),t.createBlock(t.unref(f),{key:t.unref(c),optionFactory:t.unref(r)},null,8,["optionFactory"]))}});x.install=function(e){e.component("XChartLine",x)};const S=t.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const n=e,r=t.ref(Symbol("key")),c=a=>h(this,null,function*(){const s=w(b({},a),{dataset:{dimensions:n.dimensions,source:typeof n.source=="function"?yield n.source():n.source},series:[{type:"pie"}]});return p.merge(s,n.optionFactory?yield n.optionFactory(s):{})});return t.watch(()=>[n.dimensions,n.source,n.optionFactory],()=>{r.value=Symbol("key")}),(a,s)=>(t.openBlock(),t.createBlock(t.unref(f),{key:r.value,optionFactory:c}))}});S.install=function(e){e.component("XChartPie",S)},o.XChart=f,o.XChartBar=B,o.XChartLine=x,o.XChartPie=S,o.XElement=F,o.XTestSuit=C,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -9,14 +9,14 @@ export type IOptionFactory = (
|
|
|
9
9
|
opt?: Record<string, any>
|
|
10
10
|
) => Promise<Record<string, any>>;
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface IProps {
|
|
13
13
|
width?: string;
|
|
14
14
|
height?: string;
|
|
15
15
|
option?: Record<string, any>;
|
|
16
16
|
optionFactory?: IOptionFactory;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const props = withDefaults(defineProps<
|
|
19
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
20
20
|
width: '100%',
|
|
21
21
|
height: '400px',
|
|
22
22
|
option: () => ({})
|
|
@@ -10,14 +10,14 @@ export type IOptionFactory = (
|
|
|
10
10
|
opt?: Record<string, any>
|
|
11
11
|
) => Promise<Record<string, any>>;
|
|
12
12
|
|
|
13
|
-
export interface
|
|
13
|
+
export interface IProps {
|
|
14
14
|
category?: 'x' | 'y';
|
|
15
15
|
dimensions?: string[];
|
|
16
16
|
source?: ISourceType | (() => Promise<ISourceType>);
|
|
17
17
|
optionFactory?: IOptionFactory;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const props = withDefaults(defineProps<
|
|
20
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
21
21
|
category: 'x',
|
|
22
22
|
dimensions: () => [],
|
|
23
23
|
source: () => []
|
|
@@ -10,14 +10,14 @@ export type IOptionFactory = (
|
|
|
10
10
|
opt?: Record<string, any>
|
|
11
11
|
) => Promise<Record<string, any>>;
|
|
12
12
|
|
|
13
|
-
export interface
|
|
13
|
+
export interface IProps {
|
|
14
14
|
category?: 'x' | 'y';
|
|
15
15
|
dimensions?: string[];
|
|
16
16
|
source?: ISourceType | (() => Promise<ISourceType>);
|
|
17
17
|
optionFactory?: IOptionFactory;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const props = withDefaults(defineProps<
|
|
20
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
21
21
|
category: 'x',
|
|
22
22
|
dimensions: () => [],
|
|
23
23
|
source: () => []
|
|
@@ -11,13 +11,13 @@ export type IOptionFactory = (
|
|
|
11
11
|
opt?: Record<string, any>
|
|
12
12
|
) => Promise<Record<string, any>>;
|
|
13
13
|
|
|
14
|
-
export interface
|
|
14
|
+
export interface IProps {
|
|
15
15
|
dimensions?: string[];
|
|
16
16
|
source?: ISourceType | (() => Promise<ISourceType>);
|
|
17
17
|
optionFactory?: IOptionFactory;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const props = withDefaults(defineProps<
|
|
20
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
21
21
|
dimensions: () => [],
|
|
22
22
|
source: () => []
|
|
23
23
|
});
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './theme/index.scss';
|
|
2
2
|
import { App } from 'vue';
|
|
3
3
|
import XTestSuit from './components/XTestSuit';
|
|
4
|
+
import XElement from './components/XElement';
|
|
4
5
|
import XChart from './components/XChart';
|
|
5
6
|
import XChartBar from './components/XChartBar';
|
|
6
7
|
import XChartLine from './components/XChartLine';
|
|
@@ -8,6 +9,7 @@ import XChartPie from './components/XChartPie';
|
|
|
8
9
|
|
|
9
10
|
const components: Record<string, any> = {
|
|
10
11
|
XTestSuit,
|
|
12
|
+
XElement,
|
|
11
13
|
XChart,
|
|
12
14
|
XChartBar,
|
|
13
15
|
XChartLine,
|
|
@@ -20,4 +22,4 @@ components.install = function (app: App) {
|
|
|
20
22
|
});
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
export { XTestSuit, XChart, XChartBar, XChartLine, XChartPie };
|
|
25
|
+
export { XElement, XTestSuit, XChart, XChartBar, XChartLine, XChartPie };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare type ISourceType = Array<Record<string, any>>;
|
|
2
2
|
export declare type IOptionFactory = (opt?: Record<string, any>) => Promise<Record<string, any>>;
|
|
3
|
-
export interface
|
|
3
|
+
export interface IProps {
|
|
4
4
|
category?: 'x' | 'y';
|
|
5
5
|
dimensions?: string[];
|
|
6
6
|
source?: ISourceType | (() => Promise<ISourceType>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare type ISourceType = Array<Record<string, any>>;
|
|
2
2
|
export declare type IOptionFactory = (opt?: Record<string, any>) => Promise<Record<string, any>>;
|
|
3
|
-
export interface
|
|
3
|
+
export interface IProps {
|
|
4
4
|
category?: 'x' | 'y';
|
|
5
5
|
dimensions?: string[];
|
|
6
6
|
source?: ISourceType | (() => Promise<ISourceType>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare type ISourceType = Array<Record<string, any>>;
|
|
2
2
|
export declare type IOptionFactory = (opt?: Record<string, any>) => Promise<Record<string, any>>;
|
|
3
|
-
export interface
|
|
3
|
+
export interface IProps {
|
|
4
4
|
dimensions?: string[];
|
|
5
5
|
source?: ISourceType | (() => Promise<ISourceType>);
|
|
6
6
|
optionFactory?: IOptionFactory;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface IProps {
|
|
2
|
+
tag?: string;
|
|
3
|
+
}
|
|
4
|
+
declare const _sfc_main: import("vue").DefineComponent<{
|
|
5
|
+
tag: {
|
|
6
|
+
type: StringConstructor;
|
|
7
|
+
required: false;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
props: {
|
|
12
|
+
tag: string;
|
|
13
|
+
};
|
|
14
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
tag: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
required: false;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
}>>, {
|
|
21
|
+
tag: string;
|
|
22
|
+
}>;
|
|
23
|
+
export default _sfc_main;
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import XTestSuit from './components/XTestSuit';
|
|
2
|
+
import XElement from './components/XElement';
|
|
2
3
|
import XChart from './components/XChart';
|
|
3
4
|
import XChartBar from './components/XChartBar';
|
|
4
5
|
import XChartLine from './components/XChartLine';
|
|
5
6
|
import XChartPie from './components/XChartPie';
|
|
6
|
-
export { XTestSuit, XChart, XChartBar, XChartLine, XChartPie };
|
|
7
|
+
export { XElement, XTestSuit, XChart, XChartBar, XChartLine, XChartPie };
|