@stonecrop/stonecrop 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/dist/stonecrop.d.ts +153 -3
  2. package/package.json +3 -3
@@ -322,6 +322,11 @@ type?: string | undefined;
322
322
  width?: string | undefined;
323
323
  pinned?: boolean | undefined;
324
324
  resizable?: boolean | undefined;
325
+ sortable?: boolean | undefined;
326
+ filterable?: boolean | undefined;
327
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
328
+ filterOptions?: any[] | undefined;
329
+ filterComponent?: string | undefined;
325
330
  cellComponent?: string | undefined;
326
331
  cellComponentProps?: Record<string, any> | undefined;
327
332
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -341,6 +346,11 @@ type?: string | undefined;
341
346
  width?: string | undefined;
342
347
  pinned?: boolean | undefined;
343
348
  resizable?: boolean | undefined;
349
+ sortable?: boolean | undefined;
350
+ filterable?: boolean | undefined;
351
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
352
+ filterOptions?: any[] | undefined;
353
+ filterComponent?: string | undefined;
344
354
  cellComponent?: string | undefined;
345
355
  cellComponentProps?: Record<string, any> | undefined;
346
356
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -440,6 +450,7 @@ width?: number | undefined;
440
450
  label?: string | undefined;
441
451
  }[]>;
442
452
  display: WritableComputedRef<TableDisplay[], TableDisplay[]>;
453
+ filterState: Ref<FilterStateRecord, FilterStateRecord>;
443
454
  ganttBars: Ref< {
444
455
  id: string;
445
456
  rowIndex: number;
@@ -511,14 +522,36 @@ endIndex?: number | undefined;
511
522
  colspan?: number | undefined;
512
523
  } | undefined;
513
524
  }[]>;
525
+ sortState: Ref< {
526
+ column: number | null;
527
+ direction: "asc" | "desc" | null;
528
+ }, {
529
+ column: number | null;
530
+ direction: "asc" | "desc" | null;
531
+ } | {
532
+ column: number | null;
533
+ direction: "asc" | "desc" | null;
534
+ }>;
514
535
  table: ComputedRef< {}>;
515
536
  updates: Ref<Record<string, string>, Record<string, string>>;
537
+ filteredRows: ComputedRef< {
538
+ originalIndex: number;
539
+ indent?: number | undefined;
540
+ parent?: number | undefined;
541
+ gantt?: {
542
+ color?: string | undefined;
543
+ startIndex?: number | undefined;
544
+ endIndex?: number | undefined;
545
+ colspan?: number | undefined;
546
+ } | undefined;
547
+ }[]>;
516
548
  hasPinnedColumns: ComputedRef<boolean>;
517
549
  isGanttView: ComputedRef<boolean>;
518
550
  isTreeView: ComputedRef<boolean>;
519
551
  isDependencyGraphEnabled: ComputedRef<boolean>;
520
552
  numberedRowWidth: ComputedRef<string>;
521
553
  zeroColumn: ComputedRef<boolean>;
554
+ clearFilter: (colIndex: number) => void;
522
555
  closeModal: (event: MouseEvent) => void;
523
556
  createConnection: (fromHandleId: string, toHandleId: string, options?: {
524
557
  style?: ConnectionPath["style"];
@@ -566,12 +599,14 @@ registerGanttBar: (barInfo: GanttBarInfo) => void;
566
599
  resizeColumn: (colIndex: number, newWidth: number) => void;
567
600
  setCellData: (colIndex: number, rowIndex: number, value: any) => void;
568
601
  setCellText: (colIndex: number, rowIndex: number, value: string) => void;
602
+ setFilter: (colIndex: number, filter: FilterState) => void;
603
+ sortByColumn: (colIndex: number) => void;
569
604
  toggleRowExpand: (rowIndex: number) => void;
570
605
  unregisterConnectionHandle: (handleId: string) => void;
571
606
  unregisterGanttBar: (barId: string) => void;
572
607
  updateGanttBar: (event: GanttDragEvent) => void;
573
608
  updateRows: (newRows: TableRow[]) => void;
574
- }, "columns" | "config" | "connectionHandles" | "connectionPaths" | "ganttBars" | "modal" | "rows" | "updates">, Pick<{
609
+ }, "columns" | "config" | "connectionHandles" | "connectionPaths" | "filterState" | "ganttBars" | "modal" | "rows" | "sortState" | "updates">, Pick<{
575
610
  columns: Ref< {
576
611
  name: string;
577
612
  align?: CanvasTextAlign | undefined;
@@ -581,6 +616,11 @@ type?: string | undefined;
581
616
  width?: string | undefined;
582
617
  pinned?: boolean | undefined;
583
618
  resizable?: boolean | undefined;
619
+ sortable?: boolean | undefined;
620
+ filterable?: boolean | undefined;
621
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
622
+ filterOptions?: any[] | undefined;
623
+ filterComponent?: string | undefined;
584
624
  cellComponent?: string | undefined;
585
625
  cellComponentProps?: Record<string, any> | undefined;
586
626
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -600,6 +640,11 @@ type?: string | undefined;
600
640
  width?: string | undefined;
601
641
  pinned?: boolean | undefined;
602
642
  resizable?: boolean | undefined;
643
+ sortable?: boolean | undefined;
644
+ filterable?: boolean | undefined;
645
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
646
+ filterOptions?: any[] | undefined;
647
+ filterComponent?: string | undefined;
603
648
  cellComponent?: string | undefined;
604
649
  cellComponentProps?: Record<string, any> | undefined;
605
650
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -699,6 +744,7 @@ width?: number | undefined;
699
744
  label?: string | undefined;
700
745
  }[]>;
701
746
  display: WritableComputedRef<TableDisplay[], TableDisplay[]>;
747
+ filterState: Ref<FilterStateRecord, FilterStateRecord>;
702
748
  ganttBars: Ref< {
703
749
  id: string;
704
750
  rowIndex: number;
@@ -770,14 +816,36 @@ endIndex?: number | undefined;
770
816
  colspan?: number | undefined;
771
817
  } | undefined;
772
818
  }[]>;
819
+ sortState: Ref< {
820
+ column: number | null;
821
+ direction: "asc" | "desc" | null;
822
+ }, {
823
+ column: number | null;
824
+ direction: "asc" | "desc" | null;
825
+ } | {
826
+ column: number | null;
827
+ direction: "asc" | "desc" | null;
828
+ }>;
773
829
  table: ComputedRef< {}>;
774
830
  updates: Ref<Record<string, string>, Record<string, string>>;
831
+ filteredRows: ComputedRef< {
832
+ originalIndex: number;
833
+ indent?: number | undefined;
834
+ parent?: number | undefined;
835
+ gantt?: {
836
+ color?: string | undefined;
837
+ startIndex?: number | undefined;
838
+ endIndex?: number | undefined;
839
+ colspan?: number | undefined;
840
+ } | undefined;
841
+ }[]>;
775
842
  hasPinnedColumns: ComputedRef<boolean>;
776
843
  isGanttView: ComputedRef<boolean>;
777
844
  isTreeView: ComputedRef<boolean>;
778
845
  isDependencyGraphEnabled: ComputedRef<boolean>;
779
846
  numberedRowWidth: ComputedRef<string>;
780
847
  zeroColumn: ComputedRef<boolean>;
848
+ clearFilter: (colIndex: number) => void;
781
849
  closeModal: (event: MouseEvent) => void;
782
850
  createConnection: (fromHandleId: string, toHandleId: string, options?: {
783
851
  style?: ConnectionPath["style"];
@@ -825,12 +893,14 @@ registerGanttBar: (barInfo: GanttBarInfo) => void;
825
893
  resizeColumn: (colIndex: number, newWidth: number) => void;
826
894
  setCellData: (colIndex: number, rowIndex: number, value: any) => void;
827
895
  setCellText: (colIndex: number, rowIndex: number, value: string) => void;
896
+ setFilter: (colIndex: number, filter: FilterState) => void;
897
+ sortByColumn: (colIndex: number) => void;
828
898
  toggleRowExpand: (rowIndex: number) => void;
829
899
  unregisterConnectionHandle: (handleId: string) => void;
830
900
  unregisterGanttBar: (barId: string) => void;
831
901
  updateGanttBar: (event: GanttDragEvent) => void;
832
902
  updateRows: (newRows: TableRow[]) => void;
833
- }, "display" | "table" | "hasPinnedColumns" | "isGanttView" | "isTreeView" | "isDependencyGraphEnabled" | "numberedRowWidth" | "zeroColumn">, Pick<{
903
+ }, "display" | "table" | "filteredRows" | "hasPinnedColumns" | "isGanttView" | "isTreeView" | "isDependencyGraphEnabled" | "numberedRowWidth" | "zeroColumn">, Pick<{
834
904
  columns: Ref< {
835
905
  name: string;
836
906
  align?: CanvasTextAlign | undefined;
@@ -840,6 +910,11 @@ type?: string | undefined;
840
910
  width?: string | undefined;
841
911
  pinned?: boolean | undefined;
842
912
  resizable?: boolean | undefined;
913
+ sortable?: boolean | undefined;
914
+ filterable?: boolean | undefined;
915
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
916
+ filterOptions?: any[] | undefined;
917
+ filterComponent?: string | undefined;
843
918
  cellComponent?: string | undefined;
844
919
  cellComponentProps?: Record<string, any> | undefined;
845
920
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -859,6 +934,11 @@ type?: string | undefined;
859
934
  width?: string | undefined;
860
935
  pinned?: boolean | undefined;
861
936
  resizable?: boolean | undefined;
937
+ sortable?: boolean | undefined;
938
+ filterable?: boolean | undefined;
939
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
940
+ filterOptions?: any[] | undefined;
941
+ filterComponent?: string | undefined;
862
942
  cellComponent?: string | undefined;
863
943
  cellComponentProps?: Record<string, any> | undefined;
864
944
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -958,6 +1038,7 @@ width?: number | undefined;
958
1038
  label?: string | undefined;
959
1039
  }[]>;
960
1040
  display: WritableComputedRef<TableDisplay[], TableDisplay[]>;
1041
+ filterState: Ref<FilterStateRecord, FilterStateRecord>;
961
1042
  ganttBars: Ref< {
962
1043
  id: string;
963
1044
  rowIndex: number;
@@ -1029,14 +1110,36 @@ endIndex?: number | undefined;
1029
1110
  colspan?: number | undefined;
1030
1111
  } | undefined;
1031
1112
  }[]>;
1113
+ sortState: Ref< {
1114
+ column: number | null;
1115
+ direction: "asc" | "desc" | null;
1116
+ }, {
1117
+ column: number | null;
1118
+ direction: "asc" | "desc" | null;
1119
+ } | {
1120
+ column: number | null;
1121
+ direction: "asc" | "desc" | null;
1122
+ }>;
1032
1123
  table: ComputedRef< {}>;
1033
1124
  updates: Ref<Record<string, string>, Record<string, string>>;
1125
+ filteredRows: ComputedRef< {
1126
+ originalIndex: number;
1127
+ indent?: number | undefined;
1128
+ parent?: number | undefined;
1129
+ gantt?: {
1130
+ color?: string | undefined;
1131
+ startIndex?: number | undefined;
1132
+ endIndex?: number | undefined;
1133
+ colspan?: number | undefined;
1134
+ } | undefined;
1135
+ }[]>;
1034
1136
  hasPinnedColumns: ComputedRef<boolean>;
1035
1137
  isGanttView: ComputedRef<boolean>;
1036
1138
  isTreeView: ComputedRef<boolean>;
1037
1139
  isDependencyGraphEnabled: ComputedRef<boolean>;
1038
1140
  numberedRowWidth: ComputedRef<string>;
1039
1141
  zeroColumn: ComputedRef<boolean>;
1142
+ clearFilter: (colIndex: number) => void;
1040
1143
  closeModal: (event: MouseEvent) => void;
1041
1144
  createConnection: (fromHandleId: string, toHandleId: string, options?: {
1042
1145
  style?: ConnectionPath["style"];
@@ -1084,12 +1187,14 @@ registerGanttBar: (barInfo: GanttBarInfo) => void;
1084
1187
  resizeColumn: (colIndex: number, newWidth: number) => void;
1085
1188
  setCellData: (colIndex: number, rowIndex: number, value: any) => void;
1086
1189
  setCellText: (colIndex: number, rowIndex: number, value: string) => void;
1190
+ setFilter: (colIndex: number, filter: FilterState) => void;
1191
+ sortByColumn: (colIndex: number) => void;
1087
1192
  toggleRowExpand: (rowIndex: number) => void;
1088
1193
  unregisterConnectionHandle: (handleId: string) => void;
1089
1194
  unregisterGanttBar: (barId: string) => void;
1090
1195
  updateGanttBar: (event: GanttDragEvent) => void;
1091
1196
  updateRows: (newRows: TableRow[]) => void;
1092
- }, "closeModal" | "createConnection" | "deleteConnection" | "getCellData" | "getCellDisplayValue" | "getConnectionsForBar" | "getFormattedValue" | "getHandlesForBar" | "getHeaderCellStyle" | "getIndent" | "getRowExpandSymbol" | "isRowGantt" | "isRowVisible" | "registerConnectionHandle" | "registerGanttBar" | "resizeColumn" | "setCellData" | "setCellText" | "toggleRowExpand" | "unregisterConnectionHandle" | "unregisterGanttBar" | "updateGanttBar" | "updateRows">>;
1197
+ }, "clearFilter" | "closeModal" | "createConnection" | "deleteConnection" | "getCellData" | "getCellDisplayValue" | "getConnectionsForBar" | "getFormattedValue" | "getHandlesForBar" | "getHeaderCellStyle" | "getIndent" | "getRowExpandSymbol" | "isRowGantt" | "isRowVisible" | "registerConnectionHandle" | "registerGanttBar" | "resizeColumn" | "setCellData" | "setCellText" | "setFilter" | "sortByColumn" | "toggleRowExpand" | "unregisterConnectionHandle" | "unregisterGanttBar" | "updateGanttBar" | "updateRows">>;
1093
1198
 
1094
1199
  /**
1095
1200
  * Cross-tab message payload
@@ -1429,6 +1534,25 @@ export declare interface FieldTriggerOptions {
1429
1534
  enableRollback?: boolean;
1430
1535
  }
1431
1536
 
1537
+ /**
1538
+ * Represents the state of a single filter
1539
+ * @public
1540
+ */
1541
+ declare interface FilterState {
1542
+ /** The main filter value */
1543
+ value: any;
1544
+ /** Start value for date range filters */
1545
+ startValue?: any;
1546
+ /** End value for date range filters */
1547
+ endValue?: any;
1548
+ }
1549
+
1550
+ /**
1551
+ * Record mapping column indices to their filter states
1552
+ * @public
1553
+ */
1554
+ declare type FilterStateRecord = Record<number, FilterState>;
1555
+
1432
1556
  /**
1433
1557
  * Schema structure for defining forms inside AForm
1434
1558
  * @public
@@ -2484,6 +2608,32 @@ export declare interface TableColumn {
2484
2608
  * @defaultValue false
2485
2609
  */
2486
2610
  resizable?: boolean;
2611
+ /**
2612
+ * Control whether the column should be sortable.
2613
+ *
2614
+ * @defaultValue true
2615
+ */
2616
+ sortable?: boolean;
2617
+ /**
2618
+ * Control whether the column should be filterable and define filter configuration.
2619
+ *
2620
+ * @defaultValue true
2621
+ */
2622
+ filterable?: boolean;
2623
+ /**
2624
+ * The type of filter for the column.
2625
+ *
2626
+ * @defaultValue 'text'
2627
+ */
2628
+ filterType?: 'text' | 'select' | 'number' | 'date' | 'dateRange' | 'checkbox' | 'component';
2629
+ /**
2630
+ * Options for select-type filters.
2631
+ */
2632
+ filterOptions?: any[];
2633
+ /**
2634
+ * Custom component for filtering.
2635
+ */
2636
+ filterComponent?: string;
2487
2637
  /**
2488
2638
  * The component to use to render the cell for the column. If not provided, the table will
2489
2639
  * render the default `<td>` element.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/stonecrop",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "schema helper",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -60,8 +60,8 @@
60
60
  "typescript-eslint": "^8.46.2",
61
61
  "vite": "^7.1.1",
62
62
  "vitest": "^4.0.5",
63
- "@stonecrop/aform": "0.6.0",
64
- "@stonecrop/atable": "0.6.0",
63
+ "@stonecrop/aform": "0.6.2",
64
+ "@stonecrop/atable": "0.6.2",
65
65
  "stonecrop-rig": "0.2.22"
66
66
  },
67
67
  "publishConfig": {