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,6 +1,6 @@
1
1
  {
2
2
  "name": "spark-grid-vue3",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "",
5
5
  "files": [
6
6
  "src"
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="grid-cell" :style="GridStyler.getCheckboxColumnStyles()">
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>
@@ -8,7 +8,7 @@
8
8
  :key="row._uuid"
9
9
  v-if="props.grid.config.checkboxEnabled"
10
10
  :row="row"
11
- :disabled="props.grid.config.checkboxDisabled"
11
+ :grid="props.grid"
12
12
  @change="onRowChecked"
13
13
  />
14
14
 
@@ -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,
@@ -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) + 100}px`
75
+ return grid.config.actionsWidth ?? `${((grid.config.actions?.length ?? 0) * 50) + 50}px`
76
76
  }
77
77
 
78
78
  static calculateColumnWidth(grid: GridComponent): string {