@websy/websy-designs 1.4.24 → 1.4.25
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.
|
@@ -192,14 +192,7 @@ class ButtonGroup {
|
|
|
192
192
|
handleClick (event) {
|
|
193
193
|
if (event.target.classList.contains('websy-button-group-item')) {
|
|
194
194
|
const index = +event.target.getAttribute('data-index')
|
|
195
|
-
if (this.options.activeItem !== index) {
|
|
196
|
-
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
197
|
-
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem)
|
|
198
|
-
}
|
|
199
|
-
this.options.activeItem = index
|
|
200
|
-
if (this.options.onActivate) {
|
|
201
|
-
this.options.onActivate(this.options.items[index], index, event)
|
|
202
|
-
}
|
|
195
|
+
if (this.options.activeItem !== index) {
|
|
203
196
|
const el = document.getElementById(this.elementId)
|
|
204
197
|
let buttons = Array.from(el.querySelectorAll('.websy-button-group-item'))
|
|
205
198
|
buttons.forEach(el => {
|
|
@@ -208,7 +201,14 @@ class ButtonGroup {
|
|
|
208
201
|
el.classList.remove('active')
|
|
209
202
|
})
|
|
210
203
|
event.target.classList.remove('inactive')
|
|
211
|
-
event.target.classList.add('active')
|
|
204
|
+
event.target.classList.add('active')
|
|
205
|
+
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
206
|
+
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem, true)
|
|
207
|
+
}
|
|
208
|
+
this.options.activeItem = index
|
|
209
|
+
if (this.options.onActivate) {
|
|
210
|
+
this.options.onActivate(this.options.items[index], index, event)
|
|
211
|
+
}
|
|
212
212
|
}
|
|
213
213
|
else if (this.options.activeItem === index && this.options.allowNone === true) {
|
|
214
214
|
if (this.options.onDeactivate) {
|
package/dist/websy-designs.js
CHANGED
|
@@ -269,16 +269,6 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
269
269
|
var index = +event.target.getAttribute('data-index');
|
|
270
270
|
|
|
271
271
|
if (this.options.activeItem !== index) {
|
|
272
|
-
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
273
|
-
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
this.options.activeItem = index;
|
|
277
|
-
|
|
278
|
-
if (this.options.onActivate) {
|
|
279
|
-
this.options.onActivate(this.options.items[index], index, event);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
272
|
var el = document.getElementById(this.elementId);
|
|
283
273
|
var buttons = Array.from(el.querySelectorAll('.websy-button-group-item'));
|
|
284
274
|
buttons.forEach(function (el) {
|
|
@@ -288,6 +278,16 @@ var ButtonGroup = /*#__PURE__*/function () {
|
|
|
288
278
|
});
|
|
289
279
|
event.target.classList.remove('inactive');
|
|
290
280
|
event.target.classList.add('active');
|
|
281
|
+
|
|
282
|
+
if (this.options.onDeactivate && this.options.activeItem !== -1) {
|
|
283
|
+
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem, true);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
this.options.activeItem = index;
|
|
287
|
+
|
|
288
|
+
if (this.options.onActivate) {
|
|
289
|
+
this.options.onActivate(this.options.items[index], index, event);
|
|
290
|
+
}
|
|
291
291
|
} else if (this.options.activeItem === index && this.options.allowNone === true) {
|
|
292
292
|
if (this.options.onDeactivate) {
|
|
293
293
|
this.options.onDeactivate(this.options.items[this.options.activeItem], this.options.activeItem);
|