neo.mjs 4.0.67 → 4.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.0.67",
3
+ "version": "4.0.70",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
package/src/Xhr.mjs CHANGED
@@ -24,7 +24,8 @@ class Xhr extends XhrConnection {
24
24
  remote: {
25
25
  app: [
26
26
  'promiseJson',
27
- 'promiseRequest'
27
+ 'promiseRequest',
28
+ 'setDefaultHeaders'
28
29
  ]
29
30
  },
30
31
  /**
@@ -228,11 +228,12 @@ class RecordFactory extends Base {
228
228
  * @returns {*}
229
229
  */
230
230
  parseRecordValue(record, field, value, recordConfig=null) {
231
- let mapping = field.mapping,
231
+ let fieldName = field.name,
232
+ mapping = field.mapping,
232
233
  maxLength = field.maxLength,
233
234
  minLength = field.minLength,
234
235
  nullable = field.nullable,
235
- oldValue = recordConfig?.[field.name] || record[field.name],
236
+ oldValue = recordConfig?.[fieldName] || record[fieldName],
236
237
  type = field.type?.toLowerCase();
237
238
 
238
239
  // only trigger mappings for initial values
@@ -247,21 +248,21 @@ class RecordFactory extends Base {
247
248
 
248
249
  if (Object.hasOwn(field, 'maxLength')) {
249
250
  if (value?.toString() > maxLength) {
250
- console.warn(`Setting record field: ${field} value: ${value} conflicts with maxLength: ${maxLength}`);
251
+ console.warn(`Setting record field: ${fieldName} value: ${value} conflicts with maxLength: ${maxLength}`);
251
252
  return oldValue;
252
253
  }
253
254
  }
254
255
 
255
256
  if (Object.hasOwn(field, 'minLength')) {
256
257
  if (value?.toString() < minLength) {
257
- console.warn(`Setting record field: ${field} value: ${value} conflicts with minLength: ${minLength}`);
258
+ console.warn(`Setting record field: ${fieldName} value: ${value} conflicts with minLength: ${minLength}`);
258
259
  return oldValue;
259
260
  }
260
261
  }
261
262
 
262
263
  if (Object.hasOwn(field, 'nullable')) {
263
264
  if (nullable === false && value === null) {
264
- console.warn(`Setting record field: ${field} value: ${value} conflicts with nullable: ${nullable}`);
265
+ console.warn(`Setting record field: ${fieldName} value: ${value} conflicts with nullable: ${nullable}`);
265
266
  return oldValue;
266
267
  }
267
268
  }
@@ -270,6 +271,11 @@ class RecordFactory extends Base {
270
271
  return new Date(value);
271
272
  }
272
273
 
274
+ if (type === 'string' && value !== null) {
275
+ value = value + '';
276
+ value = value.replace(/(<([^>]+)>)/ig, '');
277
+ }
278
+
273
279
  return value;
274
280
  }
275
281
 
@@ -217,6 +217,15 @@ class Xhr extends Base {
217
217
 
218
218
  return this.request(opts);
219
219
  }
220
+
221
+ /**
222
+ * Needed for remote method access
223
+ *
224
+ * @param {Object} value
225
+ */
226
+ setDefaultHeaders(value) {
227
+ this.defaultHeaders = value;
228
+ }
220
229
  }
221
230
 
222
231
  Neo.applyClassConfig(Xhr);
@@ -149,14 +149,16 @@ class DragDrop extends Base {
149
149
 
150
150
  me.addGlobalEventListeners();
151
151
 
152
+ if (Neo.config.hasMouseEvents) {
153
+ imports.push(import('../draggable/sensor/Mouse.mjs'));
154
+ }
155
+
152
156
  if (Neo.config.hasTouchEvents) {
153
157
  imports.push(import('../draggable/sensor/Touch.mjs'));
154
- } else {
155
- imports.push(import('../draggable/sensor/Mouse.mjs'));
156
158
  }
157
159
 
158
160
  Promise.all(imports).then(modules => {
159
- // create the Touch or MouseSensor
161
+ // create the Mouse- and / or TouchSensor
160
162
  Neo.create({
161
163
  module: modules[0].default
162
164
  });
@@ -204,6 +204,7 @@ class Manager extends Base {
204
204
  detectFeatures() {
205
205
  let me = this;
206
206
 
207
+ NeoConfig.hasMouseEvents = matchMedia('(pointer:fine)').matches;
207
208
  NeoConfig.hasTouchEvents = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);
208
209
 
209
210
  if (window.Worker) {