@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.
@@ -3137,13 +3137,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
3137
3137
  const formFieldsMetadataKey = 'custom::vdFormFields';
3138
3138
  const formFieldGroupsMetadataKey = 'custom:vdFormFieldGroups';
3139
3139
 
3140
+ class FormFieldGroupDefinition {
3141
+ /**
3142
+ * constructor
3143
+ * @param init
3144
+ */
3145
+ constructor(init) {
3146
+ this.name = 'details';
3147
+ this.fields = [];
3148
+ Object.assign(this, init);
3149
+ }
3150
+ }
3151
+
3152
+ /**
3153
+ * Gets poperties decoarated with @FormField grouped by row
3154
+ * @param origin
3155
+ * @returns
3156
+ * @deprecated
3157
+ */
3158
+ function getFormGroupsOld(origin) {
3159
+ return Reflect.getMetadata(formFieldsMetadataKey, origin);
3160
+ }
3140
3161
  /**
3141
3162
  * Gets poperties decoarated with @FormField grouped by row
3142
3163
  * @param origin
3143
3164
  * @returns
3144
3165
  */
3145
3166
  function getFormGroups(origin) {
3146
- return Reflect.getMetadata(formFieldGroupsMetadataKey, origin);
3167
+ /* Get main fields grouped by the group name */
3168
+ const mainFieldGroups = Utils.groupArrayBy(Reflect.getMetadata(formFieldsMetadataKey, origin), x => x.groupName);
3169
+ /* Group the fields */
3170
+ var groups = Array.from(mainFieldGroups).map(([_, value], i) => new FormFieldGroupDefinition({
3171
+ name: value[0].groupName || null,
3172
+ header: value[0].groupHeader,
3173
+ index: i,
3174
+ groups: Object.values((value).reduce(function (r, a) {
3175
+ r[a.row] = (r[a.row] || []);
3176
+ r[a.row].push(a);
3177
+ r[a.row].forEach((x, i) => x.index = x.index || i);
3178
+ Utils.sortArray(r[a.row], 'index');
3179
+ return r;
3180
+ }, Object.create(null)))
3181
+ }));
3182
+ /* Get object groups */
3183
+ var objectFieldGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, origin);
3184
+ if (objectFieldGroups) {
3185
+ groups = groups.concat(objectFieldGroups);
3186
+ }
3187
+ /* Sort the groups by index */
3188
+ Utils.sortArray(groups, 'index');
3189
+ return groups;
3147
3190
  }
3148
3191
 
3149
3192
  // @dynamic
@@ -4695,7 +4738,7 @@ class TableDataSource extends DataSource {
4695
4738
  /* Load data and return it */
4696
4739
  return this.service.getList(Object.assign({
4697
4740
  includes: this.includes,
4698
- projection: this.projection,
4741
+ projection: Array.isArray(this.projection) ? this.projection.join(',') : this.projection,
4699
4742
  page: this.paginator.pageIndex + 1,
4700
4743
  pageSize: this.paginator.pageSize,
4701
4744
  search: this.filter.toLowerCase(),
@@ -5196,6 +5239,10 @@ class GenericListComponent extends BaseComponent {
5196
5239
  * The navigations to includes
5197
5240
  */
5198
5241
  this.includes = [];
5242
+ /**
5243
+ * projection: string | string[]
5244
+ */
5245
+ this.projection = [];
5199
5246
  /**
5200
5247
  * The navigations to includes
5201
5248
  */
@@ -5347,6 +5394,7 @@ class GenericListComponent extends BaseComponent {
5347
5394
  this.dataSource = new TableDataSource(this.service, this.paginator, this.sort);
5348
5395
  /* Set includes */
5349
5396
  this.dataSource.includes = this.includes;
5397
+ this.dataSource.projection = this.projection;
5350
5398
  /* Load query from browser storage */
5351
5399
  var storredQuery = AppStorage.getObject(`${this.appSetting.projectName}.${this.router.url}`);
5352
5400
  if (storredQuery) {
@@ -11886,6 +11934,9 @@ class GenericReactiveFormComponent extends GenericFormBaseComponent {
11886
11934
  super.onAfterFormBuild();
11887
11935
  if (this.buildFieldGroups && !this.fieldGroups) {
11888
11936
  this.fieldGroups = getFormGroups(new this.entityCtor());
11937
+ if (this.debug) {
11938
+ console.log('Field groups', this.fieldGroups);
11939
+ }
11889
11940
  }
11890
11941
  }
11891
11942
  /**
@@ -13814,12 +13865,26 @@ class VdSelectComponent extends AbstractMatFormField {
13814
13865
  this.filteredOptions = this.options.filter((x) => { var _a; return ((_a = x[this.text]) === null || _a === void 0 ? void 0 : _a.toLowerCase().search(searchText.toLowerCase())) > -1; });
13815
13866
  }
13816
13867
  }
13868
+ /**
13869
+ * Gets the values of the selected options for the trigger
13870
+ * @param options
13871
+ * @returns
13872
+ */
13873
+ getTriggerValues(options) {
13874
+ var _a;
13875
+ if (Array.isArray(options)) {
13876
+ return (_a = (options || [])) === null || _a === void 0 ? void 0 : _a.map(x => this.mapper ? x.value : x.viewValue);
13877
+ }
13878
+ else {
13879
+ return this.mapper ? options === null || options === void 0 ? void 0 : options.value : options === null || options === void 0 ? void 0 : options.viewValue;
13880
+ }
13881
+ }
13817
13882
  }
13818
13883
  /** @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 });
13819
- /** @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?select.selected['viewValue']:''}}</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: (select.selected||[])['viewValue'] }\"></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: (select.selected||[])['viewValue'] }\"></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\">,&nbsp;</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\">&nbsp;</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"] }] });
13884
+ /** @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\">,&nbsp;</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\">&nbsp;</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"] }] });
13820
13885
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: VdSelectComponent, decorators: [{
13821
13886
  type: Component,
13822
- 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?select.selected['viewValue']:''}}</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: (select.selected||[])['viewValue'] }\"></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: (select.selected||[])['viewValue'] }\"></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\">,&nbsp;</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\">&nbsp;</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"] }]
13887
+ 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\">,&nbsp;</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\">&nbsp;</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"] }]
13823
13888
  }], ctorParameters: function () {
13824
13889
  return [{ type: i0.Injector }, { type: i1.NgControl, decorators: [{
13825
13890
  type: Optional
@@ -14507,36 +14572,24 @@ class FormFieldDefinition {
14507
14572
  }
14508
14573
  }
14509
14574
 
14510
- class FormFieldGroupDefinition {
14511
- /**
14512
- * constructor
14513
- * @param init
14514
- */
14515
- constructor(init) {
14516
- this.name = 'details';
14517
- this.fields = [];
14518
- Object.assign(this, init);
14519
- }
14520
- }
14521
-
14522
14575
  /**
14523
14576
  * Property decorator to create form fields
14524
14577
  * @param args
14525
14578
  * @returns
14526
14579
  */
14527
- function FormField(args = null) {
14580
+ function FormField(args) {
14528
14581
  return function (target, propertyKey) {
14529
14582
  var _a;
14530
14583
  /* Get property name */
14531
- var propertyName = (args === null || args === void 0 ? void 0 : args.name) || propertyKey;
14584
+ var propertyName = args.name || propertyKey;
14532
14585
  /* Get property type */
14533
14586
  var propertyType = (_a = Reflect.getMetadata("design:type", target, propertyKey)) === null || _a === void 0 ? void 0 : _a.name;
14534
14587
  /* Create table column */
14535
14588
  var formField = new FormFieldDefinition(Object.assign(args, {
14536
- name: (args === null || args === void 0 ? void 0 : args.name) || propertyKey,
14537
- header: (args === null || args === void 0 ? void 0 : args.header) || Reflect.getMetadata(headerMetadataKey, target, propertyKey) || propertyName,
14538
- autocompleteTemplate: (args === null || args === void 0 ? void 0 : args.autocompleteTemplate) || ((option) => option[formField.autocompleteText]),
14539
- chipTemplate: (args === null || args === void 0 ? void 0 : args.chipTemplate) || ((chip) => chip[formField.chipText])
14589
+ name: args.name || propertyKey,
14590
+ header: args.header || Reflect.getMetadata(headerMetadataKey, target, propertyKey) || propertyName,
14591
+ autocompleteTemplate: args.autocompleteTemplate || ((option) => option[formField.autocompleteText]),
14592
+ chipTemplate: args.chipTemplate || ((chip) => chip[formField.chipText])
14540
14593
  }));
14541
14594
  /* Type enum */
14542
14595
  if (formField.enumType) {
@@ -14582,36 +14635,11 @@ function FormField(args = null) {
14582
14635
  let formFields = previousFormFields ? previousFormFields.concat([formField]) : [formField];
14583
14636
  /* Override the result in the metadata */
14584
14637
  Reflect.defineMetadata(formFieldsMetadataKey, formFields, target);
14585
- /* Get old form field groups */
14586
- const previousGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, target) || [];
14587
- /* Get the group by group name from the previous saved groups */
14588
- var group = previousGroups === null || previousGroups === void 0 ? void 0 : previousGroups.filter(x => x.name == formField.groupName)[0];
14589
- /* If the group doesn't exist, create a new one and add it to the previous groups */
14590
- if (!group) {
14591
- group = new FormFieldGroupDefinition({ index: 0, name: formField.groupName || null, header: formField.groupHeader });
14592
- previousGroups.push(group);
14593
- }
14594
- /* Add the fields to the current group */
14595
- group.fields.push(formField);
14596
- /* Group the field by 'row' */
14597
- group.groups = Object.values((group.fields).reduce(function (r, a) {
14598
- r[a.row] = (r[a.row] || []);
14599
- r[a.row].push(a);
14600
- r[a.row].forEach((x, i) => x.index = x.index || i);
14601
- Utils.sortArray(r[a.row], 'index');
14602
- return r;
14603
- }, Object.create(null)));
14604
- /* Sort the groups by index */
14605
- Utils.sortArray(previousGroups, 'index');
14606
- /* Override the result in the metadata */
14607
- Reflect.defineMetadata(formFieldGroupsMetadataKey, previousGroups, target);
14608
14638
  };
14609
14639
  }
14610
14640
  /**
14611
14641
  * Property decorator to create form fields
14612
- * @param type
14613
- * @param header
14614
- * @param init
14642
+ * @param args
14615
14643
  * @returns
14616
14644
  */
14617
14645
  function FormFieldGroup(type, args = null) {
@@ -14639,12 +14667,8 @@ function FormFieldGroup(type, args = null) {
14639
14667
  });
14640
14668
  /* Get old form field groups */
14641
14669
  var previousGroups = Reflect.getMetadata(formFieldGroupsMetadataKey, target);
14642
- /* Add the current groups to the previous groups */
14643
- previousGroups = (previousGroups ? previousGroups.concat(groups) : groups);
14644
- /* Sort the groups by index */
14645
- Utils.sortArray(previousGroups, 'index');
14646
14670
  /* Override the result in the metadata */
14647
- Reflect.defineMetadata(formFieldGroupsMetadataKey, previousGroups, target);
14671
+ Reflect.defineMetadata(formFieldGroupsMetadataKey, (previousGroups ? previousGroups.concat(groups) : groups), target);
14648
14672
  };
14649
14673
  }
14650
14674