@citizenplane/pimp 8.17.1 → 8.18.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.
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
width="24"
|
|
5
|
+
height="24"
|
|
6
|
+
viewBox="0 0 24 24"
|
|
7
|
+
fill="none"
|
|
8
|
+
stroke="currentColor"
|
|
9
|
+
stroke-width="2"
|
|
10
|
+
stroke-linecap="round"
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
d="M7.58963 9.74602H16.6177M7.58963 14.2598H16.6177M6.71393 21H17.4941C19.4878 21 21.104 19.3838 21.104 17.3901V6.60993C21.104 4.61622 19.4878 3 17.4941 3H6.71393C4.72022 3 3.104 4.61622 3.104 6.60993V17.3901C3.104 19.3838 4.72023 21 6.71393 21Z"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
</template>
|
package/src/components/index.js
CHANGED
|
@@ -60,6 +60,7 @@ import IconAirline from './icons/IconAirline.vue'
|
|
|
60
60
|
import IconOta from './icons/IconOta.vue'
|
|
61
61
|
import IconSupplier from './icons/IconSupplier.vue'
|
|
62
62
|
import IconThirdParty from './icons/IconThirdParty.vue'
|
|
63
|
+
import IconGroupBy from './icons/IconGroupBy.vue'
|
|
63
64
|
|
|
64
65
|
// Helpers and Utilities
|
|
65
66
|
import TransitionExpand from './helpers-utilities/TransitionExpand.vue'
|
|
@@ -98,6 +99,7 @@ const Components = {
|
|
|
98
99
|
IconSupplier,
|
|
99
100
|
IconThirdParty,
|
|
100
101
|
IconTooltip,
|
|
102
|
+
IconGroupBy,
|
|
101
103
|
TransitionExpand,
|
|
102
104
|
}
|
|
103
105
|
|
|
@@ -214,7 +214,7 @@ const flattenedRows = computed(() => {
|
|
|
214
214
|
|
|
215
215
|
// Transform groupBy key into a row and add it in between others
|
|
216
216
|
return props.data.reduce((flattenedRows, groupByItem) => {
|
|
217
|
-
const fullWidthRow = { [CpTableConfig.RESERVED_KEYS.
|
|
217
|
+
const fullWidthRow = { [CpTableConfig.RESERVED_KEYS.GROUP_BY]: groupByItem.groupBy }
|
|
218
218
|
return [...flattenedRows, fullWidthRow, ...groupByItem.rows]
|
|
219
219
|
}, [])
|
|
220
220
|
})
|
|
@@ -362,7 +362,7 @@ const getColumnStyle = (columnPayload) => {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
const getCellStyle = (cellKey, columnIndex) => {
|
|
365
|
-
if (cellKey
|
|
365
|
+
if (isFullWidthCell(cellKey)) return null
|
|
366
366
|
return {
|
|
367
367
|
textAlign: normalizedColumns.value[columnIndex]?.textAlign,
|
|
368
368
|
}
|
|
@@ -377,16 +377,21 @@ const getRowClasses = (rowData, rowIndex) => {
|
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
const getCellClasses = (cellKey) => {
|
|
380
|
-
return { 'cpTable__cell--isFullWidth': cellKey
|
|
380
|
+
return { 'cpTable__cell--isFullWidth': isFullWidthCell(cellKey) }
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
const getColspan = (cellKey) => {
|
|
384
384
|
const numberOfColumnsValue = props.enableRowOptions ? numberOfColumns.value + 1 : numberOfColumns.value
|
|
385
|
-
return cellKey
|
|
385
|
+
return isFullWidthCell(cellKey) ? numberOfColumnsValue : null
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
const getTabindex = (rowData) => (isFullWidthRow(rowData) ? -1 : 0)
|
|
389
|
-
|
|
389
|
+
|
|
390
|
+
const fullWidthCellKeys = [CpTableConfig.RESERVED_KEYS.FULL_WIDTH, CpTableConfig.RESERVED_KEYS.GROUP_BY]
|
|
391
|
+
|
|
392
|
+
const isFullWidthCell = (cellKey) => fullWidthCellKeys.includes(cellKey)
|
|
393
|
+
const isFullWidthRow = (rowData) => fullWidthCellKeys.some((key) => rowData[key])
|
|
394
|
+
|
|
390
395
|
const isRowSelected = (rowIndex) => rawVisibleRows.value[rowIndex][CpTableConfig.RESERVED_KEYS.IS_SELECTED]
|
|
391
396
|
const areRowOptionsEnabled = (rowData) => props.enableRowOptions && !isFullWidthRow(rowData)
|
|
392
397
|
|
|
@@ -152,6 +152,28 @@ export const WithGroupBy: Story = {
|
|
|
152
152
|
},
|
|
153
153
|
],
|
|
154
154
|
},
|
|
155
|
+
render: (args) => ({
|
|
156
|
+
components: { CpTable },
|
|
157
|
+
setup() {
|
|
158
|
+
return { args }
|
|
159
|
+
},
|
|
160
|
+
template: `
|
|
161
|
+
<CpTable v-bind="args">
|
|
162
|
+
<template #groupBy="{ cell }">
|
|
163
|
+
#groupBy slot
|
|
164
|
+
<span :style="{
|
|
165
|
+
padding: '4px 8px',
|
|
166
|
+
borderRadius: '4px',
|
|
167
|
+
fontSize: '12px',
|
|
168
|
+
backgroundColor: 'blue',
|
|
169
|
+
color: 'white'
|
|
170
|
+
}">
|
|
171
|
+
{{ cell }}
|
|
172
|
+
</span>
|
|
173
|
+
</template>
|
|
174
|
+
</CpTable>
|
|
175
|
+
`,
|
|
176
|
+
}),
|
|
155
177
|
}
|
|
156
178
|
|
|
157
179
|
export const WithCustomSlots: Story = {
|