@messaia/cdk 13.3.5-rc10 → 13.3.5-rc13
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/esm2020/lib/base/components/generic-list.component.mjs +6 -1
- package/esm2020/lib/base/components/generic-reactive-form.component.mjs +4 -1
- package/esm2020/lib/forms/functions/decorators.mjs +9 -40
- package/esm2020/lib/forms/functions/functions.mjs +36 -3
- package/esm2020/lib/forms/models/form-field-definition.mjs +1 -1
- package/esm2020/lib/select/components/select.component.mjs +16 -3
- package/esm2020/lib/table/models/table-definition.mjs +1 -1
- package/esm2020/lib/table/table.data-source.mjs +2 -2
- package/fesm2015/messaia-cdk.mjs +77 -53
- package/fesm2015/messaia-cdk.mjs.map +1 -1
- package/fesm2020/messaia-cdk.mjs +76 -53
- package/fesm2020/messaia-cdk.mjs.map +1 -1
- package/lib/base/components/generic-list.component.d.ts +4 -0
- package/lib/forms/functions/decorators.d.ts +3 -5
- package/lib/forms/functions/functions.d.ts +7 -0
- package/lib/forms/models/form-field-definition.d.ts +1 -1
- package/lib/select/components/select.component.d.ts +7 -1
- package/lib/table/models/table-definition.d.ts +1 -0
- package/lib/table/table.data-source.d.ts +2 -2
- package/package.json +1 -1
package/fesm2020/messaia-cdk.mjs
CHANGED
|
@@ -3131,13 +3131,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
3131
3131
|
const formFieldsMetadataKey = 'custom::vdFormFields';
|
|
3132
3132
|
const formFieldGroupsMetadataKey = 'custom:vdFormFieldGroups';
|
|
3133
3133
|
|
|
3134
|
+
class FormFieldGroupDefinition {
|
|
3135
|
+
/**
|
|
3136
|
+
* constructor
|
|
3137
|
+
* @param init
|
|
3138
|
+
*/
|
|
3139
|
+
constructor(init) {
|
|
3140
|
+
this.name = 'details';
|
|
3141
|
+
this.fields = [];
|
|
3142
|
+
Object.assign(this, init);
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
/**
|
|
3147
|
+
* Gets poperties decoarated with @FormField grouped by row
|
|
3148
|
+
* @param origin
|
|
3149
|
+
* @returns
|
|
3150
|
+
* @deprecated
|
|
3151
|
+
*/
|
|
3152
|
+
function getFormGroupsOld(origin) {
|
|
3153
|
+
return Reflect.getMetadata(formFieldsMetadataKey, origin);
|
|
3154
|
+
}
|
|
3134
3155
|
/**
|
|
3135
3156
|
* Gets poperties decoarated with @FormField grouped by row
|
|
3136
3157
|
* @param origin
|
|
3137
3158
|
* @returns
|
|
3138
3159
|
*/
|
|
3139
3160
|
function getFormGroups(origin) {
|
|
3140
|
-
|
|
3161
|
+
/* Get main fields grouped by the group name */
|
|
3162
|
+
const mainFieldGroups = Utils.groupArrayBy(Reflect.getMetadata(formFieldsMetadataKey, origin), x => x.groupName);
|
|
3163
|
+
/* Group the fields */
|
|
3164
|
+
var groups = Array.from(mainFieldGroups).map(([_, value], i) => new FormFieldGroupDefinition({
|
|
3165
|
+
name: value[0].groupName || null,
|
|
3166
|
+
header: value[0].groupHeader,
|
|
3167
|
+
index: i,
|
|
3168
|
+
groups: Object.values((value).reduce(function (r, a) {
|
|
3169
|
+
r[a.row] = (r[a.row] || []);
|
|
3170
|
+
r[a.row].push(a);
|
|
3171
|
+
r[a.row].forEach((x, i) => x.index = x.index || i);
|
|
3172
|
+
Utils.sortArray(r[a.row], 'index');
|
|
3173
|
+
return r;
|
|
3174
|
+
}, Object.create(null)))
|
|
3175
|
+
}));
|
|
3176
|
+
/* Get object groups */
|
|
3177
|
+
var objectFieldGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, origin);
|
|
3178
|
+
if (objectFieldGroups) {
|
|
3179
|
+
groups = groups.concat(objectFieldGroups);
|
|
3180
|
+
}
|
|
3181
|
+
/* Sort the groups by index */
|
|
3182
|
+
Utils.sortArray(groups, 'index');
|
|
3183
|
+
return groups;
|
|
3141
3184
|
}
|
|
3142
3185
|
|
|
3143
3186
|
// @dynamic
|
|
@@ -4679,7 +4722,7 @@ class TableDataSource extends DataSource {
|
|
|
4679
4722
|
/* Load data and return it */
|
|
4680
4723
|
return this.service.getList(Object.assign({
|
|
4681
4724
|
includes: this.includes,
|
|
4682
|
-
projection: this.projection,
|
|
4725
|
+
projection: Array.isArray(this.projection) ? this.projection.join(',') : this.projection,
|
|
4683
4726
|
page: this.paginator.pageIndex + 1,
|
|
4684
4727
|
pageSize: this.paginator.pageSize,
|
|
4685
4728
|
search: this.filter.toLowerCase(),
|
|
@@ -5175,6 +5218,10 @@ class GenericListComponent extends BaseComponent {
|
|
|
5175
5218
|
* The navigations to includes
|
|
5176
5219
|
*/
|
|
5177
5220
|
this.includes = [];
|
|
5221
|
+
/**
|
|
5222
|
+
* projection: string | string[]
|
|
5223
|
+
*/
|
|
5224
|
+
this.projection = [];
|
|
5178
5225
|
/**
|
|
5179
5226
|
* The navigations to includes
|
|
5180
5227
|
*/
|
|
@@ -5324,6 +5371,7 @@ class GenericListComponent extends BaseComponent {
|
|
|
5324
5371
|
this.dataSource = new TableDataSource(this.service, this.paginator, this.sort);
|
|
5325
5372
|
/* Set includes */
|
|
5326
5373
|
this.dataSource.includes = this.includes;
|
|
5374
|
+
this.dataSource.projection = this.projection;
|
|
5327
5375
|
/* Load query from browser storage */
|
|
5328
5376
|
var storredQuery = AppStorage.getObject(`${this.appSetting.projectName}.${this.router.url}`);
|
|
5329
5377
|
if (storredQuery) {
|
|
@@ -11859,6 +11907,9 @@ class GenericReactiveFormComponent extends GenericFormBaseComponent {
|
|
|
11859
11907
|
super.onAfterFormBuild();
|
|
11860
11908
|
if (this.buildFieldGroups && !this.fieldGroups) {
|
|
11861
11909
|
this.fieldGroups = getFormGroups(new this.entityCtor());
|
|
11910
|
+
if (this.debug) {
|
|
11911
|
+
console.log('Field groups', this.fieldGroups);
|
|
11912
|
+
}
|
|
11862
11913
|
}
|
|
11863
11914
|
}
|
|
11864
11915
|
/**
|
|
@@ -13771,12 +13822,25 @@ class VdSelectComponent extends AbstractMatFormField {
|
|
|
13771
13822
|
this.filteredOptions = this.options.filter((x) => x[this.text]?.toLowerCase().search(searchText.toLowerCase()) > -1);
|
|
13772
13823
|
}
|
|
13773
13824
|
}
|
|
13825
|
+
/**
|
|
13826
|
+
* Gets the values of the selected options for the trigger
|
|
13827
|
+
* @param options
|
|
13828
|
+
* @returns
|
|
13829
|
+
*/
|
|
13830
|
+
getTriggerValues(options) {
|
|
13831
|
+
if (Array.isArray(options)) {
|
|
13832
|
+
return (options || [])?.map(x => this.mapper ? x.value : x.viewValue);
|
|
13833
|
+
}
|
|
13834
|
+
else {
|
|
13835
|
+
return this.mapper ? options?.value : options?.viewValue;
|
|
13836
|
+
}
|
|
13837
|
+
}
|
|
13774
13838
|
}
|
|
13775
13839
|
/** @nocollapse */ /** @nocollapse */ VdSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdSelectComponent, deps: [{ token: i0.Injector }, { token: i1.NgControl, optional: true, self: true }, { token: i1.NgForm, optional: true }, { token: i1.FormGroupDirective, optional: true }, { token: i2$1.ErrorStateMatcher }, { token: i3$2.FocusMonitor }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
13776
|
-
/** @nocollapse */ /** @nocollapse */ VdSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: VdSelectComponent, selector: "vd-select", inputs: { multiple: "multiple", disabled: "disabled", sorted: "sorted", textPrefix: "textPrefix", endpoint: "endpoint", params: "params", projection: "projection", enum: "enum", key: "key", text: "text", prefix: "prefix", options: "options", filteredOptions: "filteredOptions", filterable: "filterable", cache: "cache", sortBy: "sortBy", mapper: "mapper", compareWith: "compareWith", searchField: "searchField" }, outputs: { onValueChange: "change", onItemChange: "itemChange", onSelected: "selected", onItemSelected: "itemSelected", onLaunch: "launch" }, providers: [{ provide: MatFormFieldControl, useExisting: VdSelectComponent }], queries: [{ propertyName: "optionTemplate", first: true, predicate: VdSelectOptionDirective, descendants: true }, { propertyName: "triggerTemplate", first: true, predicate: VdSelectTriggerDirective, descendants: true }], viewQueries: [{ propertyName: "selectEl", first: true, predicate: MatSelect, descendants: true }, { propertyName: "filterInput", first: true, predicate: ["filterInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-select [placeholder]=\"placeholder\" i18n-placeholder [(ngModel)]=\"value\" #select=\"matSelect\" (selectionChange)=\"handleChange($event)\" *ngIf=\"!readonly\" [multiple]=\"multiple\" [compareWith]=\"compareWith\" [disabled]=\"disabled\" flex>\r\n <!-- #region Filter input -->\r\n <input #filterInput *ngIf=\"filterable\" type=\"text\" placeholder=\"Filter...\" class=\"vd-select-filter\" (keyup)=\"handleFilter($event.target.value)\">\r\n <!-- #endregion -->\r\n\r\n <!-- #region Trigger for launch button -->\r\n <mat-select-trigger *ngIf=\"onLaunch?.observers?.length > 0\">\r\n <span>{{select.selected
|
|
13840
|
+
/** @nocollapse */ /** @nocollapse */ VdSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: VdSelectComponent, selector: "vd-select", inputs: { multiple: "multiple", disabled: "disabled", sorted: "sorted", textPrefix: "textPrefix", endpoint: "endpoint", params: "params", projection: "projection", enum: "enum", key: "key", text: "text", prefix: "prefix", options: "options", filteredOptions: "filteredOptions", filterable: "filterable", cache: "cache", sortBy: "sortBy", mapper: "mapper", compareWith: "compareWith", searchField: "searchField" }, outputs: { onValueChange: "change", onItemChange: "itemChange", onSelected: "selected", onItemSelected: "itemSelected", onLaunch: "launch" }, providers: [{ provide: MatFormFieldControl, useExisting: VdSelectComponent }], queries: [{ propertyName: "optionTemplate", first: true, predicate: VdSelectOptionDirective, descendants: true }, { propertyName: "triggerTemplate", first: true, predicate: VdSelectTriggerDirective, descendants: true }], viewQueries: [{ propertyName: "selectEl", first: true, predicate: MatSelect, descendants: true }, { propertyName: "filterInput", first: true, predicate: ["filterInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<mat-select [placeholder]=\"placeholder\" i18n-placeholder [(ngModel)]=\"value\" #select=\"matSelect\" (selectionChange)=\"handleChange($event)\" *ngIf=\"!readonly\" [multiple]=\"multiple\" [compareWith]=\"compareWith\" [disabled]=\"disabled\" flex>\r\n <!-- #region Filter input -->\r\n <input #filterInput *ngIf=\"filterable\" type=\"text\" placeholder=\"Filter...\" class=\"vd-select-filter\" (keyup)=\"handleFilter($event.target.value)\">\r\n <!-- #endregion -->\r\n\r\n <!-- #region Trigger for launch button -->\r\n <mat-select-trigger *ngIf=\"onLaunch?.observers?.length > 0\">\r\n <span>{{getTriggerValues(select.selected)}}</span>\r\n <mat-icon class=\"vd-select-launch\" (click)=\"$event.stopPropagation(); handleLaunchClicked(value)\">launch</mat-icon>\r\n </mat-select-trigger>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Custom trigger template -->\r\n <mat-select-trigger *ngIf=\"!onLaunch?.observers?.length && triggerTemplate?.templateRef\">\r\n <ng-template *ngIf=\"triggerTemplate?.templateRef\" [ngTemplateOutlet]=\"triggerTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ trigger: getTriggerValues(select.selected) }\"></ng-template>\r\n </mat-select-trigger>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Option template as trigger -->\r\n <mat-select-trigger *ngIf=\"!onLaunch?.observers?.length && !triggerTemplate?.templateRef && optionTemplate?.templateRef\">\r\n <ng-template *ngIf=\"optionTemplate?.templateRef\" [ngTemplateOutlet]=\"optionTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ trigger: getTriggerValues(select.selected) }\"></ng-template>\r\n </mat-select-trigger>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Default option -->\r\n <mat-option class=\"tc-grey-500\" *ngIf=\"!multiple\" i18n=\"@@pleaseSelect\">--- Please Select ---</mat-option>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Options -->\r\n <ng-template let-option let-first=\"first\" ngFor [ngForOf]=\"filteredOptions\">\r\n <mat-option [value]=\"mapper ? option : option[key]\">\r\n <span *ngIf=\"!optionTemplate?.templateRef\" i18n=\"@@selection\">{option[text], select, option {option} other {{{option[text]}}}}</span>\r\n <ng-template *ngIf=\"optionTemplate?.templateRef\" [ngTemplateOutlet]=\"optionTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ option: option }\"></ng-template>\r\n </mat-option>\r\n </ng-template>\r\n <!-- #endregion -->\r\n</mat-select>\r\n\r\n<!-- #region Read only value -->\r\n<div *ngIf=\"readonly\">\r\n <div *ngIf=\"currentValue\">\r\n <div class=\"readonly-value\">\r\n <span *ngIf=\"!optionTemplate?.templateRef\">\r\n <span *ngIf=\"!multiple\" i18n=\"@@selection\">{currentValue[text], select, option {option} other {{{currentValue[text]}}}}</span>\r\n <ng-container *ngIf=\"multiple\">\r\n <span *ngFor=\"let optionValue of currentValue; let last = last\">\r\n <span i18n=\"@@selection\">{optionValue[text], select, option {option} other {{{optionValue[text]}}}}</span>\r\n <span *ngIf=\"!last\">, </span>\r\n </span>\r\n </ng-container>\r\n </span>\r\n <ng-template *ngIf=\"optionTemplate?.templateRef\" [ngTemplateOutlet]=\"optionTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ option: currentValue }\"></ng-template>\r\n </div>\r\n <mat-icon *ngIf=\"onLaunch?.observers?.length > 0\" class=\"vd-select-launch-readonly\" (click)=\"$event.stopPropagation(); handleLaunchClicked(value)\">launch</mat-icon>\r\n </div>\r\n <div *ngIf=\"!currentValue\"> </div>\r\n</div>\r\n<!-- #endregion -->", styles: [".vd-select-launch{position:absolute;right:30px;top:-5px;font-size:18px;cursor:pointer}.readonly-value{padding-right:24px;color:#000000a3;min-height:15px}.vd-select-launch-readonly{position:absolute;right:0px;top:9px;font-size:18px;cursor:pointer}.vd-select-filter{position:sticky;top:0;z-index:100;font-size:inherit;box-shadow:none;border-radius:0;padding:16px;box-sizing:border-box;border:none;border-bottom:1px solid #dcdcdc;width:100%;background-color:#f5f5f5;outline:none}\n"], components: [{ type: i4$2.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i2$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4$2.MatSelectTrigger, selector: "mat-select-trigger" }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
13777
13841
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdSelectComponent, decorators: [{
|
|
13778
13842
|
type: Component,
|
|
13779
|
-
args: [{ selector: 'vd-select', providers: [{ provide: MatFormFieldControl, useExisting: VdSelectComponent }], template: "<mat-select [placeholder]=\"placeholder\" i18n-placeholder [(ngModel)]=\"value\" #select=\"matSelect\" (selectionChange)=\"handleChange($event)\" *ngIf=\"!readonly\" [multiple]=\"multiple\" [compareWith]=\"compareWith\" [disabled]=\"disabled\" flex>\r\n <!-- #region Filter input -->\r\n <input #filterInput *ngIf=\"filterable\" type=\"text\" placeholder=\"Filter...\" class=\"vd-select-filter\" (keyup)=\"handleFilter($event.target.value)\">\r\n <!-- #endregion -->\r\n\r\n <!-- #region Trigger for launch button -->\r\n <mat-select-trigger *ngIf=\"onLaunch?.observers?.length > 0\">\r\n <span>{{select.selected
|
|
13843
|
+
args: [{ selector: 'vd-select', providers: [{ provide: MatFormFieldControl, useExisting: VdSelectComponent }], template: "<mat-select [placeholder]=\"placeholder\" i18n-placeholder [(ngModel)]=\"value\" #select=\"matSelect\" (selectionChange)=\"handleChange($event)\" *ngIf=\"!readonly\" [multiple]=\"multiple\" [compareWith]=\"compareWith\" [disabled]=\"disabled\" flex>\r\n <!-- #region Filter input -->\r\n <input #filterInput *ngIf=\"filterable\" type=\"text\" placeholder=\"Filter...\" class=\"vd-select-filter\" (keyup)=\"handleFilter($event.target.value)\">\r\n <!-- #endregion -->\r\n\r\n <!-- #region Trigger for launch button -->\r\n <mat-select-trigger *ngIf=\"onLaunch?.observers?.length > 0\">\r\n <span>{{getTriggerValues(select.selected)}}</span>\r\n <mat-icon class=\"vd-select-launch\" (click)=\"$event.stopPropagation(); handleLaunchClicked(value)\">launch</mat-icon>\r\n </mat-select-trigger>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Custom trigger template -->\r\n <mat-select-trigger *ngIf=\"!onLaunch?.observers?.length && triggerTemplate?.templateRef\">\r\n <ng-template *ngIf=\"triggerTemplate?.templateRef\" [ngTemplateOutlet]=\"triggerTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ trigger: getTriggerValues(select.selected) }\"></ng-template>\r\n </mat-select-trigger>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Option template as trigger -->\r\n <mat-select-trigger *ngIf=\"!onLaunch?.observers?.length && !triggerTemplate?.templateRef && optionTemplate?.templateRef\">\r\n <ng-template *ngIf=\"optionTemplate?.templateRef\" [ngTemplateOutlet]=\"optionTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ trigger: getTriggerValues(select.selected) }\"></ng-template>\r\n </mat-select-trigger>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Default option -->\r\n <mat-option class=\"tc-grey-500\" *ngIf=\"!multiple\" i18n=\"@@pleaseSelect\">--- Please Select ---</mat-option>\r\n <!-- #endregion -->\r\n\r\n <!-- #region Options -->\r\n <ng-template let-option let-first=\"first\" ngFor [ngForOf]=\"filteredOptions\">\r\n <mat-option [value]=\"mapper ? option : option[key]\">\r\n <span *ngIf=\"!optionTemplate?.templateRef\" i18n=\"@@selection\">{option[text], select, option {option} other {{{option[text]}}}}</span>\r\n <ng-template *ngIf=\"optionTemplate?.templateRef\" [ngTemplateOutlet]=\"optionTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ option: option }\"></ng-template>\r\n </mat-option>\r\n </ng-template>\r\n <!-- #endregion -->\r\n</mat-select>\r\n\r\n<!-- #region Read only value -->\r\n<div *ngIf=\"readonly\">\r\n <div *ngIf=\"currentValue\">\r\n <div class=\"readonly-value\">\r\n <span *ngIf=\"!optionTemplate?.templateRef\">\r\n <span *ngIf=\"!multiple\" i18n=\"@@selection\">{currentValue[text], select, option {option} other {{{currentValue[text]}}}}</span>\r\n <ng-container *ngIf=\"multiple\">\r\n <span *ngFor=\"let optionValue of currentValue; let last = last\">\r\n <span i18n=\"@@selection\">{optionValue[text], select, option {option} other {{{optionValue[text]}}}}</span>\r\n <span *ngIf=\"!last\">, </span>\r\n </span>\r\n </ng-container>\r\n </span>\r\n <ng-template *ngIf=\"optionTemplate?.templateRef\" [ngTemplateOutlet]=\"optionTemplate?.templateRef\" [ngTemplateOutletContext]=\"{ option: currentValue }\"></ng-template>\r\n </div>\r\n <mat-icon *ngIf=\"onLaunch?.observers?.length > 0\" class=\"vd-select-launch-readonly\" (click)=\"$event.stopPropagation(); handleLaunchClicked(value)\">launch</mat-icon>\r\n </div>\r\n <div *ngIf=\"!currentValue\"> </div>\r\n</div>\r\n<!-- #endregion -->", styles: [".vd-select-launch{position:absolute;right:30px;top:-5px;font-size:18px;cursor:pointer}.readonly-value{padding-right:24px;color:#000000a3;min-height:15px}.vd-select-launch-readonly{position:absolute;right:0px;top:9px;font-size:18px;cursor:pointer}.vd-select-filter{position:sticky;top:0;z-index:100;font-size:inherit;box-shadow:none;border-radius:0;padding:16px;box-sizing:border-box;border:none;border-bottom:1px solid #dcdcdc;width:100%;background-color:#f5f5f5;outline:none}\n"] }]
|
|
13780
13844
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.NgControl, decorators: [{
|
|
13781
13845
|
type: Optional
|
|
13782
13846
|
}, {
|
|
@@ -14448,35 +14512,23 @@ class FormFieldDefinition {
|
|
|
14448
14512
|
}
|
|
14449
14513
|
}
|
|
14450
14514
|
|
|
14451
|
-
class FormFieldGroupDefinition {
|
|
14452
|
-
/**
|
|
14453
|
-
* constructor
|
|
14454
|
-
* @param init
|
|
14455
|
-
*/
|
|
14456
|
-
constructor(init) {
|
|
14457
|
-
this.name = 'details';
|
|
14458
|
-
this.fields = [];
|
|
14459
|
-
Object.assign(this, init);
|
|
14460
|
-
}
|
|
14461
|
-
}
|
|
14462
|
-
|
|
14463
14515
|
/**
|
|
14464
14516
|
* Property decorator to create form fields
|
|
14465
14517
|
* @param args
|
|
14466
14518
|
* @returns
|
|
14467
14519
|
*/
|
|
14468
|
-
function FormField(args
|
|
14520
|
+
function FormField(args) {
|
|
14469
14521
|
return function (target, propertyKey) {
|
|
14470
14522
|
/* Get property name */
|
|
14471
|
-
var propertyName = args
|
|
14523
|
+
var propertyName = args.name || propertyKey;
|
|
14472
14524
|
/* Get property type */
|
|
14473
14525
|
var propertyType = Reflect.getMetadata("design:type", target, propertyKey)?.name;
|
|
14474
14526
|
/* Create table column */
|
|
14475
14527
|
var formField = new FormFieldDefinition(Object.assign(args, {
|
|
14476
|
-
name: args
|
|
14477
|
-
header: args
|
|
14478
|
-
autocompleteTemplate: args
|
|
14479
|
-
chipTemplate: args
|
|
14528
|
+
name: args.name || propertyKey,
|
|
14529
|
+
header: args.header || Reflect.getMetadata(headerMetadataKey, target, propertyKey) || propertyName,
|
|
14530
|
+
autocompleteTemplate: args.autocompleteTemplate || ((option) => option[formField.autocompleteText]),
|
|
14531
|
+
chipTemplate: args.chipTemplate || ((chip) => chip[formField.chipText])
|
|
14480
14532
|
}));
|
|
14481
14533
|
/* Type enum */
|
|
14482
14534
|
if (formField.enumType) {
|
|
@@ -14522,36 +14574,11 @@ function FormField(args = null) {
|
|
|
14522
14574
|
let formFields = previousFormFields ? previousFormFields.concat([formField]) : [formField];
|
|
14523
14575
|
/* Override the result in the metadata */
|
|
14524
14576
|
Reflect.defineMetadata(formFieldsMetadataKey, formFields, target);
|
|
14525
|
-
/* Get old form field groups */
|
|
14526
|
-
const previousGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, target) || [];
|
|
14527
|
-
/* Get the group by group name from the previous saved groups */
|
|
14528
|
-
var group = previousGroups?.filter(x => x.name == formField.groupName)[0];
|
|
14529
|
-
/* If the group doesn't exist, create a new one and add it to the previous groups */
|
|
14530
|
-
if (!group) {
|
|
14531
|
-
group = new FormFieldGroupDefinition({ index: 0, name: formField.groupName || null, header: formField.groupHeader });
|
|
14532
|
-
previousGroups.push(group);
|
|
14533
|
-
}
|
|
14534
|
-
/* Add the fields to the current group */
|
|
14535
|
-
group.fields.push(formField);
|
|
14536
|
-
/* Group the field by 'row' */
|
|
14537
|
-
group.groups = Object.values((group.fields).reduce(function (r, a) {
|
|
14538
|
-
r[a.row] = (r[a.row] || []);
|
|
14539
|
-
r[a.row].push(a);
|
|
14540
|
-
r[a.row].forEach((x, i) => x.index = x.index || i);
|
|
14541
|
-
Utils.sortArray(r[a.row], 'index');
|
|
14542
|
-
return r;
|
|
14543
|
-
}, Object.create(null)));
|
|
14544
|
-
/* Sort the groups by index */
|
|
14545
|
-
Utils.sortArray(previousGroups, 'index');
|
|
14546
|
-
/* Override the result in the metadata */
|
|
14547
|
-
Reflect.defineMetadata(formFieldGroupsMetadataKey, previousGroups, target);
|
|
14548
14577
|
};
|
|
14549
14578
|
}
|
|
14550
14579
|
/**
|
|
14551
14580
|
* Property decorator to create form fields
|
|
14552
|
-
* @param
|
|
14553
|
-
* @param header
|
|
14554
|
-
* @param init
|
|
14581
|
+
* @param args
|
|
14555
14582
|
* @returns
|
|
14556
14583
|
*/
|
|
14557
14584
|
function FormFieldGroup(type, args = null) {
|
|
@@ -14579,12 +14606,8 @@ function FormFieldGroup(type, args = null) {
|
|
|
14579
14606
|
});
|
|
14580
14607
|
/* Get old form field groups */
|
|
14581
14608
|
var previousGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, target);
|
|
14582
|
-
/* Add the current groups to the previous groups */
|
|
14583
|
-
previousGroups = (previousGroups ? previousGroups.concat(groups) : groups);
|
|
14584
|
-
/* Sort the groups by index */
|
|
14585
|
-
Utils.sortArray(previousGroups, 'index');
|
|
14586
14609
|
/* Override the result in the metadata */
|
|
14587
|
-
Reflect.defineMetadata(formFieldGroupsMetadataKey, previousGroups, target);
|
|
14610
|
+
Reflect.defineMetadata(formFieldGroupsMetadataKey, (previousGroups ? previousGroups.concat(groups) : groups), target);
|
|
14588
14611
|
};
|
|
14589
14612
|
}
|
|
14590
14613
|
|