@quidgest/ui 0.20.0 → 0.20.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/CHANGELOG.md +11 -1
- package/dist/json/api.json +277 -14
- package/dist/manifest/components.json +1 -0
- package/dist/ui.css +193 -0
- package/dist/ui.esm.js +667 -650
- package/dist/ui.js +977 -960
- package/dist/ui.min.css +1 -1
- package/dist/ui.min.js +977 -960
- package/dist/ui.scss +462 -266
- package/esm/components/QGauge/QGauge.d.ts +56 -0
- package/esm/components/QGauge/QGauge.d.ts.map +1 -0
- package/esm/components/QGauge/QGauge.vue.js +305 -0
- package/esm/components/QGauge/QGauge2.vue.js +5 -0
- package/esm/components/QGauge/constants.d.ts +6 -0
- package/esm/components/QGauge/constants.d.ts.map +1 -0
- package/esm/components/QGauge/constants.js +8 -0
- package/esm/components/QGauge/index.d.ts +124 -0
- package/esm/components/QGauge/index.d.ts.map +1 -0
- package/esm/components/QGauge/index.js +6 -0
- package/esm/components/QGauge/types.d.ts +146 -0
- package/esm/components/QGauge/types.d.ts.map +1 -0
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.d.ts.map +1 -1
- package/esm/components/index.js +64 -62
- package/esm/composables/useColor/index.d.ts +8 -0
- package/esm/composables/useColor/index.d.ts.map +1 -1
- package/esm/composables/useColor/index.js +16 -18
- package/esm/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DEFAULT_TEXTS } from './constants';
|
|
2
|
+
import { QGaugeProps } from './types';
|
|
3
|
+
type __VLS_Props = QGaugeProps;
|
|
4
|
+
type __VLS_PublicProps = {
|
|
5
|
+
modelValue?: number;
|
|
6
|
+
} & __VLS_Props;
|
|
7
|
+
declare function __VLS_template(): {
|
|
8
|
+
attrs: Partial<{}>;
|
|
9
|
+
slots: Readonly<{
|
|
10
|
+
/**
|
|
11
|
+
* Custom markup for the visible current value. Also set `valueLabel` when the
|
|
12
|
+
* slot changes how the value should be announced, because slot content does
|
|
13
|
+
* not replace `aria-valuetext`.
|
|
14
|
+
*/
|
|
15
|
+
value?: (props: {
|
|
16
|
+
value: number;
|
|
17
|
+
min: number;
|
|
18
|
+
max: number;
|
|
19
|
+
}) => unknown;
|
|
20
|
+
}> & {
|
|
21
|
+
/**
|
|
22
|
+
* Custom markup for the visible current value. Also set `valueLabel` when the
|
|
23
|
+
* slot changes how the value should be announced, because slot content does
|
|
24
|
+
* not replace `aria-valuetext`.
|
|
25
|
+
*/
|
|
26
|
+
value?: (props: {
|
|
27
|
+
value: number;
|
|
28
|
+
min: number;
|
|
29
|
+
max: number;
|
|
30
|
+
}) => unknown;
|
|
31
|
+
};
|
|
32
|
+
refs: {};
|
|
33
|
+
rootEl: HTMLDivElement;
|
|
34
|
+
};
|
|
35
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
36
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
37
|
+
"update:modelValue": (value: number) => any;
|
|
38
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
39
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
40
|
+
}>, {
|
|
41
|
+
texts: typeof DEFAULT_TEXTS;
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
tickCount: number;
|
|
45
|
+
targetComparison: import('./types').QGaugeTargetComparison;
|
|
46
|
+
showLegend: boolean;
|
|
47
|
+
showTargetLegend: boolean;
|
|
48
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
49
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
50
|
+
export default _default;
|
|
51
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
52
|
+
new (): {
|
|
53
|
+
$slots: S;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=QGauge.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QGauge.vue.d.ts","sourceRoot":"","sources":["../../../src/components/QGauge/QGauge.vue"],"names":[],"mappings":"AA+JA;AAugBC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAO3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA4B1C,KAAK,WAAW,GAAG,WAAW,CAAC;AA6UhC,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,WAAW,CAAC;AAKhB,iBAAS,cAAc;WA6LT,OAAO,IAA6B;;QAngBhD;;;;WAIG;gBACK,CAAC,KAAK,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;QALvE;;;;WAIG;gBACK,CAAC,KAAK,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO;;;;EAmgBxE;AAkCD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;wFASnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { useTheme as e } from "../../composables/theme.js";
|
|
2
|
+
import { resolveColor as t } from "../../composables/useColor/index.js";
|
|
3
|
+
import { useId as n } from "../../composables/uid.js";
|
|
4
|
+
import { DEFAULT_TEXTS as r } from "./constants.js";
|
|
5
|
+
import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, defineComponent as u, mergeModels as d, normalizeClass as f, normalizeStyle as ee, openBlock as p, renderList as m, renderSlot as te, toDisplayString as h, toRef as g, unref as _, useModel as ne } from "vue";
|
|
6
|
+
//#region src/components/QGauge/QGauge.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var re = [
|
|
8
|
+
"id",
|
|
9
|
+
"aria-labelledby",
|
|
10
|
+
"aria-valuemin",
|
|
11
|
+
"aria-valuemax",
|
|
12
|
+
"aria-valuenow",
|
|
13
|
+
"aria-valuetext"
|
|
14
|
+
], ie = ["id"], ae = { class: "q-gauge__visual" }, oe = {
|
|
15
|
+
class: "q-gauge__svg",
|
|
16
|
+
viewBox: "0 0 240 158",
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
focusable: "false"
|
|
19
|
+
}, se = ["d"], ce = ["d"], le = [
|
|
20
|
+
"d",
|
|
21
|
+
"stroke",
|
|
22
|
+
"data-range-from",
|
|
23
|
+
"data-range-to"
|
|
24
|
+
], ue = ["data-value"], de = [
|
|
25
|
+
"x1",
|
|
26
|
+
"y1",
|
|
27
|
+
"x2",
|
|
28
|
+
"y2"
|
|
29
|
+
], fe = ["x", "y"], pe = ["data-target", "data-target-state"], me = [
|
|
30
|
+
"x1",
|
|
31
|
+
"y1",
|
|
32
|
+
"x2",
|
|
33
|
+
"y2"
|
|
34
|
+
], he = [
|
|
35
|
+
"x1",
|
|
36
|
+
"y1",
|
|
37
|
+
"x2",
|
|
38
|
+
"y2"
|
|
39
|
+
], ge = ["x", "y"], _e = ["transform"], ve = { class: "q-gauge__value-row" }, ye = { class: "q-gauge__value" }, be = {
|
|
40
|
+
key: 0,
|
|
41
|
+
class: "q-gauge__unit"
|
|
42
|
+
}, xe = {
|
|
43
|
+
key: 1,
|
|
44
|
+
class: "q-gauge__secondary"
|
|
45
|
+
}, Se = {
|
|
46
|
+
key: 2,
|
|
47
|
+
class: "q-gauge__legend"
|
|
48
|
+
}, Ce = { class: "q-gauge__legend-label" }, we = { class: "q-gauge__legend-label" }, v = 120, y = 126, b = 86, x = 73, S = 97, C = 59, w = 68, T = 104, E = 116, D = 70, O = 180, k = 360, A = /*@__PURE__*/ u({
|
|
49
|
+
__name: "QGauge",
|
|
50
|
+
props: /*@__PURE__*/ d({
|
|
51
|
+
id: {},
|
|
52
|
+
class: {},
|
|
53
|
+
min: { default: 0 },
|
|
54
|
+
max: { default: 100 },
|
|
55
|
+
ranges: {},
|
|
56
|
+
ticks: {},
|
|
57
|
+
tickCount: { default: 5 },
|
|
58
|
+
label: {},
|
|
59
|
+
valueLabel: {},
|
|
60
|
+
target: {},
|
|
61
|
+
targetComparison: { default: "at-least" },
|
|
62
|
+
targetLabel: {},
|
|
63
|
+
showTargetValue: { type: Boolean },
|
|
64
|
+
showLegend: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !0
|
|
67
|
+
},
|
|
68
|
+
showTargetLegend: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !0
|
|
71
|
+
},
|
|
72
|
+
unit: {},
|
|
73
|
+
secondaryLabel: {},
|
|
74
|
+
texts: { default: () => r },
|
|
75
|
+
tickFormatter: {}
|
|
76
|
+
}, {
|
|
77
|
+
modelValue: { default: 0 },
|
|
78
|
+
modelModifiers: {}
|
|
79
|
+
}),
|
|
80
|
+
emits: ["update:modelValue"],
|
|
81
|
+
setup(r) {
|
|
82
|
+
let u = r, d = ne(r, "modelValue"), A = k - O, j = n(g(u, "id")), Te = e(), M = a(() => Number.isFinite(u.min) ? u.min : 0), N = a(() => Number.isFinite(u.max) && u.max > M.value ? u.max : M.value + 1), P = a(() => Number.isFinite(d.value) ? d.value : M.value), F = a(() => Math.min(N.value, Math.max(M.value, P.value))), I = a(() => typeof u.target == "number" && Number.isFinite(u.target) ? u.target : void 0), L = a(() => `${j.value}-label`), R = a(() => !!u.label), Ee = a(() => !!u.unit), De = a(() => !!u.secondaryLabel), z = a(() => typeof u.valueLabel == "string" ? u.valueLabel : u.valueLabel ? u.valueLabel(P.value, M.value, N.value) : String(P.value)), B = a(() => {
|
|
83
|
+
if (I.value === void 0) return;
|
|
84
|
+
if (typeof u.targetLabel == "string") return u.targetLabel;
|
|
85
|
+
if (u.targetLabel) return u.targetLabel(I.value, M.value, N.value);
|
|
86
|
+
let e = u.unit ? ` ${u.unit}` : "";
|
|
87
|
+
return `${Q(I.value)}${e}`;
|
|
88
|
+
}), Oe = a(() => {
|
|
89
|
+
let e = B.value;
|
|
90
|
+
return e === void 0 || u.targetLabel !== void 0 ? e : `${u.texts.target} ${e}`;
|
|
91
|
+
}), V = a(() => {
|
|
92
|
+
if (I.value !== void 0) return u.targetComparison === "at-most" ? P.value <= I.value : P.value >= I.value;
|
|
93
|
+
}), H = a(() => {
|
|
94
|
+
if (V.value !== void 0) return V.value ? "achieved" : "missed";
|
|
95
|
+
}), ke = a(() => {
|
|
96
|
+
if (H.value) return H.value === "achieved" ? u.texts.targetAchieved : u.texts.targetNotAchieved;
|
|
97
|
+
}), U = a(() => (u.ranges ?? []).flatMap((e) => {
|
|
98
|
+
if (!Number.isFinite(e.from) || !Number.isFinite(e.to) || e.to <= e.from) return [];
|
|
99
|
+
let n = Math.max(M.value, e.from), r = Math.min(N.value, e.to);
|
|
100
|
+
return r <= n ? [] : [{
|
|
101
|
+
from: n,
|
|
102
|
+
to: r,
|
|
103
|
+
color: t(e.color, Te.current.value.scheme),
|
|
104
|
+
label: e.label,
|
|
105
|
+
path: Z(Y(n), Y(r), b)
|
|
106
|
+
}];
|
|
107
|
+
})), W = a(() => U.value.flatMap((e) => e.label ? [{
|
|
108
|
+
from: e.from,
|
|
109
|
+
to: e.to,
|
|
110
|
+
color: e.color,
|
|
111
|
+
label: e.label
|
|
112
|
+
}] : [])), G = a(() => u.showTargetLegend && K.value ? [{
|
|
113
|
+
state: "achieved",
|
|
114
|
+
label: u.texts.targetAchieved
|
|
115
|
+
}, {
|
|
116
|
+
state: "missed",
|
|
117
|
+
label: u.texts.targetNotAchieved
|
|
118
|
+
}] : []), Ae = a(() => u.showLegend && (W.value.length > 0 || G.value.length > 0)), je = a(() => {
|
|
119
|
+
if (u.ticks) return [...new Set(u.ticks)].filter((e) => Number.isFinite(e) && e >= M.value && e <= N.value).sort((e, t) => e - t);
|
|
120
|
+
let e = Math.max(2, Math.floor(Number.isFinite(u.tickCount) ? u.tickCount : 5)), t = (N.value - M.value) / (e - 1);
|
|
121
|
+
return Array.from({ length: e }, (e, n) => M.value + t * n);
|
|
122
|
+
}), Me = a(() => je.value.map((e) => {
|
|
123
|
+
let t = Y(e);
|
|
124
|
+
return {
|
|
125
|
+
value: e,
|
|
126
|
+
inner: X(t, x),
|
|
127
|
+
outer: X(t, S),
|
|
128
|
+
label: Le(t),
|
|
129
|
+
text: u.tickFormatter ? u.tickFormatter(e) : Q(e)
|
|
130
|
+
};
|
|
131
|
+
})), K = a(() => {
|
|
132
|
+
if (I.value === void 0 || I.value < M.value || I.value > N.value) return;
|
|
133
|
+
let e = Y(I.value);
|
|
134
|
+
return {
|
|
135
|
+
value: I.value,
|
|
136
|
+
inner: X(e, w),
|
|
137
|
+
outer: X(e, T),
|
|
138
|
+
label: Re(e)
|
|
139
|
+
};
|
|
140
|
+
}), q = a(() => Z(O, k, b)), J = a(() => Y(F.value)), Ne = a(() => `rotate(${Q(J.value - 270)} ${v} ${y})`), Pe = a(() => {
|
|
141
|
+
let e;
|
|
142
|
+
for (let t of U.value) F.value >= t.from && F.value <= t.to && (e = t.label);
|
|
143
|
+
return e;
|
|
144
|
+
}), Fe = a(() => u.valueLabel === void 0 ? [z.value, u.unit].filter(Boolean).join(" ") : z.value), Ie = a(() => [
|
|
145
|
+
Fe.value,
|
|
146
|
+
Pe.value,
|
|
147
|
+
Oe.value,
|
|
148
|
+
ke.value
|
|
149
|
+
].filter(Boolean).join(" "));
|
|
150
|
+
function Y(e) {
|
|
151
|
+
return O + (e - M.value) / (N.value - M.value) * A;
|
|
152
|
+
}
|
|
153
|
+
function X(e, t) {
|
|
154
|
+
let n = e * Math.PI / 180;
|
|
155
|
+
return {
|
|
156
|
+
x: $(v + t * Math.cos(n)),
|
|
157
|
+
y: $(y + t * Math.sin(n))
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function Le(e) {
|
|
161
|
+
let t = X(e, C);
|
|
162
|
+
return e === O || e === k ? {
|
|
163
|
+
x: t.x,
|
|
164
|
+
y: $(t.y + 14)
|
|
165
|
+
} : t;
|
|
166
|
+
}
|
|
167
|
+
function Re(e) {
|
|
168
|
+
let t = X(e, E);
|
|
169
|
+
return e === O ? {
|
|
170
|
+
x: $(t.x + 16),
|
|
171
|
+
y: t.y
|
|
172
|
+
} : e === k ? {
|
|
173
|
+
x: $(t.x - 16),
|
|
174
|
+
y: t.y
|
|
175
|
+
} : t;
|
|
176
|
+
}
|
|
177
|
+
function Z(e, t, n) {
|
|
178
|
+
let r = X(e, n), i = X(t, n), a = +(t - e > 180);
|
|
179
|
+
return `M ${r.x} ${r.y} A ${n} ${n} 0 ${a} 1 ${i.x} ${i.y}`;
|
|
180
|
+
}
|
|
181
|
+
function Q(e) {
|
|
182
|
+
return String($(e));
|
|
183
|
+
}
|
|
184
|
+
function $(e) {
|
|
185
|
+
return Number(e.toFixed(3));
|
|
186
|
+
}
|
|
187
|
+
return (e, t) => (p(), s("div", {
|
|
188
|
+
id: _(j),
|
|
189
|
+
class: f(["q-gauge", u.class]),
|
|
190
|
+
role: "meter",
|
|
191
|
+
"aria-labelledby": R.value ? L.value : void 0,
|
|
192
|
+
"aria-valuemin": M.value,
|
|
193
|
+
"aria-valuemax": N.value,
|
|
194
|
+
"aria-valuenow": F.value,
|
|
195
|
+
"aria-valuetext": Ie.value
|
|
196
|
+
}, [
|
|
197
|
+
R.value ? (p(), s("div", {
|
|
198
|
+
key: 0,
|
|
199
|
+
id: L.value,
|
|
200
|
+
class: "q-gauge__label"
|
|
201
|
+
}, h(u.label), 9, ie)) : o("v-if", !0),
|
|
202
|
+
c("div", ae, [(p(), s("svg", oe, [
|
|
203
|
+
c("path", {
|
|
204
|
+
class: "q-gauge__track-shadow",
|
|
205
|
+
d: q.value
|
|
206
|
+
}, null, 8, se),
|
|
207
|
+
c("path", {
|
|
208
|
+
class: "q-gauge__track",
|
|
209
|
+
d: q.value
|
|
210
|
+
}, null, 8, ce),
|
|
211
|
+
(p(!0), s(i, null, m(U.value, (e, t) => (p(), s("path", {
|
|
212
|
+
key: `${e.from}-${e.to}-${t}`,
|
|
213
|
+
class: "q-gauge__range",
|
|
214
|
+
d: e.path,
|
|
215
|
+
stroke: e.color,
|
|
216
|
+
"data-range-from": e.from,
|
|
217
|
+
"data-range-to": e.to
|
|
218
|
+
}, null, 8, le))), 128)),
|
|
219
|
+
(p(!0), s(i, null, m(Me.value, (e) => (p(), s("g", {
|
|
220
|
+
key: e.value,
|
|
221
|
+
class: "q-gauge__tick",
|
|
222
|
+
"data-value": e.value
|
|
223
|
+
}, [c("line", {
|
|
224
|
+
x1: e.inner.x,
|
|
225
|
+
y1: e.inner.y,
|
|
226
|
+
x2: e.outer.x,
|
|
227
|
+
y2: e.outer.y
|
|
228
|
+
}, null, 8, de), c("text", {
|
|
229
|
+
x: e.label.x,
|
|
230
|
+
y: e.label.y
|
|
231
|
+
}, h(e.text), 9, fe)], 8, ue))), 128)),
|
|
232
|
+
K.value ? (p(), s("g", {
|
|
233
|
+
key: 0,
|
|
234
|
+
class: f(["q-gauge__target", `q-gauge__target--${H.value}`]),
|
|
235
|
+
"data-target": K.value.value,
|
|
236
|
+
"data-target-state": H.value
|
|
237
|
+
}, [
|
|
238
|
+
c("line", {
|
|
239
|
+
class: "q-gauge__target-outline",
|
|
240
|
+
x1: K.value.inner.x,
|
|
241
|
+
y1: K.value.inner.y,
|
|
242
|
+
x2: K.value.outer.x,
|
|
243
|
+
y2: K.value.outer.y
|
|
244
|
+
}, null, 8, me),
|
|
245
|
+
c("line", {
|
|
246
|
+
class: "q-gauge__target-line",
|
|
247
|
+
x1: K.value.inner.x,
|
|
248
|
+
y1: K.value.inner.y,
|
|
249
|
+
x2: K.value.outer.x,
|
|
250
|
+
y2: K.value.outer.y
|
|
251
|
+
}, null, 8, he),
|
|
252
|
+
u.showTargetValue ? (p(), s("text", {
|
|
253
|
+
key: 0,
|
|
254
|
+
class: "q-gauge__target-value",
|
|
255
|
+
x: K.value.label.x,
|
|
256
|
+
y: K.value.label.y
|
|
257
|
+
}, h(B.value), 9, ge)) : o("v-if", !0)
|
|
258
|
+
], 10, pe)) : o("v-if", !0),
|
|
259
|
+
c("g", {
|
|
260
|
+
class: "q-gauge__needle",
|
|
261
|
+
transform: Ne.value
|
|
262
|
+
}, [c("line", {
|
|
263
|
+
x1: v,
|
|
264
|
+
y1: y,
|
|
265
|
+
x2: v,
|
|
266
|
+
y2: D
|
|
267
|
+
})], 8, _e),
|
|
268
|
+
c("circle", {
|
|
269
|
+
class: "q-gauge__hub",
|
|
270
|
+
cx: v,
|
|
271
|
+
cy: y,
|
|
272
|
+
r: "21"
|
|
273
|
+
}),
|
|
274
|
+
c("circle", {
|
|
275
|
+
class: "q-gauge__hub-center",
|
|
276
|
+
cx: v,
|
|
277
|
+
cy: y,
|
|
278
|
+
r: "12"
|
|
279
|
+
})
|
|
280
|
+
]))]),
|
|
281
|
+
c("div", ve, [c("span", ye, [te(e.$slots, "value", {
|
|
282
|
+
value: P.value,
|
|
283
|
+
min: M.value,
|
|
284
|
+
max: N.value
|
|
285
|
+
}, () => [l(h(z.value), 1)])]), Ee.value ? (p(), s("span", be, h(u.unit), 1)) : o("v-if", !0)]),
|
|
286
|
+
De.value ? (p(), s("div", xe, h(u.secondaryLabel), 1)) : o("v-if", !0),
|
|
287
|
+
Ae.value ? (p(), s("ul", Se, [(p(!0), s(i, null, m(W.value, (e, t) => (p(), s("li", {
|
|
288
|
+
key: `${e.from}-${e.to}-${t}`,
|
|
289
|
+
class: "q-gauge__legend-item"
|
|
290
|
+
}, [c("span", {
|
|
291
|
+
class: "q-gauge__legend-swatch",
|
|
292
|
+
style: ee({ backgroundColor: e.color })
|
|
293
|
+
}, null, 4), c("span", Ce, h(e.label), 1)]))), 128)), (p(!0), s(i, null, m(G.value, (e) => (p(), s("li", {
|
|
294
|
+
key: e.state,
|
|
295
|
+
class: f([
|
|
296
|
+
"q-gauge__legend-item",
|
|
297
|
+
"q-gauge__legend-item--target",
|
|
298
|
+
{ "q-gauge__legend-item--active": e.state === H.value }
|
|
299
|
+
])
|
|
300
|
+
}, [c("span", { class: f(["q-gauge__legend-target", `q-gauge__legend-target--${e.state}`]) }, null, 2), c("span", we, h(e.label), 1)], 2))), 128))])) : o("v-if", !0)
|
|
301
|
+
], 10, re));
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
//#endregion
|
|
305
|
+
export { A as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/QGauge/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa;;;;CAIQ,CAAA"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
declare const QGauge: {
|
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
3
|
+
modelValue?: number;
|
|
4
|
+
} & import('../../types/component').QBaseComponentProps & {
|
|
5
|
+
min?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
ranges?: import('./types').QGaugeRange[];
|
|
8
|
+
ticks?: number[];
|
|
9
|
+
tickCount?: number;
|
|
10
|
+
label?: string;
|
|
11
|
+
valueLabel?: string | ((value: number, min: number, max: number) => string);
|
|
12
|
+
target?: number;
|
|
13
|
+
targetComparison?: import('./types').QGaugeTargetComparison;
|
|
14
|
+
targetLabel?: string | ((target: number, min: number, max: number) => string);
|
|
15
|
+
showTargetValue?: boolean;
|
|
16
|
+
showLegend?: boolean;
|
|
17
|
+
showTargetLegend?: boolean;
|
|
18
|
+
unit?: string;
|
|
19
|
+
secondaryLabel?: string;
|
|
20
|
+
texts?: typeof import('./constants').DEFAULT_TEXTS;
|
|
21
|
+
tickFormatter?: (value: number) => string;
|
|
22
|
+
}> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
25
|
+
"update:modelValue": (value: number) => any;
|
|
26
|
+
}, import('vue').PublicProps, {
|
|
27
|
+
texts: typeof import('./constants').DEFAULT_TEXTS;
|
|
28
|
+
min: number;
|
|
29
|
+
max: number;
|
|
30
|
+
tickCount: number;
|
|
31
|
+
targetComparison: import('./types').QGaugeTargetComparison;
|
|
32
|
+
showLegend: boolean;
|
|
33
|
+
showTargetLegend: boolean;
|
|
34
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
35
|
+
P: {};
|
|
36
|
+
B: {};
|
|
37
|
+
D: {};
|
|
38
|
+
C: {};
|
|
39
|
+
M: {};
|
|
40
|
+
Defaults: {};
|
|
41
|
+
}, Readonly<{
|
|
42
|
+
modelValue?: number;
|
|
43
|
+
} & import('../../types/component').QBaseComponentProps & {
|
|
44
|
+
min?: number;
|
|
45
|
+
max?: number;
|
|
46
|
+
ranges?: import('./types').QGaugeRange[];
|
|
47
|
+
ticks?: number[];
|
|
48
|
+
tickCount?: number;
|
|
49
|
+
label?: string;
|
|
50
|
+
valueLabel?: string | ((value: number, min: number, max: number) => string);
|
|
51
|
+
target?: number;
|
|
52
|
+
targetComparison?: import('./types').QGaugeTargetComparison;
|
|
53
|
+
targetLabel?: string | ((target: number, min: number, max: number) => string);
|
|
54
|
+
showTargetValue?: boolean;
|
|
55
|
+
showLegend?: boolean;
|
|
56
|
+
showTargetLegend?: boolean;
|
|
57
|
+
unit?: string;
|
|
58
|
+
secondaryLabel?: string;
|
|
59
|
+
texts?: typeof import('./constants').DEFAULT_TEXTS;
|
|
60
|
+
tickFormatter?: (value: number) => string;
|
|
61
|
+
}> & Readonly<{
|
|
62
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
63
|
+
}>, {}, {}, {}, {}, {
|
|
64
|
+
texts: typeof import('./constants').DEFAULT_TEXTS;
|
|
65
|
+
min: number;
|
|
66
|
+
max: number;
|
|
67
|
+
tickCount: number;
|
|
68
|
+
targetComparison: import('./types').QGaugeTargetComparison;
|
|
69
|
+
showLegend: boolean;
|
|
70
|
+
showTargetLegend: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
__isFragment?: never;
|
|
73
|
+
__isTeleport?: never;
|
|
74
|
+
__isSuspense?: never;
|
|
75
|
+
} & import('vue').ComponentOptionsBase<Readonly<{
|
|
76
|
+
modelValue?: number;
|
|
77
|
+
} & import('../../types/component').QBaseComponentProps & {
|
|
78
|
+
min?: number;
|
|
79
|
+
max?: number;
|
|
80
|
+
ranges?: import('./types').QGaugeRange[];
|
|
81
|
+
ticks?: number[];
|
|
82
|
+
tickCount?: number;
|
|
83
|
+
label?: string;
|
|
84
|
+
valueLabel?: string | ((value: number, min: number, max: number) => string);
|
|
85
|
+
target?: number;
|
|
86
|
+
targetComparison?: import('./types').QGaugeTargetComparison;
|
|
87
|
+
targetLabel?: string | ((target: number, min: number, max: number) => string);
|
|
88
|
+
showTargetValue?: boolean;
|
|
89
|
+
showLegend?: boolean;
|
|
90
|
+
showTargetLegend?: boolean;
|
|
91
|
+
unit?: string;
|
|
92
|
+
secondaryLabel?: string;
|
|
93
|
+
texts?: typeof import('./constants').DEFAULT_TEXTS;
|
|
94
|
+
tickFormatter?: (value: number) => string;
|
|
95
|
+
}> & Readonly<{
|
|
96
|
+
"onUpdate:modelValue"?: ((value: number) => any) | undefined;
|
|
97
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
98
|
+
"update:modelValue": (value: number) => any;
|
|
99
|
+
}, string, {
|
|
100
|
+
texts: typeof import('./constants').DEFAULT_TEXTS;
|
|
101
|
+
min: number;
|
|
102
|
+
max: number;
|
|
103
|
+
tickCount: number;
|
|
104
|
+
targetComparison: import('./types').QGaugeTargetComparison;
|
|
105
|
+
showLegend: boolean;
|
|
106
|
+
showTargetLegend: boolean;
|
|
107
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
108
|
+
$slots: Readonly<{
|
|
109
|
+
value?: (props: {
|
|
110
|
+
value: number;
|
|
111
|
+
min: number;
|
|
112
|
+
max: number;
|
|
113
|
+
}) => unknown;
|
|
114
|
+
}> & {
|
|
115
|
+
value?: (props: {
|
|
116
|
+
value: number;
|
|
117
|
+
min: number;
|
|
118
|
+
max: number;
|
|
119
|
+
}) => unknown;
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
export { QGauge };
|
|
123
|
+
export * from './types';
|
|
124
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/QGauge/index.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA2B,CAAA;AAGvC,OAAO,EAAE,MAAM,EAAE,CAAA;AAGjB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { QBaseComponentProps } from '../../types/component';
|
|
2
|
+
import { DEFAULT_TEXTS } from './constants';
|
|
3
|
+
/**
|
|
4
|
+
* A colored interval on the gauge scale.
|
|
5
|
+
*/
|
|
6
|
+
export type QGaugeRange = {
|
|
7
|
+
/**
|
|
8
|
+
* Inclusive start of the interval.
|
|
9
|
+
*
|
|
10
|
+
* @category Configuration
|
|
11
|
+
*/
|
|
12
|
+
from: number;
|
|
13
|
+
/**
|
|
14
|
+
* Inclusive end of the interval.
|
|
15
|
+
*
|
|
16
|
+
* @category Configuration
|
|
17
|
+
*/
|
|
18
|
+
to: number;
|
|
19
|
+
/**
|
|
20
|
+
* Theme utility color or CSS color used by the interval.
|
|
21
|
+
*
|
|
22
|
+
* @category Presentation
|
|
23
|
+
*/
|
|
24
|
+
color: string;
|
|
25
|
+
/**
|
|
26
|
+
* Accessible description of the interval.
|
|
27
|
+
*
|
|
28
|
+
* @category Content
|
|
29
|
+
*/
|
|
30
|
+
label?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Defines how the current value is compared against the target.
|
|
34
|
+
*/
|
|
35
|
+
export type QGaugeTargetComparison = 'at-least' | 'at-most';
|
|
36
|
+
export type QGaugeProps = QBaseComponentProps & {
|
|
37
|
+
/**
|
|
38
|
+
* Lowest value represented by the scale.
|
|
39
|
+
*
|
|
40
|
+
* @category Configuration
|
|
41
|
+
*/
|
|
42
|
+
min?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Highest value represented by the scale.
|
|
45
|
+
*
|
|
46
|
+
* @category Configuration
|
|
47
|
+
*/
|
|
48
|
+
max?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Colored intervals displayed over the neutral gauge track.
|
|
51
|
+
*
|
|
52
|
+
* @category Configuration
|
|
53
|
+
*/
|
|
54
|
+
ranges?: QGaugeRange[];
|
|
55
|
+
/**
|
|
56
|
+
* Explicit values to label on the scale. Overrides tickCount.
|
|
57
|
+
*
|
|
58
|
+
* @category Configuration
|
|
59
|
+
*/
|
|
60
|
+
ticks?: number[];
|
|
61
|
+
/**
|
|
62
|
+
* Number of evenly spaced scale labels generated when ticks is omitted.
|
|
63
|
+
*
|
|
64
|
+
* @category Configuration
|
|
65
|
+
*/
|
|
66
|
+
tickCount?: number;
|
|
67
|
+
/**
|
|
68
|
+
* KPI title displayed above the gauge.
|
|
69
|
+
*
|
|
70
|
+
* @category Content
|
|
71
|
+
*/
|
|
72
|
+
label?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Text or formatter used as the fallback display and as the current-value part
|
|
75
|
+
* of `aria-valuetext`. Set this when the `value` slot changes how the value
|
|
76
|
+
* should be announced, because slot markup cannot be inferred reliably for
|
|
77
|
+
* accessibility. When provided, it is treated as complete current-value text,
|
|
78
|
+
* so the unit is not appended there automatically.
|
|
79
|
+
*
|
|
80
|
+
* @category Content
|
|
81
|
+
*/
|
|
82
|
+
valueLabel?: string | ((value: number, min: number, max: number) => string);
|
|
83
|
+
/**
|
|
84
|
+
* Target value highlighted on the gauge track.
|
|
85
|
+
*
|
|
86
|
+
* @category Configuration
|
|
87
|
+
*/
|
|
88
|
+
target?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Target comparison mode. Use `at-least` when values should reach or exceed
|
|
91
|
+
* the target, and `at-most` when values should stay at or below it.
|
|
92
|
+
*
|
|
93
|
+
* @category Configuration
|
|
94
|
+
*/
|
|
95
|
+
targetComparison?: QGaugeTargetComparison;
|
|
96
|
+
/**
|
|
97
|
+
* Text or formatter used to describe the target value.
|
|
98
|
+
*
|
|
99
|
+
* @category Content
|
|
100
|
+
*/
|
|
101
|
+
targetLabel?: string | ((target: number, min: number, max: number) => string);
|
|
102
|
+
/**
|
|
103
|
+
* Whether the target value label is displayed next to the target marker.
|
|
104
|
+
*
|
|
105
|
+
* @category Presentation
|
|
106
|
+
*/
|
|
107
|
+
showTargetValue?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the legend is displayed below the gauge.
|
|
110
|
+
*
|
|
111
|
+
* @category Presentation
|
|
112
|
+
*/
|
|
113
|
+
showLegend?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Whether target status items are included in the legend when a target marker
|
|
116
|
+
* is visible. The legend itself must also be enabled with `showLegend`.
|
|
117
|
+
*
|
|
118
|
+
* @category Presentation
|
|
119
|
+
*/
|
|
120
|
+
showTargetLegend?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Unit displayed next to the current value.
|
|
123
|
+
*
|
|
124
|
+
* @category Content
|
|
125
|
+
*/
|
|
126
|
+
unit?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Supporting information displayed below the current value.
|
|
129
|
+
*
|
|
130
|
+
* @category Content
|
|
131
|
+
*/
|
|
132
|
+
secondaryLabel?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Custom text configurations.
|
|
135
|
+
*
|
|
136
|
+
* @category Configuration
|
|
137
|
+
*/
|
|
138
|
+
texts?: typeof DEFAULT_TEXTS;
|
|
139
|
+
/**
|
|
140
|
+
* Formatter used for scale labels.
|
|
141
|
+
*
|
|
142
|
+
* @category Configuration
|
|
143
|
+
*/
|
|
144
|
+
tickFormatter?: (value: number) => string;
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/QGauge/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,SAAS,CAAA;AAE3D,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG;IAC/C;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;IAEtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAEhB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;IAE3E;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAA;IAEzC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,CAAA;IAE7E;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAE1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,aAAa,CAAA;IAE5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACzC,CAAA"}
|