angular-tailwind-components 1.8.0 → 1.8.1
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.
|
@@ -668,6 +668,7 @@ class TailwindSortHeaderDirective {
|
|
|
668
668
|
sortKey = input.required(...(ngDevMode ? [{ debugName: "sortKey" }] : /* istanbul ignore next */ []));
|
|
669
669
|
host = inject((ElementRef));
|
|
670
670
|
renderer = inject(Renderer2);
|
|
671
|
+
labelWrapper;
|
|
671
672
|
appRef = inject(ApplicationRef);
|
|
672
673
|
environmentInjector = inject(EnvironmentInjector);
|
|
673
674
|
injector = inject(Injector);
|
|
@@ -718,11 +719,12 @@ class TailwindSortHeaderDirective {
|
|
|
718
719
|
this.iconRef.changeDetectorRef.detectChanges();
|
|
719
720
|
};
|
|
720
721
|
if (!this.iconRef) {
|
|
722
|
+
const labelHost = this.ensureLabelWrapper();
|
|
721
723
|
this.iconRef = createComponent(TailwindIcon, {
|
|
722
724
|
environmentInjector: this.environmentInjector,
|
|
723
725
|
elementInjector: this.injector
|
|
724
726
|
});
|
|
725
|
-
this.renderer.appendChild(
|
|
727
|
+
this.renderer.appendChild(labelHost, this.iconRef.location.nativeElement);
|
|
726
728
|
this.appRef.attachView(this.iconRef.hostView);
|
|
727
729
|
}
|
|
728
730
|
sync();
|
|
@@ -732,8 +734,31 @@ class TailwindSortHeaderDirective {
|
|
|
732
734
|
attributeFilter: [TW_TABLE_SORT_KEY_ATTR, TW_TABLE_SORT_DIR_ATTR]
|
|
733
735
|
});
|
|
734
736
|
}
|
|
737
|
+
/** Keep `th` as `display: table-cell`; flex only on an inner wrapper (label + icon). */
|
|
738
|
+
ensureLabelWrapper() {
|
|
739
|
+
if (this.labelWrapper)
|
|
740
|
+
return this.labelWrapper;
|
|
741
|
+
const th = this.host.nativeElement;
|
|
742
|
+
const existing = th.querySelector('[data-tw-sort-header-label]');
|
|
743
|
+
if (existing instanceof HTMLElement) {
|
|
744
|
+
this.labelWrapper = existing;
|
|
745
|
+
return existing;
|
|
746
|
+
}
|
|
747
|
+
const wrapper = this.renderer.createElement('span');
|
|
748
|
+
this.renderer.setAttribute(wrapper, 'data-tw-sort-header-label', '');
|
|
749
|
+
this.renderer.addClass(wrapper, 'inline-flex');
|
|
750
|
+
this.renderer.addClass(wrapper, 'items-center');
|
|
751
|
+
this.renderer.addClass(wrapper, 'gap-1.5');
|
|
752
|
+
this.renderer.addClass(wrapper, 'justify-start');
|
|
753
|
+
for (const child of Array.from(th.childNodes)) {
|
|
754
|
+
this.renderer.appendChild(wrapper, child);
|
|
755
|
+
}
|
|
756
|
+
this.renderer.appendChild(th, wrapper);
|
|
757
|
+
this.labelWrapper = wrapper;
|
|
758
|
+
return wrapper;
|
|
759
|
+
}
|
|
735
760
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TailwindSortHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
736
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.12", type: TailwindSortHeaderDirective, isStandalone: true, selector: "[tailwindSortHeader]", inputs: { sortKey: { classPropertyName: "sortKey", publicName: "sortKey", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.tabindex": "0", "attr.data-sort-key": "sortKey()" }, classAttribute: "
|
|
761
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.12", type: TailwindSortHeaderDirective, isStandalone: true, selector: "[tailwindSortHeader]", inputs: { sortKey: { classPropertyName: "sortKey", publicName: "sortKey", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.tabindex": "0", "attr.data-sort-key": "sortKey()" }, classAttribute: "cursor-pointer whitespace-nowrap text-left select-none hover:text-neutral-900" }, ngImport: i0 });
|
|
737
762
|
}
|
|
738
763
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: TailwindSortHeaderDirective, decorators: [{
|
|
739
764
|
type: Directive,
|
|
@@ -741,7 +766,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
|
|
|
741
766
|
selector: '[tailwindSortHeader]',
|
|
742
767
|
standalone: true,
|
|
743
768
|
host: {
|
|
744
|
-
class: '
|
|
769
|
+
class: 'cursor-pointer whitespace-nowrap text-left select-none hover:text-neutral-900',
|
|
745
770
|
'[attr.tabindex]': '0',
|
|
746
771
|
'[attr.data-sort-key]': 'sortKey()'
|
|
747
772
|
}
|