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
|
@@ -466,13 +466,14 @@ var PermissionTypeEnum;
|
|
|
466
466
|
PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
|
|
467
467
|
PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
|
|
468
468
|
PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
|
|
469
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
470
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
471
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
472
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
473
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
474
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
475
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
469
|
+
PermissionTypeEnum[PermissionTypeEnum["Button"] = 2] = "Button";
|
|
470
|
+
PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
|
|
471
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
|
|
472
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
|
|
473
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
|
|
474
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
|
|
475
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
|
|
476
|
+
PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
|
|
476
477
|
})(PermissionTypeEnum || (PermissionTypeEnum = {}));
|
|
477
478
|
var PermissionOptionTypeEnum;
|
|
478
479
|
(function (PermissionOptionTypeEnum) {
|
|
@@ -2125,6 +2126,7 @@ class TableComponent {
|
|
|
2125
2126
|
this.router = router;
|
|
2126
2127
|
this.changeRows = new EventEmitter();
|
|
2127
2128
|
this.select = null;
|
|
2129
|
+
this.export = null;
|
|
2128
2130
|
this.itemsWidth = 0;
|
|
2129
2131
|
}
|
|
2130
2132
|
get type() { return InputType; }
|
|
@@ -2153,7 +2155,6 @@ class TableComponent {
|
|
|
2153
2155
|
this.itemsWidth = this.table.cols.reduce((a, { percent }) => a + percent, 0);
|
|
2154
2156
|
this.reload = new InputClass(this.table.environment, this.table.l, 'Reload', 'fad fa-sync-alt', InputType.Icon, 'm-h-5');
|
|
2155
2157
|
this.maximum = new InputClass(this.table.environment, this.table.l, 'Maximum', 'fad fa-expand-arrows-alt', InputType.Icon, 'm-h-5');
|
|
2156
|
-
this.export = new InputClass(this.table.environment, this.table.l, 'Export', 'fad fa-arrow-to-bottom', InputType.Icon, 'm-h-5');
|
|
2157
2158
|
this.optDelete = new InputClass(this.table.environment, this.table.l, 'Delete', 'fad fa-trash', InputType.Icon, 'red h-25 m-h-5 d-ib va-m f-u');
|
|
2158
2159
|
for (const c of this.table.cols.filter(x => x.withSearch)) {
|
|
2159
2160
|
c.search = new InputClass(this.table.environment, this.table.l, c.name, null, c.type === TableCollType.Date ? InputType.Date : InputType.Text, 'h-25 table-search');
|
|
@@ -2193,11 +2194,6 @@ class TableComponent {
|
|
|
2193
2194
|
this.maximum.icon = this.maximum.name === 'Minimum' ? 'fad fa-expand-arrows-alt' : 'fad fa-compress-arrows-alt';
|
|
2194
2195
|
this.maximum.name = this.maximum.name === 'Minimum' ? 'Maximum' : 'Minimum';
|
|
2195
2196
|
};
|
|
2196
|
-
this.export.onClick = () => {
|
|
2197
|
-
if (!this.export.loading) {
|
|
2198
|
-
$(this.exportDropDown.nativeElement).fadeToggle();
|
|
2199
|
-
}
|
|
2200
|
-
};
|
|
2201
2197
|
this.optDelete.onClick = (i) => {
|
|
2202
2198
|
if (this.table.form) {
|
|
2203
2199
|
this.table.form.clear();
|
|
@@ -2228,7 +2224,7 @@ class TableComponent {
|
|
|
2228
2224
|
}
|
|
2229
2225
|
}
|
|
2230
2226
|
getOptions() {
|
|
2231
|
-
return this.table.
|
|
2227
|
+
return this.table.options.filter(x => x.condition == null).map((o) => {
|
|
2232
2228
|
const i = HelperClass.clone(o);
|
|
2233
2229
|
i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
|
|
2234
2230
|
return i;
|
|
@@ -2275,36 +2271,12 @@ class TableComponent {
|
|
|
2275
2271
|
this.table.sort = s;
|
|
2276
2272
|
this.table.load();
|
|
2277
2273
|
}
|
|
2278
|
-
report(type) {
|
|
2279
|
-
$(this.exportDropDown.nativeElement).fadeOut();
|
|
2280
|
-
if (type === 'Print' || type === 'PDF') {
|
|
2281
|
-
window.open(this.table.getUrl(true), '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
|
|
2282
|
-
}
|
|
2283
|
-
else {
|
|
2284
|
-
new RequestClass(this.table.l).send(this.table.getUrl(true), Method.Post, null, this.export, (result) => {
|
|
2285
|
-
const report = [];
|
|
2286
|
-
for (const r of result.List) {
|
|
2287
|
-
const row = {};
|
|
2288
|
-
for (const k of Object.keys(r)) {
|
|
2289
|
-
row[this.table.l(k)] = r[k];
|
|
2290
|
-
}
|
|
2291
|
-
report.push(row);
|
|
2292
|
-
}
|
|
2293
|
-
if (type === 'Excel') {
|
|
2294
|
-
// new ExcelService().exportAsExcelFile(report, 'Report');
|
|
2295
|
-
}
|
|
2296
|
-
else if (type === 'CSV') {
|
|
2297
|
-
// new ExcelService().exportAsCsvFile(report, 'Report');
|
|
2298
|
-
}
|
|
2299
|
-
});
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
2274
|
}
|
|
2303
2275
|
TableComponent.decorators = [
|
|
2304
2276
|
{ type: Component, args: [{
|
|
2305
2277
|
selector: 'lib-table',
|
|
2306
|
-
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.
|
|
2307
|
-
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 .
|
|
2278
|
+
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",
|
|
2279
|
+
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}"]
|
|
2308
2280
|
},] }
|
|
2309
2281
|
];
|
|
2310
2282
|
TableComponent.ctorParameters = () => [
|
|
@@ -4350,7 +4322,7 @@ class FormTableComponent {
|
|
|
4350
4322
|
this.inp.table.displayLabel = false;
|
|
4351
4323
|
this.inp.table.style = { padding: 0, boxShadow: 'unset' };
|
|
4352
4324
|
this.inp.table.permissions = p;
|
|
4353
|
-
this.inp.table.
|
|
4325
|
+
this.inp.table.showExtraButtons = false;
|
|
4354
4326
|
this.inp.table.cols.forEach(x => x.sort = false);
|
|
4355
4327
|
if (this.inp.table.form) {
|
|
4356
4328
|
this.inp.table.form.onTop = true;
|
|
@@ -6087,7 +6059,6 @@ class TableClass {
|
|
|
6087
6059
|
this.title = null;
|
|
6088
6060
|
this.sortType = null;
|
|
6089
6061
|
this.displayLabel = true;
|
|
6090
|
-
this.isReport = false;
|
|
6091
6062
|
this.sortable = false;
|
|
6092
6063
|
this.optionType = TableOptionType.Hidden;
|
|
6093
6064
|
this.loading = true;
|
|
@@ -6095,7 +6066,8 @@ class TableClass {
|
|
|
6095
6066
|
this.hasChildren = false;
|
|
6096
6067
|
this.childrenAutoLoad = false;
|
|
6097
6068
|
this.withSelect = false;
|
|
6098
|
-
this.
|
|
6069
|
+
this.showExtraButtons = true;
|
|
6070
|
+
this.extraButtons = [];
|
|
6099
6071
|
this.form = null;
|
|
6100
6072
|
this.searchForm = null;
|
|
6101
6073
|
this.modal = null;
|
|
@@ -6142,8 +6114,8 @@ class TableClass {
|
|
|
6142
6114
|
}
|
|
6143
6115
|
return this.searchForm ? this.searchForm.json(d) : d;
|
|
6144
6116
|
}
|
|
6145
|
-
getUrl(
|
|
6146
|
-
return this.url +
|
|
6117
|
+
getUrl() {
|
|
6118
|
+
return this.url + 'List';
|
|
6147
6119
|
}
|
|
6148
6120
|
showInsertModal() {
|
|
6149
6121
|
const insertAccess = this.permissions.getAccess('Insert');
|
|
@@ -6204,6 +6176,13 @@ class TableClass {
|
|
|
6204
6176
|
}
|
|
6205
6177
|
}
|
|
6206
6178
|
}
|
|
6179
|
+
const reportAccess = this.permissions.getAccess('Report');
|
|
6180
|
+
if (reportAccess != null) {
|
|
6181
|
+
const report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, InputType.Button, 'm-h-5');
|
|
6182
|
+
report.url = this.url + 'Report';
|
|
6183
|
+
report.url.urlNewTab = true;
|
|
6184
|
+
this.extraButtons.push(report);
|
|
6185
|
+
}
|
|
6207
6186
|
if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
|
|
6208
6187
|
this.form.addButtons('Save', 'green', true, this.permissions.Type === PermissionTypeEnum.Form ? (data) => {
|
|
6209
6188
|
if (data.Id) {
|
|
@@ -6294,10 +6273,10 @@ class TableClass {
|
|
|
6294
6273
|
}
|
|
6295
6274
|
else if (option.Type === PermissionTypeEnum.OptionReport) {
|
|
6296
6275
|
const p = new PermissionClass();
|
|
6297
|
-
p.RelatedId =
|
|
6276
|
+
p.RelatedId = 'Index';
|
|
6298
6277
|
p.Area = this.permissions.Area;
|
|
6299
6278
|
p.Controller = 'Print';
|
|
6300
|
-
p.Action =
|
|
6279
|
+
p.Action = option.Action;
|
|
6301
6280
|
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
6302
6281
|
opt.urlNewTab = true;
|
|
6303
6282
|
}
|
|
@@ -6322,7 +6301,7 @@ class TableClass {
|
|
|
6322
6301
|
});
|
|
6323
6302
|
};
|
|
6324
6303
|
}
|
|
6325
|
-
else if (option.Type === PermissionTypeEnum.
|
|
6304
|
+
else if (option.Type === PermissionTypeEnum.Option) {
|
|
6326
6305
|
if (option.OnClick) {
|
|
6327
6306
|
opt.onClick = (btn) => {
|
|
6328
6307
|
option.OnClick(btn);
|