slim-select 2.2.0 → 2.2.2

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.
Files changed (118) hide show
  1. package/dist/helpers.d.ts +1 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/select.d.ts +1 -1
  4. package/dist/slimselect.cjs.js +62 -40
  5. package/dist/slimselect.es.js +62 -40
  6. package/dist/slimselect.global.js +62 -40
  7. package/dist/slimselect.js +62 -40
  8. package/dist/slimselect.min.js +1 -1
  9. package/dist/slimselect.umd.js +62 -40
  10. package/dist/slimselect.umd.min.js +1 -1
  11. package/package.json +1 -3
  12. package/src/slim-select/helpers.ts +4 -0
  13. package/src/slim-select/index.ts +26 -2
  14. package/src/slim-select/render.ts +5 -3
  15. package/src/slim-select/select.ts +12 -3
  16. package/src/vue/dist/slim-select/helpers.d.ts +5 -0
  17. package/src/vue/dist/slim-select/index.d.ts +45 -0
  18. package/src/vue/dist/slim-select/render.d.ts +116 -0
  19. package/src/vue/dist/slim-select/select.d.ts +33 -0
  20. package/src/vue/dist/slim-select/settings.d.ts +30 -0
  21. package/src/vue/dist/slim-select/store.d.ts +76 -0
  22. package/src/vue/dist/slimselectvue.es.js +114 -43
  23. package/src/vue/dist/slimselectvue.global.js +114 -43
  24. package/src/vue/dist/slimselectvue.ssr.js +114 -43
  25. package/src/vue/dist/vue/hello.d.ts +2 -0
  26. package/src/vue/dist/vue/slimselect.vue.d.ts +309 -0
  27. package/src/vue/package.json +2 -3
  28. package/src/vue/slimselect.vue +66 -2
  29. package/src/vue/tsconfig.json +3 -3
  30. package/tsconfig.json +9 -2
  31. package/.github/FUNDING.yml +0 -12
  32. package/.github/ISSUE_TEMPLATE/issue-report.md +0 -14
  33. package/.vscode/extensions.json +0 -3
  34. package/.vscode/settings.json +0 -17
  35. package/docs/404.html +0 -42
  36. package/docs/CNAME +0 -1
  37. package/docs/assets/check-mark.svg +0 -6
  38. package/docs/assets/data.js +0 -63
  39. package/docs/assets/home.css +0 -1
  40. package/docs/assets/home.js +0 -1
  41. package/docs/assets/index.css +0 -1
  42. package/docs/assets/index.js +0 -16
  43. package/docs/assets/index2.js +0 -358
  44. package/docs/assets/index3.js +0 -142
  45. package/docs/assets/index4.js +0 -60
  46. package/docs/assets/index5.js +0 -149
  47. package/docs/assets/install.js +0 -34
  48. package/docs/assets/selects.js +0 -55
  49. package/docs/favicon.ico +0 -0
  50. package/docs/index.html +0 -36
  51. package/public/404.html +0 -42
  52. package/public/CNAME +0 -1
  53. package/public/favicon.ico +0 -0
  54. package/slimselect.gif +0 -0
  55. package/src/docs/app.vue +0 -228
  56. package/src/docs/assets/images/check-mark.svg +0 -6
  57. package/src/docs/assets/images/chrome.svg +0 -22
  58. package/src/docs/assets/images/firefox.svg +0 -58
  59. package/src/docs/assets/images/github.png +0 -0
  60. package/src/docs/assets/images/ie.svg +0 -11
  61. package/src/docs/assets/images/npm.png +0 -0
  62. package/src/docs/assets/images/opera.svg +0 -15
  63. package/src/docs/assets/images/safari.svg +0 -22
  64. package/src/docs/assets/scss/_variables.scss +0 -26
  65. package/src/docs/assets/scss/alert.scss +0 -12
  66. package/src/docs/assets/scss/animations.scss +0 -8
  67. package/src/docs/assets/scss/button.scss +0 -21
  68. package/src/docs/assets/scss/index.scss +0 -8
  69. package/src/docs/assets/scss/input.scss +0 -3
  70. package/src/docs/assets/scss/layout.scss +0 -250
  71. package/src/docs/assets/scss/misc.scss +0 -162
  72. package/src/docs/assets/scss/prism.scss +0 -157
  73. package/src/docs/env.d.ts +0 -13
  74. package/src/docs/main.ts +0 -27
  75. package/src/docs/pages/data.vue +0 -134
  76. package/src/docs/pages/events/addable.vue +0 -95
  77. package/src/docs/pages/events/before_after_change.vue +0 -154
  78. package/src/docs/pages/events/before_after_open_close.vue +0 -122
  79. package/src/docs/pages/events/error.vue +0 -59
  80. package/src/docs/pages/events/index.vue +0 -33
  81. package/src/docs/pages/events/search.vue +0 -169
  82. package/src/docs/pages/events/search_filter.vue +0 -45
  83. package/src/docs/pages/frameworks/index.vue +0 -18
  84. package/src/docs/pages/frameworks/vue.vue +0 -407
  85. package/src/docs/pages/home.vue +0 -241
  86. package/src/docs/pages/install.vue +0 -105
  87. package/src/docs/pages/methods/destroy.vue +0 -66
  88. package/src/docs/pages/methods/enable_disable.vue +0 -70
  89. package/src/docs/pages/methods/get_data.vue +0 -82
  90. package/src/docs/pages/methods/get_selected.vue +0 -78
  91. package/src/docs/pages/methods/index.vue +0 -36
  92. package/src/docs/pages/methods/open_close.vue +0 -63
  93. package/src/docs/pages/methods/search.vue +0 -62
  94. package/src/docs/pages/methods/set_data.vue +0 -106
  95. package/src/docs/pages/methods/set_selected.vue +0 -70
  96. package/src/docs/pages/selects.vue +0 -213
  97. package/src/docs/pages/settings/always_open.vue +0 -88
  98. package/src/docs/pages/settings/closable.vue +0 -128
  99. package/src/docs/pages/settings/close_on_select.vue +0 -69
  100. package/src/docs/pages/settings/content_location.vue +0 -64
  101. package/src/docs/pages/settings/content_position.vue +0 -86
  102. package/src/docs/pages/settings/css.vue +0 -73
  103. package/src/docs/pages/settings/data_attributes.vue +0 -39
  104. package/src/docs/pages/settings/deselect.vue +0 -69
  105. package/src/docs/pages/settings/display.vue +0 -88
  106. package/src/docs/pages/settings/hide_selected.vue +0 -73
  107. package/src/docs/pages/settings/html.vue +0 -86
  108. package/src/docs/pages/settings/index.vue +0 -76
  109. package/src/docs/pages/settings/mandatory.vue +0 -91
  110. package/src/docs/pages/settings/min_max.vue +0 -61
  111. package/src/docs/pages/settings/open_position.vue +0 -60
  112. package/src/docs/pages/settings/placeholder.vue +0 -72
  113. package/src/docs/pages/settings/search.vue +0 -140
  114. package/src/docs/pages/settings/select.vue +0 -32
  115. package/src/docs/pages/settings/select_all.vue +0 -88
  116. package/src/docs/pages/settings/show_tooltip.vue +0 -44
  117. package/src/docs/pages/settings/styles.vue +0 -51
  118. package/src/docs/router.ts +0 -50
@@ -46,11 +46,50 @@ function debounce(func, wait = 50, immediate = false) {
46
46
  }
47
47
  };
48
48
  }
49
+ function isEqual(a, b) {
50
+ return JSON.stringify(a) === JSON.stringify(b);
51
+ }
49
52
  function kebabCase(str) {
50
53
  const result = str.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, (match) => '-' + match.toLowerCase());
51
54
  return str[0] === str[0].toUpperCase() ? result.substring(1) : result;
52
55
  }
53
56
 
57
+ class Settings {
58
+ constructor(settings) {
59
+ this.id = '';
60
+ this.style = '';
61
+ this.class = [];
62
+ this.isMultiple = false;
63
+ this.isOpen = false;
64
+ this.triggerFocus = true;
65
+ this.intervalMove = null;
66
+ if (!settings) {
67
+ settings = {};
68
+ }
69
+ this.id = 'ss-' + generateID();
70
+ this.style = settings.style || '';
71
+ this.class = settings.class || [];
72
+ this.isEnabled = settings.isEnabled !== undefined ? settings.isEnabled : true;
73
+ this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false;
74
+ this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true;
75
+ this.searchPlaceholder = settings.searchPlaceholder || 'Search';
76
+ this.searchText = settings.searchText || 'No Results';
77
+ this.searchingText = settings.searchingText || 'Searching...';
78
+ this.searchHighlight = settings.searchHighlight !== undefined ? settings.searchHighlight : false;
79
+ this.closeOnSelect = settings.closeOnSelect !== undefined ? settings.closeOnSelect : true;
80
+ this.contentLocation = settings.contentLocation || document.body;
81
+ this.contentPosition = settings.contentPosition || 'absolute';
82
+ this.openPosition = settings.openPosition || 'auto';
83
+ this.placeholderText = settings.placeholderText || 'Select Value';
84
+ this.allowDeselect = settings.allowDeselect !== undefined ? settings.allowDeselect : false;
85
+ this.hideSelected = settings.hideSelected !== undefined ? settings.hideSelected : false;
86
+ this.showOptionTooltips = settings.showOptionTooltips !== undefined ? settings.showOptionTooltips : false;
87
+ this.minSelected = settings.minSelected || 0;
88
+ this.maxSelected = settings.maxSelected || 1000;
89
+ this.timeoutDelay = settings.timeoutDelay || 200;
90
+ }
91
+ }
92
+
54
93
  class Optgroup {
55
94
  constructor(optgroup) {
56
95
  this.id = !optgroup.id || optgroup.id === '' ? generateID() : optgroup.id;
@@ -944,9 +983,12 @@ class Render {
944
983
  optgroupClosableSvg.classList.add(this.classes.arrow);
945
984
  optgroupClosable.appendChild(optgroupClosableSvg);
946
985
  const optgroupClosableArrow = document.createElementNS('http://www.w3.org/2000/svg', 'path');
947
- optgroupClosableArrow.setAttribute('d', this.classes.arrow);
948
986
  optgroupClosableSvg.appendChild(optgroupClosableArrow);
949
- if (d.closable === 'open') {
987
+ if (d.options.some((o) => o.selected)) {
988
+ optgroupClosable.classList.add(this.classes.open);
989
+ optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen);
990
+ }
991
+ else if (d.closable === 'open') {
950
992
  optgroupEl.classList.add(this.classes.open);
951
993
  optgroupClosableArrow.setAttribute('d', this.classes.arrowOpen);
952
994
  }
@@ -1193,16 +1235,19 @@ class Select {
1193
1235
  }
1194
1236
  addValueChangeListener(func) {
1195
1237
  this.onValueChange = func;
1196
- this.select.addEventListener('change', this.valueChange.bind(this));
1238
+ this.select.addEventListener('change', this.valueChange.bind(this), {
1239
+ passive: true,
1240
+ });
1197
1241
  }
1198
1242
  removeValueChangeListener() {
1199
1243
  this.onValueChange = undefined;
1200
1244
  this.select.removeEventListener('change', this.valueChange.bind(this));
1201
1245
  }
1202
1246
  valueChange(ev) {
1203
- if (this.onValueChange) {
1247
+ if (this.listen && this.onValueChange) {
1204
1248
  this.onValueChange(this.getSelectedValues());
1205
1249
  }
1250
+ return true;
1206
1251
  }
1207
1252
  observeWrapper(mutations) {
1208
1253
  if (this.onSelectChange) {
@@ -1347,6 +1392,7 @@ class Select {
1347
1392
  this.select.appendChild(this.createOption(d));
1348
1393
  }
1349
1394
  }
1395
+ this.select.dispatchEvent(new Event('change'));
1350
1396
  this.changeListen(true);
1351
1397
  }
1352
1398
  createOptgroup(optgroup) {
@@ -1406,42 +1452,6 @@ class Select {
1406
1452
  }
1407
1453
  }
1408
1454
 
1409
- class Settings {
1410
- constructor(settings) {
1411
- this.id = '';
1412
- this.style = '';
1413
- this.class = [];
1414
- this.isMultiple = false;
1415
- this.isOpen = false;
1416
- this.triggerFocus = true;
1417
- this.intervalMove = null;
1418
- if (!settings) {
1419
- settings = {};
1420
- }
1421
- this.id = 'ss-' + generateID();
1422
- this.style = settings.style || '';
1423
- this.class = settings.class || [];
1424
- this.isEnabled = settings.isEnabled !== undefined ? settings.isEnabled : true;
1425
- this.alwaysOpen = settings.alwaysOpen !== undefined ? settings.alwaysOpen : false;
1426
- this.showSearch = settings.showSearch !== undefined ? settings.showSearch : true;
1427
- this.searchPlaceholder = settings.searchPlaceholder || 'Search';
1428
- this.searchText = settings.searchText || 'No Results';
1429
- this.searchingText = settings.searchingText || 'Searching...';
1430
- this.searchHighlight = settings.searchHighlight !== undefined ? settings.searchHighlight : false;
1431
- this.closeOnSelect = settings.closeOnSelect !== undefined ? settings.closeOnSelect : true;
1432
- this.contentLocation = settings.contentLocation || document.body;
1433
- this.contentPosition = settings.contentPosition || 'absolute';
1434
- this.openPosition = settings.openPosition || 'auto';
1435
- this.placeholderText = settings.placeholderText || 'Select Value';
1436
- this.allowDeselect = settings.allowDeselect !== undefined ? settings.allowDeselect : false;
1437
- this.hideSelected = settings.hideSelected !== undefined ? settings.hideSelected : false;
1438
- this.showOptionTooltips = settings.showOptionTooltips !== undefined ? settings.showOptionTooltips : false;
1439
- this.minSelected = settings.minSelected || 0;
1440
- this.maxSelected = settings.maxSelected || 1000;
1441
- this.timeoutDelay = settings.timeoutDelay || 200;
1442
- }
1443
- }
1444
-
1445
1455
  class SlimSelect {
1446
1456
  constructor(config) {
1447
1457
  this.events = {
@@ -1574,6 +1584,7 @@ class SlimSelect {
1574
1584
  return this.store.getData();
1575
1585
  }
1576
1586
  setData(data) {
1587
+ const selected = this.store.getSelected();
1577
1588
  const err = this.store.validateDataArray(data);
1578
1589
  if (err) {
1579
1590
  if (this.events.error) {
@@ -1586,23 +1597,34 @@ class SlimSelect {
1586
1597
  this.select.updateOptions(dataClean);
1587
1598
  this.render.renderValues();
1588
1599
  this.render.renderOptions(dataClean);
1600
+ if (this.events.afterChange && !isEqual(selected, this.store.getSelected())) {
1601
+ this.events.afterChange(this.store.getSelectedOptions());
1602
+ }
1589
1603
  }
1590
1604
  getSelected() {
1591
1605
  return this.store.getSelected();
1592
1606
  }
1593
1607
  setSelected(value) {
1608
+ const selected = this.store.getSelected();
1594
1609
  this.store.setSelectedBy('value', Array.isArray(value) ? value : [value]);
1595
1610
  const data = this.store.getData();
1596
1611
  this.select.updateOptions(data);
1597
1612
  this.render.renderValues();
1598
1613
  this.render.renderOptions(data);
1614
+ if (this.events.afterChange && !isEqual(selected, this.store.getSelected())) {
1615
+ this.events.afterChange(this.store.getSelectedOptions());
1616
+ }
1599
1617
  }
1600
1618
  addOption(option) {
1619
+ const selected = this.store.getSelected();
1601
1620
  this.store.addOption(option);
1602
1621
  const data = this.store.getData();
1603
1622
  this.select.updateOptions(data);
1604
1623
  this.render.renderValues();
1605
1624
  this.render.renderOptions(data);
1625
+ if (this.events.afterChange && !isEqual(selected, this.store.getSelected())) {
1626
+ this.events.afterChange(this.store.getSelectedOptions());
1627
+ }
1606
1628
  }
1607
1629
  open() {
1608
1630
  if (!this.settings.isEnabled || this.settings.isOpen) {
@@ -1688,6 +1710,13 @@ class SlimSelect {
1688
1710
  var script = vue.defineComponent({
1689
1711
  name: 'SlimSelect',
1690
1712
  props: {
1713
+ modelValue: {
1714
+ type: [String, Array, undefined],
1715
+ },
1716
+ multiple: {
1717
+ type: Boolean,
1718
+ default: false,
1719
+ },
1691
1720
  data: {
1692
1721
  type: Array,
1693
1722
  },
@@ -1698,6 +1727,7 @@ var script = vue.defineComponent({
1698
1727
  type: Object,
1699
1728
  },
1700
1729
  },
1730
+ emits: ['update:modelValue'],
1701
1731
  data() {
1702
1732
  return {
1703
1733
  slim: null,
@@ -1716,7 +1746,24 @@ var script = vue.defineComponent({
1716
1746
  if (this.events) {
1717
1747
  config.events = this.events;
1718
1748
  }
1749
+ if (!config.events) {
1750
+ config.events = {};
1751
+ }
1752
+ const ogAfterChange = config.events.afterChange;
1753
+ config.events.afterChange = (newVal) => {
1754
+ const value = this.multiple ? newVal.map((option) => option.value) : newVal[0].value;
1755
+ if (this.value !== value) {
1756
+ this.value = value;
1757
+ }
1758
+ if (config.events && ogAfterChange) {
1759
+ ogAfterChange(newVal);
1760
+ }
1761
+ };
1719
1762
  this.slim = new SlimSelect(config);
1763
+ let selected = this.$props.multiple ? this.slim.getSelected() : this.slim.getSelected()[0];
1764
+ if (this.value !== selected) {
1765
+ this.value = selected;
1766
+ }
1720
1767
  },
1721
1768
  beforeUnmount() {
1722
1769
  if (this.slim) {
@@ -1733,6 +1780,27 @@ var script = vue.defineComponent({
1733
1780
  deep: true,
1734
1781
  },
1735
1782
  },
1783
+ computed: {
1784
+ value: {
1785
+ get() {
1786
+ const multi = this.$props.multiple;
1787
+ const val = this.$props.modelValue;
1788
+ if (val === undefined) {
1789
+ return multi ? [] : '';
1790
+ }
1791
+ if (multi && typeof val === 'string') {
1792
+ return [val];
1793
+ }
1794
+ if (!multi && Array.isArray(val)) {
1795
+ return val[0];
1796
+ }
1797
+ return multi ? [] : '';
1798
+ },
1799
+ set(value) {
1800
+ this.$emit('update:modelValue', value);
1801
+ },
1802
+ },
1803
+ },
1736
1804
  methods: {
1737
1805
  getSlimSelect() {
1738
1806
  return this.slim;
@@ -1740,12 +1808,15 @@ var script = vue.defineComponent({
1740
1808
  },
1741
1809
  });
1742
1810
 
1743
- const _hoisted_1 = { ref: "slim" };
1811
+ const _hoisted_1 = ["multiple"];
1744
1812
 
1745
1813
  function render(_ctx, _cache, $props, $setup, $data, $options) {
1746
- return (vue.openBlock(), vue.createElementBlock("select", _hoisted_1, [
1814
+ return (vue.openBlock(), vue.createElementBlock("select", {
1815
+ multiple: _ctx.multiple,
1816
+ ref: "slim"
1817
+ }, [
1747
1818
  vue.renderSlot(_ctx.$slots, "default")
1748
- ], 512 /* NEED_PATCH */))
1819
+ ], 8 /* PROPS */, _hoisted_1))
1749
1820
  }
1750
1821
 
1751
1822
  script.render = render;
@@ -0,0 +1,2 @@
1
+ declare const hello = "hello world";
2
+ export default hello;
@@ -0,0 +1,309 @@
1
+ /// <reference types="node" />
2
+ import { PropType } from 'vue';
3
+ import SlimSelect, { Events } from '../slim-select';
4
+ import Settings from '../slim-select/settings';
5
+ import { DataArrayPartial, Option } from '../slim-select/store';
6
+ declare const _default: import("vue").DefineComponent<{
7
+ modelValue: {
8
+ type: PropType<string | string[] | undefined>;
9
+ };
10
+ multiple: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ data: {
15
+ type: PropType<DataArrayPartial>;
16
+ };
17
+ settings: {
18
+ type: PropType<Settings>;
19
+ };
20
+ events: {
21
+ type: PropType<Events>;
22
+ };
23
+ }, unknown, {
24
+ slim: SlimSelect | null;
25
+ }, {
26
+ value: {
27
+ get(): string | string[];
28
+ set(value: string | string[]): void;
29
+ };
30
+ }, {
31
+ getSlimSelect(): {
32
+ selectEl: HTMLSelectElement;
33
+ settings: {
34
+ id: string;
35
+ style: string;
36
+ class: string[];
37
+ isMultiple: boolean;
38
+ isOpen: boolean;
39
+ triggerFocus: boolean;
40
+ intervalMove: {
41
+ hasRef: () => boolean;
42
+ refresh: () => NodeJS.Timeout;
43
+ [Symbol.toPrimitive]: () => number;
44
+ ref: () => NodeJS.Timeout;
45
+ unref: () => NodeJS.Timeout;
46
+ } | null;
47
+ isEnabled: boolean;
48
+ alwaysOpen: boolean;
49
+ showSearch: boolean;
50
+ searchPlaceholder: string;
51
+ searchText: string;
52
+ searchingText: string;
53
+ searchHighlight: boolean;
54
+ closeOnSelect: boolean;
55
+ contentLocation: HTMLElement;
56
+ contentPosition: "relative" | "absolute";
57
+ openPosition: "auto" | "up" | "down";
58
+ placeholderText: string;
59
+ allowDeselect: boolean;
60
+ hideSelected: boolean;
61
+ showOptionTooltips: boolean;
62
+ minSelected: number;
63
+ maxSelected: number;
64
+ timeoutDelay: number;
65
+ };
66
+ select: {
67
+ select: HTMLSelectElement;
68
+ listen: boolean;
69
+ onSelectChange?: ((data: DataArrayPartial) => void) | undefined;
70
+ onValueChange?: ((value: string[]) => void) | undefined;
71
+ enable: () => void;
72
+ disable: () => void;
73
+ hideUI: () => void;
74
+ showUI: () => void;
75
+ changeListen: (on: boolean) => void;
76
+ addSelectChangeListener: (func: (data: DataArrayPartial) => void) => void;
77
+ removeSelectChangeListener: () => void;
78
+ addValueChangeListener: (func: (value: string[]) => void) => void;
79
+ removeValueChangeListener: () => void;
80
+ valueChange: (ev: Event) => boolean;
81
+ getData: () => DataArrayPartial;
82
+ getDataFromOptgroup: (optgroup: HTMLOptGroupElement) => import("../slim-select/store").OptgroupOptional;
83
+ getDataFromOption: (option: HTMLOptionElement) => Option;
84
+ getSelectedValues: () => string[];
85
+ setSelected: (value: string[]) => void;
86
+ updateSelect: (id?: string | undefined, style?: string | undefined, classes?: string[] | undefined) => void;
87
+ updateOptions: (data: import("../slim-select/store").DataArray) => void;
88
+ createOptgroup: (optgroup: import("../slim-select/store").Optgroup) => HTMLOptGroupElement;
89
+ createOption: (info: Option) => HTMLOptionElement;
90
+ destroy: () => void;
91
+ };
92
+ store: {
93
+ validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null;
94
+ validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null;
95
+ partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray;
96
+ setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void;
97
+ getData: () => import("../slim-select/store").DataArray;
98
+ getDataOptions: () => Option[];
99
+ addOption: (option: import("../slim-select/store").OptionOptional) => void;
100
+ setSelectedBy: (selectedType: "value" | "id", selectedValues: string[]) => void;
101
+ getSelected: () => string[];
102
+ getSelectedOptions: () => Option[];
103
+ getSelectedIDs: () => string[];
104
+ getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null;
105
+ getOptionByID: (id: string) => Option | null;
106
+ search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray;
107
+ filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray;
108
+ };
109
+ render: {
110
+ settings: {
111
+ id: string;
112
+ style: string;
113
+ class: string[];
114
+ isMultiple: boolean;
115
+ isOpen: boolean;
116
+ triggerFocus: boolean;
117
+ intervalMove: {
118
+ hasRef: () => boolean;
119
+ refresh: () => NodeJS.Timeout;
120
+ [Symbol.toPrimitive]: () => number;
121
+ ref: () => NodeJS.Timeout;
122
+ unref: () => NodeJS.Timeout;
123
+ } | null;
124
+ isEnabled: boolean;
125
+ alwaysOpen: boolean;
126
+ showSearch: boolean;
127
+ searchPlaceholder: string;
128
+ searchText: string;
129
+ searchingText: string;
130
+ searchHighlight: boolean;
131
+ closeOnSelect: boolean;
132
+ contentLocation: HTMLElement;
133
+ contentPosition: "relative" | "absolute";
134
+ openPosition: "auto" | "up" | "down";
135
+ placeholderText: string;
136
+ allowDeselect: boolean;
137
+ hideSelected: boolean;
138
+ showOptionTooltips: boolean;
139
+ minSelected: number;
140
+ maxSelected: number;
141
+ timeoutDelay: number;
142
+ };
143
+ store: {
144
+ validateDataArray: (data: DataArrayPartial | import("../slim-select/store").DataArray) => Error | null;
145
+ validateOption: (option: import("../slim-select/store").OptionOptional | Option) => Error | null;
146
+ partialToFullData: (data: DataArrayPartial) => import("../slim-select/store").DataArray;
147
+ setData: (data: DataArrayPartial | import("../slim-select/store").DataArray) => void;
148
+ getData: () => import("../slim-select/store").DataArray;
149
+ getDataOptions: () => Option[];
150
+ addOption: (option: import("../slim-select/store").OptionOptional) => void;
151
+ setSelectedBy: (selectedType: "value" | "id", selectedValues: string[]) => void;
152
+ getSelected: () => string[];
153
+ getSelectedOptions: () => Option[];
154
+ getSelectedIDs: () => string[];
155
+ getOptgroupByID: (id: string) => import("../slim-select/store").Optgroup | null;
156
+ getOptionByID: (id: string) => Option | null;
157
+ search: (search: string, searchFilter: (opt: Option, search: string) => boolean) => import("../slim-select/store").DataArray;
158
+ filter: (filter: ((opt: Option) => boolean) | null, includeOptgroup: boolean) => import("../slim-select/store").DataArray;
159
+ };
160
+ callbacks: {
161
+ open: () => void;
162
+ close: () => void;
163
+ addable?: ((value: string) => string | import("../slim-select/store").OptionOptional | Promise<string | import("../slim-select/store").OptionOptional>) | undefined;
164
+ setSelected: (value: string[]) => void;
165
+ addOption: (option: Option) => void;
166
+ search: (search: string) => void;
167
+ beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined;
168
+ afterChange?: ((newVal: Option[]) => void) | undefined;
169
+ };
170
+ main: {
171
+ main: HTMLDivElement;
172
+ values: HTMLDivElement;
173
+ deselect: {
174
+ main: HTMLDivElement;
175
+ svg: SVGSVGElement;
176
+ path: SVGPathElement;
177
+ };
178
+ arrow: {
179
+ main: SVGSVGElement;
180
+ path: SVGPathElement;
181
+ };
182
+ };
183
+ content: {
184
+ main: HTMLDivElement;
185
+ search: {
186
+ main: HTMLDivElement;
187
+ input: HTMLInputElement;
188
+ addable?: {
189
+ main: HTMLDivElement;
190
+ svg: SVGSVGElement;
191
+ path: SVGPathElement;
192
+ } | undefined;
193
+ };
194
+ list: HTMLDivElement;
195
+ };
196
+ classes: {
197
+ main: string;
198
+ placeholder: string;
199
+ values: string;
200
+ single: string;
201
+ value: string;
202
+ valueText: string;
203
+ valueDelete: string;
204
+ valueOut: string;
205
+ deselect: string;
206
+ deselectPath: string;
207
+ arrow: string;
208
+ arrowClose: string;
209
+ arrowOpen: string;
210
+ content: string;
211
+ openAbove: string;
212
+ openBelow: string;
213
+ search: string;
214
+ searchHighlighter: string;
215
+ searching: string;
216
+ addable: string;
217
+ addablePath: string;
218
+ list: string;
219
+ optgroup: string;
220
+ optgroupLabel: string;
221
+ optgroupLabelText: string;
222
+ optgroupActions: string;
223
+ optgroupSelectAll: string;
224
+ optgroupSelectAllBox: string;
225
+ optgroupSelectAllCheck: string;
226
+ optgroupClosable: string;
227
+ option: string;
228
+ optionDelete: string;
229
+ highlighted: string;
230
+ open: string;
231
+ close: string;
232
+ selected: string;
233
+ error: string;
234
+ disabled: string;
235
+ hide: string;
236
+ };
237
+ enable: () => void;
238
+ disable: () => void;
239
+ open: () => void;
240
+ close: () => void;
241
+ mainDiv: () => import("../slim-select/render").Main;
242
+ mainFocus: (trigger: boolean) => void;
243
+ placeholder: () => HTMLDivElement;
244
+ renderValues: () => void;
245
+ multipleValue: (option: Option) => HTMLDivElement;
246
+ contentDiv: () => import("../slim-select/render").Content;
247
+ moveContent: () => void;
248
+ searchDiv: () => import("../slim-select/render").Search;
249
+ searchFocus: (trigger: boolean) => void;
250
+ getOptions: (notPlaceholder?: boolean, notDisabled?: boolean, notHidden?: boolean) => HTMLDivElement[];
251
+ highlight: (dir: "up" | "down") => void;
252
+ listDiv: () => HTMLDivElement;
253
+ renderError: (error: string) => void;
254
+ renderSearching: () => void;
255
+ renderOptions: (data: import("../slim-select/store").DataArray) => void;
256
+ option: (option: Option) => HTMLDivElement;
257
+ destroy: () => void;
258
+ moveContentAbove: () => void;
259
+ moveContentBelow: () => void;
260
+ ensureElementInView: (container: HTMLElement, element: HTMLElement) => void;
261
+ putContent: (el: HTMLElement, isOpen: boolean) => "up" | "down";
262
+ };
263
+ events: {
264
+ search?: ((searchValue: string, currentData: import("../slim-select/store").DataArray) => DataArrayPartial | Promise<DataArrayPartial>) | undefined;
265
+ searchFilter?: ((option: Option, search: string) => boolean) | undefined;
266
+ addable?: ((value: string) => string | import("../slim-select/store").OptionOptional | Promise<string | import("../slim-select/store").OptionOptional>) | undefined;
267
+ beforeChange?: ((newVal: Option[], oldVal: Option[]) => boolean | void) | undefined;
268
+ afterChange?: ((newVal: Option[]) => void) | undefined;
269
+ beforeOpen?: (() => void) | undefined;
270
+ afterOpen?: (() => void) | undefined;
271
+ beforeClose?: (() => void) | undefined;
272
+ afterClose?: (() => void) | undefined;
273
+ error?: ((err: Error) => void) | undefined;
274
+ };
275
+ enable: () => void;
276
+ disable: () => void;
277
+ getData: () => import("../slim-select/store").DataArray;
278
+ setData: (data: DataArrayPartial) => void;
279
+ getSelected: () => string[];
280
+ setSelected: (value: string | string[]) => void;
281
+ addOption: (option: import("../slim-select/store").OptionOptional) => void;
282
+ open: () => void;
283
+ close: () => void;
284
+ search: (value: string) => void;
285
+ destroy: () => void;
286
+ } | null;
287
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
288
+ modelValue: {
289
+ type: PropType<string | string[] | undefined>;
290
+ };
291
+ multiple: {
292
+ type: BooleanConstructor;
293
+ default: boolean;
294
+ };
295
+ data: {
296
+ type: PropType<DataArrayPartial>;
297
+ };
298
+ settings: {
299
+ type: PropType<Settings>;
300
+ };
301
+ events: {
302
+ type: PropType<Events>;
303
+ };
304
+ }>> & {
305
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
306
+ }, {
307
+ multiple: boolean;
308
+ }>;
309
+ export default _default;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@slim-select/vue",
3
3
  "private": false,
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "description": "Vue integration",
6
6
  "repository": {
7
7
  "type": "git",
@@ -19,8 +19,7 @@
19
19
  "main": "dist/slimselectvue.ssr.js",
20
20
  "browser": "dist/slimselect.global.js",
21
21
  "module": "dist/slimselectvue.es.js",
22
- "types": "dist/index.d.ts",
23
- "typings": "dist/index.d.ts",
22
+ "types": "dist/vue/slimselect.vue.d.ts",
24
23
  "scripts": {
25
24
  "build": "rollup -c rollup.config.mjs",
26
25
  "test": "echo \"Error: no test specified\" && exit 1"