@gridengine/angular-datagrid-enterprise 0.5.0 → 0.7.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.
package/package.json
CHANGED
|
@@ -648,5 +648,327 @@ declare class RowLockEngine {
|
|
|
648
648
|
private _notify;
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
|
|
652
|
-
|
|
651
|
+
/**
|
|
652
|
+
* Advanced filter builder — a nestable AND/OR/NOT tree of conditions with a
|
|
653
|
+
* pure evaluator, URL-safe serialize/deserialize for shareable filter links,
|
|
654
|
+
* and a named-preset store. No React, no DOM.
|
|
655
|
+
*/
|
|
656
|
+
|
|
657
|
+
type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'isEmpty' | 'isNotEmpty';
|
|
658
|
+
/** A single leaf filter condition. */
|
|
659
|
+
interface FilterCondition {
|
|
660
|
+
kind: 'condition';
|
|
661
|
+
field: string;
|
|
662
|
+
operator: FilterOperator;
|
|
663
|
+
value?: unknown;
|
|
664
|
+
}
|
|
665
|
+
/** A nestable group of conditions/groups combined with AND or OR. */
|
|
666
|
+
interface FilterGroup {
|
|
667
|
+
kind: 'group';
|
|
668
|
+
combinator: 'and' | 'or';
|
|
669
|
+
/** Negates the entire group's result. */
|
|
670
|
+
not?: boolean;
|
|
671
|
+
children: FilterNode[];
|
|
672
|
+
}
|
|
673
|
+
type FilterNode = FilterCondition | FilterGroup;
|
|
674
|
+
/** A named, persistable filter preset. */
|
|
675
|
+
interface FilterPreset {
|
|
676
|
+
id: string;
|
|
677
|
+
name: string;
|
|
678
|
+
filter: FilterNode;
|
|
679
|
+
isShared?: boolean;
|
|
680
|
+
}
|
|
681
|
+
interface FilterPresetEngineOptions {
|
|
682
|
+
/** Presets to seed the store with. */
|
|
683
|
+
presets?: FilterPreset[];
|
|
684
|
+
/** Called when a preset is saved. */
|
|
685
|
+
onSave?: (preset: FilterPreset) => void | Promise<void>;
|
|
686
|
+
/** ID generator (injectable for tests). */
|
|
687
|
+
generateId?: () => string;
|
|
688
|
+
}
|
|
689
|
+
/** Evaluate a filter node against a row. */
|
|
690
|
+
declare function evaluateFilter(node: FilterNode, row: GridRow): boolean;
|
|
691
|
+
/** Serialize a filter tree to a URL-safe string. */
|
|
692
|
+
declare function serializeFilter(node: FilterNode): string;
|
|
693
|
+
/** Deserialize a URL-safe string back into a filter tree. Throws if invalid. */
|
|
694
|
+
declare function deserializeFilter(encoded: string): FilterNode;
|
|
695
|
+
declare class FilterPresetEngine {
|
|
696
|
+
private readonly _onSave?;
|
|
697
|
+
private readonly _generateId;
|
|
698
|
+
private _presets;
|
|
699
|
+
private _seq;
|
|
700
|
+
private _onChange?;
|
|
701
|
+
constructor(options?: FilterPresetEngineOptions);
|
|
702
|
+
subscribe(listener: () => void): () => void;
|
|
703
|
+
getPresets(): readonly FilterPreset[];
|
|
704
|
+
getPreset(id: string): FilterPreset | undefined;
|
|
705
|
+
/** Save a new preset (or replace one with the same name). Returns it. */
|
|
706
|
+
savePreset(name: string, filter: FilterNode, isShared?: boolean): FilterPreset;
|
|
707
|
+
deletePreset(id: string): void;
|
|
708
|
+
/** Filter an array of rows through a filter tree. */
|
|
709
|
+
applyFilter(node: FilterNode, rows: GridRow[]): GridRow[];
|
|
710
|
+
private _notify;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* SavedViewsEngine — manages named grid views (column layout, sort, filter,
|
|
715
|
+
* group, density, etc.) across personal + admin-shared tiers. Server sync is
|
|
716
|
+
* delegated to async callbacks so the engine stays pure and Node-testable.
|
|
717
|
+
*/
|
|
718
|
+
interface SavedView {
|
|
719
|
+
id: string;
|
|
720
|
+
name: string;
|
|
721
|
+
isShared?: boolean;
|
|
722
|
+
layout: Record<string, unknown>;
|
|
723
|
+
}
|
|
724
|
+
interface SavedViewsEngineOptions {
|
|
725
|
+
/** Async loader for the user's saved views. */
|
|
726
|
+
getSavedViews?: () => Promise<SavedView[]>;
|
|
727
|
+
/** Persist a saved view. */
|
|
728
|
+
onSaveView?: (view: SavedView) => Promise<void> | void;
|
|
729
|
+
/** Delete a saved view. */
|
|
730
|
+
onDeleteView?: (viewId: string) => Promise<void> | void;
|
|
731
|
+
/** Notified when the active view changes. */
|
|
732
|
+
onViewChange?: (view: SavedView | null) => void;
|
|
733
|
+
/** Seed views (used when no async loader is supplied). */
|
|
734
|
+
views?: SavedView[];
|
|
735
|
+
/** ID generator (injectable for tests). */
|
|
736
|
+
generateId?: () => string;
|
|
737
|
+
}
|
|
738
|
+
declare class SavedViewsEngine {
|
|
739
|
+
private readonly _getSavedViews?;
|
|
740
|
+
private readonly _onSaveView?;
|
|
741
|
+
private readonly _onDeleteView?;
|
|
742
|
+
private readonly _onViewChange?;
|
|
743
|
+
private readonly _generateId;
|
|
744
|
+
private _views;
|
|
745
|
+
private _activeViewId;
|
|
746
|
+
private _seq;
|
|
747
|
+
private _onChange?;
|
|
748
|
+
constructor(options?: SavedViewsEngineOptions);
|
|
749
|
+
subscribe(listener: () => void): () => void;
|
|
750
|
+
/** Load views from the async source, replacing local state. */
|
|
751
|
+
load(): Promise<void>;
|
|
752
|
+
getViews(): readonly SavedView[];
|
|
753
|
+
getView(id: string): SavedView | undefined;
|
|
754
|
+
/** Personal (non-shared) views. */
|
|
755
|
+
getPersonalViews(): SavedView[];
|
|
756
|
+
/** Admin-shared views. */
|
|
757
|
+
getSharedViews(): SavedView[];
|
|
758
|
+
getActiveView(): SavedView | null;
|
|
759
|
+
/** Create a new view or update an existing one by name. Returns the view. */
|
|
760
|
+
saveView(name: string, layout: Record<string, unknown>, options?: {
|
|
761
|
+
isShared?: boolean;
|
|
762
|
+
id?: string;
|
|
763
|
+
}): Promise<SavedView>;
|
|
764
|
+
/** Delete a view. If it was active, the active view is cleared. */
|
|
765
|
+
deleteView(id: string): Promise<void>;
|
|
766
|
+
/** Activate a view (or clear with null). Fires onViewChange. */
|
|
767
|
+
setActiveView(id: string | null): void;
|
|
768
|
+
private _notify;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* ExcelImportEngine — a dependency-free import pipeline that turns a tabular
|
|
773
|
+
* matrix (header row + data rows) into validated grid rows. File parsing is
|
|
774
|
+
* kept OUT of the engine: use `parseCSV()` for delimited text, or feed a
|
|
775
|
+
* `string[][]` produced by SheetJS for .xlsx. Pipeline: loadMatrix → (auto)
|
|
776
|
+
* mapping → validate → buildRows.
|
|
777
|
+
*/
|
|
778
|
+
|
|
779
|
+
/** Data type used to validate and coerce imported cell values. */
|
|
780
|
+
type ImportColumnType = 'string' | 'number' | 'boolean' | 'date';
|
|
781
|
+
interface ImportColumn {
|
|
782
|
+
/** Target grid field the source column maps to. */
|
|
783
|
+
field: string;
|
|
784
|
+
/** Header text used for auto-matching against the source sheet. */
|
|
785
|
+
headerName: string;
|
|
786
|
+
/** Expected data type. Values are validated/coerced against it. Default: 'string' */
|
|
787
|
+
type?: ImportColumnType;
|
|
788
|
+
/** Whether a value is required (empty cells produce a validation error). */
|
|
789
|
+
required?: boolean;
|
|
790
|
+
}
|
|
791
|
+
/** A single validation problem found during import. */
|
|
792
|
+
interface ImportValidationError {
|
|
793
|
+
/** Zero-based index into the source data rows (excludes the header row). */
|
|
794
|
+
rowIndex: number;
|
|
795
|
+
field: string;
|
|
796
|
+
value: string;
|
|
797
|
+
message: string;
|
|
798
|
+
}
|
|
799
|
+
interface ExcelImportEngineOptions {
|
|
800
|
+
/** Target columns the importer can map onto. */
|
|
801
|
+
columns: ImportColumn[];
|
|
802
|
+
/** Explicit source-header → target-field mapping, overriding auto-match. */
|
|
803
|
+
columnMapping?: Record<string, string>;
|
|
804
|
+
}
|
|
805
|
+
interface ImportPreview {
|
|
806
|
+
rows: GridRow[];
|
|
807
|
+
errors: ImportValidationError[];
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Parse delimited text into a matrix of string cells. Handles quoted fields
|
|
811
|
+
* containing the delimiter, newlines, and escaped quotes (`""`), plus `\n` and
|
|
812
|
+
* `\r\n` line endings.
|
|
813
|
+
*/
|
|
814
|
+
declare function parseCSV(text: string, delimiter?: string): string[][];
|
|
815
|
+
declare class ExcelImportEngine {
|
|
816
|
+
private readonly _columns;
|
|
817
|
+
private _headers;
|
|
818
|
+
private _dataRows;
|
|
819
|
+
/** sourceHeader → targetField (null = unmapped). */
|
|
820
|
+
private _mapping;
|
|
821
|
+
constructor(options: ExcelImportEngineOptions);
|
|
822
|
+
/**
|
|
823
|
+
* Load a matrix of raw cells.
|
|
824
|
+
* @param matrix Full sheet, including the header row when hasHeaderRow.
|
|
825
|
+
* @param hasHeaderRow When true (default) the first row is treated as headers.
|
|
826
|
+
*/
|
|
827
|
+
loadMatrix(matrix: string[][], hasHeaderRow?: boolean): void;
|
|
828
|
+
/** Parse delimited text and load it as the source matrix. */
|
|
829
|
+
loadCSV(text: string, delimiter?: string, hasHeaderRow?: boolean): void;
|
|
830
|
+
private _autoMap;
|
|
831
|
+
getHeaders(): readonly string[];
|
|
832
|
+
/** Current source-header → target-field mapping. */
|
|
833
|
+
getMapping(): Record<string, string | null>;
|
|
834
|
+
/** Manually map (or unmap with null) a source header to a target field. */
|
|
835
|
+
setMapping(sourceHeader: string, field: string | null): void;
|
|
836
|
+
/** Source headers not yet mapped to a target field. */
|
|
837
|
+
getUnmappedHeaders(): string[];
|
|
838
|
+
/** Target fields that have no source column mapped to them. */
|
|
839
|
+
getUnmappedFields(): string[];
|
|
840
|
+
/** Validate all data rows against the mapped column types. */
|
|
841
|
+
validate(): ImportValidationError[];
|
|
842
|
+
/** Build validated rows (rows with errors are still returned, best-effort). */
|
|
843
|
+
buildRows(): GridRow[];
|
|
844
|
+
/** Full preview: rows plus any validation errors. */
|
|
845
|
+
preview(): ImportPreview;
|
|
846
|
+
private _process;
|
|
847
|
+
/** Number of data rows currently loaded (excludes the header row). */
|
|
848
|
+
get rowCount(): number;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* PDFExportEngine — turns rows + columns + branding options into a paginated,
|
|
853
|
+
* renderer-agnostic document model (`PdfDocumentModel`). A thin adapter can feed
|
|
854
|
+
* that model to jsPDF, pdfmake, or an HTML-to-PDF pipeline without this engine
|
|
855
|
+
* depending on any of them. It preserves the given row/column order, so callers
|
|
856
|
+
* pass the already filtered/sorted view ("export what the user sees").
|
|
857
|
+
*/
|
|
858
|
+
|
|
859
|
+
interface PdfExportOptions {
|
|
860
|
+
/** Report title rendered in the header. */
|
|
861
|
+
title?: string;
|
|
862
|
+
/** Logo image URL rendered in the header. */
|
|
863
|
+
logo?: string;
|
|
864
|
+
/** Footer text rendered on every page. */
|
|
865
|
+
footer?: string;
|
|
866
|
+
/** Page size. Default: 'A4' */
|
|
867
|
+
pageSize?: 'A4' | 'Letter' | 'Legal';
|
|
868
|
+
/** Page orientation. Default: 'landscape' */
|
|
869
|
+
orientation?: 'portrait' | 'landscape';
|
|
870
|
+
/** Rows per page. Default: 25 */
|
|
871
|
+
rowsPerPage?: number;
|
|
872
|
+
}
|
|
873
|
+
interface PdfColumn {
|
|
874
|
+
field: string;
|
|
875
|
+
headerName: string;
|
|
876
|
+
/** Optional formatter for the cell value. */
|
|
877
|
+
format?: (value: unknown, row: GridRow) => string;
|
|
878
|
+
}
|
|
879
|
+
interface PdfPageHeader {
|
|
880
|
+
title?: string;
|
|
881
|
+
logo?: string;
|
|
882
|
+
/** ISO timestamp the export was generated. */
|
|
883
|
+
generatedAt: string;
|
|
884
|
+
}
|
|
885
|
+
interface PdfPageFooter {
|
|
886
|
+
text?: string;
|
|
887
|
+
pageNumber: number;
|
|
888
|
+
pageCount: number;
|
|
889
|
+
}
|
|
890
|
+
interface PdfPage {
|
|
891
|
+
header: PdfPageHeader;
|
|
892
|
+
footer: PdfPageFooter;
|
|
893
|
+
columnHeaders: string[];
|
|
894
|
+
/** Already-formatted cell text for each row on this page. */
|
|
895
|
+
rows: string[][];
|
|
896
|
+
}
|
|
897
|
+
interface PdfDocumentModel {
|
|
898
|
+
pageSize: NonNullable<PdfExportOptions['pageSize']>;
|
|
899
|
+
orientation: NonNullable<PdfExportOptions['orientation']>;
|
|
900
|
+
pages: PdfPage[];
|
|
901
|
+
}
|
|
902
|
+
interface PDFExportEngineOptions extends PdfExportOptions {
|
|
903
|
+
columns: PdfColumn[];
|
|
904
|
+
/** Injectable clock for deterministic timestamps in tests. */
|
|
905
|
+
now?: () => Date;
|
|
906
|
+
}
|
|
907
|
+
declare class PDFExportEngine {
|
|
908
|
+
private readonly _columns;
|
|
909
|
+
private readonly _options;
|
|
910
|
+
private readonly _now;
|
|
911
|
+
constructor(options: PDFExportEngineOptions);
|
|
912
|
+
/** Build the paginated document model from the given (already-visible) rows. */
|
|
913
|
+
build(rows: GridRow[]): PdfDocumentModel;
|
|
914
|
+
private _formatRow;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* FormEditorEngine — backs a slide-in form editor panel: tracks which row is
|
|
919
|
+
* open, holds an editable draft with dirty-state detection, and supports
|
|
920
|
+
* prev/next navigation across the row set. Save/delete delegate to async
|
|
921
|
+
* callbacks. Pure logic.
|
|
922
|
+
*/
|
|
923
|
+
|
|
924
|
+
interface FormEditorEngineOptions {
|
|
925
|
+
/** The rows the editor navigates over (current visible order). */
|
|
926
|
+
rows: GridRow[];
|
|
927
|
+
/** Field used as the unique row ID. Default: 'id' */
|
|
928
|
+
rowIdField?: string;
|
|
929
|
+
onSave?: (row: GridRow) => void | Promise<void>;
|
|
930
|
+
onDelete?: (row: GridRow) => void | Promise<void>;
|
|
931
|
+
}
|
|
932
|
+
declare class FormEditorEngine {
|
|
933
|
+
private _rows;
|
|
934
|
+
private readonly _rowIdField;
|
|
935
|
+
private readonly _onSave?;
|
|
936
|
+
private readonly _onDelete?;
|
|
937
|
+
private _index;
|
|
938
|
+
private _draft;
|
|
939
|
+
private _onChange?;
|
|
940
|
+
constructor(options: FormEditorEngineOptions);
|
|
941
|
+
subscribe(listener: () => void): () => void;
|
|
942
|
+
/** Replace the row set; keeps the panel on the same rowId if still present. */
|
|
943
|
+
setRows(rows: GridRow[]): void;
|
|
944
|
+
get isOpen(): boolean;
|
|
945
|
+
get index(): number;
|
|
946
|
+
/** Open the panel on a row by its ID. */
|
|
947
|
+
openById(rowId: string | number): void;
|
|
948
|
+
/** Open the panel on a row by index. */
|
|
949
|
+
openAt(index: number): void;
|
|
950
|
+
close(): void;
|
|
951
|
+
private _openAt;
|
|
952
|
+
/** The current editable draft (a copy of the row plus unsaved edits). */
|
|
953
|
+
getDraft(): GridRow | null;
|
|
954
|
+
/** The original (unedited) row currently open. */
|
|
955
|
+
getOriginal(): GridRow | null;
|
|
956
|
+
setFieldValue(field: string, value: unknown): void;
|
|
957
|
+
/** True when the draft differs from the original row. */
|
|
958
|
+
get isDirty(): boolean;
|
|
959
|
+
/** Revert unsaved edits. */
|
|
960
|
+
revert(): void;
|
|
961
|
+
get canGoPrev(): boolean;
|
|
962
|
+
get canGoNext(): boolean;
|
|
963
|
+
next(): void;
|
|
964
|
+
prev(): void;
|
|
965
|
+
/** Save the draft: commits it into the row set and calls onSave. */
|
|
966
|
+
save(): Promise<void>;
|
|
967
|
+
/** Delete the open row: removes it and keeps the panel on the next row. */
|
|
968
|
+
delete(): Promise<void>;
|
|
969
|
+
private _rowId;
|
|
970
|
+
private _notify;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
export { AuditTrailEngine, CellPermissionEngine, ClipboardEngine, DEFAULT_MASK, DataGridPro, ExcelImportEngine, FillHandleEngine, FilterPresetEngine, FormEditorEngine, FormulaEngine, GridLicenseWatermark, LicenseManager, MasterDetailEngine, PDFExportEngine, PRODUCT_ID, PURCHASE_URL, RangeSelectionEngine, RowLockEngine, SSRMEngine, SavedViewsEngine, TransactionEngine, UndoRedoManager, deserializeFilter, evaluateFilter, parseCSV, parseTSV, provideGridEngineLicense, serializeFilter, toNumber, toTimestamp };
|
|
974
|
+
export type { AuditEntry, AuditTrailEngineOptions, Block, BlockState, CellEditCommand, CellPermission, CellPermissionEngineOptions, CellRange, ClipboardEngineOptions, DeleteCommand, DetailEntry, DetailLoadState, ExcelImportEngineOptions, FillCell, FillCommand, FillDirection, FillHandleEngineOptions, FillResult, FilterCondition, FilterGroup, FilterNode, FilterOperator, FilterPreset, FilterPresetEngineOptions, FormEditorEngineOptions, FormulaEngineOptions, GridRow, ImportColumn, ImportColumnType, ImportPreview, ImportValidationError, LockedRow, MasterDetailEngineOptions, PDFExportEngineOptions, PasteCommand, PdfColumn, PdfDocumentModel, PdfExportOptions, PdfPage, PdfPageFooter, PdfPageHeader, RangeSelectionEngineOptions, RowLockEngineOptions, SSRMDataSource, SSRMEngineOptions, SSRMGetRowsParams, SSRMGetRowsResult, SavedView, SavedViewsEngineOptions, TransactionDelta, TransactionEngineOptions, UndoRedoCommand, UndoRedoManagerOptions };
|