@iankibetsh/shframework 5.8.0 → 5.8.3
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/README.md +1 -0
- package/dist/dist/library.mjs.css +32 -32
- package/dist/library.js +630 -500
- package/dist/library.mjs +630 -500
- package/package.json +1 -1
package/dist/library.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import { Modal, Offcanvas } from 'bootstrap';
|
|
|
5
5
|
import NProgress from 'nprogress';
|
|
6
6
|
import { ref, computed, watch, onMounted, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, unref, vModelSelect, vModelText, normalizeClass, createBlock, resolveDynamicComponent, resolveComponent, inject, useTemplateRef, mergeProps, vShow, renderSlot, normalizeStyle, Teleport, createVNode, withCtx, useSlots, onBeforeUnmount, reactive, vModelCheckbox, withModifiers, resolveDirective, shallowRef, markRaw, isRef } from 'vue';
|
|
7
7
|
import _ from 'lodash';
|
|
8
|
-
import { defineStore, storeToRefs } from 'pinia';
|
|
9
8
|
import { useRoute, useRouter } from 'vue-router';
|
|
9
|
+
import { defineStore, storeToRefs } from 'pinia';
|
|
10
10
|
|
|
11
11
|
function setItem (key, value) {
|
|
12
12
|
let toStore = value;
|
|
@@ -4483,6 +4483,108 @@ return (_ctx, _cache) => {
|
|
|
4483
4483
|
|
|
4484
4484
|
script$l.__file = "src/lib/components/ShCanvas.vue";
|
|
4485
4485
|
|
|
4486
|
+
const useUserStore = defineStore('user-store', {
|
|
4487
|
+
state: () => ({
|
|
4488
|
+
user: null,
|
|
4489
|
+
role: null,
|
|
4490
|
+
permissions: null,
|
|
4491
|
+
menus: [],
|
|
4492
|
+
loggedOut: false
|
|
4493
|
+
}),
|
|
4494
|
+
actions: {
|
|
4495
|
+
setUser (defaultEndpoint) {
|
|
4496
|
+
let user = null;
|
|
4497
|
+
try {
|
|
4498
|
+
user = shStorage.getItem('user') ? shStorage.getItem('user') : null;
|
|
4499
|
+
} catch (error) {
|
|
4500
|
+
user= null;
|
|
4501
|
+
}
|
|
4502
|
+
if(typeof user !== 'object'){
|
|
4503
|
+
user = null;
|
|
4504
|
+
}
|
|
4505
|
+
if (user ) {
|
|
4506
|
+
user.isAllowedTo = function (slug) {
|
|
4507
|
+
if (this.permissions) {
|
|
4508
|
+
let permissions = [];
|
|
4509
|
+
if (typeof this.permissions === 'string') {
|
|
4510
|
+
permissions = this.permissions;
|
|
4511
|
+
} else {
|
|
4512
|
+
permissions = this.permissions;
|
|
4513
|
+
}
|
|
4514
|
+
return permissions.includes(slug)
|
|
4515
|
+
}
|
|
4516
|
+
return false
|
|
4517
|
+
};
|
|
4518
|
+
}
|
|
4519
|
+
this.user = user;
|
|
4520
|
+
const userEndpoint = defaultEndpoint ?? inject('userEndpoint','auth/user') ?? 'auth/user?defaults=1';
|
|
4521
|
+
|
|
4522
|
+
shApis.doGet(userEndpoint).then(res => {
|
|
4523
|
+
let user = res.data.user;
|
|
4524
|
+
if (typeof(user) === 'undefined') {
|
|
4525
|
+
user = res.data;
|
|
4526
|
+
}
|
|
4527
|
+
shStorage.setItem('user',user);
|
|
4528
|
+
user.signOut = this.signOut;
|
|
4529
|
+
user.logout = this.signOut;
|
|
4530
|
+
user.logOut = this.signOut;
|
|
4531
|
+
user.isAllowedTo = function (slug) {
|
|
4532
|
+
if(!slug){
|
|
4533
|
+
return true
|
|
4534
|
+
}
|
|
4535
|
+
if (this.permissions) {
|
|
4536
|
+
let permissions = [];
|
|
4537
|
+
if (typeof this.permissions === 'string') {
|
|
4538
|
+
permissions = this.permissions;
|
|
4539
|
+
} else {
|
|
4540
|
+
permissions = this.permissions;
|
|
4541
|
+
}
|
|
4542
|
+
return permissions.includes(slug)
|
|
4543
|
+
}
|
|
4544
|
+
return false
|
|
4545
|
+
};
|
|
4546
|
+
user.can = user.isAllowedTo;
|
|
4547
|
+
this.user = user;
|
|
4548
|
+
}).catch((reason) => {
|
|
4549
|
+
if (reason.response && reason.response.status) {
|
|
4550
|
+
if(reason.response.status === 401) {
|
|
4551
|
+
shStorage.setItem('user',null);
|
|
4552
|
+
this.user = null;
|
|
4553
|
+
}
|
|
4554
|
+
this.loggedOut = true;
|
|
4555
|
+
}
|
|
4556
|
+
});
|
|
4557
|
+
if (this.user) {
|
|
4558
|
+
if (typeof this.user.permissions === 'string') {
|
|
4559
|
+
this.permissions = this.user.permissions;
|
|
4560
|
+
} else {
|
|
4561
|
+
this.permissions = this.user.permissions;
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
const timeNow = DateTime.now().toISO();
|
|
4565
|
+
shStorage.setItem('session_start',timeNow);
|
|
4566
|
+
},
|
|
4567
|
+
signOut () {
|
|
4568
|
+
shRepo.signOutUser();
|
|
4569
|
+
},
|
|
4570
|
+
logOut () {
|
|
4571
|
+
this.signOut();
|
|
4572
|
+
},
|
|
4573
|
+
getUser () {
|
|
4574
|
+
this.setUser();
|
|
4575
|
+
},
|
|
4576
|
+
setAccessToken (accessToken) {
|
|
4577
|
+
shStorage.setItem('access_token', accessToken);
|
|
4578
|
+
this.setUser();
|
|
4579
|
+
}
|
|
4580
|
+
},
|
|
4581
|
+
getters: {
|
|
4582
|
+
userId (state) {
|
|
4583
|
+
return state.user === null ? null:state.user.id
|
|
4584
|
+
}
|
|
4585
|
+
}
|
|
4586
|
+
});
|
|
4587
|
+
|
|
4486
4588
|
const _hoisted_1$g = { class: "callout callout-info" };
|
|
4487
4589
|
|
|
4488
4590
|
function render$2(_ctx, _cache) {
|
|
@@ -4691,108 +4793,6 @@ return (_ctx, _cache) => {
|
|
|
4691
4793
|
|
|
4692
4794
|
script$i.__file = "src/lib/components/ShSilentAction.vue";
|
|
4693
4795
|
|
|
4694
|
-
const useUserStore = defineStore('user-store', {
|
|
4695
|
-
state: () => ({
|
|
4696
|
-
user: null,
|
|
4697
|
-
role: null,
|
|
4698
|
-
permissions: null,
|
|
4699
|
-
menus: [],
|
|
4700
|
-
loggedOut: false
|
|
4701
|
-
}),
|
|
4702
|
-
actions: {
|
|
4703
|
-
setUser (defaultEndpoint) {
|
|
4704
|
-
let user = null;
|
|
4705
|
-
try {
|
|
4706
|
-
user = shStorage.getItem('user') ? shStorage.getItem('user') : null;
|
|
4707
|
-
} catch (error) {
|
|
4708
|
-
user= null;
|
|
4709
|
-
}
|
|
4710
|
-
if(typeof user !== 'object'){
|
|
4711
|
-
user = null;
|
|
4712
|
-
}
|
|
4713
|
-
if (user ) {
|
|
4714
|
-
user.isAllowedTo = function (slug) {
|
|
4715
|
-
if (this.permissions) {
|
|
4716
|
-
let permissions = [];
|
|
4717
|
-
if (typeof this.permissions === 'string') {
|
|
4718
|
-
permissions = this.permissions;
|
|
4719
|
-
} else {
|
|
4720
|
-
permissions = this.permissions;
|
|
4721
|
-
}
|
|
4722
|
-
return permissions.includes(slug)
|
|
4723
|
-
}
|
|
4724
|
-
return false
|
|
4725
|
-
};
|
|
4726
|
-
}
|
|
4727
|
-
this.user = user;
|
|
4728
|
-
const userEndpoint = defaultEndpoint ?? inject('userEndpoint','auth/user') ?? 'auth/user?defaults=1';
|
|
4729
|
-
|
|
4730
|
-
shApis.doGet(userEndpoint).then(res => {
|
|
4731
|
-
let user = res.data.user;
|
|
4732
|
-
if (typeof(user) === 'undefined') {
|
|
4733
|
-
user = res.data;
|
|
4734
|
-
}
|
|
4735
|
-
shStorage.setItem('user',user);
|
|
4736
|
-
user.signOut = this.signOut;
|
|
4737
|
-
user.logout = this.signOut;
|
|
4738
|
-
user.logOut = this.signOut;
|
|
4739
|
-
user.isAllowedTo = function (slug) {
|
|
4740
|
-
if(!slug){
|
|
4741
|
-
return true
|
|
4742
|
-
}
|
|
4743
|
-
if (this.permissions) {
|
|
4744
|
-
let permissions = [];
|
|
4745
|
-
if (typeof this.permissions === 'string') {
|
|
4746
|
-
permissions = this.permissions;
|
|
4747
|
-
} else {
|
|
4748
|
-
permissions = this.permissions;
|
|
4749
|
-
}
|
|
4750
|
-
return permissions.includes(slug)
|
|
4751
|
-
}
|
|
4752
|
-
return false
|
|
4753
|
-
};
|
|
4754
|
-
user.can = user.isAllowedTo;
|
|
4755
|
-
this.user = user;
|
|
4756
|
-
}).catch((reason) => {
|
|
4757
|
-
if (reason.response && reason.response.status) {
|
|
4758
|
-
if(reason.response.status === 401) {
|
|
4759
|
-
shStorage.setItem('user',null);
|
|
4760
|
-
this.user = null;
|
|
4761
|
-
}
|
|
4762
|
-
this.loggedOut = true;
|
|
4763
|
-
}
|
|
4764
|
-
});
|
|
4765
|
-
if (this.user) {
|
|
4766
|
-
if (typeof this.user.permissions === 'string') {
|
|
4767
|
-
this.permissions = this.user.permissions;
|
|
4768
|
-
} else {
|
|
4769
|
-
this.permissions = this.user.permissions;
|
|
4770
|
-
}
|
|
4771
|
-
}
|
|
4772
|
-
const timeNow = DateTime.now().toISO();
|
|
4773
|
-
shStorage.setItem('session_start',timeNow);
|
|
4774
|
-
},
|
|
4775
|
-
signOut () {
|
|
4776
|
-
shRepo.signOutUser();
|
|
4777
|
-
},
|
|
4778
|
-
logOut () {
|
|
4779
|
-
this.signOut();
|
|
4780
|
-
},
|
|
4781
|
-
getUser () {
|
|
4782
|
-
this.setUser();
|
|
4783
|
-
},
|
|
4784
|
-
setAccessToken (accessToken) {
|
|
4785
|
-
shStorage.setItem('access_token', accessToken);
|
|
4786
|
-
this.setUser();
|
|
4787
|
-
}
|
|
4788
|
-
},
|
|
4789
|
-
getters: {
|
|
4790
|
-
userId (state) {
|
|
4791
|
-
return state.user === null ? null:state.user.id
|
|
4792
|
-
}
|
|
4793
|
-
}
|
|
4794
|
-
});
|
|
4795
|
-
|
|
4796
4796
|
const _hoisted_1$f = ["href"];
|
|
4797
4797
|
const _hoisted_2$c = ["title"];
|
|
4798
4798
|
|
|
@@ -5482,112 +5482,125 @@ const _hoisted_10$2 = {
|
|
|
5482
5482
|
class: "alert alert-danger"
|
|
5483
5483
|
};
|
|
5484
5484
|
const _hoisted_11$1 = {
|
|
5485
|
+
key: 1,
|
|
5486
|
+
class: "text-center bg-primary-light px-2 py-1 rounded no_records_div"
|
|
5487
|
+
};
|
|
5488
|
+
const _hoisted_12$1 = {
|
|
5485
5489
|
key: 0,
|
|
5486
5490
|
class: "text-center"
|
|
5487
5491
|
};
|
|
5488
|
-
const
|
|
5492
|
+
const _hoisted_13$1 = {
|
|
5489
5493
|
key: 1,
|
|
5490
5494
|
class: "alert alert-danger error-loading"
|
|
5491
5495
|
};
|
|
5492
|
-
const
|
|
5493
|
-
const
|
|
5496
|
+
const _hoisted_14$1 = { class: "sh-thead" };
|
|
5497
|
+
const _hoisted_15$1 = {
|
|
5494
5498
|
key: 0,
|
|
5495
5499
|
style: {"width":"40px"}
|
|
5496
5500
|
};
|
|
5497
|
-
const
|
|
5498
|
-
const _hoisted_16 = ["onClick"];
|
|
5501
|
+
const _hoisted_16 = { key: 0 };
|
|
5499
5502
|
const _hoisted_17 = ["onClick"];
|
|
5500
5503
|
const _hoisted_18 = ["onClick"];
|
|
5501
5504
|
const _hoisted_19 = ["onClick"];
|
|
5502
|
-
const _hoisted_20 =
|
|
5505
|
+
const _hoisted_20 = ["onClick"];
|
|
5506
|
+
const _hoisted_21 = {
|
|
5503
5507
|
key: 1,
|
|
5504
5508
|
class: "text-capitalize"
|
|
5505
5509
|
};
|
|
5506
|
-
const
|
|
5507
|
-
const
|
|
5510
|
+
const _hoisted_22 = { class: "sh-tbody" };
|
|
5511
|
+
const _hoisted_23 = {
|
|
5508
5512
|
key: 0,
|
|
5509
5513
|
class: "text-center"
|
|
5510
5514
|
};
|
|
5511
|
-
const
|
|
5512
|
-
const
|
|
5515
|
+
const _hoisted_24 = ["colspan"];
|
|
5516
|
+
const _hoisted_25 = {
|
|
5513
5517
|
key: 1,
|
|
5514
5518
|
class: "text-center alert alert-danger"
|
|
5515
5519
|
};
|
|
5516
|
-
const
|
|
5517
|
-
const
|
|
5520
|
+
const _hoisted_26 = ["colspan"];
|
|
5521
|
+
const _hoisted_27 = {
|
|
5518
5522
|
key: 2,
|
|
5519
5523
|
class: "no_records"
|
|
5520
5524
|
};
|
|
5521
|
-
const
|
|
5522
|
-
const
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
const
|
|
5525
|
+
const _hoisted_28 = ["colspan"];
|
|
5526
|
+
const _hoisted_29 = {
|
|
5527
|
+
key: 1,
|
|
5528
|
+
class: "text-center bg-primary-light px-2 py-1 rounded no_records_div"
|
|
5529
|
+
};
|
|
5530
|
+
const _hoisted_30 = ["onClick"];
|
|
5531
|
+
const _hoisted_31 = ["value", "checked", "onChange"];
|
|
5532
|
+
const _hoisted_32 = { key: 0 };
|
|
5533
|
+
const _hoisted_33 = { key: 1 };
|
|
5534
|
+
const _hoisted_34 = {
|
|
5527
5535
|
key: 2,
|
|
5528
5536
|
class: "text-success fw-bold"
|
|
5529
5537
|
};
|
|
5530
|
-
const
|
|
5531
|
-
const _hoisted_34 = ["innerHTML"];
|
|
5532
|
-
const _hoisted_35 = ["innerHTML"];
|
|
5538
|
+
const _hoisted_35 = { key: 3 };
|
|
5533
5539
|
const _hoisted_36 = ["innerHTML"];
|
|
5534
5540
|
const _hoisted_37 = ["innerHTML"];
|
|
5535
5541
|
const _hoisted_38 = ["innerHTML"];
|
|
5536
5542
|
const _hoisted_39 = ["innerHTML"];
|
|
5537
|
-
const _hoisted_40 =
|
|
5543
|
+
const _hoisted_40 = ["innerHTML"];
|
|
5544
|
+
const _hoisted_41 = ["innerHTML"];
|
|
5545
|
+
const _hoisted_42 = {
|
|
5538
5546
|
key: 1,
|
|
5539
5547
|
style: {"white-space":"nowrap"}
|
|
5540
5548
|
};
|
|
5541
|
-
const
|
|
5542
|
-
|
|
5543
|
-
key: 0,
|
|
5544
|
-
class: "text-center"
|
|
5545
|
-
};
|
|
5546
|
-
const _hoisted_43 = { key: 1 };
|
|
5547
|
-
const _hoisted_44 = {
|
|
5548
|
-
key: 2,
|
|
5549
|
+
const _hoisted_43 = {
|
|
5550
|
+
key: 5,
|
|
5549
5551
|
class: "mobile-list-items"
|
|
5550
5552
|
};
|
|
5551
|
-
const
|
|
5552
|
-
const
|
|
5553
|
-
const
|
|
5554
|
-
const
|
|
5555
|
-
const
|
|
5553
|
+
const _hoisted_44 = ["onClick"];
|
|
5554
|
+
const _hoisted_45 = { class: "form-check" };
|
|
5555
|
+
const _hoisted_46 = ["id", "checked", "onChange"];
|
|
5556
|
+
const _hoisted_47 = ["for"];
|
|
5557
|
+
const _hoisted_48 = {
|
|
5556
5558
|
key: 0,
|
|
5557
5559
|
class: "mb-1 font-weight-bold text-capitalize profile-form-title"
|
|
5558
5560
|
};
|
|
5559
|
-
const
|
|
5561
|
+
const _hoisted_49 = {
|
|
5560
5562
|
key: 1,
|
|
5561
5563
|
class: "mb-1 font-weight-bold text-capitalize profile-form-title"
|
|
5562
5564
|
};
|
|
5563
|
-
const
|
|
5565
|
+
const _hoisted_50 = {
|
|
5564
5566
|
key: 2,
|
|
5565
5567
|
class: "mb-1 font-weight-bold text-capitalize profile-form-title"
|
|
5566
5568
|
};
|
|
5567
|
-
const
|
|
5569
|
+
const _hoisted_51 = {
|
|
5568
5570
|
key: 3,
|
|
5569
5571
|
class: "mb-1 font-weight-bold text-capitalize profile-form-title"
|
|
5570
5572
|
};
|
|
5571
|
-
const
|
|
5572
|
-
const
|
|
5573
|
+
const _hoisted_52 = { key: 1 };
|
|
5574
|
+
const _hoisted_53 = {
|
|
5573
5575
|
key: 2,
|
|
5574
5576
|
class: "text-primary fw-bold"
|
|
5575
5577
|
};
|
|
5576
|
-
const
|
|
5578
|
+
const _hoisted_54 = { key: 3 };
|
|
5579
|
+
const _hoisted_55 = ["innerHTML"];
|
|
5577
5580
|
const _hoisted_56 = ["innerHTML"];
|
|
5578
5581
|
const _hoisted_57 = ["innerHTML"];
|
|
5579
5582
|
const _hoisted_58 = ["innerHTML"];
|
|
5580
5583
|
const _hoisted_59 = ["innerHTML"];
|
|
5581
5584
|
const _hoisted_60 = ["innerHTML"];
|
|
5582
|
-
const _hoisted_61 =
|
|
5583
|
-
const _hoisted_62 = { key:
|
|
5585
|
+
const _hoisted_61 = { key: 1 };
|
|
5586
|
+
const _hoisted_62 = { key: 6 };
|
|
5584
5587
|
const _hoisted_63 = {
|
|
5585
|
-
key:
|
|
5588
|
+
key: 0,
|
|
5589
|
+
class: "text-center"
|
|
5590
|
+
};
|
|
5591
|
+
const _hoisted_64 = { key: 1 };
|
|
5592
|
+
const _hoisted_65 = { key: 2 };
|
|
5593
|
+
const _hoisted_66 = {
|
|
5594
|
+
key: 1,
|
|
5595
|
+
class: "text-center bg-primary-light px-2 py-1 rounded no_records_div"
|
|
5596
|
+
};
|
|
5597
|
+
const _hoisted_67 = {
|
|
5598
|
+
key: 9,
|
|
5586
5599
|
class: "sh-multi-actions-bar shadow-lg border rounded p-3 bg-white d-flex justify-content-between align-items-center animate__animated animate__slideInUp"
|
|
5587
5600
|
};
|
|
5588
|
-
const
|
|
5589
|
-
const
|
|
5590
|
-
const
|
|
5601
|
+
const _hoisted_68 = { class: "badge bg-primary rounded-pill me-2" };
|
|
5602
|
+
const _hoisted_69 = { class: "d-flex gap-2" };
|
|
5603
|
+
const _hoisted_70 = ["onClick"];
|
|
5591
5604
|
|
|
5592
5605
|
// --- Props / Emits
|
|
5593
5606
|
|
|
@@ -5596,18 +5609,18 @@ var script$d = {
|
|
|
5596
5609
|
props: {
|
|
5597
5610
|
endPoint: [String, null],
|
|
5598
5611
|
orderBy: String,
|
|
5599
|
-
orderMethod: {type: String, default:
|
|
5612
|
+
orderMethod: { type: String, default: "desc" },
|
|
5600
5613
|
headers: [Array, null],
|
|
5601
|
-
disableMobileResponsive: {type: Boolean, default: false},
|
|
5614
|
+
disableMobileResponsive: { type: Boolean, default: false },
|
|
5602
5615
|
cacheKey: [String, null],
|
|
5603
5616
|
query: [String, null],
|
|
5604
5617
|
pageCount: [Number, null],
|
|
5605
5618
|
actions: [Object, null],
|
|
5606
|
-
hideCount: {type: Boolean, default: false},
|
|
5607
|
-
hideLoadMore: {type: Boolean, default: false},
|
|
5619
|
+
hideCount: { type: Boolean, default: false },
|
|
5620
|
+
hideLoadMore: { type: Boolean, default: false },
|
|
5608
5621
|
links: [Object, null],
|
|
5609
5622
|
reload: [Number, Boolean, String, null],
|
|
5610
|
-
hideSearch: {type: Boolean, default: false},
|
|
5623
|
+
hideSearch: { type: Boolean, default: false },
|
|
5611
5624
|
sharedData: [Object, null],
|
|
5612
5625
|
searchPlaceholder: [String, null],
|
|
5613
5626
|
event: [String, null],
|
|
@@ -5615,17 +5628,17 @@ var script$d = {
|
|
|
5615
5628
|
displayMoreBtnClass: [String, null],
|
|
5616
5629
|
moreDetailsColumns: [Array, null],
|
|
5617
5630
|
moreDetailsFields: [Array, null],
|
|
5618
|
-
hasDownload: {type: Boolean, default: false},
|
|
5631
|
+
hasDownload: { type: Boolean, default: false },
|
|
5619
5632
|
downloadFields: [Array, null],
|
|
5620
|
-
tableHover: {type: Boolean, default: false},
|
|
5621
|
-
hideIds: {type: Array, default: () => []},
|
|
5633
|
+
tableHover: { type: Boolean, default: false },
|
|
5634
|
+
hideIds: { type: Array, default: () => [] },
|
|
5622
5635
|
paginationStyle: [String, null],
|
|
5623
|
-
hasRange: {type: Boolean, default: false},
|
|
5636
|
+
hasRange: { type: Boolean, default: false },
|
|
5624
5637
|
selectedRange: [Object, null],
|
|
5625
5638
|
noRecordsMessage: [String, null],
|
|
5626
|
-
multiActions: {type: Array, default: () => []}
|
|
5639
|
+
multiActions: { type: Array, default: () => [] },
|
|
5627
5640
|
},
|
|
5628
|
-
emits: [
|
|
5641
|
+
emits: ["rowSelected", "dataReloaded", "dataLoaded"],
|
|
5629
5642
|
setup(__props, { emit: __emit }) {
|
|
5630
5643
|
|
|
5631
5644
|
const props = __props;
|
|
@@ -5633,29 +5646,33 @@ const props = __props;
|
|
|
5633
5646
|
const emit = __emit;
|
|
5634
5647
|
|
|
5635
5648
|
// --- Injection
|
|
5636
|
-
const noRecordsComponent = inject(
|
|
5649
|
+
const noRecordsComponent = inject("noRecordsComponent", script$k);
|
|
5637
5650
|
|
|
5638
5651
|
// --- Local State
|
|
5639
5652
|
const order_by = ref(props.orderBy);
|
|
5640
5653
|
const order_method = ref(props.orderMethod);
|
|
5641
|
-
const per_page = ref(props.pageCount ?? shRepo.getShConfig(
|
|
5654
|
+
const per_page = ref(props.pageCount ?? shRepo.getShConfig("tablePerPage", 10));
|
|
5642
5655
|
const page = ref(1);
|
|
5643
5656
|
const exactMatch = ref(false);
|
|
5644
|
-
const filter_value = ref(
|
|
5645
|
-
const loading = ref(
|
|
5646
|
-
const loading_error = ref(
|
|
5657
|
+
const filter_value = ref("");
|
|
5658
|
+
const loading = ref("loading"); // 'loading' | 'done' | 'error'
|
|
5659
|
+
const loading_error = ref("");
|
|
5647
5660
|
const records = ref([]);
|
|
5648
5661
|
ref(0);
|
|
5649
5662
|
const pagination_data = ref(null);
|
|
5650
5663
|
ref(null);
|
|
5651
5664
|
ref(null);
|
|
5652
5665
|
const downloading = ref(false);
|
|
5653
|
-
const appUrl =
|
|
5666
|
+
const appUrl =
|
|
5667
|
+
window?.VITE_APP_API_URL ?? import.meta?.env?.VITE_APP_API_URL ?? "";
|
|
5654
5668
|
const hasCanvas = ref(0);
|
|
5655
5669
|
const selectedRecord = ref(null);
|
|
5656
5670
|
const timeOut = ref(null);
|
|
5657
5671
|
const tableHeaders = ref([]);
|
|
5658
|
-
const pageStyle = ref(
|
|
5672
|
+
const pageStyle = ref(
|
|
5673
|
+
props.paginationStyle ??
|
|
5674
|
+
shRepo.getShConfig("tablePaginationStyle", "loadMore"),
|
|
5675
|
+
);
|
|
5659
5676
|
const range = ref(null);
|
|
5660
5677
|
const from = ref(null);
|
|
5661
5678
|
const to = ref(null);
|
|
@@ -5666,20 +5683,23 @@ const selectedItems = ref([]);
|
|
|
5666
5683
|
const selectAll = ref(false);
|
|
5667
5684
|
|
|
5668
5685
|
// Responsive width
|
|
5669
|
-
const windowWidth = ref(
|
|
5686
|
+
const windowWidth = ref(
|
|
5687
|
+
typeof window !== "undefined" ? window.innerWidth : 1024,
|
|
5688
|
+
);
|
|
5670
5689
|
const handleResize = () => (windowWidth.value = window.innerWidth);
|
|
5671
5690
|
|
|
5672
5691
|
// --- Slots helpers
|
|
5673
5692
|
const slots = useSlots();
|
|
5674
5693
|
const hasDefaultSlot = computed(() => !!slots.default);
|
|
5675
5694
|
const hasRecordsSlot = computed(() => !!slots.records);
|
|
5695
|
+
const hasEmptySlot = computed(() => !!slots.empty);
|
|
5676
5696
|
|
|
5677
5697
|
// --- Lifecycle
|
|
5678
5698
|
onMounted(() => {
|
|
5679
5699
|
if (props.headers) tableHeaders.value = props.headers;
|
|
5680
5700
|
|
|
5681
5701
|
if (props.actions?.actions) {
|
|
5682
|
-
props.actions.actions.forEach(a => {
|
|
5702
|
+
props.actions.actions.forEach((a) => {
|
|
5683
5703
|
if (a.canvasComponent) hasCanvas.value = 1;
|
|
5684
5704
|
});
|
|
5685
5705
|
}
|
|
@@ -5688,65 +5708,74 @@ onMounted(() => {
|
|
|
5688
5708
|
|
|
5689
5709
|
reloadData();
|
|
5690
5710
|
|
|
5691
|
-
window.addEventListener(
|
|
5711
|
+
window.addEventListener("resize", handleResize);
|
|
5692
5712
|
});
|
|
5693
5713
|
|
|
5694
5714
|
onBeforeUnmount(() => {
|
|
5695
|
-
window.removeEventListener(
|
|
5715
|
+
window.removeEventListener("resize", handleResize);
|
|
5696
5716
|
if (timeOut.value) clearTimeout(timeOut.value);
|
|
5697
5717
|
});
|
|
5698
5718
|
|
|
5699
5719
|
// --- Utils used in template
|
|
5700
5720
|
const getData = (record, key) => {
|
|
5701
|
-
if (!key || !record) return
|
|
5702
|
-
if (typeof key !==
|
|
5703
|
-
return key.split(
|
|
5721
|
+
if (!key || !record) return "";
|
|
5722
|
+
if (typeof key !== "string") return "";
|
|
5723
|
+
return key.split(".").reduce((obj, i) => (obj ? obj[i] : ""), record);
|
|
5704
5724
|
};
|
|
5705
5725
|
|
|
5706
5726
|
const getLabel = (title) => {
|
|
5707
|
-
if (typeof title ===
|
|
5708
|
-
if (title.includes(
|
|
5709
|
-
const parts = title.split(
|
|
5710
|
-
return parts[parts.length - 1].replace(/_/g,
|
|
5727
|
+
if (typeof title === "string") {
|
|
5728
|
+
if (title.includes(".")) {
|
|
5729
|
+
const parts = title.split(".");
|
|
5730
|
+
return parts[parts.length - 1].replace(/_/g, " ");
|
|
5711
5731
|
}
|
|
5712
|
-
return title.replace(/_/g,
|
|
5732
|
+
return title.replace(/_/g, " ");
|
|
5713
5733
|
}
|
|
5714
|
-
if (typeof title ===
|
|
5715
|
-
if (title.label) return title.label
|
|
5716
|
-
const key = title.key ?? title.field ??
|
|
5717
|
-
if (key.includes(
|
|
5718
|
-
const parts = key.split(
|
|
5719
|
-
return parts[parts.length - 1].replace(/_/g,
|
|
5734
|
+
if (typeof title === "object") {
|
|
5735
|
+
if (title.label) return title.label;
|
|
5736
|
+
const key = title.key ?? title.field ?? "";
|
|
5737
|
+
if (key.includes(".")) {
|
|
5738
|
+
const parts = key.split(".");
|
|
5739
|
+
return parts[parts.length - 1].replace(/_/g, " ");
|
|
5720
5740
|
}
|
|
5721
|
-
return key.replace(/_/g,
|
|
5741
|
+
return key.replace(/_/g, " ");
|
|
5722
5742
|
}
|
|
5723
|
-
return
|
|
5743
|
+
return "";
|
|
5724
5744
|
};
|
|
5725
5745
|
|
|
5726
5746
|
const getSlotName = (key) => {
|
|
5727
|
-
if (typeof key ===
|
|
5728
|
-
if (typeof key ===
|
|
5729
|
-
if (typeof key ===
|
|
5730
|
-
return
|
|
5747
|
+
if (typeof key === "string") return key;
|
|
5748
|
+
if (typeof key === "object") return key.key ?? key.field ?? "";
|
|
5749
|
+
if (typeof key === "function") return key(null);
|
|
5750
|
+
return "";
|
|
5731
5751
|
};
|
|
5732
5752
|
|
|
5753
|
+
const { user } = storeToRefs(useUserStore());
|
|
5754
|
+
|
|
5755
|
+
const activeMultiActions = computed(() => {
|
|
5756
|
+
return props.multiActions.filter((action) => {
|
|
5757
|
+
if (!action.permission) return true;
|
|
5758
|
+
return user.value.isAllowedTo(action.permission);
|
|
5759
|
+
});
|
|
5760
|
+
});
|
|
5761
|
+
|
|
5733
5762
|
const cleanColumn = (col) => {
|
|
5734
|
-
const newCol = {...col};
|
|
5763
|
+
const newCol = { ...col };
|
|
5735
5764
|
delete newCol.component;
|
|
5736
5765
|
delete newCol.key;
|
|
5737
|
-
return newCol
|
|
5766
|
+
return newCol;
|
|
5738
5767
|
};
|
|
5739
5768
|
|
|
5740
5769
|
const showColumn = (header) => {
|
|
5741
|
-
if (typeof header ===
|
|
5742
|
-
if (typeof header ===
|
|
5743
|
-
return true
|
|
5770
|
+
if (typeof header === "string") return true;
|
|
5771
|
+
if (typeof header === "object" && header.validator) return header.validator();
|
|
5772
|
+
return true;
|
|
5744
5773
|
};
|
|
5745
5774
|
|
|
5746
5775
|
const cleanCanvasProps = (actions) => {
|
|
5747
|
-
const replaced = {...actions};
|
|
5776
|
+
const replaced = { ...actions };
|
|
5748
5777
|
replaced.class = null;
|
|
5749
|
-
return replaced
|
|
5778
|
+
return replaced;
|
|
5750
5779
|
};
|
|
5751
5780
|
|
|
5752
5781
|
const canvasClosed = () => {
|
|
@@ -5757,15 +5786,15 @@ const rowSelected = (row) => {
|
|
|
5757
5786
|
selectedRecord.value = null;
|
|
5758
5787
|
setTimeout(() => {
|
|
5759
5788
|
selectedRecord.value = row;
|
|
5760
|
-
emit(
|
|
5789
|
+
emit("rowSelected", row);
|
|
5761
5790
|
}, 100);
|
|
5762
5791
|
};
|
|
5763
5792
|
|
|
5764
5793
|
const changeKey = (key, value) => {
|
|
5765
|
-
if (key ===
|
|
5794
|
+
if (key === "order_by") {
|
|
5766
5795
|
order_by.value = value;
|
|
5767
|
-
order_method.value =
|
|
5768
|
-
} else if (key ===
|
|
5796
|
+
order_method.value = order_method.value === "desc" ? "asc" : "desc";
|
|
5797
|
+
} else if (key === "per_page") {
|
|
5769
5798
|
per_page.value = value;
|
|
5770
5799
|
page.value = 1;
|
|
5771
5800
|
} else {
|
|
@@ -5775,57 +5804,79 @@ const changeKey = (key, value) => {
|
|
|
5775
5804
|
stateProxy[key] = value;
|
|
5776
5805
|
} else {
|
|
5777
5806
|
// fallback direct
|
|
5778
|
-
if (key ===
|
|
5807
|
+
if (key === "page") page.value = value;
|
|
5779
5808
|
}
|
|
5780
5809
|
}
|
|
5781
5810
|
reloadData();
|
|
5782
5811
|
};
|
|
5783
5812
|
|
|
5784
|
-
const getLinkClass = (config) =>
|
|
5813
|
+
const getLinkClass = (config) =>
|
|
5814
|
+
typeof config === "object" ? config.class || "" : "";
|
|
5785
5815
|
|
|
5786
5816
|
const doEmitAction = (action, data) => {
|
|
5787
|
-
if (typeof action ===
|
|
5817
|
+
if (typeof action === "function") action(data);
|
|
5788
5818
|
else emit(action, data);
|
|
5789
5819
|
};
|
|
5790
5820
|
|
|
5791
5821
|
const getFieldType = (field) => {
|
|
5792
|
-
const numbers = [
|
|
5793
|
-
const moneys = [
|
|
5794
|
-
|
|
5822
|
+
const numbers = ["age", "interest_rate_pa"];
|
|
5823
|
+
const moneys = [
|
|
5824
|
+
"amount",
|
|
5825
|
+
"paid_amount",
|
|
5826
|
+
"total_paid",
|
|
5827
|
+
"total",
|
|
5828
|
+
"monthly_fee",
|
|
5829
|
+
"share_cost",
|
|
5830
|
+
"min_contribution",
|
|
5831
|
+
"min_membership_contribution",
|
|
5832
|
+
];
|
|
5833
|
+
const dates = [
|
|
5834
|
+
"invoice_date",
|
|
5835
|
+
"free_tier_days",
|
|
5836
|
+
"updated_at",
|
|
5837
|
+
"created_at",
|
|
5838
|
+
"end_time",
|
|
5839
|
+
];
|
|
5795
5840
|
|
|
5796
|
-
const rawField =
|
|
5797
|
-
|
|
5841
|
+
const rawField =
|
|
5842
|
+
typeof field === "object" ? (field.key ?? field.field ?? "") : field;
|
|
5843
|
+
const lastPart =
|
|
5844
|
+
typeof rawField === "string" && rawField.includes(".")
|
|
5845
|
+
? rawField.split(".").pop()
|
|
5846
|
+
: rawField;
|
|
5798
5847
|
|
|
5799
|
-
if (typeof lastPart ===
|
|
5800
|
-
|
|
5801
|
-
if (typeof lastPart ===
|
|
5802
|
-
return
|
|
5848
|
+
if (typeof lastPart === "string" && numbers.includes(lastPart))
|
|
5849
|
+
return "numeric";
|
|
5850
|
+
if (typeof lastPart === "string" && moneys.includes(lastPart)) return "money";
|
|
5851
|
+
if (typeof lastPart === "string" && dates.includes(lastPart)) return "date";
|
|
5852
|
+
return "string";
|
|
5803
5853
|
};
|
|
5804
5854
|
|
|
5805
5855
|
const replaceLinkUrl = (p, obj) => {
|
|
5806
5856
|
let path = p;
|
|
5807
|
-
if (typeof path ===
|
|
5857
|
+
if (typeof path === "object") {
|
|
5808
5858
|
if (path.link) path = path.link;
|
|
5809
5859
|
else if (path.url) path = path.url;
|
|
5810
5860
|
else if (path.path) path = path.path;
|
|
5811
|
-
else path =
|
|
5861
|
+
else path = "";
|
|
5812
5862
|
}
|
|
5813
5863
|
const matches = path.match(/\{(.*?)\}/g);
|
|
5814
|
-
matches?.forEach(k => {
|
|
5815
|
-
const key = k.replace(
|
|
5864
|
+
matches?.forEach((k) => {
|
|
5865
|
+
const key = k.replace("{", "").replace("}", "");
|
|
5816
5866
|
path = path.replace(`{${key}}`, obj[key]);
|
|
5817
5867
|
});
|
|
5818
|
-
return path
|
|
5868
|
+
return path;
|
|
5819
5869
|
};
|
|
5820
5870
|
|
|
5821
|
-
const formatDate = (date) =>
|
|
5871
|
+
const formatDate = (date) =>
|
|
5872
|
+
DateTime.fromISO(date).toLocaleString(DateTime.DATETIME_MED);
|
|
5822
5873
|
|
|
5823
5874
|
const loadMoreRecords = () => reloadData(page.value + 1, 1);
|
|
5824
5875
|
|
|
5825
5876
|
const rangeChanged = (newRange) => {
|
|
5826
5877
|
range.value = newRange;
|
|
5827
|
-
from.value = newRange.from.toFormat(
|
|
5828
|
-
to.value = newRange.to.toFormat(
|
|
5878
|
+
from.value = newRange.from.toFormat("LL/dd/yyyy");
|
|
5879
|
+
to.value = newRange.to.toFormat("LL/dd/yyyy");
|
|
5829
5880
|
period.value = newRange.period;
|
|
5830
5881
|
reloadData();
|
|
5831
5882
|
};
|
|
@@ -5839,8 +5890,8 @@ const exportData = () => {
|
|
|
5839
5890
|
downloading.value = true;
|
|
5840
5891
|
const headers = [];
|
|
5841
5892
|
const fields = props.downloadFields ? props.downloadFields : props.headers;
|
|
5842
|
-
fields?.forEach(header => {
|
|
5843
|
-
if (typeof header ===
|
|
5893
|
+
fields?.forEach((header) => {
|
|
5894
|
+
if (typeof header === "string") headers.push(header);
|
|
5844
5895
|
});
|
|
5845
5896
|
|
|
5846
5897
|
const data = {
|
|
@@ -5852,38 +5903,47 @@ const exportData = () => {
|
|
|
5852
5903
|
from: from.value,
|
|
5853
5904
|
to: to.value,
|
|
5854
5905
|
period: period.value,
|
|
5855
|
-
lastId: lastId.value
|
|
5906
|
+
lastId: lastId.value,
|
|
5856
5907
|
};
|
|
5857
5908
|
|
|
5858
|
-
shApis
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5909
|
+
shApis
|
|
5910
|
+
.doPost(props.endPoint, data)
|
|
5911
|
+
.then((res) => {
|
|
5912
|
+
downloading.value = false;
|
|
5913
|
+
if (res.data.file) {
|
|
5914
|
+
const url =
|
|
5915
|
+
appUrl +
|
|
5916
|
+
"external-download?file=" +
|
|
5917
|
+
res.data.file +
|
|
5918
|
+
"&name=" +
|
|
5919
|
+
res.data.name;
|
|
5920
|
+
window.location.href = url;
|
|
5921
|
+
}
|
|
5922
|
+
})
|
|
5923
|
+
.catch((reason) => {
|
|
5924
|
+
downloading.value = false;
|
|
5925
|
+
const error =
|
|
5926
|
+
typeof reason.response === "undefined"
|
|
5927
|
+
? "Error getting data from backend"
|
|
5928
|
+
: `${reason.response.status}:${reason.response.statusText}`;
|
|
5929
|
+
shRepo.swalError("Error", error);
|
|
5930
|
+
});
|
|
5871
5931
|
};
|
|
5872
5932
|
|
|
5873
5933
|
const setCachedData = () => {
|
|
5874
5934
|
if (props.cacheKey) {
|
|
5875
|
-
records.value = shStorage.getItem(
|
|
5935
|
+
records.value = shStorage.getItem("sh_table_cache_" + props.cacheKey, null);
|
|
5876
5936
|
}
|
|
5877
5937
|
};
|
|
5878
5938
|
|
|
5879
5939
|
// Main loader
|
|
5880
5940
|
const reloadData = (newPage, append) => {
|
|
5881
|
-
if (typeof newPage !==
|
|
5941
|
+
if (typeof newPage !== "undefined") page.value = newPage;
|
|
5882
5942
|
|
|
5883
5943
|
if (props.cacheKey && records.value !== null) {
|
|
5884
|
-
loading.value =
|
|
5944
|
+
loading.value = "done";
|
|
5885
5945
|
} else if (!append) {
|
|
5886
|
-
loading.value =
|
|
5946
|
+
loading.value = "loading";
|
|
5887
5947
|
}
|
|
5888
5948
|
|
|
5889
5949
|
let data = {
|
|
@@ -5897,74 +5957,85 @@ const reloadData = (newPage, append) => {
|
|
|
5897
5957
|
to: to.value,
|
|
5898
5958
|
period: period.value,
|
|
5899
5959
|
exact: exactMatch.value,
|
|
5900
|
-
lastId: lastId.value
|
|
5960
|
+
lastId: lastId.value,
|
|
5901
5961
|
};
|
|
5902
5962
|
|
|
5903
5963
|
// strip empty
|
|
5904
|
-
Object.keys(data).forEach(k => {
|
|
5905
|
-
if (data[k] === null || data[k] ===
|
|
5964
|
+
Object.keys(data).forEach((k) => {
|
|
5965
|
+
if (data[k] === null || data[k] === "") delete data[k];
|
|
5906
5966
|
});
|
|
5907
5967
|
|
|
5908
5968
|
if (pagination_data.value) pagination_data.value.loading = 1;
|
|
5909
5969
|
|
|
5910
5970
|
let endPoint = props.endPoint;
|
|
5911
5971
|
if (!props.endPoint && props.query) {
|
|
5912
|
-
endPoint =
|
|
5972
|
+
endPoint = "sh-ql";
|
|
5913
5973
|
data.query = props.query;
|
|
5914
5974
|
}
|
|
5915
5975
|
|
|
5916
|
-
shApis
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
emit('dataLoaded', response);
|
|
5922
|
-
|
|
5923
|
-
if (page.value < 2 && props.cacheKey) {
|
|
5924
|
-
shStorage.setItem('sh_table_cache_' + props.cacheKey, response.data);
|
|
5925
|
-
}
|
|
5976
|
+
shApis
|
|
5977
|
+
.doGet(endPoint, data)
|
|
5978
|
+
.then((req) => {
|
|
5979
|
+
emit("dataReloaded", pagination_data.value);
|
|
5980
|
+
loading.value = "done";
|
|
5926
5981
|
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
start: response.from,
|
|
5930
|
-
end: response.last_page,
|
|
5931
|
-
record_count: response.total,
|
|
5932
|
-
per_page: response.per_page,
|
|
5933
|
-
loading: 0,
|
|
5934
|
-
displayCount: response.total > response.per_page ? response.per_page : response.total
|
|
5935
|
-
};
|
|
5982
|
+
const response = req.data.data;
|
|
5983
|
+
emit("dataLoaded", response);
|
|
5936
5984
|
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5985
|
+
if (page.value < 2 && props.cacheKey) {
|
|
5986
|
+
shStorage.setItem("sh_table_cache_" + props.cacheKey, response.data);
|
|
5987
|
+
}
|
|
5940
5988
|
|
|
5941
|
-
|
|
5989
|
+
pagination_data.value = {
|
|
5990
|
+
current: response.current_page,
|
|
5991
|
+
start: response.from,
|
|
5992
|
+
end: response.last_page,
|
|
5993
|
+
record_count: response.total,
|
|
5994
|
+
per_page: response.per_page,
|
|
5995
|
+
loading: 0,
|
|
5996
|
+
displayCount:
|
|
5997
|
+
response.total > response.per_page
|
|
5998
|
+
? response.per_page
|
|
5999
|
+
: response.total,
|
|
6000
|
+
};
|
|
5942
6001
|
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
? response.per_page * response.current_page
|
|
5947
|
-
: response.total;
|
|
5948
|
-
if (totalShown > response.total) totalShown = response.total;
|
|
5949
|
-
pagination_data.value.displayCount = totalShown;
|
|
6002
|
+
if (!props.headers && response.total > 0) {
|
|
6003
|
+
tableHeaders.value = Object.keys(response.data[0]);
|
|
6004
|
+
}
|
|
5950
6005
|
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
6006
|
+
lastId.value =
|
|
6007
|
+
response.data.length > 0
|
|
6008
|
+
? response.data[response.data.length - 1].id
|
|
6009
|
+
: null;
|
|
6010
|
+
|
|
6011
|
+
if (append) {
|
|
6012
|
+
records.value.push(...response.data);
|
|
6013
|
+
let totalShown =
|
|
6014
|
+
response.total > response.per_page
|
|
6015
|
+
? response.per_page * response.current_page
|
|
6016
|
+
: response.total;
|
|
6017
|
+
if (totalShown > response.total) totalShown = response.total;
|
|
6018
|
+
pagination_data.value.displayCount = totalShown;
|
|
6019
|
+
|
|
6020
|
+
const scrollingElement = document.scrollingElement || document.body;
|
|
6021
|
+
scrollingElement.scrollTop = scrollingElement.scrollHeight;
|
|
6022
|
+
} else {
|
|
6023
|
+
records.value = response.data;
|
|
6024
|
+
}
|
|
6025
|
+
})
|
|
6026
|
+
.catch((reason) => {
|
|
6027
|
+
const error =
|
|
6028
|
+
typeof reason.response === "undefined"
|
|
6029
|
+
? "Error getting data from backend"
|
|
6030
|
+
: `${reason.response.status}:${reason.response.statusText} (${props.endPoint})`;
|
|
6031
|
+
loading_error.value = error;
|
|
6032
|
+
loading.value = "error";
|
|
6033
|
+
});
|
|
5963
6034
|
};
|
|
5964
6035
|
|
|
5965
6036
|
const toggleSelectAll = (event) => {
|
|
5966
6037
|
if (event.target.checked) {
|
|
5967
|
-
selectedItems.value = records.value.map(r => r.id);
|
|
6038
|
+
selectedItems.value = records.value.map((r) => r.id);
|
|
5968
6039
|
} else {
|
|
5969
6040
|
selectedItems.value = [];
|
|
5970
6041
|
}
|
|
@@ -5980,31 +6051,50 @@ const toggleSelectItem = (id) => {
|
|
|
5980
6051
|
};
|
|
5981
6052
|
|
|
5982
6053
|
const runMultiAction = (action) => {
|
|
5983
|
-
const selectedRecords = records.value.filter(r =>
|
|
5984
|
-
|
|
6054
|
+
const selectedRecords = records.value.filter((r) =>
|
|
6055
|
+
selectedItems.value.includes(r.id),
|
|
6056
|
+
);
|
|
6057
|
+
if (typeof action.callback === "function") {
|
|
5985
6058
|
action.callback(selectedRecords);
|
|
5986
6059
|
}
|
|
5987
6060
|
selectedItems.value = [];
|
|
5988
6061
|
};
|
|
5989
6062
|
|
|
5990
|
-
watch(
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
6063
|
+
watch(
|
|
6064
|
+
selectedItems,
|
|
6065
|
+
(newVal) => {
|
|
6066
|
+
selectAll.value =
|
|
6067
|
+
newVal.length === records.value.length && records.value.length > 0;
|
|
6068
|
+
},
|
|
6069
|
+
{ deep: true },
|
|
6070
|
+
);
|
|
5994
6071
|
|
|
5995
6072
|
// --- Watches
|
|
5996
|
-
watch(
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6073
|
+
watch(
|
|
6074
|
+
() => props.hideIds,
|
|
6075
|
+
(newVal) => {
|
|
6076
|
+
if (Array.isArray(newVal) && Array.isArray(records.value)) {
|
|
6077
|
+
records.value = records.value.filter((r) => !newVal.includes(r.id) && r);
|
|
6078
|
+
}
|
|
6079
|
+
},
|
|
6080
|
+
{ deep: true },
|
|
6081
|
+
);
|
|
6001
6082
|
|
|
6002
|
-
watch(
|
|
6003
|
-
|
|
6083
|
+
watch(
|
|
6084
|
+
() => props.reload,
|
|
6085
|
+
() => reloadData(),
|
|
6086
|
+
);
|
|
6087
|
+
watch(
|
|
6088
|
+
() => props.endPoint,
|
|
6089
|
+
() => reloadData(),
|
|
6090
|
+
);
|
|
6004
6091
|
|
|
6005
6092
|
// optional proxy (for changeKey generic setter)
|
|
6006
6093
|
const stateProxy = reactive({
|
|
6007
|
-
page,
|
|
6094
|
+
page,
|
|
6095
|
+
per_page,
|
|
6096
|
+
order_by,
|
|
6097
|
+
order_method,
|
|
6008
6098
|
});
|
|
6009
6099
|
|
|
6010
6100
|
return (_ctx, _cache) => {
|
|
@@ -6034,11 +6124,11 @@ return (_ctx, _cache) => {
|
|
|
6034
6124
|
], 8 /* PROPS */, _hoisted_3$6)
|
|
6035
6125
|
]))
|
|
6036
6126
|
: createCommentVNode("v-if", true),
|
|
6037
|
-
(!__props.hideSearch)
|
|
6127
|
+
(!__props.hideSearch && (records.value.length > 0 || !hasEmptySlot.value || filter_value.value.length > 0))
|
|
6038
6128
|
? (openBlock(), createElementBlock("div", _hoisted_4$6, [
|
|
6039
6129
|
createElementVNode("div", _hoisted_5$4, [
|
|
6040
6130
|
createElementVNode("div", {
|
|
6041
|
-
class: normalizeClass(["sh-search-bar input-group", __props.hasRange ? 'me-2':''])
|
|
6131
|
+
class: normalizeClass(["sh-search-bar input-group", __props.hasRange ? 'me-2' : ''])
|
|
6042
6132
|
}, [
|
|
6043
6133
|
withDirectives(createElementVNode("input", {
|
|
6044
6134
|
onKeydown: userTyping,
|
|
@@ -6093,18 +6183,31 @@ return (_ctx, _cache) => {
|
|
|
6093
6183
|
]))
|
|
6094
6184
|
: createCommentVNode("v-if", true),
|
|
6095
6185
|
(loading.value === 'done')
|
|
6096
|
-
? (openBlock(
|
|
6097
|
-
|
|
6098
|
-
key:
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6186
|
+
? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
6187
|
+
(records.value.length === 0)
|
|
6188
|
+
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6189
|
+
(hasEmptySlot.value)
|
|
6190
|
+
? renderSlot(_ctx.$slots, "empty", { key: 0 })
|
|
6191
|
+
: (!hasRecordsSlot.value)
|
|
6192
|
+
? (openBlock(), createElementBlock("div", _hoisted_11$1, [...(_cache[14] || (_cache[14] = [
|
|
6193
|
+
createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* CACHED */),
|
|
6194
|
+
createTextVNode(" No records found ", -1 /* CACHED */)
|
|
6195
|
+
]))]))
|
|
6196
|
+
: createCommentVNode("v-if", true)
|
|
6197
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
6198
|
+
: (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(records.value, (record) => {
|
|
6199
|
+
return renderSlot(_ctx.$slots, "default", {
|
|
6200
|
+
key: record.id,
|
|
6201
|
+
record: record
|
|
6202
|
+
})
|
|
6203
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
6204
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
6102
6205
|
: createCommentVNode("v-if", true)
|
|
6103
6206
|
], 64 /* STABLE_FRAGMENT */))
|
|
6104
6207
|
: (hasRecordsSlot.value)
|
|
6105
6208
|
? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
6106
6209
|
(loading.value === 'loading' && !__props.cacheKey)
|
|
6107
|
-
? (openBlock(), createElementBlock("div",
|
|
6210
|
+
? (openBlock(), createElementBlock("div", _hoisted_12$1, [...(_cache[15] || (_cache[15] = [
|
|
6108
6211
|
createElementVNode("div", {
|
|
6109
6212
|
class: "spinner-border",
|
|
6110
6213
|
role: "status"
|
|
@@ -6113,34 +6216,38 @@ return (_ctx, _cache) => {
|
|
|
6113
6216
|
], -1 /* CACHED */)
|
|
6114
6217
|
]))]))
|
|
6115
6218
|
: (loading.value === 'error' && !__props.cacheKey)
|
|
6116
|
-
? (openBlock(), createElementBlock("div",
|
|
6219
|
+
? (openBlock(), createElementBlock("div", _hoisted_13$1, [
|
|
6117
6220
|
createElementVNode("span", null, toDisplayString(loading_error.value), 1 /* TEXT */)
|
|
6118
6221
|
]))
|
|
6119
6222
|
: createCommentVNode("v-if", true),
|
|
6120
6223
|
(loading.value === 'done' || __props.cacheKey)
|
|
6121
6224
|
? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
6122
6225
|
(!records.value || records.value.length === 0)
|
|
6123
|
-
? (openBlock(),
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6226
|
+
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6227
|
+
(hasEmptySlot.value)
|
|
6228
|
+
? renderSlot(_ctx.$slots, "empty", { key: 0 })
|
|
6229
|
+
: (openBlock(), createBlock(resolveDynamicComponent(unref(noRecordsComponent)), { key: 1 }, {
|
|
6230
|
+
default: withCtx(() => [
|
|
6231
|
+
_cache[16] || (_cache[16] = createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* CACHED */)),
|
|
6232
|
+
createTextVNode(" " + toDisplayString(__props.noRecordsMessage ?? "No records found"), 1 /* TEXT */)
|
|
6233
|
+
]),
|
|
6234
|
+
_: 1 /* STABLE */
|
|
6235
|
+
}))
|
|
6236
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
6130
6237
|
: createCommentVNode("v-if", true),
|
|
6131
6238
|
renderSlot(_ctx.$slots, "records", { records: records.value })
|
|
6132
6239
|
], 64 /* STABLE_FRAGMENT */))
|
|
6133
6240
|
: createCommentVNode("v-if", true)
|
|
6134
6241
|
], 64 /* STABLE_FRAGMENT */))
|
|
6135
|
-
: (windowWidth.value > 700 || __props.disableMobileResponsive)
|
|
6242
|
+
: ((windowWidth.value > 700 || __props.disableMobileResponsive) && records.value.length > 0)
|
|
6136
6243
|
? (openBlock(), createElementBlock("table", {
|
|
6137
6244
|
key: 4,
|
|
6138
|
-
class: normalizeClass(["table sh-table", __props.tableHover ? 'table-hover':''])
|
|
6245
|
+
class: normalizeClass(["table sh-table", __props.tableHover ? 'table-hover' : ''])
|
|
6139
6246
|
}, [
|
|
6140
|
-
createElementVNode("thead",
|
|
6247
|
+
createElementVNode("thead", _hoisted_14$1, [
|
|
6141
6248
|
createElementVNode("tr", null, [
|
|
6142
|
-
(
|
|
6143
|
-
? (openBlock(), createElementBlock("th",
|
|
6249
|
+
(activeMultiActions.value.length > 0)
|
|
6250
|
+
? (openBlock(), createElementBlock("th", _hoisted_15$1, [
|
|
6144
6251
|
withDirectives(createElementVNode("input", {
|
|
6145
6252
|
type: "checkbox",
|
|
6146
6253
|
class: "form-check-input",
|
|
@@ -6154,47 +6261,51 @@ return (_ctx, _cache) => {
|
|
|
6154
6261
|
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (title) => {
|
|
6155
6262
|
return (openBlock(), createElementBlock(Fragment, { key: title }, [
|
|
6156
6263
|
(showColumn(title))
|
|
6157
|
-
? (openBlock(), createElementBlock("th",
|
|
6264
|
+
? (openBlock(), createElementBlock("th", _hoisted_16, [
|
|
6158
6265
|
(typeof title === 'string')
|
|
6159
6266
|
? (openBlock(), createElementBlock("a", {
|
|
6160
6267
|
key: 0,
|
|
6161
6268
|
class: "text-capitalize",
|
|
6162
6269
|
onClick: $event => (changeKey('order_by', title))
|
|
6163
|
-
}, toDisplayString(getLabel(title)), 9 /* TEXT, PROPS */,
|
|
6270
|
+
}, toDisplayString(getLabel(title)), 9 /* TEXT, PROPS */, _hoisted_17))
|
|
6164
6271
|
: (typeof title === 'object')
|
|
6165
6272
|
? (openBlock(), createElementBlock("a", {
|
|
6166
6273
|
key: 1,
|
|
6167
6274
|
class: "text-capitalize",
|
|
6168
6275
|
onClick: $event => (changeKey('order_by', title.key))
|
|
6169
|
-
}, toDisplayString(getLabel(title)), 9 /* TEXT, PROPS */,
|
|
6276
|
+
}, toDisplayString(getLabel(title)), 9 /* TEXT, PROPS */, _hoisted_18))
|
|
6170
6277
|
: (typeof title === 'function')
|
|
6171
6278
|
? (openBlock(), createElementBlock("a", {
|
|
6172
6279
|
key: 2,
|
|
6173
6280
|
class: "text-capitalize",
|
|
6174
6281
|
onClick: $event => (changeKey('order_by', title(null)))
|
|
6175
|
-
}, toDisplayString(title(null).replace(/_/g,
|
|
6282
|
+
}, toDisplayString(title(null).replace(/_/g, " ")), 9 /* TEXT, PROPS */, _hoisted_19))
|
|
6176
6283
|
: (typeof title !== 'undefined')
|
|
6177
6284
|
? (openBlock(), createElementBlock("a", {
|
|
6178
6285
|
key: 3,
|
|
6179
6286
|
class: "text-capitalize",
|
|
6180
6287
|
onClick: $event => (changeKey('order_by', title))
|
|
6181
|
-
}, toDisplayString(String(getLabel(title))), 9 /* TEXT, PROPS */,
|
|
6288
|
+
}, toDisplayString(String(getLabel(title))), 9 /* TEXT, PROPS */, _hoisted_20))
|
|
6182
6289
|
: createCommentVNode("v-if", true)
|
|
6183
6290
|
]))
|
|
6184
6291
|
: createCommentVNode("v-if", true)
|
|
6185
6292
|
], 64 /* STABLE_FRAGMENT */))
|
|
6186
6293
|
}), 128 /* KEYED_FRAGMENT */)),
|
|
6187
6294
|
(__props.actions)
|
|
6188
|
-
? (openBlock(), createElementBlock("th",
|
|
6295
|
+
? (openBlock(), createElementBlock("th", _hoisted_21, toDisplayString(__props.actions.label), 1 /* TEXT */))
|
|
6189
6296
|
: createCommentVNode("v-if", true)
|
|
6190
6297
|
])
|
|
6191
6298
|
]),
|
|
6192
|
-
createElementVNode("tbody",
|
|
6299
|
+
createElementVNode("tbody", _hoisted_22, [
|
|
6193
6300
|
(loading.value === 'loading')
|
|
6194
|
-
? (openBlock(), createElementBlock("tr",
|
|
6301
|
+
? (openBlock(), createElementBlock("tr", _hoisted_23, [
|
|
6195
6302
|
createElementVNode("td", {
|
|
6196
|
-
colspan:
|
|
6197
|
-
|
|
6303
|
+
colspan:
|
|
6304
|
+
activeMultiActions.value.length > 0
|
|
6305
|
+
? tableHeaders.value.length + 1
|
|
6306
|
+
: tableHeaders.value.length
|
|
6307
|
+
|
|
6308
|
+
}, [...(_cache[17] || (_cache[17] = [
|
|
6198
6309
|
createElementVNode("div", { class: "text-center" }, [
|
|
6199
6310
|
createElementVNode("div", {
|
|
6200
6311
|
class: "spinner-border",
|
|
@@ -6203,24 +6314,34 @@ return (_ctx, _cache) => {
|
|
|
6203
6314
|
createElementVNode("span", { class: "visually-hidden" }, "Loading...")
|
|
6204
6315
|
])
|
|
6205
6316
|
], -1 /* CACHED */)
|
|
6206
|
-
]))], 8 /* PROPS */,
|
|
6317
|
+
]))], 8 /* PROPS */, _hoisted_24)
|
|
6207
6318
|
]))
|
|
6208
6319
|
: (loading.value === 'error')
|
|
6209
|
-
? (openBlock(), createElementBlock("tr",
|
|
6320
|
+
? (openBlock(), createElementBlock("tr", _hoisted_25, [
|
|
6210
6321
|
createElementVNode("td", {
|
|
6211
|
-
colspan:
|
|
6212
|
-
|
|
6322
|
+
colspan:
|
|
6323
|
+
activeMultiActions.value.length > 0
|
|
6324
|
+
? tableHeaders.value.length + 1
|
|
6325
|
+
: tableHeaders.value.length
|
|
6326
|
+
|
|
6327
|
+
}, toDisplayString(loading_error.value), 9 /* TEXT, PROPS */, _hoisted_26)
|
|
6213
6328
|
]))
|
|
6214
6329
|
: (records.value.length === 0)
|
|
6215
|
-
? (openBlock(), createElementBlock("tr",
|
|
6330
|
+
? (openBlock(), createElementBlock("tr", _hoisted_27, [
|
|
6216
6331
|
createElementVNode("td", {
|
|
6217
|
-
colspan:
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6332
|
+
colspan:
|
|
6333
|
+
__props.actions
|
|
6334
|
+
? tableHeaders.value.length + (activeMultiActions.value.length > 0 ? 2 : 1)
|
|
6335
|
+
: tableHeaders.value.length + (activeMultiActions.value.length > 0 ? 1 : 0)
|
|
6336
|
+
|
|
6337
|
+
}, [
|
|
6338
|
+
(hasEmptySlot.value)
|
|
6339
|
+
? renderSlot(_ctx.$slots, "empty", { key: 0 })
|
|
6340
|
+
: (openBlock(), createElementBlock("div", _hoisted_29, [...(_cache[18] || (_cache[18] = [
|
|
6341
|
+
createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* CACHED */),
|
|
6342
|
+
createTextVNode(" No records found ", -1 /* CACHED */)
|
|
6343
|
+
]))]))
|
|
6344
|
+
], 8 /* PROPS */, _hoisted_28)
|
|
6224
6345
|
]))
|
|
6225
6346
|
: (loading.value === 'done')
|
|
6226
6347
|
? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(records.value, (record, index) => {
|
|
@@ -6229,7 +6350,7 @@ return (_ctx, _cache) => {
|
|
|
6229
6350
|
class: normalizeClass(record.class),
|
|
6230
6351
|
onClick: $event => (rowSelected(record))
|
|
6231
6352
|
}, [
|
|
6232
|
-
(
|
|
6353
|
+
(activeMultiActions.value.length > 0)
|
|
6233
6354
|
? (openBlock(), createElementBlock("td", {
|
|
6234
6355
|
key: 0,
|
|
6235
6356
|
onClick: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"]))
|
|
@@ -6240,13 +6361,13 @@ return (_ctx, _cache) => {
|
|
|
6240
6361
|
value: record.id,
|
|
6241
6362
|
checked: selectedItems.value.includes(record.id),
|
|
6242
6363
|
onChange: $event => (toggleSelectItem(record.id))
|
|
6243
|
-
}, null, 40 /* PROPS, NEED_HYDRATION */,
|
|
6364
|
+
}, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_31)
|
|
6244
6365
|
]))
|
|
6245
6366
|
: createCommentVNode("v-if", true),
|
|
6246
6367
|
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (key) => {
|
|
6247
6368
|
return (openBlock(), createElementBlock(Fragment, { key: key }, [
|
|
6248
6369
|
(showColumn(key))
|
|
6249
|
-
? (openBlock(), createElementBlock("td",
|
|
6370
|
+
? (openBlock(), createElementBlock("td", _hoisted_32, [
|
|
6250
6371
|
renderSlot(_ctx.$slots, getSlotName(key), {
|
|
6251
6372
|
row: record,
|
|
6252
6373
|
index: index
|
|
@@ -6254,37 +6375,37 @@ return (_ctx, _cache) => {
|
|
|
6254
6375
|
(typeof key === 'string' && __props.links && __props.links[key])
|
|
6255
6376
|
? (openBlock(), createBlock(_component_router_link, {
|
|
6256
6377
|
key: 0,
|
|
6257
|
-
target: __props.links[key].target ? '_blank':'',
|
|
6378
|
+
target: __props.links[key].target ? '_blank' : '',
|
|
6258
6379
|
to: replaceLinkUrl(__props.links[key], record),
|
|
6259
6380
|
class: normalizeClass(getLinkClass(__props.links[key])),
|
|
6260
6381
|
innerHTML: getData(record, key)
|
|
6261
6382
|
}, null, 8 /* PROPS */, ["target", "to", "class", "innerHTML"]))
|
|
6262
6383
|
: (getFieldType(key) === 'numeric')
|
|
6263
|
-
? (openBlock(), createElementBlock("span",
|
|
6384
|
+
? (openBlock(), createElementBlock("span", _hoisted_33, toDisplayString(Intl.NumberFormat().format(getData(record, key))), 1 /* TEXT */))
|
|
6264
6385
|
: (getFieldType(key) === 'money')
|
|
6265
|
-
? (openBlock(), createElementBlock("span",
|
|
6386
|
+
? (openBlock(), createElementBlock("span", _hoisted_34, toDisplayString(Intl.NumberFormat().format(getData(record, key))), 1 /* TEXT */))
|
|
6266
6387
|
: (getFieldType(key) === 'date')
|
|
6267
|
-
? (openBlock(), createElementBlock("span",
|
|
6388
|
+
? (openBlock(), createElementBlock("span", _hoisted_35, toDisplayString(formatDate(getData(record, key))), 1 /* TEXT */))
|
|
6268
6389
|
: (typeof key === 'string')
|
|
6269
6390
|
? (openBlock(), createElementBlock("span", {
|
|
6270
6391
|
key: 4,
|
|
6271
6392
|
innerHTML: getData(record, key)
|
|
6272
|
-
}, null, 8 /* PROPS */,
|
|
6393
|
+
}, null, 8 /* PROPS */, _hoisted_36))
|
|
6273
6394
|
: (typeof key === 'function')
|
|
6274
6395
|
? (openBlock(), createElementBlock("span", {
|
|
6275
6396
|
key: 5,
|
|
6276
6397
|
innerHTML: key(record, index)
|
|
6277
|
-
}, null, 8 /* PROPS */,
|
|
6398
|
+
}, null, 8 /* PROPS */, _hoisted_37))
|
|
6278
6399
|
: (typeof key === 'object' && key.callBack)
|
|
6279
6400
|
? (openBlock(), createElementBlock("span", {
|
|
6280
6401
|
key: 6,
|
|
6281
6402
|
innerHTML: key.callBack(record, index)
|
|
6282
|
-
}, null, 8 /* PROPS */,
|
|
6403
|
+
}, null, 8 /* PROPS */, _hoisted_38))
|
|
6283
6404
|
: (typeof key === 'object' && key.callback)
|
|
6284
6405
|
? (openBlock(), createElementBlock("span", {
|
|
6285
6406
|
key: 7,
|
|
6286
6407
|
innerHTML: key.callback(record, index)
|
|
6287
|
-
}, null, 8 /* PROPS */,
|
|
6408
|
+
}, null, 8 /* PROPS */, _hoisted_39))
|
|
6288
6409
|
: (typeof key === 'object' && key.component)
|
|
6289
6410
|
? (openBlock(), createBlock(resolveDynamicComponent(key.component), mergeProps({
|
|
6290
6411
|
key: 8,
|
|
@@ -6294,18 +6415,18 @@ return (_ctx, _cache) => {
|
|
|
6294
6415
|
? (openBlock(), createElementBlock("span", {
|
|
6295
6416
|
key: 9,
|
|
6296
6417
|
innerHTML: getData(record, key.key ?? key.field)
|
|
6297
|
-
}, null, 8 /* PROPS */,
|
|
6418
|
+
}, null, 8 /* PROPS */, _hoisted_40))
|
|
6298
6419
|
: (openBlock(), createElementBlock("span", {
|
|
6299
6420
|
key: 10,
|
|
6300
6421
|
innerHTML: getData(record, key[0])
|
|
6301
|
-
}, null, 8 /* PROPS */,
|
|
6422
|
+
}, null, 8 /* PROPS */, _hoisted_41))
|
|
6302
6423
|
])
|
|
6303
6424
|
]))
|
|
6304
6425
|
: createCommentVNode("v-if", true)
|
|
6305
6426
|
], 64 /* STABLE_FRAGMENT */))
|
|
6306
6427
|
}), 128 /* KEYED_FRAGMENT */)),
|
|
6307
6428
|
(__props.actions)
|
|
6308
|
-
? (openBlock(), createElementBlock("td",
|
|
6429
|
+
? (openBlock(), createElementBlock("td", _hoisted_42, [
|
|
6309
6430
|
createVNode(script$g, {
|
|
6310
6431
|
emitAction: doEmitAction,
|
|
6311
6432
|
actions: __props.actions,
|
|
@@ -6313,145 +6434,154 @@ return (_ctx, _cache) => {
|
|
|
6313
6434
|
}, null, 8 /* PROPS */, ["actions", "record"])
|
|
6314
6435
|
]))
|
|
6315
6436
|
: createCommentVNode("v-if", true)
|
|
6316
|
-
], 10 /* CLASS, PROPS */,
|
|
6437
|
+
], 10 /* CLASS, PROPS */, _hoisted_30))
|
|
6317
6438
|
}), 128 /* KEYED_FRAGMENT */))
|
|
6318
6439
|
: createCommentVNode("v-if", true)
|
|
6319
6440
|
])
|
|
6320
6441
|
], 2 /* CLASS */))
|
|
6321
|
-
: (
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6442
|
+
: (loading.value === 'done' && records.value.length > 0)
|
|
6443
|
+
? (openBlock(), createElementBlock("div", _hoisted_43, [
|
|
6444
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (record, index) => {
|
|
6445
|
+
return (openBlock(), createElementBlock("div", {
|
|
6446
|
+
key: record.id,
|
|
6447
|
+
class: "single-mobile-req bg-light p-3",
|
|
6448
|
+
onClick: $event => (rowSelected(record))
|
|
6449
|
+
}, [
|
|
6450
|
+
(activeMultiActions.value.length > 0)
|
|
6451
|
+
? (openBlock(), createElementBlock("div", {
|
|
6452
|
+
key: 0,
|
|
6453
|
+
class: "mb-2",
|
|
6454
|
+
onClick: _cache[6] || (_cache[6] = withModifiers(() => {}, ["stop"]))
|
|
6455
|
+
}, [
|
|
6456
|
+
createElementVNode("div", _hoisted_45, [
|
|
6457
|
+
createElementVNode("input", {
|
|
6458
|
+
type: "checkbox",
|
|
6459
|
+
class: "form-check-input",
|
|
6460
|
+
id: 'mobile-check-' + record.id,
|
|
6461
|
+
checked: selectedItems.value.includes(record.id),
|
|
6462
|
+
onChange: $event => (toggleSelectItem(record.id))
|
|
6463
|
+
}, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_46),
|
|
6464
|
+
createElementVNode("label", {
|
|
6465
|
+
class: "form-check-label",
|
|
6466
|
+
for: 'mobile-check-' + record.id
|
|
6467
|
+
}, "Select Item", 8 /* PROPS */, _hoisted_47)
|
|
6468
|
+
])
|
|
6469
|
+
]))
|
|
6470
|
+
: createCommentVNode("v-if", true),
|
|
6471
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (key) => {
|
|
6472
|
+
return (openBlock(), createElementBlock(Fragment, {
|
|
6473
|
+
key: key[0]
|
|
6328
6474
|
}, [
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
createElementVNode("label", {
|
|
6360
|
-
class: "form-check-label",
|
|
6361
|
-
for: 'mobile-check-'+record.id
|
|
6362
|
-
}, "Select Item", 8 /* PROPS */, _hoisted_48)
|
|
6363
|
-
])
|
|
6364
|
-
]))
|
|
6365
|
-
: createCommentVNode("v-if", true),
|
|
6366
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaders.value, (key) => {
|
|
6367
|
-
return (openBlock(), createElementBlock(Fragment, {
|
|
6368
|
-
key: key[0]
|
|
6369
|
-
}, [
|
|
6370
|
-
(showColumn(key))
|
|
6371
|
-
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6372
|
-
(typeof key === 'string' )
|
|
6373
|
-
? (openBlock(), createElementBlock("p", _hoisted_49, toDisplayString(getLabel(key)), 1 /* TEXT */))
|
|
6374
|
-
: (typeof key === 'function')
|
|
6375
|
-
? (openBlock(), createElementBlock("p", _hoisted_50, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
|
|
6376
|
-
: (typeof key === 'object')
|
|
6377
|
-
? (openBlock(), createElementBlock("p", _hoisted_51, toDisplayString(getLabel(key)), 1 /* TEXT */))
|
|
6378
|
-
: (openBlock(), createElementBlock("p", _hoisted_52, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
|
|
6379
|
-
createElementVNode("span", null, [
|
|
6380
|
-
renderSlot(_ctx.$slots, getSlotName(key), {
|
|
6381
|
-
row: record,
|
|
6382
|
-
index: index
|
|
6383
|
-
}, () => [
|
|
6384
|
-
(typeof key === 'string' && __props.links && __props.links[key])
|
|
6385
|
-
? (openBlock(), createBlock(_component_router_link, {
|
|
6386
|
-
key: 0,
|
|
6387
|
-
to: replaceLinkUrl(__props.links[key],record),
|
|
6388
|
-
class: normalizeClass(getLinkClass(__props.links[key])),
|
|
6475
|
+
(showColumn(key))
|
|
6476
|
+
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
6477
|
+
(typeof key === 'string')
|
|
6478
|
+
? (openBlock(), createElementBlock("p", _hoisted_48, toDisplayString(getLabel(key)), 1 /* TEXT */))
|
|
6479
|
+
: (typeof key === 'function')
|
|
6480
|
+
? (openBlock(), createElementBlock("p", _hoisted_49, toDisplayString(key(null).replace(/_/g, " ")), 1 /* TEXT */))
|
|
6481
|
+
: (typeof key === 'object')
|
|
6482
|
+
? (openBlock(), createElementBlock("p", _hoisted_50, toDisplayString(getLabel(key)), 1 /* TEXT */))
|
|
6483
|
+
: (openBlock(), createElementBlock("p", _hoisted_51, toDisplayString(key[1].replace(/_/g, " ")), 1 /* TEXT */)),
|
|
6484
|
+
createElementVNode("span", null, [
|
|
6485
|
+
renderSlot(_ctx.$slots, getSlotName(key), {
|
|
6486
|
+
row: record,
|
|
6487
|
+
index: index
|
|
6488
|
+
}, () => [
|
|
6489
|
+
(typeof key === 'string' && __props.links && __props.links[key])
|
|
6490
|
+
? (openBlock(), createBlock(_component_router_link, {
|
|
6491
|
+
key: 0,
|
|
6492
|
+
to: replaceLinkUrl(__props.links[key], record),
|
|
6493
|
+
class: normalizeClass(getLinkClass(__props.links[key])),
|
|
6494
|
+
innerHTML: getData(record, key)
|
|
6495
|
+
}, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
|
|
6496
|
+
: (getFieldType(key) === 'numeric')
|
|
6497
|
+
? (openBlock(), createElementBlock("span", _hoisted_52, toDisplayString(Intl.NumberFormat().format(getData(record, key))), 1 /* TEXT */))
|
|
6498
|
+
: (getFieldType(key) === 'money')
|
|
6499
|
+
? (openBlock(), createElementBlock("span", _hoisted_53, toDisplayString(Intl.NumberFormat().format(getData(record, key))), 1 /* TEXT */))
|
|
6500
|
+
: (getFieldType(key) === 'date')
|
|
6501
|
+
? (openBlock(), createElementBlock("span", _hoisted_54, toDisplayString(formatDate(getData(record, key))), 1 /* TEXT */))
|
|
6502
|
+
: (typeof key === 'string')
|
|
6503
|
+
? (openBlock(), createElementBlock("span", {
|
|
6504
|
+
key: 4,
|
|
6389
6505
|
innerHTML: getData(record, key)
|
|
6390
|
-
}, null, 8 /* PROPS */,
|
|
6391
|
-
: (
|
|
6392
|
-
? (openBlock(), createElementBlock("span",
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6506
|
+
}, null, 8 /* PROPS */, _hoisted_55))
|
|
6507
|
+
: (typeof key === 'object' && key.callBack)
|
|
6508
|
+
? (openBlock(), createElementBlock("span", {
|
|
6509
|
+
key: 5,
|
|
6510
|
+
innerHTML: key.callBack(record, index)
|
|
6511
|
+
}, null, 8 /* PROPS */, _hoisted_56))
|
|
6512
|
+
: (typeof key === 'object' && key.callback)
|
|
6513
|
+
? (openBlock(), createElementBlock("span", {
|
|
6514
|
+
key: 6,
|
|
6515
|
+
innerHTML: key.callback(record, index)
|
|
6516
|
+
}, null, 8 /* PROPS */, _hoisted_57))
|
|
6517
|
+
: (typeof key === 'object' && key.component)
|
|
6518
|
+
? (openBlock(), createBlock(resolveDynamicComponent(key.component), mergeProps({
|
|
6519
|
+
key: 7,
|
|
6520
|
+
item: record
|
|
6521
|
+
}, { ref_for: true }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
|
|
6522
|
+
: (typeof key === 'object')
|
|
6398
6523
|
? (openBlock(), createElementBlock("span", {
|
|
6399
|
-
key:
|
|
6400
|
-
innerHTML: getData(record, key)
|
|
6401
|
-
}, null, 8 /* PROPS */,
|
|
6402
|
-
: (typeof key === '
|
|
6524
|
+
key: 8,
|
|
6525
|
+
innerHTML: getData(record, key.key ?? key.field)
|
|
6526
|
+
}, null, 8 /* PROPS */, _hoisted_58))
|
|
6527
|
+
: (typeof key === 'function')
|
|
6403
6528
|
? (openBlock(), createElementBlock("span", {
|
|
6404
|
-
key:
|
|
6405
|
-
innerHTML: key
|
|
6406
|
-
}, null, 8 /* PROPS */,
|
|
6407
|
-
: (
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
]))
|
|
6446
|
-
: createCommentVNode("v-if", true)
|
|
6447
|
-
], 8 /* PROPS */, _hoisted_45))
|
|
6448
|
-
}), 128 /* KEYED_FRAGMENT */))
|
|
6529
|
+
key: 9,
|
|
6530
|
+
innerHTML: key(record, index)
|
|
6531
|
+
}, null, 8 /* PROPS */, _hoisted_59))
|
|
6532
|
+
: (openBlock(), createElementBlock("span", {
|
|
6533
|
+
key: 10,
|
|
6534
|
+
innerHTML: getData(record, key[0])
|
|
6535
|
+
}, null, 8 /* PROPS */, _hoisted_60))
|
|
6536
|
+
])
|
|
6537
|
+
])
|
|
6538
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
6539
|
+
: createCommentVNode("v-if", true),
|
|
6540
|
+
_cache[19] || (_cache[19] = createElementVNode("hr", { class: "my-2" }, null, -1 /* CACHED */))
|
|
6541
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
6542
|
+
}), 128 /* KEYED_FRAGMENT */)),
|
|
6543
|
+
(__props.actions)
|
|
6544
|
+
? (openBlock(), createElementBlock("div", _hoisted_61, [
|
|
6545
|
+
createVNode(script$g, {
|
|
6546
|
+
emitAction: doEmitAction,
|
|
6547
|
+
actions: __props.actions,
|
|
6548
|
+
record: record
|
|
6549
|
+
}, null, 8 /* PROPS */, ["actions", "record"])
|
|
6550
|
+
]))
|
|
6551
|
+
: createCommentVNode("v-if", true)
|
|
6552
|
+
], 8 /* PROPS */, _hoisted_44))
|
|
6553
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
6554
|
+
]))
|
|
6555
|
+
: (openBlock(), createElementBlock("div", _hoisted_62, [
|
|
6556
|
+
(loading.value === 'loading')
|
|
6557
|
+
? (openBlock(), createElementBlock("div", _hoisted_63, [...(_cache[20] || (_cache[20] = [
|
|
6558
|
+
createElementVNode("div", { class: "text-center" }, [
|
|
6559
|
+
createElementVNode("div", {
|
|
6560
|
+
class: "spinner-border",
|
|
6561
|
+
role: "status"
|
|
6562
|
+
}, [
|
|
6563
|
+
createElementVNode("span", { class: "visually-hidden" }, "Loading...")
|
|
6564
|
+
])
|
|
6565
|
+
], -1 /* CACHED */)
|
|
6566
|
+
]))]))
|
|
6567
|
+
: (loading.value === 'error')
|
|
6568
|
+
? (openBlock(), createElementBlock("div", _hoisted_64, [
|
|
6569
|
+
createElementVNode("span", null, toDisplayString(loading_error.value), 1 /* TEXT */)
|
|
6449
6570
|
]))
|
|
6450
|
-
:
|
|
6451
|
-
|
|
6452
|
-
|
|
6571
|
+
: (loading.value === 'done' && records.value.length === 0)
|
|
6572
|
+
? (openBlock(), createElementBlock("div", _hoisted_65, [
|
|
6573
|
+
(hasEmptySlot.value)
|
|
6574
|
+
? renderSlot(_ctx.$slots, "empty", { key: 0 })
|
|
6575
|
+
: (openBlock(), createElementBlock("div", _hoisted_66, [...(_cache[21] || (_cache[21] = [
|
|
6576
|
+
createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* CACHED */),
|
|
6577
|
+
createTextVNode(" No records found ", -1 /* CACHED */)
|
|
6578
|
+
]))]))
|
|
6579
|
+
]))
|
|
6580
|
+
: createCommentVNode("v-if", true)
|
|
6581
|
+
])),
|
|
6582
|
+
(pagination_data.value && (records.value.length > 0 || !hasEmptySlot.value || filter_value.value.length > 0))
|
|
6453
6583
|
? (openBlock(), createBlock(script$e, {
|
|
6454
|
-
key:
|
|
6584
|
+
key: 7,
|
|
6455
6585
|
onLoadMoreRecords: loadMoreRecords,
|
|
6456
6586
|
"hide-load-more": __props.hideLoadMore,
|
|
6457
6587
|
"per-page": per_page.value,
|
|
@@ -6462,7 +6592,7 @@ return (_ctx, _cache) => {
|
|
|
6462
6592
|
}, null, 8 /* PROPS */, ["hide-load-more", "per-page", "hide-count", "pagination_data", "pagination-style"]))
|
|
6463
6593
|
: createCommentVNode("v-if", true),
|
|
6464
6594
|
(__props.actions)
|
|
6465
|
-
? (openBlock(true), createElementBlock(Fragment, { key:
|
|
6595
|
+
? (openBlock(true), createElementBlock(Fragment, { key: 8 }, renderList(__props.actions.actions, (action) => {
|
|
6466
6596
|
return (openBlock(), createElementBlock(Fragment, {
|
|
6467
6597
|
key: action.label
|
|
6468
6598
|
}, [
|
|
@@ -6489,14 +6619,14 @@ return (_ctx, _cache) => {
|
|
|
6489
6619
|
], 64 /* STABLE_FRAGMENT */))
|
|
6490
6620
|
}), 128 /* KEYED_FRAGMENT */))
|
|
6491
6621
|
: createCommentVNode("v-if", true),
|
|
6492
|
-
(selectedItems.value.length > 0)
|
|
6493
|
-
? (openBlock(), createElementBlock("div",
|
|
6622
|
+
(selectedItems.value.length > 0 && activeMultiActions.value.length > 0)
|
|
6623
|
+
? (openBlock(), createElementBlock("div", _hoisted_67, [
|
|
6494
6624
|
createElementVNode("div", null, [
|
|
6495
|
-
createElementVNode("span",
|
|
6496
|
-
_cache[
|
|
6625
|
+
createElementVNode("span", _hoisted_68, toDisplayString(selectedItems.value.length), 1 /* TEXT */),
|
|
6626
|
+
_cache[22] || (_cache[22] = createTextVNode(" items selected ", -1 /* CACHED */))
|
|
6497
6627
|
]),
|
|
6498
|
-
createElementVNode("div",
|
|
6499
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
6628
|
+
createElementVNode("div", _hoisted_69, [
|
|
6629
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(activeMultiActions.value, (action) => {
|
|
6500
6630
|
return (openBlock(), createElementBlock("button", {
|
|
6501
6631
|
key: action.label,
|
|
6502
6632
|
class: normalizeClass(["btn btn-sm", action.class ?? 'btn-outline-primary']),
|
|
@@ -6509,12 +6639,12 @@ return (_ctx, _cache) => {
|
|
|
6509
6639
|
}, null, 2 /* CLASS */))
|
|
6510
6640
|
: createCommentVNode("v-if", true),
|
|
6511
6641
|
createTextVNode(" " + toDisplayString(action.label), 1 /* TEXT */)
|
|
6512
|
-
], 10 /* CLASS, PROPS */,
|
|
6642
|
+
], 10 /* CLASS, PROPS */, _hoisted_70))
|
|
6513
6643
|
}), 128 /* KEYED_FRAGMENT */)),
|
|
6514
6644
|
createElementVNode("button", {
|
|
6515
6645
|
class: "btn btn-sm btn-light",
|
|
6516
6646
|
onClick: _cache[7] || (_cache[7] = $event => (selectedItems.value = []))
|
|
6517
|
-
}, "Cancel")
|
|
6647
|
+
}, " Cancel ")
|
|
6518
6648
|
])
|
|
6519
6649
|
]))
|
|
6520
6650
|
: createCommentVNode("v-if", true)
|