@sulzanoks/vue-datatable 0.2.1 → 0.2.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 +129 -129
- package/dist/datatable-card.es.js +4 -4
- package/dist/datatable-card.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +34 -34
- package/src/Components/DatatableCard.vue +2 -2
package/README.md
CHANGED
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
# DatatableCard Component
|
|
2
|
-
|
|
3
|
-
DatatableCard is a custom Vue.js component designed to provide a flexible and customizable datatable for your web applications. It is built from scratch, inspired by the Bootstrap datatable, but with added features to support Vue.js style links and row selection.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
You can install the DatatableCard component using npm:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @sulzanoks/vue-datatable
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
To use the DatatableCard component in your Vue.js application, you can import it and include it in your component's template. Here's an example of how to use it:
|
|
16
|
-
|
|
17
|
-
```vue
|
|
18
|
-
<template>
|
|
19
|
-
<div>
|
|
20
|
-
<datatable-card
|
|
21
|
-
:card-title="cardTitle"
|
|
22
|
-
:columns="columns"
|
|
23
|
-
:url="dataUrl"
|
|
24
|
-
>
|
|
25
|
-
</datatable-card>
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
import DatatableCard from '@sulzanoks/vue-datatable';
|
|
31
|
-
import '@sulzanoks/vue-datatable/dist/style.css';
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
components: {
|
|
35
|
-
DatatableCard,
|
|
36
|
-
},
|
|
37
|
-
data() {
|
|
38
|
-
return {
|
|
39
|
-
cardTitle: 'My Datatable',
|
|
40
|
-
columns: [
|
|
41
|
-
// Define your datatable columns here
|
|
42
|
-
// Example: { data: 'id', name: 'ID', sortable: true, searchable: true }
|
|
43
|
-
],
|
|
44
|
-
dataUrl: '/api/data', // Replace with your data endpoint URL
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
</script>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Props
|
|
52
|
-
|
|
53
|
-
The DatatableCard component accepts the following props:
|
|
54
|
-
|
|
55
|
-
- `cardTitle` (String): The title for the datatable card.
|
|
56
|
-
- `clickable-rows` (Boolean, optional, default: false): Set to true to enable `row-click` event.
|
|
57
|
-
- `columns` (Array): An array of column objects defining the datatable columns.
|
|
58
|
-
- `data` (String): The key to access the data for this column in the API response.
|
|
59
|
-
- `displayName` (String): The display name or label for this column.
|
|
60
|
-
- `name` (String): The unique name or identifier for this column.
|
|
61
|
-
- `searchable` (Boolean, optional, default: true): Set to `false` to disable searching for this column.
|
|
62
|
-
- `sortable` (Boolean, optional, default: true): Set to `false` to disable sorting for this column.
|
|
63
|
-
- `visible` (Boolean, optional, default: true): Set to `false` to remove column from table.
|
|
64
|
-
- `width` (String, optional): Set solumn to width specified css param.
|
|
65
|
-
- `linkParams` (Object, optional): Defines link parameters for generating Vue.js style links.
|
|
66
|
-
- `name` (String): The name of the Vue.js route to navigate to when clicking the link.
|
|
67
|
-
- `resourceIds` (Array): An array of resource IDs to use in generating the link. Replace with actual resource IDs.
|
|
68
|
-
- `query` (Object, optional): object of attributes to include in link query params
|
|
69
|
-
- `url` (String): The URL for fetching datatable data.
|
|
70
|
-
- `selectableRows` (Boolean): Set to `true` to enable row selection. For now only works if you have a, `id` column in your data set.
|
|
71
|
-
- `order` (Array): The initial column sorting order. example: `[{ column: 0, dir: 'asc' }]`
|
|
72
|
-
- `advancedSearch` (Boolean): Set to `true` to enable advanced search, which generates an individual search input for each searchable column.
|
|
73
|
-
- `loadDataOnInit` (Boolean): Set to `true` to load data when the component is initialized.
|
|
74
|
-
- `cardIconStyle` (String, optional, default: 'card-header-primary'. There are no other options): The CSS class to apply to the card's header for icon styling.
|
|
75
|
-
- `cardIcon` (String, optional, default: null): The name of an icon from [Google Icons](https://fonts.google.com/icons) to display in the card's header. Provide the icon name without any additional markup, such as `<i>` tags. For example, if you want to use the "account_circle" icon, set this prop to `'account_circle'`. If not specified, no icon will be displayed in the card's header.
|
|
76
|
-
- `cardClasses` (String, optional, default: null): Additional CSS classes to apply to the card.
|
|
77
|
-
- `createLink` (String, optional, default: null): A link or URL to navigate to when clicking a "Create" button or link within the card.
|
|
78
|
-
- `requestQueryParams` (Object, optional): additional request query parameters to include when loading data from server.
|
|
79
|
-
- `actions` (Array, optional): Array of action objects defining action buttons for each row.
|
|
80
|
-
- `emit` (String, required): name of event to emit upon click
|
|
81
|
-
- `icon` (String, optional): The name of an icon from [Google Icons](https://fonts.google.com/icons) to display inside button.
|
|
82
|
-
- `label` (String, optional): Text to display inside button.
|
|
83
|
-
- `class` (String, optional): CSS class to apply to button.
|
|
84
|
-
|
|
85
|
-
## Internal Methods
|
|
86
|
-
|
|
87
|
-
These methods are meant to be used by component internally, but maybe you can find use for them
|
|
88
|
-
|
|
89
|
-
- `toggleSearch()`: Toggle the search input.
|
|
90
|
-
- `clearSearch()`: Clear the search bar and reload data.
|
|
91
|
-
- `setAdvancedSearchFilters()`: Set advanced search filters based in input element values and reload data.
|
|
92
|
-
- `loadData()`: Load datatable data.
|
|
93
|
-
- `initColumnSettings()`: Initialize column settings.
|
|
94
|
-
- `setPageLength(length)`: Set the number of rows per page and reload data.
|
|
95
|
-
- `setPage(page)`: Set the current page and reload data.
|
|
96
|
-
- `setSearchTerm()`: Set the full text search term for basic search on all columns and reload data.
|
|
97
|
-
- `setSorting(index)`: Set the sorting order for a column and reload data.
|
|
98
|
-
- `generateLink(linkParams, row)`: Generate a link based on parameters and row data.
|
|
99
|
-
- `selectAllRows()`: Select or deselect all rows.
|
|
100
|
-
- `clearSelectedRows()`: Clear the selected rows.
|
|
101
|
-
|
|
102
|
-
## Methods
|
|
103
|
-
- `getSelectedRows()`: Returns array of selected rows
|
|
104
|
-
- `filterColumns(params)`: Filter columns based on parameters and reload data.
|
|
105
|
-
```javascript
|
|
106
|
-
this.$refs.myDataTable.filterColumns([
|
|
107
|
-
{
|
|
108
|
-
name: 'serial_number',
|
|
109
|
-
value: this.uniqueId,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'product_name',
|
|
113
|
-
value: this.productName,
|
|
114
|
-
}
|
|
115
|
-
]);
|
|
116
|
-
```
|
|
117
|
-
- `refresh()`: Clears all sorting and filters, reloads or clears data based on `loadDataOnInit` prop.
|
|
118
|
-
|
|
119
|
-
## Events
|
|
120
|
-
- `row-click`: Emitted when row is click if `clickable-rows` prop is set to true. The event payload contains the clicked row data.
|
|
121
|
-
|
|
122
|
-
## Compatibility
|
|
123
|
-
|
|
124
|
-
This component is designed to work with Laravel's [`yajra/laravel-datatables-oracle`](https://yajrabox.com/docs/laravel-datatables). It may work with other packages that use a similar input/output structure, but it has not been tested extensively with other packages.
|
|
125
|
-
|
|
126
|
-
Please make sure that your Laravel backend and the API endpoints are configured to work with this component.
|
|
127
|
-
|
|
128
|
-
## License
|
|
129
|
-
|
|
1
|
+
# DatatableCard Component
|
|
2
|
+
|
|
3
|
+
DatatableCard is a custom Vue.js component designed to provide a flexible and customizable datatable for your web applications. It is built from scratch, inspired by the Bootstrap datatable, but with added features to support Vue.js style links and row selection.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You can install the DatatableCard component using npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @sulzanoks/vue-datatable
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
To use the DatatableCard component in your Vue.js application, you can import it and include it in your component's template. Here's an example of how to use it:
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<div>
|
|
20
|
+
<datatable-card
|
|
21
|
+
:card-title="cardTitle"
|
|
22
|
+
:columns="columns"
|
|
23
|
+
:url="dataUrl"
|
|
24
|
+
>
|
|
25
|
+
</datatable-card>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import DatatableCard from '@sulzanoks/vue-datatable';
|
|
31
|
+
import '@sulzanoks/vue-datatable/dist/style.css';
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
components: {
|
|
35
|
+
DatatableCard,
|
|
36
|
+
},
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
cardTitle: 'My Datatable',
|
|
40
|
+
columns: [
|
|
41
|
+
// Define your datatable columns here
|
|
42
|
+
// Example: { data: 'id', name: 'ID', sortable: true, searchable: true }
|
|
43
|
+
],
|
|
44
|
+
dataUrl: '/api/data', // Replace with your data endpoint URL
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
The DatatableCard component accepts the following props:
|
|
54
|
+
|
|
55
|
+
- `cardTitle` (String): The title for the datatable card.
|
|
56
|
+
- `clickable-rows` (Boolean, optional, default: false): Set to true to enable `row-click` event.
|
|
57
|
+
- `columns` (Array): An array of column objects defining the datatable columns.
|
|
58
|
+
- `data` (String): The key to access the data for this column in the API response.
|
|
59
|
+
- `displayName` (String): The display name or label for this column.
|
|
60
|
+
- `name` (String): The unique name or identifier for this column.
|
|
61
|
+
- `searchable` (Boolean, optional, default: true): Set to `false` to disable searching for this column.
|
|
62
|
+
- `sortable` (Boolean, optional, default: true): Set to `false` to disable sorting for this column.
|
|
63
|
+
- `visible` (Boolean, optional, default: true): Set to `false` to remove column from table.
|
|
64
|
+
- `width` (String, optional): Set solumn to width specified css param.
|
|
65
|
+
- `linkParams` (Object, optional): Defines link parameters for generating Vue.js style links.
|
|
66
|
+
- `name` (String): The name of the Vue.js route to navigate to when clicking the link.
|
|
67
|
+
- `resourceIds` (Array): An array of resource IDs to use in generating the link. Replace with actual resource IDs.
|
|
68
|
+
- `query` (Object, optional): object of attributes to include in link query params
|
|
69
|
+
- `url` (String): The URL for fetching datatable data.
|
|
70
|
+
- `selectableRows` (Boolean): Set to `true` to enable row selection. For now only works if you have a, `id` column in your data set.
|
|
71
|
+
- `order` (Array): The initial column sorting order. example: `[{ column: 0, dir: 'asc' }]`
|
|
72
|
+
- `advancedSearch` (Boolean): Set to `true` to enable advanced search, which generates an individual search input for each searchable column.
|
|
73
|
+
- `loadDataOnInit` (Boolean): Set to `true` to load data when the component is initialized.
|
|
74
|
+
- `cardIconStyle` (String, optional, default: 'card-header-primary'. There are no other options): The CSS class to apply to the card's header for icon styling.
|
|
75
|
+
- `cardIcon` (String, optional, default: null): The name of an icon from [Google Icons](https://fonts.google.com/icons) to display in the card's header. Provide the icon name without any additional markup, such as `<i>` tags. For example, if you want to use the "account_circle" icon, set this prop to `'account_circle'`. If not specified, no icon will be displayed in the card's header.
|
|
76
|
+
- `cardClasses` (String, optional, default: null): Additional CSS classes to apply to the card.
|
|
77
|
+
- `createLink` (String, optional, default: null): A link or URL to navigate to when clicking a "Create" button or link within the card.
|
|
78
|
+
- `requestQueryParams` (Object, optional): additional request query parameters to include when loading data from server.
|
|
79
|
+
- `actions` (Array, optional): Array of action objects defining action buttons for each row.
|
|
80
|
+
- `emit` (String, required): name of event to emit upon click
|
|
81
|
+
- `icon` (String, optional): The name of an icon from [Google Icons](https://fonts.google.com/icons) to display inside button.
|
|
82
|
+
- `label` (String, optional): Text to display inside button.
|
|
83
|
+
- `class` (String, optional): CSS class to apply to button.
|
|
84
|
+
|
|
85
|
+
## Internal Methods
|
|
86
|
+
|
|
87
|
+
These methods are meant to be used by component internally, but maybe you can find use for them
|
|
88
|
+
|
|
89
|
+
- `toggleSearch()`: Toggle the search input.
|
|
90
|
+
- `clearSearch()`: Clear the search bar and reload data.
|
|
91
|
+
- `setAdvancedSearchFilters()`: Set advanced search filters based in input element values and reload data.
|
|
92
|
+
- `loadData()`: Load datatable data.
|
|
93
|
+
- `initColumnSettings()`: Initialize column settings.
|
|
94
|
+
- `setPageLength(length)`: Set the number of rows per page and reload data.
|
|
95
|
+
- `setPage(page)`: Set the current page and reload data.
|
|
96
|
+
- `setSearchTerm()`: Set the full text search term for basic search on all columns and reload data.
|
|
97
|
+
- `setSorting(index)`: Set the sorting order for a column and reload data.
|
|
98
|
+
- `generateLink(linkParams, row)`: Generate a link based on parameters and row data.
|
|
99
|
+
- `selectAllRows()`: Select or deselect all rows.
|
|
100
|
+
- `clearSelectedRows()`: Clear the selected rows.
|
|
101
|
+
|
|
102
|
+
## Methods
|
|
103
|
+
- `getSelectedRows()`: Returns array of selected rows
|
|
104
|
+
- `filterColumns(params)`: Filter columns based on parameters and reload data.
|
|
105
|
+
```javascript
|
|
106
|
+
this.$refs.myDataTable.filterColumns([
|
|
107
|
+
{
|
|
108
|
+
name: 'serial_number',
|
|
109
|
+
value: this.uniqueId,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'product_name',
|
|
113
|
+
value: this.productName,
|
|
114
|
+
}
|
|
115
|
+
]);
|
|
116
|
+
```
|
|
117
|
+
- `refresh()`: Clears all sorting and filters, reloads or clears data based on `loadDataOnInit` prop.
|
|
118
|
+
|
|
119
|
+
## Events
|
|
120
|
+
- `row-click`: Emitted when row is click if `clickable-rows` prop is set to true. The event payload contains the clicked row data.
|
|
121
|
+
|
|
122
|
+
## Compatibility
|
|
123
|
+
|
|
124
|
+
This component is designed to work with Laravel's [`yajra/laravel-datatables-oracle`](https://yajrabox.com/docs/laravel-datatables). It may work with other packages that use a similar input/output structure, but it has not been tested extensively with other packages.
|
|
125
|
+
|
|
126
|
+
Please make sure that your Laravel backend and the API endpoints are configured to work with this component.
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
130
|
This DatatableCard component is open-source software licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
|
|
@@ -4362,7 +4362,7 @@ const tu = (e, t) => {
|
|
|
4362
4362
|
mounted() {
|
|
4363
4363
|
this.initColumnSettings(), this.loadDataOnInit && this.loadData();
|
|
4364
4364
|
}
|
|
4365
|
-
}, Ce = (e) => (pa("data-v-
|
|
4365
|
+
}, Ce = (e) => (pa("data-v-0b60868f"), e = e(), ha(), e), nu = {
|
|
4366
4366
|
key: 0,
|
|
4367
4367
|
class: "card-icon"
|
|
4368
4368
|
}, iu = {
|
|
@@ -4527,7 +4527,7 @@ function Ju(e, t, r, i, o, a) {
|
|
|
4527
4527
|
key: 0,
|
|
4528
4528
|
class: ue([a.columnSortingClasses[p], c.sortable !== !1 ? "sorting" : ""]),
|
|
4529
4529
|
onClick: (f) => a.setSorting(p),
|
|
4530
|
-
style: ca(
|
|
4530
|
+
style: ca(c.width ? { width: c.width } : {})
|
|
4531
4531
|
}, ve(c.displayName), 15, Lu)) : ie("", !0)
|
|
4532
4532
|
], 64))), 128)),
|
|
4533
4533
|
r.actions ? (B(), M("th", Bu, "Darbības")) : ie("", !0)
|
|
@@ -4574,7 +4574,7 @@ function Ju(e, t, r, i, o, a) {
|
|
|
4574
4574
|
], 2),
|
|
4575
4575
|
R("div", Vu, [
|
|
4576
4576
|
Mi(" Rāda " + ve(a.firstRecord) + ". līdz " + ve(a.lastRecord) + ". no " + ve(o.recordsFiltered) + " ierakstiem ", 1),
|
|
4577
|
-
o.recordsFiltered != o.recordsTotal ? (B(), M("span", Wu, " (kopā " + ve(o.recordsTotal) + "
|
|
4577
|
+
o.recordsFiltered != o.recordsTotal ? (B(), M("span", Wu, " (kopā " + ve(o.recordsTotal) + " ieraksti) ", 1)) : ie("", !0)
|
|
4578
4578
|
]),
|
|
4579
4579
|
R("div", zu, [
|
|
4580
4580
|
R("a", {
|
|
@@ -4605,7 +4605,7 @@ function Ju(e, t, r, i, o, a) {
|
|
|
4605
4605
|
])
|
|
4606
4606
|
], 2);
|
|
4607
4607
|
}
|
|
4608
|
-
const Qu = /* @__PURE__ */ tu(ru, [["render", Ju], ["__scopeId", "data-v-
|
|
4608
|
+
const Qu = /* @__PURE__ */ tu(ru, [["render", Ju], ["__scopeId", "data-v-0b60868f"]]);
|
|
4609
4609
|
export {
|
|
4610
4610
|
Qu as default
|
|
4611
4611
|
};
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
Please specify a more appropriate element using the "as" attribute. For example:
|
|
10
10
|
|
|
11
|
-
<Link href="${a}" method="${o}" as="button">...</Link>`),d.h(e.as,{...r,...i==="a"?{href:a}:{},onClick:c=>{_c(c)&&(c.preventDefault(),Rn.visit(a,{data:l,method:o,replace:e.replace,preserveScroll:e.preserveScroll,preserveState:e.preserveState??o!=="get",only:e.only,headers:e.headers,onCancelToken:r.onCancelToken||(()=>({})),onBefore:r.onBefore||(()=>({})),onStart:r.onStart||(()=>({})),onProgress:r.onProgress||(()=>({})),onFinish:r.onFinish||(()=>({})),onCancel:r.onCancel||(()=>({})),onSuccess:r.onSuccess||(()=>({})),onError:r.onError||(()=>({}))}))}},t)}}}),Oc=Ac;const bu="",Tc=(e,t)=>{const r=e.__vccOpts||e;for(const[i,o]of t)r[i]=o;return r},Pc={name:"DatatableCard",components:{Link:Oc},props:{cardTitle:{type:String,required:!1,default:null},cardIconStyle:{type:String,required:!1,default:"card-header-primary"},cardIcon:{type:String,required:!1,default:null},cardClasses:{type:String,required:!1,default:null},createLink:{type:String,required:!1,default:null},columns:{type:Array,required:!0},url:{type:String,required:!0},selectableRows:{type:Boolean,required:!1,default:!1},order:{type:Array,required:!1,default:[{column:0,dir:"asc"}]},advancedSearch:{type:Boolean,required:!1,default:!1},loadDataOnInit:{type:Boolean,required:!1,default:!0},requestQueryParams:{type:Object,required:!1,default:()=>({})},actions:{type:Array,required:!1},clickableRows:{type:Boolean,required:!1,default:!1}},emits:["row-click"],data(){return{searchBarOpen:!1,rows:[],columnSettings:{},searchTerm:"",recordsTotal:0,recordsFiltered:0,selectedRows:[],cardError:null}},watch:{selectedRows:function(e,t){this.selectableRows&&(e.length===this.rows.length&&e.length>0?(this.$refs.selectAllRows.indeterminate=!1,this.$refs.selectAllRows.checked=!0):e.length===0?(this.$refs.selectAllRows.indeterminate=!1,this.$refs.selectAllRows.checked=!1):this.$refs.selectAllRows.indeterminate=!0)}},computed:{firstRecord(){return this.columnSettings.start+1},lastRecord(){return this.columnSettings.start+this.rows.length},currentPage(){return Math.ceil(this.columnSettings.start/this.columnSettings.length)+1},pageCount(){return Math.ceil(this.recordsFiltered/this.columnSettings.length)},lastPageStart(){return(this.pageCount-1)*this.columnSettings.length},columnSortingClasses(){let e=[];if(!this.columnSettings.order)return e;for(let t=0;t<this.columns.length;t++){let r="";for(let i=0;i<this.columnSettings.order.length;i++)this.columnSettings.order[i].column==t&&(r=this.columnSettings.order[i].dir=="asc"?"sorting_asc":"sorting_desc");e.push(r)}return e},pages(){let e=[],t=this.currentPage-2,r=this.currentPage+2;t<1&&(t=1,r=5),r>this.pageCount&&(t=this.pageCount-4,r=this.pageCount),t<1&&(t=1);for(let i=t;i<=r;i++)e.push(i);return e}},methods:{handleEmit(e,t){this.$emit(e,t)},refresh(){this.initColumnSettings(),this.searchBarOpen=!1,this.loadDataOnInit?this.loadData():this.rows=[],this.selectedRows=[],this.advancedSearch||(this.$el.querySelector(".filter-input").value=""),this.$el.querySelectorAll(".advanced-filter-input").forEach(e=>{e.value=""})},toggleSearch(){this.advancedSearch||(this.searchBarOpen=!0),this.advancedSearch&&(this.searchBarOpen=!this.searchBarOpen)},clearSearch(){this.searchBarOpen=!1,this.$el.querySelector(".filter-input").value="",this.columnSettings.search.value="",this.loadData()},setAdvancedSearchFilters(){this.columnSettings.columns.forEach((e,t)=>{e.searchable&&(e.search.value=this.$el.querySelector(`input[name="${e.name}"]`).value)}),this.loadData()},loadData(){this.columnSettings.draw++,this.clearSelectedRows();const e={...this.requestQueryParams,...this.columnSettings};rn.get(this.url,{params:e}).then(t=>{if(t.data.error){this.cardError="error loading data. see console for details",console.error(t.data.error);return}this.cardError=null,this.rows=t.data.data,this.recordsTotal=t.data.recordsTotal,this.recordsFiltered=t.data.recordsFiltered}).catch(t=>{this.cardError=t.response.data.message,console.error(t)})},initColumnSettings(){this.columnSettings={draw:0,columns:this.columns.map((e,t)=>({data:e.data,name:e.name,searchable:e.searchable===void 0?!0:e.searchable,sortable:e.sortable===void 0?!0:e.sortable,visible:e.visible===void 0?!0:e.visible,search:{value:"",regex:!1}})),order:this.order,start:0,length:10,search:{value:"",regex:!1}}},setPageLength(e){this.columnSettings.length=e,this.loadData()},setPage(e){e<1||e>this.pageCount||(this.columnSettings.start=(e-1)*this.columnSettings.length,this.loadData())},setSearchTerm(){setTimeout(()=>{this.columnSettings.search.value=this.$el.querySelector(".filter-input").value,this.columnSettings.start=0,this.loadData()},500)},setSorting(e){this.columnSettings.columns[e].sortable&&(this.columnSettings.order[0].column==e?this.columnSettings.order[0].dir=this.columnSettings.order[0].dir=="asc"?"desc":"asc":this.columnSettings.order=[{column:e,dir:"asc"}],this.loadData())},generateLink(e,t){let r=[];e.resourceIds.forEach(o=>{r.push(t[o])});let i=route(e.name,r);return e.query&&(i+="?"+new URLSearchParams(e.query).toString()),i},selectAllRows(){this.selectedRows.length==this.rows.length?this.selectedRows=[]:this.selectedRows=this.rows.map(e=>e.id)},clearSelectedRows(){this.selectedRows=[]},filterColumns(e){this.columnSettings.columns.forEach((t,r)=>{t.searchable&&(t.search.value="",e.forEach(i=>{i.name==t.name&&(t.search.value=i.value)}))}),this.loadData()},getSelectedRows(){return this.selectedRows}},mounted(){this.initColumnSettings(),this.loadDataOnInit&&this.loadData()}},Se=e=>(d.pushScopeId("data-v-2fb2bbe2"),e=e(),d.popScopeId(),e),Cc={key:0,class:"card-icon"},Rc={key:0,class:"material-icons"},xc={key:1,class:"material-icons"},Nc={key:1,class:"card-title"},Bc={key:2,class:"card-title text-danger"},Ic={class:"form-group label-floating is-empty"},Fc=Se(()=>d.createElementVNode("i",{class:"material-icons search-icon-left"},"search",-1)),kc=[Se(()=>d.createElementVNode("i",{class:"material-icons"},"close",-1))],Lc={class:"card-actions icons right-top"},Dc={key:0},Mc=Se(()=>d.createElementVNode("i",{class:"material-icons"},"add",-1)),jc=[Se(()=>d.createElementVNode("i",{class:"material-icons"},"search",-1))],Uc={class:"dropdown","data-tippy-content":"Show Entries"},Vc=Se(()=>d.createElementVNode("a",{href:"javascript:void(0)","data-bs-toggle":"dropdown"},[d.createElementVNode("i",{class:"material-icons"},"more_vert")],-1)),$c={class:"dropdown-menu dropdown-menu-right"},qc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"10",-1))],Hc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"25",-1))],zc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"50",-1))],Wc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"100",-1))],Gc={class:"card-body"},Jc=["name","placeholder"],Kc=Se(()=>d.createElementVNode("button",{type:"submit",class:"btn btn-primary"},"Meklēt",-1)),Qc={class:"table-responsive"},Xc={class:"dataTables_wrapper no-footer"},Yc={key:0},Zc=["onClick"],eu={key:1,class:"w-25"},tu=["onClick"],ru={key:0},nu=["value"],iu={key:0},ou=["innerHTML"],au={key:1},su=["onClick"],lu={key:0,class:"material-icons"},cu={class:"dataTables_info"},uu={key:0},fu={class:"dataTables_paginate paging_simple_numbers user-select-none",id:"document-index-table_paginate"},du=["onClick"];function pu(e,t,r,i,o,a){const l=d.resolveComponent("Link");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["card",r.cardClasses])},[d.createElementVNode("header",{class:d.normalizeClass(["card-header",{"card-header-primary":!o.cardError&&r.cardIcon,"card-header-danger":o.cardError&&r.cardIcon,"card-header-icon":r.cardIcon}])},[r.cardIcon?(d.openBlock(),d.createElementBlock("div",Cc,[o.cardError?(d.openBlock(),d.createElementBlock("i",xc,"dangerous")):(d.openBlock(),d.createElementBlock("i",Rc,d.toDisplayString(r.cardIcon),1))])):d.createCommentVNode("",!0),r.cardTitle&&!o.cardError?(d.openBlock(),d.createElementBlock("h4",Nc,d.toDisplayString(r.cardTitle),1)):d.createCommentVNode("",!0),o.cardError?(d.openBlock(),d.createElementBlock("h4",Bc,d.toDisplayString(o.cardError),1)):d.createCommentVNode("",!0),r.advancedSearch?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:3,class:d.normalizeClass(["card-search",{open:o.searchBarOpen}])},[d.createElementVNode("div",Ic,[Fc,d.createElementVNode("input",{type:"text",class:"form-control filter-input",placeholder:"Search...",autocomplete:"off",onKeyup:t[0]||(t[0]=(...c)=>a.setSearchTerm&&a.setSearchTerm(...c))},null,32),d.createElementVNode("a",{href:"javascript:void(0)",class:"close-search",onClick:t[1]||(t[1]=(...c)=>a.clearSearch&&a.clearSearch(...c)),"data-tippy-content":"Close"},kc)])],2)),d.createElementVNode("ul",Lc,[d.renderSlot(e.$slots,"actions",{},void 0,!0),r.createLink?(d.openBlock(),d.createElementBlock("li",Dc,[d.createVNode(l,{href:r.createLink,"data-tippy-content":"Create new"},{default:d.withCtx(()=>[Mc]),_:1},8,["href"])])):d.createCommentVNode("",!0),d.createElementVNode("li",null,[d.createElementVNode("a",{href:"javascript:void(0)","data-tippy-content":"Meklēt",onClick:t[2]||(t[2]=(...c)=>a.toggleSearch&&a.toggleSearch(...c))},jc)]),d.createElementVNode("li",Uc,[Vc,d.createElementVNode("ul",$c,[d.createElementVNode("li",{onClick:t[3]||(t[3]=c=>a.setPageLength(10))},qc),d.createElementVNode("li",{onClick:t[4]||(t[4]=c=>a.setPageLength(25))},Hc),d.createElementVNode("li",{onClick:t[5]||(t[5]=c=>a.setPageLength(50))},zc),d.createElementVNode("li",{onClick:t[6]||(t[6]=c=>a.setPageLength(100))},Wc)])])])],2),d.createElementVNode("div",Gc,[d.renderSlot(e.$slots,"default",{},void 0,!0),r.advancedSearch?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["toolbar",{open:o.searchBarOpen}])},[d.createElementVNode("form",{onSubmit:t[7]||(t[7]=d.withModifiers((...c)=>a.setAdvancedSearchFilters&&a.setAdvancedSearchFilters(...c),["prevent"]))},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.columns,(c,h)=>(d.openBlock(),d.createElementBlock(d.Fragment,null,[c.searchable!==!1?(d.openBlock(),d.createElementBlock("span",{class:"bmd-form-group",key:h},[d.createElementVNode("input",{name:c.name,class:"form-control advanced-filter-input",placeholder:c.displayName,autocomplete:"off"},null,8,Jc)])):d.createCommentVNode("",!0)],64))),256)),Kc],32)],2)):d.createCommentVNode("",!0),d.createElementVNode("div",Qc,[d.createElementVNode("div",Xc,[d.createElementVNode("table",{class:d.normalizeClass(["table data-table dataTable no-footer",{"table-hover":r.clickableRows}])},[d.createElementVNode("thead",null,[d.createElementVNode("tr",null,[r.selectableRows?(d.openBlock(),d.createElementBlock("th",Yc,[d.createElementVNode("input",{type:"checkbox",onClick:t[8]||(t[8]=(...c)=>a.selectAllRows&&a.selectAllRows(...c)),ref:"selectAllRows"},null,512)])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.columns,(c,h)=>(d.openBlock(),d.createElementBlock(d.Fragment,{key:h},[c.visible!==!1?(d.openBlock(),d.createElementBlock("th",{key:0,class:d.normalizeClass([a.columnSortingClasses[h],c.sortable!==!1?"sorting":""]),onClick:f=>a.setSorting(h),style:d.normalizeStyle(e.comlumn.width?{width:c.width}:{})},d.toDisplayString(c.displayName),15,Zc)):d.createCommentVNode("",!0)],64))),128)),r.actions?(d.openBlock(),d.createElementBlock("th",eu,"Darbības")):d.createCommentVNode("",!0)])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.rows,(c,h)=>(d.openBlock(),d.createElementBlock("tr",{key:h,onClick:f=>r.clickableRows?e.$emit("row-click",c):null},[r.selectableRows?(d.openBlock(),d.createElementBlock("td",ru,[d.withDirectives(d.createElementVNode("input",{type:"checkbox",value:c.id,"onUpdate:modelValue":t[9]||(t[9]=f=>o.selectedRows=f)},null,8,nu),[[d.vModelCheckbox,o.selectedRows]])])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.columns,(f,y)=>(d.openBlock(),d.createElementBlock(d.Fragment,{key:y},[f.visible!==!1?(d.openBlock(),d.createElementBlock("td",iu,[f.linkParams?(d.openBlock(),d.createBlock(l,{key:0,href:a.generateLink(f.linkParams,c),innerHTML:c[f.data]},null,8,["href","innerHTML"])):(d.openBlock(),d.createElementBlock("span",{key:1,innerHTML:c[f.data]},null,8,ou))])):d.createCommentVNode("",!0)],64))),128)),r.actions?(d.openBlock(),d.createElementBlock("td",au,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.actions,(f,y)=>(d.openBlock(),d.createElementBlock("button",{key:y,class:d.normalizeClass(["btn btn-sm",f.class]),onClick:b=>a.handleEmit(f.emit,c)},[f.icon?(d.openBlock(),d.createElementBlock("i",lu,d.toDisplayString(f.icon),1)):d.createCommentVNode("",!0),d.createTextVNode(" "+d.toDisplayString(f.label),1)],10,su))),128))])):d.createCommentVNode("",!0)],8,tu))),128))])],2),d.createElementVNode("div",cu,[d.createTextVNode(" Rāda "+d.toDisplayString(a.firstRecord)+". līdz "+d.toDisplayString(a.lastRecord)+". no "+d.toDisplayString(o.recordsFiltered)+" ierakstiem ",1),o.recordsFiltered!=o.recordsTotal?(d.openBlock(),d.createElementBlock("span",uu," (kopā "+d.toDisplayString(o.recordsTotal)+" ierkasti) ",1)):d.createCommentVNode("",!0)]),d.createElementVNode("div",fu,[d.createElementVNode("a",{class:d.normalizeClass(["paginate_button first user-select-none",{disabled:o.columnSettings.start==0}]),onClick:t[10]||(t[10]=c=>a.setPage(1))},"Pirmā",2),d.createElementVNode("a",{class:d.normalizeClass(["paginate_button previous",{disabled:o.columnSettings.start==0}]),onClick:t[11]||(t[11]=c=>a.setPage(a.currentPage-1))},"Iepriekšējā",2),d.createElementVNode("span",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(a.pages,(c,h)=>(d.openBlock(),d.createElementBlock("a",{class:d.normalizeClass(["paginate_button",{current:c==a.currentPage}]),onClick:f=>a.setPage(c)},d.toDisplayString(c),11,du))),256))]),d.createElementVNode("a",{class:d.normalizeClass(["paginate_button next",{disabled:o.columnSettings.start>=a.lastPageStart}]),onClick:t[12]||(t[12]=c=>a.setPage(a.currentPage+1))},"Nākamā",2),d.createElementVNode("a",{class:d.normalizeClass(["paginate_button last",{disabled:o.columnSettings.start>=a.lastPageStart}]),onClick:t[13]||(t[13]=c=>a.setPage(a.pageCount))},"Pēdējā",2)])])])])],2)}return Tc(Pc,[["render",pu],["__scopeId","data-v-2fb2bbe2"]])});
|
|
11
|
+
<Link href="${a}" method="${o}" as="button">...</Link>`),d.h(e.as,{...r,...i==="a"?{href:a}:{},onClick:c=>{_c(c)&&(c.preventDefault(),Rn.visit(a,{data:l,method:o,replace:e.replace,preserveScroll:e.preserveScroll,preserveState:e.preserveState??o!=="get",only:e.only,headers:e.headers,onCancelToken:r.onCancelToken||(()=>({})),onBefore:r.onBefore||(()=>({})),onStart:r.onStart||(()=>({})),onProgress:r.onProgress||(()=>({})),onFinish:r.onFinish||(()=>({})),onCancel:r.onCancel||(()=>({})),onSuccess:r.onSuccess||(()=>({})),onError:r.onError||(()=>({}))}))}},t)}}}),Oc=Ac;const bu="",Tc=(e,t)=>{const r=e.__vccOpts||e;for(const[i,o]of t)r[i]=o;return r},Pc={name:"DatatableCard",components:{Link:Oc},props:{cardTitle:{type:String,required:!1,default:null},cardIconStyle:{type:String,required:!1,default:"card-header-primary"},cardIcon:{type:String,required:!1,default:null},cardClasses:{type:String,required:!1,default:null},createLink:{type:String,required:!1,default:null},columns:{type:Array,required:!0},url:{type:String,required:!0},selectableRows:{type:Boolean,required:!1,default:!1},order:{type:Array,required:!1,default:[{column:0,dir:"asc"}]},advancedSearch:{type:Boolean,required:!1,default:!1},loadDataOnInit:{type:Boolean,required:!1,default:!0},requestQueryParams:{type:Object,required:!1,default:()=>({})},actions:{type:Array,required:!1},clickableRows:{type:Boolean,required:!1,default:!1}},emits:["row-click"],data(){return{searchBarOpen:!1,rows:[],columnSettings:{},searchTerm:"",recordsTotal:0,recordsFiltered:0,selectedRows:[],cardError:null}},watch:{selectedRows:function(e,t){this.selectableRows&&(e.length===this.rows.length&&e.length>0?(this.$refs.selectAllRows.indeterminate=!1,this.$refs.selectAllRows.checked=!0):e.length===0?(this.$refs.selectAllRows.indeterminate=!1,this.$refs.selectAllRows.checked=!1):this.$refs.selectAllRows.indeterminate=!0)}},computed:{firstRecord(){return this.columnSettings.start+1},lastRecord(){return this.columnSettings.start+this.rows.length},currentPage(){return Math.ceil(this.columnSettings.start/this.columnSettings.length)+1},pageCount(){return Math.ceil(this.recordsFiltered/this.columnSettings.length)},lastPageStart(){return(this.pageCount-1)*this.columnSettings.length},columnSortingClasses(){let e=[];if(!this.columnSettings.order)return e;for(let t=0;t<this.columns.length;t++){let r="";for(let i=0;i<this.columnSettings.order.length;i++)this.columnSettings.order[i].column==t&&(r=this.columnSettings.order[i].dir=="asc"?"sorting_asc":"sorting_desc");e.push(r)}return e},pages(){let e=[],t=this.currentPage-2,r=this.currentPage+2;t<1&&(t=1,r=5),r>this.pageCount&&(t=this.pageCount-4,r=this.pageCount),t<1&&(t=1);for(let i=t;i<=r;i++)e.push(i);return e}},methods:{handleEmit(e,t){this.$emit(e,t)},refresh(){this.initColumnSettings(),this.searchBarOpen=!1,this.loadDataOnInit?this.loadData():this.rows=[],this.selectedRows=[],this.advancedSearch||(this.$el.querySelector(".filter-input").value=""),this.$el.querySelectorAll(".advanced-filter-input").forEach(e=>{e.value=""})},toggleSearch(){this.advancedSearch||(this.searchBarOpen=!0),this.advancedSearch&&(this.searchBarOpen=!this.searchBarOpen)},clearSearch(){this.searchBarOpen=!1,this.$el.querySelector(".filter-input").value="",this.columnSettings.search.value="",this.loadData()},setAdvancedSearchFilters(){this.columnSettings.columns.forEach((e,t)=>{e.searchable&&(e.search.value=this.$el.querySelector(`input[name="${e.name}"]`).value)}),this.loadData()},loadData(){this.columnSettings.draw++,this.clearSelectedRows();const e={...this.requestQueryParams,...this.columnSettings};rn.get(this.url,{params:e}).then(t=>{if(t.data.error){this.cardError="error loading data. see console for details",console.error(t.data.error);return}this.cardError=null,this.rows=t.data.data,this.recordsTotal=t.data.recordsTotal,this.recordsFiltered=t.data.recordsFiltered}).catch(t=>{this.cardError=t.response.data.message,console.error(t)})},initColumnSettings(){this.columnSettings={draw:0,columns:this.columns.map((e,t)=>({data:e.data,name:e.name,searchable:e.searchable===void 0?!0:e.searchable,sortable:e.sortable===void 0?!0:e.sortable,visible:e.visible===void 0?!0:e.visible,search:{value:"",regex:!1}})),order:this.order,start:0,length:10,search:{value:"",regex:!1}}},setPageLength(e){this.columnSettings.length=e,this.loadData()},setPage(e){e<1||e>this.pageCount||(this.columnSettings.start=(e-1)*this.columnSettings.length,this.loadData())},setSearchTerm(){setTimeout(()=>{this.columnSettings.search.value=this.$el.querySelector(".filter-input").value,this.columnSettings.start=0,this.loadData()},500)},setSorting(e){this.columnSettings.columns[e].sortable&&(this.columnSettings.order[0].column==e?this.columnSettings.order[0].dir=this.columnSettings.order[0].dir=="asc"?"desc":"asc":this.columnSettings.order=[{column:e,dir:"asc"}],this.loadData())},generateLink(e,t){let r=[];e.resourceIds.forEach(o=>{r.push(t[o])});let i=route(e.name,r);return e.query&&(i+="?"+new URLSearchParams(e.query).toString()),i},selectAllRows(){this.selectedRows.length==this.rows.length?this.selectedRows=[]:this.selectedRows=this.rows.map(e=>e.id)},clearSelectedRows(){this.selectedRows=[]},filterColumns(e){this.columnSettings.columns.forEach((t,r)=>{t.searchable&&(t.search.value="",e.forEach(i=>{i.name==t.name&&(t.search.value=i.value)}))}),this.loadData()},getSelectedRows(){return this.selectedRows}},mounted(){this.initColumnSettings(),this.loadDataOnInit&&this.loadData()}},Se=e=>(d.pushScopeId("data-v-0b60868f"),e=e(),d.popScopeId(),e),Cc={key:0,class:"card-icon"},Rc={key:0,class:"material-icons"},xc={key:1,class:"material-icons"},Nc={key:1,class:"card-title"},Bc={key:2,class:"card-title text-danger"},Ic={class:"form-group label-floating is-empty"},Fc=Se(()=>d.createElementVNode("i",{class:"material-icons search-icon-left"},"search",-1)),kc=[Se(()=>d.createElementVNode("i",{class:"material-icons"},"close",-1))],Lc={class:"card-actions icons right-top"},Dc={key:0},Mc=Se(()=>d.createElementVNode("i",{class:"material-icons"},"add",-1)),jc=[Se(()=>d.createElementVNode("i",{class:"material-icons"},"search",-1))],Uc={class:"dropdown","data-tippy-content":"Show Entries"},Vc=Se(()=>d.createElementVNode("a",{href:"javascript:void(0)","data-bs-toggle":"dropdown"},[d.createElementVNode("i",{class:"material-icons"},"more_vert")],-1)),$c={class:"dropdown-menu dropdown-menu-right"},qc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"10",-1))],Hc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"25",-1))],zc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"50",-1))],Wc=[Se(()=>d.createElementVNode("a",{href:"javascript:void(0)"},"100",-1))],Gc={class:"card-body"},Jc=["name","placeholder"],Kc=Se(()=>d.createElementVNode("button",{type:"submit",class:"btn btn-primary"},"Meklēt",-1)),Qc={class:"table-responsive"},Xc={class:"dataTables_wrapper no-footer"},Yc={key:0},Zc=["onClick"],eu={key:1,class:"w-25"},tu=["onClick"],ru={key:0},nu=["value"],iu={key:0},ou=["innerHTML"],au={key:1},su=["onClick"],lu={key:0,class:"material-icons"},cu={class:"dataTables_info"},uu={key:0},fu={class:"dataTables_paginate paging_simple_numbers user-select-none",id:"document-index-table_paginate"},du=["onClick"];function pu(e,t,r,i,o,a){const l=d.resolveComponent("Link");return d.openBlock(),d.createElementBlock("div",{class:d.normalizeClass(["card",r.cardClasses])},[d.createElementVNode("header",{class:d.normalizeClass(["card-header",{"card-header-primary":!o.cardError&&r.cardIcon,"card-header-danger":o.cardError&&r.cardIcon,"card-header-icon":r.cardIcon}])},[r.cardIcon?(d.openBlock(),d.createElementBlock("div",Cc,[o.cardError?(d.openBlock(),d.createElementBlock("i",xc,"dangerous")):(d.openBlock(),d.createElementBlock("i",Rc,d.toDisplayString(r.cardIcon),1))])):d.createCommentVNode("",!0),r.cardTitle&&!o.cardError?(d.openBlock(),d.createElementBlock("h4",Nc,d.toDisplayString(r.cardTitle),1)):d.createCommentVNode("",!0),o.cardError?(d.openBlock(),d.createElementBlock("h4",Bc,d.toDisplayString(o.cardError),1)):d.createCommentVNode("",!0),r.advancedSearch?d.createCommentVNode("",!0):(d.openBlock(),d.createElementBlock("div",{key:3,class:d.normalizeClass(["card-search",{open:o.searchBarOpen}])},[d.createElementVNode("div",Ic,[Fc,d.createElementVNode("input",{type:"text",class:"form-control filter-input",placeholder:"Search...",autocomplete:"off",onKeyup:t[0]||(t[0]=(...c)=>a.setSearchTerm&&a.setSearchTerm(...c))},null,32),d.createElementVNode("a",{href:"javascript:void(0)",class:"close-search",onClick:t[1]||(t[1]=(...c)=>a.clearSearch&&a.clearSearch(...c)),"data-tippy-content":"Close"},kc)])],2)),d.createElementVNode("ul",Lc,[d.renderSlot(e.$slots,"actions",{},void 0,!0),r.createLink?(d.openBlock(),d.createElementBlock("li",Dc,[d.createVNode(l,{href:r.createLink,"data-tippy-content":"Create new"},{default:d.withCtx(()=>[Mc]),_:1},8,["href"])])):d.createCommentVNode("",!0),d.createElementVNode("li",null,[d.createElementVNode("a",{href:"javascript:void(0)","data-tippy-content":"Meklēt",onClick:t[2]||(t[2]=(...c)=>a.toggleSearch&&a.toggleSearch(...c))},jc)]),d.createElementVNode("li",Uc,[Vc,d.createElementVNode("ul",$c,[d.createElementVNode("li",{onClick:t[3]||(t[3]=c=>a.setPageLength(10))},qc),d.createElementVNode("li",{onClick:t[4]||(t[4]=c=>a.setPageLength(25))},Hc),d.createElementVNode("li",{onClick:t[5]||(t[5]=c=>a.setPageLength(50))},zc),d.createElementVNode("li",{onClick:t[6]||(t[6]=c=>a.setPageLength(100))},Wc)])])])],2),d.createElementVNode("div",Gc,[d.renderSlot(e.$slots,"default",{},void 0,!0),r.advancedSearch?(d.openBlock(),d.createElementBlock("div",{key:0,class:d.normalizeClass(["toolbar",{open:o.searchBarOpen}])},[d.createElementVNode("form",{onSubmit:t[7]||(t[7]=d.withModifiers((...c)=>a.setAdvancedSearchFilters&&a.setAdvancedSearchFilters(...c),["prevent"]))},[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.columns,(c,h)=>(d.openBlock(),d.createElementBlock(d.Fragment,null,[c.searchable!==!1?(d.openBlock(),d.createElementBlock("span",{class:"bmd-form-group",key:h},[d.createElementVNode("input",{name:c.name,class:"form-control advanced-filter-input",placeholder:c.displayName,autocomplete:"off"},null,8,Jc)])):d.createCommentVNode("",!0)],64))),256)),Kc],32)],2)):d.createCommentVNode("",!0),d.createElementVNode("div",Qc,[d.createElementVNode("div",Xc,[d.createElementVNode("table",{class:d.normalizeClass(["table data-table dataTable no-footer",{"table-hover":r.clickableRows}])},[d.createElementVNode("thead",null,[d.createElementVNode("tr",null,[r.selectableRows?(d.openBlock(),d.createElementBlock("th",Yc,[d.createElementVNode("input",{type:"checkbox",onClick:t[8]||(t[8]=(...c)=>a.selectAllRows&&a.selectAllRows(...c)),ref:"selectAllRows"},null,512)])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.columns,(c,h)=>(d.openBlock(),d.createElementBlock(d.Fragment,{key:h},[c.visible!==!1?(d.openBlock(),d.createElementBlock("th",{key:0,class:d.normalizeClass([a.columnSortingClasses[h],c.sortable!==!1?"sorting":""]),onClick:f=>a.setSorting(h),style:d.normalizeStyle(c.width?{width:c.width}:{})},d.toDisplayString(c.displayName),15,Zc)):d.createCommentVNode("",!0)],64))),128)),r.actions?(d.openBlock(),d.createElementBlock("th",eu,"Darbības")):d.createCommentVNode("",!0)])]),d.createElementVNode("tbody",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(o.rows,(c,h)=>(d.openBlock(),d.createElementBlock("tr",{key:h,onClick:f=>r.clickableRows?e.$emit("row-click",c):null},[r.selectableRows?(d.openBlock(),d.createElementBlock("td",ru,[d.withDirectives(d.createElementVNode("input",{type:"checkbox",value:c.id,"onUpdate:modelValue":t[9]||(t[9]=f=>o.selectedRows=f)},null,8,nu),[[d.vModelCheckbox,o.selectedRows]])])):d.createCommentVNode("",!0),(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.columns,(f,y)=>(d.openBlock(),d.createElementBlock(d.Fragment,{key:y},[f.visible!==!1?(d.openBlock(),d.createElementBlock("td",iu,[f.linkParams?(d.openBlock(),d.createBlock(l,{key:0,href:a.generateLink(f.linkParams,c),innerHTML:c[f.data]},null,8,["href","innerHTML"])):(d.openBlock(),d.createElementBlock("span",{key:1,innerHTML:c[f.data]},null,8,ou))])):d.createCommentVNode("",!0)],64))),128)),r.actions?(d.openBlock(),d.createElementBlock("td",au,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(r.actions,(f,y)=>(d.openBlock(),d.createElementBlock("button",{key:y,class:d.normalizeClass(["btn btn-sm",f.class]),onClick:b=>a.handleEmit(f.emit,c)},[f.icon?(d.openBlock(),d.createElementBlock("i",lu,d.toDisplayString(f.icon),1)):d.createCommentVNode("",!0),d.createTextVNode(" "+d.toDisplayString(f.label),1)],10,su))),128))])):d.createCommentVNode("",!0)],8,tu))),128))])],2),d.createElementVNode("div",cu,[d.createTextVNode(" Rāda "+d.toDisplayString(a.firstRecord)+". līdz "+d.toDisplayString(a.lastRecord)+". no "+d.toDisplayString(o.recordsFiltered)+" ierakstiem ",1),o.recordsFiltered!=o.recordsTotal?(d.openBlock(),d.createElementBlock("span",uu," (kopā "+d.toDisplayString(o.recordsTotal)+" ieraksti) ",1)):d.createCommentVNode("",!0)]),d.createElementVNode("div",fu,[d.createElementVNode("a",{class:d.normalizeClass(["paginate_button first user-select-none",{disabled:o.columnSettings.start==0}]),onClick:t[10]||(t[10]=c=>a.setPage(1))},"Pirmā",2),d.createElementVNode("a",{class:d.normalizeClass(["paginate_button previous",{disabled:o.columnSettings.start==0}]),onClick:t[11]||(t[11]=c=>a.setPage(a.currentPage-1))},"Iepriekšējā",2),d.createElementVNode("span",null,[(d.openBlock(!0),d.createElementBlock(d.Fragment,null,d.renderList(a.pages,(c,h)=>(d.openBlock(),d.createElementBlock("a",{class:d.normalizeClass(["paginate_button",{current:c==a.currentPage}]),onClick:f=>a.setPage(c)},d.toDisplayString(c),11,du))),256))]),d.createElementVNode("a",{class:d.normalizeClass(["paginate_button next",{disabled:o.columnSettings.start>=a.lastPageStart}]),onClick:t[12]||(t[12]=c=>a.setPage(a.currentPage+1))},"Nākamā",2),d.createElementVNode("a",{class:d.normalizeClass(["paginate_button last",{disabled:o.columnSettings.start>=a.lastPageStart}]),onClick:t[13]||(t[13]=c=>a.setPage(a.pageCount))},"Pēdējā",2)])])])])],2)}return Tc(Pc,[["render",pu],["__scopeId","data-v-0b60868f"]])});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.toolbar[data-v-
|
|
1
|
+
.toolbar[data-v-0b60868f]:not(.open){display:none}.card .card-heading[data-v-0b60868f]{padding:15px 20px;position:relative;height:65px}.card .card-search[data-v-0b60868f]{position:absolute;top:0;right:0;margin:0;padding:0;height:100%;z-index:15;-webkit-transition:all .2s;-o-transition:all .2s;transition:all .2s;border:0;box-shadow:none;width:100%;display:none;background:#fff}.card .card-search .form-group[data-v-0b60868f]{margin:0;padding:0;height:65px}.card .card-search .search-icon-left[data-v-0b60868f]{left:15px;right:auto}.card .card-search .close-search[data-v-0b60868f],.card .card-search .search-icon-left[data-v-0b60868f]{top:50%;margin-top:-15px;line-height:30px;margin-right:10px;font-size:25px;position:absolute;right:15px;z-index:99}.card .card-search .form-control[data-v-0b60868f]{width:100%;height:100%;position:absolute;border:none;box-shadow:none;left:0;top:0;margin:0;font-size:15px;text-indent:45px;background-color:#eef5f9;background-image:none}.card .card-search .close-search[data-v-0b60868f]{right:15px;left:auto}.card .card-search .search-icon-left[data-v-0b60868f]{top:50%;margin-top:-15px;line-height:30px;margin-right:10px;font-size:25px;position:absolute;right:15px;z-index:99;width:30px}.card .card-search.open[data-v-0b60868f]{display:block}.card-heading ul.card-actions.icons[data-v-0b60868f]{position:absolute;list-style:none;padding:0;margin:0}ul.card-actions.icons li[data-v-0b60868f]{display:inline}.dataTables_wrapper .dataTables_paginate .paginate_button.current[data-v-0b60868f],.dataTables_wrapper .dataTables_paginate .paginate_button.current[data-v-0b60868f]:hover{background:unset;background-color:#00bcd4;border-color:#00bcd4;box-shadow:0 4px 5px #00bcd424,0 1px 10px #00bcd41f,0 2px 4px -1px #00bcd433}.dataTables_wrapper .dataTables_paginate .paginate_button[data-v-0b60868f],.dataTables_wrapper .dataTables_paginate .paginate_button[data-v-0b60868f]:hover{background:unset;border:0;border-color:#00bcd4;border-radius:30px!important;-webkit-transition:all .3s;transition:all .3s;padding:0 11px;margin:0 3px;min-width:30px;height:30px;line-height:30px;color:#999!important;font-weight:400;font-size:12px;text-transform:uppercase;background:transparent;text-align:center}.dataTables_wrapper .dataTables_paginate .paginate_button[data-v-0b60868f]:hover{border:1}.card-header[data-v-0b60868f]:first-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card .card-header[data-v-0b60868f]{border-bottom:none;background:transparent}.card [class*=card-header-][data-v-0b60868f],.card[class*=bg-][data-v-0b60868f]{color:#fff}.card .card-header[data-v-0b60868f]{z-index:3!important}.card [class*=card-header-][data-v-0b60868f]{margin:0 15px;padding:0;position:relative}.card .card-header-primary .card-icon[data-v-0b60868f],.card .card-header-primary .card-text[data-v-0b60868f],.card .card-header-primary[data-v-0b60868f]:not(.card-header-icon):not(.card-header-text),.card.bg-primary[data-v-0b60868f],.card.card-rotate.bg-primary .front[data-v-0b60868f],.card.card-rotate.bg-primary .back[data-v-0b60868f]{background:linear-gradient(60deg,#ab47bc,#8e24aa)}.card .card-header-primary .card-icon[data-v-0b60868f],.card .card-header-primary[data-v-0b60868f]:not(.card-header-icon):not(.card-header-text),.card .card-header-primary .card-text[data-v-0b60868f]{box-shadow:0 4px 20px #00000024,0 7px 10px -5px #9c27b066}.card [class*=card-header-] .card-icon[data-v-0b60868f],.card [class*=card-header-] .card-text[data-v-0b60868f]{border-radius:3px;background-color:#999;padding:15px;margin-top:-20px;margin-right:15px;float:left}.card .card-header.card-header-icon i[data-v-0b60868f],.card .card-header.card-header-text i[data-v-0b60868f]{width:33px;height:33px;text-align:center;line-height:33px}.card[data-v-0b60868f]{border:0;margin-bottom:30px;margin-top:30px;border-radius:6px;color:#333;background:#ffffff;width:100%;box-shadow:0 2px 2px #00000024,0 3px 1px -2px #0003,0 1px 5px #0000001f;box-shadow:0 1px 4px #00000024;font-size:.875rem}.card .card-header.card-header-icon .card-title[data-v-0b60868f],.card .card-header.card-header-text .card-title[data-v-0b60868f]{margin-top:15px;color:#3c4858}.card .card-header.card-header-icon h4[data-v-0b60868f],.card .card-header.card-header-text h4[data-v-0b60868f]{font-weight:300}.card .card-header .card-title[data-v-0b60868f]{margin-bottom:3px}.card .card-actions[data-v-0b60868f]{position:absolute;z-index:1;top:-50px;width:calc(100% - 30px);left:17px;right:17px;text-align:center}.card .card-actions[data-v-0b60868f]{text-align:end}.card ul.card-actions.icons[data-v-0b60868f]{position:absolute;list-style:none;padding:0;margin:0;right:10px;top:15px}ul.card-actions.icons.right-top[data-v-0b60868f]{right:10px;top:15px}ul.card-actions.icons li[data-v-0b60868f]{display:inline;width:100%;text-align:unset}.dropdown-menu .dropdown-item[data-v-0b60868f],.dropdown-menu li>a[data-v-0b60868f]{position:relative;width:auto;display:flex;flex-flow:nowrap;align-items:center;color:#333;font-weight:400;text-decoration:none;font-size:.8125rem;border-radius:.125rem;margin:0 .3125rem;transition:all .15s linear;min-width:7rem;padding:.625rem 1.25rem;overflow:hidden;line-height:1.42857143;text-overflow:ellipsis;word-wrap:break-word}.dropdown-menu .dropdown-item[data-v-0b60868f]:hover,.dropdown-menu .dropdown-item[data-v-0b60868f]:focus,.dropdown-menu a[data-v-0b60868f]:hover,.dropdown-menu a[data-v-0b60868f]:focus,.dropdown-menu a[data-v-0b60868f]:active{box-shadow:0 4px 20px #00000024,0 7px 10px -5px #9c27b066;background-color:#9c27b0;color:#fff}.dropdown-menu .dropdown-item[data-v-0b60868f],.dropdown-menu li>a[data-v-0b60868f]{padding-right:1.5rem;padding-left:1.5rem}.dropdown-menu[data-v-0b60868f]{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:10rem;padding:.5rem 0;margin:.125rem 0 0;font-size:1rem;color:#212529;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:.25rem;box-shadow:0 2px 2px #00000024,0 3px 1px -2px #0003,0 1px 5px #0000001f}.dropdown-menu[data-v-0b60868f]{border:0;display:none;padding:.3125rem 0;transform:scale(0);transform-origin:0 0;will-change:transform,opacity;box-shadow:0 2px 5px #00000042}.dropdown-menu[data-v-0b60868f]{margin:0!important}.clickable-rows tbody tr[data-v-0b60868f]{cursor:pointer}
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sulzanoks/vue-datatable",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"private": false,
|
|
5
|
-
"main": "./src/index.js",
|
|
6
|
-
"module": "./dist/datatable-card.es.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"import": "./dist/datatable-card.es.js",
|
|
10
|
-
"require": "./dist/datatable-card.umd.js"
|
|
11
|
-
},
|
|
12
|
-
"./dist/style.css": "./dist/style.css"
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist",
|
|
16
|
-
"src"
|
|
17
|
-
],
|
|
18
|
-
"type": "module",
|
|
19
|
-
"scripts": {
|
|
20
|
-
"dev": "vite",
|
|
21
|
-
"build": "vite build",
|
|
22
|
-
"preview": "vite preview"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@inertiajs/vue3": "^1.0.11",
|
|
26
|
-
"axios": "^1.5.0",
|
|
27
|
-
"vue": "^3.3.4"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@vitejs/plugin-vue": "^4.2.3",
|
|
31
|
-
"sass": "^1.67.0",
|
|
32
|
-
"vite": "^4.4.5"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@sulzanoks/vue-datatable",
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"module": "./dist/datatable-card.es.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/datatable-card.es.js",
|
|
10
|
+
"require": "./dist/datatable-card.umd.js"
|
|
11
|
+
},
|
|
12
|
+
"./dist/style.css": "./dist/style.css"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "vite build",
|
|
22
|
+
"preview": "vite preview"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@inertiajs/vue3": "^1.0.11",
|
|
26
|
+
"axios": "^1.5.0",
|
|
27
|
+
"vue": "^3.3.4"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
31
|
+
"sass": "^1.67.0",
|
|
32
|
+
"vite": "^4.4.5"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
<th v-if="column.visible !== false"
|
|
77
77
|
:class="[columnSortingClasses[index], column.sortable !== false ? 'sorting' : '']"
|
|
78
78
|
@click="setSorting(index)"
|
|
79
|
-
:style="
|
|
79
|
+
:style="column.width ? { width: column.width } : {}"
|
|
80
80
|
>
|
|
81
81
|
{{ column.displayName }}
|
|
82
82
|
</th>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class="dataTables_info">
|
|
117
117
|
Rāda {{ firstRecord }}. līdz {{ lastRecord }}. no {{ recordsFiltered }} ierakstiem
|
|
118
118
|
<span v-if="recordsFiltered != recordsTotal">
|
|
119
|
-
(kopā {{ recordsTotal }}
|
|
119
|
+
(kopā {{ recordsTotal }} ieraksti)
|
|
120
120
|
</span>
|
|
121
121
|
</div>
|
|
122
122
|
<div class="dataTables_paginate paging_simple_numbers user-select-none"
|