ps-toolkit-ui 0.0.210 → 0.0.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/karma.conf.js +32 -0
- package/ng-package.json +16 -0
- package/package.json +19 -22
- package/src/lib/classes/chart.class.ts +140 -0
- package/src/lib/classes/enum.class.ts +193 -0
- package/src/lib/classes/excel.class.ts +46 -0
- package/src/lib/classes/form.class.ts +528 -0
- package/src/lib/classes/helper.class.ts +283 -0
- package/src/lib/classes/lang.class.ts +32 -0
- package/src/lib/classes/login.class.ts +27 -0
- package/src/lib/classes/modal.class.ts +59 -0
- package/src/lib/classes/permission.class.ts +55 -0
- package/src/lib/classes/request.class.ts +255 -0
- package/src/lib/classes/safestyle.class.ts +4 -0
- package/src/lib/classes/sidebar.class.ts +20 -0
- package/src/lib/classes/steps.class.ts +19 -0
- package/src/lib/classes/string.class.ts +219 -0
- package/src/lib/classes/table.class.ts +228 -0
- package/src/lib/components/accordion/accordion.component.css +116 -0
- package/src/lib/components/accordion/accordion.component.html +19 -0
- package/src/lib/components/accordion/accordion.component.ts +41 -0
- package/src/lib/components/alert/alert.component.css +112 -0
- package/src/lib/components/alert/alert.component.html +1 -0
- package/src/lib/components/alert/alert.component.ts +35 -0
- package/src/lib/components/base.component.ts +38 -0
- package/src/lib/components/calendar/calendar.component.css +206 -0
- package/src/lib/components/calendar/calendar.component.html +36 -0
- package/src/lib/components/calendar/calendar.component.ts +99 -0
- package/src/lib/components/chart/chart.component.css +24 -0
- package/src/lib/components/chart/chart.component.html +6 -0
- package/src/lib/components/chart/chart.component.ts +14 -0
- package/src/lib/components/clock/clock.component.css +141 -0
- package/src/lib/components/clock/clock.component.html +10 -0
- package/src/lib/components/clock/clock.component.ts +37 -0
- package/src/lib/components/confirm/confirm.component.css +112 -0
- package/src/lib/components/confirm/confirm.component.html +1 -0
- package/src/lib/components/confirm/confirm.component.ts +47 -0
- package/src/lib/components/footer/footer.component.css +46 -0
- package/src/lib/components/footer/footer.component.html +9 -0
- package/src/lib/components/footer/footer.component.ts +18 -0
- package/src/lib/components/form/bank-card/form.bank-card.component.css +115 -0
- package/src/lib/components/form/bank-card/form.bank-card.component.html +13 -0
- package/src/lib/components/form/bank-card/form.bank-card.component.ts +144 -0
- package/src/lib/components/form/button/form.button.component.css +222 -0
- package/src/lib/components/form/button/form.button.component.html +16 -0
- package/src/lib/components/form/button/form.button.component.ts +65 -0
- package/src/lib/components/form/car/form.car.component.css +287 -0
- package/src/lib/components/form/car/form.car.component.html +11 -0
- package/src/lib/components/form/car/form.car.component.ts +82 -0
- package/src/lib/components/form/car/search/form.car.search.component.css +287 -0
- package/src/lib/components/form/car/search/form.car.search.component.html +15 -0
- package/src/lib/components/form/car/search/form.car.search.component.ts +170 -0
- package/src/lib/components/form/checkbox/form.checkbox.component.css +128 -0
- package/src/lib/components/form/checkbox/form.checkbox.component.html +8 -0
- package/src/lib/components/form/checkbox/form.checkbox.component.ts +64 -0
- package/src/lib/components/form/date/form.date.component.css +310 -0
- package/src/lib/components/form/date/form.date.component.html +46 -0
- package/src/lib/components/form/date/form.date.component.ts +247 -0
- package/src/lib/components/form/datetime/form.datetime.component.css +157 -0
- package/src/lib/components/form/datetime/form.datetime.component.html +11 -0
- package/src/lib/components/form/datetime/form.datetime.component.ts +98 -0
- package/src/lib/components/form/file/form.file.component.css +151 -0
- package/src/lib/components/form/file/form.file.component.html +12 -0
- package/src/lib/components/form/file/form.file.component.ts +130 -0
- package/src/lib/components/form/finger/form.finger.component.css +215 -0
- package/src/lib/components/form/finger/form.finger.component.html +59 -0
- package/src/lib/components/form/finger/form.finger.component.ts +131 -0
- package/src/lib/components/form/hidden/form.hidden.component.css +0 -0
- package/src/lib/components/form/hidden/form.hidden.component.html +0 -0
- package/src/lib/components/form/hidden/form.hidden.component.ts +29 -0
- package/src/lib/components/form/icon/form.icon.component.css +108 -0
- package/src/lib/components/form/icon/form.icon.component.html +14 -0
- package/src/lib/components/form/icon/form.icon.component.ts +73 -0
- package/src/lib/components/form/index/form.component.css +89 -0
- package/src/lib/components/form/index/form.component.html +35 -0
- package/src/lib/components/form/index/form.component.ts +45 -0
- package/src/lib/components/form/label/form.label.component.css +45 -0
- package/src/lib/components/form/label/form.label.component.html +2 -0
- package/src/lib/components/form/label/form.label.component.ts +30 -0
- package/src/lib/components/form/plaque/form.plaque.component.css +76 -0
- package/src/lib/components/form/plaque/form.plaque.component.html +10 -0
- package/src/lib/components/form/plaque/form.plaque.component.ts +178 -0
- package/src/lib/components/form/plaque/select/form.plaque.select.component.css +167 -0
- package/src/lib/components/form/plaque/select/form.plaque.select.component.html +19 -0
- package/src/lib/components/form/plaque/select/form.plaque.select.component.ts +385 -0
- package/src/lib/components/form/radio/form.radio.component.css +158 -0
- package/src/lib/components/form/radio/form.radio.component.html +16 -0
- package/src/lib/components/form/radio/form.radio.component.ts +78 -0
- package/src/lib/components/form/select/form.select.component.css +326 -0
- package/src/lib/components/form/select/form.select.component.html +16 -0
- package/src/lib/components/form/select/form.select.component.ts +358 -0
- package/src/lib/components/form/select/item/form.select.item.component.css +59 -0
- package/src/lib/components/form/select/item/form.select.item.component.html +10 -0
- package/src/lib/components/form/select/item/form.select.item.component.ts +40 -0
- package/src/lib/components/form/table/form.table.component.css +50 -0
- package/src/lib/components/form/table/form.table.component.html +8 -0
- package/src/lib/components/form/table/form.table.component.ts +94 -0
- package/src/lib/components/form/textarea/form.textarea.component.css +109 -0
- package/src/lib/components/form/textarea/form.textarea.component.html +10 -0
- package/src/lib/components/form/textarea/form.textarea.component.ts +76 -0
- package/src/lib/components/form/textbox/form.textbox.component.css +296 -0
- package/src/lib/components/form/textbox/form.textbox.component.html +13 -0
- package/src/lib/components/form/textbox/form.textbox.component.ts +185 -0
- package/src/lib/components/form/time/form.time.component.css +205 -0
- package/src/lib/components/form/time/form.time.component.html +22 -0
- package/src/lib/components/form/time/form.time.component.ts +139 -0
- package/src/lib/components/form/tree/form.tree.component.css +109 -0
- package/src/lib/components/form/tree/form.tree.component.html +11 -0
- package/src/lib/components/form/tree/form.tree.component.ts +98 -0
- package/src/lib/components/form/tree/item/form.tree.item.component.css +142 -0
- package/src/lib/components/form/tree/item/form.tree.item.component.html +9 -0
- package/src/lib/components/form/tree/item/form.tree.item.component.ts +49 -0
- package/src/lib/components/header/header.component.css +57 -0
- package/src/lib/components/header/header.component.html +5 -0
- package/src/lib/components/header/header.component.ts +28 -0
- package/src/lib/components/header/sub/sub.header.component.css +62 -0
- package/src/lib/components/header/sub/sub.header.component.html +8 -0
- package/src/lib/components/header/sub/sub.header.component.ts +11 -0
- package/src/lib/components/layout/layout.component.css +300 -0
- package/src/lib/components/layout/layout.component.html +20 -0
- package/src/lib/components/layout/layout.component.ts +21 -0
- package/src/lib/components/loading/loading.component.css +39 -0
- package/src/lib/components/loading/loading.component.html +8 -0
- package/src/lib/components/loading/loading.component.ts +18 -0
- package/src/lib/components/login/login.component.css +389 -0
- package/src/lib/components/login/login.component.html +27 -0
- package/src/lib/components/login/login.component.ts +145 -0
- package/src/lib/components/modal/modal.component.css +60 -0
- package/src/lib/components/modal/modal.component.html +12 -0
- package/src/lib/components/modal/modal.component.ts +23 -0
- package/src/lib/components/notfound/notfound.component.css +134 -0
- package/src/lib/components/notfound/notfound.component.html +10 -0
- package/src/lib/components/notfound/notfound.component.ts +25 -0
- package/src/lib/components/notification/notification.component.css +45 -0
- package/src/lib/components/notification/notification.component.html +2 -0
- package/src/lib/components/notification/notification.component.ts +11 -0
- package/src/lib/components/sidebar/item/sidebar.item.component.css +236 -0
- package/src/lib/components/sidebar/item/sidebar.item.component.html +16 -0
- package/src/lib/components/sidebar/item/sidebar.item.component.ts +54 -0
- package/src/lib/components/sidebar/sidebar.component.css +42 -0
- package/src/lib/components/sidebar/sidebar.component.html +10 -0
- package/src/lib/components/sidebar/sidebar.component.ts +60 -0
- package/src/lib/components/steps/steps.component.css +320 -0
- package/src/lib/components/steps/steps.component.html +18 -0
- package/src/lib/components/steps/steps.component.ts +44 -0
- package/src/lib/components/table/loading/table.loading.component.css +29 -0
- package/src/lib/components/table/loading/table.loading.component.html +9 -0
- package/src/lib/components/table/loading/table.loading.component.ts +14 -0
- package/src/lib/components/table/pagination/table.pagination.component.css +138 -0
- package/src/lib/components/table/pagination/table.pagination.component.html +9 -0
- package/src/lib/components/table/pagination/table.pagination.component.ts +89 -0
- package/src/lib/components/table/report/table.report.component.css +125 -0
- package/src/lib/components/table/report/table.report.component.html +19 -0
- package/src/lib/components/table/report/table.report.component.ts +238 -0
- package/src/lib/components/table/row/table.row.component.css +170 -0
- package/src/lib/components/table/row/table.row.component.html +21 -0
- package/src/lib/components/table/row/table.row.component.ts +373 -0
- package/src/lib/components/table/table.component.css +116 -0
- package/src/lib/components/table/table.component.html +62 -0
- package/src/lib/components/table/table.component.ts +180 -0
- package/src/lib/components/tooltip/tooltip.component.css +159 -0
- package/src/lib/components/tooltip/tooltip.component.html +1 -0
- package/src/lib/components/tooltip/tooltip.component.ts +15 -0
- package/src/lib/ps-toolkit-ui.module.ts +94 -0
- package/src/lib/services/config.service.ts +8 -0
- package/{public-api.d.ts → src/public-api.ts} +53 -48
- package/src/test.ts +26 -0
- package/tsconfig.lib.json +25 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/tslint.json +17 -0
- package/bundles/ps-toolkit-ui.umd.js +0 -7646
- package/bundles/ps-toolkit-ui.umd.js.map +0 -1
- package/bundles/ps-toolkit-ui.umd.min.js +0 -2
- package/bundles/ps-toolkit-ui.umd.min.js.map +0 -1
- package/esm2015/lib/classes/chart.class.js +0 -140
- package/esm2015/lib/classes/enum.class.js +0 -187
- package/esm2015/lib/classes/form.class.js +0 -481
- package/esm2015/lib/classes/helper.class.js +0 -284
- package/esm2015/lib/classes/lang.class.js +0 -32
- package/esm2015/lib/classes/login.class.js +0 -22
- package/esm2015/lib/classes/modal.class.js +0 -52
- package/esm2015/lib/classes/permission.class.js +0 -61
- package/esm2015/lib/classes/request.class.js +0 -256
- package/esm2015/lib/classes/safestyle.class.js +0 -15
- package/esm2015/lib/classes/sidebar.class.js +0 -14
- package/esm2015/lib/classes/steps.class.js +0 -20
- package/esm2015/lib/classes/string.class.js +0 -220
- package/esm2015/lib/classes/table.class.js +0 -215
- package/esm2015/lib/components/accordion/accordion.component.js +0 -45
- package/esm2015/lib/components/alert/alert.component.js +0 -39
- package/esm2015/lib/components/base.component.js +0 -45
- package/esm2015/lib/components/calendar/calendar.component.js +0 -97
- package/esm2015/lib/components/chart/chart.component.js +0 -17
- package/esm2015/lib/components/clock/clock.component.js +0 -33
- package/esm2015/lib/components/confirm/confirm.component.js +0 -50
- package/esm2015/lib/components/footer/footer.component.js +0 -23
- package/esm2015/lib/components/form/bank-card/form.bank-card.component.js +0 -148
- package/esm2015/lib/components/form/button/form.button.component.js +0 -68
- package/esm2015/lib/components/form/car/form.car.component.js +0 -84
- package/esm2015/lib/components/form/car/search/form.car.search.component.js +0 -172
- package/esm2015/lib/components/form/checkbox/form.checkbox.component.js +0 -66
- package/esm2015/lib/components/form/date/form.date.component.js +0 -254
- package/esm2015/lib/components/form/datetime/form.datetime.component.js +0 -104
- package/esm2015/lib/components/form/file/form.file.component.js +0 -133
- package/esm2015/lib/components/form/finger/form.finger.component.js +0 -138
- package/esm2015/lib/components/form/hidden/form.hidden.component.js +0 -31
- package/esm2015/lib/components/form/icon/form.icon.component.js +0 -76
- package/esm2015/lib/components/form/index/form.component.js +0 -48
- package/esm2015/lib/components/form/label/form.label.component.js +0 -32
- package/esm2015/lib/components/form/plaque/form.plaque.component.js +0 -176
- package/esm2015/lib/components/form/plaque/select/form.plaque.select.component.js +0 -390
- package/esm2015/lib/components/form/radio/form.radio.component.js +0 -79
- package/esm2015/lib/components/form/select/form.select.component.js +0 -374
- package/esm2015/lib/components/form/select/item/form.select.item.component.js +0 -43
- package/esm2015/lib/components/form/table/form.table.component.js +0 -98
- package/esm2015/lib/components/form/textarea/form.textarea.component.js +0 -78
- package/esm2015/lib/components/form/textbox/form.textbox.component.js +0 -186
- package/esm2015/lib/components/form/time/form.time.component.js +0 -145
- package/esm2015/lib/components/form/tree/form.tree.component.js +0 -99
- package/esm2015/lib/components/form/tree/item/form.tree.item.component.js +0 -48
- package/esm2015/lib/components/header/header.component.js +0 -33
- package/esm2015/lib/components/header/sub/sub.header.component.js +0 -14
- package/esm2015/lib/components/layout/layout.component.js +0 -25
- package/esm2015/lib/components/loading/loading.component.js +0 -22
- package/esm2015/lib/components/login/login.component.js +0 -148
- package/esm2015/lib/components/modal/modal.component.js +0 -25
- package/esm2015/lib/components/notfound/notfound.component.js +0 -29
- package/esm2015/lib/components/notification/notification.component.js +0 -14
- package/esm2015/lib/components/sidebar/item/sidebar.item.component.js +0 -53
- package/esm2015/lib/components/sidebar/sidebar.component.js +0 -67
- package/esm2015/lib/components/steps/steps.component.js +0 -51
- package/esm2015/lib/components/table/loading/table.loading.component.js +0 -17
- package/esm2015/lib/components/table/pagination/table.pagination.component.js +0 -84
- package/esm2015/lib/components/table/report/table.report.component.js +0 -246
- package/esm2015/lib/components/table/row/table.row.component.js +0 -379
- package/esm2015/lib/components/table/table.component.js +0 -179
- package/esm2015/lib/components/tooltip/tooltip.component.js +0 -19
- package/esm2015/lib/ps-toolkit-ui.module.js +0 -95
- package/esm2015/lib/services/config.service.js +0 -14
- package/esm2015/ps-toolkit-ui.js +0 -20
- package/esm2015/public-api.js +0 -52
- package/fesm2015/ps-toolkit-ui.js +0 -6566
- package/fesm2015/ps-toolkit-ui.js.map +0 -1
- package/lib/classes/chart.class.d.ts +0 -11
- package/lib/classes/enum.class.d.ts +0 -158
- package/lib/classes/form.class.d.ts +0 -173
- package/lib/classes/helper.class.d.ts +0 -28
- package/lib/classes/lang.class.d.ts +0 -5
- package/lib/classes/login.class.d.ts +0 -17
- package/lib/classes/modal.class.d.ts +0 -19
- package/lib/classes/permission.class.d.ts +0 -31
- package/lib/classes/request.class.d.ts +0 -12
- package/lib/classes/safestyle.class.d.ts +0 -7
- package/lib/classes/sidebar.class.d.ts +0 -11
- package/lib/classes/steps.class.d.ts +0 -17
- package/lib/classes/string.class.d.ts +0 -218
- package/lib/classes/table.class.d.ts +0 -69
- package/lib/components/accordion/accordion.component.d.ts +0 -7
- package/lib/components/alert/alert.component.d.ts +0 -10
- package/lib/components/base.component.d.ts +0 -14
- package/lib/components/calendar/calendar.component.d.ts +0 -26
- package/lib/components/chart/chart.component.d.ts +0 -5
- package/lib/components/clock/clock.component.d.ts +0 -11
- package/lib/components/confirm/confirm.component.d.ts +0 -14
- package/lib/components/footer/footer.component.d.ts +0 -6
- package/lib/components/form/bank-card/form.bank-card.component.d.ts +0 -22
- package/lib/components/form/button/form.button.component.d.ts +0 -15
- package/lib/components/form/car/form.car.component.d.ts +0 -16
- package/lib/components/form/car/search/form.car.search.component.d.ts +0 -17
- package/lib/components/form/checkbox/form.checkbox.component.d.ts +0 -14
- package/lib/components/form/date/form.date.component.d.ts +0 -42
- package/lib/components/form/datetime/form.datetime.component.d.ts +0 -13
- package/lib/components/form/file/form.file.component.d.ts +0 -17
- package/lib/components/form/finger/form.finger.component.d.ts +0 -15
- package/lib/components/form/hidden/form.hidden.component.d.ts +0 -7
- package/lib/components/form/icon/form.icon.component.d.ts +0 -15
- package/lib/components/form/index/form.component.d.ts +0 -10
- package/lib/components/form/label/form.label.component.d.ts +0 -8
- package/lib/components/form/plaque/form.plaque.component.d.ts +0 -22
- package/lib/components/form/plaque/select/form.plaque.select.component.d.ts +0 -36
- package/lib/components/form/radio/form.radio.component.d.ts +0 -13
- package/lib/components/form/select/form.select.component.d.ts +0 -39
- package/lib/components/form/select/item/form.select.item.component.d.ts +0 -12
- package/lib/components/form/table/form.table.component.d.ts +0 -9
- package/lib/components/form/textarea/form.textarea.component.d.ts +0 -13
- package/lib/components/form/textbox/form.textbox.component.d.ts +0 -20
- package/lib/components/form/time/form.time.component.d.ts +0 -25
- package/lib/components/form/tree/form.tree.component.d.ts +0 -16
- package/lib/components/form/tree/item/form.tree.item.component.d.ts +0 -17
- package/lib/components/header/header.component.d.ts +0 -9
- package/lib/components/header/sub/sub.header.component.d.ts +0 -3
- package/lib/components/layout/layout.component.d.ts +0 -8
- package/lib/components/loading/loading.component.d.ts +0 -5
- package/lib/components/login/login.component.d.ts +0 -13
- package/lib/components/modal/modal.component.d.ts +0 -9
- package/lib/components/notfound/notfound.component.d.ts +0 -8
- package/lib/components/notification/notification.component.d.ts +0 -3
- package/lib/components/sidebar/item/sidebar.item.component.d.ts +0 -14
- package/lib/components/sidebar/sidebar.component.d.ts +0 -19
- package/lib/components/steps/steps.component.d.ts +0 -10
- package/lib/components/table/loading/table.loading.component.d.ts +0 -5
- package/lib/components/table/pagination/table.pagination.component.d.ts +0 -15
- package/lib/components/table/report/table.report.component.d.ts +0 -34
- package/lib/components/table/row/table.row.component.d.ts +0 -34
- package/lib/components/table/table.component.d.ts +0 -40
- package/lib/components/tooltip/tooltip.component.d.ts +0 -5
- package/lib/ps-toolkit-ui.module.d.ts +0 -4
- package/lib/services/config.service.d.ts +0 -6
- package/ps-toolkit-ui.d.ts +0 -19
- package/ps-toolkit-ui.metadata.json +0 -1
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
|
|
2
|
+
import * as $ from 'jquery';
|
|
3
|
+
import {InputClass, OptionClass} from '../../../../classes/form.class';
|
|
4
|
+
import {InputError, InputType} from '../../../../classes/enum.class';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'lib-form-plaque-select',
|
|
8
|
+
templateUrl: './form.plaque.select.component.html',
|
|
9
|
+
styleUrls: ['./form.plaque.select.component.css']
|
|
10
|
+
})
|
|
11
|
+
export class FormPlaqueSelectComponent implements OnInit{
|
|
12
|
+
@Output()
|
|
13
|
+
changeIndex = new EventEmitter<string>();
|
|
14
|
+
@Input()
|
|
15
|
+
inp: InputClass;
|
|
16
|
+
cSearch = '';
|
|
17
|
+
open = false;
|
|
18
|
+
top = false;
|
|
19
|
+
part1: InputClass;
|
|
20
|
+
part2: InputClass;
|
|
21
|
+
part3: InputClass;
|
|
22
|
+
part4: InputClass;
|
|
23
|
+
get type(): typeof InputType { return InputType; }
|
|
24
|
+
alphas = ['الف', 'ب', 'پ', 'ت', 'ث', 'ج', 'چ', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'ژ', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ک', 'گ', 'ل', 'م', 'ن', 'و', 'ه', 'ی'];
|
|
25
|
+
@ViewChild('inputDiv') inputDiv: ElementRef;
|
|
26
|
+
@ViewChild('inputBase') inputBase: ElementRef;
|
|
27
|
+
@ViewChild('inputOptionsDiv') inputOptionsDiv: ElementRef;
|
|
28
|
+
@ViewChild('inputLabel') inputLabel: ElementRef;
|
|
29
|
+
ngOnInit(): void{
|
|
30
|
+
this.inp.setValue = (v) => {
|
|
31
|
+
this.inp.value = v;
|
|
32
|
+
this.inp.options = [];
|
|
33
|
+
};
|
|
34
|
+
this.inp.setSearch = (s) => {
|
|
35
|
+
const p = s ? s.split('_') : null;
|
|
36
|
+
if (p && p.length === 4) {
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
this.part1.value = p[0];
|
|
39
|
+
this.part2.value = p[1];
|
|
40
|
+
this.part2.search = p[1];
|
|
41
|
+
this.part3.value = p[2];
|
|
42
|
+
this.part4.value = p[3];
|
|
43
|
+
}, 100);
|
|
44
|
+
} else if (p && p.length === 2) {
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
this.part1.value = p[0];
|
|
47
|
+
this.part3.value = p[1];
|
|
48
|
+
}, 100);
|
|
49
|
+
}else {
|
|
50
|
+
this.part1.value = '';
|
|
51
|
+
this.part2.value = '';
|
|
52
|
+
this.part2.search = '';
|
|
53
|
+
this.part3.value = '';
|
|
54
|
+
this.part4.value = '';
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
this.inp.focus = () => {
|
|
58
|
+
this.openOptions(true);
|
|
59
|
+
};
|
|
60
|
+
this.inp.isValid = () => {
|
|
61
|
+
this.inp.error = null;
|
|
62
|
+
if (this.inp.required && !this.inp.value) {
|
|
63
|
+
this.inp.error = InputError.Required;
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
this.inp.clear = () => {
|
|
69
|
+
this.inp.error = null;
|
|
70
|
+
this.inp.value = this.inp.default;
|
|
71
|
+
this.inp.search = '';
|
|
72
|
+
this.part1.value = '';
|
|
73
|
+
this.part2.value = '';
|
|
74
|
+
this.part2.search = '';
|
|
75
|
+
this.part3.value = '';
|
|
76
|
+
this.part4.value = '';
|
|
77
|
+
if (this.inp.rel != null){
|
|
78
|
+
this.inp.rel.options = [];
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
this.inp.data = () => {
|
|
82
|
+
return this.inp.value;
|
|
83
|
+
};
|
|
84
|
+
this.part1 = new InputClass(this.inp.environment, this.inp.l, 'Part1', null, InputType.Number,
|
|
85
|
+
'plaque-part-1 plaque-part-item' + (this.inp.type === InputType.SelectAutoCompletePlaqueM ? ' plaque-part-m' : ''),
|
|
86
|
+
'', true,
|
|
87
|
+
this.inp.type === InputType.SelectAutoCompletePlaqueM ? 100 : 10,
|
|
88
|
+
this.inp.type === InputType.SelectAutoCompletePlaqueM ? 999 : 99);
|
|
89
|
+
this.part2 = new InputClass(this.inp.environment, this.inp.l, 'Part2', null, InputType.Select,
|
|
90
|
+
'plaque-part-2 plaque-part-item' + (this.inp.type === InputType.SelectAutoCompletePlaqueM ? ' plaque-part-m' : ''),
|
|
91
|
+
'', true);
|
|
92
|
+
this.part2.options = this.alphas.map(x => new OptionClass(x, x));
|
|
93
|
+
this.part3 = new InputClass(this.inp.environment, this.inp.l, 'Part3', null, InputType.Number,
|
|
94
|
+
'plaque-part-3 plaque-part-item' + (this.inp.type === InputType.SelectAutoCompletePlaqueM ? ' plaque-part-m' : ''),
|
|
95
|
+
'', true,
|
|
96
|
+
this.inp.type === InputType.SelectAutoCompletePlaqueM ? 10000 : 100,
|
|
97
|
+
this.inp.type === InputType.SelectAutoCompletePlaqueM ? 99999 : 999);
|
|
98
|
+
this.part4 = new InputClass(this.inp.environment, this.inp.l, 'Part4', null, InputType.Number,
|
|
99
|
+
'plaque-part-4 plaque-part-item' + (this.inp.type === InputType.SelectAutoCompletePlaqueM ? ' plaque-part-m' : ''),
|
|
100
|
+
'', true, 10, 99);
|
|
101
|
+
this.part1.displayLabel = this.part2.displayLabel = this.part3.displayLabel = this.part4.displayLabel = false;
|
|
102
|
+
this.part1.placeholder = this.part2.placeholder = this.part3.placeholder = this.part4.placeholder = null;
|
|
103
|
+
this.part1.onChange = (v) => {
|
|
104
|
+
this.inp.error = null;
|
|
105
|
+
this.inp.value = null;
|
|
106
|
+
if (v.length === 2 && this.inp.type === InputType.SelectAutoCompletePlaque){
|
|
107
|
+
this.part2.focus();
|
|
108
|
+
this.loadOptions();
|
|
109
|
+
} else if (v.length === 3 && this.inp.type === InputType.SelectAutoCompletePlaqueM){
|
|
110
|
+
this.part3.focus();
|
|
111
|
+
this.loadOptions();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
this.part2.onChange = () => {
|
|
115
|
+
this.inp.error = null;
|
|
116
|
+
this.inp.value = null;
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
this.part3.focus();
|
|
119
|
+
this.loadOptions();
|
|
120
|
+
}, 100);
|
|
121
|
+
};
|
|
122
|
+
this.part3.onChange = (v) => {
|
|
123
|
+
this.inp.error = null;
|
|
124
|
+
this.inp.value = null;
|
|
125
|
+
if (v.length === 3 && this.inp.type === InputType.SelectAutoCompletePlaque){
|
|
126
|
+
this.part4.focus();
|
|
127
|
+
this.loadOptions();
|
|
128
|
+
} else if (v.length === 5 && this.inp.type === InputType.SelectAutoCompletePlaqueM){
|
|
129
|
+
this.loadOptions();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
this.part4.onChange = (v) => {
|
|
133
|
+
this.inp.error = null;
|
|
134
|
+
this.inp.value = null;
|
|
135
|
+
if (v.length === 2){
|
|
136
|
+
this.loadOptions();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
this.part1.onKeyDown = this.part2.onKeyDown = this.part3.onKeyDown = this.part4.onKeyDown = (e) => {
|
|
140
|
+
const code = e.keyCode || e.which;
|
|
141
|
+
if (code === 38 || code === 40){
|
|
142
|
+
this.onKeyDown(e);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
this.part1.onFocusOut = (e) => {
|
|
146
|
+
if (!$(e.relatedTarget).closest('.form-input.plaque-select').hasClass('plaque-select') && !$(e.rangeParent).closest('.form-input.plaque-select').hasClass('plaque-select')){
|
|
147
|
+
if (this.open){
|
|
148
|
+
this.closeOptions();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
this.part2.onFocusOut = (e) => {
|
|
153
|
+
if (!$(e.relatedTarget).closest('.form-input.plaque-select').hasClass('plaque-select') && !$(e.rangeParent).closest('.form-input.plaque-select').hasClass('plaque-select')){
|
|
154
|
+
if (this.open){
|
|
155
|
+
this.closeOptions();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
this.part3.onFocusOut = (e) => {
|
|
160
|
+
if (!$(e.relatedTarget).closest('.form-input.plaque-select').hasClass('plaque-select') && !$(e.rangeParent).closest('.form-input.plaque-select').hasClass('plaque-select')){
|
|
161
|
+
if (this.open){
|
|
162
|
+
this.closeOptions();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
this.part4.onFocusOut = (e) => {
|
|
167
|
+
if (!$(e.relatedTarget).closest('.form-input.plaque-select').hasClass('plaque-select') && !$(e.rangeParent).closest('.form-input.plaque-select').hasClass('plaque-select')){
|
|
168
|
+
if (this.open){
|
|
169
|
+
this.closeOptions();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
loadOptions(): void{
|
|
175
|
+
const v = this.getSearch().replace(/^_+|_+$/g, '');
|
|
176
|
+
if (v){
|
|
177
|
+
this.inp.load(this.inp.url.replace('{}', v));
|
|
178
|
+
}else{
|
|
179
|
+
this.inp.options = [];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
openOptions(f = false): boolean{
|
|
183
|
+
this.setPosition();
|
|
184
|
+
this.setHoverCenter();
|
|
185
|
+
this.open = true;
|
|
186
|
+
this.focusInput(f);
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
focusInput(f = false): void{
|
|
190
|
+
if (f){
|
|
191
|
+
this.part1.focus();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
closeOptions(): boolean{
|
|
195
|
+
setTimeout(() => {
|
|
196
|
+
this.open = false;
|
|
197
|
+
this.top = false;
|
|
198
|
+
this.inp.hover = -1;
|
|
199
|
+
if (this.inp.value === null){
|
|
200
|
+
this.inp.search = '';
|
|
201
|
+
this.part1.value = '';
|
|
202
|
+
this.part2.value = '';
|
|
203
|
+
this.part2.search = '';
|
|
204
|
+
this.part3.value = '';
|
|
205
|
+
this.part4.value = '';
|
|
206
|
+
this.inp.options = [];
|
|
207
|
+
}
|
|
208
|
+
}, 1);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
setPosition(): void{
|
|
212
|
+
const rect = this.inputDiv.nativeElement.getBoundingClientRect();
|
|
213
|
+
const offsetOfBottom = window.innerHeight - rect.bottom;
|
|
214
|
+
const height = this.inputOptionsDiv.nativeElement.offsetHeight;
|
|
215
|
+
this.top = offsetOfBottom < height;
|
|
216
|
+
}
|
|
217
|
+
onKeyDown(e): void{
|
|
218
|
+
const code = e.keyCode || e.which;
|
|
219
|
+
if (code === 9) {
|
|
220
|
+
e.preventDefault();
|
|
221
|
+
this.cI(e.shiftKey ? 'ShiftTab' : 'Tab');
|
|
222
|
+
}
|
|
223
|
+
else if (code === 13){
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
if (this.open){
|
|
226
|
+
const h = this.getSelected();
|
|
227
|
+
if (!h){
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.selectOption(h.value);
|
|
231
|
+
}else{
|
|
232
|
+
this.cI('Tab');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else if (code === 40){
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
if (this.inp.hover + 1 >= this.inp.index){
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
this.inp.hover = this.getHover();
|
|
241
|
+
this.setHoverCenter();
|
|
242
|
+
}
|
|
243
|
+
else if (code === 38){
|
|
244
|
+
e.preventDefault();
|
|
245
|
+
if (this.inp.hover <= 0){
|
|
246
|
+
this.inp.hover = 0;
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
this.inp.hover = this.getHover(-1);
|
|
250
|
+
this.setHoverCenter();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
toggleOption(): void{
|
|
254
|
+
this.openOptions();
|
|
255
|
+
}
|
|
256
|
+
selectOption(v, isEdit = false): void{
|
|
257
|
+
this.inp.error = null;
|
|
258
|
+
const va = this.getValue(v);
|
|
259
|
+
this.inp.value = v;
|
|
260
|
+
this.inp.hover = va ? va.index : -1;
|
|
261
|
+
this.inp.search = va ? va.search : '';
|
|
262
|
+
this.cSearch = this.inp.search;
|
|
263
|
+
if (this.inp.onChange){
|
|
264
|
+
this.inp.onChange(this.inp);
|
|
265
|
+
}
|
|
266
|
+
if (this.inp.rel){
|
|
267
|
+
this.inp.rel.value = null;
|
|
268
|
+
this.inp.rel.hover = -1;
|
|
269
|
+
this.inp.rel.index = 0;
|
|
270
|
+
this.inp.rel.search = '';
|
|
271
|
+
this.inp.rel.options = [];
|
|
272
|
+
this.inp.rel.url = this.inp.relUrl.replace('{}', this.inp.value);
|
|
273
|
+
if (this.inp.rel.type !== InputType.SelectAutoComplete) {
|
|
274
|
+
this.inp.rel.load();
|
|
275
|
+
}else{
|
|
276
|
+
this.inp.rel.url += '_{}';
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const p = va ? va.option.Plaque.split('_') : null;
|
|
280
|
+
if (p && p.length === 4) {
|
|
281
|
+
this.part1.value = p ? p[0] : '';
|
|
282
|
+
this.part2.value = p ? p[1] : '';
|
|
283
|
+
this.part2.search = p ? p[1] : '';
|
|
284
|
+
this.part3.value = p ? p[2] : '';
|
|
285
|
+
this.part4.value = p ? p[3] : '';
|
|
286
|
+
} else if (p && p.length === 2) {
|
|
287
|
+
this.part1.value = p ? p[0] : '';
|
|
288
|
+
this.part3.value = p ? p[1] : '';
|
|
289
|
+
}
|
|
290
|
+
if (!isEdit){
|
|
291
|
+
this.cI('Tab');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
cI(i: string): void{
|
|
295
|
+
setTimeout(() => {
|
|
296
|
+
this.changeIndex.emit(i);
|
|
297
|
+
}, 10);
|
|
298
|
+
setTimeout(() => {
|
|
299
|
+
this.closeOptions();
|
|
300
|
+
}, 20);
|
|
301
|
+
}
|
|
302
|
+
setHoverCenter(): void {
|
|
303
|
+
setTimeout(() => {
|
|
304
|
+
const hover: any = $(this.inputOptionsDiv.nativeElement).find('.option.hover');
|
|
305
|
+
const items: any = $(this.inputOptionsDiv.nativeElement).find('.items');
|
|
306
|
+
if (hover.length === 0){
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
items.scrollTop = items.scrollTop - items.offset.top + hover.offset.top - hover.height();
|
|
310
|
+
}, 1);
|
|
311
|
+
}
|
|
312
|
+
getSelected(o: OptionClass[] = this.inp.options): any{
|
|
313
|
+
const h = o.find(x => x.index === this.inp.hover);
|
|
314
|
+
if (h){
|
|
315
|
+
return h;
|
|
316
|
+
}
|
|
317
|
+
for (const i of o){
|
|
318
|
+
const hi = this.getSelected(i.options);
|
|
319
|
+
if (hi){
|
|
320
|
+
return hi;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
getHover(i = 1, o: OptionClass[] = this.inp.options, h = this.inp.hover): number{
|
|
325
|
+
const ho = o.find(x => x.index === h + i);
|
|
326
|
+
if (ho){
|
|
327
|
+
if (ho.show){
|
|
328
|
+
return ho.index;
|
|
329
|
+
}else {
|
|
330
|
+
h = h + i;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
for (const it of o){
|
|
334
|
+
const hi = this.getHover(i, it.options, h);
|
|
335
|
+
if (hi){
|
|
336
|
+
return hi;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return 0;
|
|
340
|
+
}
|
|
341
|
+
getValue(v, o: OptionClass[] = this.inp.options): OptionClass{
|
|
342
|
+
const h = o.find(x => x.value === v);
|
|
343
|
+
if (h){
|
|
344
|
+
return h;
|
|
345
|
+
}
|
|
346
|
+
for (const i of o){
|
|
347
|
+
const hi = this.getValue(v, i.options);
|
|
348
|
+
if (hi){
|
|
349
|
+
return hi;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
plaqueChangeFocus(p, a): void{
|
|
354
|
+
if (p === 'Part1'){
|
|
355
|
+
if (a === 'Tab' || a === 'Enter'){
|
|
356
|
+
this.part2.focus();
|
|
357
|
+
} else if (a === 'ShiftTab' || a === 'ShiftEnter'){
|
|
358
|
+
this.changeIndex.emit('ShiftTab');
|
|
359
|
+
}
|
|
360
|
+
} else if (p === 'Part2'){
|
|
361
|
+
if (a === 'Tab' || a === 'Enter'){
|
|
362
|
+
this.part3.focus();
|
|
363
|
+
} else if (a === 'ShiftTab' || a === 'ShiftEnter'){
|
|
364
|
+
this.part1.focus();
|
|
365
|
+
}
|
|
366
|
+
} else if (p === 'Part3'){
|
|
367
|
+
if (a === 'Tab' || a === 'Enter'){
|
|
368
|
+
this.part4.focus();
|
|
369
|
+
} else if (a === 'ShiftTab' || a === 'ShiftEnter'){
|
|
370
|
+
this.part2.focus();
|
|
371
|
+
}
|
|
372
|
+
} else if (p === 'Part4'){
|
|
373
|
+
if (a === 'Tab' || a === 'Enter'){
|
|
374
|
+
this.changeIndex.emit('Tab');
|
|
375
|
+
} else if (a === 'ShiftTab' || a === 'ShiftEnter'){
|
|
376
|
+
this.part3.focus();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
getSearch(): string{
|
|
381
|
+
return this.inp.type === InputType.SelectAutoCompletePlaque ?
|
|
382
|
+
`${this.part1.value ? this.part1.value + '_' : ''}${this.part2.value ? this.part2.value + '_' : ''}${this.part3.value ? this.part3.value + '_' : ''}${this.part4.value ? this.part4.value : ''}` :
|
|
383
|
+
`${this.part1.value ? this.part1.value + '_' : ''}${this.part3.value ? this.part3.value + '_' : ''}`;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
.form-input-con.radio {
|
|
2
|
+
float: right;
|
|
3
|
+
width: 100%;
|
|
4
|
+
padding: 0 15px;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
.form-input-con.radio .form-input {
|
|
8
|
+
float: right;
|
|
9
|
+
width: 100%;
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.form-input-con.radio .form-input .label {
|
|
14
|
+
float: right;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 20px;
|
|
17
|
+
line-height: 20px;
|
|
18
|
+
padding: 0 10px;
|
|
19
|
+
font-size: 12px;
|
|
20
|
+
margin-bottom: 3px;
|
|
21
|
+
cursor: default;
|
|
22
|
+
-webkit-user-select: none;
|
|
23
|
+
-moz-user-select: none;
|
|
24
|
+
-khtml-user-select: none;
|
|
25
|
+
-ms-user-select: none;
|
|
26
|
+
direction: rtl;
|
|
27
|
+
text-align: right;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.form-input-con.radio.error .form-input .label {
|
|
31
|
+
font-size: 10px;
|
|
32
|
+
color: var(--red);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.form-input-con.radio .form-input .label .required-icon {
|
|
36
|
+
height: 20px;
|
|
37
|
+
width: 20px;
|
|
38
|
+
line-height: 20px;
|
|
39
|
+
font-size: 9px;
|
|
40
|
+
color: var(--red);
|
|
41
|
+
text-align: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
.form-input-con.radio .form-input i.icon {
|
|
46
|
+
position: absolute;
|
|
47
|
+
font-size: 13px;
|
|
48
|
+
color: var(--comp);
|
|
49
|
+
cursor: default;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
z-index: 1;
|
|
52
|
+
-webkit-transition: all .35s ease-in-out;
|
|
53
|
+
transition: all .35s ease-in-out;
|
|
54
|
+
width: 35px;
|
|
55
|
+
text-align: center;
|
|
56
|
+
height: 35px;
|
|
57
|
+
line-height: 35px;
|
|
58
|
+
left: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.form-input-con.radio .form-input > .control {
|
|
62
|
+
display: table;
|
|
63
|
+
width: 100%;
|
|
64
|
+
height: 35px;
|
|
65
|
+
background-color: white;
|
|
66
|
+
padding: 0 35px;
|
|
67
|
+
border: var(--border-input);
|
|
68
|
+
border-radius: 5px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.form-input-con.radio .form-input .input-base {
|
|
72
|
+
position: absolute;
|
|
73
|
+
width: 0;
|
|
74
|
+
height: 0;
|
|
75
|
+
opacity: 0;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
top: 50%;
|
|
78
|
+
right: 50%;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.form-input-con.radio .form-input:hover .control, .form-input-con.radio .form-input .input-base:focus + .control {
|
|
83
|
+
outline: none;
|
|
84
|
+
border: var(--border-input-dark);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.form-input-con.radio.error .form-input > .control {
|
|
88
|
+
border: var(--border-input-red);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.form-input-con.radio.error .form-input i.icon {
|
|
92
|
+
color: var(--red);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
.form-input-con.radio .form-input .options {
|
|
97
|
+
width: 100%;
|
|
98
|
+
text-align: center;
|
|
99
|
+
display: table;
|
|
100
|
+
height: 100%;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.form-input-con.radio .form-input .option {
|
|
104
|
+
text-align: center;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
font-size: 11px;
|
|
107
|
+
-webkit-user-select: none;
|
|
108
|
+
-moz-user-select: none;
|
|
109
|
+
-ms-user-select: none;
|
|
110
|
+
user-select: none;
|
|
111
|
+
position: relative;
|
|
112
|
+
float: right;
|
|
113
|
+
width: 100%;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
align-items: center;
|
|
116
|
+
display: flex;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.form-input-con.radio .form-input .option-con {
|
|
120
|
+
display: table-cell;
|
|
121
|
+
position: relative;
|
|
122
|
+
height: 100%;
|
|
123
|
+
vertical-align: middle;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.form-input-con.radio .form-input .option-con .text {
|
|
127
|
+
height: 25px;
|
|
128
|
+
line-height: 25px;
|
|
129
|
+
margin-right: 10px;
|
|
130
|
+
float: right;
|
|
131
|
+
padding: 0 20px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.form-input-con.radio .form-input .option-con input {
|
|
135
|
+
position: absolute;
|
|
136
|
+
opacity: 0;
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
right: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.form-input-con.radio .form-input .option-con span:after {
|
|
142
|
+
float: right;
|
|
143
|
+
height: 30px;
|
|
144
|
+
width: 15px;
|
|
145
|
+
content: "\f111";
|
|
146
|
+
font-family: "Font Awesome 5 Pro";
|
|
147
|
+
font-weight: bold;
|
|
148
|
+
color: var(--black-33);
|
|
149
|
+
line-height: 30px;
|
|
150
|
+
font-size: 14px;
|
|
151
|
+
}
|
|
152
|
+
.form-input-con.radio .form-input .option-con:hover span:after {
|
|
153
|
+
color: var(--black-66);
|
|
154
|
+
}
|
|
155
|
+
.form-input-con.radio .form-input .option-con input:checked ~ span:after {
|
|
156
|
+
color: var(--comp);
|
|
157
|
+
content: "\f192";
|
|
158
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<div #inputDiv [id]="inp.name + 'Input'" [className]="inp.class + ' form-input-con radio' + (inp.error == null ? '' : ' error') + (inp.disabled ? ' disabled' : '')">
|
|
2
|
+
<div class="form-input" (click)="onClick()">
|
|
3
|
+
<div *ngIf="inp.displayLabel" class="label"><i *ngIf="inp.required" class="fas fa-star-of-life required-icon"></i>{{inp.getLabel()}}</div>
|
|
4
|
+
<i *ngIf="inp.icon != null || inp.loading" #inputIcon [className]="(inp.loading ? 'fa-duotone fa-spin fa-spinner' : inp.icon) + ' icon'"></i>
|
|
5
|
+
<input #inputBase type="text" class="input-base" (keydown)="onKeyDown($event)" (focusin)="onFocusIn()">
|
|
6
|
+
<div class="control">
|
|
7
|
+
<div [className]="(o.class ? o.class + ' ' : '') + 'option-con'" *ngFor="let o of inp.options">
|
|
8
|
+
<label class="option">
|
|
9
|
+
<input [disabled]="inp.disabled" (change)="onChange()" [value]="o.value" [(ngModel)]="inp.value" [checked]="inp.value == o.value" type="radio" [name]="inp.name">
|
|
10
|
+
<span></span>
|
|
11
|
+
<div class="text">{{inp.l(o.name)}}</div>
|
|
12
|
+
</label>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
|
|
2
|
+
import * as $ from 'jquery';
|
|
3
|
+
import {InputClass} from '../../../classes/form.class';
|
|
4
|
+
import {InputError} from '../../../classes/enum.class';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'lib-form-radio',
|
|
8
|
+
templateUrl: './form.radio.component.html',
|
|
9
|
+
styleUrls: ['./form.radio.component.css']
|
|
10
|
+
})
|
|
11
|
+
export class FormRadioComponent implements OnInit{
|
|
12
|
+
@Input()
|
|
13
|
+
inp: InputClass;
|
|
14
|
+
@Output()
|
|
15
|
+
changeIndex = new EventEmitter<string>();
|
|
16
|
+
@ViewChild('inputBase') inputBase: ElementRef;
|
|
17
|
+
constructor(){
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ngOnInit(): void {
|
|
21
|
+
this.inp.load();
|
|
22
|
+
this.inp.setValue = (v) => {
|
|
23
|
+
this.inp.value = v;
|
|
24
|
+
if (this.inp.value == null){
|
|
25
|
+
this.inp.value = this.inp.options.find(x => true).value;
|
|
26
|
+
}
|
|
27
|
+
this.onChange();
|
|
28
|
+
};
|
|
29
|
+
this.inp.setValue(this.inp.value, false);
|
|
30
|
+
this.inp.isValid = () => {
|
|
31
|
+
this.inp.error = null;
|
|
32
|
+
if (this.inp.required && this.inp.value === null) {
|
|
33
|
+
this.inp.error = InputError.Required;
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
};
|
|
38
|
+
this.inp.clear = () => {
|
|
39
|
+
this.inp.error = null;
|
|
40
|
+
this.inp.setValue(this.inp.default, false);
|
|
41
|
+
};
|
|
42
|
+
this.inp.data = () => {
|
|
43
|
+
return this.inp.value;
|
|
44
|
+
};
|
|
45
|
+
this.inp.focus = () => {
|
|
46
|
+
this.onFocusIn();
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onClick(): void{
|
|
51
|
+
this.onFocusIn();
|
|
52
|
+
}
|
|
53
|
+
onKeyDown(e): void{
|
|
54
|
+
const code = e.keyCode || e.which;
|
|
55
|
+
if (code === 9 || code === 13) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
this.changeIndex.emit(e.shiftKey ? 'ShiftTab' : 'Tab');
|
|
58
|
+
}
|
|
59
|
+
const selected = this.inp.options.findIndex(x => x.value === this.inp.value);
|
|
60
|
+
if (code === 37){
|
|
61
|
+
const next = (selected >= this.inp.options.length - 1) ? selected : selected + 1;
|
|
62
|
+
this.inp.value = this.inp.options[next].value;
|
|
63
|
+
}
|
|
64
|
+
if (code === 39){
|
|
65
|
+
const next = (selected > 0) ? selected - 1 : 0;
|
|
66
|
+
this.inp.value = this.inp.options[next].value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
onChange(): void{
|
|
70
|
+
this.inp.error = null;
|
|
71
|
+
if (this.inp.onChange){
|
|
72
|
+
this.inp.onChange(this.inp);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
onFocusIn(): void{
|
|
76
|
+
$(this.inputBase.nativeElement).focus();
|
|
77
|
+
}
|
|
78
|
+
}
|