ps-toolkit-ui 0.0.210 → 0.0.211
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/karma.conf.js +32 -0
- package/ng-package.json +16 -0
- package/package.json +19 -22
- package/src/lib/classes/chart.class.ts +140 -0
- package/src/lib/classes/enum.class.ts +193 -0
- package/src/lib/classes/excel.class.ts +46 -0
- package/src/lib/classes/form.class.ts +528 -0
- package/src/lib/classes/helper.class.ts +283 -0
- package/src/lib/classes/lang.class.ts +32 -0
- package/src/lib/classes/login.class.ts +27 -0
- package/src/lib/classes/modal.class.ts +59 -0
- package/src/lib/classes/permission.class.ts +55 -0
- package/src/lib/classes/request.class.ts +255 -0
- package/src/lib/classes/safestyle.class.ts +4 -0
- package/src/lib/classes/sidebar.class.ts +20 -0
- package/src/lib/classes/steps.class.ts +19 -0
- package/src/lib/classes/string.class.ts +219 -0
- package/src/lib/classes/table.class.ts +228 -0
- package/src/lib/components/accordion/accordion.component.css +116 -0
- package/src/lib/components/accordion/accordion.component.html +19 -0
- package/src/lib/components/accordion/accordion.component.ts +41 -0
- package/src/lib/components/alert/alert.component.css +112 -0
- package/src/lib/components/alert/alert.component.html +1 -0
- package/src/lib/components/alert/alert.component.ts +35 -0
- package/src/lib/components/base.component.ts +38 -0
- package/src/lib/components/calendar/calendar.component.css +206 -0
- package/src/lib/components/calendar/calendar.component.html +36 -0
- package/src/lib/components/calendar/calendar.component.ts +99 -0
- package/src/lib/components/chart/chart.component.css +24 -0
- package/src/lib/components/chart/chart.component.html +6 -0
- package/src/lib/components/chart/chart.component.ts +14 -0
- package/src/lib/components/clock/clock.component.css +141 -0
- package/src/lib/components/clock/clock.component.html +10 -0
- package/src/lib/components/clock/clock.component.ts +37 -0
- package/src/lib/components/confirm/confirm.component.css +112 -0
- package/src/lib/components/confirm/confirm.component.html +1 -0
- package/src/lib/components/confirm/confirm.component.ts +47 -0
- package/src/lib/components/footer/footer.component.css +46 -0
- package/src/lib/components/footer/footer.component.html +9 -0
- package/src/lib/components/footer/footer.component.ts +18 -0
- package/src/lib/components/form/bank-card/form.bank-card.component.css +115 -0
- package/src/lib/components/form/bank-card/form.bank-card.component.html +13 -0
- package/src/lib/components/form/bank-card/form.bank-card.component.ts +144 -0
- package/src/lib/components/form/button/form.button.component.css +222 -0
- package/src/lib/components/form/button/form.button.component.html +16 -0
- package/src/lib/components/form/button/form.button.component.ts +65 -0
- package/src/lib/components/form/car/form.car.component.css +287 -0
- package/src/lib/components/form/car/form.car.component.html +11 -0
- package/src/lib/components/form/car/form.car.component.ts +82 -0
- package/src/lib/components/form/car/search/form.car.search.component.css +287 -0
- package/src/lib/components/form/car/search/form.car.search.component.html +15 -0
- package/src/lib/components/form/car/search/form.car.search.component.ts +170 -0
- package/src/lib/components/form/checkbox/form.checkbox.component.css +128 -0
- package/src/lib/components/form/checkbox/form.checkbox.component.html +8 -0
- package/src/lib/components/form/checkbox/form.checkbox.component.ts +64 -0
- package/src/lib/components/form/date/form.date.component.css +310 -0
- package/src/lib/components/form/date/form.date.component.html +46 -0
- package/src/lib/components/form/date/form.date.component.ts +247 -0
- package/src/lib/components/form/datetime/form.datetime.component.css +157 -0
- package/src/lib/components/form/datetime/form.datetime.component.html +11 -0
- package/src/lib/components/form/datetime/form.datetime.component.ts +98 -0
- package/src/lib/components/form/file/form.file.component.css +151 -0
- package/src/lib/components/form/file/form.file.component.html +12 -0
- package/src/lib/components/form/file/form.file.component.ts +130 -0
- package/src/lib/components/form/finger/form.finger.component.css +215 -0
- package/src/lib/components/form/finger/form.finger.component.html +59 -0
- package/src/lib/components/form/finger/form.finger.component.ts +131 -0
- package/src/lib/components/form/hidden/form.hidden.component.css +0 -0
- package/src/lib/components/form/hidden/form.hidden.component.html +0 -0
- package/src/lib/components/form/hidden/form.hidden.component.ts +29 -0
- package/src/lib/components/form/icon/form.icon.component.css +108 -0
- package/src/lib/components/form/icon/form.icon.component.html +14 -0
- package/src/lib/components/form/icon/form.icon.component.ts +73 -0
- package/src/lib/components/form/index/form.component.css +89 -0
- package/src/lib/components/form/index/form.component.html +35 -0
- package/src/lib/components/form/index/form.component.ts +45 -0
- package/src/lib/components/form/label/form.label.component.css +45 -0
- package/src/lib/components/form/label/form.label.component.html +2 -0
- package/src/lib/components/form/label/form.label.component.ts +30 -0
- package/src/lib/components/form/plaque/form.plaque.component.css +76 -0
- package/src/lib/components/form/plaque/form.plaque.component.html +10 -0
- package/src/lib/components/form/plaque/form.plaque.component.ts +178 -0
- package/src/lib/components/form/plaque/select/form.plaque.select.component.css +167 -0
- package/src/lib/components/form/plaque/select/form.plaque.select.component.html +19 -0
- package/src/lib/components/form/plaque/select/form.plaque.select.component.ts +385 -0
- package/src/lib/components/form/radio/form.radio.component.css +158 -0
- package/src/lib/components/form/radio/form.radio.component.html +16 -0
- package/src/lib/components/form/radio/form.radio.component.ts +78 -0
- package/src/lib/components/form/select/form.select.component.css +326 -0
- package/src/lib/components/form/select/form.select.component.html +16 -0
- package/src/lib/components/form/select/form.select.component.ts +358 -0
- package/src/lib/components/form/select/item/form.select.item.component.css +59 -0
- package/src/lib/components/form/select/item/form.select.item.component.html +10 -0
- package/src/lib/components/form/select/item/form.select.item.component.ts +40 -0
- package/src/lib/components/form/table/form.table.component.css +50 -0
- package/src/lib/components/form/table/form.table.component.html +8 -0
- package/src/lib/components/form/table/form.table.component.ts +94 -0
- package/src/lib/components/form/textarea/form.textarea.component.css +109 -0
- package/src/lib/components/form/textarea/form.textarea.component.html +10 -0
- package/src/lib/components/form/textarea/form.textarea.component.ts +76 -0
- package/src/lib/components/form/textbox/form.textbox.component.css +296 -0
- package/src/lib/components/form/textbox/form.textbox.component.html +13 -0
- package/src/lib/components/form/textbox/form.textbox.component.ts +185 -0
- package/src/lib/components/form/time/form.time.component.css +205 -0
- package/src/lib/components/form/time/form.time.component.html +22 -0
- package/src/lib/components/form/time/form.time.component.ts +139 -0
- package/src/lib/components/form/tree/form.tree.component.css +109 -0
- package/src/lib/components/form/tree/form.tree.component.html +11 -0
- package/src/lib/components/form/tree/form.tree.component.ts +98 -0
- package/src/lib/components/form/tree/item/form.tree.item.component.css +142 -0
- package/src/lib/components/form/tree/item/form.tree.item.component.html +9 -0
- package/src/lib/components/form/tree/item/form.tree.item.component.ts +49 -0
- package/src/lib/components/header/header.component.css +57 -0
- package/src/lib/components/header/header.component.html +5 -0
- package/src/lib/components/header/header.component.ts +28 -0
- package/src/lib/components/header/sub/sub.header.component.css +62 -0
- package/src/lib/components/header/sub/sub.header.component.html +8 -0
- package/src/lib/components/header/sub/sub.header.component.ts +11 -0
- package/src/lib/components/layout/layout.component.css +300 -0
- package/src/lib/components/layout/layout.component.html +20 -0
- package/src/lib/components/layout/layout.component.ts +21 -0
- package/src/lib/components/loading/loading.component.css +39 -0
- package/src/lib/components/loading/loading.component.html +8 -0
- package/src/lib/components/loading/loading.component.ts +18 -0
- package/src/lib/components/login/login.component.css +389 -0
- package/src/lib/components/login/login.component.html +27 -0
- package/src/lib/components/login/login.component.ts +145 -0
- package/src/lib/components/modal/modal.component.css +60 -0
- package/src/lib/components/modal/modal.component.html +12 -0
- package/src/lib/components/modal/modal.component.ts +23 -0
- package/src/lib/components/notfound/notfound.component.css +134 -0
- package/src/lib/components/notfound/notfound.component.html +10 -0
- package/src/lib/components/notfound/notfound.component.ts +25 -0
- package/src/lib/components/notification/notification.component.css +45 -0
- package/src/lib/components/notification/notification.component.html +2 -0
- package/src/lib/components/notification/notification.component.ts +11 -0
- package/src/lib/components/sidebar/item/sidebar.item.component.css +236 -0
- package/src/lib/components/sidebar/item/sidebar.item.component.html +16 -0
- package/src/lib/components/sidebar/item/sidebar.item.component.ts +54 -0
- package/src/lib/components/sidebar/sidebar.component.css +42 -0
- package/src/lib/components/sidebar/sidebar.component.html +10 -0
- package/src/lib/components/sidebar/sidebar.component.ts +60 -0
- package/src/lib/components/steps/steps.component.css +320 -0
- package/src/lib/components/steps/steps.component.html +18 -0
- package/src/lib/components/steps/steps.component.ts +44 -0
- package/src/lib/components/table/loading/table.loading.component.css +29 -0
- package/src/lib/components/table/loading/table.loading.component.html +9 -0
- package/src/lib/components/table/loading/table.loading.component.ts +14 -0
- package/src/lib/components/table/pagination/table.pagination.component.css +138 -0
- package/src/lib/components/table/pagination/table.pagination.component.html +9 -0
- package/src/lib/components/table/pagination/table.pagination.component.ts +89 -0
- package/src/lib/components/table/report/table.report.component.css +125 -0
- package/src/lib/components/table/report/table.report.component.html +19 -0
- package/src/lib/components/table/report/table.report.component.ts +238 -0
- package/src/lib/components/table/row/table.row.component.css +170 -0
- package/src/lib/components/table/row/table.row.component.html +21 -0
- package/src/lib/components/table/row/table.row.component.ts +373 -0
- package/src/lib/components/table/table.component.css +116 -0
- package/src/lib/components/table/table.component.html +62 -0
- package/src/lib/components/table/table.component.ts +180 -0
- package/src/lib/components/tooltip/tooltip.component.css +159 -0
- package/src/lib/components/tooltip/tooltip.component.html +1 -0
- package/src/lib/components/tooltip/tooltip.component.ts +15 -0
- package/src/lib/ps-toolkit-ui.module.ts +94 -0
- package/src/lib/services/config.service.ts +8 -0
- package/{public-api.d.ts → src/public-api.ts} +53 -48
- package/src/test.ts +26 -0
- package/tsconfig.lib.json +25 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/tslint.json +17 -0
- package/bundles/ps-toolkit-ui.umd.js +0 -7646
- package/bundles/ps-toolkit-ui.umd.js.map +0 -1
- package/bundles/ps-toolkit-ui.umd.min.js +0 -2
- package/bundles/ps-toolkit-ui.umd.min.js.map +0 -1
- package/esm2015/lib/classes/chart.class.js +0 -140
- package/esm2015/lib/classes/enum.class.js +0 -187
- package/esm2015/lib/classes/form.class.js +0 -481
- package/esm2015/lib/classes/helper.class.js +0 -284
- package/esm2015/lib/classes/lang.class.js +0 -32
- package/esm2015/lib/classes/login.class.js +0 -22
- package/esm2015/lib/classes/modal.class.js +0 -52
- package/esm2015/lib/classes/permission.class.js +0 -61
- package/esm2015/lib/classes/request.class.js +0 -256
- package/esm2015/lib/classes/safestyle.class.js +0 -15
- package/esm2015/lib/classes/sidebar.class.js +0 -14
- package/esm2015/lib/classes/steps.class.js +0 -20
- package/esm2015/lib/classes/string.class.js +0 -220
- package/esm2015/lib/classes/table.class.js +0 -215
- package/esm2015/lib/components/accordion/accordion.component.js +0 -45
- package/esm2015/lib/components/alert/alert.component.js +0 -39
- package/esm2015/lib/components/base.component.js +0 -45
- package/esm2015/lib/components/calendar/calendar.component.js +0 -97
- package/esm2015/lib/components/chart/chart.component.js +0 -17
- package/esm2015/lib/components/clock/clock.component.js +0 -33
- package/esm2015/lib/components/confirm/confirm.component.js +0 -50
- package/esm2015/lib/components/footer/footer.component.js +0 -23
- package/esm2015/lib/components/form/bank-card/form.bank-card.component.js +0 -148
- package/esm2015/lib/components/form/button/form.button.component.js +0 -68
- package/esm2015/lib/components/form/car/form.car.component.js +0 -84
- package/esm2015/lib/components/form/car/search/form.car.search.component.js +0 -172
- package/esm2015/lib/components/form/checkbox/form.checkbox.component.js +0 -66
- package/esm2015/lib/components/form/date/form.date.component.js +0 -254
- package/esm2015/lib/components/form/datetime/form.datetime.component.js +0 -104
- package/esm2015/lib/components/form/file/form.file.component.js +0 -133
- package/esm2015/lib/components/form/finger/form.finger.component.js +0 -138
- package/esm2015/lib/components/form/hidden/form.hidden.component.js +0 -31
- package/esm2015/lib/components/form/icon/form.icon.component.js +0 -76
- package/esm2015/lib/components/form/index/form.component.js +0 -48
- package/esm2015/lib/components/form/label/form.label.component.js +0 -32
- package/esm2015/lib/components/form/plaque/form.plaque.component.js +0 -176
- package/esm2015/lib/components/form/plaque/select/form.plaque.select.component.js +0 -390
- package/esm2015/lib/components/form/radio/form.radio.component.js +0 -79
- package/esm2015/lib/components/form/select/form.select.component.js +0 -374
- package/esm2015/lib/components/form/select/item/form.select.item.component.js +0 -43
- package/esm2015/lib/components/form/table/form.table.component.js +0 -98
- package/esm2015/lib/components/form/textarea/form.textarea.component.js +0 -78
- package/esm2015/lib/components/form/textbox/form.textbox.component.js +0 -186
- package/esm2015/lib/components/form/time/form.time.component.js +0 -145
- package/esm2015/lib/components/form/tree/form.tree.component.js +0 -99
- package/esm2015/lib/components/form/tree/item/form.tree.item.component.js +0 -48
- package/esm2015/lib/components/header/header.component.js +0 -33
- package/esm2015/lib/components/header/sub/sub.header.component.js +0 -14
- package/esm2015/lib/components/layout/layout.component.js +0 -25
- package/esm2015/lib/components/loading/loading.component.js +0 -22
- package/esm2015/lib/components/login/login.component.js +0 -148
- package/esm2015/lib/components/modal/modal.component.js +0 -25
- package/esm2015/lib/components/notfound/notfound.component.js +0 -29
- package/esm2015/lib/components/notification/notification.component.js +0 -14
- package/esm2015/lib/components/sidebar/item/sidebar.item.component.js +0 -53
- package/esm2015/lib/components/sidebar/sidebar.component.js +0 -67
- package/esm2015/lib/components/steps/steps.component.js +0 -51
- package/esm2015/lib/components/table/loading/table.loading.component.js +0 -17
- package/esm2015/lib/components/table/pagination/table.pagination.component.js +0 -84
- package/esm2015/lib/components/table/report/table.report.component.js +0 -246
- package/esm2015/lib/components/table/row/table.row.component.js +0 -379
- package/esm2015/lib/components/table/table.component.js +0 -179
- package/esm2015/lib/components/tooltip/tooltip.component.js +0 -19
- package/esm2015/lib/ps-toolkit-ui.module.js +0 -95
- package/esm2015/lib/services/config.service.js +0 -14
- package/esm2015/ps-toolkit-ui.js +0 -20
- package/esm2015/public-api.js +0 -52
- package/fesm2015/ps-toolkit-ui.js +0 -6566
- package/fesm2015/ps-toolkit-ui.js.map +0 -1
- package/lib/classes/chart.class.d.ts +0 -11
- package/lib/classes/enum.class.d.ts +0 -158
- package/lib/classes/form.class.d.ts +0 -173
- package/lib/classes/helper.class.d.ts +0 -28
- package/lib/classes/lang.class.d.ts +0 -5
- package/lib/classes/login.class.d.ts +0 -17
- package/lib/classes/modal.class.d.ts +0 -19
- package/lib/classes/permission.class.d.ts +0 -31
- package/lib/classes/request.class.d.ts +0 -12
- package/lib/classes/safestyle.class.d.ts +0 -7
- package/lib/classes/sidebar.class.d.ts +0 -11
- package/lib/classes/steps.class.d.ts +0 -17
- package/lib/classes/string.class.d.ts +0 -218
- package/lib/classes/table.class.d.ts +0 -69
- package/lib/components/accordion/accordion.component.d.ts +0 -7
- package/lib/components/alert/alert.component.d.ts +0 -10
- package/lib/components/base.component.d.ts +0 -14
- package/lib/components/calendar/calendar.component.d.ts +0 -26
- package/lib/components/chart/chart.component.d.ts +0 -5
- package/lib/components/clock/clock.component.d.ts +0 -11
- package/lib/components/confirm/confirm.component.d.ts +0 -14
- package/lib/components/footer/footer.component.d.ts +0 -6
- package/lib/components/form/bank-card/form.bank-card.component.d.ts +0 -22
- package/lib/components/form/button/form.button.component.d.ts +0 -15
- package/lib/components/form/car/form.car.component.d.ts +0 -16
- package/lib/components/form/car/search/form.car.search.component.d.ts +0 -17
- package/lib/components/form/checkbox/form.checkbox.component.d.ts +0 -14
- package/lib/components/form/date/form.date.component.d.ts +0 -42
- package/lib/components/form/datetime/form.datetime.component.d.ts +0 -13
- package/lib/components/form/file/form.file.component.d.ts +0 -17
- package/lib/components/form/finger/form.finger.component.d.ts +0 -15
- package/lib/components/form/hidden/form.hidden.component.d.ts +0 -7
- package/lib/components/form/icon/form.icon.component.d.ts +0 -15
- package/lib/components/form/index/form.component.d.ts +0 -10
- package/lib/components/form/label/form.label.component.d.ts +0 -8
- package/lib/components/form/plaque/form.plaque.component.d.ts +0 -22
- package/lib/components/form/plaque/select/form.plaque.select.component.d.ts +0 -36
- package/lib/components/form/radio/form.radio.component.d.ts +0 -13
- package/lib/components/form/select/form.select.component.d.ts +0 -39
- package/lib/components/form/select/item/form.select.item.component.d.ts +0 -12
- package/lib/components/form/table/form.table.component.d.ts +0 -9
- package/lib/components/form/textarea/form.textarea.component.d.ts +0 -13
- package/lib/components/form/textbox/form.textbox.component.d.ts +0 -20
- package/lib/components/form/time/form.time.component.d.ts +0 -25
- package/lib/components/form/tree/form.tree.component.d.ts +0 -16
- package/lib/components/form/tree/item/form.tree.item.component.d.ts +0 -17
- package/lib/components/header/header.component.d.ts +0 -9
- package/lib/components/header/sub/sub.header.component.d.ts +0 -3
- package/lib/components/layout/layout.component.d.ts +0 -8
- package/lib/components/loading/loading.component.d.ts +0 -5
- package/lib/components/login/login.component.d.ts +0 -13
- package/lib/components/modal/modal.component.d.ts +0 -9
- package/lib/components/notfound/notfound.component.d.ts +0 -8
- package/lib/components/notification/notification.component.d.ts +0 -3
- package/lib/components/sidebar/item/sidebar.item.component.d.ts +0 -14
- package/lib/components/sidebar/sidebar.component.d.ts +0 -19
- package/lib/components/steps/steps.component.d.ts +0 -10
- package/lib/components/table/loading/table.loading.component.d.ts +0 -5
- package/lib/components/table/pagination/table.pagination.component.d.ts +0 -15
- package/lib/components/table/report/table.report.component.d.ts +0 -34
- package/lib/components/table/row/table.row.component.d.ts +0 -34
- package/lib/components/table/table.component.d.ts +0 -40
- package/lib/components/tooltip/tooltip.component.d.ts +0 -5
- package/lib/ps-toolkit-ui.module.d.ts +0 -4
- package/lib/services/config.service.d.ts +0 -6
- package/ps-toolkit-ui.d.ts +0 -19
- package/ps-toolkit-ui.metadata.json +0 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {ModalClass} from './modal.class';
|
|
2
|
+
import {FormClass, InputClass} from './form.class';
|
|
3
|
+
import {
|
|
4
|
+
InputType,
|
|
5
|
+
Method,
|
|
6
|
+
PermissionAccessTypeEnum,
|
|
7
|
+
PermissionInputActionEnum,
|
|
8
|
+
PermissionInputTypeEnum,
|
|
9
|
+
PermissionTypeEnum,
|
|
10
|
+
TableCollType,
|
|
11
|
+
TableOptionType
|
|
12
|
+
} from './enum.class';
|
|
13
|
+
import {RequestClass} from './request.class';
|
|
14
|
+
import {PermissionClass} from './permission.class';
|
|
15
|
+
import {HelperClass} from './helper.class';
|
|
16
|
+
import * as $ from 'jquery';
|
|
17
|
+
|
|
18
|
+
export class TableClass {
|
|
19
|
+
constructor(environment: any, l: (k, v?) => string, permissions: PermissionClass, name: string = '', cls: string = '',
|
|
20
|
+
perPage: number = 10, height: number = 50) {
|
|
21
|
+
this.environment = environment;
|
|
22
|
+
this.l = l;
|
|
23
|
+
this.name = name;
|
|
24
|
+
this.id = this.name;
|
|
25
|
+
this.permissions = permissions;
|
|
26
|
+
this.class = cls;
|
|
27
|
+
this.perPage = perPage;
|
|
28
|
+
this.height = height;
|
|
29
|
+
}
|
|
30
|
+
environment: any = null;
|
|
31
|
+
l: (k, v?) => string;
|
|
32
|
+
permissions: PermissionClass;
|
|
33
|
+
permission = true;
|
|
34
|
+
name: string;
|
|
35
|
+
id: string;
|
|
36
|
+
class: string;
|
|
37
|
+
style = {};
|
|
38
|
+
url = null;
|
|
39
|
+
method: Method = Method.Post;
|
|
40
|
+
height = 40;
|
|
41
|
+
perPage = 10;
|
|
42
|
+
cols: TableCollClass[] = [];
|
|
43
|
+
buttons: InputClass[] = [];
|
|
44
|
+
optionsActions: any[] = [];
|
|
45
|
+
rows = [];
|
|
46
|
+
count = 0;
|
|
47
|
+
page = 1;
|
|
48
|
+
sort = null;
|
|
49
|
+
queryParams = {};
|
|
50
|
+
title = null;
|
|
51
|
+
description = null;
|
|
52
|
+
sortType = null;
|
|
53
|
+
displayLabel = true;
|
|
54
|
+
sortable = false;
|
|
55
|
+
optionType = TableOptionType.Hidden;
|
|
56
|
+
loading = true;
|
|
57
|
+
hasStatus = false;
|
|
58
|
+
hasChildren = false;
|
|
59
|
+
childrenAutoLoad = false;
|
|
60
|
+
withSelect = false;
|
|
61
|
+
showExtraButtons = true;
|
|
62
|
+
extraButtons: InputClass[] = [];
|
|
63
|
+
form: FormClass = null;
|
|
64
|
+
searchForm: FormClass = null;
|
|
65
|
+
modal: ModalClass = null;
|
|
66
|
+
level = null;
|
|
67
|
+
onLoad: () => void = null;
|
|
68
|
+
onSort: () => void = null;
|
|
69
|
+
showConfirm: (l: string, url: string, data, accept: (btn: InputClass) => void) => void = null;
|
|
70
|
+
load(btn = null): void{
|
|
71
|
+
if (this.url){
|
|
72
|
+
new RequestClass(this.environment, this.l).table(this, btn);
|
|
73
|
+
}else{
|
|
74
|
+
this.loading = false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
searchData(report = false): {} {
|
|
79
|
+
const d: any = {};
|
|
80
|
+
if (!report){
|
|
81
|
+
d.Page = this.page;
|
|
82
|
+
d.PerPage = this.perPage;
|
|
83
|
+
}
|
|
84
|
+
if (this.sortable){
|
|
85
|
+
d.Sort = 'Priority';
|
|
86
|
+
d.SortType = 'ASC';
|
|
87
|
+
}else if (this.sort){
|
|
88
|
+
d.Sort = this.sort;
|
|
89
|
+
d.SortType = this.sortType;
|
|
90
|
+
}
|
|
91
|
+
for (const c of this.cols.filter(x => x.withSearch && x.search != null && x.search.data() != null && x.search.data() !== '')){
|
|
92
|
+
d[c.name] = c.search.data();
|
|
93
|
+
}
|
|
94
|
+
return this.searchForm ? this.searchForm.json(d) : d;
|
|
95
|
+
}
|
|
96
|
+
getUrl(): string {
|
|
97
|
+
return this.url + 'List';
|
|
98
|
+
}
|
|
99
|
+
showInsertModal(cId = null): void {
|
|
100
|
+
const insertAccess = this.permissions.getAccess(PermissionAccessTypeEnum.Insert);
|
|
101
|
+
this.form.url = this.form.baseUrl = this.url + 'Insert' + (cId ? '/' + cId : '');
|
|
102
|
+
this.form.name = insertAccess.Name;
|
|
103
|
+
this.form.method = Method.Post;
|
|
104
|
+
this.form.inputs.filter(x => x.inEditDisabled).forEach(x => x.disabled = false);
|
|
105
|
+
this.form.inputs.filter(x => !x.inEditVisible).forEach(x => x.visible = true);
|
|
106
|
+
this.modal.show();
|
|
107
|
+
}
|
|
108
|
+
set(changeRows = null): void{
|
|
109
|
+
this.permission = true;
|
|
110
|
+
if (this.permissions)
|
|
111
|
+
{
|
|
112
|
+
const listAccess = this.permissions.getAccess(PermissionAccessTypeEnum.List);
|
|
113
|
+
if (listAccess !== null){
|
|
114
|
+
this.title = listAccess.Name;
|
|
115
|
+
this.url = this.permissions.getUrl();
|
|
116
|
+
if (this.permissions.Type !== PermissionTypeEnum.Form){
|
|
117
|
+
this.load();
|
|
118
|
+
}else{
|
|
119
|
+
this.loading = false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}else{
|
|
123
|
+
this.permission = false;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
for (const access of this.permissions.getAccesses().filter(x => x.InputAction !== PermissionInputActionEnum.None)){
|
|
127
|
+
if (this.buttons.filter(x => x.name === access.Name).length > 0){
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon,
|
|
131
|
+
access.InputType === PermissionInputTypeEnum.Button ? InputType.Button : InputType.Icon, 'blue w-u h-30');
|
|
132
|
+
if (access.AccessType === PermissionAccessTypeEnum.Insert){
|
|
133
|
+
accessInp.class = accessInp.class.replace('blue', 'green');
|
|
134
|
+
if (this.form){
|
|
135
|
+
this.form.url = this.form.baseUrl = this.url + 'Insert';
|
|
136
|
+
if (!this.form.onTop){
|
|
137
|
+
accessInp.onClick = () => {
|
|
138
|
+
this.form.onSuccessBase = () => {
|
|
139
|
+
this.modal.hide();
|
|
140
|
+
this.load();
|
|
141
|
+
};
|
|
142
|
+
this.showInsertModal();
|
|
143
|
+
};
|
|
144
|
+
}else{
|
|
145
|
+
this.form.displayLabel = false;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
}else{
|
|
149
|
+
if (this.modal){
|
|
150
|
+
accessInp.onClick = () => {
|
|
151
|
+
this.modal.show();
|
|
152
|
+
};
|
|
153
|
+
}else{
|
|
154
|
+
accessInp.url = this.url + 'Insert';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} else if (access.AccessType === PermissionAccessTypeEnum.Print){
|
|
158
|
+
accessInp.onClick = () => {
|
|
159
|
+
const p = new PermissionClass();
|
|
160
|
+
p.RelatedId = 'Index';
|
|
161
|
+
p.Area = this.permissions.Area;
|
|
162
|
+
p.Controller = 'Print';
|
|
163
|
+
p.Action = this.permissions.Controller + (this.permissions.Action ? this.permissions.Action : '');
|
|
164
|
+
const params = $.param(this.searchData(true));
|
|
165
|
+
window.open('/Report' + p.getUrl() + (this.permissions.RelatedId ? '/' + this.permissions.RelatedId : '') +
|
|
166
|
+
(params ? '?' + params : ''), '_blank');
|
|
167
|
+
};
|
|
168
|
+
} else if (access.InputAction === PermissionInputActionEnum.OnClick){
|
|
169
|
+
accessInp.onClick = (btn) => {
|
|
170
|
+
this.optionsActions.find(x => x.name === access.Action).onClick(btn);
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
this.buttons.push(accessInp);
|
|
174
|
+
}
|
|
175
|
+
if (this.form){
|
|
176
|
+
this.form.addButtons('Save', 'green', true, this.permissions.Type === PermissionTypeEnum.Form ? (data) => {
|
|
177
|
+
if (data.Id){
|
|
178
|
+
const i = this.rows.findIndex(x => x.Id === data.Id);
|
|
179
|
+
this.rows[i] = data;
|
|
180
|
+
}else{
|
|
181
|
+
data.Id = parseInt(HelperClass.random(5, false, false), 10);
|
|
182
|
+
this.rows.unshift(data);
|
|
183
|
+
}
|
|
184
|
+
if (changeRows){
|
|
185
|
+
changeRows.emit(data);
|
|
186
|
+
}
|
|
187
|
+
this.form.clear();
|
|
188
|
+
} : null);
|
|
189
|
+
if (this.form.onTop){
|
|
190
|
+
this.form.onSuccessBase = () => {
|
|
191
|
+
this.form.clear();
|
|
192
|
+
this.load();
|
|
193
|
+
};
|
|
194
|
+
} else {
|
|
195
|
+
if (!this.modal){
|
|
196
|
+
this.modal = new ModalClass(this.environment, this.l, this.form.name);
|
|
197
|
+
}
|
|
198
|
+
this.modal.form = this.form;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export class TableCollClass {
|
|
205
|
+
constructor(name: string, percent: number, cls = '', type: TableCollType = TableCollType.Text,
|
|
206
|
+
withSearch: boolean = true, sort: boolean = true) {
|
|
207
|
+
this.name = name;
|
|
208
|
+
this.percent = percent;
|
|
209
|
+
this.class = cls;
|
|
210
|
+
this.type = type;
|
|
211
|
+
this.withSearch = withSearch;
|
|
212
|
+
this.sort = sort;
|
|
213
|
+
}
|
|
214
|
+
enum = null;
|
|
215
|
+
name: string;
|
|
216
|
+
percent: number;
|
|
217
|
+
class: string;
|
|
218
|
+
sort = true;
|
|
219
|
+
withSearch: boolean;
|
|
220
|
+
search: InputClass = null;
|
|
221
|
+
type: TableCollType;
|
|
222
|
+
fun: (row) => void = null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export class TableRowClass {
|
|
226
|
+
constructor(public data, public children) {
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
.accordion {
|
|
2
|
+
float: right;
|
|
3
|
+
width: 100%;
|
|
4
|
+
padding: 20px;
|
|
5
|
+
background-color: white;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
position: relative;
|
|
8
|
+
min-height: 300px !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.accordion > .loading{
|
|
12
|
+
position: absolute;
|
|
13
|
+
background-color: white;
|
|
14
|
+
top: 0;
|
|
15
|
+
right: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
text-align: center;
|
|
19
|
+
border-radius: 5px;
|
|
20
|
+
z-index: 4;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.accordion > .loading .text {
|
|
24
|
+
position: absolute;
|
|
25
|
+
height: 35px;
|
|
26
|
+
line-height: 35px;
|
|
27
|
+
width: 100%;
|
|
28
|
+
text-align: center;
|
|
29
|
+
font-family: VazirBold;
|
|
30
|
+
top: calc(50% - 20px);
|
|
31
|
+
}
|
|
32
|
+
::ng-deep .accordion > .loading .icon {
|
|
33
|
+
font-size: 20px !important;
|
|
34
|
+
line-height: 30px;
|
|
35
|
+
position: relative;
|
|
36
|
+
top: 5px;
|
|
37
|
+
margin-left: 5px;
|
|
38
|
+
}
|
|
39
|
+
.accordion > .title{
|
|
40
|
+
float: right;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 30px;
|
|
43
|
+
line-height: 30px;
|
|
44
|
+
font-family: VazirBold;
|
|
45
|
+
font-size: 16px;
|
|
46
|
+
text-align: center;
|
|
47
|
+
margin-bottom: 10px;
|
|
48
|
+
position: relative;
|
|
49
|
+
}
|
|
50
|
+
.accordion .accordion-item{
|
|
51
|
+
float: right;
|
|
52
|
+
width: 100%;
|
|
53
|
+
margin-bottom: 10px;
|
|
54
|
+
position: relative;
|
|
55
|
+
}
|
|
56
|
+
.accordion .accordion-item .header{
|
|
57
|
+
float: right;
|
|
58
|
+
width: 100%;
|
|
59
|
+
-webkit-user-select: none;
|
|
60
|
+
-moz-user-select: none;
|
|
61
|
+
-khtml-user-select: none;
|
|
62
|
+
-ms-user-select: none;
|
|
63
|
+
position: relative;
|
|
64
|
+
}
|
|
65
|
+
.accordion .accordion-item .title{
|
|
66
|
+
float: right;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 30px;
|
|
69
|
+
line-height: 30px;
|
|
70
|
+
background-color: var(--base);
|
|
71
|
+
border-radius: 5px;
|
|
72
|
+
text-align: center;
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
color: white;
|
|
76
|
+
}
|
|
77
|
+
.accordion .accordion-item .title:hover{
|
|
78
|
+
background-color: var(--base-dark);
|
|
79
|
+
}
|
|
80
|
+
.accordion .accordion-item .header .icon{
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 0;
|
|
83
|
+
right: 0;
|
|
84
|
+
width: 30px;
|
|
85
|
+
height: 30px;
|
|
86
|
+
line-height: 29px;
|
|
87
|
+
text-align: center;
|
|
88
|
+
color: white;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
font-size: 18px;
|
|
91
|
+
}
|
|
92
|
+
.accordion .accordion-item .header .delete-icon{
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 0;
|
|
95
|
+
left: 0;
|
|
96
|
+
width: 30px;
|
|
97
|
+
height: 30px;
|
|
98
|
+
line-height: 29px;
|
|
99
|
+
text-align: center;
|
|
100
|
+
color: white;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
font-size: 18px;
|
|
103
|
+
}
|
|
104
|
+
.accordion .accordion-item .content{
|
|
105
|
+
display: none;
|
|
106
|
+
float: right;
|
|
107
|
+
width: 100%;
|
|
108
|
+
padding: 10px;
|
|
109
|
+
}
|
|
110
|
+
.accordion .accordion-item-con:first-of-type .content{
|
|
111
|
+
display: block;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
::ng-deep .accordion .accordion-item .content .table-con{
|
|
115
|
+
box-shadow: unset !important;
|
|
116
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div [id]="'Accordion' + accordion.name" [className]="'accordion ' + accordion.class">
|
|
2
|
+
<div *ngIf="accordion.loading" class="loading">
|
|
3
|
+
<div class="text" [innerHTML]="accordion.l('LoadingTable', 'Processing')"></div>
|
|
4
|
+
</div>
|
|
5
|
+
<div *ngIf="accordion.displayLabel" class="title underline">{{this.accordion.l(this.accordion.name)}}</div>
|
|
6
|
+
<div class="accordion-item-con w-100" *ngFor="let acc of this.accordion.rows; let i = index">
|
|
7
|
+
<div class="accordion-item" [id]="'AccordionRow' + acc.id" *ngIf="acc.show">
|
|
8
|
+
<div class="header" (click)="toggle($event)">
|
|
9
|
+
<div class="title">{{accordion.l(acc.name)}}</div>
|
|
10
|
+
<i [className]="(i == 0 ? 'fa-caret-down ' : 'fa-caret-left ') + 'fa-duotone icon'"></i>
|
|
11
|
+
<i *ngIf="accordion.hasDelete" (click)="deleteRow(acc)" class="fas fa-times delete-icon"></i>
|
|
12
|
+
</div>
|
|
13
|
+
<div [className]="(i == 0 ? 'open ' : '') + 'content'">
|
|
14
|
+
<lib-table *ngIf="acc.table != null" [table]="acc.table"></lib-table>
|
|
15
|
+
<lib-form *ngIf="acc.form != null" [form]="acc.form"></lib-form>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {Component, ElementRef, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
|
2
|
+
import * as $ from 'jquery';
|
|
3
|
+
import {AccordionClass, AccordionRowClass} from '../../classes/form.class';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-accordion',
|
|
7
|
+
templateUrl: './accordion.component.html',
|
|
8
|
+
styleUrls: ['./accordion.component.css']
|
|
9
|
+
})
|
|
10
|
+
export class AccordionComponent{
|
|
11
|
+
@Input()
|
|
12
|
+
accordion: AccordionClass;
|
|
13
|
+
constructor(){
|
|
14
|
+
}
|
|
15
|
+
toggle(e): void{
|
|
16
|
+
const chOpen = $(e.target).closest('.accordion').find('.content.open');
|
|
17
|
+
const ocOpen = chOpen.closest('.accordion-item').find('.header > .icon');
|
|
18
|
+
const ch = $(e.target).closest('.accordion-item').find(' > .content');
|
|
19
|
+
const oc = ch.closest('.accordion-item').find(' > .header > .icon');
|
|
20
|
+
if (ch.hasClass('open')) {
|
|
21
|
+
ch.removeClass('open');
|
|
22
|
+
ch.stop().slideUp();
|
|
23
|
+
oc.removeClass('fa-caret-down').addClass('fa-caret-left');
|
|
24
|
+
} else {
|
|
25
|
+
if (chOpen){
|
|
26
|
+
chOpen.removeClass('open');
|
|
27
|
+
chOpen.stop().slideUp();
|
|
28
|
+
ocOpen.removeClass('fa-caret-down').addClass('fa-caret-left');
|
|
29
|
+
}
|
|
30
|
+
ch.addClass('open');
|
|
31
|
+
ch.stop().slideDown();
|
|
32
|
+
oc.addClass('fa-caret-down').removeClass('fa-caret-left');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
deleteRow(acc: AccordionRowClass): void{
|
|
36
|
+
this.accordion.rows = this.accordion.rows.filter(x => x.name !== acc.name);
|
|
37
|
+
if (this.accordion.onDelete){
|
|
38
|
+
this.accordion.onDelete(acc);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.accordion {
|
|
2
|
+
float: right;
|
|
3
|
+
width: 100%;
|
|
4
|
+
padding: 20px;
|
|
5
|
+
background-color: white;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
position: relative;
|
|
8
|
+
min-height: 300px !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.accordion > .loading{
|
|
12
|
+
position: absolute;
|
|
13
|
+
background-color: white;
|
|
14
|
+
top: 0;
|
|
15
|
+
right: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
text-align: center;
|
|
19
|
+
border-radius: 5px;
|
|
20
|
+
z-index: 4;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.accordion > .loading .text {
|
|
24
|
+
position: absolute;
|
|
25
|
+
height: 35px;
|
|
26
|
+
line-height: 35px;
|
|
27
|
+
width: 100%;
|
|
28
|
+
text-align: center;
|
|
29
|
+
font-family: VazirBold;
|
|
30
|
+
top: calc(50% - 20px);
|
|
31
|
+
}
|
|
32
|
+
::ng-deep .accordion > .loading .icon {
|
|
33
|
+
font-size: 20px !important;
|
|
34
|
+
line-height: 30px;
|
|
35
|
+
position: relative;
|
|
36
|
+
top: 5px;
|
|
37
|
+
margin-left: 5px;
|
|
38
|
+
}
|
|
39
|
+
.accordion > .title{
|
|
40
|
+
float: right;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 30px;
|
|
43
|
+
line-height: 30px;
|
|
44
|
+
font-family: VazirBold;
|
|
45
|
+
font-size: 16px;
|
|
46
|
+
text-align: center;
|
|
47
|
+
margin-bottom: 10px;
|
|
48
|
+
position: relative;
|
|
49
|
+
}
|
|
50
|
+
.accordion .accordion-item{
|
|
51
|
+
float: right;
|
|
52
|
+
width: 100%;
|
|
53
|
+
margin-bottom: 10px;
|
|
54
|
+
position: relative;
|
|
55
|
+
}
|
|
56
|
+
.accordion .accordion-item .header{
|
|
57
|
+
float: right;
|
|
58
|
+
width: 100%;
|
|
59
|
+
-webkit-user-select: none;
|
|
60
|
+
-moz-user-select: none;
|
|
61
|
+
-khtml-user-select: none;
|
|
62
|
+
-ms-user-select: none;
|
|
63
|
+
position: relative;
|
|
64
|
+
}
|
|
65
|
+
.accordion .accordion-item .title{
|
|
66
|
+
float: right;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 30px;
|
|
69
|
+
line-height: 30px;
|
|
70
|
+
background-color: var(--base);
|
|
71
|
+
border-radius: 5px;
|
|
72
|
+
text-align: center;
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
color: white;
|
|
76
|
+
}
|
|
77
|
+
.accordion .accordion-item .title:hover{
|
|
78
|
+
background-color: var(--base-dark);
|
|
79
|
+
}
|
|
80
|
+
.accordion .accordion-item .header .icon{
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 0;
|
|
83
|
+
right: 0;
|
|
84
|
+
width: 30px;
|
|
85
|
+
height: 30px;
|
|
86
|
+
line-height: 29px;
|
|
87
|
+
text-align: center;
|
|
88
|
+
color: white;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
font-size: 18px;
|
|
91
|
+
}
|
|
92
|
+
.accordion .accordion-item .header .delete-icon{
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 0;
|
|
95
|
+
left: 0;
|
|
96
|
+
width: 30px;
|
|
97
|
+
height: 30px;
|
|
98
|
+
line-height: 29px;
|
|
99
|
+
text-align: center;
|
|
100
|
+
color: white;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
font-size: 18px;
|
|
103
|
+
}
|
|
104
|
+
.accordion .accordion-item .content{
|
|
105
|
+
display: none;
|
|
106
|
+
float: right;
|
|
107
|
+
width: 100%;
|
|
108
|
+
padding: 10px;
|
|
109
|
+
}
|
|
110
|
+
.accordion .accordion-item-con:first-of-type .content{
|
|
111
|
+
display: block;
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<lib-modal *ngIf="alert" [modal]="alert"></lib-modal>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {Component} from '@angular/core';
|
|
2
|
+
import {FormClass, InputClass} from '../../classes/form.class';
|
|
3
|
+
import {ModalClass} from '../../classes/modal.class';
|
|
4
|
+
import {InputType} from '../../classes/enum.class';
|
|
5
|
+
import {LangClass} from '../../classes/lang.class';
|
|
6
|
+
import {PsToolkitUiConfigService} from '../../services/config.service';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'lib-alert',
|
|
10
|
+
templateUrl: './alert.component.html',
|
|
11
|
+
styleUrls: ['./alert.component.css']
|
|
12
|
+
})
|
|
13
|
+
export class AlertComponent {
|
|
14
|
+
alert: ModalClass;
|
|
15
|
+
alertLabel: InputClass;
|
|
16
|
+
constructor(public config: PsToolkitUiConfigService){
|
|
17
|
+
const lang = new LangClass(config.currentLang, config.strings);
|
|
18
|
+
const l = (key: string, v = null): string => {
|
|
19
|
+
return lang.get('Public', 'Alert', key, v);
|
|
20
|
+
};
|
|
21
|
+
this.alert = new ModalClass(config.environment, l, 'Alert');
|
|
22
|
+
this.alert.form = new FormClass(config.environment, l, 'Alert');
|
|
23
|
+
this.alertLabel = new InputClass(config.environment, l, 'Alert', null, InputType.Label, 'f-s-16 p-h-20 p-t-10 l-h-30');
|
|
24
|
+
this.alert.form.inputs = [
|
|
25
|
+
this.alertLabel
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
show(l: string, accept: () => void): void{
|
|
29
|
+
this.alertLabel.value = l;
|
|
30
|
+
this.alert.onHide = () => {
|
|
31
|
+
accept();
|
|
32
|
+
};
|
|
33
|
+
this.alert.show();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {Injectable} from '@angular/core';
|
|
2
|
+
import {PermissionClass} from '../classes/permission.class';
|
|
3
|
+
import {PermissionTypeEnum} from '../classes/enum.class';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export abstract class BaseComponent {
|
|
7
|
+
l: (k, v?) => string;
|
|
8
|
+
permissions: PermissionClass;
|
|
9
|
+
protected constructor(public app: any, public c, public a = null){
|
|
10
|
+
this.l = (key: string, v = null): string => {
|
|
11
|
+
return app.getL(`${c}${(a ? `.${a}` : '')}`, key, v);
|
|
12
|
+
};
|
|
13
|
+
if (app.currentUser !== null){
|
|
14
|
+
this.permissions = this.getPermission(this.c, this.a);
|
|
15
|
+
if (this.permissions){
|
|
16
|
+
this.permissions.Area = app.area;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
getPermission(c, a = null): any{
|
|
21
|
+
const p = this.app.currentUser.Permissions.filter(per => per.Controller === c && (a == null || per.Action === a) &&
|
|
22
|
+
per.Type === PermissionTypeEnum.Item);
|
|
23
|
+
return p.length > 0 ? this.getPermissionClass(p[0]) : null;
|
|
24
|
+
}
|
|
25
|
+
getPermissionClass(p: any): PermissionClass{
|
|
26
|
+
return new PermissionClass(p.Name, p.Icon, p.Type, p.InputType, p.AccessType, p.InputAction, this.app.area, p.Controller, p.Action,
|
|
27
|
+
p.Condition, this.getPermissionAccessesClass(p.Id));
|
|
28
|
+
}
|
|
29
|
+
getPermissionAccessesClass(parentId: string): PermissionClass[]{
|
|
30
|
+
return this.app.currentUser.Permissions.filter(x => x.ParentId === parentId).map(x => this.getPermissionClass(x));
|
|
31
|
+
}
|
|
32
|
+
hasAccess(a: string): boolean{
|
|
33
|
+
return this.permissions ? this.permissions.hasAccessByName(a) : false;
|
|
34
|
+
}
|
|
35
|
+
hasOption(a: string): boolean{
|
|
36
|
+
return this.permissions ? this.permissions.hasAccessByName(a) : false;
|
|
37
|
+
}
|
|
38
|
+
}
|