@stonecrop/atable 0.13.12 → 0.13.14
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/assets/index.css +1 -1
- package/dist/atable.d.ts +209 -13
- package/dist/atable.js +1040 -1021
- package/dist/atable.js.map +1 -1
- package/dist/src/icons/index.d.ts +2 -1
- package/dist/src/icons/index.d.ts.map +1 -1
- package/dist/src/icons/index.js +3 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/stores/table.d.ts +168 -0
- package/dist/src/stores/table.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +37 -13
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/AGanttCell.vue +9 -11
- package/src/components/ARow.vue +27 -4
- package/src/components/ARowActions.vue +11 -10
- package/src/components/ATable.vue +19 -2
- package/src/icons/index.ts +3 -1
- package/src/icons/stonecrop-ui-icon-open.svg +5 -0
- package/src/index.ts +10 -1
- package/src/types/index.ts +39 -13
|
@@ -73,7 +73,7 @@ export interface CellContext {
|
|
|
73
73
|
* Row action type identifiers.
|
|
74
74
|
* @public
|
|
75
75
|
*/
|
|
76
|
-
export type RowActionType = 'add' | 'delete' | 'duplicate' | 'insertAbove' | 'insertBelow' | 'move';
|
|
76
|
+
export type RowActionType = 'open' | 'add' | 'delete' | 'duplicate' | 'insertAbove' | 'insertBelow' | 'move';
|
|
77
77
|
/**
|
|
78
78
|
* Options for configuring individual row actions.
|
|
79
79
|
* @public
|
|
@@ -137,6 +137,7 @@ export interface RowActionsConfig {
|
|
|
137
137
|
* false to disable, or provide RowActionOptions for custom configuration.
|
|
138
138
|
*/
|
|
139
139
|
actions?: {
|
|
140
|
+
open?: boolean | RowActionOptions;
|
|
140
141
|
add?: boolean | RowActionOptions;
|
|
141
142
|
delete?: boolean | RowActionOptions;
|
|
142
143
|
duplicate?: boolean | RowActionOptions;
|
|
@@ -156,6 +157,13 @@ export interface BaseTableConfig {
|
|
|
156
157
|
* @defaultValue false
|
|
157
158
|
*/
|
|
158
159
|
fullWidth?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* When true, rows show a pointer cursor and a hover highlight, signalling they are
|
|
162
|
+
* clickable. Emits `row:click` on every row click.
|
|
163
|
+
*
|
|
164
|
+
* @defaultValue false
|
|
165
|
+
*/
|
|
166
|
+
clickable?: boolean;
|
|
159
167
|
/**
|
|
160
168
|
* Configuration for row-level actions (add, delete, duplicate, etc.).
|
|
161
169
|
*/
|
|
@@ -604,9 +612,9 @@ export type ConnectionEvent = {
|
|
|
604
612
|
* @public
|
|
605
613
|
*/
|
|
606
614
|
export interface RowAddEvent {
|
|
607
|
-
/** The index
|
|
615
|
+
/** The index of the newly added row. */
|
|
608
616
|
rowIndex: number;
|
|
609
|
-
/** The
|
|
617
|
+
/** The data for the newly added row. */
|
|
610
618
|
row: TableRow;
|
|
611
619
|
}
|
|
612
620
|
/**
|
|
@@ -614,9 +622,9 @@ export interface RowAddEvent {
|
|
|
614
622
|
* @public
|
|
615
623
|
*/
|
|
616
624
|
export interface RowDeleteEvent {
|
|
617
|
-
/** The index of the row
|
|
625
|
+
/** The index of the deleted row (before deletion). */
|
|
618
626
|
rowIndex: number;
|
|
619
|
-
/** The
|
|
627
|
+
/** The data of the deleted row. */
|
|
620
628
|
row: TableRow;
|
|
621
629
|
}
|
|
622
630
|
/**
|
|
@@ -624,11 +632,11 @@ export interface RowDeleteEvent {
|
|
|
624
632
|
* @public
|
|
625
633
|
*/
|
|
626
634
|
export interface RowDuplicateEvent {
|
|
627
|
-
/** The index of the original row that was duplicated */
|
|
635
|
+
/** The index of the original row that was duplicated. */
|
|
628
636
|
sourceIndex: number;
|
|
629
|
-
/** The index of the newly created duplicate row */
|
|
637
|
+
/** The index of the newly created duplicate row. */
|
|
630
638
|
newIndex: number;
|
|
631
|
-
/** The
|
|
639
|
+
/** The data of the newly created duplicate row. */
|
|
632
640
|
row: TableRow;
|
|
633
641
|
}
|
|
634
642
|
/**
|
|
@@ -636,11 +644,11 @@ export interface RowDuplicateEvent {
|
|
|
636
644
|
* @public
|
|
637
645
|
*/
|
|
638
646
|
export interface RowInsertEvent {
|
|
639
|
-
/** The index of the row relative to which the
|
|
647
|
+
/** The index of the reference row relative to which the new row was inserted. */
|
|
640
648
|
targetIndex: number;
|
|
641
|
-
/** The index
|
|
649
|
+
/** The index at which the new row was inserted. */
|
|
642
650
|
newIndex: number;
|
|
643
|
-
/** The newly inserted row
|
|
651
|
+
/** The data of the newly inserted row. */
|
|
644
652
|
row: TableRow;
|
|
645
653
|
}
|
|
646
654
|
/**
|
|
@@ -648,9 +656,25 @@ export interface RowInsertEvent {
|
|
|
648
656
|
* @public
|
|
649
657
|
*/
|
|
650
658
|
export interface RowMoveEvent {
|
|
651
|
-
/** The
|
|
659
|
+
/** The index the row was moved from. */
|
|
652
660
|
fromIndex: number;
|
|
653
|
-
/** The
|
|
661
|
+
/** The index the row was moved to. */
|
|
654
662
|
toIndex: number;
|
|
655
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Event payload for row:click and row:open events.
|
|
666
|
+
* @public
|
|
667
|
+
*/
|
|
668
|
+
export interface RowClickEvent {
|
|
669
|
+
/** The data of the clicked row. */
|
|
670
|
+
row: TableRow;
|
|
671
|
+
/** The index of the clicked row. */
|
|
672
|
+
rowIndex: number;
|
|
673
|
+
/**
|
|
674
|
+
* The originating DOM MouseEvent. Present for all real user interactions.
|
|
675
|
+
* Inspect `event.ctrlKey` / `event.metaKey` for new-tab navigation,
|
|
676
|
+
* `event.button === 1` for middle-click, etc.
|
|
677
|
+
*/
|
|
678
|
+
event?: MouseEvent;
|
|
679
|
+
}
|
|
656
680
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,E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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/atable",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@vueuse/components": "^14.2.1",
|
|
37
37
|
"@vueuse/core": "^14.2.1",
|
|
38
|
-
"@stonecrop/schema": "0.13.
|
|
39
|
-
"@stonecrop/themes": "0.13.
|
|
40
|
-
"@stonecrop/utilities": "0.13.
|
|
38
|
+
"@stonecrop/schema": "0.13.14",
|
|
39
|
+
"@stonecrop/themes": "0.13.14",
|
|
40
|
+
"@stonecrop/utilities": "0.13.14"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"pinia": "^3.0.4",
|
|
@@ -138,17 +138,15 @@ const barStyle = computed((): StyleValue => {
|
|
|
138
138
|
}
|
|
139
139
|
})
|
|
140
140
|
|
|
141
|
-
const connectionDragStyle = computed(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
})
|
|
151
|
-
)
|
|
141
|
+
const connectionDragStyle = computed((): StyleValue => ({
|
|
142
|
+
position: 'fixed',
|
|
143
|
+
top: 0,
|
|
144
|
+
left: 0,
|
|
145
|
+
width: '100vw',
|
|
146
|
+
height: '100vh',
|
|
147
|
+
pointerEvents: 'none',
|
|
148
|
+
zIndex: 1000,
|
|
149
|
+
}))
|
|
152
150
|
|
|
153
151
|
// Drag setup data
|
|
154
152
|
const dragStartData = ref({ startX: 0, startPos: 0 })
|
package/src/components/ARow.vue
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<tr
|
|
2
|
+
<tr
|
|
3
|
+
v-show="isRowVisible"
|
|
4
|
+
ref="rowEl"
|
|
5
|
+
:tabindex="tabIndex"
|
|
6
|
+
class="atable-row"
|
|
7
|
+
:class="{ 'atable-row-clickable': isClickable }"
|
|
8
|
+
@click="onRowClick">
|
|
3
9
|
<!-- Row actions before index (default position) -->
|
|
4
10
|
<ARowActions
|
|
5
11
|
v-if="showRowActions && actionsPosition === 'before-index'"
|
|
@@ -72,13 +78,15 @@ const {
|
|
|
72
78
|
}>()
|
|
73
79
|
|
|
74
80
|
const emit = defineEmits<{
|
|
75
|
-
'row:action': [type: RowActionType, rowIndex: number]
|
|
81
|
+
'row:action': [type: RowActionType, rowIndex: number, event?: MouseEvent]
|
|
82
|
+
'row:click': [rowIndex: number, event: MouseEvent]
|
|
76
83
|
}>()
|
|
77
84
|
|
|
78
85
|
const rowRef = useTemplateRef<HTMLTableRowElement>('rowEl')
|
|
79
86
|
|
|
80
87
|
const isRowVisible = computed(() => store.isRowVisible(rowIndex))
|
|
81
88
|
const rowExpandSymbol = computed(() => store.getRowExpandSymbol(rowIndex))
|
|
89
|
+
const isClickable = computed(() => store.config.clickable ?? false)
|
|
82
90
|
|
|
83
91
|
// Row actions configuration
|
|
84
92
|
const rowActionsConfig = computed((): RowActionsConfig => {
|
|
@@ -93,8 +101,15 @@ const actionsPosition = computed(() => {
|
|
|
93
101
|
return rowActionsConfig.value.position || 'before-index'
|
|
94
102
|
})
|
|
95
103
|
|
|
96
|
-
const onRowAction = (actionType: RowActionType, index: number) => {
|
|
97
|
-
emit('row:action', actionType, index)
|
|
104
|
+
const onRowAction = (actionType: RowActionType, index: number, event?: MouseEvent) => {
|
|
105
|
+
emit('row:action', actionType, index, event)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const onRowClick = (event: MouseEvent) => {
|
|
109
|
+
// Ignore clicks on the row actions cell or tree expand cell
|
|
110
|
+
const target = event.target as HTMLElement
|
|
111
|
+
if (target.closest('.atable-row-actions') || target.closest('.tree-index')) return
|
|
112
|
+
emit('row:click', rowIndex, event)
|
|
98
113
|
}
|
|
99
114
|
|
|
100
115
|
if (addNavigation) {
|
|
@@ -123,6 +138,14 @@ if (addNavigation) {
|
|
|
123
138
|
background-color: white;
|
|
124
139
|
}
|
|
125
140
|
|
|
141
|
+
.atable-row-clickable {
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.atable-row-clickable:hover > td {
|
|
146
|
+
background-color: var(--sc-row-hover-color, #f0f4f8);
|
|
147
|
+
}
|
|
148
|
+
|
|
126
149
|
.atable-row:last-child > td {
|
|
127
150
|
border-bottom: 1px solid var(--sc-row-border-color);
|
|
128
151
|
}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
type="button"
|
|
27
27
|
class="row-action-menu-item"
|
|
28
28
|
role="menuitem"
|
|
29
|
-
@click.stop="executeAction(action.type)">
|
|
29
|
+
@click.stop="executeAction(action.type, $event)">
|
|
30
30
|
<span class="action-icon" v-html="action.icon" />
|
|
31
31
|
<span class="action-label">{{ action.label }}</span>
|
|
32
32
|
</button>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
class="row-action-btn"
|
|
43
43
|
:title="action.label"
|
|
44
44
|
:aria-label="action.label"
|
|
45
|
-
@click.stop="executeAction(action.type)">
|
|
45
|
+
@click.stop="executeAction(action.type, $event)">
|
|
46
46
|
<span class="action-icon" v-html="action.icon" />
|
|
47
47
|
</button>
|
|
48
48
|
</div>
|
|
@@ -65,7 +65,7 @@ const props = defineProps<{
|
|
|
65
65
|
}>()
|
|
66
66
|
|
|
67
67
|
const emit = defineEmits<{
|
|
68
|
-
action: [type: RowActionType, rowIndex: number]
|
|
68
|
+
action: [type: RowActionType, rowIndex: number, event?: MouseEvent]
|
|
69
69
|
}>()
|
|
70
70
|
|
|
71
71
|
const actionsCellRef = useTemplateRef<HTMLTableCellElement>('actionsCell')
|
|
@@ -77,12 +77,13 @@ const menuPosition = ref({ top: 0, left: 0 })
|
|
|
77
77
|
|
|
78
78
|
// Default labels for actions
|
|
79
79
|
const defaultLabels: Record<RowActionType, string> = {
|
|
80
|
-
add: 'Add
|
|
81
|
-
delete: 'Delete
|
|
82
|
-
duplicate: 'Duplicate
|
|
80
|
+
add: 'Add Record',
|
|
81
|
+
delete: 'Delete Record',
|
|
82
|
+
duplicate: 'Duplicate Record',
|
|
83
83
|
insertAbove: 'Insert Above',
|
|
84
84
|
insertBelow: 'Insert Below',
|
|
85
|
-
move: 'Move
|
|
85
|
+
move: 'Move Record',
|
|
86
|
+
open: 'Open Record',
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
// Determine which actions are enabled
|
|
@@ -90,7 +91,7 @@ const enabledActions = computed(() => {
|
|
|
90
91
|
const actions: Array<{ type: RowActionType; label: string; icon: string }> = []
|
|
91
92
|
const configActions = props.config.actions || {}
|
|
92
93
|
|
|
93
|
-
const actionTypes: RowActionType[] = ['add', 'delete', 'duplicate', 'insertAbove', 'insertBelow', 'move']
|
|
94
|
+
const actionTypes: RowActionType[] = ['open', 'add', 'delete', 'duplicate', 'insertAbove', 'insertBelow', 'move']
|
|
94
95
|
|
|
95
96
|
for (const type of actionTypes) {
|
|
96
97
|
const actionConfig = configActions[type]
|
|
@@ -199,7 +200,7 @@ onClickOutside(actionsCellRef, () => {
|
|
|
199
200
|
})
|
|
200
201
|
|
|
201
202
|
// Execute an action
|
|
202
|
-
const executeAction = (actionType: RowActionType) => {
|
|
203
|
+
const executeAction = (actionType: RowActionType, event?: MouseEvent) => {
|
|
203
204
|
dropdownOpen.value = false
|
|
204
205
|
|
|
205
206
|
// Check for custom handler
|
|
@@ -213,7 +214,7 @@ const executeAction = (actionType: RowActionType) => {
|
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
// Emit the action event for parent to handle
|
|
216
|
-
emit('action', actionType, props.rowIndex)
|
|
217
|
+
emit('action', actionType, props.rowIndex, event)
|
|
217
218
|
}
|
|
218
219
|
</script>
|
|
219
220
|
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
:row="row"
|
|
20
20
|
:row-index="row.originalIndex"
|
|
21
21
|
:store="store"
|
|
22
|
-
@row:action="handleRowAction"
|
|
22
|
+
@row:action="handleRowAction"
|
|
23
|
+
@row:click="handleRowClick">
|
|
23
24
|
<template v-for="(column, colIndex) in getProcessedColumnsForRow(row)" :key="column.name">
|
|
24
25
|
<component
|
|
25
26
|
:is="column.ganttComponent || 'AGanttCell'"
|
|
@@ -101,6 +102,7 @@ import type {
|
|
|
101
102
|
GanttDragEvent,
|
|
102
103
|
RowActionType,
|
|
103
104
|
RowAddEvent,
|
|
105
|
+
RowClickEvent,
|
|
104
106
|
RowDeleteEvent,
|
|
105
107
|
RowDuplicateEvent,
|
|
106
108
|
RowInsertEvent,
|
|
@@ -134,11 +136,13 @@ const emit = defineEmits<{
|
|
|
134
136
|
'connection:event': [event: ConnectionEvent]
|
|
135
137
|
'columns:update': [columns: TableColumn[]]
|
|
136
138
|
'row:add': [event: RowAddEvent]
|
|
139
|
+
'row:click': [event: RowClickEvent]
|
|
137
140
|
'row:delete': [event: RowDeleteEvent]
|
|
138
141
|
'row:duplicate': [event: RowDuplicateEvent]
|
|
139
142
|
'row:insert-above': [event: RowInsertEvent]
|
|
140
143
|
'row:insert-below': [event: RowInsertEvent]
|
|
141
144
|
'row:move': [event: RowMoveEvent]
|
|
145
|
+
'row:open': [event: RowClickEvent]
|
|
142
146
|
}>()
|
|
143
147
|
|
|
144
148
|
const tableRef = useTemplateRef<HTMLTableElement>('table')
|
|
@@ -308,11 +312,19 @@ const handleConnectionDelete = (connection: ConnectionPath) => {
|
|
|
308
312
|
emit('connection:event', { type: 'delete', connection })
|
|
309
313
|
}
|
|
310
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Handle row click events from ARow components.
|
|
317
|
+
*/
|
|
318
|
+
const handleRowClick = (rowIndex: number, event: MouseEvent) => {
|
|
319
|
+
const row = store.rows[rowIndex]
|
|
320
|
+
emit('row:click', { row, rowIndex, event })
|
|
321
|
+
}
|
|
322
|
+
|
|
311
323
|
/**
|
|
312
324
|
* Handle row action events from ARow components.
|
|
313
325
|
* Performs the default action and emits the appropriate event.
|
|
314
326
|
*/
|
|
315
|
-
const handleRowAction = (actionType: RowActionType, rowIndex: number) => {
|
|
327
|
+
const handleRowAction = (actionType: RowActionType, rowIndex: number, event?: MouseEvent) => {
|
|
316
328
|
switch (actionType) {
|
|
317
329
|
case 'add': {
|
|
318
330
|
// Add a new row after the current row
|
|
@@ -359,6 +371,11 @@ const handleRowAction = (actionType: RowActionType, rowIndex: number) => {
|
|
|
359
371
|
emit('row:move', { fromIndex: rowIndex, toIndex: -1 })
|
|
360
372
|
break
|
|
361
373
|
}
|
|
374
|
+
case 'open': {
|
|
375
|
+
const row = store.rows[rowIndex]
|
|
376
|
+
emit('row:open', { row, rowIndex, event })
|
|
377
|
+
break
|
|
378
|
+
}
|
|
362
379
|
}
|
|
363
380
|
}
|
|
364
381
|
|
package/src/icons/index.ts
CHANGED
|
@@ -10,8 +10,9 @@ import DuplicateIcon from './stonecrop-ui-icon-duplicate.svg?raw'
|
|
|
10
10
|
import InsertAboveIcon from './stonecrop-ui-icon-insert-above.svg?raw'
|
|
11
11
|
import InsertBelowIcon from './stonecrop-ui-icon-insert-below.svg?raw'
|
|
12
12
|
import MoveIcon from './stonecrop-ui-icon-move.svg?raw'
|
|
13
|
+
import OpenIcon from './stonecrop-ui-icon-open.svg?raw'
|
|
13
14
|
|
|
14
|
-
export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon }
|
|
15
|
+
export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon, OpenIcon }
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Map of action types to their default icons.
|
|
@@ -25,4 +26,5 @@ export const actionIcons: Record<string, string> = {
|
|
|
25
26
|
insertAbove: InsertAboveIcon,
|
|
26
27
|
insertBelow: InsertBelowIcon,
|
|
27
28
|
move: MoveIcon,
|
|
29
|
+
open: OpenIcon,
|
|
28
30
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
3
|
+
<path d="M32,64C14.35,64,0,49.65,0,32S14.35,0,32,0s32,14.35,32,32-14.35,32-32,32ZM32,4c-15.44,0-28,12.56-28,28s12.56,28,28,28,28-12.56,28-28S47.44,4,32,4Z" style="fill: #000; stroke-width: 0px;"/>
|
|
4
|
+
<polygon points="18,20 18,44 46,32" style="fill: #000; stroke-width: 0px;"/>
|
|
5
|
+
</svg>
|
package/src/index.ts
CHANGED
|
@@ -16,7 +16,16 @@ export type * from './types'
|
|
|
16
16
|
export { schemaToColumns } from './schemaToColumns'
|
|
17
17
|
|
|
18
18
|
// Icon exports
|
|
19
|
-
export {
|
|
19
|
+
export {
|
|
20
|
+
AddIcon,
|
|
21
|
+
DeleteIcon,
|
|
22
|
+
DuplicateIcon,
|
|
23
|
+
InsertAboveIcon,
|
|
24
|
+
InsertBelowIcon,
|
|
25
|
+
MoveIcon,
|
|
26
|
+
OpenIcon,
|
|
27
|
+
actionIcons,
|
|
28
|
+
} from './icons'
|
|
20
29
|
|
|
21
30
|
/**
|
|
22
31
|
* Install all ATable components
|
package/src/types/index.ts
CHANGED
|
@@ -83,7 +83,7 @@ export interface CellContext {
|
|
|
83
83
|
* Row action type identifiers.
|
|
84
84
|
* @public
|
|
85
85
|
*/
|
|
86
|
-
export type RowActionType = 'add' | 'delete' | 'duplicate' | 'insertAbove' | 'insertBelow' | 'move'
|
|
86
|
+
export type RowActionType = 'open' | 'add' | 'delete' | 'duplicate' | 'insertAbove' | 'insertBelow' | 'move'
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* Options for configuring individual row actions.
|
|
@@ -156,6 +156,7 @@ export interface RowActionsConfig {
|
|
|
156
156
|
* false to disable, or provide RowActionOptions for custom configuration.
|
|
157
157
|
*/
|
|
158
158
|
actions?: {
|
|
159
|
+
open?: boolean | RowActionOptions
|
|
159
160
|
add?: boolean | RowActionOptions
|
|
160
161
|
delete?: boolean | RowActionOptions
|
|
161
162
|
duplicate?: boolean | RowActionOptions
|
|
@@ -177,6 +178,14 @@ export interface BaseTableConfig {
|
|
|
177
178
|
*/
|
|
178
179
|
fullWidth?: boolean
|
|
179
180
|
|
|
181
|
+
/**
|
|
182
|
+
* When true, rows show a pointer cursor and a hover highlight, signalling they are
|
|
183
|
+
* clickable. Emits `row:click` on every row click.
|
|
184
|
+
*
|
|
185
|
+
* @defaultValue false
|
|
186
|
+
*/
|
|
187
|
+
clickable?: boolean
|
|
188
|
+
|
|
180
189
|
/**
|
|
181
190
|
* Configuration for row-level actions (add, delete, duplicate, etc.).
|
|
182
191
|
*/
|
|
@@ -692,9 +701,9 @@ export type ConnectionEvent = {
|
|
|
692
701
|
* @public
|
|
693
702
|
*/
|
|
694
703
|
export interface RowAddEvent {
|
|
695
|
-
/** The index
|
|
704
|
+
/** The index of the newly added row. */
|
|
696
705
|
rowIndex: number
|
|
697
|
-
/** The
|
|
706
|
+
/** The data for the newly added row. */
|
|
698
707
|
row: TableRow
|
|
699
708
|
}
|
|
700
709
|
|
|
@@ -703,9 +712,9 @@ export interface RowAddEvent {
|
|
|
703
712
|
* @public
|
|
704
713
|
*/
|
|
705
714
|
export interface RowDeleteEvent {
|
|
706
|
-
/** The index of the row
|
|
715
|
+
/** The index of the deleted row (before deletion). */
|
|
707
716
|
rowIndex: number
|
|
708
|
-
/** The
|
|
717
|
+
/** The data of the deleted row. */
|
|
709
718
|
row: TableRow
|
|
710
719
|
}
|
|
711
720
|
|
|
@@ -714,11 +723,11 @@ export interface RowDeleteEvent {
|
|
|
714
723
|
* @public
|
|
715
724
|
*/
|
|
716
725
|
export interface RowDuplicateEvent {
|
|
717
|
-
/** The index of the original row that was duplicated */
|
|
726
|
+
/** The index of the original row that was duplicated. */
|
|
718
727
|
sourceIndex: number
|
|
719
|
-
/** The index of the newly created duplicate row */
|
|
728
|
+
/** The index of the newly created duplicate row. */
|
|
720
729
|
newIndex: number
|
|
721
|
-
/** The
|
|
730
|
+
/** The data of the newly created duplicate row. */
|
|
722
731
|
row: TableRow
|
|
723
732
|
}
|
|
724
733
|
|
|
@@ -727,11 +736,11 @@ export interface RowDuplicateEvent {
|
|
|
727
736
|
* @public
|
|
728
737
|
*/
|
|
729
738
|
export interface RowInsertEvent {
|
|
730
|
-
/** The index of the row relative to which the
|
|
739
|
+
/** The index of the reference row relative to which the new row was inserted. */
|
|
731
740
|
targetIndex: number
|
|
732
|
-
/** The index
|
|
741
|
+
/** The index at which the new row was inserted. */
|
|
733
742
|
newIndex: number
|
|
734
|
-
/** The newly inserted row
|
|
743
|
+
/** The data of the newly inserted row. */
|
|
735
744
|
row: TableRow
|
|
736
745
|
}
|
|
737
746
|
|
|
@@ -740,8 +749,25 @@ export interface RowInsertEvent {
|
|
|
740
749
|
* @public
|
|
741
750
|
*/
|
|
742
751
|
export interface RowMoveEvent {
|
|
743
|
-
/** The
|
|
752
|
+
/** The index the row was moved from. */
|
|
744
753
|
fromIndex: number
|
|
745
|
-
/** The
|
|
754
|
+
/** The index the row was moved to. */
|
|
746
755
|
toIndex: number
|
|
747
756
|
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Event payload for row:click and row:open events.
|
|
760
|
+
* @public
|
|
761
|
+
*/
|
|
762
|
+
export interface RowClickEvent {
|
|
763
|
+
/** The data of the clicked row. */
|
|
764
|
+
row: TableRow
|
|
765
|
+
/** The index of the clicked row. */
|
|
766
|
+
rowIndex: number
|
|
767
|
+
/**
|
|
768
|
+
* The originating DOM MouseEvent. Present for all real user interactions.
|
|
769
|
+
* Inspect `event.ctrlKey` / `event.metaKey` for new-tab navigation,
|
|
770
|
+
* `event.button === 1` for middle-click, etc.
|
|
771
|
+
*/
|
|
772
|
+
event?: MouseEvent
|
|
773
|
+
}
|