bromcom-ui 2.3.70 → 2.3.71
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/bcm-alert.entry.js +58 -53
- package/dist/bromcom-ui/bcm-autocomplete.entry.js +3 -4
- package/dist/bromcom-ui/bcm-avatar.entry.js +28 -27
- package/dist/bromcom-ui/bcm-badge.entry.js +31 -60
- package/dist/bromcom-ui/bcm-breadcrumb.entry.js +32 -26
- package/dist/bromcom-ui/bcm-button.entry.js +215 -92
- 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 +4 -5
- package/dist/bromcom-ui/bcm-checkbox-group.entry.js +227 -253
- package/dist/bromcom-ui/bcm-checkbox-lite.entry.js +26 -29
- package/dist/bromcom-ui/bcm-checkbox.entry.js +89 -85
- package/dist/bromcom-ui/bcm-collapse-group.entry.js +16 -11
- package/dist/bromcom-ui/bcm-collapse.entry.js +18 -31
- package/dist/bromcom-ui/bcm-colorpicker.entry.js +6 -7
- package/dist/bromcom-ui/bcm-comment-editor.entry.js +3 -4
- package/dist/bromcom-ui/bcm-comment-group.entry.js +3 -4
- package/dist/bromcom-ui/bcm-comment.entry.js +4 -5
- package/dist/bromcom-ui/bcm-content.entry.js +15 -0
- package/dist/bromcom-ui/bcm-date-picker.entry.js +34 -31
- package/dist/bromcom-ui/bcm-datetime-picker.entry.js +100 -64
- package/dist/bromcom-ui/bcm-divider.entry.js +11 -11
- package/dist/bromcom-ui/bcm-dropdown-button.entry.js +61 -35
- package/dist/bromcom-ui/bcm-dropdown-group.entry.js +58 -0
- package/dist/bromcom-ui/bcm-dropdown-item.entry.js +16 -66
- package/dist/bromcom-ui/bcm-dropdown-list.entry.js +49 -31
- package/dist/bromcom-ui/bcm-dropdown.entry.js +46 -17
- package/dist/bromcom-ui/bcm-empty.entry.js +45 -14
- package/dist/bromcom-ui/bcm-error-layout.entry.js +34 -20
- package/dist/bromcom-ui/bcm-footer.entry.js +15 -0
- package/dist/bromcom-ui/bcm-form-group.entry.js +3 -3
- package/dist/bromcom-ui/bcm-form.entry.js +16 -31
- package/dist/bromcom-ui/bcm-header.entry.js +15 -0
- package/dist/bromcom-ui/bcm-icon.entry.js +35 -55
- package/dist/bromcom-ui/bcm-input.entry.js +276 -170
- package/dist/bromcom-ui/bcm-label.entry.js +75 -10
- package/dist/bromcom-ui/bcm-link.entry.js +5 -26
- package/dist/bromcom-ui/bcm-list-item.entry.js +3 -4
- package/dist/bromcom-ui/bcm-list-select.entry.js +13 -14
- package/dist/bromcom-ui/bcm-list.entry.js +5 -10
- package/dist/bromcom-ui/bcm-listbox-group.entry.js +4 -5
- package/dist/bromcom-ui/bcm-listbox-item.entry.js +4 -5
- package/dist/bromcom-ui/bcm-listbox.entry.js +14 -17
- package/dist/bromcom-ui/bcm-menu-group.entry.js +3 -4
- package/dist/bromcom-ui/bcm-menu-item.entry.js +3 -4
- package/dist/bromcom-ui/bcm-menu.entry.js +3 -4
- package/dist/bromcom-ui/bcm-message.entry.js +50 -54
- package/dist/bromcom-ui/bcm-modal.entry.js +160 -47
- package/dist/bromcom-ui/bcm-notification.entry.js +47 -59
- package/dist/bromcom-ui/bcm-popconfirm-box.entry.js +21 -61
- package/dist/bromcom-ui/bcm-popconfirm.entry.js +93 -49
- package/dist/bromcom-ui/bcm-popover-box.entry.js +16 -44
- package/dist/bromcom-ui/bcm-popover.entry.js +101 -61
- package/dist/bromcom-ui/bcm-progress.entry.js +63 -77
- package/dist/bromcom-ui/bcm-pulldown-group.entry.js +4 -5
- package/dist/bromcom-ui/bcm-pulldown-item.entry.js +3 -4
- package/dist/bromcom-ui/bcm-pulldown.entry.js +4 -5
- package/dist/bromcom-ui/bcm-radio-group.entry.js +85 -183
- package/dist/bromcom-ui/bcm-radio.entry.js +79 -59
- package/dist/bromcom-ui/bcm-result.entry.js +38 -62
- package/dist/bromcom-ui/bcm-search.entry.js +4 -5
- package/dist/bromcom-ui/bcm-select-box.entry.js +6 -4
- package/dist/bromcom-ui/bcm-select-group.entry.js +3 -4
- package/dist/bromcom-ui/bcm-select-option.entry.js +4 -5
- package/dist/bromcom-ui/bcm-select.entry.js +53 -37
- package/dist/bromcom-ui/bcm-selecto.entry.js +2 -3
- package/dist/bromcom-ui/bcm-slider.entry.js +3 -4
- package/dist/bromcom-ui/bcm-sub-comment.entry.js +4 -5
- package/dist/bromcom-ui/bcm-switch.entry.js +37 -48
- package/dist/bromcom-ui/bcm-tab-pane.entry.js +3 -4
- package/dist/bromcom-ui/bcm-tab.entry.js +8 -8
- package/dist/bromcom-ui/bcm-tabs-content.entry.js +4 -5
- package/dist/bromcom-ui/bcm-tabs.entry.js +5 -6
- package/dist/bromcom-ui/bcm-tag.entry.js +44 -48
- package/dist/bromcom-ui/bcm-text.entry.js +10 -16
- package/dist/bromcom-ui/bcm-textarea.entry.js +68 -45
- package/dist/bromcom-ui/bcm-time-picker.entry.js +3 -4
- package/dist/bromcom-ui/bcm-timeline-item.entry.js +24 -10
- package/dist/bromcom-ui/bcm-timeline.entry.js +33 -11
- package/dist/bromcom-ui/bcm-tooltip-box.entry.js +16 -54
- package/dist/bromcom-ui/bcm-tooltip.entry.js +99 -48
- package/dist/bromcom-ui/bcm-treeview-group.entry.js +1 -1
- package/dist/bromcom-ui/bcm-treeview-item.entry.js +4 -5
- package/dist/bromcom-ui/bcm-treeview.entry.js +5 -6
- package/dist/bromcom-ui/bcm-upload.entry.js +4 -5
- package/dist/bromcom-ui/bromcom-ui.css +36 -40154
- package/dist/bromcom-ui/bromcom-ui.esm.js +2 -2
- package/dist/bromcom-ui/datetime-helper-c373f888.js +5 -0
- package/dist/bromcom-ui/{element-dragger-2a215f47.js → element-dragger-e40f0410.js} +1 -1
- package/dist/bromcom-ui/{_commonjsHelpers-2088bffa.js → index-43956e3c.js} +56 -1
- package/dist/bromcom-ui/{index-dbc63c66.js → index-9dbea026.js} +2 -2
- package/dist/bromcom-ui/{popover-placement-f7a6551c.js → popover-placement-fb1f91e9.js} +17 -25
- package/dist/bromcom-ui/{bcm-ad02f9c9.js → string-helper-1d51eff7.js} +23 -2
- package/dist/bromcom-ui/types-0e4b533d.js +14 -0
- package/dist/bromcom-ui/types-911a8837.js +21 -0
- package/dist/bromcom-ui/{utils-333ded7f.js → utils-1feb01eb.js} +1 -4
- package/dist/types/components/atoms/avatar/avatar.d.ts +5 -9
- package/dist/types/components/atoms/badge/badge.d.ts +9 -14
- package/dist/types/components/atoms/badge/types.d.ts +4 -0
- package/dist/types/components/atoms/button/button.d.ts +10 -17
- package/dist/types/components/atoms/button/types.d.ts +22 -0
- package/dist/types/components/atoms/divider/divider.d.ts +2 -2
- package/dist/types/components/atoms/icon/icon.d.ts +9 -14
- package/dist/types/components/atoms/label/label.d.ts +2 -1
- package/dist/types/components/atoms/link/link.d.ts +1 -6
- package/dist/types/components/atoms/tag/tag.d.ts +11 -14
- package/dist/types/components/atoms/text/text.d.ts +3 -4
- package/dist/types/components/molecules/alert/alert.d.ts +37 -15
- package/dist/types/components/molecules/breadcrumb/breadcrumb.d.ts +22 -9
- package/dist/types/components/molecules/checkbox/checkbox-lite.d.ts +22 -7
- package/dist/types/components/molecules/checkbox/checkbox.d.ts +31 -26
- package/dist/types/components/molecules/checkbox/group.d.ts +83 -24
- package/dist/types/components/molecules/checkbox/types.d.ts +29 -0
- package/dist/types/components/molecules/collapse/collapse.d.ts +6 -9
- package/dist/types/components/molecules/collapse/group.d.ts +2 -4
- package/dist/types/components/molecules/dropdown/dropdown-button.d.ts +31 -18
- package/dist/types/components/molecules/dropdown/dropdown-group.d.ts +28 -0
- package/dist/types/components/molecules/dropdown/dropdown-item.d.ts +16 -17
- package/dist/types/components/molecules/dropdown/dropdown-list.d.ts +35 -12
- package/dist/types/components/molecules/dropdown/dropdown.d.ts +30 -5
- package/dist/types/components/molecules/dropdown/types.d.ts +20 -0
- package/dist/types/components/molecules/empty/empty.d.ts +24 -7
- package/dist/types/components/molecules/empty/types.d.ts +15 -0
- package/dist/types/components/molecules/error-layout/error-layout.d.ts +18 -6
- package/dist/types/components/molecules/error-layout/types.d.ts +4 -0
- package/dist/types/components/molecules/input/input.d.ts +45 -39
- package/dist/types/components/molecules/list/list-select.d.ts +1 -0
- package/dist/types/components/molecules/list/list.d.ts +1 -0
- package/dist/types/components/molecules/message/message.d.ts +25 -13
- package/dist/types/components/molecules/message/types.d.ts +13 -0
- package/dist/types/components/molecules/modal/modal-content.d.ts +4 -0
- package/dist/types/components/molecules/modal/modal-header.d.ts +4 -0
- package/dist/types/components/molecules/modal/modal.d.ts +65 -12
- package/dist/types/components/molecules/modal/model-footer.d.ts +4 -0
- package/dist/types/components/molecules/modal/types.d.ts +41 -0
- package/dist/types/components/molecules/notification/notification.d.ts +21 -14
- package/dist/types/components/molecules/notification/types.d.ts +14 -0
- package/dist/types/components/molecules/popconfirm/popconfirm-box.d.ts +12 -14
- package/dist/types/components/molecules/popconfirm/popconfirm.d.ts +14 -10
- package/dist/types/components/molecules/popover/popover-box.d.ts +10 -10
- package/dist/types/components/molecules/popover/popover.d.ts +19 -13
- package/dist/types/components/molecules/progress/progress.d.ts +6 -8
- package/dist/types/components/molecules/radio/group.d.ts +22 -28
- package/dist/types/components/molecules/radio/radio.d.ts +17 -13
- package/dist/types/components/molecules/result/result.d.ts +8 -14
- package/dist/types/components/molecules/result/types.d.ts +19 -0
- package/dist/types/components/molecules/select/select-box.d.ts +1 -0
- package/dist/types/components/molecules/select/select.d.ts +6 -5
- package/dist/types/components/molecules/switch/switch.d.ts +15 -18
- package/dist/types/components/molecules/textarea/textarea.d.ts +23 -23
- package/dist/types/components/molecules/timeline/timeline-item.d.ts +12 -0
- package/dist/types/components/molecules/timeline/timeline.d.ts +19 -2
- package/dist/types/components/molecules/tooltip/tooltip-box.d.ts +8 -11
- package/dist/types/components/molecules/tooltip/tooltip.d.ts +17 -13
- package/dist/types/components/organism/colorpicker/colorpicker.d.ts +2 -1
- package/dist/types/components/organism/date-picker/date-picker.d.ts +11 -7
- package/dist/types/components/organism/datetime-picker/datetime-picker.d.ts +5 -4
- package/dist/types/components/organism/form/form.d.ts +1 -2
- package/dist/types/components/organism/listbox/listbox.d.ts +2 -1
- package/dist/types/components/organism/tabs/tab.d.ts +1 -2
- package/dist/types/components/organism/time-picker/time-picker.d.ts +1 -1
- package/dist/types/components.d.ts +510 -553
- package/dist/types/global/variables/colors.d.ts +1 -0
- package/dist/types/helper/datetime-helper.d.ts +3 -0
- package/dist/types/helper/generate.d.ts +1 -4
- package/dist/types/helper/string-helper.d.ts +0 -3
- package/dist/types/models/bcm.d.ts +1 -1
- 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 +0 -1
- package/package.json +1 -1
- package/dist/bromcom-ui/bcm-list-2.entry.js +0 -1063
- package/dist/bromcom-ui/bcm-range.entry.js +0 -161
- package/dist/bromcom-ui/bcm-search-2.entry.js +0 -219
- package/dist/bromcom-ui/caption-template-2d4ffc88.js +0 -25
- package/dist/bromcom-ui/color-helper-19448077.js +0 -35
- package/dist/bromcom-ui/generate-8e440fc4.js +0 -91
- package/dist/bromcom-ui/index-55174f2a.js +0 -58
- package/dist/bromcom-ui/index-dd5c1283.js +0 -187
- package/dist/bromcom-ui/input-template-487d3243.js +0 -83
- package/dist/bromcom-ui/json-parse-decarator-223ea680.js +0 -21
- package/dist/bromcom-ui/label-template-501216fc.js +0 -19
- package/dist/bromcom-ui/number-helper-fea1966f.js +0 -13
- package/dist/bromcom-ui/property-decorators-21b15487.js +0 -36
- package/dist/bromcom-ui/slot-template-f79b82ee.js +0 -9
- package/dist/bromcom-ui/snq.es5-946822b8.js +0 -14
- package/dist/bromcom-ui/string-helper-35840f91.js +0 -109
- package/dist/bromcom-ui/types-6b2a6629.js +0 -172
- package/dist/types/components/atoms/states/badge.states.d.ts +0 -7
- package/dist/types/components/atoms/states/button.states.d.ts +0 -7
- package/dist/types/components/molecules/breadcrumb/types.d.ts +0 -10
- package/dist/types/components/molecules/input/types.d.ts +0 -13
- package/dist/types/components/molecules/progress/types.d.ts +0 -24
- package/dist/types/components/molecules/range/range.d.ts +0 -36
- package/dist/types/components/molecules/search-2/search-2.d.ts +0 -30
- package/dist/types/components/molecules/states/alert.states.d.ts +0 -7
- package/dist/types/components/molecules/states/checkbox-group.states.d.ts +0 -53
- package/dist/types/components/molecules/states/message.states.d.ts +0 -7
- package/dist/types/components/molecules/states/notification.states.d.ts +0 -7
- package/dist/types/components/molecules/states/radio-group.states.d.ts +0 -47
- package/dist/types/components/molecules/states/result.states.d.ts +0 -7
- package/dist/types/components/molecules/states/search.states.d.ts +0 -13
- package/dist/types/components/molecules/textarea/types.d.ts +0 -9
- package/dist/types/components/organism/list-2/list-2.d.ts +0 -109
- package/dist/types/components/organism/states/bcm-list2.states.d.ts +0 -24
- package/dist/types/decorators/json-parse-decarator.d.ts +0 -4
- package/dist/types/decorators/property-decorators.d.ts +0 -6
- package/dist/types/helper/number-helper.d.ts +0 -9
- package/dist/types/models/states/Atoms/bcm-Atoms-state.d.ts +0 -34
- package/dist/types/models/states/molecules/bcm-molecules-state.d.ts +0 -78
- package/dist/types/models/states/organisms/bcm-organisms-state.d.ts +0 -71
- package/dist/types/templates/button-template.d.ts +0 -16
- package/dist/types/templates/checkbox-group-template.d.ts +0 -10
- package/dist/types/templates/checkbox-template.d.ts +0 -13
- package/dist/types/templates/info-footer-template.d.ts +0 -10
- package/dist/types/templates/input-template.d.ts +0 -30
- package/dist/types/templates/list-item-template.d.ts +0 -11
- package/dist/types/templates/list-template.d.ts +0 -23
- package/dist/types/templates/tag-template.d.ts +0 -17
|
@@ -1,36 +1,20 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h, f as Host } from './index-
|
|
2
|
-
import {
|
|
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';
|
|
1
|
+
import { r as registerInstance, e as createEvent, h, f as Host } from './index-9dbea026.js';
|
|
2
|
+
import { c as classnames } from './index-43956e3c.js';
|
|
11
3
|
|
|
12
|
-
|
|
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
|
-
}
|
|
32
|
-
};
|
|
4
|
+
const inputCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}:host{display:inline-block;width:100%;margin:0 0 8px 0}:host(.hidden){display:none}:host(.no-margin){margin:0}.input-container{display:flex;flex-direction:column;width:100%;max-width:256px}.input-container.full-width{max-width:100%}.input-base{flex:1 1 auto;display:inline-flex;align-items:stretch;justify-content:start;position:relative;background-color:var(--bcm-color-grey-1);border:1px solid var(--bcm-color-grey-5);border-radius:2px;vertical-align:middle;overflow:hidden;padding:0 4px;cursor:text}.input-base.focused:not(.disabled){border-color:var(--bcm-color-prime-blue-5);box-shadow:0px 0px 4px var(--bcm-color-prime-blue-6)}.input-base.focused:not(.disabled) .caret-container{opacity:1}.input-base.focused:not(.disabled) .input-clear-button{opacity:1}.input-base:hover:not(.disabled){border-color:var(--bcm-color-prime-blue-6)}.input-base:hover:not(.disabled) .caret-container{opacity:1}.input-base:hover:not(.disabled) .input-clear-button{opacity:1}.input-base.disabled{background-color:var(--bcm-color-grey-3);cursor:not-allowed}.input-base.empty .input-clear-button{display:none}.input-base.invalid{border-color:var(--bcm-color-red-6)}.error .label{color:var(--bcm-color-red-6) !important}.error .input-base{border:1px solid var(--bcm-color-red-6) !important}.input-base input{color:var(--bcm-color-grey-8);flex:1 1 auto;width:0%;border:none;border-radius:2px;background:none;box-shadow:none;padding:0;margin:0 4px;font-family:\"Roboto\", sans-serif;cursor:inherit;-webkit-appearance:none;appearance:none}.input-base input::-webkit-search-decoration,.input-base input::-webkit-search-cancel-button,.input-base input::-webkit-search-results-button,.input-base input::-webkit-search-results-decoration{-webkit-appearance:none}.input-base input::placeholder{color:var(--bcm-color-grey-6);user-select:none}.input-base input:focus{outline:none}input::-webkit-calendar-picker-indicator{-webkit-appearance:none;display:none}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}input[type=number]{-moz-appearance:textfield}.input-prefix,.input-suffix{display:inline-flex;align-items:center;justify-content:center;cursor:default;color:var(--bcm-color-grey-7)}.input-prefix ::slotted(*),.input-prefix>span{margin-left:4px}.input-suffix ::slotted(*),.input-suffix>span{margin-right:4px}.input-clear-button,.input-password-toggle{display:inline-flex;align-items:center;border:none;background:none;padding:0;cursor:pointer;margin-right:4px;transition:0.2s opacity}.input-clear-button:last-child,.input-clear-button:last-of-type,.input-password-toggle:last-child,.input-password-toggle:last-of-type{margin-right:8px}.input-clear-button:focus,.input-password-toggle:focus{outline:none}.input-clear-button{opacity:0}.label{display:flex;flex-direction:column;color:var(--bcm-color-grey-9);margin-bottom:4px}.caption-area{min-height:20px}.input-caption{display:block}.unit.input-suffix{width:24px}.unit-prefix{display:inline-flex;flex:0 0 auto;align-items:center;cursor:default;color:var(--bcm-color-grey-8)}.caret-container{opacity:0;width:30px;display:flex;flex-direction:column;justify-content:center;align-items:center;border-left:1px solid #D9D9D9;border-right:1px solid #D9D9D9;transition:0.2s opacity;user-select:none;box-sizing:border-box;margin-right:4px}.caret-container:last-of-type{margin-right:-4px;border-right:none}.caret-container .caret{display:inline-flex;height:50%;width:100%;align-items:center;justify-content:center;color:var(--bcm-color-grey-7);cursor:pointer}.caret-container .caret:hover{color:var(--bcm-color-prime-blue-6)}.caret-container .caret:active{background-color:var(--bcm-color-grey-3)}.caret-container .caret:last-child{border-top:1px solid #D9D9D9}.caret-container.disabled{background-color:var(--bcm-color-grey-3)}.caret-container.disabled .caret{cursor:not-allowed}.default-icon{margin-right:8px}.caption-default{color:#8C8C8C}.caption-primary{color:#4293CF}.caption-success{color:#52C41A}.caption-warning{color:#FA8C16}.caption-error{color:#F5222D}.input-large{height:38px}.input-medium{height:30px}.input-small{height:20px}";
|
|
33
5
|
|
|
6
|
+
let id = 0;
|
|
7
|
+
const defaultIcons = {
|
|
8
|
+
email: 'mail',
|
|
9
|
+
tel: 'phone',
|
|
10
|
+
search: 'search',
|
|
11
|
+
url: 'link'
|
|
12
|
+
};
|
|
13
|
+
const iconSizes = {
|
|
14
|
+
'small': 14,
|
|
15
|
+
'medium': 16,
|
|
16
|
+
'large': 18
|
|
17
|
+
};
|
|
34
18
|
const BcmInput = class {
|
|
35
19
|
constructor(hostRef) {
|
|
36
20
|
registerInstance(this, hostRef);
|
|
@@ -39,68 +23,40 @@ const BcmInput = class {
|
|
|
39
23
|
this.clear = createEvent(this, "bcm-clear", 7);
|
|
40
24
|
this.change = createEvent(this, "bcm-change", 7);
|
|
41
25
|
this.input = createEvent(this, "bcm-input", 7);
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
this._internal_id = Generate.UID();
|
|
26
|
+
this.inputId = `input-${++id}`;
|
|
27
|
+
this.type = 'text';
|
|
45
28
|
this.value = '';
|
|
46
|
-
this.size =
|
|
29
|
+
this.size = "medium";
|
|
30
|
+
this.noCaption = false;
|
|
31
|
+
this.noMargin = false;
|
|
32
|
+
this.captionType = 'default';
|
|
33
|
+
this.fullWidth = false;
|
|
47
34
|
this.disabled = false;
|
|
48
35
|
this.readonly = false;
|
|
49
36
|
this.clearable = false;
|
|
50
|
-
this.
|
|
37
|
+
this._internal_id = (Math.random() * 4).toString(16).replace('.', '');
|
|
38
|
+
this.unit = null;
|
|
39
|
+
this.unitPrefix = null;
|
|
40
|
+
this.min = null;
|
|
41
|
+
this.max = null;
|
|
42
|
+
this.step = null;
|
|
51
43
|
this.hidden = false;
|
|
52
44
|
this.required = false;
|
|
53
|
-
this.
|
|
54
|
-
this.noMargin = false;
|
|
55
|
-
this.disableWatchValue = false; // datetimepicker
|
|
56
|
-
this.passwordToggle = false; // type password
|
|
45
|
+
this.disableWatchValue = false;
|
|
57
46
|
this.maxLength = null;
|
|
58
|
-
this.unitPrefix = null;
|
|
59
|
-
this.decimal = true;
|
|
60
|
-
this.noCaption = false;
|
|
61
|
-
this.captionType = Bcm.Status.default;
|
|
62
|
-
/** initial States **/
|
|
63
47
|
this.inValid = false;
|
|
64
|
-
this.
|
|
65
|
-
this.focused = false;
|
|
66
|
-
this.isPasswordVisible = false;
|
|
48
|
+
this.hasFocus = false;
|
|
67
49
|
this.isBlur = false;
|
|
50
|
+
this.isPasswordVisible = false;
|
|
68
51
|
}
|
|
69
|
-
|
|
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
|
-
}
|
|
95
|
-
}
|
|
96
|
-
async onBcmFocus() {
|
|
52
|
+
async setFocus() {
|
|
97
53
|
this.inputElement.focus();
|
|
98
54
|
}
|
|
99
|
-
async
|
|
55
|
+
async removeFocus() {
|
|
100
56
|
this.inputElement.blur();
|
|
101
57
|
}
|
|
102
|
-
async
|
|
103
|
-
this.inputElement.select();
|
|
58
|
+
async select() {
|
|
59
|
+
return this.inputElement.select();
|
|
104
60
|
}
|
|
105
61
|
async setValue(value) {
|
|
106
62
|
this.inputElement.value = value;
|
|
@@ -111,6 +67,7 @@ const BcmInput = class {
|
|
|
111
67
|
async setClear() {
|
|
112
68
|
this.inputElement.value = '';
|
|
113
69
|
this.value = '';
|
|
70
|
+
return Promise.resolve();
|
|
114
71
|
}
|
|
115
72
|
async resetCaption() {
|
|
116
73
|
this.caption = this.captionCache;
|
|
@@ -120,45 +77,19 @@ const BcmInput = class {
|
|
|
120
77
|
async getValue() {
|
|
121
78
|
return this.value;
|
|
122
79
|
}
|
|
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
|
-
}
|
|
153
80
|
handleFocus() {
|
|
154
|
-
this.
|
|
81
|
+
this.hasFocus = true;
|
|
155
82
|
this.focus.emit();
|
|
156
|
-
this.whatchHasFocus();
|
|
157
83
|
}
|
|
158
84
|
handleBlur() {
|
|
159
|
-
this.
|
|
85
|
+
this.hasFocus = false;
|
|
160
86
|
this.isBlur = true;
|
|
161
|
-
this.
|
|
87
|
+
if (this.type == "email") {
|
|
88
|
+
this.isEmailValid();
|
|
89
|
+
}
|
|
90
|
+
if (this.type == "tel") {
|
|
91
|
+
this.isTelValid();
|
|
92
|
+
}
|
|
162
93
|
this.blur.emit();
|
|
163
94
|
}
|
|
164
95
|
handleChange() {
|
|
@@ -166,6 +97,15 @@ const BcmInput = class {
|
|
|
166
97
|
this.change.emit(this.value);
|
|
167
98
|
}
|
|
168
99
|
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
|
+
}
|
|
169
109
|
this.value = this.inputElement.value;
|
|
170
110
|
this.input.emit(this.value);
|
|
171
111
|
}
|
|
@@ -173,102 +113,268 @@ const BcmInput = class {
|
|
|
173
113
|
this.inputElement.value = '';
|
|
174
114
|
this.value = '';
|
|
175
115
|
this.inputElement.focus();
|
|
116
|
+
this.change.emit(this.value);
|
|
176
117
|
this.clear.emit(e);
|
|
177
118
|
e.stopPropagation();
|
|
178
119
|
}
|
|
179
120
|
changePasswordVisibility() {
|
|
180
121
|
this.isPasswordVisible = !this.isPasswordVisible;
|
|
181
122
|
}
|
|
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
|
+
}
|
|
182
180
|
setCaption(caption = null, captionType = null) {
|
|
183
|
-
this.caption = caption
|
|
184
|
-
this.captionType = captionType
|
|
181
|
+
this.caption = caption ? caption : this.captionCache;
|
|
182
|
+
this.captionType = captionType ? captionType : this.captionTypeCache;
|
|
185
183
|
this.captionError = captionType == "error" ? caption : null;
|
|
186
184
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
185
|
+
isEmailValid() {
|
|
186
|
+
const { value } = this;
|
|
187
|
+
const regexp = new RegExp(/^(([^<>()\[\]\\.,;:\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,}))$/);
|
|
188
|
+
let cap = null;
|
|
189
|
+
let capType = null;
|
|
190
|
+
if (value && !regexp.test(value)) {
|
|
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;
|
|
193
252
|
}
|
|
194
253
|
else {
|
|
195
|
-
|
|
254
|
+
splitDec = 0;
|
|
196
255
|
}
|
|
197
|
-
|
|
256
|
+
returnDecimalLength = splitDec;
|
|
198
257
|
}
|
|
258
|
+
return Number(returnDecimalLength);
|
|
199
259
|
}
|
|
200
|
-
|
|
201
|
-
const {
|
|
202
|
-
if (value) {
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
this.setCaption(StringHelper.getMessage('between', [min, max]), "error");
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
260
|
+
componentWillRender() {
|
|
261
|
+
const { type } = this;
|
|
262
|
+
if (type == "number" && this.value) {
|
|
263
|
+
if (!this.isNumberValid()) {
|
|
264
|
+
this.validationRange();
|
|
208
265
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
266
|
+
}
|
|
267
|
+
if (this.isBlur) {
|
|
268
|
+
if (type == "email" && this.value) {
|
|
269
|
+
this.isEmailValid();
|
|
214
270
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
this.setCaption(StringHelper.getMessage('max', [max]), "error");
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
271
|
+
if (type == "tel" && this.value) {
|
|
272
|
+
this.isTelValid();
|
|
220
273
|
}
|
|
221
274
|
}
|
|
222
|
-
this.setCaption();
|
|
223
|
-
return true;
|
|
224
275
|
}
|
|
225
|
-
|
|
226
|
-
const { value } = this;
|
|
227
|
-
if (
|
|
228
|
-
this.
|
|
229
|
-
this.inValid = false;
|
|
276
|
+
componentWillLoad() {
|
|
277
|
+
const { type, value } = this;
|
|
278
|
+
if (type == "number" && Number(value) == value) {
|
|
279
|
+
this.value = this.numberDecimal(value);
|
|
230
280
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
281
|
+
}
|
|
282
|
+
numberControl(e) {
|
|
283
|
+
if (!this.disabled && !this.readonly) {
|
|
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
|
+
}
|
|
234
320
|
}
|
|
235
|
-
return this.inValid;
|
|
236
321
|
}
|
|
237
322
|
whatchHasFocus() {
|
|
238
|
-
const { type,
|
|
239
|
-
if (type ==
|
|
240
|
-
|
|
241
|
-
|
|
323
|
+
const { type, hasFocus, value, valueCache, inValid } = this;
|
|
324
|
+
if (type == "number") {
|
|
325
|
+
this.isNumberValid();
|
|
326
|
+
let inValidState = false;
|
|
327
|
+
if (hasFocus == true) {
|
|
328
|
+
if (inValid == true) {
|
|
329
|
+
this.value = '';
|
|
330
|
+
inValidState = true;
|
|
331
|
+
}
|
|
242
332
|
}
|
|
243
333
|
else {
|
|
244
|
-
if (
|
|
245
|
-
this.value = this.value ? this.fixToNumber(this.value) : '';
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
334
|
+
if (this.value == '' && inValid == false) {
|
|
248
335
|
this.value = valueCache;
|
|
336
|
+
inValidState = true;
|
|
337
|
+
}
|
|
338
|
+
if (value != valueCache && inValid == false && inValidState == false) {
|
|
339
|
+
this.value = value ? this.numberDecimal(value) : '';
|
|
249
340
|
}
|
|
250
341
|
}
|
|
251
342
|
}
|
|
252
343
|
}
|
|
253
|
-
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
return decLen > 0 ? NumberHelper.parseFloatFixed(val, decLen) : val;
|
|
344
|
+
watchValue() {
|
|
345
|
+
if (!this.disableWatchValue && this.type != 'number') {
|
|
346
|
+
this.handleChange();
|
|
257
347
|
}
|
|
258
|
-
return val;
|
|
259
348
|
}
|
|
260
349
|
render() {
|
|
261
|
-
const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable, passwordToggle, isPasswordVisible, noDefaultIcon, unit, inValid,
|
|
262
|
-
const
|
|
263
|
-
hidden,
|
|
264
|
-
'no-margin': noMargin,
|
|
350
|
+
const { value, size, label, type, captionType, caption, captionError, placeholder, fullWidth, disabled, readonly, clearable, passwordToggle, isPasswordVisible, noDefaultIcon, unit, inValid, hasFocus, unitPrefix, noCaption, required } = this;
|
|
351
|
+
const containerClasses = classnames('input-container', {
|
|
265
352
|
'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
|
|
266
362
|
});
|
|
267
|
-
|
|
363
|
+
const inputClass = size === 'large' ? 'size-3' : 'size-2';
|
|
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, " "))))));
|
|
268
372
|
}
|
|
269
373
|
static get watchers() { return {
|
|
374
|
+
"hasFocus": ["whatchHasFocus"],
|
|
270
375
|
"value": ["watchValue"]
|
|
271
376
|
}; }
|
|
272
377
|
};
|
|
378
|
+
BcmInput.style = inputCss;
|
|
273
379
|
|
|
274
380
|
export { BcmInput as bcm_input };
|
|
@@ -1,11 +1,74 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
2
|
-
import {
|
|
3
|
-
import './
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { h, r as registerInstance, f as Host, g as getElement } from './index-9dbea026.js';
|
|
2
|
+
import { S as StatusProps } from './types-911a8837.js';
|
|
3
|
+
import { c as classnames } from './index-43956e3c.js';
|
|
4
|
+
import { S as StringHelper, B as Bcm } from './string-helper-1d51eff7.js';
|
|
5
|
+
|
|
6
|
+
class Generate {
|
|
7
|
+
}
|
|
8
|
+
Generate.UID = () => Math.random().toString(36).substr(2, 9);
|
|
9
|
+
Generate.getIconAttrWithStatusType = (status, loading = false) => {
|
|
10
|
+
if (loading)
|
|
11
|
+
return { icon: 'loading', color: 'blue-6' };
|
|
12
|
+
switch (status) {
|
|
13
|
+
case StatusProps.info:
|
|
14
|
+
return { color: 'blue-6', icon: 'info-circle' };
|
|
15
|
+
case StatusProps.error:
|
|
16
|
+
return { color: 'red-6', icon: 'close-circle' };
|
|
17
|
+
case StatusProps.warning:
|
|
18
|
+
return { color: 'warmyellow-6', icon: 'exclamation-circle' };
|
|
19
|
+
case StatusProps.success:
|
|
20
|
+
return { color: 'green-6', icon: 'check-circle' };
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
Generate.createComponent = (element, props) => {
|
|
24
|
+
let box = document.createElement(element);
|
|
25
|
+
Object.keys(props).forEach(key => {
|
|
26
|
+
box[key] = props[key];
|
|
27
|
+
});
|
|
28
|
+
document.body.appendChild(box);
|
|
29
|
+
return box;
|
|
30
|
+
};
|
|
31
|
+
Generate.debounceInput = (func, wait, immediate) => {
|
|
32
|
+
let timeout;
|
|
33
|
+
return function () {
|
|
34
|
+
let context = this, args = arguments;
|
|
35
|
+
let later = function () {
|
|
36
|
+
timeout = null;
|
|
37
|
+
if (!immediate)
|
|
38
|
+
func.apply(context, args);
|
|
39
|
+
};
|
|
40
|
+
let callNow = immediate && !timeout;
|
|
41
|
+
clearTimeout(timeout);
|
|
42
|
+
timeout = setTimeout(later, wait);
|
|
43
|
+
if (callNow)
|
|
44
|
+
func.apply(context, args);
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
Generate.flatArray = (arr) => {
|
|
48
|
+
return arr.reduce((acc, val) => {
|
|
49
|
+
return acc.concat(Array.isArray(val) ? Generate.flatArray(val) : val);
|
|
50
|
+
}, []);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const SlotTemplate = ({ value, className, name }) => {
|
|
54
|
+
return StringHelper.isNullOrEmpty(value) ? h("span", { class: className },
|
|
55
|
+
h("slot", Object.assign({}, (name && { name: name })))) : h("span", { class: className }, value);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const LabelTemplate = ({ required, value, size, form, htmlFor, type }) => {
|
|
59
|
+
size = size || Bcm.FontSize['size-1'];
|
|
60
|
+
type = type || Bcm.Status.default;
|
|
61
|
+
const labelClasses = classnames('bcm-label__text', size, {
|
|
62
|
+
'bcm-label__text-error': type === Bcm.Status.error,
|
|
63
|
+
});
|
|
64
|
+
return (h("label", { form: form, htmlFor: htmlFor, class: labelClasses },
|
|
65
|
+
" ",
|
|
66
|
+
h(SlotTemplate, { value: value }),
|
|
67
|
+
" ",
|
|
68
|
+
required && ('*')));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const labelCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto:400,500\");.size-1{font-size:12px;line-height:20px}.size-2{font-size:14px;line-height:22px}.size-3{font-size:16px;line-height:24px}.size-4{font-size:20px;line-height:28px}.size-5{font-size:24px;line-height:32px}.size-6{font-size:30px;line-height:38px}.size-7{font-size:38px;line-height:46px}.size-8{font-size:46px;line-height:54px}.size-9{font-size:56px;line-height:64px}.weight-regular{font-weight:400}.weight-semibold{font-weight:500}.bcm-label{display:flex;align-items:center;grid-gap:2px}.bcm-label__text{display:inline-block;color:var(--bcm-color-grey-9);margin-bottom:4px}.bcm-label__text-error{color:var(--bcm-color-red-6)}";
|
|
9
72
|
|
|
10
73
|
const BcmLabel = class {
|
|
11
74
|
constructor(hostRef) {
|
|
@@ -18,11 +81,13 @@ const BcmLabel = class {
|
|
|
18
81
|
this.type = Bcm.Status.default;
|
|
19
82
|
}
|
|
20
83
|
render() {
|
|
21
|
-
const { required, value, size, form, htmlFor, hidden, type } = this;
|
|
84
|
+
const { required, value, size, form, htmlFor, hidden, type, tooltip } = this;
|
|
22
85
|
const hostClasses = classnames('bcm-label', { hidden });
|
|
23
|
-
|
|
86
|
+
const Label = (h(LabelTemplate, { form: form, htmlFor: htmlFor, value: value, size: size, type: type, required: required }));
|
|
87
|
+
return (h(Host, null, h("div", { class: hostClasses }, Label, tooltip && (h("bcm-tooltip", { message: tooltip, placement: 'top', trigger: 'hover' }, h("bcm-icon", { color: "grey-8", icon: "question-circle", type: "fill" }))))));
|
|
24
88
|
}
|
|
25
89
|
get el() { return getElement(this); }
|
|
26
90
|
};
|
|
91
|
+
BcmLabel.style = labelCss;
|
|
27
92
|
|
|
28
93
|
export { BcmLabel as bcm_label };
|