selectic 3.0.4 → 3.0.5

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.
Binary file
@@ -2025,15 +2025,26 @@ let Selectic = class Selectic extends vtyx.Vue {
2025
2025
  }
2026
2026
  get outsideListener() {
2027
2027
  return (evt) => {
2028
- const target = evt.target;
2029
2028
  if (!this.$refs) {
2030
2029
  /* this component should have been destroyed */
2031
2030
  this.removeListeners();
2032
2031
  this.store.commit('isOpen', false);
2033
2032
  return;
2034
2033
  }
2035
- if (!this.$refs.extendedList.$el.contains(target) && !this.$el.contains(target)) {
2036
- this.store.commit('isOpen', false);
2034
+ const store = this.store;
2035
+ const keepOpenWithOtherSelectic = this.params.keepOpenWithOtherSelectic;
2036
+ const extendedList = this.$refs.extendedList;
2037
+ if (!extendedList) {
2038
+ /* this component is not focused anymore */
2039
+ if (!keepOpenWithOtherSelectic) {
2040
+ this.removeListeners();
2041
+ this.store.commit('isOpen', false);
2042
+ }
2043
+ return;
2044
+ }
2045
+ const target = evt.target;
2046
+ if (!extendedList.$el.contains(target) && !this.$el.contains(target)) {
2047
+ store.commit('isOpen', false);
2037
2048
  }
2038
2049
  };
2039
2050
  }
@@ -2021,15 +2021,26 @@ let Selectic = class Selectic extends Vue {
2021
2021
  }
2022
2022
  get outsideListener() {
2023
2023
  return (evt) => {
2024
- const target = evt.target;
2025
2024
  if (!this.$refs) {
2026
2025
  /* this component should have been destroyed */
2027
2026
  this.removeListeners();
2028
2027
  this.store.commit('isOpen', false);
2029
2028
  return;
2030
2029
  }
2031
- if (!this.$refs.extendedList.$el.contains(target) && !this.$el.contains(target)) {
2032
- this.store.commit('isOpen', false);
2030
+ const store = this.store;
2031
+ const keepOpenWithOtherSelectic = this.params.keepOpenWithOtherSelectic;
2032
+ const extendedList = this.$refs.extendedList;
2033
+ if (!extendedList) {
2034
+ /* this component is not focused anymore */
2035
+ if (!keepOpenWithOtherSelectic) {
2036
+ this.removeListeners();
2037
+ this.store.commit('isOpen', false);
2038
+ }
2039
+ return;
2040
+ }
2041
+ const target = evt.target;
2042
+ if (!extendedList.$el.contains(target) && !this.$el.contains(target)) {
2043
+ store.commit('isOpen', false);
2033
2044
  }
2034
2045
  };
2035
2046
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "selectic",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "Smart Select for VueJS 3.x",
5
5
  "main": "dist/selectic.common.js",
6
6
  "module": "dist/selectic.esm.js",
package/src/index.tsx CHANGED
@@ -309,8 +309,6 @@ export default class Selectic extends Vue<Props> {
309
309
 
310
310
  get outsideListener() {
311
311
  return (evt: MouseEvent) => {
312
- const target = evt.target as Node;
313
-
314
312
  if (!this.$refs) {
315
313
  /* this component should have been destroyed */
316
314
  this.removeListeners();
@@ -318,8 +316,23 @@ export default class Selectic extends Vue<Props> {
318
316
  return;
319
317
  }
320
318
 
321
- if (!this.$refs.extendedList.$el.contains(target) && !this.$el.contains(target)) {
322
- this.store.commit('isOpen', false);
319
+ const store = this.store;
320
+ const keepOpenWithOtherSelectic = this.params.keepOpenWithOtherSelectic;
321
+ const extendedList = this.$refs.extendedList;
322
+
323
+ if (!extendedList) {
324
+ /* this component is not focused anymore */
325
+ if (!keepOpenWithOtherSelectic) {
326
+ this.removeListeners();
327
+ this.store.commit('isOpen', false);
328
+ }
329
+ return;
330
+ }
331
+
332
+ const target = evt.target as Node;
333
+
334
+ if (!extendedList.$el.contains(target) && !this.$el.contains(target)) {
335
+ store.commit('isOpen', false);
323
336
  }
324
337
  };
325
338
  }