@iankibetsh/shframework 3.0.8 → 4.0.1

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
@@ -2094,18 +2094,20 @@ function filterData(e){
2094
2094
  }
2095
2095
  let filterValue = e.target.innerText;
2096
2096
  searchText.value = filterValue;
2097
- if(props.data) {
2097
+ if (props.url) {
2098
+ shApis.doGet(props.url, { all: 1,filter_value: filterValue }).then(res => {
2099
+ suggestions.value = res.data.data ?? res.data;
2100
+ }).catch(res => {
2101
+ console.log(res);
2102
+ });
2103
+ } else if(props.data) {
2098
2104
  suggestions.value = props.data.filter(item=>{
2099
2105
  if(item.name.toLowerCase().includes(filterValue.toLowerCase())){
2100
2106
  return item
2101
2107
  }
2102
2108
  });
2103
- } else if (props.url) {
2104
- shApis.doGet(props.url, { all: 1,filter_value: filterValue }).then(res => {
2105
- suggestions.value = res.data.data ?? res.data;
2106
- }).catch(res => {
2107
- console.log(res);
2108
- });
2109
+ } else {
2110
+ console.log("Error: no data or url provided");
2109
2111
  }
2110
2112
  }
2111
2113
 
@@ -2136,6 +2138,7 @@ return (_ctx, _cache) => {
2136
2138
  contenteditable: "true",
2137
2139
  onClick: filterData,
2138
2140
  onInput: filterData,
2141
+ onChange: filterData,
2139
2142
  class: "flex-fill h-100 sh-suggestion-input"
2140
2143
  }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$9)
2141
2144
  ], 8 /* PROPS */, _hoisted_2$d),
@@ -2243,7 +2246,8 @@ var script$s = {
2243
2246
  if(this.customComponent && this.customComponent[field]){
2244
2247
  return 'component'
2245
2248
  }
2246
- if(this.suggests && this.suggests.includes(field)){
2249
+ if(this.suggests && this.suggests[field]){
2250
+ // alert('found')
2247
2251
  return 'suggest'
2248
2252
  }
2249
2253
  if(this.editors && this.editors.includes(field)){
@@ -2471,7 +2475,7 @@ var script$s = {
2471
2475
  if (!this.suggests) {
2472
2476
  this.suggests = [];
2473
2477
  }
2474
- this.suggests.push(key);
2478
+ this.suggests[key] = this.fillSelects[key];
2475
2479
  } else if (this.fillSelects[key].data) {
2476
2480
  this.selectData[key] = this.fillSelects[key].data;
2477
2481
  } else {
@@ -2692,8 +2696,10 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2692
2696
  "fill-selects": $props.fillSelects[field],
2693
2697
  class: vue.normalizeClass(_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field),
2694
2698
  modelValue: _ctx.form_elements[field],
2695
- "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2696
- }, null, 8 /* PROPS */, ["select-data", "fill-selects", "class", "modelValue", "onUpdate:modelValue"]))
2699
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2700
+ url: _ctx.suggests[field].url ?? false,
2701
+ data: _ctx.suggests[field].data ?? false
2702
+ }, null, 8 /* PROPS */, ["select-data", "fill-selects", "class", "modelValue", "onUpdate:modelValue", "url", "data"]))
2697
2703
  : vue.createCommentVNode("v-if", true),
2698
2704
  ($options.getFieldType(field) === 'text')
2699
2705
  ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
@@ -4305,7 +4311,7 @@ var script$b = {
4305
4311
  return {
4306
4312
  order_by: '',
4307
4313
  order_method: '',
4308
- per_page: shRepo.getShConfig('tablePerPage', 10),
4314
+ per_page: this.pageCount ?? shRepo.getShConfig('tablePerPage', 10),
4309
4315
  page: 1,
4310
4316
  exactMatch: false,
4311
4317
  filter_value: '',
package/dist/library.mjs CHANGED
@@ -2082,18 +2082,20 @@ function filterData(e){
2082
2082
  }
2083
2083
  let filterValue = e.target.innerText;
2084
2084
  searchText.value = filterValue;
2085
- if(props.data) {
2085
+ if (props.url) {
2086
+ shApis.doGet(props.url, { all: 1,filter_value: filterValue }).then(res => {
2087
+ suggestions.value = res.data.data ?? res.data;
2088
+ }).catch(res => {
2089
+ console.log(res);
2090
+ });
2091
+ } else if(props.data) {
2086
2092
  suggestions.value = props.data.filter(item=>{
2087
2093
  if(item.name.toLowerCase().includes(filterValue.toLowerCase())){
2088
2094
  return item
2089
2095
  }
2090
2096
  });
2091
- } else if (props.url) {
2092
- shApis.doGet(props.url, { all: 1,filter_value: filterValue }).then(res => {
2093
- suggestions.value = res.data.data ?? res.data;
2094
- }).catch(res => {
2095
- console.log(res);
2096
- });
2097
+ } else {
2098
+ console.log("Error: no data or url provided");
2097
2099
  }
2098
2100
  }
2099
2101
 
@@ -2124,6 +2126,7 @@ return (_ctx, _cache) => {
2124
2126
  contenteditable: "true",
2125
2127
  onClick: filterData,
2126
2128
  onInput: filterData,
2129
+ onChange: filterData,
2127
2130
  class: "flex-fill h-100 sh-suggestion-input"
2128
2131
  }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$9)
2129
2132
  ], 8 /* PROPS */, _hoisted_2$d),
@@ -2231,7 +2234,8 @@ var script$s = {
2231
2234
  if(this.customComponent && this.customComponent[field]){
2232
2235
  return 'component'
2233
2236
  }
2234
- if(this.suggests && this.suggests.includes(field)){
2237
+ if(this.suggests && this.suggests[field]){
2238
+ // alert('found')
2235
2239
  return 'suggest'
2236
2240
  }
2237
2241
  if(this.editors && this.editors.includes(field)){
@@ -2459,7 +2463,7 @@ var script$s = {
2459
2463
  if (!this.suggests) {
2460
2464
  this.suggests = [];
2461
2465
  }
2462
- this.suggests.push(key);
2466
+ this.suggests[key] = this.fillSelects[key];
2463
2467
  } else if (this.fillSelects[key].data) {
2464
2468
  this.selectData[key] = this.fillSelects[key].data;
2465
2469
  } else {
@@ -2680,8 +2684,10 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2680
2684
  "fill-selects": $props.fillSelects[field],
2681
2685
  class: normalizeClass(_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field),
2682
2686
  modelValue: _ctx.form_elements[field],
2683
- "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
2684
- }, null, 8 /* PROPS */, ["select-data", "fill-selects", "class", "modelValue", "onUpdate:modelValue"]))
2687
+ "onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
2688
+ url: _ctx.suggests[field].url ?? false,
2689
+ data: _ctx.suggests[field].data ?? false
2690
+ }, null, 8 /* PROPS */, ["select-data", "fill-selects", "class", "modelValue", "onUpdate:modelValue", "url", "data"]))
2685
2691
  : createCommentVNode("v-if", true),
2686
2692
  ($options.getFieldType(field) === 'text')
2687
2693
  ? withDirectives((openBlock(), createElementBlock("input", {
@@ -4293,7 +4299,7 @@ var script$b = {
4293
4299
  return {
4294
4300
  order_by: '',
4295
4301
  order_method: '',
4296
- per_page: shRepo.getShConfig('tablePerPage', 10),
4302
+ per_page: this.pageCount ?? shRepo.getShConfig('tablePerPage', 10),
4297
4303
  page: 1,
4298
4304
  exactMatch: false,
4299
4305
  filter_value: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "3.0.8",
3
+ "version": "4.0.1",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",