angular-formio
Version:
Form.io Angular JSON Form Renderer ========================== This library serves as a Dynamic JSON Powered Form rendering library for [Angular](https://angular.io). This works by providing a JSON schema to a ```<formio>``` Angular component, where that f
94 lines (93 loc) • 3.2 kB
JavaScript
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @fileoverview added by tsickle
* Generated from: grid/submission/SubmissionGridBody.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Component } from '@angular/core';
import { get } from 'lodash';
import { GridBodyComponent } from '../GridBodyComponent';
var SubmissionGridBodyComponent = /** @class */ (function (_super) {
__extends(SubmissionGridBodyComponent, _super);
function SubmissionGridBodyComponent() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} formio
* @param {?=} query
* @return {?}
*/
SubmissionGridBodyComponent.prototype.load = /**
* @param {?} formio
* @param {?=} query
* @return {?}
*/
function (formio, query) {
var _this = this;
query = query || {};
return formio.loadSubmissions({ params: query })
.then((/**
* @param {?} submissions
* @return {?}
*/
function (submissions) { return _this.setRows(query, submissions); }));
};
/**
* Render the cell data.
*
* @param submission
* @param header
* @return any
*/
/**
* Render the cell data.
*
* @param {?} submission
* @param {?} header
* @return {?} any
*/
SubmissionGridBodyComponent.prototype.view = /**
* Render the cell data.
*
* @param {?} submission
* @param {?} header
* @return {?} any
*/
function (submission, header) {
/** @type {?} */
var cellValue = get(submission, header.key);
if (header.renderCell) {
return header.renderCell(cellValue, header.component);
}
else {
if (header.component) {
if (header.component.getView) {
return header.component.getView(cellValue);
}
return header.component.asString(cellValue);
}
else {
return cellValue.toString();
}
}
};
SubmissionGridBodyComponent.decorators = [
{ type: Component, args: [{
template: "<ng-template> <tbody> <tr *ngFor=\"let row of rows\" (click)=\"onRowSelect($event, row)\"> <td *ngFor=\"let rowHeader of header.headers\" [innerHTML]=\"view(row, rowHeader)\"></td> </tr> </tbody> </ng-template> "
},] },
];
return SubmissionGridBodyComponent;
}(GridBodyComponent));
export { SubmissionGridBodyComponent };