its_ui_vite 1.0.0 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "its_ui_vite",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "main": "./src/libIndex.js",
5
5
  "module": "./src/libIndex.js",
6
6
  "files": [
@@ -163,29 +163,27 @@ const foundOptions = computed(() => {
163
163
  return props.options.filter(({text}) => text && reg.test(text))
164
164
  })
165
165
 
166
- watch(props.modelValue, (options: TOption[]) => {
167
- if (!(options?.length)) return;
168
- activeOptions.value.clear();
169
- oldActiveOptions.value.clear();
166
+ watch(() => props.modelValue, (options: TOption[]) => {
167
+ activeOptions.value.clear();
168
+ oldActiveOptions.value.clear();
170
169
 
171
- options = isMultiple.value ? options : options.slice(0, 1);
172
- [...options].forEach((item) => {
170
+ if (!(options?.length)) return setActivePlaceholder();
173
171
 
174
- let option = props.options.find(({ value }) => value === (item?.value || item))
172
+ options = isMultiple.value ? options : options.slice(0, 1);
173
+ [...options].forEach((item) => {
175
174
 
176
- if (!item?.value) {
177
- option = props.options.find(({ value }) => value === item);
178
- } else {
179
-
180
- }
181
-
182
- if (undefined === option) return;
175
+ const option = props.options.find(({ value }) => [item?.value, item].includes(value))
176
+
177
+ if (undefined === option) return;
183
178
 
184
- activeOptions.value.add(option);
185
- oldActiveOptions.value.add(option);
186
- })
179
+ activeOptions.value.add(option);
180
+ oldActiveOptions.value.add(option);
181
+ })
187
182
 
188
- setActivePlaceholder()
183
+ setActivePlaceholder()
184
+ }, {
185
+ immediate: true,
186
+ deep: true
189
187
  })
190
188
 
191
189
  onMounted(() => {
@@ -206,7 +204,6 @@ const handleOption: TDebounceEvent = function(option, evt) {
206
204
  if (isSelectAll.value && evt) setAllOption(evt)
207
205
  setOption(option, evt);
208
206
 
209
- setActivePlaceholder()
210
207
  if (!isMultiple.value) dispatchEmit()
211
208
  }
212
209
 
@@ -220,10 +217,11 @@ const setOption: TDebounceEvent = function(option, evt) {
220
217
  if (!isMultiple.value) activeOptions.value.clear()
221
218
 
222
219
  activeOptions.value[isAdd ? 'add' : 'delete'](option)
220
+ setActivePlaceholder()
223
221
  }
224
222
 
225
223
  function getCheckboxProp(option: TOption) {
226
- const isChecked = !!([...activeOptions.value].find(({ value }) => option.value === value));
224
+ const isChecked = !!([...activeOptions.value, ...props.modelValue].find((item) => [item.value, item].includes(option.value)));
227
225
 
228
226
  if (!isMultiple.value) return {}
229
227
  return {
@@ -636,7 +636,12 @@
636
636
  <!-- col -->
637
637
  <div class="table__col">
638
638
  <div class="table__item">
639
- <CSelect @change_cselect="(evt) => log(['CSelect default', evt])" v-model="VModelOption" :options="option" />
639
+ <CSelect
640
+ :options="option"
641
+ v-model="VModelOption"
642
+ :autocomplete="true"
643
+ @change_cselect="(evt) => log(['CSelect default', evt])"
644
+ />
640
645
  </div>
641
646
  </div>
642
647
  <!-- ./col -->
@@ -712,8 +717,9 @@
712
717
  <div class="table__col">
713
718
 
714
719
  <div class="table__item">
715
- <CSelect variant="multiple" @change_cselect="(evt) => log(['CSelect multiple', evt])" size="sm" :select-all="true" :options="option.slice(-2)" v-model="VModelOption" />
720
+ <CSelect variant="multiple" @change_cselect="(evt) => log(['CSelect multiple', evt])" size="sm" :select-all="true" :options="option.slice(-2)" :model-value="VModelOption" />
716
721
  </div>
722
+ <h2 @click="VModelOption.length ? VModelOption.splice(0) : VModelOption.push('jj889')">{{ VModelOption }}</h2>
717
723
 
718
724
  <div class="table__item">
719
725
  <CSelect variant="multiple" @change_cselect="(evt) => log(['CSelect multiple', evt])" size="sm" :select-all="true" :options="option" v-model="VModelOption" />