@iankibetsh/shframework 4.0.9 → 4.1.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.
@@ -63,21 +63,6 @@
63
63
  color: white;
64
64
  }
65
65
 
66
- .sh-selected-item{
67
- line-height: unset!important;
68
- }
69
- .sh-suggestion-input{
70
- padding: 0.375rem 0.75rem;
71
- }
72
- .sh-suggest{
73
- margin-bottom: 1rem;
74
- }
75
- .sh-suggest-control::after{
76
- margin-top: auto;
77
- margin-bottom: auto;
78
- margin-right: 0.255em;
79
- }
80
-
81
66
  .permissions-main {
82
67
  background: #edeff2;
83
68
  }
@@ -110,6 +95,21 @@
110
95
  flex-grow: 1;
111
96
  }
112
97
 
98
+ .sh-selected-item{
99
+ line-height: unset!important;
100
+ }
101
+ .sh-suggestion-input{
102
+ padding: 0.375rem 0.75rem;
103
+ }
104
+ .sh-suggest{
105
+ margin-bottom: 1rem;
106
+ }
107
+ .sh-suggest-control::after{
108
+ margin-top: auto;
109
+ margin-bottom: auto;
110
+ margin-right: 0.255em;
111
+ }
112
+
113
113
  .sh-forgot-link, .sh-register-link{
114
114
  cursor: pointer;
115
115
  }
package/dist/library.js CHANGED
@@ -4328,7 +4328,7 @@ script$c.__file = "src/lib/components/ShRange.vue";
4328
4328
 
4329
4329
  var script$b = {
4330
4330
  name: 'sh-table',
4331
- props: ['endPoint', 'headers', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange'],
4331
+ props: ['endPoint', 'headers','cacheKey', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange'],
4332
4332
  data() {
4333
4333
  return {
4334
4334
  order_by: '',
@@ -4361,6 +4361,7 @@ var script$b = {
4361
4361
  if (this.headers) {
4362
4362
  this.tableHeaders = this.headers;
4363
4363
  }
4364
+
4364
4365
  if (this.actions && this.actions.actions) {
4365
4366
  this.actions.actions.forEach(action => {
4366
4367
  if (action.canvasComponent) {
@@ -4368,6 +4369,10 @@ var script$b = {
4368
4369
  }
4369
4370
  });
4370
4371
  }
4372
+ if(this.cacheKey){
4373
+ this.setCachedData();
4374
+ }
4375
+ this.reloadData();
4371
4376
  },
4372
4377
  methods: {
4373
4378
  rangeChanged: function (newRange) {
@@ -4514,11 +4519,18 @@ var script$b = {
4514
4519
  shRepo.swalError('Error', error);
4515
4520
  });
4516
4521
  },
4522
+ setCachedData: function () {
4523
+ if (this.cacheKey) {
4524
+ this.records = ShStorage.getItem('sh_table_cache_' + this.cacheKey, []);
4525
+ }
4526
+ },
4517
4527
  reloadData: function (page, append) {
4518
4528
  if (typeof page !== 'undefined') {
4519
4529
  this.page = page;
4520
4530
  }
4521
- if (!append) {
4531
+ if (this.cacheKey && this.records && this.records.length > 0 && this.page < 2 ) {
4532
+ this.loading = 'done';
4533
+ } else if(!append){
4522
4534
  this.loading = 'loading';
4523
4535
  }
4524
4536
  const data = {
@@ -4546,6 +4558,9 @@ var script$b = {
4546
4558
  this.$emit('dataReloaded', this.pagination_data);
4547
4559
  this.loading = 'done';
4548
4560
  const response = req.data.data;
4561
+ if(this.page < 2 && this.cacheKey){
4562
+ ShStorage.setItem('sh_table_cache_' + this.cacheKey, response.data);
4563
+ }
4549
4564
  this.pagination_data = {
4550
4565
  current: response.current_page,
4551
4566
  start: response.from,
@@ -4591,9 +4606,6 @@ var script$b = {
4591
4606
  this.reloadData();
4592
4607
  }
4593
4608
  },
4594
- created() {
4595
- this.reloadData();
4596
- },
4597
4609
  components: {
4598
4610
  ShRange: script$c,
4599
4611
  ShSilentAction: script$d,
package/dist/library.mjs CHANGED
@@ -4316,7 +4316,7 @@ script$c.__file = "src/lib/components/ShRange.vue";
4316
4316
 
4317
4317
  var script$b = {
4318
4318
  name: 'sh-table',
4319
- props: ['endPoint', 'headers', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange'],
4319
+ props: ['endPoint', 'headers','cacheKey', 'query', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds', 'paginationStyle', 'hasRange'],
4320
4320
  data() {
4321
4321
  return {
4322
4322
  order_by: '',
@@ -4349,6 +4349,7 @@ var script$b = {
4349
4349
  if (this.headers) {
4350
4350
  this.tableHeaders = this.headers;
4351
4351
  }
4352
+
4352
4353
  if (this.actions && this.actions.actions) {
4353
4354
  this.actions.actions.forEach(action => {
4354
4355
  if (action.canvasComponent) {
@@ -4356,6 +4357,10 @@ var script$b = {
4356
4357
  }
4357
4358
  });
4358
4359
  }
4360
+ if(this.cacheKey){
4361
+ this.setCachedData();
4362
+ }
4363
+ this.reloadData();
4359
4364
  },
4360
4365
  methods: {
4361
4366
  rangeChanged: function (newRange) {
@@ -4502,11 +4507,18 @@ var script$b = {
4502
4507
  shRepo.swalError('Error', error);
4503
4508
  });
4504
4509
  },
4510
+ setCachedData: function () {
4511
+ if (this.cacheKey) {
4512
+ this.records = ShStorage.getItem('sh_table_cache_' + this.cacheKey, []);
4513
+ }
4514
+ },
4505
4515
  reloadData: function (page, append) {
4506
4516
  if (typeof page !== 'undefined') {
4507
4517
  this.page = page;
4508
4518
  }
4509
- if (!append) {
4519
+ if (this.cacheKey && this.records && this.records.length > 0 && this.page < 2 ) {
4520
+ this.loading = 'done';
4521
+ } else if(!append){
4510
4522
  this.loading = 'loading';
4511
4523
  }
4512
4524
  const data = {
@@ -4534,6 +4546,9 @@ var script$b = {
4534
4546
  this.$emit('dataReloaded', this.pagination_data);
4535
4547
  this.loading = 'done';
4536
4548
  const response = req.data.data;
4549
+ if(this.page < 2 && this.cacheKey){
4550
+ ShStorage.setItem('sh_table_cache_' + this.cacheKey, response.data);
4551
+ }
4537
4552
  this.pagination_data = {
4538
4553
  current: response.current_page,
4539
4554
  start: response.from,
@@ -4579,9 +4594,6 @@ var script$b = {
4579
4594
  this.reloadData();
4580
4595
  }
4581
4596
  },
4582
- created() {
4583
- this.reloadData();
4584
- },
4585
4597
  components: {
4586
4598
  ShRange: script$c,
4587
4599
  ShSilentAction: script$d,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "4.0.9",
3
+ "version": "4.1.1",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",