bromcom-ui 2.3.66 → 2.3.70
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/dist/bromcom-ui/{index-43956e3c.js → _commonjsHelpers-2088bffa.js} +1 -56
- package/dist/bromcom-ui/bcm-ad02f9c9.js +453 -0
- package/dist/bromcom-ui/bcm-alert.entry.js +53 -58
- package/dist/bromcom-ui/bcm-autocomplete.entry.js +4 -3
- package/dist/bromcom-ui/bcm-avatar.entry.js +27 -28
- package/dist/bromcom-ui/bcm-badge.entry.js +60 -31
- package/dist/bromcom-ui/bcm-breadcrumb.entry.js +26 -32
- package/dist/bromcom-ui/bcm-button.entry.js +92 -215
- package/dist/bromcom-ui/bcm-card-footer.entry.js +1 -1
- package/dist/bromcom-ui/bcm-card-header.entry.js +1 -1
- package/dist/bromcom-ui/bcm-card.entry.js +5 -4
- package/dist/bromcom-ui/bcm-checkbox-group.entry.js +253 -227
- package/dist/bromcom-ui/bcm-checkbox-lite.entry.js +29 -26
- package/dist/bromcom-ui/bcm-checkbox.entry.js +85 -89
- package/dist/bromcom-ui/bcm-collapse-group.entry.js +11 -16
- package/dist/bromcom-ui/bcm-collapse.entry.js +31 -18
- package/dist/bromcom-ui/bcm-colorpicker.entry.js +7 -6
- package/dist/bromcom-ui/bcm-comment-editor.entry.js +4 -3
- package/dist/bromcom-ui/bcm-comment-group.entry.js +4 -3
- package/dist/bromcom-ui/bcm-comment.entry.js +5 -4
- package/dist/bromcom-ui/bcm-date-picker.entry.js +31 -34
- package/dist/bromcom-ui/bcm-datetime-picker.entry.js +20 -46
- package/dist/bromcom-ui/bcm-divider.entry.js +11 -11
- package/dist/bromcom-ui/bcm-dropdown-button.entry.js +35 -61
- package/dist/bromcom-ui/bcm-dropdown-item.entry.js +66 -16
- package/dist/bromcom-ui/bcm-dropdown-list.entry.js +31 -49
- package/dist/bromcom-ui/bcm-dropdown.entry.js +17 -46
- package/dist/bromcom-ui/bcm-empty.entry.js +14 -45
- package/dist/bromcom-ui/bcm-error-layout.entry.js +20 -34
- package/dist/bromcom-ui/bcm-form-group.entry.js +3 -3
- package/dist/bromcom-ui/bcm-form.entry.js +31 -16
- package/dist/bromcom-ui/bcm-icon.entry.js +55 -35
- package/dist/bromcom-ui/bcm-input.entry.js +170 -276
- package/dist/bromcom-ui/bcm-label.entry.js +12 -549
- package/dist/bromcom-ui/bcm-link.entry.js +26 -5
- package/dist/bromcom-ui/bcm-list-2.entry.js +1063 -0
- package/dist/bromcom-ui/bcm-list-item.entry.js +4 -3
- package/dist/bromcom-ui/bcm-list-select.entry.js +14 -13
- package/dist/bromcom-ui/bcm-list.entry.js +10 -5
- package/dist/bromcom-ui/bcm-listbox-group.entry.js +5 -4
- package/dist/bromcom-ui/bcm-listbox-item.entry.js +5 -4
- package/dist/bromcom-ui/bcm-listbox.entry.js +17 -14
- package/dist/bromcom-ui/bcm-menu-group.entry.js +4 -3
- package/dist/bromcom-ui/bcm-menu-item.entry.js +4 -3
- package/dist/bromcom-ui/bcm-menu.entry.js +4 -3
- package/dist/bromcom-ui/bcm-message.entry.js +54 -50
- package/dist/bromcom-ui/bcm-modal.entry.js +47 -160
- package/dist/bromcom-ui/bcm-notification.entry.js +59 -47
- package/dist/bromcom-ui/bcm-popconfirm-box.entry.js +61 -21
- package/dist/bromcom-ui/bcm-popconfirm.entry.js +49 -93
- package/dist/bromcom-ui/bcm-popover-box.entry.js +44 -16
- package/dist/bromcom-ui/bcm-popover.entry.js +61 -101
- package/dist/bromcom-ui/bcm-progress.entry.js +77 -63
- package/dist/bromcom-ui/bcm-pulldown-group.entry.js +5 -4
- package/dist/bromcom-ui/bcm-pulldown-item.entry.js +4 -3
- package/dist/bromcom-ui/bcm-pulldown.entry.js +5 -4
- package/dist/bromcom-ui/bcm-radio-group.entry.js +183 -85
- package/dist/bromcom-ui/bcm-radio.entry.js +59 -79
- package/dist/bromcom-ui/bcm-range.entry.js +161 -0
- package/dist/bromcom-ui/bcm-result.entry.js +62 -38
- package/dist/bromcom-ui/bcm-search-2.entry.js +219 -0
- package/dist/bromcom-ui/bcm-search.entry.js +5 -4
- package/dist/bromcom-ui/bcm-select-box.entry.js +4 -3
- package/dist/bromcom-ui/bcm-select-group.entry.js +4 -3
- package/dist/bromcom-ui/bcm-select-option.entry.js +5 -4
- package/dist/bromcom-ui/bcm-select.entry.js +11 -12
- package/dist/bromcom-ui/bcm-selecto.entry.js +3 -2
- package/dist/bromcom-ui/bcm-slider.entry.js +4 -3
- package/dist/bromcom-ui/bcm-sub-comment.entry.js +5 -4
- package/dist/bromcom-ui/bcm-switch.entry.js +48 -37
- package/dist/bromcom-ui/bcm-tab-pane.entry.js +4 -3
- package/dist/bromcom-ui/bcm-tab.entry.js +8 -8
- package/dist/bromcom-ui/bcm-tabs-content.entry.js +5 -4
- package/dist/bromcom-ui/bcm-tabs.entry.js +6 -5
- package/dist/bromcom-ui/bcm-tag.entry.js +48 -44
- package/dist/bromcom-ui/bcm-text.entry.js +16 -10
- package/dist/bromcom-ui/bcm-textarea.entry.js +45 -68
- package/dist/bromcom-ui/bcm-time-picker.entry.js +4 -3
- package/dist/bromcom-ui/bcm-timeline-item.entry.js +10 -24
- package/dist/bromcom-ui/bcm-timeline.entry.js +11 -33
- package/dist/bromcom-ui/bcm-tooltip-box.entry.js +54 -16
- package/dist/bromcom-ui/bcm-tooltip.entry.js +48 -99
- package/dist/bromcom-ui/bcm-treeview-group.entry.js +1 -1
- package/dist/bromcom-ui/bcm-treeview-item.entry.js +5 -4
- package/dist/bromcom-ui/bcm-treeview.entry.js +6 -5
- package/dist/bromcom-ui/bcm-upload.entry.js +5 -4
- package/dist/bromcom-ui/bromcom-ui.css +40153 -35
- package/dist/bromcom-ui/bromcom-ui.esm.js +2 -2
- package/dist/bromcom-ui/caption-template-2d4ffc88.js +25 -0
- package/dist/bromcom-ui/color-helper-19448077.js +35 -0
- package/dist/bromcom-ui/{element-dragger-e40f0410.js → element-dragger-2a215f47.js} +1 -1
- package/dist/bromcom-ui/generate-8e440fc4.js +91 -0
- package/dist/bromcom-ui/index-55174f2a.js +58 -0
- package/dist/bromcom-ui/{index-9dbea026.js → index-dbc63c66.js} +2 -2
- package/dist/bromcom-ui/index-dd5c1283.js +187 -0
- package/dist/bromcom-ui/input-template-487d3243.js +83 -0
- package/dist/bromcom-ui/json-parse-decarator-223ea680.js +21 -0
- package/dist/bromcom-ui/label-template-501216fc.js +19 -0
- package/dist/bromcom-ui/number-helper-fea1966f.js +13 -0
- package/dist/bromcom-ui/{popover-placement-fb1f91e9.js → popover-placement-f7a6551c.js} +25 -17
- package/dist/bromcom-ui/property-decorators-21b15487.js +36 -0
- package/dist/bromcom-ui/slot-template-f79b82ee.js +9 -0
- package/dist/bromcom-ui/snq.es5-946822b8.js +14 -0
- package/dist/bromcom-ui/string-helper-35840f91.js +109 -0
- package/dist/bromcom-ui/types-6b2a6629.js +172 -0
- package/dist/bromcom-ui/{utils-1feb01eb.js → utils-333ded7f.js} +4 -1
- package/dist/types/components/atoms/avatar/avatar.d.ts +9 -5
- package/dist/types/components/atoms/badge/badge.d.ts +14 -9
- package/dist/types/components/atoms/button/button.d.ts +17 -10
- package/dist/types/components/atoms/button/types.d.ts +0 -22
- package/dist/types/components/atoms/divider/divider.d.ts +2 -2
- package/dist/types/components/atoms/icon/icon.d.ts +14 -9
- package/dist/types/components/atoms/label/label.d.ts +1 -2
- package/dist/types/components/atoms/link/link.d.ts +6 -1
- package/dist/types/components/atoms/states/badge.states.d.ts +7 -0
- package/dist/types/components/atoms/states/button.states.d.ts +7 -0
- package/dist/types/components/atoms/tag/tag.d.ts +14 -11
- package/dist/types/components/atoms/text/text.d.ts +4 -3
- package/dist/types/components/molecules/alert/alert.d.ts +15 -37
- package/dist/types/components/molecules/breadcrumb/breadcrumb.d.ts +9 -22
- package/dist/types/components/molecules/breadcrumb/types.d.ts +10 -0
- package/dist/types/components/molecules/checkbox/checkbox-lite.d.ts +7 -22
- package/dist/types/components/molecules/checkbox/checkbox.d.ts +26 -31
- package/dist/types/components/molecules/checkbox/group.d.ts +24 -83
- package/dist/types/components/molecules/collapse/collapse.d.ts +9 -6
- package/dist/types/components/molecules/collapse/group.d.ts +4 -2
- package/dist/types/components/molecules/dropdown/dropdown-button.d.ts +18 -31
- package/dist/types/components/molecules/dropdown/dropdown-item.d.ts +17 -16
- package/dist/types/components/molecules/dropdown/dropdown-list.d.ts +12 -35
- package/dist/types/components/molecules/dropdown/dropdown.d.ts +5 -30
- package/dist/types/components/molecules/empty/empty.d.ts +7 -24
- package/dist/types/components/molecules/empty/types.d.ts +0 -15
- package/dist/types/components/molecules/error-layout/error-layout.d.ts +6 -18
- package/dist/types/components/molecules/input/input.d.ts +39 -45
- package/dist/types/components/molecules/input/types.d.ts +13 -0
- package/dist/types/components/molecules/list/list-select.d.ts +0 -1
- package/dist/types/components/molecules/list/list.d.ts +0 -1
- package/dist/types/components/molecules/message/message.d.ts +13 -25
- package/dist/types/components/molecules/modal/modal.d.ts +12 -65
- package/dist/types/components/molecules/notification/notification.d.ts +14 -21
- package/dist/types/components/molecules/popconfirm/popconfirm-box.d.ts +14 -12
- package/dist/types/components/molecules/popconfirm/popconfirm.d.ts +10 -14
- package/dist/types/components/molecules/popover/popover-box.d.ts +10 -10
- package/dist/types/components/molecules/popover/popover.d.ts +13 -19
- package/dist/types/components/molecules/progress/progress.d.ts +8 -6
- package/dist/types/components/molecules/progress/types.d.ts +24 -0
- package/dist/types/components/molecules/radio/group.d.ts +28 -22
- package/dist/types/components/molecules/radio/radio.d.ts +13 -17
- package/dist/types/components/molecules/range/range.d.ts +36 -0
- package/dist/types/components/molecules/result/result.d.ts +14 -8
- package/dist/types/components/molecules/search-2/search-2.d.ts +30 -0
- package/dist/types/components/molecules/select/select.d.ts +4 -5
- package/dist/types/components/molecules/states/alert.states.d.ts +7 -0
- package/dist/types/components/molecules/states/checkbox-group.states.d.ts +53 -0
- package/dist/types/components/molecules/states/message.states.d.ts +7 -0
- package/dist/types/components/molecules/states/notification.states.d.ts +7 -0
- package/dist/types/components/molecules/states/radio-group.states.d.ts +47 -0
- package/dist/types/components/molecules/states/result.states.d.ts +7 -0
- package/dist/types/components/molecules/states/search.states.d.ts +13 -0
- package/dist/types/components/molecules/switch/switch.d.ts +18 -15
- package/dist/types/components/molecules/textarea/textarea.d.ts +23 -23
- package/dist/types/components/molecules/textarea/types.d.ts +9 -0
- package/dist/types/components/molecules/timeline/timeline-item.d.ts +0 -12
- package/dist/types/components/molecules/timeline/timeline.d.ts +2 -19
- package/dist/types/components/molecules/tooltip/tooltip-box.d.ts +11 -8
- package/dist/types/components/molecules/tooltip/tooltip.d.ts +13 -17
- package/dist/types/components/organism/colorpicker/colorpicker.d.ts +1 -2
- package/dist/types/components/organism/date-picker/date-picker.d.ts +7 -11
- package/dist/types/components/organism/datetime-picker/datetime-picker.d.ts +4 -5
- package/dist/types/components/organism/form/form.d.ts +2 -1
- package/dist/types/components/organism/list-2/list-2.d.ts +109 -0
- package/dist/types/components/organism/listbox/listbox.d.ts +1 -2
- package/dist/types/components/organism/states/bcm-list2.states.d.ts +24 -0
- package/dist/types/components/organism/tabs/tab.d.ts +2 -1
- package/dist/types/components/organism/time-picker/time-picker.d.ts +1 -1
- package/dist/types/components.d.ts +554 -511
- package/dist/types/decorators/json-parse-decarator.d.ts +4 -0
- package/dist/types/decorators/property-decorators.d.ts +6 -0
- package/dist/types/global/variables/colors.d.ts +0 -1
- package/dist/types/helper/generate.d.ts +4 -1
- package/dist/types/helper/number-helper.d.ts +9 -0
- package/dist/types/helper/string-helper.d.ts +3 -0
- package/dist/types/models/bcm.d.ts +1 -1
- package/dist/types/models/states/Atoms/bcm-Atoms-state.d.ts +34 -0
- package/dist/types/models/states/molecules/bcm-molecules-state.d.ts +78 -0
- package/dist/types/models/states/organisms/bcm-organisms-state.d.ts +71 -0
- package/dist/types/templates/button-template.d.ts +16 -0
- package/dist/types/templates/checkbox-group-template.d.ts +10 -0
- package/dist/types/templates/checkbox-template.d.ts +13 -0
- package/dist/types/templates/info-footer-template.d.ts +10 -0
- package/dist/types/templates/input-template.d.ts +30 -0
- package/dist/types/templates/list-item-template.d.ts +11 -0
- package/dist/types/templates/list-template.d.ts +23 -0
- package/dist/types/templates/tag-template.d.ts +17 -0
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/utils/popover-placement.d.ts +3 -3
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/bromcom-ui/bcm-content.entry.js +0 -15
- package/dist/bromcom-ui/bcm-dropdown-group.entry.js +0 -58
- package/dist/bromcom-ui/bcm-footer.entry.js +0 -15
- package/dist/bromcom-ui/bcm-header.entry.js +0 -15
- package/dist/bromcom-ui/datetime-helper-c373f888.js +0 -5
- package/dist/bromcom-ui/types-0e4b533d.js +0 -14
- package/dist/bromcom-ui/types-911a8837.js +0 -21
- package/dist/types/components/atoms/badge/types.d.ts +0 -4
- package/dist/types/components/molecules/checkbox/types.d.ts +0 -29
- package/dist/types/components/molecules/dropdown/dropdown-group.d.ts +0 -28
- package/dist/types/components/molecules/dropdown/types.d.ts +0 -20
- package/dist/types/components/molecules/error-layout/types.d.ts +0 -4
- package/dist/types/components/molecules/message/types.d.ts +0 -13
- package/dist/types/components/molecules/modal/modal-content.d.ts +0 -4
- package/dist/types/components/molecules/modal/modal-header.d.ts +0 -4
- package/dist/types/components/molecules/modal/model-footer.d.ts +0 -4
- package/dist/types/components/molecules/modal/types.d.ts +0 -41
- package/dist/types/components/molecules/notification/types.d.ts +0 -14
- package/dist/types/components/molecules/result/types.d.ts +0 -19
- package/dist/types/helper/datetime-helper.d.ts +0 -3
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h, f as Host } from './index-
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, e as createEvent, h, f as Host } from './index-dbc63c66.js';
|
|
2
|
+
import { G as Generate } from './generate-8e440fc4.js';
|
|
3
|
+
import './_commonjsHelpers-2088bffa.js';
|
|
4
|
+
import { c as classnames } from './index-55174f2a.js';
|
|
5
|
+
import './snq.es5-946822b8.js';
|
|
6
|
+
import { B as Bcm } from './bcm-ad02f9c9.js';
|
|
7
|
+
import { S as StringHelper } from './string-helper-35840f91.js';
|
|
8
|
+
import { C as CaptionTemplate } from './caption-template-2d4ffc88.js';
|
|
9
|
+
import { I as InputTemplate } from './input-template-487d3243.js';
|
|
10
|
+
import { N as NumberHelper } from './number-helper-fea1966f.js';
|
|
3
11
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
class Validators {
|
|
13
|
+
}
|
|
14
|
+
Validators.isEmailValid = (str) => /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(str);
|
|
15
|
+
Validators.isUrlValid = (str) => /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(str);
|
|
16
|
+
Validators.isNumberValid = (str) => /^\d+$/.test(str);
|
|
17
|
+
Validators.isNumberFloatValid = (str) => /^\d+(\.\d+)?$/.test(str);
|
|
18
|
+
Validators.isPhoneValid = (str) => /^(?=.*[0-9])[- +()0-9]+$/.test(str);
|
|
19
|
+
Validators.isValidate = (str, type) => {
|
|
20
|
+
switch (type) {
|
|
21
|
+
case 'email':
|
|
22
|
+
return Validators.isEmailValid(str);
|
|
23
|
+
case 'url':
|
|
24
|
+
return Validators.isUrlValid(str);
|
|
25
|
+
case 'number':
|
|
26
|
+
return Validators.isNumberValid(str) || Validators.isNumberFloatValid(str);
|
|
27
|
+
case 'phone':
|
|
28
|
+
return Validators.isPhoneValid(str);
|
|
29
|
+
default:
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
17
32
|
};
|
|
33
|
+
|
|
18
34
|
const BcmInput = class {
|
|
19
35
|
constructor(hostRef) {
|
|
20
36
|
registerInstance(this, hostRef);
|
|
@@ -23,40 +39,68 @@ const BcmInput = class {
|
|
|
23
39
|
this.clear = createEvent(this, "bcm-clear", 7);
|
|
24
40
|
this.change = createEvent(this, "bcm-change", 7);
|
|
25
41
|
this.input = createEvent(this, "bcm-input", 7);
|
|
26
|
-
|
|
27
|
-
this.
|
|
42
|
+
/** Props **/
|
|
43
|
+
this._id = Generate.UID();
|
|
44
|
+
this._internal_id = Generate.UID();
|
|
28
45
|
this.value = '';
|
|
29
|
-
this.size =
|
|
30
|
-
this.noCaption = false;
|
|
31
|
-
this.noMargin = false;
|
|
32
|
-
this.captionType = 'default';
|
|
33
|
-
this.fullWidth = false;
|
|
46
|
+
this.size = Bcm.Size.medium;
|
|
34
47
|
this.disabled = false;
|
|
35
48
|
this.readonly = false;
|
|
36
49
|
this.clearable = false;
|
|
37
|
-
this.
|
|
38
|
-
this.unit = null;
|
|
39
|
-
this.unitPrefix = null;
|
|
40
|
-
this.min = null;
|
|
41
|
-
this.max = null;
|
|
42
|
-
this.step = null;
|
|
50
|
+
this.type = Bcm.InputType.text;
|
|
43
51
|
this.hidden = false;
|
|
44
52
|
this.required = false;
|
|
45
|
-
this.
|
|
53
|
+
this.fullWidth = false;
|
|
54
|
+
this.noMargin = false;
|
|
55
|
+
this.disableWatchValue = false; // datetimepicker
|
|
56
|
+
this.passwordToggle = false; // type password
|
|
46
57
|
this.maxLength = null;
|
|
58
|
+
this.unitPrefix = null;
|
|
59
|
+
this.decimal = true;
|
|
60
|
+
this.noCaption = false;
|
|
61
|
+
this.captionType = Bcm.Status.default;
|
|
62
|
+
/** initial States **/
|
|
47
63
|
this.inValid = false;
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
64
|
+
this.valueCache = '';
|
|
65
|
+
this.focused = false;
|
|
50
66
|
this.isPasswordVisible = false;
|
|
67
|
+
this.isBlur = false;
|
|
68
|
+
}
|
|
69
|
+
connectedCallback() {
|
|
70
|
+
this.valueCache = this.value;
|
|
71
|
+
this.captionCache = this.caption;
|
|
72
|
+
this.captionTypeCache = this.captionType;
|
|
73
|
+
}
|
|
74
|
+
componentWillRender() {
|
|
75
|
+
const { type, isBlur, value } = this;
|
|
76
|
+
if (value) {
|
|
77
|
+
switch (type) {
|
|
78
|
+
case "number":
|
|
79
|
+
{
|
|
80
|
+
!this.checkValid("number") && (this.validationRange());
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
case "email":
|
|
84
|
+
{
|
|
85
|
+
isBlur && (this.checkValid("email"));
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case "tel":
|
|
89
|
+
{
|
|
90
|
+
isBlur && (this.checkValid("phone"));
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
51
95
|
}
|
|
52
|
-
async
|
|
96
|
+
async onBcmFocus() {
|
|
53
97
|
this.inputElement.focus();
|
|
54
98
|
}
|
|
55
|
-
async
|
|
99
|
+
async onBcmBlur() {
|
|
56
100
|
this.inputElement.blur();
|
|
57
101
|
}
|
|
58
|
-
async
|
|
59
|
-
|
|
102
|
+
async onBcmSelect() {
|
|
103
|
+
this.inputElement.select();
|
|
60
104
|
}
|
|
61
105
|
async setValue(value) {
|
|
62
106
|
this.inputElement.value = value;
|
|
@@ -67,7 +111,6 @@ const BcmInput = class {
|
|
|
67
111
|
async setClear() {
|
|
68
112
|
this.inputElement.value = '';
|
|
69
113
|
this.value = '';
|
|
70
|
-
return Promise.resolve();
|
|
71
114
|
}
|
|
72
115
|
async resetCaption() {
|
|
73
116
|
this.caption = this.captionCache;
|
|
@@ -77,19 +120,45 @@ const BcmInput = class {
|
|
|
77
120
|
async getValue() {
|
|
78
121
|
return this.value;
|
|
79
122
|
}
|
|
123
|
+
watchValue() {
|
|
124
|
+
if (!this.disableWatchValue && this.type != 'number') {
|
|
125
|
+
this.handleChange();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
listenKeyDown(e) {
|
|
129
|
+
if (!this.disabled && !this.readonly) {
|
|
130
|
+
this.onBcmFocus();
|
|
131
|
+
if (this.type == "number") {
|
|
132
|
+
var which = e.which || 0;
|
|
133
|
+
var key = e.key;
|
|
134
|
+
if (which == 38) { // up arrow
|
|
135
|
+
e.preventDefault(),
|
|
136
|
+
this.stepUpOrDown('up');
|
|
137
|
+
}
|
|
138
|
+
if (which == 40) { // down arrow
|
|
139
|
+
e.preventDefault(),
|
|
140
|
+
this.stepUpOrDown('down');
|
|
141
|
+
}
|
|
142
|
+
if ((which == 190 || which == 110 || key == ".") && this.value.indexOf(".") > -1) { //.
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
}
|
|
145
|
+
if ((which == 189 || which == 109 || key == "-")) { //-
|
|
146
|
+
if (this.value.charAt(0) == '-' || this.value.indexOf("-") > -1) {
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
80
153
|
handleFocus() {
|
|
81
|
-
this.
|
|
154
|
+
this.focused = true;
|
|
82
155
|
this.focus.emit();
|
|
156
|
+
this.whatchHasFocus();
|
|
83
157
|
}
|
|
84
158
|
handleBlur() {
|
|
85
|
-
this.
|
|
159
|
+
this.focused = false;
|
|
86
160
|
this.isBlur = true;
|
|
87
|
-
|
|
88
|
-
this.isEmailValid();
|
|
89
|
-
}
|
|
90
|
-
if (this.type == "tel") {
|
|
91
|
-
this.isTelValid();
|
|
92
|
-
}
|
|
161
|
+
this.whatchHasFocus();
|
|
93
162
|
this.blur.emit();
|
|
94
163
|
}
|
|
95
164
|
handleChange() {
|
|
@@ -97,15 +166,6 @@ const BcmInput = class {
|
|
|
97
166
|
this.change.emit(this.value);
|
|
98
167
|
}
|
|
99
168
|
handleInput() {
|
|
100
|
-
if (this.type == "number") {
|
|
101
|
-
if (this.decimal == "false") {
|
|
102
|
-
this.inputElement.value = this.inputElement.value.replace(/[^0-9-]/g, '');
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
this.inputElement.value = this.inputElement.value.replace(/[^0-9.,-]/g, '');
|
|
106
|
-
}
|
|
107
|
-
this.inputElement.value = this.inputElement.value.replace(/(\..*)\./g, '$1').replace(/(\-.*)\-/g, '$1');
|
|
108
|
-
}
|
|
109
169
|
this.value = this.inputElement.value;
|
|
110
170
|
this.input.emit(this.value);
|
|
111
171
|
}
|
|
@@ -113,268 +173,102 @@ const BcmInput = class {
|
|
|
113
173
|
this.inputElement.value = '';
|
|
114
174
|
this.value = '';
|
|
115
175
|
this.inputElement.focus();
|
|
116
|
-
this.change.emit(this.value);
|
|
117
176
|
this.clear.emit(e);
|
|
118
177
|
e.stopPropagation();
|
|
119
178
|
}
|
|
120
179
|
changePasswordVisibility() {
|
|
121
180
|
this.isPasswordVisible = !this.isPasswordVisible;
|
|
122
181
|
}
|
|
123
|
-
incrementNumber() {
|
|
124
|
-
if (!this.inValid && !this.disabled && !this.readonly) {
|
|
125
|
-
let step = this.getNumberStep();
|
|
126
|
-
let val = Number(this.value) + Number(step);
|
|
127
|
-
this.value = this.numberDecimal(val);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
decrementNumber() {
|
|
131
|
-
if (!this.inValid && !this.disabled && !this.readonly) {
|
|
132
|
-
let step = this.getNumberStep();
|
|
133
|
-
let val = Number(this.value) - Number(step);
|
|
134
|
-
this.value = this.numberDecimal(val);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
getNumberStep(step = Number(this.step)) {
|
|
138
|
-
let returnStep = 1;
|
|
139
|
-
if (step && Number(step) == step)
|
|
140
|
-
returnStep = step;
|
|
141
|
-
return Number(returnStep);
|
|
142
|
-
}
|
|
143
|
-
connectedCallback() {
|
|
144
|
-
this.changePasswordVisibility = this.changePasswordVisibility.bind(this);
|
|
145
|
-
this.handleChange = this.handleChange.bind(this);
|
|
146
|
-
this.handleBlur = this.handleBlur.bind(this);
|
|
147
|
-
this.handleFocus = this.handleFocus.bind(this);
|
|
148
|
-
this.handleInput = this.handleInput.bind(this);
|
|
149
|
-
this.handleClear = this.handleClear.bind(this);
|
|
150
|
-
this.incrementNumber = this.incrementNumber.bind(this);
|
|
151
|
-
this.decrementNumber = this.decrementNumber.bind(this);
|
|
152
|
-
this.valueCache = this.value;
|
|
153
|
-
this.captionCache = this.caption;
|
|
154
|
-
this.captionTypeCache = this.captionType;
|
|
155
|
-
}
|
|
156
|
-
validationRange(val = JSON.stringify({
|
|
157
|
-
"value": this.value,
|
|
158
|
-
"min": this.min,
|
|
159
|
-
"max": this.max
|
|
160
|
-
})) {
|
|
161
|
-
let cap = null;
|
|
162
|
-
let capType = null;
|
|
163
|
-
let returnValidation = true;
|
|
164
|
-
let item = JSON.parse(val);
|
|
165
|
-
let { length, value, min, max } = item;
|
|
166
|
-
length = parseFloat(length);
|
|
167
|
-
value = parseFloat(value);
|
|
168
|
-
min = parseFloat(min);
|
|
169
|
-
max = parseFloat(max);
|
|
170
|
-
length !== 0 && (value && (min && max && ((value < min || value > max) && (cap = "Please enter a value between " + min + " and " + max + ".",
|
|
171
|
-
capType = "error",
|
|
172
|
-
returnValidation = false)) || min && !max && (value < min && (cap = "Please enter a value greater than or equal to " + min + ".",
|
|
173
|
-
capType = "error",
|
|
174
|
-
returnValidation = false)) || !min && max && (value > max && (cap = "Please enter a value less than or equal to " + max + ".",
|
|
175
|
-
capType = "error",
|
|
176
|
-
returnValidation = false))));
|
|
177
|
-
this.setCaption(cap, capType);
|
|
178
|
-
return returnValidation;
|
|
179
|
-
}
|
|
180
182
|
setCaption(caption = null, captionType = null) {
|
|
181
|
-
this.caption = caption
|
|
182
|
-
this.captionType = captionType
|
|
183
|
+
this.caption = caption || this.captionCache;
|
|
184
|
+
this.captionType = captionType || this.captionTypeCache;
|
|
183
185
|
this.captionError = captionType == "error" ? caption : null;
|
|
184
186
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
cap = "Please enter a valid email address.",
|
|
192
|
-
capType = "error",
|
|
193
|
-
this.inValid = true;
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
this.inValid = false;
|
|
197
|
-
}
|
|
198
|
-
this.setCaption(cap, capType);
|
|
199
|
-
return this.inValid;
|
|
200
|
-
}
|
|
201
|
-
isTelValid() {
|
|
202
|
-
const { value } = this;
|
|
203
|
-
const regexp = new RegExp(/^(?=.*[0-9])[- +()0-9]+$/);
|
|
204
|
-
let cap = null;
|
|
205
|
-
let capType = null;
|
|
206
|
-
if (value && !regexp.test(value)) {
|
|
207
|
-
cap = "Please enter a valid phone number.",
|
|
208
|
-
capType = "error",
|
|
209
|
-
this.inValid = true;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
this.inValid = false;
|
|
213
|
-
}
|
|
214
|
-
this.setCaption(cap, capType);
|
|
215
|
-
return this.inValid;
|
|
216
|
-
}
|
|
217
|
-
isNumberValid(caption = "Invalid number", captionType = "error") {
|
|
218
|
-
const { value } = this;
|
|
219
|
-
if (value && Number(value) != value) {
|
|
220
|
-
this.inValid = true;
|
|
221
|
-
this.setCaption(caption, captionType);
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
this.inValid = false;
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
setNumberUnit() {
|
|
228
|
-
const { value, unit } = this;
|
|
229
|
-
if (Number(value) == value && (unit === null || unit === void 0 ? void 0 : unit.length) > 0 && !value)
|
|
230
|
-
this.value = 0;
|
|
231
|
-
}
|
|
232
|
-
numberDecimal(val = '') {
|
|
233
|
-
let decLen = this.getDecimalLength();
|
|
234
|
-
if (val && decLen)
|
|
235
|
-
return parseFloat(val).toFixed(decLen);
|
|
236
|
-
return val;
|
|
237
|
-
}
|
|
238
|
-
numberNotDecimal(val = 0) {
|
|
239
|
-
return Math.trunc(val);
|
|
240
|
-
}
|
|
241
|
-
getDecimalLength() {
|
|
242
|
-
const { step } = this;
|
|
243
|
-
var decimalNumber = null;
|
|
244
|
-
let returnDecimalLength = 0, splitted, splitDec;
|
|
245
|
-
if (decimalNumber && Number(decimalNumber) == decimalNumber) {
|
|
246
|
-
returnDecimalLength = decimalNumber;
|
|
247
|
-
}
|
|
248
|
-
else if (!decimalNumber && step && Number(step) == step) {
|
|
249
|
-
if (String(step).includes(".")) {
|
|
250
|
-
splitted = String(step).split('.');
|
|
251
|
-
splitDec = splitted[splitted.length - 1].length;
|
|
187
|
+
stepUpOrDown(type) {
|
|
188
|
+
if (!this.inValid && !this.disabled && !this.readonly) {
|
|
189
|
+
let step = +(this.step) || 1;
|
|
190
|
+
let val = +(this.value);
|
|
191
|
+
if (type == 'up') {
|
|
192
|
+
val = +(val + step);
|
|
252
193
|
}
|
|
253
194
|
else {
|
|
254
|
-
|
|
195
|
+
val = +(val - step);
|
|
255
196
|
}
|
|
256
|
-
|
|
197
|
+
this.value = val;
|
|
257
198
|
}
|
|
258
|
-
return Number(returnDecimalLength);
|
|
259
199
|
}
|
|
260
|
-
|
|
261
|
-
const {
|
|
262
|
-
if (
|
|
263
|
-
if (
|
|
264
|
-
|
|
200
|
+
validationRange() {
|
|
201
|
+
const { min, max, value } = this;
|
|
202
|
+
if (value) {
|
|
203
|
+
if (min && max) {
|
|
204
|
+
if (value < min || value > max) {
|
|
205
|
+
this.setCaption(StringHelper.getMessage('between', [min, max]), "error");
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
265
208
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
209
|
+
else if (min) {
|
|
210
|
+
if (value < min) {
|
|
211
|
+
this.setCaption(StringHelper.getMessage('min', [min]), "error");
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
270
214
|
}
|
|
271
|
-
if (
|
|
272
|
-
|
|
215
|
+
else if (max) {
|
|
216
|
+
if (value > max) {
|
|
217
|
+
this.setCaption(StringHelper.getMessage('max', [max]), "error");
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
273
220
|
}
|
|
274
221
|
}
|
|
222
|
+
this.setCaption();
|
|
223
|
+
return true;
|
|
275
224
|
}
|
|
276
|
-
|
|
277
|
-
const {
|
|
278
|
-
if (
|
|
279
|
-
this.
|
|
225
|
+
checkValid(type) {
|
|
226
|
+
const { value } = this;
|
|
227
|
+
if (Validators.isValidate(value, type)) {
|
|
228
|
+
this.setCaption();
|
|
229
|
+
this.inValid = false;
|
|
280
230
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (this.type == "number") {
|
|
285
|
-
var which = e.which || 0;
|
|
286
|
-
var key = e.key;
|
|
287
|
-
which == 38 && ( // up arrow
|
|
288
|
-
e.preventDefault(),
|
|
289
|
-
this.incrementNumber());
|
|
290
|
-
which == 40 && ( // down arrow
|
|
291
|
-
e.preventDefault(),
|
|
292
|
-
this.decrementNumber());
|
|
293
|
-
key == "." && String(this.value).includes(".") && ( // dot: shouldn't be more than one
|
|
294
|
-
e.preventDefault());
|
|
295
|
-
if (which == 8 || //backspace / delete
|
|
296
|
-
which == 9 || //tab
|
|
297
|
-
which == 13 || //enter
|
|
298
|
-
which == 16 || //shift
|
|
299
|
-
which == 17 || //ctrl
|
|
300
|
-
which == 18 || //alt
|
|
301
|
-
which == 46 || //delete
|
|
302
|
-
(which == 110 && (this.type == 'number' && this.decimal != false)) || //decimal point
|
|
303
|
-
// (which == 188 && key == ",") || //comma
|
|
304
|
-
(which == 190 && key == "." && (this.type == 'number' && this.decimal != false)) || //period
|
|
305
|
-
(which == 189 && this.inputElement.value.length == 0) || //-
|
|
306
|
-
(which == 109 && this.inputElement.value.length == 0) || //-
|
|
307
|
-
(which >= 35 && which <= 40) || //end, home, left arrow, up arrow, right arrow, down arrow
|
|
308
|
-
(which >= 48 && which <= 57) || //0-9
|
|
309
|
-
(which >= 96 && which <= 105) //0-9(numpad)
|
|
310
|
-
)
|
|
311
|
-
return true;
|
|
312
|
-
e.preventDefault();
|
|
313
|
-
if (this.decimal == true) {
|
|
314
|
-
this.value = this.numberDecimal(this.value);
|
|
315
|
-
}
|
|
316
|
-
else if (this.decimal == false) {
|
|
317
|
-
this.value = this.numberNotDecimal(this.value);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
231
|
+
else {
|
|
232
|
+
this.setCaption(StringHelper.getMessage(type), "error");
|
|
233
|
+
this.inValid = true;
|
|
320
234
|
}
|
|
235
|
+
return this.inValid;
|
|
321
236
|
}
|
|
322
237
|
whatchHasFocus() {
|
|
323
|
-
const { type,
|
|
324
|
-
if (type ==
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (hasFocus == true) {
|
|
328
|
-
if (inValid == true) {
|
|
329
|
-
this.value = '';
|
|
330
|
-
inValidState = true;
|
|
331
|
-
}
|
|
238
|
+
const { type, focused, valueCache, inValid } = this;
|
|
239
|
+
if (type == Bcm.InputType.number && inValid) {
|
|
240
|
+
if (focused) {
|
|
241
|
+
this.value = '';
|
|
332
242
|
}
|
|
333
243
|
else {
|
|
334
|
-
if (this.value
|
|
335
|
-
this.value =
|
|
336
|
-
inValidState = true;
|
|
244
|
+
if (!StringHelper.isNullOrEmpty(this.value)) {
|
|
245
|
+
this.value = this.value ? this.fixToNumber(this.value) : '';
|
|
337
246
|
}
|
|
338
|
-
|
|
339
|
-
this.value =
|
|
247
|
+
else {
|
|
248
|
+
this.value = valueCache;
|
|
340
249
|
}
|
|
341
250
|
}
|
|
342
251
|
}
|
|
343
252
|
}
|
|
344
|
-
|
|
345
|
-
if (
|
|
346
|
-
this.
|
|
253
|
+
fixToNumber(val) {
|
|
254
|
+
if (val) {
|
|
255
|
+
const decLen = NumberHelper.getDecimalLength(this.step);
|
|
256
|
+
return decLen > 0 ? NumberHelper.parseFloatFixed(val, decLen) : val;
|
|
347
257
|
}
|
|
258
|
+
return val;
|
|
348
259
|
}
|
|
349
260
|
render() {
|
|
350
|
-
const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable, passwordToggle, isPasswordVisible, noDefaultIcon, unit, inValid,
|
|
351
|
-
const
|
|
261
|
+
const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable, passwordToggle, isPasswordVisible, noDefaultIcon, unit, inValid, focused, unitPrefix, noCaption, required, hidden, noMargin, _id } = this;
|
|
262
|
+
const hostClasses = classnames('bcm-input', {
|
|
263
|
+
hidden,
|
|
264
|
+
'no-margin': noMargin,
|
|
352
265
|
'full-width': fullWidth,
|
|
353
|
-
'error': captionType == 'error' ? true : false
|
|
354
|
-
});
|
|
355
|
-
const baseClasses = classnames('input-base', 'input-' + size, {
|
|
356
|
-
'invalid': inValid,
|
|
357
|
-
'unit': (unit === null || unit === void 0 ? void 0 : unit.length) > 0,
|
|
358
|
-
'focused': hasFocus,
|
|
359
|
-
'disabled': disabled,
|
|
360
|
-
'readonly': readonly,
|
|
361
|
-
'empty': (value === null || value === void 0 ? void 0 : value.length) < 1
|
|
362
266
|
});
|
|
363
|
-
|
|
364
|
-
const captionClasses = classnames('size-1', 'input-caption', 'caption-' + captionType);
|
|
365
|
-
const hostClasses = classnames(this.hidden ? 'hidden' : null, this.noMargin ? 'no-margin' : null);
|
|
366
|
-
return (h(Host, { class: hostClasses }, h("div", { class: containerClasses }, label && h("div", null, h("bcm-label", { tooltip: this.tooltip, type: captionType, value: label, required: required, htmlFor: this.inputId })), h("div", { class: baseClasses }, h("span", { class: "input-prefix" }, h("slot", { name: "prefix" }), unitPrefix && h("span", { class: classnames(inputClass, 'unit-prefix') }, unitPrefix)), h("input", { "bcm-internal-id": this._id, id: this.inputId, class: inputClass, ref: el => (this.inputElement = el), onFocus: this.handleFocus, onBlur: this.handleBlur, onChange: this.handleChange, onInput: this.handleInput, maxLength: this.maxLength, type: type === 'password' && isPasswordVisible ? 'text' :
|
|
367
|
-
type === 'number' ? 'text' : type, placeholder: placeholder, value: type === 'number' && !this.hasFocus
|
|
368
|
-
? value + (value && (unit === null || unit === void 0 ? void 0 : unit.length) > 0 ? ' ' + unit : '')
|
|
369
|
-
: value, disabled: this.disabled, readonly: this.readonly }), clearable && !this.disabled && (h("button", { class: "input-clear-button", onClick: this.handleClear }, h("bcm-icon", { icon: "close-circle", type: "fill", size: iconSizes[size], color: "grey-7" }))), type === 'password' && passwordToggle && (h("button", { class: "input-password-toggle", onClick: this.changePasswordVisibility }, h("bcm-icon", { icon: isPasswordVisible ? "eye-invisible" : "eye", type: "outlined", size: iconSizes[size], color: "grey-7" }))), Object.keys(defaultIcons).includes(type) && !noDefaultIcon && (h("span", { class: "input-suffix default-icon" }, h("bcm-icon", { icon: defaultIcons[type], type: "outlined", size: iconSizes[size], color: "grey-7" }))), type === 'number' && (h("div", { class: classnames('caret-container', { 'unit': (unit === null || unit === void 0 ? void 0 : unit.length) > 0 }, { 'disabled': inValid }, { 'disabled': readonly }) }, h("span", { class: "caret", onClick: inValid == false && this.incrementNumber }, h("bcm-icon", { icon: "caret-up", type: "outlined", color: "grey-7", size: 8 })), h("span", { class: "caret", onClick: inValid == false && this.decrementNumber }, h("bcm-icon", { icon: "caret-down", type: "outlined", color: "grey-7", size: 8 })))), type !== 'number' && (h("span", { class: "input-suffix" }, h("slot", { name: "suffix" })))), !noCaption && (h("div", { class: "caption-area" }, captionType == "error"
|
|
370
|
-
? h("span", { class: captionClasses }, " ", captionError, " ")
|
|
371
|
-
: caption && h("span", { class: captionClasses }, " ", caption, " "))))));
|
|
267
|
+
return (h(Host, { tabindex: "1", onfocus: () => this.onBcmFocus(), class: hostClasses, onClick: () => this.onBcmFocus() }, label && h("bcm-label", { type: captionType, value: label, required: required, htmlFor: _id }), h(InputTemplate, { id: _id, type: type, value: value, placeholder: placeholder, disabled: disabled, readonly: readonly, clearable: clearable, passwordToggle: passwordToggle, isPasswordVisible: isPasswordVisible, noDefaultIcon: noDefaultIcon, focused: focused, inValid: inValid, unitPrefix: unitPrefix, maxLength: this.maxLength, internalId: this._internal_id, captionType: captionType, unit: unit, size: size, handleFocus: () => this.handleFocus(), handleBlur: () => this.handleBlur(), handleChange: () => this.handleChange(), handleInput: () => this.handleInput(), steps: (e) => this.stepUpOrDown(e), changePasswordVisibility: () => this.changePasswordVisibility(), handleClear: (e) => this.handleClear(e), ref: (el) => this.inputElement = el }), h(CaptionTemplate, { noCaption: noCaption, captionType: captionType, captionError: captionError, caption: caption })));
|
|
372
268
|
}
|
|
373
269
|
static get watchers() { return {
|
|
374
|
-
"hasFocus": ["whatchHasFocus"],
|
|
375
270
|
"value": ["watchValue"]
|
|
376
271
|
}; }
|
|
377
272
|
};
|
|
378
|
-
BcmInput.style = inputCss;
|
|
379
273
|
|
|
380
274
|
export { BcmInput as bcm_input };
|