tailjng 0.1.6 → 0.1.7
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 +12 -4
- package/cli/execute/init-app.js +5 -2
- package/cli/execute/sync-app.js +14 -2
- package/cli/settings/colors-config-utils.js +43 -8
- package/cli/settings/icons-config-utils.js +62 -0
- package/cli/settings/path-utils.js +32 -2
- package/cli/settings/project-utils.js +7 -1
- package/cli/templates/app.generator.js +2 -2
- package/fesm2022/tailjng.mjs +247 -80
- package/fesm2022/tailjng.mjs.map +1 -1
- package/lib/services/static/theme.service.d.ts +39 -1
- package/lib/utils/theme/theme-variables.util.d.ts +31 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
- package/registry/components.json +41 -18
- package/src/colors.safelist.css +2 -2
- package/src/lib/components/.config/README.md +11 -0
- package/src/lib/components/.config/colors/README.md +38 -0
- package/src/lib/components/{colors-config → .config/colors}/colors.config.ts +5 -5
- package/src/lib/components/{colors-config → .config/colors}/colors.safelist.css +2 -2
- package/src/lib/components/.config/icons/README.md +26 -0
- package/src/lib/components/.config/icons/icons.lucide.ts +134 -0
- package/src/lib/components/.config/input/README.md +24 -0
- package/src/lib/components/.config/input/input.classes.ts +119 -0
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.css +244 -2
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.html +25 -38
- package/src/lib/components/alert/alert-dialog/dialog-alert.component.ts +66 -56
- package/src/lib/components/alert/alert-dialog/dialog-alert.types.ts +19 -0
- package/src/lib/components/alert/alert-toast/toast-alert.component.css +630 -12
- package/src/lib/components/alert/alert-toast/toast-alert.component.html +103 -102
- package/src/lib/components/alert/alert-toast/toast-alert.component.ts +485 -128
- package/src/lib/components/alert/alert-toast/toast-alert.types.ts +25 -0
- package/src/lib/components/badge/badge.component.html +34 -21
- package/src/lib/components/badge/badge.component.ts +140 -31
- package/src/lib/components/button/button.component.html +16 -10
- package/src/lib/components/button/button.component.ts +162 -22
- package/src/lib/components/card/card-complete/complete-card.component.html +2 -2
- package/src/lib/components/card/card-complete/complete-card.component.ts +26 -16
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.html +2 -2
- package/src/lib/components/card/card-crud-complete/complete-crud-card.component.ts +26 -16
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.css +97 -0
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.html +54 -46
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.ts +135 -64
- package/src/lib/components/checkbox/checkbox-input/input-checkbox.types.ts +3 -0
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.css +112 -0
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.html +28 -25
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.ts +67 -15
- package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.types.ts +1 -0
- package/src/lib/components/coach-mark/coach-mark.component.html +4 -22
- package/src/lib/components/coach-mark/coach-mark.component.scss +1 -1
- package/src/lib/components/coach-mark/coach-mark.component.ts +51 -18
- package/src/lib/components/coach-mark/coach-mark.directive.ts +133 -78
- package/src/lib/components/coach-mark/coach-mark.types.ts +12 -0
- package/src/lib/components/dialog/dialog.component.css +103 -1
- package/src/lib/components/dialog/dialog.component.html +46 -66
- package/src/lib/components/dialog/dialog.component.ts +136 -110
- package/src/lib/components/dialog/dialog.types.ts +19 -0
- package/src/lib/components/filter/filter-complete/complete-filter.component.html +16 -19
- package/src/lib/components/filter/filter-complete/complete-filter.component.scss +35 -0
- package/src/lib/components/filter/filter-complete/complete-filter.component.ts +58 -34
- package/src/lib/components/filter/filter-complete/complete-filter.types.ts +7 -0
- package/src/lib/components/filter/filter-complete/complete-filter.util.ts +16 -0
- package/src/lib/components/form/form-container/container-form.component.css +4 -0
- package/src/lib/components/form/form-container/container-form.component.html +2 -2
- package/src/lib/components/form/form-container/container-form.component.ts +72 -16
- package/src/lib/components/form/form-container/container-form.types.ts +42 -0
- package/src/lib/components/form/form-container/form-col-span.directive.ts +25 -0
- package/src/lib/components/form/form-sidebar/sidebar-form.component.css +276 -0
- package/src/lib/components/form/form-sidebar/sidebar-form.component.html +117 -125
- package/src/lib/components/form/form-sidebar/sidebar-form.component.ts +109 -34
- package/src/lib/components/form/form-sidebar/sidebar-form.types.ts +3 -0
- package/src/lib/components/{toggle-radio/toggle-radio.component.css → form/form-validation/validation-form.component.css} +0 -1
- package/src/lib/components/form/form-validation/validation-form.component.html +10 -6
- package/src/lib/components/form/form-validation/validation-form.component.ts +99 -12
- package/src/lib/components/form/form-validation/validation-form.types.ts +33 -0
- package/src/lib/components/icon/icon.component.html +8 -5
- package/src/lib/components/icon/icon.component.ts +111 -9
- package/src/lib/components/input/input/input.component.html +19 -16
- package/src/lib/components/input/input/input.component.ts +130 -53
- package/src/lib/components/input/input/input.types.ts +8 -0
- package/src/lib/components/input/input-file/file-input.component.html +65 -56
- package/src/lib/components/input/input-file/file-input.component.ts +276 -173
- package/src/lib/components/input/input-file/file-input.types.ts +2 -0
- package/src/lib/components/input/input-range/range-input.component.css +67 -0
- package/src/lib/components/input/input-range/range-input.component.html +50 -58
- package/src/lib/components/input/input-range/range-input.component.ts +148 -60
- package/src/lib/components/input/input-range/range-input.types.ts +7 -0
- package/src/lib/components/input/input-textarea/textarea-input.component.html +16 -7
- package/src/lib/components/input/input-textarea/textarea-input.component.ts +140 -50
- package/src/lib/components/input/input-textarea/textarea-input.types.ts +2 -0
- package/src/lib/components/label/label.component.html +17 -16
- package/src/lib/components/label/label.component.ts +70 -16
- package/src/lib/components/label/label.types.ts +2 -0
- package/src/lib/components/menu/menu-options-table/menu-options-defaults.ts +34 -0
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.html +34 -20
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.ts +211 -58
- package/src/lib/components/menu/menu-options-table/options-table-menu.types.ts +38 -0
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.html +49 -52
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.ts +112 -24
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.types.ts +9 -0
- package/src/lib/components/mode-toggle/mode-toggle.component.html +11 -16
- package/src/lib/components/mode-toggle/mode-toggle.component.ts +69 -33
- package/src/lib/components/paginator/paginator-complete/complete-paginator.component.html +4 -4
- package/src/lib/components/paginator/paginator-complete/complete-paginator.component.ts +31 -7
- package/src/lib/components/paginator/paginator-complete/complete-paginator.types.ts +12 -0
- package/src/lib/components/paginator/paginator-complete/complete-paginator.util.ts +36 -0
- package/src/lib/components/progress-bar/progress-bar.component.css +11 -0
- package/src/lib/components/progress-bar/progress-bar.component.html +41 -40
- package/src/lib/components/progress-bar/progress-bar.component.ts +95 -11
- package/src/lib/components/progress-bar/progress-bar.types.ts +2 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.css +6 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.component.html +54 -44
- package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +450 -509
- package/src/lib/components/select/select-dropdown/dropdown-select.types.ts +43 -0
- package/src/lib/components/select/select-dropdown/dropdown-select.util.ts +179 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.css +6 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.html +131 -42
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +491 -475
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.types.ts +22 -0
- package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.util.ts +20 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.component.css +10 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.component.html +76 -60
- package/src/lib/components/select/select-multi-table/multi-table-select.component.ts +250 -313
- package/src/lib/components/select/select-multi-table/multi-table-select.types.ts +10 -0
- package/src/lib/components/select/select-multi-table/multi-table-select.util.ts +5 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.css +212 -0
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.html +62 -53
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.ts +84 -27
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.types.ts +2 -0
- package/src/lib/components/table/table-complete/complete-table.component.html +15 -17
- package/src/lib/components/table/table-complete/complete-table.component.ts +190 -338
- package/src/lib/components/table/table-complete/complete-table.types.ts +28 -0
- package/src/lib/components/table/table-complete/complete-table.util.ts +236 -0
- package/src/lib/components/table/table-complete/index.ts +2 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.animations.ts +34 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.html +73 -128
- package/src/lib/components/table/table-crud-complete/complete-crud-table.component.ts +542 -829
- package/src/lib/components/table/table-crud-complete/complete-crud-table.types.ts +57 -0
- package/src/lib/components/table/table-crud-complete/complete-crud-table.util.ts +723 -0
- package/src/lib/components/table/table-crud-complete/index.ts +3 -0
- package/src/lib/components/theme-generator/theme-generator.component.css +21 -0
- package/src/lib/components/theme-generator/theme-generator.component.html +146 -116
- package/src/lib/components/theme-generator/theme-generator.component.ts +44 -24
- package/src/lib/components/toggle-radio/shared/toggle-options.types.ts +8 -0
- package/src/lib/components/toggle-radio/shared/toggle-options.util.ts +44 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.css +135 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.html +52 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.ts +198 -0
- package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.types.ts +1 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.css +108 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.html +37 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.ts +193 -0
- package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.types.ts +1 -0
- package/src/lib/components/tooltip/tooltip.directive.ts +12 -9
- package/src/lib/components/tooltip/tooltip.service.ts +331 -133
- package/src/lib/components/tooltip/tooltip.types.ts +9 -0
- package/src/lib/components/viewer/viewer-image/image-viewer.component.css +90 -4
- package/src/lib/components/viewer/viewer-image/image-viewer.component.html +52 -103
- package/src/lib/components/viewer/viewer-image/image-viewer.component.ts +182 -177
- package/src/lib/components/viewer/viewer-image/image-viewer.types.ts +3 -0
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.css +177 -0
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.html +74 -24
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.ts +168 -15
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.types.ts +1 -0
- package/src/styles.css +2 -2
- package/lib/services/static/icons.service.d.ts +0 -65
- package/src/lib/components/colors-config/README.md +0 -38
- package/src/lib/components/form/form-sidebar/sidebar-form.component.scss +0 -0
- package/src/lib/components/form/form-validation/validation-form.component.scss +0 -0
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.scss +0 -0
- package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.scss +0 -12
- package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.scss +0 -0
- package/src/lib/components/toggle-radio/toggle-radio.component.html +0 -51
- package/src/lib/components/toggle-radio/toggle-radio.component.ts +0 -222
- package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.scss +0 -0
- package/tailjng-0.1.6.tgz +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TableColumn } from 'tailjng';
|
|
2
|
+
|
|
3
|
+
/** Maps upload/search keys for inline editing dropdowns. */
|
|
4
|
+
export type CompleteTableEquivalenceConfig = {
|
|
5
|
+
keyColumnSearch: string;
|
|
6
|
+
keyReturn: string;
|
|
7
|
+
keyAlternate?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type CompleteTableEquivalenceConfigs = Record<string, CompleteTableEquivalenceConfig>;
|
|
11
|
+
|
|
12
|
+
export type CompleteTableEquivalenceMaps = Record<string, Record<string | number, string>>;
|
|
13
|
+
|
|
14
|
+
export type CompleteTableEquivalenceOption = {
|
|
15
|
+
key: any;
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** Resolved equivalence metadata for one editable column. */
|
|
20
|
+
export type CompleteTableEquivalenceData = {
|
|
21
|
+
keyReturn: string;
|
|
22
|
+
options: CompleteTableEquivalenceOption[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type CompleteTableSortDirection = 'asc' | 'desc' | 'none';
|
|
26
|
+
|
|
27
|
+
/** Cell value resolver passed into search/sort helpers. */
|
|
28
|
+
export type CompleteTableGetCellValueFn = (item: unknown, column: TableColumn<any>) => unknown;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { TableColumn } from 'tailjng';
|
|
2
|
+
import {
|
|
3
|
+
applyColumnDefaults,
|
|
4
|
+
formatCellDisplayValue,
|
|
5
|
+
hasEquivalenceConfig,
|
|
6
|
+
isBooleanValue,
|
|
7
|
+
isDateValue,
|
|
8
|
+
parseCellEditValue,
|
|
9
|
+
setNestedValue,
|
|
10
|
+
} from '../table-crud-complete/complete-crud-table.util';
|
|
11
|
+
import type {
|
|
12
|
+
CompleteTableEquivalenceConfigs,
|
|
13
|
+
CompleteTableEquivalenceData,
|
|
14
|
+
CompleteTableEquivalenceMaps,
|
|
15
|
+
CompleteTableGetCellValueFn,
|
|
16
|
+
CompleteTableSortDirection,
|
|
17
|
+
} from './complete-table.types';
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
applyColumnDefaults,
|
|
21
|
+
formatCellDisplayValue,
|
|
22
|
+
hasEquivalenceConfig,
|
|
23
|
+
isBooleanValue,
|
|
24
|
+
isDateValue,
|
|
25
|
+
parseCellEditValue,
|
|
26
|
+
setNestedValue,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// ── Equivalence ──────────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
export function getStaticTableEquivalenceData(
|
|
32
|
+
equivalenceConfigs: CompleteTableEquivalenceConfigs | undefined,
|
|
33
|
+
equivalences: CompleteTableEquivalenceMaps | undefined,
|
|
34
|
+
columnKey: string,
|
|
35
|
+
): CompleteTableEquivalenceData | null {
|
|
36
|
+
for (const [, config] of Object.entries(equivalenceConfigs || {})) {
|
|
37
|
+
if (!config || config.keyColumnSearch !== columnKey) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const keyReturn = config.keyReturn;
|
|
42
|
+
const idMap = equivalences?.[keyReturn];
|
|
43
|
+
|
|
44
|
+
if (!idMap) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const options = Object.entries(idMap).map(([id, label]) => ({
|
|
49
|
+
key: +id,
|
|
50
|
+
label: String(label),
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
return { keyReturn, options };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ── Flat / nested objects ────────────────────────────────────────────────────
|
|
60
|
+
|
|
61
|
+
export function flattenObject(obj: Record<string, unknown>, prefix = ''): Record<string, unknown> {
|
|
62
|
+
const result: Record<string, unknown> = {};
|
|
63
|
+
|
|
64
|
+
for (const key of Object.keys(obj)) {
|
|
65
|
+
const value = obj[key];
|
|
66
|
+
const prefixedKey = prefix ? `${prefix}.${key}` : key;
|
|
67
|
+
|
|
68
|
+
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
|
69
|
+
Object.assign(result, flattenObject(value as Record<string, unknown>, prefixedKey));
|
|
70
|
+
} else {
|
|
71
|
+
result[prefixedKey] = value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function rebuildObject(flatObj: Record<string, unknown>): Record<string, unknown> {
|
|
79
|
+
const result: Record<string, unknown> = {};
|
|
80
|
+
|
|
81
|
+
for (const key in flatObj) {
|
|
82
|
+
if (!Object.prototype.hasOwnProperty.call(flatObj, key)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const value = flatObj[key];
|
|
87
|
+
|
|
88
|
+
if (key.includes('.')) {
|
|
89
|
+
const parts = key.split('.');
|
|
90
|
+
let current: Record<string, unknown> = result;
|
|
91
|
+
|
|
92
|
+
for (let index = 0; index < parts.length; index++) {
|
|
93
|
+
const part = parts[index];
|
|
94
|
+
|
|
95
|
+
if (index === parts.length - 1) {
|
|
96
|
+
current[part] = value;
|
|
97
|
+
} else {
|
|
98
|
+
if (!current[part]) {
|
|
99
|
+
current[part] = {};
|
|
100
|
+
}
|
|
101
|
+
current = current[part] as Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
result[key] = value;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ── Row index helpers ────────────────────────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
export function findRowIndexByJsonSnapshot<T>(rows: T[], item: T): number {
|
|
115
|
+
return rows.findIndex((row) => JSON.stringify(row) === JSON.stringify(item));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ── Search ───────────────────────────────────────────────────────────────────
|
|
119
|
+
|
|
120
|
+
export function filterDisplayDataBySearch(
|
|
121
|
+
staticData: Record<string, unknown>[],
|
|
122
|
+
columns: TableColumn<any>[],
|
|
123
|
+
searchQuery: string,
|
|
124
|
+
getValue: CompleteTableGetCellValueFn,
|
|
125
|
+
): Record<string, unknown>[] {
|
|
126
|
+
const rebuilt = staticData.map((item) => rebuildObject(item));
|
|
127
|
+
|
|
128
|
+
if (!searchQuery?.trim()) {
|
|
129
|
+
return rebuilt;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const searchableKeys = columns.filter((column) => column.isSearchable).map((column) => column.key);
|
|
133
|
+
const normalizedQuery = searchQuery.trim().toLowerCase();
|
|
134
|
+
|
|
135
|
+
return rebuilt.filter((item) =>
|
|
136
|
+
searchableKeys.some((key) => {
|
|
137
|
+
const column = columns.find((col) => col.key === key);
|
|
138
|
+
const value = column ? getValue(item, column) : undefined;
|
|
139
|
+
return value?.toString().toLowerCase().includes(normalizedQuery);
|
|
140
|
+
}),
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ── Sort ─────────────────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
/** Sort state after clicking a column header (static table — clears column on desc→none). */
|
|
147
|
+
export function resolveStaticTableSortState(
|
|
148
|
+
column: TableColumn<any>,
|
|
149
|
+
currentSortColumn: string | null,
|
|
150
|
+
currentSortDirection: CompleteTableSortDirection,
|
|
151
|
+
): { sortColumn: string | null; sortDirection: CompleteTableSortDirection } {
|
|
152
|
+
if (currentSortColumn === column.key) {
|
|
153
|
+
if (currentSortDirection === 'asc') {
|
|
154
|
+
return { sortColumn: column.key, sortDirection: 'desc' };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (currentSortDirection === 'desc') {
|
|
158
|
+
return { sortColumn: null, sortDirection: 'none' };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return { sortColumn: column.key, sortDirection: 'asc' };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return { sortColumn: column.key, sortDirection: 'asc' };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function sortDisplayDataInPlace(
|
|
168
|
+
displayData: Record<string, unknown>[],
|
|
169
|
+
sortColumn: string | null,
|
|
170
|
+
sortDirection: CompleteTableSortDirection,
|
|
171
|
+
columns: TableColumn<any>[],
|
|
172
|
+
getValue: CompleteTableGetCellValueFn,
|
|
173
|
+
): void {
|
|
174
|
+
if (!sortColumn || sortDirection === 'none') {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const column = columns.find((col) => col.key === sortColumn);
|
|
179
|
+
if (!column) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
displayData.sort((rowA, rowB) => {
|
|
184
|
+
const valA = getValue(rowA, column);
|
|
185
|
+
const valB = getValue(rowB, column);
|
|
186
|
+
|
|
187
|
+
if (valA === 'S/N' && valB !== 'S/N') {
|
|
188
|
+
return -1;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (valB === 'S/N' && valA !== 'S/N') {
|
|
192
|
+
return 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (valA == null || valB == null) {
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const compA = valA.toString().toLowerCase();
|
|
200
|
+
const compB = valB.toString().toLowerCase();
|
|
201
|
+
|
|
202
|
+
if (compA < compB) {
|
|
203
|
+
return sortDirection === 'asc' ? -1 : 1;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (compA > compB) {
|
|
207
|
+
return sortDirection === 'asc' ? 1 : -1;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return 0;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Toggles a nested boolean field on one row (local edit, no API). */
|
|
215
|
+
export function toggleNestedBooleanOnItem(
|
|
216
|
+
item: Record<string, unknown>,
|
|
217
|
+
column: TableColumn<any>,
|
|
218
|
+
currentValue: unknown,
|
|
219
|
+
): void {
|
|
220
|
+
const updatedValue = !currentValue;
|
|
221
|
+
const keys = column.key.split('.');
|
|
222
|
+
let current: Record<string, unknown> = item;
|
|
223
|
+
|
|
224
|
+
for (let index = 0; index < keys.length; index++) {
|
|
225
|
+
const key = keys[index];
|
|
226
|
+
|
|
227
|
+
if (index === keys.length - 1) {
|
|
228
|
+
current[key] = updatedValue;
|
|
229
|
+
} else {
|
|
230
|
+
if (!current[key]) {
|
|
231
|
+
current[key] = {};
|
|
232
|
+
}
|
|
233
|
+
current = current[key] as Record<string, unknown>;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
2
|
+
|
|
3
|
+
/** Row expand/collapse animation for standard table rows. */
|
|
4
|
+
export const crudTableSlideToggleAnimation = trigger('slideToggle', [
|
|
5
|
+
state('collapsed', style({ height: '0', opacity: 0 })),
|
|
6
|
+
state('expanded', style({ height: '*', opacity: 1 })),
|
|
7
|
+
transition('collapsed <=> expanded', [animate('0.3s ease-in-out')]),
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
/** Group header expand/collapse animation. */
|
|
11
|
+
export const crudTableGroupSlideToggleAnimation = trigger('groupSlideToggle', [
|
|
12
|
+
state('collapsed', style({ height: '0', opacity: 0, overflow: 'hidden' })),
|
|
13
|
+
state('expanded', style({ height: '*', opacity: 1, overflow: 'visible' })),
|
|
14
|
+
transition('collapsed => expanded', [animate('380ms cubic-bezier(0.4, 0, 0.2, 1)')]),
|
|
15
|
+
transition('expanded => collapsed', [animate('300ms cubic-bezier(0.4, 0, 0.6, 1)')]),
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
/** Staggered reveal for nested group rows. */
|
|
19
|
+
export const crudTableGroupRowRevealAnimation = trigger('groupRowReveal', [
|
|
20
|
+
transition(':enter', [
|
|
21
|
+
style({ opacity: 0, transform: 'translateY(-4px)' }),
|
|
22
|
+
animate('280ms cubic-bezier(0.4, 0, 0.2, 1)', style({ opacity: 1, transform: 'translateY(0)' })),
|
|
23
|
+
]),
|
|
24
|
+
transition(':leave', [
|
|
25
|
+
animate('220ms cubic-bezier(0.4, 0, 0.6, 1)', style({ opacity: 0, transform: 'translateY(-4px)' })),
|
|
26
|
+
]),
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
/** All animations used by {@link JCompleteCrudTableComponent}. */
|
|
30
|
+
export const CRUD_TABLE_ANIMATIONS = [
|
|
31
|
+
crudTableSlideToggleAnimation,
|
|
32
|
+
crudTableGroupSlideToggleAnimation,
|
|
33
|
+
crudTableGroupRowRevealAnimation,
|
|
34
|
+
];
|