@globalbrain/sefirot 2.27.0 → 2.28.0

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.
@@ -18,6 +18,7 @@ const {
18
18
  records,
19
19
  header,
20
20
  footer,
21
+ summary,
21
22
  total,
22
23
  page,
23
24
  perPage,
@@ -71,6 +72,12 @@ const classes = computed(() => ({
71
72
  'borderless': borderless?.value
72
73
  }))
73
74
 
75
+ const recordsWithSummary = computed(() => {
76
+ return (records?.value && summary?.value)
77
+ ? [...records?.value, summary?.value]
78
+ : records?.value ?? []
79
+ })
80
+
74
81
  watch(() => records?.value, () => {
75
82
  headLock = true
76
83
  bodyLock = true
@@ -160,7 +167,12 @@ function updateColWidth(key: string, value: string) {
160
167
  @scroll="syncBodyScroll"
161
168
  >
162
169
  <div class="block">
163
- <div v-for="(record, rIndex) in records" :key="rIndex" class="row">
170
+ <div
171
+ v-for="(record, rIndex) in recordsWithSummary"
172
+ :key="rIndex"
173
+ class="row"
174
+ :class="rIndex === records?.length && 'summary'"
175
+ >
164
176
  <STableItem
165
177
  v-for="key in orders"
166
178
  :key="key"
@@ -170,6 +182,7 @@ function updateColWidth(key: string, value: string) {
170
182
  >
171
183
  <STableCell
172
184
  :name="key"
185
+ :class="rIndex === records?.length && 'summary'"
173
186
  :class-name="columns[key].className"
174
187
  :cell="columns[key].cell"
175
188
  :value="record[key]"
@@ -95,7 +95,11 @@ const computedCell = computed<TableCell | undefined>(() =>
95
95
  overflow: hidden;
96
96
 
97
97
  .row:hover & {
98
- background-color: var(--c-bg-elv);
98
+ background-color: var(--c-bg-elv-1);
99
+ }
100
+
101
+ .summary & {
102
+ background-color: var(--c-bg-elv-2);
99
103
  }
100
104
 
101
105
  .STableItem:first-child & {
@@ -42,5 +42,9 @@ const _value = computed(() => {
42
42
  .STableCellDay.neutral & { color: var(--c-text-1); }
43
43
  .STableCellDay.soft & { color: var(--c-text-2); }
44
44
  .STableCellDay.mute & { color: var(--c-text-3); }
45
+
46
+ .STableCell.summary & {
47
+ font-weight: var(--table-cell-summary-font-weight);
48
+ }
45
49
  }
46
50
  </style>
@@ -110,6 +110,10 @@ const _iconColor = computed(() => {
110
110
  .STableCellText.link:hover &.warning { color: var(--c-warning-darker); }
111
111
  .STableCellText.link &.danger { color: var(--c-danger); }
112
112
  .STableCellText.link:hover &.danger { color: var(--c-danger-dark); }
113
+
114
+ .STableCell.summary & {
115
+ font-weight: var(--table-cell-summary-font-weight);
116
+ }
113
117
  }
114
118
 
115
119
  .icon {
@@ -13,6 +13,7 @@ export interface Table<
13
13
  records?: R[] | null
14
14
  header?: boolean
15
15
  footer?: boolean
16
+ summary?: TableSummary<R> | null
16
17
  total?: number | null
17
18
  page?: number | null
18
19
  perPage?: number | null
@@ -138,12 +139,17 @@ export interface TableCellComponent extends TableCellBase {
138
139
  props?: Record<string, any>
139
140
  }
140
141
 
142
+ export type TableSummary<T> = {
143
+ [P in keyof T]?: T[P] | null | undefined
144
+ }
145
+
141
146
  export interface UseTableOptions<O extends string, R extends Record<string, any>> {
142
147
  orders: MaybeRef<O[]>
143
148
  columns: MaybeRef<TableColumns<O, R>>
144
149
  records?: MaybeRef<R[] | null | undefined>
145
150
  header?: MaybeRef<boolean | undefined>
146
151
  footer?: MaybeRef<boolean | undefined>
152
+ summary?: MaybeRef<TableSummary<R> | null | undefined>
147
153
  total?: MaybeRef<number | null | undefined>
148
154
  page?: MaybeRef<number | null | undefined>
149
155
  perPage?: MaybeRef<number | null | undefined>
@@ -639,6 +639,8 @@
639
639
 
640
640
  --table-cell-font-size: 14px;
641
641
  --table-cell-font-weight: 400;
642
+
643
+ --table-cell-summary-font-weight: 600;
642
644
  }
643
645
 
644
646
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "2.27.0",
3
+ "version": "2.28.0",
4
4
  "packageManager": "pnpm@7.26.2",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",