@liquid-js/lyr-extras 0.0.0-stage → 22.0.0-alpha.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.
- package/LICENSE.txt +23 -0
- package/README.md +61 -2
- package/fesm2022/liquid-js-lyr-extras-chart.mjs +871 -0
- package/fesm2022/liquid-js-lyr-extras-chart.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-color-picker.mjs +819 -0
- package/fesm2022/liquid-js-lyr-extras-color-picker.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-editor.mjs +921 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-editor.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-viewer.mjs +369 -0
- package/fesm2022/liquid-js-lyr-extras-markdown-viewer.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-mask.mjs +238 -0
- package/fesm2022/liquid-js-lyr-extras-mask.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-media.mjs +1142 -0
- package/fesm2022/liquid-js-lyr-extras-media.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-phone-input.mjs +862 -0
- package/fesm2022/liquid-js-lyr-extras-phone-input.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras-qr-code.mjs +236 -0
- package/fesm2022/liquid-js-lyr-extras-qr-code.mjs.map +1 -0
- package/fesm2022/liquid-js-lyr-extras.mjs +0 -0
- package/package.json +159 -3
- package/types/liquid-js-lyr-extras-chart.d.ts +294 -0
- package/types/liquid-js-lyr-extras-color-picker.d.ts +311 -0
- package/types/liquid-js-lyr-extras-markdown-editor.d.ts +367 -0
- package/types/liquid-js-lyr-extras-markdown-viewer.d.ts +174 -0
- package/types/liquid-js-lyr-extras-mask.d.ts +130 -0
- package/types/liquid-js-lyr-extras-media.d.ts +517 -0
- package/types/liquid-js-lyr-extras-phone-input.d.ts +428 -0
- package/types/liquid-js-lyr-extras-qr-code.d.ts +113 -0
- package/types/liquid-js-lyr-extras.d.ts +1 -0
|
@@ -0,0 +1,871 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, ElementRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, inject, input, makeEnvironmentProviders, provideEnvironmentInitializer, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { ArcElement, BarController, BarElement, CategoryScale, Chart, DoughnutController, Filler, Legend, LineController, LineElement, LinearScale, PieController, PointElement, Tooltip } from "chart.js";
|
|
4
|
+
import { merge } from "chart.js/helpers";
|
|
5
|
+
import { NbJSThemesRegistry, NbThemeService, NbThemeStyleChanges } from "@liquid-js/lyr-core";
|
|
6
|
+
const STATUSES = [
|
|
7
|
+
"basic",
|
|
8
|
+
"primary",
|
|
9
|
+
"success",
|
|
10
|
+
"info",
|
|
11
|
+
"warning",
|
|
12
|
+
"danger",
|
|
13
|
+
"control"
|
|
14
|
+
];
|
|
15
|
+
function tint(color, alpha) {
|
|
16
|
+
const hex = /^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(color);
|
|
17
|
+
if (hex) {
|
|
18
|
+
const [r, g, b] = hex.slice(1).map((channel) => parseInt(channel, 16));
|
|
19
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
20
|
+
}
|
|
21
|
+
const rgb = /^rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(color);
|
|
22
|
+
return rgb ? `rgba(${rgb[1]}, ${rgb[2]}, ${rgb[3]}, ${alpha})` : color;
|
|
23
|
+
}
|
|
24
|
+
function surfaceOf(element) {
|
|
25
|
+
for (let current = element; current; current = current.parentElement) {
|
|
26
|
+
const background = getComputedStyle(current).backgroundColor;
|
|
27
|
+
if (background && background !== "transparent" && !/^rgba\(.*,\s*0\)$/.test(background)) return background;
|
|
28
|
+
}
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
function pixels(length, rootFontSize) {
|
|
32
|
+
const value = parseFloat(length);
|
|
33
|
+
return length.trim().endsWith("rem") ? value * rootFontSize : value;
|
|
34
|
+
}
|
|
35
|
+
function nbReadChartTheme(element, jsTheme) {
|
|
36
|
+
const style = getComputedStyle(element);
|
|
37
|
+
const rootFontSize = parseFloat(getComputedStyle(element.ownerDocument.documentElement).fontSize) || 16;
|
|
38
|
+
const variable = (name) => style.getPropertyValue(`--${name}`).trim();
|
|
39
|
+
const js = jsTheme?.variables ?? {};
|
|
40
|
+
const status = Object.fromEntries(STATUSES.map((name) => {
|
|
41
|
+
const color = (name === "basic" ? variable("text-hint-color") || js["fg"] : variable(`color-${name}-default`) || js[name]) || js["fgText"] || "#808080";
|
|
42
|
+
return [name, {
|
|
43
|
+
color,
|
|
44
|
+
tint: variable(`color-${name}-transparent-200`) || tint(color, .16)
|
|
45
|
+
}];
|
|
46
|
+
}));
|
|
47
|
+
const colorOf = (value) => {
|
|
48
|
+
if (value in status) return status[value];
|
|
49
|
+
let color = value;
|
|
50
|
+
if (/^[a-z][\w-]*$/i.test(value)) {
|
|
51
|
+
const custom = variable(`color-${value}-default`);
|
|
52
|
+
if (custom) return {
|
|
53
|
+
color: custom,
|
|
54
|
+
tint: variable(`color-${value}-transparent-200`) || tint(custom, .16)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (value.startsWith("var(")) {
|
|
58
|
+
element.style.setProperty("--nb-chart-color", value);
|
|
59
|
+
color = getComputedStyle(element).getPropertyValue("--nb-chart-color").trim() || value;
|
|
60
|
+
element.style.removeProperty("--nb-chart-color");
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
color,
|
|
64
|
+
tint: tint(color, .16)
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const caption = variable("text-caption-font-size");
|
|
68
|
+
return {
|
|
69
|
+
status,
|
|
70
|
+
colorOf,
|
|
71
|
+
text: variable("text-basic-color") || js["fgText"] || style.color,
|
|
72
|
+
hint: variable("text-hint-color") || js["fg"] || style.color,
|
|
73
|
+
grid: variable("divider-color") || js["separator"] || "rgba(128, 128, 128, 0.24)",
|
|
74
|
+
surface: surfaceOf(element) || variable("background-basic-color-1") || js["bg"] || "#ffffff",
|
|
75
|
+
tooltipBackground: variable("tooltip-background-color") || variable("background-alternative-color-3") || js["fgText"] || "#222b45",
|
|
76
|
+
tooltipText: variable("tooltip-text-color") || variable("text-alternate-color") || js["bg"] || "#ffffff",
|
|
77
|
+
fontFamily: variable("font-family-primary") || js["fontMain"] || style.fontFamily,
|
|
78
|
+
fontSize: caption ? pixels(caption, rootFontSize) : .75 * rootFontSize
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const NB_LINE_CHART_PARTS = [
|
|
82
|
+
LineController,
|
|
83
|
+
LineElement,
|
|
84
|
+
PointElement,
|
|
85
|
+
CategoryScale,
|
|
86
|
+
LinearScale,
|
|
87
|
+
Filler,
|
|
88
|
+
Legend,
|
|
89
|
+
Tooltip
|
|
90
|
+
];
|
|
91
|
+
const NB_BAR_CHART_PARTS = [
|
|
92
|
+
BarController,
|
|
93
|
+
BarElement,
|
|
94
|
+
CategoryScale,
|
|
95
|
+
LinearScale,
|
|
96
|
+
Legend,
|
|
97
|
+
Tooltip
|
|
98
|
+
];
|
|
99
|
+
const NB_PIE_CHART_PARTS = [
|
|
100
|
+
PieController,
|
|
101
|
+
DoughnutController,
|
|
102
|
+
ArcElement,
|
|
103
|
+
Legend,
|
|
104
|
+
Tooltip
|
|
105
|
+
];
|
|
106
|
+
function provideNbCharts(...parts) {
|
|
107
|
+
return makeEnvironmentProviders([provideEnvironmentInitializer(() => Chart.register(...parts))]);
|
|
108
|
+
}
|
|
109
|
+
const NB_CHART_PALETTE = [
|
|
110
|
+
"primary",
|
|
111
|
+
"success",
|
|
112
|
+
"info",
|
|
113
|
+
"warning",
|
|
114
|
+
"danger"
|
|
115
|
+
];
|
|
116
|
+
const SLICED = /* @__PURE__ */ new Set([
|
|
117
|
+
"pie",
|
|
118
|
+
"doughnut",
|
|
119
|
+
"polarArea"
|
|
120
|
+
]);
|
|
121
|
+
const LINED = /* @__PURE__ */ new Set(["line", "radar"]);
|
|
122
|
+
const CARTESIAN = /* @__PURE__ */ new Set([
|
|
123
|
+
"line",
|
|
124
|
+
"bar",
|
|
125
|
+
"scatter",
|
|
126
|
+
"bubble"
|
|
127
|
+
]);
|
|
128
|
+
function themedData(type, data, theme, palette) {
|
|
129
|
+
const color = (index) => theme.colorOf(palette[index % palette.length] ?? "primary");
|
|
130
|
+
const datasets = data.datasets.map((dataset, index) => {
|
|
131
|
+
const own = dataset;
|
|
132
|
+
if (own["backgroundColor"] !== void 0 || own["borderColor"] !== void 0) return dataset;
|
|
133
|
+
if (SLICED.has(type)) return {
|
|
134
|
+
...dataset,
|
|
135
|
+
backgroundColor: dataset.data.map((_, slice) => color(slice).color),
|
|
136
|
+
borderColor: theme.surface
|
|
137
|
+
};
|
|
138
|
+
const { color: main, tint } = color(index);
|
|
139
|
+
return LINED.has(type) ? {
|
|
140
|
+
...dataset,
|
|
141
|
+
borderColor: main,
|
|
142
|
+
backgroundColor: tint,
|
|
143
|
+
pointBackgroundColor: main
|
|
144
|
+
} : {
|
|
145
|
+
...dataset,
|
|
146
|
+
borderColor: main,
|
|
147
|
+
backgroundColor: main
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
...data,
|
|
152
|
+
datasets
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function themedOptions(type, options, theme) {
|
|
156
|
+
const axis = {
|
|
157
|
+
ticks: { color: theme.hint },
|
|
158
|
+
grid: { color: theme.grid },
|
|
159
|
+
border: { color: theme.grid }
|
|
160
|
+
};
|
|
161
|
+
const defaults = {
|
|
162
|
+
color: theme.text,
|
|
163
|
+
borderColor: theme.grid,
|
|
164
|
+
font: {
|
|
165
|
+
family: theme.fontFamily,
|
|
166
|
+
size: theme.fontSize
|
|
167
|
+
},
|
|
168
|
+
plugins: {
|
|
169
|
+
legend: { labels: { color: theme.text } },
|
|
170
|
+
tooltip: {
|
|
171
|
+
backgroundColor: theme.tooltipBackground,
|
|
172
|
+
titleColor: theme.tooltipText,
|
|
173
|
+
bodyColor: theme.tooltipText,
|
|
174
|
+
footerColor: theme.tooltipText
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
if (CARTESIAN.has(type)) defaults["scales"] = {
|
|
179
|
+
x: axis,
|
|
180
|
+
y: axis
|
|
181
|
+
};
|
|
182
|
+
else if (type === "radar" || type === "polarArea") defaults["scales"] = { r: {
|
|
183
|
+
...axis,
|
|
184
|
+
angleLines: { color: theme.grid },
|
|
185
|
+
pointLabels: { color: theme.text }
|
|
186
|
+
} };
|
|
187
|
+
return merge({}, [defaults, options ?? {}]);
|
|
188
|
+
}
|
|
189
|
+
var NbChartComponent = class NbChartComponent {
|
|
190
|
+
constructor() {
|
|
191
|
+
this.type = input.required(...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
192
|
+
this.data = input.required(...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
193
|
+
this.options = input(...ngDevMode ? [void 0, { debugName: "options" }] : /* istanbul ignore next */ []);
|
|
194
|
+
this.plugins = input(new Array(), ...ngDevMode ? [{ debugName: "plugins" }] : /* istanbul ignore next */ []);
|
|
195
|
+
this.palette = input(NB_CHART_PALETTE, ...ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []);
|
|
196
|
+
this.ariaLabel = input(void 0, {
|
|
197
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
198
|
+
alias: "aria-label"
|
|
199
|
+
});
|
|
200
|
+
this.drawn = signal(void 0, ...ngDevMode ? [{ debugName: "drawn" }] : /* istanbul ignore next */ []);
|
|
201
|
+
this.chart = this.drawn.asReadonly();
|
|
202
|
+
this.canvas = viewChild.required("canvas", ...ngDevMode ? [{ debugName: "canvas" }] : /* istanbul ignore next */ []);
|
|
203
|
+
const host = inject(ElementRef).nativeElement;
|
|
204
|
+
const themeService = inject(NbThemeService, { optional: true });
|
|
205
|
+
const jsThemes = inject(NbJSThemesRegistry, { optional: true });
|
|
206
|
+
const themeStyle = inject(NbThemeStyleChanges).changes;
|
|
207
|
+
afterRenderEffect(() => {
|
|
208
|
+
const themeName = themeService?.theme();
|
|
209
|
+
themeService?.contentSize();
|
|
210
|
+
themeStyle();
|
|
211
|
+
const type = this.type();
|
|
212
|
+
const data = this.data();
|
|
213
|
+
const options = this.options();
|
|
214
|
+
const plugins = this.plugins();
|
|
215
|
+
const palette = this.palette();
|
|
216
|
+
const theme = nbReadChartTheme(host, themeName && jsThemes?.has(themeName) ? jsThemes.get(themeName) : void 0);
|
|
217
|
+
const config = {
|
|
218
|
+
type,
|
|
219
|
+
data: themedData(type, data, theme, palette),
|
|
220
|
+
options: themedOptions(type, options, theme),
|
|
221
|
+
plugins
|
|
222
|
+
};
|
|
223
|
+
untracked(() => {
|
|
224
|
+
let chart = this.chart();
|
|
225
|
+
if (chart && chart.config.type !== type) {
|
|
226
|
+
chart.destroy();
|
|
227
|
+
chart = void 0;
|
|
228
|
+
}
|
|
229
|
+
if (chart) {
|
|
230
|
+
chart.data = config.data;
|
|
231
|
+
chart.options = config.options ?? {};
|
|
232
|
+
chart.update();
|
|
233
|
+
} else this.drawn.set(new Chart(this.canvas().nativeElement, config));
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
const destroyRef = inject(DestroyRef);
|
|
237
|
+
afterNextRender(() => {
|
|
238
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
239
|
+
let width = host.clientWidth;
|
|
240
|
+
const observer = new ResizeObserver(() => {
|
|
241
|
+
if (host.clientWidth !== width) {
|
|
242
|
+
width = host.clientWidth;
|
|
243
|
+
this.chart()?.resize();
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
observer.observe(host);
|
|
247
|
+
destroyRef.onDestroy(() => observer.disconnect());
|
|
248
|
+
});
|
|
249
|
+
destroyRef.onDestroy(() => this.chart()?.destroy());
|
|
250
|
+
}
|
|
251
|
+
static {
|
|
252
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
253
|
+
minVersion: "12.0.0",
|
|
254
|
+
version: "22.3.0",
|
|
255
|
+
ngImport: i0,
|
|
256
|
+
type: NbChartComponent,
|
|
257
|
+
deps: [],
|
|
258
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
static {
|
|
262
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
263
|
+
minVersion: "17.2.0",
|
|
264
|
+
version: "22.3.0",
|
|
265
|
+
type: NbChartComponent,
|
|
266
|
+
isStandalone: true,
|
|
267
|
+
selector: "nb-chart",
|
|
268
|
+
inputs: {
|
|
269
|
+
type: {
|
|
270
|
+
classPropertyName: "type",
|
|
271
|
+
publicName: "type",
|
|
272
|
+
isSignal: true,
|
|
273
|
+
isRequired: true,
|
|
274
|
+
transformFunction: null
|
|
275
|
+
},
|
|
276
|
+
data: {
|
|
277
|
+
classPropertyName: "data",
|
|
278
|
+
publicName: "data",
|
|
279
|
+
isSignal: true,
|
|
280
|
+
isRequired: true,
|
|
281
|
+
transformFunction: null
|
|
282
|
+
},
|
|
283
|
+
options: {
|
|
284
|
+
classPropertyName: "options",
|
|
285
|
+
publicName: "options",
|
|
286
|
+
isSignal: true,
|
|
287
|
+
isRequired: false,
|
|
288
|
+
transformFunction: null
|
|
289
|
+
},
|
|
290
|
+
plugins: {
|
|
291
|
+
classPropertyName: "plugins",
|
|
292
|
+
publicName: "plugins",
|
|
293
|
+
isSignal: true,
|
|
294
|
+
isRequired: false,
|
|
295
|
+
transformFunction: null
|
|
296
|
+
},
|
|
297
|
+
palette: {
|
|
298
|
+
classPropertyName: "palette",
|
|
299
|
+
publicName: "palette",
|
|
300
|
+
isSignal: true,
|
|
301
|
+
isRequired: false,
|
|
302
|
+
transformFunction: null
|
|
303
|
+
},
|
|
304
|
+
ariaLabel: {
|
|
305
|
+
classPropertyName: "ariaLabel",
|
|
306
|
+
publicName: "aria-label",
|
|
307
|
+
isSignal: true,
|
|
308
|
+
isRequired: false,
|
|
309
|
+
transformFunction: null
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
viewQueries: [{
|
|
313
|
+
propertyName: "canvas",
|
|
314
|
+
first: true,
|
|
315
|
+
predicate: ["canvas"],
|
|
316
|
+
descendants: true,
|
|
317
|
+
isSignal: true
|
|
318
|
+
}],
|
|
319
|
+
ngImport: i0,
|
|
320
|
+
template: "<canvas #canvas role=\"img\" [attr.aria-label]=\"ariaLabel() ?? null\"></canvas>",
|
|
321
|
+
isInline: true,
|
|
322
|
+
styles: [":host{display:block;position:relative}canvas{display:block;max-width:100%}\n"]
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
327
|
+
minVersion: "12.0.0",
|
|
328
|
+
version: "22.3.0",
|
|
329
|
+
ngImport: i0,
|
|
330
|
+
type: NbChartComponent,
|
|
331
|
+
decorators: [{
|
|
332
|
+
type: Component,
|
|
333
|
+
args: [{
|
|
334
|
+
selector: "nb-chart",
|
|
335
|
+
template: "<canvas #canvas role=\"img\" [attr.aria-label]=\"ariaLabel() ?? null\"></canvas>",
|
|
336
|
+
styles: [":host{display:block;position:relative}canvas{display:block;max-width:100%}\n"]
|
|
337
|
+
}]
|
|
338
|
+
}],
|
|
339
|
+
ctorParameters: () => [],
|
|
340
|
+
propDecorators: {
|
|
341
|
+
type: [{
|
|
342
|
+
type: i0.Input,
|
|
343
|
+
args: [{
|
|
344
|
+
isSignal: true,
|
|
345
|
+
alias: "type",
|
|
346
|
+
required: true
|
|
347
|
+
}]
|
|
348
|
+
}],
|
|
349
|
+
data: [{
|
|
350
|
+
type: i0.Input,
|
|
351
|
+
args: [{
|
|
352
|
+
isSignal: true,
|
|
353
|
+
alias: "data",
|
|
354
|
+
required: true
|
|
355
|
+
}]
|
|
356
|
+
}],
|
|
357
|
+
options: [{
|
|
358
|
+
type: i0.Input,
|
|
359
|
+
args: [{
|
|
360
|
+
isSignal: true,
|
|
361
|
+
alias: "options",
|
|
362
|
+
required: false
|
|
363
|
+
}]
|
|
364
|
+
}],
|
|
365
|
+
plugins: [{
|
|
366
|
+
type: i0.Input,
|
|
367
|
+
args: [{
|
|
368
|
+
isSignal: true,
|
|
369
|
+
alias: "plugins",
|
|
370
|
+
required: false
|
|
371
|
+
}]
|
|
372
|
+
}],
|
|
373
|
+
palette: [{
|
|
374
|
+
type: i0.Input,
|
|
375
|
+
args: [{
|
|
376
|
+
isSignal: true,
|
|
377
|
+
alias: "palette",
|
|
378
|
+
required: false
|
|
379
|
+
}]
|
|
380
|
+
}],
|
|
381
|
+
ariaLabel: [{
|
|
382
|
+
type: i0.Input,
|
|
383
|
+
args: [{
|
|
384
|
+
isSignal: true,
|
|
385
|
+
alias: "aria-label",
|
|
386
|
+
required: false
|
|
387
|
+
}]
|
|
388
|
+
}],
|
|
389
|
+
canvas: [{
|
|
390
|
+
type: i0.ViewChild,
|
|
391
|
+
args: ["canvas", { isSignal: true }]
|
|
392
|
+
}]
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
function colorsOf(items) {
|
|
396
|
+
const taken = new Set(items.map((item) => item.color ?? item.status).filter((color) => color !== void 0));
|
|
397
|
+
const free = NB_CHART_PALETTE.filter((color) => !taken.has(color));
|
|
398
|
+
const palette = free.length ? free : NB_CHART_PALETTE;
|
|
399
|
+
let next = 0;
|
|
400
|
+
return items.map((item) => item.color ?? item.status ?? palette[next++ % palette.length]);
|
|
401
|
+
}
|
|
402
|
+
var NbLineChartComponent = class NbLineChartComponent {
|
|
403
|
+
constructor() {
|
|
404
|
+
this.labels = input([], ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
405
|
+
this.series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
|
|
406
|
+
this.area = input(false, {
|
|
407
|
+
...ngDevMode ? { debugName: "area" } : /* istanbul ignore next */ {},
|
|
408
|
+
transform: booleanAttribute
|
|
409
|
+
});
|
|
410
|
+
this.smooth = input(false, {
|
|
411
|
+
...ngDevMode ? { debugName: "smooth" } : /* istanbul ignore next */ {},
|
|
412
|
+
transform: booleanAttribute
|
|
413
|
+
});
|
|
414
|
+
this.ariaLabel = input(void 0, {
|
|
415
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
416
|
+
alias: "aria-label"
|
|
417
|
+
});
|
|
418
|
+
this.palette = computed(() => colorsOf(this.series()), ...ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []);
|
|
419
|
+
this.data = computed(() => ({
|
|
420
|
+
labels: [...this.labels()],
|
|
421
|
+
datasets: this.series().map((series) => ({
|
|
422
|
+
label: series.name,
|
|
423
|
+
data: [...series.data],
|
|
424
|
+
fill: series.area ?? this.area() ? "origin" : false,
|
|
425
|
+
tension: this.smooth() ? .4 : 0,
|
|
426
|
+
...series.dashed ? {
|
|
427
|
+
borderDash: [6, 4],
|
|
428
|
+
borderWidth: 2,
|
|
429
|
+
pointRadius: 0,
|
|
430
|
+
pointHoverRadius: 0
|
|
431
|
+
} : {}
|
|
432
|
+
}))
|
|
433
|
+
}), ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
434
|
+
this.options = computed(() => ({ plugins: { legend: { display: this.series().length > 1 } } }), ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
435
|
+
}
|
|
436
|
+
static {
|
|
437
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
438
|
+
minVersion: "12.0.0",
|
|
439
|
+
version: "22.3.0",
|
|
440
|
+
ngImport: i0,
|
|
441
|
+
type: NbLineChartComponent,
|
|
442
|
+
deps: [],
|
|
443
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
static {
|
|
447
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
448
|
+
minVersion: "17.1.0",
|
|
449
|
+
version: "22.3.0",
|
|
450
|
+
type: NbLineChartComponent,
|
|
451
|
+
isStandalone: true,
|
|
452
|
+
selector: "nb-line-chart",
|
|
453
|
+
inputs: {
|
|
454
|
+
labels: {
|
|
455
|
+
classPropertyName: "labels",
|
|
456
|
+
publicName: "labels",
|
|
457
|
+
isSignal: true,
|
|
458
|
+
isRequired: false,
|
|
459
|
+
transformFunction: null
|
|
460
|
+
},
|
|
461
|
+
series: {
|
|
462
|
+
classPropertyName: "series",
|
|
463
|
+
publicName: "series",
|
|
464
|
+
isSignal: true,
|
|
465
|
+
isRequired: false,
|
|
466
|
+
transformFunction: null
|
|
467
|
+
},
|
|
468
|
+
area: {
|
|
469
|
+
classPropertyName: "area",
|
|
470
|
+
publicName: "area",
|
|
471
|
+
isSignal: true,
|
|
472
|
+
isRequired: false,
|
|
473
|
+
transformFunction: null
|
|
474
|
+
},
|
|
475
|
+
smooth: {
|
|
476
|
+
classPropertyName: "smooth",
|
|
477
|
+
publicName: "smooth",
|
|
478
|
+
isSignal: true,
|
|
479
|
+
isRequired: false,
|
|
480
|
+
transformFunction: null
|
|
481
|
+
},
|
|
482
|
+
ariaLabel: {
|
|
483
|
+
classPropertyName: "ariaLabel",
|
|
484
|
+
publicName: "aria-label",
|
|
485
|
+
isSignal: true,
|
|
486
|
+
isRequired: false,
|
|
487
|
+
transformFunction: null
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
ngImport: i0,
|
|
491
|
+
template: "<nb-chart type=\"line\" [data]=\"data()\" [options]=\"options()\" [palette]=\"palette()\" [aria-label]=\"ariaLabel()\" />",
|
|
492
|
+
isInline: true,
|
|
493
|
+
styles: [":host{display:block}\n"],
|
|
494
|
+
dependencies: [{
|
|
495
|
+
kind: "component",
|
|
496
|
+
type: NbChartComponent,
|
|
497
|
+
selector: "nb-chart",
|
|
498
|
+
inputs: [
|
|
499
|
+
"type",
|
|
500
|
+
"data",
|
|
501
|
+
"options",
|
|
502
|
+
"plugins",
|
|
503
|
+
"palette",
|
|
504
|
+
"aria-label"
|
|
505
|
+
]
|
|
506
|
+
}]
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
511
|
+
minVersion: "12.0.0",
|
|
512
|
+
version: "22.3.0",
|
|
513
|
+
ngImport: i0,
|
|
514
|
+
type: NbLineChartComponent,
|
|
515
|
+
decorators: [{
|
|
516
|
+
type: Component,
|
|
517
|
+
args: [{
|
|
518
|
+
selector: "nb-line-chart",
|
|
519
|
+
template: "<nb-chart type=\"line\" [data]=\"data()\" [options]=\"options()\" [palette]=\"palette()\" [aria-label]=\"ariaLabel()\" />",
|
|
520
|
+
imports: [NbChartComponent],
|
|
521
|
+
styles: [":host{display:block}\n"]
|
|
522
|
+
}]
|
|
523
|
+
}],
|
|
524
|
+
propDecorators: {
|
|
525
|
+
labels: [{
|
|
526
|
+
type: i0.Input,
|
|
527
|
+
args: [{
|
|
528
|
+
isSignal: true,
|
|
529
|
+
alias: "labels",
|
|
530
|
+
required: false
|
|
531
|
+
}]
|
|
532
|
+
}],
|
|
533
|
+
series: [{
|
|
534
|
+
type: i0.Input,
|
|
535
|
+
args: [{
|
|
536
|
+
isSignal: true,
|
|
537
|
+
alias: "series",
|
|
538
|
+
required: false
|
|
539
|
+
}]
|
|
540
|
+
}],
|
|
541
|
+
area: [{
|
|
542
|
+
type: i0.Input,
|
|
543
|
+
args: [{
|
|
544
|
+
isSignal: true,
|
|
545
|
+
alias: "area",
|
|
546
|
+
required: false
|
|
547
|
+
}]
|
|
548
|
+
}],
|
|
549
|
+
smooth: [{
|
|
550
|
+
type: i0.Input,
|
|
551
|
+
args: [{
|
|
552
|
+
isSignal: true,
|
|
553
|
+
alias: "smooth",
|
|
554
|
+
required: false
|
|
555
|
+
}]
|
|
556
|
+
}],
|
|
557
|
+
ariaLabel: [{
|
|
558
|
+
type: i0.Input,
|
|
559
|
+
args: [{
|
|
560
|
+
isSignal: true,
|
|
561
|
+
alias: "aria-label",
|
|
562
|
+
required: false
|
|
563
|
+
}]
|
|
564
|
+
}]
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
var NbBarChartComponent = class NbBarChartComponent {
|
|
568
|
+
constructor() {
|
|
569
|
+
this.labels = input([], ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
570
|
+
this.series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
|
|
571
|
+
this.horizontal = input(false, {
|
|
572
|
+
...ngDevMode ? { debugName: "horizontal" } : /* istanbul ignore next */ {},
|
|
573
|
+
transform: booleanAttribute
|
|
574
|
+
});
|
|
575
|
+
this.stacked = input(false, {
|
|
576
|
+
...ngDevMode ? { debugName: "stacked" } : /* istanbul ignore next */ {},
|
|
577
|
+
transform: booleanAttribute
|
|
578
|
+
});
|
|
579
|
+
this.ariaLabel = input(void 0, {
|
|
580
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
581
|
+
alias: "aria-label"
|
|
582
|
+
});
|
|
583
|
+
this.palette = computed(() => colorsOf(this.series()), ...ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []);
|
|
584
|
+
this.data = computed(() => ({
|
|
585
|
+
labels: [...this.labels()],
|
|
586
|
+
datasets: this.series().map((series) => ({
|
|
587
|
+
label: series.name,
|
|
588
|
+
data: [...series.data]
|
|
589
|
+
}))
|
|
590
|
+
}), ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
591
|
+
this.options = computed(() => ({
|
|
592
|
+
indexAxis: this.horizontal() ? "y" : "x",
|
|
593
|
+
scales: {
|
|
594
|
+
x: { stacked: this.stacked() },
|
|
595
|
+
y: { stacked: this.stacked() }
|
|
596
|
+
},
|
|
597
|
+
plugins: { legend: { display: this.series().length > 1 } }
|
|
598
|
+
}), ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
599
|
+
}
|
|
600
|
+
static {
|
|
601
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
602
|
+
minVersion: "12.0.0",
|
|
603
|
+
version: "22.3.0",
|
|
604
|
+
ngImport: i0,
|
|
605
|
+
type: NbBarChartComponent,
|
|
606
|
+
deps: [],
|
|
607
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
static {
|
|
611
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
612
|
+
minVersion: "17.1.0",
|
|
613
|
+
version: "22.3.0",
|
|
614
|
+
type: NbBarChartComponent,
|
|
615
|
+
isStandalone: true,
|
|
616
|
+
selector: "nb-bar-chart",
|
|
617
|
+
inputs: {
|
|
618
|
+
labels: {
|
|
619
|
+
classPropertyName: "labels",
|
|
620
|
+
publicName: "labels",
|
|
621
|
+
isSignal: true,
|
|
622
|
+
isRequired: false,
|
|
623
|
+
transformFunction: null
|
|
624
|
+
},
|
|
625
|
+
series: {
|
|
626
|
+
classPropertyName: "series",
|
|
627
|
+
publicName: "series",
|
|
628
|
+
isSignal: true,
|
|
629
|
+
isRequired: false,
|
|
630
|
+
transformFunction: null
|
|
631
|
+
},
|
|
632
|
+
horizontal: {
|
|
633
|
+
classPropertyName: "horizontal",
|
|
634
|
+
publicName: "horizontal",
|
|
635
|
+
isSignal: true,
|
|
636
|
+
isRequired: false,
|
|
637
|
+
transformFunction: null
|
|
638
|
+
},
|
|
639
|
+
stacked: {
|
|
640
|
+
classPropertyName: "stacked",
|
|
641
|
+
publicName: "stacked",
|
|
642
|
+
isSignal: true,
|
|
643
|
+
isRequired: false,
|
|
644
|
+
transformFunction: null
|
|
645
|
+
},
|
|
646
|
+
ariaLabel: {
|
|
647
|
+
classPropertyName: "ariaLabel",
|
|
648
|
+
publicName: "aria-label",
|
|
649
|
+
isSignal: true,
|
|
650
|
+
isRequired: false,
|
|
651
|
+
transformFunction: null
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
ngImport: i0,
|
|
655
|
+
template: "<nb-chart type=\"bar\" [data]=\"data()\" [options]=\"options()\" [palette]=\"palette()\" [aria-label]=\"ariaLabel()\" />",
|
|
656
|
+
isInline: true,
|
|
657
|
+
styles: [":host{display:block}\n"],
|
|
658
|
+
dependencies: [{
|
|
659
|
+
kind: "component",
|
|
660
|
+
type: NbChartComponent,
|
|
661
|
+
selector: "nb-chart",
|
|
662
|
+
inputs: [
|
|
663
|
+
"type",
|
|
664
|
+
"data",
|
|
665
|
+
"options",
|
|
666
|
+
"plugins",
|
|
667
|
+
"palette",
|
|
668
|
+
"aria-label"
|
|
669
|
+
]
|
|
670
|
+
}]
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
675
|
+
minVersion: "12.0.0",
|
|
676
|
+
version: "22.3.0",
|
|
677
|
+
ngImport: i0,
|
|
678
|
+
type: NbBarChartComponent,
|
|
679
|
+
decorators: [{
|
|
680
|
+
type: Component,
|
|
681
|
+
args: [{
|
|
682
|
+
selector: "nb-bar-chart",
|
|
683
|
+
template: "<nb-chart type=\"bar\" [data]=\"data()\" [options]=\"options()\" [palette]=\"palette()\" [aria-label]=\"ariaLabel()\" />",
|
|
684
|
+
imports: [NbChartComponent],
|
|
685
|
+
styles: [":host{display:block}\n"]
|
|
686
|
+
}]
|
|
687
|
+
}],
|
|
688
|
+
propDecorators: {
|
|
689
|
+
labels: [{
|
|
690
|
+
type: i0.Input,
|
|
691
|
+
args: [{
|
|
692
|
+
isSignal: true,
|
|
693
|
+
alias: "labels",
|
|
694
|
+
required: false
|
|
695
|
+
}]
|
|
696
|
+
}],
|
|
697
|
+
series: [{
|
|
698
|
+
type: i0.Input,
|
|
699
|
+
args: [{
|
|
700
|
+
isSignal: true,
|
|
701
|
+
alias: "series",
|
|
702
|
+
required: false
|
|
703
|
+
}]
|
|
704
|
+
}],
|
|
705
|
+
horizontal: [{
|
|
706
|
+
type: i0.Input,
|
|
707
|
+
args: [{
|
|
708
|
+
isSignal: true,
|
|
709
|
+
alias: "horizontal",
|
|
710
|
+
required: false
|
|
711
|
+
}]
|
|
712
|
+
}],
|
|
713
|
+
stacked: [{
|
|
714
|
+
type: i0.Input,
|
|
715
|
+
args: [{
|
|
716
|
+
isSignal: true,
|
|
717
|
+
alias: "stacked",
|
|
718
|
+
required: false
|
|
719
|
+
}]
|
|
720
|
+
}],
|
|
721
|
+
ariaLabel: [{
|
|
722
|
+
type: i0.Input,
|
|
723
|
+
args: [{
|
|
724
|
+
isSignal: true,
|
|
725
|
+
alias: "aria-label",
|
|
726
|
+
required: false
|
|
727
|
+
}]
|
|
728
|
+
}]
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
var NbPieChartComponent = class NbPieChartComponent {
|
|
732
|
+
constructor() {
|
|
733
|
+
this.slices = input([], ...ngDevMode ? [{ debugName: "slices" }] : /* istanbul ignore next */ []);
|
|
734
|
+
this.doughnut = input(false, {
|
|
735
|
+
...ngDevMode ? { debugName: "doughnut" } : /* istanbul ignore next */ {},
|
|
736
|
+
transform: booleanAttribute
|
|
737
|
+
});
|
|
738
|
+
this.ariaLabel = input(void 0, {
|
|
739
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
740
|
+
alias: "aria-label"
|
|
741
|
+
});
|
|
742
|
+
this.palette = computed(() => colorsOf(this.slices()), ...ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []);
|
|
743
|
+
this.options = {
|
|
744
|
+
aspectRatio: 2,
|
|
745
|
+
plugins: { legend: { position: "right" } }
|
|
746
|
+
};
|
|
747
|
+
this.data = computed(() => ({
|
|
748
|
+
labels: this.slices().map((slice) => slice.label),
|
|
749
|
+
datasets: [{ data: this.slices().map((slice) => slice.value) }]
|
|
750
|
+
}), ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
751
|
+
}
|
|
752
|
+
static {
|
|
753
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
754
|
+
minVersion: "12.0.0",
|
|
755
|
+
version: "22.3.0",
|
|
756
|
+
ngImport: i0,
|
|
757
|
+
type: NbPieChartComponent,
|
|
758
|
+
deps: [],
|
|
759
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
static {
|
|
763
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
764
|
+
minVersion: "17.1.0",
|
|
765
|
+
version: "22.3.0",
|
|
766
|
+
type: NbPieChartComponent,
|
|
767
|
+
isStandalone: true,
|
|
768
|
+
selector: "nb-pie-chart",
|
|
769
|
+
inputs: {
|
|
770
|
+
slices: {
|
|
771
|
+
classPropertyName: "slices",
|
|
772
|
+
publicName: "slices",
|
|
773
|
+
isSignal: true,
|
|
774
|
+
isRequired: false,
|
|
775
|
+
transformFunction: null
|
|
776
|
+
},
|
|
777
|
+
doughnut: {
|
|
778
|
+
classPropertyName: "doughnut",
|
|
779
|
+
publicName: "doughnut",
|
|
780
|
+
isSignal: true,
|
|
781
|
+
isRequired: false,
|
|
782
|
+
transformFunction: null
|
|
783
|
+
},
|
|
784
|
+
ariaLabel: {
|
|
785
|
+
classPropertyName: "ariaLabel",
|
|
786
|
+
publicName: "aria-label",
|
|
787
|
+
isSignal: true,
|
|
788
|
+
isRequired: false,
|
|
789
|
+
transformFunction: null
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
ngImport: i0,
|
|
793
|
+
template: `
|
|
794
|
+
<nb-chart
|
|
795
|
+
[type]="doughnut() ? 'doughnut' : 'pie'"
|
|
796
|
+
[data]="data()"
|
|
797
|
+
[options]="options"
|
|
798
|
+
[palette]="palette()"
|
|
799
|
+
[aria-label]="ariaLabel()"
|
|
800
|
+
/>
|
|
801
|
+
`,
|
|
802
|
+
isInline: true,
|
|
803
|
+
styles: [":host{display:block}\n"],
|
|
804
|
+
dependencies: [{
|
|
805
|
+
kind: "component",
|
|
806
|
+
type: NbChartComponent,
|
|
807
|
+
selector: "nb-chart",
|
|
808
|
+
inputs: [
|
|
809
|
+
"type",
|
|
810
|
+
"data",
|
|
811
|
+
"options",
|
|
812
|
+
"plugins",
|
|
813
|
+
"palette",
|
|
814
|
+
"aria-label"
|
|
815
|
+
]
|
|
816
|
+
}]
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
821
|
+
minVersion: "12.0.0",
|
|
822
|
+
version: "22.3.0",
|
|
823
|
+
ngImport: i0,
|
|
824
|
+
type: NbPieChartComponent,
|
|
825
|
+
decorators: [{
|
|
826
|
+
type: Component,
|
|
827
|
+
args: [{
|
|
828
|
+
selector: "nb-pie-chart",
|
|
829
|
+
template: `
|
|
830
|
+
<nb-chart
|
|
831
|
+
[type]="doughnut() ? 'doughnut' : 'pie'"
|
|
832
|
+
[data]="data()"
|
|
833
|
+
[options]="options"
|
|
834
|
+
[palette]="palette()"
|
|
835
|
+
[aria-label]="ariaLabel()"
|
|
836
|
+
/>
|
|
837
|
+
`,
|
|
838
|
+
imports: [NbChartComponent],
|
|
839
|
+
styles: [":host{display:block}\n"]
|
|
840
|
+
}]
|
|
841
|
+
}],
|
|
842
|
+
propDecorators: {
|
|
843
|
+
slices: [{
|
|
844
|
+
type: i0.Input,
|
|
845
|
+
args: [{
|
|
846
|
+
isSignal: true,
|
|
847
|
+
alias: "slices",
|
|
848
|
+
required: false
|
|
849
|
+
}]
|
|
850
|
+
}],
|
|
851
|
+
doughnut: [{
|
|
852
|
+
type: i0.Input,
|
|
853
|
+
args: [{
|
|
854
|
+
isSignal: true,
|
|
855
|
+
alias: "doughnut",
|
|
856
|
+
required: false
|
|
857
|
+
}]
|
|
858
|
+
}],
|
|
859
|
+
ariaLabel: [{
|
|
860
|
+
type: i0.Input,
|
|
861
|
+
args: [{
|
|
862
|
+
isSignal: true,
|
|
863
|
+
alias: "aria-label",
|
|
864
|
+
required: false
|
|
865
|
+
}]
|
|
866
|
+
}]
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
export { NB_BAR_CHART_PARTS, NB_CHART_PALETTE, NB_LINE_CHART_PARTS, NB_PIE_CHART_PARTS, NbBarChartComponent, NbChartComponent, NbLineChartComponent, NbPieChartComponent, provideNbCharts };
|
|
870
|
+
|
|
871
|
+
//# sourceMappingURL=liquid-js-lyr-extras-chart.mjs.map
|