@stonecrop/atable 0.31.0 → 0.32.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.
Files changed (79) hide show
  1. package/dist/assets/index.css +804 -1
  2. package/dist/atable.js +2809 -1944
  3. package/dist/atable.js.map +1 -1
  4. package/dist/src/components/ACell.vue.d.ts +17 -0
  5. package/dist/src/components/ACell.vue.d.ts.map +1 -0
  6. package/dist/src/components/AGanttCell.vue.d.ts +34 -0
  7. package/dist/src/components/AGanttCell.vue.d.ts.map +1 -0
  8. package/dist/src/components/AGanttConnection.vue.d.ts +13 -0
  9. package/dist/src/components/AGanttConnection.vue.d.ts.map +1 -0
  10. package/dist/src/components/ARow.vue.d.ts +2693 -0
  11. package/dist/src/components/ARow.vue.d.ts.map +1 -0
  12. package/dist/src/components/ARowActions.vue.d.ts +16 -0
  13. package/dist/src/components/ARowActions.vue.d.ts.map +1 -0
  14. package/dist/src/components/ATable.vue.d.ts +13358 -0
  15. package/dist/src/components/ATable.vue.d.ts.map +1 -0
  16. package/dist/src/components/ATableColumnFilter.vue.d.ts +11 -0
  17. package/dist/src/components/ATableColumnFilter.vue.d.ts.map +1 -0
  18. package/dist/src/components/ATableHeader.vue.d.ts +20 -0
  19. package/dist/src/components/ATableHeader.vue.d.ts.map +1 -0
  20. package/dist/src/components/ATableLoading.vue.d.ts +14 -0
  21. package/dist/src/components/ATableLoading.vue.d.ts.map +1 -0
  22. package/dist/src/components/ATableLoadingBar.vue.d.ts +14 -0
  23. package/dist/src/components/ATableLoadingBar.vue.d.ts.map +1 -0
  24. package/dist/src/components/ATableModal.vue.d.ts +18 -0
  25. package/dist/src/components/ATableModal.vue.d.ts.map +1 -0
  26. package/dist/src/components/ATablePaginationFooter.vue.d.ts +17 -0
  27. package/dist/src/components/ATablePaginationFooter.vue.d.ts.map +1 -0
  28. package/dist/src/icons/index.d.ts +14 -7
  29. package/dist/src/icons/index.d.ts.map +1 -1
  30. package/dist/{tsdoc-metadata.json → src/tsdoc-metadata.json} +1 -1
  31. package/dist/src/types/index.d.ts.map +1 -1
  32. package/package.json +35 -29
  33. package/dist/atable.d.ts +0 -3560
  34. package/dist/atable.tsbuildinfo +0 -1
  35. package/dist/icons/stonecrop-ui-icon-add.svg +0 -5
  36. package/dist/icons/stonecrop-ui-icon-delete.svg +0 -5
  37. package/dist/icons/stonecrop-ui-icon-duplicate.svg +0 -5
  38. package/dist/icons/stonecrop-ui-icon-insert-above.svg +0 -15
  39. package/dist/icons/stonecrop-ui-icon-insert-below.svg +0 -15
  40. package/dist/icons/stonecrop-ui-icon-move.svg +0 -4
  41. package/dist/icons/stonecrop-ui-icon-open.svg +0 -5
  42. package/dist/src/composables/table-pagination.js +0 -108
  43. package/dist/src/icons/index.js +0 -32
  44. package/dist/src/index.js +0 -33
  45. package/dist/src/linkSearchableText.js +0 -44
  46. package/dist/src/resolveFilterType.js +0 -27
  47. package/dist/src/schemaToColumns.js +0 -59
  48. package/dist/src/stores/table.js +0 -833
  49. package/dist/src/types/index.js +0 -0
  50. package/dist/src/utils.js +0 -39
  51. package/src/components/ACell.vue +0 -410
  52. package/src/components/AGanttCell.vue +0 -638
  53. package/src/components/AGanttConnection.vue +0 -164
  54. package/src/components/ARow.vue +0 -251
  55. package/src/components/ARowActions.vue +0 -407
  56. package/src/components/ATable.vue +0 -538
  57. package/src/components/ATableColumnFilter.vue +0 -216
  58. package/src/components/ATableHeader.vue +0 -141
  59. package/src/components/ATableLoading.vue +0 -86
  60. package/src/components/ATableLoadingBar.vue +0 -81
  61. package/src/components/ATableModal.vue +0 -52
  62. package/src/components/ATablePaginationFooter.vue +0 -100
  63. package/src/composables/table-pagination.ts +0 -172
  64. package/src/icons/index.ts +0 -38
  65. package/src/icons/stonecrop-ui-icon-add.svg +0 -5
  66. package/src/icons/stonecrop-ui-icon-delete.svg +0 -5
  67. package/src/icons/stonecrop-ui-icon-duplicate.svg +0 -5
  68. package/src/icons/stonecrop-ui-icon-insert-above.svg +0 -15
  69. package/src/icons/stonecrop-ui-icon-insert-below.svg +0 -15
  70. package/src/icons/stonecrop-ui-icon-move.svg +0 -4
  71. package/src/icons/stonecrop-ui-icon-open.svg +0 -5
  72. package/src/index.ts +0 -62
  73. package/src/linkSearchableText.ts +0 -42
  74. package/src/resolveFilterType.ts +0 -32
  75. package/src/schemaToColumns.ts +0 -67
  76. package/src/shims-vue.d.ts +0 -10
  77. package/src/stores/table.ts +0 -978
  78. package/src/types/index.ts +0 -794
  79. package/src/utils.ts +0 -40
@@ -1,794 +0,0 @@
1
- import { useElementBounding } from '@vueuse/core'
2
- import type { Ref, ShallowRef } from 'vue'
3
-
4
- import type { ColumnSchema } from '@stonecrop/schema'
5
- import type { BadgeDescriptor } from '@stonecrop/schema'
6
-
7
- import { createTableStore } from '../stores/table'
8
-
9
- /**
10
- * Runtime column definition for ATable.
11
- *
12
- * Extends `ColumnSchema` from `@stonecrop/schema` — all authoring properties (`label`, `component`, `width`,
13
- * `pinned`, filter config, cell/modal component names, etc.) are inherited. The overrides
14
- * below widen three properties for runtime use (live functions, broader alignment values)
15
- * and add two runtime-only additions (`mask`, `originalIndex`).
16
- *
17
- * Schema-based callers should author columns as `ColumnSchema[]` (using `fieldname`) and
18
- * pass them via ATable's `:schema` prop — `TableColumn` is the internal runtime type and
19
- * callers working from a doctype schema never need to construct it directly.
20
- * @public
21
- */
22
- export interface TableColumn extends Omit<ColumnSchema, 'fieldname' | 'hidden' | 'format' | 'modalComponent'> {
23
- /** Runtime column key. Corresponds to `fieldname` in `ColumnSchema`; populated by `schemaToColumns`. */
24
- name: string
25
-
26
- /**
27
- * Widens `ColumnSchema.format` (string-only) to also accept a live function at runtime.
28
- * Serialized string functions are deserialized by the table store's `getFormattedValue`.
29
- * May return a plain string, HTML, or a {@link @stonecrop/schema#BadgeDescriptor}.
30
- */
31
- format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor)
32
-
33
- /**
34
- * Widens `ColumnSchema.modalComponent` (string-only) to also accept a factory function.
35
- * When a function is provided it receives the cell context and returns the component name.
36
- * The cell context exposes:
37
- * - `row` — the row object for the current cell
38
- * - `column` — the column object for the current cell
39
- * - `table` — the table object
40
- */
41
- modalComponent?: string | ((context: CellContext) => string)
42
-
43
- /**
44
- * Input mask applied to the cell value before display. Accepts a live function only —
45
- * masks cannot be serialized to JSON so they are absent from `ColumnSchema`.
46
- */
47
- mask?: (value: any) => any
48
-
49
- /**
50
- * For link columns (those carrying `doctype`): the target doctype slug used by the `linkResolver`
51
- * to look up display text for bare ID values. Set automatically by `schemaToColumns`
52
- * from the field's `doctype` property.
53
- */
54
- linkDoctype?: string
55
-
56
- /**
57
- * Runtime Gantt column index (excluding pinned columns). Set automatically during
58
- * Gantt table rendering.
59
- */
60
- readonly originalIndex?: number
61
- }
62
-
63
- /**
64
- * Table cell context definition.
65
- * @public
66
- */
67
- export interface CellContext {
68
- /**
69
- * The row object for the current cell.
70
- */
71
- row: TableRow
72
-
73
- /**
74
- * The column object for the current cell.
75
- */
76
- column: TableColumn
77
-
78
- /**
79
- * The table object for the current cell.
80
- */
81
- table: { [key: string]: any }
82
- }
83
-
84
- /**
85
- * Row action type identifiers.
86
- * @public
87
- */
88
- export type RowActionType =
89
- 'open' | 'add' | 'delete' | 'duplicate' | 'insertAbove' | 'insertBelow' | 'move' | 'moveUp' | 'moveDown'
90
-
91
- /**
92
- * Options for configuring individual row actions.
93
- * @public
94
- */
95
- export interface RowActionOptions {
96
- /**
97
- * Whether the action is enabled.
98
- *
99
- * @defaultValue true
100
- */
101
- enabled?: boolean
102
-
103
- /**
104
- * Custom label for the action (used in dropdown mode).
105
- */
106
- label?: string
107
-
108
- /**
109
- * Custom icon override (raw SVG string).
110
- */
111
- icon?: string
112
-
113
- /**
114
- * Custom handler for the action. Return false to prevent the default behavior.
115
- *
116
- * @param rowIndex - The index of the row the action is being performed on
117
- * @param store - The table store instance
118
- * @returns void or false to prevent default behavior
119
- */
120
- handler?: (rowIndex: number, store: ReturnType<typeof createTableStore>) => void | boolean
121
-
122
- /**
123
- * Per-row predicate to disable this action for specific rows (e.g. a lock-aware delete, or
124
- * move-up on the first row). Returns true to render the action disabled. Evaluated reactively
125
- * against the store, so it updates as rows change.
126
- *
127
- * @param rowIndex - The index of the row
128
- * @param store - The table store instance
129
- */
130
- disabled?: (rowIndex: number, store: ReturnType<typeof createTableStore>) => boolean
131
- }
132
-
133
- /**
134
- * Configuration for row-level actions (add, delete, duplicate, etc.).
135
- * @public
136
- */
137
- export interface RowActionsConfig {
138
- /**
139
- * Whether row actions are enabled.
140
- *
141
- * @defaultValue false
142
- */
143
- enabled: boolean
144
-
145
- /**
146
- * Position of the row actions column relative to the index column.
147
- *
148
- * @defaultValue 'before-index'
149
- */
150
- position?: 'before-index' | 'after-index' | 'end'
151
-
152
- /**
153
- * Pixel width threshold at which to switch from icons to dropdown mode.
154
- * Set to 0 to always use icons, or a large number to always use dropdown.
155
- *
156
- * @defaultValue 150
157
- */
158
- dropdownThreshold?: number
159
-
160
- /**
161
- * Force dropdown mode regardless of available width.
162
- *
163
- * @defaultValue false
164
- */
165
- forceDropdown?: boolean
166
-
167
- /**
168
- * Configuration for individual actions. Set to true to enable with defaults,
169
- * false to disable, or provide RowActionOptions for custom configuration.
170
- */
171
- actions?: {
172
- open?: boolean | RowActionOptions
173
- add?: boolean | RowActionOptions
174
- delete?: boolean | RowActionOptions
175
- duplicate?: boolean | RowActionOptions
176
- insertAbove?: boolean | RowActionOptions
177
- insertBelow?: boolean | RowActionOptions
178
- move?: boolean | RowActionOptions
179
- moveUp?: boolean | RowActionOptions
180
- moveDown?: boolean | RowActionOptions
181
- }
182
- }
183
-
184
- /**
185
- * Base table configuration properties shared across all view types.
186
- * @public
187
- */
188
- export interface BaseTableConfig {
189
- /**
190
- * Control whether the table should be allowed to use the full width of its container.
191
- *
192
- * @defaultValue false
193
- */
194
- fullWidth?: boolean
195
-
196
- /**
197
- * When true, rows show a pointer cursor and a hover highlight, signalling they are
198
- * clickable. Emits `row:click` on every row click.
199
- *
200
- * @defaultValue false
201
- */
202
- clickable?: boolean
203
-
204
- /**
205
- * Configuration for row-level actions (add, delete, duplicate, etc.).
206
- */
207
- rowActions?: RowActionsConfig
208
-
209
- /**
210
- * When set, slice the held rows into in-memory windows of this size.
211
- * Omit to show the whole held list as one window (server paging uses the backend cap).
212
- */
213
- pageSize?: number
214
- }
215
-
216
- /**
217
- * Table configuration for basic view types (uncounted, list, list-expansion).
218
- * @public
219
- */
220
- export interface BasicTableConfig extends BaseTableConfig {
221
- /**
222
- * The type of view to display the table in.
223
- */
224
- view?: 'uncounted' | 'list' | 'list-expansion'
225
- }
226
-
227
- /**
228
- * Table configuration for tree view types.
229
- * @public
230
- */
231
- export interface TreeTableConfig extends BaseTableConfig {
232
- /**
233
- * The type of view to display the table in.
234
- */
235
- view: 'tree'
236
-
237
- /**
238
- * Default expansion state for tree views. Possible values:
239
- * - `root` - Only top-level nodes are visible (fully collapsed)
240
- * - `branch` - Shows minimal tree to display all gantt nodes. Expands only the necessary paths to gantt nodes, stops at gantt nodes with no gantt descendants
241
- * - `leaf` - All nodes are visible (fully expanded)
242
- *
243
- * @defaultValue undefined (default behavior is 'leaf' mode)
244
- */
245
- defaultTreeExpansion?: 'root' | 'branch' | 'leaf'
246
- }
247
-
248
- /**
249
- * Table configuration for gantt view types.
250
- * @public
251
- */
252
- export interface GanttTableConfig extends BaseTableConfig {
253
- /**
254
- * The type of view to display the table in.
255
- */
256
- view: 'gantt'
257
-
258
- /**
259
- * Control whether dependency graph connections should be enabled for Gantt views.
260
- * When false, connection handles and dependency lines will be hidden.
261
- *
262
- * @defaultValue true
263
- */
264
- dependencyGraph?: boolean
265
- }
266
-
267
- /**
268
- * Table configuration for tree-gantt view types.
269
- * @public
270
- */
271
- export interface TreeGanttTableConfig extends BaseTableConfig {
272
- /**
273
- * The type of view to display the table in.
274
- */
275
- view: 'tree-gantt'
276
-
277
- /**
278
- * Default expansion state for tree views. Possible values:
279
- * - `root` - Only top-level nodes are visible (fully collapsed)
280
- * - `branch` - Shows minimal tree to display all gantt nodes. Expands only the necessary paths to gantt nodes, stops at gantt nodes with no gantt descendants
281
- * - `leaf` - All nodes are visible (fully expanded)
282
- *
283
- * @defaultValue undefined (default behavior is 'leaf' mode)
284
- */
285
- defaultTreeExpansion?: 'root' | 'branch' | 'leaf'
286
-
287
- /**
288
- * Control whether dependency graph connections should be enabled for Gantt views.
289
- * When false, connection handles and dependency lines will be hidden.
290
- *
291
- * @defaultValue true
292
- */
293
- dependencyGraph?: boolean
294
- }
295
-
296
- /**
297
- * Table configuration definition using discriminated unions for type safety.
298
- * @public
299
- */
300
- export type TableConfig = BasicTableConfig | TreeTableConfig | GanttTableConfig | TreeGanttTableConfig
301
-
302
- /**
303
- * Table display definition.
304
- * @public
305
- */
306
- export interface TableDisplay {
307
- /**
308
- * Indicates whether a row node is expanded or collapsed.
309
- *
310
- * Only applicable for list-expansion views.
311
- *
312
- * @defaultValue false
313
- */
314
- expanded?: boolean
315
-
316
- /**
317
- * Indicates whether a row node's child nodes are open or closed.
318
- *
319
- * Only applicable for tree views.
320
- *
321
- * @defaultValue false
322
- */
323
- childrenOpen?: boolean
324
-
325
- /**
326
- * Indicates whether a row node is a parent node. This is evaluated automatically
327
- * while rendering the table.
328
- *
329
- * Only applicable for tree views.
330
- */
331
- isParent?: boolean
332
-
333
- /**
334
- * Indicates whether a row node is a root node. This is evaluated automatically
335
- * while rendering the table.
336
- *
337
- * Only applicable for tree views.
338
- */
339
- isRoot?: boolean
340
-
341
- /**
342
- * Indicates whether a row node is visible. This is evaluated automatically
343
- * while rendering the table.
344
- *
345
- * Only applicable for tree views.
346
- */
347
- open?: boolean
348
-
349
- /**
350
- * The indentation level of the row node.
351
- *
352
- * Only applicable for tree and gantt views.
353
- *
354
- * @defaultValue 0
355
- */
356
- indent?: number
357
-
358
- /**
359
- * The HTML parent element for the row node. This is evaluated automatically while rendering
360
- * the table.
361
- *
362
- * Only applicable for tree and gantt views.
363
- */
364
- parent?: number
365
-
366
- /**
367
- * Indicates whether a row node has been modified. This is evaluated automatically when a cell
368
- * is edited.
369
- *
370
- * @defaultValue false
371
- */
372
- rowModified?: boolean
373
- }
374
-
375
- /**
376
- * Table row definition.
377
- * @public
378
- */
379
- export interface TableRow {
380
- /**
381
- * Additional arbitrary properties that can be passed to the row object.
382
- */
383
- [key: string]: any
384
-
385
- /**
386
- * The indentation level of the row node.
387
- *
388
- * Only applicable for tree and gantt views.
389
- *
390
- * @defaultValue 0
391
- */
392
- indent?: number
393
-
394
- /**
395
- * The HTML parent element for the row node. This is evaluated automatically while rendering
396
- * the table.
397
- *
398
- * Only applicable for tree and gantt views.
399
- */
400
- parent?: number
401
-
402
- /**
403
- * The options to use when rendering the row as a Gantt table.
404
- */
405
- gantt?: GanttOptions
406
- }
407
-
408
- /**
409
- * Gantt chart options for table rows.
410
- * @public
411
- */
412
- export interface GanttOptions {
413
- /**
414
- * The color to be applied to the row's gantt bar.
415
- *
416
- * @defaultValue '#cccccc'
417
- */
418
- color?: string
419
-
420
- /**
421
- * The starting column index for the gantt bar.
422
- *
423
- * @defaultValue 0
424
- */
425
- startIndex?: number
426
-
427
- /**
428
- * The ending column index for the gantt bar. If endIndex and colspan are not provided,
429
- * the bar will stretch to the end of the table.
430
- */
431
- endIndex?: number
432
-
433
- /**
434
- * The length of the gantt bar in columns. Useful when only the start index is provided.
435
- * If colspan and endIndex are not provided, the bar will stretch to the end of the table.
436
- */
437
- colspan?: number
438
- }
439
-
440
- /**
441
- * Gantt table drag event definition.
442
- * @public
443
- */
444
- export type GanttDragEvent = {
445
- rowIndex: number
446
- colIndex: number
447
- delta: number
448
- } & (
449
- | {
450
- type: 'bar'
451
- oldStart: number
452
- oldEnd: number
453
- newStart: number
454
- newEnd: number
455
- colspan: number
456
- }
457
- | {
458
- type: 'resize'
459
- edge: 'start'
460
- oldStart: number
461
- newStart: number
462
- end: number
463
- oldColspan: number
464
- newColspan: number
465
- }
466
- | {
467
- type: 'resize'
468
- edge: 'end'
469
- oldEnd: number
470
- newEnd: number
471
- start: number
472
- oldColspan: number
473
- newColspan: number
474
- }
475
- )
476
-
477
- /**
478
- * Table modal definition.
479
- * @public
480
- */
481
- export interface TableModal {
482
- /**
483
- * Indicates whether the table modal is currently visible.
484
- *
485
- * @defaultValue false
486
- */
487
- visible?: boolean
488
-
489
- /**
490
- * The HTML cell element that the modal is currently being displayed for. The field is unset
491
- * when the modal is not being displayed.
492
- */
493
- cell?: HTMLTableCellElement | null
494
-
495
- /**
496
- * The HTML parent element that the modal is currently being displayed for. The field is unset
497
- * when the modal is not being displayed.
498
- */
499
- parent?: HTMLElement
500
-
501
- /**
502
- * The index of the column that the modal is currently being displayed for. The field is
503
- * unset when the modal is not being displayed.
504
- */
505
- colIndex?: number
506
-
507
- /**
508
- * The index of the row that the modal is currently being displayed for. The field is
509
- * unset when the modal is not being displayed.
510
- */
511
- rowIndex?: number
512
-
513
- /**
514
- * The component to use to render the modal. If not provided, the table will
515
- * try to use the column's `modalComponent` property, if set. If that is not set,
516
- * the table will not display a modal.
517
- *
518
- * @see {@link TableColumn.modalComponent}
519
- */
520
- component?: string
521
-
522
- /**
523
- * Additional properties to pass to the table's modal component.
524
- */
525
- componentProps?: Record<string, any>
526
-
527
- /**
528
- * Reactive bottom value for the modal's bounding box. The field is unset when the modal
529
- * is not being displayed.
530
- */
531
- bottom?: ReturnType<typeof useElementBounding>['bottom']
532
-
533
- /**
534
- * Reactive height value for the modal's bounding box. The field is unset when the modal
535
- * is not being displayed.
536
- */
537
- height?: ReturnType<typeof useElementBounding>['height']
538
-
539
- /**
540
- * Reactive left value for the modal's bounding box. The field is unset when the modal
541
- * is not being displayed.
542
- */
543
- left?: ReturnType<typeof useElementBounding>['left']
544
-
545
- /**
546
- * Reactive width value for the modal's bounding box. The field is unset when the modal
547
- * is not being displayed.
548
- */
549
- width?: ReturnType<typeof useElementBounding>['width']
550
- }
551
-
552
- /**
553
- * Table modal component props definition.
554
- * @public
555
- */
556
- export interface TableModalProps {
557
- /**
558
- * Additional arbitrary properties that can be passed to the modal component.
559
- */
560
- [key: string]: any
561
-
562
- /**
563
- * The index of the column that the modal is currently being displayed for.
564
- */
565
- colIndex: number
566
-
567
- /**
568
- * The index of the row that the modal is currently being displayed for.
569
- */
570
- rowIndex: number
571
-
572
- /**
573
- * The store for managing the current table's state.
574
- */
575
- store: ReturnType<typeof createTableStore>
576
- }
577
-
578
- /**
579
- * Gantt bar information for VueFlow integration.
580
- * @public
581
- */
582
- export interface GanttBarInfo {
583
- /**
584
- * Unique identifier for the gantt bar.
585
- */
586
- id: string
587
-
588
- /**
589
- * The row index of the gantt bar.
590
- */
591
- rowIndex: number
592
-
593
- /**
594
- * The primary column index of the gantt bar (typically the start index).
595
- */
596
- colIndex: number
597
-
598
- /**
599
- * Starting column index of the gantt bar.
600
- */
601
- startIndex: Ref<number>
602
-
603
- /**
604
- * Ending column index of the gantt bar.
605
- */
606
- endIndex: Ref<number>
607
-
608
- /**
609
- * Color of the gantt bar.
610
- */
611
- color: Ref<string>
612
-
613
- /**
614
- * The position of the gantt bar in the ATable component.
615
- */
616
- position: {
617
- x: ShallowRef<number>
618
- y: ShallowRef<number>
619
- }
620
-
621
- /**
622
- * Display label for the gantt bar.
623
- */
624
- label?: string
625
- }
626
-
627
- /**
628
- * Connection handle information for gantt bar connections.
629
- * @public
630
- */
631
- export interface ConnectionHandle {
632
- /**
633
- * Unique identifier for the connection handle.
634
- */
635
- id: string
636
-
637
- /**
638
- * The row index of the gantt bar this handle belongs to.
639
- */
640
- rowIndex: number
641
-
642
- /**
643
- * The column index of the gantt bar this handle belongs to.
644
- */
645
- colIndex: number
646
-
647
- /**
648
- * The side of the gantt bar where this handle is located.
649
- */
650
- side: 'left' | 'right'
651
-
652
- /**
653
- * The position of the connection handle.
654
- */
655
- position: {
656
- x: ShallowRef<number>
657
- y: ShallowRef<number>
658
- }
659
-
660
- /**
661
- * Whether the handle is currently visible (on hover).
662
- */
663
- visible: Ref<boolean>
664
-
665
- /**
666
- * Reference to the gantt bar this handle belongs to.
667
- */
668
- barId: string
669
- }
670
-
671
- /**
672
- * Connection path between two gantt bars.
673
- * @public
674
- */
675
- export interface ConnectionPath {
676
- /**
677
- * Unique identifier for the connection path.
678
- */
679
- id: string
680
-
681
- /**
682
- * The source connection handle.
683
- */
684
- from: {
685
- barId: string
686
- side: 'left' | 'right'
687
- }
688
-
689
- /**
690
- * The target connection handle.
691
- */
692
- to: {
693
- barId: string
694
- side: 'left' | 'right'
695
- }
696
-
697
- /**
698
- * Optional styling for the connection path.
699
- */
700
- style?: {
701
- color?: string
702
- width?: number
703
- }
704
-
705
- /**
706
- * Optional label for the connection.
707
- */
708
- label?: string
709
- }
710
-
711
- /**
712
- * Connection event for handling connection creation/deletion.
713
- * @public
714
- */
715
- export type ConnectionEvent = {
716
- type: 'create' | 'delete'
717
- connection: ConnectionPath
718
- }
719
-
720
- /**
721
- * Event payload for row:add event.
722
- * @public
723
- */
724
- export interface RowAddEvent {
725
- /** The index of the newly added row. */
726
- rowIndex: number
727
- /** The data for the newly added row. */
728
- row: TableRow
729
- }
730
-
731
- /**
732
- * Event payload for row:delete event.
733
- * @public
734
- */
735
- export interface RowDeleteEvent {
736
- /** The index of the deleted row (before deletion). */
737
- rowIndex: number
738
- /** The data of the deleted row. */
739
- row: TableRow
740
- }
741
-
742
- /**
743
- * Event payload for row:duplicate event.
744
- * @public
745
- */
746
- export interface RowDuplicateEvent {
747
- /** The index of the original row that was duplicated. */
748
- sourceIndex: number
749
- /** The index of the newly created duplicate row. */
750
- newIndex: number
751
- /** The data of the newly created duplicate row. */
752
- row: TableRow
753
- }
754
-
755
- /**
756
- * Event payload for row:insert-above and row:insert-below events.
757
- * @public
758
- */
759
- export interface RowInsertEvent {
760
- /** The index of the reference row relative to which the new row was inserted. */
761
- targetIndex: number
762
- /** The index at which the new row was inserted. */
763
- newIndex: number
764
- /** The data of the newly inserted row. */
765
- row: TableRow
766
- }
767
-
768
- /**
769
- * Event payload for row:move event.
770
- * @public
771
- */
772
- export interface RowMoveEvent {
773
- /** The index the row was moved from. */
774
- fromIndex: number
775
- /** The index the row was moved to. */
776
- toIndex: number
777
- }
778
-
779
- /**
780
- * Event payload for row:click and row:open events.
781
- * @public
782
- */
783
- export interface RowClickEvent {
784
- /** The data of the clicked row. */
785
- row: TableRow
786
- /** The index of the clicked row. */
787
- rowIndex: number
788
- /**
789
- * The originating DOM MouseEvent. Present for all real user interactions.
790
- * Inspect `event.ctrlKey` / `event.metaKey` for new-tab navigation,
791
- * `event.button === 1` for middle-click, etc.
792
- */
793
- event?: MouseEvent
794
- }