@tots/editable-columns 15.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/README.md +24 -0
- package/esm2020/lib/columns/input-column/input-column.component.mjs +106 -0
- package/esm2020/lib/editable-columns.module.mjs +50 -0
- package/esm2020/public-api.mjs +12 -0
- package/esm2020/tots-editable-columns.mjs +5 -0
- package/fesm2015/tots-editable-columns.mjs +163 -0
- package/fesm2015/tots-editable-columns.mjs.map +1 -0
- package/fesm2020/tots-editable-columns.mjs +161 -0
- package/fesm2020/tots-editable-columns.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/columns/input-column/input-column.component.d.ts +24 -0
- package/lib/editable-columns.module.d.ts +11 -0
- package/package.json +33 -0
- package/public-api.d.ts +8 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# EditableColumns
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.0.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project editable-columns` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project editable-columns`.
|
|
8
|
+
> Note: Don't forget to add `--project editable-columns` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build editable-columns` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build editable-columns`, go to the dist folder `cd dist/editable-columns` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test editable-columns` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { FormControl } from '@angular/forms';
|
|
3
|
+
import { TotsBaseColumnComponent, TotsTableHelper } from '@tots/table';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@angular/common";
|
|
6
|
+
import * as i2 from "@angular/forms";
|
|
7
|
+
import * as i3 from "@angular/material/form-field";
|
|
8
|
+
import * as i4 from "@angular/material/input";
|
|
9
|
+
export class InputColumn extends TotsBaseColumnComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
}
|
|
13
|
+
ngOnInit() {
|
|
14
|
+
this.loadInput();
|
|
15
|
+
this.loadForm();
|
|
16
|
+
this.loadChanges();
|
|
17
|
+
}
|
|
18
|
+
loadChanges() {
|
|
19
|
+
this.input.valueChanges
|
|
20
|
+
.subscribe(res => {
|
|
21
|
+
this.onAction.next({ key: 'input-change', item: { field_key: this.getFormKey(), item: this.item, value: res, valid: this.input.valid } });
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
loadForm() {
|
|
25
|
+
if (this.column.extra == undefined || this.column.extra.group == undefined) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let group = this.column.extra.group;
|
|
29
|
+
if (group.get(this.getFormKey()) != undefined) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
group.addControl(this.getFormKey(), this.input);
|
|
33
|
+
}
|
|
34
|
+
loadInput() {
|
|
35
|
+
let value = TotsTableHelper.getItemValueByKey(this.item, this.column.field_key);
|
|
36
|
+
this.input = new FormControl(value, this.getValidators());
|
|
37
|
+
}
|
|
38
|
+
getFormKey() {
|
|
39
|
+
if (Array.isArray(this.column.field_key)) {
|
|
40
|
+
return this.column.field_key.join('_');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return this.column.field_key;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getValidators() {
|
|
47
|
+
if (this.column.extra && this.column.extra.validators) {
|
|
48
|
+
return this.column.extra.validators;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
getErrorMessage() {
|
|
53
|
+
if (!this.column.extra.errors) {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
for (const error of this.column.extra.errors) {
|
|
57
|
+
if (this.input.hasError(error.name)) {
|
|
58
|
+
return error.message;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
getAppearance() {
|
|
64
|
+
if (this.column.extra && this.column.extra.appearance) {
|
|
65
|
+
return this.column.extra.appearance;
|
|
66
|
+
}
|
|
67
|
+
return 'fill';
|
|
68
|
+
}
|
|
69
|
+
getLabel() {
|
|
70
|
+
if (this.column.extra && this.column.extra.label) {
|
|
71
|
+
return this.column.extra.label;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
getClasses() {
|
|
76
|
+
if (this.column.extra && this.column.extra.classes) {
|
|
77
|
+
return this.column.extra.classes;
|
|
78
|
+
}
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
getPlaceholder() {
|
|
82
|
+
if (this.column.extra && this.column.extra.placeholder) {
|
|
83
|
+
return this.column.extra.placeholder;
|
|
84
|
+
}
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
87
|
+
getCaption() {
|
|
88
|
+
if (this.column.extra && this.column.extra.caption) {
|
|
89
|
+
return this.column.extra.caption;
|
|
90
|
+
}
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
hasError() {
|
|
94
|
+
return this.input.invalid && (this.input.dirty || this.input.touched);
|
|
95
|
+
}
|
|
96
|
+
getInput() {
|
|
97
|
+
return this.input;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
InputColumn.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: InputColumn, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
101
|
+
InputColumn.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: InputColumn, selector: "tots-input-column", usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] });
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: InputColumn, decorators: [{
|
|
103
|
+
type: Component,
|
|
104
|
+
args: [{ selector: 'tots-input-column', template: "<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{margin-bottom:0}\n"] }]
|
|
105
|
+
}], ctorParameters: function () { return []; } });
|
|
106
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQtY29sdW1uLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3RvdHMvZWRpdGFibGUtY29sdW1ucy9zcmMvbGliL2NvbHVtbnMvaW5wdXQtY29sdW1uL2lucHV0LWNvbHVtbi5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy90b3RzL2VkaXRhYmxlLWNvbHVtbnMvc3JjL2xpYi9jb2x1bW5zL2lucHV0LWNvbHVtbi9pbnB1dC1jb2x1bW4uY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMxQyxPQUFPLEVBQUUsV0FBVyxFQUEwQixNQUFNLGdCQUFnQixDQUFDO0FBRX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Q+XG4iXX0=
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
/** Angular Material */
|
|
5
|
+
import { MatInputModule } from '@angular/material/input';
|
|
6
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
+
/** Columns */
|
|
8
|
+
import { InputColumn } from './columns/input-column/input-column.component';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export class TotsEditableColumnsModule {
|
|
11
|
+
}
|
|
12
|
+
TotsEditableColumnsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
13
|
+
TotsEditableColumnsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, declarations: [
|
|
14
|
+
/** Columns */
|
|
15
|
+
InputColumn], imports: [CommonModule,
|
|
16
|
+
FormsModule,
|
|
17
|
+
ReactiveFormsModule,
|
|
18
|
+
/** Angular Material */
|
|
19
|
+
MatFormFieldModule,
|
|
20
|
+
MatInputModule], exports: [
|
|
21
|
+
/** Columns */
|
|
22
|
+
InputColumn] });
|
|
23
|
+
TotsEditableColumnsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, imports: [CommonModule,
|
|
24
|
+
FormsModule,
|
|
25
|
+
ReactiveFormsModule,
|
|
26
|
+
/** Angular Material */
|
|
27
|
+
MatFormFieldModule,
|
|
28
|
+
MatInputModule] });
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, decorators: [{
|
|
30
|
+
type: NgModule,
|
|
31
|
+
args: [{
|
|
32
|
+
declarations: [
|
|
33
|
+
/** Columns */
|
|
34
|
+
InputColumn
|
|
35
|
+
],
|
|
36
|
+
imports: [
|
|
37
|
+
CommonModule,
|
|
38
|
+
FormsModule,
|
|
39
|
+
ReactiveFormsModule,
|
|
40
|
+
/** Angular Material */
|
|
41
|
+
MatFormFieldModule,
|
|
42
|
+
MatInputModule,
|
|
43
|
+
],
|
|
44
|
+
exports: [
|
|
45
|
+
/** Columns */
|
|
46
|
+
InputColumn
|
|
47
|
+
]
|
|
48
|
+
}]
|
|
49
|
+
}] });
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWRpdGFibGUtY29sdW1ucy5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy90b3RzL2VkaXRhYmxlLWNvbHVtbnMvc3JjL2xpYi9lZGl0YWJsZS1jb2x1bW5zLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUMvQyxPQUFPLEVBQUUsV0FBVyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFbEUsdUJBQXVCO0FBQ3ZCLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN6RCxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUVsRSxjQUFjO0FBQ2QsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLCtDQUErQyxDQUFDOztBQTBCNUUsTUFBTSxPQUFPLHlCQUF5Qjs7c0hBQXpCLHlCQUF5Qjt1SEFBekIseUJBQ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BJbnB1dENvbHVtbiB9IGZyb20gJy4vY29sdW1ucy9pbnB1dC1jb2x1bW4vaW5wdXQtY29sdW1uLmNvbXBvbmVudCc7XG5cblxuXG5cblxuQE5nTW9kdWxlKHtcbiAgZGVjbGFyYXRpb25zOiBbXG5cbiAgICAvKiogQ29sdW1ucyAqL1xuICAgIElucHV0Q29sdW1uXG4gIF0sXG4gIGltcG9ydHM6IFtcbiAgICBDb21tb25Nb2R1bGUsXG4gICAgRm9ybXNNb2R1bGUsXG4gICAgUmVhY3RpdmVGb3Jtc01vZHVsZSxcblxuICAgIC8qKiBBbmd1bGFyIE1hdGVyaWFsICovXG4gICAgTWF0Rm9ybUZpZWxkTW9kdWxlLFxuICAgIE1hdElucHV0TW9kdWxlLFxuICBdLFxuICBleHBvcnRzOiBbXG4gICAgLyoqIENvbHVtbnMgKi9cbiAgICBJbnB1dENvbHVtblxuICBdXG59KVxuZXhwb3J0IGNsYXNzIFRvdHNFZGl0YWJsZUNvbHVtbnNNb2R1bGUgeyB9XG4iXX0=
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of editable-columns
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Columns
|
|
6
|
+
*/
|
|
7
|
+
export * from './lib/columns/input-column/input-column.component';
|
|
8
|
+
/**
|
|
9
|
+
* Modules
|
|
10
|
+
*/
|
|
11
|
+
export * from './lib/editable-columns.module';
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3RvdHMvZWRpdGFibGUtY29sdW1ucy9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVIOztHQUVHO0FBQ0gsY0FBYyxtREFBbUQsQ0FBQztBQUVsRTs7R0FFRztBQUNILGNBQWMsK0JBQStCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGVkaXRhYmxlLWNvbHVtbnNcbiAqL1xuXG4vKipcbiAqIENvbHVtbnNcbiAqL1xuZXhwb3J0ICogZnJvbSAnLi9saWIvY29sdW1ucy9pbnB1dC1jb2x1bW4vaW5wdXQtY29sdW1uLmNvbXBvbmVudCc7XG5cbi8qKlxuICogTW9kdWxlc1xuICovXG5leHBvcnQgKiBmcm9tICcuL2xpYi9lZGl0YWJsZS1jb2x1bW5zLm1vZHVsZSc7XG4iXX0=
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG90cy1lZGl0YWJsZS1jb2x1bW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvdG90cy9lZGl0YWJsZS1jb2x1bW5zL3NyYy90b3RzLWVkaXRhYmxlLWNvbHVtbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/forms';
|
|
4
|
+
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { TotsBaseColumnComponent, TotsTableHelper } from '@tots/table';
|
|
6
|
+
import * as i1 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
import * as i3 from '@angular/material/form-field';
|
|
9
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
10
|
+
import * as i4 from '@angular/material/input';
|
|
11
|
+
import { MatInputModule } from '@angular/material/input';
|
|
12
|
+
|
|
13
|
+
class InputColumn extends TotsBaseColumnComponent {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
ngOnInit() {
|
|
18
|
+
this.loadInput();
|
|
19
|
+
this.loadForm();
|
|
20
|
+
this.loadChanges();
|
|
21
|
+
}
|
|
22
|
+
loadChanges() {
|
|
23
|
+
this.input.valueChanges
|
|
24
|
+
.subscribe(res => {
|
|
25
|
+
this.onAction.next({ key: 'input-change', item: { field_key: this.getFormKey(), item: this.item, value: res, valid: this.input.valid } });
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
loadForm() {
|
|
29
|
+
if (this.column.extra == undefined || this.column.extra.group == undefined) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
let group = this.column.extra.group;
|
|
33
|
+
if (group.get(this.getFormKey()) != undefined) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
group.addControl(this.getFormKey(), this.input);
|
|
37
|
+
}
|
|
38
|
+
loadInput() {
|
|
39
|
+
let value = TotsTableHelper.getItemValueByKey(this.item, this.column.field_key);
|
|
40
|
+
this.input = new FormControl(value, this.getValidators());
|
|
41
|
+
}
|
|
42
|
+
getFormKey() {
|
|
43
|
+
if (Array.isArray(this.column.field_key)) {
|
|
44
|
+
return this.column.field_key.join('_');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return this.column.field_key;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
getValidators() {
|
|
51
|
+
if (this.column.extra && this.column.extra.validators) {
|
|
52
|
+
return this.column.extra.validators;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
getErrorMessage() {
|
|
57
|
+
if (!this.column.extra.errors) {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
for (const error of this.column.extra.errors) {
|
|
61
|
+
if (this.input.hasError(error.name)) {
|
|
62
|
+
return error.message;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
getAppearance() {
|
|
68
|
+
if (this.column.extra && this.column.extra.appearance) {
|
|
69
|
+
return this.column.extra.appearance;
|
|
70
|
+
}
|
|
71
|
+
return 'fill';
|
|
72
|
+
}
|
|
73
|
+
getLabel() {
|
|
74
|
+
if (this.column.extra && this.column.extra.label) {
|
|
75
|
+
return this.column.extra.label;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
getClasses() {
|
|
80
|
+
if (this.column.extra && this.column.extra.classes) {
|
|
81
|
+
return this.column.extra.classes;
|
|
82
|
+
}
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
getPlaceholder() {
|
|
86
|
+
if (this.column.extra && this.column.extra.placeholder) {
|
|
87
|
+
return this.column.extra.placeholder;
|
|
88
|
+
}
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
getCaption() {
|
|
92
|
+
if (this.column.extra && this.column.extra.caption) {
|
|
93
|
+
return this.column.extra.caption;
|
|
94
|
+
}
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
hasError() {
|
|
98
|
+
return this.input.invalid && (this.input.dirty || this.input.touched);
|
|
99
|
+
}
|
|
100
|
+
getInput() {
|
|
101
|
+
return this.input;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
InputColumn.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: InputColumn, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
105
|
+
InputColumn.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: InputColumn, selector: "tots-input-column", usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] });
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: InputColumn, decorators: [{
|
|
107
|
+
type: Component,
|
|
108
|
+
args: [{ selector: 'tots-input-column', template: "<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{margin-bottom:0}\n"] }]
|
|
109
|
+
}], ctorParameters: function () { return []; } });
|
|
110
|
+
|
|
111
|
+
class TotsEditableColumnsModule {
|
|
112
|
+
}
|
|
113
|
+
TotsEditableColumnsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
114
|
+
TotsEditableColumnsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, declarations: [
|
|
115
|
+
/** Columns */
|
|
116
|
+
InputColumn
|
|
117
|
+
], imports: [CommonModule,
|
|
118
|
+
FormsModule,
|
|
119
|
+
ReactiveFormsModule,
|
|
120
|
+
/** Angular Material */
|
|
121
|
+
MatFormFieldModule,
|
|
122
|
+
MatInputModule], exports: [
|
|
123
|
+
/** Columns */
|
|
124
|
+
InputColumn
|
|
125
|
+
] });
|
|
126
|
+
TotsEditableColumnsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, imports: [CommonModule,
|
|
127
|
+
FormsModule,
|
|
128
|
+
ReactiveFormsModule,
|
|
129
|
+
/** Angular Material */
|
|
130
|
+
MatFormFieldModule,
|
|
131
|
+
MatInputModule] });
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, decorators: [{
|
|
133
|
+
type: NgModule,
|
|
134
|
+
args: [{
|
|
135
|
+
declarations: [
|
|
136
|
+
/** Columns */
|
|
137
|
+
InputColumn
|
|
138
|
+
],
|
|
139
|
+
imports: [
|
|
140
|
+
CommonModule,
|
|
141
|
+
FormsModule,
|
|
142
|
+
ReactiveFormsModule,
|
|
143
|
+
/** Angular Material */
|
|
144
|
+
MatFormFieldModule,
|
|
145
|
+
MatInputModule,
|
|
146
|
+
],
|
|
147
|
+
exports: [
|
|
148
|
+
/** Columns */
|
|
149
|
+
InputColumn
|
|
150
|
+
]
|
|
151
|
+
}]
|
|
152
|
+
}] });
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* Public API Surface of editable-columns
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Generated bundle index. Do not edit.
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
export { InputColumn, TotsEditableColumnsModule };
|
|
163
|
+
//# sourceMappingURL=tots-editable-columns.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tots-editable-columns.mjs","sources":["../../../../projects/tots/editable-columns/src/lib/columns/input-column/input-column.component.ts","../../../../projects/tots/editable-columns/src/lib/columns/input-column/input-column.component.html","../../../../projects/tots/editable-columns/src/lib/editable-columns.module.ts","../../../../projects/tots/editable-columns/src/public-api.ts","../../../../projects/tots/editable-columns/src/tots-editable-columns.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { FormControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\nimport { TotsBaseColumnComponent, TotsTableHelper } from '@tots/table';\n\n@Component({\n selector: 'tots-input-column',\n templateUrl: './input-column.component.html',\n styleUrls: ['./input-column.component.css']\n})\nexport class InputColumn extends TotsBaseColumnComponent {\n\n input!: FormControl;\n\n constructor() {\n super();\n }\n\n ngOnInit(): void {\n this.loadInput();\n this.loadForm();\n this.loadChanges();\n }\n\n loadChanges() {\n this.input.valueChanges\n .subscribe(res => {\n this.onAction.next({ key: 'input-change', item: { field_key: this.getFormKey(), item: this.item, value: res, valid: this.input.valid } });\n });\n }\n\n loadForm() {\n if(this.column.extra == undefined || this.column.extra.group == undefined){\n return;\n }\n\n let group: FormGroup = this.column.extra.group;\n if(group.get(this.getFormKey()) != undefined){\n return;\n }\n\n group.addControl(this.getFormKey(), this.input);\n }\n\n loadInput() {\n let value = TotsTableHelper.getItemValueByKey(this.item, this.column.field_key);\n this.input = new FormControl(value, this.getValidators());\n }\n\n getFormKey(): string {\n if(Array.isArray(this.column.field_key)){\n return this.column.field_key.join('_');\n } else {\n return this.column.field_key!;\n }\n }\n\n getValidators() : ValidatorFn[] | ValidatorFn | null {\n if (this.column.extra && this.column.extra.validators) {\n return this.column.extra.validators;\n }\n return null;\n }\n\n getErrorMessage() : string {\n if (!this.column.extra.errors) {\n return '';\n }\n\n for (const error of this.column.extra.errors) {\n if (this.input.hasError(error.name)) {\n return error.message;\n }\n }\n\n return '';\n }\n\n getAppearance() : MatFormFieldAppearance {\n if (this.column.extra && this.column.extra.appearance) {\n return this.column.extra.appearance;\n }\n return 'fill';\n }\n\n getLabel() : string | undefined {\n if (this.column.extra && this.column.extra.label) {\n return this.column.extra.label;\n }\n return undefined;\n }\n\n getClasses() : string {\n if (this.column.extra && this.column.extra.classes) {\n return this.column.extra.classes;\n }\n return '';\n }\n\n getPlaceholder() : string {\n if (this.column.extra && this.column.extra.placeholder) {\n return this.column.extra.placeholder;\n }\n return '';\n }\n\n getCaption() : string {\n if (this.column.extra && this.column.extra.caption) {\n return this.column.extra.caption;\n }\n return '';\n }\n\n hasError() : boolean {\n return this.input.invalid && (this.input.dirty || this.input.touched);\n }\n\n getInput() {\n return this.input;\n }\n}\n","<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\n/** Angular Material */\nimport { MatInputModule } from '@angular/material/input';\nimport { MatFormFieldModule } from '@angular/material/form-field';\n\n/** Columns */\nimport { InputColumn } from './columns/input-column/input-column.component';\n\n\n\n\n\n@NgModule({\n declarations: [\n\n /** Columns */\n InputColumn\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n\n /** Angular Material */\n MatFormFieldModule,\n MatInputModule,\n ],\n exports: [\n /** Columns */\n InputColumn\n ]\n})\nexport class TotsEditableColumnsModule { }\n","/*\n * Public API Surface of editable-columns\n */\n\n/**\n * Columns\n */\nexport * from './lib/columns/input-column/input-column.component';\n\n/**\n * Modules\n */\nexport * from './lib/editable-columns.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAUM,MAAO,WAAY,SAAQ,uBAAuB,CAAA;AAItD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE,CAAC;KACT;IAED,QAAQ,GAAA;QACN,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB;IAED,WAAW,GAAA;QACT,IAAI,CAAC,KAAK,CAAC,YAAY;aACtB,SAAS,CAAC,GAAG,IAAG;AACf,YAAA,IAAI,C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* as i2 from '@angular/forms';
|
|
4
|
+
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { TotsBaseColumnComponent, TotsTableHelper } from '@tots/table';
|
|
6
|
+
import * as i1 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
import * as i3 from '@angular/material/form-field';
|
|
9
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
10
|
+
import * as i4 from '@angular/material/input';
|
|
11
|
+
import { MatInputModule } from '@angular/material/input';
|
|
12
|
+
|
|
13
|
+
class InputColumn extends TotsBaseColumnComponent {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
}
|
|
17
|
+
ngOnInit() {
|
|
18
|
+
this.loadInput();
|
|
19
|
+
this.loadForm();
|
|
20
|
+
this.loadChanges();
|
|
21
|
+
}
|
|
22
|
+
loadChanges() {
|
|
23
|
+
this.input.valueChanges
|
|
24
|
+
.subscribe(res => {
|
|
25
|
+
this.onAction.next({ key: 'input-change', item: { field_key: this.getFormKey(), item: this.item, value: res, valid: this.input.valid } });
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
loadForm() {
|
|
29
|
+
if (this.column.extra == undefined || this.column.extra.group == undefined) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
let group = this.column.extra.group;
|
|
33
|
+
if (group.get(this.getFormKey()) != undefined) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
group.addControl(this.getFormKey(), this.input);
|
|
37
|
+
}
|
|
38
|
+
loadInput() {
|
|
39
|
+
let value = TotsTableHelper.getItemValueByKey(this.item, this.column.field_key);
|
|
40
|
+
this.input = new FormControl(value, this.getValidators());
|
|
41
|
+
}
|
|
42
|
+
getFormKey() {
|
|
43
|
+
if (Array.isArray(this.column.field_key)) {
|
|
44
|
+
return this.column.field_key.join('_');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return this.column.field_key;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
getValidators() {
|
|
51
|
+
if (this.column.extra && this.column.extra.validators) {
|
|
52
|
+
return this.column.extra.validators;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
getErrorMessage() {
|
|
57
|
+
if (!this.column.extra.errors) {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
for (const error of this.column.extra.errors) {
|
|
61
|
+
if (this.input.hasError(error.name)) {
|
|
62
|
+
return error.message;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return '';
|
|
66
|
+
}
|
|
67
|
+
getAppearance() {
|
|
68
|
+
if (this.column.extra && this.column.extra.appearance) {
|
|
69
|
+
return this.column.extra.appearance;
|
|
70
|
+
}
|
|
71
|
+
return 'fill';
|
|
72
|
+
}
|
|
73
|
+
getLabel() {
|
|
74
|
+
if (this.column.extra && this.column.extra.label) {
|
|
75
|
+
return this.column.extra.label;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
getClasses() {
|
|
80
|
+
if (this.column.extra && this.column.extra.classes) {
|
|
81
|
+
return this.column.extra.classes;
|
|
82
|
+
}
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
getPlaceholder() {
|
|
86
|
+
if (this.column.extra && this.column.extra.placeholder) {
|
|
87
|
+
return this.column.extra.placeholder;
|
|
88
|
+
}
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
getCaption() {
|
|
92
|
+
if (this.column.extra && this.column.extra.caption) {
|
|
93
|
+
return this.column.extra.caption;
|
|
94
|
+
}
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
hasError() {
|
|
98
|
+
return this.input.invalid && (this.input.dirty || this.input.touched);
|
|
99
|
+
}
|
|
100
|
+
getInput() {
|
|
101
|
+
return this.input;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
InputColumn.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: InputColumn, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
105
|
+
InputColumn.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: InputColumn, selector: "tots-input-column", usesInheritance: true, ngImport: i0, template: "<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{margin-bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }] });
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: InputColumn, decorators: [{
|
|
107
|
+
type: Component,
|
|
108
|
+
args: [{ selector: 'tots-input-column', template: "<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n", styles: ["mat-form-field{margin-bottom:0}\n"] }]
|
|
109
|
+
}], ctorParameters: function () { return []; } });
|
|
110
|
+
|
|
111
|
+
class TotsEditableColumnsModule {
|
|
112
|
+
}
|
|
113
|
+
TotsEditableColumnsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
114
|
+
TotsEditableColumnsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, declarations: [
|
|
115
|
+
/** Columns */
|
|
116
|
+
InputColumn], imports: [CommonModule,
|
|
117
|
+
FormsModule,
|
|
118
|
+
ReactiveFormsModule,
|
|
119
|
+
/** Angular Material */
|
|
120
|
+
MatFormFieldModule,
|
|
121
|
+
MatInputModule], exports: [
|
|
122
|
+
/** Columns */
|
|
123
|
+
InputColumn] });
|
|
124
|
+
TotsEditableColumnsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, imports: [CommonModule,
|
|
125
|
+
FormsModule,
|
|
126
|
+
ReactiveFormsModule,
|
|
127
|
+
/** Angular Material */
|
|
128
|
+
MatFormFieldModule,
|
|
129
|
+
MatInputModule] });
|
|
130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TotsEditableColumnsModule, decorators: [{
|
|
131
|
+
type: NgModule,
|
|
132
|
+
args: [{
|
|
133
|
+
declarations: [
|
|
134
|
+
/** Columns */
|
|
135
|
+
InputColumn
|
|
136
|
+
],
|
|
137
|
+
imports: [
|
|
138
|
+
CommonModule,
|
|
139
|
+
FormsModule,
|
|
140
|
+
ReactiveFormsModule,
|
|
141
|
+
/** Angular Material */
|
|
142
|
+
MatFormFieldModule,
|
|
143
|
+
MatInputModule,
|
|
144
|
+
],
|
|
145
|
+
exports: [
|
|
146
|
+
/** Columns */
|
|
147
|
+
InputColumn
|
|
148
|
+
]
|
|
149
|
+
}]
|
|
150
|
+
}] });
|
|
151
|
+
|
|
152
|
+
/*
|
|
153
|
+
* Public API Surface of editable-columns
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Generated bundle index. Do not edit.
|
|
158
|
+
*/
|
|
159
|
+
|
|
160
|
+
export { InputColumn, TotsEditableColumnsModule };
|
|
161
|
+
//# sourceMappingURL=tots-editable-columns.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tots-editable-columns.mjs","sources":["../../../../projects/tots/editable-columns/src/lib/columns/input-column/input-column.component.ts","../../../../projects/tots/editable-columns/src/lib/columns/input-column/input-column.component.html","../../../../projects/tots/editable-columns/src/lib/editable-columns.module.ts","../../../../projects/tots/editable-columns/src/public-api.ts","../../../../projects/tots/editable-columns/src/tots-editable-columns.ts"],"sourcesContent":["import { Component } from '@angular/core';\nimport { FormControl, FormGroup, ValidatorFn } from '@angular/forms';\nimport { MatFormFieldAppearance } from '@angular/material/form-field';\nimport { TotsBaseColumnComponent, TotsTableHelper } from '@tots/table';\n\n@Component({\n selector: 'tots-input-column',\n templateUrl: './input-column.component.html',\n styleUrls: ['./input-column.component.css']\n})\nexport class InputColumn extends TotsBaseColumnComponent {\n\n input!: FormControl;\n\n constructor() {\n super();\n }\n\n ngOnInit(): void {\n this.loadInput();\n this.loadForm();\n this.loadChanges();\n }\n\n loadChanges() {\n this.input.valueChanges\n .subscribe(res => {\n this.onAction.next({ key: 'input-change', item: { field_key: this.getFormKey(), item: this.item, value: res, valid: this.input.valid } });\n });\n }\n\n loadForm() {\n if(this.column.extra == undefined || this.column.extra.group == undefined){\n return;\n }\n\n let group: FormGroup = this.column.extra.group;\n if(group.get(this.getFormKey()) != undefined){\n return;\n }\n\n group.addControl(this.getFormKey(), this.input);\n }\n\n loadInput() {\n let value = TotsTableHelper.getItemValueByKey(this.item, this.column.field_key);\n this.input = new FormControl(value, this.getValidators());\n }\n\n getFormKey(): string {\n if(Array.isArray(this.column.field_key)){\n return this.column.field_key.join('_');\n } else {\n return this.column.field_key!;\n }\n }\n\n getValidators() : ValidatorFn[] | ValidatorFn | null {\n if (this.column.extra && this.column.extra.validators) {\n return this.column.extra.validators;\n }\n return null;\n }\n\n getErrorMessage() : string {\n if (!this.column.extra.errors) {\n return '';\n }\n\n for (const error of this.column.extra.errors) {\n if (this.input.hasError(error.name)) {\n return error.message;\n }\n }\n\n return '';\n }\n\n getAppearance() : MatFormFieldAppearance {\n if (this.column.extra && this.column.extra.appearance) {\n return this.column.extra.appearance;\n }\n return 'fill';\n }\n\n getLabel() : string | undefined {\n if (this.column.extra && this.column.extra.label) {\n return this.column.extra.label;\n }\n return undefined;\n }\n\n getClasses() : string {\n if (this.column.extra && this.column.extra.classes) {\n return this.column.extra.classes;\n }\n return '';\n }\n\n getPlaceholder() : string {\n if (this.column.extra && this.column.extra.placeholder) {\n return this.column.extra.placeholder;\n }\n return '';\n }\n\n getCaption() : string {\n if (this.column.extra && this.column.extra.caption) {\n return this.column.extra.caption;\n }\n return '';\n }\n\n hasError() : boolean {\n return this.input.invalid && (this.input.dirty || this.input.touched);\n }\n\n getInput() {\n return this.input;\n }\n}\n","<mat-form-field class=\"{{getClasses()}}\" [appearance]=\"getAppearance()\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"getLabel()\"> {{ getLabel() }} </mat-label>\n <input matInput type=\"text\" [formControl]=\"input\" [placeholder]=\"getPlaceholder()\"/>\n <mat-hint *ngIf=\"getCaption()\" [align]=\"'end'\"> {{getCaption()}} </mat-hint>\n <mat-error *ngIf=\"hasError()\">{{getErrorMessage()}}</mat-error>\n</mat-form-field>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\n/** Angular Material */\nimport { MatInputModule } from '@angular/material/input';\nimport { MatFormFieldModule } from '@angular/material/form-field';\n\n/** Columns */\nimport { InputColumn } from './columns/input-column/input-column.component';\n\n\n\n\n\n@NgModule({\n declarations: [\n\n /** Columns */\n InputColumn\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n\n /** Angular Material */\n MatFormFieldModule,\n MatInputModule,\n ],\n exports: [\n /** Columns */\n InputColumn\n ]\n})\nexport class TotsEditableColumnsModule { }\n","/*\n * Public API Surface of editable-columns\n */\n\n/**\n * Columns\n */\nexport * from './lib/columns/input-column/input-column.component';\n\n/**\n * Modules\n */\nexport * from './lib/editable-columns.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAUM,MAAO,WAAY,SAAQ,uBAAuB,CAAA;AAItD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE,CAAC;KACT;IAED,QAAQ,GAAA;QACN,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB;IAED,WAAW,GAAA;QACT,IAAI,CAAC,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,24 @@
|
|
|
1
|
+
import { FormControl, ValidatorFn } from '@angular/forms';
|
|
2
|
+
import { MatFormFieldAppearance } from '@angular/material/form-field';
|
|
3
|
+
import { TotsBaseColumnComponent } from '@tots/table';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class InputColumn extends TotsBaseColumnComponent {
|
|
6
|
+
input: FormControl;
|
|
7
|
+
constructor();
|
|
8
|
+
ngOnInit(): void;
|
|
9
|
+
loadChanges(): void;
|
|
10
|
+
loadForm(): void;
|
|
11
|
+
loadInput(): void;
|
|
12
|
+
getFormKey(): string;
|
|
13
|
+
getValidators(): ValidatorFn[] | ValidatorFn | null;
|
|
14
|
+
getErrorMessage(): string;
|
|
15
|
+
getAppearance(): MatFormFieldAppearance;
|
|
16
|
+
getLabel(): string | undefined;
|
|
17
|
+
getClasses(): string;
|
|
18
|
+
getPlaceholder(): string;
|
|
19
|
+
getCaption(): string;
|
|
20
|
+
hasError(): boolean;
|
|
21
|
+
getInput(): FormControl<any>;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InputColumn, never>;
|
|
23
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InputColumn, "tots-input-column", never, {}, {}, never, never, false, never>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./columns/input-column/input-column.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/forms";
|
|
5
|
+
import * as i4 from "@angular/material/form-field";
|
|
6
|
+
import * as i5 from "@angular/material/input";
|
|
7
|
+
export declare class TotsEditableColumnsModule {
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TotsEditableColumnsModule, never>;
|
|
9
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TotsEditableColumnsModule, [typeof i1.InputColumn], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.MatFormFieldModule, typeof i5.MatInputModule], [typeof i1.InputColumn]>;
|
|
10
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<TotsEditableColumnsModule>;
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tots/editable-columns",
|
|
3
|
+
"version": "15.0.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^15.0.0",
|
|
6
|
+
"@angular/core": "^15.0.0",
|
|
7
|
+
"@angular/material": "^15.0.0",
|
|
8
|
+
"@tots/table": "^15.0.42"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"tslib": "^2.3.0"
|
|
12
|
+
},
|
|
13
|
+
"module": "fesm2015/tots-editable-columns.mjs",
|
|
14
|
+
"es2020": "fesm2020/tots-editable-columns.mjs",
|
|
15
|
+
"esm2020": "esm2020/tots-editable-columns.mjs",
|
|
16
|
+
"fesm2020": "fesm2020/tots-editable-columns.mjs",
|
|
17
|
+
"fesm2015": "fesm2015/tots-editable-columns.mjs",
|
|
18
|
+
"typings": "index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": {
|
|
21
|
+
"default": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
|
+
"esm2020": "./esm2020/tots-editable-columns.mjs",
|
|
26
|
+
"es2020": "./fesm2020/tots-editable-columns.mjs",
|
|
27
|
+
"es2015": "./fesm2015/tots-editable-columns.mjs",
|
|
28
|
+
"node": "./fesm2015/tots-editable-columns.mjs",
|
|
29
|
+
"default": "./fesm2020/tots-editable-columns.mjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"sideEffects": false
|
|
33
|
+
}
|