@rxap/schematic-angular 19.3.1 → 21.0.1-dev.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.
- package/CHANGELOG.md +42 -0
- package/package.json +10 -10
- package/src/lib/coerce-minimum-table-component.js +12 -7
- package/src/lib/coerce-minimum-table-component.js.map +1 -1
- package/src/lib/form/control/table-select-form-control.js +4 -4
- package/src/lib/form/control/table-select-form-control.js.map +1 -1
- package/src/lib/rules/table-cell-component-rule.js +2 -3
- package/src/lib/rules/table-cell-component-rule.js.map +1 -1
- package/src/schematics/accordion/accordion-component/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/accordion/accordion-component/__snapshots__/normalize-accordion-component-options.spec.ts.snap +1 -1
- package/src/schematics/accordion/accordion-component/files/component/__componentName__.component.html.hbs +10 -7
- package/src/schematics/accordion/accordion-item-component/files/component/__componentName__.component.html.template +3 -1
- package/src/schematics/accordion/item/accordion-item-data-grid-component/__snapshots__/normalize-accordion-item-data-grid-component-options.spec.ts.snap +1 -1
- package/src/schematics/accordion/item/accordion-item-data-grid-component/files/data-grid-collection/__componentName__.component.html.template +6 -5
- package/src/schematics/accordion/item/accordion-item-nested-component/__snapshots__/normalize-accordion-item-nested-component-options.spec.ts.snap +1 -1
- package/src/schematics/accordion/item/accordion-item-switch-component/__snapshots__/normalize-accordion-item-switch-component-options.spec.ts.snap +1 -1
- package/src/schematics/accordion/item/accordion-item-table-component/__snapshots__/normalize-accordion-item-table-component-options.spec.ts.snap +1 -1
- package/src/schematics/accordion/item/accordion-item-tree-table-component/__snapshots__/normalize-accordion-item-tree-table-component-options.spec.ts.snap +1 -1
- package/src/schematics/accordion/templates/switch-accordion-item.hbs +10 -10
- package/src/schematics/data-grid-component/__snapshots__/index.spec.ts.snap +34 -1
- package/src/schematics/data-grid-component/__snapshots__/normalize-data-grid-component-options.spec.ts.snap +1 -1
- package/src/schematics/data-grid-component/component-rule.js +14 -6
- package/src/schematics/data-grid-component/component-rule.js.map +1 -1
- package/src/schematics/data-grid-component/files/component/__componentName__.component.html.hbs +1 -1
- package/src/schematics/dialog-component/__snapshots__/index.spec.ts.snap +57 -8
- package/src/schematics/dialog-component/__snapshots__/normalize-dialog-component-options.spec.ts.snap +1 -1
- package/src/schematics/dialog-component/files/component/__componentName__.component.html.template +3 -1
- package/src/schematics/form/control/autocomplete-form-control/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/form/control/autocomplete-form-control/__snapshots__/normalize-autocomplete-form-control-options.spec.ts.snap +1 -1
- package/src/schematics/form/control/autocomplete-table-select-form-control/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/form/control/autocomplete-table-select-form-control/__snapshots__/normalize-table-select-form-control-options.spec.ts.snap +37 -5
- package/src/schematics/form/control/date-form-control/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/form/control/date-form-control/__snapshots__/normalize-date-form-control-options.spec.ts.snap +1 -1
- package/src/schematics/form/control/input-form-control/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/form/control/input-form-control/__snapshots__/normalize-input-form-control-options.spec.ts.snap +1 -1
- package/src/schematics/form/control/select-form-control/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/form/control/select-form-control/__snapshots__/normalize-select-form-control-options.spec.ts.snap +1 -1
- package/src/schematics/form/control/table-select-form-control/__snapshots__/normalize-table-select-form-control-options.spec.ts.snap +37 -5
- package/src/schematics/form/form-array/__snapshots__/normalize-form-array-options.spec.ts.snap +1 -1
- package/src/schematics/form/form-component/__snapshots__/index.spec.ts.snap +66 -1
- package/src/schematics/form/form-component/__snapshots__/normalize-form-component-options.spec.ts.snap +1 -1
- package/src/schematics/form/form-component/coerce-form-component.js +1 -1
- package/src/schematics/form/form-component/coerce-form-component.js.map +1 -1
- package/src/schematics/form/form-component/files/window/open-__componentName__-window.method.ts.template +26 -16
- package/src/schematics/form/form-control/__snapshots__/normalize-form-control-options.spec.ts.snap +1 -1
- package/src/schematics/form/form-definition/__snapshots__/index.spec.ts.snap +43 -1
- package/src/schematics/form/form-definition/__snapshots__/normalize-form-definition-options.spec.ts.snap +1 -1
- package/src/schematics/form/form-group/__snapshots__/normalize-form-group-options.spec.ts.snap +1 -1
- package/src/schematics/route-component/__snapshots__/normalize-route-component-options.spec.ts.snap +1 -1
- package/src/schematics/table/action/dialog-table-action/__snapshots__/normalize-dialog-table-action-options.spec.ts.snap +1 -1
- package/src/schematics/table/action/form-table-action/__snapshots__/normalize-form-table-action-options.spec.ts.snap +1 -1
- package/src/schematics/table/action/navigation-table-action/__snapshots__/normalize-navigation-table-action-options.spec.ts.snap +1 -1
- package/src/schematics/table/action/open-api-table-action/__snapshots__/normalize-open-api-table-action-options.spec.ts.snap +1 -1
- package/src/schematics/table/action/operation-table-action/__snapshots__/normalize-operation-table-action-options.spec.ts.snap +1 -1
- package/src/schematics/table/header-button/form-table-header-button/__snapshots__/normalize-form-table-header-button-options.spec.ts.snap +1 -1
- package/src/schematics/table/header-button/method-table-header-button/__snapshots__/normalize-method-table-header-button-options.spec.ts.snap +1 -1
- package/src/schematics/table/header-button/navigation-table-header-button/__snapshots__/normalize-navigation-table-header-button-options.spec.ts.snap +1 -1
- package/src/schematics/table/table-action/__snapshots__/normalize-table-action-options.spec.ts.snap +1 -1
- package/src/schematics/table/table-component/__snapshots__/index.spec.ts.snap +417 -1
- package/src/schematics/table/table-component/__snapshots__/normalize-table-component-options.spec.ts.snap +1 -1
- package/src/schematics/table/table-component/files/component/__componentName__.component.html.hbs +14 -11
- package/src/schematics/table/table-component/select-column-rule.js +3 -1
- package/src/schematics/table/table-component/select-column-rule.js.map +1 -1
- package/src/schematics/table/table-header-button/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/table/table-header-button/__snapshots__/normalize-table-header-button-options.spec.ts.snap +1 -1
- package/src/schematics/table/templates/spinner-table-column.hbs +5 -7
- package/src/schematics/table/tree-table-component/__snapshots__/index.spec.ts.snap +145 -1
- package/src/schematics/table/tree-table-component/files/component/__componentName__.component.html.hbs +14 -11
- package/src/schematics/tree-component/__snapshots__/index.spec.ts.snap +1 -1
- package/src/schematics/tree-component/__snapshots__/normalize-tree-component-options.spec.ts.snap +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
3
|
exports[`table-component minimal: file-tree 1`] = `
|
|
4
4
|
[
|
|
@@ -34,6 +34,132 @@ exports[`table-component minimal: file-tree 1`] = `
|
|
|
34
34
|
]
|
|
35
35
|
`;
|
|
36
36
|
|
|
37
|
+
exports[`table-component minimal: generated 1`] = `
|
|
38
|
+
{
|
|
39
|
+
"/package.json": "{
|
|
40
|
+
"name": "workspace",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@rxap/components": "19.0.0-dev.0",
|
|
43
|
+
"@rxap/data-source": "19.0.0-dev.0",
|
|
44
|
+
"@rxap/directives": "19.0.0-dev.0",
|
|
45
|
+
"@rxap/form-system": "19.0.0-dev.0",
|
|
46
|
+
"@rxap/forms": "19.0.0-dev.0",
|
|
47
|
+
"@rxap/material-directives": "19.0.0-dev.0",
|
|
48
|
+
"@rxap/material-form-system": "19.0.0-dev.1",
|
|
49
|
+
"@rxap/material-table-system": "19.0.0-dev.1",
|
|
50
|
+
"@rxap/mixin": "16.0.11-dev.0",
|
|
51
|
+
"@rxap/nest-dto": "10.3.7-dev.1",
|
|
52
|
+
"@rxap/pattern": "1.1.10-dev.0",
|
|
53
|
+
"@rxap/reflect-metadata": "1.0.12-dev.0",
|
|
54
|
+
"@rxap/rxjs": "1.1.11-dev.0",
|
|
55
|
+
"@rxap/utilities": "16.4.1-dev.0",
|
|
56
|
+
"@rxap/window-system": "19.0.0-dev.0"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
",
|
|
60
|
+
"/ui/lib/src/lib/test-table/test-table.component.html": "<div class="flex flex-col gap-y-4 m-4">
|
|
61
|
+
|
|
62
|
+
<div class="table-card-container flex flex-col">
|
|
63
|
+
<mat-card>
|
|
64
|
+
<mat-progress-bar
|
|
65
|
+
rxapCardProgressBar
|
|
66
|
+
[loading$]="tableDataSourceDirective.loading$"
|
|
67
|
+
></mat-progress-bar>
|
|
68
|
+
<mat-card-header class="min-h-full h-12">
|
|
69
|
+
<mat-card-title i18n>Test Table</mat-card-title>
|
|
70
|
+
<rxap-table-column-menu
|
|
71
|
+
matCard
|
|
72
|
+
#rxapTableColumns="rxapTableColumns"
|
|
73
|
+
>
|
|
74
|
+
</rxap-table-column-menu>
|
|
75
|
+
</mat-card-header>
|
|
76
|
+
|
|
77
|
+
<mat-card-content>
|
|
78
|
+
@if (tableDataSourceDirective.hasError$ | async) {
|
|
79
|
+
<rxap-data-source-error
|
|
80
|
+
[dataSourceLike]="tableDataSourceDirective">
|
|
81
|
+
</rxap-data-source-error>
|
|
82
|
+
}
|
|
83
|
+
<div class="table-scroll-container mt-4 overflow-x-auto overscroll-auto">
|
|
84
|
+
<table
|
|
85
|
+
[class.hidden]="tableDataSourceDirective.hasError$ | async"
|
|
86
|
+
mat-table
|
|
87
|
+
#tableDataSourceDirective="rxapTableDataSource"
|
|
88
|
+
rxapTableDataSource
|
|
89
|
+
[parameters]="parameters()"
|
|
90
|
+
id="test-table"
|
|
91
|
+
[paginator]="paginator"
|
|
92
|
+
>
|
|
93
|
+
<!-- region columns -->
|
|
94
|
+
|
|
95
|
+
<!-- endregion -->
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<tr
|
|
101
|
+
[@rowsAnimation]=""
|
|
102
|
+
mat-row
|
|
103
|
+
[ngClass]="{ 'rxap-row-odd !bg-neutral-200 dark:!bg-neutral-600': odd, 'rxap-row-even': even }"
|
|
104
|
+
class="hover:!bg-neutral-400 dark:hover:!bg-neutral-800"
|
|
105
|
+
*matRowDef="
|
|
106
|
+
let element;
|
|
107
|
+
columns: rxapTableColumns.displayColumns();
|
|
108
|
+
let odd = odd;
|
|
109
|
+
let even = even
|
|
110
|
+
"
|
|
111
|
+
></tr>
|
|
112
|
+
</table>
|
|
113
|
+
</div>
|
|
114
|
+
</mat-card-content>
|
|
115
|
+
<mat-card-footer>
|
|
116
|
+
<mat-paginator
|
|
117
|
+
[class.hidden]="tableDataSourceDirective.hasError$ | async"
|
|
118
|
+
class="m-4"
|
|
119
|
+
rxapPersistent
|
|
120
|
+
[pageSizeOptions]="[5,10,25,50,100]"
|
|
121
|
+
[pageSize]="10"
|
|
122
|
+
#paginator="matPaginator"
|
|
123
|
+
></mat-paginator>
|
|
124
|
+
</mat-card-footer>
|
|
125
|
+
</mat-card>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
",
|
|
129
|
+
"/ui/lib/src/lib/test-table/test-table.component.scss": "",
|
|
130
|
+
"/ui/lib/src/lib/test-table/test-table.component.ts": "import { Component, ChangeDetectionStrategy, input } from '@angular/core';
|
|
131
|
+
import { RowAnimation, TableColumnMenuComponent, TableColumnOptionComponent, PersistentPaginatorDirective, TableDataSourceDirective } from '@rxap/material-table-system';
|
|
132
|
+
import { Observable } from 'rxjs';
|
|
133
|
+
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
134
|
+
import { DataSourceErrorComponent } from '@rxap/data-source';
|
|
135
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
136
|
+
import { MatTableModule } from '@angular/material/table';
|
|
137
|
+
import { CardProgressBarDirective } from '@rxap/material-directives/card';
|
|
138
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
139
|
+
import { MatCardModule } from '@angular/material/card';
|
|
140
|
+
import { AsyncPipe, NgIf, NgClass } from '@angular/common';
|
|
141
|
+
|
|
142
|
+
@Component({
|
|
143
|
+
standalone: true,
|
|
144
|
+
selector: 'jest-test-table',
|
|
145
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
146
|
+
templateUrl: './test-table.component.html',
|
|
147
|
+
styleUrls: ['./test-table.component.scss'],
|
|
148
|
+
animations: [RowAnimation],
|
|
149
|
+
imports: [TableColumnMenuComponent, TableColumnOptionComponent, MatPaginatorModule, PersistentPaginatorDirective, DataSourceErrorComponent, MatDividerModule, TableDataSourceDirective, MatTableModule, CardProgressBarDirective, MatProgressBarModule, MatCardModule, AsyncPipe, NgIf, NgClass],
|
|
150
|
+
})
|
|
151
|
+
export class TestTableComponent {
|
|
152
|
+
public readonly parameters = input<Observable<Record<string, unknown>>>();
|
|
153
|
+
}
|
|
154
|
+
",
|
|
155
|
+
"/ui/lib/src/lib/test-table/test-table.ts": "import { TableRowMetadata } from '@rxap/material-table-system';
|
|
156
|
+
|
|
157
|
+
export interface ITestTable extends Record<string, unknown>, TableRowMetadata {
|
|
158
|
+
}
|
|
159
|
+
",
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
|
|
37
163
|
exports[`table-component nestjs backend: file-tree 1`] = `
|
|
38
164
|
[
|
|
39
165
|
"/angular.json",
|
|
@@ -72,6 +198,296 @@ exports[`table-component nestjs backend: file-tree 1`] = `
|
|
|
72
198
|
]
|
|
73
199
|
`;
|
|
74
200
|
|
|
201
|
+
exports[`table-component nestjs backend: generated 1`] = `
|
|
202
|
+
{
|
|
203
|
+
"/api/lib/src/lib/api-lib/api-lib.module.ts": "import { Module } from '@nestjs/common';
|
|
204
|
+
import { TestTableController } from './test-table.controller';
|
|
205
|
+
|
|
206
|
+
@Module({
|
|
207
|
+
controllers: [TestTableController],
|
|
208
|
+
})
|
|
209
|
+
export class ApiLibModule {
|
|
210
|
+
}
|
|
211
|
+
",
|
|
212
|
+
"/api/lib/src/lib/api-lib/dtos/test-table-page.dto.ts": "import { Expose, Type } from 'class-transformer';
|
|
213
|
+
import { IsArray, IsInstance, IsNumber, IsOptional, IsString } from 'class-validator';
|
|
214
|
+
import { TestTableRowDto } from './test-table-row.dto';
|
|
215
|
+
import { FilterQueryDto } from '@rxap/nest-dto';
|
|
216
|
+
|
|
217
|
+
export class TestTablePageDto {
|
|
218
|
+
@Expose()
|
|
219
|
+
@IsArray()
|
|
220
|
+
@Type(() => TestTableRowDto)
|
|
221
|
+
@IsInstance(TestTableRowDto, {
|
|
222
|
+
each: true
|
|
223
|
+
})
|
|
224
|
+
rows!: Array<TestTableRowDto>;
|
|
225
|
+
@Expose()
|
|
226
|
+
@IsNumber()
|
|
227
|
+
pageSize!: number;
|
|
228
|
+
@Expose()
|
|
229
|
+
@IsNumber()
|
|
230
|
+
pageIndex!: number;
|
|
231
|
+
@Expose()
|
|
232
|
+
@IsNumber()
|
|
233
|
+
total!: number;
|
|
234
|
+
@Expose()
|
|
235
|
+
@IsOptional()
|
|
236
|
+
@IsString()
|
|
237
|
+
sortDirection?: string;
|
|
238
|
+
@Expose()
|
|
239
|
+
@IsOptional()
|
|
240
|
+
@IsString()
|
|
241
|
+
sortBy?: string;
|
|
242
|
+
@Expose()
|
|
243
|
+
@IsArray()
|
|
244
|
+
@Type(() => FilterQueryDto)
|
|
245
|
+
@IsInstance(FilterQueryDto, {
|
|
246
|
+
each: true
|
|
247
|
+
})
|
|
248
|
+
@IsOptional()
|
|
249
|
+
filter?: Array<FilterQueryDto>;
|
|
250
|
+
}
|
|
251
|
+
",
|
|
252
|
+
"/api/lib/src/lib/api-lib/dtos/test-table-row.dto.ts": "import { Expose } from 'class-transformer';
|
|
253
|
+
import { IsString, IsNumber } from 'class-validator';
|
|
254
|
+
|
|
255
|
+
export class TestTableRowDto {
|
|
256
|
+
@Expose()
|
|
257
|
+
@IsString()
|
|
258
|
+
name!: string;
|
|
259
|
+
@Expose()
|
|
260
|
+
@IsNumber()
|
|
261
|
+
__rowId!: number;
|
|
262
|
+
}
|
|
263
|
+
",
|
|
264
|
+
"/api/lib/src/lib/api-lib/test-table.controller.ts": "import { Controller, DefaultValuePipe, Get, Query } from '@nestjs/common';
|
|
265
|
+
import { TestTableRowDto } from './dtos/test-table-row.dto';
|
|
266
|
+
import { TestTablePageDto } from './dtos/test-table-page.dto';
|
|
267
|
+
import { ToDtoInstance } from '@rxap/nest-dto';
|
|
268
|
+
import { FilterQuery, FilterQueryPipe } from '@rxap/nest-utilities';
|
|
269
|
+
import { ApiQuery } from '@nestjs/swagger';
|
|
270
|
+
|
|
271
|
+
@Controller('api-lib/test-table')
|
|
272
|
+
export class TestTableController {
|
|
273
|
+
public async getPageData(sortBy: string, sortDirection: string, pageSize: number, pageIndex: number, filter: FilterQuery[]): Promise<{
|
|
274
|
+
list: Array<RawRowData>,
|
|
275
|
+
total: number
|
|
276
|
+
}> {
|
|
277
|
+
return {
|
|
278
|
+
list: [],
|
|
279
|
+
total: 0,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
private toRowDto(item: RawRowData, index: number, pageIndex: number, pageSize: number, list: Array<RawRowData>): TestTableRowDto {
|
|
284
|
+
return {
|
|
285
|
+
__rowId: (pageIndex * pageSize + index),
|
|
286
|
+
|
|
287
|
+
name: item.name
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
private toPageDto(list: Array<RawRowData>, total: number, pageIndex: number, pageSize: number, sortBy: string, sortDirection: string, filter: FilterQuery[]): TestTablePageDto {
|
|
292
|
+
return {
|
|
293
|
+
total, pageIndex, pageSize, sortBy, sortDirection, filter,
|
|
294
|
+
rows: list.map((item, index) => this.toRowDto(item, index, pageIndex, pageSize, list))
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
@Get()
|
|
299
|
+
@ApiQuery({
|
|
300
|
+
name: 'pageIndex',
|
|
301
|
+
required: false,
|
|
302
|
+
isArray: false
|
|
303
|
+
})
|
|
304
|
+
@ApiQuery({
|
|
305
|
+
name: 'pageSize',
|
|
306
|
+
required: false,
|
|
307
|
+
isArray: false
|
|
308
|
+
})
|
|
309
|
+
@ApiQuery({
|
|
310
|
+
name: 'sortDirection',
|
|
311
|
+
required: false,
|
|
312
|
+
isArray: false
|
|
313
|
+
})
|
|
314
|
+
@ApiQuery({
|
|
315
|
+
name: 'sortBy',
|
|
316
|
+
required: false,
|
|
317
|
+
isArray: false
|
|
318
|
+
})
|
|
319
|
+
@ApiQuery({
|
|
320
|
+
name: 'filter',
|
|
321
|
+
required: false,
|
|
322
|
+
isArray: true
|
|
323
|
+
})
|
|
324
|
+
public async getPage(@Query('filter', new FilterQueryPipe()) filter: Array<FilterQuery>, @Query('pageIndex', new DefaultValuePipe(0)) pageIndex: number, @Query('pageSize', new DefaultValuePipe(5)) pageSize: number, @Query('sortBy', new DefaultValuePipe('__updatedAt')) sortBy: string, @Query('sortDirection', new DefaultValuePipe('desc')) sortDirection: string): Promise<TestTablePageDto> {
|
|
325
|
+
const data = await this.getPageData(sortBy, sortDirection, pageSize, pageIndex, filter);
|
|
326
|
+
return ToDtoInstance(
|
|
327
|
+
TestTablePageDto,
|
|
328
|
+
this.toPageDto(data.list, data.total, pageIndex, pageSize, sortBy, sortDirection, filter),
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
type RawRowData = any;
|
|
334
|
+
",
|
|
335
|
+
"/package.json": "{
|
|
336
|
+
"name": "workspace",
|
|
337
|
+
"dependencies": {
|
|
338
|
+
"@rxap/components": "19.0.0-dev.0",
|
|
339
|
+
"@rxap/data-source": "19.0.0-dev.0",
|
|
340
|
+
"@rxap/directives": "19.0.0-dev.0",
|
|
341
|
+
"@rxap/form-system": "19.0.0-dev.0",
|
|
342
|
+
"@rxap/forms": "19.0.0-dev.0",
|
|
343
|
+
"@rxap/material-directives": "19.0.0-dev.0",
|
|
344
|
+
"@rxap/material-form-system": "19.0.0-dev.1",
|
|
345
|
+
"@rxap/material-table-system": "19.0.0-dev.1",
|
|
346
|
+
"@rxap/mixin": "16.0.11-dev.0",
|
|
347
|
+
"@rxap/nest-dto": "10.3.7-dev.1",
|
|
348
|
+
"@rxap/pattern": "1.1.10-dev.0",
|
|
349
|
+
"@rxap/reflect-metadata": "1.0.12-dev.0",
|
|
350
|
+
"@rxap/rxjs": "1.1.11-dev.0",
|
|
351
|
+
"@rxap/utilities": "16.4.1-dev.0",
|
|
352
|
+
"@rxap/window-system": "19.0.0-dev.0"
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
",
|
|
356
|
+
"/ui/lib/src/lib/test-table/test-table.component.html": "<div class="flex flex-col gap-y-4 m-4">
|
|
357
|
+
|
|
358
|
+
<div class="table-card-container flex flex-col">
|
|
359
|
+
<mat-card>
|
|
360
|
+
<mat-progress-bar
|
|
361
|
+
rxapCardProgressBar
|
|
362
|
+
[loading$]="tableDataSourceDirective.loading$"
|
|
363
|
+
></mat-progress-bar>
|
|
364
|
+
<mat-card-header class="min-h-full h-12">
|
|
365
|
+
<mat-card-title i18n>Test Table</mat-card-title>
|
|
366
|
+
<rxap-table-column-menu
|
|
367
|
+
matCard
|
|
368
|
+
#rxapTableColumns="rxapTableColumns"
|
|
369
|
+
>
|
|
370
|
+
<rxap-table-column-option name="name"
|
|
371
|
+
>
|
|
372
|
+
<ng-container i18n>Name</ng-container>
|
|
373
|
+
</rxap-table-column-option>
|
|
374
|
+
</rxap-table-column-menu>
|
|
375
|
+
</mat-card-header>
|
|
376
|
+
|
|
377
|
+
<mat-card-content>
|
|
378
|
+
@if (tableDataSourceDirective.hasError$ | async) {
|
|
379
|
+
<rxap-data-source-error
|
|
380
|
+
[dataSourceLike]="tableDataSourceDirective">
|
|
381
|
+
</rxap-data-source-error>
|
|
382
|
+
}
|
|
383
|
+
<div class="table-scroll-container mt-4 overflow-x-auto overscroll-auto">
|
|
384
|
+
<table
|
|
385
|
+
[class.hidden]="tableDataSourceDirective.hasError$ | async"
|
|
386
|
+
mat-table
|
|
387
|
+
#tableDataSourceDirective="rxapTableDataSource"
|
|
388
|
+
rxapTableDataSource
|
|
389
|
+
[parameters]="parameters()"
|
|
390
|
+
id="test-table"
|
|
391
|
+
[paginator]="paginator"
|
|
392
|
+
>
|
|
393
|
+
<!-- region columns -->
|
|
394
|
+
<ng-container matColumnDef="name">
|
|
395
|
+
<th mat-header-cell
|
|
396
|
+
*matHeaderCellDef
|
|
397
|
+
>
|
|
398
|
+
<ng-container i18n>Name</ng-container>
|
|
399
|
+
</th>
|
|
400
|
+
<td *matCellDef="let element"
|
|
401
|
+
mat-cell
|
|
402
|
+
>
|
|
403
|
+
{{ element?.name }}
|
|
404
|
+
</td>
|
|
405
|
+
</ng-container>
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
<!-- endregion -->
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
<tr
|
|
413
|
+
mat-header-row
|
|
414
|
+
*matHeaderRowDef="rxapTableColumns.displayColumns()"
|
|
415
|
+
></tr>
|
|
416
|
+
|
|
417
|
+
<tr
|
|
418
|
+
[@rowsAnimation]=""
|
|
419
|
+
mat-row
|
|
420
|
+
[ngClass]="{ 'rxap-row-odd !bg-neutral-200 dark:!bg-neutral-600': odd, 'rxap-row-even': even }"
|
|
421
|
+
class="hover:!bg-neutral-400 dark:hover:!bg-neutral-800"
|
|
422
|
+
*matRowDef="
|
|
423
|
+
let element;
|
|
424
|
+
columns: rxapTableColumns.displayColumns();
|
|
425
|
+
let odd = odd;
|
|
426
|
+
let even = even
|
|
427
|
+
"
|
|
428
|
+
></tr>
|
|
429
|
+
</table>
|
|
430
|
+
</div>
|
|
431
|
+
</mat-card-content>
|
|
432
|
+
<mat-card-footer>
|
|
433
|
+
<mat-paginator
|
|
434
|
+
[class.hidden]="tableDataSourceDirective.hasError$ | async"
|
|
435
|
+
class="m-4"
|
|
436
|
+
rxapPersistent
|
|
437
|
+
[pageSizeOptions]="[5,10,25,50,100]"
|
|
438
|
+
[pageSize]="10"
|
|
439
|
+
#paginator="matPaginator"
|
|
440
|
+
></mat-paginator>
|
|
441
|
+
</mat-card-footer>
|
|
442
|
+
</mat-card>
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
",
|
|
446
|
+
"/ui/lib/src/lib/test-table/test-table.component.scss": "",
|
|
447
|
+
"/ui/lib/src/lib/test-table/test-table.component.ts": "import { Component, ChangeDetectionStrategy, input } from '@angular/core';
|
|
448
|
+
import { RowAnimation, TableColumnMenuComponent, TableColumnOptionComponent, PersistentPaginatorDirective, TableDataSourceDirective, TABLE_REMOTE_METHOD_ADAPTER_FACTORY, RXAP_TABLE_METHOD } from '@rxap/material-table-system';
|
|
449
|
+
import { Observable } from 'rxjs';
|
|
450
|
+
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
451
|
+
import { DataSourceErrorComponent } from '@rxap/data-source';
|
|
452
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
453
|
+
import { MatTableModule } from '@angular/material/table';
|
|
454
|
+
import { CardProgressBarDirective } from '@rxap/material-directives/card';
|
|
455
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
456
|
+
import { MatCardModule } from '@angular/material/card';
|
|
457
|
+
import { AsyncPipe, NgIf, NgClass } from '@angular/common';
|
|
458
|
+
import { GetPageAdapterFactory } from '@rxap/open-api/remote-method';
|
|
459
|
+
import { TestTableControllerGetPageRemoteMethod } from 'open-api-api-lib/src/lib/remote-methods';
|
|
460
|
+
|
|
461
|
+
@Component({
|
|
462
|
+
standalone: true,
|
|
463
|
+
selector: 'jest-test-table',
|
|
464
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
465
|
+
templateUrl: './test-table.component.html',
|
|
466
|
+
styleUrls: ['./test-table.component.scss'],
|
|
467
|
+
animations: [RowAnimation],
|
|
468
|
+
imports: [TableColumnMenuComponent, TableColumnOptionComponent, MatPaginatorModule, PersistentPaginatorDirective, DataSourceErrorComponent, MatDividerModule, TableDataSourceDirective, MatTableModule, CardProgressBarDirective, MatProgressBarModule, MatCardModule, AsyncPipe, NgIf, NgClass],
|
|
469
|
+
providers: [{
|
|
470
|
+
provide: TABLE_REMOTE_METHOD_ADAPTER_FACTORY,
|
|
471
|
+
useValue: GetPageAdapterFactory
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
provide: RXAP_TABLE_METHOD,
|
|
475
|
+
useExisting: TestTableControllerGetPageRemoteMethod
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
})
|
|
479
|
+
export class TestTableComponent {
|
|
480
|
+
public readonly parameters = input<Observable<Record<string, unknown>>>();
|
|
481
|
+
}
|
|
482
|
+
",
|
|
483
|
+
"/ui/lib/src/lib/test-table/test-table.ts": "import { TableRowMetadata } from '@rxap/material-table-system';
|
|
484
|
+
import { TestTableControllerGetPageResponse } from 'open-api-api-lib/src/lib/responses';
|
|
485
|
+
|
|
486
|
+
export type ITestTable = TableRowMetadata & TestTableControllerGetPageResponse['rows'][number];
|
|
487
|
+
",
|
|
488
|
+
}
|
|
489
|
+
`;
|
|
490
|
+
|
|
75
491
|
exports[`table-component nestjs backend: ui-lib.module.ts 1`] = `
|
|
76
492
|
"import { NgModule } from '@angular/core';
|
|
77
493
|
@NgModule({})
|
package/src/schematics/table/table-component/files/component/__componentName__.component.html.hbs
CHANGED
|
@@ -81,20 +81,21 @@
|
|
|
81
81
|
</mat-card-header>
|
|
82
82
|
|
|
83
83
|
<mat-card-content>
|
|
84
|
+
@if (tableDataSourceDirective.hasError$ | async) {
|
|
84
85
|
<rxap-data-source-error
|
|
85
|
-
*ngIf="tableDataSourceDirective.hasError$ | async"
|
|
86
86
|
[dataSourceLike]="tableDataSourceDirective">
|
|
87
87
|
</rxap-data-source-error>
|
|
88
|
+
}
|
|
88
89
|
<div class="table-scroll-container mt-4 overflow-x-auto overscroll-auto">
|
|
89
90
|
<table
|
|
90
|
-
[
|
|
91
|
+
[class.hidden]="tableDataSourceDirective.hasError$ | async"
|
|
91
92
|
mat-table
|
|
92
93
|
#tableDataSourceDirective="rxapTableDataSource"
|
|
93
94
|
{{#ifeq backend "data-source"}}
|
|
94
|
-
[dataSource]="dataSource"
|
|
95
|
+
[dataSource]="dataSource()"
|
|
95
96
|
{{/ifeq}}
|
|
96
97
|
rxapTableDataSource
|
|
97
|
-
[parameters]="parameters"
|
|
98
|
+
[parameters]="parameters()"
|
|
98
99
|
id="{{name}}"
|
|
99
100
|
{{#if cssClass}}
|
|
100
101
|
{{> cssClass cssClass=cssClass}}
|
|
@@ -144,6 +145,7 @@
|
|
|
144
145
|
<div class="flex flex-row" *rxapSelectedRows="let selected">
|
|
145
146
|
{{#each actionList}}
|
|
146
147
|
{{#if this.inHeader}}
|
|
148
|
+
@if (selected | rxapRowActionCheck:'{{this.type}}') {
|
|
147
149
|
<button
|
|
148
150
|
rxapTableRowHeaderAction="{{this.type}}"
|
|
149
151
|
mat-icon-button
|
|
@@ -153,7 +155,6 @@
|
|
|
153
155
|
{{#if this.cssClass}}
|
|
154
156
|
{{> cssClass cssClass=this.cssClass}}
|
|
155
157
|
{{/if}}
|
|
156
|
-
*ngIf="selected | rxapRowActionCheck:'{{this.type}}'"
|
|
157
158
|
{{#if this.permission}}
|
|
158
159
|
rxapHasEnablePermission="{{this.permission}}"
|
|
159
160
|
{{/if}}
|
|
@@ -171,6 +172,7 @@
|
|
|
171
172
|
mode="indeterminate"
|
|
172
173
|
></mat-progress-bar>
|
|
173
174
|
</button>
|
|
175
|
+
}
|
|
174
176
|
{{/if}}
|
|
175
177
|
{{/each}}
|
|
176
178
|
</div>
|
|
@@ -182,6 +184,7 @@
|
|
|
182
184
|
<td class="drop-shadow-2xl" mat-cell *matCellDef="let element">
|
|
183
185
|
<div class="flex flex-row">
|
|
184
186
|
{{#each actionList}}
|
|
187
|
+
@if (element | rxapRowActionCheck:'{{this.type}}') {
|
|
185
188
|
<button
|
|
186
189
|
rxapTableRowAction="{{this.type}}"
|
|
187
190
|
[element]="element"
|
|
@@ -192,7 +195,6 @@
|
|
|
192
195
|
{{> cssClass cssClass=this.cssClass}}
|
|
193
196
|
{{/if}}
|
|
194
197
|
mat-icon-button
|
|
195
|
-
*ngIf="element | rxapRowActionCheck:'{{this.type}}'"
|
|
196
198
|
{{#if this.permission}}
|
|
197
199
|
rxapHasEnablePermission="{{this.permission}}"
|
|
198
200
|
{{/if}}
|
|
@@ -210,6 +212,7 @@
|
|
|
210
212
|
mode="indeterminate"
|
|
211
213
|
></mat-progress-bar>
|
|
212
214
|
</button>
|
|
215
|
+
}
|
|
213
216
|
{{/each}}
|
|
214
217
|
</div>
|
|
215
218
|
</td>
|
|
@@ -224,7 +227,7 @@
|
|
|
224
227
|
<!-- endregion -->
|
|
225
228
|
{{#if hasCustomFilter}}
|
|
226
229
|
<ng-container matColumnDef="custom_filter">
|
|
227
|
-
<th *matHeaderCellDef [colSpan]="rxapTableColumns.displayColumns.length" mat-header-cell>
|
|
230
|
+
<th *matHeaderCellDef [colSpan]="rxapTableColumns.displayColumns().length" mat-header-cell>
|
|
228
231
|
<div class="flex flex-row gap-6">
|
|
229
232
|
{{#each filterList}}
|
|
230
233
|
{{ indent (compile this.handlebars control=this prefix=../prefix) 16 }}
|
|
@@ -271,14 +274,14 @@
|
|
|
271
274
|
<tr
|
|
272
275
|
class="rxap-filter-header"
|
|
273
276
|
mat-header-row
|
|
274
|
-
*matHeaderRowDef="rxapTableColumns.displayColumns | toFilterColumnNames"
|
|
277
|
+
*matHeaderRowDef="rxapTableColumns.displayColumns() | toFilterColumnNames"
|
|
275
278
|
></tr>
|
|
276
279
|
{{/if}}
|
|
277
280
|
|
|
278
281
|
{{#if withHeader}}
|
|
279
282
|
<tr
|
|
280
283
|
mat-header-row
|
|
281
|
-
*matHeaderRowDef="rxapTableColumns.displayColumns"
|
|
284
|
+
*matHeaderRowDef="rxapTableColumns.displayColumns()"
|
|
282
285
|
></tr>
|
|
283
286
|
{{/if}}
|
|
284
287
|
|
|
@@ -289,7 +292,7 @@
|
|
|
289
292
|
class="hover:!bg-neutral-400 dark:hover:!bg-neutral-800"
|
|
290
293
|
*matRowDef="
|
|
291
294
|
let element;
|
|
292
|
-
columns: rxapTableColumns.displayColumns;
|
|
295
|
+
columns: rxapTableColumns.displayColumns();
|
|
293
296
|
let odd = odd;
|
|
294
297
|
let even = even
|
|
295
298
|
"
|
|
@@ -300,7 +303,7 @@
|
|
|
300
303
|
{{#if hasPaginator}}
|
|
301
304
|
<mat-card-footer>
|
|
302
305
|
<mat-paginator
|
|
303
|
-
[
|
|
306
|
+
[class.hidden]="tableDataSourceDirective.hasError$ | async"
|
|
304
307
|
class="m-4"
|
|
305
308
|
rxapPersistent
|
|
306
309
|
[pageSizeOptions]="[5,10,25,50,100]"
|
|
@@ -33,7 +33,9 @@ function selectColumnRule(normalizedOptions) {
|
|
|
33
33
|
namedImports: ['RXAP_MATERIAL_TABLE_SYSTEM_SELECT_ROW_OPTIONS'],
|
|
34
34
|
},
|
|
35
35
|
]);
|
|
36
|
-
(
|
|
36
|
+
for (const name of ['CheckboxCellComponent', 'CheckboxHeaderCellComponent', 'SelectedRowsDirective']) {
|
|
37
|
+
(0, schematics_ts_morph_1.AddComponentImport)(sourceFile, name, '@rxap/material-table-system');
|
|
38
|
+
}
|
|
37
39
|
},
|
|
38
40
|
}),
|
|
39
41
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-column-rule.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/angular/src/schematics/table/table-component/select-column-rule.ts"],"names":[],"mappings":";;AAiBA,
|
|
1
|
+
{"version":3,"file":"select-column-rule.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/angular/src/schematics/table/table-component/select-column-rule.ts"],"names":[],"mappings":";;AAiBA,4CA4DC;AA7ED,2DAIoC;AACpC,mEAImC;AACnC,uCAIkB;AAGlB,SAAgB,gBAAgB,CAAC,iBAAkD;IAEjF,MAAM,EACJ,YAAY,EACZ,OAAO,EACP,OAAO,EACP,MAAM,EACN,aAAa,EACb,SAAS,EACT,SAAS,GACV,GAAG,iBAAiB,CAAC;IAEtB,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,yCAAmB,EAAC;gBAClB,OAAO;gBACP,OAAO;gBACP,MAAM;gBACN,IAAI,EAAE,aAAa;gBACnB,SAAS;gBACT,SAAS;gBACT,gBAAgB,EAAE,CAChB,OAAgB,EAChB,CAAE,UAAU,CAAkB,EAC9B,EAAE;oBACF,IAAA,0CAAoB,EAClB,UAAU,EACV,kBAAkB,EAClB;wBACE;4BACE,eAAe,EAAE,6BAA6B;4BAC9C,YAAY,EAAE,CAAE,kBAAkB,CAAE;yBACrC;qBACF,CACF,CAAC;oBACF,IAAA,0CAAoB,EAClB,UAAU,EACV;wBACE,OAAO,EAAE,+CAA+C;wBACxD,QAAQ,EAAE,kBAAO,CAAC,MAAM,CAAC;4BACvB,QAAQ,EAAE,MAAM;yBACjB,CAAC;qBACH,EACD;wBACE;4BACE,eAAe,EAAE,6BAA6B;4BAC9C,YAAY,EAAE,CAAE,+CAA+C,CAAE;yBAClE;qBACF,CACF,CAAC;oBACF,KAAK,MAAM,IAAI,IAAI,CAAE,uBAAuB,EAAE,6BAA6B,EAAE,uBAAuB,CAAE,EAAE,CAAC;wBACvG,IAAA,wCAAkB,EAAC,UAAU,EAAE,IAAI,EAAE,6BAA6B,CAAC,CAAC;oBACtE,CAAC;gBACH,CAAC;aACF,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAA,iBAAI,GAAE,CAAC;AAEhB,CAAC"}
|
|
@@ -16,12 +16,10 @@
|
|
|
16
16
|
{{> cssClass cssClass=column.cssClass}}
|
|
17
17
|
{{/if}}
|
|
18
18
|
>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
></
|
|
23
|
-
|
|
24
|
-
<div class="w-[15px] h-[15px]"></div>
|
|
25
|
-
</ng-template>
|
|
19
|
+
@if (element.__metadata__?.loading$ | async) {
|
|
20
|
+
<mat-spinner diameter="15"></mat-spinner>
|
|
21
|
+
} @else {
|
|
22
|
+
<div class="w-[15px] h-[15px]"></div>
|
|
23
|
+
}
|
|
26
24
|
</td>
|
|
27
25
|
{{/matColumnDef}}
|