@citizenplane/pimp 16.2.0 → 16.2.2
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/pimp.es.js +3463 -3468
- package/dist/pimp.umd.js +35 -35
- package/package.json +1 -1
- package/src/components/CpTable.vue +6 -13
- package/src/components/CpTableColumnEditor.vue +4 -1
- package/src/constants/CpTableColumn.ts +0 -1
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
v-for="column in visibleColumns"
|
|
21
21
|
:key="column.id"
|
|
22
22
|
class="cpTable__column"
|
|
23
|
+
:class="getColumnClasses(column.id)"
|
|
23
24
|
:style="getColumnStyle(column)"
|
|
24
25
|
>
|
|
25
26
|
<slot :column="column" name="column">
|
|
@@ -49,12 +50,11 @@
|
|
|
49
50
|
>
|
|
50
51
|
<slot name="row" :row="rowData">
|
|
51
52
|
<td
|
|
52
|
-
v-for="(cellValue, cellKey
|
|
53
|
+
v-for="(cellValue, cellKey) in rowData"
|
|
53
54
|
:key="`${cellKey}_${rowIndex}`"
|
|
54
55
|
class="cpTable__cell"
|
|
55
56
|
:class="getCellClasses(cellKey)"
|
|
56
57
|
:colspan="getColspan(cellKey)"
|
|
57
|
-
:style="getCellStyle(cellKey, cellIndex)"
|
|
58
58
|
>
|
|
59
59
|
<slot :cell="cellValue" :name="cellKey">
|
|
60
60
|
<span v-if="isFullWidthRow(rowData)">{{ cellValue }}</span>
|
|
@@ -136,6 +136,7 @@ import CpTableEmptyState from '@/components/CpTableEmptyState.vue'
|
|
|
136
136
|
import { camelize, decamelize } from '@/helpers/string'
|
|
137
137
|
|
|
138
138
|
import { PAGINATION_FORMATS, RESERVED_KEYS, VISIBLE_ROWS_MAX } from '@/constants'
|
|
139
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
139
140
|
|
|
140
141
|
interface Emits {
|
|
141
142
|
(evt: 'onRowClick', data: Record<string, unknown>): void
|
|
@@ -544,6 +545,8 @@ const resetScrollPosition = () => {
|
|
|
544
545
|
}
|
|
545
546
|
}
|
|
546
547
|
|
|
548
|
+
const getColumnClasses = (columnId: string) => `cpTable__column--is${capitalizeFirstLetter(columnId)}`
|
|
549
|
+
|
|
547
550
|
const getColumnStyle = (column: CpTableColumnObject) => {
|
|
548
551
|
let width: string | undefined
|
|
549
552
|
|
|
@@ -555,17 +558,7 @@ const getColumnStyle = (column: CpTableColumnObject) => {
|
|
|
555
558
|
width = `${column.width}px`
|
|
556
559
|
}
|
|
557
560
|
|
|
558
|
-
return {
|
|
559
|
-
width,
|
|
560
|
-
textAlign: column.textAlign,
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
const getCellStyle = (cellKey: RESERVED_KEYS, cellIndex: number) => {
|
|
565
|
-
if (isFullWidthCell(cellKey)) return null
|
|
566
|
-
return {
|
|
567
|
-
textAlign: visibleColumns.value[cellIndex]?.textAlign,
|
|
568
|
-
}
|
|
561
|
+
return { width }
|
|
569
562
|
}
|
|
570
563
|
|
|
571
564
|
const getRowClasses = (rowData: Record<string, unknown>, rowIndex: number) => {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<div class="cpTableColumnEditor">
|
|
3
3
|
<v-dropdown
|
|
4
4
|
v-model:shown="isDropdownVisible"
|
|
5
|
+
:aria-id="ariaId"
|
|
5
6
|
:delay="0"
|
|
6
7
|
placement="bottom-end"
|
|
7
8
|
popper-class="cpTableColumnEditor__dropdown"
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
</template>
|
|
81
82
|
|
|
82
83
|
<script setup lang="ts">
|
|
83
|
-
import { computed, ref, useTemplateRef } from 'vue'
|
|
84
|
+
import { computed, ref, useTemplateRef, useId } from 'vue'
|
|
84
85
|
|
|
85
86
|
import { CpTableColumnObject } from '@/constants/CpTableColumn'
|
|
86
87
|
|
|
@@ -93,6 +94,8 @@ interface Props {
|
|
|
93
94
|
|
|
94
95
|
const props = defineProps<Props>()
|
|
95
96
|
|
|
97
|
+
const ariaId = useId()
|
|
98
|
+
|
|
96
99
|
const isDropdownVisible = ref(false)
|
|
97
100
|
const selectedColumnIds = defineModel<string[]>()
|
|
98
101
|
|