@iankibetsh/shframework 5.0.3 → 5.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.
package/dist/library.js CHANGED
@@ -2150,7 +2150,7 @@ const _hoisted_10$8 = {
2150
2150
 
2151
2151
  var script$z = {
2152
2152
  __name: 'ShSuggest',
2153
- props: ['data','allowMultiple','url','modelValue','optionTemplate'],
2153
+ props: ['data','allowMultiple','url','modelValue','optionTemplate','allowUserInput'],
2154
2154
  emits: ['update:modelValue'],
2155
2155
  setup(__props, { emit: __emit }) {
2156
2156
 
@@ -2190,7 +2190,12 @@ function addSuggestion(sgn){
2190
2190
  function updateModelValue(){
2191
2191
  let selectedItems = selectedSuggestions.value;
2192
2192
  if(selectedItems.length === 0) {
2193
- emit('update:modelValue', null);
2193
+ if(props.allowUserInput){
2194
+ emit('update:modelValue', searchText.value);
2195
+ return
2196
+ } else {
2197
+ emit('update:modelValue', null);
2198
+ }
2194
2199
  } else if (!props.allowMultiple) {
2195
2200
  emit('update:modelValue', selectedItems[0].id);
2196
2201
  } else {
@@ -2214,6 +2219,7 @@ function filterData(e){
2214
2219
  showDropDown();
2215
2220
  let filterValue = e.target.innerText;
2216
2221
  searchText.value = filterValue;
2222
+ updateModelValue();
2217
2223
  if (props.url) {
2218
2224
  fetchRemoteData();
2219
2225
  } else if(props.data) {
@@ -2313,7 +2319,7 @@ return (_ctx, _cache) => {
2313
2319
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_6$a)
2314
2320
  ], 8 /* PROPS */, _hoisted_2$h),
2315
2321
  vue.createElementVNode("ul", {
2316
- class: "dropdown-menu w-100",
2322
+ class: vue.normalizeClass([(!vue.unref(suggestions) || vue.unref(suggestions).length === 0) ? 'no-sh-suggestions':'sh-found-suggestions', "dropdown-menu w-100"]),
2317
2323
  id: 'dropwdown_section' + vue.unref(id),
2318
2324
  "aria-labelledby": vue.unref(id)
2319
2325
  }, [
@@ -2345,7 +2351,7 @@ return (_ctx, _cache) => {
2345
2351
  : (vue.unref(searchText))
2346
2352
  ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_9$8, " No results found "))
2347
2353
  : (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$8, " Type to search... "))
2348
- ], 8 /* PROPS */, _hoisted_7$9)
2354
+ ], 10 /* CLASS, PROPS */, _hoisted_7$9)
2349
2355
  ]))
2350
2356
  : vue.createCommentVNode("v-if", true)
2351
2357
  }
package/dist/library.mjs CHANGED
@@ -3,7 +3,7 @@ import moment from 'moment';
3
3
  import Swal from 'sweetalert2';
4
4
  import { Modal, Offcanvas } from 'bootstrap';
5
5
  import NProgress from 'nprogress';
6
- import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, ref, onMounted, watch, unref, createBlock, resolveDynamicComponent, normalizeClass, resolveComponent, inject, mergeProps, renderSlot, normalizeStyle, computed, createVNode, withCtx, vModelCheckbox, shallowRef, normalizeProps, pushScopeId, popScopeId, markRaw, isRef } from 'vue';
6
+ import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, ref, onMounted, watch, unref, normalizeClass, createBlock, resolveDynamicComponent, resolveComponent, inject, mergeProps, renderSlot, normalizeStyle, computed, createVNode, withCtx, vModelCheckbox, shallowRef, normalizeProps, pushScopeId, popScopeId, markRaw, isRef } from 'vue';
7
7
  import _ from 'lodash';
8
8
  import { defineStore, storeToRefs } from 'pinia';
9
9
  import { useRoute, useRouter } from 'vue-router';
@@ -2138,7 +2138,7 @@ const _hoisted_10$8 = {
2138
2138
 
2139
2139
  var script$z = {
2140
2140
  __name: 'ShSuggest',
2141
- props: ['data','allowMultiple','url','modelValue','optionTemplate'],
2141
+ props: ['data','allowMultiple','url','modelValue','optionTemplate','allowUserInput'],
2142
2142
  emits: ['update:modelValue'],
2143
2143
  setup(__props, { emit: __emit }) {
2144
2144
 
@@ -2178,7 +2178,12 @@ function addSuggestion(sgn){
2178
2178
  function updateModelValue(){
2179
2179
  let selectedItems = selectedSuggestions.value;
2180
2180
  if(selectedItems.length === 0) {
2181
- emit('update:modelValue', null);
2181
+ if(props.allowUserInput){
2182
+ emit('update:modelValue', searchText.value);
2183
+ return
2184
+ } else {
2185
+ emit('update:modelValue', null);
2186
+ }
2182
2187
  } else if (!props.allowMultiple) {
2183
2188
  emit('update:modelValue', selectedItems[0].id);
2184
2189
  } else {
@@ -2202,6 +2207,7 @@ function filterData(e){
2202
2207
  showDropDown();
2203
2208
  let filterValue = e.target.innerText;
2204
2209
  searchText.value = filterValue;
2210
+ updateModelValue();
2205
2211
  if (props.url) {
2206
2212
  fetchRemoteData();
2207
2213
  } else if(props.data) {
@@ -2301,7 +2307,7 @@ return (_ctx, _cache) => {
2301
2307
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_6$a)
2302
2308
  ], 8 /* PROPS */, _hoisted_2$h),
2303
2309
  createElementVNode("ul", {
2304
- class: "dropdown-menu w-100",
2310
+ class: normalizeClass([(!unref(suggestions) || unref(suggestions).length === 0) ? 'no-sh-suggestions':'sh-found-suggestions', "dropdown-menu w-100"]),
2305
2311
  id: 'dropwdown_section' + unref(id),
2306
2312
  "aria-labelledby": unref(id)
2307
2313
  }, [
@@ -2333,7 +2339,7 @@ return (_ctx, _cache) => {
2333
2339
  : (unref(searchText))
2334
2340
  ? (openBlock(), createElementBlock("li", _hoisted_9$8, " No results found "))
2335
2341
  : (openBlock(), createElementBlock("li", _hoisted_10$8, " Type to search... "))
2336
- ], 8 /* PROPS */, _hoisted_7$9)
2342
+ ], 10 /* CLASS, PROPS */, _hoisted_7$9)
2337
2343
  ]))
2338
2344
  : createCommentVNode("v-if", true)
2339
2345
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",