@stonecrop/atable 0.4.23 → 0.4.24

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.
@@ -1,4 +1,5 @@
1
1
  import { useElementBounding } from '@vueuse/core';
2
+ import type { Ref, ShallowRef } from 'vue';
2
3
  import { createTableStore } from '../stores/table';
3
4
  /**
4
5
  * Table column definition.
@@ -115,8 +116,8 @@ export interface TableColumn {
115
116
  */
116
117
  ganttComponent?: string;
117
118
  /**
118
- * The colspan of the Gantt-bar for the column. This is used to determine how many columns
119
- * the Gantt-bar should span.
119
+ * The colspan of the Gantt bar for the column. This determines how many columns
120
+ * the Gantt bar should span across.
120
121
  *
121
122
  * Only applicable for Gantt tables.
122
123
  *
@@ -124,8 +125,8 @@ export interface TableColumn {
124
125
  */
125
126
  colspan?: number;
126
127
  /**
127
- * The starting column index for the Gantt-bar, excluding any pinned columns. This is
128
- * evaluated automatically while rendering the table.
128
+ * The original column index for the Gantt bar, excluding any pinned columns.
129
+ * This is evaluated automatically while rendering the table.
129
130
  *
130
131
  * Only applicable for Gantt tables.
131
132
  *
@@ -164,8 +165,10 @@ export interface TableConfig {
164
165
  * - `list` - row numbers are displayed in the table
165
166
  * - `list-expansion` - carets are displayed in the number column that expand/collapse the row inline
166
167
  * - `tree` - carets are displayed in the number column that expand/collapse grouped rows
168
+ * - `gantt` - view that allows specific rows to be displayed with Gantt functionality
169
+ * - `tree-gantt` - similar to `gantt`, but allows for tree functionality as well
167
170
  */
168
- view?: 'uncounted' | 'list' | 'list-expansion' | 'tree' | 'gantt';
171
+ view?: 'uncounted' | 'list' | 'list-expansion' | 'tree' | 'gantt' | 'tree-gantt';
169
172
  /**
170
173
  * Control whether the table should be allowed to use the full width of its container.
171
174
  *
@@ -268,26 +271,30 @@ export interface TableRow {
268
271
  gantt?: GanttOptions;
269
272
  }
270
273
  /**
271
- * This interface defines the options for a row when it is being viewed as a Gantt chart.
274
+ * Gantt chart options for table rows.
272
275
  * @public
273
276
  */
274
277
  export interface GanttOptions {
275
278
  /**
276
- * The colour to be applied to the row's gantt bar.
279
+ * The color to be applied to the row's gantt bar.
280
+ *
281
+ * @defaultValue '#cccccc'
277
282
  */
278
283
  color?: string;
279
284
  /**
280
285
  * The starting column index for the gantt bar.
286
+ *
287
+ * @defaultValue 0
281
288
  */
282
289
  startIndex?: number;
283
290
  /**
284
- * The ending column index for the gantt bar. If the endIndex and colspan are not provided,
291
+ * The ending column index for the gantt bar. If endIndex and colspan are not provided,
285
292
  * the bar will stretch to the end of the table.
286
293
  */
287
294
  endIndex?: number;
288
295
  /**
289
- * The length of the gantt bar. Useful when only the start index is provided. If the
290
- * colspan and endIndex are not provided, the bar will stretch to the end of the table.
296
+ * The length of the gantt bar in columns. Useful when only the start index is provided.
297
+ * If colspan and endIndex are not provided, the bar will stretch to the end of the table.
291
298
  */
292
299
  colspan?: number;
293
300
  }
@@ -409,4 +416,125 @@ export interface TableModalProps {
409
416
  */
410
417
  store: ReturnType<typeof createTableStore>;
411
418
  }
419
+ /**
420
+ * Gantt bar information for VueFlow integration.
421
+ * @public
422
+ */
423
+ export interface GanttBarInfo {
424
+ /**
425
+ * Unique identifier for the gantt bar.
426
+ */
427
+ id: string;
428
+ /**
429
+ * The row index of the gantt bar.
430
+ */
431
+ rowIndex: number;
432
+ /**
433
+ * The primary column index of the gantt bar (typically the start index).
434
+ */
435
+ colIndex: number;
436
+ /**
437
+ * Starting column index of the gantt bar.
438
+ */
439
+ startIndex: Ref<number>;
440
+ /**
441
+ * Ending column index of the gantt bar.
442
+ */
443
+ endIndex: Ref<number>;
444
+ /**
445
+ * Color of the gantt bar.
446
+ */
447
+ color: Ref<string>;
448
+ /**
449
+ * The position of the gantt bar in the ATable component.
450
+ */
451
+ position: {
452
+ x: ShallowRef<number>;
453
+ y: ShallowRef<number>;
454
+ };
455
+ /**
456
+ * Display label for the gantt bar.
457
+ */
458
+ label?: string;
459
+ }
460
+ /**
461
+ * Connection handle information for gantt bar connections.
462
+ * @public
463
+ */
464
+ export interface ConnectionHandle {
465
+ /**
466
+ * Unique identifier for the connection handle.
467
+ */
468
+ id: string;
469
+ /**
470
+ * The row index of the gantt bar this handle belongs to.
471
+ */
472
+ rowIndex: number;
473
+ /**
474
+ * The column index of the gantt bar this handle belongs to.
475
+ */
476
+ colIndex: number;
477
+ /**
478
+ * The side of the gantt bar where this handle is located.
479
+ */
480
+ side: 'left' | 'right';
481
+ /**
482
+ * The position of the connection handle.
483
+ */
484
+ position: {
485
+ x: ShallowRef<number>;
486
+ y: ShallowRef<number>;
487
+ };
488
+ /**
489
+ * Whether the handle is currently visible (on hover).
490
+ */
491
+ visible: Ref<boolean>;
492
+ /**
493
+ * Reference to the gantt bar this handle belongs to.
494
+ */
495
+ barId: string;
496
+ }
497
+ /**
498
+ * Connection path between two gantt bars.
499
+ * @public
500
+ */
501
+ export interface ConnectionPath {
502
+ /**
503
+ * Unique identifier for the connection path.
504
+ */
505
+ id: string;
506
+ /**
507
+ * The source connection handle.
508
+ */
509
+ from: {
510
+ barId: string;
511
+ side: 'left' | 'right';
512
+ };
513
+ /**
514
+ * The target connection handle.
515
+ */
516
+ to: {
517
+ barId: string;
518
+ side: 'left' | 'right';
519
+ };
520
+ /**
521
+ * Optional styling for the connection path.
522
+ */
523
+ style?: {
524
+ color?: string;
525
+ width?: number;
526
+ };
527
+ /**
528
+ * Optional label for the connection.
529
+ */
530
+ label?: string;
531
+ }
532
+ /**
533
+ * Connection event for handling connection creation/deletion.
534
+ * @public
535
+ */
536
+ export type ConnectionEvent = {
537
+ type: 'create' | 'delete';
538
+ connection: ConnectionPath;
539
+ };
412
540
  //# 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,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD;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,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAEtB;;OAEG;IACH,QAAQ,EAAE;QACT,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;QACrB,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;KACrB,CAAA;IAED;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,IAAI,EAAE;QACL,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KACtB,CAAA;IAED;;OAEG;IACH,EAAE,EAAE;QACH,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KACtB,CAAA;IAED;;OAEG;IACH,KAAK,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IAED;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACzB,UAAU,EAAE,cAAc,CAAA;CAC1B,CAAA"}
@@ -34,11 +34,14 @@ export const createTableStore = (initData) => {
34
34
  }
35
35
  // TODO: (typing) is this type correct for the parent set?
36
36
  const parents = new Set();
37
- for (let rowIndex = rows.value.length - 1; rowIndex >= 0; rowIndex--) {
37
+ for (let rowIndex = 0; rowIndex < rows.value.length; rowIndex++) {
38
38
  const row = rows.value[rowIndex];
39
- if (row.parent) {
39
+ if (row.parent !== null && row.parent !== undefined) {
40
40
  parents.add(row.parent);
41
41
  }
42
+ }
43
+ for (let rowIndex = 0; rowIndex < rows.value.length; rowIndex++) {
44
+ const row = rows.value[rowIndex];
42
45
  defaultDisplay[rowIndex] = {
43
46
  childrenOpen: false,
44
47
  expanded: false,
@@ -60,13 +63,18 @@ export const createTableStore = (initData) => {
60
63
  const display = ref(createDisplayObject(initData.display));
61
64
  const modal = ref(initData.modal || { visible: false });
62
65
  const updates = ref({});
66
+ const ganttBars = ref([]);
67
+ const connectionHandles = ref([]);
68
+ const connectionPaths = ref([]);
63
69
  // getters
64
70
  const hasPinnedColumns = computed(() => columns.value.some(col => col.pinned));
71
+ const isGanttView = computed(() => config.value.view === 'gantt' || config.value.view === 'tree-gantt');
72
+ const isTreeView = computed(() => config.value.view === 'tree' || config.value.view === 'tree-gantt');
65
73
  const numberedRowWidth = computed(() => {
66
74
  const indent = Math.ceil(rows.value.length / 100 + 1);
67
75
  return `${indent}ch`;
68
76
  });
69
- const zeroColumn = computed(() => config.value.view ? ['list', 'tree', 'list-expansion'].includes(config.value.view) : false);
77
+ const zeroColumn = computed(() => config.value.view ? ['list', 'tree', 'tree-gantt', 'list-expansion'].includes(config.value.view) : false);
70
78
  // actions
71
79
  const getCellData = (colIndex, rowIndex) => table.value[`${colIndex}:${rowIndex}`];
72
80
  const setCellData = (colIndex, rowIndex, value) => {
@@ -116,27 +124,33 @@ export const createTableStore = (initData) => {
116
124
  };
117
125
  const isRowGantt = (rowIndex) => {
118
126
  const row = rows.value[rowIndex];
119
- return config.value.view === 'gantt' && row.indent === 0;
127
+ return isGanttView.value && row.gantt !== undefined;
120
128
  };
121
129
  const isRowVisible = (rowIndex) => {
122
- return config.value.view !== 'tree' || display.value[rowIndex].isRoot || display.value[rowIndex].open;
130
+ return !isTreeView.value || display.value[rowIndex].isRoot || display.value[rowIndex].open;
123
131
  };
124
132
  const getRowExpandSymbol = (rowIndex) => {
125
- if (config.value.view !== 'tree') {
133
+ if (!isTreeView.value && config.value.view !== 'list-expansion') {
126
134
  return '';
127
135
  }
128
- if (display.value[rowIndex].isRoot || display.value[rowIndex].isParent) {
129
- return display.value[rowIndex].childrenOpen ? '-' : '+';
136
+ if (isTreeView.value && (display.value[rowIndex].isRoot || display.value[rowIndex].isParent)) {
137
+ return display.value[rowIndex].childrenOpen ? '' : '';
138
+ }
139
+ if (config.value.view === 'list-expansion') {
140
+ return display.value[rowIndex].expanded ? '▼' : '►';
130
141
  }
131
142
  return '';
132
143
  };
133
144
  const toggleRowExpand = (rowIndex) => {
134
- if (config.value.view === 'tree') {
145
+ if (isTreeView.value) {
135
146
  display.value[rowIndex].childrenOpen = !display.value[rowIndex].childrenOpen;
136
- for (let index = rows.value.length - 1; index >= 0; index--) {
147
+ const isOpen = display.value[rowIndex].childrenOpen;
148
+ for (let index = 0; index < rows.value.length; index++) {
137
149
  if (display.value[index].parent === rowIndex) {
138
- display.value[index].open = !display.value[index].open;
139
- if (display.value[index].childrenOpen) {
150
+ display.value[index].open = isOpen;
151
+ if (!isOpen) {
152
+ // If we're closing, also close any children recursively
153
+ display.value[index].childrenOpen = false;
140
154
  toggleRowExpand(index);
141
155
  }
142
156
  }
@@ -211,33 +225,117 @@ export const createTableStore = (initData) => {
211
225
  }
212
226
  }
213
227
  };
228
+ const registerGanttBar = (barInfo) => {
229
+ const existingIndex = ganttBars.value.findIndex(bar => bar.id === barInfo.id);
230
+ if (existingIndex >= 0) {
231
+ // @ts-expect-error TODO: for some reason, the IDE is expecting an unref'd value
232
+ ganttBars.value[existingIndex] = barInfo;
233
+ }
234
+ else {
235
+ // @ts-expect-error TODO: for some reason, the IDE is expecting an unref'd value
236
+ ganttBars.value.push(barInfo);
237
+ }
238
+ };
239
+ const unregisterGanttBar = (barId) => {
240
+ const index = ganttBars.value.findIndex(bar => bar.id === barId);
241
+ if (index >= 0) {
242
+ ganttBars.value.splice(index, 1);
243
+ }
244
+ };
245
+ const registerConnectionHandle = (handleInfo) => {
246
+ const existingIndex = connectionHandles.value.findIndex(handle => handle.id === handleInfo.id);
247
+ if (existingIndex >= 0) {
248
+ // @ts-expect-error TODO: for some reason, the IDE is expecting an unref'd value
249
+ connectionHandles.value[existingIndex] = handleInfo;
250
+ }
251
+ else {
252
+ // @ts-expect-error TODO: for some reason, the IDE is expecting an unref'd value
253
+ connectionHandles.value.push(handleInfo);
254
+ }
255
+ };
256
+ const unregisterConnectionHandle = (handleId) => {
257
+ const index = connectionHandles.value.findIndex(handle => handle.id === handleId);
258
+ if (index >= 0) {
259
+ connectionHandles.value.splice(index, 1);
260
+ }
261
+ };
262
+ const createConnection = (fromHandleId, toHandleId, options) => {
263
+ const fromHandle = connectionHandles.value.find(h => h.id === fromHandleId);
264
+ const toHandle = connectionHandles.value.find(h => h.id === toHandleId);
265
+ if (!fromHandle || !toHandle) {
266
+ console.warn('Cannot create connection: handle not found');
267
+ return null;
268
+ }
269
+ const connection = {
270
+ id: `connection-${fromHandleId}-${toHandleId}`,
271
+ from: {
272
+ barId: fromHandle.barId,
273
+ side: fromHandle.side,
274
+ },
275
+ to: {
276
+ barId: toHandle.barId,
277
+ side: toHandle.side,
278
+ },
279
+ style: options?.style,
280
+ label: options?.label,
281
+ };
282
+ connectionPaths.value.push(connection);
283
+ return connection;
284
+ };
285
+ const deleteConnection = (connectionId) => {
286
+ const index = connectionPaths.value.findIndex(conn => conn.id === connectionId);
287
+ if (index >= 0) {
288
+ connectionPaths.value.splice(index, 1);
289
+ return true;
290
+ }
291
+ return false;
292
+ };
293
+ const getConnectionsForBar = (barId) => {
294
+ return connectionPaths.value.filter(conn => conn.from.barId === barId || conn.to.barId === barId);
295
+ };
296
+ const getHandlesForBar = (barId) => {
297
+ return connectionHandles.value.filter(handle => handle.barId === barId);
298
+ };
214
299
  return {
215
300
  // state
216
301
  columns,
217
302
  config,
303
+ connectionHandles,
304
+ connectionPaths,
218
305
  display,
306
+ ganttBars,
219
307
  modal,
220
308
  rows,
221
309
  table,
222
310
  updates,
223
311
  // getters
224
312
  hasPinnedColumns,
313
+ isGanttView,
314
+ isTreeView,
225
315
  numberedRowWidth,
226
316
  zeroColumn,
227
317
  // actions
228
318
  closeModal,
319
+ createConnection,
320
+ deleteConnection,
229
321
  getCellData,
230
322
  getCellDisplayValue,
323
+ getConnectionsForBar,
231
324
  getFormattedValue,
325
+ getHandlesForBar,
232
326
  getHeaderCellStyle,
233
- resizeColumn,
234
327
  getIndent,
235
328
  getRowExpandSymbol,
236
329
  isRowGantt,
237
330
  isRowVisible,
331
+ registerConnectionHandle,
332
+ registerGanttBar,
333
+ resizeColumn,
238
334
  setCellData,
239
335
  setCellText,
240
336
  toggleRowExpand,
337
+ unregisterConnectionHandle,
338
+ unregisterGanttBar,
241
339
  updateGanttBar,
242
340
  };
243
341
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/atable",
3
- "version": "0.4.23",
3
+ "version": "0.4.24",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -38,8 +38,8 @@
38
38
  "@vueuse/core": "^13.4.0",
39
39
  "pinia": "^3.0.3",
40
40
  "vue": "^3.5.17",
41
- "@stonecrop/themes": "0.4.23",
42
- "@stonecrop/utilities": "0.4.23"
41
+ "@stonecrop/themes": "0.4.24",
42
+ "@stonecrop/utilities": "0.4.24"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@microsoft/api-documenter": "^7.26.29",