@area8975/ui 0.1.1-dev.7 → 0.1.1-dev.8
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/fesm2022/area8975-ui.mjs +208 -5
- package/fesm2022/area8975-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/area8975-ui.d.ts +39 -1
package/fesm2022/area8975-ui.mjs
CHANGED
|
@@ -657,7 +657,10 @@ var UiChartComponent = class UiChartComponent {
|
|
|
657
657
|
});
|
|
658
658
|
effect(() => {
|
|
659
659
|
const chart = this.chart();
|
|
660
|
-
if (chart)
|
|
660
|
+
if (chart) {
|
|
661
|
+
this.applyHidden(chart);
|
|
662
|
+
this.applyEmphasis();
|
|
663
|
+
}
|
|
661
664
|
});
|
|
662
665
|
inject(DestroyRef).onDestroy(() => {
|
|
663
666
|
this.destroyed = true;
|
|
@@ -673,16 +676,18 @@ var UiChartComponent = class UiChartComponent {
|
|
|
673
676
|
}
|
|
674
677
|
}
|
|
675
678
|
applyEmphasis() {
|
|
676
|
-
const emphasis = untracked(this.emphasis);
|
|
677
679
|
const names = this.seriesNames();
|
|
680
|
+
const emphasis = untracked(this.emphasis);
|
|
681
|
+
const active = emphasis && names.includes(emphasis) && !untracked(this.hiddenSeries).includes(emphasis) ? emphasis : null;
|
|
678
682
|
const groups = this.canvas().nativeElement.querySelectorAll(".apexcharts-series[data\\:realIndex]");
|
|
679
683
|
for (const group of groups) {
|
|
680
684
|
const name = names[Number(group.getAttribute("data:realIndex"))];
|
|
681
|
-
group.classList.toggle("ui-chart-series--faded", !!
|
|
685
|
+
group.classList.toggle("ui-chart-series--faded", !!active && name !== active);
|
|
682
686
|
}
|
|
683
687
|
}
|
|
684
688
|
seriesNames() {
|
|
685
|
-
|
|
689
|
+
const { series = [], labels = [] } = untracked(this.options);
|
|
690
|
+
return series.map((item, index) => typeof item === "object" && item !== null && "name" in item ? item.name ?? null : labels[index] ?? null);
|
|
686
691
|
}
|
|
687
692
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
688
693
|
minVersion: "12.0.0",
|
|
@@ -1788,6 +1793,204 @@ const LineChartCurves = [
|
|
|
1788
1793
|
"smooth",
|
|
1789
1794
|
"stepline"
|
|
1790
1795
|
];
|
|
1796
|
+
const percentFormatter = new Intl.NumberFormat("en-GB", {
|
|
1797
|
+
style: "percent",
|
|
1798
|
+
maximumFractionDigits: 1
|
|
1799
|
+
});
|
|
1800
|
+
var UiPieChartComponent = class UiPieChartComponent extends UiAxisChartBase {
|
|
1801
|
+
variant = input("pie", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
1802
|
+
totalLabel = input("Total", ...ngDevMode ? [{ debugName: "totalLabel" }] : /* istanbul ignore next */ []);
|
|
1803
|
+
values = computed(() => this.series()[0]?.data ?? [], ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
|
|
1804
|
+
isEmpty = computed(() => !this.values().some((value) => value !== null && value > 0), ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
|
|
1805
|
+
isMuted = computed(() => {
|
|
1806
|
+
const highlight = this.highlight();
|
|
1807
|
+
return this.categories().map((name) => !!highlight && !highlight.includes(name));
|
|
1808
|
+
}, ...ngDevMode ? [{ debugName: "isMuted" }] : /* istanbul ignore next */ []);
|
|
1809
|
+
styles = computed(() => {
|
|
1810
|
+
const highlight = this.highlight();
|
|
1811
|
+
const muted = this.isMuted();
|
|
1812
|
+
return this.categories().map((name, index) => muted[index] ? {
|
|
1813
|
+
colour: CHART_INK.context,
|
|
1814
|
+
dashed: false
|
|
1815
|
+
} : chartSeriesStyle(highlight ? highlight.indexOf(name) : index, false));
|
|
1816
|
+
}, ...ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []);
|
|
1817
|
+
legendItems = computed(() => {
|
|
1818
|
+
const highlight = this.highlight();
|
|
1819
|
+
const items = this.categories().map((name, index) => ({
|
|
1820
|
+
name,
|
|
1821
|
+
...this.styles()[index]
|
|
1822
|
+
})).filter((_, index) => !this.isMuted()[index]);
|
|
1823
|
+
return highlight ? items.sort((a, b) => highlight.indexOf(a.name) - highlight.indexOf(b.name)) : items;
|
|
1824
|
+
}, ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
|
|
1825
|
+
slices = computed(() => {
|
|
1826
|
+
const hidden = this.hiddenSeries();
|
|
1827
|
+
const values = this.values();
|
|
1828
|
+
const colours = this.colours();
|
|
1829
|
+
return this.categories().map((name, index) => ({
|
|
1830
|
+
name,
|
|
1831
|
+
value: values[index] ?? 0,
|
|
1832
|
+
colour: colours[index]
|
|
1833
|
+
})).filter((slice) => !hidden.includes(slice.name));
|
|
1834
|
+
}, ...ngDevMode ? [{ debugName: "slices" }] : /* istanbul ignore next */ []);
|
|
1835
|
+
chartOptions = computed(() => {
|
|
1836
|
+
const base = baseChartOptions();
|
|
1837
|
+
const slices = this.slices();
|
|
1838
|
+
const donut = this.variant() === "donut";
|
|
1839
|
+
const total = slices.reduce((sum, slice) => sum + slice.value, 0);
|
|
1840
|
+
const centreText = {
|
|
1841
|
+
fontSize: "12px",
|
|
1842
|
+
color: CHART_INK.muted,
|
|
1843
|
+
offsetY: -4
|
|
1844
|
+
};
|
|
1845
|
+
return mergeChartOptions({
|
|
1846
|
+
...base,
|
|
1847
|
+
chart: {
|
|
1848
|
+
...base.chart,
|
|
1849
|
+
type: donut ? "donut" : "pie",
|
|
1850
|
+
height: this.height()
|
|
1851
|
+
},
|
|
1852
|
+
colors: slices.map((slice) => slice.colour),
|
|
1853
|
+
labels: slices.map((slice) => slice.name),
|
|
1854
|
+
series: slices.map((slice) => slice.value),
|
|
1855
|
+
stroke: {
|
|
1856
|
+
show: true,
|
|
1857
|
+
width: 2,
|
|
1858
|
+
colors: [CHART_INK.surface]
|
|
1859
|
+
},
|
|
1860
|
+
states: {
|
|
1861
|
+
...base.states,
|
|
1862
|
+
hover: { filter: { type: "darken" } }
|
|
1863
|
+
},
|
|
1864
|
+
plotOptions: { pie: {
|
|
1865
|
+
expandOnClick: false,
|
|
1866
|
+
donut: {
|
|
1867
|
+
size: "65%",
|
|
1868
|
+
labels: {
|
|
1869
|
+
show: donut,
|
|
1870
|
+
name: centreText,
|
|
1871
|
+
value: {
|
|
1872
|
+
fontSize: "20px",
|
|
1873
|
+
fontWeight: 600,
|
|
1874
|
+
color: CHART_INK.text,
|
|
1875
|
+
offsetY: 4,
|
|
1876
|
+
formatter: (value) => this.formatValue(Number(value))
|
|
1877
|
+
},
|
|
1878
|
+
total: {
|
|
1879
|
+
show: true,
|
|
1880
|
+
showAlways: true,
|
|
1881
|
+
label: this.totalLabel(),
|
|
1882
|
+
...centreText,
|
|
1883
|
+
formatter: () => this.formatValue(total)
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
} },
|
|
1888
|
+
tooltip: {
|
|
1889
|
+
theme: "light",
|
|
1890
|
+
fillSeriesColor: false,
|
|
1891
|
+
custom: ({ seriesIndex }) => {
|
|
1892
|
+
const slice = slices[seriesIndex];
|
|
1893
|
+
return slice ? chartTooltipHtml("", [{
|
|
1894
|
+
colour: slice.colour,
|
|
1895
|
+
name: slice.name,
|
|
1896
|
+
value: this.formatValue(slice.value)
|
|
1897
|
+
}], total ? `${percentFormatter.format(slice.value / total)} of total` : "") : "";
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
}, this.options());
|
|
1901
|
+
}, ...ngDevMode ? [{ debugName: "chartOptions" }] : /* istanbul ignore next */ []);
|
|
1902
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1903
|
+
minVersion: "12.0.0",
|
|
1904
|
+
version: "22.2.1",
|
|
1905
|
+
ngImport: i0,
|
|
1906
|
+
type: UiPieChartComponent,
|
|
1907
|
+
deps: null,
|
|
1908
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1909
|
+
});
|
|
1910
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1911
|
+
minVersion: "17.1.0",
|
|
1912
|
+
version: "22.2.1",
|
|
1913
|
+
type: UiPieChartComponent,
|
|
1914
|
+
isStandalone: true,
|
|
1915
|
+
selector: "ui-pie-chart",
|
|
1916
|
+
inputs: {
|
|
1917
|
+
variant: {
|
|
1918
|
+
classPropertyName: "variant",
|
|
1919
|
+
publicName: "variant",
|
|
1920
|
+
isSignal: true,
|
|
1921
|
+
isRequired: false,
|
|
1922
|
+
transformFunction: null
|
|
1923
|
+
},
|
|
1924
|
+
totalLabel: {
|
|
1925
|
+
classPropertyName: "totalLabel",
|
|
1926
|
+
publicName: "totalLabel",
|
|
1927
|
+
isSignal: true,
|
|
1928
|
+
isRequired: false,
|
|
1929
|
+
transformFunction: null
|
|
1930
|
+
}
|
|
1931
|
+
},
|
|
1932
|
+
host: { classAttribute: "block w-full min-w-0" },
|
|
1933
|
+
usesInheritance: true,
|
|
1934
|
+
ngImport: i0,
|
|
1935
|
+
template: "<ui-chart-frame\n [options]=\"chartOptions()\"\n [ariaLabel]=\"ariaLabel()\"\n [categories]=\"categories()\"\n [series]=\"series()\"\n [legendItems]=\"legendItems()\"\n [legendNote]=\"legendNote()\"\n [(hiddenSeries)]=\"hiddenSeries\"\n [valueFormatter]=\"valueFormatter()\"\n [categoryLabel]=\"categoryLabel()\"\n [height]=\"height()\"\n [emptyText]=\"emptyText()\"\n [loading]=\"loading()\"\n [empty]=\"isEmpty()\"\n [showTable]=\"showTable()\"\n/>\n",
|
|
1936
|
+
dependencies: [{
|
|
1937
|
+
kind: "component",
|
|
1938
|
+
type: UiChartFrameComponent,
|
|
1939
|
+
selector: "ui-chart-frame",
|
|
1940
|
+
inputs: [
|
|
1941
|
+
"options",
|
|
1942
|
+
"ariaLabel",
|
|
1943
|
+
"categories",
|
|
1944
|
+
"series",
|
|
1945
|
+
"legendItems",
|
|
1946
|
+
"legendNote",
|
|
1947
|
+
"hiddenSeries",
|
|
1948
|
+
"valueFormatter",
|
|
1949
|
+
"categoryLabel",
|
|
1950
|
+
"height",
|
|
1951
|
+
"emptyText",
|
|
1952
|
+
"loading",
|
|
1953
|
+
"empty",
|
|
1954
|
+
"showTable"
|
|
1955
|
+
],
|
|
1956
|
+
outputs: ["hiddenSeriesChange"]
|
|
1957
|
+
}]
|
|
1958
|
+
});
|
|
1959
|
+
};
|
|
1960
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1961
|
+
minVersion: "12.0.0",
|
|
1962
|
+
version: "22.2.1",
|
|
1963
|
+
ngImport: i0,
|
|
1964
|
+
type: UiPieChartComponent,
|
|
1965
|
+
decorators: [{
|
|
1966
|
+
type: Component,
|
|
1967
|
+
args: [{
|
|
1968
|
+
selector: "ui-pie-chart",
|
|
1969
|
+
imports: [UiChartFrameComponent],
|
|
1970
|
+
host: { class: "block w-full min-w-0" },
|
|
1971
|
+
template: "<ui-chart-frame\n [options]=\"chartOptions()\"\n [ariaLabel]=\"ariaLabel()\"\n [categories]=\"categories()\"\n [series]=\"series()\"\n [legendItems]=\"legendItems()\"\n [legendNote]=\"legendNote()\"\n [(hiddenSeries)]=\"hiddenSeries\"\n [valueFormatter]=\"valueFormatter()\"\n [categoryLabel]=\"categoryLabel()\"\n [height]=\"height()\"\n [emptyText]=\"emptyText()\"\n [loading]=\"loading()\"\n [empty]=\"isEmpty()\"\n [showTable]=\"showTable()\"\n/>\n"
|
|
1972
|
+
}]
|
|
1973
|
+
}],
|
|
1974
|
+
propDecorators: {
|
|
1975
|
+
variant: [{
|
|
1976
|
+
type: i0.Input,
|
|
1977
|
+
args: [{
|
|
1978
|
+
isSignal: true,
|
|
1979
|
+
alias: "variant",
|
|
1980
|
+
required: false
|
|
1981
|
+
}]
|
|
1982
|
+
}],
|
|
1983
|
+
totalLabel: [{
|
|
1984
|
+
type: i0.Input,
|
|
1985
|
+
args: [{
|
|
1986
|
+
isSignal: true,
|
|
1987
|
+
alias: "totalLabel",
|
|
1988
|
+
required: false
|
|
1989
|
+
}]
|
|
1990
|
+
}]
|
|
1991
|
+
}
|
|
1992
|
+
});
|
|
1993
|
+
const PieChartVariants = ["pie", "donut"];
|
|
1791
1994
|
var UiCheckboxComponent = class UiCheckboxComponent {
|
|
1792
1995
|
value = model.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
1793
1996
|
id = input("", ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
@@ -11572,6 +11775,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
11572
11775
|
}]
|
|
11573
11776
|
}
|
|
11574
11777
|
});
|
|
11575
|
-
export { AlertAppearances, AlertIntents, BadgeAppearances, BadgeIntents, BadgeSizes, BarChartOrientations, ButtonAppearances, ButtonIntents, ButtonSizes, ButtonTypes, CalendarModes, FileRejectionReasons, InputAriaAutocompletes, InputAriaHasPopups, InputModes, InputTypes, LineChartCurves, MoneySignDisplays, ProgressIntents, ProgressLabelPositions, ProgressOrientations, ProgressShapes, ProgressSizes, SelectLocalDataSource, SelectMultipleDisplays, SelectRemoteDataSource, SkeletonShapes, TableLocalDataSource, TableRemoteDataSource, TextareaResizeOptions, ToastIntents, ToasterPositions, UI_LOADING_TYPES, UiAlertComponent, UiBadgeComponent, UiBarChartComponent, UiButtonComponent, UiButtonGroupComponent, UiCalendarComponent, UiChartComponent, UiChartFrameComponent, UiChartLegendComponent, UiChartTableComponent, UiCheckboxComponent, UiColourComponent, UiContainerComponent, UiCounterComponent, UiDateRangePickerComponent, UiDatepickerComponent, UiDrawerComponent, UiDropdownButtonComponent, UiDropdownComponent, UiDropdownDirective, UiDropdownMenuComponent, UiDropzoneComponent, UiFieldComponent, UiFileInputComponent, UiInputAddonComponent, UiInputComponent, UiInputGroupComponent, UiKpiComponent, UiLayoutComponent, UiLineChartComponent, UiLoadingComponent, UiModalComponent, UiMoneyComponent, UiOverlayComponent, UiPaginationComponent, UiProgressComponent, UiRadioComponent, UiSelectComponent, UiSidebarComponent, UiSidebarItemComponent, UiSkeletonComponent, UiSwitchComponent, UiTabComponent, UiTabDirective, UiTableComponent, UiTextareaComponent, UiTimeSelectComponent, UiToastComponent, UiToastService, UiToasterComponent, UiTooltipComponent, WeekStarts, defaultDateRangePresets, financialYearPreset, lastDaysPreset, monthPreset, thisWeekPreset, todayPreset, yearPreset };
|
|
11778
|
+
export { AlertAppearances, AlertIntents, BadgeAppearances, BadgeIntents, BadgeSizes, BarChartOrientations, ButtonAppearances, ButtonIntents, ButtonSizes, ButtonTypes, CalendarModes, FileRejectionReasons, InputAriaAutocompletes, InputAriaHasPopups, InputModes, InputTypes, LineChartCurves, MoneySignDisplays, PieChartVariants, ProgressIntents, ProgressLabelPositions, ProgressOrientations, ProgressShapes, ProgressSizes, SelectLocalDataSource, SelectMultipleDisplays, SelectRemoteDataSource, SkeletonShapes, TableLocalDataSource, TableRemoteDataSource, TextareaResizeOptions, ToastIntents, ToasterPositions, UI_LOADING_TYPES, UiAlertComponent, UiBadgeComponent, UiBarChartComponent, UiButtonComponent, UiButtonGroupComponent, UiCalendarComponent, UiChartComponent, UiChartFrameComponent, UiChartLegendComponent, UiChartTableComponent, UiCheckboxComponent, UiColourComponent, UiContainerComponent, UiCounterComponent, UiDateRangePickerComponent, UiDatepickerComponent, UiDrawerComponent, UiDropdownButtonComponent, UiDropdownComponent, UiDropdownDirective, UiDropdownMenuComponent, UiDropzoneComponent, UiFieldComponent, UiFileInputComponent, UiInputAddonComponent, UiInputComponent, UiInputGroupComponent, UiKpiComponent, UiLayoutComponent, UiLineChartComponent, UiLoadingComponent, UiModalComponent, UiMoneyComponent, UiOverlayComponent, UiPaginationComponent, UiPieChartComponent, UiProgressComponent, UiRadioComponent, UiSelectComponent, UiSidebarComponent, UiSidebarItemComponent, UiSkeletonComponent, UiSwitchComponent, UiTabComponent, UiTabDirective, UiTableComponent, UiTextareaComponent, UiTimeSelectComponent, UiToastComponent, UiToastService, UiToasterComponent, UiTooltipComponent, WeekStarts, defaultDateRangePresets, financialYearPreset, lastDaysPreset, monthPreset, thisWeekPreset, todayPreset, yearPreset };
|
|
11576
11779
|
|
|
11577
11780
|
//# sourceMappingURL=area8975-ui.mjs.map
|