ps-toolkit-ui 0.0.211 → 0.0.212
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 +7812 -0
- package/bundles/ps-toolkit-ui.umd.js.map +1 -0
- package/bundles/ps-toolkit-ui.umd.min.js +2 -0
- package/bundles/ps-toolkit-ui.umd.min.js.map +1 -0
- package/esm2015/lib/classes/chart.class.js +140 -0
- package/esm2015/lib/classes/enum.class.js +187 -0
- package/esm2015/lib/classes/form.class.js +481 -0
- package/esm2015/lib/classes/helper.class.js +284 -0
- package/esm2015/lib/classes/lang.class.js +32 -0
- package/esm2015/lib/classes/login.class.js +22 -0
- package/esm2015/lib/classes/modal.class.js +52 -0
- package/esm2015/lib/classes/permission.class.js +61 -0
- package/esm2015/lib/classes/request.class.js +256 -0
- package/esm2015/lib/classes/safestyle.class.js +15 -0
- package/esm2015/lib/classes/sidebar.class.js +14 -0
- package/esm2015/lib/classes/steps.class.js +20 -0
- package/esm2015/lib/classes/string.class.js +220 -0
- package/esm2015/lib/classes/table.class.js +215 -0
- package/esm2015/lib/components/accordion/accordion.component.js +45 -0
- package/esm2015/lib/components/alert/alert.component.js +39 -0
- package/esm2015/lib/components/base.component.js +45 -0
- package/esm2015/lib/components/calendar/calendar.component.js +97 -0
- package/esm2015/lib/components/chart/chart.component.js +17 -0
- package/esm2015/lib/components/clock/clock.component.js +33 -0
- package/esm2015/lib/components/confirm/confirm.component.js +50 -0
- package/esm2015/lib/components/footer/footer.component.js +23 -0
- package/esm2015/lib/components/form/bank-card/form.bank-card.component.js +148 -0
- package/esm2015/lib/components/form/button/form.button.component.js +68 -0
- package/esm2015/lib/components/form/car/form.car.component.js +84 -0
- package/esm2015/lib/components/form/car/search/form.car.search.component.js +172 -0
- package/esm2015/lib/components/form/checkbox/form.checkbox.component.js +66 -0
- package/esm2015/lib/components/form/date/form.date.component.js +254 -0
- package/esm2015/lib/components/form/datetime/form.datetime.component.js +104 -0
- package/esm2015/lib/components/form/file/form.file.component.js +133 -0
- package/esm2015/lib/components/form/finger/form.finger.component.js +138 -0
- package/esm2015/lib/components/form/hidden/form.hidden.component.js +31 -0
- package/esm2015/lib/components/form/icon/form.icon.component.js +76 -0
- package/esm2015/lib/components/form/index/form.component.js +48 -0
- package/esm2015/lib/components/form/label/form.label.component.js +32 -0
- package/esm2015/lib/components/form/plaque/form.plaque.component.js +176 -0
- package/esm2015/lib/components/form/plaque/select/form.plaque.select.component.js +390 -0
- package/esm2015/lib/components/form/radio/form.radio.component.js +79 -0
- package/esm2015/lib/components/form/select/form.select.component.js +374 -0
- package/esm2015/lib/components/form/select/item/form.select.item.component.js +43 -0
- package/esm2015/lib/components/form/table/form.table.component.js +98 -0
- package/esm2015/lib/components/form/textarea/form.textarea.component.js +78 -0
- package/esm2015/lib/components/form/textbox/form.textbox.component.js +186 -0
- package/esm2015/lib/components/form/time/form.time.component.js +145 -0
- package/esm2015/lib/components/form/tree/form.tree.component.js +99 -0
- package/esm2015/lib/components/form/tree/item/form.tree.item.component.js +48 -0
- package/esm2015/lib/components/header/header.component.js +33 -0
- package/esm2015/lib/components/header/sub/sub.header.component.js +14 -0
- package/esm2015/lib/components/layout/layout.component.js +25 -0
- package/esm2015/lib/components/loading/loading.component.js +22 -0
- package/esm2015/lib/components/login/login.component.js +148 -0
- package/esm2015/lib/components/modal/modal.component.js +25 -0
- package/esm2015/lib/components/notfound/notfound.component.js +29 -0
- package/esm2015/lib/components/notification/notification.component.js +14 -0
- package/esm2015/lib/components/sidebar/item/sidebar.item.component.js +53 -0
- package/esm2015/lib/components/sidebar/sidebar.component.js +67 -0
- package/esm2015/lib/components/steps/steps.component.js +51 -0
- package/esm2015/lib/components/table/loading/table.loading.component.js +17 -0
- package/esm2015/lib/components/table/pagination/table.pagination.component.js +84 -0
- package/esm2015/lib/components/table/report/table.report.component.js +246 -0
- package/esm2015/lib/components/table/row/table.row.component.js +379 -0
- package/esm2015/lib/components/table/table.component.js +179 -0
- package/esm2015/lib/components/tooltip/tooltip.component.js +19 -0
- package/esm2015/lib/ps-toolkit-ui.module.js +95 -0
- package/esm2015/lib/services/config.service.js +14 -0
- package/esm2015/ps-toolkit-ui.js +20 -0
- package/esm2015/public-api.js +53 -0
- package/fesm2015/ps-toolkit-ui.js +6706 -0
- package/fesm2015/ps-toolkit-ui.js.map +1 -0
- package/lib/classes/chart.class.d.ts +11 -0
- package/lib/classes/enum.class.d.ts +158 -0
- package/lib/classes/form.class.d.ts +173 -0
- package/lib/classes/helper.class.d.ts +28 -0
- package/lib/classes/lang.class.d.ts +5 -0
- package/lib/classes/login.class.d.ts +17 -0
- package/lib/classes/modal.class.d.ts +19 -0
- package/lib/classes/permission.class.d.ts +31 -0
- package/lib/classes/request.class.d.ts +12 -0
- package/lib/classes/safestyle.class.d.ts +7 -0
- package/lib/classes/sidebar.class.d.ts +11 -0
- package/lib/classes/steps.class.d.ts +17 -0
- package/lib/classes/string.class.d.ts +218 -0
- package/lib/classes/table.class.d.ts +69 -0
- package/lib/components/accordion/accordion.component.d.ts +7 -0
- package/lib/components/alert/alert.component.d.ts +10 -0
- package/lib/components/base.component.d.ts +14 -0
- package/lib/components/calendar/calendar.component.d.ts +26 -0
- package/lib/components/chart/chart.component.d.ts +5 -0
- package/lib/components/clock/clock.component.d.ts +11 -0
- package/lib/components/confirm/confirm.component.d.ts +14 -0
- package/lib/components/footer/footer.component.d.ts +6 -0
- package/lib/components/form/bank-card/form.bank-card.component.d.ts +22 -0
- package/lib/components/form/button/form.button.component.d.ts +15 -0
- package/lib/components/form/car/form.car.component.d.ts +16 -0
- package/lib/components/form/car/search/form.car.search.component.d.ts +17 -0
- package/lib/components/form/checkbox/form.checkbox.component.d.ts +14 -0
- package/lib/components/form/date/form.date.component.d.ts +42 -0
- package/lib/components/form/datetime/form.datetime.component.d.ts +13 -0
- package/lib/components/form/file/form.file.component.d.ts +17 -0
- package/lib/components/form/finger/form.finger.component.d.ts +15 -0
- package/lib/components/form/hidden/form.hidden.component.d.ts +7 -0
- package/lib/components/form/icon/form.icon.component.d.ts +15 -0
- package/lib/components/form/index/form.component.d.ts +10 -0
- package/lib/components/form/label/form.label.component.d.ts +8 -0
- package/lib/components/form/plaque/form.plaque.component.d.ts +22 -0
- package/lib/components/form/plaque/select/form.plaque.select.component.d.ts +36 -0
- package/lib/components/form/radio/form.radio.component.d.ts +13 -0
- package/lib/components/form/select/form.select.component.d.ts +39 -0
- package/lib/components/form/select/item/form.select.item.component.d.ts +12 -0
- package/lib/components/form/table/form.table.component.d.ts +9 -0
- package/lib/components/form/textarea/form.textarea.component.d.ts +13 -0
- package/lib/components/form/textbox/form.textbox.component.d.ts +20 -0
- package/lib/components/form/time/form.time.component.d.ts +25 -0
- package/lib/components/form/tree/form.tree.component.d.ts +16 -0
- package/lib/components/form/tree/item/form.tree.item.component.d.ts +17 -0
- package/lib/components/header/header.component.d.ts +9 -0
- package/lib/components/header/sub/sub.header.component.d.ts +3 -0
- package/lib/components/layout/layout.component.d.ts +8 -0
- package/lib/components/loading/loading.component.d.ts +5 -0
- package/lib/components/login/login.component.d.ts +13 -0
- package/lib/components/modal/modal.component.d.ts +9 -0
- package/lib/components/notfound/notfound.component.d.ts +8 -0
- package/lib/components/notification/notification.component.d.ts +3 -0
- package/lib/components/sidebar/item/sidebar.item.component.d.ts +14 -0
- package/lib/components/sidebar/sidebar.component.d.ts +19 -0
- package/lib/components/steps/steps.component.d.ts +10 -0
- package/lib/components/table/loading/table.loading.component.d.ts +5 -0
- package/lib/components/table/pagination/table.pagination.component.d.ts +15 -0
- package/lib/components/table/report/table.report.component.d.ts +34 -0
- package/lib/components/table/row/table.row.component.d.ts +34 -0
- package/lib/components/table/table.component.d.ts +40 -0
- package/lib/components/tooltip/tooltip.component.d.ts +5 -0
- package/lib/ps-toolkit-ui.module.d.ts +4 -0
- package/lib/services/config.service.d.ts +6 -0
- package/package.json +23 -19
- package/ps-toolkit-ui.d.ts +19 -0
- package/ps-toolkit-ui.metadata.json +1 -0
- package/{src/public-api.ts → public-api.d.ts} +49 -53
- package/karma.conf.js +0 -32
- package/ng-package.json +0 -16
- package/src/lib/classes/chart.class.ts +0 -140
- package/src/lib/classes/enum.class.ts +0 -193
- package/src/lib/classes/excel.class.ts +0 -46
- package/src/lib/classes/form.class.ts +0 -528
- package/src/lib/classes/helper.class.ts +0 -283
- package/src/lib/classes/lang.class.ts +0 -32
- package/src/lib/classes/login.class.ts +0 -27
- package/src/lib/classes/modal.class.ts +0 -59
- package/src/lib/classes/permission.class.ts +0 -55
- package/src/lib/classes/request.class.ts +0 -255
- package/src/lib/classes/safestyle.class.ts +0 -4
- package/src/lib/classes/sidebar.class.ts +0 -20
- package/src/lib/classes/steps.class.ts +0 -19
- package/src/lib/classes/string.class.ts +0 -219
- package/src/lib/classes/table.class.ts +0 -228
- package/src/lib/components/accordion/accordion.component.css +0 -116
- package/src/lib/components/accordion/accordion.component.html +0 -19
- package/src/lib/components/accordion/accordion.component.ts +0 -41
- package/src/lib/components/alert/alert.component.css +0 -112
- package/src/lib/components/alert/alert.component.html +0 -1
- package/src/lib/components/alert/alert.component.ts +0 -35
- package/src/lib/components/base.component.ts +0 -38
- package/src/lib/components/calendar/calendar.component.css +0 -206
- package/src/lib/components/calendar/calendar.component.html +0 -36
- package/src/lib/components/calendar/calendar.component.ts +0 -99
- package/src/lib/components/chart/chart.component.css +0 -24
- package/src/lib/components/chart/chart.component.html +0 -6
- package/src/lib/components/chart/chart.component.ts +0 -14
- package/src/lib/components/clock/clock.component.css +0 -141
- package/src/lib/components/clock/clock.component.html +0 -10
- package/src/lib/components/clock/clock.component.ts +0 -37
- package/src/lib/components/confirm/confirm.component.css +0 -112
- package/src/lib/components/confirm/confirm.component.html +0 -1
- package/src/lib/components/confirm/confirm.component.ts +0 -47
- package/src/lib/components/footer/footer.component.css +0 -46
- package/src/lib/components/footer/footer.component.html +0 -9
- package/src/lib/components/footer/footer.component.ts +0 -18
- package/src/lib/components/form/bank-card/form.bank-card.component.css +0 -115
- package/src/lib/components/form/bank-card/form.bank-card.component.html +0 -13
- package/src/lib/components/form/bank-card/form.bank-card.component.ts +0 -144
- package/src/lib/components/form/button/form.button.component.css +0 -222
- package/src/lib/components/form/button/form.button.component.html +0 -16
- package/src/lib/components/form/button/form.button.component.ts +0 -65
- package/src/lib/components/form/car/form.car.component.css +0 -287
- package/src/lib/components/form/car/form.car.component.html +0 -11
- package/src/lib/components/form/car/form.car.component.ts +0 -82
- package/src/lib/components/form/car/search/form.car.search.component.css +0 -287
- package/src/lib/components/form/car/search/form.car.search.component.html +0 -15
- package/src/lib/components/form/car/search/form.car.search.component.ts +0 -170
- package/src/lib/components/form/checkbox/form.checkbox.component.css +0 -128
- package/src/lib/components/form/checkbox/form.checkbox.component.html +0 -8
- package/src/lib/components/form/checkbox/form.checkbox.component.ts +0 -64
- package/src/lib/components/form/date/form.date.component.css +0 -310
- package/src/lib/components/form/date/form.date.component.html +0 -46
- package/src/lib/components/form/date/form.date.component.ts +0 -247
- package/src/lib/components/form/datetime/form.datetime.component.css +0 -157
- package/src/lib/components/form/datetime/form.datetime.component.html +0 -11
- package/src/lib/components/form/datetime/form.datetime.component.ts +0 -98
- package/src/lib/components/form/file/form.file.component.css +0 -151
- package/src/lib/components/form/file/form.file.component.html +0 -12
- package/src/lib/components/form/file/form.file.component.ts +0 -130
- package/src/lib/components/form/finger/form.finger.component.css +0 -215
- package/src/lib/components/form/finger/form.finger.component.html +0 -59
- package/src/lib/components/form/finger/form.finger.component.ts +0 -131
- 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 +0 -29
- package/src/lib/components/form/icon/form.icon.component.css +0 -108
- package/src/lib/components/form/icon/form.icon.component.html +0 -14
- package/src/lib/components/form/icon/form.icon.component.ts +0 -73
- package/src/lib/components/form/index/form.component.css +0 -89
- package/src/lib/components/form/index/form.component.html +0 -35
- package/src/lib/components/form/index/form.component.ts +0 -45
- package/src/lib/components/form/label/form.label.component.css +0 -45
- package/src/lib/components/form/label/form.label.component.html +0 -2
- package/src/lib/components/form/label/form.label.component.ts +0 -30
- package/src/lib/components/form/plaque/form.plaque.component.css +0 -76
- package/src/lib/components/form/plaque/form.plaque.component.html +0 -10
- package/src/lib/components/form/plaque/form.plaque.component.ts +0 -178
- package/src/lib/components/form/plaque/select/form.plaque.select.component.css +0 -167
- package/src/lib/components/form/plaque/select/form.plaque.select.component.html +0 -19
- package/src/lib/components/form/plaque/select/form.plaque.select.component.ts +0 -385
- package/src/lib/components/form/radio/form.radio.component.css +0 -158
- package/src/lib/components/form/radio/form.radio.component.html +0 -16
- package/src/lib/components/form/radio/form.radio.component.ts +0 -78
- package/src/lib/components/form/select/form.select.component.css +0 -326
- package/src/lib/components/form/select/form.select.component.html +0 -16
- package/src/lib/components/form/select/form.select.component.ts +0 -358
- package/src/lib/components/form/select/item/form.select.item.component.css +0 -59
- package/src/lib/components/form/select/item/form.select.item.component.html +0 -10
- package/src/lib/components/form/select/item/form.select.item.component.ts +0 -40
- package/src/lib/components/form/table/form.table.component.css +0 -50
- package/src/lib/components/form/table/form.table.component.html +0 -8
- package/src/lib/components/form/table/form.table.component.ts +0 -94
- package/src/lib/components/form/textarea/form.textarea.component.css +0 -109
- package/src/lib/components/form/textarea/form.textarea.component.html +0 -10
- package/src/lib/components/form/textarea/form.textarea.component.ts +0 -76
- package/src/lib/components/form/textbox/form.textbox.component.css +0 -296
- package/src/lib/components/form/textbox/form.textbox.component.html +0 -13
- package/src/lib/components/form/textbox/form.textbox.component.ts +0 -185
- package/src/lib/components/form/time/form.time.component.css +0 -205
- package/src/lib/components/form/time/form.time.component.html +0 -22
- package/src/lib/components/form/time/form.time.component.ts +0 -139
- package/src/lib/components/form/tree/form.tree.component.css +0 -109
- package/src/lib/components/form/tree/form.tree.component.html +0 -11
- package/src/lib/components/form/tree/form.tree.component.ts +0 -98
- package/src/lib/components/form/tree/item/form.tree.item.component.css +0 -142
- package/src/lib/components/form/tree/item/form.tree.item.component.html +0 -9
- package/src/lib/components/form/tree/item/form.tree.item.component.ts +0 -49
- package/src/lib/components/header/header.component.css +0 -57
- package/src/lib/components/header/header.component.html +0 -5
- package/src/lib/components/header/header.component.ts +0 -28
- package/src/lib/components/header/sub/sub.header.component.css +0 -62
- package/src/lib/components/header/sub/sub.header.component.html +0 -8
- package/src/lib/components/header/sub/sub.header.component.ts +0 -11
- package/src/lib/components/layout/layout.component.css +0 -300
- package/src/lib/components/layout/layout.component.html +0 -20
- package/src/lib/components/layout/layout.component.ts +0 -21
- package/src/lib/components/loading/loading.component.css +0 -39
- package/src/lib/components/loading/loading.component.html +0 -8
- package/src/lib/components/loading/loading.component.ts +0 -18
- package/src/lib/components/login/login.component.css +0 -389
- package/src/lib/components/login/login.component.html +0 -27
- package/src/lib/components/login/login.component.ts +0 -145
- package/src/lib/components/modal/modal.component.css +0 -60
- package/src/lib/components/modal/modal.component.html +0 -12
- package/src/lib/components/modal/modal.component.ts +0 -23
- package/src/lib/components/notfound/notfound.component.css +0 -134
- package/src/lib/components/notfound/notfound.component.html +0 -10
- package/src/lib/components/notfound/notfound.component.ts +0 -25
- package/src/lib/components/notification/notification.component.css +0 -45
- package/src/lib/components/notification/notification.component.html +0 -2
- package/src/lib/components/notification/notification.component.ts +0 -11
- package/src/lib/components/sidebar/item/sidebar.item.component.css +0 -236
- package/src/lib/components/sidebar/item/sidebar.item.component.html +0 -16
- package/src/lib/components/sidebar/item/sidebar.item.component.ts +0 -54
- package/src/lib/components/sidebar/sidebar.component.css +0 -42
- package/src/lib/components/sidebar/sidebar.component.html +0 -10
- package/src/lib/components/sidebar/sidebar.component.ts +0 -60
- package/src/lib/components/steps/steps.component.css +0 -320
- package/src/lib/components/steps/steps.component.html +0 -18
- package/src/lib/components/steps/steps.component.ts +0 -44
- package/src/lib/components/table/loading/table.loading.component.css +0 -29
- package/src/lib/components/table/loading/table.loading.component.html +0 -9
- package/src/lib/components/table/loading/table.loading.component.ts +0 -14
- package/src/lib/components/table/pagination/table.pagination.component.css +0 -138
- package/src/lib/components/table/pagination/table.pagination.component.html +0 -9
- package/src/lib/components/table/pagination/table.pagination.component.ts +0 -89
- package/src/lib/components/table/report/table.report.component.css +0 -125
- package/src/lib/components/table/report/table.report.component.html +0 -19
- package/src/lib/components/table/report/table.report.component.ts +0 -238
- package/src/lib/components/table/row/table.row.component.css +0 -170
- package/src/lib/components/table/row/table.row.component.html +0 -21
- package/src/lib/components/table/row/table.row.component.ts +0 -373
- package/src/lib/components/table/table.component.css +0 -116
- package/src/lib/components/table/table.component.html +0 -62
- package/src/lib/components/table/table.component.ts +0 -180
- package/src/lib/components/tooltip/tooltip.component.css +0 -159
- package/src/lib/components/tooltip/tooltip.component.html +0 -1
- package/src/lib/components/tooltip/tooltip.component.ts +0 -15
- package/src/lib/ps-toolkit-ui.module.ts +0 -94
- package/src/lib/services/config.service.ts +0 -8
- package/src/test.ts +0 -26
- package/tsconfig.lib.json +0 -25
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- package/tslint.json +0 -17
|
@@ -1,228 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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>
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<lib-modal *ngIf="alert" [modal]="alert"></lib-modal>
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
}
|