@shikshalokam/sl-reports
Version:
Library to integrate questionnaire in SL Projects
730 lines (684 loc) • 47 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('/core'), require('chartjs-plugin-datalabels'), require('ng2-charts'), require('@angular/common'), require('chartjs-plugin-stacked100'), require('ng2-semantic-ui-v9')) :
typeof define === 'function' && define.amd ? define('sl-reports-library', ['exports', '/core', 'chartjs-plugin-datalabels', 'ng2-charts', '@angular/common', 'chartjs-plugin-stacked100', 'ng2-semantic-ui-v9'], factory) :
(global = global || self, factory(global['sl-reports-library'] = {}, global.ng.core, global.pluginDataLabels, global.ng2Charts, global.ng.common, global.stackedBar, global.ng2SemanticUiV9));
}(this, (function (exports, core, pluginDataLabels, ng2Charts, common, stackedBar, ng2SemanticUiV9) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
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);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(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;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __createBinding(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}
function __exportStar(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
var SlReportsLibraryService = /** @class */ (function () {
function SlReportsLibraryService() {
}
SlReportsLibraryService.ɵprov = core.ɵɵdefineInjectable({ factory: function SlReportsLibraryService_Factory() { return new SlReportsLibraryService(); }, token: SlReportsLibraryService, providedIn: "root" });
SlReportsLibraryService = __decorate([
core.Injectable({
providedIn: 'root'
})
], SlReportsLibraryService);
return SlReportsLibraryService;
}());
var SlReportsLibraryComponent = /** @class */ (function () {
function SlReportsLibraryComponent() {
}
SlReportsLibraryComponent.prototype.ngOnInit = function () {
};
SlReportsLibraryComponent = __decorate([
core.Component({
selector: 'sl-reports-library',
template: "\n <p>\n sl-reports-library works!\n </p>\n "
})
], SlReportsLibraryComponent);
return SlReportsLibraryComponent;
}());
var ReportHeaderComponent = /** @class */ (function () {
function ReportHeaderComponent() {
}
ReportHeaderComponent.prototype.ngOnInit = function () {
};
__decorate([
core.Input()
], ReportHeaderComponent.prototype, "title", void 0);
__decorate([
core.Input()
], ReportHeaderComponent.prototype, "lastdate", void 0);
ReportHeaderComponent = __decorate([
core.Component({
selector: 'sl-report-header',
template: "<div class=\"report-title\"> {{title}}</div>\n<span class=\"ml-auto sb-last-update-status fnormal sb-color-gray-400 px-10 last-update\">\n <span>Last Updated on : </span> \n {{lastdate}}\n</span>",
styles: [".report-title{font-size:22px;color:var(--sb-text);font-family:\"Noto Sans\";line-height:24px;font-weight:500}.report-subtitle{font-size:19px;color:var(--sb-search-input-text);font-family:\"Noto Sans\";line-height:24px;font-weight:600}"]
})
], ReportHeaderComponent);
return ReportHeaderComponent;
}());
var PieChartComponent = /** @class */ (function () {
function PieChartComponent() {
this.pieChartOptions = {
responsive: true,
legend: { position: 'bottom', align: 'start' },
};
this.pieChartType = 'pie';
this.pieChartLegend = true;
}
PieChartComponent.prototype.ngOnInit = function () {
this.pieChartLabels = this.data.chart.data.labels;
this.pieChartData = this.data.chart.data.datasets[0].data;
this.chartColors = [{ backgroundColor: this.data.chart.data.datasets[0].backgroundColor }];
};
__decorate([
core.Input()
], PieChartComponent.prototype, "data", void 0);
__decorate([
core.Input()
], PieChartComponent.prototype, "questionNumber", void 0);
__decorate([
core.ViewChild('chartRootElement')
], PieChartComponent.prototype, "chartRootElement", void 0);
__decorate([
core.ViewChild('chartCanvas')
], PieChartComponent.prototype, "chartCanvas", void 0);
PieChartComponent = __decorate([
core.Component({
selector: 'sl-pie-chart',
template: "<div *ngIf=\"pieChartData\" >\n <div class=\"heading\">\n <h4>{{ questionNumber }}) {{ data?.question }}</h4>\n </div>\n <ng-container *ngIf=\"data?.chart?.data\">\n <canvas \n #chartCanvas\n baseChart\n width=\"300px\" \n height=\"90px\"\n [data]=\"pieChartData\"\n [labels]=\"pieChartLabels\"\n [chartType]=\"pieChartType\"\n [options]=\"pieChartOptions\"\n [legend]=\"pieChartLegend\"\n [colors]=\"chartColors\"\n >\n </canvas>\n </ng-container>\n\n <div class=\"errorMsg\" *ngIf=\"!data?.chart?.data\">No data found</div>\n</div>\n",
styles: [".heading{text-align:center;padding:15px 10px}.errorMsg{color:grey;text-align:center;padding:20px 0}"]
})
], PieChartComponent);
return PieChartComponent;
}());
var BarChartComponent = /** @class */ (function () {
function BarChartComponent() {
this.barChartOptions = {
responsive: true,
maintainAspectRatio: true,
scales: {
xAxes: [
{
ticks: {
min: 0,
max: 100,
},
scaleLabel: {
display: true,
labelString: 'Response in %',
},
},
],
yAxes: [
{
ticks: {
callback: function (value, index, values) {
// // return createSubstrArr(value, 5) || value;
var strArr = value.split(' ');
var tempString = '';
var result = [];
for (var x = 0; x < strArr.length; x++) {
tempString += ' ' + strArr[x];
if ((x % 4 === 0 && x !== 0) || x == strArr.length - 1) {
tempString = tempString.slice(1);
result.push(tempString);
tempString = '';
}
}
return result || value;
},
fontSize: 15,
},
display: true,
scaleLabel: {
display: true,
labelString: 'Response',
},
},
],
},
};
this.barChartType = 'horizontalBar';
this.barChartLegend = false;
this.barChartPlugins = [pluginDataLabels];
}
BarChartComponent.prototype.ngOnInit = function () {
this.barChartLabels = this.data.chart.data.labels;
this.barChartData = [
{ data: this.data.chart.data.datasets[0].data, label: 'Series A' },
];
this.chartColors = [
{ backgroundColor: this.data.chart.data.datasets[0].backgroundColor },
];
// this.barChartPlugins = [
// {
// beforeUpdate: function (c) {
// var chartHeight = c.chart.height;
// var size = (chartHeight * 5) / 100;
// c.scales['y-axis-0'].options.ticks.minor.fontSize = size;
// },
// },
// ];
};
__decorate([
core.Input()
], BarChartComponent.prototype, "data", void 0);
__decorate([
core.Input()
], BarChartComponent.prototype, "questionNumber", void 0);
__decorate([
core.ViewChild('chartRootElement')
], BarChartComponent.prototype, "chartRootElement", void 0);
__decorate([
core.ViewChild('chartCanvas')
], BarChartComponent.prototype, "chartCanvas", void 0);
BarChartComponent = __decorate([
core.Component({
selector: 'sl-bar-chart',
template: "<div *ngIf=\"barChartData\" class=\"graph-filters\" #chartRootElement>\n <div *ngIf=\"data?.chart?.data\" class=\"bar-chart-wrapper\">\n <canvas\n #chartCanvas \n baseChart \n [datasets]=\"barChartData\"\n [labels]=\"barChartLabels\"\n [options]=\"barChartOptions\"\n [chartType]=\"barChartType\"\n [legend]=\"barChartLegend\"\n [plugins]=\"barChartPlugins\"\n [colors]=\"chartColors\"\n ></canvas>\n </div>\n\n <div *ngIf=\"!data?.chart?.data\" class=\"errorMsg\">No data found</div>\n</div>\n",
styles: [".heading{padding:15px 10px;text-align:center}.errorMsg{color:grey;text-align:center;padding:20px 0}.bar-chart-wrapper{display:block;max-width:900px;max-height:450px;margin:0 auto}"]
})
], BarChartComponent);
return BarChartComponent;
}());
var GenericChartComponent = /** @class */ (function () {
function GenericChartComponent() {
}
GenericChartComponent.prototype.ngOnInit = function () {
};
GenericChartComponent.prototype.extension = function (name) {
return name.split(".").pop();
};
GenericChartComponent.prototype.openFile = function (file) {
window.open(file.url, "_blank");
};
__decorate([
core.Input()
], GenericChartComponent.prototype, "reportSections", void 0);
GenericChartComponent = __decorate([
core.Component({
selector: 'sl-generic-chart',
template: "<div *ngFor=\"let section of reportSections\">\n <div class=\"ui bottom p-0 b-0 no-bg my-24 graph-content-section\">\n <div *ngFor=\"let element of section?.questionArray; let i = index\">\n <div\n class=\"ui segment chart-conent-section\"\n [ngSwitch]=\"element?.responseType\"\n >\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'text'\"\n ></sl-reports-text>\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'number'\"\n ></sl-reports-text>\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'date'\"\n ></sl-reports-text>\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchDefault\n ></sl-reports-text>\n <sl-pie-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'radio'\"\n ></sl-pie-chart>\n <sl-pie-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'pie'\"\n ></sl-pie-chart>\n <sl-bar-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'bar'\"\n ></sl-bar-chart>\n <sl-bar-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'multiselect'\"\n ></sl-bar-chart>\n <sl-bar-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'column'\"\n ></sl-bar-chart>\n <sl-percentage-column-charts\n [chartData]=\"element\"\n *ngSwitchCase=\"'horizontalBar'\"\n >\n </sl-percentage-column-charts>\n <sl-matrix-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'matrix'\"\n ></sl-matrix-chart>\n <sl-expansion-table\n [datas]=\"element\"\n *ngSwitchCase=\"'expansion-table'\"\n ></sl-expansion-table>\n </div>\n <div\n *ngFor=\"let e of element.evidences\"\n (click)=\"openFile(e)\"\n class=\"area\"\n >\n <div *ngIf=\"e.extension == 'png'\" class=\"mx-10\">\n <i class=\"file image outline icon\"></i>\n </div>\n <div *ngIf=\"e.extension == 'jpg'\" class=\"mx-10\">\n <i class=\"file image outline icon\"></i>\n </div>\n <div *ngIf=\"e.extension == 'jpeg'\" class=\"mx-10\">\n <i class=\"file image outline icon\"></i>\n </div>\n <div *ngIf=\"e.extension == 'pdf'\" class=\"mx-10\">\n <i class=\"file pdf outline icon\"></i>\n </div>\n </div>\n </div>\n </div>\n</div>\n",
styles: [".graph-content-section{padding-bottom:15px!important;background-color:#e9e8d9!important;border-radius:0 0 24px 24px!important;margin-top:0!important;padding-top:5px!important}.chart-conent-section{position:relative;z-index:3;margin:15px!important;border:.0625rem solid var(--rc-dddddd);padding:1.5rem;background:#fff;box-shadow:0 .125rem .4375rem 0 rgba(var(--rc-rgba-black),.16);border-radius:24px!important}"]
})
], GenericChartComponent);
return GenericChartComponent;
}());
var PercentageColumnChartsComponent = /** @class */ (function () {
function PercentageColumnChartsComponent() {
this.barChartType = 'horizontalBar';
this.barChartLegend = true;
this.barChartPlugins = [pluginDataLabels, stackedBar];
}
PercentageColumnChartsComponent.prototype.ngOnInit = function () {
var _this = this;
this.submiisionDateArray = this.chartData.chart.submissionDateArray;
this.barChartData = this.chartData.chart.data.datasets;
this.barChartLabels = this.chartData.chart.data.labels;
this.barChartOptions = {
scales: {
xAxes: [
{
stacked: false,
gridLines: { display: false },
scaleLabel: {
display: true,
labelString: 'Criteria',
},
},
],
yAxes: [
{
stacked: true,
ticks: {
fontSize: 12,
},
},
],
},
plugins: {
stacked100: { enable: true, replaceTooltipLabel: true },
datalabels: {
offset: 0,
anchor: 'end',
align: 'left',
font: {
size: 12,
},
formatter: function (value, data) {
var d = data.chart.data;
var datasetIndex = data.datasetIndex, dataIndex = data.dataIndex;
// to remove 0 data in report
if (d.originalData[datasetIndex][dataIndex] == 0) {
if ((data.datasetIndex + 1) % _this.barChartData.length == 0 &&
_this.submiisionDateArray.length) {
return ['', '', _this.submiisionDateArray[data.dataIndex]];
}
return '';
}
// to remove date in instance report
if (_this.submiisionDateArray && !_this.submiisionDateArray.length) {
return "" + d.originalData[datasetIndex][dataIndex];
}
// for last value
if ((data.datasetIndex + 1) % _this.barChartData.length == 0) {
// console.log(data.datasetIndex)
if (d.originalData[datasetIndex][dataIndex] == 1) {
return ['', '', _this.submiisionDateArray[data.dataIndex]];
}
return [
" " + d.originalData[datasetIndex][dataIndex],
'',
" " + _this.submiisionDateArray[data.dataIndex],
];
}
else {
return "" + d.originalData[datasetIndex][dataIndex];
}
},
},
},
};
// this.barChartPlugins = [
// {
// beforeUpdate: function (c) {
// var chartHeight = c.chart.height;
// var size = (chartHeight * 3) / 100;
// c.scales['y-axis-0'].options.ticks.minor.fontSize = size;
// },
// },
// ];
};
// events
PercentageColumnChartsComponent.prototype.chartClicked = function (_a) {
var event = _a.event, active = _a.active;
// console.log(event, active);
};
__decorate([
core.ViewChild('chartCanvas')
], PercentageColumnChartsComponent.prototype, "chartCanvas", void 0);
__decorate([
core.Input()
], PercentageColumnChartsComponent.prototype, "chartData", void 0);
PercentageColumnChartsComponent = __decorate([
core.Component({
selector: 'sl-percentage-column-charts',
template: "<div class=\"graph-filters\" #chartRootElement>\n <ng-container *ngIf=\"chartData?.chart?.data\" class=\"bar-chart-wrapper\">\n <canvas\n #chartCanvas\n baseChart\n [datasets]=\"barChartData\"\n [labels]=\"barChartLabels\"\n [options]=\"barChartOptions\"\n [plugins]=\"barChartPlugins\"\n [legend]=\"barChartLegend\"\n [chartType]=\"barChartType\"\n ></canvas>\n </ng-container>\n</div>\n",
styles: [".bar-chart-wrapper{display:block;max-width:900px;max-height:450px;margin:0 auto}"]
})
], PercentageColumnChartsComponent);
return PercentageColumnChartsComponent;
}());
var ScatterChartsComponent = /** @class */ (function () {
function ScatterChartsComponent() {
}
ScatterChartsComponent.prototype.ngOnInit = function () {
};
ScatterChartsComponent = __decorate([
core.Component({
selector: 'sl-scatter-charts',
template: "<p>scatter-charts works!</p>\n",
styles: [""]
})
], ScatterChartsComponent);
return ScatterChartsComponent;
}());
var MatrixChartComponent = /** @class */ (function () {
function MatrixChartComponent() {
this.allEvidence = new core.EventEmitter();
}
MatrixChartComponent.prototype.ngOnInit = function () { };
MatrixChartComponent.prototype.extension = function (name) {
return name.split(".").pop();
};
MatrixChartComponent.prototype.openFile = function (file) {
window.open(file.url, "_blank");
};
__decorate([
core.Input()
], MatrixChartComponent.prototype, "data", void 0);
__decorate([
core.Input()
], MatrixChartComponent.prototype, "questionNumber", void 0);
__decorate([
core.Output()
], MatrixChartComponent.prototype, "allEvidence", void 0);
MatrixChartComponent = __decorate([
core.Component({
selector: 'sl-matrix-chart',
template: "<div>\n <div class=\"heading\">\n <h4>{{ questionNumber }}) {{ data?.question }}</h4>\n </div>\n <div class=\"ui bottom p-0 b-0 no-bg my-24 graph-content-section\">\n <div *ngFor=\"let element of data?.instanceQuestions; let i = index\">\n <div\n class=\"ui segment chart-conent-section\"\n [ngSwitch]=\"element?.responseType\"\n >\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'text'\"\n ></sl-reports-text>\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'number'\"\n ></sl-reports-text>\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'date'\"\n ></sl-reports-text>\n <sl-reports-text\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchDefault\n ></sl-reports-text>\n <sl-pie-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'radio'\"\n ></sl-pie-chart>\n <sl-pie-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'pie'\"\n ></sl-pie-chart>\n <sl-bar-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'bar'\"\n ></sl-bar-chart>\n <sl-bar-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'multiselect'\"\n ></sl-bar-chart>\n <sl-bar-chart\n [data]=\"element\"\n [questionNumber]=\"i + 1\"\n *ngSwitchCase=\"'column'\"\n ></sl-bar-chart>\n </div>\n <div\n *ngFor=\"let e of element.evidences\"\n (click)=\"openFile(e)\"\n class=\"area\"\n >\n <div *ngIf=\"e.extension == 'png'\" class=\"mx-10\">\n <i class=\"file image outline icon\"></i>\n </div>\n <div *ngIf=\"e.extension == 'jpg'\" class=\"mx-10\">\n <i class=\"file image outline icon\"></i>\n </div>\n <div *ngIf=\"e.extension == 'jpeg'\" class=\"mx-10\">\n <i class=\"file image outline icon\"></i>\n </div>\n <div *ngIf=\"e.extension == 'pdf'\" class=\"mx-10\">\n <i class=\"file pdf outline icon\"></i>\n </div>\n </div>\n </div>\n </div>\n</div>\n",
styles: [".area{position:relative}i{font-size:40px}.heading{padding:15px 10px;text-align:center}.graph-content-section{padding-bottom:15px!important;background-color:#c4c3c1!important;border-radius:0 0 24px 24px!important;margin-top:0!important;padding-top:5px!important}.chart-conent-section{position:relative;z-index:3;margin:15px!important;border:.0625rem solid var(--rc-dddddd);padding:1.5rem;background:#fff;box-shadow:0 .125rem .4375rem 0 rgba(var(--rc-rgba-black),.16);border-radius:24px!important}"]
})
], MatrixChartComponent);
return MatrixChartComponent;
}());
var ReportsTextComponent = /** @class */ (function () {
function ReportsTextComponent() {
}
ReportsTextComponent.prototype.ngOnInit = function () {
};
__decorate([
core.Input()
], ReportsTextComponent.prototype, "data", void 0);
__decorate([
core.Input()
], ReportsTextComponent.prototype, "questionNumber", void 0);
ReportsTextComponent = __decorate([
core.Component({
selector: 'sl-reports-text',
template: "<strong>{{ questionNumber }}) {{ data?.question }}</strong>\n<div class=\"answer-list\">\n <div *ngFor=\"let answer of data?.answers\">\n {{\n data?.resposeType === \"date\" && answer\n ? (answer | date: \"medium\":\"IST\")\n : answer\n }}\n </div>\n</div>\n",
styles: [".heading{text-align:center;padding:15px 10px}.answer-list{margin-top:3px;border-top:1px solid #ccc!important}"]
})
], ReportsTextComponent);
return ReportsTextComponent;
}());
var ExpansionTableComponent = /** @class */ (function () {
function ExpansionTableComponent() {
}
ExpansionTableComponent.prototype.ngOnInit = function () {
};
__decorate([
core.Input()
], ExpansionTableComponent.prototype, "datas", void 0);
ExpansionTableComponent = __decorate([
core.Component({
selector: 'sl-expansion-table',
template: "<div *ngIf=\"datas?.chart\">\n <strong>{{ datas?.chart?.title }}</strong> \n \n <sui-accordion class=\"styled fluid sb-accordion sb-new-theme-accordion drop-accordian\" *ngFor=\"let item of datas?.chart?.domains; let i = index\">\n <sui-accordion-panel [isOpen]=\"false\">\n <div title class=\"sb-accordion-title fsmall d-flex flex-ai-center flex-jc-space-between\">\n <span>{{ item?.domainName }}</span>\n <i class=\"chevron down icon\" role=\"img\" title=\"expand\"></i>\n </div>\n <div content class=\"sb-accordion-content sb-bg-color-white pt-0 pb-8\">\n <table>\n <tr class=\"_flex-box\">\n <td text-wrap style=\"flex: 1\"></td>\n <td class=\"_flex-box\" class=\"assess\" *ngFor=\"let head of datas?.chart?.heading\">\n {{ head }}\n </td>\n </tr>\n <tr *ngFor=\"let criteria of item.criterias\" class=\"_flex-box _justify-content-space-between _noWrap\">\n <td class=\"ion-text-wrap\" style=\"flex: 1\">{{ criteria?.name }}</td>\n <td class=\"_flex-box\" *ngFor=\"let level of criteria?.levels\">{{ level }}</td>\n </tr>\n </table>\n </div>\n </sui-accordion-panel>\n </sui-accordion>\n </div>\n ",
styles: ["table{border-collapse:collapse;border-spacing:0;width:100%;border:1px solid #ddd;background:#fff;color:var(--sb-text)}td,th{text-align:center;padding:12px 4px;color:#000}tr:nth-child(even){background-color:#f2f2f2}.expansionPanel{border-radius:10px;width:100%;margin:16px 0!important;padding:0!important}.assess{flex:0;text-align:-webkit-center}.heading{padding:15px 10px;text-align:center}.domain{display:flex;justify-content:space-between;margin-bottom:3px;border:1px solig;color:var(--sb-text)}.drop-accordian{margin-bottom:4px}"]
})
], ExpansionTableComponent);
return ExpansionTableComponent;
}());
var ExpansionPanelComponent = /** @class */ (function () {
function ExpansionPanelComponent() {
}
ExpansionPanelComponent.prototype.ngOnInit = function () {
};
__decorate([
core.Input()
], ExpansionPanelComponent.prototype, "datas", void 0);
ExpansionPanelComponent = __decorate([
core.Component({
selector: 'sl-expansion-panel',
template: "<!-- <h2 *ngIf=\"datas?.chart\" class=\"heading\">{{ datas?.chart?.title }}</h2>\n<div *ngIf=\"datas?.chart\" >\n <div *ngFor=\"let entity of datas?.chart?.entities\">\n <h4 class=\"heading\">{{ entity.entityName }}</h4>\n\n <div\n (click)=\"isOpenIndex = isOpenIndex == i ? -1 : i\"\n class=\"expansionPanel\"\n margin\n *ngFor=\"let item of entity?.domains; let i = index\"\n >\n <div class=\"domain\" >\n <h4 style=\"flex: 1\" >{{ item?.domainName }}</h4>\n <i *ngIf=\"!(isOpenIndex == i)\" class=\"arrow down icon medium\" ></i>\n <i *ngIf=\"isOpenIndex == i\" class=\"arrow up icon medium\" ></i>\n </div>\n <div *ngIf=\"isOpenIndex == i\" class=\"ion-padding\">\n <table>\n <tr *ngFor=\"let criteria of item.criterias\" class=\"domain _noWrap\">\n <td style=\"flex: 1\">{{ criteria?.name }}</td>\n <td class=\"_flex-box\">: {{ criteria?.level }}</td>\n </tr>\n </table>\n </div>\n </div>\n </div>\n</div> -->\n\n\n<div *ngIf=\"datas?.chart\">\n <strong>{{ datas?.chart?.title }}</strong>\n <div *ngFor=\"let entity of datas?.chart?.entities\">\n <strong>{{ entity.entityName }}</strong>\n\n <sui-accordion class=\"styled fluid sb-accordion sb-new-theme-accordion drop-accordian\"\n *ngFor=\"let item of entity?.domains; let i = index\">\n <sui-accordion-panel [isOpen]=\"false\">\n <div title class=\"sb-accordion-title fsmall d-flex flex-ai-center flex-jc-space-between\">\n <span>{{ item?.domainName }}</span>\n <i class=\"chevron down icon\" role=\"img\" title=\"expand\"></i>\n </div>\n <div content class=\"sb-accordion-content sb-bg-color-white pt-0 pb-8\">\n <table>\n <tr *ngFor=\"let criteria of item.criterias\" class=\"domain _noWrap\">\n <td style=\"flex: 1\">{{ criteria?.name }}</td>\n <td class=\"_flex-box\">: {{ criteria?.level }}</td>\n </tr>\n </table>\n </div>\n </sui-accordion-panel>\n </sui-accordion>\n </div>\n</div>",
styles: ["table{border-collapse:collapse;border-spacing:0;width:100%;border:1px solid #ddd;background:#fff;color:var(--sb-text)}td,th{text-align:center;padding:12px 4px;color:#000}tr:nth-child(even){background-color:#f2f2f2}.expansionPanel{border-radius:10px;width:100%;margin:16px 0!important;padding:0!important}.assess{flex:0;text-align:-webkit-center}.heading{padding:15px 10px;text-align:center}.domain{display:flex;justify-content:space-between;margin-bottom:3px;border:1px solig;color:var(--sb-text)}.drop-accordian{margin-bottom:4px}"]
})
], ExpansionPanelComponent);
return ExpansionPanelComponent;
}());
var FileExtension = {
videoFormats: ["mp4", "WMV", "WEBM", "flv", "avi", "3GP", "OGG", "m4v"],
audioFormats: ["AIF", "cda", "mpa", "ogg", "wav", "wma", "mp3"],
pptFormats: ["ppt", "pptx", "pps", "ppsx"],
wordFormats: ["docx", "doc", "docm", "dotx"],
imageFormats: ["jpg", "png", "jpeg"],
pdfFormats: ["pdf"],
spreadSheetFormats: ["xls", "xlsx"],
};
var AttachmentsComponent = /** @class */ (function () {
function AttachmentsComponent() {
this.imageFormats = FileExtension.imageFormats;
this.videoFormats = FileExtension.videoFormats;
this.audioFormats = FileExtension.audioFormats;
this.pdfFormats = FileExtension.pdfFormats;
this.wordFormats = FileExtension.wordFormats;
this.spreadSheetFormats = FileExtension.spreadSheetFormats;
}
AttachmentsComponent.prototype.ngOnInit = function () { };
AttachmentsComponent.prototype.openImage = function (url) {
window.open(url, "_blank");
};
__decorate([
core.Input()
], AttachmentsComponent.prototype, "url", void 0);
__decorate([
core.Input()
], AttachmentsComponent.prototype, "extension", void 0);
AttachmentsComponent = __decorate([
core.Component({
selector: 'sl-attachments',
template: "<div class=\"thumbnail-card\">\n <img [src]=\"url\" *ngIf=\"imageFormats.includes(extension)\" (click)=\"openImage(url)\" class=\"card-images\" />\n <!-- <fa name=\"file-video-o\" class=\"attachmentIcon\" *ngIf=\"videoFormats.includes(extension)\" (click)=\"playVideo(url)\"></fa> -->\n <i\n class=\"video icon attachmentIcon\"\n *ngIf=\"videoFormats.includes(extension)\"\n (click)=\"openImage(url)\"\n ></i>\n \n <!-- <fa *ngIf=\"audioFormats.includes(extension)\" name=\"file-audio-o\" class=\"attachmentIcon\" (click)=\"playAudio(url)\"></fa> -->\n <i\n *ngIf=\"audioFormats.includes(extension)\"\n class=\"file audio icon attachmentIcon\"\n (click)=\"openImage(url)\"\n ></i>\n <!-- <fa class=\"attachmentIcon\" name=\"file-pdf-o\" *ngIf=\"pdfFormats.includes(extension)\" (click)=\"openDocument(url)\"></fa> -->\n <i\n class=\"file alternate icon attachmentIcon\"\n *ngIf=\"pdfFormats.includes(extension)\"\n (click)=\"openImage(url)\"\n ></i>\n \n <i\n class=\"file alternate icon attachmentIcon\"\n *ngIf=\"spreadSheetFormats.includes(extension) || wordFormats.includes(extension) \"\n (click)=\"openImage(url)\"\n ></i>\n </div>\n ",
styles: [".attachmentIcon{margin-top:10px;font-size:70px}.thumbnail-card{height:98px;display:inline;justify-content:space-around;align-items:center}.card-images{width:90px;height:90px;margin-right:2px;margin-bottom:2px;border-radius:10px}"]
})
], AttachmentsComponent);
return AttachmentsComponent;
}());
var SlReportsLibraryModule = /** @class */ (function () {
function SlReportsLibraryModule() {
}
SlReportsLibraryModule = __decorate([
core.NgModule({
declarations: [
SlReportsLibraryComponent,
ReportHeaderComponent,
PieChartComponent,
BarChartComponent,
GenericChartComponent,
PercentageColumnChartsComponent,
ScatterChartsComponent,
MatrixChartComponent,
ReportsTextComponent,
ExpansionTableComponent,
ExpansionPanelComponent,
AttachmentsComponent,
],
imports: [ng2Charts.ChartsModule, common.CommonModule, ng2SemanticUiV9.SuiModule, ng2SemanticUiV9.SuiAccordionModule],
exports: [
SlReportsLibraryComponent,
ReportHeaderComponent,
PieChartComponent,
BarChartComponent,
GenericChartComponent,
PercentageColumnChartsComponent,
ScatterChartsComponent,
MatrixChartComponent,
ReportsTextComponent,
ExpansionTableComponent,
ExpansionPanelComponent,
AttachmentsComponent
],
schemas: [core.CUSTOM_ELEMENTS_SCHEMA],
})
], SlReportsLibraryModule);
return SlReportsLibraryModule;
}());
exports.AttachmentsComponent = AttachmentsComponent;
exports.BarChartComponent = BarChartComponent;
exports.ExpansionPanelComponent = ExpansionPanelComponent;
exports.ExpansionTableComponent = ExpansionTableComponent;
exports.GenericChartComponent = GenericChartComponent;
exports.MatrixChartComponent = MatrixChartComponent;
exports.PercentageColumnChartsComponent = PercentageColumnChartsComponent;
exports.PieChartComponent = PieChartComponent;
exports.ReportHeaderComponent = ReportHeaderComponent;
exports.ReportsTextComponent = ReportsTextComponent;
exports.ScatterChartsComponent = ScatterChartsComponent;
exports.SlReportsLibraryComponent = SlReportsLibraryComponent;
exports.SlReportsLibraryModule = SlReportsLibraryModule;
exports.SlReportsLibraryService = SlReportsLibraryService;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=sl-reports-library.umd.js.map