@vtj/ui 0.0.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/cdn/index.js +1 -0
  3. package/cdn/style.css +1 -0
  4. package/lib/index.js +2039 -0
  5. package/lib/style.css +1 -1
  6. package/package.json +24 -33
  7. package/types/components/block/Block.vue.d.ts +143 -0
  8. package/types/components/block/block.d.ts +68 -0
  9. package/types/components/block/index.d.ts +319 -0
  10. package/types/components/config/Config.d.ts +26 -0
  11. package/types/components/config/index.d.ts +19 -0
  12. package/types/components/config/props.d.ts +6 -0
  13. package/types/components/container/Container.vue.d.ts +52 -0
  14. package/types/components/container/container.d.ts +46 -0
  15. package/types/components/container/index.d.ts +159 -0
  16. package/types/components/cron/Cron.vue.d.ts +9 -0
  17. package/types/components/cron/cron.d.ts +23 -0
  18. package/types/components/cron/index.d.ts +11 -0
  19. package/types/components/dialog/Dialog.vue.d.ts +289 -0
  20. package/types/components/dialog/create.d.ts +6 -0
  21. package/types/components/dialog/dialog.d.ts +155 -0
  22. package/types/components/dialog/hooks.d.ts +927 -0
  23. package/types/components/dialog/index.d.ts +638 -0
  24. package/types/components/element/Element.d.ts +25 -0
  25. package/types/components/element/index.d.ts +21 -0
  26. package/types/components/field/Field.vue.d.ts +802 -0
  27. package/types/components/field/field.d.ts +230 -0
  28. package/types/components/field/hooks.d.ts +23 -0
  29. package/types/components/field/index.d.ts +2034 -0
  30. package/types/components/field/setters/InputSetter.d.ts +45 -0
  31. package/types/components/field/setters/SelectSetter.d.ts +45 -0
  32. package/types/components/field/setters/factory.d.ts +54 -0
  33. package/types/components/field/setters/index.d.ts +93 -0
  34. package/types/components/form/Form.vue.d.ts +5352 -0
  35. package/types/components/form/form.d.ts +384 -0
  36. package/types/components/form/hooks.d.ts +1906 -0
  37. package/types/components/form/index.d.ts +15373 -0
  38. package/types/components/help/Help.vue.d.ts +315 -0
  39. package/types/components/help/help.d.ts +172 -0
  40. package/types/components/help/hooks.d.ts +18 -0
  41. package/types/components/help/index.d.ts +316 -0
  42. package/types/components/icon/Icon.vue.d.ts +52 -0
  43. package/types/components/icon/icon.d.ts +30 -0
  44. package/types/components/icon/index.d.ts +166 -0
  45. package/types/components/index.d.ts +16 -0
  46. package/types/components/page/Page.vue.d.ts +22 -0
  47. package/types/components/page/index.d.ts +118 -0
  48. package/types/components/page/page.d.ts +9 -0
  49. package/types/components/panel/Panel.vue.d.ts +573 -0
  50. package/types/components/panel/index.d.ts +1207 -0
  51. package/types/components/panel/panel.d.ts +227 -0
  52. package/types/components/text/Text.vue.d.ts +52 -0
  53. package/types/components/text/index.d.ts +165 -0
  54. package/types/components/text/text.d.ts +37 -0
  55. package/types/components/tool/Tool.vue.d.ts +158 -0
  56. package/types/components/tool/Trigger.d.ts +29 -0
  57. package/types/components/tool/hooks.d.ts +250 -0
  58. package/types/components/tool/index.d.ts +371 -0
  59. package/types/components/tool/tool.d.ts +91 -0
  60. package/types/components/toolbar/Toolbar.vue.d.ts +44 -0
  61. package/types/components/toolbar/hooks.d.ts +14 -0
  62. package/types/components/toolbar/index.d.ts +161 -0
  63. package/types/components/toolbar/toolbar.d.ts +45 -0
  64. package/types/components/wrapper/Wrapper.vue.d.ts +268 -0
  65. package/types/components/wrapper/index.d.ts +601 -0
  66. package/types/components/wrapper/wrapper.d.ts +145 -0
  67. package/types/constants.d.ts +4 -0
  68. package/types/hooks/index.d.ts +4 -0
  69. package/types/hooks/useConfig.d.ts +5 -0
  70. package/types/hooks/useDraggable.d.ts +13 -0
  71. package/types/hooks/useIcon.d.ts +4 -0
  72. package/types/hooks/useResizable.d.ts +25 -0
  73. package/types/index.d.ts +13 -4
  74. package/types/list.d.ts +21588 -0
  75. package/types/utils/emits.d.ts +6 -0
  76. package/types/utils/index.d.ts +4 -0
  77. package/types/utils/install.d.ts +9 -0
  78. package/types/utils/make-install.d.ts +5 -0
  79. package/types/utils/util.d.ts +8 -0
  80. package/README.md +0 -4
  81. package/lib/cdn/index.cjs.js +0 -1
  82. package/lib/cdn/index.es.js +0 -242
  83. package/lib/cdn/index.umd.js +0 -1
  84. package/lib/cdn/style.css +0 -1
  85. package/lib/index.cjs.js +0 -1
  86. package/lib/index.es.js +0 -246
  87. package/lib/index.umd.js +0 -1
  88. package/src/components/XChart/Chart.vue +0 -42
  89. package/src/components/XChart/index.ts +0 -8
  90. package/src/components/XChart/style.scss +0 -0
  91. package/src/components/XChartBar/Bar.vue +0 -27
  92. package/src/components/XChartBar/index.ts +0 -8
  93. package/src/components/XChartLine/Line.vue +0 -27
  94. package/src/components/XChartLine/index.ts +0 -8
  95. package/src/components/XChartPie/Pie.vue +0 -54
  96. package/src/components/XChartPie/index.ts +0 -8
  97. package/src/components/XTestSuit/TestSuit.vue +0 -47
  98. package/src/components/XTestSuit/index.ts +0 -8
  99. package/src/components/XTestSuit/style.scss +0 -14
  100. package/src/hooks/useECharts.ts +0 -55
  101. package/src/hooks/useRectChart.ts +0 -46
  102. package/src/index.ts +0 -23
  103. package/src/theme/_vars.scss +0 -8
  104. package/src/theme/base.scss +0 -0
  105. package/src/theme/index.scss +0 -4
  106. package/types/dev/vite-env.d.ts +0 -7
  107. package/types/src/components/XChart/Chart.vue.d.ts +0 -69
  108. package/types/src/components/XChart/index.d.ts +0 -2
  109. package/types/src/components/XChartBar/Bar.vue.d.ts +0 -124
  110. package/types/src/components/XChartBar/index.d.ts +0 -2
  111. package/types/src/components/XChartLine/Line.vue.d.ts +0 -124
  112. package/types/src/components/XChartLine/index.d.ts +0 -2
  113. package/types/src/components/XChartPie/Pie.vue.d.ts +0 -111
  114. package/types/src/components/XChartPie/index.d.ts +0 -2
  115. package/types/src/components/XTestSuit/TestSuit.vue.d.ts +0 -59
  116. package/types/src/components/XTestSuit/index.d.ts +0 -2
  117. package/types/src/hooks/useECharts.d.ts +0 -15
  118. package/types/src/hooks/useRectChart.d.ts +0 -4
  119. package/types/src/index.d.ts +0 -6
@@ -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,4 @@
1
+ export * from './util';
2
+ export * from './emits';
3
+ export * from './install';
4
+ export * from './make-install';
@@ -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,5 @@
1
+ import type { App, Plugin } from 'vue';
2
+ import { ConfigContext } from '../components';
3
+ export declare const makeInstaller: (components?: Plugin[]) => {
4
+ install: (app: App, options?: ConfigContext) => void;
5
+ };
@@ -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
@@ -1,4 +0,0 @@
1
- # Vue3 通用业务组件库
2
-
3
- Vue 3 + TypeScript + Vite
4
-
@@ -1 +0,0 @@
1
- "use strict";var F=Object.defineProperty,g=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var k=(e,t,o)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,d=(e,t)=>{for(var o in t||(t={}))C.call(t,o)&&k(e,o,t[o]);if(h)for(var o of h(t))B.call(t,o)&&k(e,o,t[o]);return e},y=(e,t)=>g(e,x(t));var p=(e,t,o)=>new Promise((n,u)=>{var s=i=>{try{c(o.next(i))}catch(l){u(l)}},r=i=>{try{c(o.throw(i))}catch(l){u(l)}},c=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,r);c((o=o.apply(e,t)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S={class:"x-test-suit"},E=Vue.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),w={class:"x-test-suit__body"},b={class:"x-test-suit_props"},X={class:"x-test-suit_slots"},A=Vue.createTextVNode(" Default Slot"),N={key:0},V=Vue.defineComponent({__name:"TestSuit",props:{p1:null,p2:null,p3:{type:Boolean},p4:null},emits:["click"],setup(e,{emit:t}){const o=e,n=Vue.computed(()=>[{name:"p1",value:o.p1},{name:"p2",value:o.p2},{name:"p3",value:o.p3},{name:"p4",value:o.p4}]),u=()=>{t("click")};return(s,r)=>(Vue.openBlock(),Vue.createElementBlock("div",S,[E,Vue.createElementVNode("div",w,[Vue.createElementVNode("div",b,[(Vue.openBlock(!0),Vue.createElementBlock(Vue.Fragment,null,Vue.renderList(Vue.unref(n),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:u},"Tigger Click Event")]),Vue.createElementVNode("div",X,[Vue.createElementVNode("div",null,[Vue.renderSlot(s.$slots,"default",{},()=>[A])]),s.$slots.footer?(Vue.openBlock(),Vue.createElementBlock("div",N,[Vue.renderSlot(s.$slots,"footer")])):Vue.createCommentVNode("",!0)])])]))}});V.install=function(e){e.component("XTestSuit",V)};function T(e,t={}){const o=Vue.ref(!1);let n=null;const u=c=>p(this,null,function*(){n=echarts.init(e.value);const i=c||VtjUtils.merge({},t.option,t.optionFactory?yield t.optionFactory(t.option):{});n.setOption(i)}),s=()=>{n==null||n.dispose(),u()},r=VtjUtils.debounce(()=>{if(!o.value){o.value=!0;return}n==null||n.resize()},100);return Vue.onMounted(u),Vue.watch(()=>[t.option,t.optionFactory],s),VueUse.useResizeObserver(e,r),{getChart:()=>n,echarts,reset:s,resize:r}}const a=Vue.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(e,{expose:t}){const o=e,n=Vue.ref(),u=Vue.computed(()=>({width:o.width,height:o.height})),{getChart:s,reset:r,resize:c,echarts:i}=T(n,o);return t({getChart:s,echarts:i,reset:r,resize:c}),(l,$)=>(Vue.openBlock(),Vue.createElementBlock("div",{ref_key:"container",ref:n,style:Vue.normalizeStyle(Vue.unref(u))},"Chart",4))}});a.install=function(e){e.component("XChart",a)};function v(e,t){const o=u=>p(this,null,function*(){const s=y(d({},u),{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 r=(e.dimensions||[]).length;if(r>1){const c=new Array(r-1);c.fill({type:t}),s.series=c}return VtjUtils.merge(s,e.optionFactory?yield e.optionFactory(s):{})}),n=Vue.ref(Symbol("key"));return Vue.watch(()=>[e.category,e.dimensions,e.source,e.optionFactory],()=>{n.value=Symbol("key")}),{optionFactory:o,key:n}}const m=Vue.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:o,key:n}=v(t,"bar");return(u,s)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(a),{key:Vue.unref(n),optionFactory:Vue.unref(o)},null,8,["optionFactory"]))}});m.install=function(e){e.component("XChartBar",m)};const f=Vue.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:o,key:n}=v(t,"line");return(u,s)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(a),{key:Vue.unref(n),optionFactory:Vue.unref(o)},null,8,["optionFactory"]))}});f.install=function(e){e.component("XChartLine",f)};const _=Vue.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,o=Vue.ref(Symbol("key")),n=u=>p(this,null,function*(){const s=y(d({},u),{dataset:{dimensions:t.dimensions,source:typeof t.source=="function"?yield t.source():t.source},series:[{type:"pie"}]});return VtjUtils.merge(s,t.optionFactory?yield t.optionFactory(s):{})});return Vue.watch(()=>[t.dimensions,t.source,t.optionFactory],()=>{o.value=Symbol("key")}),(u,s)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(a),{key:o.value,optionFactory:n}))}});_.install=function(e){e.component("XChartPie",_)};exports.XChart=a;exports.XChartBar=m;exports.XChartLine=f;exports.XChartPie=_;exports.XTestSuit=V;
@@ -1,242 +0,0 @@
1
- var v = Object.defineProperty, x = Object.defineProperties;
2
- var g = Object.getOwnPropertyDescriptors;
3
- var V = Object.getOwnPropertySymbols;
4
- var C = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;
5
- var m = (e, t, n) => t in e ? v(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, y = (e, t) => {
6
- for (var n in t || (t = {}))
7
- C.call(t, n) && m(e, n, t[n]);
8
- if (V)
9
- for (var n of V(t))
10
- B.call(t, n) && m(e, n, t[n]);
11
- return e;
12
- }, d = (e, t) => x(e, g(t));
13
- var p = (e, t, n) => new Promise((o, u) => {
14
- var s = (i) => {
15
- try {
16
- c(n.next(i));
17
- } catch (l) {
18
- u(l);
19
- }
20
- }, r = (i) => {
21
- try {
22
- c(n.throw(i));
23
- } catch (l) {
24
- u(l);
25
- }
26
- }, c = (i) => i.done ? o(i.value) : Promise.resolve(i.value).then(s, r);
27
- c((n = n.apply(e, t)).next());
28
- });
29
- const S = { class: "x-test-suit" }, E = /* @__PURE__ */ Vue.createElementVNode("div", { class: "x-test-suit__header" }, "XTestSuit", -1), w = { class: "x-test-suit__body" }, X = { class: "x-test-suit_props" }, A = { class: "x-test-suit_slots" }, N = /* @__PURE__ */ Vue.createTextVNode(" Default Slot"), b = { 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, r) => (Vue.openBlock(), Vue.createElementBlock("div", S, [
48
- E,
49
- Vue.createElementVNode("div", w, [
50
- Vue.createElementVNode("div", X, [
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", A, [
57
- Vue.createElementVNode("div", null, [
58
- Vue.renderSlot(s.$slots, "default", {}, () => [
59
- N
60
- ])
61
- ]),
62
- s.$slots.footer ? (Vue.openBlock(), Vue.createElementBlock("div", b, [
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
- function $(e, t = {}) {
74
- const n = Vue.ref(!1);
75
- let o = null;
76
- const u = (c) => p(this, null, function* () {
77
- o = echarts.init(e.value);
78
- const i = c || VtjUtils.merge(
79
- {},
80
- t.option,
81
- t.optionFactory ? yield t.optionFactory(t.option) : {}
82
- );
83
- o.setOption(i);
84
- }), s = () => {
85
- o == null || o.dispose(), u();
86
- }, r = VtjUtils.debounce(() => {
87
- if (!n.value) {
88
- n.value = !0;
89
- return;
90
- }
91
- o == null || o.resize();
92
- }, 100);
93
- return Vue.onMounted(u), Vue.watch(() => [t.option, t.optionFactory], s), VueUse.useResizeObserver(e, r), {
94
- getChart: () => o,
95
- echarts,
96
- reset: s,
97
- resize: r
98
- };
99
- }
100
- const a = /* @__PURE__ */ Vue.defineComponent({
101
- __name: "Chart",
102
- props: {
103
- width: { default: "100%" },
104
- height: { default: "400px" },
105
- option: { default: () => ({}) },
106
- optionFactory: null
107
- },
108
- setup(e, { expose: t }) {
109
- const n = e, o = Vue.ref(), u = Vue.computed(() => ({
110
- width: n.width,
111
- height: n.height
112
- })), { getChart: s, reset: r, resize: c, echarts: i } = $(o, n);
113
- return t({
114
- getChart: s,
115
- echarts: i,
116
- reset: r,
117
- resize: c
118
- }), (l, T) => (Vue.openBlock(), Vue.createElementBlock("div", {
119
- ref_key: "container",
120
- ref: o,
121
- style: Vue.normalizeStyle(Vue.unref(u))
122
- }, "Chart", 4));
123
- }
124
- });
125
- a.install = function(e) {
126
- e.component("XChart", a);
127
- };
128
- function F(e, t) {
129
- const n = (u) => p(this, null, function* () {
130
- const s = d(y({}, u), {
131
- title: {},
132
- xAxis: {},
133
- yAxis: {}
134
- });
135
- e.category === "x" ? (s.xAxis = { type: "category" }, s.yAxis = {}) : (s.xAxis = {}, s.yAxis = { type: "category" }), s.dataset = {
136
- dimensions: e.dimensions,
137
- source: typeof e.source == "function" ? yield e.source() : e.source
138
- };
139
- const r = (e.dimensions || []).length;
140
- if (r > 1) {
141
- const c = new Array(r - 1);
142
- c.fill({ type: t }), s.series = c;
143
- }
144
- return VtjUtils.merge(
145
- s,
146
- e.optionFactory ? yield e.optionFactory(s) : {}
147
- );
148
- }), o = Vue.ref(Symbol("key"));
149
- return Vue.watch(
150
- () => [e.category, e.dimensions, e.source, e.optionFactory],
151
- () => {
152
- o.value = Symbol("key");
153
- }
154
- ), {
155
- optionFactory: n,
156
- key: o
157
- };
158
- }
159
- const _ = /* @__PURE__ */ Vue.defineComponent({
160
- __name: "Bar",
161
- props: {
162
- category: { default: "x" },
163
- dimensions: { default: () => [] },
164
- source: { type: [Array, Function], default: () => [] },
165
- optionFactory: null
166
- },
167
- setup(e) {
168
- const t = e, { optionFactory: n, key: o } = F(t, "bar");
169
- return (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
170
- key: Vue.unref(o),
171
- optionFactory: Vue.unref(n)
172
- }, null, 8, ["optionFactory"]));
173
- }
174
- });
175
- _.install = function(e) {
176
- e.component("XChartBar", _);
177
- };
178
- const h = /* @__PURE__ */ Vue.defineComponent({
179
- __name: "Line",
180
- props: {
181
- category: { default: "x" },
182
- dimensions: { default: () => [] },
183
- source: { type: [Array, Function], default: () => [] },
184
- optionFactory: null
185
- },
186
- setup(e) {
187
- const t = e, { optionFactory: n, key: o } = F(t, "line");
188
- return (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
189
- key: Vue.unref(o),
190
- optionFactory: Vue.unref(n)
191
- }, null, 8, ["optionFactory"]));
192
- }
193
- });
194
- h.install = function(e) {
195
- e.component("XChartLine", h);
196
- };
197
- const k = /* @__PURE__ */ Vue.defineComponent({
198
- __name: "Pie",
199
- props: {
200
- dimensions: { default: () => [] },
201
- source: { type: [Array, Function], default: () => [] },
202
- optionFactory: null
203
- },
204
- setup(e) {
205
- const t = e, n = Vue.ref(Symbol("key")), o = (u) => p(this, null, function* () {
206
- const s = d(y({}, u), {
207
- dataset: {
208
- dimensions: t.dimensions,
209
- source: typeof t.source == "function" ? yield t.source() : t.source
210
- },
211
- series: [
212
- {
213
- type: "pie"
214
- }
215
- ]
216
- });
217
- return VtjUtils.merge(
218
- s,
219
- t.optionFactory ? yield t.optionFactory(s) : {}
220
- );
221
- });
222
- return Vue.watch(
223
- () => [t.dimensions, t.source, t.optionFactory],
224
- () => {
225
- n.value = Symbol("key");
226
- }
227
- ), (u, s) => (Vue.openBlock(), Vue.createBlock(Vue.unref(a), {
228
- key: n.value,
229
- optionFactory: o
230
- }));
231
- }
232
- });
233
- k.install = function(e) {
234
- e.component("XChartPie", k);
235
- };
236
- export {
237
- a as XChart,
238
- _ as XChartBar,
239
- h as XChartLine,
240
- k as XChartPie,
241
- f as XTestSuit
242
- };
@@ -1 +0,0 @@
1
- (function(u,s){typeof exports=="object"&&typeof module!="undefined"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(u=typeof globalThis!="undefined"?globalThis:u||self,s(u.VtjUI={}))})(this,function(u){"use strict";var X=Object.defineProperty,A=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var b=(u,s,c)=>s in u?X(u,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):u[s]=c,x=(u,s)=>{for(var c in s||(s={}))T.call(s,c)&&b(u,c,s[c]);if(E)for(var c of E(s))j.call(s,c)&&b(u,c,s[c]);return u},B=(u,s)=>A(u,N(s));var m=(u,s,c)=>new Promise((_,f)=>{var h=a=>{try{V(c.next(a))}catch(p){f(p)}},k=a=>{try{V(c.throw(a))}catch(p){f(p)}},V=a=>a.done?_(a.value):Promise.resolve(a.value).then(h,k);V((c=c.apply(u,s)).next())});const s="",c={class:"x-test-suit"},_=Vue.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),f={class:"x-test-suit__body"},h={class:"x-test-suit_props"},k={class:"x-test-suit_slots"},V=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 i=e,n=Vue.computed(()=>[{name:"p1",value:i.p1},{name:"p2",value:i.p2},{name:"p3",value:i.p3},{name:"p4",value:i.p4}]),r=()=>{t("click")};return(o,d)=>(Vue.openBlock(),Vue.createElementBlock("div",c,[_,Vue.createElementVNode("div",f,[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(o.$slots,"default",{},()=>[V])]),o.$slots.footer?(Vue.openBlock(),Vue.createElementBlock("div",a,[Vue.renderSlot(o.$slots,"footer")])):Vue.createCommentVNode("",!0)])])]))}});p.install=function(e){e.component("XTestSuit",p)};function w(e,t={}){const i=Vue.ref(!1);let n=null;const r=l=>m(this,null,function*(){n=echarts.init(e.value);const C=l||VtjUtils.merge({},t.option,t.optionFactory?yield t.optionFactory(t.option):{});n.setOption(C)}),o=()=>{n==null||n.dispose(),r()},d=VtjUtils.debounce(()=>{if(!i.value){i.value=!0;return}n==null||n.resize()},100);return Vue.onMounted(r),Vue.watch(()=>[t.option,t.optionFactory],o),VueUse.useResizeObserver(e,d),{getChart:()=>n,echarts,reset:o,resize:d}}const y=Vue.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(e,{expose:t}){const i=e,n=Vue.ref(),r=Vue.computed(()=>({width:i.width,height:i.height})),{getChart:o,reset:d,resize:l,echarts:C}=w(n,i);return t({getChart:o,echarts:C,reset:d,resize:l}),($,U)=>(Vue.openBlock(),Vue.createElementBlock("div",{ref_key:"container",ref:n,style:Vue.normalizeStyle(Vue.unref(r))},"Chart",4))}});y.install=function(e){e.component("XChart",y)};function S(e,t){const i=r=>m(this,null,function*(){const o=B(x({},r),{title:{},xAxis:{},yAxis:{}});e.category==="x"?(o.xAxis={type:"category"},o.yAxis={}):(o.xAxis={},o.yAxis={type:"category"}),o.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}),o.series=l}return VtjUtils.merge(o,e.optionFactory?yield e.optionFactory(o):{})}),n=Vue.ref(Symbol("key"));return Vue.watch(()=>[e.category,e.dimensions,e.source,e.optionFactory],()=>{n.value=Symbol("key")}),{optionFactory:i,key:n}}const v=Vue.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:i,key:n}=S(t,"bar");return(r,o)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(y),{key:Vue.unref(n),optionFactory:Vue.unref(i)},null,8,["optionFactory"]))}});v.install=function(e){e.component("XChartBar",v)};const F=Vue.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,{optionFactory:i,key:n}=S(t,"line");return(r,o)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(y),{key:Vue.unref(n),optionFactory:Vue.unref(i)},null,8,["optionFactory"]))}});F.install=function(e){e.component("XChartLine",F)};const g=Vue.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const t=e,i=Vue.ref(Symbol("key")),n=r=>m(this,null,function*(){const o=B(x({},r),{dataset:{dimensions:t.dimensions,source:typeof t.source=="function"?yield t.source():t.source},series:[{type:"pie"}]});return VtjUtils.merge(o,t.optionFactory?yield t.optionFactory(o):{})});return Vue.watch(()=>[t.dimensions,t.source,t.optionFactory],()=>{i.value=Symbol("key")}),(r,o)=>(Vue.openBlock(),Vue.createBlock(Vue.unref(y),{key:i.value,optionFactory:n}))}});g.install=function(e){e.component("XChartPie",g)},u.XChart=y,u.XChartBar=v,u.XChartLine=F,u.XChartPie=g,u.XTestSuit=p,Object.defineProperties(u,{__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 B=Object.defineProperty,S=Object.defineProperties;var b=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var F=(e,n,o)=>n in e?B(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,f=(e,n)=>{for(var o in n||(n={}))E.call(n,o)&&F(e,o,n[o]);if(g)for(var o of g(n))w.call(n,o)&&F(e,o,n[o]);return e},m=(e,n)=>S(e,b(n));var d=(e,n,o)=>new Promise((r,s)=>{var c=a=>{try{i(o.next(a))}catch(p){s(p)}},u=a=>{try{i(o.throw(a))}catch(p){s(p)}},i=a=>a.done?r(a.value):Promise.resolve(a.value).then(c,u);i((o=o.apply(e,n)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),N=require("echarts"),X=require("@vueuse/core"),y=require("@vtj/utils");function A(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const x=A(N);const O={class:"x-test-suit"},V=t.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),T={class:"x-test-suit__body"},$={class:"x-test-suit_props"},j={class:"x-test-suit_slots"},z=t.createTextVNode(" Default Slot"),P={key:0},_=t.defineComponent({__name:"TestSuit",props:{p1:null,p2:null,p3:{type:Boolean},p4:null},emits:["click"],setup(e,{emit:n}){const o=e,r=t.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,u)=>(t.openBlock(),t.createElementBlock("div",O,[V,t.createElementVNode("div",T,[t.createElementVNode("div",$,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(r),i=>(t.openBlock(),t.createElementBlock("div",null,t.toDisplayString(i.name)+": "+t.toDisplayString(JSON.stringify(i.value)),1))),256))]),t.createElementVNode("div",{class:"x-test-suit_events"},[t.createElementVNode("button",{onClick:s},"Tigger Click Event")]),t.createElementVNode("div",j,[t.createElementVNode("div",null,[t.renderSlot(c.$slots,"default",{},()=>[z])]),c.$slots.footer?(t.openBlock(),t.createElementBlock("div",P,[t.renderSlot(c.$slots,"footer")])):t.createCommentVNode("",!0)])])]))}});_.install=function(e){e.component("XTestSuit",_)};function L(e,n={}){const o=t.ref(!1);let r=null;const s=i=>d(this,null,function*(){r=x.init(e.value);const a=i||y.merge({},n.option,n.optionFactory?yield n.optionFactory(n.option):{});r.setOption(a)}),c=()=>{r==null||r.dispose(),s()},u=y.debounce(()=>{if(!o.value){o.value=!0;return}r==null||r.resize()},100);return t.onMounted(s),t.watch(()=>[n.option,n.optionFactory],c),X.useResizeObserver(e,u),{getChart:()=>r,echarts:x,reset:c,resize:u}}const l=t.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(e,{expose:n}){const o=e,r=t.ref(),s=t.computed(()=>({width:o.width,height:o.height})),{getChart:c,reset:u,resize:i,echarts:a}=L(r,o);return n({getChart:c,echarts:a,reset:u,resize:i}),(p,M)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"container",ref:r,style:t.normalizeStyle(t.unref(s))},"Chart",4))}});l.install=function(e){e.component("XChart",l)};function C(e,n){const o=s=>d(this,null,function*(){const c=m(f({},s),{title:{},xAxis:{},yAxis:{}});e.category==="x"?(c.xAxis={type:"category"},c.yAxis={}):(c.xAxis={},c.yAxis={type:"category"}),c.dataset={dimensions:e.dimensions,source:typeof e.source=="function"?yield e.source():e.source};const u=(e.dimensions||[]).length;if(u>1){const i=new Array(u-1);i.fill({type:n}),c.series=i}return y.merge(c,e.optionFactory?yield e.optionFactory(c):{})}),r=t.ref(Symbol("key"));return t.watch(()=>[e.category,e.dimensions,e.source,e.optionFactory],()=>{r.value=Symbol("key")}),{optionFactory:o,key:r}}const h=t.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const n=e,{optionFactory:o,key:r}=C(n,"bar");return(s,c)=>(t.openBlock(),t.createBlock(t.unref(l),{key:t.unref(r),optionFactory:t.unref(o)},null,8,["optionFactory"]))}});h.install=function(e){e.component("XChartBar",h)};const k=t.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const n=e,{optionFactory:o,key:r}=C(n,"line");return(s,c)=>(t.openBlock(),t.createBlock(t.unref(l),{key:t.unref(r),optionFactory:t.unref(o)},null,8,["optionFactory"]))}});k.install=function(e){e.component("XChartLine",k)};const v=t.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(e){const n=e,o=t.ref(Symbol("key")),r=s=>d(this,null,function*(){const c=m(f({},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 t.watch(()=>[n.dimensions,n.source,n.optionFactory],()=>{o.value=Symbol("key")}),(s,c)=>(t.openBlock(),t.createBlock(t.unref(l),{key:o.value,optionFactory:r}))}});v.install=function(e){e.component("XChartPie",v)};exports.XChart=l;exports.XChartBar=h;exports.XChartLine=k;exports.XChartPie=v;exports.XTestSuit=_;
package/lib/index.es.js DELETED
@@ -1,246 +0,0 @@
1
- var E = Object.defineProperty, N = Object.defineProperties;
2
- var O = Object.getOwnPropertyDescriptors;
3
- var C = Object.getOwnPropertySymbols;
4
- var P = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
5
- var S = (t, e, o) => e in t ? E(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, F = (t, e) => {
6
- for (var o in e || (e = {}))
7
- P.call(e, o) && S(t, o, e[o]);
8
- if (C)
9
- for (var o of C(e))
10
- V.call(e, o) && S(t, o, e[o]);
11
- return t;
12
- }, v = (t, e) => N(t, O(e));
13
- var f = (t, e, o) => new Promise((n, i) => {
14
- var s = (a) => {
15
- try {
16
- r(o.next(a));
17
- } catch (_) {
18
- i(_);
19
- }
20
- }, c = (a) => {
21
- try {
22
- r(o.throw(a));
23
- } catch (_) {
24
- i(_);
25
- }
26
- }, r = (a) => a.done ? n(a.value) : Promise.resolve(a.value).then(s, c);
27
- r((o = o.apply(t, e)).next());
28
- });
29
- import { defineComponent as m, computed as z, openBlock as l, createElementBlock as p, createElementVNode as y, Fragment as D, renderList as R, unref as u, toDisplayString as X, renderSlot as w, createCommentVNode as J, createTextVNode as M, ref as h, onMounted as j, watch as x, normalizeStyle as q, createBlock as k } from "vue";
30
- import * as A from "echarts";
31
- import { useResizeObserver as G } from "@vueuse/core";
32
- import { debounce as H, merge as g } from "@vtj/utils";
33
- const I = { class: "x-test-suit" }, K = /* @__PURE__ */ y("div", { class: "x-test-suit__header" }, "XTestSuit", -1), Q = { class: "x-test-suit__body" }, U = { class: "x-test-suit_props" }, W = { class: "x-test-suit_slots" }, Y = /* @__PURE__ */ M(" Default Slot"), Z = { key: 0 }, b = /* @__PURE__ */ m({
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) => (l(), p("div", I, [
52
- K,
53
- y("div", Q, [
54
- y("div", U, [
55
- (l(!0), p(D, null, R(u(n), (r) => (l(), p("div", null, X(r.name) + ": " + X(JSON.stringify(r.value)), 1))), 256))
56
- ]),
57
- y("div", { class: "x-test-suit_events" }, [
58
- y("button", { onClick: i }, "Tigger Click Event")
59
- ]),
60
- y("div", W, [
61
- y("div", null, [
62
- w(s.$slots, "default", {}, () => [
63
- Y
64
- ])
65
- ]),
66
- s.$slots.footer ? (l(), p("div", Z, [
67
- w(s.$slots, "footer")
68
- ])) : J("", !0)
69
- ])
70
- ])
71
- ]));
72
- }
73
- });
74
- b.install = function(t) {
75
- t.component("XTestSuit", b);
76
- };
77
- function tt(t, e = {}) {
78
- const o = h(!1);
79
- let n = null;
80
- const i = (r) => f(this, null, function* () {
81
- n = A.init(t.value);
82
- const a = r || g(
83
- {},
84
- e.option,
85
- e.optionFactory ? yield e.optionFactory(e.option) : {}
86
- );
87
- n.setOption(a);
88
- }), s = () => {
89
- n == null || n.dispose(), i();
90
- }, c = H(() => {
91
- if (!o.value) {
92
- o.value = !0;
93
- return;
94
- }
95
- n == null || n.resize();
96
- }, 100);
97
- return j(i), x(() => [e.option, e.optionFactory], s), G(t, c), {
98
- getChart: () => n,
99
- echarts: A,
100
- reset: s,
101
- resize: c
102
- };
103
- }
104
- const d = /* @__PURE__ */ m({
105
- __name: "Chart",
106
- props: {
107
- width: { default: "100%" },
108
- height: { default: "400px" },
109
- option: { default: () => ({}) },
110
- optionFactory: null
111
- },
112
- setup(t, { expose: e }) {
113
- const o = t, n = h(), i = z(() => ({
114
- width: o.width,
115
- height: o.height
116
- })), { getChart: s, reset: c, resize: r, echarts: a } = tt(n, o);
117
- return e({
118
- getChart: s,
119
- echarts: a,
120
- reset: c,
121
- resize: r
122
- }), (_, et) => (l(), p("div", {
123
- ref_key: "container",
124
- ref: n,
125
- style: q(u(i))
126
- }, "Chart", 4));
127
- }
128
- });
129
- d.install = function(t) {
130
- t.component("XChart", d);
131
- };
132
- function L(t, e) {
133
- const o = (i) => f(this, null, function* () {
134
- const s = v(F({}, i), {
135
- title: {},
136
- xAxis: {},
137
- yAxis: {}
138
- });
139
- t.category === "x" ? (s.xAxis = { type: "category" }, s.yAxis = {}) : (s.xAxis = {}, s.yAxis = { type: "category" }), s.dataset = {
140
- dimensions: t.dimensions,
141
- source: typeof t.source == "function" ? yield t.source() : t.source
142
- };
143
- const c = (t.dimensions || []).length;
144
- if (c > 1) {
145
- const r = new Array(c - 1);
146
- r.fill({ type: e }), s.series = r;
147
- }
148
- return g(
149
- s,
150
- t.optionFactory ? yield t.optionFactory(s) : {}
151
- );
152
- }), n = h(Symbol("key"));
153
- return x(
154
- () => [t.category, t.dimensions, t.source, t.optionFactory],
155
- () => {
156
- n.value = Symbol("key");
157
- }
158
- ), {
159
- optionFactory: o,
160
- key: n
161
- };
162
- }
163
- const B = /* @__PURE__ */ m({
164
- __name: "Bar",
165
- props: {
166
- category: { default: "x" },
167
- dimensions: { default: () => [] },
168
- source: { type: [Array, Function], default: () => [] },
169
- optionFactory: null
170
- },
171
- setup(t) {
172
- const e = t, { optionFactory: o, key: n } = L(e, "bar");
173
- return (i, s) => (l(), k(u(d), {
174
- key: u(n),
175
- optionFactory: u(o)
176
- }, null, 8, ["optionFactory"]));
177
- }
178
- });
179
- B.install = function(t) {
180
- t.component("XChartBar", B);
181
- };
182
- const $ = /* @__PURE__ */ m({
183
- __name: "Line",
184
- props: {
185
- category: { default: "x" },
186
- dimensions: { default: () => [] },
187
- source: { type: [Array, Function], default: () => [] },
188
- optionFactory: null
189
- },
190
- setup(t) {
191
- const e = t, { optionFactory: o, key: n } = L(e, "line");
192
- return (i, s) => (l(), k(u(d), {
193
- key: u(n),
194
- optionFactory: u(o)
195
- }, null, 8, ["optionFactory"]));
196
- }
197
- });
198
- $.install = function(t) {
199
- t.component("XChartLine", $);
200
- };
201
- const T = /* @__PURE__ */ m({
202
- __name: "Pie",
203
- props: {
204
- dimensions: { default: () => [] },
205
- source: { type: [Array, Function], default: () => [] },
206
- optionFactory: null
207
- },
208
- setup(t) {
209
- const e = t, o = h(Symbol("key")), n = (i) => f(this, null, function* () {
210
- const s = v(F({}, i), {
211
- dataset: {
212
- dimensions: e.dimensions,
213
- source: typeof e.source == "function" ? yield e.source() : e.source
214
- },
215
- series: [
216
- {
217
- type: "pie"
218
- }
219
- ]
220
- });
221
- return g(
222
- s,
223
- e.optionFactory ? yield e.optionFactory(s) : {}
224
- );
225
- });
226
- return x(
227
- () => [e.dimensions, e.source, e.optionFactory],
228
- () => {
229
- o.value = Symbol("key");
230
- }
231
- ), (i, s) => (l(), k(u(d), {
232
- key: o.value,
233
- optionFactory: n
234
- }));
235
- }
236
- });
237
- T.install = function(t) {
238
- t.component("XChartPie", T);
239
- };
240
- export {
241
- d as XChart,
242
- B as XChartBar,
243
- $ as XChartLine,
244
- T as XChartPie,
245
- b as XTestSuit
246
- };
package/lib/index.umd.js DELETED
@@ -1 +0,0 @@
1
- (function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("echarts"),require("@vueuse/core"),require("@vtj/utils")):typeof define=="function"&&define.amd?define(["exports","vue","echarts","@vueuse/core","@vtj/utils"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o.VtjUI={},o.vue,o.echarts,o.core,o.utils))})(this,function(o,e,s,k,p){"use strict";var z=Object.defineProperty,P=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var X=(o,e,s)=>e in o?z(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,b=(o,e)=>{for(var s in e||(e={}))M.call(e,s)&&X(o,s,e[s]);if(N)for(var s of N(e))q.call(e,s)&&X(o,s,e[s]);return o},E=(o,e)=>P(o,L(e));var h=(o,e,s)=>new Promise((k,p)=>{var g=l=>{try{_(s.next(l))}catch(y){p(y)}},m=l=>{try{_(s.throw(l))}catch(y){p(y)}},_=l=>l.done?k(l.value):Promise.resolve(l.value).then(g,m);_((s=s.apply(o,e)).next())});function g(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const c in t)if(c!=="default"){const r=Object.getOwnPropertyDescriptor(t,c);Object.defineProperty(n,c,r.get?r:{enumerable:!0,get:()=>t[c]})}}return n.default=t,Object.freeze(n)}const m=g(s),_="",l={class:"x-test-suit"},y=e.createElementVNode("div",{class:"x-test-suit__header"},"XTestSuit",-1),A={class:"x-test-suit__body"},T={class:"x-test-suit_props"},V={class:"x-test-suit_slots"},j=e.createTextVNode(" Default Slot"),O={key:0},F=e.defineComponent({__name:"TestSuit",props:{p1:null,p2:null,p3:{type:Boolean},p4:null},emits:["click"],setup(t,{emit:n}){const c=t,r=e.computed(()=>[{name:"p1",value:c.p1},{name:"p2",value:c.p2},{name:"p3",value:c.p3},{name:"p4",value:c.p4}]),a=()=>{n("click")};return(i,d)=>(e.openBlock(),e.createElementBlock("div",l,[y,e.createElementVNode("div",A,[e.createElementVNode("div",T,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),u=>(e.openBlock(),e.createElementBlock("div",null,e.toDisplayString(u.name)+": "+e.toDisplayString(JSON.stringify(u.value)),1))),256))]),e.createElementVNode("div",{class:"x-test-suit_events"},[e.createElementVNode("button",{onClick:a},"Tigger Click Event")]),e.createElementVNode("div",V,[e.createElementVNode("div",null,[e.renderSlot(i.$slots,"default",{},()=>[j])]),i.$slots.footer?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(i.$slots,"footer")])):e.createCommentVNode("",!0)])])]))}});F.install=function(t){t.component("XTestSuit",F)};function $(t,n={}){const c=e.ref(!1);let r=null;const a=u=>h(this,null,function*(){r=m.init(t.value);const S=u||p.merge({},n.option,n.optionFactory?yield n.optionFactory(n.option):{});r.setOption(S)}),i=()=>{r==null||r.dispose(),a()},d=p.debounce(()=>{if(!c.value){c.value=!0;return}r==null||r.resize()},100);return e.onMounted(a),e.watch(()=>[n.option,n.optionFactory],i),k.useResizeObserver(t,d),{getChart:()=>r,echarts:m,reset:i,resize:d}}const f=e.defineComponent({__name:"Chart",props:{width:{default:"100%"},height:{default:"400px"},option:{default:()=>({})},optionFactory:null},setup(t,{expose:n}){const c=t,r=e.ref(),a=e.computed(()=>({width:c.width,height:c.height})),{getChart:i,reset:d,resize:u,echarts:S}=$(r,c);return n({getChart:i,echarts:S,reset:d,resize:u}),(D,R)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"container",ref:r,style:e.normalizeStyle(e.unref(a))},"Chart",4))}});f.install=function(t){t.component("XChart",f)};function w(t,n){const c=a=>h(this,null,function*(){const i=E(b({},a),{title:{},xAxis:{},yAxis:{}});t.category==="x"?(i.xAxis={type:"category"},i.yAxis={}):(i.xAxis={},i.yAxis={type:"category"}),i.dataset={dimensions:t.dimensions,source:typeof t.source=="function"?yield t.source():t.source};const d=(t.dimensions||[]).length;if(d>1){const u=new Array(d-1);u.fill({type:n}),i.series=u}return p.merge(i,t.optionFactory?yield t.optionFactory(i):{})}),r=e.ref(Symbol("key"));return e.watch(()=>[t.category,t.dimensions,t.source,t.optionFactory],()=>{r.value=Symbol("key")}),{optionFactory:c,key:r}}const C=e.defineComponent({__name:"Bar",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(t){const n=t,{optionFactory:c,key:r}=w(n,"bar");return(a,i)=>(e.openBlock(),e.createBlock(e.unref(f),{key:e.unref(r),optionFactory:e.unref(c)},null,8,["optionFactory"]))}});C.install=function(t){t.component("XChartBar",C)};const x=e.defineComponent({__name:"Line",props:{category:{default:"x"},dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(t){const n=t,{optionFactory:c,key:r}=w(n,"line");return(a,i)=>(e.openBlock(),e.createBlock(e.unref(f),{key:e.unref(r),optionFactory:e.unref(c)},null,8,["optionFactory"]))}});x.install=function(t){t.component("XChartLine",x)};const B=e.defineComponent({__name:"Pie",props:{dimensions:{default:()=>[]},source:{type:[Array,Function],default:()=>[]},optionFactory:null},setup(t){const n=t,c=e.ref(Symbol("key")),r=a=>h(this,null,function*(){const i=E(b({},a),{dataset:{dimensions:n.dimensions,source:typeof n.source=="function"?yield n.source():n.source},series:[{type:"pie"}]});return p.merge(i,n.optionFactory?yield n.optionFactory(i):{})});return e.watch(()=>[n.dimensions,n.source,n.optionFactory],()=>{c.value=Symbol("key")}),(a,i)=>(e.openBlock(),e.createBlock(e.unref(f),{key:c.value,optionFactory:r}))}});B.install=function(t){t.component("XChartPie",B)},o.XChart=f,o.XChartBar=C,o.XChartLine=x,o.XChartPie=B,o.XTestSuit=F,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 Props {
13
- width?: string;
14
- height?: string;
15
- option?: Record<string, any>;
16
- optionFactory?: IOptionFactory;
17
- }
18
-
19
- const props = withDefaults(defineProps<Props>(), {
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>
@@ -1,8 +0,0 @@
1
- import Chart from './Chart.vue';
2
- import { App } from 'vue';
3
-
4
- Chart.install = function (app: App) {
5
- app.component('XChart', Chart);
6
- };
7
-
8
- export default Chart;
File without changes