spark-grid-vue3 0.0.49 → 0.0.51
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="grid-cell" :style="
|
|
2
|
+
<div class="grid-cell" :style="columnStyle()">
|
|
3
3
|
<div class="checker">
|
|
4
4
|
<span :class="{'checked': row._isChecked}">
|
|
5
5
|
<input
|
|
@@ -18,11 +18,24 @@
|
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
20
|
import {GridStyler} from "../utils/GridStyler"
|
|
21
|
-
import type {Row} from "../types/types"
|
|
21
|
+
import type {GridComponent, Row} from "../types/types"
|
|
22
22
|
|
|
23
23
|
const props = defineProps<{
|
|
24
|
-
row: Row
|
|
24
|
+
row: Row,
|
|
25
|
+
grid: GridComponent,
|
|
25
26
|
}>()
|
|
26
27
|
|
|
28
|
+
const columnStyle = () => {
|
|
29
|
+
const style = GridStyler.getCheckboxColumnStyles()
|
|
30
|
+
|
|
31
|
+
if (props.grid.config.onBeforeCheckboxAndRadioButtonStyleMounted) {
|
|
32
|
+
const newStyle = props.grid.config.onBeforeCheckboxAndRadioButtonStyleMounted(props.row, props.grid)
|
|
33
|
+
|
|
34
|
+
return {...style, ...newStyle}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return style
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
const emits = defineEmits(['change'])
|
|
28
41
|
</script>
|
package/src/types/types.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export type OnHeaderContentGetter = (value: any, grid: GridComponent) => CellCon
|
|
|
37
37
|
export type OnBeforeCellMounted = (value: CellContent, column: Column, row: Row, grid: GridComponent) => CellContent
|
|
38
38
|
export type OnBeforeHeaderCellMounted = (column: Column, grid: GridComponent) => CellContent
|
|
39
39
|
export type OnBeforeCellStyleMounted = (value: CellContent, column: Column, row: Row, grid: GridComponent) => { [key: string]: any }
|
|
40
|
+
export type OnBeforeCheckboxAndRadioButtonStyleMounted = (row: Row, grid: GridComponent) => { [key: string]: any }
|
|
40
41
|
export type OnBeforeColumnStyleMounted = (value: CellContent, row: Row, grid: GridComponent) => { [key: string]: any }
|
|
41
42
|
export type OnVisibleCheck = () => boolean
|
|
42
43
|
export type OnVisibleActionCheck = (row: Row) => boolean
|
|
@@ -118,6 +119,7 @@ export type SparkGridConfig = {
|
|
|
118
119
|
onBeforeCellMounted?: OnBeforeCellMounted,
|
|
119
120
|
onBeforeHeaderCellMounted?: OnBeforeHeaderCellMounted,
|
|
120
121
|
onBeforeCellStyleMounted?: OnBeforeCellStyleMounted,
|
|
122
|
+
onBeforeCheckboxAndRadioButtonStyleMounted?: OnBeforeCheckboxAndRadioButtonStyleMounted,
|
|
121
123
|
onClickRow?: OnRowEvent,
|
|
122
124
|
onDoubleClickRow?: OnRowEvent,
|
|
123
125
|
onCheckboxStateChanged?: OnRowEvent,
|
package/src/utils/GridStyler.ts
CHANGED
|
@@ -72,7 +72,7 @@ export class GridStyler {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
static calculateActionsWidth(grid: GridComponent): string | number {
|
|
75
|
-
return grid.config.actionsWidth ?? `${((grid.config.actions?.length ?? 0) * 50) +
|
|
75
|
+
return grid.config.actionsWidth ?? `${((grid.config.actions?.length ?? 0) * 50) + 50}px`
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
static calculateColumnWidth(grid: GridComponent): string {
|