ps-toolkit-ui 1.19.82 → 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 +196 -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/login.class.js +2 -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 +164 -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
|
@@ -11,12 +11,12 @@ import { FormsModule } from '@angular/forms';
|
|
|
11
11
|
import { CommonModule } from '@angular/common';
|
|
12
12
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
13
13
|
import { CKEditorModule } from 'ckeditor4-angular';
|
|
14
|
+
import { saveAs } from 'file-saver';
|
|
15
|
+
import { utils, write } from 'xlsx';
|
|
14
16
|
import * as Highcharts from 'highcharts';
|
|
15
17
|
import { chart } from 'highcharts';
|
|
16
18
|
import * as HighchartsExporting from 'highcharts/modules/exporting';
|
|
17
19
|
import * as HighchartsExportData from 'highcharts/modules/export-data';
|
|
18
|
-
import { saveAs } from 'file-saver';
|
|
19
|
-
import { utils, write } from 'xlsx';
|
|
20
20
|
|
|
21
21
|
class PsToolkitUiConfigService {
|
|
22
22
|
constructor(environment, strings, currentLang) {
|
|
@@ -2853,101 +2853,7 @@ class TableRowComponent {
|
|
|
2853
2853
|
}, []);
|
|
2854
2854
|
}
|
|
2855
2855
|
getCell(col) {
|
|
2856
|
-
|
|
2857
|
-
const cv = get(this.row.Data, col.name);
|
|
2858
|
-
if (cv === null) {
|
|
2859
|
-
return col.default ? col.default : '';
|
|
2860
|
-
}
|
|
2861
|
-
else if (col.fun != null) {
|
|
2862
|
-
return col.fun(this.row.Data);
|
|
2863
|
-
}
|
|
2864
|
-
else if (col.enum !== null) {
|
|
2865
|
-
return this.table.l(EnumUtils.getKeyByValue(col.enum, cv));
|
|
2866
|
-
}
|
|
2867
|
-
else if (col.type === TableCollType.DateDif) {
|
|
2868
|
-
return HelperClass.getDateDif(this.table.l, cv);
|
|
2869
|
-
}
|
|
2870
|
-
else if (col.type === TableCollType.Date) {
|
|
2871
|
-
return HelperClass.getDate(cv);
|
|
2872
|
-
}
|
|
2873
|
-
else if (col.type === TableCollType.DateTime) {
|
|
2874
|
-
return '<span class="ltr">' + HelperClass.getDateTime(cv) + '</span>';
|
|
2875
|
-
}
|
|
2876
|
-
else if (col.type === TableCollType.Month) {
|
|
2877
|
-
return HelperClass.getDate(cv, 'jMMMM jYYYY');
|
|
2878
|
-
}
|
|
2879
|
-
else if (col.type === TableCollType.Year) {
|
|
2880
|
-
return HelperClass.getDate(cv, 'jYYYY');
|
|
2881
|
-
}
|
|
2882
|
-
else if (col.type === TableCollType.Time) {
|
|
2883
|
-
return HelperClass.getTime(cv);
|
|
2884
|
-
}
|
|
2885
|
-
else if (col.type === TableCollType.Color) {
|
|
2886
|
-
return '<div class="color" style="background-color: ' + cv + '; color: ' + HelperClass.getColorByBgColor(cv) + '">' + cv + '</div>';
|
|
2887
|
-
}
|
|
2888
|
-
else if (col.type === TableCollType.Url) {
|
|
2889
|
-
return '<a target="_blank" class="ltr" href="' + cv + '">' + cv + '</a>';
|
|
2890
|
-
}
|
|
2891
|
-
else if (col.type === TableCollType.Image) {
|
|
2892
|
-
return '<img style="height: ' + this.table.height + 'px" alt="" src="' + this.service.environment.url + cv + '"/>';
|
|
2893
|
-
}
|
|
2894
|
-
else if (col.type === TableCollType.FileSize) {
|
|
2895
|
-
return HelperClass.getFileSize(cv);
|
|
2896
|
-
}
|
|
2897
|
-
else if (col.type === TableCollType.Price) {
|
|
2898
|
-
try {
|
|
2899
|
-
return HelperClass.toPrice(this.table.l, cv);
|
|
2900
|
-
}
|
|
2901
|
-
catch (_a) { }
|
|
2902
|
-
}
|
|
2903
|
-
else if (col.type === TableCollType.Number) {
|
|
2904
|
-
return cv.toLocaleString();
|
|
2905
|
-
}
|
|
2906
|
-
else if (col.type === TableCollType.Files) {
|
|
2907
|
-
let files = '';
|
|
2908
|
-
for (const f of cv) {
|
|
2909
|
-
const k = f.split('.').at(-1);
|
|
2910
|
-
if (k === 'jpeg' || k === 'jpg' || k === 'png') {
|
|
2911
|
-
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>';
|
|
2912
|
-
}
|
|
2913
|
-
else {
|
|
2914
|
-
files += '<a target="_blank" href="' + this.table.environment.url + f + '" class="f-s-30 m-h-5 ' + FileIcons[k] + '"></a>';
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
return files;
|
|
2918
|
-
}
|
|
2919
|
-
else if (col.type === TableCollType.Plaque) {
|
|
2920
|
-
const parts = cv.split('_');
|
|
2921
|
-
if (parts.length === 4) {
|
|
2922
|
-
return '<div data-copy="' + parts.join(' ') + '" class="plaque' + (parts[1] === 'ع' ? ' p' : '') + (parts[1] === 'ا' ? ' g' : '') + '">' +
|
|
2923
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
2924
|
-
'<div class="part2">' + parts[1] + '</div>' +
|
|
2925
|
-
'<div class="part3">' + parts[2] + '</div>' +
|
|
2926
|
-
'<div class="part4">' + parts[3] + '</div>' +
|
|
2927
|
-
'</div>';
|
|
2928
|
-
}
|
|
2929
|
-
else if (parts.length === 2 && parts.every(x => /^[0-9]+$/.test(x))) {
|
|
2930
|
-
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-m">' +
|
|
2931
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
2932
|
-
'<div class="part2">' + parts[1] + '</div>' +
|
|
2933
|
-
'</div>';
|
|
2934
|
-
}
|
|
2935
|
-
else if (parts.length === 2) {
|
|
2936
|
-
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-f">' +
|
|
2937
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
2938
|
-
'<div class="part2">' + parts[1] + '</div>' +
|
|
2939
|
-
'</div>';
|
|
2940
|
-
}
|
|
2941
|
-
else if (parts.length === 1) {
|
|
2942
|
-
return '<div data-copy="' + parts[0] + '" class="plaque plaque-g">' +
|
|
2943
|
-
'<div class="part1">' + parts[0] + '</div>' +
|
|
2944
|
-
'</div>';
|
|
2945
|
-
}
|
|
2946
|
-
}
|
|
2947
|
-
else if (col.type === TableCollType.PlaqueText) {
|
|
2948
|
-
return `<div class="ltr">${HelperClass.ToReadablePlaque(cv)}</div>`;
|
|
2949
|
-
}
|
|
2950
|
-
return this.table.l(cv);
|
|
2856
|
+
this.table.getCell(this.row.Data, col);
|
|
2951
2857
|
}
|
|
2952
2858
|
getCol(n) {
|
|
2953
2859
|
let c = this.row.Data;
|
|
@@ -3116,6 +3022,7 @@ class TableComponent {
|
|
|
3116
3022
|
get colType() { return TableCollType; }
|
|
3117
3023
|
ngOnInit() {
|
|
3118
3024
|
this.reload = new InputClass(this.table.environment, this.table.l, 'Reload', 'fad fa-sync-alt', InputType.Icon, 'm-r-10-p');
|
|
3025
|
+
this.excel = new InputClass(this.table.environment, this.table.l, 'Excel', 'fad fa-arrow-down-to-line f-s-21', InputType.Icon, 'm-r-10-p');
|
|
3119
3026
|
this.maximum = new InputClass(this.table.environment, this.table.l, 'Maximum', 'fad fa-arrows-maximize', InputType.Icon, 'm-r-10-p');
|
|
3120
3027
|
this.expertSearch = new InputClass(this.table.environment, this.table.l, 'ExpertSearch', 'fad fa-magnifying-glass', InputType.Icon, 'm-r-10-p');
|
|
3121
3028
|
for (const c of this.table.cols.filter(x => x.withSearch)) {
|
|
@@ -3196,6 +3103,9 @@ class TableComponent {
|
|
|
3196
3103
|
this.reload.onClick = () => {
|
|
3197
3104
|
this.table.load(this.reload);
|
|
3198
3105
|
};
|
|
3106
|
+
this.excel.onClick = () => {
|
|
3107
|
+
this.table.excel();
|
|
3108
|
+
};
|
|
3199
3109
|
this.maximum.onClick = () => {
|
|
3200
3110
|
$$1(this.tableDiv.nativeElement).toggleClass('maximum');
|
|
3201
3111
|
this.maximum.icon = this.maximum.name === 'Minimum' ? 'fad fa-arrows-maximize' : 'fad fa-arrows-minimize';
|
|
@@ -3292,7 +3202,7 @@ class TableComponent {
|
|
|
3292
3202
|
TableComponent.decorators = [
|
|
3293
3203
|
{ type: Component, args: [{
|
|
3294
3204
|
selector: 'lib-table',
|
|
3295
|
-
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",
|
|
3205
|
+
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",
|
|
3296
3206
|
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%}}"]
|
|
3297
3207
|
},] }
|
|
3298
3208
|
];
|
|
@@ -6956,6 +6866,7 @@ class LoginClass {
|
|
|
6956
6866
|
setCookie(r) {
|
|
6957
6867
|
if (r.Token) {
|
|
6958
6868
|
HelperClass.setCookie('Authorization', `Bearer ${r.Token}`);
|
|
6869
|
+
HelperClass.setCookie('AuthorizationCu', `Bearer ${r.Token}`);
|
|
6959
6870
|
}
|
|
6960
6871
|
}
|
|
6961
6872
|
showModal() {
|
|
@@ -8078,6 +7989,48 @@ class StepsItemClass {
|
|
|
8078
7989
|
}
|
|
8079
7990
|
}
|
|
8080
7991
|
|
|
7992
|
+
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
7993
|
+
const CSV_TYPE = 'data:text/csv;charset=UTF-8';
|
|
7994
|
+
const EXCEL_EXTENSION = '.xlsx';
|
|
7995
|
+
const CSV_EXTENSION = '.csv';
|
|
7996
|
+
class ExcelClass {
|
|
7997
|
+
constructor() { }
|
|
7998
|
+
exportAsExcelFile(json, excelFileName, opts = null) {
|
|
7999
|
+
const worksheet = utils.json_to_sheet(json, opts);
|
|
8000
|
+
const workbook = {
|
|
8001
|
+
Sheets: { data: worksheet },
|
|
8002
|
+
SheetNames: ['data']
|
|
8003
|
+
};
|
|
8004
|
+
const excelBuffer = write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
8005
|
+
this.saveAsExcelFile(excelBuffer, excelFileName);
|
|
8006
|
+
}
|
|
8007
|
+
getExcelData(json, excelFileName) {
|
|
8008
|
+
const worksheet = utils.json_to_sheet(json);
|
|
8009
|
+
const workbook = {
|
|
8010
|
+
Sheets: { data: worksheet },
|
|
8011
|
+
SheetNames: ['data']
|
|
8012
|
+
};
|
|
8013
|
+
const excelBuffer = write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
8014
|
+
return new Blob([excelBuffer], { type: EXCEL_TYPE });
|
|
8015
|
+
}
|
|
8016
|
+
saveAsExcelFile(buffer, fileName) {
|
|
8017
|
+
const data = new Blob([buffer], { type: EXCEL_TYPE });
|
|
8018
|
+
saveAs(data, fileName + EXCEL_EXTENSION);
|
|
8019
|
+
}
|
|
8020
|
+
saveAsCsvFile(buffer, fileName) {
|
|
8021
|
+
const data = new Blob([buffer], { type: CSV_TYPE });
|
|
8022
|
+
saveAs(data, fileName + CSV_EXTENSION);
|
|
8023
|
+
}
|
|
8024
|
+
exportAsCsvFile(json, fileName) {
|
|
8025
|
+
const replacer = (key, value) => value === null ? '' : value; // specify how you want to handle null values here
|
|
8026
|
+
const header = Object.keys(json[0]);
|
|
8027
|
+
const csv = json.map(row => header.map(fieldName => JSON.stringify(row[fieldName], replacer)).join(','));
|
|
8028
|
+
csv.unshift(header.join(','));
|
|
8029
|
+
const csvArray = csv.join('\r\n');
|
|
8030
|
+
this.saveAsCsvFile('\uFEFF' + csvArray, fileName);
|
|
8031
|
+
}
|
|
8032
|
+
}
|
|
8033
|
+
|
|
8081
8034
|
class TableClass {
|
|
8082
8035
|
constructor(environment, l, permissions, name = '', cls = '', perPage = 10, height = 50) {
|
|
8083
8036
|
this.environment = null;
|
|
@@ -8488,6 +8441,119 @@ class TableClass {
|
|
|
8488
8441
|
this.onLoad(null);
|
|
8489
8442
|
}
|
|
8490
8443
|
}
|
|
8444
|
+
getCell(row, col) {
|
|
8445
|
+
// console.log('getCell');
|
|
8446
|
+
const cv = get(row.Data, col.name);
|
|
8447
|
+
if (cv === null) {
|
|
8448
|
+
return col.default ? col.default : '';
|
|
8449
|
+
}
|
|
8450
|
+
else if (col.fun != null) {
|
|
8451
|
+
return col.fun(row.Data);
|
|
8452
|
+
}
|
|
8453
|
+
else if (col.enum !== null) {
|
|
8454
|
+
return this.l(EnumUtils.getKeyByValue(col.enum, cv));
|
|
8455
|
+
}
|
|
8456
|
+
else if (col.type === TableCollType.DateDif) {
|
|
8457
|
+
return HelperClass.getDateDif(this.l, cv);
|
|
8458
|
+
}
|
|
8459
|
+
else if (col.type === TableCollType.Date) {
|
|
8460
|
+
return HelperClass.getDate(cv);
|
|
8461
|
+
}
|
|
8462
|
+
else if (col.type === TableCollType.DateTime) {
|
|
8463
|
+
return '<span class="ltr">' + HelperClass.getDateTime(cv) + '</span>';
|
|
8464
|
+
}
|
|
8465
|
+
else if (col.type === TableCollType.Month) {
|
|
8466
|
+
return HelperClass.getDate(cv, 'jMMMM jYYYY');
|
|
8467
|
+
}
|
|
8468
|
+
else if (col.type === TableCollType.Year) {
|
|
8469
|
+
return HelperClass.getDate(cv, 'jYYYY');
|
|
8470
|
+
}
|
|
8471
|
+
else if (col.type === TableCollType.Time) {
|
|
8472
|
+
return HelperClass.getTime(cv);
|
|
8473
|
+
}
|
|
8474
|
+
else if (col.type === TableCollType.Color) {
|
|
8475
|
+
return '<div class="color" style="background-color: ' + cv + '; color: ' + HelperClass.getColorByBgColor(cv) + '">' + cv + '</div>';
|
|
8476
|
+
}
|
|
8477
|
+
else if (col.type === TableCollType.Url) {
|
|
8478
|
+
return '<a target="_blank" class="ltr" href="' + cv + '">' + cv + '</a>';
|
|
8479
|
+
}
|
|
8480
|
+
else if (col.type === TableCollType.Image) {
|
|
8481
|
+
return '<img style="height: ' + this.height + 'px" alt="" src="' + this.environment.url + cv + '"/>';
|
|
8482
|
+
}
|
|
8483
|
+
else if (col.type === TableCollType.FileSize) {
|
|
8484
|
+
return HelperClass.getFileSize(cv);
|
|
8485
|
+
}
|
|
8486
|
+
else if (col.type === TableCollType.Price) {
|
|
8487
|
+
try {
|
|
8488
|
+
return HelperClass.toPrice(this.l, cv);
|
|
8489
|
+
}
|
|
8490
|
+
catch (_a) { }
|
|
8491
|
+
}
|
|
8492
|
+
else if (col.type === TableCollType.Number) {
|
|
8493
|
+
return cv.toLocaleString();
|
|
8494
|
+
}
|
|
8495
|
+
else if (col.type === TableCollType.Files) {
|
|
8496
|
+
let files = '';
|
|
8497
|
+
for (const f of cv) {
|
|
8498
|
+
const k = f.split('.').at(-1);
|
|
8499
|
+
if (k === 'jpeg' || k === 'jpg' || k === 'png') {
|
|
8500
|
+
files += '<a target="_blank" href="' + this.environment.url + f + '" class="m-h-5"><img alt="" src="' + this.environment.url + f + '" style="height: 30px"/></a>';
|
|
8501
|
+
}
|
|
8502
|
+
else {
|
|
8503
|
+
files += '<a target="_blank" href="' + this.environment.url + f + '" class="f-s-30 m-h-5 ' + FileIcons[k] + '"></a>';
|
|
8504
|
+
}
|
|
8505
|
+
}
|
|
8506
|
+
return files;
|
|
8507
|
+
}
|
|
8508
|
+
else if (col.type === TableCollType.Plaque) {
|
|
8509
|
+
const parts = cv.split('_');
|
|
8510
|
+
if (parts.length === 4) {
|
|
8511
|
+
return '<div data-copy="' + parts.join(' ') + '" class="plaque' + (parts[1] === 'ع' ? ' p' : '') + (parts[1] === 'ا' ? ' g' : '') + '">' +
|
|
8512
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
8513
|
+
'<div class="part2">' + parts[1] + '</div>' +
|
|
8514
|
+
'<div class="part3">' + parts[2] + '</div>' +
|
|
8515
|
+
'<div class="part4">' + parts[3] + '</div>' +
|
|
8516
|
+
'</div>';
|
|
8517
|
+
}
|
|
8518
|
+
else if (parts.length === 2 && parts.every(x => /^[0-9]+$/.test(x))) {
|
|
8519
|
+
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-m">' +
|
|
8520
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
8521
|
+
'<div class="part2">' + parts[1] + '</div>' +
|
|
8522
|
+
'</div>';
|
|
8523
|
+
}
|
|
8524
|
+
else if (parts.length === 2) {
|
|
8525
|
+
return '<div data-copy="' + parts.join(' ') + '" class="plaque plaque-f">' +
|
|
8526
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
8527
|
+
'<div class="part2">' + parts[1] + '</div>' +
|
|
8528
|
+
'</div>';
|
|
8529
|
+
}
|
|
8530
|
+
else if (parts.length === 1) {
|
|
8531
|
+
return '<div data-copy="' + parts[0] + '" class="plaque plaque-g">' +
|
|
8532
|
+
'<div class="part1">' + parts[0] + '</div>' +
|
|
8533
|
+
'</div>';
|
|
8534
|
+
}
|
|
8535
|
+
}
|
|
8536
|
+
else if (col.type === TableCollType.PlaqueText) {
|
|
8537
|
+
return `<div class="ltr">${HelperClass.ToReadablePlaque(cv)}</div>`;
|
|
8538
|
+
}
|
|
8539
|
+
return this.l(cv);
|
|
8540
|
+
}
|
|
8541
|
+
excel() {
|
|
8542
|
+
const data = [];
|
|
8543
|
+
this.rows.forEach(row => {
|
|
8544
|
+
const x = {};
|
|
8545
|
+
this.cols.forEach(col => {
|
|
8546
|
+
x[col.name] = this.getText(this.getCell(row, col));
|
|
8547
|
+
});
|
|
8548
|
+
data.push(x);
|
|
8549
|
+
});
|
|
8550
|
+
new ExcelClass().exportAsExcelFile(data, (this.name ? this.name : 'ExportData') + '.xlsx');
|
|
8551
|
+
}
|
|
8552
|
+
getText(s) {
|
|
8553
|
+
const span = document.createElement('span');
|
|
8554
|
+
span.innerHTML = s;
|
|
8555
|
+
return span.textContent || span.innerText;
|
|
8556
|
+
}
|
|
8491
8557
|
}
|
|
8492
8558
|
class TableCollClass {
|
|
8493
8559
|
constructor(name, cls = '', type = TableCollType.Text, withSearch = true, sort = true) {
|
|
@@ -8698,48 +8764,6 @@ class HeaderClass {
|
|
|
8698
8764
|
}
|
|
8699
8765
|
}
|
|
8700
8766
|
|
|
8701
|
-
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
8702
|
-
const CSV_TYPE = 'data:text/csv;charset=UTF-8';
|
|
8703
|
-
const EXCEL_EXTENSION = '.xlsx';
|
|
8704
|
-
const CSV_EXTENSION = '.csv';
|
|
8705
|
-
class ExcelClass {
|
|
8706
|
-
constructor() { }
|
|
8707
|
-
exportAsExcelFile(json, excelFileName, opts = null) {
|
|
8708
|
-
const worksheet = utils.json_to_sheet(json, opts);
|
|
8709
|
-
const workbook = {
|
|
8710
|
-
Sheets: { data: worksheet },
|
|
8711
|
-
SheetNames: ['data']
|
|
8712
|
-
};
|
|
8713
|
-
const excelBuffer = write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
8714
|
-
this.saveAsExcelFile(excelBuffer, excelFileName);
|
|
8715
|
-
}
|
|
8716
|
-
getExcelData(json, excelFileName) {
|
|
8717
|
-
const worksheet = utils.json_to_sheet(json);
|
|
8718
|
-
const workbook = {
|
|
8719
|
-
Sheets: { data: worksheet },
|
|
8720
|
-
SheetNames: ['data']
|
|
8721
|
-
};
|
|
8722
|
-
const excelBuffer = write(workbook, { bookType: 'xlsx', type: 'array' });
|
|
8723
|
-
return new Blob([excelBuffer], { type: EXCEL_TYPE });
|
|
8724
|
-
}
|
|
8725
|
-
saveAsExcelFile(buffer, fileName) {
|
|
8726
|
-
const data = new Blob([buffer], { type: EXCEL_TYPE });
|
|
8727
|
-
saveAs(data, fileName + EXCEL_EXTENSION);
|
|
8728
|
-
}
|
|
8729
|
-
saveAsCsvFile(buffer, fileName) {
|
|
8730
|
-
const data = new Blob([buffer], { type: CSV_TYPE });
|
|
8731
|
-
saveAs(data, fileName + CSV_EXTENSION);
|
|
8732
|
-
}
|
|
8733
|
-
exportAsCsvFile(json, fileName) {
|
|
8734
|
-
const replacer = (key, value) => value === null ? '' : value; // specify how you want to handle null values here
|
|
8735
|
-
const header = Object.keys(json[0]);
|
|
8736
|
-
const csv = json.map(row => header.map(fieldName => JSON.stringify(row[fieldName], replacer)).join(','));
|
|
8737
|
-
csv.unshift(header.join(','));
|
|
8738
|
-
const csvArray = csv.join('\r\n');
|
|
8739
|
-
this.saveAsCsvFile('\uFEFF' + csvArray, fileName);
|
|
8740
|
-
}
|
|
8741
|
-
}
|
|
8742
|
-
|
|
8743
8767
|
/*
|
|
8744
8768
|
* Public API Surface of ps-toolkit-ui
|
|
8745
8769
|
*/
|