@flowtools/uplot 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.es.js +13 -13
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as U, ref as k, onMounted as V, watch as b, nextTick as $, openBlock as u, createElementBlock as p, renderSlot as D, unref as f, createElementVNode as g, createTextVNode as P, toDisplayString as h, createCommentVNode as S, Fragment as F, renderList as N, normalizeClass as L, normalizeStyle as j } from "vue";
|
|
2
2
|
import M from "uplot";
|
|
3
|
-
import { useElementSize as
|
|
3
|
+
import { useElementSize as R, useVModel as C } from "@vueuse/core";
|
|
4
4
|
const T = (a) => {
|
|
5
5
|
if (typeof a == "object" && a !== null) {
|
|
6
6
|
if (typeof Object.getPrototypeOf == "function") {
|
|
@@ -30,10 +30,10 @@ c.withOptions = (a, ...r) => {
|
|
|
30
30
|
const s = c(...r);
|
|
31
31
|
return c.options = B, s;
|
|
32
32
|
};
|
|
33
|
-
const
|
|
33
|
+
const q = { class: "__uplot-root" }, G = {
|
|
34
34
|
key: 0,
|
|
35
35
|
class: "extra-info"
|
|
36
|
-
},
|
|
36
|
+
}, H = /* @__PURE__ */ g("br", null, null, -1), I = { style: { "text-align": "left" } }, J = { class: "__uplot-legend" }, K = ["onClick"], Q = {
|
|
37
37
|
key: 1,
|
|
38
38
|
class: "__uplot-legend-value"
|
|
39
39
|
}, W = {
|
|
@@ -44,7 +44,7 @@ const G = { class: "__uplot-root" }, H = {
|
|
|
44
44
|
props: {
|
|
45
45
|
options: null,
|
|
46
46
|
data: null,
|
|
47
|
-
|
|
47
|
+
noResetScale: { type: Boolean, default: !1 },
|
|
48
48
|
showDebug: { type: Boolean, default: !1 },
|
|
49
49
|
noFooter: { type: Boolean, default: !1 },
|
|
50
50
|
zoom: { default: () => [null, null] },
|
|
@@ -52,7 +52,7 @@ const G = { class: "__uplot-root" }, H = {
|
|
|
52
52
|
},
|
|
53
53
|
emits: ["select", "cursor", "update:zoom", "update:series"],
|
|
54
54
|
setup(a, { expose: r, emit: s }) {
|
|
55
|
-
const o = a, v = k(), { width: y, height: w } =
|
|
55
|
+
const o = a, v = k(), { width: y, height: w } = R(v), x = C(o, "zoom", s, { passive: !0 }), i = C(o, "series", s, { passive: !0 }), E = {
|
|
56
56
|
title: void 0,
|
|
57
57
|
legend: {
|
|
58
58
|
show: !1
|
|
@@ -117,7 +117,7 @@ const G = { class: "__uplot-root" }, H = {
|
|
|
117
117
|
A();
|
|
118
118
|
});
|
|
119
119
|
}), b(o.data, (e) => {
|
|
120
|
-
if (o.
|
|
120
|
+
if (o.noResetScale) {
|
|
121
121
|
n.setData(e);
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
@@ -132,7 +132,7 @@ const G = { class: "__uplot-root" }, H = {
|
|
|
132
132
|
var l, t;
|
|
133
133
|
typeof e == "object" && (e = ((l = i.value) == null ? void 0 : l.indexOf(e)) || -1), n.setSeries(e, { show: !n.series[e].show }), (t = i.value) != null && t[e] && (i.value[e].show = n.series[e].show);
|
|
134
134
|
}
|
|
135
|
-
return r({ toggleShow: m, uplot: z }), (e, l) => (u(), p("div",
|
|
135
|
+
return r({ toggleShow: m, uplot: z }), (e, l) => (u(), p("div", q, [
|
|
136
136
|
D(e.$slots, "header", {
|
|
137
137
|
series: f(i),
|
|
138
138
|
toggleShow: m
|
|
@@ -142,17 +142,17 @@ const G = { class: "__uplot-root" }, H = {
|
|
|
142
142
|
ref: v,
|
|
143
143
|
class: "__uplot"
|
|
144
144
|
}, null, 512),
|
|
145
|
-
a.showDebug ? (u(), p("div",
|
|
145
|
+
a.showDebug ? (u(), p("div", G, [
|
|
146
146
|
P(h(f(y)) + " x " + h(f(w)) + " ", 1),
|
|
147
|
-
|
|
148
|
-
g("pre",
|
|
147
|
+
H,
|
|
148
|
+
g("pre", I, h(f(i)), 1)
|
|
149
149
|
])) : S("", !0),
|
|
150
150
|
a.noFooter ? S("", !0) : D(e.$slots, "footer", {
|
|
151
151
|
key: 1,
|
|
152
152
|
series: f(i),
|
|
153
153
|
toggleShow: m
|
|
154
154
|
}, () => [
|
|
155
|
-
g("div",
|
|
155
|
+
g("div", J, [
|
|
156
156
|
(u(!0), p(F, null, N(f(i), (t, d) => {
|
|
157
157
|
var _;
|
|
158
158
|
return u(), p("div", {
|
|
@@ -166,8 +166,8 @@ const G = { class: "__uplot-root" }, H = {
|
|
|
166
166
|
style: j({ color: t.stroke || "black" }),
|
|
167
167
|
class: "__uplot-legend-label"
|
|
168
168
|
}, h(t.label), 5)) : S("", !0),
|
|
169
|
-
t.value ? (u(), p("span",
|
|
170
|
-
], 14,
|
|
169
|
+
t.value ? (u(), p("span", Q, h(t.value), 1)) : (u(), p("span", W, "--"))
|
|
170
|
+
], 14, K);
|
|
171
171
|
}), 128))
|
|
172
172
|
])
|
|
173
173
|
])
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("uplot"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","uplot","@vueuse/core"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["change-name"]={},i.vue,i.Uplot,i.core))})(this,function(i,e,z,h){"use strict";const U="",w=c=>{if(typeof c=="object"&&c!==null){if(typeof Object.getPrototypeOf=="function"){const r=Object.getPrototypeOf(c);return r===Object.prototype||r===null}return Object.prototype.toString.call(c)==="[object Object]"}return!1},d=(...c)=>c.reduce((r,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return n&&Object.keys(n).forEach(o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(r[o])&&Array.isArray(n[o])?r[o]=d.options.mergeArrays?Array.from(new Set(r[o].concat(n[o]))):n[o]:w(r[o])&&w(n[o])?r[o]=d(r[o],n[o]):r[o]=n[o])}),r},{}),b={mergeArrays:!0};d.options=b,d.withOptions=(c,...r)=>{d.options={mergeArrays:!0,...c};const n=d(...r);return d.options=b,n};const E={class:"__uplot-root"},O={key:0,class:"extra-info"},D=e.createElementVNode("br",null,null,-1),A={style:{"text-align":"left"}},V={class:"__uplot-legend"},j=["onClick"],C={key:1,class:"__uplot-legend-value"},T={key:2,class:"__uplot-legend-value"},N=e.defineComponent({__name:"Uplot",props:{options:null,data:null,
|
|
1
|
+
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("uplot"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","uplot","@vueuse/core"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["change-name"]={},i.vue,i.Uplot,i.core))})(this,function(i,e,z,h){"use strict";const U="",w=c=>{if(typeof c=="object"&&c!==null){if(typeof Object.getPrototypeOf=="function"){const r=Object.getPrototypeOf(c);return r===Object.prototype||r===null}return Object.prototype.toString.call(c)==="[object Object]"}return!1},d=(...c)=>c.reduce((r,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return n&&Object.keys(n).forEach(o=>{["__proto__","constructor","prototype"].includes(o)||(Array.isArray(r[o])&&Array.isArray(n[o])?r[o]=d.options.mergeArrays?Array.from(new Set(r[o].concat(n[o]))):n[o]:w(r[o])&&w(n[o])?r[o]=d(r[o],n[o]):r[o]=n[o])}),r},{}),b={mergeArrays:!0};d.options=b,d.withOptions=(c,...r)=>{d.options={mergeArrays:!0,...c};const n=d(...r);return d.options=b,n};const E={class:"__uplot-root"},O={key:0,class:"extra-info"},D=e.createElementVNode("br",null,null,-1),A={style:{"text-align":"left"}},V={class:"__uplot-legend"},j=["onClick"],C={key:1,class:"__uplot-legend-value"},T={key:2,class:"__uplot-legend-value"},N=e.defineComponent({__name:"Uplot",props:{options:null,data:null,noResetScale:{type:Boolean,default:!1},showDebug:{type:Boolean,default:!1},noFooter:{type:Boolean,default:!1},zoom:{default:()=>[null,null]},series:null},emits:["select","cursor","update:zoom","update:series"],setup(c,{expose:r,emit:n}){const o=c,_=e.ref(),{width:g,height:y}=h.useElementSize(_),S=h.useVModel(o,"zoom",n,{passive:!0}),p=h.useVModel(o,"series",n,{passive:!0}),P={title:void 0,legend:{show:!1},hooks:{init:[t=>{o.showDebug&&console.log("init",t),p.value=t.series.map((s,l)=>({label:s.label,stroke:typeof s.stroke=="function"?s.stroke(t,l):null,value:null,data:null,show:s.show}))}],setCursor:[t=>{n("cursor",t.cursor),p.value=t.series.map((s,l)=>{var f,u;return{label:s.label,stroke:typeof s.stroke=="function"?s.stroke(t,l):null,value:t.cursor.idx&&t.data[l][t.cursor.idx]?typeof s.value=="function"?s.value(t,t.data[l][t.cursor.idx],l,t.cursor.idx):t.data[l][t.cursor.idx]:null,data:(f=t.cursor)!=null&&f.idx?t.data[l][(u=t.cursor)==null?void 0:u.idx]:null,show:s.show}})}],setSelect:[t=>{n("select",t.select),o.showDebug&&console.log("setSelect",t.select),S.value=[t.posToVal(t.select.left,"x"),t.posToVal(t.select.left+t.select.width,"x")]}],setScale:[t=>{S.value=[t.scales.x.min||null,t.scales.x.max||null]}]}};let a;const k=e.ref();function B(){a&&a.destroy(),a=new z({width:100,height:100,...d(o.options,P)},o.data,_.value),k.value=a,o.zoom[0]!==null&&o.zoom[1]!==null&&a.setScale("x",{min:o.zoom[0],max:o.zoom[1]}),setTimeout(()=>{x()},0)}e.onMounted(()=>{B()}),e.watch([g,y],()=>{e.nextTick(()=>{x()})}),e.watch(o.data,t=>{if(o.noResetScale){a.setData(t);return}a.setData(t,!0),a.redraw()}),e.watch(o.options,(t,s)=>{o.showDebug&&console.log("watch options",t,s),B()});function x(){a.setSize({width:g.value,height:y.value}),o.showDebug&&console.log("resize",a)}function m(t){var s,l;typeof t=="object"&&(t=((s=p.value)==null?void 0:s.indexOf(t))||-1),a.setSeries(t,{show:!a.series[t].show}),(l=p.value)!=null&&l[t]&&(p.value[t].show=a.series[t].show)}return r({toggleShow:m,uplot:k}),(t,s)=>(e.openBlock(),e.createElementBlock("div",E,[e.renderSlot(t.$slots,"header",{series:e.unref(p),toggleShow:m}),e.createElementVNode("div",{ref_key:"el",ref:_,class:"__uplot"},null,512),c.showDebug?(e.openBlock(),e.createElementBlock("div",O,[e.createTextVNode(e.toDisplayString(e.unref(g))+" x "+e.toDisplayString(e.unref(y))+" ",1),D,e.createElementVNode("pre",A,e.toDisplayString(e.unref(p)),1)])):e.createCommentVNode("",!0),c.noFooter?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"footer",{key:1,series:e.unref(p),toggleShow:m},()=>[e.createElementVNode("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),(l,f)=>{var u;return e.openBlock(),e.createElementBlock("div",{key:l.label,class:e.normalizeClass(["__uplot-legend-series",[`__uplot-${(u=l.label)==null?void 0:u.toLowerCase()}`,`__uplot-i-${f}`]]),style:e.normalizeStyle({backgroundColor:l.show?"":"lightgrey"}),onClick:M=>m(f)},[f!==0?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle({color:l.stroke||"black"}),class:"__uplot-legend-label"},e.toDisplayString(l.label),5)):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("span",C,e.toDisplayString(l.value),1)):(e.openBlock(),e.createElementBlock("span",T,"--"))],14,j)}),128))])])]))}}),$="";i.Uplot=N,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|