@vtj/ui 0.0.6 → 0.4.1
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 +21 -0
- package/cdn/index.js +1 -0
- package/cdn/style.css +1 -0
- package/lib/index.js +2039 -0
- package/lib/style.css +1 -1
- package/package.json +24 -33
- package/types/components/block/Block.vue.d.ts +143 -0
- package/types/components/block/block.d.ts +68 -0
- package/types/components/block/index.d.ts +319 -0
- package/types/components/config/Config.d.ts +26 -0
- package/types/components/config/index.d.ts +19 -0
- package/types/components/config/props.d.ts +6 -0
- package/types/components/container/Container.vue.d.ts +52 -0
- package/types/components/container/container.d.ts +46 -0
- package/types/components/container/index.d.ts +159 -0
- package/types/components/cron/Cron.vue.d.ts +9 -0
- package/types/components/cron/cron.d.ts +23 -0
- package/types/components/cron/index.d.ts +11 -0
- package/types/components/dialog/Dialog.vue.d.ts +289 -0
- package/types/components/dialog/create.d.ts +6 -0
- package/types/components/dialog/dialog.d.ts +155 -0
- package/types/components/dialog/hooks.d.ts +927 -0
- package/types/components/dialog/index.d.ts +638 -0
- package/types/components/element/Element.d.ts +25 -0
- package/types/components/element/index.d.ts +21 -0
- package/types/components/field/Field.vue.d.ts +802 -0
- package/types/components/field/field.d.ts +230 -0
- package/types/components/field/hooks.d.ts +23 -0
- package/types/components/field/index.d.ts +2034 -0
- package/types/components/field/setters/InputSetter.d.ts +45 -0
- package/types/components/field/setters/SelectSetter.d.ts +45 -0
- package/types/components/field/setters/factory.d.ts +54 -0
- package/types/components/field/setters/index.d.ts +93 -0
- package/types/components/form/Form.vue.d.ts +5352 -0
- package/types/components/form/form.d.ts +384 -0
- package/types/components/form/hooks.d.ts +1906 -0
- package/types/components/form/index.d.ts +15373 -0
- package/types/components/help/Help.vue.d.ts +315 -0
- package/types/components/help/help.d.ts +172 -0
- package/types/components/help/hooks.d.ts +18 -0
- package/types/components/help/index.d.ts +316 -0
- package/types/components/icon/Icon.vue.d.ts +52 -0
- package/types/components/icon/icon.d.ts +30 -0
- package/types/components/icon/index.d.ts +166 -0
- package/types/components/index.d.ts +16 -0
- package/types/components/page/Page.vue.d.ts +22 -0
- package/types/components/page/index.d.ts +118 -0
- package/types/components/page/page.d.ts +9 -0
- package/types/components/panel/Panel.vue.d.ts +573 -0
- package/types/components/panel/index.d.ts +1207 -0
- package/types/components/panel/panel.d.ts +227 -0
- package/types/components/text/Text.vue.d.ts +52 -0
- package/types/components/text/index.d.ts +165 -0
- package/types/components/text/text.d.ts +37 -0
- package/types/components/tool/Tool.vue.d.ts +158 -0
- package/types/components/tool/Trigger.d.ts +29 -0
- package/types/components/tool/hooks.d.ts +250 -0
- package/types/components/tool/index.d.ts +371 -0
- package/types/components/tool/tool.d.ts +91 -0
- package/types/components/toolbar/Toolbar.vue.d.ts +44 -0
- package/types/components/toolbar/hooks.d.ts +14 -0
- package/types/components/toolbar/index.d.ts +161 -0
- package/types/components/toolbar/toolbar.d.ts +45 -0
- package/types/components/wrapper/Wrapper.vue.d.ts +268 -0
- package/types/components/wrapper/index.d.ts +601 -0
- package/types/components/wrapper/wrapper.d.ts +145 -0
- package/types/constants.d.ts +4 -0
- package/types/hooks/index.d.ts +4 -0
- package/types/hooks/useConfig.d.ts +5 -0
- package/types/hooks/useDraggable.d.ts +13 -0
- package/types/hooks/useIcon.d.ts +4 -0
- package/types/hooks/useResizable.d.ts +25 -0
- package/types/index.d.ts +13 -4
- package/types/list.d.ts +21588 -0
- package/types/utils/emits.d.ts +6 -0
- package/types/utils/index.d.ts +4 -0
- package/types/utils/install.d.ts +9 -0
- package/types/utils/make-install.d.ts +5 -0
- package/types/utils/util.d.ts +8 -0
- package/README.md +0 -4
- package/lib/cdn/index.cjs.js +0 -1
- package/lib/cdn/index.es.js +0 -261
- package/lib/cdn/index.umd.js +0 -1
- package/lib/cdn/style.css +0 -1
- package/lib/index.cjs.js +0 -1
- package/lib/index.es.js +0 -265
- package/lib/index.umd.js +0 -1
- package/src/components/XChart/Chart.vue +0 -42
- package/src/components/XChart/index.ts +0 -8
- package/src/components/XChart/style.scss +0 -0
- package/src/components/XChartBar/Bar.vue +0 -27
- package/src/components/XChartBar/index.ts +0 -8
- package/src/components/XChartLine/Line.vue +0 -27
- package/src/components/XChartLine/index.ts +0 -8
- package/src/components/XChartPie/Pie.vue +0 -54
- package/src/components/XChartPie/index.ts +0 -8
- package/src/components/XElement/Element.vue +0 -14
- package/src/components/XElement/index.ts +0 -8
- package/src/components/XTestSuit/TestSuit.vue +0 -47
- package/src/components/XTestSuit/index.ts +0 -8
- package/src/components/XTestSuit/style.scss +0 -14
- package/src/hooks/useECharts.ts +0 -55
- package/src/hooks/useRectChart.ts +0 -46
- package/src/index.ts +0 -25
- package/src/theme/_vars.scss +0 -8
- package/src/theme/base.scss +0 -0
- package/src/theme/index.scss +0 -4
- package/types/dev/vite-env.d.ts +0 -7
- package/types/src/components/XChart/Chart.vue.d.ts +0 -69
- package/types/src/components/XChart/index.d.ts +0 -2
- package/types/src/components/XChartBar/Bar.vue.d.ts +0 -124
- package/types/src/components/XChartBar/index.d.ts +0 -2
- package/types/src/components/XChartLine/Line.vue.d.ts +0 -124
- package/types/src/components/XChartLine/index.d.ts +0 -2
- package/types/src/components/XChartPie/Pie.vue.d.ts +0 -111
- package/types/src/components/XChartPie/index.d.ts +0 -2
- package/types/src/components/XElement/Element.vue.d.ts +0 -23
- package/types/src/components/XElement/index.d.ts +0 -2
- package/types/src/components/XTestSuit/TestSuit.vue.d.ts +0 -59
- package/types/src/components/XTestSuit/index.d.ts +0 -2
- package/types/src/hooks/useECharts.d.ts +0 -15
- package/types/src/hooks/useRectChart.d.ts +0 -4
- package/types/src/index.d.ts +0 -7
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
|
|
2
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
3
|
+
export type Emits<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options> = Options extends Array<infer V> ? (event: V, ...args: any[]) => void : {} extends Options ? (event: string, ...args: any[]) => void : UnionToIntersection<{
|
|
4
|
+
[key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => void : (event: key, ...args: any[]) => void;
|
|
5
|
+
}[Event]>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Directive, AppContext, Plugin } from 'vue';
|
|
2
|
+
export type WithInstall<T> = T & Plugin;
|
|
3
|
+
export type InstallWithContext<T> = WithInstall<T> & {
|
|
4
|
+
_context: AppContext | null;
|
|
5
|
+
};
|
|
6
|
+
export declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E | undefined) => WithInstall<T> & E;
|
|
7
|
+
export declare const withInstallFunction: <T>(fn: T, name: string) => InstallWithContext<T>;
|
|
8
|
+
export declare const withInstallDirective: <T extends Directive>(directive: T, name: string) => WithInstall<T>;
|
|
9
|
+
export declare const withNoopInstall: <T>(component: T) => WithInstall<T>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type UnReadOnly<T> = {
|
|
2
|
+
-readonly [P in keyof T]: T[P];
|
|
3
|
+
};
|
|
4
|
+
export declare function getSizeValue(value: string | number): string;
|
|
5
|
+
export declare function parseSize(size: string | number | undefined, max: number): number;
|
|
6
|
+
export declare function omit<T extends Record<string, any>, K extends Record<string, any>>(target: T, keys: string[]): K;
|
|
7
|
+
export declare function pick<T extends Record<string, any>, K extends Record<string, any>>(target: T, keys: string[]): K;
|
|
8
|
+
export declare const NOOP: () => void;
|
package/README.md
DELETED
package/lib/cdn/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
var C = Object.defineProperty, F = Object.defineProperties;
|
|
2
|
-
var g = Object.getOwnPropertyDescriptors;
|
|
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
|
-
for (var n in t || (t = {}))
|
|
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
|
-
return e;
|
|
12
|
-
}, V = (e, t) => F(e, g(t));
|
|
13
|
-
var p = (e, t, n) => new Promise((o, u) => {
|
|
14
|
-
var s = (r) => {
|
|
15
|
-
try {
|
|
16
|
-
c(n.next(r));
|
|
17
|
-
} catch (l) {
|
|
18
|
-
u(l);
|
|
19
|
-
}
|
|
20
|
-
}, i = (r) => {
|
|
21
|
-
try {
|
|
22
|
-
c(n.throw(r));
|
|
23
|
-
} catch (l) {
|
|
24
|
-
u(l);
|
|
25
|
-
}
|
|
26
|
-
}, c = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(s, i);
|
|
27
|
-
c((n = n.apply(e, t)).next());
|
|
28
|
-
});
|
|
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
|
-
__name: "TestSuit",
|
|
31
|
-
props: {
|
|
32
|
-
p1: null,
|
|
33
|
-
p2: null,
|
|
34
|
-
p3: { type: Boolean },
|
|
35
|
-
p4: null
|
|
36
|
-
},
|
|
37
|
-
emits: ["click"],
|
|
38
|
-
setup(e, { emit: t }) {
|
|
39
|
-
const n = e, o = Vue.computed(() => [
|
|
40
|
-
{ name: "p1", value: n.p1 },
|
|
41
|
-
{ name: "p2", value: n.p2 },
|
|
42
|
-
{ name: "p3", value: n.p3 },
|
|
43
|
-
{ name: "p4", value: n.p4 }
|
|
44
|
-
]), u = () => {
|
|
45
|
-
t("click");
|
|
46
|
-
};
|
|
47
|
-
return (s, i) => (Vue.openBlock(), Vue.createElementBlock("div", S, [
|
|
48
|
-
w,
|
|
49
|
-
Vue.createElementVNode("div", X, [
|
|
50
|
-
Vue.createElementVNode("div", A, [
|
|
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
|
-
]),
|
|
53
|
-
Vue.createElementVNode("div", { class: "x-test-suit_events" }, [
|
|
54
|
-
Vue.createElementVNode("button", { onClick: u }, "Tigger Click Event")
|
|
55
|
-
]),
|
|
56
|
-
Vue.createElementVNode("div", N, [
|
|
57
|
-
Vue.createElementVNode("div", null, [
|
|
58
|
-
Vue.renderSlot(s.$slots, "default", {}, () => [
|
|
59
|
-
b
|
|
60
|
-
])
|
|
61
|
-
]),
|
|
62
|
-
s.$slots.footer ? (Vue.openBlock(), Vue.createElementBlock("div", $, [
|
|
63
|
-
Vue.renderSlot(s.$slots, "footer")
|
|
64
|
-
])) : Vue.createCommentVNode("", !0)
|
|
65
|
-
])
|
|
66
|
-
])
|
|
67
|
-
]));
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
f.install = function(e) {
|
|
71
|
-
e.component("XTestSuit", f);
|
|
72
|
-
};
|
|
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 = {}) {
|
|
92
|
-
const n = Vue.ref(!1);
|
|
93
|
-
let o = null;
|
|
94
|
-
const u = (c) => p(this, null, function* () {
|
|
95
|
-
o = echarts.init(e.value);
|
|
96
|
-
const r = c || VtjUtils.merge(
|
|
97
|
-
{},
|
|
98
|
-
t.option,
|
|
99
|
-
t.optionFactory ? yield t.optionFactory(t.option) : {}
|
|
100
|
-
);
|
|
101
|
-
o.setOption(r);
|
|
102
|
-
}), s = () => {
|
|
103
|
-
o == null || o.dispose(), u();
|
|
104
|
-
}, i = VtjUtils.debounce(() => {
|
|
105
|
-
if (!n.value) {
|
|
106
|
-
n.value = !0;
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
o == null || o.resize();
|
|
110
|
-
}, 100);
|
|
111
|
-
return Vue.onMounted(u), Vue.watch(() => [t.option, t.optionFactory], s), VueUse.useResizeObserver(e, i), {
|
|
112
|
-
getChart: () => o,
|
|
113
|
-
echarts,
|
|
114
|
-
reset: s,
|
|
115
|
-
resize: i
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
const a = /* @__PURE__ */ Vue.defineComponent({
|
|
119
|
-
__name: "Chart",
|
|
120
|
-
props: {
|
|
121
|
-
width: { default: "100%" },
|
|
122
|
-
height: { default: "400px" },
|
|
123
|
-
option: { default: () => ({}) },
|
|
124
|
-
optionFactory: null
|
|
125
|
-
},
|
|
126
|
-
setup(e, { expose: t }) {
|
|
127
|
-
const n = e, o = Vue.ref(), u = Vue.computed(() => ({
|
|
128
|
-
width: n.width,
|
|
129
|
-
height: n.height
|
|
130
|
-
})), { getChart: s, reset: i, resize: c, echarts: r } = T(o, n);
|
|
131
|
-
return t({
|
|
132
|
-
getChart: s,
|
|
133
|
-
echarts: r,
|
|
134
|
-
reset: i,
|
|
135
|
-
resize: c
|
|
136
|
-
}), (l, z) => (Vue.openBlock(), Vue.createElementBlock("div", {
|
|
137
|
-
ref_key: "container",
|
|
138
|
-
ref: o,
|
|
139
|
-
style: Vue.normalizeStyle(Vue.unref(u))
|
|
140
|
-
}, "Chart", 4));
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
a.install = function(e) {
|
|
144
|
-
e.component("XChart", a);
|
|
145
|
-
};
|
|
146
|
-
function x(e, t) {
|
|
147
|
-
const n = (u) => p(this, null, function* () {
|
|
148
|
-
const s = V(d({}, u), {
|
|
149
|
-
title: {},
|
|
150
|
-
xAxis: {},
|
|
151
|
-
yAxis: {}
|
|
152
|
-
});
|
|
153
|
-
e.category === "x" ? (s.xAxis = { type: "category" }, s.yAxis = {}) : (s.xAxis = {}, s.yAxis = { type: "category" }), s.dataset = {
|
|
154
|
-
dimensions: e.dimensions,
|
|
155
|
-
source: typeof e.source == "function" ? yield e.source() : e.source
|
|
156
|
-
};
|
|
157
|
-
const i = (e.dimensions || []).length;
|
|
158
|
-
if (i > 1) {
|
|
159
|
-
const c = new Array(i - 1);
|
|
160
|
-
c.fill({ type: t }), s.series = c;
|
|
161
|
-
}
|
|
162
|
-
return VtjUtils.merge(
|
|
163
|
-
s,
|
|
164
|
-
e.optionFactory ? yield e.optionFactory(s) : {}
|
|
165
|
-
);
|
|
166
|
-
}), o = Vue.ref(Symbol("key"));
|
|
167
|
-
return Vue.watch(
|
|
168
|
-
() => [e.category, e.dimensions, e.source, e.optionFactory],
|
|
169
|
-
() => {
|
|
170
|
-
o.value = Symbol("key");
|
|
171
|
-
}
|
|
172
|
-
), {
|
|
173
|
-
optionFactory: n,
|
|
174
|
-
key: o
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
const h = /* @__PURE__ */ Vue.defineComponent({
|
|
178
|
-
__name: "Bar",
|
|
179
|
-
props: {
|
|
180
|
-
category: { default: "x" },
|
|
181
|
-
dimensions: { default: () => [] },
|
|
182
|
-
source: { type: [Array, Function], default: () => [] },
|
|
183
|
-
optionFactory: null
|
|
184
|
-
},
|
|
185
|
-
setup(e) {
|
|
186
|
-
const t = e, { optionFactory: n, key: o } = x(t, "bar");
|
|
187
|
-
return (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
|
|
188
|
-
key: Vue.unref(o),
|
|
189
|
-
optionFactory: Vue.unref(n)
|
|
190
|
-
}, null, 8, ["optionFactory"]));
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
h.install = function(e) {
|
|
194
|
-
e.component("XChartBar", h);
|
|
195
|
-
};
|
|
196
|
-
const k = /* @__PURE__ */ Vue.defineComponent({
|
|
197
|
-
__name: "Line",
|
|
198
|
-
props: {
|
|
199
|
-
category: { default: "x" },
|
|
200
|
-
dimensions: { default: () => [] },
|
|
201
|
-
source: { type: [Array, Function], default: () => [] },
|
|
202
|
-
optionFactory: null
|
|
203
|
-
},
|
|
204
|
-
setup(e) {
|
|
205
|
-
const t = e, { optionFactory: n, key: o } = x(t, "line");
|
|
206
|
-
return (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
|
|
207
|
-
key: Vue.unref(o),
|
|
208
|
-
optionFactory: Vue.unref(n)
|
|
209
|
-
}, null, 8, ["optionFactory"]));
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
k.install = function(e) {
|
|
213
|
-
e.component("XChartLine", k);
|
|
214
|
-
};
|
|
215
|
-
const v = /* @__PURE__ */ Vue.defineComponent({
|
|
216
|
-
__name: "Pie",
|
|
217
|
-
props: {
|
|
218
|
-
dimensions: { default: () => [] },
|
|
219
|
-
source: { type: [Array, Function], default: () => [] },
|
|
220
|
-
optionFactory: null
|
|
221
|
-
},
|
|
222
|
-
setup(e) {
|
|
223
|
-
const t = e, n = Vue.ref(Symbol("key")), o = (u) => p(this, null, function* () {
|
|
224
|
-
const s = V(d({}, u), {
|
|
225
|
-
dataset: {
|
|
226
|
-
dimensions: t.dimensions,
|
|
227
|
-
source: typeof t.source == "function" ? yield t.source() : t.source
|
|
228
|
-
},
|
|
229
|
-
series: [
|
|
230
|
-
{
|
|
231
|
-
type: "pie"
|
|
232
|
-
}
|
|
233
|
-
]
|
|
234
|
-
});
|
|
235
|
-
return VtjUtils.merge(
|
|
236
|
-
s,
|
|
237
|
-
t.optionFactory ? yield t.optionFactory(s) : {}
|
|
238
|
-
);
|
|
239
|
-
});
|
|
240
|
-
return Vue.watch(
|
|
241
|
-
() => [t.dimensions, t.source, t.optionFactory],
|
|
242
|
-
() => {
|
|
243
|
-
n.value = Symbol("key");
|
|
244
|
-
}
|
|
245
|
-
), (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
|
|
246
|
-
key: n.value,
|
|
247
|
-
optionFactory: o
|
|
248
|
-
}));
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
v.install = function(e) {
|
|
252
|
-
e.component("XChartPie", v);
|
|
253
|
-
};
|
|
254
|
-
export {
|
|
255
|
-
a as XChart,
|
|
256
|
-
h as XChartBar,
|
|
257
|
-
k as XChartLine,
|
|
258
|
-
v as XChartPie,
|
|
259
|
-
_ as XElement,
|
|
260
|
-
f as XTestSuit
|
|
261
|
-
};
|
package/lib/cdn/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/cdn/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.x-test-suit{width:100%;height:100%;border:1px solid #ccc}.x-test-suit__header{padding:5px 10px;background-color:#efefef}.x-test-suit__body{padding:10px}
|
package/lib/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
var N = Object.defineProperty, D = Object.defineProperties;
|
|
2
|
-
var O = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var S = Object.getOwnPropertySymbols;
|
|
4
|
-
var P = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
|
|
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
|
-
for (var o in e || (e = {}))
|
|
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
|
-
return t;
|
|
12
|
-
}, F = (t, e) => D(t, O(e));
|
|
13
|
-
var f = (t, e, o) => new Promise((n, i) => {
|
|
14
|
-
var s = (r) => {
|
|
15
|
-
try {
|
|
16
|
-
a(o.next(r));
|
|
17
|
-
} catch (_) {
|
|
18
|
-
i(_);
|
|
19
|
-
}
|
|
20
|
-
}, c = (r) => {
|
|
21
|
-
try {
|
|
22
|
-
a(o.throw(r));
|
|
23
|
-
} catch (_) {
|
|
24
|
-
i(_);
|
|
25
|
-
}
|
|
26
|
-
}, a = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(s, c);
|
|
27
|
-
a((o = o.apply(t, e)).next());
|
|
28
|
-
});
|
|
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
|
-
import * as A from "echarts";
|
|
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
|
-
__name: "TestSuit",
|
|
35
|
-
props: {
|
|
36
|
-
p1: null,
|
|
37
|
-
p2: null,
|
|
38
|
-
p3: { type: Boolean },
|
|
39
|
-
p4: null
|
|
40
|
-
},
|
|
41
|
-
emits: ["click"],
|
|
42
|
-
setup(t, { emit: e }) {
|
|
43
|
-
const o = t, n = z(() => [
|
|
44
|
-
{ name: "p1", value: o.p1 },
|
|
45
|
-
{ name: "p2", value: o.p2 },
|
|
46
|
-
{ name: "p3", value: o.p3 },
|
|
47
|
-
{ name: "p4", value: o.p4 }
|
|
48
|
-
]), i = () => {
|
|
49
|
-
e("click");
|
|
50
|
-
};
|
|
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
|
-
]),
|
|
57
|
-
p("div", { class: "x-test-suit_events" }, [
|
|
58
|
-
p("button", { onClick: i }, "Tigger Click Event")
|
|
59
|
-
]),
|
|
60
|
-
p("div", tt, [
|
|
61
|
-
p("div", null, [
|
|
62
|
-
g(s.$slots, "default", {}, () => [
|
|
63
|
-
et
|
|
64
|
-
])
|
|
65
|
-
]),
|
|
66
|
-
s.$slots.footer ? (u(), d("div", ot, [
|
|
67
|
-
g(s.$slots, "footer")
|
|
68
|
-
])) : M("", !0)
|
|
69
|
-
])
|
|
70
|
-
])
|
|
71
|
-
]));
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
b.install = function(t) {
|
|
75
|
-
t.component("XTestSuit", b);
|
|
76
|
-
};
|
|
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);
|
|
97
|
-
let n = null;
|
|
98
|
-
const i = (a) => f(this, null, function* () {
|
|
99
|
-
n = A.init(t.value);
|
|
100
|
-
const r = a || C(
|
|
101
|
-
{},
|
|
102
|
-
e.option,
|
|
103
|
-
e.optionFactory ? yield e.optionFactory(e.option) : {}
|
|
104
|
-
);
|
|
105
|
-
n.setOption(r);
|
|
106
|
-
}), s = () => {
|
|
107
|
-
n == null || n.dispose(), i();
|
|
108
|
-
}, c = Q(() => {
|
|
109
|
-
if (!o.value) {
|
|
110
|
-
o.value = !0;
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
n == null || n.resize();
|
|
114
|
-
}, 100);
|
|
115
|
-
return H(i), k(() => [e.option, e.optionFactory], s), K(t, c), {
|
|
116
|
-
getChart: () => n,
|
|
117
|
-
echarts: A,
|
|
118
|
-
reset: s,
|
|
119
|
-
resize: c
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
const m = /* @__PURE__ */ y({
|
|
123
|
-
__name: "Chart",
|
|
124
|
-
props: {
|
|
125
|
-
width: { default: "100%" },
|
|
126
|
-
height: { default: "400px" },
|
|
127
|
-
option: { default: () => ({}) },
|
|
128
|
-
optionFactory: null
|
|
129
|
-
},
|
|
130
|
-
setup(t, { expose: e }) {
|
|
131
|
-
const o = t, n = v(), i = z(() => ({
|
|
132
|
-
width: o.width,
|
|
133
|
-
height: o.height
|
|
134
|
-
})), { getChart: s, reset: c, resize: a, echarts: r } = nt(n, o);
|
|
135
|
-
return e({
|
|
136
|
-
getChart: s,
|
|
137
|
-
echarts: r,
|
|
138
|
-
reset: c,
|
|
139
|
-
resize: a
|
|
140
|
-
}), (_, st) => (u(), d("div", {
|
|
141
|
-
ref_key: "container",
|
|
142
|
-
ref: n,
|
|
143
|
-
style: I(l(i))
|
|
144
|
-
}, "Chart", 4));
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
m.install = function(t) {
|
|
148
|
-
t.component("XChart", m);
|
|
149
|
-
};
|
|
150
|
-
function L(t, e) {
|
|
151
|
-
const o = (i) => f(this, null, function* () {
|
|
152
|
-
const s = F(x({}, i), {
|
|
153
|
-
title: {},
|
|
154
|
-
xAxis: {},
|
|
155
|
-
yAxis: {}
|
|
156
|
-
});
|
|
157
|
-
t.category === "x" ? (s.xAxis = { type: "category" }, s.yAxis = {}) : (s.xAxis = {}, s.yAxis = { type: "category" }), s.dataset = {
|
|
158
|
-
dimensions: t.dimensions,
|
|
159
|
-
source: typeof t.source == "function" ? yield t.source() : t.source
|
|
160
|
-
};
|
|
161
|
-
const c = (t.dimensions || []).length;
|
|
162
|
-
if (c > 1) {
|
|
163
|
-
const a = new Array(c - 1);
|
|
164
|
-
a.fill({ type: e }), s.series = a;
|
|
165
|
-
}
|
|
166
|
-
return C(
|
|
167
|
-
s,
|
|
168
|
-
t.optionFactory ? yield t.optionFactory(s) : {}
|
|
169
|
-
);
|
|
170
|
-
}), n = v(Symbol("key"));
|
|
171
|
-
return k(
|
|
172
|
-
() => [t.category, t.dimensions, t.source, t.optionFactory],
|
|
173
|
-
() => {
|
|
174
|
-
n.value = Symbol("key");
|
|
175
|
-
}
|
|
176
|
-
), {
|
|
177
|
-
optionFactory: o,
|
|
178
|
-
key: n
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
const B = /* @__PURE__ */ y({
|
|
182
|
-
__name: "Bar",
|
|
183
|
-
props: {
|
|
184
|
-
category: { default: "x" },
|
|
185
|
-
dimensions: { default: () => [] },
|
|
186
|
-
source: { type: [Array, Function], default: () => [] },
|
|
187
|
-
optionFactory: null
|
|
188
|
-
},
|
|
189
|
-
setup(t) {
|
|
190
|
-
const e = t, { optionFactory: o, key: n } = L(e, "bar");
|
|
191
|
-
return (i, s) => (u(), h(l(m), {
|
|
192
|
-
key: l(n),
|
|
193
|
-
optionFactory: l(o)
|
|
194
|
-
}, null, 8, ["optionFactory"]));
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
B.install = function(t) {
|
|
198
|
-
t.component("XChartBar", B);
|
|
199
|
-
};
|
|
200
|
-
const E = /* @__PURE__ */ y({
|
|
201
|
-
__name: "Line",
|
|
202
|
-
props: {
|
|
203
|
-
category: { default: "x" },
|
|
204
|
-
dimensions: { default: () => [] },
|
|
205
|
-
source: { type: [Array, Function], default: () => [] },
|
|
206
|
-
optionFactory: null
|
|
207
|
-
},
|
|
208
|
-
setup(t) {
|
|
209
|
-
const e = t, { optionFactory: o, key: n } = L(e, "line");
|
|
210
|
-
return (i, s) => (u(), h(l(m), {
|
|
211
|
-
key: l(n),
|
|
212
|
-
optionFactory: l(o)
|
|
213
|
-
}, null, 8, ["optionFactory"]));
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
E.install = function(t) {
|
|
217
|
-
t.component("XChartLine", E);
|
|
218
|
-
};
|
|
219
|
-
const T = /* @__PURE__ */ y({
|
|
220
|
-
__name: "Pie",
|
|
221
|
-
props: {
|
|
222
|
-
dimensions: { default: () => [] },
|
|
223
|
-
source: { type: [Array, Function], default: () => [] },
|
|
224
|
-
optionFactory: null
|
|
225
|
-
},
|
|
226
|
-
setup(t) {
|
|
227
|
-
const e = t, o = v(Symbol("key")), n = (i) => f(this, null, function* () {
|
|
228
|
-
const s = F(x({}, i), {
|
|
229
|
-
dataset: {
|
|
230
|
-
dimensions: e.dimensions,
|
|
231
|
-
source: typeof e.source == "function" ? yield e.source() : e.source
|
|
232
|
-
},
|
|
233
|
-
series: [
|
|
234
|
-
{
|
|
235
|
-
type: "pie"
|
|
236
|
-
}
|
|
237
|
-
]
|
|
238
|
-
});
|
|
239
|
-
return C(
|
|
240
|
-
s,
|
|
241
|
-
e.optionFactory ? yield e.optionFactory(s) : {}
|
|
242
|
-
);
|
|
243
|
-
});
|
|
244
|
-
return k(
|
|
245
|
-
() => [e.dimensions, e.source, e.optionFactory],
|
|
246
|
-
() => {
|
|
247
|
-
o.value = Symbol("key");
|
|
248
|
-
}
|
|
249
|
-
), (i, s) => (u(), h(l(m), {
|
|
250
|
-
key: o.value,
|
|
251
|
-
optionFactory: n
|
|
252
|
-
}));
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
T.install = function(t) {
|
|
256
|
-
t.component("XChartPie", T);
|
|
257
|
-
};
|
|
258
|
-
export {
|
|
259
|
-
m as XChart,
|
|
260
|
-
B as XChartBar,
|
|
261
|
-
E as XChartLine,
|
|
262
|
-
T as XChartPie,
|
|
263
|
-
$ as XElement,
|
|
264
|
-
b as XTestSuit
|
|
265
|
-
};
|
package/lib/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}})});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="container" :style="style">Chart</div>
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts" setup>
|
|
5
|
-
import { ref, computed } from 'vue';
|
|
6
|
-
import useECharts from '../../hooks/useECharts';
|
|
7
|
-
|
|
8
|
-
export type IOptionFactory = (
|
|
9
|
-
opt?: Record<string, any>
|
|
10
|
-
) => Promise<Record<string, any>>;
|
|
11
|
-
|
|
12
|
-
export interface IProps {
|
|
13
|
-
width?: string;
|
|
14
|
-
height?: string;
|
|
15
|
-
option?: Record<string, any>;
|
|
16
|
-
optionFactory?: IOptionFactory;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const props = withDefaults(defineProps<IProps>(), {
|
|
20
|
-
width: '100%',
|
|
21
|
-
height: '400px',
|
|
22
|
-
option: () => ({})
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const container = ref<HTMLElement>();
|
|
26
|
-
|
|
27
|
-
const style = computed(() => {
|
|
28
|
-
return {
|
|
29
|
-
width: props.width,
|
|
30
|
-
height: props.height
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const { getChart, reset, resize, echarts } = useECharts(container, props);
|
|
35
|
-
|
|
36
|
-
defineExpose({
|
|
37
|
-
getChart,
|
|
38
|
-
echarts,
|
|
39
|
-
reset,
|
|
40
|
-
resize
|
|
41
|
-
});
|
|
42
|
-
</script>
|