cmat 0.0.18 → 0.0.19

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.
@@ -18,6 +18,7 @@ export * from './types/radio/radio.component';
18
18
  export * from './types/repeat/repeat.component';
19
19
  export * from './types/select/select.component';
20
20
  export * from './types/select-tree/select-tree.component';
21
+ export * from './types/select-table/select-table.component';
21
22
  export * from './types/stepper/horizontal/stepper.component';
22
23
  export * from './types/stepper/vertical/stepper.component';
23
24
  export * from './types/table/table.component';
@@ -0,0 +1,40 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
3
+ import { FieldTypeConfig } from '@ngx-formly/core';
4
+ import { FormlyFieldSelectProps } from '@ngx-formly/core/select';
5
+ import { FieldType } from '@ngx-formly/material';
6
+ import { CmatSelectTableDataSource, CmatSelectTableRow } from 'cmat/components/select-table';
7
+ import { CustomFormFieldProps } from '../../wrappers/form-field/form-field.component';
8
+ import * as i0 from "@angular/core";
9
+ interface SelectTableProps extends CustomFormFieldProps, FormlyFieldSelectProps {
10
+ multiple: boolean;
11
+ search: boolean;
12
+ canNull: boolean;
13
+ customTriggerLabelTemplate: string;
14
+ domain?: {
15
+ url?: string;
16
+ code?: string;
17
+ key?: string;
18
+ value?: string;
19
+ };
20
+ }
21
+ export declare class CmatSelectTableTypeComponent extends FieldType<FieldTypeConfig<SelectTableProps>> implements OnInit, OnDestroy {
22
+ private _http;
23
+ private _changeDetectorRef;
24
+ defaultOptions: {
25
+ props: {
26
+ multiple: boolean;
27
+ search: boolean;
28
+ canNull: boolean;
29
+ customTriggerLabelTemplate: string;
30
+ };
31
+ };
32
+ urlData: CmatSelectTableDataSource<CmatSelectTableRow>;
33
+ private _unsubscribeAll;
34
+ constructor(_http: HttpClient, _changeDetectorRef: ChangeDetectorRef);
35
+ ngOnInit(): void;
36
+ ngOnDestroy(): void;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<CmatSelectTableTypeComponent, never>;
38
+ static ɵcmp: i0.ɵɵComponentDeclaration<CmatSelectTableTypeComponent, "cmat-select-table-type", never, {}, {}, never, never, true, never>;
39
+ }
40
+ export {};
@@ -48,6 +48,7 @@ import * as i2$5 from '@angular/material/select';
48
48
  import { MatSelectModule } from '@angular/material/select';
49
49
  import { CmatSelectSearchComponent } from 'cmat/components/select-search';
50
50
  import { CmatSelectTreeComponent } from 'cmat/components/select-tree';
51
+ import { CmatSelectTableComponent } from 'cmat/components/select-table';
51
52
  import * as i2$6 from '@angular/material/stepper';
52
53
  import { MatStepperModule } from '@angular/material/stepper';
53
54
  import { CdkDrag } from '@angular/cdk/drag-drop';
@@ -1046,6 +1047,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
1046
1047
  args: [{ selector: 'cmat-select-tree-type', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ReactiveFormsModule, CmatSelectTreeComponent], template: "<cmat-select-tree [formControl]=\"formControl\" [dataSource]=\"urlData\" [customTriggerLabelTemplate]=\"'${name}'\"\r\n [multiple]=\"props.multiple\" [overallSearchEnabled]=\"props.search\" [canNull]=\"props.canNull\"\r\n [showToggleAllCheckbox]=\"props.showToggleAllCheckbox\" [expandable]=\"props.expandable\" [placeholder]=\"placeholder\"\r\n [tabIndex]=\"props.tabindex\" [required]=\"required\"></cmat-select-tree>", styles: [":host{width:100%}\n"] }]
1047
1048
  }], ctorParameters: () => [{ type: i1$5.HttpClient }, { type: i0.ChangeDetectorRef }] });
1048
1049
 
1050
+ class CmatSelectTableTypeComponent extends FieldType$1 {
1051
+ constructor(_http, _changeDetectorRef) {
1052
+ super();
1053
+ this._http = _http;
1054
+ this._changeDetectorRef = _changeDetectorRef;
1055
+ this.defaultOptions = {
1056
+ props: {
1057
+ multiple: false,
1058
+ search: true,
1059
+ canNull: false,
1060
+ customTriggerLabelTemplate: '${name}'
1061
+ },
1062
+ };
1063
+ this.urlData = { columns: [], data: [] };
1064
+ this._unsubscribeAll = new Subject();
1065
+ }
1066
+ ngOnInit() {
1067
+ const url = this.field.props?.domain?.url;
1068
+ if (url && this.field.props?.domain?.code && this.field.props?.domain?.key && this.field.props?.domain?.value) {
1069
+ this._http.get(url).pipe(takeUntil(this._unsubscribeAll)).subscribe((data) => {
1070
+ if (data) {
1071
+ const datas = data.filter((i) => {
1072
+ if (this.field.props?.domain?.key)
1073
+ return i[this.field.props?.domain?.key] === this.field.props?.domain?.code;
1074
+ return false;
1075
+ });
1076
+ if (datas && this.field.props?.domain?.value) {
1077
+ this.urlData = datas[0][this.field.props?.domain?.value];
1078
+ }
1079
+ else {
1080
+ this.urlData = { columns: [], data: [] };
1081
+ }
1082
+ }
1083
+ else {
1084
+ this.urlData = { columns: [], data: [] };
1085
+ }
1086
+ this._changeDetectorRef.markForCheck();
1087
+ });
1088
+ }
1089
+ else {
1090
+ this.urlData = { columns: [], data: [] };
1091
+ this._changeDetectorRef.markForCheck();
1092
+ }
1093
+ }
1094
+ ngOnDestroy() {
1095
+ this._unsubscribeAll.next(void 0);
1096
+ this._unsubscribeAll.complete();
1097
+ }
1098
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CmatSelectTableTypeComponent, deps: [{ token: i1$5.HttpClient }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
1099
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: CmatSelectTableTypeComponent, isStandalone: true, selector: "cmat-select-table-type", usesInheritance: true, ngImport: i0, template: "<cmat-select-table [formControl]=\"formControl\" [dataSource]=\"urlData\" [customTriggerLabelTemplate]=\"'${name}'\"\r\n [multiple]=\"props.multiple\" [overallSearchEnabled]=\"props.search\" [canNull]=\"props.canNull\"\r\n [placeholder]=\"placeholder\" [tabIndex]=\"props.tabindex\" [required]=\"required\"></cmat-select-table>", styles: [":host{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: CmatSelectTableComponent, selector: "cmat-select-table", inputs: ["id", "dataSource", "noEntriesFoundLabel", "showNoFoundLabel", "multiple", "overallSearchEnabled", "overallSearchVisible", "resetSortOnOpen", "resetFiltersOnOpen", "customTriggerLabelFn", "triggerLabelSort", "customTriggerLabelTemplate", "canNull", "defaultSort", "resetOptionAction", "placeholder", "value", "required", "disabled"], outputs: ["closed"], exportAs: ["cmatSelectTable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1100
+ }
1101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: CmatSelectTableTypeComponent, decorators: [{
1102
+ type: Component,
1103
+ args: [{ selector: 'cmat-select-table-type', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ReactiveFormsModule, CmatSelectTableComponent], template: "<cmat-select-table [formControl]=\"formControl\" [dataSource]=\"urlData\" [customTriggerLabelTemplate]=\"'${name}'\"\r\n [multiple]=\"props.multiple\" [overallSearchEnabled]=\"props.search\" [canNull]=\"props.canNull\"\r\n [placeholder]=\"placeholder\" [tabIndex]=\"props.tabindex\" [required]=\"required\"></cmat-select-table>", styles: [":host{width:100%}\n"] }]
1104
+ }], ctorParameters: () => [{ type: i1$5.HttpClient }, { type: i0.ChangeDetectorRef }] });
1105
+
1049
1106
  class CmatStepperHorizontalTypeComponent extends FieldType$2 {
1050
1107
  isValid(field) {
1051
1108
  if (field.key) {
@@ -1574,5 +1631,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
1574
1631
  * Generated bundle index. Do not edit.
1575
1632
  */
1576
1633
 
1577
- export { CmatAddonsWrapperComponent, CmatButtonTypeComponent, CmatCardWrapperComponent, CmatCascadeTypeComponent, CmatCheckListTypeComponent, CmatChipsInputTypeComponent, CmatColorPickerTypeComponent, CmatDateRangeTypeComponent, CmatDatepickerTypeComponent, CmatExpansionWrapperComponent, CmatFormFieldWrapperComponent, CmatKnobTypeComponent, CmatMultiCheckboxTypeComponent, CmatNumberTypeComponent, CmatPanelWrapperComponent, CmatQuillTypeComponent, CmatRadioTypeComponent, CmatRatingTypeComponent, CmatRepeatTypeComponent, CmatSelectTreeTypeComponent, CmatSelectTypeComponent, CmatStepperHorizontalTypeComponent, CmatStepperVerticalTypeComponent, CmatTabTypeComponent, CmatTableTypeComponent, CmatTagsTypeComponent, CmatTextareaTypeComponent, CmatUploadTypeComponent, addonsExtension };
1634
+ export { CmatAddonsWrapperComponent, CmatButtonTypeComponent, CmatCardWrapperComponent, CmatCascadeTypeComponent, CmatCheckListTypeComponent, CmatChipsInputTypeComponent, CmatColorPickerTypeComponent, CmatDateRangeTypeComponent, CmatDatepickerTypeComponent, CmatExpansionWrapperComponent, CmatFormFieldWrapperComponent, CmatKnobTypeComponent, CmatMultiCheckboxTypeComponent, CmatNumberTypeComponent, CmatPanelWrapperComponent, CmatQuillTypeComponent, CmatRadioTypeComponent, CmatRatingTypeComponent, CmatRepeatTypeComponent, CmatSelectTableTypeComponent, CmatSelectTreeTypeComponent, CmatSelectTypeComponent, CmatStepperHorizontalTypeComponent, CmatStepperVerticalTypeComponent, CmatTabTypeComponent, CmatTableTypeComponent, CmatTagsTypeComponent, CmatTextareaTypeComponent, CmatUploadTypeComponent, addonsExtension };
1578
1635
  //# sourceMappingURL=cmat-components-custom-formly.mjs.map