@dolusoft/vue3-datatable 1.1.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Bhavesh Patel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,191 @@
1
+ # @bhplugin/vue3-datatable
2
+
3
+ ## Example
4
+
5
+ [Document & Demos](https://vue3-datatable-document.vercel.app)
6
+
7
+ ## Install
8
+
9
+ #### NPM
10
+
11
+ ```bash
12
+ npm install @bhplugin/vue3-datatable --save
13
+ ```
14
+
15
+ #### Yarn
16
+
17
+ ```bash
18
+ yarn add @bhplugin/vue3-datatable
19
+ ```
20
+
21
+ #### Bower
22
+
23
+ ```bash
24
+ bower install @bhplugin/vue3-datatable --save
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```html
30
+ <template>
31
+ <vue3-datatable :rows="rows" :columns="cols"> </vue3-datatable>
32
+ </template>
33
+
34
+ <script setup lang="ts">
35
+ import { ref } from "vue";
36
+ import Vue3Datatable from "@bhplugin/vue3-datatable";
37
+ import "@bhplugin/vue3-datatable/dist/style.css";
38
+
39
+ const cols = ref([
40
+ { field: "id", title: "ID", width: "90px", filter: false },
41
+ { field: "name", title: "Name" },
42
+ { field: "username", title: "Username" },
43
+ { field: "email", title: "Email" },
44
+ { field: "phone", title: "Phone" },
45
+ { field: "date", title: "Date", type: "date" },
46
+ { field: "active", title: "Active", type: "bool" },
47
+ { field: "age", title: "Age", type: "number" },
48
+ { field: "address.city", title: "Address" },
49
+ { field: "company.name", title: "Company" },
50
+ ]);
51
+
52
+ const rows = ref([
53
+ {
54
+ id: 1,
55
+ name: "Leanne Graham",
56
+ username: "Bret",
57
+ email: "Sincere@april.biz",
58
+ address: {
59
+ street: "Kulas Light",
60
+ suite: "Apt. 556",
61
+ city: "Gwenborough",
62
+ zipcode: "92998-3874",
63
+ geo: {
64
+ lat: "-37.3159",
65
+ lng: "81.1496",
66
+ },
67
+ },
68
+ phone: "1-770-736-8031 x56442",
69
+ website: "hildegard.org",
70
+ company: {
71
+ name: "Romaguera-Crona",
72
+ catchPhrase: "Multi-layered client-server neural-net",
73
+ bs: "harness real-time e-markets",
74
+ },
75
+ date: "Tue Sep 27 2022 22:19:57",
76
+ age: 10,
77
+ active: true,
78
+ },
79
+ .......
80
+ ]);
81
+ </script>
82
+ ```
83
+
84
+ ## Props
85
+
86
+ | Props | Type | Default | Description |
87
+ | ----------------------- | :---------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
+ | **columns** (required) | array<colDef> | [] | table columns |
89
+ | **rows** (required) | array<any> | [] | table rows |
90
+ | **isServerMode** | boolean | false | set **_true_** if you need server side pagination. |
91
+ | **totalRows** | number | 0 | total number of rows. **_totalRows_** required when **_isServerMode_** is true |
92
+ | **skin** | string | "bh-table-striped bh-table-hover" | custom class for skin ('**_bh-table-striped_**' - for stripe row, '**_bh-table-hover_**' - for hover row, '**_bh-table-bordered_**' - for bordered row, '**_bh-table-compact_**' - for compact table) |
93
+ | **loading** | boolean | false | enable loader |
94
+ | **hasCheckbox** | boolean | false | enable checkbox |
95
+ | **search** | string | "" | enable global search |
96
+ | **page** | number | 1 | current page |
97
+ | **pageSize** | number | 10 | number of rows per page |
98
+ | **pageSizeOptions** | array<number> | [10, 20, 30, 50, 100] | pagesize options |
99
+ | **showPageSize** | boolean | true | enable pagesize options |
100
+ | **rowClass** | array<string>, function | "" | custom row class |
101
+ | **cellClass** | array<string>, function | "" | custom cell class |
102
+ | **sortable** | boolean | true | enable sorting |
103
+ | **sortColumn** | string | "id" | name of sort column |
104
+ | **sortDirection** | string | "asc" | sort direction (asc or desc) |
105
+ | **columnFilter** | boolean | false | enable individual column filter |
106
+ | **columnFilterLang** | records<string,string> | null | columns filters translation (**ex**: {no_filter: 'Aucun', contain: 'Contiens', not_contain: 'Ne contiens pas', equal: 'Egale', not_equal: 'Différent', start_with: 'Commence par', end_with: 'Termine par', greater_than: 'Supérieur à', greater_than_equal: 'Sup. ou égale à', less_than: 'Inférieur à', less_than_equal: 'Inf. ou égale à', is_null: 'Est null', is_not_null: 'Non null'} ) |
107
+ | **pagination** | boolean | true | enable pagination |
108
+ | **showNumbers** | boolean | true | enable numbers pagination |
109
+ | **showNumbersCount** | number | 5 | show numbers of count in pagination |
110
+ | **showFirstPage** | boolean | true | enable first page in pagination |
111
+ | **showLastPage** | boolean | true | enable last page in pagination |
112
+ | **firstArrow** | string | default arrow | custom first page arrow |
113
+ | **lastArrow** | string | default arrow | custom last page arrow |
114
+ | **previousArrow** | string | default arrow | custom previous page arrow |
115
+ | **nextArrow** | string | default arrow | custom next page arrow |
116
+ | **paginationInfo** | string | "Showing {0} to {1} of {2} entries" | custom pagination info |
117
+ | **noDataContent** | string | No data available | custom no data message |
118
+ | **stickyHeader** | boolean | false | enable fixed header |
119
+ | **height** | string | 450px | only will be used when stickyHeader enabled |
120
+ | **stickyFirstColumn** | boolean | false | enable fixed first column |
121
+ | **cloneHeaderInFooter** | boolean | false | enable clone header in footer |
122
+ | **selectRowOnClick** | boolean | false | enable to select row(checkbox) on row click |
123
+
124
+ ## Columns options
125
+
126
+ | Props | Type | Default | Description |
127
+ | ---------------- | :--------------- | --------- | ----------------------------------------------------- |
128
+ | **isUnique** | boolean | false | db column is primary key or not |
129
+ | **field** | string | "" | db column name |
130
+ | **title** | string | "" | display column name |
131
+ | **value** | string | "" | filter value if filter enabled |
132
+ | **condition** | string | "contain" | default condition for column filter if filter enabled |
133
+ | **type** | string | "" | column type (string, date, number, bool) |
134
+ | **width** | string | "" | custom width of column |
135
+ | **minWidth** | string | "" | custom minimum width of column |
136
+ | **maxWidth** | string | "" | custom maximum width of column |
137
+ | **hide** | boolean | false | show/hide column |
138
+ | **filter** | boolean | true | enable column filter |
139
+ | **search** | boolean | true | enabled global search |
140
+ | **sort** | boolean | true | enable sorting |
141
+ | **cellRenderer** | function, string | true | custom cell rendering |
142
+ | **headerClass** | string | "" | custom header cell class |
143
+ | **cellClass** | string | "" | custom cell class |
144
+
145
+ ## Events
146
+
147
+ | Name | Description |
148
+ | ------------------ | --------------------------------------------- |
149
+ | **sortChange** | will trigger when sorting changed |
150
+ | **searchChange** | will trigger when search changed |
151
+ | **pageChange** | will trigger when page changed |
152
+ | **pageSizeChange** | will trigger when pagesize changed |
153
+ | **rowSelect** | will trigger when row selected using checkbox |
154
+ | **filterChange** | will trigger when column filter changed |
155
+ | **rowClick** | will trigger when row clicked |
156
+ | **rowDBClick** | will trigger when row double clicked |
157
+
158
+ ## Methods
159
+
160
+ | Name | Description |
161
+ | ------------------------ | ---------------------------------------------------------------------------- |
162
+ | **reset** | will reset all options like selected rows, filter, search, currennt page etc |
163
+ | **getFilteredRows** | will returns all filtered rows |
164
+ | **getColumnFilters** | will return all column filters |
165
+ | **getSelectedRows** | will returns all selected rows |
166
+ | **clearSelectedRows** | will unselect all selected rows |
167
+ | **selectRow(index)** | will select row with the given index (non-existent row will be ignored) |
168
+ | **unselectRow(index)** | will unselect row with the given index (non-existent row will be ignored) |
169
+ | **isRowSelected(index)** | will return true if the row with given index is selected |
170
+
171
+ <br/>
172
+
173
+ ## License
174
+
175
+ **_@bhplugin/vue3-datatable_** is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
176
+
177
+ <br/>
178
+
179
+ ## **Our other plugins**
180
+
181
+ <br/>
182
+
183
+ ### Angular Datatable - [**@bhplugin/ng-datatable**](https://www.npmjs.com/package/@bhplugin/ng-datatable)
184
+
185
+ <br/>
186
+
187
+ ## Support
188
+
189
+ <a target="_blank" href="https://www.buymeacoffee.com/bhplugin">
190
+ <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60">
191
+ </a>
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
Binary file
package/dist/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import Vue3Datatable from "./custom-table.vue";
2
+ export default Vue3Datatable;
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ *,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }*,:after,:before{border:0 solid #0000;box-sizing:border-box}.bh-table-responsive{position:relative;width:100%;overflow:auto;border-radius:.25rem}.bh-table-responsive table{width:100%;max-width:100%;border-collapse:collapse!important}.bh-table-responsive table tfoot tr,.bh-table-responsive table thead tr{--tw-bg-opacity:1;background-color:rgb(246 247 250/var(--tw-bg-opacity))}.bh-table-responsive table tbody tr td,.bh-table-responsive table tfoot tr th,.bh-table-responsive table thead tr th{padding:.75rem 1rem;text-align:left}.bh-table-responsive table tfoot tr th,.bh-table-responsive table thead tr th{vertical-align:top;font-weight:700}.bh-table-responsive table tbody tr{border-bottom-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(246 247 250/var(--tw-border-opacity))}.bh-table-responsive table.bh-table-striped tbody tr:nth-child(odd){background-color:#e0e6ed26}.bh-table-responsive table.bh-table-hover tbody tr:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bh-table-responsive table.bh-table-compact tbody tr td,.bh-table-responsive table.bh-table-compact thead tr th{padding:.5rem .75rem}.bh-table-responsive table.bh-table-bordered tbody tr td,.bh-table-responsive table.bh-table-bordered thead tr th{border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(246 247 250/var(--tw-border-opacity))}.bh-pagination .bh-page-item{display:grid;height:2rem;width:2rem;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;place-content:center;border-radius:9999px;border:1px solid #0e17264d;--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));padding:.375rem .625rem;--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity));outline-width:0}.bh-pagination .bh-page-item:hover{--tw-border-opacity:1;border-color:rgb(67 97 238/var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(67 97 238/var(--tw-bg-opacity));--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity));transition-duration:.2s}.bh-pagination .bh-page-item{-webkit-appearance:button;background-image:none}.bh-pagination .bh-page-item.disabled:not(.bh-active){pointer-events:none;opacity:.5}.bh-pagination .bh-page-item.bh-active{--tw-border-opacity:1;border-color:rgb(67 97 238/var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(67 97 238/var(--tw-bg-opacity));--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.bh-table-responsive button,.bh-table-responsive input{outline:2px solid #0000;outline-offset:2px}.bh-pagination-info .bh-pagesize{box-sizing:border-box;border-radius:.25rem;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(224 230 237/var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));padding:.375rem .5rem;font-weight:400;--tw-text-opacity:1;color:rgb(14 23 38/var(--tw-text-opacity));outline-width:0}.bh-pagination-info .bh-pagesize:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:#e0e6ed66}.bh-table-responsive table th .bh-filter{margin-top:.125rem;display:flex;height:30px;align-items:center}.bh-table-responsive table th .bh-filter,.bh-table-responsive table th .bh-filter>.bh-form-control{width:100%}.bh-table-responsive table th .bh-filter>.bh-form-control{box-sizing:border-box;height:100%;min-width:60px;border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(224 230 237/var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));padding:.25rem .75rem;font-size:.875rem;line-height:1.25rem;font-weight:400;--tw-text-opacity:1;color:rgb(14 23 38/var(--tw-text-opacity));outline-width:0}.bh-table-responsive table th .bh-filter>.bh-form-control:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:#e0e6ed66}.bh-table-responsive table th .bh-filter>select{border-radius:.25rem}.bh-table-responsive table th .bh-filter>button{display:grid;height:30px;width:30px;flex-shrink:0;cursor:pointer;place-content:center;border-top-right-radius:.25rem;border-bottom-right-radius:.25rem;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(224 230 237/var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(224 230 237/var(--tw-bg-opacity));color:#0e1726b3}.bh-table-responsive table th .bh-filter>button:hover{color:#0e1726e6}.bh-table-responsive table th .bh-filter>button{-webkit-appearance:button;background-image:none}.bh-filter-menu button{display:flex;width:100%;cursor:pointer;border:1px solid #0000;background-color:rgb(255 255 255/var(--tw-bg-opacity));padding:.375rem 1rem;text-align:left}.bh-filter-menu button,.bh-filter-menu button:hover{--tw-bg-opacity:1}.bh-filter-menu button:hover{background-color:rgb(243 244 246/var(--tw-bg-opacity));font-weight:700}.bh-filter-menu button{-webkit-appearance:button;background-image:none}.bh-filter-menu button.active{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity));font-weight:700}.bh-table-responsive input[type=checkbox]{position:absolute;opacity:0}.bh-table-responsive input[type=checkbox],.bh-table-responsive input[type=checkbox]+div{height:1.25rem;width:1.25rem}.bh-table-responsive input[type=checkbox]+div{display:grid;place-content:center;border-radius:.25rem;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(224 230 237/var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bh-table-responsive input[type=checkbox]+div svg{pointer-events:none;display:none;height:.75rem;width:.75rem;fill:currentColor;--tw-text-opacity:1;color:rgb(67 97 238/var(--tw-text-opacity))}.bh-table-responsive input[type=checkbox]:checked+div,.bh-table-responsive input[type=checkbox]:indeterminate+div{--tw-border-opacity:1;border-color:rgb(67 97 238/var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(67 97 238/var(--tw-bg-opacity))}.bh-table-responsive input[type=checkbox]:checked+div svg.check,.bh-table-responsive input[type=checkbox]:indeterminate+div svg.intermediate{display:flex;--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.bh-pointer-events-none{pointer-events:none}.bh-absolute{position:absolute}.bh-relative{position:relative}.bh-sticky{position:sticky}.bh-inset-0{inset:0}.bh-bottom-0{bottom:0}.bh-left-0{left:0}.bh-left-\[52px\]{left:52px}.bh-right-0{right:0}.bh-top-0{top:0}.bh-top-full{top:100%}.bh-z-10{z-index:10}.bh-z-\[1\]{z-index:1}.bh-mb-2{margin-bottom:.5rem}.bh-ml-3{margin-left:.75rem}.bh-mr-2{margin-right:.5rem}.bh-mt-1{margin-top:.25rem}.bh-flex{display:flex}.bh-inline-flex{display:inline-flex}.bh-grid{display:grid}.bh-h-11{height:2.75rem}.bh-h-8{height:2rem}.bh-min-h-\[300px\]{min-height:300px}.bh-w-32{width:8rem}.bh-w-4{width:1rem}.bh-w-px{width:1px}.bh-cursor-pointer{cursor:pointer}.bh-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bh-flex-col{flex-direction:column}.bh-flex-wrap{flex-wrap:wrap}.bh-place-content-center{place-content:center}.bh-items-center{align-items:center}.bh-gap-4{gap:1rem}.bh-space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.25rem*var(--tw-space-x-reverse));margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)))}.bh-overflow-hidden{overflow:hidden}.bh-rounded{border-radius:.25rem}.bh-rounded-md{border-radius:.375rem}.bh-border{border-width:1px}.bh-border-solid{border-style:solid}.\!bh-border-transparent{border-color:#0000!important}.bh-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.\!bh-bg-white{--tw-bg-opacity:1!important;background-color:rgb(255 255 255/var(--tw-bg-opacity))!important}.bh-bg-blue-light{--tw-bg-opacity:1;background-color:rgb(246 247 250/var(--tw-bg-opacity))}.bh-bg-blue-light\/50{background-color:#f6f7fa80}.bh-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.\!bh-p-0{padding:0!important}.bh-p-10{padding:2.5rem}.bh-p-2{padding:.5rem}.bh-py-5{padding-top:1.25rem;padding-bottom:1.25rem}.bh-text-\[13px\]{font-size:13px}.bh-text-sm{font-size:.875rem;line-height:1.25rem}.bh-font-normal{font-weight:400}.\!bh-text-primary{--tw-text-opacity:1!important;color:rgb(67 97 238/var(--tw-text-opacity))!important}.bh-text-black{--tw-text-opacity:1;color:rgb(14 23 38/var(--tw-text-opacity))}.bh-text-black\/20{color:#0e172633}.bh-text-primary{--tw-text-opacity:1;color:rgb(67 97 238/var(--tw-text-opacity))}.bh-antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bh-shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.bh-outline-0{outline-width:0}.bh-filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.bh-skeleton-box{position:relative;width:100%;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bh-skeleton-box:after{position:absolute;inset:0;--tw-translate-x:-100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));animation:bhshimmer 2s infinite;background-image:linear-gradient(90deg,#0000,rgba(0,0,0,.025) 20%,#0000000d 50%,#0000);--tw-content:"";content:var(--tw-content)}@keyframes bhshimmer{to{transform:translateX(100%)}}.focus\:bh-border-gray-200:focus{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}@media (min-width:640px){.sm\:bh-ml-auto{margin-left:auto}.sm\:bh-flex-row{flex-direction:row}}
@@ -0,0 +1 @@
1
+ "use strict";const t="";module.exports=t;
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),we={class:"bh-filter-menu bh-absolute bh-z-[1] bh-bg-white bh-shadow-md bh-rounded-md bh-top-full bh-right-0 bh-w-32 bh-mt-1"},Be=["onClick"],Ee=e.defineComponent({__name:"column-filter",props:["column","columnFilterLang"],emits:["close","filterChange"],setup(k,{emit:p}){const l=k;e.onBeforeUnmount(()=>{document.removeEventListener("click",n)}),e.onMounted(()=>{document.addEventListener("click",n)});const n=()=>{p("close")},h=y=>{l.column.condition=y,y===""&&(l.column.value=""),p("filterChange",l.column)};return(y,a)=>{var c,z,d,A,B,R,_,b,$,E,F,T,N,q,V,H,O,g,w;return e.openBlock(),e.createElementBlock("div",we,[e.createElementVNode("div",{class:"bh-text-[13px] bh-font-normal bh-rounded bh-overflow-hidden",onClick:e.withModifiers(n,["stop"])},[e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition===""}),onClick:a[0]||(a[0]=v=>h(""))},e.toDisplayString((c=l.columnFilterLang&&l.columnFilterLang.no_filter)!=null?c:"No filter"),3),l.column.type==="string"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="contain"}),onClick:a[1]||(a[1]=v=>h("contain"))},e.toDisplayString((z=l.columnFilterLang&&l.columnFilterLang.contain)!=null?z:"Contain"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="not_contain"}),onClick:a[2]||(a[2]=v=>h("not_contain"))},e.toDisplayString((d=l.columnFilterLang&&l.columnFilterLang.not_contain)!=null?d:"Not contain"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="equal"}),onClick:a[3]||(a[3]=v=>h("equal"))},e.toDisplayString((A=l.columnFilterLang&&l.columnFilterLang.equal)!=null?A:"Equal"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="not_equal"}),onClick:a[4]||(a[4]=v=>h("not_equal"))},e.toDisplayString((B=l.columnFilterLang&&l.columnFilterLang.not_equal)!=null?B:"Not equal"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="start_with"}),onClick:a[5]||(a[5]=v=>h("start_with"))},e.toDisplayString((R=l.columnFilterLang&&l.columnFilterLang.start_with)!=null?R:"Starts with"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="end_with"}),onClick:a[6]||(a[6]=v=>h("end_with"))},e.toDisplayString((_=l.columnFilterLang&&l.columnFilterLang.end_with)!=null?_:"Ends with"),3)],64)):l.column.type==="number"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="equal"}),onClick:a[7]||(a[7]=v=>h("equal"))},e.toDisplayString((b=l.columnFilterLang&&l.columnFilterLang.equal)!=null?b:"Equal"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="not_equal"}),onClick:a[8]||(a[8]=v=>h("not_equal"))},e.toDisplayString(($=l.columnFilterLang&&l.columnFilterLang.not_equal)!=null?$:"Not equal"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="greater_than"}),onClick:a[9]||(a[9]=v=>h("greater_than"))},e.toDisplayString((E=l.columnFilterLang&&l.columnFilterLang.greater_than)!=null?E:"Greater than"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="greater_than_equal"}),onClick:a[10]||(a[10]=v=>h("greater_than_equal"))},e.toDisplayString((F=l.columnFilterLang&&l.columnFilterLang.greater_than_equal)!=null?F:"Greater than or equal"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="less_than"}),onClick:a[11]||(a[11]=v=>h("less_than"))},e.toDisplayString((T=l.columnFilterLang&&l.columnFilterLang.less_than)!=null?T:"Less than"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="less_than_equal"}),onClick:a[12]||(a[12]=v=>h("less_than_equal"))},e.toDisplayString((N=l.columnFilterLang&&l.columnFilterLang.less_than_equal)!=null?N:"Less than or equal"),3)],64)):l.column.type==="date"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="equal"}),onClick:a[13]||(a[13]=v=>h("equal"))},e.toDisplayString((q=l.columnFilterLang&&l.columnFilterLang.equal)!=null?q:"Equal"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="not_equal"}),onClick:a[14]||(a[14]=v=>h("not_equal"))},e.toDisplayString((V=l.columnFilterLang&&l.columnFilterLang.not_equal)!=null?V:"Not equal"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="greater_than"}),onClick:a[15]||(a[15]=v=>h("greater_than"))},e.toDisplayString((H=l.columnFilterLang&&l.columnFilterLang.greater_than)!=null?H:"Greater than"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="less_than"}),onClick:a[16]||(a[16]=v=>h("less_than"))},e.toDisplayString((O=l.columnFilterLang&&l.columnFilterLang.less_than)!=null?O:"Less than"),3)],64)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="is_null"}),onClick:a[17]||(a[17]=v=>h("is_null"))},e.toDisplayString((g=l.columnFilterLang&&l.columnFilterLang.is_null)!=null?g:"Is null"),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass({active:l.column.condition==="is_not_null"}),onClick:a[18]||(a[18]=v=>h("is_not_null"))},e.toDisplayString((w=l.columnFilterLang&&l.columnFilterLang.is_not_null)!=null?w:"Not null"),3)],8,Be)])}}}),I=(k,p)=>{const l=k.__vccOpts||k;for(const[n,h]of p)l[n]=h;return l},Fe={},Ne={version:"1.1",viewBox:"0 0 17 12",xmlns:"http://www.w3.org/2000/svg"},Se=e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("g",{transform:"translate(-9 -11)",fill:"currentColor","fill-rule":"nonzero"},[e.createElementVNode("path",{d:"m25.576 11.414c0.56558 0.55188 0.56558 1.4439 0 1.9961l-9.404 9.176c-0.28213 0.27529-0.65247 0.41385-1.0228 0.41385-0.37034 0-0.74068-0.13855-1.0228-0.41385l-4.7019-4.588c-0.56584-0.55188-0.56584-1.4442 0-1.9961 0.56558-0.55214 1.4798-0.55214 2.0456 0l3.679 3.5899 8.3812-8.1779c0.56558-0.55214 1.4798-0.55214 2.0456 0z"})])],-1),Ve=[Se];function Le(k,p){return e.openBlock(),e.createElementBlock("svg",Ne,Ve)}const re=I(Fe,[["render",Le]]),ze={},xe={viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor","stroke-width":"3",fill:"none","stroke-linecap":"round","stroke-linejoin":"round",class:"css-i6dzq1"},$e=e.createElementVNode("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1),Me=[$e];function qe(k,p){return e.openBlock(),e.createElementBlock("svg",xe,Me)}const De=I(ze,[["render",qe]]),Ae={},Re={viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor","stroke-width":"1.5",fill:"none","stroke-linecap":"round","stroke-linejoin":"round",class:"css-i6dzq1"},Te=e.createElementVNode("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"},null,-1),He=[Te];function Oe(k,p){return e.openBlock(),e.createElementBlock("svg",Re,He)}const Pe=I(Ae,[["render",Oe]]),Ue={key:"hdrrow"},Ie={class:"bh-checkbox"},Ge=["onClick"],Ke={width:"16",height:"16",viewBox:"0 0 14 14",fill:"none"},Je={key:0,class:"bh-filter bh-relative"},We=["onUpdate:modelValue"],Ye=["onUpdate:modelValue"],Qe=["onUpdate:modelValue"],Xe=["onUpdate:modelValue"],Ze=e.createElementVNode("option",{value:void 0},"All",-1),je=e.createElementVNode("option",{value:!0},"True",-1),et=e.createElementVNode("option",{value:!1},"False",-1),tt=[Ze,je,et],lt=["onClick"],ae=e.defineComponent({__name:"column-header",props:["all","currentSortColumn","currentSortDirection","isOpenFilter","isFooter","checkAll","columnFilterLang"],emits:["selectAll","sortChange","filterChange","toggleFilterMenu"],setup(k,{emit:p}){const l=k,n=e.ref(null),h=()=>{n.value&&(n.value.indeterminate=l.checkAll!==0?!l.checkAll:!1,n.value.checked=l.checkAll)};return e.watch(()=>l.checkAll,h),(y,a)=>(e.openBlock(),e.createElementBlock("tr",Ue,[l.all.hasCheckbox?(e.openBlock(),e.createElementBlock("th",{key:"chkall",class:e.normalizeClass(["bh-w-px",{"bh-sticky bh-bg-blue-light bh-z-[1]":l.all.stickyHeader||l.all.stickyFirstColumn,"bh-top-0":l.all.stickyHeader,"bh-left-0":l.all.stickyFirstColumn}])},[e.createElementVNode("div",Ie,[e.createElementVNode("input",{ref_key:"selectedAll",ref:n,type:"checkbox",onClick:a[0]||(a[0]=e.withModifiers(c=>p("selectAll",c.target.checked),["stop"]))},null,512),e.createElementVNode("div",null,[e.createVNode(re,{class:"check"}),e.createVNode(De,{class:"intermediate"})])])],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.all.columns,(c,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[c.hide?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("th",{key:c.field,class:e.normalizeClass(["bh-select-none bh-z-[1]",[l.all.sortable&&c.sort?"bh-cursor-pointer":"",z===0&&l.all.stickyFirstColumn?"bh-sticky bh-left-0 bh-bg-blue-light":"",l.all.hasCheckbox&&z===0&&l.all.stickyFirstColumn?"bh-left-[52px]":""]]),style:e.normalizeStyle({width:c.width,"min-width":c.minWidth,"max-width":c.maxWidth})},[e.createElementVNode("div",{class:e.normalizeClass(["bh-flex bh-items-center",[c.headerClass?c.headerClass:""]]),onClick:d=>l.all.sortable&&c.sort&&p("sortChange",c.field)},[e.createTextVNode(e.toDisplayString(c.title)+" ",1),l.all.sortable&&c.sort?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["bh-ml-3 bh-sort bh-flex bh-items-center",[l.currentSortColumn,l.currentSortDirection]])},[(e.openBlock(),e.createElementBlock("svg",Ke,[e.createElementVNode("polygon",{points:"3.11,6.25 10.89,6.25 7,1.75 ",fill:"currentColor",class:e.normalizeClass(["bh-text-black/20",[k.currentSortColumn===c.field&&k.currentSortDirection==="asc"?"!bh-text-primary":""]])},null,2),e.createElementVNode("polygon",{points:"7,12.25 10.89,7.75 3.11,7.75 ",fill:"currentColor",class:e.normalizeClass(["bh-text-black/20",[k.currentSortColumn===c.field&&k.currentSortDirection==="desc"?"!bh-text-primary":""]])},null,2)]))],2)):e.createCommentVNode("",!0)],10,Ge),l.all.columnFilter&&!l.isFooter?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c.filter?(e.openBlock(),e.createElementBlock("div",Je,[c.type==="string"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":d=>c.value=d,type:"text",class:"bh-form-control",onKeyup:a[1]||(a[1]=d=>p("filterChange"))},null,40,We)),[[e.vModelText,c.value,void 0,{trim:!0}]]):e.createCommentVNode("",!0),c.type==="number"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":d=>c.value=d,type:"number",class:"bh-form-control",onKeyup:a[2]||(a[2]=d=>p("filterChange"))},null,40,Ye)),[[e.vModelText,c.value,void 0,{number:!0,trim:!0}]]):c.type==="date"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:2,"onUpdate:modelValue":d=>c.value=d,type:"date",class:"bh-form-control",onChange:a[3]||(a[3]=d=>p("filterChange"))},null,40,Qe)),[[e.vModelText,c.value]]):c.type==="bool"?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:3,"onUpdate:modelValue":d=>c.value=d,class:"bh-form-control",onChange:a[4]||(a[4]=d=>p("filterChange")),onClick:a[5]||(a[5]=d=>l.isOpenFilter=null)},tt,40,Xe)),[[e.vModelSelect,c.value]]):e.createCommentVNode("",!0),c.type!=="bool"?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",onClick:e.withModifiers(d=>p("toggleFilterMenu",c),["stop"])},[e.createVNode(Pe,{class:"bh-w-4"})],8,lt)):e.createCommentVNode("",!0),e.withDirectives(e.createVNode(Ee,{column:c,type:c.type,columnFilterLang:l.columnFilterLang,onClose:a[6]||(a[6]=d=>p("toggleFilterMenu",null)),onFilterChange:a[7]||(a[7]=d=>p("filterChange"))},null,8,["column","type","columnFilterLang"]),[[e.vShow,l.isOpenFilter===c.field]])])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],6))],64))),256))]))}}),nt={},ot={width:"84",height:"84",viewBox:"0 0 24 24",class:"bh-loader bh-text-primary"},at=e.createStaticVNode('<circle cx="18" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".67" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".33" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="6" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle>',3),rt=[at];function it(k,p){return e.openBlock(),e.createElementBlock("svg",ot,rt)}const st=I(nt,[["render",it]]),ct={class:"bh-datatable bh-antialiased bh-relative bh-text-black bh-text-sm bh-font-normal"},ut=["onClick"],dt={class:"bh-checkbox"},mt=["value"],ht=["innerHTML"],ft={key:1},vt=["colspan"],pt=["colspan"],gt=e.createElementVNode("div",{class:"bh-skeleton-box bh-h-8"},null,-1),kt=[gt],Ct={key:0,class:"bh-absolute bh-inset-0 bh-bg-blue-light/50 bh-grid bh-place-content-center"},bt={class:"bh-flex bh-items-center bh-flex-wrap bh-flex-col sm:bh-flex-row bh-gap-4"},yt={class:"bh-pagination-info bh-flex bh-items-center"},_t={class:"bh-mr-2"},wt=["value"],Bt={class:"bh-pagination-number sm:bh-ml-auto bh-inline-flex bh-items-center bh-space-x-1"},Et=["innerHTML"],Ft={key:1,"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 16 16"},Nt=e.createElementVNode("g",{fill:"currentColor","fill-rule":"evenodd"},[e.createElementVNode("path",{d:"M8.354 1.646a.5.5 0 0 1 0 .708L2.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"}),e.createElementVNode("path",{d:"M12.354 1.646a.5.5 0 0 1 0 .708L6.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"})],-1),St=[Nt],Vt=["innerHTML"],Lt={key:1,"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 16 16"},zt=e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"},null,-1),xt=[zt],$t=["onClick"],Mt=["innerHTML"],qt={key:1,"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 16 16"},Dt=e.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8L4.646 2.354a.5.5 0 0 1 0-.708z"},null,-1),At=[Dt],Rt=["innerHTML"],Tt={key:1,"aria-hidden":"true",width:"14",height:"14",viewBox:"0 0 16 16"},Ht=e.createElementVNode("g",{fill:"currentColor","fill-rule":"evenodd"},[e.createElementVNode("path",{d:"M3.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L9.293 8L3.646 2.354a.5.5 0 0 1 0-.708z"}),e.createElementVNode("path",{d:"M7.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L13.293 8L7.646 2.354a.5.5 0 0 1 0-.708z"})],-1),Ot=[Ht],Pt=e.defineComponent({__name:"custom-table",props:{loading:{type:Boolean,default:!1},isServerMode:{type:Boolean,default:!1},skin:{default:"bh-table-striped bh-table-hover"},totalRows:{default:0},rows:{default:()=>[]},columns:{default:()=>[]},hasCheckbox:{type:Boolean,default:!1},search:{default:""},columnChooser:{type:Boolean,default:!1},page:{default:1},pageSize:{default:10},pageSizeOptions:{default:()=>[10,20,30,50,100]},showPageSize:{type:Boolean,default:!0},rowClass:{default:[]},cellClass:{default:[]},sortable:{type:Boolean,default:!1},sortColumn:{default:"id"},sortDirection:{default:"asc"},columnFilter:{type:Boolean,default:!1},columnFilterLang:{default:null},pagination:{type:Boolean,default:!0},showNumbers:{type:Boolean,default:!0},showNumbersCount:{default:5},showFirstPage:{type:Boolean,default:!0},showLastPage:{type:Boolean,default:!0},firstArrow:{default:""},lastArrow:{default:""},nextArrow:{default:""},previousArrow:{default:""},paginationInfo:{default:"Showing {0} to {1} of {2} entries"},noDataContent:{default:"No data available"},stickyHeader:{type:Boolean,default:!1},height:{default:"500px"},stickyFirstColumn:{type:Boolean,default:!1},cloneHeaderInFooter:{type:Boolean,default:!1},selectRowOnClick:{type:Boolean,default:!1}},emits:["change","sortChange","searchChange","pageChange","pageSizeChange","rowSelect","filterChange","rowClick","rowDBClick"],setup(k,{expose:p,emit:l}){var ee,te;const n=k,h=e.useSlots();for(const t of n.columns||[]){const r=((ee=t.type)==null?void 0:ee.toLowerCase())||"string";t.type=r,t.isUnique=t.isUnique!==void 0?t.isUnique:!1,t.hide=t.hide!==void 0?t.hide:!1,t.filter=t.filter!==void 0?t.filter:!0,t.search=t.search!==void 0?t.search:!0,t.sort=t.sort!==void 0?t.sort:!0,t.html=t.html!==void 0?t.html:!1,t.condition=!r||r==="string"?"contain":"equal"}const y=e.ref([]),a=e.ref(n.page),c=e.ref(n.pagination?n.pageSize:(te=n.rows)==null?void 0:te.length),z=n.pageSize,d=e.ref(n.sortColumn),A=n.sortColumn,B=e.ref(n.sortDirection),R=n.sortDirection,_=e.ref(n.totalRows),b=e.ref([]),$=e.ref(null),E=e.ref(n.loading),F=e.ref(n.search),T=JSON.parse(JSON.stringify(n.columns)),N=e.ref(null),q=e.ref(null);let V=e.ref(0);const H=e.ref(230);e.onMounted(()=>{L()}),p({reset(){ge()},getSelectedRows(){return ke()},getColumnFilters(){return Ce()},clearSelectedRows(){return be()},selectRow(t){Z(t)},unselectRow(t){j(t)},isRowSelected(t){return U(t)},getFilteredRows(){return J()}});const O=(t,...r)=>t.replace(/{(\d+)}/g,(i,m)=>typeof r[m]<"u"?r[m]:i),g=e.computed(()=>{const t=n.columns.find(r=>r.isUnique);return(t==null?void 0:t.field)||null}),w=e.computed(()=>{const t=c.value<1?1:Math.ceil(_.value/c.value);return Math.max(t||0,1)}),v=e.computed(()=>(a.value-1)*c.value+1),K=e.computed(()=>{const t=a.value*c.value;return _.value>=t?t:_.value}),ie=e.computed(()=>{let t,r;return typeof n.showNumbersCount<"u"&&n.showNumbersCount<w.value?(t=Math.max(a.value-Math.floor(n.showNumbersCount/2),1),r=t+n.showNumbersCount-1,r>w.value&&(r=w.value,t=r-n.showNumbersCount+1)):(t=1,r=w.value),Array.from(Array(r+1-t).keys()).map(C=>t+C)}),J=()=>{var C,D,le;let t=n.rows||[];if(!n.isServerMode){if((C=n.columns)==null||C.forEach(o=>{o.filter&&(o.value!==void 0&&o.value!==null&&o.value!==""||o.condition==="is_null"||o.condition=="is_not_null")&&(o.type==="string"?(o.value&&!o.condition&&(o.condition="contain"),o.condition==="contain"?t=t.filter(s=>{var f;return(f=u(s,o.field))==null?void 0:f.toString().toLowerCase().includes(o.value.toLowerCase())}):o.condition==="not_contain"?t=t.filter(s=>{var f;return!((f=u(s,o.field))!=null&&f.toString().toLowerCase().includes(o.value.toLowerCase()))}):o.condition==="equal"?t=t.filter(s=>{var f;return((f=u(s,o.field))==null?void 0:f.toString().toLowerCase())===o.value.toLowerCase()}):o.condition==="not_equal"?t=t.filter(s=>{var f;return((f=u(s,o.field))==null?void 0:f.toString().toLowerCase())!==o.value.toLowerCase()}):o.condition=="start_with"?t=t.filter(s=>{var f;return((f=u(s,o.field))==null?void 0:f.toString().toLowerCase().indexOf(o.value.toLowerCase()))===0}):o.condition=="end_with"&&(t=t.filter(s=>{var f;return((f=u(s,o.field))==null?void 0:f.toString().toLowerCase().substr(o.value.length*-1))===o.value.toLowerCase()}))):o.type==="number"?(o.value&&!o.condition&&(o.condition="equal"),o.condition==="equal"?t=t.filter(s=>u(s,o.field)&&parseFloat(u(s,o.field))===parseFloat(o.value)):o.condition==="not_equal"?t=t.filter(s=>u(s,o.field)&&parseFloat(u(s,o.field))!==parseFloat(o.value)):o.condition==="greater_than"?t=t.filter(s=>u(s,o.field)&&parseFloat(u(s,o.field))>parseFloat(o.value)):o.condition==="greater_than_equal"?t=t.filter(s=>u(s,o.field)&&parseFloat(u(s,o.field))>=parseFloat(o.value)):o.condition==="less_than"?t=t.filter(s=>u(s,o.field)&&parseFloat(u(s,o.field))<parseFloat(o.value)):o.condition==="less_than_equal"&&(t=t.filter(s=>u(s,o.field)&&parseFloat(u(s,o.field))<=parseFloat(o.value)))):o.type==="date"?(o.value&&!o.condition&&(o.condition="equal"),o.condition==="equal"?t=t.filter(s=>u(s,o.field)&&P(u(s,o.field))===o.value):o.condition==="not_equal"?t=t.filter(s=>u(s,o.field)&&P(u(s,o.field))!==o.value):o.condition==="greater_than"?t=t.filter(s=>u(s,o.field)&&P(u(s,o.field))>o.value):o.condition==="less_than"&&(t=t.filter(s=>u(s,o.field)&&P(u(s,o.field))<o.value))):o.type==="bool"&&(t=t.filter(s=>u(s,o.field)===o.value)),o.condition==="is_null"?(t=t.filter(s=>u(s,o.field)==null||u(s,o.field)==""),o.value=""):o.condition==="is_not_null"&&(o.value="",t=t.filter(s=>u(s,o.field))))}),F.value&&(t==null?void 0:t.length)){let o=[];const s=(n.columns||[]).filter(f=>f.search&&!f.hide).map(f=>f.field);for(var r=0;r<(t==null?void 0:t.length);r++)for(var i=0;i<s.length;i++)if((D=u(t[r],s[i]))!=null&&D.toString().toLowerCase().includes(F.value.toLowerCase())){o.push(t[r]);break}t=o}var m=new Intl.Collator(void 0,{numeric:((le=n.columns.find(o=>o.field==d.value))==null?void 0:le.type)==="number",sensitivity:"base"});const ye=B.value==="desc"?-1:1;t.sort((o,s)=>{var ne,oe;const f=(ne=d.value)==null?void 0:ne.split(".").reduce((x,G)=>x==null?void 0:x[G],o),_e=(oe=d.value)==null?void 0:oe.split(".").reduce((x,G)=>x==null?void 0:x[G],s);return m.compare(f,_e)*ye})}return t},L=()=>{let t=[],r=J();n.isServerMode?(_.value=n.totalRows||0,t=r):(_.value=(r==null?void 0:r.length)||0,t=r.slice(v.value-1,K.value)),y.value=t||[]};e.watch(()=>n.loading,()=>{E.value=n.loading});const W=t=>{t?N.value===t.field?N.value=null:N.value=t.field:N.value=null},se=()=>{if(a.value==1)return!1;a.value--},ce=t=>{a.value=t},ue=()=>{if(a.value>=w.value)return!1;a.value++},de=()=>{S(!1),n.isServerMode?M("page"):(L(),l("pageChange",a.value))};e.watch(()=>a.value,de);const me=()=>{n.isServerMode||(a.value=1),S(!1),L()};e.watch(()=>n.rows,me);const he=()=>{S(!1),n.isServerMode?a.value===1?M("pagesize",!0):a.value=1:(a.value=1,L(),l("pageSizeChange",c.value))};e.watch(()=>c.value,he);const Y=t=>{let r="asc";t==d.value&&B.value==="asc"&&(r="desc");let i=(a.value-1)*c.value,m=c.value;d.value=t,B.value=r,S(!1),L(),n.isServerMode?M("sort"):l("sortChange",{offset:i,limit:m,field:t,direction:r})},Q=t=>{$.value=t.length&&y.value.length&&t.length===y.value.length;const r=y.value.filter((i,m)=>b.value.includes(g.value?i[g.value]:m));l("rowSelect",r)};e.watch(()=>b.value,Q);const S=t=>{t?b.value=y.value.map((r,i)=>g.value?r[g.value]:i):b.value=[]},X=()=>{S(!1),n.isServerMode?a.value===1?M("filter",!0):a.value=1:(a.value=1,L(),l("filterChange",n.columns))},fe=()=>{S(!1),n.isServerMode?a.value===1?M("search",!0):a.value=1:(a.value=1,L(),l("searchChange",F.value))};e.watch(()=>n.search,()=>{F.value=n.search,fe()});const u=(t,r)=>r==null?void 0:r.split(".").reduce((i,m)=>i==null?void 0:i[m],t),P=t=>{try{if(!t)return"";const r=new Date(t),i=r.getDate(),m=r.getMonth()+1;return r.getFullYear()+"-"+(m>9?m:"0"+m)+"-"+(i>9?i:"0"+i)}catch{}return""},ve=(t,r)=>{V.value++,V.value===1?q.value=setTimeout(()=>{V.value=0,n.selectRowOnClick&&(U(r)?j(r):Z(r),Q(b.value)),l("rowClick",t)},H.value):V.value===2&&(clearTimeout(q.value),V.value=0,l("rowDBClick",t))},M=(t,r=!1)=>{if(n.isServerMode){pe();const i={current_page:r?1:a.value,pagesize:c.value,offset:(a.value-1)*c.value,sort_column:d.value,sort_direction:B.value,search:F.value,column_filters:n.columns,change_type:t};l("change",i)}},pe=()=>{for(let t=0;t<n.columns.length;t++){let r=n.columns[t];r.filter&&(r.value!==void 0&&r.value!==null&&r.value!==""||r.condition==="is_null"||r.condition==="is_not_null")&&(r.type==="string"&&r.value&&!r.condition&&(r.condition="contain"),r.type==="number"&&r.value&&!r.condition&&(r.condition="equal"),r.type==="date"&&r.value&&!r.condition&&(r.condition="equal"))}},ge=()=>{S(!1);for(let t=0;t<n.columns.length;t++)n.columns[t]=T[t];F.value="",c.value=z,d.value=A,B.value=R,n.isServerMode?a.value===1?M("reset",!0):a.value=1:(a.value=1,L())},ke=()=>y.value.filter((r,i)=>b.value.includes(g.value?r[g.value]:i)),Ce=()=>n.columns,be=()=>{b.value=[]},Z=t=>{if(!U(t)){const r=y.value.find((i,m)=>m===t);b.value.push(g.value?r[g.value]:t)}},j=t=>{if(U(t)){const r=y.value.find((i,m)=>m===t);b.value=b.value.filter(i=>i!==(g.value?r[g.value]:t))}},U=t=>{const r=y.value.find((i,m)=>m===t);return r?b.value.includes(g.value?r[g.value]:t):!1};return(t,r)=>(e.openBlock(),e.createElementBlock("div",ct,[e.createElementVNode("div",{class:e.normalizeClass(["bh-table-responsive",{"bh-min-h-[300px]":E.value}]),style:e.normalizeStyle({height:n.stickyHeader&&n.height})},[e.createElementVNode("table",{class:e.normalizeClass([n.skin])},[e.createElementVNode("thead",{class:e.normalizeClass({"bh-sticky bh-top-0 bh-z-10":n.stickyHeader})},[e.createVNode(ae,{all:n,currentSortColumn:d.value,currentSortDirection:B.value,isOpenFilter:N.value,checkAll:$.value,columnFilterLang:n.columnFilterLang,onSelectAll:S,onSortChange:Y,onFilterChange:X,onToggleFilterMenu:W},null,8,["currentSortColumn","currentSortDirection","isOpenFilter","checkAll","columnFilterLang"])],2),e.createElementVNode("tbody",null,[_.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(y.value,(i,m)=>(e.openBlock(),e.createElementBlock("tr",{key:i[e.unref(g)]?i[e.unref(g)]:m,class:e.normalizeClass([typeof n.rowClass=="function"?k.rowClass(i):n.rowClass,n.selectRowOnClick?"bh-cursor-pointer":""]),onClick:e.withModifiers(C=>ve(i,m),["prevent"])},[n.hasCheckbox?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass({"bh-sticky bh-left-0 bh-bg-blue-light":n.stickyFirstColumn})},[e.createElementVNode("div",dt,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=C=>b.value=C),type:"checkbox",value:i[e.unref(g)]?i[e.unref(g)]:m,onClick:r[1]||(r[1]=e.withModifiers(()=>{},["stop"]))},null,8,mt),[[e.vModelCheckbox,b.value]]),e.createElementVNode("div",null,[e.createVNode(re,{class:"check"})])])],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(C,D)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[C.hide?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("td",{key:C.field,class:e.normalizeClass([typeof n.cellClass=="function"?k.cellClass(i):n.cellClass,D===0&&n.stickyFirstColumn?"bh-sticky bh-left-0 bh-bg-blue-light":"",n.hasCheckbox&&D===0&&n.stickyFirstColumn?"bh-left-[52px]":"",C.cellClass?C.cellClass:""])},[e.unref(h)[C.field]?e.renderSlot(t.$slots,C.field,{key:0,value:i}):C.cellRenderer?(e.openBlock(),e.createElementBlock("div",{key:1,innerHTML:C.cellRenderer(i)},null,8,ht)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(u(i,C.field)),1)],64))],2))],64))),256))],10,ut))),128)):e.createCommentVNode("",!0),!_.value&&!E.value?(e.openBlock(),e.createElementBlock("tr",ft,[e.createElementVNode("td",{colspan:n.columns.length+1},e.toDisplayString(n.noDataContent),9,vt)])):e.createCommentVNode("",!0),!_.value&&E.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(n.pageSize,i=>(e.openBlock(),e.createElementBlock("tr",{key:i,class:"!bh-bg-white bh-h-11 !bh-border-transparent"},[e.createElementVNode("td",{colspan:n.columns.length+1,class:"!bh-p-0 !bh-border-transparent"},kt,8,pt)]))),128)):e.createCommentVNode("",!0)]),n.cloneHeaderInFooter?(e.openBlock(),e.createElementBlock("tfoot",{key:0,class:e.normalizeClass({"bh-sticky bh-bottom-0":n.stickyHeader})},[e.createVNode(ae,{all:n,currentSortColumn:d.value,currentSortDirection:B.value,isOpenFilter:N.value,isFooter:!0,checkAll:$.value,onSelectAll:S,onSortChange:Y,onFilterChange:X,onToggleFilterMenu:W},null,8,["currentSortColumn","currentSortDirection","isOpenFilter","checkAll"])],2)):e.createCommentVNode("",!0)],2),_.value&&E.value?(e.openBlock(),e.createElementBlock("div",Ct,[e.createVNode(st)])):e.createCommentVNode("",!0)],6),n.pagination&&_.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["bh-pagination bh-py-5",{"bh-pointer-events-none":E.value}])},[e.createElementVNode("div",bt,[e.createElementVNode("div",yt,[e.createElementVNode("span",_t,e.toDisplayString(O(n.paginationInfo,_.value?e.unref(v):0,e.unref(K),_.value)),1),n.showPageSize?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:0,"onUpdate:modelValue":r[2]||(r[2]=i=>c.value=i),class:"bh-pagesize"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.pageSizeOptions,i=>(e.openBlock(),e.createElementBlock("option",{value:i,key:i},e.toDisplayString(i),9,wt))),128))],512)),[[e.vModelSelect,c.value]]):e.createCommentVNode("",!0)]),e.createElementVNode("div",Bt,[n.showFirstPage?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["bh-page-item first-page",{disabled:a.value<=1}]),onClick:r[3]||(r[3]=i=>a.value=1)},[n.firstArrow?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:n.firstArrow},null,8,Et)):(e.openBlock(),e.createElementBlock("svg",Ft,St))],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["bh-page-item previous-page",{disabled:a.value<=1}]),onClick:se},[n.previousArrow?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:n.previousArrow},null,8,Vt)):(e.openBlock(),e.createElementBlock("svg",Lt,xt))],2),n.showNumbers?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(e.unref(ie),i=>(e.openBlock(),e.createElementBlock("button",{key:i,type:"button",class:e.normalizeClass(["bh-page-item",{disabled:a.value===i,"bh-active":i===a.value}]),onClick:m=>ce(i)},e.toDisplayString(i),11,$t))),128)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["bh-page-item next-page",{disabled:a.value>=e.unref(w)}]),onClick:ue},[n.nextArrow?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:n.nextArrow},null,8,Mt)):(e.openBlock(),e.createElementBlock("svg",qt,At))],2),n.showLastPage?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:e.normalizeClass(["bh-page-item last-page",{disabled:a.value>=e.unref(w)}]),onClick:r[4]||(r[4]=i=>a.value=e.unref(w))},[n.lastArrow?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:n.lastArrow},null,8,Rt)):(e.openBlock(),e.createElementBlock("svg",Tt,Ot))],2)):e.createCommentVNode("",!0)])])],2)):e.createCommentVNode("",!0)]))}});module.exports=Pt;
@@ -0,0 +1,845 @@
1
+ import { defineComponent as se, onBeforeUnmount as Te, onMounted as ke, openBlock as u, createElementBlock as c, createElementVNode as i, withModifiers as Q, normalizeClass as d, toDisplayString as p, Fragment as q, createCommentVNode as y, ref as x, watch as U, createVNode as O, renderList as K, normalizeStyle as we, createTextVNode as Fe, withDirectives as E, vModelText as ie, vModelSelect as Le, vShow as Ve, createStaticVNode as Ue, useSlots as Ee, computed as Y, unref as z, vModelCheckbox as Ie, renderSlot as Ge } from "vue";
2
+ const Ke = { class: "bh-filter-menu bh-absolute bh-z-[1] bh-bg-white bh-shadow-md bh-rounded-md bh-top-full bh-right-0 bh-w-32 bh-mt-1" }, Je = ["onClick"], We = /* @__PURE__ */ se({
3
+ __name: "column-filter",
4
+ props: ["column", "columnFilterLang"],
5
+ emits: ["close", "filterChange"],
6
+ setup(w, { emit: C }) {
7
+ const t = w;
8
+ Te(() => {
9
+ document.removeEventListener("click", l);
10
+ }), ke(() => {
11
+ document.addEventListener("click", l);
12
+ });
13
+ const l = () => {
14
+ C("close");
15
+ }, b = (S) => {
16
+ t.column.condition = S, S === "" && (t.column.value = ""), C("filterChange", t.column);
17
+ };
18
+ return (S, o) => {
19
+ var h, T, f, X, A, Z, $, L, I, B, N, j, R, J, P, ee, te, k, M;
20
+ return u(), c("div", Ke, [
21
+ i("div", {
22
+ class: "bh-text-[13px] bh-font-normal bh-rounded bh-overflow-hidden",
23
+ onClick: Q(l, ["stop"])
24
+ }, [
25
+ i("button", {
26
+ type: "button",
27
+ class: d({ active: t.column.condition === "" }),
28
+ onClick: o[0] || (o[0] = (_) => b(""))
29
+ }, p((h = t.columnFilterLang && t.columnFilterLang.no_filter) != null ? h : "No filter"), 3),
30
+ t.column.type === "string" ? (u(), c(q, { key: 0 }, [
31
+ i("button", {
32
+ type: "button",
33
+ class: d({ active: t.column.condition === "contain" }),
34
+ onClick: o[1] || (o[1] = (_) => b("contain"))
35
+ }, p((T = t.columnFilterLang && t.columnFilterLang.contain) != null ? T : "Contain"), 3),
36
+ i("button", {
37
+ type: "button",
38
+ class: d({ active: t.column.condition === "not_contain" }),
39
+ onClick: o[2] || (o[2] = (_) => b("not_contain"))
40
+ }, p((f = t.columnFilterLang && t.columnFilterLang.not_contain) != null ? f : "Not contain"), 3),
41
+ i("button", {
42
+ type: "button",
43
+ class: d({ active: t.column.condition === "equal" }),
44
+ onClick: o[3] || (o[3] = (_) => b("equal"))
45
+ }, p((X = t.columnFilterLang && t.columnFilterLang.equal) != null ? X : "Equal"), 3),
46
+ i("button", {
47
+ type: "button",
48
+ class: d({ active: t.column.condition === "not_equal" }),
49
+ onClick: o[4] || (o[4] = (_) => b("not_equal"))
50
+ }, p((A = t.columnFilterLang && t.columnFilterLang.not_equal) != null ? A : "Not equal"), 3),
51
+ i("button", {
52
+ type: "button",
53
+ class: d({ active: t.column.condition === "start_with" }),
54
+ onClick: o[5] || (o[5] = (_) => b("start_with"))
55
+ }, p((Z = t.columnFilterLang && t.columnFilterLang.start_with) != null ? Z : "Starts with"), 3),
56
+ i("button", {
57
+ type: "button",
58
+ class: d({ active: t.column.condition === "end_with" }),
59
+ onClick: o[6] || (o[6] = (_) => b("end_with"))
60
+ }, p(($ = t.columnFilterLang && t.columnFilterLang.end_with) != null ? $ : "Ends with"), 3)
61
+ ], 64)) : t.column.type === "number" ? (u(), c(q, { key: 1 }, [
62
+ i("button", {
63
+ type: "button",
64
+ class: d({ active: t.column.condition === "equal" }),
65
+ onClick: o[7] || (o[7] = (_) => b("equal"))
66
+ }, p((L = t.columnFilterLang && t.columnFilterLang.equal) != null ? L : "Equal"), 3),
67
+ i("button", {
68
+ type: "button",
69
+ class: d({ active: t.column.condition === "not_equal" }),
70
+ onClick: o[8] || (o[8] = (_) => b("not_equal"))
71
+ }, p((I = t.columnFilterLang && t.columnFilterLang.not_equal) != null ? I : "Not equal"), 3),
72
+ i("button", {
73
+ type: "button",
74
+ class: d({ active: t.column.condition === "greater_than" }),
75
+ onClick: o[9] || (o[9] = (_) => b("greater_than"))
76
+ }, p((B = t.columnFilterLang && t.columnFilterLang.greater_than) != null ? B : "Greater than"), 3),
77
+ i("button", {
78
+ type: "button",
79
+ class: d({ active: t.column.condition === "greater_than_equal" }),
80
+ onClick: o[10] || (o[10] = (_) => b("greater_than_equal"))
81
+ }, p((N = t.columnFilterLang && t.columnFilterLang.greater_than_equal) != null ? N : "Greater than or equal"), 3),
82
+ i("button", {
83
+ type: "button",
84
+ class: d({ active: t.column.condition === "less_than" }),
85
+ onClick: o[11] || (o[11] = (_) => b("less_than"))
86
+ }, p((j = t.columnFilterLang && t.columnFilterLang.less_than) != null ? j : "Less than"), 3),
87
+ i("button", {
88
+ type: "button",
89
+ class: d({ active: t.column.condition === "less_than_equal" }),
90
+ onClick: o[12] || (o[12] = (_) => b("less_than_equal"))
91
+ }, p((R = t.columnFilterLang && t.columnFilterLang.less_than_equal) != null ? R : "Less than or equal"), 3)
92
+ ], 64)) : t.column.type === "date" ? (u(), c(q, { key: 2 }, [
93
+ i("button", {
94
+ type: "button",
95
+ class: d({ active: t.column.condition === "equal" }),
96
+ onClick: o[13] || (o[13] = (_) => b("equal"))
97
+ }, p((J = t.columnFilterLang && t.columnFilterLang.equal) != null ? J : "Equal"), 3),
98
+ i("button", {
99
+ type: "button",
100
+ class: d({ active: t.column.condition === "not_equal" }),
101
+ onClick: o[14] || (o[14] = (_) => b("not_equal"))
102
+ }, p((P = t.columnFilterLang && t.columnFilterLang.not_equal) != null ? P : "Not equal"), 3),
103
+ i("button", {
104
+ type: "button",
105
+ class: d({ active: t.column.condition === "greater_than" }),
106
+ onClick: o[15] || (o[15] = (_) => b("greater_than"))
107
+ }, p((ee = t.columnFilterLang && t.columnFilterLang.greater_than) != null ? ee : "Greater than"), 3),
108
+ i("button", {
109
+ type: "button",
110
+ class: d({ active: t.column.condition === "less_than" }),
111
+ onClick: o[16] || (o[16] = (_) => b("less_than"))
112
+ }, p((te = t.columnFilterLang && t.columnFilterLang.less_than) != null ? te : "Less than"), 3)
113
+ ], 64)) : y("", !0),
114
+ i("button", {
115
+ type: "button",
116
+ class: d({ active: t.column.condition === "is_null" }),
117
+ onClick: o[17] || (o[17] = (_) => b("is_null"))
118
+ }, p((k = t.columnFilterLang && t.columnFilterLang.is_null) != null ? k : "Is null"), 3),
119
+ i("button", {
120
+ type: "button",
121
+ class: d({ active: t.column.condition === "is_not_null" }),
122
+ onClick: o[18] || (o[18] = (_) => b("is_not_null"))
123
+ }, p((M = t.columnFilterLang && t.columnFilterLang.is_not_null) != null ? M : "Not null"), 3)
124
+ ], 8, Je)
125
+ ]);
126
+ };
127
+ }
128
+ }), oe = (w, C) => {
129
+ const t = w.__vccOpts || w;
130
+ for (const [l, b] of C)
131
+ t[l] = b;
132
+ return t;
133
+ }, Ye = {}, Qe = {
134
+ version: "1.1",
135
+ viewBox: "0 0 17 12",
136
+ xmlns: "http://www.w3.org/2000/svg"
137
+ }, Xe = /* @__PURE__ */ i("g", {
138
+ fill: "none",
139
+ "fill-rule": "evenodd"
140
+ }, [
141
+ /* @__PURE__ */ i("g", {
142
+ transform: "translate(-9 -11)",
143
+ fill: "currentColor",
144
+ "fill-rule": "nonzero"
145
+ }, [
146
+ /* @__PURE__ */ i("path", { d: "m25.576 11.414c0.56558 0.55188 0.56558 1.4439 0 1.9961l-9.404 9.176c-0.28213 0.27529-0.65247 0.41385-1.0228 0.41385-0.37034 0-0.74068-0.13855-1.0228-0.41385l-4.7019-4.588c-0.56584-0.55188-0.56584-1.4442 0-1.9961 0.56558-0.55214 1.4798-0.55214 2.0456 0l3.679 3.5899 8.3812-8.1779c0.56558-0.55214 1.4798-0.55214 2.0456 0z" })
147
+ ])
148
+ ], -1), Ze = [
149
+ Xe
150
+ ];
151
+ function je(w, C) {
152
+ return u(), c("svg", Qe, Ze);
153
+ }
154
+ const Se = /* @__PURE__ */ oe(Ye, [["render", je]]), et = {}, tt = {
155
+ viewBox: "0 0 24 24",
156
+ width: "24",
157
+ height: "24",
158
+ stroke: "currentColor",
159
+ "stroke-width": "3",
160
+ fill: "none",
161
+ "stroke-linecap": "round",
162
+ "stroke-linejoin": "round",
163
+ class: "css-i6dzq1"
164
+ }, lt = /* @__PURE__ */ i("line", {
165
+ x1: "5",
166
+ y1: "12",
167
+ x2: "19",
168
+ y2: "12"
169
+ }, null, -1), nt = [
170
+ lt
171
+ ];
172
+ function ot(w, C) {
173
+ return u(), c("svg", tt, nt);
174
+ }
175
+ const at = /* @__PURE__ */ oe(et, [["render", ot]]), it = {}, st = {
176
+ viewBox: "0 0 24 24",
177
+ width: "24",
178
+ height: "24",
179
+ stroke: "currentColor",
180
+ "stroke-width": "1.5",
181
+ fill: "none",
182
+ "stroke-linecap": "round",
183
+ "stroke-linejoin": "round",
184
+ class: "css-i6dzq1"
185
+ }, rt = /* @__PURE__ */ i("polygon", { points: "22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" }, null, -1), ut = [
186
+ rt
187
+ ];
188
+ function ct(w, C) {
189
+ return u(), c("svg", st, ut);
190
+ }
191
+ const ht = /* @__PURE__ */ oe(it, [["render", ct]]), dt = { key: "hdrrow" }, vt = { class: "bh-checkbox" }, ft = ["onClick"], gt = {
192
+ width: "16",
193
+ height: "16",
194
+ viewBox: "0 0 14 14",
195
+ fill: "none"
196
+ }, pt = {
197
+ key: 0,
198
+ class: "bh-filter bh-relative"
199
+ }, bt = ["onUpdate:modelValue"], mt = ["onUpdate:modelValue"], _t = ["onUpdate:modelValue"], yt = ["onUpdate:modelValue"], Ct = /* @__PURE__ */ i("option", { value: void 0 }, "All", -1), kt = /* @__PURE__ */ i("option", { value: !0 }, "True", -1), wt = /* @__PURE__ */ i("option", { value: !1 }, "False", -1), Ft = [
200
+ Ct,
201
+ kt,
202
+ wt
203
+ ], Lt = ["onClick"], Ce = /* @__PURE__ */ se({
204
+ __name: "column-header",
205
+ props: ["all", "currentSortColumn", "currentSortDirection", "isOpenFilter", "isFooter", "checkAll", "columnFilterLang"],
206
+ emits: ["selectAll", "sortChange", "filterChange", "toggleFilterMenu"],
207
+ setup(w, { emit: C }) {
208
+ const t = w, l = x(null);
209
+ return U(() => t.checkAll, () => {
210
+ l.value && (l.value.indeterminate = t.checkAll !== 0 ? !t.checkAll : !1, l.value.checked = t.checkAll);
211
+ }), (S, o) => (u(), c("tr", dt, [
212
+ t.all.hasCheckbox ? (u(), c("th", {
213
+ key: "chkall",
214
+ class: d(["bh-w-px", {
215
+ "bh-sticky bh-bg-blue-light bh-z-[1]": t.all.stickyHeader || t.all.stickyFirstColumn,
216
+ "bh-top-0": t.all.stickyHeader,
217
+ "bh-left-0": t.all.stickyFirstColumn
218
+ }])
219
+ }, [
220
+ i("div", vt, [
221
+ i("input", {
222
+ ref_key: "selectedAll",
223
+ ref: l,
224
+ type: "checkbox",
225
+ onClick: o[0] || (o[0] = Q((h) => C("selectAll", h.target.checked), ["stop"]))
226
+ }, null, 512),
227
+ i("div", null, [
228
+ O(Se, { class: "check" }),
229
+ O(at, { class: "intermediate" })
230
+ ])
231
+ ])
232
+ ], 2)) : y("", !0),
233
+ (u(!0), c(q, null, K(t.all.columns, (h, T) => (u(), c(q, null, [
234
+ h.hide ? y("", !0) : (u(), c("th", {
235
+ key: h.field,
236
+ class: d(["bh-select-none bh-z-[1]", [
237
+ t.all.sortable && h.sort ? "bh-cursor-pointer" : "",
238
+ T === 0 && t.all.stickyFirstColumn ? "bh-sticky bh-left-0 bh-bg-blue-light" : "",
239
+ t.all.hasCheckbox && T === 0 && t.all.stickyFirstColumn ? "bh-left-[52px]" : ""
240
+ ]]),
241
+ style: we({
242
+ width: h.width,
243
+ "min-width": h.minWidth,
244
+ "max-width": h.maxWidth
245
+ })
246
+ }, [
247
+ i("div", {
248
+ class: d(["bh-flex bh-items-center", [h.headerClass ? h.headerClass : ""]]),
249
+ onClick: (f) => t.all.sortable && h.sort && C("sortChange", h.field)
250
+ }, [
251
+ Fe(p(h.title) + " ", 1),
252
+ t.all.sortable && h.sort ? (u(), c("span", {
253
+ key: 0,
254
+ class: d(["bh-ml-3 bh-sort bh-flex bh-items-center", [t.currentSortColumn, t.currentSortDirection]])
255
+ }, [
256
+ (u(), c("svg", gt, [
257
+ i("polygon", {
258
+ points: "3.11,6.25 10.89,6.25 7,1.75 ",
259
+ fill: "currentColor",
260
+ class: d(["bh-text-black/20", [w.currentSortColumn === h.field && w.currentSortDirection === "asc" ? "!bh-text-primary" : ""]])
261
+ }, null, 2),
262
+ i("polygon", {
263
+ points: "7,12.25 10.89,7.75 3.11,7.75 ",
264
+ fill: "currentColor",
265
+ class: d(["bh-text-black/20", [w.currentSortColumn === h.field && w.currentSortDirection === "desc" ? "!bh-text-primary" : ""]])
266
+ }, null, 2)
267
+ ]))
268
+ ], 2)) : y("", !0)
269
+ ], 10, ft),
270
+ t.all.columnFilter && !t.isFooter ? (u(), c(q, { key: 0 }, [
271
+ h.filter ? (u(), c("div", pt, [
272
+ h.type === "string" ? E((u(), c("input", {
273
+ key: 0,
274
+ "onUpdate:modelValue": (f) => h.value = f,
275
+ type: "text",
276
+ class: "bh-form-control",
277
+ onKeyup: o[1] || (o[1] = (f) => C("filterChange"))
278
+ }, null, 40, bt)), [
279
+ [
280
+ ie,
281
+ h.value,
282
+ void 0,
283
+ { trim: !0 }
284
+ ]
285
+ ]) : y("", !0),
286
+ h.type === "number" ? E((u(), c("input", {
287
+ key: 1,
288
+ "onUpdate:modelValue": (f) => h.value = f,
289
+ type: "number",
290
+ class: "bh-form-control",
291
+ onKeyup: o[2] || (o[2] = (f) => C("filterChange"))
292
+ }, null, 40, mt)), [
293
+ [
294
+ ie,
295
+ h.value,
296
+ void 0,
297
+ {
298
+ number: !0,
299
+ trim: !0
300
+ }
301
+ ]
302
+ ]) : h.type === "date" ? E((u(), c("input", {
303
+ key: 2,
304
+ "onUpdate:modelValue": (f) => h.value = f,
305
+ type: "date",
306
+ class: "bh-form-control",
307
+ onChange: o[3] || (o[3] = (f) => C("filterChange"))
308
+ }, null, 40, _t)), [
309
+ [ie, h.value]
310
+ ]) : h.type === "bool" ? E((u(), c("select", {
311
+ key: 3,
312
+ "onUpdate:modelValue": (f) => h.value = f,
313
+ class: "bh-form-control",
314
+ onChange: o[4] || (o[4] = (f) => C("filterChange")),
315
+ onClick: o[5] || (o[5] = (f) => t.isOpenFilter = null)
316
+ }, Ft, 40, yt)), [
317
+ [Le, h.value]
318
+ ]) : y("", !0),
319
+ h.type !== "bool" ? (u(), c("button", {
320
+ key: 4,
321
+ type: "button",
322
+ onClick: Q((f) => C("toggleFilterMenu", h), ["stop"])
323
+ }, [
324
+ O(ht, { class: "bh-w-4" })
325
+ ], 8, Lt)) : y("", !0),
326
+ E(O(We, {
327
+ column: h,
328
+ type: h.type,
329
+ columnFilterLang: t.columnFilterLang,
330
+ onClose: o[6] || (o[6] = (f) => C("toggleFilterMenu", null)),
331
+ onFilterChange: o[7] || (o[7] = (f) => C("filterChange"))
332
+ }, null, 8, ["column", "type", "columnFilterLang"]), [
333
+ [Ve, t.isOpenFilter === h.field]
334
+ ])
335
+ ])) : y("", !0)
336
+ ], 64)) : y("", !0)
337
+ ], 6))
338
+ ], 64))), 256))
339
+ ]));
340
+ }
341
+ }), St = {}, $t = {
342
+ width: "84",
343
+ height: "84",
344
+ viewBox: "0 0 24 24",
345
+ class: "bh-loader bh-text-primary"
346
+ }, xt = /* @__PURE__ */ Ue('<circle cx="18" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".67" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="12" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin=".33" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle><circle cx="6" cy="12" r="0" fill="currentColor"><animate attributeName="r" begin="0" calcMode="spline" dur="1.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" repeatCount="indefinite" values="0;2;0;0"></animate></circle>', 3), qt = [
347
+ xt
348
+ ];
349
+ function Mt(w, C) {
350
+ return u(), c("svg", $t, qt);
351
+ }
352
+ const zt = /* @__PURE__ */ oe(St, [["render", Mt]]), At = { class: "bh-datatable bh-antialiased bh-relative bh-text-black bh-text-sm bh-font-normal" }, Bt = ["onClick"], Nt = { class: "bh-checkbox" }, Rt = ["value"], Dt = ["innerHTML"], Pt = { key: 1 }, Ht = ["colspan"], Ot = ["colspan"], Tt = /* @__PURE__ */ i("div", { class: "bh-skeleton-box bh-h-8" }, null, -1), Vt = [
353
+ Tt
354
+ ], Ut = {
355
+ key: 0,
356
+ class: "bh-absolute bh-inset-0 bh-bg-blue-light/50 bh-grid bh-place-content-center"
357
+ }, Et = { class: "bh-flex bh-items-center bh-flex-wrap bh-flex-col sm:bh-flex-row bh-gap-4" }, It = { class: "bh-pagination-info bh-flex bh-items-center" }, Gt = { class: "bh-mr-2" }, Kt = ["value"], Jt = { class: "bh-pagination-number sm:bh-ml-auto bh-inline-flex bh-items-center bh-space-x-1" }, Wt = ["innerHTML"], Yt = {
358
+ key: 1,
359
+ "aria-hidden": "true",
360
+ width: "14",
361
+ height: "14",
362
+ viewBox: "0 0 16 16"
363
+ }, Qt = /* @__PURE__ */ i("g", {
364
+ fill: "currentColor",
365
+ "fill-rule": "evenodd"
366
+ }, [
367
+ /* @__PURE__ */ i("path", { d: "M8.354 1.646a.5.5 0 0 1 0 .708L2.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z" }),
368
+ /* @__PURE__ */ i("path", { d: "M12.354 1.646a.5.5 0 0 1 0 .708L6.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z" })
369
+ ], -1), Xt = [
370
+ Qt
371
+ ], Zt = ["innerHTML"], jt = {
372
+ key: 1,
373
+ "aria-hidden": "true",
374
+ width: "14",
375
+ height: "14",
376
+ viewBox: "0 0 16 16"
377
+ }, el = /* @__PURE__ */ i("path", {
378
+ fill: "currentColor",
379
+ "fill-rule": "evenodd",
380
+ d: "M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"
381
+ }, null, -1), tl = [
382
+ el
383
+ ], ll = ["onClick"], nl = ["innerHTML"], ol = {
384
+ key: 1,
385
+ "aria-hidden": "true",
386
+ width: "14",
387
+ height: "14",
388
+ viewBox: "0 0 16 16"
389
+ }, al = /* @__PURE__ */ i("path", {
390
+ fill: "currentColor",
391
+ "fill-rule": "evenodd",
392
+ d: "M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8L4.646 2.354a.5.5 0 0 1 0-.708z"
393
+ }, null, -1), il = [
394
+ al
395
+ ], sl = ["innerHTML"], rl = {
396
+ key: 1,
397
+ "aria-hidden": "true",
398
+ width: "14",
399
+ height: "14",
400
+ viewBox: "0 0 16 16"
401
+ }, ul = /* @__PURE__ */ i("g", {
402
+ fill: "currentColor",
403
+ "fill-rule": "evenodd"
404
+ }, [
405
+ /* @__PURE__ */ i("path", { d: "M3.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L9.293 8L3.646 2.354a.5.5 0 0 1 0-.708z" }),
406
+ /* @__PURE__ */ i("path", { d: "M7.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L13.293 8L7.646 2.354a.5.5 0 0 1 0-.708z" })
407
+ ], -1), cl = [
408
+ ul
409
+ ], gl = /* @__PURE__ */ se({
410
+ __name: "custom-table",
411
+ props: {
412
+ loading: { type: Boolean, default: !1 },
413
+ isServerMode: { type: Boolean, default: !1 },
414
+ skin: { default: "bh-table-striped bh-table-hover" },
415
+ totalRows: { default: 0 },
416
+ rows: { default: () => [] },
417
+ columns: { default: () => [] },
418
+ hasCheckbox: { type: Boolean, default: !1 },
419
+ search: { default: "" },
420
+ columnChooser: { type: Boolean, default: !1 },
421
+ page: { default: 1 },
422
+ pageSize: { default: 10 },
423
+ pageSizeOptions: { default: () => [10, 20, 30, 50, 100] },
424
+ showPageSize: { type: Boolean, default: !0 },
425
+ rowClass: { default: [] },
426
+ cellClass: { default: [] },
427
+ sortable: { type: Boolean, default: !1 },
428
+ sortColumn: { default: "id" },
429
+ sortDirection: { default: "asc" },
430
+ columnFilter: { type: Boolean, default: !1 },
431
+ columnFilterLang: { default: null },
432
+ pagination: { type: Boolean, default: !0 },
433
+ showNumbers: { type: Boolean, default: !0 },
434
+ showNumbersCount: { default: 5 },
435
+ showFirstPage: { type: Boolean, default: !0 },
436
+ showLastPage: { type: Boolean, default: !0 },
437
+ firstArrow: { default: "" },
438
+ lastArrow: { default: "" },
439
+ nextArrow: { default: "" },
440
+ previousArrow: { default: "" },
441
+ paginationInfo: { default: "Showing {0} to {1} of {2} entries" },
442
+ noDataContent: { default: "No data available" },
443
+ stickyHeader: { type: Boolean, default: !1 },
444
+ height: { default: "500px" },
445
+ stickyFirstColumn: { type: Boolean, default: !1 },
446
+ cloneHeaderInFooter: { type: Boolean, default: !1 },
447
+ selectRowOnClick: { type: Boolean, default: !1 }
448
+ },
449
+ emits: ["change", "sortChange", "searchChange", "pageChange", "pageSizeChange", "rowSelect", "filterChange", "rowClick", "rowDBClick"],
450
+ setup(w, { expose: C, emit: t }) {
451
+ var pe, be;
452
+ const l = w, b = Ee();
453
+ for (const e of l.columns || []) {
454
+ const a = ((pe = e.type) == null ? void 0 : pe.toLowerCase()) || "string";
455
+ e.type = a, e.isUnique = e.isUnique !== void 0 ? e.isUnique : !1, e.hide = e.hide !== void 0 ? e.hide : !1, e.filter = e.filter !== void 0 ? e.filter : !0, e.search = e.search !== void 0 ? e.search : !0, e.sort = e.sort !== void 0 ? e.sort : !0, e.html = e.html !== void 0 ? e.html : !1, e.condition = !a || a === "string" ? "contain" : "equal";
456
+ }
457
+ const S = x([]), o = x(l.page), h = x(l.pagination ? l.pageSize : (be = l.rows) == null ? void 0 : be.length), T = l.pageSize, f = x(l.sortColumn), X = l.sortColumn, A = x(l.sortDirection), Z = l.sortDirection, $ = x(l.totalRows), L = x([]), I = x(null), B = x(l.loading), N = x(l.search), j = JSON.parse(JSON.stringify(l.columns)), R = x(null), J = x(null);
458
+ let P = x(0);
459
+ const ee = x(230);
460
+ ke(() => {
461
+ H();
462
+ }), C({
463
+ reset() {
464
+ Ne();
465
+ },
466
+ getSelectedRows() {
467
+ return Re();
468
+ },
469
+ getColumnFilters() {
470
+ return De();
471
+ },
472
+ clearSelectedRows() {
473
+ return Pe();
474
+ },
475
+ selectRow(e) {
476
+ fe(e);
477
+ },
478
+ unselectRow(e) {
479
+ ge(e);
480
+ },
481
+ isRowSelected(e) {
482
+ return ne(e);
483
+ },
484
+ getFilteredRows() {
485
+ return ue();
486
+ }
487
+ });
488
+ const te = (e, ...a) => e.replace(/{(\d+)}/g, (s, g) => typeof a[g] < "u" ? a[g] : s), k = Y(() => {
489
+ const e = l.columns.find((a) => a.isUnique);
490
+ return (e == null ? void 0 : e.field) || null;
491
+ }), M = Y(() => {
492
+ const e = h.value < 1 ? 1 : Math.ceil($.value / h.value);
493
+ return Math.max(e || 0, 1);
494
+ }), _ = Y(() => (o.value - 1) * h.value + 1), re = Y(() => {
495
+ const e = o.value * h.value;
496
+ return $.value >= e ? e : $.value;
497
+ }), $e = Y(() => {
498
+ let e, a;
499
+ return typeof l.showNumbersCount < "u" && l.showNumbersCount < M.value ? (e = Math.max(o.value - Math.floor(l.showNumbersCount / 2), 1), a = e + l.showNumbersCount - 1, a > M.value && (a = M.value, e = a - l.showNumbersCount + 1)) : (e = 1, a = M.value), Array.from(Array(a + 1 - e).keys()).map((F) => e + F);
500
+ }), ue = () => {
501
+ var F, W, me;
502
+ let e = l.rows || [];
503
+ if (!l.isServerMode) {
504
+ if ((F = l.columns) == null || F.forEach((n) => {
505
+ n.filter && (n.value !== void 0 && n.value !== null && n.value !== "" || n.condition === "is_null" || n.condition == "is_not_null") && (n.type === "string" ? (n.value && !n.condition && (n.condition = "contain"), n.condition === "contain" ? e = e.filter((r) => {
506
+ var m;
507
+ return (m = v(r, n.field)) == null ? void 0 : m.toString().toLowerCase().includes(n.value.toLowerCase());
508
+ }) : n.condition === "not_contain" ? e = e.filter((r) => {
509
+ var m;
510
+ return !((m = v(r, n.field)) != null && m.toString().toLowerCase().includes(n.value.toLowerCase()));
511
+ }) : n.condition === "equal" ? e = e.filter((r) => {
512
+ var m;
513
+ return ((m = v(r, n.field)) == null ? void 0 : m.toString().toLowerCase()) === n.value.toLowerCase();
514
+ }) : n.condition === "not_equal" ? e = e.filter((r) => {
515
+ var m;
516
+ return ((m = v(r, n.field)) == null ? void 0 : m.toString().toLowerCase()) !== n.value.toLowerCase();
517
+ }) : n.condition == "start_with" ? e = e.filter((r) => {
518
+ var m;
519
+ return ((m = v(r, n.field)) == null ? void 0 : m.toString().toLowerCase().indexOf(n.value.toLowerCase())) === 0;
520
+ }) : n.condition == "end_with" && (e = e.filter((r) => {
521
+ var m;
522
+ return ((m = v(r, n.field)) == null ? void 0 : m.toString().toLowerCase().substr(n.value.length * -1)) === n.value.toLowerCase();
523
+ }))) : n.type === "number" ? (n.value && !n.condition && (n.condition = "equal"), n.condition === "equal" ? e = e.filter((r) => v(r, n.field) && parseFloat(v(r, n.field)) === parseFloat(n.value)) : n.condition === "not_equal" ? e = e.filter((r) => v(r, n.field) && parseFloat(v(r, n.field)) !== parseFloat(n.value)) : n.condition === "greater_than" ? e = e.filter((r) => v(r, n.field) && parseFloat(v(r, n.field)) > parseFloat(n.value)) : n.condition === "greater_than_equal" ? e = e.filter((r) => v(r, n.field) && parseFloat(v(r, n.field)) >= parseFloat(n.value)) : n.condition === "less_than" ? e = e.filter((r) => v(r, n.field) && parseFloat(v(r, n.field)) < parseFloat(n.value)) : n.condition === "less_than_equal" && (e = e.filter((r) => v(r, n.field) && parseFloat(v(r, n.field)) <= parseFloat(n.value)))) : n.type === "date" ? (n.value && !n.condition && (n.condition = "equal"), n.condition === "equal" ? e = e.filter((r) => v(r, n.field) && le(v(r, n.field)) === n.value) : n.condition === "not_equal" ? e = e.filter((r) => v(r, n.field) && le(v(r, n.field)) !== n.value) : n.condition === "greater_than" ? e = e.filter((r) => v(r, n.field) && le(v(r, n.field)) > n.value) : n.condition === "less_than" && (e = e.filter((r) => v(r, n.field) && le(v(r, n.field)) < n.value))) : n.type === "bool" && (e = e.filter((r) => v(r, n.field) === n.value)), n.condition === "is_null" ? (e = e.filter((r) => v(r, n.field) == null || v(r, n.field) == ""), n.value = "") : n.condition === "is_not_null" && (n.value = "", e = e.filter((r) => v(r, n.field))));
524
+ }), N.value && (e == null ? void 0 : e.length)) {
525
+ let n = [];
526
+ const r = (l.columns || []).filter((m) => m.search && !m.hide).map((m) => m.field);
527
+ for (var a = 0; a < (e == null ? void 0 : e.length); a++)
528
+ for (var s = 0; s < r.length; s++)
529
+ if ((W = v(e[a], r[s])) != null && W.toString().toLowerCase().includes(N.value.toLowerCase())) {
530
+ n.push(e[a]);
531
+ break;
532
+ }
533
+ e = n;
534
+ }
535
+ var g = new Intl.Collator(void 0, {
536
+ numeric: ((me = l.columns.find((n) => n.field == f.value)) == null ? void 0 : me.type) === "number",
537
+ sensitivity: "base"
538
+ });
539
+ const He = A.value === "desc" ? -1 : 1;
540
+ e.sort((n, r) => {
541
+ var _e, ye;
542
+ const m = (_e = f.value) == null ? void 0 : _e.split(".").reduce((V, ae) => V == null ? void 0 : V[ae], n), Oe = (ye = f.value) == null ? void 0 : ye.split(".").reduce((V, ae) => V == null ? void 0 : V[ae], r);
543
+ return g.compare(m, Oe) * He;
544
+ });
545
+ }
546
+ return e;
547
+ }, H = () => {
548
+ let e = [], a = ue();
549
+ l.isServerMode ? ($.value = l.totalRows || 0, e = a) : ($.value = (a == null ? void 0 : a.length) || 0, e = a.slice(_.value - 1, re.value)), S.value = e || [];
550
+ };
551
+ U(
552
+ () => l.loading,
553
+ () => {
554
+ B.value = l.loading;
555
+ }
556
+ );
557
+ const ce = (e) => {
558
+ e ? R.value === e.field ? R.value = null : R.value = e.field : R.value = null;
559
+ }, xe = () => {
560
+ if (o.value == 1)
561
+ return !1;
562
+ o.value--;
563
+ }, qe = (e) => {
564
+ o.value = e;
565
+ }, Me = () => {
566
+ if (o.value >= M.value)
567
+ return !1;
568
+ o.value++;
569
+ };
570
+ U(() => o.value, () => {
571
+ D(!1), l.isServerMode ? G("page") : (H(), t("pageChange", o.value));
572
+ }), U(() => l.rows, () => {
573
+ l.isServerMode || (o.value = 1), D(!1), H();
574
+ }), U(() => h.value, () => {
575
+ D(!1), l.isServerMode ? o.value === 1 ? G("pagesize", !0) : o.value = 1 : (o.value = 1, H(), t("pageSizeChange", h.value));
576
+ });
577
+ const he = (e) => {
578
+ let a = "asc";
579
+ e == f.value && A.value === "asc" && (a = "desc");
580
+ let s = (o.value - 1) * h.value, g = h.value;
581
+ f.value = e, A.value = a, D(!1), H(), l.isServerMode ? G("sort") : t("sortChange", { offset: s, limit: g, field: e, direction: a });
582
+ }, de = (e) => {
583
+ I.value = e.length && S.value.length && e.length === S.value.length;
584
+ const a = S.value.filter((s, g) => L.value.includes(k.value ? s[k.value] : g));
585
+ t("rowSelect", a);
586
+ };
587
+ U(() => L.value, de);
588
+ const D = (e) => {
589
+ e ? L.value = S.value.map((a, s) => k.value ? a[k.value] : s) : L.value = [];
590
+ }, ve = () => {
591
+ D(!1), l.isServerMode ? o.value === 1 ? G("filter", !0) : o.value = 1 : (o.value = 1, H(), t("filterChange", l.columns));
592
+ }, ze = () => {
593
+ D(!1), l.isServerMode ? o.value === 1 ? G("search", !0) : o.value = 1 : (o.value = 1, H(), t("searchChange", N.value));
594
+ };
595
+ U(
596
+ () => l.search,
597
+ () => {
598
+ N.value = l.search, ze();
599
+ }
600
+ );
601
+ const v = (e, a) => a == null ? void 0 : a.split(".").reduce((s, g) => s == null ? void 0 : s[g], e), le = (e) => {
602
+ try {
603
+ if (!e)
604
+ return "";
605
+ const a = new Date(e), s = a.getDate(), g = a.getMonth() + 1;
606
+ return a.getFullYear() + "-" + (g > 9 ? g : "0" + g) + "-" + (s > 9 ? s : "0" + s);
607
+ } catch {
608
+ }
609
+ return "";
610
+ }, Ae = (e, a) => {
611
+ P.value++, P.value === 1 ? J.value = setTimeout(() => {
612
+ P.value = 0, l.selectRowOnClick && (ne(a) ? ge(a) : fe(a), de(L.value)), t("rowClick", e);
613
+ }, ee.value) : P.value === 2 && (clearTimeout(J.value), P.value = 0, t("rowDBClick", e));
614
+ }, G = (e, a = !1) => {
615
+ if (l.isServerMode) {
616
+ Be();
617
+ const s = {
618
+ current_page: a ? 1 : o.value,
619
+ pagesize: h.value,
620
+ offset: (o.value - 1) * h.value,
621
+ sort_column: f.value,
622
+ sort_direction: A.value,
623
+ search: N.value,
624
+ column_filters: l.columns,
625
+ change_type: e
626
+ };
627
+ t("change", s);
628
+ }
629
+ }, Be = () => {
630
+ for (let e = 0; e < l.columns.length; e++) {
631
+ let a = l.columns[e];
632
+ a.filter && (a.value !== void 0 && a.value !== null && a.value !== "" || a.condition === "is_null" || a.condition === "is_not_null") && (a.type === "string" && a.value && !a.condition && (a.condition = "contain"), a.type === "number" && a.value && !a.condition && (a.condition = "equal"), a.type === "date" && a.value && !a.condition && (a.condition = "equal"));
633
+ }
634
+ }, Ne = () => {
635
+ D(!1);
636
+ for (let e = 0; e < l.columns.length; e++)
637
+ l.columns[e] = j[e];
638
+ N.value = "", h.value = T, f.value = X, A.value = Z, l.isServerMode ? o.value === 1 ? G("reset", !0) : o.value = 1 : (o.value = 1, H());
639
+ }, Re = () => S.value.filter((a, s) => L.value.includes(k.value ? a[k.value] : s)), De = () => l.columns, Pe = () => {
640
+ L.value = [];
641
+ }, fe = (e) => {
642
+ if (!ne(e)) {
643
+ const a = S.value.find((s, g) => g === e);
644
+ L.value.push(k.value ? a[k.value] : e);
645
+ }
646
+ }, ge = (e) => {
647
+ if (ne(e)) {
648
+ const a = S.value.find((s, g) => g === e);
649
+ L.value = L.value.filter((s) => s !== (k.value ? a[k.value] : e));
650
+ }
651
+ }, ne = (e) => {
652
+ const a = S.value.find((s, g) => g === e);
653
+ return a ? L.value.includes(k.value ? a[k.value] : e) : !1;
654
+ };
655
+ return (e, a) => (u(), c("div", At, [
656
+ i("div", {
657
+ class: d(["bh-table-responsive", { "bh-min-h-[300px]": B.value }]),
658
+ style: we({ height: l.stickyHeader && l.height })
659
+ }, [
660
+ i("table", {
661
+ class: d([l.skin])
662
+ }, [
663
+ i("thead", {
664
+ class: d({ "bh-sticky bh-top-0 bh-z-10": l.stickyHeader })
665
+ }, [
666
+ O(Ce, {
667
+ all: l,
668
+ currentSortColumn: f.value,
669
+ currentSortDirection: A.value,
670
+ isOpenFilter: R.value,
671
+ checkAll: I.value,
672
+ columnFilterLang: l.columnFilterLang,
673
+ onSelectAll: D,
674
+ onSortChange: he,
675
+ onFilterChange: ve,
676
+ onToggleFilterMenu: ce
677
+ }, null, 8, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll", "columnFilterLang"])
678
+ ], 2),
679
+ i("tbody", null, [
680
+ $.value ? (u(!0), c(q, { key: 0 }, K(S.value, (s, g) => (u(), c("tr", {
681
+ key: s[z(k)] ? s[z(k)] : g,
682
+ class: d([typeof l.rowClass == "function" ? w.rowClass(s) : l.rowClass, l.selectRowOnClick ? "bh-cursor-pointer" : ""]),
683
+ onClick: Q((F) => Ae(s, g), ["prevent"])
684
+ }, [
685
+ l.hasCheckbox ? (u(), c("td", {
686
+ key: 0,
687
+ class: d({
688
+ "bh-sticky bh-left-0 bh-bg-blue-light": l.stickyFirstColumn
689
+ })
690
+ }, [
691
+ i("div", Nt, [
692
+ E(i("input", {
693
+ "onUpdate:modelValue": a[0] || (a[0] = (F) => L.value = F),
694
+ type: "checkbox",
695
+ value: s[z(k)] ? s[z(k)] : g,
696
+ onClick: a[1] || (a[1] = Q(() => {
697
+ }, ["stop"]))
698
+ }, null, 8, Rt), [
699
+ [Ie, L.value]
700
+ ]),
701
+ i("div", null, [
702
+ O(Se, { class: "check" })
703
+ ])
704
+ ])
705
+ ], 2)) : y("", !0),
706
+ (u(!0), c(q, null, K(l.columns, (F, W) => (u(), c(q, null, [
707
+ F.hide ? y("", !0) : (u(), c("td", {
708
+ key: F.field,
709
+ class: d([
710
+ typeof l.cellClass == "function" ? w.cellClass(s) : l.cellClass,
711
+ W === 0 && l.stickyFirstColumn ? "bh-sticky bh-left-0 bh-bg-blue-light" : "",
712
+ l.hasCheckbox && W === 0 && l.stickyFirstColumn ? "bh-left-[52px]" : "",
713
+ F.cellClass ? F.cellClass : ""
714
+ ])
715
+ }, [
716
+ z(b)[F.field] ? Ge(e.$slots, F.field, {
717
+ key: 0,
718
+ value: s
719
+ }) : F.cellRenderer ? (u(), c("div", {
720
+ key: 1,
721
+ innerHTML: F.cellRenderer(s)
722
+ }, null, 8, Dt)) : (u(), c(q, { key: 2 }, [
723
+ Fe(p(v(s, F.field)), 1)
724
+ ], 64))
725
+ ], 2))
726
+ ], 64))), 256))
727
+ ], 10, Bt))), 128)) : y("", !0),
728
+ !$.value && !B.value ? (u(), c("tr", Pt, [
729
+ i("td", {
730
+ colspan: l.columns.length + 1
731
+ }, p(l.noDataContent), 9, Ht)
732
+ ])) : y("", !0),
733
+ !$.value && B.value ? (u(!0), c(q, { key: 2 }, K(l.pageSize, (s) => (u(), c("tr", {
734
+ key: s,
735
+ class: "!bh-bg-white bh-h-11 !bh-border-transparent"
736
+ }, [
737
+ i("td", {
738
+ colspan: l.columns.length + 1,
739
+ class: "!bh-p-0 !bh-border-transparent"
740
+ }, Vt, 8, Ot)
741
+ ]))), 128)) : y("", !0)
742
+ ]),
743
+ l.cloneHeaderInFooter ? (u(), c("tfoot", {
744
+ key: 0,
745
+ class: d({ "bh-sticky bh-bottom-0": l.stickyHeader })
746
+ }, [
747
+ O(Ce, {
748
+ all: l,
749
+ currentSortColumn: f.value,
750
+ currentSortDirection: A.value,
751
+ isOpenFilter: R.value,
752
+ isFooter: !0,
753
+ checkAll: I.value,
754
+ onSelectAll: D,
755
+ onSortChange: he,
756
+ onFilterChange: ve,
757
+ onToggleFilterMenu: ce
758
+ }, null, 8, ["currentSortColumn", "currentSortDirection", "isOpenFilter", "checkAll"])
759
+ ], 2)) : y("", !0)
760
+ ], 2),
761
+ $.value && B.value ? (u(), c("div", Ut, [
762
+ O(zt)
763
+ ])) : y("", !0)
764
+ ], 6),
765
+ l.pagination && $.value ? (u(), c("div", {
766
+ key: 0,
767
+ class: d(["bh-pagination bh-py-5", { "bh-pointer-events-none": B.value }])
768
+ }, [
769
+ i("div", Et, [
770
+ i("div", It, [
771
+ i("span", Gt, p(te(l.paginationInfo, $.value ? z(_) : 0, z(re), $.value)), 1),
772
+ l.showPageSize ? E((u(), c("select", {
773
+ key: 0,
774
+ "onUpdate:modelValue": a[2] || (a[2] = (s) => h.value = s),
775
+ class: "bh-pagesize"
776
+ }, [
777
+ (u(!0), c(q, null, K(l.pageSizeOptions, (s) => (u(), c("option", {
778
+ value: s,
779
+ key: s
780
+ }, p(s), 9, Kt))), 128))
781
+ ], 512)), [
782
+ [Le, h.value]
783
+ ]) : y("", !0)
784
+ ]),
785
+ i("div", Jt, [
786
+ l.showFirstPage ? (u(), c("button", {
787
+ key: 0,
788
+ type: "button",
789
+ class: d(["bh-page-item first-page", { disabled: o.value <= 1 }]),
790
+ onClick: a[3] || (a[3] = (s) => o.value = 1)
791
+ }, [
792
+ l.firstArrow ? (u(), c("span", {
793
+ key: 0,
794
+ innerHTML: l.firstArrow
795
+ }, null, 8, Wt)) : (u(), c("svg", Yt, Xt))
796
+ ], 2)) : y("", !0),
797
+ i("button", {
798
+ type: "button",
799
+ class: d(["bh-page-item previous-page", { disabled: o.value <= 1 }]),
800
+ onClick: xe
801
+ }, [
802
+ l.previousArrow ? (u(), c("span", {
803
+ key: 0,
804
+ innerHTML: l.previousArrow
805
+ }, null, 8, Zt)) : (u(), c("svg", jt, tl))
806
+ ], 2),
807
+ l.showNumbers ? (u(!0), c(q, { key: 1 }, K(z($e), (s) => (u(), c("button", {
808
+ key: s,
809
+ type: "button",
810
+ class: d(["bh-page-item", {
811
+ disabled: o.value === s,
812
+ "bh-active": s === o.value
813
+ }]),
814
+ onClick: (g) => qe(s)
815
+ }, p(s), 11, ll))), 128)) : y("", !0),
816
+ i("button", {
817
+ type: "button",
818
+ class: d(["bh-page-item next-page", { disabled: o.value >= z(M) }]),
819
+ onClick: Me
820
+ }, [
821
+ l.nextArrow ? (u(), c("span", {
822
+ key: 0,
823
+ innerHTML: l.nextArrow
824
+ }, null, 8, nl)) : (u(), c("svg", ol, il))
825
+ ], 2),
826
+ l.showLastPage ? (u(), c("button", {
827
+ key: 2,
828
+ type: "button",
829
+ class: d(["bh-page-item last-page", { disabled: o.value >= z(M) }]),
830
+ onClick: a[4] || (a[4] = (s) => o.value = z(M))
831
+ }, [
832
+ l.lastArrow ? (u(), c("span", {
833
+ key: 0,
834
+ innerHTML: l.lastArrow
835
+ }, null, 8, sl)) : (u(), c("svg", rl, cl))
836
+ ], 2)) : y("", !0)
837
+ ])
838
+ ])
839
+ ], 2)) : y("", !0)
840
+ ]));
841
+ }
842
+ });
843
+ export {
844
+ gl as default
845
+ };
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@dolusoft/vue3-datatable",
3
+ "version": "1.1.4",
4
+ "description": "Vue3 Datatable - fully customizable & easy to use datatable library",
5
+ "private": false,
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/vue3-datatable.umd.js",
11
+ "module": "./dist/vue3-datatable.js",
12
+ "types": "./dist/main.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/vue3-datatable.js",
16
+ "require": "./dist/vue3-datatable.umd.js"
17
+ },
18
+ "./dist/style.css": "./dist/style.css"
19
+ },
20
+ "author": {
21
+ "name": "Bhavesh Patel",
22
+ "email": "bhavesh.patel200@gmail.com"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/bhaveshpatel200/vue3-datatable.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/bhaveshpatel200/vue3-datatable/issues"
30
+ },
31
+ "homepage": "https://github.com/bhaveshpatel200/vue3-datatable#readme",
32
+ "funding": "https://github.com/sponsors/bhaveshpatel200",
33
+ "keywords": [
34
+ "vue3",
35
+ "vue",
36
+ "vuejs",
37
+ "component",
38
+ "datatable",
39
+ "vue3 datatable",
40
+ "vue datatable",
41
+ "vue3-datatable",
42
+ "vue grid",
43
+ "vue3 grid",
44
+ "vue table",
45
+ "vue3 table",
46
+ "datagrid",
47
+ "data-grid",
48
+ "data-table",
49
+ "table",
50
+ "grid",
51
+ "filter",
52
+ "sorting",
53
+ "pagination"
54
+ ],
55
+ "license": "MIT",
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "scripts": {
60
+ "dev": "vite",
61
+ "build": "vite build && vue-tsc --emitDeclarationOnly && npm run tailwind:build",
62
+ "preview": "vite preview",
63
+ "tailwind": "npx tailwindcss -i ./src/assets/css/tailwind.css -o ./dist/style.css --watch",
64
+ "tailwind:build": "npx tailwindcss -i ./src/assets/css/tailwind.css -o ./dist/style.css --minify"
65
+ },
66
+ "dependencies": {
67
+ "vue": "^3.2.37"
68
+ },
69
+ "devDependencies": {
70
+ "@types/node": "^18.11.9",
71
+ "@vitejs/plugin-vue": "^3.0.0",
72
+ "autoprefixer": "^10.4.8",
73
+ "typescript": "^4.6.4",
74
+ "vite": "^3.0.0",
75
+ "vue-tsc": "^0.38.4"
76
+ },
77
+ "browserslist": [
78
+ "> 1%",
79
+ "last 2 versions",
80
+ "not dead",
81
+ "not ie 11"
82
+ ]
83
+ }