ps-toolkit-ui 1.19.83 → 1.19.84
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.
- package/bundles/ps-toolkit-ui.umd.js +195 -171
- package/bundles/ps-toolkit-ui.umd.js.map +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js.map +1 -1
- package/esm2015/lib/classes/table.class.js +117 -2
- package/esm2015/lib/components/table/row/table.row.component.js +3 -98
- package/esm2015/lib/components/table/table.component.js +6 -2
- package/fesm2015/ps-toolkit-ui.js +163 -140
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/table.class.d.ts +3 -0
- package/lib/components/table/table.component.d.ts +1 -0
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('jquery'), require('lodash'), require('jalali-moment'), require('@angular/router'), require('rxjs'), require('jquery-ui-dist/jquery-ui'), require('@angular/forms'), require('@angular/common'), require('@angular/platform-browser'), require('ckeditor4-angular'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('ps-toolkit-ui', ['exports', '@angular/core', 'jquery', 'lodash', 'jalali-moment', '@angular/router', 'rxjs', 'jquery-ui-dist/jquery-ui', '@angular/forms', '@angular/common', '@angular/platform-browser', 'ckeditor4-angular', 'highcharts', 'highcharts/modules/exporting', 'highcharts/modules/export-data'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ps-toolkit-ui'] = {}, global.ng.core, global.$$1, global._, global.moment, global.ng.router, global.rxjs, null, global.ng.forms, global.ng.common, global.ng.platformBrowser, global.ckeditor4Angular, global.
|
|
5
|
-
}(this, (function (exports, core, $$1, _, moment, router, rxjs, jqueryUi, forms, common, platformBrowser, ckeditor4Angular,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('jquery'), require('lodash'), require('jalali-moment'), require('@angular/router'), require('rxjs'), require('jquery-ui-dist/jquery-ui'), require('@angular/forms'), require('@angular/common'), require('@angular/platform-browser'), require('ckeditor4-angular'), require('file-saver'), require('xlsx'), require('highcharts'), require('highcharts/modules/exporting'), require('highcharts/modules/export-data')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('ps-toolkit-ui', ['exports', '@angular/core', 'jquery', 'lodash', 'jalali-moment', '@angular/router', 'rxjs', 'jquery-ui-dist/jquery-ui', '@angular/forms', '@angular/common', '@angular/platform-browser', 'ckeditor4-angular', 'file-saver', 'xlsx', 'highcharts', 'highcharts/modules/exporting', 'highcharts/modules/export-data'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['ps-toolkit-ui'] = {}, global.ng.core, global.$$1, global._, global.moment, global.ng.router, global.rxjs, null, global.ng.forms, global.ng.common, global.ng.platformBrowser, global.ckeditor4Angular, global.FileSaver, global.XLSX, global.Highcharts, global.HighchartsExporting, global.HighchartsExportData));
|
|
5
|
+
}(this, (function (exports, core, $$1, _, moment, router, rxjs, jqueryUi, forms, common, platformBrowser, ckeditor4Angular, FileSaver, XLSX, Highcharts, HighchartsExporting, HighchartsExportData) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) { return e; } else {
|
|
@@ -3686,112 +3686,7 @@
|
|
|
3686
3686
|
}, []);
|
|
3687
3687
|
};
|
|
3688
3688
|
TableRowComponent.prototype.getCell = function (col) {
|
|
3689
|
-
|
|
3690
|
-
// console.log('getCell');
|
|
3691
|
-
var cv = _.get(this.row.Data, col.name);
|
|
3692
|
-
if (cv === null) {
|
|
3693
|
-
return col.default ? col.default : '';
|
|
3694
|
-
}
|
|
3695
|
-
else if (col.fun != null) {
|
|
3696
|
-
return col.fun(this.row.Data);
|
|
3697
|
-
}
|
|
3698
|
-
else if (col.enum !== null) {
|
|
3699
|
-
return this.table.l(EnumUtils.getKeyByValue(col.enum, cv));
|
|
3700
|
-
}
|
|
3701
|
-
else if (col.type === exports.TableCollType.DateDif) {
|
|
3702
|
-
return HelperClass.getDateDif(this.table.l, cv);
|
|
3703
|
-
}
|
|
3704
|
-
else if (col.type === exports.TableCollType.Date) {
|
|
3705
|
-
return HelperClass.getDate(cv);
|
|
3706
|
-
}
|
|
3707
|
-
else if (col.type === exports.TableCollType.DateTime) {
|
|
3708
|
-
return '<span class="ltr">' + HelperClass.getDateTime(cv) + '</span>';
|
|
3709
|
-
}
|
|
3710
|
-
else if (col.type === exports.TableCollType.Month) {
|
|
3711
|
-
return HelperClass.getDate(cv, 'jMMMM jYYYY');
|
|
3712
|
-
}
|
|
3713
|
-
else if (col.type === exports.TableCollType.Year) {
|
|
3714
|
-
return HelperClass.getDate(cv, 'jYYYY');
|
|
3715
|
-
}
|
|
3716
|
-
else if (col.type === exports.TableCollType.Time) {
|
|
3717
|
-
return HelperClass.getTime(cv);
|
|
3718
|
-
}
|
|
3719
|
-
else if (col.type === exports.TableCollType.Color) {
|
|
3720
|
-
return '<div class="color" style="background-color: ' + cv + '; color: ' + HelperClass.getColorByBgColor(cv) + '">' + cv + '</div>';
|
|
3721
|
-
}
|
|
3722
|
-
else if (col.type === exports.TableCollType.Url) {
|
|
3723
|
-
return '<a target="_blank" class="ltr" href="' + cv + '">' + cv + '</a>';
|
|
3724
|
-
}
|
|
3725
|
-
else if (col.type === exports.TableCollType.Image) {
|
|
3726
|
-
return '<img style="height: ' + this.table.height + 'px" alt="" src="' + this.service.environment.url + cv + '"/>';
|
|
3727
|
-
}
|
|
3728
|
-
else if (col.type === exports.TableCollType.FileSize) {
|
|
3729
|
-
return HelperClass.getFileSize(cv);
|
|
3730
|
-
}
|
|
3731
|
-
else if (col.type === exports.TableCollType.Price) {
|
|
3732
|
-
try {
|
|
3733
|
-
return HelperClass.toPrice(this.table.l, cv);
|
|
3734
|
-
}
|
|
3735
|
-
catch (_a) { }
|
|
3736
|
-
}
|
|
3737
|
-
else if (col.type === exports.TableCollType.Number) {
|
|
3738
|
-
return cv.toLocaleString();
|
|
3739
|
-
}
|
|
3740
|
-
else if (col.type === exports.TableCollType.Files) {
|
|
3741
|
-
var files = '';
|
|
3742
|
-
try {
|
|
3743
|
-
for (var cv_1 = __values(cv), cv_1_1 = cv_1.next(); !cv_1_1.done; cv_1_1 = cv_1.next()) {
|
|
3744
|
-
var f = cv_1_1.value;
|
|
3745
|
-
var k = f.split('.').at(-1);
|
|
3746
|
-
if (k === 'jpeg' || k === 'jpg' || k === 'png') {
|
|
3747
|
-
files += '<a target="_blank" href="' + this.table.environment.url + f + '" class="m-h-5"><img alt="" src="' + this.table.environment.url + f + '" style="height: 30px"/></a>';
|
|
3748
|
-
}
|
|
3749
|
-
else {
|
|
3750
|
-
files += '<a target="_blank" href="' + this.table.environment.url + f + '" class="f-s-30 m-h-5 ' + exports.FileIcons[k] + '"></a>';
|
|
3751
|
-
}
|
|
3752
|
-
}
|
|
3753
|
-
}
|
|
3754
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
3755
|
-
finally {
|
|
3756
|
-
try {
|
|
3757
|
-
if (cv_1_1 && !cv_1_1.done && (_e = cv_1.return)) _e.call(cv_1);
|
|
3758
|
-
}
|
|
3759
|
-
finally { if (e_4) throw e_4.error; }
|
|
3760
|
-
}
|
|
3761
|
-
return files;
|
|
3762
|
-
}
|
|
3763
|
-
else if (col.type === exports.TableCollType.Plaque) {
|
|
3764
|
-
var parts = cv.split('_');
|
|
3765
|
-
if (parts.length === 4) {
|
|
3766
|
-
return '<div data-copy="' + parts.join(' ') + '" class="plaque' + (parts[1] === 'ع' ? ' p' : '') + (parts[1] === 'ا' ? ' g' : '') + '">' +
|
|
3767
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
3768
|
-
'<div class="part2">' + parts[1] + '</div>' +
|
|
3769
|
-
'<div class="part3">' + parts[2] + '</div>' +
|
|
3770
|
-
'<div class="part4">' + parts[3] + '</div>' +
|
|
3771
|
-
'</div>';
|
|
3772
|
-
}
|
|
3773
|
-
else if (parts.length === 2 && parts.every(function (x) { return /^[0-9]+$/.test(x); })) {
|
|
3774
|
-
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-m">' +
|
|
3775
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
3776
|
-
'<div class="part2">' + parts[1] + '</div>' +
|
|
3777
|
-
'</div>';
|
|
3778
|
-
}
|
|
3779
|
-
else if (parts.length === 2) {
|
|
3780
|
-
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-f">' +
|
|
3781
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
3782
|
-
'<div class="part2">' + parts[1] + '</div>' +
|
|
3783
|
-
'</div>';
|
|
3784
|
-
}
|
|
3785
|
-
else if (parts.length === 1) {
|
|
3786
|
-
return '<div data-copy="' + parts[0] + '" class="plaque plaque-g">' +
|
|
3787
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
3788
|
-
'</div>';
|
|
3789
|
-
}
|
|
3790
|
-
}
|
|
3791
|
-
else if (col.type === exports.TableCollType.PlaqueText) {
|
|
3792
|
-
return "<div class=\"ltr\">" + HelperClass.ToReadablePlaque(cv) + "</div>";
|
|
3793
|
-
}
|
|
3794
|
-
return this.table.l(cv);
|
|
3689
|
+
this.table.getCell(this.row.Data, col);
|
|
3795
3690
|
};
|
|
3796
3691
|
TableRowComponent.prototype.getCol = function (n) {
|
|
3797
3692
|
var c = this.row.Data;
|
|
@@ -3982,6 +3877,7 @@
|
|
|
3982
3877
|
var e_1, _a;
|
|
3983
3878
|
var _this = this;
|
|
3984
3879
|
this.reload = new InputClass(this.table.environment, this.table.l, 'Reload', 'fad fa-sync-alt', exports.InputType.Icon, 'm-r-10-p');
|
|
3880
|
+
this.excel = new InputClass(this.table.environment, this.table.l, 'Excel', 'fad fa-arrow-down-to-line f-s-21', exports.InputType.Icon, 'm-r-10-p');
|
|
3985
3881
|
this.maximum = new InputClass(this.table.environment, this.table.l, 'Maximum', 'fad fa-arrows-maximize', exports.InputType.Icon, 'm-r-10-p');
|
|
3986
3882
|
this.expertSearch = new InputClass(this.table.environment, this.table.l, 'ExpertSearch', 'fad fa-magnifying-glass', exports.InputType.Icon, 'm-r-10-p');
|
|
3987
3883
|
try {
|
|
@@ -4072,6 +3968,9 @@
|
|
|
4072
3968
|
this.reload.onClick = function () {
|
|
4073
3969
|
_this.table.load(_this.reload);
|
|
4074
3970
|
};
|
|
3971
|
+
this.excel.onClick = function () {
|
|
3972
|
+
_this.table.excel();
|
|
3973
|
+
};
|
|
4075
3974
|
this.maximum.onClick = function () {
|
|
4076
3975
|
$__namespace(_this.tableDiv.nativeElement).toggleClass('maximum');
|
|
4077
3976
|
_this.maximum.icon = _this.maximum.name === 'Minimum' ? 'fad fa-arrows-maximize' : 'fad fa-arrows-minimize';
|
|
@@ -4170,7 +4069,7 @@
|
|
|
4170
4069
|
TableComponent.decorators = [
|
|
4171
4070
|
{ type: core.Component, args: [{
|
|
4172
4071
|
selector: 'lib-table',
|
|
4173
|
-
template: "<div [id]=\"table.id + 'Table'\" [style]=\"table.style\" #tableDiv [className]=\"(table.class ? table.class : '') + (table.sortable ? 'sortable' : '') + (table.hasChildren || table.subTable != null ? ' has-children' : '') + (table.vertical ? ' vertical' : '') + (table.expertSearch ? ' expert-search' : '') + ' table-con w-100'\">\r\n <div *ngIf=\"table.displayLabel\" class=\"title\">\r\n <div class=\"f-r\" [innerHTML]=\"this.table.title ? this.table.title : table.l('List')\"></div>\r\n <span class=\"description\" *ngIf=\"this.table.description != null\" [innerHTML]=\"'( ' + this.table.description + ' )'\"></span>\r\n <div class=\"extra-buttons\" *ngIf=\"table.showExtraButtons\">\r\n <span *ngIf=\"isChecked()\">\r\n <lib-form-icon *ngFor=\"let btn of table.extraButtons\" [inp]=\"btn\"></lib-form-icon>\r\n </span>\r\n <span *ngIf=\"!isChecked()\">\r\n <lib-form-icon *ngIf=\"table.expertSearch\" [inp]=\"expertSearch\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"reload\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"maximum\"></lib-form-icon>\r\n </span>\r\n </div>\r\n <div *ngIf=\"table.buttons.length > 0\" class=\"buttons\">\r\n <span *ngFor=\"let btn of table.buttons\">\r\n <lib-form-button [inp]=\"btn\" *ngIf=\"btn.type == type.Button\"></lib-form-button>\r\n <lib-form-icon [inp]=\"btn\" *ngIf=\"btn.type == type.Icon\"></lib-form-icon>\r\n <lib-form-label [inp]=\"btn\" *ngIf=\"btn.type == type.Label\"></lib-form-label>\r\n <lib-form-select [inp]=\"btn\" *ngIf=\"btn.type == type.Select\"></lib-form-select>\r\n </span>\r\n </div>\r\n </div>\r\n <div class=\"search-form\" *ngIf=\"table.searchForm\" (click)=\"hideExpertSearch($event)\">\r\n <lib-form [form]=\"table.searchForm\"></lib-form>\r\n </div>\r\n <lib-form *ngIf=\"table.form && table.form.onTop\" [form]=\"table.form\"></lib-form>\r\n <div class=\"table\">\r\n <div class=\"header\">\r\n <div [className]=\"(table.hasChildren || table.subTable != null ? 'with-handle-children ' : '') + (table.sortable ? 'with-handle-sortable ' : '') + (table.withCheck ? 'with-handle-check ' : '') + 'row'\">\r\n <div class=\"handle-con\">\r\n <div class=\"handle handle-sortable\" *ngIf=\"table.sortable\"></div>\r\n <div class=\"handle handle-check\" *ngIf=\"table.hasChildren || table.subTable != null\"></div>\r\n <div class=\"handle handle-children\" *ngIf=\"table.withCheck\">\r\n <i (click)=\"checkAll()\" [className]=\"(allChecked() ? 'fa-solid fa-square-check c-green' : isChecked() ? 'fa-solid fa-square-minus c-green' : 'fa-regular fa-square') + ' check-row'\" *ngIf=\"table.rows.length > 0\"></i>\r\n </div>\r\n </div>\r\n <div (click)=\"!table.sortable && col.sort && changeSort($event, col.name)\" [className]=\"(!table.sortable && col.sort ? 'sort ' : '') + col.class + ' ' + col.name + '-cell cell w-100'\" *ngFor=\"let col of table.cols\">\r\n <div class=\"header-title\" *ngIf=\"col.search == null || table.sortable\" [innerHTML]=\"table.l(col.name)\"></div>\r\n <div class=\"header-search\" *ngIf=\"!table.sortable && col.search != null\">\r\n <lib-form-textbox *ngIf=\"col.type != colType.Date && col.type != colType.DateTime && col.type != colType.DateDif && col.type != colType.DateRemain && col.type != colType.Month && col.type != colType.Year && col.enum == null\" [inp]=\"col.search\"></lib-form-textbox>\r\n <lib-form-date *ngIf=\"(col.type == colType.Date || col.type == colType.DateTime || col.type === colType.DateDif || col.type === colType.DateRemain || col.type == colType.Month || col.type == colType.Year) && col.enum == null\" [inp]=\"col.search\"></lib-form-date>\r\n <lib-form-select *ngIf=\"col.enum != null\" [inp]=\"col.search\"></lib-form-select>\r\n </div>\r\n <i *ngIf=\"!table.sortable && col.sort\" [className]=\"'sort-icon fas' + (table.sort === col.name ? (table.sortType === 'ASC' ? ' fa-sort-up' : ' fa-sort-down') : ' fa-sort')\"></i>\r\n </div>\r\n <div class=\"cell options\" *ngIf=\"table.optionType == tableOptionType.Show\">{{table.l('Options')}}</div>\r\n </div>\r\n </div>\r\n <div class=\"body\" #rows [style]=\"table.perPage > 0 ? {minHeight: table.height * table.perPage + 'px'} : {minHeight: '250px'}\">\r\n <lib-table-row (confirmShow)=\"onConfirmShow($event)\" [level]=\"1\" (changeRows)=\"onChangeRows($event)\" [id]=\"row.id ? row.id : ''\" [table]=\"table\" [row]=\"row\" *ngFor=\"let row of getRows()\"></lib-table-row>\r\n <lib-table-loading [table]=\"table\"></lib-table-loading>\r\n </div>\r\n </div>\r\n <lib-table-pagination [table]=\"table\" *ngIf=\"table.perPage > 0\"></lib-table-pagination>\r\n <lib-modal *ngIf=\"table.modal != null\" [modal]=\"table.modal\"></lib-modal>\r\n <lib-modal [modal]=\"opt\" *ngFor=\"let opt of getModals()\"></lib-modal>\r\n <lib-confirm #confirm [tableId]=\"table.name\"></lib-confirm>\r\n</div>\r\n",
|
|
4072
|
+
template: "<div [id]=\"table.id + 'Table'\" [style]=\"table.style\" #tableDiv [className]=\"(table.class ? table.class : '') + (table.sortable ? 'sortable' : '') + (table.hasChildren || table.subTable != null ? ' has-children' : '') + (table.vertical ? ' vertical' : '') + (table.expertSearch ? ' expert-search' : '') + ' table-con w-100'\">\r\n <div *ngIf=\"table.displayLabel\" class=\"title\">\r\n <div class=\"f-r\" [innerHTML]=\"this.table.title ? this.table.title : table.l('List')\"></div>\r\n <span class=\"description\" *ngIf=\"this.table.description != null\" [innerHTML]=\"'( ' + this.table.description + ' )'\"></span>\r\n <div class=\"extra-buttons\" *ngIf=\"table.showExtraButtons\">\r\n <span *ngIf=\"isChecked()\">\r\n <lib-form-icon *ngFor=\"let btn of table.extraButtons\" [inp]=\"btn\"></lib-form-icon>\r\n </span>\r\n <span *ngIf=\"!isChecked()\">\r\n <lib-form-icon *ngIf=\"table.expertSearch\" [inp]=\"expertSearch\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"excel\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"reload\"></lib-form-icon>\r\n <lib-form-icon [inp]=\"maximum\"></lib-form-icon>\r\n </span>\r\n </div>\r\n <div *ngIf=\"table.buttons.length > 0\" class=\"buttons\">\r\n <span *ngFor=\"let btn of table.buttons\">\r\n <lib-form-button [inp]=\"btn\" *ngIf=\"btn.type == type.Button\"></lib-form-button>\r\n <lib-form-icon [inp]=\"btn\" *ngIf=\"btn.type == type.Icon\"></lib-form-icon>\r\n <lib-form-label [inp]=\"btn\" *ngIf=\"btn.type == type.Label\"></lib-form-label>\r\n <lib-form-select [inp]=\"btn\" *ngIf=\"btn.type == type.Select\"></lib-form-select>\r\n </span>\r\n </div>\r\n </div>\r\n <div class=\"search-form\" *ngIf=\"table.searchForm\" (click)=\"hideExpertSearch($event)\">\r\n <lib-form [form]=\"table.searchForm\"></lib-form>\r\n </div>\r\n <lib-form *ngIf=\"table.form && table.form.onTop\" [form]=\"table.form\"></lib-form>\r\n <div class=\"table\">\r\n <div class=\"header\">\r\n <div [className]=\"(table.hasChildren || table.subTable != null ? 'with-handle-children ' : '') + (table.sortable ? 'with-handle-sortable ' : '') + (table.withCheck ? 'with-handle-check ' : '') + 'row'\">\r\n <div class=\"handle-con\">\r\n <div class=\"handle handle-sortable\" *ngIf=\"table.sortable\"></div>\r\n <div class=\"handle handle-check\" *ngIf=\"table.hasChildren || table.subTable != null\"></div>\r\n <div class=\"handle handle-children\" *ngIf=\"table.withCheck\">\r\n <i (click)=\"checkAll()\" [className]=\"(allChecked() ? 'fa-solid fa-square-check c-green' : isChecked() ? 'fa-solid fa-square-minus c-green' : 'fa-regular fa-square') + ' check-row'\" *ngIf=\"table.rows.length > 0\"></i>\r\n </div>\r\n </div>\r\n <div (click)=\"!table.sortable && col.sort && changeSort($event, col.name)\" [className]=\"(!table.sortable && col.sort ? 'sort ' : '') + col.class + ' ' + col.name + '-cell cell w-100'\" *ngFor=\"let col of table.cols\">\r\n <div class=\"header-title\" *ngIf=\"col.search == null || table.sortable\" [innerHTML]=\"table.l(col.name)\"></div>\r\n <div class=\"header-search\" *ngIf=\"!table.sortable && col.search != null\">\r\n <lib-form-textbox *ngIf=\"col.type != colType.Date && col.type != colType.DateTime && col.type != colType.DateDif && col.type != colType.DateRemain && col.type != colType.Month && col.type != colType.Year && col.enum == null\" [inp]=\"col.search\"></lib-form-textbox>\r\n <lib-form-date *ngIf=\"(col.type == colType.Date || col.type == colType.DateTime || col.type === colType.DateDif || col.type === colType.DateRemain || col.type == colType.Month || col.type == colType.Year) && col.enum == null\" [inp]=\"col.search\"></lib-form-date>\r\n <lib-form-select *ngIf=\"col.enum != null\" [inp]=\"col.search\"></lib-form-select>\r\n </div>\r\n <i *ngIf=\"!table.sortable && col.sort\" [className]=\"'sort-icon fas' + (table.sort === col.name ? (table.sortType === 'ASC' ? ' fa-sort-up' : ' fa-sort-down') : ' fa-sort')\"></i>\r\n </div>\r\n <div class=\"cell options\" *ngIf=\"table.optionType == tableOptionType.Show\">{{table.l('Options')}}</div>\r\n </div>\r\n </div>\r\n <div class=\"body\" #rows [style]=\"table.perPage > 0 ? {minHeight: table.height * table.perPage + 'px'} : {minHeight: '250px'}\">\r\n <lib-table-row (confirmShow)=\"onConfirmShow($event)\" [level]=\"1\" (changeRows)=\"onChangeRows($event)\" [id]=\"row.id ? row.id : ''\" [table]=\"table\" [row]=\"row\" *ngFor=\"let row of getRows()\"></lib-table-row>\r\n <lib-table-loading [table]=\"table\"></lib-table-loading>\r\n </div>\r\n </div>\r\n <lib-table-pagination [table]=\"table\" *ngIf=\"table.perPage > 0\"></lib-table-pagination>\r\n <lib-modal *ngIf=\"table.modal != null\" [modal]=\"table.modal\"></lib-modal>\r\n <lib-modal [modal]=\"opt\" *ngFor=\"let opt of getModals()\"></lib-modal>\r\n <lib-confirm #confirm [tableId]=\"table.name\"></lib-confirm>\r\n</div>\r\n",
|
|
4174
4073
|
styles: [".table-con{background-color:#fff;border-radius:var(--border-radius-base);box-shadow:var(--box-shadow-table);float:right;padding:20px;position:relative}.table-con.maximum{border-radius:0;height:100%;overflow-y:auto;position:fixed;right:0;top:0;width:100%;z-index:102}.table-con>.title{float:right;font-size:16px;font-weight:700;line-height:40px;margin-bottom:10px;position:relative;text-align:right;width:100%;z-index:3}.table-con>.title .description{font-size:13px;font-weight:200;margin-right:10px}.table-con>.title .buttons,.table-con>.title .extra-buttons{float:left;margin-top:5px;position:relative;z-index:1}.table-con>.title .extra-buttons{min-width:80px}.table-con>.search-form{border-radius:var(--border-radius-base);float:right;margin-bottom:10px;width:100%}.table-con.expert-search>.search-form{background-color:rgba(51,51,51,.4);height:100%;left:0;margin-bottom:0;opacity:0;overflow:hidden;position:absolute;top:0;transition:all .35s ease-in-out;visibility:hidden;width:100%;z-index:4}.table-con.expert-search.show-expert-search>.search-form{opacity:1;visibility:visible}::ng-deep .table-con.expert-search>.search-form .form{background-color:var(--white);box-shadow:var(--box-shadow-right);height:100%;left:calc(-20% - 20px);padding:20px;position:absolute;top:0;transition:all .35s ease-in-out;width:20%;z-index:4}::ng-deep .table-con.expert-search>.search-form .form .inputs{float:right;height:calc(100% - 50px);margin:0;overflow-y:auto;width:100%}::ng-deep .table-con.expert-search.show-expert-search>.search-form .form{left:0}.table-con .table,.table-con .table .header{float:right;width:100%}.table-con .table .header .row{-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;align-items:center;background-color:var(--base-white);border-radius:var(--border-radius-base);display:flex;flex-wrap:wrap;float:right;justify-content:right;position:relative;width:100%}.table-con .table .header .row.with-handle-check,.table-con .table .header .row.with-handle-children,.table-con .table .header .row.with-handle-sortable{padding-right:30px}.table-con .table .header .row.with-handle-children.with-handle-check,.table-con .table .header .row.with-handle-sortable.with-handle-check,.table-con .table .header .row.with-handle-sortable.with-handle-children{padding-right:60px}.table-con .table .header .row.with-handle-sortable.with-handle-children.with-handle-check{padding-right:90px}.table-con .table .header .row .cell{align-items:center;color:var(--black-light);display:flex;float:right;font-size:12px;font-weight:200;font-weight:400;height:45px;justify-content:center;position:relative}.table-con .table .header .row .cell.options{margin-left:auto;margin-right:auto}.table-con .table .header .row .handle-con{height:100%;position:absolute;right:0;top:0}.table-con .table .header .row .handle-con .handle{align-items:center;display:flex;float:right;height:100%;justify-content:center;width:30px}.table-con .table .header .row .handle-con .handle i{cursor:pointer;font-size:18px}.table-con .table .header .row .cell.sort{cursor:pointer}.table-con .table .header .row .cell .header-title{float:right;padding:0 15px;text-align:center;width:calc(100% - 20px)}.table-con .table .header .row .cell .header-search{float:right;width:calc(100% - 20px)}.table-con .table .header .row .cell .sort-icon{float:right;font-size:13px;height:20px;left:5px;line-height:20px;opacity:.6;top:calc(50% - 10px);width:20px}.table-con .table .body{float:right;position:relative;width:100%}::ng-deep .table-con .table .header .row .cell .check-row{cursor:pointer;font-size:18px;height:30px;line-height:30px}::ng-deep .table-con.vertical .table lib-table-row>.row-con>.row:after{background-image:linear-gradient(180deg,rgba(0,0,0,.05),rgba(50,50,50,.15),rgba(0,0,0,.05));height:100%;left:0;right:unset;width:1px}::ng-deep .table-con.vertical:not(.sortable) .table lib-table-row:first-of-type>.row-con>.row:after,::ng-deep .table-con:not(.sortable) .table lib-table-row:last-of-type>.row-con>.row:after{background-image:unset}.table-con.vertical .table .header{display:none}::ng-deep .table-con .table lib-table-row{display:contents}.table-con.vertical .table .body{display:flex}::ng-deep .table-con.vertical .table lib-table-row:first-of-type>.row-con{background-color:var(--base-white);border-radius:var(--border-radius-base);max-width:150px}@media (max-width:499.99px){::ng-deep .table-con.expert-search>.search-form .form{left:calc(-100% - 20px);width:100%}}@media (min-width:500px) and (max-width:699.99px){::ng-deep .table-con.expert-search>.search-form .form{left:calc(-50% - 20px);width:50%}}@media (min-width:700px) and (max-width:999.99px){::ng-deep .table-con.expert-search>.search-form .form{left:calc(-40% - 20px);width:40%}}@media (min-width:1000px) and (max-width:1599.99px){::ng-deep .table-con.expert-search>.search-form .form{left:calc(-30% - 20px);width:30%}}"]
|
|
4175
4074
|
},] }
|
|
4176
4075
|
];
|
|
@@ -9271,6 +9170,51 @@
|
|
|
9271
9170
|
return StepsItemClass;
|
|
9272
9171
|
}());
|
|
9273
9172
|
|
|
9173
|
+
var EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
9174
|
+
var CSV_TYPE = 'data:text/csv;charset=UTF-8';
|
|
9175
|
+
var EXCEL_EXTENSION = '.xlsx';
|
|
9176
|
+
var CSV_EXTENSION = '.csv';
|
|
9177
|
+
var ExcelClass = /** @class */ (function () {
|
|
9178
|
+
function ExcelClass() {
|
|
9179
|
+
}
|
|
9180
|
+
ExcelClass.prototype.exportAsExcelFile = function (json, excelFileName, opts) {
|
|
9181
|
+
if (opts === void 0) { opts = null; }
|
|
9182
|
+
var worksheet = XLSX.utils.json_to_sheet(json, opts);
|
|
9183
|
+
var workbook = {
|
|
9184
|
+
Sheets: { data: worksheet },
|
|
9185
|
+
SheetNames: ['data']
|
|
9186
|
+
};
|
|
9187
|
+
var excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
9188
|
+
this.saveAsExcelFile(excelBuffer, excelFileName);
|
|
9189
|
+
};
|
|
9190
|
+
ExcelClass.prototype.getExcelData = function (json, excelFileName) {
|
|
9191
|
+
var worksheet = XLSX.utils.json_to_sheet(json);
|
|
9192
|
+
var workbook = {
|
|
9193
|
+
Sheets: { data: worksheet },
|
|
9194
|
+
SheetNames: ['data']
|
|
9195
|
+
};
|
|
9196
|
+
var excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
9197
|
+
return new Blob([excelBuffer], { type: EXCEL_TYPE });
|
|
9198
|
+
};
|
|
9199
|
+
ExcelClass.prototype.saveAsExcelFile = function (buffer, fileName) {
|
|
9200
|
+
var data = new Blob([buffer], { type: EXCEL_TYPE });
|
|
9201
|
+
FileSaver.saveAs(data, fileName + EXCEL_EXTENSION);
|
|
9202
|
+
};
|
|
9203
|
+
ExcelClass.prototype.saveAsCsvFile = function (buffer, fileName) {
|
|
9204
|
+
var data = new Blob([buffer], { type: CSV_TYPE });
|
|
9205
|
+
FileSaver.saveAs(data, fileName + CSV_EXTENSION);
|
|
9206
|
+
};
|
|
9207
|
+
ExcelClass.prototype.exportAsCsvFile = function (json, fileName) {
|
|
9208
|
+
var replacer = function (key, value) { return value === null ? '' : value; }; // specify how you want to handle null values here
|
|
9209
|
+
var header = Object.keys(json[0]);
|
|
9210
|
+
var csv = json.map(function (row) { return header.map(function (fieldName) { return JSON.stringify(row[fieldName], replacer); }).join(','); });
|
|
9211
|
+
csv.unshift(header.join(','));
|
|
9212
|
+
var csvArray = csv.join('\r\n');
|
|
9213
|
+
this.saveAsCsvFile('\uFEFF' + csvArray, fileName);
|
|
9214
|
+
};
|
|
9215
|
+
return ExcelClass;
|
|
9216
|
+
}());
|
|
9217
|
+
|
|
9274
9218
|
var TableClass = /** @class */ (function () {
|
|
9275
9219
|
function TableClass(environment, l, permissions, name, cls, perPage, height) {
|
|
9276
9220
|
if (name === void 0) { name = ''; }
|
|
@@ -9437,7 +9381,7 @@
|
|
|
9437
9381
|
return (relatedId ? url.replace('{}', relatedId) : (url.match(/{}/g) || []).length > 1 ? url.replace('/{}', '') : url).replace('{}', rowId);
|
|
9438
9382
|
};
|
|
9439
9383
|
TableClass.prototype.searchData = function (report) {
|
|
9440
|
-
var e_1,
|
|
9384
|
+
var e_1, _b;
|
|
9441
9385
|
if (report === void 0) { report = false; }
|
|
9442
9386
|
var d = {};
|
|
9443
9387
|
if (!report) {
|
|
@@ -9456,8 +9400,8 @@
|
|
|
9456
9400
|
d.SortType = this.sortType;
|
|
9457
9401
|
}
|
|
9458
9402
|
try {
|
|
9459
|
-
for (var
|
|
9460
|
-
var c =
|
|
9403
|
+
for (var _c = __values(this.cols.filter(function (x) { return x.withSearch && x.search != null && x.search.data() != null && x.search.data() !== ''; })), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
9404
|
+
var c = _d.value;
|
|
9461
9405
|
var vl = c.search.data();
|
|
9462
9406
|
this.addData(d, c.name, vl);
|
|
9463
9407
|
}
|
|
@@ -9465,7 +9409,7 @@
|
|
|
9465
9409
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
9466
9410
|
finally {
|
|
9467
9411
|
try {
|
|
9468
|
-
if (
|
|
9412
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
9469
9413
|
}
|
|
9470
9414
|
finally { if (e_1) throw e_1.error; }
|
|
9471
9415
|
}
|
|
@@ -9475,11 +9419,11 @@
|
|
|
9475
9419
|
return this.searchForm ? this.searchForm.data(d) : d;
|
|
9476
9420
|
};
|
|
9477
9421
|
TableClass.prototype.addData = function (d, name, vl) {
|
|
9478
|
-
var e_2,
|
|
9422
|
+
var e_2, _b;
|
|
9479
9423
|
if (typeof vl === 'object' && !(vl instanceof Array)) {
|
|
9480
9424
|
try {
|
|
9481
|
-
for (var
|
|
9482
|
-
var
|
|
9425
|
+
for (var _c = __values(Object.entries(vl)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
9426
|
+
var _e = __read(_d.value, 2), key = _e[0], value = _e[1];
|
|
9483
9427
|
if (value != null) {
|
|
9484
9428
|
d[key] = value;
|
|
9485
9429
|
}
|
|
@@ -9488,7 +9432,7 @@
|
|
|
9488
9432
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
9489
9433
|
finally {
|
|
9490
9434
|
try {
|
|
9491
|
-
if (
|
|
9435
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
9492
9436
|
}
|
|
9493
9437
|
finally { if (e_2) throw e_2.error; }
|
|
9494
9438
|
}
|
|
@@ -9520,7 +9464,7 @@
|
|
|
9520
9464
|
this.modal.show(data);
|
|
9521
9465
|
};
|
|
9522
9466
|
TableClass.prototype.set = function (changeRows) {
|
|
9523
|
-
var e_3,
|
|
9467
|
+
var e_3, _b, e_4, _c;
|
|
9524
9468
|
var _this = this;
|
|
9525
9469
|
if (changeRows === void 0) { changeRows = null; }
|
|
9526
9470
|
this.permission = true;
|
|
@@ -9625,15 +9569,15 @@
|
|
|
9625
9569
|
};
|
|
9626
9570
|
var this_1 = this;
|
|
9627
9571
|
try {
|
|
9628
|
-
for (var
|
|
9629
|
-
var access =
|
|
9572
|
+
for (var _d = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
9573
|
+
var access = _e.value;
|
|
9630
9574
|
_loop_1(access);
|
|
9631
9575
|
}
|
|
9632
9576
|
}
|
|
9633
9577
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
9634
9578
|
finally {
|
|
9635
9579
|
try {
|
|
9636
|
-
if (
|
|
9580
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
9637
9581
|
}
|
|
9638
9582
|
finally { if (e_3) throw e_3.error; }
|
|
9639
9583
|
}
|
|
@@ -9667,15 +9611,15 @@
|
|
|
9667
9611
|
};
|
|
9668
9612
|
var this_2 = this;
|
|
9669
9613
|
try {
|
|
9670
|
-
for (var
|
|
9671
|
-
var option =
|
|
9614
|
+
for (var _f = __values(this.permissions.getOptions().filter(function (x) { return x.Multi; })), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
9615
|
+
var option = _g.value;
|
|
9672
9616
|
_loop_2(option);
|
|
9673
9617
|
}
|
|
9674
9618
|
}
|
|
9675
9619
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
9676
9620
|
finally {
|
|
9677
9621
|
try {
|
|
9678
|
-
if (
|
|
9622
|
+
if (_g && !_g.done && (_c = _f.return)) _c.call(_f);
|
|
9679
9623
|
}
|
|
9680
9624
|
finally { if (e_4) throw e_4.error; }
|
|
9681
9625
|
}
|
|
@@ -9746,6 +9690,131 @@
|
|
|
9746
9690
|
this.onLoad(null);
|
|
9747
9691
|
}
|
|
9748
9692
|
};
|
|
9693
|
+
TableClass.prototype.getCell = function (row, col) {
|
|
9694
|
+
var e_5, _b;
|
|
9695
|
+
// console.log('getCell');
|
|
9696
|
+
var cv = _.get(row.Data, col.name);
|
|
9697
|
+
if (cv === null) {
|
|
9698
|
+
return col.default ? col.default : '';
|
|
9699
|
+
}
|
|
9700
|
+
else if (col.fun != null) {
|
|
9701
|
+
return col.fun(row.Data);
|
|
9702
|
+
}
|
|
9703
|
+
else if (col.enum !== null) {
|
|
9704
|
+
return this.l(EnumUtils.getKeyByValue(col.enum, cv));
|
|
9705
|
+
}
|
|
9706
|
+
else if (col.type === exports.TableCollType.DateDif) {
|
|
9707
|
+
return HelperClass.getDateDif(this.l, cv);
|
|
9708
|
+
}
|
|
9709
|
+
else if (col.type === exports.TableCollType.Date) {
|
|
9710
|
+
return HelperClass.getDate(cv);
|
|
9711
|
+
}
|
|
9712
|
+
else if (col.type === exports.TableCollType.DateTime) {
|
|
9713
|
+
return '<span class="ltr">' + HelperClass.getDateTime(cv) + '</span>';
|
|
9714
|
+
}
|
|
9715
|
+
else if (col.type === exports.TableCollType.Month) {
|
|
9716
|
+
return HelperClass.getDate(cv, 'jMMMM jYYYY');
|
|
9717
|
+
}
|
|
9718
|
+
else if (col.type === exports.TableCollType.Year) {
|
|
9719
|
+
return HelperClass.getDate(cv, 'jYYYY');
|
|
9720
|
+
}
|
|
9721
|
+
else if (col.type === exports.TableCollType.Time) {
|
|
9722
|
+
return HelperClass.getTime(cv);
|
|
9723
|
+
}
|
|
9724
|
+
else if (col.type === exports.TableCollType.Color) {
|
|
9725
|
+
return '<div class="color" style="background-color: ' + cv + '; color: ' + HelperClass.getColorByBgColor(cv) + '">' + cv + '</div>';
|
|
9726
|
+
}
|
|
9727
|
+
else if (col.type === exports.TableCollType.Url) {
|
|
9728
|
+
return '<a target="_blank" class="ltr" href="' + cv + '">' + cv + '</a>';
|
|
9729
|
+
}
|
|
9730
|
+
else if (col.type === exports.TableCollType.Image) {
|
|
9731
|
+
return '<img style="height: ' + this.height + 'px" alt="" src="' + this.environment.url + cv + '"/>';
|
|
9732
|
+
}
|
|
9733
|
+
else if (col.type === exports.TableCollType.FileSize) {
|
|
9734
|
+
return HelperClass.getFileSize(cv);
|
|
9735
|
+
}
|
|
9736
|
+
else if (col.type === exports.TableCollType.Price) {
|
|
9737
|
+
try {
|
|
9738
|
+
return HelperClass.toPrice(this.l, cv);
|
|
9739
|
+
}
|
|
9740
|
+
catch (_a) { }
|
|
9741
|
+
}
|
|
9742
|
+
else if (col.type === exports.TableCollType.Number) {
|
|
9743
|
+
return cv.toLocaleString();
|
|
9744
|
+
}
|
|
9745
|
+
else if (col.type === exports.TableCollType.Files) {
|
|
9746
|
+
var files = '';
|
|
9747
|
+
try {
|
|
9748
|
+
for (var cv_1 = __values(cv), cv_1_1 = cv_1.next(); !cv_1_1.done; cv_1_1 = cv_1.next()) {
|
|
9749
|
+
var f = cv_1_1.value;
|
|
9750
|
+
var k = f.split('.').at(-1);
|
|
9751
|
+
if (k === 'jpeg' || k === 'jpg' || k === 'png') {
|
|
9752
|
+
files += '<a target="_blank" href="' + this.environment.url + f + '" class="m-h-5"><img alt="" src="' + this.environment.url + f + '" style="height: 30px"/></a>';
|
|
9753
|
+
}
|
|
9754
|
+
else {
|
|
9755
|
+
files += '<a target="_blank" href="' + this.environment.url + f + '" class="f-s-30 m-h-5 ' + exports.FileIcons[k] + '"></a>';
|
|
9756
|
+
}
|
|
9757
|
+
}
|
|
9758
|
+
}
|
|
9759
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
9760
|
+
finally {
|
|
9761
|
+
try {
|
|
9762
|
+
if (cv_1_1 && !cv_1_1.done && (_b = cv_1.return)) _b.call(cv_1);
|
|
9763
|
+
}
|
|
9764
|
+
finally { if (e_5) throw e_5.error; }
|
|
9765
|
+
}
|
|
9766
|
+
return files;
|
|
9767
|
+
}
|
|
9768
|
+
else if (col.type === exports.TableCollType.Plaque) {
|
|
9769
|
+
var parts = cv.split('_');
|
|
9770
|
+
if (parts.length === 4) {
|
|
9771
|
+
return '<div data-copy="' + parts.join(' ') + '" class="plaque' + (parts[1] === 'ع' ? ' p' : '') + (parts[1] === 'ا' ? ' g' : '') + '">' +
|
|
9772
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
9773
|
+
'<div class="part2">' + parts[1] + '</div>' +
|
|
9774
|
+
'<div class="part3">' + parts[2] + '</div>' +
|
|
9775
|
+
'<div class="part4">' + parts[3] + '</div>' +
|
|
9776
|
+
'</div>';
|
|
9777
|
+
}
|
|
9778
|
+
else if (parts.length === 2 && parts.every(function (x) { return /^[0-9]+$/.test(x); })) {
|
|
9779
|
+
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-m">' +
|
|
9780
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
9781
|
+
'<div class="part2">' + parts[1] + '</div>' +
|
|
9782
|
+
'</div>';
|
|
9783
|
+
}
|
|
9784
|
+
else if (parts.length === 2) {
|
|
9785
|
+
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-f">' +
|
|
9786
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
9787
|
+
'<div class="part2">' + parts[1] + '</div>' +
|
|
9788
|
+
'</div>';
|
|
9789
|
+
}
|
|
9790
|
+
else if (parts.length === 1) {
|
|
9791
|
+
return '<div data-copy="' + parts[0] + '" class="plaque plaque-g">' +
|
|
9792
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
9793
|
+
'</div>';
|
|
9794
|
+
}
|
|
9795
|
+
}
|
|
9796
|
+
else if (col.type === exports.TableCollType.PlaqueText) {
|
|
9797
|
+
return "<div class=\"ltr\">" + HelperClass.ToReadablePlaque(cv) + "</div>";
|
|
9798
|
+
}
|
|
9799
|
+
return this.l(cv);
|
|
9800
|
+
};
|
|
9801
|
+
TableClass.prototype.excel = function () {
|
|
9802
|
+
var _this = this;
|
|
9803
|
+
var data = [];
|
|
9804
|
+
this.rows.forEach(function (row) {
|
|
9805
|
+
var x = {};
|
|
9806
|
+
_this.cols.forEach(function (col) {
|
|
9807
|
+
x[col.name] = _this.getText(_this.getCell(row, col));
|
|
9808
|
+
});
|
|
9809
|
+
data.push(x);
|
|
9810
|
+
});
|
|
9811
|
+
new ExcelClass().exportAsExcelFile(data, (this.name ? this.name : 'ExportData') + '.xlsx');
|
|
9812
|
+
};
|
|
9813
|
+
TableClass.prototype.getText = function (s) {
|
|
9814
|
+
var span = document.createElement('span');
|
|
9815
|
+
span.innerHTML = s;
|
|
9816
|
+
return span.textContent || span.innerText;
|
|
9817
|
+
};
|
|
9749
9818
|
return TableClass;
|
|
9750
9819
|
}());
|
|
9751
9820
|
var TableCollClass = /** @class */ (function () {
|
|
@@ -9992,51 +10061,6 @@
|
|
|
9992
10061
|
return HeaderClass;
|
|
9993
10062
|
}());
|
|
9994
10063
|
|
|
9995
|
-
var EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
9996
|
-
var CSV_TYPE = 'data:text/csv;charset=UTF-8';
|
|
9997
|
-
var EXCEL_EXTENSION = '.xlsx';
|
|
9998
|
-
var CSV_EXTENSION = '.csv';
|
|
9999
|
-
var ExcelClass = /** @class */ (function () {
|
|
10000
|
-
function ExcelClass() {
|
|
10001
|
-
}
|
|
10002
|
-
ExcelClass.prototype.exportAsExcelFile = function (json, excelFileName, opts) {
|
|
10003
|
-
if (opts === void 0) { opts = null; }
|
|
10004
|
-
var worksheet = XLSX.utils.json_to_sheet(json, opts);
|
|
10005
|
-
var workbook = {
|
|
10006
|
-
Sheets: { data: worksheet },
|
|
10007
|
-
SheetNames: ['data']
|
|
10008
|
-
};
|
|
10009
|
-
var excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
10010
|
-
this.saveAsExcelFile(excelBuffer, excelFileName);
|
|
10011
|
-
};
|
|
10012
|
-
ExcelClass.prototype.getExcelData = function (json, excelFileName) {
|
|
10013
|
-
var worksheet = XLSX.utils.json_to_sheet(json);
|
|
10014
|
-
var workbook = {
|
|
10015
|
-
Sheets: { data: worksheet },
|
|
10016
|
-
SheetNames: ['data']
|
|
10017
|
-
};
|
|
10018
|
-
var excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
10019
|
-
return new Blob([excelBuffer], { type: EXCEL_TYPE });
|
|
10020
|
-
};
|
|
10021
|
-
ExcelClass.prototype.saveAsExcelFile = function (buffer, fileName) {
|
|
10022
|
-
var data = new Blob([buffer], { type: EXCEL_TYPE });
|
|
10023
|
-
FileSaver.saveAs(data, fileName + EXCEL_EXTENSION);
|
|
10024
|
-
};
|
|
10025
|
-
ExcelClass.prototype.saveAsCsvFile = function (buffer, fileName) {
|
|
10026
|
-
var data = new Blob([buffer], { type: CSV_TYPE });
|
|
10027
|
-
FileSaver.saveAs(data, fileName + CSV_EXTENSION);
|
|
10028
|
-
};
|
|
10029
|
-
ExcelClass.prototype.exportAsCsvFile = function (json, fileName) {
|
|
10030
|
-
var replacer = function (key, value) { return value === null ? '' : value; }; // specify how you want to handle null values here
|
|
10031
|
-
var header = Object.keys(json[0]);
|
|
10032
|
-
var csv = json.map(function (row) { return header.map(function (fieldName) { return JSON.stringify(row[fieldName], replacer); }).join(','); });
|
|
10033
|
-
csv.unshift(header.join(','));
|
|
10034
|
-
var csvArray = csv.join('\r\n');
|
|
10035
|
-
this.saveAsCsvFile('\uFEFF' + csvArray, fileName);
|
|
10036
|
-
};
|
|
10037
|
-
return ExcelClass;
|
|
10038
|
-
}());
|
|
10039
|
-
|
|
10040
10064
|
/*
|
|
10041
10065
|
* Public API Surface of ps-toolkit-ui
|
|
10042
10066
|
*/
|