UNPKG

ion-oui

Version:

The client library of oui builder for ionic

88 lines (87 loc) 4.93 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.OUIIonStatedParser = exports.OUIIonStated = void 0; var oui_parser_1 = require("./../oui-parser"); var core_1 = require("@angular/core"); var oui_element_1 = require("../oui-element"); var oui_1 = require("./oui"); var OUIIonStated = /** @class */ (function (_super) { __extends(OUIIonStated, _super); function OUIIonStated(differs) { var _this = _super.call(this) || this; _this.differs = differs; return _this; } OUIIonStated.prototype.ngOnInit = function () { var _a, _b, _c, _d, _e, _f; this.formId = (_c = (_b = (_a = this.clickHandler) === null || _a === void 0 ? void 0 : _a.page) === null || _b === void 0 ? void 0 : _b.formStates) === null || _c === void 0 ? void 0 : _c.currentFormId; this.stateDiffer = this.differs.find((_f = (_e = (_d = this.clickHandler) === null || _d === void 0 ? void 0 : _d.page) === null || _e === void 0 ? void 0 : _e.state) === null || _f === void 0 ? void 0 : _f.data).create(); }; OUIIonStated.prototype.stateChanged = function (changes) { var _a, _b, _c; // tslint:disable-next-line:no-console console.log('state changes', this.formId); // If you want to see details then use // tslint:disable-next-line:no-console changes.forEachRemovedItem(function (record) { return console.log(':::', record); }); // tslint:disable-next-line:no-console changes.forEachAddedItem(function (record) { return console.log(':::', record); }); // tslint:disable-next-line:no-console changes.forEachChangedItem(function (record) { return console.log(':::', record); }); if ((_b = (_a = this.clickHandler) === null || _a === void 0 ? void 0 : _a.page) === null || _b === void 0 ? void 0 : _b.formStates) { this.clickHandler.page.formStates.currentFormId = this.formId; } (_c = this.child) === null || _c === void 0 ? void 0 : _c.loadComponent(); }; OUIIonStated.prototype.ngDoCheck = function () { var _a, _b, _c; var changes = this.stateDiffer.diff((_c = (_b = (_a = this.clickHandler) === null || _a === void 0 ? void 0 : _a.page) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.data); if (changes) { this.stateChanged(changes); } }; __decorate([ (0, core_1.ViewChild)(oui_1.IonOUI) ], OUIIonStated.prototype, "child", void 0); OUIIonStated = __decorate([ (0, core_1.Component)({ selector: 'app-ion-oui-stated', template: "\n <div [style.width]=\"data.width ? data.width + 'px' : '100%'\" [style.height]=\"data.height ? data.height + 'px': 'initial'\" [style.backgroundColor]=\"data.color\">\n <app-ion-oui [mode]=\"mode\" *ngIf=\"data.child\" [data]=\"data.child\" [onClick]=\"click\"></app-ion-oui>\n </div>\n ", styleUrls: ['./o-ui.scss'], }) ], OUIIonStated); return OUIIonStated; }(oui_element_1.OUIIonElement)); exports.OUIIonStated = OUIIonStated; var OUIIonStatedParser = /** @class */ (function (_super) { __extends(OUIIonStatedParser, _super); function OUIIonStatedParser() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = 'Stated'; _this.componentType = OUIIonStated; return _this; } return OUIIonStatedParser; }(oui_parser_1.OUIAbstractIonParser)); exports.OUIIonStatedParser = OUIIonStatedParser;