bootstrap-italia 2.7.8 → 2.7.9
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/css/bootstrap-italia.min.css +1 -1
- package/dist/css/bootstrap-italia.min.css.map +1 -1
- package/dist/js/bootstrap-italia.bundle.min.js +7 -7
- package/dist/js/bootstrap-italia.min.js +7 -7
- package/dist/plugins/input-label.js +4 -1
- package/dist/plugins/input-label.js.map +1 -1
- package/dist/plugins/input-number.js +15 -23
- package/dist/plugins/input-number.js.map +1 -1
- package/dist/plugins/input-search-autocomplete.js +6 -13
- package/dist/plugins/input-search-autocomplete.js.map +1 -1
- package/dist/plugins/input.js +8 -28
- package/dist/plugins/input.js.map +1 -1
- package/dist/plugins/select-autocomplete.js +25 -6
- package/dist/plugins/select-autocomplete.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/js/plugins/input-label.js +4 -1
- package/src/js/plugins/input-number.js +15 -23
- package/src/js/plugins/input-search-autocomplete.js +6 -13
- package/src/js/plugins/input.js +8 -28
- package/src/js/plugins/select-autocomplete.js +25 -6
- package/src/js/version.js +1 -1
- package/src/scss/custom/_form-input-number.scss +20 -55
- package/src/scss/custom/_forms.scss +8 -2
- package/src/scss/custom/_just-validate.scss +50 -17
- package/src/scss/custom/_version.scss +1 -1
package/dist/plugins/input.js
CHANGED
|
@@ -6,10 +6,6 @@ import InputLabel from './input-label.js';
|
|
|
6
6
|
const NAME = 'input';
|
|
7
7
|
const DATA_KEY = 'bs.input';
|
|
8
8
|
const EVENT_KEY = `.${DATA_KEY}`;
|
|
9
|
-
const DATA_API_KEY = '.data-api';
|
|
10
|
-
|
|
11
|
-
const EVENT_MOUSEDOWN_DATA_API = `mousedown${EVENT_KEY}${DATA_API_KEY}`;
|
|
12
|
-
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`;
|
|
13
9
|
|
|
14
10
|
const EVENT_CHANGE = `change${EVENT_KEY}`;
|
|
15
11
|
|
|
@@ -65,26 +61,14 @@ class Input extends BaseComponent {
|
|
|
65
61
|
*/
|
|
66
62
|
const excludes = [
|
|
67
63
|
'select',
|
|
68
|
-
//'input[data-bs-input][type="number"]',
|
|
69
64
|
'input[data-bs-input][type="password"]',
|
|
70
65
|
'input.input-password[data-bs-input]',
|
|
71
66
|
'input[data-bs-autocomplete][type="search"]',
|
|
72
67
|
'input[type="time"]',
|
|
68
|
+
'input[type="radio"]',
|
|
69
|
+
'input[type="checkbox"]',
|
|
73
70
|
];
|
|
74
71
|
|
|
75
|
-
/*const inputs = SelectorEngine.find('input, textarea').filter((input) => {
|
|
76
|
-
let result = true
|
|
77
|
-
excludes.forEach((selector) => {
|
|
78
|
-
if (input.matches(selector)) {
|
|
79
|
-
result = false
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
return result
|
|
83
|
-
})
|
|
84
|
-
inputs.forEach((input) => {
|
|
85
|
-
Input.getOrCreateInstance(input)
|
|
86
|
-
})*/
|
|
87
|
-
|
|
88
72
|
const createInput = (element) => {
|
|
89
73
|
const toExclude = !!excludes.find((selector) => element.matches(selector));
|
|
90
74
|
const isInputNumber = !!(element.getAttribute('type') === 'number' && element.parentNode.querySelector('button[class^="input-number-"]')); //check if it's a InputNumber component
|
|
@@ -94,16 +78,12 @@ const createInput = (element) => {
|
|
|
94
78
|
return null
|
|
95
79
|
};
|
|
96
80
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const element = createInput(target);
|
|
104
|
-
if (element && element._label) {
|
|
105
|
-
element._label._labelOut();
|
|
106
|
-
}
|
|
81
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
82
|
+
var frmel = document.querySelectorAll('input, textarea, label');
|
|
83
|
+
frmel.forEach(function (item) {
|
|
84
|
+
const target = InputLabel.getInputFromLabel(item) || item;
|
|
85
|
+
createInput(target);
|
|
86
|
+
});
|
|
107
87
|
});
|
|
108
88
|
|
|
109
89
|
export { Input as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../src/js/plugins/input.js"],"sourcesContent":["import BaseComponent from 'bootstrap/js/src/base-component.js'\n\nimport EventHandler from 'bootstrap/js/src/dom/event-handler'\nimport SelectorEngine from 'bootstrap/js/src/dom/selector-engine'\n\nimport InputLabel from './input-label'\n\nconst NAME = 'input'\nconst DATA_KEY = 'bs.input'\nconst EVENT_KEY = `.${DATA_KEY}`\
|
|
1
|
+
{"version":3,"file":"input.js","sources":["../../src/js/plugins/input.js"],"sourcesContent":["import BaseComponent from 'bootstrap/js/src/base-component.js'\n\nimport EventHandler from 'bootstrap/js/src/dom/event-handler'\nimport SelectorEngine from 'bootstrap/js/src/dom/selector-engine'\n\nimport InputLabel from './input-label'\n\nconst NAME = 'input'\nconst DATA_KEY = 'bs.input'\nconst EVENT_KEY = `.${DATA_KEY}`\n\nconst EVENT_CHANGE = `change${EVENT_KEY}`\n\nclass Input extends BaseComponent {\n constructor(element) {\n super(element)\n\n this._label = new InputLabel(element)\n this._bindEvents()\n }\n\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n // Public\n\n // Private\n _bindEvents() {\n if (this._element.getAttribute('type') === 'file') {\n EventHandler.on(this._element, EVENT_CHANGE, () => {\n this._handleFileDescription()\n })\n }\n }\n\n _handleFileDescription() {\n const fileNames = []\n let labelPrefix = ''\n\n Array.from(this._element.files).forEach((file) => {\n const fileSize = Math.round(parseInt(file.size, 10) / 1024)\n fileNames.push(file.name + ' (' + fileSize + 'kb)')\n })\n\n if (this._element.files.length > 1) {\n labelPrefix = this._element.files.length + ' file da caricare: '\n }\n\n const label = SelectorEngine.findOne('label[for=\"' + this._element.getAttribute('id') + '\"] label.form-file-name', this._element)\n if (label) {\n label.innerText = labelPrefix + fileNames.join('; ')\n }\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\nconst excludes = [\n 'select',\n 'input[data-bs-input][type=\"password\"]',\n 'input.input-password[data-bs-input]',\n 'input[data-bs-autocomplete][type=\"search\"]',\n 'input[type=\"time\"]',\n 'input[type=\"radio\"]',\n 'input[type=\"checkbox\"]',\n]\n\nconst createInput = (element) => {\n const toExclude = !!excludes.find((selector) => element.matches(selector))\n const isInputNumber = !!(element.getAttribute('type') === 'number' && element.parentNode.querySelector('button[class^=\"input-number-\"]')) //check if it's a InputNumber component\n if (!toExclude && !isInputNumber) {\n return Input.getOrCreateInstance(element)\n }\n return null\n}\n\ndocument.addEventListener('DOMContentLoaded', function () {\n var frmel = document.querySelectorAll('input, textarea, label')\n frmel.forEach(function (item) {\n const target = InputLabel.getInputFromLabel(item) || item\n createInput(target)\n })\n})\n\nexport default Input\n"],"names":[],"mappings":"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"}
|
|
@@ -2,14 +2,24 @@ import accessibleAutocomplete from 'accessible-autocomplete';
|
|
|
2
2
|
import BaseComponent from 'bootstrap/js/src/base-component.js';
|
|
3
3
|
|
|
4
4
|
const NAME = 'selectautocomplete';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
function onClassChange(element, callback) {
|
|
7
|
+
const observer = new MutationObserver((mutations) => {
|
|
8
|
+
mutations.forEach((mutation) => {
|
|
9
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
|
10
|
+
callback(mutation.target);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
observer.observe(element, { attributes: true });
|
|
15
|
+
return observer.disconnect
|
|
16
|
+
}
|
|
8
17
|
|
|
9
18
|
class SelectAutocomplete extends BaseComponent {
|
|
10
19
|
constructor(element, config) {
|
|
11
20
|
super(element);
|
|
12
|
-
|
|
21
|
+
this._hasFormControl = element.classList.contains('form-control');
|
|
22
|
+
this.element_original_id = this._element.id;
|
|
13
23
|
this._config = config;
|
|
14
24
|
this._enhance();
|
|
15
25
|
}
|
|
@@ -20,11 +30,20 @@ class SelectAutocomplete extends BaseComponent {
|
|
|
20
30
|
return NAME
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
// Public
|
|
24
|
-
|
|
25
33
|
// Private
|
|
26
34
|
_enhance() {
|
|
27
35
|
accessibleAutocomplete.enhanceSelectElement(Object.assign({}, { selectElement: this._element }, this._config));
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
if (this._hasFormControl) {
|
|
38
|
+
const inputField = document.getElementById(this.element_original_id);
|
|
39
|
+
inputField.classList.add('form-control');
|
|
40
|
+
onClassChange(inputField, (node) => {
|
|
41
|
+
if (!node.classList.contains('form-control')) {
|
|
42
|
+
node.classList.add('form-control');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, 100);
|
|
28
47
|
}
|
|
29
48
|
}
|
|
30
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-autocomplete.js","sources":["../../src/js/plugins/select-autocomplete.js"],"sourcesContent":["import accessibleAutocomplete from 'accessible-autocomplete'\n\nimport BaseComponent from 'bootstrap/js/src/base-component.js'\n\nconst NAME = 'selectautocomplete'\n
|
|
1
|
+
{"version":3,"file":"select-autocomplete.js","sources":["../../src/js/plugins/select-autocomplete.js"],"sourcesContent":["import accessibleAutocomplete from 'accessible-autocomplete'\n\nimport BaseComponent from 'bootstrap/js/src/base-component.js'\n\nconst NAME = 'selectautocomplete'\n\nfunction onClassChange(element, callback) {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes' && mutation.attributeName === 'class') {\n callback(mutation.target)\n }\n })\n })\n observer.observe(element, { attributes: true })\n return observer.disconnect\n}\n\nclass SelectAutocomplete extends BaseComponent {\n constructor(element, config) {\n super(element)\n this._hasFormControl = element.classList.contains('form-control')\n this.element_original_id = this._element.id\n this._config = config\n this._enhance()\n }\n\n // Getters\n\n static get NAME() {\n return NAME\n }\n\n // Private\n _enhance() {\n accessibleAutocomplete.enhanceSelectElement(Object.assign({}, { selectElement: this._element }, this._config))\n setTimeout(() => {\n if (this._hasFormControl) {\n const inputField = document.getElementById(this.element_original_id)\n inputField.classList.add('form-control')\n onClassChange(inputField, (node) => {\n if (!node.classList.contains('form-control')) {\n node.classList.add('form-control')\n }\n })\n }\n }, 100)\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nexport default SelectAutocomplete\n"],"names":[],"mappings":";;;AAIA,MAAM,IAAI,GAAG,qBAAoB;AACjC;AACA,SAAS,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE;AAC1C,EAAE,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,CAAC,SAAS,KAAK;AACvD,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAK;AACpC,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI,QAAQ,CAAC,aAAa,KAAK,OAAO,EAAE;AAChF,QAAQ,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAC;AACjC,OAAO;AACP,KAAK,EAAC;AACN,GAAG,EAAC;AACJ,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAC;AACjD,EAAE,OAAO,QAAQ,CAAC,UAAU;AAC5B,CAAC;AACD;AACA,MAAM,kBAAkB,SAAS,aAAa,CAAC;AAC/C,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE;AAC/B,IAAI,KAAK,CAAC,OAAO,EAAC;AAClB,IAAI,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAC;AACrE,IAAI,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAE;AAC/C,IAAI,IAAI,CAAC,OAAO,GAAG,OAAM;AACzB,IAAI,IAAI,CAAC,QAAQ,GAAE;AACnB,GAAG;AACH;AACA;AACA;AACA,EAAE,WAAW,IAAI,GAAG;AACpB,IAAI,OAAO,IAAI;AACf,GAAG;AACH;AACA;AACA,EAAE,QAAQ,GAAG;AACb,IAAI,sBAAsB,CAAC,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAC;AAClH,IAAI,UAAU,CAAC,MAAM;AACrB,MAAM,IAAI,IAAI,CAAC,eAAe,EAAE;AAChC,QAAQ,MAAM,UAAU,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,mBAAmB,EAAC;AAC5E,QAAQ,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAC;AAChD,QAAQ,aAAa,CAAC,UAAU,EAAE,CAAC,IAAI,KAAK;AAC5C,UAAU,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;AACxD,YAAY,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAC;AAC9C,WAAW;AACX,SAAS,EAAC;AACV,OAAO;AACP,KAAK,EAAE,GAAG,EAAC;AACX,GAAG;AACH;;;;"}
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// bootstrap italia version variable
|
|
2
2
|
// useful to check for the current version
|
|
3
3
|
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
const BOOTSTRAP_ITALIA_VERSION = '2.7.
|
|
4
|
+
const BOOTSTRAP_ITALIA_VERSION = '2.7.9';
|
|
5
5
|
|
|
6
6
|
export { BOOTSTRAP_ITALIA_VERSION as default };
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../src/js/version.js"],"sourcesContent":["// bootstrap italia version variable\n// useful to check for the current version\n// eslint-disable-next-line no-unused-vars\nconst BOOTSTRAP_ITALIA_VERSION = '2.7.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../src/js/version.js"],"sourcesContent":["// bootstrap italia version variable\n// useful to check for the current version\n// eslint-disable-next-line no-unused-vars\nconst BOOTSTRAP_ITALIA_VERSION = '2.7.9'\nexport default BOOTSTRAP_ITALIA_VERSION\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACK,MAAC,wBAAwB,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -12,15 +12,12 @@ const DATA_API_KEY = '.data-api'
|
|
|
12
12
|
|
|
13
13
|
const EVENT_CLICK = `click${EVENT_KEY}`
|
|
14
14
|
const EVENT_CHANGE = `change${EVENT_KEY}`
|
|
15
|
+
const EVENT_INPUT = `input`
|
|
15
16
|
|
|
16
17
|
//const EVENT_FOCUS_DATA_API = `focus${EVENT_KEY}${DATA_API_KEY}`
|
|
17
18
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
|
18
|
-
const EVENT_MOUSEDOWN_DATA_API = `mousedown${EVENT_KEY}${DATA_API_KEY}`
|
|
19
|
-
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`
|
|
20
19
|
|
|
21
20
|
const CLASS_NAME_ADAPTIVE = 'input-number-adaptive'
|
|
22
|
-
const CLASS_NAME_PERCENTAGE = 'input-number-percentage'
|
|
23
|
-
const CLASS_NAME_CURRENCY = 'input-number-currency'
|
|
24
21
|
//const CLASS_NAME_INCREMENT = 'input-number-add'
|
|
25
22
|
const CLASS_NAME_DECREMENT = 'input-number-sub'
|
|
26
23
|
|
|
@@ -61,6 +58,7 @@ class InputNumber extends BaseComponent {
|
|
|
61
58
|
EventHandler.on(btn, EVENT_CLICK, (evt) => {
|
|
62
59
|
evt.preventDefault()
|
|
63
60
|
this._incrDecr(btn.classList.contains(CLASS_NAME_DECREMENT))
|
|
61
|
+
this._label._labelOut()
|
|
64
62
|
})
|
|
65
63
|
})
|
|
66
64
|
|
|
@@ -72,14 +70,9 @@ class InputNumber extends BaseComponent {
|
|
|
72
70
|
if (this._wrapperElement.classList.contains(CLASS_NAME_ADAPTIVE)) {
|
|
73
71
|
let newWidth = null
|
|
74
72
|
//let newWidthIE = null
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
if (this._wrapperElement.classList.contains(CLASS_NAME_CURRENCY)) {
|
|
80
|
-
newWidth = 'calc(40px + 44px + ' + this._element.value.length + 'ch)'
|
|
81
|
-
//newWidthIE = 'calc(40px + 44px + (1.5 * ' + this._element.value.length + 'ch))'
|
|
82
|
-
}
|
|
73
|
+
//74px - buttons (30px) and possible validation icon (40px)
|
|
74
|
+
newWidth = 'calc(70px + ' + this._element.value.length + 'ch)'
|
|
75
|
+
//newWidthIE = 'calc(44px + (1.5 * ' + this._element.value.length + 'ch))'
|
|
83
76
|
|
|
84
77
|
if (newWidth) {
|
|
85
78
|
this._element.style.width = newWidth
|
|
@@ -89,7 +82,8 @@ class InputNumber extends BaseComponent {
|
|
|
89
82
|
}
|
|
90
83
|
|
|
91
84
|
_incrDecr(isDecr) {
|
|
92
|
-
|
|
85
|
+
var inputVal = 0
|
|
86
|
+
if (this._element.value !== '') inputVal = parseFloat(this._element.value)
|
|
93
87
|
|
|
94
88
|
if (!isNaN(inputVal)) {
|
|
95
89
|
//get step
|
|
@@ -100,6 +94,7 @@ class InputNumber extends BaseComponent {
|
|
|
100
94
|
|
|
101
95
|
this._element.value = inputVal + step * (isDecr ? -1 : 1)
|
|
102
96
|
EventHandler.trigger(this._element, EVENT_CHANGE)
|
|
97
|
+
EventHandler.trigger(this._element, EVENT_INPUT)
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
100
|
|
|
@@ -168,17 +163,14 @@ const createInput = (element) => {
|
|
|
168
163
|
return null
|
|
169
164
|
}
|
|
170
165
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const element = createInput(target)
|
|
178
|
-
if (element && element._label) {
|
|
179
|
-
element._label._labelOut()
|
|
180
|
-
}
|
|
166
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
167
|
+
var frmel = document.querySelectorAll(SELECTOR_INPUT + ', label')
|
|
168
|
+
frmel.forEach(function (item) {
|
|
169
|
+
const target = InputLabel.getInputFromLabel(item) || item
|
|
170
|
+
createInput(target)
|
|
171
|
+
})
|
|
181
172
|
})
|
|
173
|
+
|
|
182
174
|
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_BTN, function () {
|
|
183
175
|
const wrapper = this.closest(SELECTOR_WRAPPER)
|
|
184
176
|
if (wrapper) {
|
|
@@ -9,15 +9,12 @@ import InputLabel from './input-label'
|
|
|
9
9
|
const NAME = 'inputsearchautocomplete'
|
|
10
10
|
const DATA_KEY = 'bs.inputsearchautocomplete'
|
|
11
11
|
const EVENT_KEY = `.${DATA_KEY}`
|
|
12
|
-
const DATA_API_KEY = '.data-api'
|
|
13
12
|
|
|
14
13
|
const Default = {
|
|
15
14
|
autocomplete: [],
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
const EVENT_KEYUP = `keyup${EVENT_KEY}`
|
|
19
|
-
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`
|
|
20
|
-
const EVENT_MOUSEDOWN_DATA_API = `mousedown${EVENT_KEY}${DATA_API_KEY}`
|
|
21
18
|
|
|
22
19
|
const CLASS_NAME_SHOW = 'autocomplete-list-show'
|
|
23
20
|
const CLASS_NAME_AUTOCOMPLETE = 'autocomplete'
|
|
@@ -137,16 +134,12 @@ const createInput = (element) => {
|
|
|
137
134
|
return null
|
|
138
135
|
}
|
|
139
136
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const element = createInput(target)
|
|
147
|
-
if (element && element._label) {
|
|
148
|
-
element._label._labelOut()
|
|
149
|
-
}
|
|
137
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
138
|
+
var frmel = document.querySelectorAll(SELECTOR_SEARCH + ', label')
|
|
139
|
+
frmel.forEach(function (item) {
|
|
140
|
+
const target = InputLabel.getInputFromLabel(item) || item
|
|
141
|
+
createInput(target)
|
|
142
|
+
})
|
|
150
143
|
})
|
|
151
144
|
|
|
152
145
|
export default InputSearch
|
package/src/js/plugins/input.js
CHANGED
|
@@ -8,10 +8,6 @@ import InputLabel from './input-label'
|
|
|
8
8
|
const NAME = 'input'
|
|
9
9
|
const DATA_KEY = 'bs.input'
|
|
10
10
|
const EVENT_KEY = `.${DATA_KEY}`
|
|
11
|
-
const DATA_API_KEY = '.data-api'
|
|
12
|
-
|
|
13
|
-
const EVENT_MOUSEDOWN_DATA_API = `mousedown${EVENT_KEY}${DATA_API_KEY}`
|
|
14
|
-
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`
|
|
15
11
|
|
|
16
12
|
const EVENT_CHANGE = `change${EVENT_KEY}`
|
|
17
13
|
|
|
@@ -67,26 +63,14 @@ class Input extends BaseComponent {
|
|
|
67
63
|
*/
|
|
68
64
|
const excludes = [
|
|
69
65
|
'select',
|
|
70
|
-
//'input[data-bs-input][type="number"]',
|
|
71
66
|
'input[data-bs-input][type="password"]',
|
|
72
67
|
'input.input-password[data-bs-input]',
|
|
73
68
|
'input[data-bs-autocomplete][type="search"]',
|
|
74
69
|
'input[type="time"]',
|
|
70
|
+
'input[type="radio"]',
|
|
71
|
+
'input[type="checkbox"]',
|
|
75
72
|
]
|
|
76
73
|
|
|
77
|
-
/*const inputs = SelectorEngine.find('input, textarea').filter((input) => {
|
|
78
|
-
let result = true
|
|
79
|
-
excludes.forEach((selector) => {
|
|
80
|
-
if (input.matches(selector)) {
|
|
81
|
-
result = false
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
return result
|
|
85
|
-
})
|
|
86
|
-
inputs.forEach((input) => {
|
|
87
|
-
Input.getOrCreateInstance(input)
|
|
88
|
-
})*/
|
|
89
|
-
|
|
90
74
|
const createInput = (element) => {
|
|
91
75
|
const toExclude = !!excludes.find((selector) => element.matches(selector))
|
|
92
76
|
const isInputNumber = !!(element.getAttribute('type') === 'number' && element.parentNode.querySelector('button[class^="input-number-"]')) //check if it's a InputNumber component
|
|
@@ -96,16 +80,12 @@ const createInput = (element) => {
|
|
|
96
80
|
return null
|
|
97
81
|
}
|
|
98
82
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const element = createInput(target)
|
|
106
|
-
if (element && element._label) {
|
|
107
|
-
element._label._labelOut()
|
|
108
|
-
}
|
|
83
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
84
|
+
var frmel = document.querySelectorAll('input, textarea, label')
|
|
85
|
+
frmel.forEach(function (item) {
|
|
86
|
+
const target = InputLabel.getInputFromLabel(item) || item
|
|
87
|
+
createInput(target)
|
|
88
|
+
})
|
|
109
89
|
})
|
|
110
90
|
|
|
111
91
|
export default Input
|
|
@@ -3,14 +3,24 @@ import accessibleAutocomplete from 'accessible-autocomplete'
|
|
|
3
3
|
import BaseComponent from 'bootstrap/js/src/base-component.js'
|
|
4
4
|
|
|
5
5
|
const NAME = 'selectautocomplete'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
function onClassChange(element, callback) {
|
|
8
|
+
const observer = new MutationObserver((mutations) => {
|
|
9
|
+
mutations.forEach((mutation) => {
|
|
10
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
|
11
|
+
callback(mutation.target)
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
observer.observe(element, { attributes: true })
|
|
16
|
+
return observer.disconnect
|
|
17
|
+
}
|
|
9
18
|
|
|
10
19
|
class SelectAutocomplete extends BaseComponent {
|
|
11
20
|
constructor(element, config) {
|
|
12
21
|
super(element)
|
|
13
|
-
|
|
22
|
+
this._hasFormControl = element.classList.contains('form-control')
|
|
23
|
+
this.element_original_id = this._element.id
|
|
14
24
|
this._config = config
|
|
15
25
|
this._enhance()
|
|
16
26
|
}
|
|
@@ -21,11 +31,20 @@ class SelectAutocomplete extends BaseComponent {
|
|
|
21
31
|
return NAME
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
// Public
|
|
25
|
-
|
|
26
34
|
// Private
|
|
27
35
|
_enhance() {
|
|
28
36
|
accessibleAutocomplete.enhanceSelectElement(Object.assign({}, { selectElement: this._element }, this._config))
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
if (this._hasFormControl) {
|
|
39
|
+
const inputField = document.getElementById(this.element_original_id)
|
|
40
|
+
inputField.classList.add('form-control')
|
|
41
|
+
onClassChange(inputField, (node) => {
|
|
42
|
+
if (!node.classList.contains('form-control')) {
|
|
43
|
+
node.classList.add('form-control')
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}, 100)
|
|
29
48
|
}
|
|
30
49
|
}
|
|
31
50
|
|
package/src/js/version.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
.input-number {
|
|
2
2
|
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
3
|
|
|
5
4
|
&.input-number-adaptive {
|
|
6
|
-
width:
|
|
7
|
-
display: inline;
|
|
5
|
+
width: fit-content;
|
|
8
6
|
input[type='number'] {
|
|
9
7
|
width: auto;
|
|
10
8
|
transition: all 0.3s;
|
|
@@ -23,80 +21,49 @@
|
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
// color: $color-text-muted;
|
|
26
|
-
padding-right: 32px;
|
|
27
|
-
padding-left: 12px;
|
|
28
|
-
min-width: 86px !important;
|
|
29
|
-
width: 100%;
|
|
30
24
|
|
|
31
25
|
&:focus {
|
|
32
26
|
color: $color-text-base;
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
29
|
|
|
36
|
-
//currency + percentage version
|
|
37
|
-
&.input-number-currency,
|
|
38
|
-
&.input-number-percentage {
|
|
39
|
-
&:before {
|
|
40
|
-
position: absolute;
|
|
41
|
-
left: 14px;
|
|
42
|
-
top: 0;
|
|
43
|
-
// color: $color-text-muted;
|
|
44
|
-
font-weight: bold;
|
|
45
|
-
font-size: 1rem;
|
|
46
|
-
}
|
|
47
|
-
input[type='number'] {
|
|
48
|
-
padding-left: 40px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
&.input-number-currency {
|
|
52
|
-
&:before {
|
|
53
|
-
content: '€';
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
&.input-number-percentage {
|
|
57
|
-
&:before {
|
|
58
|
-
content: '%';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
30
|
//disabled version
|
|
63
31
|
&.disabled {
|
|
64
32
|
input[type='number'] {
|
|
65
|
-
background-color:
|
|
66
|
-
color: $gray-
|
|
67
|
-
border-bottom-color: $gray-border-disabled;
|
|
33
|
+
background-color: $gray-disabled;
|
|
34
|
+
color: $gray-800;
|
|
68
35
|
&:hover {
|
|
69
36
|
cursor: not-allowed;
|
|
70
37
|
color: $gray-label-disabled;
|
|
71
38
|
}
|
|
72
39
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
border-color: transparent transparent $gray-border-disabled transparent;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
&.input-number-sub {
|
|
84
|
-
&:after {
|
|
85
|
-
border-color: $gray-border-disabled transparent transparent transparent;
|
|
40
|
+
.input-group-text {
|
|
41
|
+
background-color: $gray-disabled;
|
|
42
|
+
color: $gray-800;
|
|
43
|
+
button {
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
&:hover {
|
|
46
|
+
cursor: not-allowed;
|
|
86
47
|
}
|
|
87
48
|
}
|
|
88
49
|
}
|
|
89
50
|
}
|
|
90
51
|
|
|
91
52
|
//add + sub buttons
|
|
92
|
-
|
|
53
|
+
.input-group-text.align-buttons {
|
|
93
54
|
position: absolute;
|
|
94
|
-
|
|
55
|
+
top: 0;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
right: 0;
|
|
58
|
+
z-index: 10;
|
|
59
|
+
}
|
|
60
|
+
.input-group-text button {
|
|
61
|
+
position: relative;
|
|
95
62
|
transition: opacity 0.1s;
|
|
96
63
|
padding: 0;
|
|
97
64
|
border: none;
|
|
98
|
-
height:
|
|
99
|
-
width:
|
|
65
|
+
height: 50%;
|
|
66
|
+
width: 16px;
|
|
100
67
|
background: transparent;
|
|
101
68
|
&:after {
|
|
102
69
|
position: absolute;
|
|
@@ -126,14 +93,12 @@
|
|
|
126
93
|
}
|
|
127
94
|
|
|
128
95
|
&.input-number-add {
|
|
129
|
-
top: -6px;
|
|
130
96
|
&:after {
|
|
131
97
|
border-width: 0 5px 6px 5px;
|
|
132
98
|
border-color: transparent transparent $neutral-1-a7 transparent; // TODO Check if still necessary
|
|
133
99
|
}
|
|
134
100
|
}
|
|
135
101
|
&.input-number-sub {
|
|
136
|
-
bottom: -6px;
|
|
137
102
|
&:after {
|
|
138
103
|
border-width: 6px 5px 0 5px;
|
|
139
104
|
border-color: $neutral-1-a7 transparent transparent transparent; // TODO Check if still necessary
|
|
@@ -59,6 +59,13 @@ fieldset {
|
|
|
59
59
|
font-size: $small-font-size;
|
|
60
60
|
color: $input-label-color;
|
|
61
61
|
}
|
|
62
|
+
&:not(.active) {
|
|
63
|
+
& + .input-number-currency {
|
|
64
|
+
.input-group-text {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
input:is([type='radio']),
|
|
@@ -100,7 +107,6 @@ textarea {
|
|
|
100
107
|
border-radius: 0;
|
|
101
108
|
padding: $input-spacing-y $input-spacing-x;
|
|
102
109
|
outline: 0;
|
|
103
|
-
height: $input-height;
|
|
104
110
|
width: 100%;
|
|
105
111
|
box-shadow: none;
|
|
106
112
|
transition: none;
|
|
@@ -188,7 +194,7 @@ textarea {
|
|
|
188
194
|
.input-group-text {
|
|
189
195
|
padding: $input-spacing-y $input-spacing-x;
|
|
190
196
|
border-bottom: 1px solid $input-border;
|
|
191
|
-
|
|
197
|
+
border-radius: 0;
|
|
192
198
|
}
|
|
193
199
|
|
|
194
200
|
.input-group-prepend {
|