@iankibetsh/shframework 5.0.2 → 5.0.4

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
+ console.log(searchText.value);
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 {
@@ -2216,12 +2221,14 @@ function filterData(e){
2216
2221
  searchText.value = filterValue;
2217
2222
  if (props.url) {
2218
2223
  fetchRemoteData();
2224
+ updateModelValue();
2219
2225
  } else if(props.data) {
2220
2226
  suggestions.value = props.data.filter(item=>{
2221
2227
  if(item.name.toLowerCase().includes(filterValue.toLowerCase())){
2222
2228
  return item
2223
2229
  }
2224
2230
  });
2231
+ updateModelValue();
2225
2232
  } else {
2226
2233
  console.log("Error: no data or url provided");
2227
2234
  }
@@ -2313,7 +2320,7 @@ return (_ctx, _cache) => {
2313
2320
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_6$a)
2314
2321
  ], 8 /* PROPS */, _hoisted_2$h),
2315
2322
  vue.createElementVNode("ul", {
2316
- class: "dropdown-menu w-100",
2323
+ class: vue.normalizeClass([(!vue.unref(suggestions) || vue.unref(suggestions).length === 0) ? 'no-sh-suggestions':'sh-found-suggestions', "dropdown-menu w-100"]),
2317
2324
  id: 'dropwdown_section' + vue.unref(id),
2318
2325
  "aria-labelledby": vue.unref(id)
2319
2326
  }, [
@@ -2345,7 +2352,7 @@ return (_ctx, _cache) => {
2345
2352
  : (vue.unref(searchText))
2346
2353
  ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_9$8, " No results found "))
2347
2354
  : (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$8, " Type to search... "))
2348
- ], 8 /* PROPS */, _hoisted_7$9)
2355
+ ], 10 /* CLASS, PROPS */, _hoisted_7$9)
2349
2356
  ]))
2350
2357
  : vue.createCommentVNode("v-if", true)
2351
2358
  }
@@ -4478,7 +4485,7 @@ return (_ctx, _cache) => {
4478
4485
  onActionFailed: _cache[4] || (_cache[4] = $event => (doEmitAction('actionFailed',__props.record))),
4479
4486
  onActionCanceled: _cache[5] || (_cache[5] = $event => (doEmitAction('actionCanceled',__props.record))),
4480
4487
  "loading-message": __props.action.label,
4481
- class: vue.normalizeClass(__props.action.class + __props.actionClass),
4488
+ class: vue.normalizeClass(__props.action.class +' '+ __props.actionClass),
4482
4489
  url: url.value
4483
4490
  }, {
4484
4491
  default: vue.withCtx(() => [
@@ -4497,7 +4504,7 @@ return (_ctx, _cache) => {
4497
4504
  key: 2,
4498
4505
  href: '#' + __props.action.canvasId,
4499
4506
  "data-bs-toggle": "offcanvas",
4500
- class: vue.normalizeClass(__props.action.class + __props.actionClass)
4507
+ class: vue.normalizeClass(__props.action.class + ' ' + __props.actionClass)
4501
4508
  }, [
4502
4509
  (__props.action.icon)
4503
4510
  ? (vue.openBlock(), vue.createElementBlock("span", {
@@ -4511,7 +4518,7 @@ return (_ctx, _cache) => {
4511
4518
  ? (vue.openBlock(), vue.createElementBlock("button", {
4512
4519
  key: 3,
4513
4520
  title: __props.action.title,
4514
- class: vue.normalizeClass(__props.action.class ? __props.action.class:'btn btn-default' + __props.actionClass),
4521
+ class: vue.normalizeClass(__props.action.class ? __props.action.class:'btn btn-default ' + __props.actionClass),
4515
4522
  onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
4516
4523
  }, [
4517
4524
  (__props.action.icon)
@@ -4527,7 +4534,7 @@ return (_ctx, _cache) => {
4527
4534
  key: 4,
4528
4535
  title: __props.action.title,
4529
4536
  to: url.value,
4530
- class: vue.normalizeClass(__props.action.class + __props.actionClass)
4537
+ class: vue.normalizeClass(__props.action.class +' '+ __props.actionClass)
4531
4538
  }, {
4532
4539
  default: vue.withCtx(() => [
4533
4540
  (__props.action.icon)
@@ -4615,6 +4622,7 @@ return (_ctx, _cache) => {
4615
4622
  ]))
4616
4623
  : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(actionItems), (act) => {
4617
4624
  return (vue.openBlock(), vue.createBlock(script$h, {
4625
+ "action-class": " ",
4618
4626
  key: act.label,
4619
4627
  "emit-action": __props.emitAction,
4620
4628
  action: act,
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
+ console.log(searchText.value);
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 {
@@ -2204,12 +2209,14 @@ function filterData(e){
2204
2209
  searchText.value = filterValue;
2205
2210
  if (props.url) {
2206
2211
  fetchRemoteData();
2212
+ updateModelValue();
2207
2213
  } else if(props.data) {
2208
2214
  suggestions.value = props.data.filter(item=>{
2209
2215
  if(item.name.toLowerCase().includes(filterValue.toLowerCase())){
2210
2216
  return item
2211
2217
  }
2212
2218
  });
2219
+ updateModelValue();
2213
2220
  } else {
2214
2221
  console.log("Error: no data or url provided");
2215
2222
  }
@@ -2301,7 +2308,7 @@ return (_ctx, _cache) => {
2301
2308
  }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_6$a)
2302
2309
  ], 8 /* PROPS */, _hoisted_2$h),
2303
2310
  createElementVNode("ul", {
2304
- class: "dropdown-menu w-100",
2311
+ class: normalizeClass([(!unref(suggestions) || unref(suggestions).length === 0) ? 'no-sh-suggestions':'sh-found-suggestions', "dropdown-menu w-100"]),
2305
2312
  id: 'dropwdown_section' + unref(id),
2306
2313
  "aria-labelledby": unref(id)
2307
2314
  }, [
@@ -2333,7 +2340,7 @@ return (_ctx, _cache) => {
2333
2340
  : (unref(searchText))
2334
2341
  ? (openBlock(), createElementBlock("li", _hoisted_9$8, " No results found "))
2335
2342
  : (openBlock(), createElementBlock("li", _hoisted_10$8, " Type to search... "))
2336
- ], 8 /* PROPS */, _hoisted_7$9)
2343
+ ], 10 /* CLASS, PROPS */, _hoisted_7$9)
2337
2344
  ]))
2338
2345
  : createCommentVNode("v-if", true)
2339
2346
  }
@@ -4466,7 +4473,7 @@ return (_ctx, _cache) => {
4466
4473
  onActionFailed: _cache[4] || (_cache[4] = $event => (doEmitAction('actionFailed',__props.record))),
4467
4474
  onActionCanceled: _cache[5] || (_cache[5] = $event => (doEmitAction('actionCanceled',__props.record))),
4468
4475
  "loading-message": __props.action.label,
4469
- class: normalizeClass(__props.action.class + __props.actionClass),
4476
+ class: normalizeClass(__props.action.class +' '+ __props.actionClass),
4470
4477
  url: url.value
4471
4478
  }, {
4472
4479
  default: withCtx(() => [
@@ -4485,7 +4492,7 @@ return (_ctx, _cache) => {
4485
4492
  key: 2,
4486
4493
  href: '#' + __props.action.canvasId,
4487
4494
  "data-bs-toggle": "offcanvas",
4488
- class: normalizeClass(__props.action.class + __props.actionClass)
4495
+ class: normalizeClass(__props.action.class + ' ' + __props.actionClass)
4489
4496
  }, [
4490
4497
  (__props.action.icon)
4491
4498
  ? (openBlock(), createElementBlock("span", {
@@ -4499,7 +4506,7 @@ return (_ctx, _cache) => {
4499
4506
  ? (openBlock(), createElementBlock("button", {
4500
4507
  key: 3,
4501
4508
  title: __props.action.title,
4502
- class: normalizeClass(__props.action.class ? __props.action.class:'btn btn-default' + __props.actionClass),
4509
+ class: normalizeClass(__props.action.class ? __props.action.class:'btn btn-default ' + __props.actionClass),
4503
4510
  onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
4504
4511
  }, [
4505
4512
  (__props.action.icon)
@@ -4515,7 +4522,7 @@ return (_ctx, _cache) => {
4515
4522
  key: 4,
4516
4523
  title: __props.action.title,
4517
4524
  to: url.value,
4518
- class: normalizeClass(__props.action.class + __props.actionClass)
4525
+ class: normalizeClass(__props.action.class +' '+ __props.actionClass)
4519
4526
  }, {
4520
4527
  default: withCtx(() => [
4521
4528
  (__props.action.icon)
@@ -4603,6 +4610,7 @@ return (_ctx, _cache) => {
4603
4610
  ]))
4604
4611
  : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(actionItems), (act) => {
4605
4612
  return (openBlock(), createBlock(script$h, {
4613
+ "action-class": " ",
4606
4614
  key: act.label,
4607
4615
  "emit-action": __props.emitAction,
4608
4616
  action: act,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",