@haloduck/ui 2.0.35 → 2.0.37
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/haloduck-ui.mjs +271 -27
- package/fesm2022/haloduck-ui.mjs.map +1 -1
- package/index.d.ts +51 -8
- package/package.json +1 -1
- package/public/i18n/haloduck/en.json +4 -1
- package/public/i18n/haloduck/ko.json +5 -2
package/fesm2022/haloduck-ui.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { Injectable, Input, Component, inject, ChangeDetectorRef, forwardRef, Vi
|
|
|
3
3
|
import { signIn, confirmSignIn, resetPassword, confirmResetPassword } from 'aws-amplify/auth';
|
|
4
4
|
import * as i1$1 from '@angular/forms';
|
|
5
5
|
import { NG_VALUE_ACCESSOR, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
-
import { BehaviorSubject, zip, Subject, takeUntil, tap, combineLatest, switchMap, of, Observable, distinctUntilChanged, map, take } from 'rxjs';
|
|
6
|
+
import { BehaviorSubject, zip, Subject, takeUntil, tap, combineLatest, switchMap, of, Observable, distinctUntilChanged, shareReplay, map, take } from 'rxjs';
|
|
7
7
|
import { ulid } from 'ulid';
|
|
8
8
|
import * as i1 from '@angular/common';
|
|
9
9
|
import { CommonModule, DecimalPipe, DatePipe } from '@angular/common';
|
|
@@ -2903,13 +2903,22 @@ class AutoLoadDirective {
|
|
|
2903
2903
|
autoLoadRootMargin = '0px';
|
|
2904
2904
|
autoLoadTrigger = new EventEmitter();
|
|
2905
2905
|
ngOnInit() {
|
|
2906
|
-
|
|
2907
|
-
|
|
2906
|
+
this.setupObserver();
|
|
2907
|
+
}
|
|
2908
|
+
ngOnChanges(changes) {
|
|
2909
|
+
if (changes['autoLoadEnabled']) {
|
|
2910
|
+
this.setupObserver();
|
|
2908
2911
|
}
|
|
2909
2912
|
}
|
|
2910
2913
|
ngOnDestroy() {
|
|
2911
2914
|
this.disconnect();
|
|
2912
2915
|
}
|
|
2916
|
+
setupObserver() {
|
|
2917
|
+
this.disconnect();
|
|
2918
|
+
if (this.autoLoadEnabled && 'IntersectionObserver' in window) {
|
|
2919
|
+
this.initializeObserver();
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2913
2922
|
initializeObserver() {
|
|
2914
2923
|
this.ngZone.runOutsideAngular(() => {
|
|
2915
2924
|
this.observer = new IntersectionObserver((entries) => {
|
|
@@ -2956,6 +2965,7 @@ class AutoLoadDirective {
|
|
|
2956
2965
|
disconnect() {
|
|
2957
2966
|
if (this.observer) {
|
|
2958
2967
|
this.observer.disconnect();
|
|
2968
|
+
this.observer = undefined;
|
|
2959
2969
|
}
|
|
2960
2970
|
}
|
|
2961
2971
|
// 외부에서 로딩 상태를 제어할 수 있는 메서드
|
|
@@ -2968,7 +2978,7 @@ class AutoLoadDirective {
|
|
|
2968
2978
|
this.isLoading = false;
|
|
2969
2979
|
}
|
|
2970
2980
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: AutoLoadDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2971
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: AutoLoadDirective, isStandalone: true, selector: "[haloduckAutoLoad]", inputs: { autoLoadEnabled: "autoLoadEnabled", autoLoadThreshold: "autoLoadThreshold", autoLoadRootMargin: "autoLoadRootMargin" }, outputs: { autoLoadTrigger: "autoLoadTrigger" }, ngImport: i0 });
|
|
2981
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.4", type: AutoLoadDirective, isStandalone: true, selector: "[haloduckAutoLoad]", inputs: { autoLoadEnabled: "autoLoadEnabled", autoLoadThreshold: "autoLoadThreshold", autoLoadRootMargin: "autoLoadRootMargin" }, outputs: { autoLoadTrigger: "autoLoadTrigger" }, usesOnChanges: true, ngImport: i0 });
|
|
2972
2982
|
}
|
|
2973
2983
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: AutoLoadDirective, decorators: [{
|
|
2974
2984
|
type: Directive,
|
|
@@ -2986,13 +2996,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
2986
2996
|
type: Output
|
|
2987
2997
|
}] } });
|
|
2988
2998
|
|
|
2999
|
+
class TableSettingService {
|
|
3000
|
+
dialogService = inject(DialogService);
|
|
3001
|
+
currentOverlayRef;
|
|
3002
|
+
currentTableNameSubject = new BehaviorSubject('');
|
|
3003
|
+
settingsSubjects = new Map();
|
|
3004
|
+
defaultSettings = {
|
|
3005
|
+
showHeader: true,
|
|
3006
|
+
autoLoad: false,
|
|
3007
|
+
};
|
|
3008
|
+
get currentTableName$() {
|
|
3009
|
+
return this.currentTableNameSubject.asObservable();
|
|
3010
|
+
}
|
|
3011
|
+
show(tableName) {
|
|
3012
|
+
this.currentTableNameSubject.next(tableName);
|
|
3013
|
+
// Lazy import to avoid circular dependency
|
|
3014
|
+
Promise.resolve().then(function () { return tableSetting_component; }).then(({ TableSettingComponent }) => {
|
|
3015
|
+
this.currentOverlayRef = this.dialogService.open(TableSettingComponent, {
|
|
3016
|
+
tableName,
|
|
3017
|
+
});
|
|
3018
|
+
});
|
|
3019
|
+
}
|
|
3020
|
+
hide() {
|
|
3021
|
+
console.log('Hiding table settings', this.currentOverlayRef);
|
|
3022
|
+
if (this.currentOverlayRef) {
|
|
3023
|
+
this.dialogService.close(this.currentOverlayRef);
|
|
3024
|
+
this.currentOverlayRef = undefined;
|
|
3025
|
+
}
|
|
3026
|
+
this.currentTableNameSubject.next('');
|
|
3027
|
+
}
|
|
3028
|
+
getSettings(tableName) {
|
|
3029
|
+
if (!this.settingsSubjects.has(tableName)) {
|
|
3030
|
+
const savedSettings = this.loadSettingsFromStorage(tableName);
|
|
3031
|
+
this.settingsSubjects.set(tableName, new BehaviorSubject(savedSettings));
|
|
3032
|
+
}
|
|
3033
|
+
return this.settingsSubjects.get(tableName).asObservable();
|
|
3034
|
+
}
|
|
3035
|
+
setCurrentTableName(tableName) {
|
|
3036
|
+
this.currentTableNameSubject.next(tableName);
|
|
3037
|
+
}
|
|
3038
|
+
updateSettings(tableName, settings) {
|
|
3039
|
+
if (!this.settingsSubjects.has(tableName)) {
|
|
3040
|
+
this.settingsSubjects.set(tableName, new BehaviorSubject(settings));
|
|
3041
|
+
}
|
|
3042
|
+
else {
|
|
3043
|
+
this.settingsSubjects.get(tableName).next(settings);
|
|
3044
|
+
}
|
|
3045
|
+
this.saveSettingsToStorage(tableName, settings);
|
|
3046
|
+
}
|
|
3047
|
+
loadSettingsFromStorage(tableName) {
|
|
3048
|
+
try {
|
|
3049
|
+
const storageKey = `tableSettings_${tableName}`;
|
|
3050
|
+
const saved = localStorage.getItem(storageKey);
|
|
3051
|
+
if (saved) {
|
|
3052
|
+
return { ...this.defaultSettings, ...JSON.parse(saved) };
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
catch (error) {
|
|
3056
|
+
console.warn('Failed to load table settings from localStorage:', error);
|
|
3057
|
+
}
|
|
3058
|
+
return { ...this.defaultSettings };
|
|
3059
|
+
}
|
|
3060
|
+
saveSettingsToStorage(tableName, settings) {
|
|
3061
|
+
try {
|
|
3062
|
+
const storageKey = `tableSettings_${tableName}`;
|
|
3063
|
+
localStorage.setItem(storageKey, JSON.stringify(settings));
|
|
3064
|
+
}
|
|
3065
|
+
catch (error) {
|
|
3066
|
+
console.warn('Failed to save table settings to localStorage:', error);
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableSettingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3070
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableSettingService, providedIn: 'root' });
|
|
3071
|
+
}
|
|
3072
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableSettingService, decorators: [{
|
|
3073
|
+
type: Injectable,
|
|
3074
|
+
args: [{
|
|
3075
|
+
providedIn: 'root',
|
|
3076
|
+
}]
|
|
3077
|
+
}] });
|
|
3078
|
+
|
|
2989
3079
|
class TableComponent {
|
|
2990
3080
|
coreService = inject(CoreService);
|
|
3081
|
+
tableSettingService = inject(TableSettingService);
|
|
2991
3082
|
loadMoreRowRef;
|
|
2992
3083
|
tableLayout = 'auto';
|
|
2993
|
-
|
|
2994
|
-
showHeader = true;
|
|
3084
|
+
tableName = '';
|
|
2995
3085
|
useLoadMore = true;
|
|
3086
|
+
defaultAutoLoad = true;
|
|
3087
|
+
defaultShowHeader = true;
|
|
2996
3088
|
columns = [];
|
|
2997
3089
|
rows = new Observable();
|
|
2998
3090
|
isLoading = new Observable();
|
|
@@ -3005,6 +3097,9 @@ class TableComponent {
|
|
|
3005
3097
|
onLoadMore = new EventEmitter();
|
|
3006
3098
|
onRowClick = new EventEmitter();
|
|
3007
3099
|
onRowDblClick = new EventEmitter();
|
|
3100
|
+
settings$ = this.tableName ? this.tableSettingService.getSettings(this.tableName).pipe(shareReplay(1)) : of({ showHeader: this.defaultShowHeader, autoLoad: this.defaultAutoLoad });
|
|
3101
|
+
showHeader$ = this.settings$.pipe(map(settings => settings.showHeader));
|
|
3102
|
+
autoLoad$ = this.settings$.pipe(map(settings => settings.autoLoad));
|
|
3008
3103
|
getColumnValue(row, column) {
|
|
3009
3104
|
const value = this.getColumnValueRaw(row, column);
|
|
3010
3105
|
if (column.customRenderFn) {
|
|
@@ -3056,19 +3151,40 @@ class TableComponent {
|
|
|
3056
3151
|
}
|
|
3057
3152
|
getNumber(data) {
|
|
3058
3153
|
const numberPipe = new DecimalPipe('en-US');
|
|
3059
|
-
|
|
3154
|
+
try {
|
|
3155
|
+
return of(numberPipe.transform(data) || '');
|
|
3156
|
+
}
|
|
3157
|
+
catch (error) {
|
|
3158
|
+
return of('');
|
|
3159
|
+
}
|
|
3060
3160
|
}
|
|
3061
3161
|
getDate(data) {
|
|
3062
3162
|
const datePipe = new DatePipe('en-US');
|
|
3163
|
+
try {
|
|
3164
|
+
return of(datePipe.transform(data, 'shortDate') || '');
|
|
3165
|
+
}
|
|
3166
|
+
catch (error) {
|
|
3167
|
+
return of('');
|
|
3168
|
+
}
|
|
3063
3169
|
return of(datePipe.transform(data, 'shortDate') || '');
|
|
3064
3170
|
}
|
|
3065
3171
|
getDateTime(data) {
|
|
3066
3172
|
const datePipe = new DatePipe('en-US');
|
|
3067
|
-
|
|
3173
|
+
try {
|
|
3174
|
+
return of(datePipe.transform(data, this.coreService.getDateFormatLong()) || '');
|
|
3175
|
+
}
|
|
3176
|
+
catch (error) {
|
|
3177
|
+
return of('');
|
|
3178
|
+
}
|
|
3068
3179
|
}
|
|
3069
3180
|
getTime(data) {
|
|
3070
3181
|
const datePipe = new DatePipe('en-US');
|
|
3071
|
-
|
|
3182
|
+
try {
|
|
3183
|
+
return of(datePipe.transform(data, 'Time') || '');
|
|
3184
|
+
}
|
|
3185
|
+
catch (error) {
|
|
3186
|
+
return of('');
|
|
3187
|
+
}
|
|
3072
3188
|
}
|
|
3073
3189
|
onUpdateSort(field, direction) {
|
|
3074
3190
|
this.onSortChange.emit({ field, direction });
|
|
@@ -3085,11 +3201,13 @@ class TableComponent {
|
|
|
3085
3201
|
});
|
|
3086
3202
|
}
|
|
3087
3203
|
onAutoLoadTriggered() {
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
this.
|
|
3091
|
-
|
|
3092
|
-
|
|
3204
|
+
this.autoLoad$.pipe(take(1)).subscribe(autoLoad => {
|
|
3205
|
+
if (autoLoad) {
|
|
3206
|
+
this.lastEvaluatedKey.pipe(take(1)).subscribe((lastEvaluatedKey) => {
|
|
3207
|
+
this.onLoadMore.emit(lastEvaluatedKey);
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
});
|
|
3093
3211
|
}
|
|
3094
3212
|
onRowClicked(row) {
|
|
3095
3213
|
this.onRowClick.emit(row);
|
|
@@ -3097,23 +3215,31 @@ class TableComponent {
|
|
|
3097
3215
|
onRowDblClicked(row) {
|
|
3098
3216
|
this.onRowDblClick.emit(row);
|
|
3099
3217
|
}
|
|
3100
|
-
ngOnInit() {
|
|
3218
|
+
ngOnInit() {
|
|
3219
|
+
if (this.tableName) {
|
|
3220
|
+
this.settings$ = this.tableSettingService.getSettings(this.tableName).pipe(shareReplay(1));
|
|
3221
|
+
this.showHeader$ = this.settings$.pipe(map(settings => settings.showHeader));
|
|
3222
|
+
this.autoLoad$ = this.settings$.pipe(map(settings => settings.autoLoad));
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
openSettings() {
|
|
3226
|
+
if (this.tableName) {
|
|
3227
|
+
this.tableSettingService.show(this.tableName);
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3101
3230
|
ngAfterViewInit() { }
|
|
3102
|
-
constructor() { }
|
|
3103
3231
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3104
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: TableComponent, isStandalone: true, selector: "haloduck-table", inputs: { tableLayout: "tableLayout",
|
|
3232
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: TableComponent, isStandalone: true, selector: "haloduck-table", inputs: { tableLayout: "tableLayout", tableName: "tableName", useLoadMore: "useLoadMore", columns: "columns", rows: "rows", isLoading: "isLoading", isPaging: "isPaging", sort: "sort", expandedTemplate: "expandedTemplate", customTemplates: "customTemplates", lastEvaluatedKey: "lastEvaluatedKey" }, outputs: { onSortChange: "onSortChange", onLoadMore: "onLoadMore", onRowClick: "onRowClick", onRowDblClick: "onRowDblClick" }, providers: [provideTranslocoScope('haloduck')], viewQueries: [{ propertyName: "loadMoreRowRef", first: true, predicate: ["loadMoreRow"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"w-full h-full shadow border border-light-inactive dark:border-dark-inactive rounded-lg overflow-auto\">\n <table class=\"w-full h-full\"\n [ngClass]=\"{\n 'table-fixed': tableLayout === 'fixed',\n 'table-auto': tableLayout === 'auto',\n }\">\n <colgroup>\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <col class=\"{{ column.width || '' }}\" />\n }\n }\n </colgroup>\n @if (showHeader$ | async) {\n <thead class=\"bg-light-inactive/50 dark:bg-dark-inactive/50 rounded-tl-lg rounded-tr-lg\">\n <tr>\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <th scope=\"col\"\n class=\"{{ column.align || '' }} py-3.5 pl-4 pr-3 text-sm font-semibold text-light-on-background dark:text-dark-on-background whitespace-nowrap\">\n <span class=\"group inline-flex\">\n {{ column.label }}\n @if (column.sortable) {\n @switch (getSortDirection(column.sort?.field || column.key) | async)\n {\n @case('desc') {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'asc')\"\n class=\"ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n @case('asc') {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'desc')\"\n class=\"ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M14.78 11.78a.75.75 0 0 1-1.06 0L10 8.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n @default {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'asc')\"\n class=\"invisible ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive group-hover:visible group-focus:visible\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M14.78 11.78a.75.75 0 0 1-1.06 0L10 8.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n }\n }\n </span>\n </th>\n }\n }\n </tr>\n </thead>\n }\n <tbody class=\"overflow-scroll\">\n @for (row of rows | async; track row['id']; let lastRow = $last) {\n <tr class=\"border-t border-light-inactive dark:border-dark-inactive {{ row.bgColor || '' }}\"\n (click)=\"onRowClicked(row)\"\n (dblclick)=\"onRowDblClicked(row)\"\n [ngClass]=\"{'rounded-b-lg': lastRow && (lastEvaluatedKey | async) === null, 'even:bg-light-alternative dark:even:bg-dark-alternative odd:bg-light-background dark:odd:bg-dark-background': !row.bgColor }\"\n [ngStyle]=\"{ 'background-color': row.bgColor || '' }\">\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <td class=\"relative overflow-visible {{ column.align || '' }} whitespace-nowrap px-3 text-sm text-light-on-background dark:text-dark-on-background\"\n [ngClass]=\"{\n 'first:rounded-bl-lg last:rounded-br-lg': lastRow && (lastEvaluatedKey | async) === null,\n 'text-wrap': row.isExpanded && column.type !== 'custom',\n 'overflow-x-hidden text-ellipsis' : !row.isExpanded && column.type !== 'custom',\n 'py-2': column.type === 'custom',\n 'py-4': column.type !== 'custom'\n }\">\n @if (column.type === 'custom') {\n @if (column.customRenderTemplate) {\n <ng-container [ngTemplateOutlet]=\"customTemplates[column.customRenderTemplate]\"\n [ngTemplateOutletContext]=\"{ $implicit: row, column: column }\"></ng-container>\n }\n }\n @else {\n {{ getColumnValue(row, column) | async }}\n }\n </td>\n }\n }\n </tr>\n\n @if (row.isExpanded && expandedTemplate) {\n <tr>\n <td [attr.colspan]=\"columns.length\">\n </td>\n </tr>\n <tr class=\"even:bg-light-alternative dark:even:bg-dark-alternative odd:bg-light-background dark:odd:bg-dark-background\">\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 pb-4 text-sm text-center\">\n <ng-container [ngTemplateOutlet]=\"expandedTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: row }\"></ng-container>\n </td>\n </tr>\n }\n\n @if (lastRow && (lastEvaluatedKey | async) && !(isLoading | async) && useLoadMore) {\n <tr #loadMoreRow\n class=\"border-t border-light-inactive dark:border-dark-inactive bg-light-background dark:bg-dark-background\"\n haloduckAutoLoad\n [autoLoadEnabled]=\"(autoLoad$ | async) ?? true\"\n [autoLoadThreshold]=\"0.1\"\n (autoLoadTrigger)=\"onAutoLoadTriggered()\">\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 py-4 text-sm text-light-on-background dark:text-dark-on-background text-center h-16 bg-light-background dark:bg-dark-background rounded-bl-lg rounded-br-lg\">\n <div (click)=\"onLoadMoreClicked()\"\n class=\"cursor-pointer\">\n {{ 'haloduck.ui.table.Load More...' | transloco }}\n </div>\n </td>\n </tr>\n }\n\n } @empty {\n @if(!(isLoading | async)) {\n <tr>\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 py-4 text-sm text-light-on-background dark:text-dark-on-background text-center h-16 bg-light-background dark:bg-dark-background rounded-bl-lg rounded-br-lg\">\n {{ 'haloduck.ui.table.No data available.' | transloco }}\n </td>\n </tr>\n }\n }\n\n @if(isLoading | async) {\n @for ( i of [0,1,2,3,4]; track i; let lastRow = $last)\n {\n <tr class=\"bg-light-background dark:bg-dark-background border-t border-light-inactive/50 dark:border-dark-inactive/50\">\n @for (column of columns; track column.key) {\n <td class=\"whitespace-nowrap py-4 pl-4 pr-3 text-sm\"\n [ngClass]=\"{'first:rounded-bl-lg last:rounded-br-lg': lastRow}\">\n <div class=\"h-4 bg-light-inactive/50 dark:bg-dark-inactive/50 rounded-md animate-pulse\"></div>\n </td>\n }\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: AutoLoadDirective, selector: "[haloduckAutoLoad]", inputs: ["autoLoadEnabled", "autoLoadThreshold", "autoLoadRootMargin"], outputs: ["autoLoadTrigger"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3105
3233
|
}
|
|
3106
3234
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableComponent, decorators: [{
|
|
3107
3235
|
type: Component,
|
|
3108
|
-
args: [{ selector: 'haloduck-table', imports: [CommonModule, TranslocoModule, AutoLoadDirective], providers: [provideTranslocoScope('haloduck')], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"w-full h-full shadow border border-light-inactive dark:border-dark-inactive rounded-lg overflow-auto\">\n <table class=\"w-full h-full\"\n [ngClass]=\"{\n 'table-fixed': tableLayout === 'fixed',\n 'table-auto': tableLayout === 'auto',\n }\">\n <colgroup>\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <col class=\"{{ column.width || '' }}\" />\n }\n }\n </colgroup>\n @if (showHeader) {\n <thead class=\"bg-light-inactive/50 dark:bg-dark-inactive/50 rounded-tl-lg rounded-tr-lg\">\n <tr>\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <th scope=\"col\"\n class=\"{{ column.align || '' }} py-3.5 pl-4 pr-3 text-sm font-semibold text-light-on-background dark:text-dark-on-background whitespace-nowrap\">\n <span class=\"group inline-flex\">\n {{ column.label }}\n @if (column.sortable) {\n @switch (getSortDirection(column.sort?.field || column.key) | async)\n {\n @case('desc') {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'asc')\"\n class=\"ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n @case('asc') {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'desc')\"\n class=\"ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M14.78 11.78a.75.75 0 0 1-1.06 0L10 8.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n @default {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'asc')\"\n class=\"invisible ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive group-hover:visible group-focus:visible\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M14.78 11.78a.75.75 0 0 1-1.06 0L10 8.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n }\n }\n </span>\n </th>\n }\n }\n </tr>\n </thead>\n }\n <tbody class=\"overflow-scroll\">\n @for (row of rows | async; track row['id']; let lastRow = $last) {\n <tr class=\"border-t border-light-inactive dark:border-dark-inactive {{ row.bgColor || '' }}\"\n (click)=\"onRowClicked(row)\"\n (dblclick)=\"onRowDblClicked(row)\"\n [ngClass]=\"{'rounded-b-lg': lastRow && (lastEvaluatedKey | async) === null, 'even:bg-light-alternative dark:even:bg-dark-alternative odd:bg-light-background dark:odd:bg-dark-background': !row.bgColor }\"\n [ngStyle]=\"{ 'background-color': row.bgColor || '' }\">\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <td class=\"relative overflow-visible {{ column.align || '' }} whitespace-nowrap px-3 text-sm text-light-on-background dark:text-dark-on-background\"\n [ngClass]=\"{\n 'first:rounded-bl-lg last:rounded-br-lg': lastRow && (lastEvaluatedKey | async) === null,\n 'text-wrap': row.isExpanded && column.type !== 'custom',\n 'overflow-x-hidden text-ellipsis' : !row.isExpanded && column.type !== 'custom',\n 'py-2': column.type === 'custom',\n 'py-4': column.type !== 'custom'\n }\">\n @if (column.type === 'custom') {\n @if (column.customRenderTemplate) {\n <ng-container [ngTemplateOutlet]=\"customTemplates[column.customRenderTemplate]\"\n [ngTemplateOutletContext]=\"{ $implicit: row, column: column }\"></ng-container>\n }\n }\n @else {\n {{ getColumnValue(row, column) | async }}\n }\n </td>\n }\n }\n </tr>\n\n @if (row.isExpanded && expandedTemplate) {\n <tr>\n <td [attr.colspan]=\"columns.length\">\n </td>\n </tr>\n <tr class=\"even:bg-light-alternative dark:even:bg-dark-alternative odd:bg-light-background dark:odd:bg-dark-background\">\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 pb-4 text-sm text-center\">\n <ng-container [ngTemplateOutlet]=\"expandedTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: row }\"></ng-container>\n </td>\n </tr>\n }\n\n @if (lastRow && (lastEvaluatedKey | async) && !(isLoading | async) && useLoadMore) {\n <tr #loadMoreRow\n class=\"border-t border-light-inactive dark:border-dark-inactive bg-light-background dark:bg-dark-background\"\n haloduckAutoLoad\n [autoLoadEnabled]=\"autoLoad\"\n [autoLoadThreshold]=\"0.1\"\n (autoLoadTrigger)=\"onAutoLoadTriggered()\">\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 py-4 text-sm text-light-on-background dark:text-dark-on-background text-center h-16 bg-light-background dark:bg-dark-background rounded-bl-lg rounded-br-lg\">\n <div (click)=\"onLoadMoreClicked()\"\n class=\"cursor-pointer\">\n {{ 'haloduck.ui.table.Load More...' | transloco }}\n </div>\n </td>\n </tr>\n }\n\n } @empty {\n @if(!(isLoading | async)) {\n <tr>\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 py-4 text-sm text-light-on-background dark:text-dark-on-background text-center h-16 bg-light-background dark:bg-dark-background rounded-bl-lg rounded-br-lg\">\n {{ 'haloduck.ui.table.No data available.' | transloco }}\n </td>\n </tr>\n }\n }\n\n @if(isLoading | async) {\n @for ( i of [0,1,2,3,4]; track i; let lastRow = $last)\n {\n <tr class=\"bg-light-background dark:bg-dark-background border-t border-light-inactive/50 dark:border-dark-inactive/50\">\n @for (column of columns; track column.key) {\n <td class=\"whitespace-nowrap py-4 pl-4 pr-3 text-sm\"\n [ngClass]=\"{'first:rounded-bl-lg last:rounded-br-lg': lastRow}\">\n <div class=\"h-4 bg-light-inactive/50 dark:bg-dark-inactive/50 rounded-md animate-pulse\"></div>\n </td>\n }\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n" }]
|
|
3109
|
-
}],
|
|
3236
|
+
args: [{ selector: 'haloduck-table', imports: [CommonModule, TranslocoModule, AutoLoadDirective], providers: [provideTranslocoScope('haloduck')], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"w-full h-full shadow border border-light-inactive dark:border-dark-inactive rounded-lg overflow-auto\">\n <table class=\"w-full h-full\"\n [ngClass]=\"{\n 'table-fixed': tableLayout === 'fixed',\n 'table-auto': tableLayout === 'auto',\n }\">\n <colgroup>\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <col class=\"{{ column.width || '' }}\" />\n }\n }\n </colgroup>\n @if (showHeader$ | async) {\n <thead class=\"bg-light-inactive/50 dark:bg-dark-inactive/50 rounded-tl-lg rounded-tr-lg\">\n <tr>\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <th scope=\"col\"\n class=\"{{ column.align || '' }} py-3.5 pl-4 pr-3 text-sm font-semibold text-light-on-background dark:text-dark-on-background whitespace-nowrap\">\n <span class=\"group inline-flex\">\n {{ column.label }}\n @if (column.sortable) {\n @switch (getSortDirection(column.sort?.field || column.key) | async)\n {\n @case('desc') {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'asc')\"\n class=\"ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n @case('asc') {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'desc')\"\n class=\"ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M14.78 11.78a.75.75 0 0 1-1.06 0L10 8.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n @default {\n <span (click)=\"onUpdateSort(column.sort?.field || column.key, 'asc')\"\n class=\"invisible ml-2 flex-none rounded text-light-on-inactive dark:text-dark-on-inactive group-hover:visible group-focus:visible\">\n <svg class=\"size-5\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\">\n <path fill-rule=\"evenodd\"\n d=\"M14.78 11.78a.75.75 0 0 1-1.06 0L10 8.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06l4.25-4.25a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06Z\"\n clip-rule=\"evenodd\" />\n </svg>\n </span>\n }\n }\n }\n </span>\n </th>\n }\n }\n </tr>\n </thead>\n }\n <tbody class=\"overflow-scroll\">\n @for (row of rows | async; track row['id']; let lastRow = $last) {\n <tr class=\"border-t border-light-inactive dark:border-dark-inactive {{ row.bgColor || '' }}\"\n (click)=\"onRowClicked(row)\"\n (dblclick)=\"onRowDblClicked(row)\"\n [ngClass]=\"{'rounded-b-lg': lastRow && (lastEvaluatedKey | async) === null, 'even:bg-light-alternative dark:even:bg-dark-alternative odd:bg-light-background dark:odd:bg-dark-background': !row.bgColor }\"\n [ngStyle]=\"{ 'background-color': row.bgColor || '' }\">\n @for (column of columns; track column.key) {\n @if (!column.hidden || !(column.hidden | async)) {\n <td class=\"relative overflow-visible {{ column.align || '' }} whitespace-nowrap px-3 text-sm text-light-on-background dark:text-dark-on-background\"\n [ngClass]=\"{\n 'first:rounded-bl-lg last:rounded-br-lg': lastRow && (lastEvaluatedKey | async) === null,\n 'text-wrap': row.isExpanded && column.type !== 'custom',\n 'overflow-x-hidden text-ellipsis' : !row.isExpanded && column.type !== 'custom',\n 'py-2': column.type === 'custom',\n 'py-4': column.type !== 'custom'\n }\">\n @if (column.type === 'custom') {\n @if (column.customRenderTemplate) {\n <ng-container [ngTemplateOutlet]=\"customTemplates[column.customRenderTemplate]\"\n [ngTemplateOutletContext]=\"{ $implicit: row, column: column }\"></ng-container>\n }\n }\n @else {\n {{ getColumnValue(row, column) | async }}\n }\n </td>\n }\n }\n </tr>\n\n @if (row.isExpanded && expandedTemplate) {\n <tr>\n <td [attr.colspan]=\"columns.length\">\n </td>\n </tr>\n <tr class=\"even:bg-light-alternative dark:even:bg-dark-alternative odd:bg-light-background dark:odd:bg-dark-background\">\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 pb-4 text-sm text-center\">\n <ng-container [ngTemplateOutlet]=\"expandedTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: row }\"></ng-container>\n </td>\n </tr>\n }\n\n @if (lastRow && (lastEvaluatedKey | async) && !(isLoading | async) && useLoadMore) {\n <tr #loadMoreRow\n class=\"border-t border-light-inactive dark:border-dark-inactive bg-light-background dark:bg-dark-background\"\n haloduckAutoLoad\n [autoLoadEnabled]=\"(autoLoad$ | async) ?? true\"\n [autoLoadThreshold]=\"0.1\"\n (autoLoadTrigger)=\"onAutoLoadTriggered()\">\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 py-4 text-sm text-light-on-background dark:text-dark-on-background text-center h-16 bg-light-background dark:bg-dark-background rounded-bl-lg rounded-br-lg\">\n <div (click)=\"onLoadMoreClicked()\"\n class=\"cursor-pointer\">\n {{ 'haloduck.ui.table.Load More...' | transloco }}\n </div>\n </td>\n </tr>\n }\n\n } @empty {\n @if(!(isLoading | async)) {\n <tr>\n <td [attr.colspan]=\"columns.length\"\n class=\"whitespace-nowrap px-3 py-4 text-sm text-light-on-background dark:text-dark-on-background text-center h-16 bg-light-background dark:bg-dark-background rounded-bl-lg rounded-br-lg\">\n {{ 'haloduck.ui.table.No data available.' | transloco }}\n </td>\n </tr>\n }\n }\n\n @if(isLoading | async) {\n @for ( i of [0,1,2,3,4]; track i; let lastRow = $last)\n {\n <tr class=\"bg-light-background dark:bg-dark-background border-t border-light-inactive/50 dark:border-dark-inactive/50\">\n @for (column of columns; track column.key) {\n <td class=\"whitespace-nowrap py-4 pl-4 pr-3 text-sm\"\n [ngClass]=\"{'first:rounded-bl-lg last:rounded-br-lg': lastRow}\">\n <div class=\"h-4 bg-light-inactive/50 dark:bg-dark-inactive/50 rounded-md animate-pulse\"></div>\n </td>\n }\n </tr>\n }\n }\n </tbody>\n </table>\n</div>\n\n" }]
|
|
3237
|
+
}], propDecorators: { loadMoreRowRef: [{
|
|
3110
3238
|
type: ViewChild,
|
|
3111
3239
|
args: ['loadMoreRow', { read: ElementRef }]
|
|
3112
3240
|
}], tableLayout: [{
|
|
3113
3241
|
type: Input
|
|
3114
|
-
}],
|
|
3115
|
-
type: Input
|
|
3116
|
-
}], showHeader: [{
|
|
3242
|
+
}], tableName: [{
|
|
3117
3243
|
type: Input
|
|
3118
3244
|
}], useLoadMore: [{
|
|
3119
3245
|
type: Input
|
|
@@ -3217,6 +3343,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
3217
3343
|
args: ['label']
|
|
3218
3344
|
}] } });
|
|
3219
3345
|
|
|
3346
|
+
class TableSettingComponent {
|
|
3347
|
+
tableSettingService = inject(TableSettingService);
|
|
3348
|
+
context;
|
|
3349
|
+
get currentSettings$() {
|
|
3350
|
+
const tableName = this.context?.tableName;
|
|
3351
|
+
return tableName
|
|
3352
|
+
? this.tableSettingService.getSettings(tableName)
|
|
3353
|
+
: this.tableSettingService.getSettings('');
|
|
3354
|
+
}
|
|
3355
|
+
ngOnInit() {
|
|
3356
|
+
console.log('Table settings initialized', this.context);
|
|
3357
|
+
}
|
|
3358
|
+
close() {
|
|
3359
|
+
if (this.context?.overlayRef) {
|
|
3360
|
+
this.tableSettingService.hide();
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
onSettingChange(settings) {
|
|
3364
|
+
const tableName = this.context?.tableName;
|
|
3365
|
+
if (tableName) {
|
|
3366
|
+
this.tableSettingService.updateSettings(tableName, settings);
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableSettingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3370
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: TableSettingComponent, isStandalone: true, selector: "haloduck-table-setting", inputs: { context: "context" }, providers: [provideTranslocoScope('haloduck')], ngImport: i0, template: `
|
|
3371
|
+
<div class="p-6">
|
|
3372
|
+
<div class="flex justify-between items-center mb-4">
|
|
3373
|
+
<h2
|
|
3374
|
+
class="text-lg font-semibold text-light-on-background dark:text-dark-on-background"
|
|
3375
|
+
>
|
|
3376
|
+
{{ 'haloduck.ui.table.settings' | transloco }}
|
|
3377
|
+
</h2>
|
|
3378
|
+
</div>
|
|
3379
|
+
|
|
3380
|
+
@if (currentSettings$ | async; as settings) {
|
|
3381
|
+
<div class="space-y-4">
|
|
3382
|
+
<haloduck-toggle
|
|
3383
|
+
[(ngModel)]="settings.showHeader"
|
|
3384
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3385
|
+
>
|
|
3386
|
+
{{ 'haloduck.ui.table.Show headers' | transloco }}
|
|
3387
|
+
</haloduck-toggle>
|
|
3388
|
+
|
|
3389
|
+
<haloduck-toggle
|
|
3390
|
+
[(ngModel)]="settings.autoLoad"
|
|
3391
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3392
|
+
>
|
|
3393
|
+
{{ 'haloduck.ui.table.Auto load' | transloco }}
|
|
3394
|
+
</haloduck-toggle>
|
|
3395
|
+
</div>
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
<div class="flex justify-end mt-6">
|
|
3399
|
+
<haloduck-button variant="none" size="sm" (click)="close()">
|
|
3400
|
+
{{ 'haloduck.ui.button.Close' | transloco }}
|
|
3401
|
+
</haloduck-button>
|
|
3402
|
+
</div>
|
|
3403
|
+
</div>
|
|
3404
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslocoModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ButtonComponent, selector: "haloduck-button", inputs: ["disabled", "variant"] }, { kind: "component", type: ToggleComponent, selector: "haloduck-toggle", inputs: ["layout", "value", "disabled", "nullable"], outputs: ["toggled"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2$1.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3405
|
+
}
|
|
3406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableSettingComponent, decorators: [{
|
|
3407
|
+
type: Component,
|
|
3408
|
+
args: [{
|
|
3409
|
+
selector: 'haloduck-table-setting',
|
|
3410
|
+
imports: [
|
|
3411
|
+
CommonModule,
|
|
3412
|
+
TranslocoModule,
|
|
3413
|
+
FormsModule,
|
|
3414
|
+
ButtonComponent,
|
|
3415
|
+
ToggleComponent,
|
|
3416
|
+
],
|
|
3417
|
+
template: `
|
|
3418
|
+
<div class="p-6">
|
|
3419
|
+
<div class="flex justify-between items-center mb-4">
|
|
3420
|
+
<h2
|
|
3421
|
+
class="text-lg font-semibold text-light-on-background dark:text-dark-on-background"
|
|
3422
|
+
>
|
|
3423
|
+
{{ 'haloduck.ui.table.settings' | transloco }}
|
|
3424
|
+
</h2>
|
|
3425
|
+
</div>
|
|
3426
|
+
|
|
3427
|
+
@if (currentSettings$ | async; as settings) {
|
|
3428
|
+
<div class="space-y-4">
|
|
3429
|
+
<haloduck-toggle
|
|
3430
|
+
[(ngModel)]="settings.showHeader"
|
|
3431
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3432
|
+
>
|
|
3433
|
+
{{ 'haloduck.ui.table.Show headers' | transloco }}
|
|
3434
|
+
</haloduck-toggle>
|
|
3435
|
+
|
|
3436
|
+
<haloduck-toggle
|
|
3437
|
+
[(ngModel)]="settings.autoLoad"
|
|
3438
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3439
|
+
>
|
|
3440
|
+
{{ 'haloduck.ui.table.Auto load' | transloco }}
|
|
3441
|
+
</haloduck-toggle>
|
|
3442
|
+
</div>
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
<div class="flex justify-end mt-6">
|
|
3446
|
+
<haloduck-button variant="none" size="sm" (click)="close()">
|
|
3447
|
+
{{ 'haloduck.ui.button.Close' | transloco }}
|
|
3448
|
+
</haloduck-button>
|
|
3449
|
+
</div>
|
|
3450
|
+
</div>
|
|
3451
|
+
`,
|
|
3452
|
+
providers: [provideTranslocoScope('haloduck')],
|
|
3453
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3454
|
+
}]
|
|
3455
|
+
}], propDecorators: { context: [{
|
|
3456
|
+
type: Input
|
|
3457
|
+
}] } });
|
|
3458
|
+
|
|
3459
|
+
var tableSetting_component = /*#__PURE__*/Object.freeze({
|
|
3460
|
+
__proto__: null,
|
|
3461
|
+
TableSettingComponent: TableSettingComponent
|
|
3462
|
+
});
|
|
3463
|
+
|
|
3220
3464
|
class TabsComponent {
|
|
3221
3465
|
tabs = [];
|
|
3222
3466
|
selectedIndex = 0;
|
|
@@ -3264,11 +3508,11 @@ class TabsComponent {
|
|
|
3264
3508
|
this.selectedIndex = this.tabs.length - 1;
|
|
3265
3509
|
}
|
|
3266
3510
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3267
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: TabsComponent, isStandalone: true, selector: "haloduck-tabs", inputs: { tabs: "tabs", selectedIndex: "selectedIndex", layout: "layout", labelWidth: "labelWidth" }, outputs: { selectedIndexChange: "selectedIndexChange" }, viewQueries: [{ propertyName: "label", first: true, predicate: ["label"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"flex gap-2 items-start w-full\"
|
|
3511
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.4", type: TabsComponent, isStandalone: true, selector: "haloduck-tabs", inputs: { tabs: "tabs", selectedIndex: "selectedIndex", layout: "layout", labelWidth: "labelWidth" }, outputs: { selectedIndexChange: "selectedIndexChange" }, viewQueries: [{ propertyName: "label", first: true, predicate: ["label"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"flex gap-2 items-start w-full\"\n [ngClass]=\"{'flex-col': layout === 'vertical'}\">\n <label #label\n class=\"block text-sm/6 font-medium text-light-on-control dark:text-dark-on-control {{ labelWidth }}\"\n [ngClass]=\"{'w-full': layout === 'vertical'}\">\n <ng-content select=\"[slot=label]\"></ng-content>\n </label>\n\n <div class=\"flex-1 w-full\">\n <div class=\"flex items-center gap-1 border-b border-light-inactive dark:border-dark-inactive text-sm/6\">\n @for (tab of tabs; track tab.label; let i = $index) {\n <button type=\"button\"\n class=\"px-3 py-2 rounded-t-md\"\n [ngClass]=\"{\n 'text-light-on-control dark:text-dark-on-control': i !== selectedIndex,\n 'text-light-primary dark:text-dark-primary border-b-2 border-light-primary dark:border-dark-primary': i === selectedIndex\n }\"\n (click)=\"select(i)\">\n {{ tab.label }}\n </button>\n }\n </div>\n\n <div class=\"mt-3\">\n @if (current) {\n <ng-container *ngComponentOutlet=\"current!.component; inputs: current!.inputs || {}\"></ng-container>\n }\n </div>\n </div>\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }] });
|
|
3268
3512
|
}
|
|
3269
3513
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TabsComponent, decorators: [{
|
|
3270
3514
|
type: Component,
|
|
3271
|
-
args: [{ selector: 'haloduck-tabs', imports: [CommonModule], template: "<div class=\"flex gap-2 items-start w-full\"
|
|
3515
|
+
args: [{ selector: 'haloduck-tabs', imports: [CommonModule], template: "<div class=\"flex gap-2 items-start w-full\"\n [ngClass]=\"{'flex-col': layout === 'vertical'}\">\n <label #label\n class=\"block text-sm/6 font-medium text-light-on-control dark:text-dark-on-control {{ labelWidth }}\"\n [ngClass]=\"{'w-full': layout === 'vertical'}\">\n <ng-content select=\"[slot=label]\"></ng-content>\n </label>\n\n <div class=\"flex-1 w-full\">\n <div class=\"flex items-center gap-1 border-b border-light-inactive dark:border-dark-inactive text-sm/6\">\n @for (tab of tabs; track tab.label; let i = $index) {\n <button type=\"button\"\n class=\"px-3 py-2 rounded-t-md\"\n [ngClass]=\"{\n 'text-light-on-control dark:text-dark-on-control': i !== selectedIndex,\n 'text-light-primary dark:text-dark-primary border-b-2 border-light-primary dark:border-dark-primary': i === selectedIndex\n }\"\n (click)=\"select(i)\">\n {{ tab.label }}\n </button>\n }\n </div>\n\n <div class=\"mt-3\">\n @if (current) {\n <ng-container *ngComponentOutlet=\"current!.component; inputs: current!.inputs || {}\"></ng-container>\n }\n </div>\n </div>\n</div>" }]
|
|
3272
3516
|
}], propDecorators: { tabs: [{
|
|
3273
3517
|
type: Input
|
|
3274
3518
|
}], selectedIndex: [{
|
|
@@ -3418,7 +3662,7 @@ class TagInputComponent {
|
|
|
3418
3662
|
multi: true,
|
|
3419
3663
|
},
|
|
3420
3664
|
provideTranslocoScope('haloduck'),
|
|
3421
|
-
], viewQueries: [{ propertyName: "label", first: true, predicate: ["label"], descendants: true }, { propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true }], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n <label #label
|
|
3665
|
+
], viewQueries: [{ propertyName: "label", first: true, predicate: ["label"], descendants: true }, { propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true }], ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n <label #label\n class=\"block text-sm/6 font-medium text-light-on-control dark:text-dark-on-control text-left\">\n <ng-content></ng-content>\n </label>\n\n <div\n class=\"tag-input-wrapper block w-full rounded-md bg-light-control dark:bg-dark-control disabled:bg-light-control/60 dark:disabled:bg-dark-control/80 px-2 py-1.5 text-base text-light-on-control dark:text-dark-on-control disabled:cursor-not-allowed disabled:text-light-on-control/60 dark:disabled:text-dark-on-control/80 outline -outline-offset-1 outline-light-inactive dark:outline-dark-inactive placeholder:text-light-inactive dark:placeholder:text-dark-inactive sm:text-sm/6\">\n <div class=\"flex flex-wrap items-center gap-2\">\n @for ( tag of tags; track tag; let i = $index) {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-light-secondary dark:bg-dark-secondary text-light-on-secondary dark:text-dark-on-secondary px-2 py-0.5 text-xs\">\n {{ tag }}\n @if (!disabled) {\n <button type=\"button\"\n (click)=\"removeTag(i)\"\n class=\"text-light-on-secondary/80 hover:text-light-on-secondary dark:text-dark-on-secondary/80 dark:hover:text-dark-on-secondary hover:cursor-pointer\">\n \u00D7\n </button>\n }\n </span>\n }\n\n <input #inputEl\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n class=\"flex-1 min-w-[8rem] bg-transparent outline-none placeholder:text-light-inactive dark:placeholder:text-dark-inactive\"\n [value]=\"inputValue\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\" />\n </div>\n </div>\n</div>", styles: [":host{display:block}.tag-input-wrapper:focus-within{outline-width:2px;outline-offset:2px;outline-color:var(--color-light-primary)!important}@media (prefers-color-scheme: dark){.tag-input-wrapper:focus-within{outline-color:var(--color-dark-primary)!important}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
3422
3666
|
}
|
|
3423
3667
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TagInputComponent, decorators: [{
|
|
3424
3668
|
type: Component,
|
|
@@ -3429,7 +3673,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
3429
3673
|
multi: true,
|
|
3430
3674
|
},
|
|
3431
3675
|
provideTranslocoScope('haloduck'),
|
|
3432
|
-
], template: "<div class=\"flex flex-col gap-2\">\n <label #label
|
|
3676
|
+
], template: "<div class=\"flex flex-col gap-2\">\n <label #label\n class=\"block text-sm/6 font-medium text-light-on-control dark:text-dark-on-control text-left\">\n <ng-content></ng-content>\n </label>\n\n <div\n class=\"tag-input-wrapper block w-full rounded-md bg-light-control dark:bg-dark-control disabled:bg-light-control/60 dark:disabled:bg-dark-control/80 px-2 py-1.5 text-base text-light-on-control dark:text-dark-on-control disabled:cursor-not-allowed disabled:text-light-on-control/60 dark:disabled:text-dark-on-control/80 outline -outline-offset-1 outline-light-inactive dark:outline-dark-inactive placeholder:text-light-inactive dark:placeholder:text-dark-inactive sm:text-sm/6\">\n <div class=\"flex flex-wrap items-center gap-2\">\n @for ( tag of tags; track tag; let i = $index) {\n <span\n class=\"inline-flex items-center gap-1 rounded-md bg-light-secondary dark:bg-dark-secondary text-light-on-secondary dark:text-dark-on-secondary px-2 py-0.5 text-xs\">\n {{ tag }}\n @if (!disabled) {\n <button type=\"button\"\n (click)=\"removeTag(i)\"\n class=\"text-light-on-secondary/80 hover:text-light-on-secondary dark:text-dark-on-secondary/80 dark:hover:text-dark-on-secondary hover:cursor-pointer\">\n \u00D7\n </button>\n }\n </span>\n }\n\n <input #inputEl\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n class=\"flex-1 min-w-[8rem] bg-transparent outline-none placeholder:text-light-inactive dark:placeholder:text-dark-inactive\"\n [value]=\"inputValue\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\" />\n </div>\n </div>\n</div>", styles: [":host{display:block}.tag-input-wrapper:focus-within{outline-width:2px;outline-offset:2px;outline-color:var(--color-light-primary)!important}@media (prefers-color-scheme: dark){.tag-input-wrapper:focus-within{outline-color:var(--color-dark-primary)!important}}\n"] }]
|
|
3433
3677
|
}], propDecorators: { label: [{
|
|
3434
3678
|
type: ViewChild,
|
|
3435
3679
|
args: ['label']
|
|
@@ -3742,5 +3986,5 @@ const provideHaloduckTransloco = () => provideTranslocoScope({
|
|
|
3742
3986
|
* Generated bundle index. Do not edit.
|
|
3743
3987
|
*/
|
|
3744
3988
|
|
|
3745
|
-
export { AuthenticateComponent, AutoLoadDirective, BreadcrumbComponent, ButtonComponent, CalendarComponent, ConfirmDialogService, CopyButtonComponent, DatePickerComponent, DateRangeComponent, DialogService, DrawCanvasComponent, ERROR_NOT_ACCEPTABLE_FILE_TYPE, ERROR_OVER_COUNT, ERROR_OVER_SIZE, ERROR_UPLOAD, FileUploaderComponent, FlipComponent, GroupedDirective, ImageUploaderComponent, ImageViewerComponent, InputComponent, LanguageSelectorComponent, MapToAddressComponent, NotificationComponent, NotificationService, PictureNameComponent, SelectComponent, SelectDropdownComponent, SideMenuComponent, SideMenuItemComponent, StlViewerComponent, TableComponent, TabsComponent, TagInputComponent, TagViewerComponent, ToggleComponent, dateToString, provideHaloduckTransloco };
|
|
3989
|
+
export { AuthenticateComponent, AutoLoadDirective, BreadcrumbComponent, ButtonComponent, CalendarComponent, ConfirmDialogService, CopyButtonComponent, DatePickerComponent, DateRangeComponent, DialogService, DrawCanvasComponent, ERROR_NOT_ACCEPTABLE_FILE_TYPE, ERROR_OVER_COUNT, ERROR_OVER_SIZE, ERROR_UPLOAD, FileUploaderComponent, FlipComponent, GroupedDirective, ImageUploaderComponent, ImageViewerComponent, InputComponent, LanguageSelectorComponent, MapToAddressComponent, NotificationComponent, NotificationService, PictureNameComponent, SelectComponent, SelectDropdownComponent, SideMenuComponent, SideMenuItemComponent, StlViewerComponent, TableComponent, TableSettingComponent, TableSettingService, TabsComponent, TagInputComponent, TagViewerComponent, ToggleComponent, dateToString, provideHaloduckTransloco };
|
|
3746
3990
|
//# sourceMappingURL=haloduck-ui.mjs.map
|