@kizmann/pico-js 1.0.5 → 1.0.7

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": "@kizmann/pico-js",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -327,6 +327,10 @@ export default class Map
327
327
  item.info.open(this.map, item.marker);
328
328
  }
329
329
 
330
+ if ( Any.isFunction(item.onOpen) ) {
331
+ item.onOpen(item);
332
+ }
333
+
330
334
  this.styleMarker(key, 'active');
331
335
 
332
336
  return hidden;
@@ -350,6 +354,10 @@ export default class Map
350
354
  item.info.close();
351
355
  }
352
356
 
357
+ if ( Any.isFunction(item.onClose) ) {
358
+ item.onClose(item);
359
+ }
360
+
353
361
  this.styleMarker(key, 'default');
354
362
 
355
363
  return visible;
@@ -368,14 +376,14 @@ export default class Map
368
376
  }
369
377
 
370
378
  item.extras = Obj.except(options, [
371
- 'map', 'position', 'lat', 'lng', 'html', 'style', 'visible'
379
+ 'map', 'position', 'lat', 'lng', 'html', 'style', 'visible', 'onOpen', 'onClose'
372
380
  ]);
373
381
 
374
382
  if ( ! Obj.has(options, 'map') ) {
375
383
  options.map = this.map;
376
384
  }
377
385
 
378
- if ( ! Obj.has(options, 'positon') ) {
386
+ if ( ! Obj.has(options, 'position') ) {
379
387
  options.position = Obj.only(options, ['lat', 'lng']);
380
388
  }
381
389
 
@@ -389,6 +397,10 @@ export default class Map
389
397
  item.marker.setVisible(false);
390
398
  }
391
399
 
400
+ Obj.assign(item, {
401
+ onOpen: Obj.get(options, 'onOpen'), onClose: Obj.get(options, 'onClose'),
402
+ })
403
+
392
404
  Obj.set(this.markers, key, item);
393
405
 
394
406
  this.clusterMarkers(this.clusterOptions, null, false);
@@ -903,6 +903,17 @@ export class Dom
903
903
  return this;
904
904
  }
905
905
 
906
+ stateClass(vals, state = true)
907
+ {
908
+ if ( this.length() > 1 ) {
909
+ return this.each((el) => Dom.find(el).stateClass(vals, state));
910
+ }
911
+
912
+ state ? this.addClass(vals) : this.removeClass(vals);
913
+
914
+ return this;
915
+ }
916
+
906
917
  attr(attr, val = undefined)
907
918
  {
908
919
  if ( this.empty() ) {
@@ -101,8 +101,9 @@ export class Num
101
101
  value = Any.float(num).toFixed(fixed);
102
102
  }
103
103
 
104
- let totals = value.replace(/\.[0-9]+$/, ''),
105
- minals = value.replace(/^[0-9\-]+\./, '');
104
+ let [totals, minals] = [
105
+ value.replace(/\.[0-9]+$/, ''), value.replace(/^[0-9\-]+\./, '')
106
+ ];
106
107
 
107
108
  let splits = Arr.reduce(totals.split('').reverse(), (result, val, key) => {
108
109