@haloduck/ui 2.0.9 → 2.0.10
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 +68 -1
- package/fesm2022/haloduck-ui.mjs.map +1 -1
- package/index.d.ts +25 -3
- package/package.json +1 -1
package/fesm2022/haloduck-ui.mjs
CHANGED
|
@@ -2784,6 +2784,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
|
|
|
2784
2784
|
args: ['label']
|
|
2785
2785
|
}] } });
|
|
2786
2786
|
|
|
2787
|
+
class TabsComponent {
|
|
2788
|
+
tabs = [];
|
|
2789
|
+
selectedIndex = 0;
|
|
2790
|
+
layout = 'vertical';
|
|
2791
|
+
labelWidth = '';
|
|
2792
|
+
selectedIndexChange = new EventEmitter();
|
|
2793
|
+
label;
|
|
2794
|
+
ngOnChanges(changes) {
|
|
2795
|
+
if (changes['tabs']) {
|
|
2796
|
+
this.ensureSelectedInRange();
|
|
2797
|
+
}
|
|
2798
|
+
if (changes['selectedIndex']) {
|
|
2799
|
+
this.ensureSelectedInRange();
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
ngAfterViewInit() {
|
|
2803
|
+
// hide label if no content.
|
|
2804
|
+
if (this.label && this.label.nativeElement) {
|
|
2805
|
+
const hasContent = this.label.nativeElement.textContent?.trim();
|
|
2806
|
+
if (!hasContent) {
|
|
2807
|
+
this.label.nativeElement.style.display = 'none';
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
get current() {
|
|
2812
|
+
if (!this.tabs || this.tabs.length === 0)
|
|
2813
|
+
return null;
|
|
2814
|
+
const idx = Math.min(Math.max(this.selectedIndex, 0), this.tabs.length - 1);
|
|
2815
|
+
return this.tabs[idx];
|
|
2816
|
+
}
|
|
2817
|
+
select(index) {
|
|
2818
|
+
if (index < 0 || index >= this.tabs.length)
|
|
2819
|
+
return;
|
|
2820
|
+
this.selectedIndex = index;
|
|
2821
|
+
this.selectedIndexChange.emit(this.selectedIndex);
|
|
2822
|
+
}
|
|
2823
|
+
ensureSelectedInRange() {
|
|
2824
|
+
if (!this.tabs || this.tabs.length === 0) {
|
|
2825
|
+
this.selectedIndex = 0;
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
if (this.selectedIndex < 0)
|
|
2829
|
+
this.selectedIndex = 0;
|
|
2830
|
+
if (this.selectedIndex > this.tabs.length - 1)
|
|
2831
|
+
this.selectedIndex = this.tabs.length - 1;
|
|
2832
|
+
}
|
|
2833
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2834
|
+
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\" [ngClass]=\"{'flex-col': layout === 'vertical'}\">\n <label #label class=\"block text-sm/6 font-medium text-light-on-control dark:text-dark-on-control {{ labelWidth }}\" [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; 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>\n", 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"] }] });
|
|
2835
|
+
}
|
|
2836
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: TabsComponent, decorators: [{
|
|
2837
|
+
type: Component,
|
|
2838
|
+
args: [{ selector: 'haloduck-tabs', imports: [CommonModule], template: "<div class=\"flex gap-2 items-start w-full\" [ngClass]=\"{'flex-col': layout === 'vertical'}\">\n <label #label class=\"block text-sm/6 font-medium text-light-on-control dark:text-dark-on-control {{ labelWidth }}\" [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; 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>\n" }]
|
|
2839
|
+
}], propDecorators: { tabs: [{
|
|
2840
|
+
type: Input
|
|
2841
|
+
}], selectedIndex: [{
|
|
2842
|
+
type: Input
|
|
2843
|
+
}], layout: [{
|
|
2844
|
+
type: Input
|
|
2845
|
+
}], labelWidth: [{
|
|
2846
|
+
type: Input
|
|
2847
|
+
}], selectedIndexChange: [{
|
|
2848
|
+
type: Output
|
|
2849
|
+
}], label: [{
|
|
2850
|
+
type: ViewChild,
|
|
2851
|
+
args: ['label']
|
|
2852
|
+
}] } });
|
|
2853
|
+
|
|
2787
2854
|
class BreadcrumbService {
|
|
2788
2855
|
router;
|
|
2789
2856
|
coreService = inject(CoreService);
|
|
@@ -2896,5 +2963,5 @@ const provideHaloduckTransloco = () => provideTranslocoScope({
|
|
|
2896
2963
|
* Generated bundle index. Do not edit.
|
|
2897
2964
|
*/
|
|
2898
2965
|
|
|
2899
|
-
export { AuthenticateComponent, BreadcrumbComponent, ButtonComponent, CalendarComponent, ConfirmDialogService, CopyButtonComponent, DatePickerComponent, DateRangeComponent, DialogService, DrawCanvasComponent, ERROR_NOT_ACCEPTABLE_FILE_TYPE, ERROR_OVER_COUNT, ERROR_OVER_SIZE, ERROR_UPLOAD, FileUploaderComponent, FlipComponent, ImageUploaderComponent, ImageViewerComponent, InputComponent, LanguageSelectorComponent, MapToAddressComponent, NotificationComponent, NotificationService, PictureNameComponent, SelectComponent, SelectDropdownComponent, SideMenuComponent, SideMenuItemComponent, StlViewerComponent, TableComponent, ToggleComponent, dateToString, provideHaloduckTransloco };
|
|
2966
|
+
export { AuthenticateComponent, BreadcrumbComponent, ButtonComponent, CalendarComponent, ConfirmDialogService, CopyButtonComponent, DatePickerComponent, DateRangeComponent, DialogService, DrawCanvasComponent, ERROR_NOT_ACCEPTABLE_FILE_TYPE, ERROR_OVER_COUNT, ERROR_OVER_SIZE, ERROR_UPLOAD, FileUploaderComponent, FlipComponent, ImageUploaderComponent, ImageViewerComponent, InputComponent, LanguageSelectorComponent, MapToAddressComponent, NotificationComponent, NotificationService, PictureNameComponent, SelectComponent, SelectDropdownComponent, SideMenuComponent, SideMenuItemComponent, StlViewerComponent, TableComponent, TabsComponent, ToggleComponent, dateToString, provideHaloduckTransloco };
|
|
2900
2967
|
//# sourceMappingURL=haloduck-ui.mjs.map
|