mn-angular-lib 0.0.87 → 0.0.88
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.
|
@@ -3316,21 +3316,30 @@ var ColumnSortType;
|
|
|
3316
3316
|
* Attribute directive that applies responsive-hiding classes to table cells/headers.
|
|
3317
3317
|
* Hides the element by default and shows it as `table-cell` at the specified breakpoint.
|
|
3318
3318
|
*
|
|
3319
|
+
* Uses a static class map so Tailwind CSS can detect the full class names at build time.
|
|
3320
|
+
*
|
|
3319
3321
|
* Usage: `<td [mnHiddenBelow]="column.hiddenBelow">`
|
|
3320
3322
|
*/
|
|
3321
3323
|
class MnHiddenBelowDirective {
|
|
3324
|
+
/** The breakpoint below which the element is hidden. */
|
|
3322
3325
|
mnHiddenBelow;
|
|
3323
3326
|
el = inject(ElementRef);
|
|
3324
3327
|
renderer = inject(Renderer2);
|
|
3325
3328
|
appliedClasses = [];
|
|
3329
|
+
/** Static mapping of breakpoints to their full Tailwind class names. */
|
|
3330
|
+
classMap = {
|
|
3331
|
+
sm: ['hidden', 'sm:table-cell'],
|
|
3332
|
+
md: ['hidden', 'md:table-cell'],
|
|
3333
|
+
lg: ['hidden', 'lg:table-cell'],
|
|
3334
|
+
};
|
|
3326
3335
|
ngOnChanges() {
|
|
3327
3336
|
// Remove previously applied classes
|
|
3328
3337
|
for (const cls of this.appliedClasses) {
|
|
3329
3338
|
this.renderer.removeClass(this.el.nativeElement, cls);
|
|
3330
3339
|
}
|
|
3331
3340
|
this.appliedClasses = [];
|
|
3332
|
-
if (this.mnHiddenBelow) {
|
|
3333
|
-
const classes = [
|
|
3341
|
+
if (this.mnHiddenBelow && this.classMap[this.mnHiddenBelow]) {
|
|
3342
|
+
const classes = this.classMap[this.mnHiddenBelow];
|
|
3334
3343
|
for (const cls of classes) {
|
|
3335
3344
|
this.renderer.addClass(this.el.nativeElement, cls);
|
|
3336
3345
|
}
|