@spartan-ng/cli 0.0.1-alpha.475 → 0.0.1-alpha.476
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/package.json +1 -1
- package/src/generators/base/lib/initialize-angular-library.js +1 -0
- package/src/generators/base/lib/initialize-angular-library.js.map +1 -1
- package/src/generators/ui/libs/ui-pagination-helm/files/index.ts.template +3 -0
- package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-numbered-pagination-query-params.component.ts.template +179 -0
- package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-numbered-pagination.component.ts.template +2 -2
- package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-item.directive.ts.template +0 -1
- package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-link.directive.ts.template +3 -0
- package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-next.component.ts.template +11 -2
- package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination-previous.component.ts.template +11 -2
- package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination.directive.ts.template +1 -0
- package/src/generators/ui/libs/ui-table-helm/files/index.ts.template +19 -17
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.directive.ts.template +217 -15
- package/src/generators/ui/supported-ui-libraries.json +41 -42
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-caption.component.ts.template +0 -54
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-table.component.ts.template +0 -45
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-td.component.ts.template +0 -44
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-th.component.ts.template +0 -48
- package/src/generators/ui/libs/ui-table-helm/files/lib/hlm-trow.component.ts.template +0 -25
package/package.json
CHANGED
|
@@ -40,6 +40,7 @@ async function initializeAngularLibrary(tree, options) {
|
|
|
40
40
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
41
41
|
// @ts-ignore
|
|
42
42
|
'@nx/angular/generators')))).libraryGenerator(tree, {
|
|
43
|
+
...((0, devkit_1.readNxJson)(tree).generators?.['@nx/angular:library'] || {}),
|
|
43
44
|
name: options.publicName,
|
|
44
45
|
skipFormat: true,
|
|
45
46
|
simpleName: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-angular-library.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/generators/base/lib/initialize-angular-library.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,
|
|
1
|
+
{"version":3,"file":"initialize-angular-library.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/generators/base/lib/initialize-angular-library.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,4DAmBC;AAtBD,uCAAsE;AAG/D,KAAK,UAAU,wBAAwB,CAAC,IAAU,EAAE,OAA+B;IACzF,OAAO,MAAM,CACZ;IACC,6DAA6D;IAC7D,aAAa;IACb,wBAAwB,GACxB,CACD,CAAC,gBAAgB,CAAC,IAAI,EAAE;QACxB,GAAG,CAAC,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QAC/D,IAAI,EAAE,OAAO,CAAC,UAAU;QACxB,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,oBAAoB,OAAO,CAAC,aAAa,EAAE;QACvD,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAA,0BAAiB,EAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC;QACnE,IAAI,EAAE,OAAO,CAAC,IAAI;KAClB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
|
|
3
|
+
import { HlmNumberedPaginationQueryParamsComponent } from './lib/hlm-numbered-pagination-query-params.component';
|
|
3
4
|
import { HlmNumberedPaginationComponent } from './lib/hlm-numbered-pagination.component';
|
|
4
5
|
import { HlmPaginationContentDirective } from './lib/hlm-pagination-content.directive';
|
|
5
6
|
import { HlmPaginationEllipsisComponent } from './lib/hlm-pagination-ellipsis.component';
|
|
@@ -9,6 +10,7 @@ import { HlmPaginationNextComponent } from './lib/hlm-pagination-next.component'
|
|
|
9
10
|
import { HlmPaginationPreviousComponent } from './lib/hlm-pagination-previous.component';
|
|
10
11
|
import { HlmPaginationDirective } from './lib/hlm-pagination.directive';
|
|
11
12
|
|
|
13
|
+
export * from './lib/hlm-numbered-pagination-query-params.component';
|
|
12
14
|
export * from './lib/hlm-numbered-pagination.component';
|
|
13
15
|
export * from './lib/hlm-pagination-content.directive';
|
|
14
16
|
export * from './lib/hlm-pagination-ellipsis.component';
|
|
@@ -27,6 +29,7 @@ export const HlmPaginationImports = [
|
|
|
27
29
|
HlmPaginationNextComponent,
|
|
28
30
|
HlmPaginationEllipsisComponent,
|
|
29
31
|
HlmNumberedPaginationComponent,
|
|
32
|
+
HlmNumberedPaginationQueryParamsComponent,
|
|
30
33
|
] as const;
|
|
31
34
|
|
|
32
35
|
@NgModule({
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
booleanAttribute,
|
|
6
|
+
computed,
|
|
7
|
+
input,
|
|
8
|
+
model,
|
|
9
|
+
numberAttribute,
|
|
10
|
+
untracked,
|
|
11
|
+
} from '@angular/core';
|
|
12
|
+
import { FormsModule } from '@angular/forms';
|
|
13
|
+
import { BrnSelectImports } from '@spartan-ng/brain/select';
|
|
14
|
+
import { HlmSelectImports } from '@spartan-ng/helm/select';
|
|
15
|
+
import { createPageArray, outOfBoundCorrection } from './hlm-numbered-pagination.component';
|
|
16
|
+
import { HlmPaginationContentDirective } from './hlm-pagination-content.directive';
|
|
17
|
+
import { HlmPaginationEllipsisComponent } from './hlm-pagination-ellipsis.component';
|
|
18
|
+
import { HlmPaginationItemDirective } from './hlm-pagination-item.directive';
|
|
19
|
+
import { HlmPaginationLinkDirective } from './hlm-pagination-link.directive';
|
|
20
|
+
import { HlmPaginationNextComponent } from './hlm-pagination-next.component';
|
|
21
|
+
import { HlmPaginationPreviousComponent } from './hlm-pagination-previous.component';
|
|
22
|
+
import { HlmPaginationDirective } from './hlm-pagination.directive';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'hlm-numbered-pagination-query-params',
|
|
26
|
+
template: `
|
|
27
|
+
<div class="flex items-center justify-between gap-2 px-4 py-2">
|
|
28
|
+
<div class="flex items-center gap-1 text-nowrap text-sm text-gray-600">
|
|
29
|
+
<b>{{ totalItems() }}</b>
|
|
30
|
+
total items |
|
|
31
|
+
<b>{{ pages().length }}</b>
|
|
32
|
+
pages
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<nav hlmPagination>
|
|
36
|
+
<ul hlmPaginationContent>
|
|
37
|
+
@if (showEdges() && !isFirstPageActive()) {
|
|
38
|
+
<li hlmPaginationItem>
|
|
39
|
+
<hlm-pagination-previous
|
|
40
|
+
[link]="link()"
|
|
41
|
+
[queryParams]="{ page: currentPage() - 1 }"
|
|
42
|
+
queryParamsHandling="merge"
|
|
43
|
+
/>
|
|
44
|
+
</li>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@for (page of pages(); track page) {
|
|
48
|
+
<li hlmPaginationItem>
|
|
49
|
+
@if (page === '...') {
|
|
50
|
+
<hlm-pagination-ellipsis />
|
|
51
|
+
} @else {
|
|
52
|
+
<a
|
|
53
|
+
hlmPaginationLink
|
|
54
|
+
[link]="currentPage() !== page ? link() : undefined"
|
|
55
|
+
[queryParams]="{ page }"
|
|
56
|
+
queryParamsHandling="merge"
|
|
57
|
+
[isActive]="currentPage() === page"
|
|
58
|
+
>
|
|
59
|
+
{{ page }}
|
|
60
|
+
</a>
|
|
61
|
+
}
|
|
62
|
+
</li>
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@if (showEdges() && !isLastPageActive()) {
|
|
66
|
+
<li hlmPaginationItem>
|
|
67
|
+
<hlm-pagination-next
|
|
68
|
+
[link]="link()"
|
|
69
|
+
[queryParams]="{ page: currentPage() + 1 }"
|
|
70
|
+
queryParamsHandling="merge"
|
|
71
|
+
/>
|
|
72
|
+
</li>
|
|
73
|
+
}
|
|
74
|
+
</ul>
|
|
75
|
+
</nav>
|
|
76
|
+
|
|
77
|
+
<!-- Show Page Size selector -->
|
|
78
|
+
<brn-select [(ngModel)]="itemsPerPage" class="ml-auto" placeholder="Page size">
|
|
79
|
+
<hlm-select-trigger class="w-fit">
|
|
80
|
+
<hlm-select-value />
|
|
81
|
+
</hlm-select-trigger>
|
|
82
|
+
<hlm-select-content>
|
|
83
|
+
@for (pageSize of pageSizesWithCurrent(); track pageSize) {
|
|
84
|
+
<hlm-option [value]="pageSize">{{ pageSize }} / page</hlm-option>
|
|
85
|
+
}
|
|
86
|
+
</hlm-select-content>
|
|
87
|
+
</brn-select>
|
|
88
|
+
</div>
|
|
89
|
+
`,
|
|
90
|
+
imports: [
|
|
91
|
+
FormsModule,
|
|
92
|
+
HlmPaginationDirective,
|
|
93
|
+
HlmPaginationContentDirective,
|
|
94
|
+
HlmPaginationItemDirective,
|
|
95
|
+
HlmPaginationPreviousComponent,
|
|
96
|
+
HlmPaginationNextComponent,
|
|
97
|
+
HlmPaginationLinkDirective,
|
|
98
|
+
HlmPaginationEllipsisComponent,
|
|
99
|
+
BrnSelectImports,
|
|
100
|
+
HlmSelectImports,
|
|
101
|
+
],
|
|
102
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
103
|
+
})
|
|
104
|
+
export class HlmNumberedPaginationQueryParamsComponent {
|
|
105
|
+
/**
|
|
106
|
+
* The current (active) page.
|
|
107
|
+
*/
|
|
108
|
+
public readonly currentPage = model.required<number>();
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The number of items per paginated page.
|
|
112
|
+
*/
|
|
113
|
+
public readonly itemsPerPage = model.required<number>();
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The total number of items in the collection. Only useful when
|
|
117
|
+
* doing server-side paging, where the collection size is limited
|
|
118
|
+
* to a single page returned by the server API.
|
|
119
|
+
*/
|
|
120
|
+
public readonly totalItems = input.required<number, NumberInput>({
|
|
121
|
+
transform: numberAttribute,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The URL path to use for the pagination links.
|
|
126
|
+
* Defaults to '.' (current path).
|
|
127
|
+
*/
|
|
128
|
+
public readonly link = input<string>('.');
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The number of page links to show.
|
|
132
|
+
*/
|
|
133
|
+
public readonly maxSize = input<number, NumberInput>(7, {
|
|
134
|
+
transform: numberAttribute,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Show the first and last page buttons.
|
|
139
|
+
*/
|
|
140
|
+
public readonly showEdges = input<boolean, BooleanInput>(true, {
|
|
141
|
+
transform: booleanAttribute,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The page sizes to show.
|
|
146
|
+
* Defaults to [10, 20, 50, 100]
|
|
147
|
+
*/
|
|
148
|
+
public readonly pageSizes = input<number[]>([10, 20, 50, 100]);
|
|
149
|
+
|
|
150
|
+
protected readonly pageSizesWithCurrent = computed(() => {
|
|
151
|
+
const pageSizes = this.pageSizes();
|
|
152
|
+
return pageSizes.includes(this.itemsPerPage())
|
|
153
|
+
? pageSizes // if current page size is included, return the same array
|
|
154
|
+
: [...pageSizes, this.itemsPerPage()].sort((a, b) => a - b); // otherwise, add current page size and sort the array
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
protected readonly isFirstPageActive = computed(() => this.currentPage() === 1);
|
|
158
|
+
protected readonly isLastPageActive = computed(() => this.currentPage() === this.lastPageNumber());
|
|
159
|
+
|
|
160
|
+
protected readonly lastPageNumber = computed(() => {
|
|
161
|
+
if (this.totalItems() < 1) {
|
|
162
|
+
// when there are 0 or fewer (an error case) items, there are no "pages" as such,
|
|
163
|
+
// but it makes sense to consider a single, empty page as the last page.
|
|
164
|
+
return 1;
|
|
165
|
+
}
|
|
166
|
+
return Math.ceil(this.totalItems() / this.itemsPerPage());
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
protected readonly pages = computed(() => {
|
|
170
|
+
const correctedCurrentPage = outOfBoundCorrection(this.totalItems(), this.itemsPerPage(), this.currentPage());
|
|
171
|
+
|
|
172
|
+
if (correctedCurrentPage !== this.currentPage()) {
|
|
173
|
+
// update the current page
|
|
174
|
+
untracked(() => this.currentPage.set(correctedCurrentPage));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return createPageArray(correctedCurrentPage, this.itemsPerPage(), this.totalItems(), this.maxSize());
|
|
178
|
+
});
|
|
179
|
+
}
|
|
@@ -181,7 +181,7 @@ type Page = number | '...';
|
|
|
181
181
|
*
|
|
182
182
|
* Copied from 'ngx-pagination' package
|
|
183
183
|
*/
|
|
184
|
-
function outOfBoundCorrection(totalItems: number, itemsPerPage: number, currentPage: number): number {
|
|
184
|
+
export function outOfBoundCorrection(totalItems: number, itemsPerPage: number, currentPage: number): number {
|
|
185
185
|
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
186
186
|
if (totalPages < currentPage && 0 < totalPages) {
|
|
187
187
|
return totalPages;
|
|
@@ -199,7 +199,7 @@ function outOfBoundCorrection(totalItems: number, itemsPerPage: number, currentP
|
|
|
199
199
|
*
|
|
200
200
|
* Copied from 'ngx-pagination' package
|
|
201
201
|
*/
|
|
202
|
-
function createPageArray(
|
|
202
|
+
export function createPageArray(
|
|
203
203
|
currentPage: number,
|
|
204
204
|
itemsPerPage: number,
|
|
205
205
|
totalItems: number,
|
|
@@ -18,6 +18,5 @@ export type PaginationItemVariants = VariantProps<typeof paginationItemVariants>
|
|
|
18
18
|
})
|
|
19
19
|
export class HlmPaginationItemDirective {
|
|
20
20
|
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
21
|
-
|
|
22
21
|
protected readonly _computedClass = computed(() => hlm(paginationItemVariants(), this.userClass()));
|
|
23
22
|
}
|
|
@@ -39,8 +39,11 @@ export type PaginationLinkVariants = VariantProps<typeof paginationLinkVariants>
|
|
|
39
39
|
})
|
|
40
40
|
export class HlmPaginationLinkDirective {
|
|
41
41
|
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
42
|
+
/** Whether the link is active (i.e., the current page). */
|
|
42
43
|
public readonly isActive = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
|
|
44
|
+
/** The size of the button. */
|
|
43
45
|
public readonly size = input<ButtonVariants['size']>('icon');
|
|
46
|
+
/** The link to navigate to the page. */
|
|
44
47
|
public readonly link = input<RouterLink['routerLink']>();
|
|
45
48
|
|
|
46
49
|
protected readonly _computedClass = computed(() =>
|
|
@@ -23,7 +23,7 @@ import { HlmPaginationLinkDirective } from './hlm-pagination-link.directive';
|
|
|
23
23
|
[size]="size()"
|
|
24
24
|
[attr.aria-label]="ariaLabel()"
|
|
25
25
|
>
|
|
26
|
-
<span [class
|
|
26
|
+
<span [class]="_labelClass()">{{ text() }}</span>
|
|
27
27
|
<ng-icon hlm size="sm" name="lucideChevronRight" />
|
|
28
28
|
</a>
|
|
29
29
|
`,
|
|
@@ -31,17 +31,26 @@ import { HlmPaginationLinkDirective } from './hlm-pagination-link.directive';
|
|
|
31
31
|
})
|
|
32
32
|
export class HlmPaginationNextComponent {
|
|
33
33
|
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
34
|
+
/** The link to navigate to the next page. */
|
|
34
35
|
public readonly link = input<RouterLink['routerLink']>();
|
|
36
|
+
/** The query parameters to pass to the next page. */
|
|
35
37
|
public readonly queryParams = input<RouterLink['queryParams']>();
|
|
38
|
+
/** How to handle query parameters when navigating to the next page. */
|
|
36
39
|
public readonly queryParamsHandling = input<RouterLink['queryParamsHandling']>();
|
|
37
40
|
|
|
41
|
+
/** The aria-label for the next page link. */
|
|
38
42
|
public readonly ariaLabel = input<string>('Go to next page', { alias: 'aria-label' });
|
|
43
|
+
/** The text to display for the next page link. */
|
|
39
44
|
public readonly text = input<string>('Next');
|
|
45
|
+
/** Whether the button should only display the icon. */
|
|
40
46
|
public readonly iconOnly = input<boolean, BooleanInput>(false, {
|
|
41
47
|
transform: booleanAttribute,
|
|
42
48
|
});
|
|
49
|
+
protected readonly _labelClass = computed(() => (this.iconOnly() ? 'sr-only' : 'hidden sm:block'));
|
|
43
50
|
|
|
44
51
|
protected readonly size = computed<ButtonVariants['size']>(() => (this.iconOnly() ? 'icon' : 'default'));
|
|
45
52
|
|
|
46
|
-
protected readonly _computedClass = computed(() =>
|
|
53
|
+
protected readonly _computedClass = computed(() =>
|
|
54
|
+
hlm('gap-1', !this.iconOnly() ? 'sm:pr-2.5' : '', this.userClass()),
|
|
55
|
+
);
|
|
47
56
|
}
|
|
@@ -24,24 +24,33 @@ import { HlmPaginationLinkDirective } from './hlm-pagination-link.directive';
|
|
|
24
24
|
[attr.aria-label]="ariaLabel()"
|
|
25
25
|
>
|
|
26
26
|
<ng-icon hlm size="sm" name="lucideChevronLeft" />
|
|
27
|
-
<span [class
|
|
27
|
+
<span [class]="_labelClass()">{{ text() }}</span>
|
|
28
28
|
</a>
|
|
29
29
|
`,
|
|
30
30
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
31
31
|
})
|
|
32
32
|
export class HlmPaginationPreviousComponent {
|
|
33
33
|
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
34
|
+
/** The link to navigate to the previous page. */
|
|
34
35
|
public readonly link = input<RouterLink['routerLink']>();
|
|
36
|
+
/** The query parameters to pass to the previous page. */
|
|
35
37
|
public readonly queryParams = input<RouterLink['queryParams']>();
|
|
38
|
+
/** How to handle query parameters when navigating to the previous page. */
|
|
36
39
|
public readonly queryParamsHandling = input<RouterLink['queryParamsHandling']>();
|
|
37
40
|
|
|
41
|
+
/** The aria-label for the previous page link. */
|
|
38
42
|
public readonly ariaLabel = input<string>('Go to previous page', { alias: 'aria-label' });
|
|
43
|
+
/** The text to display for the previous page link. */
|
|
39
44
|
public readonly text = input<string>('Previous');
|
|
45
|
+
/** Whether the button should only display the icon. */
|
|
40
46
|
public readonly iconOnly = input<boolean, BooleanInput>(false, {
|
|
41
47
|
transform: booleanAttribute,
|
|
42
48
|
});
|
|
49
|
+
protected readonly _labelClass = computed(() => (this.iconOnly() ? 'sr-only' : 'hidden sm:block'));
|
|
43
50
|
|
|
44
51
|
protected readonly size = computed<ButtonVariants['size']>(() => (this.iconOnly() ? 'icon' : 'default'));
|
|
45
52
|
|
|
46
|
-
protected readonly _computedClass = computed(() =>
|
|
53
|
+
protected readonly _computedClass = computed(() =>
|
|
54
|
+
hlm('gap-1', !this.iconOnly() ? 'sm:pl-2.5' : '', this.userClass()),
|
|
55
|
+
);
|
|
47
56
|
}
|
package/src/generators/ui/libs/ui-pagination-helm/files/lib/hlm-pagination.directive.ts.template
CHANGED
|
@@ -20,6 +20,7 @@ export type PaginationVariants = VariantProps<typeof paginationVariants>;
|
|
|
20
20
|
export class HlmPaginationDirective {
|
|
21
21
|
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
22
22
|
|
|
23
|
+
/** The aria-label for the pagination component. */
|
|
23
24
|
public readonly ariaLabel = input<string>('pagination', { alias: 'aria-label' });
|
|
24
25
|
|
|
25
26
|
protected readonly _computedClass = computed(() => hlm(paginationVariants(), this.userClass()));
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import {
|
|
4
|
+
HlmCaptionDirective,
|
|
5
|
+
HlmTableDirective,
|
|
6
|
+
HlmTBodyDirective,
|
|
7
|
+
HlmTdDirective,
|
|
8
|
+
HlmTFootDirective,
|
|
9
|
+
HlmThDirective,
|
|
10
|
+
HlmTHeadDirective,
|
|
11
|
+
HlmTrDirective,
|
|
12
|
+
} from './lib/hlm-table.directive';
|
|
9
13
|
|
|
10
|
-
export
|
|
11
|
-
export { HlmTableComponent } from './lib/hlm-table.component';
|
|
12
|
-
export { HlmTableDirective } from './lib/hlm-table.directive';
|
|
13
|
-
export { HlmTdComponent } from './lib/hlm-td.component';
|
|
14
|
-
export { HlmThComponent } from './lib/hlm-th.component';
|
|
15
|
-
export { HlmTrowComponent } from './lib/hlm-trow.component';
|
|
14
|
+
export * from './lib/hlm-table.directive';
|
|
16
15
|
|
|
17
16
|
export const HlmTableImports = [
|
|
18
|
-
HlmTableComponent,
|
|
19
17
|
HlmTableDirective,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
HlmTHeadDirective,
|
|
19
|
+
HlmTBodyDirective,
|
|
20
|
+
HlmTFootDirective,
|
|
21
|
+
HlmTrDirective,
|
|
22
|
+
HlmThDirective,
|
|
23
|
+
HlmTdDirective,
|
|
24
|
+
HlmCaptionDirective,
|
|
25
|
+
HlmTableDirective,
|
|
24
26
|
] as const;
|
|
25
27
|
|
|
26
28
|
@NgModule({
|
|
@@ -1,18 +1,220 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
// src/app/directives/hlm-table-directives.ts
|
|
2
|
+
import { computed, Directive, inject, InjectionToken, input, ValueProvider } from '@angular/core';
|
|
3
|
+
import { hlm } from '@spartan-ng/brain/core';
|
|
4
|
+
import type { ClassValue } from 'clsx';
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
// Configuration Interface and InjectionToken
|
|
7
|
+
export const HlmTableConfigToken = new InjectionToken<HlmTableVariant>('HlmTableConfig');
|
|
8
|
+
export interface HlmTableVariant {
|
|
9
|
+
table: string;
|
|
10
|
+
thead: string;
|
|
11
|
+
tbody: string;
|
|
12
|
+
tfoot: string;
|
|
13
|
+
tr: string;
|
|
14
|
+
th: string;
|
|
15
|
+
td: string;
|
|
16
|
+
caption: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const HlmTableVariantDefault: HlmTableVariant = {
|
|
20
|
+
table: 'w-full caption-bottom text-sm',
|
|
21
|
+
thead: '[&_tr]:border-b',
|
|
22
|
+
tbody: '[&_tr:last-child]:border-0',
|
|
23
|
+
tfoot: 'bg-muted/50 border-t font-medium [&>tr]:last:border-b-0',
|
|
24
|
+
tr: 'hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors',
|
|
25
|
+
th: 'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
|
26
|
+
td: 'p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
|
27
|
+
caption: 'text-muted-foreground mt-4 text-sm',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function provideHlmTableConfig(config: Partial<HlmTableVariant>): ValueProvider {
|
|
31
|
+
return {
|
|
32
|
+
provide: HlmTableConfigToken,
|
|
33
|
+
useValue: { ...HlmTableVariantDefault, ...config },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function injectHlmTableConfig(): HlmTableVariant {
|
|
38
|
+
return inject(HlmTableConfigToken, { optional: true }) ?? HlmTableVariantDefault;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Directive to apply Shadcn-like styling to a <table> element.
|
|
43
|
+
* It resolves and provides base classes for its child table elements.
|
|
44
|
+
* If a table has the `hlmTable` attribute, it will be styled with the provided variant.
|
|
45
|
+
* The other table elements will check if a parent table has the `hlmTable` attribute and will be styled accordingly.
|
|
46
|
+
*/
|
|
47
|
+
@Directive({
|
|
48
|
+
selector: 'table[hlmTable]',
|
|
49
|
+
standalone: true,
|
|
50
|
+
host: {
|
|
51
|
+
'[class]': '_computedClass()',
|
|
52
|
+
},
|
|
53
|
+
})
|
|
5
54
|
export class HlmTableDirective {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
55
|
+
/** Input to configure the variant of the table, this input has the highest priority. */
|
|
56
|
+
public readonly userVariant = input<Partial<HlmTableVariant> | string>({}, { alias: 'hlmTable' });
|
|
57
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
58
|
+
|
|
59
|
+
/** Global or default configuration provided by injectHlmTableConfig() */
|
|
60
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
61
|
+
|
|
62
|
+
// Protected variant that resolves user input to a full HlmTableVariant
|
|
63
|
+
protected readonly _variant = computed<HlmTableVariant>(() => {
|
|
64
|
+
const globalOrDefaultConfig = this._globalOrDefaultConfig;
|
|
65
|
+
const localInputConfig = this.userVariant();
|
|
66
|
+
|
|
67
|
+
// Priority 1: Local input object
|
|
68
|
+
if (typeof localInputConfig === 'object' && localInputConfig !== null && Object.keys(localInputConfig).length > 0) {
|
|
69
|
+
// Merge local input with the baseline provided by injectHlmTableConfig()
|
|
70
|
+
// This ensures that properties not in localInputConfig still fall back to global/default values.
|
|
71
|
+
return { ...globalOrDefaultConfig, ...localInputConfig };
|
|
72
|
+
}
|
|
73
|
+
// If localInputConfig is not a non-empty object (e.g., it's undefined, an empty object, or a string),
|
|
74
|
+
// then the globalOrDefaultConfig (which is already the result of injected OR default) is used.
|
|
75
|
+
return globalOrDefaultConfig;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Computed class for the host <table> element
|
|
79
|
+
protected readonly _computedClass = computed(() => hlm(this._variant().table, this.userClass()));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Directive to apply Shadcn-like styling to a <thead> element
|
|
84
|
+
* within an HlmTableDirective context.
|
|
85
|
+
*/
|
|
86
|
+
@Directive({
|
|
87
|
+
selector: 'thead[hlmTHead]',
|
|
88
|
+
standalone: true,
|
|
89
|
+
host: {
|
|
90
|
+
'[class]': '_computedClass()',
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
export class HlmTHeadDirective {
|
|
94
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
95
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
96
|
+
|
|
97
|
+
protected readonly _computedClass = computed(() =>
|
|
98
|
+
hlm(this._globalOrDefaultConfig ? this._globalOrDefaultConfig.thead.trim() : '', this.userClass()),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Directive to apply Shadcn-like styling to a <tbody> element
|
|
104
|
+
* within an HlmTableDirective context.
|
|
105
|
+
*/
|
|
106
|
+
@Directive({
|
|
107
|
+
selector: 'tbody[hlmTBody]',
|
|
108
|
+
standalone: true,
|
|
109
|
+
host: {
|
|
110
|
+
'[class]': '_computedClass()',
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
export class HlmTBodyDirective {
|
|
114
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
115
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
116
|
+
|
|
117
|
+
protected readonly _computedClass = computed(() =>
|
|
118
|
+
hlm(this._globalOrDefaultConfig ? this._globalOrDefaultConfig.tbody.trim() : '', this.userClass()),
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Directive to apply Shadcn-like styling to a <tfoot> element
|
|
124
|
+
* within an HlmTableDirective context.
|
|
125
|
+
*/
|
|
126
|
+
@Directive({
|
|
127
|
+
selector: 'tfoot[hlmTFoot]',
|
|
128
|
+
standalone: true,
|
|
129
|
+
host: {
|
|
130
|
+
'[class]': '_computedClass()',
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
export class HlmTFootDirective {
|
|
134
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
135
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
136
|
+
|
|
137
|
+
protected readonly _computedClass = computed(() =>
|
|
138
|
+
hlm(this._globalOrDefaultConfig ? this._globalOrDefaultConfig.tfoot.trim() : '', this.userClass()),
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Directive to apply Shadcn-like styling to a <tr> element
|
|
144
|
+
* within an HlmTableDirective context.
|
|
145
|
+
*/
|
|
146
|
+
@Directive({
|
|
147
|
+
selector: 'tr[hlmTr]',
|
|
148
|
+
standalone: true,
|
|
149
|
+
host: {
|
|
150
|
+
'[class]': '_computedClass()',
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
export class HlmTrDirective {
|
|
154
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
155
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
156
|
+
|
|
157
|
+
protected readonly _computedClass = computed(() =>
|
|
158
|
+
hlm(this._globalOrDefaultConfig ? this._globalOrDefaultConfig.tr.trim() : '', this.userClass()),
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Directive to apply Shadcn-like styling to a <th> element
|
|
164
|
+
* within an HlmTableDirective context.
|
|
165
|
+
*/
|
|
166
|
+
@Directive({
|
|
167
|
+
selector: 'th[hlmTh]',
|
|
168
|
+
standalone: true,
|
|
169
|
+
host: {
|
|
170
|
+
'[class]': '_computedClass()',
|
|
171
|
+
},
|
|
172
|
+
})
|
|
173
|
+
export class HlmThDirective {
|
|
174
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
175
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
176
|
+
|
|
177
|
+
protected readonly _computedClass = computed(() =>
|
|
178
|
+
hlm(this._globalOrDefaultConfig ? this._globalOrDefaultConfig.th.trim() : '', this.userClass()),
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Directive to apply Shadcn-like styling to a <td> element
|
|
184
|
+
* within an HlmTableDirective context.
|
|
185
|
+
*/
|
|
186
|
+
@Directive({
|
|
187
|
+
selector: 'td[hlmTd]',
|
|
188
|
+
standalone: true,
|
|
189
|
+
host: {
|
|
190
|
+
'[class]': '_computedClass()',
|
|
191
|
+
},
|
|
192
|
+
})
|
|
193
|
+
export class HlmTdDirective {
|
|
194
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
195
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
196
|
+
|
|
197
|
+
protected readonly _computedClass = computed(() =>
|
|
198
|
+
hlm(this._globalOrDefaultConfig ? this._globalOrDefaultConfig.td.trim() : '', this.userClass()),
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Directive to apply Shadcn-like styling to a <caption> element
|
|
204
|
+
* within an HlmTableDirective context.
|
|
205
|
+
*/
|
|
206
|
+
@Directive({
|
|
207
|
+
selector: 'caption[hlmCaption]',
|
|
208
|
+
standalone: true,
|
|
209
|
+
host: {
|
|
210
|
+
'[class]': '_computedClass()',
|
|
211
|
+
},
|
|
212
|
+
})
|
|
213
|
+
export class HlmCaptionDirective {
|
|
214
|
+
private readonly _globalOrDefaultConfig = injectHlmTableConfig();
|
|
215
|
+
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
216
|
+
|
|
217
|
+
protected readonly _computedClass = computed(() =>
|
|
218
|
+
hlm(this._globalOrDefaultConfig ? this._globalOrDefaultConfig.caption.trim() : '', this.userClass()),
|
|
219
|
+
);
|
|
18
220
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"internalName": "ui-accordion-helm",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/core": ">=19.0.0",
|
|
6
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
6
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
7
7
|
"clsx": "^2.1.1",
|
|
8
8
|
"@ng-icons/core": ">=29.0.0",
|
|
9
9
|
"@ng-icons/lucide": ">=29.0.0"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"internalName": "ui-alert-helm",
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@angular/core": ">=19.0.0",
|
|
16
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
16
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
17
17
|
"class-variance-authority": "^0.7.0",
|
|
18
18
|
"clsx": "^2.1.1"
|
|
19
19
|
}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"internalName": "ui-alert-dialog-helm",
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@angular/core": ">=19.0.0",
|
|
25
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
25
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
26
26
|
"clsx": "^2.1.1"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@angular/core": ">=19.0.0",
|
|
33
33
|
"@angular/cdk": ">=19.0.0",
|
|
34
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
34
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
35
35
|
"clsx": "^2.1.1"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"internalName": "ui-avatar-helm",
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@angular/core": ">=19.0.0",
|
|
42
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
42
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
43
43
|
"class-variance-authority": "^0.7.0",
|
|
44
44
|
"clsx": "^2.1.1"
|
|
45
45
|
}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@angular/core": ">=19.0.0",
|
|
51
51
|
"@angular/cdk": ">=19.0.0",
|
|
52
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
52
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
53
53
|
"class-variance-authority": "^0.7.0",
|
|
54
54
|
"clsx": "^2.1.1"
|
|
55
55
|
}
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@angular/core": ">=19.0.0",
|
|
61
61
|
"@ng-icons/core": ">=29.0.0",
|
|
62
62
|
"@ng-icons/lucide": ">=29.0.0",
|
|
63
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
63
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
64
64
|
"clsx": "^2.1.1",
|
|
65
65
|
"@angular/router": ">=19.0.0"
|
|
66
66
|
}
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"internalName": "ui-button-helm",
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@angular/core": ">=19.0.0",
|
|
72
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
72
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
73
73
|
"class-variance-authority": "^0.7.0",
|
|
74
74
|
"clsx": "^2.1.1"
|
|
75
75
|
}
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@angular/cdk": ">=19.0.0",
|
|
82
82
|
"@ng-icons/core": ">=29.0.0",
|
|
83
83
|
"@ng-icons/lucide": ">=29.0.0",
|
|
84
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
84
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
85
85
|
"clsx": "^2.1.1"
|
|
86
86
|
}
|
|
87
87
|
},
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"internalName": "ui-card-helm",
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"@angular/core": ">=19.0.0",
|
|
92
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
92
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
93
93
|
"class-variance-authority": "^0.7.0",
|
|
94
94
|
"clsx": "^2.1.1"
|
|
95
95
|
}
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"internalName": "ui-carousel-helm",
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@angular/core": ">=19.0.0",
|
|
101
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
101
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
102
102
|
"clsx": "^2.1.1",
|
|
103
103
|
"@ng-icons/core": ">=29.0.0",
|
|
104
104
|
"@ng-icons/lucide": ">=29.0.0",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@angular/forms": ">=19.0.0",
|
|
113
113
|
"@ng-icons/core": ">=29.0.0",
|
|
114
114
|
"@ng-icons/lucide": ">=29.0.0",
|
|
115
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
115
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
116
116
|
"clsx": "^2.1.1"
|
|
117
117
|
}
|
|
118
118
|
},
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"internalName": "ui-command-helm",
|
|
121
121
|
"peerDependencies": {
|
|
122
122
|
"@angular/core": ">=19.0.0",
|
|
123
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
123
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
124
124
|
"clsx": "^2.1.1",
|
|
125
125
|
"@angular/cdk": ">=19.0.0"
|
|
126
126
|
}
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"@angular/forms": ">=19.0.0",
|
|
134
134
|
"@ng-icons/core": ">=29.0.0",
|
|
135
135
|
"@ng-icons/lucide": ">=29.0.0",
|
|
136
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
136
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
137
137
|
"clsx": "^2.1.1"
|
|
138
138
|
}
|
|
139
139
|
},
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"internalName": "ui-dialog-helm",
|
|
142
142
|
"peerDependencies": {
|
|
143
143
|
"@angular/core": ">=19.0.0",
|
|
144
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
144
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
145
145
|
"clsx": "^2.1.1",
|
|
146
146
|
"@angular/common": ">=19.0.0",
|
|
147
147
|
"@ng-icons/core": ">=29.0.0",
|
|
@@ -154,14 +154,14 @@
|
|
|
154
154
|
"peerDependencies": {
|
|
155
155
|
"@angular/core": ">=19.0.0",
|
|
156
156
|
"@angular/forms": ">=19.0.0",
|
|
157
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
157
|
+
"@spartan-ng/brain": "0.0.1-alpha.476"
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
"hover-card": {
|
|
161
161
|
"internalName": "ui-hover-card-helm",
|
|
162
162
|
"peerDependencies": {
|
|
163
163
|
"@angular/core": ">=19.0.0",
|
|
164
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
164
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
165
165
|
"clsx": "^2.1.1"
|
|
166
166
|
}
|
|
167
167
|
},
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
"internalName": "ui-input-helm",
|
|
178
178
|
"peerDependencies": {
|
|
179
179
|
"@angular/core": ">=19.0.0",
|
|
180
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
180
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
181
181
|
"class-variance-authority": "^0.7.0",
|
|
182
182
|
"clsx": "^2.1.1",
|
|
183
183
|
"@angular/forms": ">=19.0.0"
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
"internalName": "ui-input-otp-helm",
|
|
188
188
|
"peerDependencies": {
|
|
189
189
|
"@angular/core": ">=19.0.0",
|
|
190
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
190
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
191
191
|
"clsx": "^2.1.1",
|
|
192
192
|
"@ng-icons/core": ">=29.0.0",
|
|
193
193
|
"@ng-icons/lucide": ">=29.0.0",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"internalName": "ui-label-helm",
|
|
199
199
|
"peerDependencies": {
|
|
200
200
|
"@angular/core": ">=19.0.0",
|
|
201
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
201
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
202
202
|
"class-variance-authority": "^0.7.0",
|
|
203
203
|
"clsx": "^2.1.1"
|
|
204
204
|
}
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
"internalName": "ui-menu-helm",
|
|
208
208
|
"peerDependencies": {
|
|
209
209
|
"@angular/core": ">=19.0.0",
|
|
210
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
210
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
211
211
|
"clsx": "^2.1.1",
|
|
212
212
|
"@ng-icons/core": ">=29.0.0",
|
|
213
213
|
"@ng-icons/lucide": ">=29.0.0",
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
"@angular/core": ">=19.0.0",
|
|
221
221
|
"@angular/cdk": ">=19.0.0",
|
|
222
222
|
"@angular/forms": ">=19.0.0",
|
|
223
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
223
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
224
224
|
"class-variance-authority": "^0.7.0",
|
|
225
225
|
"clsx": "^2.1.1",
|
|
226
226
|
"@ng-icons/core": ">=29.0.0",
|
|
@@ -232,7 +232,7 @@
|
|
|
232
232
|
"internalName": "ui-popover-helm",
|
|
233
233
|
"peerDependencies": {
|
|
234
234
|
"@angular/core": ">=19.0.0",
|
|
235
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
235
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
236
236
|
"clsx": "^2.1.1"
|
|
237
237
|
}
|
|
238
238
|
},
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
"internalName": "ui-progress-helm",
|
|
241
241
|
"peerDependencies": {
|
|
242
242
|
"@angular/core": ">=19.0.0",
|
|
243
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
243
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
244
244
|
"clsx": "^2.1.1"
|
|
245
245
|
}
|
|
246
246
|
},
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
"internalName": "ui-radio-group-helm",
|
|
249
249
|
"peerDependencies": {
|
|
250
250
|
"@angular/core": ">=19.0.0",
|
|
251
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
251
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
252
252
|
"clsx": "^2.1.1",
|
|
253
253
|
"@angular/common": ">=19.0.0"
|
|
254
254
|
}
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
"internalName": "ui-scroll-area-helm",
|
|
258
258
|
"peerDependencies": {
|
|
259
259
|
"@angular/core": ">=19.0.0",
|
|
260
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
260
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
261
261
|
"clsx": "^2.1.1"
|
|
262
262
|
}
|
|
263
263
|
},
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
"internalName": "ui-select-helm",
|
|
266
266
|
"peerDependencies": {
|
|
267
267
|
"@angular/core": ">=19.0.0",
|
|
268
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
268
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
269
269
|
"clsx": "^2.1.1",
|
|
270
270
|
"@ng-icons/core": ">=29.0.0",
|
|
271
271
|
"@ng-icons/lucide": ">=29.0.0",
|
|
@@ -276,7 +276,7 @@
|
|
|
276
276
|
"internalName": "ui-separator-helm",
|
|
277
277
|
"peerDependencies": {
|
|
278
278
|
"@angular/core": ">=19.0.0",
|
|
279
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
279
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
280
280
|
"clsx": "^2.1.1"
|
|
281
281
|
}
|
|
282
282
|
},
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
"internalName": "ui-sheet-helm",
|
|
285
285
|
"peerDependencies": {
|
|
286
286
|
"@angular/core": ">=19.0.0",
|
|
287
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
287
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
288
288
|
"clsx": "^2.1.1",
|
|
289
289
|
"@ng-icons/core": ">=29.0.0",
|
|
290
290
|
"@ng-icons/lucide": ">=29.0.0",
|
|
@@ -295,7 +295,7 @@
|
|
|
295
295
|
"internalName": "ui-skeleton-helm",
|
|
296
296
|
"peerDependencies": {
|
|
297
297
|
"@angular/core": ">=19.0.0",
|
|
298
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
298
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
299
299
|
"clsx": "^2.1.1"
|
|
300
300
|
}
|
|
301
301
|
},
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
"internalName": "ui-slider-helm",
|
|
304
304
|
"peerDependencies": {
|
|
305
305
|
"@angular/core": ">=19.0.0",
|
|
306
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
306
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
307
307
|
"clsx": "^2.1.1"
|
|
308
308
|
}
|
|
309
309
|
},
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
"internalName": "ui-sonner-helm",
|
|
312
312
|
"peerDependencies": {
|
|
313
313
|
"@angular/core": ">=19.0.0",
|
|
314
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
314
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
315
315
|
"clsx": "^2.1.1",
|
|
316
316
|
"ngx-sonner": ">=3.0.0"
|
|
317
317
|
}
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
"internalName": "ui-spinner-helm",
|
|
321
321
|
"peerDependencies": {
|
|
322
322
|
"@angular/core": ">=19.0.0",
|
|
323
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
323
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
324
324
|
"class-variance-authority": "^0.7.0",
|
|
325
325
|
"clsx": "^2.1.1"
|
|
326
326
|
}
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
"internalName": "ui-switch-helm",
|
|
330
330
|
"peerDependencies": {
|
|
331
331
|
"@angular/core": ">=19.0.0",
|
|
332
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
332
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
333
333
|
"clsx": "^2.1.1",
|
|
334
334
|
"@angular/cdk": ">=19.0.0",
|
|
335
335
|
"@angular/forms": ">=19.0.0"
|
|
@@ -339,16 +339,15 @@
|
|
|
339
339
|
"internalName": "ui-table-helm",
|
|
340
340
|
"peerDependencies": {
|
|
341
341
|
"@angular/core": ">=19.0.0",
|
|
342
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
343
|
-
"clsx": "^2.1.1"
|
|
344
|
-
"@angular/common": ">=19.0.0"
|
|
342
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
343
|
+
"clsx": "^2.1.1"
|
|
345
344
|
}
|
|
346
345
|
},
|
|
347
346
|
"tabs": {
|
|
348
347
|
"internalName": "ui-tabs-helm",
|
|
349
348
|
"peerDependencies": {
|
|
350
349
|
"@angular/core": ">=19.0.0",
|
|
351
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
350
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
352
351
|
"clsx": "^2.1.1",
|
|
353
352
|
"class-variance-authority": "^0.7.0",
|
|
354
353
|
"@angular/cdk": ">=19.0.0",
|
|
@@ -361,7 +360,7 @@
|
|
|
361
360
|
"internalName": "ui-toggle-helm",
|
|
362
361
|
"peerDependencies": {
|
|
363
362
|
"@angular/core": ">=19.0.0",
|
|
364
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
363
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
365
364
|
"class-variance-authority": "^0.7.0",
|
|
366
365
|
"clsx": "^2.1.1"
|
|
367
366
|
}
|
|
@@ -370,7 +369,7 @@
|
|
|
370
369
|
"internalName": "ui-toggle-group-helm",
|
|
371
370
|
"peerDependencies": {
|
|
372
371
|
"@angular/core": ">=19.0.0",
|
|
373
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
372
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
374
373
|
"class-variance-authority": "^0.7.0",
|
|
375
374
|
"clsx": "^2.1.1"
|
|
376
375
|
}
|
|
@@ -379,14 +378,14 @@
|
|
|
379
378
|
"internalName": "ui-tooltip-helm",
|
|
380
379
|
"peerDependencies": {
|
|
381
380
|
"@angular/core": ">=19.0.0",
|
|
382
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
381
|
+
"@spartan-ng/brain": "0.0.1-alpha.476"
|
|
383
382
|
}
|
|
384
383
|
},
|
|
385
384
|
"typography": {
|
|
386
385
|
"internalName": "ui-typography-helm",
|
|
387
386
|
"peerDependencies": {
|
|
388
387
|
"@angular/core": ">=19.0.0",
|
|
389
|
-
"@spartan-ng/brain": "0.0.1-alpha.
|
|
388
|
+
"@spartan-ng/brain": "0.0.1-alpha.476",
|
|
390
389
|
"clsx": "^2.1.1"
|
|
391
390
|
}
|
|
392
391
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ViewEncapsulation,
|
|
5
|
-
booleanAttribute,
|
|
6
|
-
computed,
|
|
7
|
-
effect,
|
|
8
|
-
inject,
|
|
9
|
-
input,
|
|
10
|
-
untracked,
|
|
11
|
-
} from '@angular/core';
|
|
12
|
-
import { hlm } from '@spartan-ng/brain/core';
|
|
13
|
-
import type { ClassValue } from 'clsx';
|
|
14
|
-
import { HlmTableComponent } from './hlm-table.component';
|
|
15
|
-
|
|
16
|
-
let captionIdSequence = 0;
|
|
17
|
-
|
|
18
|
-
@Component({
|
|
19
|
-
selector: 'hlm-caption',
|
|
20
|
-
host: {
|
|
21
|
-
'[class]': '_computedClass()',
|
|
22
|
-
'[id]': 'id()',
|
|
23
|
-
},
|
|
24
|
-
template: `
|
|
25
|
-
<ng-content />
|
|
26
|
-
`,
|
|
27
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
28
|
-
encapsulation: ViewEncapsulation.None,
|
|
29
|
-
})
|
|
30
|
-
export class HlmCaptionComponent {
|
|
31
|
-
private readonly _table = inject(HlmTableComponent, { optional: true });
|
|
32
|
-
|
|
33
|
-
protected readonly id = input<string | null | undefined>(`${captionIdSequence++}`);
|
|
34
|
-
|
|
35
|
-
public readonly hidden = input(false, { transform: booleanAttribute });
|
|
36
|
-
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
37
|
-
protected readonly _computedClass = computed(() =>
|
|
38
|
-
hlm(
|
|
39
|
-
'text-center block mt-4 text-sm text-muted-foreground',
|
|
40
|
-
this.hidden() ? 'sr-only' : 'order-last',
|
|
41
|
-
this.userClass(),
|
|
42
|
-
),
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
constructor() {
|
|
46
|
-
effect(() => {
|
|
47
|
-
const id = this.id();
|
|
48
|
-
untracked(() => {
|
|
49
|
-
if (!this._table) return;
|
|
50
|
-
this._table.labeledBy.set(id);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ViewEncapsulation,
|
|
5
|
-
computed,
|
|
6
|
-
effect,
|
|
7
|
-
input,
|
|
8
|
-
signal,
|
|
9
|
-
untracked,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { hlm } from '@spartan-ng/brain/core';
|
|
12
|
-
import type { ClassValue } from 'clsx';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'hlm-table',
|
|
16
|
-
host: {
|
|
17
|
-
'[class]': '_computedClass()',
|
|
18
|
-
role: 'table',
|
|
19
|
-
'[attr.aria-labelledby]': 'labeledBy()',
|
|
20
|
-
},
|
|
21
|
-
template: `
|
|
22
|
-
<ng-content />
|
|
23
|
-
`,
|
|
24
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
|
-
encapsulation: ViewEncapsulation.None,
|
|
26
|
-
})
|
|
27
|
-
export class HlmTableComponent {
|
|
28
|
-
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
29
|
-
protected readonly _computedClass = computed(() =>
|
|
30
|
-
hlm('flex flex-col text-sm [&_hlm-trow:last-child]:border-0', this.userClass()),
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
// we aria-labelledby to be settable from outside but use the input by default.
|
|
34
|
-
public readonly _labeledByInput = input<string | null | undefined>(undefined, { alias: 'aria-labelledby' });
|
|
35
|
-
public readonly labeledBy = signal<string | null | undefined>(undefined);
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
effect(() => {
|
|
39
|
-
const labeledBy = this._labeledByInput();
|
|
40
|
-
untracked(() => {
|
|
41
|
-
this.labeledBy.set(labeledBy);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
ViewEncapsulation,
|
|
6
|
-
booleanAttribute,
|
|
7
|
-
computed,
|
|
8
|
-
inject,
|
|
9
|
-
input,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { hlm } from '@spartan-ng/brain/core';
|
|
12
|
-
import { BrnColumnDefComponent } from '@spartan-ng/brain/table';
|
|
13
|
-
import type { ClassValue } from 'clsx';
|
|
14
|
-
|
|
15
|
-
@Component({
|
|
16
|
-
selector: 'hlm-td',
|
|
17
|
-
imports: [NgTemplateOutlet],
|
|
18
|
-
host: {
|
|
19
|
-
'[class]': '_computedClass()',
|
|
20
|
-
},
|
|
21
|
-
template: `
|
|
22
|
-
<ng-template #content>
|
|
23
|
-
<ng-content />
|
|
24
|
-
</ng-template>
|
|
25
|
-
@if (truncate()) {
|
|
26
|
-
<span class="flex-1 truncate">
|
|
27
|
-
<ng-container [ngTemplateOutlet]="content" />
|
|
28
|
-
</span>
|
|
29
|
-
} @else {
|
|
30
|
-
<ng-container [ngTemplateOutlet]="content" />
|
|
31
|
-
}
|
|
32
|
-
`,
|
|
33
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
34
|
-
encapsulation: ViewEncapsulation.None,
|
|
35
|
-
})
|
|
36
|
-
export class HlmTdComponent {
|
|
37
|
-
private readonly _columnDef? = inject(BrnColumnDefComponent, { optional: true });
|
|
38
|
-
public readonly truncate = input(false, { transform: booleanAttribute });
|
|
39
|
-
|
|
40
|
-
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
41
|
-
protected readonly _computedClass = computed(() =>
|
|
42
|
-
hlm('flex flex-none p-4 items-center [&:has([role=checkbox])]:pr-0', this._columnDef?.class(), this.userClass()),
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
Component,
|
|
5
|
-
ViewEncapsulation,
|
|
6
|
-
booleanAttribute,
|
|
7
|
-
computed,
|
|
8
|
-
inject,
|
|
9
|
-
input,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { hlm } from '@spartan-ng/brain/core';
|
|
12
|
-
import { BrnColumnDefComponent } from '@spartan-ng/brain/table';
|
|
13
|
-
import type { ClassValue } from 'clsx';
|
|
14
|
-
|
|
15
|
-
@Component({
|
|
16
|
-
selector: 'hlm-th',
|
|
17
|
-
imports: [NgTemplateOutlet],
|
|
18
|
-
host: {
|
|
19
|
-
'[class]': '_computedClass()',
|
|
20
|
-
},
|
|
21
|
-
template: `
|
|
22
|
-
<ng-template #content>
|
|
23
|
-
<ng-content />
|
|
24
|
-
</ng-template>
|
|
25
|
-
@if (truncate()) {
|
|
26
|
-
<span class="flex-1 truncate">
|
|
27
|
-
<ng-container [ngTemplateOutlet]="content" />
|
|
28
|
-
</span>
|
|
29
|
-
} @else {
|
|
30
|
-
<ng-container [ngTemplateOutlet]="content" />
|
|
31
|
-
}
|
|
32
|
-
`,
|
|
33
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
34
|
-
encapsulation: ViewEncapsulation.None,
|
|
35
|
-
})
|
|
36
|
-
export class HlmThComponent {
|
|
37
|
-
private readonly _columnDef? = inject(BrnColumnDefComponent, { optional: true });
|
|
38
|
-
public readonly truncate = input(false, { transform: booleanAttribute });
|
|
39
|
-
|
|
40
|
-
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
41
|
-
protected readonly _computedClass = computed(() =>
|
|
42
|
-
hlm(
|
|
43
|
-
'flex flex-none h-12 px-4 text-sm items-center font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
|
|
44
|
-
this._columnDef?.class(),
|
|
45
|
-
this.userClass(),
|
|
46
|
-
),
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, ViewEncapsulation, computed, input } from '@angular/core';
|
|
2
|
-
import { hlm } from '@spartan-ng/brain/core';
|
|
3
|
-
import type { ClassValue } from 'clsx';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'hlm-trow',
|
|
7
|
-
host: {
|
|
8
|
-
'[class]': '_computedClass()',
|
|
9
|
-
role: 'row',
|
|
10
|
-
},
|
|
11
|
-
template: `
|
|
12
|
-
<ng-content />
|
|
13
|
-
`,
|
|
14
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
15
|
-
encapsulation: ViewEncapsulation.None,
|
|
16
|
-
})
|
|
17
|
-
export class HlmTrowComponent {
|
|
18
|
-
public readonly userClass = input<ClassValue>('', { alias: 'class' });
|
|
19
|
-
protected _computedClass = computed(() =>
|
|
20
|
-
hlm(
|
|
21
|
-
'flex flex border-b border-border transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',
|
|
22
|
-
this.userClass(),
|
|
23
|
-
),
|
|
24
|
-
);
|
|
25
|
-
}
|