@osimatic/helpers-js 1.5.12 → 1.5.14
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/form_date.js +5 -1
- package/form_helper.js +0 -12
- package/media.js +2 -9
- package/package.json +4 -4
- package/tests/form_date.test.js +8 -0
package/form_date.js
CHANGED
|
@@ -6,7 +6,11 @@ class InputPeriod {
|
|
|
6
6
|
|
|
7
7
|
static addLinks(form) {
|
|
8
8
|
form = toEl(form);
|
|
9
|
-
|
|
9
|
+
const input = form.querySelector('input[type="date"][data-add_period_select_links]');
|
|
10
|
+
if (!input) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
let divParent = input.parentElement;
|
|
10
14
|
if (divParent.classList.contains('input-group')) {
|
|
11
15
|
divParent = divParent.parentElement;
|
|
12
16
|
}
|
package/form_helper.js
CHANGED
|
@@ -200,18 +200,6 @@ class FormHelper {
|
|
|
200
200
|
|
|
201
201
|
static initTypeFields(form) {
|
|
202
202
|
form = toEl(form);
|
|
203
|
-
if (typeof Modernizr != 'undefined') {
|
|
204
|
-
if (!Modernizr.inputtypes.date) {
|
|
205
|
-
form.querySelectorAll('input[type="date"]').forEach(el => el.style.maxWidth = '120px');
|
|
206
|
-
}
|
|
207
|
-
if (!Modernizr.inputtypes.time) {
|
|
208
|
-
form.querySelectorAll('input[type="time"]').forEach(el => {
|
|
209
|
-
el.style.maxWidth = '100px';
|
|
210
|
-
el.placeholder = 'hh:mm';
|
|
211
|
-
});
|
|
212
|
-
form.querySelectorAll('input[type="time"][step="1"]').forEach(el => el.placeholder = 'hh:mm:ss');
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
203
|
|
|
216
204
|
// Show/Hide password
|
|
217
205
|
form.querySelectorAll('input[type="password"]').forEach(inputEl => {
|
package/media.js
CHANGED
|
@@ -157,16 +157,9 @@ class UserMedia {
|
|
|
157
157
|
/** Generic => all other errors */
|
|
158
158
|
|
|
159
159
|
static requestMediaPermissions(constraints) {
|
|
160
|
-
/*try {
|
|
161
|
-
console.log(require.resolve("bowser"));
|
|
162
|
-
} catch(e) {
|
|
163
|
-
return;
|
|
164
|
-
}*/
|
|
165
|
-
|
|
166
160
|
return new Promise((resolve, reject) => {
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const browserName = browser.getBrowserName();
|
|
161
|
+
const { UAParser } = require('ua-parser-js');
|
|
162
|
+
const browserName = new UAParser(window.navigator.userAgent).getBrowser().name;
|
|
170
163
|
|
|
171
164
|
navigator.mediaDevices.getUserMedia(typeof constraints !== 'undefined' ? constraints : { audio: true, video: true })
|
|
172
165
|
.then((stream) => resolve(stream))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osimatic/helpers-js",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.14",
|
|
4
4
|
"main": "main.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
"libphonenumber-js": "^1.12.39",
|
|
19
19
|
"ua-parser-js": "^2.0.9"
|
|
20
20
|
},
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"access": "public"
|
|
23
|
-
},
|
|
24
21
|
"peerDependencies": {
|
|
25
22
|
"intl-tel-input": ">=19.0",
|
|
26
23
|
"leaflet": ">=1.9"
|
|
@@ -30,6 +27,9 @@
|
|
|
30
27
|
"jest-environment-jsdom": "^30.2.0",
|
|
31
28
|
"whatwg-fetch": "^3.6.20"
|
|
32
29
|
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
33
|
"jest": {
|
|
34
34
|
"testEnvironment": "node",
|
|
35
35
|
"testMatch": [
|
package/tests/form_date.test.js
CHANGED
|
@@ -651,6 +651,14 @@ describe('InputPeriod', () => {
|
|
|
651
651
|
});
|
|
652
652
|
});
|
|
653
653
|
|
|
654
|
+
test('should not throw when form has no input[data-add_period_select_links]', () => {
|
|
655
|
+
document.body.innerHTML = `<form><div><input type="date" /></div></form>`;
|
|
656
|
+
const form = document.querySelector('form');
|
|
657
|
+
|
|
658
|
+
expect(() => InputPeriod.addLinks(form)).not.toThrow();
|
|
659
|
+
expect(form.querySelector('.select_period_links')).toBeNull();
|
|
660
|
+
});
|
|
661
|
+
|
|
654
662
|
describe('init', () => {
|
|
655
663
|
test('should set up click handlers for all period links', () => {
|
|
656
664
|
const linkSelectors = [
|