@danielgindi/selectbox 2.0.38 → 2.0.40

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/lib/SelectBox.js CHANGED
@@ -2237,7 +2237,9 @@ class SelectBox {
2237
2237
  break;
2238
2238
 
2239
2239
  default:
2240
- if (p.allowTypeToSelect) {
2240
+ if (dropList.isVisible()) {
2241
+ dropList._keydownFreeType(evt, false);
2242
+ } else if (p.allowTypeToSelect) {
2241
2243
  dropList._keydownFreeType(evt, true);
2242
2244
  } else {
2243
2245
  this.openList();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/selectbox",
3
- "version": "2.0.38",
3
+ "version": "2.0.40",
4
4
  "description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
5
5
  "main": "dist/lib.cjs.min.js",
6
6
  "module": "lib/index.js",
@@ -31,30 +31,30 @@
31
31
  "homepage": "https://github.com/danielgindi/selectbox#readme",
32
32
  "license": "MIT",
33
33
  "devDependencies": {
34
- "@babel/core": "^7.28.4",
35
- "@babel/preset-env": "^7.28.3",
36
- "@babel/runtime": "^7.28.4",
37
- "@eslint/eslintrc": "^3.3.1",
38
- "@eslint/js": "^9.38.0",
34
+ "@babel/core": "^7.29.0",
35
+ "@babel/preset-env": "^7.29.0",
36
+ "@babel/runtime": "^7.28.6",
37
+ "@eslint/eslintrc": "^3.3.4",
38
+ "@eslint/js": "^9.39.3",
39
39
  "@rollup/plugin-babel": "^6.1.0",
40
- "@rollup/plugin-commonjs": "^28.0.8",
40
+ "@rollup/plugin-commonjs": "^29.0.0",
41
41
  "@rollup/plugin-node-resolve": "^16.0.3",
42
42
  "@rollup/plugin-terser": "^0.4.4",
43
- "core-js": "^3.46.0",
44
- "eslint": "^9.38.0",
45
- "eslint-formatter-codeframe": "^7.32.1",
46
- "eslint-plugin-vue": "^9.32.0",
47
- "fs-extra": "^11.3.2",
48
- "globals": "^16.4.0",
43
+ "core-js": "^3.48.0",
44
+ "eslint": "^9.39.3",
45
+ "eslint-formatter-codeframe": "^7.32.2",
46
+ "eslint-plugin-vue": "^9.33.0",
47
+ "fs-extra": "^11.3.3",
48
+ "globals": "^17.4.0",
49
49
  "husky": "^9.1.7",
50
50
  "pinst": "^3.0.0",
51
- "rollup": "^4.52.5",
52
- "sass": "^1.93.2",
53
- "vite": "^7.2.2"
51
+ "rollup": "^4.59.0",
52
+ "sass": "^1.97.3",
53
+ "vite": "^7.3.1"
54
54
  },
55
55
  "dependencies": {
56
56
  "@danielgindi/dom-utils": "^1.0.11",
57
- "@danielgindi/virtual-list-helper": "^1.0.15",
57
+ "@danielgindi/virtual-list-helper": "^1.0.18",
58
58
  "fast-deep-equal": "^3.1.3",
59
59
  "keycode-js": "^3.1.0",
60
60
  "mitt": "^3.0.1"
package/vue/SelectBox.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <span ref="el" />
2
+ <span :ref="v => el = v" />
3
3
  </template>
4
4
 
5
5
  <script>
@@ -311,6 +311,7 @@ export default {
311
311
  data() {
312
312
  return {
313
313
  el: undefined,
314
+ isMounted: false,
314
315
 
315
316
  nonReactive: Object.seal({
316
317
  instance: undefined,
@@ -739,27 +740,31 @@ export default {
739
740
  this.nonReactive.instance.invokeRefilter();
740
741
  },
741
742
  },
742
- },
743
-
744
- mounted() {
745
- this._createBox();
746
743
 
747
- if (window.ResizeObserver === undefined) {
748
- this._isAttached = !!this.$refs.el && document.body.contains(this.$refs.el);
744
+ el(v) {
745
+ if (v) {
746
+ if (this.isMounted) {
747
+ this._createBox();
749
748
 
750
- this.$nextTick(() => {
751
- if (this.nonReactive.instance && this._isAttached)
752
- this.nonReactive.instance.refreshSize();
753
- });
754
- }
749
+ if (window.ResizeObserver === undefined) {
750
+ const wasAttached = this._isAttached;
751
+ this._isAttached = !!this.el && document.body.contains(this.el);
752
+ if (!wasAttached && this.nonReactive.instance && this._isAttached)
753
+ this.nonReactive.instance.refreshSize();
754
+ }
755
+ }
756
+ } else {
757
+ this._destroyBox();
758
+ }
759
+ },
755
760
  },
756
761
 
757
- updated() {
758
- if (this.$refs.el && this.el !== this.$refs.el) {
759
- this._createBox();
760
- }
762
+ mounted() {
763
+ this.isMounted = true;
761
764
 
762
- if (window.ResizeObserver === undefined) {
765
+ this._createBox();
766
+
767
+ if (window.ResizeObserver === undefined && this.nonReactive.instance) {
763
768
  const wasAttached = this._isAttached;
764
769
  this._isAttached = !!this.$refs.el && document.body.contains(this.$refs.el);
765
770
  if (!wasAttached && this.nonReactive.instance && this._isAttached)
@@ -767,8 +772,8 @@ export default {
767
772
  }
768
773
  },
769
774
 
770
- [isVue3 ? 'unmounted' : 'destroyed']() {
771
- this._destroyBox();
775
+ unmounted() {
776
+ this.isMounted = false;
772
777
  },
773
778
 
774
779
  methods: {
@@ -811,7 +816,6 @@ export default {
811
816
  _createBox() {
812
817
  this._destroyBox();
813
818
 
814
- this.el = this.$refs.el;
815
819
  if (!this.el)
816
820
  return;
817
821
 
@@ -875,8 +879,6 @@ export default {
875
879
  this.nonReactive.instance.destroy();
876
880
  this.nonReactive.instance = undefined;
877
881
  }
878
-
879
- this.el = undefined;
880
882
  },
881
883
 
882
884
  _concatClassesObject(classes) {