@lemonadejs/calendar 3.1.0 → 3.2.0

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/index.d.ts CHANGED
@@ -18,6 +18,10 @@ declare namespace Calendar {
18
18
  value?: number | string;
19
19
  /** Bind the calendar to na HTML input element */
20
20
  input?: HTMLElement;
21
+ /** Onchange event */
22
+ onchange: (self: object, value: string) => void;
23
+ /** On update event */
24
+ onupdate: (self: object, value: string) => void;
21
25
  }
22
26
 
23
27
  interface Instance {
package/dist/index.js CHANGED
@@ -272,6 +272,8 @@ if (! Modal && typeof (require) === 'function') {
272
272
  const Calendar = function() {
273
273
  let self = this;
274
274
 
275
+ const onchange = self.onchange;
276
+
275
277
  // Weekdays
276
278
  self.weekdays = getWeekdays();
277
279
 
@@ -647,8 +649,12 @@ if (! Modal && typeof (require) === 'function') {
647
649
  self.options = views[self.view].call(self, date);
648
650
  }
649
651
  } else if (prop === 'value') {
652
+ // TODO: onchange only when the component value really changes
653
+ if (typeof(onchange) === 'function') {
654
+ onchange(self, self.value);
655
+ }
650
656
  if (typeof(self.onupdate) === 'function') {
651
- self.onupdate.call(self, self.value);
657
+ self.onupdate(self, self.value);
652
658
  }
653
659
  } else if (prop === 'options') {
654
660
  self.content.focus();
package/package.json CHANGED
@@ -14,10 +14,10 @@
14
14
  "javascript plugins"
15
15
  ],
16
16
  "dependencies": {
17
- "lemonadejs": "^4.0.7",
18
- "@lemonadejs/modal": "^2.6.1"
17
+ "lemonadejs": "^4.1.1",
18
+ "@lemonadejs/modal": "^2.7.1"
19
19
  },
20
20
  "main": "dist/index.js",
21
21
  "types": "dist/index.d.ts",
22
- "version": "3.1.0"
22
+ "version": "3.2.0"
23
23
  }