@haloduck/ui 2.0.36 → 2.0.38
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 +243 -24
- 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
|
+
}, ['w-full', 'max-w-xs']);
|
|
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) {
|
|
@@ -3106,11 +3201,13 @@ class TableComponent {
|
|
|
3106
3201
|
});
|
|
3107
3202
|
}
|
|
3108
3203
|
onAutoLoadTriggered() {
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
this.
|
|
3112
|
-
|
|
3113
|
-
|
|
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
|
+
});
|
|
3114
3211
|
}
|
|
3115
3212
|
onRowClicked(row) {
|
|
3116
3213
|
this.onRowClick.emit(row);
|
|
@@ -3118,23 +3215,31 @@ class TableComponent {
|
|
|
3118
3215
|
onRowDblClicked(row) {
|
|
3119
3216
|
this.onRowDblClick.emit(row);
|
|
3120
3217
|
}
|
|
3121
|
-
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
|
+
}
|
|
3122
3230
|
ngAfterViewInit() { }
|
|
3123
|
-
constructor() { }
|
|
3124
3231
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3125
|
-
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 });
|
|
3126
3233
|
}
|
|
3127
3234
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableComponent, decorators: [{
|
|
3128
3235
|
type: Component,
|
|
3129
|
-
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" }]
|
|
3130
|
-
}],
|
|
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: [{
|
|
3131
3238
|
type: ViewChild,
|
|
3132
3239
|
args: ['loadMoreRow', { read: ElementRef }]
|
|
3133
3240
|
}], tableLayout: [{
|
|
3134
3241
|
type: Input
|
|
3135
|
-
}],
|
|
3136
|
-
type: Input
|
|
3137
|
-
}], showHeader: [{
|
|
3242
|
+
}], tableName: [{
|
|
3138
3243
|
type: Input
|
|
3139
3244
|
}], useLoadMore: [{
|
|
3140
3245
|
type: Input
|
|
@@ -3238,6 +3343,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
3238
3343
|
args: ['label']
|
|
3239
3344
|
}] } });
|
|
3240
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="flex justify-between items-center mb-4">
|
|
3372
|
+
<h2
|
|
3373
|
+
class="text-md font-semibold text-light-on-background dark:text-dark-on-background"
|
|
3374
|
+
>
|
|
3375
|
+
{{ 'haloduck.ui.table.settings' | transloco }}
|
|
3376
|
+
</h2>
|
|
3377
|
+
</div>
|
|
3378
|
+
|
|
3379
|
+
@if (currentSettings$ | async; as settings) {
|
|
3380
|
+
<div class="flex flex-col gap-4 p-4">
|
|
3381
|
+
<haloduck-toggle
|
|
3382
|
+
[(ngModel)]="settings.showHeader"
|
|
3383
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3384
|
+
>
|
|
3385
|
+
{{ 'haloduck.ui.table.Show headers' | transloco }}
|
|
3386
|
+
</haloduck-toggle>
|
|
3387
|
+
|
|
3388
|
+
<haloduck-toggle
|
|
3389
|
+
[(ngModel)]="settings.autoLoad"
|
|
3390
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3391
|
+
>
|
|
3392
|
+
{{ 'haloduck.ui.table.Auto load' | transloco }}
|
|
3393
|
+
</haloduck-toggle>
|
|
3394
|
+
</div>
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
<div class="flex justify-end mt-6">
|
|
3398
|
+
<haloduck-button variant="none" size="sm" (click)="close()">
|
|
3399
|
+
{{ 'haloduck.ui.button.Close' | transloco }}
|
|
3400
|
+
</haloduck-button>
|
|
3401
|
+
</div>
|
|
3402
|
+
`, 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 });
|
|
3403
|
+
}
|
|
3404
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TableSettingComponent, decorators: [{
|
|
3405
|
+
type: Component,
|
|
3406
|
+
args: [{
|
|
3407
|
+
selector: 'haloduck-table-setting',
|
|
3408
|
+
imports: [
|
|
3409
|
+
CommonModule,
|
|
3410
|
+
TranslocoModule,
|
|
3411
|
+
FormsModule,
|
|
3412
|
+
ButtonComponent,
|
|
3413
|
+
ToggleComponent,
|
|
3414
|
+
],
|
|
3415
|
+
template: `
|
|
3416
|
+
<div class="flex justify-between items-center mb-4">
|
|
3417
|
+
<h2
|
|
3418
|
+
class="text-md font-semibold text-light-on-background dark:text-dark-on-background"
|
|
3419
|
+
>
|
|
3420
|
+
{{ 'haloduck.ui.table.settings' | transloco }}
|
|
3421
|
+
</h2>
|
|
3422
|
+
</div>
|
|
3423
|
+
|
|
3424
|
+
@if (currentSettings$ | async; as settings) {
|
|
3425
|
+
<div class="flex flex-col gap-4 p-4">
|
|
3426
|
+
<haloduck-toggle
|
|
3427
|
+
[(ngModel)]="settings.showHeader"
|
|
3428
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3429
|
+
>
|
|
3430
|
+
{{ 'haloduck.ui.table.Show headers' | transloco }}
|
|
3431
|
+
</haloduck-toggle>
|
|
3432
|
+
|
|
3433
|
+
<haloduck-toggle
|
|
3434
|
+
[(ngModel)]="settings.autoLoad"
|
|
3435
|
+
(ngModelChange)="onSettingChange(settings)"
|
|
3436
|
+
>
|
|
3437
|
+
{{ 'haloduck.ui.table.Auto load' | transloco }}
|
|
3438
|
+
</haloduck-toggle>
|
|
3439
|
+
</div>
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
<div class="flex justify-end mt-6">
|
|
3443
|
+
<haloduck-button variant="none" size="sm" (click)="close()">
|
|
3444
|
+
{{ 'haloduck.ui.button.Close' | transloco }}
|
|
3445
|
+
</haloduck-button>
|
|
3446
|
+
</div>
|
|
3447
|
+
`,
|
|
3448
|
+
providers: [provideTranslocoScope('haloduck')],
|
|
3449
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3450
|
+
}]
|
|
3451
|
+
}], propDecorators: { context: [{
|
|
3452
|
+
type: Input
|
|
3453
|
+
}] } });
|
|
3454
|
+
|
|
3455
|
+
var tableSetting_component = /*#__PURE__*/Object.freeze({
|
|
3456
|
+
__proto__: null,
|
|
3457
|
+
TableSettingComponent: TableSettingComponent
|
|
3458
|
+
});
|
|
3459
|
+
|
|
3241
3460
|
class TabsComponent {
|
|
3242
3461
|
tabs = [];
|
|
3243
3462
|
selectedIndex = 0;
|
|
@@ -3285,11 +3504,11 @@ class TabsComponent {
|
|
|
3285
3504
|
this.selectedIndex = this.tabs.length - 1;
|
|
3286
3505
|
}
|
|
3287
3506
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3288
|
-
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\"
|
|
3507
|
+
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"] }] });
|
|
3289
3508
|
}
|
|
3290
3509
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TabsComponent, decorators: [{
|
|
3291
3510
|
type: Component,
|
|
3292
|
-
args: [{ selector: 'haloduck-tabs', imports: [CommonModule], template: "<div class=\"flex gap-2 items-start w-full\"
|
|
3511
|
+
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>" }]
|
|
3293
3512
|
}], propDecorators: { tabs: [{
|
|
3294
3513
|
type: Input
|
|
3295
3514
|
}], selectedIndex: [{
|
|
@@ -3439,7 +3658,7 @@ class TagInputComponent {
|
|
|
3439
3658
|
multi: true,
|
|
3440
3659
|
},
|
|
3441
3660
|
provideTranslocoScope('haloduck'),
|
|
3442
|
-
], 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
|
|
3661
|
+
], 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 }] });
|
|
3443
3662
|
}
|
|
3444
3663
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TagInputComponent, decorators: [{
|
|
3445
3664
|
type: Component,
|
|
@@ -3450,7 +3669,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
3450
3669
|
multi: true,
|
|
3451
3670
|
},
|
|
3452
3671
|
provideTranslocoScope('haloduck'),
|
|
3453
|
-
], template: "<div class=\"flex flex-col gap-2\">\n <label #label
|
|
3672
|
+
], 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"] }]
|
|
3454
3673
|
}], propDecorators: { label: [{
|
|
3455
3674
|
type: ViewChild,
|
|
3456
3675
|
args: ['label']
|
|
@@ -3763,5 +3982,5 @@ const provideHaloduckTransloco = () => provideTranslocoScope({
|
|
|
3763
3982
|
* Generated bundle index. Do not edit.
|
|
3764
3983
|
*/
|
|
3765
3984
|
|
|
3766
|
-
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 };
|
|
3985
|
+
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 };
|
|
3767
3986
|
//# sourceMappingURL=haloduck-ui.mjs.map
|