@webitel/ui-sdk 24.10.63 → 24.10.64

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.10.63",
3
+ "version": "24.10.64",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -15,7 +15,8 @@
15
15
  "publish-lib:testless": "npm run build && npm publish --access public",
16
16
  "docs:dev": "vitepress dev docs --port 8080",
17
17
  "docs:build": "vitepress build docs",
18
- "docs:preview": "vitepress preview docs"
18
+ "docs:preview": "vitepress preview docs",
19
+ "update-node":"nvm install --lts && nvm alias default node"
19
20
  },
20
21
  "main": "./dist/@webitel/ui-sdk.mjs",
21
22
  "type": "module",
@@ -155,5 +156,9 @@
155
156
  "vitest": "^1.4.0",
156
157
  "vue": "^3.4.15",
157
158
  "vuex": "^4.1.0"
159
+ },
160
+ "engines": {
161
+ "npm": "10.9.0",
162
+ "node": "v22.11.0"
158
163
  }
159
164
  }
@@ -158,6 +158,7 @@ export default {
158
158
  created() {
159
159
  // load options only if not disabled
160
160
  if (!this.disabled) this.fetchOptions();
161
+
161
162
  this.fetchOptions = debounce(this.fetchOptions, 500);
162
163
  },
163
164
  };
@@ -28,6 +28,23 @@ describe('WtTagsInput', () => {
28
28
  expect(wrapper.emitted().input[0][0]).toEqual([tag]);
29
29
  });
30
30
 
31
+ it('by default when input taggable initialize options should set from value', () => {
32
+ const wrapper = mount(WtTagsInput, {
33
+ props: {
34
+ value: [
35
+ { label: 'Vue.js', text: 'JavaScript' },
36
+ { label: 'Vue2.js', text: 'JavaScript' },
37
+ { label: 'Vue3.js', text: 'JavaScript' }
38
+ ],
39
+ options: [
40
+ { label: 'Vue.js', text: 'JavaScript' }
41
+ ]
42
+ },
43
+ });
44
+ expect(wrapper.findComponent({ name: 'vue-multiselect' }).vm.$props.options.length).toEqual(3);
45
+ });
46
+
47
+
31
48
  it('in manual mode doesnt emit "input" event at native "tag" event', () => {
32
49
  const tag = '123';
33
50
  const wrapper = mount(WtTagsInput, {
@@ -102,6 +102,8 @@
102
102
  </template>
103
103
 
104
104
  <script>
105
+ import deepEqual from 'deep-equal';
106
+
105
107
  import multiselectMixin from '../wt-select/mixins/multiselectMixin.js';
106
108
  import taggableMixin from './mixin/taggableMixin.js';
107
109
 
@@ -153,7 +155,25 @@ export default {
153
155
  const label = this.getOptionLabel({ optionLabel, option });
154
156
  return typeof label === 'object' ? option.label : label;
155
157
  },
158
+ initializeOptions() {
159
+ if (!this.value) {
160
+ return [];
161
+ }
162
+
163
+ const newOptions = this.value.filter(valObj => {
164
+ return !this.options.find(option => {
165
+ return deepEqual(option, valObj)
166
+ });
167
+ });
168
+
169
+ this.options.unshift(...newOptions)
170
+ }
156
171
  },
172
+ created() {
173
+ if (!this.isApiMode) {
174
+ this.initializeOptions()
175
+ }
176
+ }
157
177
  };
158
178
  </script>
159
179