@stonecrop/aform 0.6.0 → 0.6.1

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/aform.d.ts +153 -3
  2. package/package.json +5 -5
package/dist/aform.d.ts CHANGED
@@ -264,6 +264,11 @@ type?: string | undefined;
264
264
  width?: string | undefined;
265
265
  pinned?: boolean | undefined;
266
266
  resizable?: boolean | undefined;
267
+ sortable?: boolean | undefined;
268
+ filterable?: boolean | undefined;
269
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
270
+ filterOptions?: any[] | undefined;
271
+ filterComponent?: string | undefined;
267
272
  cellComponent?: string | undefined;
268
273
  cellComponentProps?: Record<string, any> | undefined;
269
274
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -283,6 +288,11 @@ type?: string | undefined;
283
288
  width?: string | undefined;
284
289
  pinned?: boolean | undefined;
285
290
  resizable?: boolean | undefined;
291
+ sortable?: boolean | undefined;
292
+ filterable?: boolean | undefined;
293
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
294
+ filterOptions?: any[] | undefined;
295
+ filterComponent?: string | undefined;
286
296
  cellComponent?: string | undefined;
287
297
  cellComponentProps?: Record<string, any> | undefined;
288
298
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -382,6 +392,7 @@ width?: number | undefined;
382
392
  label?: string | undefined;
383
393
  }[]>;
384
394
  display: WritableComputedRef<TableDisplay[], TableDisplay[]>;
395
+ filterState: Ref<FilterStateRecord, FilterStateRecord>;
385
396
  ganttBars: Ref< {
386
397
  id: string;
387
398
  rowIndex: number;
@@ -453,14 +464,36 @@ endIndex?: number | undefined;
453
464
  colspan?: number | undefined;
454
465
  } | undefined;
455
466
  }[]>;
467
+ sortState: Ref< {
468
+ column: number | null;
469
+ direction: "asc" | "desc" | null;
470
+ }, {
471
+ column: number | null;
472
+ direction: "asc" | "desc" | null;
473
+ } | {
474
+ column: number | null;
475
+ direction: "asc" | "desc" | null;
476
+ }>;
456
477
  table: ComputedRef< {}>;
457
478
  updates: Ref<Record<string, string>, Record<string, string>>;
479
+ filteredRows: ComputedRef< {
480
+ originalIndex: number;
481
+ indent?: number | undefined;
482
+ parent?: number | undefined;
483
+ gantt?: {
484
+ color?: string | undefined;
485
+ startIndex?: number | undefined;
486
+ endIndex?: number | undefined;
487
+ colspan?: number | undefined;
488
+ } | undefined;
489
+ }[]>;
458
490
  hasPinnedColumns: ComputedRef<boolean>;
459
491
  isGanttView: ComputedRef<boolean>;
460
492
  isTreeView: ComputedRef<boolean>;
461
493
  isDependencyGraphEnabled: ComputedRef<boolean>;
462
494
  numberedRowWidth: ComputedRef<string>;
463
495
  zeroColumn: ComputedRef<boolean>;
496
+ clearFilter: (colIndex: number) => void;
464
497
  closeModal: (event: MouseEvent) => void;
465
498
  createConnection: (fromHandleId: string, toHandleId: string, options?: {
466
499
  style?: ConnectionPath["style"];
@@ -508,12 +541,14 @@ registerGanttBar: (barInfo: GanttBarInfo) => void;
508
541
  resizeColumn: (colIndex: number, newWidth: number) => void;
509
542
  setCellData: (colIndex: number, rowIndex: number, value: any) => void;
510
543
  setCellText: (colIndex: number, rowIndex: number, value: string) => void;
544
+ setFilter: (colIndex: number, filter: FilterState) => void;
545
+ sortByColumn: (colIndex: number) => void;
511
546
  toggleRowExpand: (rowIndex: number) => void;
512
547
  unregisterConnectionHandle: (handleId: string) => void;
513
548
  unregisterGanttBar: (barId: string) => void;
514
549
  updateGanttBar: (event: GanttDragEvent) => void;
515
550
  updateRows: (newRows: TableRow[]) => void;
516
- }, "columns" | "config" | "connectionHandles" | "connectionPaths" | "ganttBars" | "modal" | "rows" | "updates">, Pick<{
551
+ }, "columns" | "config" | "connectionHandles" | "connectionPaths" | "filterState" | "ganttBars" | "modal" | "rows" | "sortState" | "updates">, Pick<{
517
552
  columns: Ref< {
518
553
  name: string;
519
554
  align?: CanvasTextAlign | undefined;
@@ -523,6 +558,11 @@ type?: string | undefined;
523
558
  width?: string | undefined;
524
559
  pinned?: boolean | undefined;
525
560
  resizable?: boolean | undefined;
561
+ sortable?: boolean | undefined;
562
+ filterable?: boolean | undefined;
563
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
564
+ filterOptions?: any[] | undefined;
565
+ filterComponent?: string | undefined;
526
566
  cellComponent?: string | undefined;
527
567
  cellComponentProps?: Record<string, any> | undefined;
528
568
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -542,6 +582,11 @@ type?: string | undefined;
542
582
  width?: string | undefined;
543
583
  pinned?: boolean | undefined;
544
584
  resizable?: boolean | undefined;
585
+ sortable?: boolean | undefined;
586
+ filterable?: boolean | undefined;
587
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
588
+ filterOptions?: any[] | undefined;
589
+ filterComponent?: string | undefined;
545
590
  cellComponent?: string | undefined;
546
591
  cellComponentProps?: Record<string, any> | undefined;
547
592
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -641,6 +686,7 @@ width?: number | undefined;
641
686
  label?: string | undefined;
642
687
  }[]>;
643
688
  display: WritableComputedRef<TableDisplay[], TableDisplay[]>;
689
+ filterState: Ref<FilterStateRecord, FilterStateRecord>;
644
690
  ganttBars: Ref< {
645
691
  id: string;
646
692
  rowIndex: number;
@@ -712,14 +758,36 @@ endIndex?: number | undefined;
712
758
  colspan?: number | undefined;
713
759
  } | undefined;
714
760
  }[]>;
761
+ sortState: Ref< {
762
+ column: number | null;
763
+ direction: "asc" | "desc" | null;
764
+ }, {
765
+ column: number | null;
766
+ direction: "asc" | "desc" | null;
767
+ } | {
768
+ column: number | null;
769
+ direction: "asc" | "desc" | null;
770
+ }>;
715
771
  table: ComputedRef< {}>;
716
772
  updates: Ref<Record<string, string>, Record<string, string>>;
773
+ filteredRows: ComputedRef< {
774
+ originalIndex: number;
775
+ indent?: number | undefined;
776
+ parent?: number | undefined;
777
+ gantt?: {
778
+ color?: string | undefined;
779
+ startIndex?: number | undefined;
780
+ endIndex?: number | undefined;
781
+ colspan?: number | undefined;
782
+ } | undefined;
783
+ }[]>;
717
784
  hasPinnedColumns: ComputedRef<boolean>;
718
785
  isGanttView: ComputedRef<boolean>;
719
786
  isTreeView: ComputedRef<boolean>;
720
787
  isDependencyGraphEnabled: ComputedRef<boolean>;
721
788
  numberedRowWidth: ComputedRef<string>;
722
789
  zeroColumn: ComputedRef<boolean>;
790
+ clearFilter: (colIndex: number) => void;
723
791
  closeModal: (event: MouseEvent) => void;
724
792
  createConnection: (fromHandleId: string, toHandleId: string, options?: {
725
793
  style?: ConnectionPath["style"];
@@ -767,12 +835,14 @@ registerGanttBar: (barInfo: GanttBarInfo) => void;
767
835
  resizeColumn: (colIndex: number, newWidth: number) => void;
768
836
  setCellData: (colIndex: number, rowIndex: number, value: any) => void;
769
837
  setCellText: (colIndex: number, rowIndex: number, value: string) => void;
838
+ setFilter: (colIndex: number, filter: FilterState) => void;
839
+ sortByColumn: (colIndex: number) => void;
770
840
  toggleRowExpand: (rowIndex: number) => void;
771
841
  unregisterConnectionHandle: (handleId: string) => void;
772
842
  unregisterGanttBar: (barId: string) => void;
773
843
  updateGanttBar: (event: GanttDragEvent) => void;
774
844
  updateRows: (newRows: TableRow[]) => void;
775
- }, "display" | "table" | "hasPinnedColumns" | "isGanttView" | "isTreeView" | "isDependencyGraphEnabled" | "numberedRowWidth" | "zeroColumn">, Pick<{
845
+ }, "display" | "table" | "filteredRows" | "hasPinnedColumns" | "isGanttView" | "isTreeView" | "isDependencyGraphEnabled" | "numberedRowWidth" | "zeroColumn">, Pick<{
776
846
  columns: Ref< {
777
847
  name: string;
778
848
  align?: CanvasTextAlign | undefined;
@@ -782,6 +852,11 @@ type?: string | undefined;
782
852
  width?: string | undefined;
783
853
  pinned?: boolean | undefined;
784
854
  resizable?: boolean | undefined;
855
+ sortable?: boolean | undefined;
856
+ filterable?: boolean | undefined;
857
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
858
+ filterOptions?: any[] | undefined;
859
+ filterComponent?: string | undefined;
785
860
  cellComponent?: string | undefined;
786
861
  cellComponentProps?: Record<string, any> | undefined;
787
862
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -801,6 +876,11 @@ type?: string | undefined;
801
876
  width?: string | undefined;
802
877
  pinned?: boolean | undefined;
803
878
  resizable?: boolean | undefined;
879
+ sortable?: boolean | undefined;
880
+ filterable?: boolean | undefined;
881
+ filterType?: "text" | "select" | "number" | "date" | "dateRange" | "checkbox" | "component" | undefined;
882
+ filterOptions?: any[] | undefined;
883
+ filterComponent?: string | undefined;
804
884
  cellComponent?: string | undefined;
805
885
  cellComponentProps?: Record<string, any> | undefined;
806
886
  modalComponent?: string | ((context: CellContext) => string) | undefined;
@@ -900,6 +980,7 @@ width?: number | undefined;
900
980
  label?: string | undefined;
901
981
  }[]>;
902
982
  display: WritableComputedRef<TableDisplay[], TableDisplay[]>;
983
+ filterState: Ref<FilterStateRecord, FilterStateRecord>;
903
984
  ganttBars: Ref< {
904
985
  id: string;
905
986
  rowIndex: number;
@@ -971,14 +1052,36 @@ endIndex?: number | undefined;
971
1052
  colspan?: number | undefined;
972
1053
  } | undefined;
973
1054
  }[]>;
1055
+ sortState: Ref< {
1056
+ column: number | null;
1057
+ direction: "asc" | "desc" | null;
1058
+ }, {
1059
+ column: number | null;
1060
+ direction: "asc" | "desc" | null;
1061
+ } | {
1062
+ column: number | null;
1063
+ direction: "asc" | "desc" | null;
1064
+ }>;
974
1065
  table: ComputedRef< {}>;
975
1066
  updates: Ref<Record<string, string>, Record<string, string>>;
1067
+ filteredRows: ComputedRef< {
1068
+ originalIndex: number;
1069
+ indent?: number | undefined;
1070
+ parent?: number | undefined;
1071
+ gantt?: {
1072
+ color?: string | undefined;
1073
+ startIndex?: number | undefined;
1074
+ endIndex?: number | undefined;
1075
+ colspan?: number | undefined;
1076
+ } | undefined;
1077
+ }[]>;
976
1078
  hasPinnedColumns: ComputedRef<boolean>;
977
1079
  isGanttView: ComputedRef<boolean>;
978
1080
  isTreeView: ComputedRef<boolean>;
979
1081
  isDependencyGraphEnabled: ComputedRef<boolean>;
980
1082
  numberedRowWidth: ComputedRef<string>;
981
1083
  zeroColumn: ComputedRef<boolean>;
1084
+ clearFilter: (colIndex: number) => void;
982
1085
  closeModal: (event: MouseEvent) => void;
983
1086
  createConnection: (fromHandleId: string, toHandleId: string, options?: {
984
1087
  style?: ConnectionPath["style"];
@@ -1026,12 +1129,14 @@ registerGanttBar: (barInfo: GanttBarInfo) => void;
1026
1129
  resizeColumn: (colIndex: number, newWidth: number) => void;
1027
1130
  setCellData: (colIndex: number, rowIndex: number, value: any) => void;
1028
1131
  setCellText: (colIndex: number, rowIndex: number, value: string) => void;
1132
+ setFilter: (colIndex: number, filter: FilterState) => void;
1133
+ sortByColumn: (colIndex: number) => void;
1029
1134
  toggleRowExpand: (rowIndex: number) => void;
1030
1135
  unregisterConnectionHandle: (handleId: string) => void;
1031
1136
  unregisterGanttBar: (barId: string) => void;
1032
1137
  updateGanttBar: (event: GanttDragEvent) => void;
1033
1138
  updateRows: (newRows: TableRow[]) => void;
1034
- }, "closeModal" | "createConnection" | "deleteConnection" | "getCellData" | "getCellDisplayValue" | "getConnectionsForBar" | "getFormattedValue" | "getHandlesForBar" | "getHeaderCellStyle" | "getIndent" | "getRowExpandSymbol" | "isRowGantt" | "isRowVisible" | "registerConnectionHandle" | "registerGanttBar" | "resizeColumn" | "setCellData" | "setCellText" | "toggleRowExpand" | "unregisterConnectionHandle" | "unregisterGanttBar" | "updateGanttBar" | "updateRows">>;
1139
+ }, "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">>;
1035
1140
 
1036
1141
  /**
1037
1142
  * Schema structure for defining fieldsets inside AForm
@@ -1055,6 +1160,25 @@ export declare type FieldsetSchema = BaseSchema & {
1055
1160
  collapsible?: boolean;
1056
1161
  };
1057
1162
 
1163
+ /**
1164
+ * Represents the state of a single filter
1165
+ * @public
1166
+ */
1167
+ declare interface FilterState {
1168
+ /** The main filter value */
1169
+ value: any;
1170
+ /** Start value for date range filters */
1171
+ startValue?: any;
1172
+ /** End value for date range filters */
1173
+ endValue?: any;
1174
+ }
1175
+
1176
+ /**
1177
+ * Record mapping column indices to their filter states
1178
+ * @public
1179
+ */
1180
+ declare type FilterStateRecord = Record<number, FilterState>;
1181
+
1058
1182
  /**
1059
1183
  * Schema structure for defining forms inside AForm
1060
1184
  * @public
@@ -1306,6 +1430,32 @@ export declare interface TableColumn {
1306
1430
  * @defaultValue false
1307
1431
  */
1308
1432
  resizable?: boolean;
1433
+ /**
1434
+ * Control whether the column should be sortable.
1435
+ *
1436
+ * @defaultValue true
1437
+ */
1438
+ sortable?: boolean;
1439
+ /**
1440
+ * Control whether the column should be filterable and define filter configuration.
1441
+ *
1442
+ * @defaultValue true
1443
+ */
1444
+ filterable?: boolean;
1445
+ /**
1446
+ * The type of filter for the column.
1447
+ *
1448
+ * @defaultValue 'text'
1449
+ */
1450
+ filterType?: 'text' | 'select' | 'number' | 'date' | 'dateRange' | 'checkbox' | 'component';
1451
+ /**
1452
+ * Options for select-type filters.
1453
+ */
1454
+ filterOptions?: any[];
1455
+ /**
1456
+ * Custom component for filtering.
1457
+ */
1458
+ filterComponent?: string;
1309
1459
  /**
1310
1460
  * The component to use to render the cell for the column. If not provided, the table will
1311
1461
  * render the default `<td>` element.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/aform",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -38,8 +38,8 @@
38
38
  "@vueuse/core": "^14.0.0",
39
39
  "@vueuse/components": "^14.0.0",
40
40
  "vue": "^3.5.22",
41
- "@stonecrop/utilities": "0.6.0",
42
- "@stonecrop/themes": "0.6.0"
41
+ "@stonecrop/themes": "0.6.1",
42
+ "@stonecrop/utilities": "0.6.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@eslint/js": "^9.38.0",
@@ -60,11 +60,11 @@
60
60
  "vite": "^7.1.1",
61
61
  "vitest": "^4.0.5",
62
62
  "vue-router": "^4.6.3",
63
- "@stonecrop/atable": "0.6.0",
63
+ "@stonecrop/atable": "0.6.1",
64
64
  "stonecrop-rig": "0.2.22"
65
65
  },
66
66
  "peerDependencies": {
67
- "@stonecrop/atable": "0.6.0"
67
+ "@stonecrop/atable": "0.6.1"
68
68
  },
69
69
  "publishConfig": {
70
70
  "access": "public"