ps-toolkit-ui 0.0.27 → 0.0.28
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 +79 -70
- 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/permission.class.js +6 -3
- package/esm2015/lib/classes/string.class.js +2 -1
- package/esm2015/lib/classes/table.class.js +16 -15
- package/esm2015/lib/components/base.component.js +2 -9
- package/esm2015/lib/components/table/row/table.row.component.js +57 -45
- package/esm2015/lib/components/table/table.component.js +2 -2
- package/fesm2015/ps-toolkit-ui.js +79 -69
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/permission.class.d.ts +2 -2
- package/lib/classes/string.class.d.ts +1 -0
- package/lib/classes/table.class.d.ts +1 -0
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -132,6 +132,7 @@ const strings = {
|
|
|
132
132
|
RePassword: 'تکرار کلمه عبور',
|
|
133
133
|
PassportLetter: 'حرف',
|
|
134
134
|
Passport: 'گذرنامه',
|
|
135
|
+
List: 'لیست',
|
|
135
136
|
Priority: 'اولویت',
|
|
136
137
|
PassportImage: 'تصویر گذرنامه',
|
|
137
138
|
PassportExpireDate: 'تاریخ انقضاء گذرنامه',
|
|
@@ -1810,6 +1811,8 @@ class TableRowComponent {
|
|
|
1810
1811
|
this.confirmShow = new EventEmitter();
|
|
1811
1812
|
this.changeRows = new EventEmitter();
|
|
1812
1813
|
this.loadParent = new EventEmitter();
|
|
1814
|
+
this.optEdit = null;
|
|
1815
|
+
this.optDelete = null;
|
|
1813
1816
|
this.showChildren = null;
|
|
1814
1817
|
this.addChildren = null;
|
|
1815
1818
|
this.itemsWidth = 0;
|
|
@@ -1818,8 +1821,14 @@ class TableRowComponent {
|
|
|
1818
1821
|
get type() { return InputType; }
|
|
1819
1822
|
ngOnInit() {
|
|
1820
1823
|
this.itemsWidth = this.table.cols.reduce((a, { percent }) => a + percent, 0);
|
|
1821
|
-
|
|
1822
|
-
|
|
1824
|
+
const updateAccess = this.table.permissions.getAccess('Update');
|
|
1825
|
+
const deleteAccess = this.table.permissions.getAccess('Delete');
|
|
1826
|
+
if (updateAccess != null) {
|
|
1827
|
+
this.optEdit = new InputClass(this.table.environment, this.table.l, updateAccess.Name, 'fad fa-pen', InputType.Icon, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
1828
|
+
}
|
|
1829
|
+
if (deleteAccess != null) {
|
|
1830
|
+
this.optDelete = new InputClass(this.table.environment, this.table.l, deleteAccess.Name, 'fad fa-trash', InputType.Icon, 'red h-25 m-h-5 d-ib va-m f-u');
|
|
1831
|
+
}
|
|
1823
1832
|
if (this.table.hasChildren) {
|
|
1824
1833
|
if (!this.table.childrenAutoLoad) {
|
|
1825
1834
|
this.children = this.getChildren();
|
|
@@ -1862,54 +1871,58 @@ class TableRowComponent {
|
|
|
1862
1871
|
};
|
|
1863
1872
|
}
|
|
1864
1873
|
this.options = this.getOptions();
|
|
1865
|
-
if (this.
|
|
1866
|
-
this.
|
|
1867
|
-
this.
|
|
1868
|
-
|
|
1869
|
-
this.table.
|
|
1870
|
-
this.table.
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1874
|
+
if (this.optEdit !== null) {
|
|
1875
|
+
if (this.table.form) {
|
|
1876
|
+
this.optEdit.onClick = () => {
|
|
1877
|
+
this.table.form.url = this.table.url + 'Update/' + this.row.Id;
|
|
1878
|
+
if (this.table.hasChildren && this.row.ParentId != null) {
|
|
1879
|
+
this.table.form.onSuccessBase = () => {
|
|
1880
|
+
this.table.modal.hide();
|
|
1881
|
+
if (this.table.childrenAutoLoad) {
|
|
1882
|
+
this.loadParent.emit(this.row.ParentId);
|
|
1883
|
+
}
|
|
1884
|
+
else {
|
|
1885
|
+
this.table.load();
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
else {
|
|
1890
|
+
this.table.form.onSuccessBase = () => {
|
|
1891
|
+
if (!this.table.form.onTop) {
|
|
1892
|
+
this.table.modal.hide();
|
|
1893
|
+
}
|
|
1894
|
+
this.table.form.clear();
|
|
1875
1895
|
this.table.load();
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
this.edit();
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
else {
|
|
1902
|
+
this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
if (this.optDelete != null) {
|
|
1906
|
+
this.optDelete.onClick = () => {
|
|
1907
|
+
if (this.table.form) {
|
|
1908
|
+
this.table.form.clear();
|
|
1909
|
+
}
|
|
1910
|
+
if (this.table.permissions.Type === PermissionTypeEnum.Form) {
|
|
1911
|
+
this.table.rows = this.table.rows.filter(x => x.Id !== this.row.Id);
|
|
1912
|
+
this.changeRows.emit(this.row);
|
|
1878
1913
|
}
|
|
1879
1914
|
else {
|
|
1880
|
-
this.
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1915
|
+
this.confirmShow.emit({ id: this.row.Id, accept: () => {
|
|
1916
|
+
if (this.table.hasChildren && this.table.childrenAutoLoad && this.row.ParentId != null) {
|
|
1917
|
+
this.loadParent.emit(this.row.ParentId);
|
|
1918
|
+
}
|
|
1919
|
+
else {
|
|
1920
|
+
this.table.load();
|
|
1921
|
+
}
|
|
1922
|
+
} });
|
|
1887
1923
|
}
|
|
1888
|
-
this.edit();
|
|
1889
1924
|
};
|
|
1890
1925
|
}
|
|
1891
|
-
else {
|
|
1892
|
-
this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
|
|
1893
|
-
}
|
|
1894
|
-
this.optDelete.onClick = () => {
|
|
1895
|
-
if (this.table.form) {
|
|
1896
|
-
this.table.form.clear();
|
|
1897
|
-
}
|
|
1898
|
-
if (this.table.permissions.Type === PermissionTypeEnum.Form) {
|
|
1899
|
-
this.table.rows = this.table.rows.filter(x => x.Id !== this.row.Id);
|
|
1900
|
-
this.changeRows.emit(this.row);
|
|
1901
|
-
}
|
|
1902
|
-
else {
|
|
1903
|
-
this.confirmShow.emit({ id: this.row.Id, accept: () => {
|
|
1904
|
-
if (this.table.hasChildren && this.table.childrenAutoLoad && this.row.ParentId != null) {
|
|
1905
|
-
this.loadParent.emit(this.row.ParentId);
|
|
1906
|
-
}
|
|
1907
|
-
else {
|
|
1908
|
-
this.table.load();
|
|
1909
|
-
}
|
|
1910
|
-
} });
|
|
1911
|
-
}
|
|
1912
|
-
};
|
|
1913
1926
|
if (this.table.sortable) {
|
|
1914
1927
|
this.setSortRow();
|
|
1915
1928
|
}
|
|
@@ -2257,7 +2270,7 @@ class TableComponent {
|
|
|
2257
2270
|
TableComponent.decorators = [
|
|
2258
2271
|
{ type: Component, args: [{
|
|
2259
2272
|
selector: 'lib-table',
|
|
2260
|
-
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.
|
|
2273
|
+
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.extraButtons\">\r\n <div *ngIf=\"table.permissions && table.permissions.hasAccess('Report')\" class=\"export\">\r\n <lib-form-icon [inp]=\"export\"></lib-form-icon>\r\n <div class=\"export-dropdown\" #exportDropDown>\r\n <div (click)=\"report('Print')\" class=\"item\"><div class=\"text\">Print</div><i class=\"fad fa-print\"></i></div>\r\n <div (click)=\"report('Excel')\" class=\"item\"><div class=\"text\">Excel</div><i class=\"fad fa-file-excel\"></i></div>\r\n <div (click)=\"report('CSV')\" class=\"item\"><div class=\"text\">CSV</div><i class=\"fad fa-file-csv\"></i></div>\r\n <div (click)=\"report('PDF')\" class=\"item\"><div class=\"text\">PDF</div><i class=\"fad fa-file-pdf\"></i></div>\r\n </div>\r\n </div>\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.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",
|
|
2261
2274
|
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 .extra-buttons .export{float:right;position:relative}.table-con>.title .extra-buttons .export .export-dropdown{background-color:#fff;border-radius:5px;box-shadow:var(--box-shadow-table);display:none;overflow:hidden;padding:15px 0;position:absolute;right:-50px;top:35px;width:130px;z-index:2}.table-con>.title .extra-buttons .export .export-dropdown .item{cursor:pointer;float:right;padding:0 15px;text-align:center;width:100%}.table-con>.title .extra-buttons .export .export-dropdown .item:hover{background-color:var(--black-22)}.table-con>.title .extra-buttons .export .export-dropdown .text{float:right;font-family:VazirLight;font-size:13px;height:40px;line-height:41px;width:70%}.table-con>.title .extra-buttons .export .export-dropdown i{color:var(--black-88);float:right;font-size:14px;height:40px;line-height:40px;width:30%}.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}"]
|
|
2262
2275
|
},] }
|
|
2263
2276
|
];
|
|
@@ -4239,18 +4252,21 @@ FormSelectComponent.propDecorators = {
|
|
|
4239
4252
|
};
|
|
4240
4253
|
|
|
4241
4254
|
class PermissionClass {
|
|
4242
|
-
constructor(Name = '', Icon = '', Type = null, Area = '', Controller = '', Action = '',
|
|
4255
|
+
constructor(Name = '', Icon = '', Type = null, Area = '', Controller = '', Action = '', Accesses = []) {
|
|
4243
4256
|
this.Name = Name;
|
|
4244
4257
|
this.Icon = Icon;
|
|
4245
4258
|
this.Type = Type;
|
|
4246
4259
|
this.Area = Area;
|
|
4247
4260
|
this.Controller = Controller;
|
|
4248
4261
|
this.Action = Action;
|
|
4249
|
-
this.Children = Children;
|
|
4250
4262
|
this.Accesses = Accesses;
|
|
4251
4263
|
this.RelatedId = null;
|
|
4252
4264
|
this.Condition = null;
|
|
4253
4265
|
}
|
|
4266
|
+
getAccess(a) {
|
|
4267
|
+
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access);
|
|
4268
|
+
return c.length > 0 ? c[0] : null;
|
|
4269
|
+
}
|
|
4254
4270
|
hasAccess(a) {
|
|
4255
4271
|
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access).length > 0;
|
|
4256
4272
|
}
|
|
@@ -5959,16 +5975,9 @@ class BaseComponent {
|
|
|
5959
5975
|
return p.length > 0 ? this.getPermissionClass(p[0]) : null;
|
|
5960
5976
|
}
|
|
5961
5977
|
getPermissionClass(p) {
|
|
5962
|
-
|
|
5963
|
-
console.log(p);
|
|
5964
|
-
console.log('$$$$$$$$$$');
|
|
5965
|
-
return new PermissionClass(p.Name, p.Icon, p.Type, p.Area, p.Controller, p.Action, [], this.getPermissionAccessesClass(p.Id));
|
|
5978
|
+
return new PermissionClass(p.Name, p.Icon, p.Type, p.Area, p.Controller, p.Action, this.getPermissionAccessesClass(p.Id));
|
|
5966
5979
|
}
|
|
5967
5980
|
getPermissionAccessesClass(parentId) {
|
|
5968
|
-
console.log('--------------');
|
|
5969
|
-
console.log(parentId);
|
|
5970
|
-
console.log(this.app.currentUser.Permissions.filter(x => x.ParentId === parentId));
|
|
5971
|
-
console.log('--------------');
|
|
5972
5981
|
return this.app.currentUser.Permissions.filter(x => x.ParentId === parentId).map(x => this.getPermissionClass(x));
|
|
5973
5982
|
}
|
|
5974
5983
|
hasAccess(a) {
|
|
@@ -6024,6 +6033,7 @@ class TableClass {
|
|
|
6024
6033
|
this.page = 1;
|
|
6025
6034
|
this.sort = null;
|
|
6026
6035
|
this.queryParams = {};
|
|
6036
|
+
this.title = null;
|
|
6027
6037
|
this.sortType = null;
|
|
6028
6038
|
this.displayLabel = true;
|
|
6029
6039
|
this.isReport = false;
|
|
@@ -6092,7 +6102,9 @@ class TableClass {
|
|
|
6092
6102
|
}
|
|
6093
6103
|
set(changeRows = null) {
|
|
6094
6104
|
this.permission = true;
|
|
6095
|
-
|
|
6105
|
+
const listAccess = this.permissions.getAccess('List');
|
|
6106
|
+
if (this.permissions && listAccess !== null) {
|
|
6107
|
+
this.title = listAccess.Name;
|
|
6096
6108
|
this.url = this.permissions.getUrl();
|
|
6097
6109
|
if (this.permissions.Type !== PermissionTypeEnum.Form) {
|
|
6098
6110
|
this.load();
|
|
@@ -6105,8 +6117,9 @@ class TableClass {
|
|
|
6105
6117
|
this.permission = false;
|
|
6106
6118
|
return;
|
|
6107
6119
|
}
|
|
6108
|
-
const
|
|
6109
|
-
if (
|
|
6120
|
+
const insertAccess = this.permissions.getAccess('Insert');
|
|
6121
|
+
if (insertAccess != null) {
|
|
6122
|
+
const insert = new InputClass(this.environment, this.l, insertAccess.Name, 'fad fa-plus fa-rotate-90', InputType.Button, 'w-u green h-30');
|
|
6110
6123
|
if (this.form) {
|
|
6111
6124
|
this.form.url = this.form.baseUrl = this.url + 'Insert';
|
|
6112
6125
|
if (!this.form.onTop) {
|
|
@@ -6124,8 +6137,15 @@ class TableClass {
|
|
|
6124
6137
|
}
|
|
6125
6138
|
}
|
|
6126
6139
|
else {
|
|
6127
|
-
insert.url = this.url;
|
|
6128
6140
|
this.buttons.unshift(insert);
|
|
6141
|
+
if (this.modal) {
|
|
6142
|
+
insert.onClick = () => {
|
|
6143
|
+
this.modal.show();
|
|
6144
|
+
};
|
|
6145
|
+
}
|
|
6146
|
+
else {
|
|
6147
|
+
insert.url = this.url + 'Insert';
|
|
6148
|
+
}
|
|
6129
6149
|
}
|
|
6130
6150
|
}
|
|
6131
6151
|
if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
|
|
@@ -6156,16 +6176,6 @@ class TableClass {
|
|
|
6156
6176
|
this.modal.form = this.form;
|
|
6157
6177
|
}
|
|
6158
6178
|
}
|
|
6159
|
-
else {
|
|
6160
|
-
if (this.modal) {
|
|
6161
|
-
insert.onClick = () => {
|
|
6162
|
-
this.modal.show();
|
|
6163
|
-
};
|
|
6164
|
-
}
|
|
6165
|
-
else {
|
|
6166
|
-
insert.url = this.url + 'Insert';
|
|
6167
|
-
}
|
|
6168
|
-
}
|
|
6169
6179
|
for (const option of this.permissions.getOptions()) {
|
|
6170
6180
|
if (this.options.filter(x => x.name === option.Name).length > 0) {
|
|
6171
6181
|
continue;
|