ngwr 5.0.3 → 6.0.0
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/alert/public-api.d.ts +0 -1
- package/avatar/public-api.d.ts +0 -1
- package/button/public-api.d.ts +0 -1
- package/cdk/base.directive.d.ts +6 -1
- package/checkbox/public-api.d.ts +0 -1
- package/dialog/dialog.module.d.ts +1 -6
- package/divider/public-api.d.ts +0 -1
- package/dropdown/dropdown-menu-item.component.d.ts +12 -0
- package/dropdown/dropdown-menu.component.d.ts +14 -0
- package/dropdown/dropdown.directive.d.ts +29 -0
- package/dropdown/dropdown.types.d.ts +9 -0
- package/dropdown/index.d.ts +5 -0
- package/dropdown/public-api.d.ts +10 -0
- package/dropdown/styles/_index.scss +91 -0
- package/dropdown/styles/vars.scss +18 -0
- package/fesm2022/ngwr-alert.mjs +7 -27
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +7 -27
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +10 -31
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-cdk.mjs +9 -4
- package/fesm2022/ngwr-cdk.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +5 -24
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +130 -148
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-divider.mjs +5 -19
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +315 -0
- package/fesm2022/ngwr-dropdown.mjs.map +1 -0
- package/fesm2022/ngwr-form.mjs +8 -29
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +11 -31
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +8 -28
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +125 -0
- package/fesm2022/ngwr-pagination.mjs.map +1 -0
- package/fesm2022/ngwr-pipes.mjs +5 -25
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +6 -25
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +6 -25
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +405 -0
- package/fesm2022/ngwr-select.mjs.map +1 -0
- package/fesm2022/ngwr-skeleton.mjs +5 -19
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-spinner.mjs +16 -28
- package/fesm2022/ngwr-spinner.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +258 -0
- package/fesm2022/ngwr-table.mjs.map +1 -0
- package/fesm2022/ngwr-tag.mjs +7 -21
- package/fesm2022/ngwr-tag.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +6 -25
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/form/public-api.d.ts +0 -1
- package/icon/public-api.d.ts +0 -1
- package/input/public-api.d.ts +0 -1
- package/package.json +33 -5
- package/pagination/index.d.ts +5 -0
- package/pagination/pagination.component.d.ts +23 -0
- package/pagination/pagination.types.d.ts +7 -0
- package/pagination/public-api.d.ts +8 -0
- package/pagination/styles/_index.scss +60 -0
- package/pagination/styles/vars.scss +14 -0
- package/pipes/public-api.d.ts +0 -1
- package/progress/public-api.d.ts +0 -1
- package/qr/public-api.d.ts +0 -1
- package/select/index.d.ts +5 -0
- package/select/public-api.d.ts +10 -0
- package/select/select-option-group.component.d.ts +19 -0
- package/select/select-option.component.d.ts +22 -0
- package/select/select.component.d.ts +63 -0
- package/select/select.types.d.ts +17 -0
- package/select/styles/_index.scss +237 -0
- package/select/styles/vars.scss +32 -0
- package/skeleton/index.d.ts +0 -1
- package/spinner/index.d.ts +0 -1
- package/spinner/spinner.component.d.ts +4 -2
- package/spinner/spinner.types.d.ts +7 -0
- package/spinner/styles/_index.scss +10 -3
- package/styles.scss +4 -0
- package/table/index.d.ts +5 -0
- package/table/public-api.d.ts +11 -0
- package/table/styles/_index.scss +4 -0
- package/table/styles/table-filter.scss +202 -0
- package/table/styles/table-sort.scss +47 -0
- package/table/styles/table.scss +232 -0
- package/table/styles/vars.scss +21 -0
- package/table/table-cell/index.d.ts +7 -0
- package/table/table-cell/table-cell.directive.d.ts +8 -0
- package/table/table-filter/index.d.ts +7 -0
- package/table/table-filter/table-filter.component.d.ts +18 -0
- package/table/table-sort/index.d.ts +7 -0
- package/table/table-sort/table-sort.component.d.ts +8 -0
- package/table/table.component.d.ts +33 -0
- package/table/types/index.d.ts +6 -0
- package/table/types/table-cell-context.d.ts +6 -0
- package/table/types/table-columns.d.ts +7 -0
- package/table/types/table-filter-emit.d.ts +5 -0
- package/table/types/table-filter-item.d.ts +6 -0
- package/table/types/table-order-item.d.ts +5 -0
- package/table/types/table-order.enum.d.ts +5 -0
- package/tag/public-api.d.ts +0 -1
- package/textarea/public-api.d.ts +0 -1
- package/alert/alert.module.d.ts +0 -7
- package/avatar/avatar.module.d.ts +0 -7
- package/button/button.module.d.ts +0 -8
- package/checkbox/checkbox.module.d.ts +0 -7
- package/divider/divider.module.d.ts +0 -7
- package/form/form.module.d.ts +0 -8
- package/icon/icon.module.d.ts +0 -7
- package/input/input.module.d.ts +0 -7
- package/pipes/pipes.module.d.ts +0 -7
- package/progress/progress.module.d.ts +0 -7
- package/qr/qr.module.d.ts +0 -7
- package/skeleton/skeleton.module.d.ts +0 -7
- package/spinner/spinner.module.d.ts +0 -7
- package/tag/tag.module.d.ts +0 -7
- package/textarea/textarea.module.d.ts +0 -7
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { NgTemplateOutlet, KeyValuePipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { input, inject, TemplateRef, Directive, EventEmitter, signal, Component, ChangeDetectionStrategy, ViewEncapsulation, Output, numberAttribute, model, HostBinding, HostListener, ContentChildren } from '@angular/core';
|
|
4
|
+
import { WrDropdownDirective, WrDropdownMenuComponent } from 'ngwr/dropdown';
|
|
5
|
+
import { provideWrIcons, checkmark, filter, WrIconComponent, arrowTop, infoCircleOutline } from 'ngwr/icon';
|
|
6
|
+
import { WrPaginationComponent } from 'ngwr/pagination';
|
|
7
|
+
import { NewArrayPipe } from 'ngwr/pipes';
|
|
8
|
+
import { WrSpinnerComponent } from 'ngwr/spinner';
|
|
9
|
+
import * as i1 from '@angular/forms';
|
|
10
|
+
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
11
|
+
import { startWith } from 'rxjs';
|
|
12
|
+
import { takeUntil } from 'rxjs/operators';
|
|
13
|
+
import { WrAbstractBase } from 'ngwr/cdk';
|
|
14
|
+
|
|
15
|
+
var WrTableOrder;
|
|
16
|
+
(function (WrTableOrder) {
|
|
17
|
+
WrTableOrder[WrTableOrder["REMOVE"] = 0] = "REMOVE";
|
|
18
|
+
WrTableOrder[WrTableOrder["ASC"] = 1] = "ASC";
|
|
19
|
+
WrTableOrder[WrTableOrder["DESC"] = 2] = "DESC";
|
|
20
|
+
})(WrTableOrder || (WrTableOrder = {}));
|
|
21
|
+
|
|
22
|
+
class WrTableCellDirective {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.columnKey = input.required({ alias: 'wrTableCell' });
|
|
25
|
+
this.template = inject((TemplateRef));
|
|
26
|
+
}
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
28
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.5", type: WrTableCellDirective, isStandalone: true, selector: "[wrTableCell]", inputs: { columnKey: { classPropertyName: "columnKey", publicName: "wrTableCell", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
|
|
29
|
+
}
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableCellDirective, decorators: [{
|
|
31
|
+
type: Directive,
|
|
32
|
+
args: [{
|
|
33
|
+
selector: '[wrTableCell]',
|
|
34
|
+
}]
|
|
35
|
+
}] });
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
*
|
|
40
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
41
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
class WrTableFilterComponent extends WrAbstractBase {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.items = input.required();
|
|
48
|
+
this.selectedItems = new EventEmitter();
|
|
49
|
+
this.search = new FormControl(null, { nonNullable: true });
|
|
50
|
+
this.filteredItems = signal([]);
|
|
51
|
+
}
|
|
52
|
+
get length() {
|
|
53
|
+
return this.filteredItems().filter(i => i.isSelected).length;
|
|
54
|
+
}
|
|
55
|
+
ngOnInit() {
|
|
56
|
+
this.search.valueChanges
|
|
57
|
+
.pipe(startWith(null))
|
|
58
|
+
.pipe(takeUntil(this.destroyed$))
|
|
59
|
+
.subscribe(value => {
|
|
60
|
+
let filtered = [...this.items()];
|
|
61
|
+
if (value) {
|
|
62
|
+
filtered = this.items().filter(i => {
|
|
63
|
+
const searchValue = value.toLowerCase();
|
|
64
|
+
const itemTitle = i.title.toLowerCase();
|
|
65
|
+
const itemValue = i.value.toLowerCase();
|
|
66
|
+
const hasTitle = itemTitle.includes(searchValue);
|
|
67
|
+
const hasValue = itemValue.includes(searchValue);
|
|
68
|
+
return hasTitle || hasValue;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
this.filteredItems.set(filtered);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
onItemSelect(item) {
|
|
75
|
+
const array = this.filteredItems();
|
|
76
|
+
const index = array.findIndex(i => i === item);
|
|
77
|
+
array[index].isSelected = !array[index].isSelected;
|
|
78
|
+
this.getSelectedItems();
|
|
79
|
+
}
|
|
80
|
+
onResetClick() {
|
|
81
|
+
const array = [...this.filteredItems()];
|
|
82
|
+
array.map(i => (i.isSelected = false));
|
|
83
|
+
this.filteredItems.set(array);
|
|
84
|
+
this.selectedItems.emit([]);
|
|
85
|
+
}
|
|
86
|
+
getSelectedItems() {
|
|
87
|
+
const selected = this.filteredItems().filter(i => i.isSelected);
|
|
88
|
+
this.selectedItems.emit(selected);
|
|
89
|
+
}
|
|
90
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableFilterComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
91
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: WrTableFilterComponent, isStandalone: true, selector: "wr-table-filter", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selectedItems: "selectedItems" }, host: { properties: { "class.wr-table-filter--active": "length > 0" }, classAttribute: "wr-table-filter" }, providers: [provideWrIcons([checkmark, filter])], usesInheritance: true, ngImport: i0, template: "<div class=\"wr-table-filter-icon\" wrDropdown [dropdownMenu]=\"tableFilterDropdown\">\n <wr-icon class=\"wr-table-filter-icon__icon\" name=\"filter\" />\n</div>\n\n<wr-dropdown-menu #tableFilterDropdown=\"wrDropdownMenu\">\n <div class=\"wr-table-filter-dropdown\">\n <input class=\"wr-table-filter-dropdown__input\" [formControl]=\"search\" placeholder=\"\u041F\u043E\u0438\u0441\u043A...\" />\n\n <div class=\"wr-table-filter-dropdown__body\">\n @if (filteredItems(); as items) {\n @for (item of items; track $index) {\n <div\n class=\"wr-table-filter-dropdown-item\"\n [class.wr-table-filter-dropdown-item--selected]=\"item?.isSelected\"\n (click)=\"onItemSelect(item)\"\n >\n <div class=\"wr-table-filter-dropdown-item-check\">\n <wr-icon class=\"wr-table-filter-dropdown-item-check__icon\" name=\"checkmark\" />\n </div>\n <span class=\"wr-table-filter-dropdown-item__title\">{{ item?.title }}</span>\n </div>\n }\n\n @if (items.length < 1) {\n <div class=\"wr-table-filter-dropdown-empty\">\n <span class=\"wr-table-filter-dropdown-empty__title\">\u041D\u0435\u0442 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432</span>\n </div>\n }\n }\n </div>\n\n @if (length > 0) {\n <div class=\"wr-table-filter-dropdown__reset\" (click)=\"onResetClick()\">\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C</div>\n }\n </div>\n</wr-dropdown-menu>\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: WrIconComponent, selector: "wr-icon", inputs: ["name"] }, { kind: "directive", type: WrDropdownDirective, selector: "[wrDropdown]", inputs: ["dropdownMenu", "trigger", "position"] }, { kind: "component", type: WrDropdownMenuComponent, selector: "wr-dropdown-menu", exportAs: ["wrDropdownMenu"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
92
|
+
}
|
|
93
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableFilterComponent, decorators: [{
|
|
94
|
+
type: Component,
|
|
95
|
+
args: [{ selector: 'wr-table-filter', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [ReactiveFormsModule, WrIconComponent, WrDropdownDirective, WrDropdownMenuComponent], providers: [provideWrIcons([checkmark, filter])], host: {
|
|
96
|
+
class: 'wr-table-filter',
|
|
97
|
+
'[class.wr-table-filter--active]': 'length > 0',
|
|
98
|
+
}, template: "<div class=\"wr-table-filter-icon\" wrDropdown [dropdownMenu]=\"tableFilterDropdown\">\n <wr-icon class=\"wr-table-filter-icon__icon\" name=\"filter\" />\n</div>\n\n<wr-dropdown-menu #tableFilterDropdown=\"wrDropdownMenu\">\n <div class=\"wr-table-filter-dropdown\">\n <input class=\"wr-table-filter-dropdown__input\" [formControl]=\"search\" placeholder=\"\u041F\u043E\u0438\u0441\u043A...\" />\n\n <div class=\"wr-table-filter-dropdown__body\">\n @if (filteredItems(); as items) {\n @for (item of items; track $index) {\n <div\n class=\"wr-table-filter-dropdown-item\"\n [class.wr-table-filter-dropdown-item--selected]=\"item?.isSelected\"\n (click)=\"onItemSelect(item)\"\n >\n <div class=\"wr-table-filter-dropdown-item-check\">\n <wr-icon class=\"wr-table-filter-dropdown-item-check__icon\" name=\"checkmark\" />\n </div>\n <span class=\"wr-table-filter-dropdown-item__title\">{{ item?.title }}</span>\n </div>\n }\n\n @if (items.length < 1) {\n <div class=\"wr-table-filter-dropdown-empty\">\n <span class=\"wr-table-filter-dropdown-empty__title\">\u041D\u0435\u0442 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432</span>\n </div>\n }\n }\n </div>\n\n @if (length > 0) {\n <div class=\"wr-table-filter-dropdown__reset\" (click)=\"onResetClick()\">\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C</div>\n }\n </div>\n</wr-dropdown-menu>\n" }]
|
|
99
|
+
}], propDecorators: { selectedItems: [{
|
|
100
|
+
type: Output
|
|
101
|
+
}] } });
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @license
|
|
105
|
+
*
|
|
106
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
107
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
class WrTableSortComponent {
|
|
111
|
+
constructor() {
|
|
112
|
+
this.order = input();
|
|
113
|
+
this.TableOrder = WrTableOrder;
|
|
114
|
+
}
|
|
115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableSortComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
116
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: WrTableSortComponent, isStandalone: true, selector: "wr-table-sort", inputs: { order: { classPropertyName: "order", publicName: "order", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.wr-table-sort--asc": "order() === TableOrder.ASC", "class.wr-table-sort--desc": "order() === TableOrder.DESC" }, classAttribute: "wr-table-sort" }, providers: [provideWrIcons([arrowTop])], ngImport: i0, template: "<wr-icon class=\"wr-table-sort__icon\" name=\"arrow-top\" />\n", dependencies: [{ kind: "component", type: WrIconComponent, selector: "wr-icon", inputs: ["name"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
117
|
+
}
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableSortComponent, decorators: [{
|
|
119
|
+
type: Component,
|
|
120
|
+
args: [{ selector: 'wr-table-sort', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [provideWrIcons([arrowTop])], imports: [WrIconComponent], host: {
|
|
121
|
+
class: 'wr-table-sort',
|
|
122
|
+
'[class.wr-table-sort--asc]': 'order() === TableOrder.ASC',
|
|
123
|
+
'[class.wr-table-sort--desc]': 'order() === TableOrder.DESC',
|
|
124
|
+
}, template: "<wr-icon class=\"wr-table-sort__icon\" name=\"arrow-top\" />\n" }]
|
|
125
|
+
}] });
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @license
|
|
129
|
+
*
|
|
130
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
131
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
class WrTableComponent {
|
|
135
|
+
constructor() {
|
|
136
|
+
this.columns = input.required();
|
|
137
|
+
this.items = input.required();
|
|
138
|
+
this.loading = input();
|
|
139
|
+
this.pagination = input(false);
|
|
140
|
+
this.total = input(1, { transform: numberAttribute });
|
|
141
|
+
this.currentPage = model(1);
|
|
142
|
+
this.pageSize = model(15);
|
|
143
|
+
this.pageSizeOptions = input([15, 25, 50]);
|
|
144
|
+
this.ordering = model();
|
|
145
|
+
this.filterChange = new EventEmitter();
|
|
146
|
+
this.cellTemplates = new Map();
|
|
147
|
+
/**
|
|
148
|
+
* We need to pass null to save original order for keyvalue pipe
|
|
149
|
+
* https://angular.dev/api/common/KeyValuePipe?tab=description
|
|
150
|
+
*/
|
|
151
|
+
this.keepOrder = () => null;
|
|
152
|
+
}
|
|
153
|
+
get styles() {
|
|
154
|
+
return {
|
|
155
|
+
'--wr-table-columns': Object.keys(this.columns).length,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
onKeypress(evt) {
|
|
159
|
+
const isCtrl = evt.ctrlKey;
|
|
160
|
+
const isPeriod = evt.code === 'Period';
|
|
161
|
+
const isComma = evt.code === 'Comma';
|
|
162
|
+
if (isCtrl && isPeriod) {
|
|
163
|
+
const totalPages = Math.ceil(this.total() / this.pageSize());
|
|
164
|
+
if (this.currentPage() < totalPages) {
|
|
165
|
+
this.currentPage.update(value => ++value);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (isCtrl && isComma) {
|
|
169
|
+
if (this.currentPage() > 1) {
|
|
170
|
+
this.currentPage.update(value => --value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
ngAfterContentInit() {
|
|
175
|
+
this.customCells?.forEach(cell => {
|
|
176
|
+
this.cellTemplates.set(cell.columnKey(), cell.template);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
getCellTemplate(columnKey) {
|
|
180
|
+
return this.cellTemplates.get(columnKey) || null;
|
|
181
|
+
}
|
|
182
|
+
hasCellTemplate(columnKey) {
|
|
183
|
+
return this.cellTemplates.has(columnKey);
|
|
184
|
+
}
|
|
185
|
+
getOrder(key) {
|
|
186
|
+
return this.ordering()?.find(o => o.key === key)?.order ?? WrTableOrder.REMOVE;
|
|
187
|
+
}
|
|
188
|
+
onOrderChange(key) {
|
|
189
|
+
const item = this.ordering()?.find(o => o.key === key);
|
|
190
|
+
let order;
|
|
191
|
+
switch (item?.order) {
|
|
192
|
+
case WrTableOrder.ASC:
|
|
193
|
+
order = WrTableOrder.DESC;
|
|
194
|
+
break;
|
|
195
|
+
case WrTableOrder.DESC:
|
|
196
|
+
order = WrTableOrder.REMOVE;
|
|
197
|
+
break;
|
|
198
|
+
default:
|
|
199
|
+
order = WrTableOrder.ASC;
|
|
200
|
+
}
|
|
201
|
+
const orderingItem = {
|
|
202
|
+
key,
|
|
203
|
+
order,
|
|
204
|
+
};
|
|
205
|
+
this.ordering.update(ordering => {
|
|
206
|
+
const orderingMap = new Map(ordering?.map(item => [item.key, item]) ?? []);
|
|
207
|
+
orderingMap.set(key, orderingItem);
|
|
208
|
+
return Array.from(orderingMap.values());
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
onFilterChange(key, items) {
|
|
212
|
+
this.filterChange.emit({ key, items });
|
|
213
|
+
}
|
|
214
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
215
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: WrTableComponent, isStandalone: true, selector: "wr-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, currentPage: { classPropertyName: "currentPage", publicName: "currentPage", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizeOptions: { classPropertyName: "pageSizeOptions", publicName: "pageSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, ordering: { classPropertyName: "ordering", publicName: "ordering", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { currentPage: "currentPageChange", pageSize: "pageSizeChange", ordering: "orderingChange", filterChange: "filterChange" }, host: { listeners: { "document:keydown": "onKeypress($event)" }, properties: { "style": "this.styles" }, classAttribute: "wr-table" }, providers: [provideWrIcons([infoCircleOutline])], queries: [{ propertyName: "customCells", predicate: WrTableCellDirective }], ngImport: i0, template: "@if (pagination()) {\n <div class=\"wr-table-top\">\n @if (loading()) {\n <wr-spinner class=\"wr-table__spinner\" />\n }\n\n <div class=\"wr-table-hint\" wrDropdown [dropdownMenu]=\"tablePaginationHelpDropdown\">\n <wr-icon class=\"wr-table-hint__icon\" name=\"info-circle-outline\" />\n </div>\n\n <ng-template [ngTemplateOutlet]=\"tablePagination\" />\n </div>\n}\n\n<div class=\"wr-table-head\">\n <div class=\"wr-table-head__wrapper\">\n @for (item of columns() | keyvalue: keepOrder; track item.key) {\n @if (item.value; as column) {\n <div class=\"wr-table-head-cell\">\n <span class=\"wr-table-head-cell__title\">{{ column.title }}</span>\n\n @if (column.sortable) {\n <wr-table-sort [order]=\"getOrder(item.key)\" (click)=\"onOrderChange(item.key)\" />\n }\n @if (column.filterItems && column.filterItems.length > 0) {\n <wr-table-filter [items]=\"column.filterItems\" (selectedItems)=\"onFilterChange(item.key, $event)\" />\n }\n </div>\n }\n }\n </div>\n</div>\n\n<div class=\"wr-table-body\">\n @if (items()?.length) {\n @for (item of items(); track $index) {\n <div class=\"wr-table-body__row\">\n @for (column of columns() | keyvalue: keepOrder; track column.key) {\n <div class=\"wr-table-body-cell\">\n @if (hasCellTemplate(column.key)) {\n <ng-container\n [ngTemplateOutlet]=\"getCellTemplate(column.key)!\"\n [ngTemplateOutletContext]=\"{\n $implicit: item[column.key],\n item: item,\n column: column.value,\n }\"\n />\n } @else {\n <span>{{ item[column.key] }}</span>\n }\n </div>\n }\n </div>\n }\n } @else {\n <div class=\"wr-table-body__loader\">\n <wr-spinner size=\"large\"></wr-spinner>\n </div>\n\n @for (i of pageSize() | newArray; track $index) {\n <div class=\"wr-table-body__row\">\n @for (column of columns() | keyvalue; track column.key) {\n <div class=\"wr-table-body-item\">\n <span> </span>\n </div>\n }\n </div>\n }\n }\n</div>\n\n@if (pagination()) {\n <div class=\"wr-table-bot\">\n <ng-template [ngTemplateOutlet]=\"tablePagination\" />\n </div>\n}\n\n<ng-template #tablePagination>\n <wr-pagination\n class=\"wr-table__pagination\"\n [showSizeChanger]=\"true\"\n [disabled]=\"!!loading()\"\n [total]=\"total()\"\n [(currentPage)]=\"currentPage\"\n [(pageSize)]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n />\n</ng-template>\n\n<wr-dropdown-menu #tablePaginationHelpDropdown=\"wrDropdownMenu\">\n <div class=\"wr-table-hint-dropdown\">\n <div class=\"wr-table-hint-dropdown-item\">\n <span class=\"wr-table-hint-dropdown-item__title\">Next:</span>\n <div class=\"wr-table-hint-dropdown-item__keys\">\n <span class=\"wr-table-hint-dropdown-item__key\">Ctrl</span>\n <span>+</span>\n <span class=\"wr-table-hint-dropdown-item__key\">{{ '>' }}</span>\n </div>\n </div>\n\n <div class=\"wr-table-hint-dropdown-item\">\n <span class=\"wr-table-hint-dropdown-item__title\">Prev:</span>\n <div class=\"wr-table-hint-dropdown-item__keys\">\n <span class=\"wr-table-hint-dropdown-item__key\">Ctrl</span>\n <span>+</span>\n <span class=\"wr-table-hint-dropdown-item__key\">{{ '<' }}</span>\n </div>\n </div>\n </div>\n</wr-dropdown-menu>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: NewArrayPipe, name: "newArray" }, { kind: "component", type: WrIconComponent, selector: "wr-icon", inputs: ["name"] }, { kind: "component", type: WrSpinnerComponent, selector: "wr-spinner", inputs: ["size"] }, { kind: "directive", type: WrDropdownDirective, selector: "[wrDropdown]", inputs: ["dropdownMenu", "trigger", "position"] }, { kind: "component", type: WrDropdownMenuComponent, selector: "wr-dropdown-menu", exportAs: ["wrDropdownMenu"] }, { kind: "component", type: WrPaginationComponent, selector: "wr-pagination", inputs: ["currentPage", "total", "pageSize", "pageSizeOptions", "showSizeChanger", "showTotal", "position", "disabled", "ofLabel"], outputs: ["currentPageChange", "pageSizeChange"] }, { kind: "component", type: WrTableSortComponent, selector: "wr-table-sort", inputs: ["order"] }, { kind: "component", type: WrTableFilterComponent, selector: "wr-table-filter", inputs: ["items"], outputs: ["selectedItems"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
216
|
+
}
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTableComponent, decorators: [{
|
|
218
|
+
type: Component,
|
|
219
|
+
args: [{ selector: 'wr-table', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
220
|
+
NgTemplateOutlet,
|
|
221
|
+
KeyValuePipe,
|
|
222
|
+
NewArrayPipe,
|
|
223
|
+
WrIconComponent,
|
|
224
|
+
WrSpinnerComponent,
|
|
225
|
+
WrDropdownDirective,
|
|
226
|
+
WrDropdownMenuComponent,
|
|
227
|
+
WrPaginationComponent,
|
|
228
|
+
WrTableSortComponent,
|
|
229
|
+
WrTableFilterComponent,
|
|
230
|
+
], providers: [provideWrIcons([infoCircleOutline])], host: {
|
|
231
|
+
class: 'wr-table',
|
|
232
|
+
}, template: "@if (pagination()) {\n <div class=\"wr-table-top\">\n @if (loading()) {\n <wr-spinner class=\"wr-table__spinner\" />\n }\n\n <div class=\"wr-table-hint\" wrDropdown [dropdownMenu]=\"tablePaginationHelpDropdown\">\n <wr-icon class=\"wr-table-hint__icon\" name=\"info-circle-outline\" />\n </div>\n\n <ng-template [ngTemplateOutlet]=\"tablePagination\" />\n </div>\n}\n\n<div class=\"wr-table-head\">\n <div class=\"wr-table-head__wrapper\">\n @for (item of columns() | keyvalue: keepOrder; track item.key) {\n @if (item.value; as column) {\n <div class=\"wr-table-head-cell\">\n <span class=\"wr-table-head-cell__title\">{{ column.title }}</span>\n\n @if (column.sortable) {\n <wr-table-sort [order]=\"getOrder(item.key)\" (click)=\"onOrderChange(item.key)\" />\n }\n @if (column.filterItems && column.filterItems.length > 0) {\n <wr-table-filter [items]=\"column.filterItems\" (selectedItems)=\"onFilterChange(item.key, $event)\" />\n }\n </div>\n }\n }\n </div>\n</div>\n\n<div class=\"wr-table-body\">\n @if (items()?.length) {\n @for (item of items(); track $index) {\n <div class=\"wr-table-body__row\">\n @for (column of columns() | keyvalue: keepOrder; track column.key) {\n <div class=\"wr-table-body-cell\">\n @if (hasCellTemplate(column.key)) {\n <ng-container\n [ngTemplateOutlet]=\"getCellTemplate(column.key)!\"\n [ngTemplateOutletContext]=\"{\n $implicit: item[column.key],\n item: item,\n column: column.value,\n }\"\n />\n } @else {\n <span>{{ item[column.key] }}</span>\n }\n </div>\n }\n </div>\n }\n } @else {\n <div class=\"wr-table-body__loader\">\n <wr-spinner size=\"large\"></wr-spinner>\n </div>\n\n @for (i of pageSize() | newArray; track $index) {\n <div class=\"wr-table-body__row\">\n @for (column of columns() | keyvalue; track column.key) {\n <div class=\"wr-table-body-item\">\n <span> </span>\n </div>\n }\n </div>\n }\n }\n</div>\n\n@if (pagination()) {\n <div class=\"wr-table-bot\">\n <ng-template [ngTemplateOutlet]=\"tablePagination\" />\n </div>\n}\n\n<ng-template #tablePagination>\n <wr-pagination\n class=\"wr-table__pagination\"\n [showSizeChanger]=\"true\"\n [disabled]=\"!!loading()\"\n [total]=\"total()\"\n [(currentPage)]=\"currentPage\"\n [(pageSize)]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n />\n</ng-template>\n\n<wr-dropdown-menu #tablePaginationHelpDropdown=\"wrDropdownMenu\">\n <div class=\"wr-table-hint-dropdown\">\n <div class=\"wr-table-hint-dropdown-item\">\n <span class=\"wr-table-hint-dropdown-item__title\">Next:</span>\n <div class=\"wr-table-hint-dropdown-item__keys\">\n <span class=\"wr-table-hint-dropdown-item__key\">Ctrl</span>\n <span>+</span>\n <span class=\"wr-table-hint-dropdown-item__key\">{{ '>' }}</span>\n </div>\n </div>\n\n <div class=\"wr-table-hint-dropdown-item\">\n <span class=\"wr-table-hint-dropdown-item__title\">Prev:</span>\n <div class=\"wr-table-hint-dropdown-item__keys\">\n <span class=\"wr-table-hint-dropdown-item__key\">Ctrl</span>\n <span>+</span>\n <span class=\"wr-table-hint-dropdown-item__key\">{{ '<' }}</span>\n </div>\n </div>\n </div>\n</wr-dropdown-menu>\n" }]
|
|
233
|
+
}], propDecorators: { filterChange: [{
|
|
234
|
+
type: Output
|
|
235
|
+
}], styles: [{
|
|
236
|
+
type: HostBinding,
|
|
237
|
+
args: ['style']
|
|
238
|
+
}], onKeypress: [{
|
|
239
|
+
type: HostListener,
|
|
240
|
+
args: ['document:keydown', ['$event']]
|
|
241
|
+
}], customCells: [{
|
|
242
|
+
type: ContentChildren,
|
|
243
|
+
args: [WrTableCellDirective]
|
|
244
|
+
}] } });
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @license
|
|
248
|
+
*
|
|
249
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
250
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Generated bundle index. Do not edit.
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
export { WrTableCellDirective, WrTableComponent, WrTableFilterComponent, WrTableOrder, WrTableSortComponent };
|
|
258
|
+
//# sourceMappingURL=ngwr-table.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngwr-table.mjs","sources":["../../../projects/lib/table/types/table-order.enum.ts","../../../projects/lib/table/table-cell/table-cell.directive.ts","../../../projects/lib/table/table-cell/index.ts","../../../projects/lib/table/table-filter/table-filter.component.ts","../../../projects/lib/table/table-filter/table-filter.component.html","../../../projects/lib/table/table-filter/index.ts","../../../projects/lib/table/table-sort/table-sort.component.ts","../../../projects/lib/table/table-sort/table-sort.component.html","../../../projects/lib/table/table-sort/index.ts","../../../projects/lib/table/table.component.ts","../../../projects/lib/table/table.component.html","../../../projects/lib/table/public-api.ts","../../../projects/lib/table/ngwr-table.ts"],"sourcesContent":["export enum WrTableOrder {\n REMOVE,\n ASC,\n DESC,\n}\n","import { Directive, inject, input, TemplateRef } from '@angular/core';\n\nimport { WrTableCellContext } from '../types';\n\n@Directive({\n selector: '[wrTableCell]',\n})\nexport class WrTableCellDirective {\n columnKey = input.required<string>({ alias: 'wrTableCell' });\n\n template = inject(TemplateRef<WrTableCellContext>);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './table-cell.directive';\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n input,\n OnInit,\n Output,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\n\nimport { startWith } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { WrAbstractBase } from 'ngwr/cdk';\nimport { WrDropdownDirective, WrDropdownMenuComponent } from 'ngwr/dropdown';\nimport { checkmark, filter as filterIcon, provideWrIcons, WrIconComponent } from 'ngwr/icon';\n\nimport { WrTableFilterItem } from '../types';\n\n@Component({\n selector: 'wr-table-filter',\n templateUrl: './table-filter.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [ReactiveFormsModule, WrIconComponent, WrDropdownDirective, WrDropdownMenuComponent],\n providers: [provideWrIcons([checkmark, filterIcon])],\n host: {\n class: 'wr-table-filter',\n '[class.wr-table-filter--active]': 'length > 0',\n },\n})\nexport class WrTableFilterComponent extends WrAbstractBase implements OnInit {\n items = input.required<WrTableFilterItem[]>();\n\n @Output()\n readonly selectedItems = new EventEmitter<WrTableFilterItem[]>();\n\n protected readonly search = new FormControl<string | null>(null, { nonNullable: true });\n protected readonly filteredItems = signal<WrTableFilterItem[]>([]);\n\n protected get length(): number {\n return this.filteredItems().filter(i => i.isSelected).length;\n }\n\n ngOnInit(): void {\n this.search.valueChanges\n .pipe(startWith(null))\n .pipe(takeUntil(this.destroyed$))\n .subscribe(value => {\n let filtered = [...this.items()];\n if (value) {\n filtered = this.items().filter(i => {\n const searchValue = value.toLowerCase();\n\n const itemTitle = i.title.toLowerCase();\n const itemValue = i.value.toLowerCase();\n\n const hasTitle = itemTitle.includes(searchValue);\n const hasValue = itemValue.includes(searchValue);\n\n return hasTitle || hasValue;\n });\n }\n this.filteredItems.set(filtered);\n });\n }\n\n onItemSelect(item: WrTableFilterItem): void {\n const array = this.filteredItems();\n const index = array.findIndex(i => i === item);\n array[index].isSelected = !array[index].isSelected;\n this.getSelectedItems();\n }\n\n onResetClick(): void {\n const array = [...this.filteredItems()];\n array.map(i => (i.isSelected = false));\n this.filteredItems.set(array);\n this.selectedItems.emit([]);\n }\n\n getSelectedItems(): void {\n const selected = this.filteredItems().filter(i => i.isSelected);\n this.selectedItems.emit(selected);\n }\n}\n","<div class=\"wr-table-filter-icon\" wrDropdown [dropdownMenu]=\"tableFilterDropdown\">\n <wr-icon class=\"wr-table-filter-icon__icon\" name=\"filter\" />\n</div>\n\n<wr-dropdown-menu #tableFilterDropdown=\"wrDropdownMenu\">\n <div class=\"wr-table-filter-dropdown\">\n <input class=\"wr-table-filter-dropdown__input\" [formControl]=\"search\" placeholder=\"Поиск...\" />\n\n <div class=\"wr-table-filter-dropdown__body\">\n @if (filteredItems(); as items) {\n @for (item of items; track $index) {\n <div\n class=\"wr-table-filter-dropdown-item\"\n [class.wr-table-filter-dropdown-item--selected]=\"item?.isSelected\"\n (click)=\"onItemSelect(item)\"\n >\n <div class=\"wr-table-filter-dropdown-item-check\">\n <wr-icon class=\"wr-table-filter-dropdown-item-check__icon\" name=\"checkmark\" />\n </div>\n <span class=\"wr-table-filter-dropdown-item__title\">{{ item?.title }}</span>\n </div>\n }\n\n @if (items.length < 1) {\n <div class=\"wr-table-filter-dropdown-empty\">\n <span class=\"wr-table-filter-dropdown-empty__title\">Нет элементов</span>\n </div>\n }\n }\n </div>\n\n @if (length > 0) {\n <div class=\"wr-table-filter-dropdown__reset\" (click)=\"onResetClick()\">Сбросить</div>\n }\n </div>\n</wr-dropdown-menu>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './table-filter.component';\n","import { ChangeDetectionStrategy, Component, input, ViewEncapsulation } from '@angular/core';\n\nimport { arrowTop, provideWrIcons, WrIconComponent } from 'ngwr/icon';\n\nimport { WrTableOrder } from '../types';\n\n@Component({\n selector: 'wr-table-sort',\n templateUrl: './table-sort.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [provideWrIcons([arrowTop])],\n imports: [WrIconComponent],\n host: {\n class: 'wr-table-sort',\n '[class.wr-table-sort--asc]': 'order() === TableOrder.ASC',\n '[class.wr-table-sort--desc]': 'order() === TableOrder.DESC',\n },\n})\nexport class WrTableSortComponent {\n order = input<WrTableOrder>();\n\n protected readonly TableOrder = WrTableOrder;\n}\n","<wr-icon class=\"wr-table-sort__icon\" name=\"arrow-top\" />\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './table-sort.component';\n","import { KeyValuePipe, NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n EventEmitter,\n HostBinding,\n HostListener,\n numberAttribute,\n Output,\n QueryList,\n TemplateRef,\n ViewEncapsulation,\n AfterContentInit,\n input,\n model,\n} from '@angular/core';\n\nimport { SafeAny } from 'ngwr/cdk/types';\nimport { WrDropdownDirective, WrDropdownMenuComponent } from 'ngwr/dropdown';\nimport { infoCircleOutline, provideWrIcons, WrIconComponent } from 'ngwr/icon';\nimport { WrPaginationComponent } from 'ngwr/pagination';\nimport { NewArrayPipe } from 'ngwr/pipes';\nimport { WrSpinnerComponent } from 'ngwr/spinner';\n\nimport { WrTableCellDirective } from './table-cell';\nimport { WrTableFilterComponent } from './table-filter';\nimport { WrTableSortComponent } from './table-sort';\nimport {\n WrTableCellContext,\n WrTableColumns,\n WrTableFilterEmit,\n WrTableFilterItem,\n WrTableOrder,\n WrTableOrderItem,\n} from './types';\n\n@Component({\n selector: 'wr-table',\n templateUrl: './table.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n NgTemplateOutlet,\n KeyValuePipe,\n NewArrayPipe,\n WrIconComponent,\n WrSpinnerComponent,\n WrDropdownDirective,\n WrDropdownMenuComponent,\n WrPaginationComponent,\n WrTableSortComponent,\n WrTableFilterComponent,\n ],\n providers: [provideWrIcons([infoCircleOutline])],\n host: {\n class: 'wr-table',\n },\n})\nexport class WrTableComponent implements AfterContentInit {\n columns = input.required<WrTableColumns>();\n items = input.required<SafeAny[] | undefined>();\n loading = input<boolean>();\n pagination = input<boolean>(false);\n total = input<number, number>(1, { transform: numberAttribute });\n currentPage = model<number>(1);\n pageSize = model<number>(15);\n pageSizeOptions = input<number[]>([15, 25, 50]);\n ordering = model<WrTableOrderItem[]>();\n\n @Output() readonly filterChange = new EventEmitter<WrTableFilterEmit>();\n\n @HostBinding('style')\n get styles(): Record<string, string | number> {\n return {\n '--wr-table-columns': Object.keys(this.columns).length,\n };\n }\n\n @HostListener('document:keydown', ['$event'])\n onKeypress(evt: KeyboardEvent): void {\n const isCtrl = evt.ctrlKey;\n const isPeriod = evt.code === 'Period';\n const isComma = evt.code === 'Comma';\n\n if (isCtrl && isPeriod) {\n const totalPages = Math.ceil(this.total() / this.pageSize());\n\n if (this.currentPage() < totalPages) {\n this.currentPage.update(value => ++value);\n }\n }\n\n if (isCtrl && isComma) {\n if (this.currentPage() > 1) {\n this.currentPage.update(value => --value);\n }\n }\n }\n\n @ContentChildren(WrTableCellDirective)\n private customCells: QueryList<WrTableCellDirective> | undefined;\n\n private cellTemplates = new Map<string, TemplateRef<WrTableCellContext>>();\n\n ngAfterContentInit(): void {\n this.customCells?.forEach(cell => {\n this.cellTemplates.set(cell.columnKey(), cell.template);\n });\n }\n\n protected getCellTemplate(columnKey: string): TemplateRef<WrTableCellContext> | null {\n return this.cellTemplates.get(columnKey) || null;\n }\n\n protected hasCellTemplate(columnKey: string): boolean {\n return this.cellTemplates.has(columnKey);\n }\n\n /**\n * We need to pass null to save original order for keyvalue pipe\n * https://angular.dev/api/common/KeyValuePipe?tab=description\n */\n protected readonly keepOrder = (): SafeAny => null;\n\n protected getOrder(key: string): WrTableOrder {\n return this.ordering()?.find(o => o.key === key)?.order ?? WrTableOrder.REMOVE;\n }\n\n protected onOrderChange(key: string): void {\n const item = this.ordering()?.find(o => o.key === key);\n\n let order: WrTableOrder;\n switch (item?.order) {\n case WrTableOrder.ASC:\n order = WrTableOrder.DESC;\n break;\n case WrTableOrder.DESC:\n order = WrTableOrder.REMOVE;\n break;\n default:\n order = WrTableOrder.ASC;\n }\n\n const orderingItem: WrTableOrderItem = {\n key,\n order,\n };\n\n this.ordering.update(ordering => {\n const orderingMap = new Map(ordering?.map(item => [item.key, item]) ?? []);\n orderingMap.set(key, orderingItem);\n return Array.from(orderingMap.values());\n });\n }\n\n protected onFilterChange(key: string, items: WrTableFilterItem[]): void {\n this.filterChange.emit({ key, items });\n }\n}\n","@if (pagination()) {\n <div class=\"wr-table-top\">\n @if (loading()) {\n <wr-spinner class=\"wr-table__spinner\" />\n }\n\n <div class=\"wr-table-hint\" wrDropdown [dropdownMenu]=\"tablePaginationHelpDropdown\">\n <wr-icon class=\"wr-table-hint__icon\" name=\"info-circle-outline\" />\n </div>\n\n <ng-template [ngTemplateOutlet]=\"tablePagination\" />\n </div>\n}\n\n<div class=\"wr-table-head\">\n <div class=\"wr-table-head__wrapper\">\n @for (item of columns() | keyvalue: keepOrder; track item.key) {\n @if (item.value; as column) {\n <div class=\"wr-table-head-cell\">\n <span class=\"wr-table-head-cell__title\">{{ column.title }}</span>\n\n @if (column.sortable) {\n <wr-table-sort [order]=\"getOrder(item.key)\" (click)=\"onOrderChange(item.key)\" />\n }\n @if (column.filterItems && column.filterItems.length > 0) {\n <wr-table-filter [items]=\"column.filterItems\" (selectedItems)=\"onFilterChange(item.key, $event)\" />\n }\n </div>\n }\n }\n </div>\n</div>\n\n<div class=\"wr-table-body\">\n @if (items()?.length) {\n @for (item of items(); track $index) {\n <div class=\"wr-table-body__row\">\n @for (column of columns() | keyvalue: keepOrder; track column.key) {\n <div class=\"wr-table-body-cell\">\n @if (hasCellTemplate(column.key)) {\n <ng-container\n [ngTemplateOutlet]=\"getCellTemplate(column.key)!\"\n [ngTemplateOutletContext]=\"{\n $implicit: item[column.key],\n item: item,\n column: column.value,\n }\"\n />\n } @else {\n <span>{{ item[column.key] }}</span>\n }\n </div>\n }\n </div>\n }\n } @else {\n <div class=\"wr-table-body__loader\">\n <wr-spinner size=\"large\"></wr-spinner>\n </div>\n\n @for (i of pageSize() | newArray; track $index) {\n <div class=\"wr-table-body__row\">\n @for (column of columns() | keyvalue; track column.key) {\n <div class=\"wr-table-body-item\">\n <span> </span>\n </div>\n }\n </div>\n }\n }\n</div>\n\n@if (pagination()) {\n <div class=\"wr-table-bot\">\n <ng-template [ngTemplateOutlet]=\"tablePagination\" />\n </div>\n}\n\n<ng-template #tablePagination>\n <wr-pagination\n class=\"wr-table__pagination\"\n [showSizeChanger]=\"true\"\n [disabled]=\"!!loading()\"\n [total]=\"total()\"\n [(currentPage)]=\"currentPage\"\n [(pageSize)]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n />\n</ng-template>\n\n<wr-dropdown-menu #tablePaginationHelpDropdown=\"wrDropdownMenu\">\n <div class=\"wr-table-hint-dropdown\">\n <div class=\"wr-table-hint-dropdown-item\">\n <span class=\"wr-table-hint-dropdown-item__title\">Next:</span>\n <div class=\"wr-table-hint-dropdown-item__keys\">\n <span class=\"wr-table-hint-dropdown-item__key\">Ctrl</span>\n <span>+</span>\n <span class=\"wr-table-hint-dropdown-item__key\">{{ '>' }}</span>\n </div>\n </div>\n\n <div class=\"wr-table-hint-dropdown-item\">\n <span class=\"wr-table-hint-dropdown-item__title\">Prev:</span>\n <div class=\"wr-table-hint-dropdown-item__keys\">\n <span class=\"wr-table-hint-dropdown-item__key\">Ctrl</span>\n <span>+</span>\n <span class=\"wr-table-hint-dropdown-item__key\">{{ '<' }}</span>\n </div>\n </div>\n </div>\n</wr-dropdown-menu>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './types';\nexport * from './table.component';\nexport * from './table-cell';\nexport * from './table-filter';\nexport * from './table-sort';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["filterIcon"],"mappings":";;;;;;;;;;;;;;IAAY;AAAZ,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,YAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAM;AACN,IAAA,YAAA,CAAA,YAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAG;AACH,IAAA,YAAA,CAAA,YAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI;AACN,CAAC,EAJW,YAAY,KAAZ,YAAY,GAIvB,EAAA,CAAA,CAAA;;MCGY,oBAAoB,CAAA;AAHjC,IAAA,WAAA,GAAA;QAIE,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC,QAAQ,CAAS,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAE5D,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,EAAC,WAA+B,EAAC;AACnD;8GAJY,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,eAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,aAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AAC1B,iBAAA;;;ACND;;;;;AAKG;;AC4BG,MAAO,sBAAuB,SAAQ,cAAc,CAAA;AAZ1D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FAOb,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAtB5B,SAAS;+BACE,UAAU,EAAA,eAAA,EAEH,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,IAAI,EAC5B,OAAA,EAAA;wBACP,gBAAgB;wBAChB,YAAY;wBACZ,YAAY;wBACZ,eAAe;wBACf,kBAAkB;wBAClB,mBAAmB;wBACnB,uBAAuB;wBACvB,qBAAqB;wBACrB,oBAAoB;wBACpB,sBAAsB;qBACvB,EACU,SAAA,EAAA,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAC1C,IAAA,EAAA;AACJ,wBAAA,KAAK,EAAE,UAAU;AAClB,qBAAA,EAAA,QAAA,EAAA,giHAAA,EAAA;8BAakB,YAAY,EAAA,CAAA;sBAA9B;gBAGG,MAAM,EAAA,CAAA;sBADT,WAAW;uBAAC,OAAO;gBAQpB,UAAU,EAAA,CAAA;sBADT,YAAY;uBAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC;gBAsBpC,WAAW,EAAA,CAAA;sBADlB,eAAe;uBAAC,oBAAoB;;;AEpGvC;;;;;AAKG;;ACLH;;AAEG;;;;"}
|
package/fesm2022/ngwr-tag.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { booleanAttribute, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostBinding
|
|
2
|
+
import { booleanAttribute, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, HostBinding } from '@angular/core';
|
|
3
3
|
import { WrIconComponent } from 'ngwr/icon';
|
|
4
|
-
import
|
|
5
|
-
import { WrSpinnerModule } from 'ngwr/spinner';
|
|
4
|
+
import { WrSpinnerComponent } from 'ngwr/spinner';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @license
|
|
@@ -41,12 +40,12 @@ class WrTagComponent {
|
|
|
41
40
|
'wr-tag--hoverable': this.hoverable,
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
45
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.
|
|
43
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
44
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.5", type: WrTagComponent, isStandalone: true, selector: "wr-tag", inputs: { color: "color", icon: "icon", iconPosition: "iconPosition", outlined: ["outlined", "outlined", booleanAttribute], rounded: ["rounded", "rounded", booleanAttribute], transparent: ["transparent", "transparent", booleanAttribute], hoverable: ["hoverable", "hoverable", booleanAttribute], loading: ["loading", "loading", booleanAttribute] }, host: { properties: { "class": "this.elClasses" } }, ngImport: i0, template: "@if (loading && iconPosition === 'start') {\n <wr-spinner class=\"wr-tag__spin\" />\n}\n@if (icon && !loading && iconPosition === 'start') {\n <wr-icon class=\"wr-tag__icon\" [name]=\"icon\" />\n}\n<ng-content />\n@if (loading && iconPosition === 'end') {\n <wr-spinner class=\"wr-tag__spin\" />\n}\n@if (icon && !loading && iconPosition === 'end') {\n <wr-icon class=\"wr-tag__icon\" [name]=\"icon\" />\n}\n", dependencies: [{ kind: "component", type: WrIconComponent, selector: "wr-icon", inputs: ["name"] }, { kind: "component", type: WrSpinnerComponent, selector: "wr-spinner", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
46
45
|
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTagComponent, decorators: [{
|
|
48
47
|
type: Component,
|
|
49
|
-
args: [{ selector: 'wr-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [WrIconComponent,
|
|
48
|
+
args: [{ selector: 'wr-tag', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [WrIconComponent, WrSpinnerComponent], template: "@if (loading && iconPosition === 'start') {\n <wr-spinner class=\"wr-tag__spin\" />\n}\n@if (icon && !loading && iconPosition === 'start') {\n <wr-icon class=\"wr-tag__icon\" [name]=\"icon\" />\n}\n<ng-content />\n@if (loading && iconPosition === 'end') {\n <wr-spinner class=\"wr-tag__spin\" />\n}\n@if (icon && !loading && iconPosition === 'end') {\n <wr-icon class=\"wr-tag__icon\" [name]=\"icon\" />\n}\n" }]
|
|
50
49
|
}], propDecorators: { color: [{
|
|
51
50
|
type: Input
|
|
52
51
|
}], icon: [{
|
|
@@ -73,19 +72,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
73
72
|
args: ['class']
|
|
74
73
|
}] } });
|
|
75
74
|
|
|
76
|
-
class WrTagModule {
|
|
77
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WrTagModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
78
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: WrTagModule, imports: [WrTagComponent], exports: [WrTagComponent] }); }
|
|
79
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WrTagModule, imports: [WrTagComponent] }); }
|
|
80
|
-
}
|
|
81
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WrTagModule, decorators: [{
|
|
82
|
-
type: NgModule,
|
|
83
|
-
args: [{
|
|
84
|
-
imports: [WrTagComponent],
|
|
85
|
-
exports: [WrTagComponent],
|
|
86
|
-
}]
|
|
87
|
-
}] });
|
|
88
|
-
|
|
89
75
|
/**
|
|
90
76
|
* @license
|
|
91
77
|
*
|
|
@@ -97,5 +83,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
97
83
|
* Generated bundle index. Do not edit.
|
|
98
84
|
*/
|
|
99
85
|
|
|
100
|
-
export { WrTagComponent
|
|
86
|
+
export { WrTagComponent };
|
|
101
87
|
//# sourceMappingURL=ngwr-tag.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-tag.mjs","sources":["../../../projects/lib/tag/tag.component.ts","../../../projects/lib/tag/tag.component.html","../../../projects/lib/tag/
|
|
1
|
+
{"version":3,"file":"ngwr-tag.mjs","sources":["../../../projects/lib/tag/tag.component.ts","../../../projects/lib/tag/tag.component.html","../../../projects/lib/tag/public-api.ts","../../../projects/lib/tag/ngwr-tag.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n Input,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { SafeAny, WrThemeColor } from 'ngwr/cdk/types';\nimport { WrIconComponent, wrIconName } from 'ngwr/icon';\nimport { WrSpinnerComponent } from 'ngwr/spinner';\n\n@Component({\n selector: 'wr-tag',\n templateUrl: './tag.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [WrIconComponent, WrSpinnerComponent],\n})\nexport class WrTagComponent {\n @Input() color: WrThemeColor = 'primary';\n @Input() icon: wrIconName | null = null;\n @Input() iconPosition: 'start' | 'end' = 'start';\n @Input({ transform: booleanAttribute }) outlined = false;\n @Input({ transform: booleanAttribute }) rounded = false;\n @Input({ transform: booleanAttribute }) transparent = false;\n @Input({ transform: booleanAttribute }) hoverable = false;\n @Input({ transform: booleanAttribute }) loading = false;\n\n @HostBinding('class')\n get elClasses(): SafeAny {\n return {\n 'wr-tag': true,\n 'wr-tag--color-primary': this.color === 'primary',\n 'wr-tag--color-secondary': this.color === 'secondary',\n 'wr-tag--color-success': this.color === 'success',\n 'wr-tag--color-warning': this.color === 'warning',\n 'wr-tag--color-danger': this.color === 'danger',\n 'wr-tag--color-light': this.color === 'light',\n 'wr-tag--color-medium': this.color === 'medium',\n 'wr-tag--color-dark': this.color === 'dark',\n 'wr-tag--icon-start': (this.icon || this.loading) && this.iconPosition === 'start',\n 'wr-tag--icon-end': (this.icon || this.loading) && this.iconPosition === 'end',\n 'wr-tag--loading': this.loading,\n 'wr-tag--rounded': this.rounded,\n 'wr-tag--outlined': this.outlined,\n 'wr-tag--transparent': this.transparent,\n 'wr-tag--hoverable': this.hoverable,\n };\n }\n}\n","@if (loading && iconPosition === 'start') {\n <wr-spinner class=\"wr-tag__spin\" />\n}\n@if (icon && !loading && iconPosition === 'start') {\n <wr-icon class=\"wr-tag__icon\" [name]=\"icon\" />\n}\n<ng-content />\n@if (loading && iconPosition === 'end') {\n <wr-spinner class=\"wr-tag__spin\" />\n}\n@if (icon && !loading && iconPosition === 'end') {\n <wr-icon class=\"wr-tag__icon\" [name]=\"icon\" />\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './tag.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;MAsBU,cAAc,CAAA;AAP3B,IAAA,WAAA,GAAA;QAQW,IAAK,CAAA,KAAA,GAAiB,SAAS;QAC/B,IAAI,CAAA,IAAA,GAAsB,IAAI;QAC9B,IAAY,CAAA,YAAA,GAAoB,OAAO;QACR,IAAQ,CAAA,QAAA,GAAG,K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BAAb;gBACQ,IAAI,EAAA,CAAA;sBAAZ;gBACQ,YAAY,EAAA,CAAA;sBAApB;gBACuC,QAAQ,EAAA,CAAA;sBAA/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBACE,OAAO,EAAA,CAAA;sBAA9C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBACE,WAAW,EAAA,CAAA;sBAAlD,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBACE,SAAS,EAAA,CAAA;sBAAhD,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBACE,OAAO,EAAA,CAAA;sBAA9C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBAGlC,SAAS,EAAA,CAAA;sBADZ,WAAW;uBAAC,OAAO;;;AErCtB;;;;;AAKG;;ACLH;;AAEG;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
2
|
import { isPlatformBrowser } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { signal, inject, PLATFORM_ID, ChangeDetectorRef, booleanAttribute, numberAttribute, forwardRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ViewChild, HostBinding
|
|
4
|
+
import { signal, inject, PLATFORM_ID, ChangeDetectorRef, booleanAttribute, numberAttribute, forwardRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ViewChild, HostBinding } from '@angular/core';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
6
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
7
|
import { noop } from 'rxjs';
|
|
@@ -96,8 +96,8 @@ class WrTextareaComponent extends WrAbstractBase {
|
|
|
96
96
|
textarea.style.height = `${newHeight}px`;
|
|
97
97
|
textarea.style.overflowY = this.maxRows && textarea.scrollHeight > newHeight ? 'auto' : 'hidden';
|
|
98
98
|
}
|
|
99
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
100
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.
|
|
99
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
100
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.1.5", type: WrTextareaComponent, isStandalone: true, selector: "wr-textarea", inputs: { placeholder: "placeholder", readonly: ["readonly", "readonly", booleanAttribute], resizable: ["resizable", "resizable", booleanAttribute], autosize: ["autosize", "autosize", booleanAttribute], rows: ["rows", "rows", numberAttribute], maxRows: ["maxRows", "maxRows", numberAttribute], disabled: ["disabled", "disabled", booleanAttribute] }, host: { properties: { "class": "this.elClasses" } }, providers: [
|
|
101
101
|
{
|
|
102
102
|
provide: NG_VALUE_ACCESSOR,
|
|
103
103
|
// eslint-disable-next-line @angular-eslint/no-forward-ref
|
|
@@ -106,9 +106,9 @@ class WrTextareaComponent extends WrAbstractBase {
|
|
|
106
106
|
},
|
|
107
107
|
], viewQueries: [{ propertyName: "textareaNative", first: true, predicate: ["textareaNative"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<textarea\n #textareaNative\n class=\"wr-textarea__native\"\n [placeholder]=\"placeholder\"\n [rows]=\"rows\"\n [readonly]=\"readonly\"\n [disabled]=\"isDisabled()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"writeValue($event)\"\n (input)=\"resizeTextarea()\"\n></textarea>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
108
108
|
}
|
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: WrTextareaComponent, decorators: [{
|
|
110
110
|
type: Component,
|
|
111
|
-
args: [{
|
|
111
|
+
args: [{ selector: 'wr-textarea', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [FormsModule], providers: [
|
|
112
112
|
{
|
|
113
113
|
provide: NG_VALUE_ACCESSOR,
|
|
114
114
|
// eslint-disable-next-line @angular-eslint/no-forward-ref
|
|
@@ -144,25 +144,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
144
144
|
args: ['class']
|
|
145
145
|
}] } });
|
|
146
146
|
|
|
147
|
-
/**
|
|
148
|
-
* @license
|
|
149
|
-
*
|
|
150
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
151
|
-
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
152
|
-
*/
|
|
153
|
-
class WrTextareaModule {
|
|
154
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WrTextareaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
155
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: WrTextareaModule, imports: [WrTextareaComponent], exports: [WrTextareaComponent] }); }
|
|
156
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WrTextareaModule, imports: [WrTextareaComponent] }); }
|
|
157
|
-
}
|
|
158
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: WrTextareaModule, decorators: [{
|
|
159
|
-
type: NgModule,
|
|
160
|
-
args: [{
|
|
161
|
-
imports: [WrTextareaComponent],
|
|
162
|
-
exports: [WrTextareaComponent],
|
|
163
|
-
}]
|
|
164
|
-
}] });
|
|
165
|
-
|
|
166
147
|
/**
|
|
167
148
|
* @license
|
|
168
149
|
*
|
|
@@ -181,5 +162,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
181
162
|
* Generated bundle index. Do not edit.
|
|
182
163
|
*/
|
|
183
164
|
|
|
184
|
-
export { WrTextareaComponent
|
|
165
|
+
export { WrTextareaComponent };
|
|
185
166
|
//# sourceMappingURL=ngwr-textarea.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-textarea.mjs","sources":["../../../projects/lib/textarea/textarea.component.ts","../../../projects/lib/textarea/textarea.component.html","../../../projects/lib/textarea/textarea.module.ts","../../../projects/lib/textarea/public-api.ts","../../../projects/lib/textarea/index.ts","../../../projects/lib/textarea/ngwr-textarea.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n forwardRef,\n HostBinding,\n inject,\n Input,\n numberAttribute,\n PLATFORM_ID,\n signal,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { noop } from 'rxjs';\n\nimport { WrAbstractBase } from 'ngwr/cdk';\nimport { SafeAny } from 'ngwr/cdk/types';\n\n/**\n * NGWR textarea component.\n *\n * {@tutorial} [How to use wr-textarea]{@link http://ngwr.dev/docs/components/textarea}\n */\n@Component({\n standalone: true,\n selector: 'wr-textarea',\n templateUrl: './textarea.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [FormsModule],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrTextareaComponent),\n multi: true,\n },\n ],\n})\nexport class WrTextareaComponent extends WrAbstractBase implements ControlValueAccessor, AfterViewInit {\n @Input() placeholder = '';\n @Input({ transform: booleanAttribute }) readonly = false;\n @Input({ transform: booleanAttribute }) resizable = true;\n @Input({ transform: booleanAttribute }) autosize = false;\n @Input({ transform: numberAttribute }) rows = 2;\n @Input({ transform: numberAttribute }) maxRows?: number;\n\n @Input({ transform: booleanAttribute })\n set disabled(value: boolean) {\n this.isDisabled.set(value);\n }\n get disabled(): boolean {\n return this.isDisabled();\n }\n\n @ViewChild('textareaNative')\n private textareaNative: ElementRef<HTMLTextAreaElement> | undefined;\n\n @HostBinding('class')\n get elClasses(): SafeAny {\n return {\n 'wr-textarea': true,\n 'wr-textarea--resizable': this.resizable,\n 'wr-textarea--disabled': this.isDisabled(),\n 'wr-textarea--autosize': this.autosize,\n };\n }\n\n protected value?: string;\n\n protected readonly inputValue = signal<string | null>(null);\n protected readonly isDisabled = signal(false);\n\n private readonly platformId = inject(PLATFORM_ID);\n private readonly cdr = inject(ChangeDetectorRef);\n\n private get isBrowser(): boolean {\n return isPlatformBrowser(this.platformId);\n }\n\n ngAfterViewInit(): void {\n if (this.autosize && this.isBrowser) {\n this.resizeTextarea();\n }\n }\n\n onChange: (value: string) => void = noop;\n onTouch: () => void = noop;\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouch = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.isDisabled.set(coerceBooleanProperty(isDisabled));\n }\n\n writeValue(value: string): void {\n this.value = value;\n this.onChange(value);\n this.inputValue.set(value);\n\n if (this.isBrowser) {\n requestAnimationFrame(() => {\n this.resizeTextarea();\n });\n }\n\n this.cdr.markForCheck();\n }\n\n resizeTextarea(): void {\n if (!this.autosize || !this.textareaNative || !this.isBrowser) {\n return;\n }\n\n const textarea = this.textareaNative.nativeElement;\n\n textarea.style.height = 'auto';\n\n let newHeight: number;\n let maxHeight = 'none';\n\n if (this.maxRows) {\n const computedStyle = getComputedStyle(textarea);\n const lineHeight = parseInt(computedStyle.lineHeight, 10) || parseInt(computedStyle.fontSize, 10) * 1.2;\n\n maxHeight = `${lineHeight * this.maxRows}px`;\n newHeight = Math.min(textarea.scrollHeight, lineHeight * this.maxRows);\n } else {\n newHeight = textarea.scrollHeight;\n }\n\n textarea.style.maxHeight = maxHeight;\n textarea.style.height = `${newHeight}px`;\n textarea.style.overflowY = this.maxRows && textarea.scrollHeight > newHeight ? 'auto' : 'hidden';\n }\n}\n","<textarea\n #textareaNative\n class=\"wr-textarea__native\"\n [placeholder]=\"placeholder\"\n [rows]=\"rows\"\n [readonly]=\"readonly\"\n [disabled]=\"isDisabled()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"writeValue($event)\"\n (input)=\"resizeTextarea()\"\n></textarea>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { NgModule } from '@angular/core';\n\nimport { WrTextareaComponent } from './textarea.component';\n\n@NgModule({\n imports: [WrTextareaComponent],\n exports: [WrTextareaComponent],\n})\nexport class WrTextareaModule {}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './textarea.component';\nexport * from './textarea.module';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './public-api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AA4BH;;;;AAIG;AAiBG,MAAO,mBAAoB,SAAQ,cAAc,CAAA;AAhBvD,IAAA,WAAA,GAAA;;QAiBW,IAAW,CAAA,WAAA,GAAG,EAAE;QACe,IAAQ,CAAA,QAAA,GAAG,KAAK;QAChB,IAAS,CAAA,SAAA,GAAG,IAAI;QAChB,IAAQ,CAAA,QAAA,GAAG,KAAK;QACjB,IAAI,CAAA,IAAA,GAAG,CAAC;AA0B5B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAgB,IAAI,CAAC;AACxC,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;AAE5B,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAYhD,IAAQ,CAAA,QAAA,GAA4B,IAAI;QACxC,IAAO,CAAA,OAAA,GAAe,IAAI;AAsD3B;IA9FC,IACI,QAAQ,CAAC,KAAc,EAAA;AACzB,QAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;;AAE5B,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,OAAO,IAAI,CAAC,UAAU,EAAE;;AAM1B,IAAA,IACI,SAAS,GAAA;QACX,OAAO;AACL,YAAA,aAAa,EAAE,IAAI;YACnB,wBAAwB,EAAE,IAAI,CAAC,SAAS;AACxC,YAAA,uBAAuB,EAAE,IAAI,CAAC,UAAU,EAAE;YAC1C,uBAAuB,EAAE,IAAI,C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A,OAAA,EAAA,CACnB,mBAAmB,CAAA,EAAA,CAAA,CAAA;AAElB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAHjB,mBAAmB,CAAA,EAAA,CAAA,CAAA;;2FAGlB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,mBAAmB,CAAC;oBAC9B,OAAO,EAAE,CAAC,mBAAmB,CAAC;AAC/B,iBAAA;;;ACdD;;;;;AAKG;;ACLH;;;;;AAKG;;ACLH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-textarea.mjs","sources":["../../../projects/lib/textarea/textarea.component.ts","../../../projects/lib/textarea/textarea.component.html","../../../projects/lib/textarea/public-api.ts","../../../projects/lib/textarea/index.ts","../../../projects/lib/textarea/ngwr-textarea.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n forwardRef,\n HostBinding,\n inject,\n Input,\n numberAttribute,\n PLATFORM_ID,\n signal,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { noop } from 'rxjs';\n\nimport { WrAbstractBase } from 'ngwr/cdk';\nimport { SafeAny } from 'ngwr/cdk/types';\n\n/**\n * NGWR textarea component.\n *\n * {@tutorial} [How to use wr-textarea]{@link http://ngwr.dev/docs/components/textarea}\n */\n@Component({\n selector: 'wr-textarea',\n templateUrl: './textarea.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [FormsModule],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrTextareaComponent),\n multi: true,\n },\n ],\n})\nexport class WrTextareaComponent extends WrAbstractBase implements ControlValueAccessor, AfterViewInit {\n @Input() placeholder = '';\n @Input({ transform: booleanAttribute }) readonly = false;\n @Input({ transform: booleanAttribute }) resizable = true;\n @Input({ transform: booleanAttribute }) autosize = false;\n @Input({ transform: numberAttribute }) rows = 2;\n @Input({ transform: numberAttribute }) maxRows?: number;\n\n @Input({ transform: booleanAttribute })\n set disabled(value: boolean) {\n this.isDisabled.set(value);\n }\n get disabled(): boolean {\n return this.isDisabled();\n }\n\n @ViewChild('textareaNative')\n private textareaNative: ElementRef<HTMLTextAreaElement> | undefined;\n\n @HostBinding('class')\n get elClasses(): SafeAny {\n return {\n 'wr-textarea': true,\n 'wr-textarea--resizable': this.resizable,\n 'wr-textarea--disabled': this.isDisabled(),\n 'wr-textarea--autosize': this.autosize,\n };\n }\n\n protected value?: string;\n\n protected readonly inputValue = signal<string | null>(null);\n protected readonly isDisabled = signal(false);\n\n private readonly platformId = inject(PLATFORM_ID);\n private readonly cdr = inject(ChangeDetectorRef);\n\n private get isBrowser(): boolean {\n return isPlatformBrowser(this.platformId);\n }\n\n ngAfterViewInit(): void {\n if (this.autosize && this.isBrowser) {\n this.resizeTextarea();\n }\n }\n\n onChange: (value: string) => void = noop;\n onTouch: () => void = noop;\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouch = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.isDisabled.set(coerceBooleanProperty(isDisabled));\n }\n\n writeValue(value: string): void {\n this.value = value;\n this.onChange(value);\n this.inputValue.set(value);\n\n if (this.isBrowser) {\n requestAnimationFrame(() => {\n this.resizeTextarea();\n });\n }\n\n this.cdr.markForCheck();\n }\n\n resizeTextarea(): void {\n if (!this.autosize || !this.textareaNative || !this.isBrowser) {\n return;\n }\n\n const textarea = this.textareaNative.nativeElement;\n\n textarea.style.height = 'auto';\n\n let newHeight: number;\n let maxHeight = 'none';\n\n if (this.maxRows) {\n const computedStyle = getComputedStyle(textarea);\n const lineHeight = parseInt(computedStyle.lineHeight, 10) || parseInt(computedStyle.fontSize, 10) * 1.2;\n\n maxHeight = `${lineHeight * this.maxRows}px`;\n newHeight = Math.min(textarea.scrollHeight, lineHeight * this.maxRows);\n } else {\n newHeight = textarea.scrollHeight;\n }\n\n textarea.style.maxHeight = maxHeight;\n textarea.style.height = `${newHeight}px`;\n textarea.style.overflowY = this.maxRows && textarea.scrollHeight > newHeight ? 'auto' : 'hidden';\n }\n}\n","<textarea\n #textareaNative\n class=\"wr-textarea__native\"\n [placeholder]=\"placeholder\"\n [rows]=\"rows\"\n [readonly]=\"readonly\"\n [disabled]=\"isDisabled()\"\n [ngModel]=\"inputValue()\"\n (ngModelChange)=\"writeValue($event)\"\n (input)=\"resizeTextarea()\"\n></textarea>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './textarea.component';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport * from './public-api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AA4BH;;;;AAIG;AAgBG,MAAO,mBAAoB,SAAQ,cAAc,CAAA;AAfvD,IAAA,WAAA,GAAA;;QAgBW,IAAW,CAAA,WAAA,GAAG,EAAE;QACe,IAAQ,CAAA,QAAA,GAAG,KAAK;QAChB,I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