vi-grid-builder 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -0
- package/dist/vi-grid-builder.js +5714 -0
- package/dist/vi-grid-builder.umd.cjs +565 -0
- package/package.json +13 -1
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/vi-grid-builder.iml +0 -8
- package/.idea/watcherTasks.xml +0 -4
- package/.vscode/extensions.json +0 -3
- package/ViGridBuilderPlugin.js +0 -50
- package/playground/.vscode/extensions.json +0 -3
- package/playground/README.md +0 -29
- package/playground/index.html +0 -13
- package/playground/jsconfig.json +0 -8
- package/playground/package-lock.json +0 -2524
- package/playground/package.json +0 -20
- package/playground/public/favicon.ico +0 -0
- package/playground/src/App.vue +0 -86
- package/playground/src/assets/base.css +0 -86
- package/playground/src/assets/logo.svg +0 -1
- package/playground/src/assets/main.css +0 -35
- package/playground/src/components/ActionsField.vue +0 -99
- package/playground/src/components/ClickableRow.vue +0 -68
- package/playground/src/components/ClientSideData.vue +0 -86
- package/playground/src/components/ColumnVisibility.vue +0 -85
- package/playground/src/components/CustomField.vue +0 -64
- package/playground/src/components/CustomHeader.vue +0 -85
- package/playground/src/components/FieldTypes.vue +0 -150
- package/playground/src/components/GlobalOptions.vue +0 -68
- package/playground/src/components/PaginationOptions.vue +0 -130
- package/playground/src/components/RowSelect.vue +0 -72
- package/playground/src/components/ServerSideData.vue +0 -62
- package/playground/src/components/SortableColumnServerSide.vue +0 -73
- package/playground/src/components/TableStyle.vue +0 -112
- package/playground/src/components/fields/SampleCustomField.vue +0 -24
- package/playground/src/components/icons/IconCommunity.vue +0 -7
- package/playground/src/components/icons/IconDocumentation.vue +0 -7
- package/playground/src/components/icons/IconEcosystem.vue +0 -7
- package/playground/src/components/icons/IconSupport.vue +0 -7
- package/playground/src/components/icons/IconTooling.vue +0 -19
- package/playground/src/main.js +0 -49
- package/playground/vite.config.js +0 -17
- package/src/ViGridBuilder.scss +0 -189
- package/src/ViGridBuilder.vue +0 -393
- package/src/ViGridField.scss +0 -1
- package/src/ViGridField.vue +0 -90
- package/src/ViGridHeadCell.vue +0 -32
- package/src/ViGridHeadColumnCell.vue +0 -42
- package/src/ViGridHeader.vue +0 -67
- package/src/composables/useColumns.js +0 -21
- package/src/composables/useGridActions.js +0 -32
- package/src/composables/useGridSettings.js +0 -18
- package/src/composables/usePagination.js +0 -39
- package/src/composables/useRowHelper.js +0 -40
- package/src/composables/useRowSelect.js +0 -51
- package/src/composables/useSettings.js +0 -29
- package/src/composables/useSort.js +0 -125
- package/src/fields/ViGridActions.scss +0 -2
- package/src/fields/ViGridActions.vue +0 -83
- package/src/fields/ViGridBadge.scss +0 -13
- package/src/fields/ViGridBadge.vue +0 -20
- package/src/fields/ViGridCheckbox.vue +0 -31
- package/src/fields/ViGridDate.scss +0 -3
- package/src/fields/ViGridDate.vue +0 -40
- package/src/fields/ViGridImage.scss +0 -7
- package/src/fields/ViGridImage.vue +0 -18
- package/src/fields/ViGridLink.scss +0 -3
- package/src/fields/ViGridLink.vue +0 -28
- package/src/fields/ViGridNumber.scss +0 -3
- package/src/fields/ViGridNumber.vue +0 -30
- package/src/fields/ViGridText.scss +0 -0
- package/src/fields/ViGridText.vue +0 -18
- package/src/fields/partials/ViGridKebabMenu.scss +0 -65
- package/src/fields/partials/ViGridKebabMenu.vue +0 -90
- package/src/fields/partials/ViGridSimpleActions.scss +0 -4
- package/src/fields/partials/ViGridSimpleActions.vue +0 -25
- package/src/mixins/field-mixin.js +0 -13
- package/src/settings/DateSettings.js +0 -7
- package/src/settings/GridSettings.js +0 -24
- package/vite.config.js +0 -17
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {computed} from "vue";
|
|
2
|
-
export default function usePagination(props,emit,fetchData) {
|
|
3
|
-
const localPagination = computed({
|
|
4
|
-
get() {
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
page: props.pagination?.page,
|
|
8
|
-
rowsPerPage: props.pagination?.rowsPerPage
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
set(newValue) {
|
|
13
|
-
emit("update:pagination", {
|
|
14
|
-
...props.pagination,
|
|
15
|
-
...newValue
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const onPaginationChange = ({currentPage, rowsPerPage}) => {
|
|
21
|
-
let newPagination = {
|
|
22
|
-
...localPagination.value,
|
|
23
|
-
...currentPage && {page:currentPage},
|
|
24
|
-
...(rowsPerPage!== undefined) && {rowsPerPage},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
localPagination.value = newPagination;
|
|
28
|
-
if (props.serverMode) {
|
|
29
|
-
fetchData({pagination: newPagination})
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
localPagination,
|
|
35
|
-
onPaginationChange
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {computed, watch} from "vue";
|
|
2
|
-
import {globalGridSettings} from "../composables/useSettings.js";
|
|
3
|
-
|
|
4
|
-
export default function useRowHelper(props, emit, sortedRows) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const totalRows = computed(() => {
|
|
8
|
-
return props.serverMode ? props.pagination?.rowsNumber:props.rows.length;
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const currentVisibleRows = computed(() => {
|
|
12
|
-
|
|
13
|
-
if (props.serverMode || props.disablePagination) {
|
|
14
|
-
return sortedRows.value;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let rowsPerPage = props.pagination?.rowsPerPage ?? globalGridSettings.value.rowsPerPage
|
|
18
|
-
if (rowsPerPage===0) {
|
|
19
|
-
return sortedRows.value;
|
|
20
|
-
}
|
|
21
|
-
const startIndex = (props.pagination.page - 1) * rowsPerPage;
|
|
22
|
-
const endIndex = startIndex + rowsPerPage;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return sortedRows.value.slice(startIndex, endIndex)
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const onRowClicked = (row) => {
|
|
29
|
-
if (props.clickableRow) {
|
|
30
|
-
emit('rowClicked', row)
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
totalRows,
|
|
37
|
-
currentVisibleRows,
|
|
38
|
-
onRowClicked,
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import useRowHelper from "../composables/useRowHelper.js";
|
|
2
|
-
import {computed, ref} from "vue";
|
|
3
|
-
|
|
4
|
-
export default function useRowSelect(props, emit, currentVisibleRows) {
|
|
5
|
-
|
|
6
|
-
let selectedRows = ref([]);
|
|
7
|
-
const toggleRowSelect = (row, selected) => {
|
|
8
|
-
if (selected) {
|
|
9
|
-
selectedRows.value.push(row[props.rowKey])
|
|
10
|
-
} else {
|
|
11
|
-
selectedRows.value = selectedRows.value.filter(idx => idx!==row[props.rowKey])
|
|
12
|
-
}
|
|
13
|
-
emit('selectedRowsUpdate', selectedRows.value)
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const toggleMasterSelect = (selected) => {
|
|
18
|
-
if (selected) {
|
|
19
|
-
selectedRows.value = [
|
|
20
|
-
...selectedRows.value,
|
|
21
|
-
...currentVisibleRows.value.filter(row => !selectedRows.value.includes(row[props.rowKey])).map(row => row[props.rowKey])
|
|
22
|
-
]
|
|
23
|
-
} else {
|
|
24
|
-
const currentVisibleRowKeys = currentVisibleRows.value.map(row => row[props.rowKey]);
|
|
25
|
-
selectedRows.value = selectedRows.value.filter(rowKey => {
|
|
26
|
-
return !currentVisibleRowKeys.includes(rowKey)
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
emit('selectedRowsUpdate', selectedRows.value)
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const isRowSelected = (row) => {
|
|
34
|
-
|
|
35
|
-
return selectedRows.value.includes(row[props.rowKey]);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const areAllRowsSelected = computed(() => {
|
|
39
|
-
|
|
40
|
-
const selectedFromCurrentRows = currentVisibleRows.value.filter(row => selectedRows.value.includes(row[props.rowKey]));
|
|
41
|
-
return selectedFromCurrentRows.length > 0 && selectedFromCurrentRows.length===currentVisibleRows.value.length;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
selectedRows,
|
|
46
|
-
toggleRowSelect,
|
|
47
|
-
toggleMasterSelect,
|
|
48
|
-
isRowSelected,
|
|
49
|
-
areAllRowsSelected
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {computed, ref} from "vue";
|
|
2
|
-
|
|
3
|
-
import GridSettings from "../settings/GridSettings.js";
|
|
4
|
-
|
|
5
|
-
export const globalGridSettings = ref({});
|
|
6
|
-
export default function useSettings(props) {
|
|
7
|
-
|
|
8
|
-
const localSettingsKeys = ['align', 'disablePagination', 'defaultSlots', 'noDataLabel', 'noCellDataLabel', 'stripped', 'bordered', 'compactPagination', 'rowsPerPageOptions', 'rowsPerPage'];
|
|
9
|
-
|
|
10
|
-
const localSettings = localSettingsKeys.reduce((settings, key) => {
|
|
11
|
-
if (props[key] !== undefined) {
|
|
12
|
-
settings[key] = props[key];
|
|
13
|
-
}
|
|
14
|
-
return settings;
|
|
15
|
-
}, {})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const settings = computed(() => {
|
|
19
|
-
return {
|
|
20
|
-
...GridSettings,
|
|
21
|
-
...globalGridSettings.value,
|
|
22
|
-
...localSettings
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
settings
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import {computed, ref} from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default function useSort(props) {
|
|
5
|
-
|
|
6
|
-
let sortDirection = ref(null);
|
|
7
|
-
let sortFieldType = ref(null);
|
|
8
|
-
let sortField = ref(null);
|
|
9
|
-
// Calculate the next sort direction based on the current field
|
|
10
|
-
const calculateNextSortDirection = function (field) {
|
|
11
|
-
if (sortField.value!==field) {
|
|
12
|
-
return 'ascending'
|
|
13
|
-
} else if (sortDirection.value==='ascending') {
|
|
14
|
-
return 'descending'
|
|
15
|
-
} else {
|
|
16
|
-
return null
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const setSortFields = function (column, direction = 'auto') {
|
|
21
|
-
if (direction!=='auto') {
|
|
22
|
-
sortField.value = column.name;
|
|
23
|
-
sortFieldType.value = column.type;
|
|
24
|
-
sortDirection.value = direction;
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
const nextDirection = calculateNextSortDirection(column.name);
|
|
28
|
-
sortField.value = nextDirection===null ? null:column.name;
|
|
29
|
-
sortFieldType.value = nextDirection===null ? null:column.type;
|
|
30
|
-
sortDirection.value = nextDirection;
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
field: sortField.value,
|
|
34
|
-
direction: sortDirection.value
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// Format the sort field for use in API requests
|
|
39
|
-
const formatSortFields = () => {
|
|
40
|
-
return sortDirection.value===null ? null:[{
|
|
41
|
-
field: sortField.value,
|
|
42
|
-
descending: sortDirection.value==='descending'
|
|
43
|
-
}];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const _clientNumberSort = (rows, sortField, sortDirection) => {
|
|
47
|
-
if (sortDirection==='ascending') {
|
|
48
|
-
return rows.sort((a, b) => {
|
|
49
|
-
return Number(a[sortField]) - Number(b[sortField])
|
|
50
|
-
});
|
|
51
|
-
} else if (sortDirection==='descending') {
|
|
52
|
-
|
|
53
|
-
return rows.sort((a, b) => {
|
|
54
|
-
return Number(b[sortField]) - Number(a[sortField])
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return rows;
|
|
58
|
-
}
|
|
59
|
-
const _clientAlphabetSort = (rows, sortField, sortDirection) => {
|
|
60
|
-
if (sortDirection==='ascending') {
|
|
61
|
-
return rows.sort((a, b) => {
|
|
62
|
-
return a[sortField].toString().localeCompare(b[sortField].toString())
|
|
63
|
-
});
|
|
64
|
-
} else if (sortDirection==='descending') {
|
|
65
|
-
|
|
66
|
-
return rows.sort((a, b) => b[sortField].toString().localeCompare(a[sortField].toString()));
|
|
67
|
-
}
|
|
68
|
-
return rows;
|
|
69
|
-
}
|
|
70
|
-
//sort rows on client side
|
|
71
|
-
const clientSort = function (rows, sortField, sortFieldType, sortDirection) {
|
|
72
|
-
if (!sortDirection) {
|
|
73
|
-
return rows;
|
|
74
|
-
}
|
|
75
|
-
if (sortFieldType==='number') {
|
|
76
|
-
|
|
77
|
-
return _clientNumberSort(rows, sortField, sortDirection);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return _clientAlphabetSort(rows, sortField, sortDirection);
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Set the sort fields from pagination data from API
|
|
85
|
-
const setSortFieldsFromPagination = (pagination) => {
|
|
86
|
-
|
|
87
|
-
if (!pagination?.sortBy?.length) {
|
|
88
|
-
sortField.value = null;
|
|
89
|
-
sortFieldType.value = null;
|
|
90
|
-
sortDirection.value = null;
|
|
91
|
-
} else {
|
|
92
|
-
let column = props.columns.find(column => column.name===pagination.sortBy[0].field);
|
|
93
|
-
setSortFields(column, pagination?.sortBy[0].descending ? 'descending':'ascending');
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// Get the sortable state for column based on the current sort state
|
|
98
|
-
const getSortableState = (column) => {
|
|
99
|
-
if (sortField.value!==column.name) {
|
|
100
|
-
return 'unsorted';
|
|
101
|
-
}
|
|
102
|
-
return sortDirection.value;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const sortedRows = computed(() => {
|
|
106
|
-
if (props.serverMode) {
|
|
107
|
-
return props.rows ?? [];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return clientSort([...props.rows ?? []], sortField.value, sortFieldType.value, sortDirection.value)
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
setSortFieldsFromPagination,
|
|
116
|
-
getSortableState,
|
|
117
|
-
setSortFields,
|
|
118
|
-
formatSortFields,
|
|
119
|
-
clientSort,
|
|
120
|
-
sortedRows,
|
|
121
|
-
sortField,
|
|
122
|
-
sortDirection,
|
|
123
|
-
sortFieldType
|
|
124
|
-
}
|
|
125
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vi-grid-actions" ref="gridActions">
|
|
3
|
-
<vi-grid-kebab-menu
|
|
4
|
-
v-if="kebab"
|
|
5
|
-
:actions="visibleActions"
|
|
6
|
-
:row-key="rowKey"
|
|
7
|
-
:row="row"
|
|
8
|
-
:show-menu="row[rowKey] === rowMenuOpened"
|
|
9
|
-
@actionClicked="onActionClicked"
|
|
10
|
-
@toggleMenu="$ev => toggleRowMenu(row)"
|
|
11
|
-
/>
|
|
12
|
-
<vi-grid-simple-actions
|
|
13
|
-
v-else
|
|
14
|
-
:actions="visibleActions"
|
|
15
|
-
:row-key="rowKey"
|
|
16
|
-
:row="row"
|
|
17
|
-
@actionClicked="onActionClicked"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script>
|
|
25
|
-
import ViGridKebabMenu from "./partials/ViGridKebabMenu.vue";
|
|
26
|
-
import ViGridSimpleActions from "./partials/ViGridSimpleActions.vue";
|
|
27
|
-
|
|
28
|
-
import {useGridActions} from "../composables/useGridActions.js"
|
|
29
|
-
import {onMounted, onUnmounted, ref} from "vue";
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
name: "ViGridActions",
|
|
33
|
-
components: {ViGridSimpleActions, ViGridKebabMenu},
|
|
34
|
-
props: {
|
|
35
|
-
kebab:{
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false,
|
|
38
|
-
},
|
|
39
|
-
row: {},
|
|
40
|
-
rowKey: String,
|
|
41
|
-
actions:{
|
|
42
|
-
type: Array,
|
|
43
|
-
default: function () {
|
|
44
|
-
|
|
45
|
-
return []
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
rowMenuOpened:{
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
setup(props, {emit}) {
|
|
53
|
-
const {visibleActions, onActionClicked, toggleRowMenu} = useGridActions(props,emit);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
let gridActions = ref(null);
|
|
57
|
-
onMounted(() => {
|
|
58
|
-
gridActions.clickOutsideHandler = (event) => {
|
|
59
|
-
if (props.rowMenuOpened) {
|
|
60
|
-
if (gridActions.value && !(gridActions.value===event.target || gridActions.value.contains(event.target))) {
|
|
61
|
-
emit('update:rowMenuOpened', null);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
document.addEventListener('click', gridActions.clickOutsideHandler);
|
|
66
|
-
})
|
|
67
|
-
onUnmounted(() => {
|
|
68
|
-
document.removeEventListener('click', gridActions.clickOutsideHandler);
|
|
69
|
-
})
|
|
70
|
-
return {
|
|
71
|
-
visibleActions,
|
|
72
|
-
onActionClicked,
|
|
73
|
-
toggleRowMenu,
|
|
74
|
-
gridActions
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
</script>
|
|
80
|
-
|
|
81
|
-
<style lang="scss">
|
|
82
|
-
@import "ViGridActions";
|
|
83
|
-
</style>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
.vi-grid-badge {
|
|
2
|
-
width: 100%;
|
|
3
|
-
//padding: 5px 10px;
|
|
4
|
-
border-radius: 12px;
|
|
5
|
-
font-size: .8rem !important;
|
|
6
|
-
line-height: 1;
|
|
7
|
-
//font-weight: 600;
|
|
8
|
-
text-transform: uppercase;
|
|
9
|
-
background-color: var(--vi-grid-primary-color);
|
|
10
|
-
color: var(--vi-grid-primary-text-color);
|
|
11
|
-
padding: 5px;
|
|
12
|
-
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vi-grid-badge" v-bind="$attrs" :class="value">
|
|
3
|
-
{{value}}
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
|
|
9
|
-
//todo colors
|
|
10
|
-
export default {
|
|
11
|
-
name: "ViGridBadge",
|
|
12
|
-
props: {
|
|
13
|
-
value: {},
|
|
14
|
-
},
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<style lang="scss">
|
|
19
|
-
@import "ViGridBadge";
|
|
20
|
-
</style>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vi-grid-checkbox">
|
|
3
|
-
<input type="checkbox"
|
|
4
|
-
:checked="value"
|
|
5
|
-
@change="$emit('checkbox-clicked', {row:this.row, field:this.name, value:$event.target.checked})"
|
|
6
|
-
@click.stop
|
|
7
|
-
/>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
export default {
|
|
13
|
-
name: "ViGridCheckbox",
|
|
14
|
-
props: {
|
|
15
|
-
value: {
|
|
16
|
-
type: Boolean
|
|
17
|
-
},
|
|
18
|
-
name: {
|
|
19
|
-
type: String
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
row: {
|
|
23
|
-
type: Object
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<style lang="scss">
|
|
30
|
-
@import "ViGridText";
|
|
31
|
-
</style>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vi-grid-date">
|
|
3
|
-
{{dateFormatted}}
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
|
|
9
|
-
import { format, parseISO } from 'date-fns';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
name: "ViGridDate",
|
|
13
|
-
inject: ['ViDateSettings'],
|
|
14
|
-
props: {
|
|
15
|
-
value: {},
|
|
16
|
-
mode:{
|
|
17
|
-
type: String,
|
|
18
|
-
validator: function (value) {
|
|
19
|
-
|
|
20
|
-
return ['date','dateTime','time'].includes(value)
|
|
21
|
-
},
|
|
22
|
-
default:'dateTime'
|
|
23
|
-
},
|
|
24
|
-
format:{
|
|
25
|
-
type: String,
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
computed: {
|
|
30
|
-
dateFormatted() {
|
|
31
|
-
const formatString = this.format ?? this.ViDateSettings.format[this.mode];
|
|
32
|
-
return format(parseISO(this.value), formatString);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<style lang="scss">
|
|
39
|
-
@import "ViGridDate";
|
|
40
|
-
</style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vi-grid-image">
|
|
3
|
-
<img :src="value"/>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
export default {
|
|
9
|
-
name: "ViGridImage",
|
|
10
|
-
props: {
|
|
11
|
-
value: {},
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<style lang="scss">
|
|
17
|
-
@import "ViGridImage";
|
|
18
|
-
</style>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vi-grid-link">
|
|
3
|
-
<a :href="row[link] ?? value" target="_blank" v-if="(link && row[link]) || (!link && value)">{{value}}</a>
|
|
4
|
-
<div v-else>{{value}}</div>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
name: "ViGridLink",
|
|
11
|
-
props: {
|
|
12
|
-
link: {
|
|
13
|
-
type: String,
|
|
14
|
-
// required: true
|
|
15
|
-
},
|
|
16
|
-
row: {
|
|
17
|
-
type: Object,
|
|
18
|
-
required: true
|
|
19
|
-
},
|
|
20
|
-
value: {},
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<style lang="scss">
|
|
27
|
-
@import "ViGridLink";
|
|
28
|
-
</style>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vi-grid-number">
|
|
3
|
-
{{ formattedNumber }}
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
export default {
|
|
9
|
-
name: "ViGridNumber",
|
|
10
|
-
props: {
|
|
11
|
-
value: {},
|
|
12
|
-
format: {
|
|
13
|
-
type: Object,
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
computed: {
|
|
17
|
-
formattedNumber() {
|
|
18
|
-
if (!this.format) {
|
|
19
|
-
return this.value
|
|
20
|
-
}
|
|
21
|
-
return new Intl.NumberFormat(undefined, this.format).format(Number(this.value));
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<style lang="scss">
|
|
29
|
-
@import "ViGridNumber.scss";
|
|
30
|
-
</style>
|
|
File without changes
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
.vi-grid-kebab-menu {
|
|
2
|
-
cursor: pointer;
|
|
3
|
-
min-height: 10px;
|
|
4
|
-
width: 100%;
|
|
5
|
-
position: relative;
|
|
6
|
-
|
|
7
|
-
.actions-menu-button {
|
|
8
|
-
box-sizing: border-box;
|
|
9
|
-
position: relative;
|
|
10
|
-
display: block;
|
|
11
|
-
width: 4px;
|
|
12
|
-
height: 4px;
|
|
13
|
-
background: currentColor;
|
|
14
|
-
border-radius: 100%;
|
|
15
|
-
|
|
16
|
-
&::after,
|
|
17
|
-
&::before {
|
|
18
|
-
content: "";
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
display: block;
|
|
23
|
-
width: 4px;
|
|
24
|
-
height: 4px;
|
|
25
|
-
background: currentColor;
|
|
26
|
-
border-radius: 100%;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&::after {
|
|
30
|
-
left: -6px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&::before {
|
|
34
|
-
right: -6px;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.actions-menu {
|
|
39
|
-
padding: 5px;
|
|
40
|
-
white-space: nowrap;
|
|
41
|
-
|
|
42
|
-
position: absolute;
|
|
43
|
-
z-index: 1000;
|
|
44
|
-
background-color: white;
|
|
45
|
-
border: 1px solid #ddd;
|
|
46
|
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow */
|
|
47
|
-
border-radius: 5px;
|
|
48
|
-
min-width: 200px;
|
|
49
|
-
overflow: hidden; /* Ensure rounded corners */
|
|
50
|
-
.actions-menu-item {
|
|
51
|
-
padding: 10px 15px;
|
|
52
|
-
font-size: 14px;
|
|
53
|
-
color: #333; /* Dark gray */
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
transition: background-color 0.3s ease;
|
|
56
|
-
|
|
57
|
-
&:hover {
|
|
58
|
-
background-color: #f5f5f5;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|