@area8975/ui 0.2.2-dev.49 → 0.2.2-dev.50
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 +3 -2
- package/fesm2022/area8975-ui-alert.mjs +113 -0
- package/fesm2022/area8975-ui-alert.mjs.map +1 -0
- package/fesm2022/area8975-ui-avatar.mjs +157 -0
- package/fesm2022/area8975-ui-avatar.mjs.map +1 -0
- package/fesm2022/area8975-ui-badge.mjs +116 -0
- package/fesm2022/area8975-ui-badge.mjs.map +1 -0
- package/fesm2022/area8975-ui-button.mjs +314 -0
- package/fesm2022/area8975-ui-button.mjs.map +1 -0
- package/fesm2022/area8975-ui-calendar.mjs +549 -0
- package/fesm2022/area8975-ui-calendar.mjs.map +1 -0
- package/fesm2022/area8975-ui-card-header.mjs +96 -0
- package/fesm2022/area8975-ui-card-header.mjs.map +1 -0
- package/fesm2022/area8975-ui-card.mjs +73 -0
- package/fesm2022/area8975-ui-card.mjs.map +1 -0
- package/fesm2022/area8975-ui-chart-palette.mjs +225 -0
- package/fesm2022/area8975-ui-chart-palette.mjs.map +1 -0
- package/fesm2022/area8975-ui-charts.mjs +2813 -0
- package/fesm2022/area8975-ui-charts.mjs.map +1 -0
- package/fesm2022/area8975-ui-checkbox.mjs +202 -0
- package/fesm2022/area8975-ui-checkbox.mjs.map +1 -0
- package/fesm2022/area8975-ui-colour.mjs +200 -0
- package/fesm2022/area8975-ui-colour.mjs.map +1 -0
- package/fesm2022/area8975-ui-container.mjs +40 -0
- package/fesm2022/area8975-ui-container.mjs.map +1 -0
- package/fesm2022/area8975-ui-counter.mjs +246 -0
- package/fesm2022/area8975-ui-counter.mjs.map +1 -0
- package/fesm2022/area8975-ui-date-range-picker.mjs +554 -0
- package/fesm2022/area8975-ui-date-range-picker.mjs.map +1 -0
- package/fesm2022/area8975-ui-datepicker.mjs +547 -0
- package/fesm2022/area8975-ui-datepicker.mjs.map +1 -0
- package/fesm2022/area8975-ui-disclosure.mjs +279 -0
- package/fesm2022/area8975-ui-disclosure.mjs.map +1 -0
- package/fesm2022/area8975-ui-drawer.mjs +106 -0
- package/fesm2022/area8975-ui-drawer.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropdown-button.mjs +141 -0
- package/fesm2022/area8975-ui-dropdown-button.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropdown-menu.mjs +96 -0
- package/fesm2022/area8975-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropdown.mjs +208 -0
- package/fesm2022/area8975-ui-dropdown.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropzone.mjs +332 -0
- package/fesm2022/area8975-ui-dropzone.mjs.map +1 -0
- package/fesm2022/area8975-ui-field.mjs +191 -0
- package/fesm2022/area8975-ui-field.mjs.map +1 -0
- package/fesm2022/area8975-ui-file-input.mjs +340 -0
- package/fesm2022/area8975-ui-file-input.mjs.map +1 -0
- package/fesm2022/area8975-ui-file.mjs +47 -0
- package/fesm2022/area8975-ui-file.mjs.map +1 -0
- package/fesm2022/area8975-ui-format.mjs +70 -0
- package/fesm2022/area8975-ui-format.mjs.map +1 -0
- package/fesm2022/area8975-ui-input-addon.mjs +42 -0
- package/fesm2022/area8975-ui-input-addon.mjs.map +1 -0
- package/fesm2022/area8975-ui-input-group.mjs +86 -0
- package/fesm2022/area8975-ui-input-group.mjs.map +1 -0
- package/fesm2022/area8975-ui-input.mjs +682 -0
- package/fesm2022/area8975-ui-input.mjs.map +1 -0
- package/fesm2022/area8975-ui-kpi.mjs +167 -0
- package/fesm2022/area8975-ui-kpi.mjs.map +1 -0
- package/fesm2022/area8975-ui-layout.mjs +63 -0
- package/fesm2022/area8975-ui-layout.mjs.map +1 -0
- package/fesm2022/area8975-ui-loading.mjs +76 -0
- package/fesm2022/area8975-ui-loading.mjs.map +1 -0
- package/fesm2022/area8975-ui-modal-close-btn.mjs +89 -0
- package/fesm2022/area8975-ui-modal-close-btn.mjs.map +1 -0
- package/fesm2022/area8975-ui-modal.mjs +235 -0
- package/fesm2022/area8975-ui-modal.mjs.map +1 -0
- package/fesm2022/area8975-ui-money.mjs +230 -0
- package/fesm2022/area8975-ui-money.mjs.map +1 -0
- package/fesm2022/area8975-ui-overlay.mjs +317 -0
- package/fesm2022/area8975-ui-overlay.mjs.map +1 -0
- package/fesm2022/area8975-ui-pagination.mjs +152 -0
- package/fesm2022/area8975-ui-pagination.mjs.map +1 -0
- package/fesm2022/area8975-ui-private.mjs +63 -0
- package/fesm2022/area8975-ui-private.mjs.map +1 -0
- package/fesm2022/area8975-ui-progress.mjs +307 -0
- package/fesm2022/area8975-ui-progress.mjs.map +1 -0
- package/fesm2022/area8975-ui-radio.mjs +199 -0
- package/fesm2022/area8975-ui-radio.mjs.map +1 -0
- package/fesm2022/area8975-ui-rich-text-editor.mjs +778 -0
- package/fesm2022/area8975-ui-rich-text-editor.mjs.map +1 -0
- package/fesm2022/area8975-ui-search.mjs +266 -0
- package/fesm2022/area8975-ui-search.mjs.map +1 -0
- package/fesm2022/area8975-ui-segmented.mjs +118 -0
- package/fesm2022/area8975-ui-segmented.mjs.map +1 -0
- package/fesm2022/area8975-ui-select.mjs +926 -0
- package/fesm2022/area8975-ui-select.mjs.map +1 -0
- package/fesm2022/area8975-ui-sidebar-group.mjs +60 -0
- package/fesm2022/area8975-ui-sidebar-group.mjs.map +1 -0
- package/fesm2022/area8975-ui-sidebar-item.mjs +107 -0
- package/fesm2022/area8975-ui-sidebar-item.mjs.map +1 -0
- package/fesm2022/area8975-ui-sidebar.mjs +109 -0
- package/fesm2022/area8975-ui-sidebar.mjs.map +1 -0
- package/fesm2022/area8975-ui-skeleton.mjs +116 -0
- package/fesm2022/area8975-ui-skeleton.mjs.map +1 -0
- package/fesm2022/area8975-ui-stat.mjs +55 -0
- package/fesm2022/area8975-ui-stat.mjs.map +1 -0
- package/fesm2022/area8975-ui-switch.mjs +132 -0
- package/fesm2022/area8975-ui-switch.mjs.map +1 -0
- package/fesm2022/area8975-ui-tab.mjs +217 -0
- package/fesm2022/area8975-ui-tab.mjs.map +1 -0
- package/fesm2022/area8975-ui-table-filters.mjs +499 -0
- package/fesm2022/area8975-ui-table-filters.mjs.map +1 -0
- package/fesm2022/area8975-ui-table.mjs +1237 -0
- package/fesm2022/area8975-ui-table.mjs.map +1 -0
- package/fesm2022/area8975-ui-textarea.mjs +375 -0
- package/fesm2022/area8975-ui-textarea.mjs.map +1 -0
- package/fesm2022/area8975-ui-theme.mjs +246 -0
- package/fesm2022/area8975-ui-theme.mjs.map +1 -0
- package/fesm2022/area8975-ui-time-select.mjs +170 -0
- package/fesm2022/area8975-ui-time-select.mjs.map +1 -0
- package/fesm2022/area8975-ui-toast.mjs +269 -0
- package/fesm2022/area8975-ui-toast.mjs.map +1 -0
- package/fesm2022/area8975-ui-toaster.mjs +117 -0
- package/fesm2022/area8975-ui-toaster.mjs.map +1 -0
- package/fesm2022/area8975-ui-tooltip.mjs +196 -0
- package/fesm2022/area8975-ui-tooltip.mjs.map +1 -0
- package/fesm2022/area8975-ui-user-menu.mjs +186 -0
- package/fesm2022/area8975-ui-user-menu.mjs.map +1 -0
- package/fesm2022/area8975-ui.mjs +0 -16520
- package/package.json +237 -1
- package/types/area8975-ui-alert.d.ts +25 -0
- package/types/area8975-ui-avatar.d.ts +40 -0
- package/types/area8975-ui-badge.d.ts +31 -0
- package/types/area8975-ui-button.d.ts +129 -0
- package/types/area8975-ui-calendar.d.ts +177 -0
- package/types/area8975-ui-card-header.d.ts +28 -0
- package/types/area8975-ui-card.d.ts +18 -0
- package/types/area8975-ui-chart-palette.d.ts +176 -0
- package/types/area8975-ui-charts.d.ts +747 -0
- package/types/area8975-ui-checkbox.d.ts +61 -0
- package/types/area8975-ui-colour.d.ts +31 -0
- package/types/area8975-ui-container.d.ts +5 -0
- package/types/area8975-ui-counter.d.ts +43 -0
- package/types/area8975-ui-date-range-picker.d.ts +132 -0
- package/types/area8975-ui-datepicker.d.ts +124 -0
- package/types/area8975-ui-disclosure.d.ts +79 -0
- package/types/area8975-ui-drawer.d.ts +25 -0
- package/types/area8975-ui-dropdown-button.d.ts +32 -0
- package/types/area8975-ui-dropdown-menu.d.ts +25 -0
- package/types/area8975-ui-dropdown.d.ts +56 -0
- package/types/area8975-ui-dropzone.d.ts +96 -0
- package/types/area8975-ui-field.d.ts +72 -0
- package/types/area8975-ui-file-input.d.ts +72 -0
- package/types/area8975-ui-file.d.ts +21 -0
- package/types/area8975-ui-format.d.ts +37 -0
- package/types/area8975-ui-input-addon.d.ts +10 -0
- package/types/area8975-ui-input-group.d.ts +18 -0
- package/types/area8975-ui-input.d.ts +224 -0
- package/types/area8975-ui-kpi.d.ts +36 -0
- package/types/area8975-ui-layout.d.ts +7 -0
- package/types/area8975-ui-loading.d.ts +16 -0
- package/types/area8975-ui-modal-close-btn.d.ts +14 -0
- package/types/area8975-ui-modal.d.ts +45 -0
- package/types/area8975-ui-money.d.ts +77 -0
- package/types/area8975-ui-overlay.d.ts +75 -0
- package/types/area8975-ui-pagination.d.ts +27 -0
- package/types/area8975-ui-private.d.ts +20 -0
- package/types/area8975-ui-progress.d.ts +127 -0
- package/types/area8975-ui-radio.d.ts +61 -0
- package/types/area8975-ui-rich-text-editor.d.ts +165 -0
- package/types/area8975-ui-search.d.ts +56 -0
- package/types/area8975-ui-segmented.d.ts +41 -0
- package/types/area8975-ui-select.d.ts +293 -0
- package/types/area8975-ui-sidebar-group.d.ts +15 -0
- package/types/area8975-ui-sidebar-item.d.ts +20 -0
- package/types/area8975-ui-sidebar.d.ts +16 -0
- package/types/area8975-ui-skeleton.d.ts +35 -0
- package/types/area8975-ui-stat.d.ts +13 -0
- package/types/area8975-ui-switch.d.ts +32 -0
- package/types/area8975-ui-tab.d.ts +45 -0
- package/types/area8975-ui-table-filters.d.ts +138 -0
- package/types/area8975-ui-table.d.ts +371 -0
- package/types/area8975-ui-textarea.d.ts +126 -0
- package/types/area8975-ui-theme.d.ts +61 -0
- package/types/area8975-ui-time-select.d.ts +35 -0
- package/types/area8975-ui-toast.d.ts +78 -0
- package/types/area8975-ui-toaster.d.ts +23 -0
- package/types/area8975-ui-tooltip.d.ts +47 -0
- package/types/area8975-ui-user-menu.d.ts +39 -0
- package/types/area8975-ui.d.ts +1 -4546
- package/fesm2022/area8975-ui.mjs.map +0 -1
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { DOCUMENT, NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, computed, effect, inject, input, model, signal, untracked } from "@angular/core";
|
|
4
|
+
import { UiBadgeComponent } from "@area8975/ui/badge";
|
|
5
|
+
import { UiButtonComponent } from "@area8975/ui/button";
|
|
6
|
+
import { UiCheckboxComponent } from "@area8975/ui/checkbox";
|
|
7
|
+
import { UiDateRangePickerComponent } from "@area8975/ui/date-range-picker";
|
|
8
|
+
import { UiDrawerComponent } from "@area8975/ui/drawer";
|
|
9
|
+
import { UiInputComponent } from "@area8975/ui/input";
|
|
10
|
+
import { UiRadioComponent } from "@area8975/ui/radio";
|
|
11
|
+
import { UiTableRegistry } from "@area8975/ui/table";
|
|
12
|
+
const TableFiltersBreakpoints = {
|
|
13
|
+
sm: "40rem",
|
|
14
|
+
md: "48rem",
|
|
15
|
+
lg: "64rem",
|
|
16
|
+
xl: "80rem",
|
|
17
|
+
"2xl": "96rem"
|
|
18
|
+
};
|
|
19
|
+
let nextId = 0;
|
|
20
|
+
var UiTableFiltersComponent = class UiTableFiltersComponent {
|
|
21
|
+
registry = inject(UiTableRegistry);
|
|
22
|
+
facets = input.required(...ngDevMode ? [{ debugName: "facets" }] : /* istanbul ignore next */ []);
|
|
23
|
+
table = input(null, ...ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []);
|
|
24
|
+
value = model({}, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
25
|
+
collapseBelow = input("lg", ...ngDevMode ? [{ debugName: "collapseBelow" }] : /* istanbul ignore next */ []);
|
|
26
|
+
idPrefix = `ui-table-filters-${nextId++}`;
|
|
27
|
+
anyRange = "any";
|
|
28
|
+
customRange = "custom";
|
|
29
|
+
customRanges = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "customRanges" }] : /* istanbul ignore next */ []);
|
|
30
|
+
amountDrafts = signal({}, ...ngDevMode ? [{ debugName: "amountDrafts" }] : /* istanbul ignore next */ []);
|
|
31
|
+
expanded = signal(/* @__PURE__ */ new Set(), ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
32
|
+
linked = computed(() => {
|
|
33
|
+
const id = this.table();
|
|
34
|
+
return id ? this.registry.get(id) : null;
|
|
35
|
+
}, ...ngDevMode ? [{ debugName: "linked" }] : /* istanbul ignore next */ []);
|
|
36
|
+
appliedCount = computed(() => this.facets().filter((facet) => facet.id in this.value()).length, ...ngDevMode ? [{ debugName: "appliedCount" }] : /* istanbul ignore next */ []);
|
|
37
|
+
anyApplied = computed(() => this.appliedCount() > 0, ...ngDevMode ? [{ debugName: "anyApplied" }] : /* istanbul ignore next */ []);
|
|
38
|
+
window = inject(DOCUMENT).defaultView;
|
|
39
|
+
wide = signal(true, ...ngDevMode ? [{ debugName: "wide" }] : /* istanbul ignore next */ []);
|
|
40
|
+
constructor() {
|
|
41
|
+
effect((onCleanup) => {
|
|
42
|
+
const media = this.window?.matchMedia?.(`(min-width: ${TableFiltersBreakpoints[this.collapseBelow()]})`);
|
|
43
|
+
if (!media) return;
|
|
44
|
+
const onChange = (event) => this.wide.set(event.matches);
|
|
45
|
+
this.wide.set(media.matches);
|
|
46
|
+
media.addEventListener("change", onChange);
|
|
47
|
+
onCleanup(() => media.removeEventListener("change", onChange));
|
|
48
|
+
});
|
|
49
|
+
let previous = null;
|
|
50
|
+
effect(() => {
|
|
51
|
+
const table = this.linked();
|
|
52
|
+
const filters = table?.filters() ?? {};
|
|
53
|
+
untracked(() => {
|
|
54
|
+
const justLinked = table !== previous;
|
|
55
|
+
previous = table;
|
|
56
|
+
if (!table) return;
|
|
57
|
+
if (justLinked && this.anyApplied() && !this.hasAny(filters)) {
|
|
58
|
+
table.filters.set({
|
|
59
|
+
...filters,
|
|
60
|
+
...this.ownFilters(this.value())
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.value.set(filters);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
groupName(facet) {
|
|
69
|
+
return `${this.idPrefix}-${facet.id}`;
|
|
70
|
+
}
|
|
71
|
+
choiceId(facet, choice) {
|
|
72
|
+
return `${this.groupName(facet)}-${choice}`;
|
|
73
|
+
}
|
|
74
|
+
picked(facet) {
|
|
75
|
+
return this.value()[facet.id] ?? null;
|
|
76
|
+
}
|
|
77
|
+
pick(facet, value) {
|
|
78
|
+
this.apply(facet.id, value ?? void 0);
|
|
79
|
+
}
|
|
80
|
+
isChecked(facet, option) {
|
|
81
|
+
const applied = this.value()[facet.id];
|
|
82
|
+
return Array.isArray(applied) && applied.includes(option.value);
|
|
83
|
+
}
|
|
84
|
+
check(facet, option, checked) {
|
|
85
|
+
const applied = this.value()[facet.id];
|
|
86
|
+
const picked = (Array.isArray(applied) ? applied : []).filter((value) => value !== option.value);
|
|
87
|
+
const next = checked ? [...picked, option.value] : picked;
|
|
88
|
+
this.apply(facet.id, next.length ? next : void 0);
|
|
89
|
+
}
|
|
90
|
+
isExpanded(facet) {
|
|
91
|
+
return this.expanded().has(facet.id);
|
|
92
|
+
}
|
|
93
|
+
isShown(facet, option, index) {
|
|
94
|
+
return this.isExpanded(facet) || !this.isPastCutoff(facet, index) || this.isSelected(facet, option);
|
|
95
|
+
}
|
|
96
|
+
hiddenCount(facet) {
|
|
97
|
+
return facet.options.filter((option, index) => this.isPastCutoff(facet, index) && !this.isSelected(facet, option)).length;
|
|
98
|
+
}
|
|
99
|
+
toggleExpanded(facet) {
|
|
100
|
+
this.expanded.update((ids) => {
|
|
101
|
+
const next = new Set(ids);
|
|
102
|
+
if (!next.delete(facet.id)) next.add(facet.id);
|
|
103
|
+
return next;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
range(facet) {
|
|
107
|
+
return this.value()[facet.id] ?? {
|
|
108
|
+
start: null,
|
|
109
|
+
end: null
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
dateMode(facet) {
|
|
113
|
+
if (this.customRanges().has(facet.id)) return "custom";
|
|
114
|
+
const applied = this.range(facet);
|
|
115
|
+
if (!applied.start) return "any";
|
|
116
|
+
const index = (facet.presets ?? []).findIndex((preset) => {
|
|
117
|
+
const range = preset.range();
|
|
118
|
+
return range.start === applied.start && range.end === applied.end;
|
|
119
|
+
});
|
|
120
|
+
return index === -1 ? "custom" : index;
|
|
121
|
+
}
|
|
122
|
+
pickDate(facet, mode) {
|
|
123
|
+
this.setCustom(facet.id, mode === "custom");
|
|
124
|
+
if (mode === "any") this.apply(facet.id, void 0);
|
|
125
|
+
else if (mode !== "custom") this.apply(facet.id, facet.presets?.[mode]?.range());
|
|
126
|
+
}
|
|
127
|
+
setRange(facet, range) {
|
|
128
|
+
this.apply(facet.id, range.start ? range : void 0);
|
|
129
|
+
}
|
|
130
|
+
amountRange(facet) {
|
|
131
|
+
return this.value()[facet.id];
|
|
132
|
+
}
|
|
133
|
+
amountMode(facet) {
|
|
134
|
+
if (this.customRanges().has(facet.id)) return "custom";
|
|
135
|
+
const applied = this.amountRange(facet);
|
|
136
|
+
if (!applied) return "any";
|
|
137
|
+
const index = (facet.presets ?? []).findIndex((preset) => isSameAmountRange(preset.range, applied));
|
|
138
|
+
return index === -1 ? "custom" : index;
|
|
139
|
+
}
|
|
140
|
+
pickAmount(facet, mode) {
|
|
141
|
+
this.setCustom(facet.id, mode === "custom");
|
|
142
|
+
this.forgetAmountDraft(facet.id);
|
|
143
|
+
if (mode === "any") this.apply(facet.id, void 0);
|
|
144
|
+
else if (mode !== "custom") this.apply(facet.id, facet.presets?.[mode]?.range);
|
|
145
|
+
}
|
|
146
|
+
amountText(facet, end) {
|
|
147
|
+
const draft = this.amountDrafts()[facet.id];
|
|
148
|
+
const applied = this.amountRange(facet);
|
|
149
|
+
if (draft && isSameAmountRange(amountRangeFrom(draft), applied)) return draft[end];
|
|
150
|
+
return applied?.[end]?.toString() ?? "";
|
|
151
|
+
}
|
|
152
|
+
typeAmount(facet, end, text) {
|
|
153
|
+
const draft = {
|
|
154
|
+
min: this.amountText(facet, "min"),
|
|
155
|
+
max: this.amountText(facet, "max"),
|
|
156
|
+
[end]: text
|
|
157
|
+
};
|
|
158
|
+
this.amountDrafts.update((drafts) => ({
|
|
159
|
+
...drafts,
|
|
160
|
+
[facet.id]: draft
|
|
161
|
+
}));
|
|
162
|
+
this.apply(facet.id, amountRangeFrom(draft));
|
|
163
|
+
}
|
|
164
|
+
isAmountValid(facet, end) {
|
|
165
|
+
const draft = this.amountDrafts()[facet.id];
|
|
166
|
+
if (!draft) return true;
|
|
167
|
+
return isReadableAmount(draft[end]) && !isBackwards(draft);
|
|
168
|
+
}
|
|
169
|
+
clearAll() {
|
|
170
|
+
this.customRanges.set(/* @__PURE__ */ new Set());
|
|
171
|
+
this.amountDrafts.set({});
|
|
172
|
+
this.write(this.withoutOwn(this.currentFilters()));
|
|
173
|
+
}
|
|
174
|
+
setCustom(id, custom) {
|
|
175
|
+
this.customRanges.update((ids) => {
|
|
176
|
+
const next = new Set(ids);
|
|
177
|
+
if (custom) next.add(id);
|
|
178
|
+
else next.delete(id);
|
|
179
|
+
return next;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
forgetAmountDraft(id) {
|
|
183
|
+
this.amountDrafts.update((drafts) => Object.fromEntries(Object.entries(drafts).filter(([draftId]) => draftId !== id)));
|
|
184
|
+
}
|
|
185
|
+
isPastCutoff(facet, index) {
|
|
186
|
+
return facet.visibleOptions !== void 0 && index >= facet.visibleOptions;
|
|
187
|
+
}
|
|
188
|
+
isSelected(facet, option) {
|
|
189
|
+
return facet.multiple ? this.isChecked(facet, option) : this.picked(facet) === option.value;
|
|
190
|
+
}
|
|
191
|
+
apply(id, applied) {
|
|
192
|
+
const next = { ...this.currentFilters() };
|
|
193
|
+
if (applied === void 0) delete next[id];
|
|
194
|
+
else next[id] = applied;
|
|
195
|
+
this.write(next);
|
|
196
|
+
}
|
|
197
|
+
write(filters) {
|
|
198
|
+
this.value.set(filters);
|
|
199
|
+
this.linked()?.filters.set(filters);
|
|
200
|
+
}
|
|
201
|
+
currentFilters() {
|
|
202
|
+
return this.linked()?.filters() ?? this.value();
|
|
203
|
+
}
|
|
204
|
+
ownFilters(filters) {
|
|
205
|
+
const ids = new Set(this.facets().map((facet) => facet.id));
|
|
206
|
+
return Object.fromEntries(Object.entries(filters).filter(([id]) => ids.has(id)));
|
|
207
|
+
}
|
|
208
|
+
withoutOwn(filters) {
|
|
209
|
+
const ids = new Set(this.facets().map((facet) => facet.id));
|
|
210
|
+
return Object.fromEntries(Object.entries(filters).filter(([id]) => !ids.has(id)));
|
|
211
|
+
}
|
|
212
|
+
hasAny(filters) {
|
|
213
|
+
return Object.keys(this.ownFilters(filters)).length > 0;
|
|
214
|
+
}
|
|
215
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
216
|
+
minVersion: "12.0.0",
|
|
217
|
+
version: "22.2.1",
|
|
218
|
+
ngImport: i0,
|
|
219
|
+
type: UiTableFiltersComponent,
|
|
220
|
+
deps: [],
|
|
221
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
222
|
+
});
|
|
223
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
224
|
+
minVersion: "17.0.0",
|
|
225
|
+
version: "22.2.1",
|
|
226
|
+
type: UiTableFiltersComponent,
|
|
227
|
+
isStandalone: true,
|
|
228
|
+
selector: "ui-table-filters",
|
|
229
|
+
inputs: {
|
|
230
|
+
facets: {
|
|
231
|
+
classPropertyName: "facets",
|
|
232
|
+
publicName: "facets",
|
|
233
|
+
isSignal: true,
|
|
234
|
+
isRequired: true,
|
|
235
|
+
transformFunction: null
|
|
236
|
+
},
|
|
237
|
+
table: {
|
|
238
|
+
classPropertyName: "table",
|
|
239
|
+
publicName: "table",
|
|
240
|
+
isSignal: true,
|
|
241
|
+
isRequired: false,
|
|
242
|
+
transformFunction: null
|
|
243
|
+
},
|
|
244
|
+
value: {
|
|
245
|
+
classPropertyName: "value",
|
|
246
|
+
publicName: "value",
|
|
247
|
+
isSignal: true,
|
|
248
|
+
isRequired: false,
|
|
249
|
+
transformFunction: null
|
|
250
|
+
},
|
|
251
|
+
collapseBelow: {
|
|
252
|
+
classPropertyName: "collapseBelow",
|
|
253
|
+
publicName: "collapseBelow",
|
|
254
|
+
isSignal: true,
|
|
255
|
+
isRequired: false,
|
|
256
|
+
transformFunction: null
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
outputs: { value: "valueChange" },
|
|
260
|
+
host: { classAttribute: "block" },
|
|
261
|
+
ngImport: i0,
|
|
262
|
+
template: "@if (wide()) {\n <div class=\"ui-table-filters-panel ui-table-filters-panel--card\">\n <ng-container *ngTemplateOutlet=\"body; context: { $implicit: true }\" />\n </div>\n} @else {\n <ui-button\n appearance=\"white\"\n intent=\"secondary\"\n size=\"sm\"\n classes=\"gap-x-2 h-9.5 py-0!\"\n (click)=\"drawer.isOpen.set(true)\"\n >\n Filters\n @if (appliedCount()) {\n <ui-badge appearance=\"soft\" size=\"xs\" class=\"ui-text-caption\">{{\n appliedCount()\n }}</ui-badge>\n }\n </ui-button>\n\n <ui-drawer #drawer label=\"Filters\">\n <button\n drawer-actions\n type=\"button\"\n class=\"ui-table-filters-clear ui-text-body-alt\"\n [class.invisible]=\"!anyApplied()\"\n (click)=\"clearAll()\"\n >\n Clear all\n </button>\n\n <div class=\"ui-table-filters-panel\">\n <ng-container\n *ngTemplateOutlet=\"body; context: { $implicit: false }\"\n />\n </div>\n </ui-drawer>\n}\n\n<ng-template #body let-showHeader>\n @if (showHeader) {\n <div class=\"ui-table-filters-header\">\n <span class=\"ui-table-filters-title ui-text-body\">\n Filters\n </span>\n\n <button\n type=\"button\"\n class=\"ui-table-filters-clear ui-text-body-alt\"\n [class.invisible]=\"!anyApplied()\"\n (click)=\"clearAll()\"\n >\n Clear all\n </button>\n </div>\n }\n\n @for (facet of facets(); track facet.id) {\n <fieldset class=\"ui-table-filters-facet\">\n <legend class=\"ui-table-filters-legend ui-text-body-alt\">\n {{ facet.label }}\n </legend>\n\n <div\n class=\"ui-table-filters-choices\"\n [id]=\"groupName(facet) + '-options'\"\n >\n @switch (facet.kind) {\n @case ('options') {\n @if (facet.multiple) {\n @for (option of facet.options; track option.value; let index = $index) {\n @if (isShown(facet, option, index)) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-checkbox\n [id]=\"choiceId(facet, index)\"\n [value]=\"isChecked(facet, option)\"\n (valueChange)=\"check(facet, option, $event)\"\n />\n <span class=\"truncate\">{{\n option.label\n }}</span>\n </label>\n }\n }\n } @else {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'any')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'any')\"\n [value]=\"picked(facet)\"\n (valueChange)=\"pick(facet, $event)\"\n [option]=\"null\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Any</span>\n </label>\n\n @for (option of facet.options; track option.value; let index = $index) {\n @if (isShown(facet, option, index)) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-radio\n [id]=\"choiceId(facet, index)\"\n [value]=\"picked(facet)\"\n (valueChange)=\"pick(facet, $event)\"\n [option]=\"option.value\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">{{\n option.label\n }}</span>\n </label>\n }\n }\n }\n }\n @case ('dateRange') {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'any')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'any')\"\n [value]=\"dateMode(facet)\"\n (valueChange)=\"pickDate(facet, $event)\"\n [option]=\"anyRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Any time</span>\n </label>\n\n @for (preset of facet.presets ?? []; track preset.label; let index = $index) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-radio\n [id]=\"choiceId(facet, index)\"\n [value]=\"dateMode(facet)\"\n (valueChange)=\"pickDate(facet, $event)\"\n [option]=\"index\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">{{ preset.label }}</span>\n </label>\n }\n\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'custom')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'custom')\"\n [value]=\"dateMode(facet)\"\n (valueChange)=\"pickDate(facet, $event)\"\n [option]=\"customRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Custom range</span>\n </label>\n\n @if (dateMode(facet) === 'custom') {\n <label\n class=\"sr-only\"\n [for]=\"groupName(facet) + '-range'\"\n >{{ facet.label }} range</label>\n <ui-date-range-picker\n class=\"ui-table-filters-range\"\n [id]=\"groupName(facet) + '-range'\"\n [value]=\"range(facet)\"\n (valueChange)=\"setRange(facet, $event)\"\n [placeholder]=\"facet.placeholder ?? 'Select dates'\"\n [min]=\"facet.min ?? null\"\n [max]=\"facet.max ?? null\"\n />\n }\n }\n @case ('amountRange') {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'any')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'any')\"\n [value]=\"amountMode(facet)\"\n (valueChange)=\"pickAmount(facet, $event)\"\n [option]=\"anyRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Any amount</span>\n </label>\n\n @for (preset of facet.presets ?? []; track preset.label; let index = $index) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-radio\n [id]=\"choiceId(facet, index)\"\n [value]=\"amountMode(facet)\"\n (valueChange)=\"pickAmount(facet, $event)\"\n [option]=\"index\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">{{ preset.label }}</span>\n </label>\n }\n\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'custom')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'custom')\"\n [value]=\"amountMode(facet)\"\n (valueChange)=\"pickAmount(facet, $event)\"\n [option]=\"customRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Custom range</span>\n </label>\n\n @if (amountMode(facet) === 'custom') {\n <div class=\"ui-table-filters-amounts\">\n <ui-input\n class=\"ui-table-filters-amount ui-text-body-alt\"\n [id]=\"groupName(facet) + '-min'\"\n inputmode=\"decimal\"\n placeholder=\"Min\"\n [ariaLabel]=\"facet.label + ' from'\"\n [value]=\"amountText(facet, 'min')\"\n (valueChange)=\"typeAmount(facet, 'min', $event)\"\n [validationState]=\"isAmountValid(facet, 'min') ? null : false\"\n >\n @if (facet.prefix) {\n <ng-template #leading>\n <span class=\"ui-table-filters-prefix\">{{\n facet.prefix\n }}</span>\n </ng-template>\n }\n </ui-input>\n\n <span class=\"ui-table-filters-to ui-text-body-alt\">to</span>\n\n <ui-input\n class=\"ui-table-filters-amount ui-text-body-alt\"\n [id]=\"groupName(facet) + '-max'\"\n inputmode=\"decimal\"\n placeholder=\"Max\"\n [ariaLabel]=\"facet.label + ' up to'\"\n [value]=\"amountText(facet, 'max')\"\n (valueChange)=\"typeAmount(facet, 'max', $event)\"\n [validationState]=\"isAmountValid(facet, 'max') ? null : false\"\n >\n @if (facet.prefix) {\n <ng-template #leading>\n <span class=\"ui-table-filters-prefix\">{{\n facet.prefix\n }}</span>\n </ng-template>\n }\n </ui-input>\n </div>\n }\n }\n }\n </div>\n\n @if (facet.kind === 'options' && hiddenCount(facet)) {\n <button\n type=\"button\"\n class=\"ui-table-filters-more ui-text-body-alt\"\n [attr.aria-expanded]=\"isExpanded(facet)\"\n [attr.aria-controls]=\"groupName(facet) + '-options'\"\n (click)=\"toggleExpanded(facet)\"\n >\n @if (isExpanded(facet)) {\n Show fewer\n } @else {\n Show {{ hiddenCount(facet) }} more\n }\n </button>\n }\n </fieldset>\n }\n</ng-template>\n",
|
|
263
|
+
styles: ["@layer properties;.ui-table-filters-panel{display:flex;flex-direction:column;row-gap:calc(var(--spacing, .25rem) * 6)}.ui-table-filters-panel--card{border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--card-line);background-color:var(--card);padding:calc(var(--spacing, .25rem) * 5)}.ui-table-filters-header{display:flex;align-items:center;justify-content:space-between;column-gap:calc(var(--spacing, .25rem) * 3)}.ui-table-filters-title{display:flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2);--tw-font-weight: var(--font-weight-medium, 500);font-weight:var(--font-weight-medium, 500);color:var(--foreground)}.ui-table-filters-clear{cursor:pointer;color:var(--muted-foreground-1)}.ui-table-filters-clear:hover{color:var(--foreground)}.ui-table-filters-clear:focus-visible{text-decoration-line:underline}.ui-table-filters-clear:focus-visible{--tw-outline-style: none;outline-style:none}.ui-table-filters-facet{margin:0;min-width:0px;border-style:var(--tw-border-style);border-width:0px;padding:0}.ui-table-filters-legend{margin-bottom:calc(var(--spacing, .25rem) * 3);padding:0;--tw-font-weight: var(--font-weight-medium, 500);font-weight:var(--font-weight-medium, 500);color:var(--foreground)}.ui-table-filters-choices{display:flex;flex-direction:column;row-gap:calc(var(--spacing, .25rem) * 2.5)}.ui-table-filters-choice{display:flex;min-width:0px;cursor:pointer;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2.5);color:var(--muted-foreground-2)}.ui-table-filters-choice:hover{color:var(--foreground)}.ui-table-filters-range{margin-top:calc(var(--spacing, .25rem) * .5)}.ui-table-filters-amounts{margin-top:calc(var(--spacing, .25rem) * .5);display:flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2)}.ui-table-filters-amount{min-width:0px;flex:1}.ui-table-filters-prefix{padding-inline-start:calc(var(--spacing, .25rem) * 3);color:var(--muted-foreground-1)}.ui-table-filters-to{flex-shrink:0;color:var(--muted-foreground-1)}.ui-table-filters-more{margin-top:calc(var(--spacing, .25rem) * 2.5);cursor:pointer;color:var(--color-primary-500, var(--color-blue-500))}.ui-table-filters-more:hover{color:var(--color-primary-600, var(--color-blue-600))}.ui-table-filters-more:hover{text-decoration-line:underline}.ui-table-filters-more:focus-visible{color:var(--color-primary-600, var(--color-blue-600))}.ui-table-filters-more:focus-visible{text-decoration-line:underline}.ui-table-filters-more:focus-visible{--tw-outline-style: none;outline-style:none}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"],
|
|
264
|
+
dependencies: [
|
|
265
|
+
{
|
|
266
|
+
kind: "directive",
|
|
267
|
+
type: NgTemplateOutlet,
|
|
268
|
+
selector: "[ngTemplateOutlet]",
|
|
269
|
+
inputs: [
|
|
270
|
+
"ngTemplateOutletContext",
|
|
271
|
+
"ngTemplateOutlet",
|
|
272
|
+
"ngTemplateOutletInjector"
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
kind: "component",
|
|
277
|
+
type: UiButtonComponent,
|
|
278
|
+
selector: "ui-button",
|
|
279
|
+
inputs: [
|
|
280
|
+
"appearance",
|
|
281
|
+
"intent",
|
|
282
|
+
"size",
|
|
283
|
+
"classes",
|
|
284
|
+
"type",
|
|
285
|
+
"ariaLabel",
|
|
286
|
+
"disabled",
|
|
287
|
+
"loading"
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
kind: "component",
|
|
292
|
+
type: UiBadgeComponent,
|
|
293
|
+
selector: "ui-badge",
|
|
294
|
+
inputs: [
|
|
295
|
+
"appearance",
|
|
296
|
+
"intent",
|
|
297
|
+
"size"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
kind: "component",
|
|
302
|
+
type: UiDrawerComponent,
|
|
303
|
+
selector: "ui-drawer",
|
|
304
|
+
inputs: [
|
|
305
|
+
"enableBackdrop",
|
|
306
|
+
"label",
|
|
307
|
+
"subLabel"
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
kind: "component",
|
|
312
|
+
type: UiCheckboxComponent,
|
|
313
|
+
selector: "ui-checkbox",
|
|
314
|
+
inputs: [
|
|
315
|
+
"value",
|
|
316
|
+
"id",
|
|
317
|
+
"name",
|
|
318
|
+
"required",
|
|
319
|
+
"disabled",
|
|
320
|
+
"indeterminate",
|
|
321
|
+
"validationState",
|
|
322
|
+
"classes"
|
|
323
|
+
],
|
|
324
|
+
outputs: ["valueChange", "validationStateChange"]
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
kind: "component",
|
|
328
|
+
type: UiRadioComponent,
|
|
329
|
+
selector: "ui-radio",
|
|
330
|
+
inputs: [
|
|
331
|
+
"value",
|
|
332
|
+
"option",
|
|
333
|
+
"id",
|
|
334
|
+
"name",
|
|
335
|
+
"required",
|
|
336
|
+
"disabled",
|
|
337
|
+
"validationState",
|
|
338
|
+
"compareWith"
|
|
339
|
+
],
|
|
340
|
+
outputs: ["valueChange", "validationStateChange"]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
kind: "component",
|
|
344
|
+
type: UiInputComponent,
|
|
345
|
+
selector: "ui-input",
|
|
346
|
+
inputs: [
|
|
347
|
+
"value",
|
|
348
|
+
"classes",
|
|
349
|
+
"type",
|
|
350
|
+
"id",
|
|
351
|
+
"name",
|
|
352
|
+
"placeholder",
|
|
353
|
+
"autocomplete",
|
|
354
|
+
"inputmode",
|
|
355
|
+
"required",
|
|
356
|
+
"disabled",
|
|
357
|
+
"readonly",
|
|
358
|
+
"validationState",
|
|
359
|
+
"min",
|
|
360
|
+
"max",
|
|
361
|
+
"step",
|
|
362
|
+
"pattern",
|
|
363
|
+
"minlength",
|
|
364
|
+
"maxlength",
|
|
365
|
+
"autofocus",
|
|
366
|
+
"spellcheck",
|
|
367
|
+
"revealable",
|
|
368
|
+
"list",
|
|
369
|
+
"ariaLabel",
|
|
370
|
+
"describedBy",
|
|
371
|
+
"inputRole",
|
|
372
|
+
"ariaExpanded",
|
|
373
|
+
"ariaControls",
|
|
374
|
+
"ariaActiveDescendant",
|
|
375
|
+
"ariaAutocomplete",
|
|
376
|
+
"ariaHasPopup"
|
|
377
|
+
],
|
|
378
|
+
outputs: [
|
|
379
|
+
"valueChange",
|
|
380
|
+
"validationStateChange",
|
|
381
|
+
"focused",
|
|
382
|
+
"blurred"
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
kind: "component",
|
|
387
|
+
type: UiDateRangePickerComponent,
|
|
388
|
+
selector: "ui-date-range-picker",
|
|
389
|
+
inputs: [
|
|
390
|
+
"value",
|
|
391
|
+
"id",
|
|
392
|
+
"placeholder",
|
|
393
|
+
"disabled",
|
|
394
|
+
"clearable",
|
|
395
|
+
"validationState",
|
|
396
|
+
"describedBy",
|
|
397
|
+
"min",
|
|
398
|
+
"max",
|
|
399
|
+
"isDateDisabled",
|
|
400
|
+
"weekStart",
|
|
401
|
+
"locale",
|
|
402
|
+
"format",
|
|
403
|
+
"presets"
|
|
404
|
+
],
|
|
405
|
+
outputs: ["valueChange"]
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
});
|
|
409
|
+
};
|
|
410
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
411
|
+
minVersion: "12.0.0",
|
|
412
|
+
version: "22.2.1",
|
|
413
|
+
ngImport: i0,
|
|
414
|
+
type: UiTableFiltersComponent,
|
|
415
|
+
decorators: [{
|
|
416
|
+
type: Component,
|
|
417
|
+
args: [{
|
|
418
|
+
selector: "ui-table-filters",
|
|
419
|
+
imports: [
|
|
420
|
+
NgTemplateOutlet,
|
|
421
|
+
UiButtonComponent,
|
|
422
|
+
UiBadgeComponent,
|
|
423
|
+
UiDrawerComponent,
|
|
424
|
+
UiCheckboxComponent,
|
|
425
|
+
UiRadioComponent,
|
|
426
|
+
UiInputComponent,
|
|
427
|
+
UiDateRangePickerComponent
|
|
428
|
+
],
|
|
429
|
+
host: { class: "block" },
|
|
430
|
+
template: "@if (wide()) {\n <div class=\"ui-table-filters-panel ui-table-filters-panel--card\">\n <ng-container *ngTemplateOutlet=\"body; context: { $implicit: true }\" />\n </div>\n} @else {\n <ui-button\n appearance=\"white\"\n intent=\"secondary\"\n size=\"sm\"\n classes=\"gap-x-2 h-9.5 py-0!\"\n (click)=\"drawer.isOpen.set(true)\"\n >\n Filters\n @if (appliedCount()) {\n <ui-badge appearance=\"soft\" size=\"xs\" class=\"ui-text-caption\">{{\n appliedCount()\n }}</ui-badge>\n }\n </ui-button>\n\n <ui-drawer #drawer label=\"Filters\">\n <button\n drawer-actions\n type=\"button\"\n class=\"ui-table-filters-clear ui-text-body-alt\"\n [class.invisible]=\"!anyApplied()\"\n (click)=\"clearAll()\"\n >\n Clear all\n </button>\n\n <div class=\"ui-table-filters-panel\">\n <ng-container\n *ngTemplateOutlet=\"body; context: { $implicit: false }\"\n />\n </div>\n </ui-drawer>\n}\n\n<ng-template #body let-showHeader>\n @if (showHeader) {\n <div class=\"ui-table-filters-header\">\n <span class=\"ui-table-filters-title ui-text-body\">\n Filters\n </span>\n\n <button\n type=\"button\"\n class=\"ui-table-filters-clear ui-text-body-alt\"\n [class.invisible]=\"!anyApplied()\"\n (click)=\"clearAll()\"\n >\n Clear all\n </button>\n </div>\n }\n\n @for (facet of facets(); track facet.id) {\n <fieldset class=\"ui-table-filters-facet\">\n <legend class=\"ui-table-filters-legend ui-text-body-alt\">\n {{ facet.label }}\n </legend>\n\n <div\n class=\"ui-table-filters-choices\"\n [id]=\"groupName(facet) + '-options'\"\n >\n @switch (facet.kind) {\n @case ('options') {\n @if (facet.multiple) {\n @for (option of facet.options; track option.value; let index = $index) {\n @if (isShown(facet, option, index)) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-checkbox\n [id]=\"choiceId(facet, index)\"\n [value]=\"isChecked(facet, option)\"\n (valueChange)=\"check(facet, option, $event)\"\n />\n <span class=\"truncate\">{{\n option.label\n }}</span>\n </label>\n }\n }\n } @else {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'any')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'any')\"\n [value]=\"picked(facet)\"\n (valueChange)=\"pick(facet, $event)\"\n [option]=\"null\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Any</span>\n </label>\n\n @for (option of facet.options; track option.value; let index = $index) {\n @if (isShown(facet, option, index)) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-radio\n [id]=\"choiceId(facet, index)\"\n [value]=\"picked(facet)\"\n (valueChange)=\"pick(facet, $event)\"\n [option]=\"option.value\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">{{\n option.label\n }}</span>\n </label>\n }\n }\n }\n }\n @case ('dateRange') {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'any')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'any')\"\n [value]=\"dateMode(facet)\"\n (valueChange)=\"pickDate(facet, $event)\"\n [option]=\"anyRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Any time</span>\n </label>\n\n @for (preset of facet.presets ?? []; track preset.label; let index = $index) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-radio\n [id]=\"choiceId(facet, index)\"\n [value]=\"dateMode(facet)\"\n (valueChange)=\"pickDate(facet, $event)\"\n [option]=\"index\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">{{ preset.label }}</span>\n </label>\n }\n\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'custom')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'custom')\"\n [value]=\"dateMode(facet)\"\n (valueChange)=\"pickDate(facet, $event)\"\n [option]=\"customRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Custom range</span>\n </label>\n\n @if (dateMode(facet) === 'custom') {\n <label\n class=\"sr-only\"\n [for]=\"groupName(facet) + '-range'\"\n >{{ facet.label }} range</label>\n <ui-date-range-picker\n class=\"ui-table-filters-range\"\n [id]=\"groupName(facet) + '-range'\"\n [value]=\"range(facet)\"\n (valueChange)=\"setRange(facet, $event)\"\n [placeholder]=\"facet.placeholder ?? 'Select dates'\"\n [min]=\"facet.min ?? null\"\n [max]=\"facet.max ?? null\"\n />\n }\n }\n @case ('amountRange') {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'any')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'any')\"\n [value]=\"amountMode(facet)\"\n (valueChange)=\"pickAmount(facet, $event)\"\n [option]=\"anyRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Any amount</span>\n </label>\n\n @for (preset of facet.presets ?? []; track preset.label; let index = $index) {\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, index)\"\n >\n <ui-radio\n [id]=\"choiceId(facet, index)\"\n [value]=\"amountMode(facet)\"\n (valueChange)=\"pickAmount(facet, $event)\"\n [option]=\"index\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">{{ preset.label }}</span>\n </label>\n }\n\n <label\n class=\"ui-table-filters-choice ui-text-body-alt\"\n [for]=\"choiceId(facet, 'custom')\"\n >\n <ui-radio\n [id]=\"choiceId(facet, 'custom')\"\n [value]=\"amountMode(facet)\"\n (valueChange)=\"pickAmount(facet, $event)\"\n [option]=\"customRange\"\n [name]=\"groupName(facet)\"\n />\n <span class=\"truncate\">Custom range</span>\n </label>\n\n @if (amountMode(facet) === 'custom') {\n <div class=\"ui-table-filters-amounts\">\n <ui-input\n class=\"ui-table-filters-amount ui-text-body-alt\"\n [id]=\"groupName(facet) + '-min'\"\n inputmode=\"decimal\"\n placeholder=\"Min\"\n [ariaLabel]=\"facet.label + ' from'\"\n [value]=\"amountText(facet, 'min')\"\n (valueChange)=\"typeAmount(facet, 'min', $event)\"\n [validationState]=\"isAmountValid(facet, 'min') ? null : false\"\n >\n @if (facet.prefix) {\n <ng-template #leading>\n <span class=\"ui-table-filters-prefix\">{{\n facet.prefix\n }}</span>\n </ng-template>\n }\n </ui-input>\n\n <span class=\"ui-table-filters-to ui-text-body-alt\">to</span>\n\n <ui-input\n class=\"ui-table-filters-amount ui-text-body-alt\"\n [id]=\"groupName(facet) + '-max'\"\n inputmode=\"decimal\"\n placeholder=\"Max\"\n [ariaLabel]=\"facet.label + ' up to'\"\n [value]=\"amountText(facet, 'max')\"\n (valueChange)=\"typeAmount(facet, 'max', $event)\"\n [validationState]=\"isAmountValid(facet, 'max') ? null : false\"\n >\n @if (facet.prefix) {\n <ng-template #leading>\n <span class=\"ui-table-filters-prefix\">{{\n facet.prefix\n }}</span>\n </ng-template>\n }\n </ui-input>\n </div>\n }\n }\n }\n </div>\n\n @if (facet.kind === 'options' && hiddenCount(facet)) {\n <button\n type=\"button\"\n class=\"ui-table-filters-more ui-text-body-alt\"\n [attr.aria-expanded]=\"isExpanded(facet)\"\n [attr.aria-controls]=\"groupName(facet) + '-options'\"\n (click)=\"toggleExpanded(facet)\"\n >\n @if (isExpanded(facet)) {\n Show fewer\n } @else {\n Show {{ hiddenCount(facet) }} more\n }\n </button>\n }\n </fieldset>\n }\n</ng-template>\n",
|
|
431
|
+
styles: ["@layer properties;.ui-table-filters-panel{display:flex;flex-direction:column;row-gap:calc(var(--spacing, .25rem) * 6)}.ui-table-filters-panel--card{border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--card-line);background-color:var(--card);padding:calc(var(--spacing, .25rem) * 5)}.ui-table-filters-header{display:flex;align-items:center;justify-content:space-between;column-gap:calc(var(--spacing, .25rem) * 3)}.ui-table-filters-title{display:flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2);--tw-font-weight: var(--font-weight-medium, 500);font-weight:var(--font-weight-medium, 500);color:var(--foreground)}.ui-table-filters-clear{cursor:pointer;color:var(--muted-foreground-1)}.ui-table-filters-clear:hover{color:var(--foreground)}.ui-table-filters-clear:focus-visible{text-decoration-line:underline}.ui-table-filters-clear:focus-visible{--tw-outline-style: none;outline-style:none}.ui-table-filters-facet{margin:0;min-width:0px;border-style:var(--tw-border-style);border-width:0px;padding:0}.ui-table-filters-legend{margin-bottom:calc(var(--spacing, .25rem) * 3);padding:0;--tw-font-weight: var(--font-weight-medium, 500);font-weight:var(--font-weight-medium, 500);color:var(--foreground)}.ui-table-filters-choices{display:flex;flex-direction:column;row-gap:calc(var(--spacing, .25rem) * 2.5)}.ui-table-filters-choice{display:flex;min-width:0px;cursor:pointer;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2.5);color:var(--muted-foreground-2)}.ui-table-filters-choice:hover{color:var(--foreground)}.ui-table-filters-range{margin-top:calc(var(--spacing, .25rem) * .5)}.ui-table-filters-amounts{margin-top:calc(var(--spacing, .25rem) * .5);display:flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2)}.ui-table-filters-amount{min-width:0px;flex:1}.ui-table-filters-prefix{padding-inline-start:calc(var(--spacing, .25rem) * 3);color:var(--muted-foreground-1)}.ui-table-filters-to{flex-shrink:0;color:var(--muted-foreground-1)}.ui-table-filters-more{margin-top:calc(var(--spacing, .25rem) * 2.5);cursor:pointer;color:var(--color-primary-500, var(--color-blue-500))}.ui-table-filters-more:hover{color:var(--color-primary-600, var(--color-blue-600))}.ui-table-filters-more:hover{text-decoration-line:underline}.ui-table-filters-more:focus-visible{color:var(--color-primary-600, var(--color-blue-600))}.ui-table-filters-more:focus-visible{text-decoration-line:underline}.ui-table-filters-more:focus-visible{--tw-outline-style: none;outline-style:none}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-font-weight{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style: solid;--tw-font-weight: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
432
|
+
}]
|
|
433
|
+
}],
|
|
434
|
+
ctorParameters: () => [],
|
|
435
|
+
propDecorators: {
|
|
436
|
+
facets: [{
|
|
437
|
+
type: i0.Input,
|
|
438
|
+
args: [{
|
|
439
|
+
isSignal: true,
|
|
440
|
+
alias: "facets",
|
|
441
|
+
required: true
|
|
442
|
+
}]
|
|
443
|
+
}],
|
|
444
|
+
table: [{
|
|
445
|
+
type: i0.Input,
|
|
446
|
+
args: [{
|
|
447
|
+
isSignal: true,
|
|
448
|
+
alias: "table",
|
|
449
|
+
required: false
|
|
450
|
+
}]
|
|
451
|
+
}],
|
|
452
|
+
value: [{
|
|
453
|
+
type: i0.Input,
|
|
454
|
+
args: [{
|
|
455
|
+
isSignal: true,
|
|
456
|
+
alias: "value",
|
|
457
|
+
required: false
|
|
458
|
+
}]
|
|
459
|
+
}, {
|
|
460
|
+
type: i0.Output,
|
|
461
|
+
args: ["valueChange"]
|
|
462
|
+
}],
|
|
463
|
+
collapseBelow: [{
|
|
464
|
+
type: i0.Input,
|
|
465
|
+
args: [{
|
|
466
|
+
isSignal: true,
|
|
467
|
+
alias: "collapseBelow",
|
|
468
|
+
required: false
|
|
469
|
+
}]
|
|
470
|
+
}]
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
function amountFrom(text) {
|
|
474
|
+
const digits = text.trim().replaceAll(",", "");
|
|
475
|
+
if (!digits) return null;
|
|
476
|
+
const amount = Number(digits);
|
|
477
|
+
return Number.isFinite(amount) ? amount : null;
|
|
478
|
+
}
|
|
479
|
+
function isReadableAmount(text) {
|
|
480
|
+
return !text.trim() || amountFrom(text) !== null;
|
|
481
|
+
}
|
|
482
|
+
function isBackwards(draft) {
|
|
483
|
+
const min = amountFrom(draft.min);
|
|
484
|
+
const max = amountFrom(draft.max);
|
|
485
|
+
return min !== null && max !== null && min > max;
|
|
486
|
+
}
|
|
487
|
+
function amountRangeFrom(draft) {
|
|
488
|
+
const range = {
|
|
489
|
+
min: amountFrom(draft.min),
|
|
490
|
+
max: amountFrom(draft.max)
|
|
491
|
+
};
|
|
492
|
+
return range.min === null && range.max === null || isBackwards(draft) ? void 0 : range;
|
|
493
|
+
}
|
|
494
|
+
function isSameAmountRange(first, second) {
|
|
495
|
+
return (first?.min ?? null) === (second?.min ?? null) && (first?.max ?? null) === (second?.max ?? null);
|
|
496
|
+
}
|
|
497
|
+
export { TableFiltersBreakpoints, UiTableFiltersComponent };
|
|
498
|
+
|
|
499
|
+
//# sourceMappingURL=area8975-ui-table-filters.mjs.map
|