@stonecrop/atable 0.4.3 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/atable",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -38,8 +38,8 @@
38
38
  "@vueuse/core": "^12.0.0",
39
39
  "pinia": "^2.3.0",
40
40
  "vue": "^3.5.11",
41
- "@stonecrop/utilities": "0.4.3",
42
- "@stonecrop/themes": "0.4.3"
41
+ "@stonecrop/themes": "0.4.4",
42
+ "@stonecrop/utilities": "0.4.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@microsoft/api-documenter": "^7.26.2",
@@ -13,7 +13,7 @@
13
13
  @input="updateCellData"
14
14
  @click="showModal"
15
15
  class="atable-cell"
16
- :class="pinned ? 'sticky-column' : ''">
16
+ :class="cellClasses">
17
17
  <component
18
18
  v-if="column.cellComponent"
19
19
  :is="column.cellComponent"
@@ -38,6 +38,7 @@ const {
38
38
  store,
39
39
  addNavigation = true,
40
40
  tabIndex = 0,
41
+ pinned = false,
41
42
  } = defineProps<{
42
43
  colIndex: number
43
44
  rowIndex: number
@@ -72,12 +73,18 @@ const cellStyle = computed((): CSSProperties => {
72
73
  return {
73
74
  textAlign,
74
75
  width: cellWidth,
75
- backgroundColor: !cellModified.value ? 'inherit' : 'var(--sc-cell-changed-color)',
76
76
  fontWeight: !cellModified.value ? 'inherit' : 'bold',
77
77
  paddingLeft: store.getIndent(colIndex, store.display[rowIndex]?.indent),
78
78
  }
79
79
  })
80
80
 
81
+ const cellClasses = computed(() => {
82
+ return {
83
+ 'sticky-column': pinned,
84
+ 'cell-modified': cellModified.value,
85
+ }
86
+ })
87
+
81
88
  const showModal = () => {
82
89
  const { left, bottom, width, height } = useElementBounding(cellRef)
83
90
 
@@ -211,4 +218,11 @@ const updateCellData = (payload: Event) => {
211
218
  text-wrap: nowrap;
212
219
  box-sizing: border-box;
213
220
  }
221
+ .cell-modified {
222
+ font-weight: bold;
223
+ font-style: italic;
224
+ }
225
+ .cell-modified-highlight {
226
+ background-color: var(--sc-cell-changed-color);
227
+ }
214
228
  </style>
@@ -94,3 +94,10 @@ if (addNavigation) {
94
94
  padding: 1.5rem;
95
95
  }
96
96
  </style>
97
+ <style scoped>
98
+ .expandable-row.changed-row-gradient:has(td.cell-modified) {
99
+ --cell-color-start: color-mix(in srgb, var(--sc-cell-changed-color), #fff 20%);
100
+ --cell-color-end: color-mix(in srgb, var(--sc-cell-changed-color), #fff 60%);
101
+ background: linear-gradient(90deg, var(--cell-color-start), var(--cell-color-end));
102
+ }
103
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <tr ref="rowEl" :tabindex="tabIndex" v-show="isRowVisible" class="table-row">
2
+ <tr ref="rowEl" :tabindex="tabIndex" v-show="isRowVisible" class="atable-row">
3
3
  <!-- render numbered/tree view index; skip render for uncounted lists -->
4
4
  <slot name="index" v-if="store.config.view !== 'uncounted'">
5
5
  <td
@@ -69,7 +69,7 @@ if (addNavigation) {
69
69
  <style>
70
70
  @import url('@stonecrop/themes/default.css');
71
71
 
72
- .table-row {
72
+ .atable-row {
73
73
  border-top: 1px solid var(--sc-row-border-color);
74
74
  display: flex;
75
75
  background-color: white;
@@ -104,4 +104,18 @@ if (addNavigation) {
104
104
  padding-top: var(--sc-atable-row-padding);
105
105
  padding-bottom: var(--sc-atable-row-padding);
106
106
  }
107
+ /* sticky cells in modified rows should be a solid color to properly hide non-sticky cells */
108
+ .atable-row:has(td.cell-modified) > td.sticky-column,
109
+ .atable-row:has(td.cell-modified) > th.sticky-column,
110
+ .atable-row:has(td.cell-modified) > td.sticky-index,
111
+ .atable-row:has(td.cell-modified) > th.sticky-index {
112
+ background: var(--sc-cell-changed-color);
113
+ }
114
+ </style>
115
+ <style scoped>
116
+ .atable-row.changed-row-gradient:has(td.cell-modified) {
117
+ --cell-color-start: color-mix(in srgb, var(--sc-cell-changed-color), #fff 20%);
118
+ --cell-color-end: color-mix(in srgb, var(--sc-cell-changed-color), #fff 60%);
119
+ background: linear-gradient(90deg, var(--cell-color-start), var(--cell-color-end));
120
+ }
107
121
  </style>