@orchidui/dashboard 0.0.1 → 0.2.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.
@@ -0,0 +1,100 @@
1
+ const d = (n) => {
2
+ const o = /^rgb\((\s*\d+\s*),(\s*\d+\s*),(\s*\d+\s*)\)$/i;
3
+ if (!o.test(n))
4
+ return null;
5
+ const t = o.exec(n);
6
+ if (!t)
7
+ return null;
8
+ const e = parseInt(t[1].trim(), 10), r = parseInt(t[2].trim(), 10), s = parseInt(t[3].trim(), 10);
9
+ return {
10
+ r: e,
11
+ g: r,
12
+ b: s
13
+ };
14
+ }, m = (n) => {
15
+ const o = /^rgba?\((\s*\d+\s*),(\s*\d+\s*),(\s*\d+\s*),(\s*[\d.]+\s*)\)$/i;
16
+ if (!o.test(n))
17
+ return null;
18
+ const t = o.exec(n);
19
+ if (!t)
20
+ return null;
21
+ const e = parseInt(t[1].trim(), 10), r = parseInt(t[2].trim(), 10), s = parseInt(t[3].trim(), 10), i = parseFloat(t[4].trim());
22
+ return {
23
+ r: e,
24
+ g: r,
25
+ b: s,
26
+ a: i
27
+ };
28
+ }, x = (n) => {
29
+ const o = /^#?([a-f\d]{8})$/i;
30
+ if (!o.test(n))
31
+ return null;
32
+ const t = o.exec(n);
33
+ if (!t)
34
+ return null;
35
+ const e = t[1], r = e.substring(6, 8), s = parseInt(e.substring(0, 2), 16), i = parseInt(e.substring(2, 4), 16), c = parseInt(e.substring(4, 6), 16), f = parseInt(r, 16) / 255;
36
+ return { r: s, g: i, b: c, a: f };
37
+ }, p = (n, o, t, e) => {
38
+ function r(a) {
39
+ const u = a.toString(16);
40
+ return u.length === 1 ? "0" + u : u;
41
+ }
42
+ const s = r(Math.round(n)), i = r(Math.round(o)), c = r(Math.round(t)), f = r(Math.round(e * 255));
43
+ return `#${s}${i}${c}${f}`;
44
+ }, h = (n) => {
45
+ var o;
46
+ try {
47
+ let t = (o = n.replace(
48
+ /^#?([a-f\d])([a-f\d])([a-f\d])$/i,
49
+ // @ts-ignore
50
+ (i, c, f, a) => "#" + c + c + f + f + a + a
51
+ ).substring(1).match(/.{2}/g)) == null ? void 0 : o.map((i) => parseInt(i, 16)), e = t == null ? void 0 : t[0], r = t == null ? void 0 : t[1], s = t == null ? void 0 : t[2];
52
+ return Number.isNaN(e) || Number.isNaN(r) || Number.isNaN(s) || e === void 0 || r === void 0 || s === void 0 ? null : {
53
+ r: e,
54
+ g: r,
55
+ b: s
56
+ };
57
+ } catch {
58
+ return null;
59
+ }
60
+ }, M = (n, o, t) => {
61
+ n = n / 255, o = o / 255, t = t / 255;
62
+ const e = Math.max(n, o, t), r = Math.min(n, o, t);
63
+ let s;
64
+ return e === n ? s = (o - t) / (e - r) : e === o ? s = 2 + (t - n) / (e - r) : s = 4 + (n - o) / (e - r), s *= 60, s < 0 && (s += 360), Number.isNaN(s) && (s = 0), s;
65
+ }, b = (n, o, t) => {
66
+ o = o / 100, t = t / 100;
67
+ let e, r, s, i = [];
68
+ return e = (1 - Math.abs(2 * t - 1)) * o, r = e * (1 - Math.abs(n / 60 % 2 - 1)), s = t - e / 2, n >= 0 && n < 60 && (i = [e, r, 0]), n >= 60 && n < 120 && (i = [r, e, 0]), n >= 120 && n < 180 && (i = [0, e, r]), n >= 180 && n < 240 && (i = [0, r, e]), n >= 240 && n < 300 && (i = [r, 0, e]), n >= 300 && n <= 360 && (i = [e, 0, r]), i.map((c) => Math.round(255 * (c + s)));
69
+ }, g = (n, o, t) => "#" + (16777216 + (t | o << 8 | n << 16)).toString(16).slice(1), N = (n, o, t) => {
70
+ let e = b(n, o, t);
71
+ return { rgb: e, hexA: g(e[0], e[1], e[2]) };
72
+ }, I = (n, o, t) => {
73
+ let e, r, s, i, c, f, a = 0, u = [];
74
+ for (u[0] = n / 255, u[1] = o / 255, u[2] = t / 255, e = u[0], r = u[0], f = 0, s = 0; s < u.length - 1; s++)
75
+ u[s + 1] <= e && (e = u[s + 1]), u[s + 1] >= r && (r = u[s + 1], f = s + 1);
76
+ return f === 0 && (a = (u[1] - u[2]) / (r - e)), f === 1 && (a = 2 + (u[2] - u[0]) / (r - e)), f === 2 && (a = 4 + (u[0] - u[1]) / (r - e)), isNaN(a) && (a = 0), a = a * 60, a < 0 && (a = a + 360), i = (e + r) / 2, e === r ? c = 0 : i < 0.5 ? c = (r - e) / (r + e) : c = (r - e) / (2 - r - e), c = c, { h: a, s: c, l: i };
77
+ }, R = (n, o, t) => {
78
+ n = n % 360 / 360, o = Math.min(1, Math.max(0, o)), t = Math.min(1, Math.max(0, t));
79
+ let e, r, s;
80
+ if (o === 0)
81
+ e = r = s = t;
82
+ else {
83
+ const i = (a, u, l) => (l < 0 && (l += 1), l > 1 && (l -= 1), l < 0.16666666666666666 ? a + (u - a) * 6 * l : l < 0.5 ? u : l < 0.6666666666666666 ? a + (u - a) * (0.6666666666666666 - l) * 6 : a), c = t < 0.5 ? t * (1 + o) : t + o - t * o, f = 2 * t - c;
84
+ e = i(f, c, n + 0.3333333333333333), r = i(f, c, n), s = i(f, c, n - 0.3333333333333333);
85
+ }
86
+ return e = Math.round(e * 255), r = Math.round(r * 255), s = Math.round(s * 255), { r: e, g: r, b: s };
87
+ };
88
+ export {
89
+ x as hex8ToRgba,
90
+ h as hexToRgb,
91
+ N as hsl2Hex,
92
+ b as hsl2Rgb,
93
+ R as hslToRgb,
94
+ d as parseRgb,
95
+ m as parseRgba,
96
+ g as rgb2Hex,
97
+ I as rgbToHsl,
98
+ M as rgbToHue,
99
+ p as rgbaToHex8
100
+ };
@@ -0,0 +1,29 @@
1
+ const r = (t = [], i = []) => {
2
+ const c = {
3
+ fixed: {},
4
+ active: {}
5
+ };
6
+ return t.forEach((e) => {
7
+ c.fixed[e.key] = e.isActive;
8
+ }), i.forEach((e) => {
9
+ c.active[e.key] = e.isActive;
10
+ }), JSON.stringify(c);
11
+ }, n = (t, i, c) => {
12
+ const e = t ? JSON.parse(t) : null;
13
+ return e ? [...Object.keys(e.fixed), ...Object.keys(e.active)].length !== i.length ? (localStorage.removeItem(c), { fixed: null, active: null }) : {
14
+ fixed: Object.keys(e.fixed).map((o) => ({
15
+ ...i.find((a) => a.key === o) || {},
16
+ isActive: e.fixed[o]
17
+ })),
18
+ active: Object.keys(e.active).map((o) => ({
19
+ ...i.find((a) => a.key === o) || {},
20
+ isActive: e.active[o]
21
+ }))
22
+ } : { fixed: null, active: null };
23
+ }, s = (t, i) => localStorage.setItem(t, i), l = (t) => localStorage.getItem(t);
24
+ export {
25
+ n as formatHeadersFromLocalStorage,
26
+ r as formatHeadersToLocalStorage,
27
+ l as getFromLocalStorage,
28
+ s as setInLocalStorage
29
+ };
@@ -0,0 +1,5 @@
1
+ import { a as t } from "../../QuillEditor-CEkhRyf0.js";
2
+ import "vue";
3
+ export {
4
+ t as QuillEditor
5
+ };
@@ -0,0 +1,25 @@
1
+ import { ref as i, onMounted as s, onBeforeUnmount as u, watch as v, markRaw as l } from "vue";
2
+ import * as d from "echarts";
3
+ const p = (t, r) => {
4
+ const e = i(), a = () => {
5
+ t.value && (e.value = l(d.init(t.value)), e.value.setOption(r.value));
6
+ }, n = () => {
7
+ e.value && e.value.dispose(), a();
8
+ };
9
+ return s(() => {
10
+ a(), window.addEventListener("resize", n);
11
+ }), u(() => {
12
+ e.value && e.value.dispose(), window.removeEventListener("resize", n);
13
+ }), v(
14
+ () => r.value,
15
+ (o) => {
16
+ e.value.setOption(o);
17
+ },
18
+ { deep: !0 }
19
+ ), {
20
+ chart: e
21
+ };
22
+ };
23
+ export {
24
+ p as useChart
25
+ };
@@ -0,0 +1,116 @@
1
+ import { computed as s, ref as n, openBlock as p, createElementBlock as c } from "vue";
2
+ import { useChart as m } from "./Dashboard/composables/useChart.js";
3
+ const x = {
4
+ __name: "OcBarChart",
5
+ props: {
6
+ variant: {
7
+ type: String,
8
+ validator: (r) => ["primary", "purple"].includes(r)
9
+ },
10
+ showTooltip: Boolean,
11
+ showLegend: Boolean,
12
+ showGrid: Boolean,
13
+ chartData: Array,
14
+ labelData: Array,
15
+ yAxisFormatter: Function,
16
+ xAxisFormatter: Function,
17
+ tooltipFormatter: Function,
18
+ tooltipValueFormatter: Function
19
+ },
20
+ setup(r) {
21
+ const t = r, a = {
22
+ primary: "#2465DE",
23
+ purple: "#B14AED"
24
+ }, l = s(() => ({
25
+ xAxis: {
26
+ type: "category",
27
+ data: t.labelData,
28
+ axisTick: {
29
+ show: !1
30
+ },
31
+ axisLabel: {
32
+ color: "#9295A5",
33
+ formatter: t.xAxisFormatter
34
+ },
35
+ axisLine: {
36
+ lineStyle: {
37
+ color: "#F2F2F4"
38
+ }
39
+ }
40
+ },
41
+ yAxis: {
42
+ type: "value",
43
+ splitLine: {
44
+ show: !1
45
+ },
46
+ axisLabel: {
47
+ color: "#9295A5",
48
+ formatter: t.yAxisFormatter
49
+ }
50
+ },
51
+ grid: {
52
+ show: t.showGrid,
53
+ right: "10px",
54
+ left: 0,
55
+ top: "10px",
56
+ bottom: 0,
57
+ containLabel: !0
58
+ },
59
+ legend: {
60
+ show: t.showLegend
61
+ },
62
+ tooltip: {
63
+ show: t.showTooltip,
64
+ padding: 0,
65
+ borderWidth: 0,
66
+ borderRadius: 8,
67
+ formatter: (e) => {
68
+ if (t.tooltipFormatter)
69
+ return t.tooltipFormatter(e);
70
+ let o = e.value;
71
+ return t.tooltipValueFormatter && (o = t.tooltipValueFormatter(o)), `
72
+ <div class="py-3 px-4 leading-normal">
73
+ <div class="flex w-full justify-between items-center">
74
+ <span class="uppercase text-[10px] font-medium">
75
+ ${e.name}
76
+ </span>
77
+ </div>
78
+ <div class="text-oc-text font-medium text-[12px]">${o}</div>
79
+ </div>
80
+
81
+ `;
82
+ }
83
+ },
84
+ series: [
85
+ {
86
+ data: t.chartData,
87
+ type: "bar",
88
+ smooth: !0,
89
+ showSymbol: !1,
90
+ itemStyle: {
91
+ color: a[t.variant],
92
+ opacity: 0.5,
93
+ borderRadius: [4, 4, 0, 0]
94
+ // Sets a 4pt radius for the top-left and top-right corners
95
+ },
96
+ emphasis: {
97
+ itemStyle: {
98
+ color: a[t.variant],
99
+ opacity: 1,
100
+ borderRadius: [4, 4, 0, 0]
101
+ // Reapply the 4pt radius for emphasis states
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ })), i = n();
107
+ return m(i, l), (e, o) => (p(), c("div", {
108
+ ref_key: "barChart",
109
+ ref: i,
110
+ class: "w-full"
111
+ }, null, 512));
112
+ }
113
+ };
114
+ export {
115
+ x as default
116
+ };
@@ -0,0 +1,140 @@
1
+ import { computed as d, ref as h, openBlock as i, createElementBlock as s, createElementVNode as l, Fragment as m, renderList as u, toDisplayString as f } from "vue";
2
+ import { useChart as x } from "./Dashboard/composables/useChart.js";
3
+ const y = { class: "grid grid-cols-2" }, v = { class: "pt-4 pb-7 flex flex-col h-[100%]" }, b = { class: "text-[14px] flex flex-1 items-center justify-start pr-2" }, g = { class: "truncate" }, _ = {
4
+ __name: "OcBarRaceChart",
5
+ props: {
6
+ variant: {
7
+ type: String,
8
+ validator: (a) => ["primary", "purple"].includes(a)
9
+ },
10
+ showTooltip: Boolean,
11
+ showLegend: Boolean,
12
+ showGrid: Boolean,
13
+ chartData: Array,
14
+ labelData: Array,
15
+ legendData: Array,
16
+ yAxisFormatter: Function,
17
+ tooltipFormatter: Function,
18
+ tooltipValueFormatter: Function
19
+ },
20
+ setup(a) {
21
+ const t = a, r = {
22
+ primary: "#2465DE",
23
+ purple: "#B14AED"
24
+ }, c = d(() => ({
25
+ xAxis: {
26
+ show: !1,
27
+ type: "value"
28
+ },
29
+ yAxis: {
30
+ inverse: !0,
31
+ data: t.labelData,
32
+ type: "category",
33
+ axisLine: {
34
+ show: !1
35
+ },
36
+ axisTick: {
37
+ show: !1
38
+ },
39
+ splitLine: {
40
+ show: !1
41
+ },
42
+ axisLabel: {
43
+ color: "#03102F",
44
+ fontWeight: 500,
45
+ formatter: t.yAxisFormatter,
46
+ fontSize: 14
47
+ }
48
+ },
49
+ grid: {
50
+ show: t.showGrid,
51
+ right: 0,
52
+ left: 0,
53
+ top: "10px",
54
+ bottom: 0,
55
+ containLabel: !0
56
+ },
57
+ legend: {
58
+ show: t.showLegend
59
+ },
60
+ tooltip: {
61
+ show: t.showTooltip,
62
+ padding: 0,
63
+ borderWidth: 0,
64
+ formatter: (e) => {
65
+ if (t.tooltipFormatter)
66
+ return t.tooltipFormatter(e);
67
+ let o = e.value;
68
+ return t.tooltipValueFormatter && (o = t.tooltipValueFormatter(o)), `
69
+ <div class="py-3 px-4 leading-normal">
70
+ <div class="flex w-full justify-between items-center">
71
+ <span class="uppercase text-[10px] font-medium">
72
+ ${e.name}
73
+ </span>
74
+ </div>
75
+ <div class="text-oc-text font-medium text-[12px]">${o}</div>
76
+ </div>
77
+
78
+ `;
79
+ }
80
+ },
81
+ series: [
82
+ {
83
+ data: t.chartData,
84
+ type: "bar",
85
+ smooth: !0,
86
+ showSymbol: !1,
87
+ label: {
88
+ show: !0,
89
+ position: "insideLeft",
90
+ color: "#03102F",
91
+ opacity: 1,
92
+ align: "left",
93
+ padding: [0, 0],
94
+ fontWeight: 300,
95
+ fontSize: 12
96
+ },
97
+ barGap: 0,
98
+ itemStyle: {
99
+ color: r[t.variant],
100
+ opacity: 0.2,
101
+ borderRadius: [0, 4, 4, 0]
102
+ },
103
+ emphasis: {
104
+ itemStyle: {
105
+ color: r[t.variant]
106
+ }
107
+ }
108
+ },
109
+ {
110
+ data: t.chartData.map((e) => Math.max(...t.chartData) * 2e-3),
111
+ type: "bar",
112
+ smooth: !0,
113
+ showSymbol: !1,
114
+ label: {
115
+ show: !1
116
+ },
117
+ barGap: "-100%",
118
+ itemStyle: {
119
+ color: r[t.variant]
120
+ }
121
+ }
122
+ ]
123
+ })), n = h();
124
+ return x(n, c), (e, o) => (i(), s("div", y, [
125
+ l("div", v, [
126
+ (i(!0), s(m, null, u(a.legendData, (p) => (i(), s("div", b, [
127
+ l("div", g, f(p), 1)
128
+ ]))), 256))
129
+ ]),
130
+ l("div", {
131
+ ref_key: "barRaceChart",
132
+ ref: n,
133
+ class: "h-full"
134
+ }, null, 512)
135
+ ]));
136
+ }
137
+ };
138
+ export {
139
+ _ as default
140
+ };