@stonecrop/stonecrop 0.4.11 → 0.4.13

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,5 +1,5 @@
1
1
  export type { BaseSchema, FieldsetSchema, FormSchema, SchemaTypes, TableSchema } from '@stonecrop/aform';
2
- export type { CellContext, TableColumn, TableConfig, TableRow } from '@stonecrop/atable';
2
+ export type { CellContext, GanttOptions, TableColumn, TableConfig, TableRow } from '@stonecrop/atable';
3
3
  import { type StonecropReturn, useStonecrop } from './composable';
4
4
  import DoctypeMeta from './doctype';
5
5
  import Registry from './registry';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACxG,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAExF,OAAO,EAAE,KAAK,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,WAAW,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEvF,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACxG,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEtG,OAAO,EAAE,KAAK,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,WAAW,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEvF,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,CAAA"}
@@ -39,13 +39,22 @@ export declare type BaseSchema = {
39
39
  * Table cell context definition.
40
40
  * @public
41
41
  */
42
- export declare type CellContext = {
42
+ export declare interface CellContext {
43
+ /**
44
+ * The row object for the current cell.
45
+ */
43
46
  row: TableRow;
47
+ /**
48
+ * The column object for the current cell.
49
+ */
44
50
  column: TableColumn;
51
+ /**
52
+ * The table object for the current cell.
53
+ */
45
54
  table: {
46
55
  [key: string]: any;
47
56
  };
48
- };
57
+ }
49
58
 
50
59
  /**
51
60
  * Doctype Meta class
@@ -166,6 +175,31 @@ export declare type FormSchema = BaseSchema & {
166
175
  mask?: string;
167
176
  };
168
177
 
178
+ /**
179
+ * This interface defines the options for a row when it is being viewed as a Gantt chart.
180
+ * @public
181
+ */
182
+ export declare interface GanttOptions {
183
+ /**
184
+ * The colour to be applied to the row's gantt bar.
185
+ */
186
+ color?: string;
187
+ /**
188
+ * The starting column index for the gantt bar.
189
+ */
190
+ startIndex?: number;
191
+ /**
192
+ * The ending column index for the gantt bar. If the endIndex and colspan are not provided,
193
+ * the bar will stretch to the end of the table.
194
+ */
195
+ endIndex?: number;
196
+ /**
197
+ * The length of the gantt bar. Useful when only the start index is provided. If the
198
+ * colspan and endIndex are not provided, the bar will stretch to the end of the table.
199
+ */
200
+ colspan?: number;
201
+ }
202
+
169
203
  /**
170
204
  * Immutable Doctype type for Stonecrop instances
171
205
  * @public
@@ -474,20 +508,67 @@ export declare type StonecropReturn = {
474
508
  * Table column definition.
475
509
  * @public
476
510
  */
477
- export declare type TableColumn = {
511
+ export declare interface TableColumn {
512
+ /**
513
+ * The key of the column. This is used to identify the column in the table.
514
+ */
478
515
  name: string;
516
+ /**
517
+ * The alignment of the column. Possible values:
518
+ * - `left` - left aligned
519
+ * - `center` - center aligned
520
+ * - `right` - right aligned
521
+ * - `start` - aligned to the start of the column
522
+ * - `end` - aligned to the end of the column
523
+ *
524
+ * @defaultValue 'center'
525
+ */
479
526
  align?: CanvasTextAlign;
527
+ /**
528
+ * Control whether cells for the column is editable.
529
+ *
530
+ * @defaultValue false
531
+ */
480
532
  edit?: boolean;
533
+ /**
534
+ * The label of the column. This is displayed in the table header.
535
+ *
536
+ * @defaultValue If no label is provided, a character will be assigned alphabetically,
537
+ * starting from 'A' for the first column, 'B' for the second column, and so on.
538
+ */
481
539
  label?: string;
540
+ /**
541
+ * The data-type of the column. Possible values:
542
+ * - `Data` - the column contains text data
543
+ * - `Select` - the column contains a select input
544
+ * - `Date` - the column contains a date input
545
+ * - `component` - the column contains a custom component
546
+ *
547
+ * @beta
548
+ */
482
549
  type?: string;
550
+ /**
551
+ * The width of the column. This can be a number (in pixels) or a string (in CSS units).
552
+ *
553
+ * @defaultValue '40ch'
554
+ */
483
555
  width?: string;
556
+ /**
557
+ * Control whether the column should be pinned to the table.
558
+ *
559
+ * @defaultValue false
560
+ */
484
561
  pinned?: boolean;
485
- color?: string;
486
- colspan?: number;
487
- ganttComponent?: string;
488
- isGantt?: boolean;
489
- originalIndex?: number;
562
+ /**
563
+ * The component to use to render the cell for the column. If not provided, the table will
564
+ * render the default `<td>` element.
565
+ */
490
566
  cellComponent?: string;
567
+ /**
568
+ * Additional properties to pass to the table's cell component.
569
+ *
570
+ * Only applicable if the `cellComponent` property is set for the column.
571
+ */
491
572
  cellComponentProps?: Record<string, any>;
492
573
  /**
493
574
  * The component to use for the modal. If a function is provided, it will be called with the cell context.
@@ -504,16 +585,63 @@ export declare type TableColumn = {
504
585
  * - `store` - the table data store
505
586
  */
506
587
  modalComponent?: string | ((context: CellContext) => string);
588
+ /**
589
+ * Additional properties to pass to the modal component.
590
+ *
591
+ * Only applicable if the `modalComponent` property is set for the column.
592
+ */
507
593
  modalComponentExtraProps?: Record<string, any>;
594
+ /**
595
+ * The format function to use to format the value of the cell. This can either be a normal or stringified
596
+ * function that takes the value and the cell context and returns a string.
597
+ */
508
598
  format?: string | ((value: any, context: CellContext) => string);
599
+ /**
600
+ * The masking function to use to apply an input mask to the cell. This will accept an input value and
601
+ * return the masked value.
602
+ */
509
603
  mask?: (value: any) => any;
510
- };
604
+ /**
605
+ * Whether the column is a Gantt column.
606
+ *
607
+ * Only applicable for Gantt tables.
608
+ *
609
+ * @defaultValue false
610
+ */
611
+ isGantt?: boolean;
612
+ /**
613
+ * The component to use to render the Gantt bar for the column.
614
+ *
615
+ * Only applicable for Gantt tables.
616
+ *
617
+ * @defaultValue 'AGanttCell'
618
+ */
619
+ ganttComponent?: string;
620
+ /**
621
+ * The colspan of the Gantt-bar for the column. This is used to determine how many columns
622
+ * the Gantt-bar should span.
623
+ *
624
+ * Only applicable for Gantt tables.
625
+ *
626
+ * @defaultValue The number of columns in the table, excluding any pinned columns.
627
+ */
628
+ colspan?: number;
629
+ /**
630
+ * The starting column index for the Gantt-bar, excluding any pinned columns. This is
631
+ * evaluated automatically while rendering the table.
632
+ *
633
+ * Only applicable for Gantt tables.
634
+ *
635
+ * @defaultValue 0
636
+ */
637
+ originalIndex?: number;
638
+ }
511
639
 
512
640
  /**
513
641
  * Table configuration definition.
514
642
  * @public
515
643
  */
516
- export declare type TableConfig = {
644
+ export declare interface TableConfig {
517
645
  /**
518
646
  * The type of view to display the table in. Possible values:
519
647
  * - `uncounted` - row numbers are not displayed in the table
@@ -522,18 +650,43 @@ export declare type TableConfig = {
522
650
  * - `tree` - carets are displayed in the number column that expand/collapse grouped rows
523
651
  */
524
652
  view?: 'uncounted' | 'list' | 'list-expansion' | 'tree' | 'gantt';
653
+ /**
654
+ * Control whether the table should be allowed to use the full width of its container.
655
+ *
656
+ * @defaultValue false
657
+ */
525
658
  fullWidth?: boolean;
526
- };
659
+ }
527
660
 
528
661
  /**
529
662
  * Table row definition.
530
663
  * @public
531
664
  */
532
- export declare type TableRow = {
665
+ export declare interface TableRow {
666
+ /**
667
+ * Additional arbitrary properties that can be passed to the row object.
668
+ */
533
669
  [key: string]: any;
670
+ /**
671
+ * The indentation level of the row node.
672
+ *
673
+ * Only applicable for tree and gantt views.
674
+ *
675
+ * @defaultValue 0
676
+ */
534
677
  indent?: number;
678
+ /**
679
+ * The HTML parent element for the row node. This is evaluated automatically while rendering
680
+ * the table.
681
+ *
682
+ * Only applicable for tree and gantt views.
683
+ */
535
684
  parent?: number;
536
- };
685
+ /**
686
+ * The options to use when rendering the row as a Gantt table.
687
+ */
688
+ gantt?: GanttOptions;
689
+ }
537
690
 
538
691
  /**
539
692
  * Schema structure for defining tables inside AForm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/stonecrop",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "schema helper",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,9 +52,9 @@
52
52
  "eslint-plugin-vue": "^9.11.1",
53
53
  "typescript": "~5.6.3",
54
54
  "vite": "^6.1.1",
55
- "@stonecrop/atable": "0.4.11",
55
+ "@stonecrop/atable": "0.4.13",
56
56
  "stonecrop-rig": "0.2.22",
57
- "@stonecrop/aform": "0.4.11"
57
+ "@stonecrop/aform": "0.4.13"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { BaseSchema, FieldsetSchema, FormSchema, SchemaTypes, TableSchema } from '@stonecrop/aform'
2
- export type { CellContext, TableColumn, TableConfig, TableRow } from '@stonecrop/atable'
2
+ export type { CellContext, GanttOptions, TableColumn, TableConfig, TableRow } from '@stonecrop/atable'
3
3
 
4
4
  import { type StonecropReturn, useStonecrop } from './composable'
5
5
  import DoctypeMeta from './doctype'