text: import { Component, Input, Output, EventEmitter } from '@angular/core';
  import { CollectionUtils, DependentUtils } from '../../../utility';
  import { Ability } from '@casl/ability';
  import { AbilityUtils } from '../../../utility/ability.utility';
  export class CrudFormComponent {
      constructor(ability) {
          this.ability = ability;
          this.onFormChange = new EventEmitter();
          this.onFieldChange = new EventEmitter();
          this.onButtonClick = new EventEmitter();
          this.onSortClick = new EventEmitter();
          this.onPageClick = new EventEmitter();
          this.formsConfigToDisplay = new Array();
          this.rowsInTab = new Array();
          AbilityUtils.setAbility(this.ability);
      }
      ngOnInit() {
          this.filterForms();
          this.drawTabs();
          this.setConfigAsPerTab();
          this.addWidget = this.addWidgetButton("addWidget", "Add", "add", "primary" /* PRIMARY */);
      }
      setConfigAsPerTab(tabIdentifier) {
          if (this.configData) {
              this.badges = this.configData.badges;
              this.pageBackRoute = this.configData.pageBackRoute;
              this.record = this.configData.record;
              if (this.configData.configPerTabs) {
                  let tabIndex = 0;
                  this.configData.configPerTabs.forEach((tabConfigData, tabKey) => {
                      if ((tabKey == tabIdentifier || (tabIndex == 0 && tabIdentifier == null)) && tabConfigData) {
                          if (tabConfigData.badges) {
                              this.badges = tabConfigData.badges;
                          }
                          if (tabConfigData.pageBackRoute) {
                              this.pageBackRoute = tabConfigData.pageBackRoute;
                          }
                          if (tabConfigData.record) {
                              this.record = this.configData.record;
                          }
                      }
                      tabIndex++;
                  });
              }
          }
      }
      getTabIdentifier(tabTitle) {
          let tabIdentifier = '';
          if (this.form && this.form.tabs) {
              for (let tab of this.form.tabs) {
                  if (tab.label == tabTitle) {
                      tabIdentifier = tab.identifier;
                      break;
                  }
              }
          }
          return tabIdentifier;
      }
      drawTabs() {
          if (this.form && this.form.tabs && this.form.tabs.length > 0) {
              for (let tIndex = 0; tIndex < this.form.tabs.length; tIndex++) {
                  if (this.form.tabs[tIndex] && (this.form.tabs[tIndex].permission == null || (this.form.tabs[tIndex].permission && (this.ability.can(this.form.tabs[tIndex].permission['action'], this.form.tabs[tIndex].permission['subject']))))) {
                      this.rowsInTab.push(this.drawTab(tIndex));
                  }
              }
          }
      }
      drawTab(tabIndex) {
          let rows = new Array();
          let rIndex = 0;
          if (this.form && this.form.tabs && this.form.tabs.length > 0) {
              for (let tIndex = 0; tIndex < this.form.tabs.length; tIndex++) {
                  if (this.form.tabs[tIndex].widgets && this.form.tabs[tIndex].widgets.length > 0 && tIndex == tabIndex) {
                      for (let widget of this.form.tabs[tIndex].widgets) {
                          if (widget &&
                              (widget.permission == null ||
                                  (widget.permission && (this.ability.can(widget.permission['action'], widget.permission['subject']))))) {
                              if (CollectionUtils.isEmpty(rows[rIndex])) {
                                  rows[rIndex] = new Array();
                              }
                              let colCount = 0;
                              rows[rIndex].forEach(row => colCount += row.colSpan);
                              if (colCount < 2) {
                                  rows[rIndex].push(widget);
                              }
                              else {
                                  rIndex++;
                                  rows[rIndex] = new Array();
                                  rows[rIndex].push(widget);
                              }
                          }
                      }
                  }
              }
          }
          console.log(rows);
          return rows;
      }
      displayWidget(widget, supportingRecord, record) {
          return DependentUtils.displayDependencyField(widget.dependentOnFields, supportingRecord, record);
      }
      filterForms() {
          let formIdentifiers;
          if (this.actionPages && this.actions) {
              for (let actionPage of this.actionPages) {
                  for (let action of this.actions) {
                      if (actionPage.buttonIdentifier == action.identifier) {
                          formIdentifiers = actionPage.associatedFormIdentifiers;
                      }
                  }
              }
              if (this.form && this.form.tabs && formIdentifiers) {
                  for (let tab of this.form.tabs) {
                      for (let widget of tab.widgets) {
                          if (formIdentifiers.indexOf(widget.widget.identifier) > -1) {
                              widget.widget['display'] = true;
                          }
                      }
                  }
              }
              else {
                  this.form.tabs.forEach(tab => tab.widgets.forEach(widget => widget.widget['display'] = true));
              }
          }
          else {
              this.form.tabs.forEach(tab => tab.widgets.forEach(widget => widget.widget['display'] = true));
          }
      }
      addWidgetButton(identifier, label, icon, color) {
          let buttonConfig = {
              identifier: identifier,
              type: "GHOST" /* GHOST */,
              label: label,
              color: color,
              size: "small" /* SMALL */,
              icon: icon,
              onlyIcon: false,
              alwaysEnable: true
          };
          return buttonConfig;
      }
      fieldChange(fieldChange) {
          console.log(fieldChange);
          this.onFieldChange.emit(fieldChange);
      }
      formChange(form) {
          this.onFormChange.emit(form);
      }
      buttonClick(action) {
          console.log(action);
          if (action.action == "addWidget") {
              if (this.record[action.sourceIdentifier] && this.record[action.sourceIdentifier] instanceof Array) {
                  this.record[action.sourceIdentifier].push({});
              }
              else {
                  this.record[action.sourceIdentifier] = new Array();
                  this.record[action.sourceIdentifier].push({});
              }
          }
          this.onButtonClick.emit(action);
      }
      onTabChange(event) {
          console.log(event);
          this.setConfigAsPerTab(this.getTabIdentifier(event.tab.textLabel));
      }
      onAccordianChange(event) {
          console.log(event);
      }
      onSort(event) {
          console.log(event);
          this.onSortClick.emit(event);
      }
      onPage(event) {
          console.log(event);
          this.onPageClick.emit(event);
      }
  }
  CrudFormComponent.decorators = [
      { type: Component, args: [{
                  selector: 'cf-crud-form',
                  template: "<mat-card class=\"cf-crud-card\">\n    <!-- {{configData | json}} -->\n    <mat-card-header class=\"cf-list-header\">\n        <cf-crud-header\n            [identifier]=\"identifier\"\n            [title]=\"header.title\"\n            [subtitle]=\"header.subtitle\"\n            [description]=\"header.description\"\n            [badges]=\"badges\"\n            [icon]=\"header.icon\"\n            [pageBackRoute]=\"pageBackRoute\"\n            [formDisplayMode]=\"'CRUD_FORM'\"\n            [actions]=\"actions\"\n            [originalData]=\"configData.originalData\"  \n            [context]=\"record\"\n            [style.width.%]=\"100\"\n            (onButtonClick)=\"buttonClick($event)\"\n        ></cf-crud-header>\n    </mat-card-header> \n  \n    <mat-card-content class=\"cf-crud-content\">\n        <div class=\"mdc-layout-grid cf-crud-header\" *ngIf=\"header.description && header.description.text && header.description.bgColor\">\n            <div class=\"mdc-layout-grid__inner\">\n                <div class=\"mdc-layout-grid__cell--span-12\">\n                    <div \n                        class=\"cf-crud-header-desc\"\n                        [style.background-color]=\"header.description.bgColor\"\n                        [style.color]=\"header.description.textColor\"\n                    >\n                        <mat-icon class=\"cf-crud-header-desc-icon\" aria-hidden=\"true\" [attr.aria-label]=\"header.description.icon\" *ngIf=\"header.description.icon\">{{header.description.icon}}</mat-icon>\n                        <span>{{ header.description.text }}</span>\n                    </div>\n                </div>\n            </div>\n        </div>\n        <!-- <cf-error></cf-error> -->\n\n        <span *ngIf=\"form && form.displayType == 'TAB' && form.tabs && form.tabs.length > 1\">\n            <mat-tab-group (selectedTabChange)=\"onTabChange($event)\">\n              <mat-tab \n                *ngFor=\"let tab of form.tabs; let tIndex=index\"\n                [label]=\"tab.label\">\n                <ng-container *ngTemplateOutlet=\"cfTab; context: {tab: tab, record: record, formRows: rowsInTab[tIndex], tIndex: tIndex}\"></ng-container>\n              </mat-tab>\n            </mat-tab-group>\n        </span>\n        <span *ngIf=\"form && form.displayType == 'ACCORDIAN' && form.tabs && form.tabs.length > 1\">\n            <mat-accordion>\n                <mat-expansion-panel\n                  *ngFor=\"let tab of form.tabs; let tIndex=index\"\n                  [expanded]=\"tIndex === 0\"\n                  (opened)=\"onAccordianChange(tIndex)\">\n                  <mat-expansion-panel-header>\n                    <mat-panel-title>\n                      {{tab.label}}\n                    </mat-panel-title>\n                  </mat-expansion-panel-header>\n                  <ng-container *ngTemplateOutlet=\"cfTab; context: {tab: tab, record: record, formRows: rowsInTab[tIndex], tIndex: tIndex}\"></ng-container>\n                </mat-expansion-panel>\n            </mat-accordion>\n        </span>\n        <span *ngIf=\"form && form.tabs && form.tabs.length == 1\">\n            <span \n                *ngFor=\"let tab of form.tabs; let tIndex=index\">\n                <ng-container *ngTemplateOutlet=\"cfTab; context: {tab: tab, record: record, formRows: rowsInTab[tIndex], tIndex: tIndex}\"></ng-container>\n            </span>\n        </span>\n    </mat-card-content>\n</mat-card>\n  \n<ng-template #cfTab let-tab=\"tab\" let-record=\"record\" let-formRows=\"formRows\" let-tIndex=\"tIndex\">\n    <!-- {{record | json}} -->\n    <div \n        class=\"mdc-layout-grid cf-crud-tab\"\n        *ngIf=\"tab && (tab.permission == null || (tab.permission && (tab.permission['subject'] | can: tab.permission['action'])))\"\n    >\n        <div class=\"mdc-layout-grid__inner cf-crud-tab-header\" *ngIf=\"tab.description && tab.description.text\">\n            <div class=\"mdc-layout-grid__cell--span-12\">\n                {{tab.description.text}} \n            </div>\n        </div>\n\n        <div class=\"mdc-layout-grid__inner\" *ngIf=\"tab.customPlugin && tab.customPlugin.component\">\n            <div class=\"mdc-layout-grid__cell--span-12\">\n                <ndc-dynamic\n                    [ndcDynamicComponent]=\"tab.customPlugin.component\"\n                ></ndc-dynamic>\n            </div>\n        </div>\n\n        <div \n            *ngFor=\"let row of formRows; let rIndex = index;\" \n            class=\"mdc-layout-grid__inner cf-crud-tab-form\"> \n            <div\n                *ngFor=\"let cell of row\" \n                class=\"mdc-layout-grid__cell--span-{{cell.colSpan * 6}} cf-crud-form\">\n                <!-- <pre>--{{configData.record[cell.widget.identifier] | json}}--</pre> -->\n\n                <span *ngIf=\"cell.multiple && cell.multiple.addMore; else singleCell\">\n                    <mat-card  *ngIf=\"displayWidget(cell, record, record[cell.widget.identifier] && record[cell.widget.identifier][0] ? record[cell.widget.identifier][0] : {})\" class=\"cf-crud-child-widgets\">\n                        <!-- {{configData | json}} -->\n                        <mat-card-header class=\"cf-list-header\"> \n                            <mat-card-title>{{ cell.multiple.sectionTitle }}</mat-card-title>\n                            <cf-button \n                                class=\"cf-crud-widget-addmore\"\n                                [sourceIdentifier]=\"cell.widget.identifier\"\n                                [sourceIndex]=\"rIndex\" \n                                [context]=\"record\"\n                                [originalData]=\"configData.record[cell.widget.identifier]\"\n                                [button]=\"addWidget\"\n                                (onClick)=\"buttonClick($event);$event.event.stopPropagation()\"\n                            ></cf-button> \n                        </mat-card-header> \n                        <mat-divider class=\"cf-crud-form-header-divider\"></mat-divider>\n                        <mat-card-content class=\"cf-crud-child-widgets-content\">\n                            <span *ngIf=\"record[cell.widget.identifier] && record[cell.widget.identifier].length > 0; else newCellAtIndex;\">\n                                <span *ngFor=\"let cellAtIndex of record[cell.widget.identifier]; let cellArrayIndex = index;\">\n                                    <ng-container *ngTemplateOutlet=\"cfWidget; context: {\n                                        cell: cell, \n                                        supportingRecord: record,\n                                        record: record[cell.widget.identifier][cellArrayIndex], \n                                        configData: configData.record[cell.widget.identifier][cellArrayIndex], \n                                        multiple: true,\n                                        cellArrayIndex: cellArrayIndex,\n                                        tIndex: tIndex\n                                    }\"></ng-container>\n                                </span>\n                            </span>\n                            <ng-template #newCellAtIndex>\n                                <ng-container *ngTemplateOutlet=\"cfWidget; context: {\n                                    cell: cell, \n                                    supportingRecord: {},\n                                    record: {}, \n                                    configData: {}, \n                                    multiple: true,\n                                    cellArrayIndex: 0,\n                                    tIndex: tIndex\n                                }\"></ng-container>\n                            </ng-template>\n                        </mat-card-content>\n                    </mat-card>\n                </span>\n                <ng-template #singleCell>\n                    <span *ngIf=\"displayWidget(cell, record, record[cell.widget.identifier])\">\n                        <ng-container *ngTemplateOutlet=\"cfWidget; context: {\n                            cell: cell, \n                            supportingRecord: record,\n                            record: record[cell.widget.identifier], \n                            configData: configData.record[cell.widget.identifier], \n                            multiple: false,\n                            cellArrayIndex: null,\n                            tIndex: tIndex\n                        }\"></ng-container>\n                    </span>\n                </ng-template>\n            </div>\n        </div>\n    </div>\n</ng-template>\n\n<ng-template #cfWidget let-cell=\"cell\" let-supportingRecord=\"supportingRecord\" let-record=\"record\" let-configData=\"configData\" let-multiple=\"multiple\" let-cellArrayIndex=\"cellArrayIndex\" let-tIndex=\"tIndex\">\n    <cf-form \n        *ngIf=\"cell.widgetType == 'FORM'\"\n        [formConfig]=\"cell.widget\"\n        [sourceIndex]=\"tIndex\"\n        [widgetArrayIndex]=\"cellArrayIndex\"\n        [record]=\"record\"\n        [originalData]=\"configData\"  \n        [keyMap]=\"keyMap\"\n        [reset]=\"reset\" \n        (onFieldChange)=\"fieldChange($event)\"\n        (onFormChange)=\"formChange($event)\"\n        (onButtonClick)=\"buttonClick($event)\"\n    ></cf-form>\n\n    <cf-static-list\n        *ngIf=\"cell.widgetType == 'LIST' && cell.widget.listType == 'STATIC'\"\n        [listConfig]=\"cell.widget\"\n        [sourceIdentifier]=\"identifier\"\n        [sourceIndex]=\"tIndex\"\n        [widgetArrayIndex]=\"cellArrayIndex\"\n        [record]=\"record\"\n        [originalData]=\"configData\"  \n        [keyMap]=\"keyMap\"\n        (onFormChange)=\"formChange($event)\"\n        (onFieldChange)=\"fieldChange($event)\"\n        (onButtonClick)=\"buttonClick($event)\"\n        (onPageChange)=\"onPage($event)\"\n        (onSortChange)=\"onSort($event)\"  \n    ></cf-static-list>\n    <!-- [expanded]=\"_expanded\" -->\n\n    <cf-dynamic-list\n        *ngIf=\"cell.widgetType == 'LIST' && cell.widget.listType == 'DYNAMIC'\"\n        [listConfig]=\"cell.widget\"\n        [sourceIdentifier]=\"identifier\"\n        [sourceIndex]=\"tIndex\"\n        [widgetArrayIndex]=\"cellArrayIndex\"\n        [record]=\"record\"\n        [originalData]=\"configData\"  \n        [keyMap]=\"keyMap\"\n        (onFormChange)=\"formChange($event)\"\n        (onFieldChange)=\"fieldChange($event)\"\n        (onButtonClick)=\"buttonClick($event)\"\n        (onPageChange)=\"onPage($event)\"\n        (onSortChange)=\"onSort($event)\"  \n    ></cf-dynamic-list>\n</ng-template>",
                  styles: [":root{--mdc-layout-grid-column-width-desktop:72px;--mdc-layout-grid-column-width-phone:72px;--mdc-layout-grid-column-width-tablet:72px;--mdc-layout-grid-gutter-desktop:24px;--mdc-layout-grid-gutter-phone:16px;--mdc-layout-grid-gutter-tablet:16px;--mdc-layout-grid-margin-desktop:24px;--mdc-layout-grid-margin-phone:16px;--mdc-layout-grid-margin-tablet:16px}@media (min-width:840px){.mdc-layout-grid{box-sizing:border-box;margin:0 auto;padding:24px;padding:var(--mdc-layout-grid-margin-desktop,24px)}}@media (min-width:600px) and (max-width:839px){.mdc-layout-grid{box-sizing:border-box;margin:0 auto;padding:16px;padding:var(--mdc-layout-grid-margin-tablet,16px)}}@media (max-width:599px){.mdc-layout-grid{box-sizing:border-box;margin:0 auto;padding:16px;padding:var(--mdc-layout-grid-margin-phone,16px)}}@media (min-width:840px){.mdc-layout-grid__inner{align-items:stretch;display:flex;flex-flow:row wrap;margin:-12px;margin:calc(var(--mdc-layout-grid-gutter-desktop, 24px)/2*-1)}@supports (display:grid){.mdc-layout-grid__inner{-ms-grid-columns:(minmax(0,1fr))[12];display:-ms-grid;display:grid;grid-gap:24px;grid-gap:var(--mdc-layout-grid-gutter-desktop,24px);grid-template-columns:repeat(12,minmax(0,1fr));margin:0}}}@media (min-width:600px) and (max-width:839px){.mdc-layout-grid__inner{align-items:stretch;display:flex;flex-flow:row wrap;margin:-8px;margin:calc(var(--mdc-layout-grid-gutter-tablet, 16px)/2*-1)}@supports (display:grid){.mdc-layout-grid__inner{-ms-grid-columns:(minmax(0,1fr))[8];display:-ms-grid;display:grid;grid-gap:16px;grid-gap:var(--mdc-layout-grid-gutter-tablet,16px);grid-template-columns:repeat(8,minmax(0,1fr));margin:0}}}@media (max-width:599px){.mdc-layout-grid__inner{align-items:stretch;display:flex;flex-flow:row wrap;margin:-8px;margin:calc(var(--mdc-layout-grid-gutter-phone, 16px)/2*-1)}@supports (display:grid){.mdc-layout-grid__inner{-ms-grid-columns:(minmax(0,1fr))[4];display:-ms-grid;display:grid;grid-gap:16px;grid-gap:var(--mdc-layout-grid-gutter-phone,16px);grid-template-columns:repeat(4,minmax(0,1fr));margin:0}}}@media (min-width:840px){.mdc-layout-grid__cell{box-sizing:border-box;margin:12px;margin:calc(var(--mdc-layout-grid-gutter-desktop, 24px)/2);width:calc(33.33333% - 24px);width:calc(33.33333% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell{-ms-grid-column-span:4;grid-column-end:span 4;margin:0;width:auto}}.mdc-layout-grid__cell--span-1,.mdc-layout-grid__cell--span-1-desktop{width:calc(8.33333% - 24px);width:calc(8.33333% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-1,.mdc-layout-grid__cell--span-1-desktop{-ms-grid-column-span:1;grid-column-end:span 1;width:auto}}.mdc-layout-grid__cell--span-2,.mdc-layout-grid__cell--span-2-desktop{width:calc(16.66667% - 24px);width:calc(16.66667% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-2,.mdc-layout-grid__cell--span-2-desktop{-ms-grid-column-span:2;grid-column-end:span 2;width:auto}}.mdc-layout-grid__cell--span-3,.mdc-layout-grid__cell--span-3-desktop{width:calc(25% - 24px);width:calc(25% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-3,.mdc-layout-grid__cell--span-3-desktop{-ms-grid-column-span:3;grid-column-end:span 3;width:auto}}.mdc-layout-grid__cell--span-4,.mdc-layout-grid__cell--span-4-desktop{width:calc(33.33333% - 24px);width:calc(33.33333% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-4,.mdc-layout-grid__cell--span-4-desktop{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-5,.mdc-layout-grid__cell--span-5-desktop{width:calc(41.66667% - 24px);width:calc(41.66667% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-5,.mdc-layout-grid__cell--span-5-desktop{-ms-grid-column-span:5;grid-column-end:span 5;width:auto}}.mdc-layout-grid__cell--span-6,.mdc-layout-grid__cell--span-6-desktop{width:calc(50% - 24px);width:calc(50% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-6,.mdc-layout-grid__cell--span-6-desktop{-ms-grid-column-span:6;grid-column-end:span 6;width:auto}}.mdc-layout-grid__cell--span-7,.mdc-layout-grid__cell--span-7-desktop{width:calc(58.33333% - 24px);width:calc(58.33333% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-7,.mdc-layout-grid__cell--span-7-desktop{-ms-grid-column-span:7;grid-column-end:span 7;width:auto}}.mdc-layout-grid__cell--span-8,.mdc-layout-grid__cell--span-8-desktop{width:calc(66.66667% - 24px);width:calc(66.66667% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-8,.mdc-layout-grid__cell--span-8-desktop{-ms-grid-column-span:8;grid-column-end:span 8;width:auto}}.mdc-layout-grid__cell--span-9,.mdc-layout-grid__cell--span-9-desktop{width:calc(75% - 24px);width:calc(75% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-9,.mdc-layout-grid__cell--span-9-desktop{-ms-grid-column-span:9;grid-column-end:span 9;width:auto}}.mdc-layout-grid__cell--span-10,.mdc-layout-grid__cell--span-10-desktop{width:calc(83.33333% - 24px);width:calc(83.33333% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-10,.mdc-layout-grid__cell--span-10-desktop{-ms-grid-column-span:10;grid-column-end:span 10;width:auto}}.mdc-layout-grid__cell--span-11,.mdc-layout-grid__cell--span-11-desktop{width:calc(91.66667% - 24px);width:calc(91.66667% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-11,.mdc-layout-grid__cell--span-11-desktop{-ms-grid-column-span:11;grid-column-end:span 11;width:auto}}.mdc-layout-grid__cell--span-12,.mdc-layout-grid__cell--span-12-desktop{width:calc(100% - 24px);width:calc(100% - var(--mdc-layout-grid-gutter-desktop, 24px))}@supports (display:grid){.mdc-layout-grid__cell--span-12,.mdc-layout-grid__cell--span-12-desktop{-ms-grid-column-span:12;grid-column-end:span 12;width:auto}}}@media (min-width:600px) and (max-width:839px){.mdc-layout-grid__cell{box-sizing:border-box;margin:8px;margin:calc(var(--mdc-layout-grid-gutter-tablet, 16px)/2);width:calc(50% - 16px);width:calc(50% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell{-ms-grid-column-span:4;grid-column-end:span 4;margin:0;width:auto}}.mdc-layout-grid__cell--span-1,.mdc-layout-grid__cell--span-1-tablet{width:calc(12.5% - 16px);width:calc(12.5% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-1,.mdc-layout-grid__cell--span-1-tablet{-ms-grid-column-span:1;grid-column-end:span 1;width:auto}}.mdc-layout-grid__cell--span-2,.mdc-layout-grid__cell--span-2-tablet{width:calc(25% - 16px);width:calc(25% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-2,.mdc-layout-grid__cell--span-2-tablet{-ms-grid-column-span:2;grid-column-end:span 2;width:auto}}.mdc-layout-grid__cell--span-3,.mdc-layout-grid__cell--span-3-tablet{width:calc(37.5% - 16px);width:calc(37.5% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-3,.mdc-layout-grid__cell--span-3-tablet{-ms-grid-column-span:3;grid-column-end:span 3;width:auto}}.mdc-layout-grid__cell--span-4,.mdc-layout-grid__cell--span-4-tablet{width:calc(50% - 16px);width:calc(50% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-4,.mdc-layout-grid__cell--span-4-tablet{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-5,.mdc-layout-grid__cell--span-5-tablet{width:calc(62.5% - 16px);width:calc(62.5% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-5,.mdc-layout-grid__cell--span-5-tablet{-ms-grid-column-span:5;grid-column-end:span 5;width:auto}}.mdc-layout-grid__cell--span-6,.mdc-layout-grid__cell--span-6-tablet{width:calc(75% - 16px);width:calc(75% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-6,.mdc-layout-grid__cell--span-6-tablet{-ms-grid-column-span:6;grid-column-end:span 6;width:auto}}.mdc-layout-grid__cell--span-7,.mdc-layout-grid__cell--span-7-tablet{width:calc(87.5% - 16px);width:calc(87.5% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-7,.mdc-layout-grid__cell--span-7-tablet{-ms-grid-column-span:7;grid-column-end:span 7;width:auto}}.mdc-layout-grid__cell--span-8,.mdc-layout-grid__cell--span-8-tablet{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-8,.mdc-layout-grid__cell--span-8-tablet{-ms-grid-column-span:8;grid-column-end:span 8;width:auto}}.mdc-layout-grid__cell--span-9,.mdc-layout-grid__cell--span-9-tablet{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-9,.mdc-layout-grid__cell--span-9-tablet{-ms-grid-column-span:8;grid-column-end:span 8;width:auto}}.mdc-layout-grid__cell--span-10,.mdc-layout-grid__cell--span-10-tablet{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-10,.mdc-layout-grid__cell--span-10-tablet{-ms-grid-column-span:8;grid-column-end:span 8;width:auto}}.mdc-layout-grid__cell--span-11,.mdc-layout-grid__cell--span-11-tablet{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-11,.mdc-layout-grid__cell--span-11-tablet{-ms-grid-column-span:8;grid-column-end:span 8;width:auto}}.mdc-layout-grid__cell--span-12,.mdc-layout-grid__cell--span-12-tablet{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-tablet, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-12,.mdc-layout-grid__cell--span-12-tablet{-ms-grid-column-span:8;grid-column-end:span 8;width:auto}}}@media (max-width:599px){.mdc-layout-grid__cell{box-sizing:border-box;margin:8px;margin:calc(var(--mdc-layout-grid-gutter-phone, 16px)/2);width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell{-ms-grid-column-span:4;grid-column-end:span 4;margin:0;width:auto}}.mdc-layout-grid__cell--span-1,.mdc-layout-grid__cell--span-1-phone{width:calc(25% - 16px);width:calc(25% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-1,.mdc-layout-grid__cell--span-1-phone{-ms-grid-column-span:1;grid-column-end:span 1;width:auto}}.mdc-layout-grid__cell--span-2,.mdc-layout-grid__cell--span-2-phone{width:calc(50% - 16px);width:calc(50% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-2,.mdc-layout-grid__cell--span-2-phone{-ms-grid-column-span:2;grid-column-end:span 2;width:auto}}.mdc-layout-grid__cell--span-3,.mdc-layout-grid__cell--span-3-phone{width:calc(75% - 16px);width:calc(75% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-3,.mdc-layout-grid__cell--span-3-phone{-ms-grid-column-span:3;grid-column-end:span 3;width:auto}}.mdc-layout-grid__cell--span-4,.mdc-layout-grid__cell--span-4-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-4,.mdc-layout-grid__cell--span-4-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-5,.mdc-layout-grid__cell--span-5-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-5,.mdc-layout-grid__cell--span-5-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-6,.mdc-layout-grid__cell--span-6-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-6,.mdc-layout-grid__cell--span-6-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-7,.mdc-layout-grid__cell--span-7-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-7,.mdc-layout-grid__cell--span-7-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-8,.mdc-layout-grid__cell--span-8-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-8,.mdc-layout-grid__cell--span-8-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-9,.mdc-layout-grid__cell--span-9-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-9,.mdc-layout-grid__cell--span-9-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-10,.mdc-layout-grid__cell--span-10-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-10,.mdc-layout-grid__cell--span-10-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-11,.mdc-layout-grid__cell--span-11-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-11,.mdc-layout-grid__cell--span-11-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}.mdc-layout-grid__cell--span-12,.mdc-layout-grid__cell--span-12-phone{width:calc(100% - 16px);width:calc(100% - var(--mdc-layout-grid-gutter-phone, 16px))}@supports (display:grid){.mdc-layout-grid__cell--span-12,.mdc-layout-grid__cell--span-12-phone{-ms-grid-column-span:4;grid-column-end:span 4;width:auto}}}.mdc-layout-grid__cell--order-1{order:1}.mdc-layout-grid__cell--order-2{order:2}.mdc-layout-grid__cell--order-3{order:3}.mdc-layout-grid__cell--order-4{order:4}.mdc-layout-grid__cell--order-5{order:5}.mdc-layout-grid__cell--order-6{order:6}.mdc-layout-grid__cell--order-7{order:7}.mdc-layout-grid__cell--order-8{order:8}.mdc-layout-grid__cell--order-9{order:9}.mdc-layout-grid__cell--order-10{order:10}.mdc-layout-grid__cell--order-11{order:11}.mdc-layout-grid__cell--order-12{order:12}.mdc-layout-grid__cell--align-top{align-self:flex-start}@supports (display:grid){.mdc-layout-grid__cell--align-top{-ms-grid-row-align:start;align-self:start}}.mdc-layout-grid__cell--align-middle{-ms-grid-row-align:center;align-self:center}.mdc-layout-grid__cell--align-bottom{align-self:flex-end}@supports (display:grid){.mdc-layout-grid__cell--align-bottom{-ms-grid-row-align:end;align-self:end}}@media (min-width:840px){.mdc-layout-grid--fixed-column-width{width:1176px;width:calc(var(--mdc-layout-grid-column-width-desktop, 72px)*12 + var(--mdc-layout-grid-gutter-desktop, 24px)*11 + var(--mdc-layout-grid-margin-desktop, 24px)*2)}}@media (min-width:600px) and (max-width:839px){.mdc-layout-grid--fixed-column-width{width:720px;width:calc(var(--mdc-layout-grid-column-width-tablet, 72px)*8 + var(--mdc-layout-grid-gutter-tablet, 16px)*7 + var(--mdc-layout-grid-margin-tablet, 16px)*2)}}@media (max-width:599px){.mdc-layout-grid--fixed-column-width{width:368px;width:calc(var(--mdc-layout-grid-column-width-phone, 72px)*4 + var(--mdc-layout-grid-gutter-phone, 16px)*3 + var(--mdc-layout-grid-margin-phone, 16px)*2)}}.mdc-layout-grid--align-left{margin-left:0;margin-right:auto}.mdc-layout-grid--align-right{margin-left:auto;margin-right:0}.cf-crud-card{background-color:transparent}.cf-crud-form{padding-bottom:20px}.cf-crud-tab{padding:0!important}.cf-crud-tab-header{padding:20px 0!important}.cf-crud-tab-form{margin:1px}.cf-crud-header{padding:0}.cf-crud-header-desc{padding:5px 10px;width:auto}.cf-crud-header-desc-icon{font-size:15px;height:15px!important;margin-top:0;padding:0 5px 0 0;width:15px!important}.cf-crud-child-widgets{background-color:#f5f5f5}.cf-crud-child-widgets-content{padding-top:20px}.cf-crud-widget-addmore{margin-top:-8px}.cf-crud-content{padding-top:16px}"]
              },] }
  ];
  CrudFormComponent.ctorParameters = () => [
      { type: Ability }
  ];
  CrudFormComponent.propDecorators = {
      identifier: [{ type: Input }],
      header: [{ type: Input }],
      actions: [{ type: Input }],
      actionPages: [{ type: Input }],
      form: [{ type: Input }],
      reset: [{ type: Input }],
      configData: [{ type: Input }],
      keyMap: [{ type: Input }],
      onFormChange: [{ type: Output }],
      onFieldChange: [{ type: Output }],
      onButtonClick: [{ type: Output }],
      onSortClick: [{ type: Output }],
      onPageClick: [{ type: Output }]
  };
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3J1ZC1mb3JtLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvbml0aW5raGFpdGFuL05pdGluL3N0dWR5L2FuZ3VsYXIvbWF0ZXJpYWwvYWRtaW4tYnVpbGRlci1wbHVnaW4vcHJvamVjdHMvYWRtaW4tYnVpbGRlci9zcmMvIiwic291cmNlcyI6WyJsaWIvY3J1ZC9jb21wb25lbnQvY3J1ZC1mb3JtL2NydWQtZm9ybS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBVSxLQUFLLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUcvRSxPQUFPLEVBQUUsZUFBZSxFQUFFLGNBQWMsRUFBYSxNQUFNLGtCQUFrQixDQUFDO0FBSzlFLE9BQU8s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dGEucGFnZUJhY2tSb3V0ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0YWJDb25maWdEYXRhLnJlY29yZCkge1xuICAgICAgICAgICAgICB0aGlzLnJlY29yZCA9IHRoaXMuY29uZmlnRGF0YS5yZWNvcmQ7IFxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICB0YWJJbmRleCsrO1xuICAgICAgICB9KVxuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIGdldFRhYklkZW50aWZpZXIodGFiVGl0bGU6IHN0cmluZyk6IHN0cmluZyB7XG4gICAgbGV0IHRhYklkZW50aWZpZXIgPSAnJztcbiAgICBpZiAodGhpcy5mb3JtICYmIHRoaXMuZm9ybS50YWJzKSB7XG4gICAgICBmb3IgKGxldCB0YWIgb2YgdGhpcy5mb3JtLnRhYnMpIHtcbiAgICAgICAgaWYgKHRhYi5sYWJlbCA9PSB0YWJUaXRsZSkge1xuICAgICAgICAgIHRhYklkZW50aWZpZXIgPSB0YWIuaWRlbnRpZmllcjtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB0YWJJZGVudGlmaWVyO1xuICB9XG5cbiAgZHJhd1RhYnMoKTogdm9pZCB7IFxuICAgIGlmICh0aGlzLmZvcm0gJiYgdGhpcy5mb3JtLnRhYnMgJiYgdGhpcy5mb3JtLnRhYnMubGVuZ3RoID4gMCkge1xuICAgICAgZm9yIChsZXQgdEluZGV4ID0gMDsgdEluZGV4IDwgdGhpcy5mb3JtLnRhYnMubGVuZ3RoOyB0SW5kZXgrKykge1xuICAgICAgICBpZiAodGhpcy5mb3JtLnRhYnNbdEluZGV4XSAmJiAodGhpcy5mb3JtLnRhYnNbdEluZGV4XS5wZXJtaXNzaW9uID09IG51bGwgfHwgKHRoaXMuZm9ybS50YWJzW3RJbmRleF0ucGVybWlzc2lvbiAmJiAodGhpcy5hYmlsaXR5LmNhbih0aGlzLmZ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zaW9uWydhY3Rpb24nXSwgd2lkZ2V0LnBlcm1pc3Npb25bJ3N1YmplY3QnXSkpXG4gICAgICAgICAgICAgIClcbiAgICAgICAgICAgICkpIHtcbiAgICAgICAgICAgICAgaWYgKENvbGxlY3Rpb25VdGlscy5pc0VtcHR5KHJvd3NbckluZGV4XSkpIHtcbiAgICAgICAgICAgICAgICByb3dzW3JJbmRleF0gPSBuZXcgQXJyYXk8Q3J1ZFdpZGdldD4oKTtcbiAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgIGxldCBjb2xDb3VudCA9IDA7XG4gICAgICAgICAgICAgIHJvd3NbckluZGV4XS5mb3JFYWNoKHJvdyA9PiBjb2xDb3VudCArPSByb3cuY29sU3Bhbik7XG5cbiAgICAgICAgICAgICAgaWYgKGNvbENvdW50IDwgMikge1xuICAgICAgICAgICAgICAgIHJvd3NbckluZGV4XS5wdXNoKHdpZGdldCk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgckluZGV4Kys7XG4gICAgICAgICAgICAgICAgcm93c1tySW5kZXhdID0gbmV3IEFycmF5PENydWRXaWRnZXQ+KCk7XG4gICAgICAgICAgICAgICAgcm93c1tySW5kZXhdLnB1c2god2lkZ2V0KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiBcbiAgICBjb25zb2xlLmxvZyhyb3dzKTtcbiAgICByZXR1cm4gcm93cztcbiAgfVxuXG4gIGRpc3BsYXlXaWRnZXQod2lkZ2V0OiBDcnVkV2lkZ2V0LCBzdXBwb3J0aW5nUmVjb3JkOiBhbnksIHJlY29yZDogYW55KTogYm9vbGVhbiB7XG4gICAgcmV0dXJuIERlcGVuZGVudFV0aWxzLmRpc3BsYXlEZXBlbmRlbmN5RmllbGQod2lkZ2V0LmRlcGVuZGVudE9uRmllbGRzLCBzdXBwb3J0aW5nUmVjb3JkLCByZWNvc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