@citizenplane/pimp 14.1.0 → 14.1.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/package.json
CHANGED
|
@@ -145,6 +145,11 @@ const handleClick = () => (isToggled.value = !isToggled.value)
|
|
|
145
145
|
&:hover {
|
|
146
146
|
background-color: var(--cp-background-primary-hover);
|
|
147
147
|
}
|
|
148
|
+
|
|
149
|
+
&:focus-visible {
|
|
150
|
+
outline-offset: calc(var(--cp-spacing-sm) * -1);
|
|
151
|
+
border-radius: var(--cp-radius-md);
|
|
152
|
+
}
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
&__title {
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
<cp-icon size="16" :type="option.icon" />
|
|
78
78
|
</button>
|
|
79
79
|
<button
|
|
80
|
+
v-if="hasMoreQuickActionsThanLimit"
|
|
80
81
|
class="cpTable__action cpTable__action--isDefault"
|
|
81
82
|
type="button"
|
|
82
83
|
@click.stop="handleContextMenu({ rowData, rowIndex }, $event)"
|
|
@@ -209,7 +210,7 @@ const cpTableContainer = ref<HTMLElement | null>(null)
|
|
|
209
210
|
const contextualMenu = ref<InstanceType<typeof CpContextualMenu>>()
|
|
210
211
|
|
|
211
212
|
const hasRowOptions = computed(() => props.enableRowOptions && props.rowOptions.length)
|
|
212
|
-
const hasMoreQuickActionsThanLimit = computed(() => props.rowOptions.length
|
|
213
|
+
const hasMoreQuickActionsThanLimit = computed(() => props.rowOptions.length > props.quickOptionsLimit)
|
|
213
214
|
|
|
214
215
|
const quickOptions = computed(() => {
|
|
215
216
|
if (!props.enableRowOptions || !props.rowOptions.length || props.quickOptionsLimit === 0) return []
|
|
@@ -219,6 +219,54 @@ export const WithCustomRowOptions: Story = {
|
|
|
219
219
|
}),
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
+
export const WithoutDefaultAction: Story = {
|
|
223
|
+
args: {
|
|
224
|
+
...Default.args,
|
|
225
|
+
enableRowOptions: true,
|
|
226
|
+
quickOptionsLimit: 2,
|
|
227
|
+
enableColumnEdition: true,
|
|
228
|
+
},
|
|
229
|
+
render: (args) => ({
|
|
230
|
+
components: { CpTable },
|
|
231
|
+
setup() {
|
|
232
|
+
const isEditLoading = ref(false)
|
|
233
|
+
|
|
234
|
+
const rowOptions = computed(() => [
|
|
235
|
+
{
|
|
236
|
+
id: 'see',
|
|
237
|
+
label: 'See',
|
|
238
|
+
icon: 'eye',
|
|
239
|
+
action: () => console.log('See'),
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: 'delete',
|
|
243
|
+
label: 'Delete',
|
|
244
|
+
icon: 'trash',
|
|
245
|
+
isCritical: true,
|
|
246
|
+
action: () => console.log('Delete'),
|
|
247
|
+
},
|
|
248
|
+
])
|
|
249
|
+
|
|
250
|
+
return { args, isEditLoading, rowOptions }
|
|
251
|
+
},
|
|
252
|
+
template: `
|
|
253
|
+
<CpTable v-bind="args" :row-options="rowOptions">
|
|
254
|
+
<template #status="{ cell }">
|
|
255
|
+
<span :style="{
|
|
256
|
+
padding: '4px 8px',
|
|
257
|
+
borderRadius: '4px',
|
|
258
|
+
fontSize: '12px',
|
|
259
|
+
backgroundColor: cell === 'Active' ? '#10B981' : '#EF4444',
|
|
260
|
+
color: 'white'
|
|
261
|
+
}">
|
|
262
|
+
{{ cell }}
|
|
263
|
+
</span>
|
|
264
|
+
</template>
|
|
265
|
+
</CpTable>
|
|
266
|
+
`,
|
|
267
|
+
}),
|
|
268
|
+
}
|
|
269
|
+
|
|
222
270
|
export const WithOnlyDefaultAction: Story = {
|
|
223
271
|
args: {
|
|
224
272
|
...Default.args,
|