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,283 +0,0 @@
|
|
|
1
|
-
import {InputError} from './enum.class';
|
|
2
|
-
import {InputClass} from './form.class';
|
|
3
|
-
import * as moment from 'jalali-moment';
|
|
4
|
-
import * as $ from 'jquery';
|
|
5
|
-
|
|
6
|
-
// @dynamic
|
|
7
|
-
export class HelperClass {
|
|
8
|
-
static getLabel(inp: InputClass): string {
|
|
9
|
-
if (inp.error === InputError.Required) {
|
|
10
|
-
return inp.l('FormErrorRequired', inp.name);
|
|
11
|
-
} else if (inp.error === InputError.Invalid) {
|
|
12
|
-
return inp.l('FormErrorInvalid', inp.name);
|
|
13
|
-
} else if (inp.error === InputError.Length) {
|
|
14
|
-
return inp.l('FormErrorLength', [inp.name, inp.minLength]);
|
|
15
|
-
} else if (inp.error === InputError.MinLength) {
|
|
16
|
-
return inp.l('FormErrorMinLength', [inp.name, inp.minLength]);
|
|
17
|
-
} else if (inp.error === InputError.MaxLength) {
|
|
18
|
-
return inp.l('FormErrorMaxLength', [inp.name, inp.maxLength]);
|
|
19
|
-
} else if (inp.error === InputError.MinAmount) {
|
|
20
|
-
return inp.l('FormErrorMinAmount', [inp.name, inp.minLength]);
|
|
21
|
-
} else if (inp.error === InputError.MaxAmount) {
|
|
22
|
-
return inp.l('FormErrorMaxAmount', [inp.name, inp.maxLength]);
|
|
23
|
-
} else if (inp.error === InputError.Expired) {
|
|
24
|
-
return inp.l('FormErrorExpired', inp.name);
|
|
25
|
-
} else if (inp.error === InputError.Wrong) {
|
|
26
|
-
return inp.l('FormErrorWrong', inp.name);
|
|
27
|
-
} else if (inp.error === InputError.Error) {
|
|
28
|
-
return inp.l('FormError', inp.name);
|
|
29
|
-
} else if (inp.error === InputError.NotMatch) {
|
|
30
|
-
return inp.l('FormErrorNotMatch', inp.match.name);
|
|
31
|
-
} else if (inp.error === InputError.Exist) {
|
|
32
|
-
return inp.l('FormErrorExist', inp.name);
|
|
33
|
-
} else if (inp.error === InputError.NotExist) {
|
|
34
|
-
return inp.l('FormErrorNotExist', inp.name);
|
|
35
|
-
} else if (inp.error === InputError.NotAllowed) {
|
|
36
|
-
return inp.l('FormErrorNotAllowed', [inp.name, inp.allowed.join(', ')]);
|
|
37
|
-
} else if (inp.error === InputError.MaxContent) {
|
|
38
|
-
return inp.l('FormErrorMaxContent', [inp.name, inp.maxLength]);
|
|
39
|
-
} else if (inp.error === InputError.Upload) {
|
|
40
|
-
return inp.l('FormErrorUpload', inp.name);
|
|
41
|
-
}
|
|
42
|
-
const desc = inp.description !== null ? ' (' + inp.l(inp.description) + ')' : '';
|
|
43
|
-
return inp.l(inp.name) + desc;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
static nationalCodeValid(c): boolean {
|
|
47
|
-
if (!RegExp(/^\d{10}$/).test(c) || RegExp(/^(.)\1+$/).test(c)) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
const check = parseInt(c[9], 10);
|
|
51
|
-
let sum = 0;
|
|
52
|
-
for (let i = 0; i < 9; ++i) {
|
|
53
|
-
sum += parseInt(c[i], 10) * (10 - i);
|
|
54
|
-
}
|
|
55
|
-
sum %= 11;
|
|
56
|
-
return (sum < 2 && check === sum) || (sum >= 2 && check + sum === 11);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static iso7064Mod97_10(iban): number{
|
|
60
|
-
let remainder = iban;
|
|
61
|
-
while (remainder.length > 2){
|
|
62
|
-
const block = remainder.slice(0, 9);
|
|
63
|
-
remainder = parseInt(block, 10) % 97 + remainder.slice(block.length);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return parseInt(remainder, 10) % 97;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static shebaValid(str): boolean {
|
|
70
|
-
const pattern = /IR[0-9]{24}/;
|
|
71
|
-
if (!str.startWith('IR')){
|
|
72
|
-
str = 'IR' + str;
|
|
73
|
-
}
|
|
74
|
-
if (str.length !== 26) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!pattern.test(str)) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
let newStr = str.substr(4);
|
|
83
|
-
const d1 = str.charCodeAt(0) - 65 + 10;
|
|
84
|
-
const d2 = str.charCodeAt(1) - 65 + 10;
|
|
85
|
-
newStr += d1.toString() + d2.toString() + str.substr(2, 2);
|
|
86
|
-
|
|
87
|
-
return this.iso7064Mod97_10(newStr) === 1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
static postalCodeValid(c): boolean {
|
|
91
|
-
return RegExp(/^\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b$/).test(c);
|
|
92
|
-
}
|
|
93
|
-
static random(length, upper = true, lower = true, num = true): string {
|
|
94
|
-
let result = '';
|
|
95
|
-
const characters = `${upper ? 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' : ''}${lower ? 'abcdefghijklmnopqrstuvwxyz' : ''}${num ? '123456789' : ''}`;
|
|
96
|
-
const charactersLength = characters.length;
|
|
97
|
-
for (let i = 0; i < length; i++ ) {
|
|
98
|
-
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
99
|
-
}
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
static setCookie(name, value, days): void {
|
|
103
|
-
let expires = '';
|
|
104
|
-
if (days) {
|
|
105
|
-
const date = new Date();
|
|
106
|
-
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
107
|
-
expires = '; expires=' + date.toUTCString();
|
|
108
|
-
}
|
|
109
|
-
document.cookie = name + '=' + (value || '') + expires + '; path=/';
|
|
110
|
-
}
|
|
111
|
-
static getCookie(name): string {
|
|
112
|
-
const nameEQ = name + '=';
|
|
113
|
-
const ca = document.cookie.split(';');
|
|
114
|
-
for (let c of ca) {
|
|
115
|
-
while (c.charAt(0) === ' '){
|
|
116
|
-
c = c.substring(1, c.length);
|
|
117
|
-
}
|
|
118
|
-
if (c.indexOf(nameEQ) === 0){
|
|
119
|
-
return c.substring(nameEQ.length, c.length);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
static eraseCookie(name): void {
|
|
125
|
-
document.cookie.split(';')
|
|
126
|
-
.forEach((c) => { document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/'); });
|
|
127
|
-
}
|
|
128
|
-
static getDateDif(l, dt: string): string{
|
|
129
|
-
const d = parseInt(dt.substring(6, dt.length - 2), 10);
|
|
130
|
-
const now = moment.now();
|
|
131
|
-
const dif = (now - d) / 1000;
|
|
132
|
-
const h = Math.floor(dif / 3600);
|
|
133
|
-
const m = Math.floor(dif % 3600 / 60);
|
|
134
|
-
if (h < 24)
|
|
135
|
-
{
|
|
136
|
-
let r = h > 0 ? l('HourP', h.toString()) : '';
|
|
137
|
-
r += r !== '' && m > 0 ? l('And') : '';
|
|
138
|
-
r += m > 0 ? l('MinuteP', m.toString()) : '';
|
|
139
|
-
r += r !== '' ? '' : l('AFew');
|
|
140
|
-
r += ' ' + l('Ago');
|
|
141
|
-
return r;
|
|
142
|
-
}
|
|
143
|
-
return '<div class="ltr">' + moment(d).locale('fa').format('jYYYY/jMM/jDD HH:mm') + '</div>';
|
|
144
|
-
}
|
|
145
|
-
static getRowEnum(l, e, dt): string{
|
|
146
|
-
const v = e.find(x => x.Value === dt);
|
|
147
|
-
return `<span class="status ${v.Class}">` + l(v.Name) + '</span>';
|
|
148
|
-
}
|
|
149
|
-
static getNow(): any{
|
|
150
|
-
return moment.now();
|
|
151
|
-
}
|
|
152
|
-
static getMoment(i = null, f = null): any{
|
|
153
|
-
if (i == null){
|
|
154
|
-
return moment();
|
|
155
|
-
}
|
|
156
|
-
return moment(i, f);
|
|
157
|
-
}
|
|
158
|
-
static getDateRemain(l, dt: string): string{
|
|
159
|
-
const d = parseInt(dt.substring(6, dt.length - 2), 10);
|
|
160
|
-
const now = moment.now();
|
|
161
|
-
const dif = (d - now) / 1000;
|
|
162
|
-
if (dif <= 0)
|
|
163
|
-
{
|
|
164
|
-
return l('Ended');
|
|
165
|
-
}
|
|
166
|
-
const h = Math.floor(dif / 3600);
|
|
167
|
-
const m = Math.floor(dif % 3600 / 60);
|
|
168
|
-
if (h < 24)
|
|
169
|
-
{
|
|
170
|
-
let r = h > 0 ? l('HourP', h.toString()) : '';
|
|
171
|
-
r += r !== '' && m > 0 ? l('And') : '';
|
|
172
|
-
r += m > 0 ? l('MinuteP', m.toString()) : '';
|
|
173
|
-
r += r !== '' ? '' : l('AFew');
|
|
174
|
-
r += ' ' + l('Later');
|
|
175
|
-
return r;
|
|
176
|
-
}
|
|
177
|
-
return '<div class="ltr">' + moment(d).locale('fa').format('jYYYY/jMM/jDD HH:mm') + '</div>';
|
|
178
|
-
}
|
|
179
|
-
static getDate(dt: string): string{
|
|
180
|
-
try {
|
|
181
|
-
if (dt === null){
|
|
182
|
-
return '';
|
|
183
|
-
}
|
|
184
|
-
const d = parseInt(dt.substring(6, dt.length - 2), 10);
|
|
185
|
-
return moment(d).locale('fa').format('jYYYY/jMM/jDD');
|
|
186
|
-
}catch (e) {
|
|
187
|
-
return dt;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
static getTime(dt: any): string{
|
|
191
|
-
try {
|
|
192
|
-
if (dt === null){
|
|
193
|
-
return '';
|
|
194
|
-
}
|
|
195
|
-
return `${(dt.Hours > 9 ? dt.Hours : `0${dt.Hours}`)}:${(dt.Minutes > 9 ? dt.Minutes : `0${dt.Minutes}`)}`;
|
|
196
|
-
}catch (e) {
|
|
197
|
-
return dt;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
static getDateTime(dt: string): string{
|
|
201
|
-
if (dt === null){
|
|
202
|
-
return '';
|
|
203
|
-
}
|
|
204
|
-
const d = parseInt(dt.substring(6, dt.length - 2), 10);
|
|
205
|
-
return moment(d).locale('fa').format('jYYYY/jMM/jDD HH:mm');
|
|
206
|
-
}
|
|
207
|
-
static getFileSize(bytes: number): string {
|
|
208
|
-
const suffix = [ 'B', 'KB', 'MB', 'GB', 'TB'];
|
|
209
|
-
let dblSByte = bytes;
|
|
210
|
-
let i = 0;
|
|
211
|
-
for (; i < suffix.length && bytes >= 1024; i++, bytes /= 1024)
|
|
212
|
-
{
|
|
213
|
-
dblSByte = bytes / 1024.0;
|
|
214
|
-
}
|
|
215
|
-
return `${dblSByte.toLocaleString('en-US', {
|
|
216
|
-
minimumFractionDigits: 0,
|
|
217
|
-
maximumFractionDigits: 1,
|
|
218
|
-
})} ${suffix[i]}`;
|
|
219
|
-
}
|
|
220
|
-
static getPDate(l, s): string{
|
|
221
|
-
return s.replace(/Hour/g, l('Hour'))
|
|
222
|
-
.replace(/LessThanMinute/g, l('LessThanMinute'))
|
|
223
|
-
.replace(/Minute/g, l('Minute'))
|
|
224
|
-
.replace(/And/g, l('And'))
|
|
225
|
-
.replace(/AFew/g, l('AFew'))
|
|
226
|
-
.replace(/Finished/g, l('Finished'))
|
|
227
|
-
.replace(/Day/g, l('Day'))
|
|
228
|
-
.replace(/Later/g, l('Later'))
|
|
229
|
-
.replace(/Ago/g, l('Ago'));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
static clone<T>(v: T): T {
|
|
233
|
-
if (v == null){
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
const copy = new (v.constructor as { new() })();
|
|
237
|
-
Object.assign(copy, v);
|
|
238
|
-
return copy;
|
|
239
|
-
}
|
|
240
|
-
static cloneJson(inp): any {
|
|
241
|
-
return JSON.parse(JSON.stringify(inp));
|
|
242
|
-
}
|
|
243
|
-
static getName(n): string{
|
|
244
|
-
return n.replace(/ک/g, 'ك').replace(/ی/g, 'ي').replace(/آ/g, 'آ');
|
|
245
|
-
}
|
|
246
|
-
static addNotification(m, e = true): void{
|
|
247
|
-
const id = HelperClass.random(20);
|
|
248
|
-
// tslint:disable-next-line
|
|
249
|
-
$('#Notifications').append('<div id="' + id + '" class="con"><div class="item ' + (e ? 'error' : 'success') + '"><i class="fas fa-times"></i><div>' + m + '</div></div></div>');
|
|
250
|
-
setTimeout(() => {
|
|
251
|
-
const d = $('#' + id);
|
|
252
|
-
d.fadeOut(300, () => {
|
|
253
|
-
d.remove();
|
|
254
|
-
});
|
|
255
|
-
}, 5000);
|
|
256
|
-
}
|
|
257
|
-
static checkCartDigit(code): boolean{
|
|
258
|
-
const l = code.length;
|
|
259
|
-
if (l < 16 || parseInt(code.substr(1, 10), 10) === 0 ||
|
|
260
|
-
parseInt(code.substr(10, 6), 10) === 0) {
|
|
261
|
-
return false;
|
|
262
|
-
}
|
|
263
|
-
let s = 0;
|
|
264
|
-
for (let i = 0; i < 16; i++){
|
|
265
|
-
const k = i % 2 === 0 ? 2 : 1;
|
|
266
|
-
const d = parseInt(code.substr(i, 1), 10) * k;
|
|
267
|
-
s += d > 9 ? d - 9 : d;
|
|
268
|
-
}
|
|
269
|
-
return s % 10 === 0;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
static getData(key, state, parent): any {
|
|
273
|
-
const data = [];
|
|
274
|
-
if (parent && parent.snapshot.data && parent.snapshot.data[key]) {
|
|
275
|
-
data.push(parent.snapshot.data[key]);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (state && parent) {
|
|
279
|
-
data.push(...this.getData(key, state, state.firstChild(parent)));
|
|
280
|
-
}
|
|
281
|
-
return data;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as _ from 'lodash';
|
|
2
|
-
import {strings as publicStrings} from './string.class';
|
|
3
|
-
|
|
4
|
-
// @dynamic
|
|
5
|
-
export class LangClass {
|
|
6
|
-
lang: {};
|
|
7
|
-
constructor(d: string, strings: {}) {
|
|
8
|
-
this.lang = _.merge(publicStrings[d], strings[d]);
|
|
9
|
-
}
|
|
10
|
-
get(area, c, k, v = null): string {
|
|
11
|
-
let cv = _.get(this.lang, area ? `${area}.${c}.${k}` : `${c}.${k}`);
|
|
12
|
-
if (!cv){
|
|
13
|
-
cv = _.get(this.lang, `Public.${c}.${k}`);
|
|
14
|
-
}
|
|
15
|
-
if (!cv){
|
|
16
|
-
cv = _.get(this.lang, `Public.${k}`);
|
|
17
|
-
}
|
|
18
|
-
if (!cv){
|
|
19
|
-
return k;
|
|
20
|
-
}
|
|
21
|
-
if (v !== null) {
|
|
22
|
-
if (v.constructor === Array) {
|
|
23
|
-
v.forEach((x) => {
|
|
24
|
-
cv = cv.replace('{}', this.get(area, c, x, null));
|
|
25
|
-
});
|
|
26
|
-
} else {
|
|
27
|
-
cv = cv.replace('{}', this.get(area, c, v, null));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return cv;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {FormClass} from './form.class';
|
|
2
|
-
import {HelperClass} from './helper.class';
|
|
3
|
-
|
|
4
|
-
export class LoginClass {
|
|
5
|
-
constructor(type: string) {
|
|
6
|
-
this.type = type;
|
|
7
|
-
}
|
|
8
|
-
type: string;
|
|
9
|
-
steps: LoginStepClass[] = [];
|
|
10
|
-
active = 0;
|
|
11
|
-
onSuccess: (result) => void = null;
|
|
12
|
-
sendCodeUrl: string;
|
|
13
|
-
reSendCodeUrl: string;
|
|
14
|
-
loginUrl: string;
|
|
15
|
-
setCookie(r): void{
|
|
16
|
-
if (r.Token){
|
|
17
|
-
HelperClass.setCookie('Authorization', `Bearer ${r.Token}`, 30);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export class LoginStepClass{
|
|
22
|
-
constructor(form: FormClass) {
|
|
23
|
-
this.form = form;
|
|
24
|
-
}
|
|
25
|
-
form: FormClass = null;
|
|
26
|
-
show(result: any = null): void {}
|
|
27
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {AccordionClass, FormClass} from './form.class';
|
|
2
|
-
import * as $ from 'jquery';
|
|
3
|
-
import {InputType} from './enum.class';
|
|
4
|
-
import {TableClass} from './table.class';
|
|
5
|
-
|
|
6
|
-
export class ModalClass {
|
|
7
|
-
constructor(environment: any, l: (k, v?) => string, name: string, cls: string = '') {
|
|
8
|
-
this.environment = environment;
|
|
9
|
-
this.l = l;
|
|
10
|
-
this.name = name;
|
|
11
|
-
this.id = this.name;
|
|
12
|
-
this.class = cls;
|
|
13
|
-
}
|
|
14
|
-
environment: any = null;
|
|
15
|
-
l: (k, v?) => string;
|
|
16
|
-
name: string;
|
|
17
|
-
id: string;
|
|
18
|
-
class: string;
|
|
19
|
-
relatedId: null;
|
|
20
|
-
form: FormClass = null;
|
|
21
|
-
firstForm = true;
|
|
22
|
-
table: TableClass = null;
|
|
23
|
-
accordion: AccordionClass = null;
|
|
24
|
-
onShow: () => void = null;
|
|
25
|
-
onHide: () => void = null;
|
|
26
|
-
show(): void{
|
|
27
|
-
if (this.onShow){
|
|
28
|
-
this.onShow();
|
|
29
|
-
}
|
|
30
|
-
$('body').addClass('open-modal');
|
|
31
|
-
$('#' + this.id + 'Modal').fadeIn(300, () => {
|
|
32
|
-
if (this.form != null){
|
|
33
|
-
const i = this.form.inputs.find(x => !x.disabled && x.type !== InputType.Label && x.type !== InputType.Hidden &&
|
|
34
|
-
x.type !== InputType.Constant && x.type !== InputType.Submit && x.type !== InputType.Button && x.type !== InputType.Icon &&
|
|
35
|
-
x.type !== InputType.Check);
|
|
36
|
-
if (i){
|
|
37
|
-
i.focus();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
hide(): void{
|
|
43
|
-
$('body').removeClass('open-modal');
|
|
44
|
-
$('#' + this.id + 'Modal').fadeOut(300, () => {
|
|
45
|
-
if (this.form && this.form.name !== 'Confirm' && this.form.name !== 'Alert'){
|
|
46
|
-
this.form.clear();
|
|
47
|
-
if (this.form.onHideModal){
|
|
48
|
-
this.form.onHideModal();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (this.table && this.table.form){
|
|
52
|
-
this.table.form.clear();
|
|
53
|
-
}
|
|
54
|
-
if (this.onHide){
|
|
55
|
-
this.onHide();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {PermissionAccessTypeEnum, PermissionInputActionEnum, PermissionInputTypeEnum, PermissionTypeEnum} from './enum.class';
|
|
2
|
-
import {ModalClass} from './modal.class';
|
|
3
|
-
|
|
4
|
-
export class PermissionClass {
|
|
5
|
-
constructor(public Name: string = '', public Icon: string = '', public Type: PermissionTypeEnum = null,
|
|
6
|
-
public InputType: PermissionInputTypeEnum = null, public AccessType: PermissionAccessTypeEnum = null,
|
|
7
|
-
public InputAction: PermissionInputActionEnum = null, public Area: string = '', public Controller: string = '',
|
|
8
|
-
public Action: string = '', public Condition: string = null, public Accesses: PermissionClass[] = []) {
|
|
9
|
-
}
|
|
10
|
-
Modal: ModalClass;
|
|
11
|
-
RelatedId: string = null;
|
|
12
|
-
OnClick: (btn) => void = null;
|
|
13
|
-
getAccessByName(a: string): PermissionClass{
|
|
14
|
-
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access);
|
|
15
|
-
return c.length > 0 ? c[0] : null;
|
|
16
|
-
}
|
|
17
|
-
getAccess(at: PermissionAccessTypeEnum): PermissionClass{
|
|
18
|
-
const c = this.Accesses.filter(x => x.AccessType === at && x.Type === PermissionTypeEnum.Access);
|
|
19
|
-
return c.length > 0 ? c[0] : null;
|
|
20
|
-
}
|
|
21
|
-
hasAccessByName(a: string): boolean{
|
|
22
|
-
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access).length > 0;
|
|
23
|
-
}
|
|
24
|
-
hasAccess(at: PermissionAccessTypeEnum): boolean{
|
|
25
|
-
return this.Accesses.filter(x => x.AccessType === at && x.Type === PermissionTypeEnum.Access).length > 0;
|
|
26
|
-
}
|
|
27
|
-
getAccesses(): PermissionClass[]{
|
|
28
|
-
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Access);
|
|
29
|
-
}
|
|
30
|
-
delete(a: string): void{
|
|
31
|
-
this.Accesses = this.Accesses.filter(x => x.Action !== a);
|
|
32
|
-
}
|
|
33
|
-
hasOptionByName(a: string): boolean{
|
|
34
|
-
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option).length > 0;
|
|
35
|
-
}
|
|
36
|
-
hasOption(at: PermissionAccessTypeEnum): boolean{
|
|
37
|
-
return this.Accesses.filter(x => x.AccessType === at && x.Type === PermissionTypeEnum.Option).length > 0;
|
|
38
|
-
}
|
|
39
|
-
getOptions(): PermissionClass[]{
|
|
40
|
-
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Option);
|
|
41
|
-
}
|
|
42
|
-
getOptionByName(a: string): PermissionClass{
|
|
43
|
-
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option);
|
|
44
|
-
return c.length > 0 ? c[0] : null;
|
|
45
|
-
}
|
|
46
|
-
getOption(at: PermissionAccessTypeEnum): PermissionClass{
|
|
47
|
-
const c = this.Accesses.filter(x => x.AccessType === at && x.Type === PermissionTypeEnum.Option);
|
|
48
|
-
return c.length > 0 ? c[0] : null;
|
|
49
|
-
}
|
|
50
|
-
getUrl(): string{
|
|
51
|
-
return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
|
|
52
|
-
(this.RelatedId ? `${this.RelatedId}/` : '') +
|
|
53
|
-
(this.Action ? this.Action : '');
|
|
54
|
-
}
|
|
55
|
-
}
|