ps-toolkit-ui 0.0.154 → 0.0.155
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 +61 -58
- 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 +2 -2
- package/esm2015/lib/components/table/row/table.row.component.js +3 -3
- package/esm2015/lib/components/table/table.component.js +6 -2
- package/fesm2015/ps-toolkit-ui.js +57 -54
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/table.class.d.ts +1 -1
- package/lib/components/table/table.component.d.ts +2 -0
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -2076,7 +2076,7 @@ class TableRowComponent {
|
|
|
2076
2076
|
opt.urlNewTab = option.InputAction === PermissionInputActionEnum.LinkNewTab;
|
|
2077
2077
|
}
|
|
2078
2078
|
else if (option.InputAction === PermissionInputActionEnum.Modal) {
|
|
2079
|
-
opt.modal = this.table.
|
|
2079
|
+
opt.modal = this.table.optionsActions.find(x => x.name === option.Action);
|
|
2080
2080
|
opt.onClick = () => {
|
|
2081
2081
|
if (opt.modal.table) {
|
|
2082
2082
|
const p = new PermissionClass();
|
|
@@ -2124,7 +2124,7 @@ class TableRowComponent {
|
|
|
2124
2124
|
const p = new PermissionClass();
|
|
2125
2125
|
p.RelatedId = 'Index';
|
|
2126
2126
|
p.Area = this.table.permissions.Area;
|
|
2127
|
-
p.Controller =
|
|
2127
|
+
p.Controller = option.Controller;
|
|
2128
2128
|
p.Action = option.Action;
|
|
2129
2129
|
opt.url = '/Report' + p.getUrl() + '/' + this.row.Data.Id;
|
|
2130
2130
|
opt.urlNewTab = true;
|
|
@@ -2281,6 +2281,56 @@ TableRowComponent.propDecorators = {
|
|
|
2281
2281
|
childrenDiv: [{ type: ViewChild, args: ['childrenDiv',] }]
|
|
2282
2282
|
};
|
|
2283
2283
|
|
|
2284
|
+
class ModalClass {
|
|
2285
|
+
constructor(environment, l, name, cls = '') {
|
|
2286
|
+
this.environment = null;
|
|
2287
|
+
this.form = null;
|
|
2288
|
+
this.firstForm = true;
|
|
2289
|
+
this.table = null;
|
|
2290
|
+
this.accordion = null;
|
|
2291
|
+
this.onShow = null;
|
|
2292
|
+
this.onHide = null;
|
|
2293
|
+
this.environment = environment;
|
|
2294
|
+
this.l = l;
|
|
2295
|
+
this.name = name;
|
|
2296
|
+
this.id = this.name;
|
|
2297
|
+
this.class = cls;
|
|
2298
|
+
}
|
|
2299
|
+
show() {
|
|
2300
|
+
if (this.onShow) {
|
|
2301
|
+
this.onShow();
|
|
2302
|
+
}
|
|
2303
|
+
$('body').addClass('open-modal');
|
|
2304
|
+
$('#' + this.id + 'Modal').fadeIn(300, () => {
|
|
2305
|
+
if (this.form != null) {
|
|
2306
|
+
const i = this.form.inputs.find(x => !x.disabled && x.type !== InputType.Label && x.type !== InputType.Hidden &&
|
|
2307
|
+
x.type !== InputType.Constant && x.type !== InputType.Submit && x.type !== InputType.Button && x.type !== InputType.Icon &&
|
|
2308
|
+
x.type !== InputType.Check);
|
|
2309
|
+
if (i) {
|
|
2310
|
+
i.focus();
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
hide() {
|
|
2316
|
+
$('body').removeClass('open-modal');
|
|
2317
|
+
$('#' + this.id + 'Modal').fadeOut(300, () => {
|
|
2318
|
+
if (this.form && this.form.name !== 'Confirm' && this.form.name !== 'Alert') {
|
|
2319
|
+
this.form.clear();
|
|
2320
|
+
if (this.form.onHideModal) {
|
|
2321
|
+
this.form.onHideModal();
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
if (this.table && this.table.form) {
|
|
2325
|
+
this.table.form.clear();
|
|
2326
|
+
}
|
|
2327
|
+
if (this.onHide) {
|
|
2328
|
+
this.onHide();
|
|
2329
|
+
}
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2284
2334
|
class TableComponent {
|
|
2285
2335
|
constructor(router) {
|
|
2286
2336
|
this.router = router;
|
|
@@ -2433,11 +2483,14 @@ class TableComponent {
|
|
|
2433
2483
|
this.table.sort = s;
|
|
2434
2484
|
this.table.load();
|
|
2435
2485
|
}
|
|
2486
|
+
getModals() {
|
|
2487
|
+
return this.table.optionsActions.filter(x => x instanceof ModalClass);
|
|
2488
|
+
}
|
|
2436
2489
|
}
|
|
2437
2490
|
TableComponent.decorators = [
|
|
2438
2491
|
{ type: Component, args: [{
|
|
2439
2492
|
selector: 'lib-table',
|
|
2440
|
-
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\" *ngFor=\"let opt of
|
|
2493
|
+
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\" *ngFor=\"let opt of getModals()\"></lib-modal>\r\n <lib-confirm #confirm [tableId]=\"table.name\"></lib-confirm>\r\n</div>\r\n",
|
|
2441
2494
|
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}"]
|
|
2442
2495
|
},] }
|
|
2443
2496
|
];
|
|
@@ -5056,56 +5109,6 @@ FormTreeComponent.propDecorators = {
|
|
|
5056
5109
|
inputBase: [{ type: ViewChild, args: ['inputBase',] }]
|
|
5057
5110
|
};
|
|
5058
5111
|
|
|
5059
|
-
class ModalClass {
|
|
5060
|
-
constructor(environment, l, name, cls = '') {
|
|
5061
|
-
this.environment = null;
|
|
5062
|
-
this.form = null;
|
|
5063
|
-
this.firstForm = true;
|
|
5064
|
-
this.table = null;
|
|
5065
|
-
this.accordion = null;
|
|
5066
|
-
this.onShow = null;
|
|
5067
|
-
this.onHide = null;
|
|
5068
|
-
this.environment = environment;
|
|
5069
|
-
this.l = l;
|
|
5070
|
-
this.name = name;
|
|
5071
|
-
this.id = this.name;
|
|
5072
|
-
this.class = cls;
|
|
5073
|
-
}
|
|
5074
|
-
show() {
|
|
5075
|
-
if (this.onShow) {
|
|
5076
|
-
this.onShow();
|
|
5077
|
-
}
|
|
5078
|
-
$('body').addClass('open-modal');
|
|
5079
|
-
$('#' + this.id + 'Modal').fadeIn(300, () => {
|
|
5080
|
-
if (this.form != null) {
|
|
5081
|
-
const i = this.form.inputs.find(x => !x.disabled && x.type !== InputType.Label && x.type !== InputType.Hidden &&
|
|
5082
|
-
x.type !== InputType.Constant && x.type !== InputType.Submit && x.type !== InputType.Button && x.type !== InputType.Icon &&
|
|
5083
|
-
x.type !== InputType.Check);
|
|
5084
|
-
if (i) {
|
|
5085
|
-
i.focus();
|
|
5086
|
-
}
|
|
5087
|
-
}
|
|
5088
|
-
});
|
|
5089
|
-
}
|
|
5090
|
-
hide() {
|
|
5091
|
-
$('body').removeClass('open-modal');
|
|
5092
|
-
$('#' + this.id + 'Modal').fadeOut(300, () => {
|
|
5093
|
-
if (this.form && this.form.name !== 'Confirm' && this.form.name !== 'Alert') {
|
|
5094
|
-
this.form.clear();
|
|
5095
|
-
if (this.form.onHideModal) {
|
|
5096
|
-
this.form.onHideModal();
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
if (this.table && this.table.form) {
|
|
5100
|
-
this.table.form.clear();
|
|
5101
|
-
}
|
|
5102
|
-
if (this.onHide) {
|
|
5103
|
-
this.onHide();
|
|
5104
|
-
}
|
|
5105
|
-
});
|
|
5106
|
-
}
|
|
5107
|
-
}
|
|
5108
|
-
|
|
5109
5112
|
class AlertComponent {
|
|
5110
5113
|
constructor(config) {
|
|
5111
5114
|
this.config = config;
|
|
@@ -6171,7 +6174,7 @@ class TableClass {
|
|
|
6171
6174
|
this.perPage = 10;
|
|
6172
6175
|
this.cols = [];
|
|
6173
6176
|
this.buttons = [];
|
|
6174
|
-
this.
|
|
6177
|
+
this.optionsActions = [];
|
|
6175
6178
|
this.rows = [];
|
|
6176
6179
|
this.count = 0;
|
|
6177
6180
|
this.page = 1;
|