wonder-image 1.2.7 → 1.4.3
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/backend/head.js +1 -1
- package/dist/backend/head.js.map +1 -1
- package/dist/frontend/body-end.js +1 -1
- package/dist/frontend/body-end.js.map +1 -1
- package/dist/frontend/head.js +1 -1
- package/dist/frontend/head.js.map +1 -1
- package/dist/lib/fullcalendar/fullcalendar.js +1 -1
- package/dist/lib/fullcalendar/fullcalendar.js.LICENSE.txt +2 -0
- package/dist/lib/fullcalendar/fullcalendar.js.map +1 -1
- package/dist/lib/videojs/video.js +1 -1
- package/dist/lib/videojs/video.js.map +1 -1
- package/package.json +1 -1
- package/src/build/frontend/js/form/input.js +2 -0
- package/src/build/frontend/js/form/list.js +86 -12
- package/src/build/frontend/js/form/place.js +76 -0
- package/src/build/global/js/utility.js +6 -0
package/package.json
CHANGED
|
@@ -197,6 +197,7 @@ function setInput() {
|
|
|
197
197
|
document.querySelectorAll("[data-wi-list-input='true']").forEach(element => {
|
|
198
198
|
element.addEventListener("keyup", searchInput);
|
|
199
199
|
element.addEventListener("focusin", searchInput);
|
|
200
|
+
element.addEventListener("focusin", showList);
|
|
200
201
|
element.addEventListener("keyup", showList);
|
|
201
202
|
element.addEventListener("focusout", hideList);
|
|
202
203
|
element.addEventListener("change", controlList);
|
|
@@ -234,5 +235,6 @@ function setInput() {
|
|
|
234
235
|
check();
|
|
235
236
|
setAutonumeric();
|
|
236
237
|
setGoogleMapsApi();
|
|
238
|
+
setInputCountry();
|
|
237
239
|
|
|
238
240
|
}
|
|
@@ -17,6 +17,8 @@ function searchInput(event) {
|
|
|
17
17
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// const event_CheckInput = new Event("wi-check-input");
|
|
21
|
+
|
|
20
22
|
function checkInput(event) {
|
|
21
23
|
|
|
22
24
|
var container = event.target;
|
|
@@ -33,6 +35,9 @@ function checkInput(event) {
|
|
|
33
35
|
|
|
34
36
|
var input = document.querySelector('#'+inputId);
|
|
35
37
|
input.value = checkbox.dataset.wiName;
|
|
38
|
+
// input.dispatchEvent(event_CheckInput);
|
|
39
|
+
|
|
40
|
+
check();
|
|
36
41
|
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -40,7 +45,6 @@ function controlList(event) {
|
|
|
40
45
|
|
|
41
46
|
var element = event.target;
|
|
42
47
|
var container = event.target.parentElement;
|
|
43
|
-
var spanAlert = container.querySelector('.alert-error');
|
|
44
48
|
|
|
45
49
|
var l = element.dataset.wiListArray.split('|');
|
|
46
50
|
var v = element.value.toLowerCase();
|
|
@@ -48,34 +52,33 @@ function controlList(event) {
|
|
|
48
52
|
if (v != '') {
|
|
49
53
|
if (l.includes(v)) {
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
container.classList.remove('input-error');
|
|
53
|
-
element.setCustomValidity('');
|
|
55
|
+
removeInputError(element);
|
|
54
56
|
|
|
55
57
|
container.querySelectorAll('input[type=radio]').forEach(e => {
|
|
58
|
+
|
|
56
59
|
var name = e.dataset.wiName;
|
|
60
|
+
|
|
57
61
|
if (name.toLowerCase() == v) {
|
|
58
62
|
e.checked = true;
|
|
59
|
-
}else{
|
|
63
|
+
} else {
|
|
60
64
|
e.checked = false;
|
|
61
65
|
}
|
|
66
|
+
|
|
62
67
|
});
|
|
63
68
|
|
|
64
69
|
} else {
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
container.classList.add('input-error');
|
|
69
|
-
|
|
70
|
-
container.querySelectorAll('input[type=radio]:checked').forEach(e => {
|
|
71
|
-
e.checked = false;
|
|
72
|
-
});
|
|
71
|
+
inputError(element, 'Campo non corretto!')
|
|
72
|
+
container.querySelectorAll('input[type=radio]:checked').forEach(e => { e.checked = false; });
|
|
73
73
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
check();
|
|
78
|
+
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
|
|
79
82
|
function showList(event) { event.target.parentElement.classList.add('wi-list-active'); }
|
|
80
83
|
|
|
81
84
|
function hideList(event) { event.target.parentElement.classList.remove('wi-list-active'); }
|
|
@@ -152,4 +155,75 @@ function searchResults(event, result) {
|
|
|
152
155
|
}
|
|
153
156
|
});
|
|
154
157
|
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function textListValue (input, value) {
|
|
161
|
+
|
|
162
|
+
var form = input.form;
|
|
163
|
+
var inputName = input.dataset.wiName.replace('-text', '');
|
|
164
|
+
|
|
165
|
+
if (form.querySelector('input[name="'+inputName+'"][value="'+value+'"]')) {
|
|
166
|
+
form.querySelector('input[name="'+inputName+'"][value="'+value+'"]').click();
|
|
167
|
+
checkLabel();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function textListOptions(input, options) {
|
|
173
|
+
|
|
174
|
+
var listHTML = "";
|
|
175
|
+
var listArray = [];
|
|
176
|
+
|
|
177
|
+
var form = input.form;
|
|
178
|
+
var inputId = input.id;
|
|
179
|
+
var inputAttribute = input.dataset.wiInputAttribute;
|
|
180
|
+
var inputLabel = input.labels[0];
|
|
181
|
+
var inputName = input.dataset.wiName.replace('-text', '');;
|
|
182
|
+
|
|
183
|
+
var listContainer = form.querySelector('#list_'+inputId);
|
|
184
|
+
|
|
185
|
+
input.dataset.wiListArray = "";
|
|
186
|
+
listContainer.innerHTML = "";
|
|
187
|
+
|
|
188
|
+
for (var optionValue in options) {
|
|
189
|
+
|
|
190
|
+
var optionId = "value_"+code();
|
|
191
|
+
var optionLabel = options[optionValue];
|
|
192
|
+
|
|
193
|
+
listArray.push(optionLabel);
|
|
194
|
+
|
|
195
|
+
listHTML += "<div class='wi-input-list-value' data-wi-list-value='true'><input id='"+optionId+"' data-wi-keyword='"+optionValue+" "+optionLabel+"' data-wi-input='"+inputId+"' data-wi-name='"+optionLabel+"' type='radio' name='"+inputName+"' value='"+optionValue+"'>"+optionLabel+"</div>";
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (listHTML == "") {
|
|
200
|
+
|
|
201
|
+
input.required = false;
|
|
202
|
+
input.disabled = true;
|
|
203
|
+
inputLabel.innerHTML = inputLabel.innerHTML.replace('*', '');
|
|
204
|
+
|
|
205
|
+
} else {
|
|
206
|
+
|
|
207
|
+
if (inputAttribute.indexOf('required') != '-1') {
|
|
208
|
+
|
|
209
|
+
input.required = true;
|
|
210
|
+
|
|
211
|
+
if (inputLabel.innerHTML.indexOf('*') == '-1') {
|
|
212
|
+
inputLabel.innerHTML = inputLabel.innerHTML+'*'
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
input.dataset.wiListArray = listArray.join('|').toLowerCase();
|
|
218
|
+
listContainer.innerHTML = listHTML;
|
|
219
|
+
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
listContainer.querySelectorAll("[data-wi-list-value='true']").forEach(element => {
|
|
223
|
+
element.addEventListener("click", checkInput);
|
|
224
|
+
element.addEventListener("mousedown", checkInput);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
checkLabel();
|
|
228
|
+
|
|
155
229
|
}
|
|
@@ -173,4 +173,80 @@ function setGoogleMapsApi() {
|
|
|
173
173
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
function setInputCountry() {
|
|
180
|
+
|
|
181
|
+
document.querySelectorAll("[data-wi-input-country='true']").forEach(element => {
|
|
182
|
+
element.addEventListener("change", searchStates);
|
|
183
|
+
element.addEventListener("focusout", searchStates);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function setCountryState(input, country, state) {
|
|
189
|
+
|
|
190
|
+
textListValue(input, country);
|
|
191
|
+
searchStates(input, state);
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function searchStates(event, stateValue = null) {
|
|
196
|
+
|
|
197
|
+
if (typeof event.target !== "undefined") {
|
|
198
|
+
var inputCountry = event.target;
|
|
199
|
+
} else {
|
|
200
|
+
var inputCountry = event;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
var form = inputCountry.form;
|
|
204
|
+
var inputCountryName = inputCountry.dataset.wiName.replace('-text', '');
|
|
205
|
+
var inputStateName = inputCountry.dataset.wiInputState;
|
|
206
|
+
|
|
207
|
+
var inputState = form.querySelector('input[data-wi-name="'+inputStateName+'-text"]');
|
|
208
|
+
|
|
209
|
+
inputState.disabled = true;
|
|
210
|
+
inputState.value = "";
|
|
211
|
+
|
|
212
|
+
delay(100).then(() => {
|
|
213
|
+
|
|
214
|
+
if (form.querySelector('input[name="'+inputCountryName+'"]:checked') != null) {
|
|
215
|
+
|
|
216
|
+
loadingSpinner();
|
|
217
|
+
|
|
218
|
+
var country = form.querySelector('input[name="'+inputCountryName+'"]:checked');
|
|
219
|
+
|
|
220
|
+
$.ajax({
|
|
221
|
+
type: "POST",
|
|
222
|
+
url: pathApp+'/api/states.php',
|
|
223
|
+
data: {
|
|
224
|
+
post: 'true',
|
|
225
|
+
country: country.value
|
|
226
|
+
},
|
|
227
|
+
success: function (data) {
|
|
228
|
+
|
|
229
|
+
const response = JSON.parse(data);
|
|
230
|
+
|
|
231
|
+
textListOptions( inputState, response );
|
|
232
|
+
|
|
233
|
+
inputState.disabled = false;
|
|
234
|
+
|
|
235
|
+
if (stateValue != null && stateValue != "") { textListValue(inputState, stateValue); }
|
|
236
|
+
|
|
237
|
+
loadingSpinner();
|
|
238
|
+
|
|
239
|
+
},
|
|
240
|
+
error: function (XMLHttpRequest) {
|
|
241
|
+
|
|
242
|
+
ajaxRequestError(XMLHttpRequest);
|
|
243
|
+
loadingSpinner();
|
|
244
|
+
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
});
|
|
251
|
+
|
|
176
252
|
}
|