ps-toolkit-ui 0.0.99 → 0.0.103
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 +27 -71
- 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/enum.class.js +9 -8
- package/esm2015/lib/classes/table.class.js +15 -8
- package/esm2015/lib/components/form/table/form.table.component.js +2 -2
- package/esm2015/lib/components/table/table.component.js +5 -34
- package/fesm2015/ps-toolkit-ui.js +27 -48
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/enum.class.d.ts +8 -7
- package/lib/classes/table.class.d.ts +3 -3
- package/lib/components/table/table.component.d.ts +0 -1
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
- package/src/assets/scripts/base.js +0 -8
|
@@ -804,13 +804,14 @@
|
|
|
804
804
|
PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
|
|
805
805
|
PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
|
|
806
806
|
PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
|
|
807
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
808
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
809
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
810
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
811
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
812
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
813
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
807
|
+
PermissionTypeEnum[PermissionTypeEnum["Button"] = 2] = "Button";
|
|
808
|
+
PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
|
|
809
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
|
|
810
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
|
|
811
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
|
|
812
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
|
|
813
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
|
|
814
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
|
|
814
815
|
})(exports.PermissionTypeEnum || (exports.PermissionTypeEnum = {}));
|
|
815
816
|
(function (PermissionOptionTypeEnum) {
|
|
816
817
|
PermissionOptionTypeEnum[PermissionOptionTypeEnum["Icon"] = 0] = "Icon";
|
|
@@ -2693,6 +2694,7 @@
|
|
|
2693
2694
|
this.router = router;
|
|
2694
2695
|
this.changeRows = new core.EventEmitter();
|
|
2695
2696
|
this.select = null;
|
|
2697
|
+
this.export = null;
|
|
2696
2698
|
this.itemsWidth = 0;
|
|
2697
2699
|
}
|
|
2698
2700
|
Object.defineProperty(TableComponent.prototype, "type", {
|
|
@@ -2738,7 +2740,6 @@
|
|
|
2738
2740
|
}, 0);
|
|
2739
2741
|
this.reload = new InputClass(this.table.environment, this.table.l, 'Reload', 'fad fa-sync-alt', exports.InputType.Icon, 'm-h-5');
|
|
2740
2742
|
this.maximum = new InputClass(this.table.environment, this.table.l, 'Maximum', 'fad fa-expand-arrows-alt', exports.InputType.Icon, 'm-h-5');
|
|
2741
|
-
this.export = new InputClass(this.table.environment, this.table.l, 'Export', 'fad fa-arrow-to-bottom', exports.InputType.Icon, 'm-h-5');
|
|
2742
2743
|
this.optDelete = new InputClass(this.table.environment, this.table.l, 'Delete', 'fad fa-trash', exports.InputType.Icon, 'red h-25 m-h-5 d-ib va-m f-u');
|
|
2743
2744
|
try {
|
|
2744
2745
|
for (var _b = __values(this.table.cols.filter(function (x) { return x.withSearch; })), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -2788,11 +2789,6 @@
|
|
|
2788
2789
|
_this.maximum.icon = _this.maximum.name === 'Minimum' ? 'fad fa-expand-arrows-alt' : 'fad fa-compress-arrows-alt';
|
|
2789
2790
|
_this.maximum.name = _this.maximum.name === 'Minimum' ? 'Maximum' : 'Minimum';
|
|
2790
2791
|
};
|
|
2791
|
-
this.export.onClick = function () {
|
|
2792
|
-
if (!_this.export.loading) {
|
|
2793
|
-
$__namespace(_this.exportDropDown.nativeElement).fadeToggle();
|
|
2794
|
-
}
|
|
2795
|
-
};
|
|
2796
2792
|
this.optDelete.onClick = function (i) {
|
|
2797
2793
|
if (_this.table.form) {
|
|
2798
2794
|
_this.table.form.clear();
|
|
@@ -2823,7 +2819,7 @@
|
|
|
2823
2819
|
}
|
|
2824
2820
|
};
|
|
2825
2821
|
TableComponent.prototype.getOptions = function () {
|
|
2826
|
-
return this.table.
|
|
2822
|
+
return this.table.options.filter(function (x) { return x.condition == null; }).map(function (o) {
|
|
2827
2823
|
var i = HelperClass.clone(o);
|
|
2828
2824
|
i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
|
|
2829
2825
|
return i;
|
|
@@ -2871,59 +2867,13 @@
|
|
|
2871
2867
|
this.table.sort = s;
|
|
2872
2868
|
this.table.load();
|
|
2873
2869
|
};
|
|
2874
|
-
TableComponent.prototype.report = function (type) {
|
|
2875
|
-
var _this = this;
|
|
2876
|
-
$__namespace(this.exportDropDown.nativeElement).fadeOut();
|
|
2877
|
-
if (type === 'Print' || type === 'PDF') {
|
|
2878
|
-
window.open(this.table.getUrl(true), '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
|
|
2879
|
-
}
|
|
2880
|
-
else {
|
|
2881
|
-
new RequestClass(this.table.l).send(this.table.getUrl(true), exports.Method.Post, null, this.export, function (result) {
|
|
2882
|
-
var e_2, _a, e_3, _b;
|
|
2883
|
-
var report = [];
|
|
2884
|
-
try {
|
|
2885
|
-
for (var _c = __values(result.List), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
2886
|
-
var r = _d.value;
|
|
2887
|
-
var row = {};
|
|
2888
|
-
try {
|
|
2889
|
-
for (var _e = (e_3 = void 0, __values(Object.keys(r))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
2890
|
-
var k = _f.value;
|
|
2891
|
-
row[_this.table.l(k)] = r[k];
|
|
2892
|
-
}
|
|
2893
|
-
}
|
|
2894
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2895
|
-
finally {
|
|
2896
|
-
try {
|
|
2897
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
2898
|
-
}
|
|
2899
|
-
finally { if (e_3) throw e_3.error; }
|
|
2900
|
-
}
|
|
2901
|
-
report.push(row);
|
|
2902
|
-
}
|
|
2903
|
-
}
|
|
2904
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2905
|
-
finally {
|
|
2906
|
-
try {
|
|
2907
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
2908
|
-
}
|
|
2909
|
-
finally { if (e_2) throw e_2.error; }
|
|
2910
|
-
}
|
|
2911
|
-
if (type === 'Excel') {
|
|
2912
|
-
// new ExcelService().exportAsExcelFile(report, 'Report');
|
|
2913
|
-
}
|
|
2914
|
-
else if (type === 'CSV') {
|
|
2915
|
-
// new ExcelService().exportAsCsvFile(report, 'Report');
|
|
2916
|
-
}
|
|
2917
|
-
});
|
|
2918
|
-
}
|
|
2919
|
-
};
|
|
2920
2870
|
return TableComponent;
|
|
2921
2871
|
}());
|
|
2922
2872
|
TableComponent.decorators = [
|
|
2923
2873
|
{ type: core.Component, args: [{
|
|
2924
2874
|
selector: 'lib-table',
|
|
2925
|
-
template: "<div [id]=\"table.id + 'Table'\" [style]=\"table.style\" #tableDiv [className]=\"(table.class ? table.class : '') + (table.sortable ? 'sortable' : '') + (table.hasChildren ? ' has-children' : '') + ' table-con'\">\r\n <div *ngIf=\"table.displayLabel\" class=\"title\">\r\n {{this.table.title ? this.table.title : 'List'}}\r\n <div class=\"extra-buttons\" *ngIf=\"table.
|
|
2926
|
-
styles: [".table-con{background-color:#fff;border-radius:5px;box-shadow:var(--box-shadow-table);float:right;padding:20px;position:relative;width:100%}.table-con.maximum{border-radius:0;height:100%;overflow-y:auto;position:fixed;right:0;top:0;width:100%;z-index:11}.table-con>.title{float:right;font-family:VazirBold;font-size:16px;height:40px;line-height:40px;margin-bottom:10px;position:relative;text-align:right;width:100%}.table-con>.title .extra-buttons{float:left;margin-top:5px}.table-con>.title .
|
|
2875
|
+
template: "<div [id]=\"table.id + 'Table'\" [style]=\"table.style\" #tableDiv [className]=\"(table.class ? table.class : '') + (table.sortable ? 'sortable' : '') + (table.hasChildren ? ' has-children' : '') + ' table-con'\">\r\n <div *ngIf=\"table.displayLabel\" class=\"title\">\r\n {{this.table.title ? this.table.title : 'List'}}\r\n <div class=\"extra-buttons\" *ngIf=\"table.showExtraButtons\">\r\n <lib-form-icon *ngFor=\"let btn of table.extraButtons\" [inp]=\"btn\"></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 </div>\r\n <div *ngIf=\"table.buttons.length > 0\" class=\"buttons\">\r\n <lib-form-button [inp]=\"btn\" *ngFor=\"let btn of table.buttons\"></lib-form-button>\r\n </div>\r\n </div>\r\n <div class=\"search-form\" *ngIf=\"table.searchForm\">\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 <table>\r\n <thead>\r\n <tr>\r\n <th *ngIf=\"table.hasChildren\" style=\"width: 50px\"></th>\r\n <th *ngIf=\"table.sortable\" style=\"width: 50px\"></th>\r\n <th *ngIf=\"table.withSelect\" style=\"width: 50px\">\r\n <i (click)=\"selectAll()\" [className]=\"(allSelected() ? 'fas fa-check-square green' : isSelected() ? 'fas fa-minus-square green' : 'far fa-square') + ' select-row'\" *ngIf=\"table.rows.length > 0\"></i>\r\n </th>\r\n <th (click)=\"!table.sortable && col.sort && changeSort($event, col.name)\" [className]=\"(!table.sortable && col.sort ? 'sort' : '')\" *ngFor=\"let col of table.cols\" [style]=\"{width: col.percent + '%'}\">\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 <span *ngIf=\"col.search == null\">{{ table.l(col.name) }}</span>\r\n <div class=\"w-90 header-search p-h-20 m-r-5\" *ngIf=\"!table.sortable && col.search != null\">\r\n <lib-form-textbox *ngIf=\"col.type != colType.Date\" [inp]=\"col.search\"></lib-form-textbox>\r\n <lib-form-date *ngIf=\"col.type == colType.Date\" [inp]=\"col.search\"></lib-form-date>\r\n </div>\r\n </th>\r\n <th *ngIf=\"table.optionType == tableOptionType.Show\" [style]=\"{width: (100 - itemsWidth) + '%'}\">{{table.l('Options')}}</th>\r\n<!-- <th *ngIf=\"table.hasOption()\" [style]=\"{width: (100 - itemsWidth) + '%'}\">-->\r\n<!-- <span *ngIf=\"!table.withSelect || !isSelected()\">{{ table.l('Options') }}</span>-->\r\n<!-- <span *ngIf=\"table.withSelect && isSelected()\" class=\"option-con\">-->\r\n<!-- <span *ngFor=\"let opt of options\">-->\r\n<!-- <lib-form-button *ngIf=\"opt.type == type.Button\" [inp]=\"opt\"></lib-form-button>-->\r\n<!-- <lib-form-icon *ngIf=\"opt.type == type.Icon\" [inp]=\"opt\"></lib-form-icon>-->\r\n<!-- </span>-->\r\n<!-- </span>-->\r\n<!-- </th>-->\r\n </tr>\r\n </thead>\r\n <tbody #rows [style]=\"table.perPage > 0 ? {height: table.height * table.perPage + 'px'} : table.loading || !table.permission || table.rows.length == 0 ? {height: '100px'} : {}\">\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 <tr *ngIf=\"table.perPage > 0\" [style]=\"{height: (table.perPage > 0 ? (table.perPage - table.rows.length) * table.height : '100') + 'px', visibility: 'hidden'}\"></tr>\r\n <lib-table-loading [table]=\"table\"></lib-table-loading>\r\n </tbody>\r\n <tfoot>\r\n <tr>\r\n <td colspan=\"100%\">\r\n <lib-table-pagination [table]=\"table\" *ngIf=\"table.perPage > 0\"></lib-table-pagination>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n <lib-modal *ngIf=\"table.modal != null\" [modal]=\"table.modal\"></lib-modal>\r\n <lib-modal [modal]=\"opt.modal\" *ngFor=\"let opt of getOptionModals()\"></lib-modal>\r\n <lib-confirm #confirm [tableId]=\"table.name\"></lib-confirm>\r\n</div>\r\n",
|
|
2876
|
+
styles: [".table-con{background-color:#fff;border-radius:5px;box-shadow:var(--box-shadow-table);float:right;padding:20px;position:relative;width:100%}.table-con.maximum{border-radius:0;height:100%;overflow-y:auto;position:fixed;right:0;top:0;width:100%;z-index:11}.table-con>.title{float:right;font-family:VazirBold;font-size:16px;height:40px;line-height:40px;margin-bottom:10px;position:relative;text-align:right;width:100%}.table-con>.title .extra-buttons{float:left;margin-top:5px}.table-con>.title .buttons{float:left;margin-left:10px;margin-top:5px}.table-con>.search-form{border-radius:5px;float:right;margin-bottom:5px;width:100%}.table-con table{border-spacing:0!important;width:100%}.table-con table thead tr{-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;position:relative}.table-con table thead tr th{background-color:var(--base-11);color:var(--black-88);font-family:VazirLight;font-size:12px;font-weight:400;height:45px;position:relative;vertical-align:middle}.table-con table thead tr th:first-child{border-bottom-right-radius:5px;border-top-right-radius:5px}.table-con table thead tr th:last-child{border-bottom-left-radius:5px;border-top-left-radius:5px}.table-con table thead tr th.sort{cursor:pointer}.table-con table thead tr th .sort-icon{font-size:13px;height:20px;left:5px;line-height:20px;opacity:.6;position:absolute;top:calc(50% - 10px);width:20px}.table-con table tbody{position:relative}.table-con table tfoot tr{height:45px}.table-con table tfoot tr td{position:relative;vertical-align:bottom}::ng-deep .table-con:not(.sortable) table lib-table-row:last-of-type>tr:after{background-image:unset}::ng-deep .table-con table thead tr th .select-row{cursor:pointer;font-size:18px;height:30px;line-height:30px}"]
|
|
2927
2877
|
},] }
|
|
2928
2878
|
];
|
|
2929
2879
|
TableComponent.ctorParameters = function () { return [
|
|
@@ -5173,7 +5123,7 @@
|
|
|
5173
5123
|
this.inp.table.displayLabel = false;
|
|
5174
5124
|
this.inp.table.style = { padding: 0, boxShadow: 'unset' };
|
|
5175
5125
|
this.inp.table.permissions = p;
|
|
5176
|
-
this.inp.table.
|
|
5126
|
+
this.inp.table.showExtraButtons = false;
|
|
5177
5127
|
this.inp.table.cols.forEach(function (x) { return x.sort = false; });
|
|
5178
5128
|
if (this.inp.table.form) {
|
|
5179
5129
|
this.inp.table.form.onTop = true;
|
|
@@ -7042,7 +6992,6 @@
|
|
|
7042
6992
|
this.title = null;
|
|
7043
6993
|
this.sortType = null;
|
|
7044
6994
|
this.displayLabel = true;
|
|
7045
|
-
this.isReport = false;
|
|
7046
6995
|
this.sortable = false;
|
|
7047
6996
|
this.optionType = exports.TableOptionType.Hidden;
|
|
7048
6997
|
this.loading = true;
|
|
@@ -7050,7 +6999,8 @@
|
|
|
7050
6999
|
this.hasChildren = false;
|
|
7051
7000
|
this.childrenAutoLoad = false;
|
|
7052
7001
|
this.withSelect = false;
|
|
7053
|
-
this.
|
|
7002
|
+
this.showExtraButtons = true;
|
|
7003
|
+
this.extraButtons = [];
|
|
7054
7004
|
this.form = null;
|
|
7055
7005
|
this.searchForm = null;
|
|
7056
7006
|
this.modal = null;
|
|
@@ -7109,9 +7059,8 @@
|
|
|
7109
7059
|
}
|
|
7110
7060
|
return this.searchForm ? this.searchForm.json(d) : d;
|
|
7111
7061
|
};
|
|
7112
|
-
TableClass.prototype.getUrl = function (
|
|
7113
|
-
|
|
7114
|
-
return this.url + (this.isReport || isReport ? 'Report?' : 'List');
|
|
7062
|
+
TableClass.prototype.getUrl = function () {
|
|
7063
|
+
return this.url + 'List';
|
|
7115
7064
|
};
|
|
7116
7065
|
TableClass.prototype.showInsertModal = function () {
|
|
7117
7066
|
var insertAccess = this.permissions.getAccess('Insert');
|
|
@@ -7175,6 +7124,13 @@
|
|
|
7175
7124
|
}
|
|
7176
7125
|
}
|
|
7177
7126
|
}
|
|
7127
|
+
var reportAccess = this.permissions.getAccess('Report');
|
|
7128
|
+
if (reportAccess != null) {
|
|
7129
|
+
var report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, exports.InputType.Button, 'm-h-5');
|
|
7130
|
+
report.url = this.url + 'Report';
|
|
7131
|
+
report.url.urlNewTab = true;
|
|
7132
|
+
this.extraButtons.push(report);
|
|
7133
|
+
}
|
|
7178
7134
|
if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
|
|
7179
7135
|
this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {
|
|
7180
7136
|
if (data.Id) {
|
|
@@ -7276,10 +7232,10 @@
|
|
|
7276
7232
|
}
|
|
7277
7233
|
else if (option.Type === exports.PermissionTypeEnum.OptionReport) {
|
|
7278
7234
|
var p = new PermissionClass();
|
|
7279
|
-
p.RelatedId =
|
|
7235
|
+
p.RelatedId = 'Index';
|
|
7280
7236
|
p.Area = this_1.permissions.Area;
|
|
7281
7237
|
p.Controller = 'Print';
|
|
7282
|
-
p.Action =
|
|
7238
|
+
p.Action = option.Action;
|
|
7283
7239
|
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
7284
7240
|
opt.urlNewTab = true;
|
|
7285
7241
|
}
|
|
@@ -7304,7 +7260,7 @@
|
|
|
7304
7260
|
});
|
|
7305
7261
|
};
|
|
7306
7262
|
}
|
|
7307
|
-
else if (option.Type === exports.PermissionTypeEnum.
|
|
7263
|
+
else if (option.Type === exports.PermissionTypeEnum.Option) {
|
|
7308
7264
|
if (option.OnClick) {
|
|
7309
7265
|
opt.onClick = function (btn) {
|
|
7310
7266
|
option.OnClick(btn);
|