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,528 +0,0 @@
|
|
|
1
|
-
import {EnumUtils, InputError, InputType, Method} from './enum.class';
|
|
2
|
-
import {HelperClass} from './helper.class';
|
|
3
|
-
import {RequestClass} from './request.class';
|
|
4
|
-
import {TableClass} from './table.class';
|
|
5
|
-
import * as $ from 'jquery';
|
|
6
|
-
import {ModalClass} from './modal.class';
|
|
7
|
-
import * as _ from 'lodash';
|
|
8
|
-
|
|
9
|
-
export class Progress {
|
|
10
|
-
constructor(secs: number) {
|
|
11
|
-
this.secs = this.remainSecs = secs;
|
|
12
|
-
}
|
|
13
|
-
secs: number;
|
|
14
|
-
remainSecs: number;
|
|
15
|
-
percent = 98;
|
|
16
|
-
interVal;
|
|
17
|
-
onEnd: () => void = null;
|
|
18
|
-
onStart: () => void = null;
|
|
19
|
-
start = () => {
|
|
20
|
-
this.remainSecs = this.secs;
|
|
21
|
-
this.percent = 98;
|
|
22
|
-
if (this.onStart){
|
|
23
|
-
this.onStart();
|
|
24
|
-
}
|
|
25
|
-
this.interVal = setInterval( () => {
|
|
26
|
-
this.percent = (this.remainSecs / this.secs) * 98;
|
|
27
|
-
if (this.remainSecs === 0){
|
|
28
|
-
clearInterval(this.interVal);
|
|
29
|
-
if (this.onEnd){
|
|
30
|
-
this.onEnd();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
this.remainSecs -= 0.5;
|
|
34
|
-
}, 500);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export class FormClass {
|
|
38
|
-
constructor(environment: any, l: (k, v?) => string, name: string = null, permission: boolean = true,
|
|
39
|
-
url: string = null, cls: string = null) {
|
|
40
|
-
this.environment = environment;
|
|
41
|
-
this.l = l;
|
|
42
|
-
this.url = url;
|
|
43
|
-
this.baseUrl = url;
|
|
44
|
-
this.class = cls;
|
|
45
|
-
this.permission = permission;
|
|
46
|
-
this.name = name;
|
|
47
|
-
this.id = this.name;
|
|
48
|
-
}
|
|
49
|
-
l: (k, v?) => string;
|
|
50
|
-
permission: boolean;
|
|
51
|
-
environment: any = null;
|
|
52
|
-
name: string;
|
|
53
|
-
subName: string = null;
|
|
54
|
-
id: string;
|
|
55
|
-
class: string;
|
|
56
|
-
baseUrl: string;
|
|
57
|
-
url: string;
|
|
58
|
-
method: Method = Method.Post;
|
|
59
|
-
loading = false;
|
|
60
|
-
style: {};
|
|
61
|
-
onTop = false;
|
|
62
|
-
displayLabel = true;
|
|
63
|
-
inputs: InputClass[] = [];
|
|
64
|
-
onSuccessBase: (result) => void = null;
|
|
65
|
-
onSuccess: (result) => void = null;
|
|
66
|
-
onFailed: (result) => void = null;
|
|
67
|
-
onLoad: (result) => void = null;
|
|
68
|
-
onBeforeSubmit: () => boolean = null;
|
|
69
|
-
onHideModal: () => void = null;
|
|
70
|
-
|
|
71
|
-
loadData(url): void {
|
|
72
|
-
this.loading = true;
|
|
73
|
-
new RequestClass(this.environment, this.l).send(url, Method.Post, null, null, (result) => {
|
|
74
|
-
setTimeout(() => {
|
|
75
|
-
this.setData(result);
|
|
76
|
-
this.loading = false;
|
|
77
|
-
if (this.onLoad){
|
|
78
|
-
this.onLoad(result);
|
|
79
|
-
}
|
|
80
|
-
}, 500);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
submit(onSubmit = null): void {
|
|
84
|
-
new RequestClass(this.environment, this.l).postForm(this, onSubmit);
|
|
85
|
-
}
|
|
86
|
-
check(): boolean {
|
|
87
|
-
let valid = true;
|
|
88
|
-
this.inputs.forEach(inp => {
|
|
89
|
-
if (!inp.isValid()) {
|
|
90
|
-
if (valid){
|
|
91
|
-
inp.focus();
|
|
92
|
-
}
|
|
93
|
-
valid = false;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return valid;
|
|
97
|
-
}
|
|
98
|
-
clear(): void {
|
|
99
|
-
this.method = Method.Post;
|
|
100
|
-
this.url = this.baseUrl;
|
|
101
|
-
this.setButtons(this.onTop, false);
|
|
102
|
-
this.clearInputs();
|
|
103
|
-
}
|
|
104
|
-
clearInputs(): void{
|
|
105
|
-
this.inputs.filter(x => x.type !== InputType.Constant).forEach(inp => {
|
|
106
|
-
inp.clear();
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
setButtons(formOnTop, edit: boolean, id = null): void {
|
|
110
|
-
const s = this.inputs.find(x => x.type === InputType.Submit);
|
|
111
|
-
if (!s){
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
s.name = edit ? 'Accept' : 'Save';
|
|
115
|
-
s.class = edit ? s.class.replace('green', 'blue') : s.class.replace('blue', 'green');
|
|
116
|
-
}
|
|
117
|
-
addButtons(name = 'Save', cls = 'green', clear = true, onSubmit = null): void {
|
|
118
|
-
if (this.inputs.filter(x => x.type === InputType.Submit).length > 0){
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const br = new InputClass(this.environment, this.l, null, null, InputType.Label,
|
|
122
|
-
(this.onTop ? 'space' : 'underline') + (onSubmit === null ? '' : ' m-v-5'));
|
|
123
|
-
const save = new InputClass(this.environment, this.l, name, 'fa-duotone fa-check', InputType.Submit, 'w-30 f-l ' + cls + (onSubmit === null ? ' h-30' : ' h-25'));
|
|
124
|
-
save.onClick = () => {
|
|
125
|
-
this.submit(onSubmit);
|
|
126
|
-
};
|
|
127
|
-
this.inputs.push(br);
|
|
128
|
-
this.inputs.push(save);
|
|
129
|
-
if (clear){
|
|
130
|
-
const erase = new InputClass(this.environment, this.l, null, 'fa-duotone fa-eraser', InputType.Button,
|
|
131
|
-
'f-l w-u grey' + (onSubmit === null ? ' h-30' : ' h-25'));
|
|
132
|
-
erase.onClick = () => {
|
|
133
|
-
if (this.onTop){
|
|
134
|
-
this.clear();
|
|
135
|
-
}else{
|
|
136
|
-
this.clearInputs();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
this.inputs.push(erase);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
data(d = null): any {
|
|
143
|
-
if (this.inputs.findIndex(x => x.type === InputType.File) === -1){
|
|
144
|
-
if (d == null){
|
|
145
|
-
d = {};
|
|
146
|
-
}
|
|
147
|
-
this.inputs.forEach(inp => {
|
|
148
|
-
const vl = inp.data();
|
|
149
|
-
if (vl !== null){
|
|
150
|
-
_.set(d, inp.name, vl);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}else{
|
|
154
|
-
if (d == null){
|
|
155
|
-
d = new FormData();
|
|
156
|
-
}
|
|
157
|
-
this.inputs.forEach(inp => {
|
|
158
|
-
const vl = inp.data();
|
|
159
|
-
if (vl !== null){
|
|
160
|
-
if (vl instanceof Array){
|
|
161
|
-
for (const v of vl){
|
|
162
|
-
d.append(inp.name, v);
|
|
163
|
-
}
|
|
164
|
-
}else{
|
|
165
|
-
d.append(inp.name, vl);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return d;
|
|
171
|
-
}
|
|
172
|
-
json(d = null): {} {
|
|
173
|
-
if (d == null){
|
|
174
|
-
d = {};
|
|
175
|
-
}
|
|
176
|
-
this.inputs.forEach(inp => {
|
|
177
|
-
const vl = inp.data();
|
|
178
|
-
if (vl !== null && vl !== ''){
|
|
179
|
-
if (vl instanceof Array){
|
|
180
|
-
for (const v of vl){
|
|
181
|
-
d[inp.name] = v;
|
|
182
|
-
}
|
|
183
|
-
}else{
|
|
184
|
-
d[inp.name] = vl;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
return d;
|
|
189
|
-
}
|
|
190
|
-
setData(d): void {
|
|
191
|
-
this.inputs.forEach(inp => {
|
|
192
|
-
const iv = _.get(d, inp.name);
|
|
193
|
-
if (inp.type === InputType.CarSearch){
|
|
194
|
-
const ivs = _.get(d, inp.name.replace('Id', ''));
|
|
195
|
-
inp.setValue({Search: ivs, Value: iv}, true);
|
|
196
|
-
}else if (inp.type !== InputType.Label || iv != null){
|
|
197
|
-
inp.setValue(iv, true);
|
|
198
|
-
}
|
|
199
|
-
if (inp.type === InputType.SelectAutoCompletePlaque || inp.type === InputType.SelectAutoComplete){
|
|
200
|
-
const ivs = _.get(d, inp.name.replace('Id', ''));
|
|
201
|
-
inp.setSearch(ivs);
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export class InputClass {
|
|
208
|
-
constructor(environment: any, l: (k, v?) => string, name: string, icon: string = null,
|
|
209
|
-
type: InputType = InputType.Text, cls: string = '', value = null,
|
|
210
|
-
required: boolean = true, minLength = -1, maxLength = -1) {
|
|
211
|
-
this.environment = environment;
|
|
212
|
-
this.l = l;
|
|
213
|
-
this.name = name;
|
|
214
|
-
this.loadingName = name;
|
|
215
|
-
this.placeholder = name;
|
|
216
|
-
this.icon = icon;
|
|
217
|
-
this.class = cls + ([InputType.Mobile, InputType.Phone, InputType.Password, InputType.Email, InputType.Number, InputType.Price,
|
|
218
|
-
InputType.NationalCode, InputType.Sheba, InputType.PostalCode, InputType.Date, InputType.Time].includes(type) ? ' ltr' : '');
|
|
219
|
-
this.type = type;
|
|
220
|
-
this.value = value;
|
|
221
|
-
this.default = typeof value === 'number' ? _.cloneDeep(value) : HelperClass.clone(value);
|
|
222
|
-
this.required = required;
|
|
223
|
-
this.minLength = type === InputType.Mobile || type === InputType.Phone ? 11 :
|
|
224
|
-
type === InputType.NationalCode || type === InputType.PostalCode ? 10 :
|
|
225
|
-
type === InputType.Sheba ? 24 : minLength;
|
|
226
|
-
this.maxLength = type === InputType.Mobile || type === InputType.Phone ? 11 :
|
|
227
|
-
type === InputType.NationalCode || type === InputType.PostalCode ? 10 :
|
|
228
|
-
type === InputType.Sheba ? 24 : maxLength;
|
|
229
|
-
}
|
|
230
|
-
environment: any = null;
|
|
231
|
-
l: (k, v?) => string;
|
|
232
|
-
name: string;
|
|
233
|
-
url = null;
|
|
234
|
-
urlNewTab = false;
|
|
235
|
-
loadingName: string;
|
|
236
|
-
placeholder: string;
|
|
237
|
-
id: string;
|
|
238
|
-
icon: string;
|
|
239
|
-
addNew = false;
|
|
240
|
-
class: string;
|
|
241
|
-
description: string = null;
|
|
242
|
-
type: InputType;
|
|
243
|
-
value;
|
|
244
|
-
search;
|
|
245
|
-
default;
|
|
246
|
-
required: boolean;
|
|
247
|
-
disabled = false;
|
|
248
|
-
inEditDisabled = false;
|
|
249
|
-
inEditVisible = true;
|
|
250
|
-
displayLabel = true;
|
|
251
|
-
withClear = false;
|
|
252
|
-
minLength = -1;
|
|
253
|
-
maxLength = -1;
|
|
254
|
-
error: InputError = null;
|
|
255
|
-
loading = false;
|
|
256
|
-
button = null;
|
|
257
|
-
onClickButton: () => void = null;
|
|
258
|
-
progress: Progress = null;
|
|
259
|
-
onClick: (btn) => void = null;
|
|
260
|
-
onKeyUp: (inp) => void = null;
|
|
261
|
-
onKeyDown: (e) => void = null;
|
|
262
|
-
options: OptionClass[] = [];
|
|
263
|
-
match: InputClass = null;
|
|
264
|
-
rel: InputClass = null;
|
|
265
|
-
relUrl: string = null;
|
|
266
|
-
table: TableClass;
|
|
267
|
-
style = {};
|
|
268
|
-
position = 'bottom';
|
|
269
|
-
onChange: (v, e?) => void = null;
|
|
270
|
-
hover = -1;
|
|
271
|
-
visible = true;
|
|
272
|
-
exportPdf = false;
|
|
273
|
-
open = false;
|
|
274
|
-
multiple = false;
|
|
275
|
-
onlyChild = true;
|
|
276
|
-
allowed = null;
|
|
277
|
-
row = null;
|
|
278
|
-
rows = [];
|
|
279
|
-
index = 0;
|
|
280
|
-
level = null;
|
|
281
|
-
modal: ModalClass = null;
|
|
282
|
-
nameFun: (r) => void = null;
|
|
283
|
-
onFocusOut: (e) => void = () => {};
|
|
284
|
-
focus(changeIndex: boolean = false): void {}
|
|
285
|
-
changeType: (t: InputType) => void = () => {};
|
|
286
|
-
setValue: (v, isEdit) => void = (v, isEdit) => { this.value = v; };
|
|
287
|
-
setSearch: (v) => void = () => {};
|
|
288
|
-
clear: () => void = () => { this.value = null; };
|
|
289
|
-
focusOut: () => void = () => {};
|
|
290
|
-
data: () => any = () => {
|
|
291
|
-
return this.value;
|
|
292
|
-
}
|
|
293
|
-
isValid: () => boolean = () => {
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
load(u = null, done: () => void = null): void{
|
|
297
|
-
u = u ? u : this.url;
|
|
298
|
-
if (u){
|
|
299
|
-
this.options = [];
|
|
300
|
-
this.hover = -1;
|
|
301
|
-
this.index = 0;
|
|
302
|
-
this.rows = [];
|
|
303
|
-
if (typeof u === 'string') {
|
|
304
|
-
if (!u.includes('{}')){
|
|
305
|
-
new RequestClass(this.environment, this.l).send(u ? u : this.url, Method.Post, null, this, (result) => {
|
|
306
|
-
if (this.type === InputType.SelectSearch || this.type === InputType.Select || this.type === InputType.SelectAutoComplete ||
|
|
307
|
-
this.type === InputType.SelectAutoCompletePlaque || this.type === InputType.SelectAutoCompletePlaqueM) {
|
|
308
|
-
const r = this.getOptions(result, null);
|
|
309
|
-
const s = result.find(x => x.Selected);
|
|
310
|
-
if (s) {
|
|
311
|
-
this.value = s.Id.toString();
|
|
312
|
-
}
|
|
313
|
-
this.setOptions(r);
|
|
314
|
-
} else if (this.type === InputType.Tree) {
|
|
315
|
-
this.rows = this.getRows(result, null);
|
|
316
|
-
}
|
|
317
|
-
if (done) {
|
|
318
|
-
done();
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
}else{
|
|
323
|
-
const result = [];
|
|
324
|
-
EnumUtils.getKeysAndValues(u).forEach((k) => {
|
|
325
|
-
result.push({Name: this.l(k.key), Id: k.value.toString()});
|
|
326
|
-
});
|
|
327
|
-
const r = this.getOptions(result, null);
|
|
328
|
-
this.setOptions(r);
|
|
329
|
-
}
|
|
330
|
-
} else if (this.options instanceof Array){
|
|
331
|
-
this.options.forEach(x => x.index = this.index++);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
setOptions(r): void{
|
|
335
|
-
this.options = r;
|
|
336
|
-
if (this.value != null){
|
|
337
|
-
setTimeout(() => {
|
|
338
|
-
this.setValue(this.value, true);
|
|
339
|
-
}, 500);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
getOptions(r, p, tree = true): OptionClass[]{
|
|
343
|
-
return r.filter(x => (p == null && !x.ParentId) || x.ParentId === p || !tree)
|
|
344
|
-
.map((x) => {
|
|
345
|
-
const o = new OptionClass(x.Name, x.Id.toString());
|
|
346
|
-
if (this.type === InputType.SelectAutoCompletePlaque || this.type === InputType.SelectAutoCompletePlaqueM || this.name === 'CarId'){
|
|
347
|
-
const tn = o.name.split('_');
|
|
348
|
-
if (tn.length === 4){
|
|
349
|
-
tn[1] += '‎';
|
|
350
|
-
tn[2] += ' |';
|
|
351
|
-
o.name = tn.join(' ');
|
|
352
|
-
} else if (tn.length === 2){
|
|
353
|
-
o.name = tn.join(' ');
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
o.search = x.Search;
|
|
357
|
-
o.option = x;
|
|
358
|
-
o.index = this.index++;
|
|
359
|
-
o.options = tree ? this.getOptions(r, x.Id) : [];
|
|
360
|
-
return o;
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
getRows(r, p): TreeRowClass[]{
|
|
364
|
-
const l = [];
|
|
365
|
-
r.filter(x => (p == null && !x.ParentId) || x.ParentId === p).forEach((x) => {
|
|
366
|
-
let c = this.getRows(r, x.Id);
|
|
367
|
-
c = c.length > 0 ? c : x.Children ? x.Children.map(a => new TreeRowClass(a.Name, a.Id, a.Selected)) : [];
|
|
368
|
-
let s = x.Selected === true;
|
|
369
|
-
if (this.onlyChild){
|
|
370
|
-
s = c.length === 0 ? x.Selected : (c.find(y => y.selected === false || y.selected === null) == null ? true :
|
|
371
|
-
(c.find(y => y.selected === true || y.selected === null) != null ? null : false));
|
|
372
|
-
}
|
|
373
|
-
const n = this.nameFun ? this.nameFun(x) : x.Name;
|
|
374
|
-
l.push(new TreeRowClass(n, x.Id, s, c));
|
|
375
|
-
});
|
|
376
|
-
return l;
|
|
377
|
-
}
|
|
378
|
-
getLabel(): string {
|
|
379
|
-
return HelperClass.getLabel(this);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
export class OptionClass {
|
|
384
|
-
constructor(name: string, value: string, options: OptionClass[] = [], cls: string = null) {
|
|
385
|
-
this.name = name;
|
|
386
|
-
this.value = value;
|
|
387
|
-
this.options = options;
|
|
388
|
-
this.class = cls;
|
|
389
|
-
}
|
|
390
|
-
option;
|
|
391
|
-
search: string;
|
|
392
|
-
class: string;
|
|
393
|
-
name: string;
|
|
394
|
-
value: string;
|
|
395
|
-
index: number;
|
|
396
|
-
show = true;
|
|
397
|
-
selected = false;
|
|
398
|
-
parent: OptionClass = null;
|
|
399
|
-
options: OptionClass[];
|
|
400
|
-
loading = false;
|
|
401
|
-
}
|
|
402
|
-
export class DayClass {
|
|
403
|
-
constructor(day: number, today: boolean, selected: boolean) {
|
|
404
|
-
this.day = day;
|
|
405
|
-
this.today = today;
|
|
406
|
-
this.selected = selected;
|
|
407
|
-
}
|
|
408
|
-
day: number;
|
|
409
|
-
today: boolean;
|
|
410
|
-
selected: boolean;
|
|
411
|
-
}
|
|
412
|
-
export class TreeRowClass {
|
|
413
|
-
constructor(name: string, value: string, selected: boolean = false, children: TreeRowClass[] = []) {
|
|
414
|
-
this.name = name;
|
|
415
|
-
this.value = value;
|
|
416
|
-
this.selected = selected;
|
|
417
|
-
this.children = children;
|
|
418
|
-
}
|
|
419
|
-
name: string;
|
|
420
|
-
value: string;
|
|
421
|
-
selected: boolean;
|
|
422
|
-
parent: TreeRowClass;
|
|
423
|
-
children: TreeRowClass[];
|
|
424
|
-
toggle(onlyChild: boolean = true): void {
|
|
425
|
-
if (this.selected){
|
|
426
|
-
this.unCheck(onlyChild);
|
|
427
|
-
if (onlyChild){
|
|
428
|
-
setTimeout(() => {this.unCheckParent(); });
|
|
429
|
-
}
|
|
430
|
-
}else{
|
|
431
|
-
this.check(onlyChild);
|
|
432
|
-
if (onlyChild){
|
|
433
|
-
setTimeout(() => {this.checkParent(); });
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
check(onlyChild: boolean, c: TreeRowClass = this): void {
|
|
438
|
-
c.selected = true;
|
|
439
|
-
if (onlyChild) {
|
|
440
|
-
c.checkChildren(onlyChild);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
unCheck(onlyChild: boolean, c: TreeRowClass = this): void {
|
|
444
|
-
c.selected = false;
|
|
445
|
-
if (onlyChild) {
|
|
446
|
-
c.children.forEach((ch) => {
|
|
447
|
-
this.unCheck(onlyChild, ch);
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
checkChildren(onlyChild: boolean): void{
|
|
452
|
-
this.children.forEach((ch) => {
|
|
453
|
-
this.check(onlyChild, ch);
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
checkParent(p: TreeRowClass = this.parent): void{
|
|
457
|
-
if (p){
|
|
458
|
-
if (p.children.filter(x => !x.selected).length > 0){
|
|
459
|
-
p.selected = null;
|
|
460
|
-
}else{
|
|
461
|
-
p.selected = true;
|
|
462
|
-
}
|
|
463
|
-
this.checkParent(p.parent);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
unCheckParent(p: TreeRowClass = this.parent): void{
|
|
467
|
-
if (p){
|
|
468
|
-
if (p.children.filter(x => x.selected || x.selected == null).length > 0){
|
|
469
|
-
p.selected = null;
|
|
470
|
-
}else{
|
|
471
|
-
p.selected = false;
|
|
472
|
-
}
|
|
473
|
-
this.unCheckParent(p.parent);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
export class AccordionClass {
|
|
479
|
-
constructor(l: (k, v?) => string, name: string, cls: string = '', rows: AccordionRowClass[]) {
|
|
480
|
-
this.l = l;
|
|
481
|
-
this.name = name;
|
|
482
|
-
this.class = cls;
|
|
483
|
-
this.rows = rows;
|
|
484
|
-
}
|
|
485
|
-
l: (k, v?) => string;
|
|
486
|
-
name: string;
|
|
487
|
-
class: string;
|
|
488
|
-
rows: AccordionRowClass[];
|
|
489
|
-
hasDelete = false;
|
|
490
|
-
displayLabel = false;
|
|
491
|
-
loading = false;
|
|
492
|
-
onDelete: (row) => void = null;
|
|
493
|
-
check(): boolean{
|
|
494
|
-
for (const row of this.rows){
|
|
495
|
-
if (!row.form.check()){
|
|
496
|
-
row.open();
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
return true;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
export class AccordionRowClass {
|
|
505
|
-
constructor(id: string, name: string, form: FormClass = null, table: TableClass = null) {
|
|
506
|
-
this.id = id;
|
|
507
|
-
this.name = name;
|
|
508
|
-
this.form = form;
|
|
509
|
-
this.table = table;
|
|
510
|
-
}
|
|
511
|
-
id: string;
|
|
512
|
-
name: string;
|
|
513
|
-
show = true;
|
|
514
|
-
form: FormClass;
|
|
515
|
-
table: TableClass;
|
|
516
|
-
toggle(): void {
|
|
517
|
-
setTimeout(() => {
|
|
518
|
-
$('#AccordionRow' + this.id + ' > .header').click();
|
|
519
|
-
}, 100);
|
|
520
|
-
}
|
|
521
|
-
open(): void {
|
|
522
|
-
setTimeout(() => {
|
|
523
|
-
if (!$('#AccordionRow' + this.id + ' > .content').hasClass('open')){
|
|
524
|
-
$('#AccordionRow' + this.id + ' > .header').click();
|
|
525
|
-
}
|
|
526
|
-
}, 100);
|
|
527
|
-
}
|
|
528
|
-
}
|