@gridengine/angular-datagrid-enterprise 0.6.0 → 0.8.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridengine/angular-datagrid-enterprise",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Pro/Enterprise features for the GridEngine Angular data grid (license-gated).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -1,3 +1,4 @@
1
+ import { ColDef } from '@gridengine/angular-datagrid';
1
2
  export * from '@gridengine/angular-datagrid';
2
3
  import * as _angular_core from '@angular/core';
3
4
  import { EnvironmentProviders } from '@angular/core';
@@ -768,5 +769,228 @@ declare class SavedViewsEngine {
768
769
  private _notify;
769
770
  }
770
771
 
771
- export { AuditTrailEngine, CellPermissionEngine, ClipboardEngine, DEFAULT_MASK, DataGridPro, FillHandleEngine, FilterPresetEngine, FormulaEngine, GridLicenseWatermark, LicenseManager, MasterDetailEngine, PRODUCT_ID, PURCHASE_URL, RangeSelectionEngine, RowLockEngine, SSRMEngine, SavedViewsEngine, TransactionEngine, UndoRedoManager, deserializeFilter, evaluateFilter, parseTSV, provideGridEngineLicense, serializeFilter, toNumber, toTimestamp };
772
- export type { AuditEntry, AuditTrailEngineOptions, Block, BlockState, CellEditCommand, CellPermission, CellPermissionEngineOptions, CellRange, ClipboardEngineOptions, DeleteCommand, DetailEntry, DetailLoadState, FillCell, FillCommand, FillDirection, FillHandleEngineOptions, FillResult, FilterCondition, FilterGroup, FilterNode, FilterOperator, FilterPreset, FilterPresetEngineOptions, FormulaEngineOptions, GridRow, LockedRow, MasterDetailEngineOptions, PasteCommand, RangeSelectionEngineOptions, RowLockEngineOptions, SSRMDataSource, SSRMEngineOptions, SSRMGetRowsParams, SSRMGetRowsResult, SavedView, SavedViewsEngineOptions, TransactionDelta, TransactionEngineOptions, UndoRedoCommand, UndoRedoManagerOptions };
772
+ /**
773
+ * ExcelImportEngine — a dependency-free import pipeline that turns a tabular
774
+ * matrix (header row + data rows) into validated grid rows. File parsing is
775
+ * kept OUT of the engine: use `parseCSV()` for delimited text, or feed a
776
+ * `string[][]` produced by SheetJS for .xlsx. Pipeline: loadMatrix → (auto)
777
+ * mapping → validate → buildRows.
778
+ */
779
+
780
+ /** Data type used to validate and coerce imported cell values. */
781
+ type ImportColumnType = 'string' | 'number' | 'boolean' | 'date';
782
+ interface ImportColumn {
783
+ /** Target grid field the source column maps to. */
784
+ field: string;
785
+ /** Header text used for auto-matching against the source sheet. */
786
+ headerName: string;
787
+ /** Expected data type. Values are validated/coerced against it. Default: 'string' */
788
+ type?: ImportColumnType;
789
+ /** Whether a value is required (empty cells produce a validation error). */
790
+ required?: boolean;
791
+ }
792
+ /** A single validation problem found during import. */
793
+ interface ImportValidationError {
794
+ /** Zero-based index into the source data rows (excludes the header row). */
795
+ rowIndex: number;
796
+ field: string;
797
+ value: string;
798
+ message: string;
799
+ }
800
+ interface ExcelImportEngineOptions {
801
+ /** Target columns the importer can map onto. */
802
+ columns: ImportColumn[];
803
+ /** Explicit source-header → target-field mapping, overriding auto-match. */
804
+ columnMapping?: Record<string, string>;
805
+ }
806
+ interface ImportPreview {
807
+ rows: GridRow[];
808
+ errors: ImportValidationError[];
809
+ }
810
+ /**
811
+ * Parse delimited text into a matrix of string cells. Handles quoted fields
812
+ * containing the delimiter, newlines, and escaped quotes (`""`), plus `\n` and
813
+ * `\r\n` line endings.
814
+ */
815
+ declare function parseCSV(text: string, delimiter?: string): string[][];
816
+ declare class ExcelImportEngine {
817
+ private readonly _columns;
818
+ private _headers;
819
+ private _dataRows;
820
+ /** sourceHeader → targetField (null = unmapped). */
821
+ private _mapping;
822
+ constructor(options: ExcelImportEngineOptions);
823
+ /**
824
+ * Load a matrix of raw cells.
825
+ * @param matrix Full sheet, including the header row when hasHeaderRow.
826
+ * @param hasHeaderRow When true (default) the first row is treated as headers.
827
+ */
828
+ loadMatrix(matrix: string[][], hasHeaderRow?: boolean): void;
829
+ /** Parse delimited text and load it as the source matrix. */
830
+ loadCSV(text: string, delimiter?: string, hasHeaderRow?: boolean): void;
831
+ private _autoMap;
832
+ getHeaders(): readonly string[];
833
+ /** Current source-header → target-field mapping. */
834
+ getMapping(): Record<string, string | null>;
835
+ /** Manually map (or unmap with null) a source header to a target field. */
836
+ setMapping(sourceHeader: string, field: string | null): void;
837
+ /** Source headers not yet mapped to a target field. */
838
+ getUnmappedHeaders(): string[];
839
+ /** Target fields that have no source column mapped to them. */
840
+ getUnmappedFields(): string[];
841
+ /** Validate all data rows against the mapped column types. */
842
+ validate(): ImportValidationError[];
843
+ /** Build validated rows (rows with errors are still returned, best-effort). */
844
+ buildRows(): GridRow[];
845
+ /** Full preview: rows plus any validation errors. */
846
+ preview(): ImportPreview;
847
+ private _process;
848
+ /** Number of data rows currently loaded (excludes the header row). */
849
+ get rowCount(): number;
850
+ }
851
+
852
+ /**
853
+ * PDFExportEngine — turns rows + columns + branding options into a paginated,
854
+ * renderer-agnostic document model (`PdfDocumentModel`). A thin adapter can feed
855
+ * that model to jsPDF, pdfmake, or an HTML-to-PDF pipeline without this engine
856
+ * depending on any of them. It preserves the given row/column order, so callers
857
+ * pass the already filtered/sorted view ("export what the user sees").
858
+ */
859
+
860
+ interface PdfExportOptions {
861
+ /** Report title rendered in the header. */
862
+ title?: string;
863
+ /** Logo image URL rendered in the header. */
864
+ logo?: string;
865
+ /** Footer text rendered on every page. */
866
+ footer?: string;
867
+ /** Page size. Default: 'A4' */
868
+ pageSize?: 'A4' | 'Letter' | 'Legal';
869
+ /** Page orientation. Default: 'landscape' */
870
+ orientation?: 'portrait' | 'landscape';
871
+ /** Rows per page. Default: 25 */
872
+ rowsPerPage?: number;
873
+ }
874
+ interface PdfColumn {
875
+ field: string;
876
+ headerName: string;
877
+ /** Optional formatter for the cell value. */
878
+ format?: (value: unknown, row: GridRow) => string;
879
+ }
880
+ interface PdfPageHeader {
881
+ title?: string;
882
+ logo?: string;
883
+ /** ISO timestamp the export was generated. */
884
+ generatedAt: string;
885
+ }
886
+ interface PdfPageFooter {
887
+ text?: string;
888
+ pageNumber: number;
889
+ pageCount: number;
890
+ }
891
+ interface PdfPage {
892
+ header: PdfPageHeader;
893
+ footer: PdfPageFooter;
894
+ columnHeaders: string[];
895
+ /** Already-formatted cell text for each row on this page. */
896
+ rows: string[][];
897
+ }
898
+ interface PdfDocumentModel {
899
+ pageSize: NonNullable<PdfExportOptions['pageSize']>;
900
+ orientation: NonNullable<PdfExportOptions['orientation']>;
901
+ pages: PdfPage[];
902
+ }
903
+ interface PDFExportEngineOptions extends PdfExportOptions {
904
+ columns: PdfColumn[];
905
+ /** Injectable clock for deterministic timestamps in tests. */
906
+ now?: () => Date;
907
+ }
908
+ declare class PDFExportEngine {
909
+ private readonly _columns;
910
+ private readonly _options;
911
+ private readonly _now;
912
+ constructor(options: PDFExportEngineOptions);
913
+ /** Build the paginated document model from the given (already-visible) rows. */
914
+ build(rows: GridRow[]): PdfDocumentModel;
915
+ private _formatRow;
916
+ }
917
+
918
+ /**
919
+ * FormEditorEngine — backs a slide-in form editor panel: tracks which row is
920
+ * open, holds an editable draft with dirty-state detection, and supports
921
+ * prev/next navigation across the row set. Save/delete delegate to async
922
+ * callbacks. Pure logic.
923
+ */
924
+
925
+ interface FormEditorEngineOptions {
926
+ /** The rows the editor navigates over (current visible order). */
927
+ rows: GridRow[];
928
+ /** Field used as the unique row ID. Default: 'id' */
929
+ rowIdField?: string;
930
+ onSave?: (row: GridRow) => void | Promise<void>;
931
+ onDelete?: (row: GridRow) => void | Promise<void>;
932
+ }
933
+ declare class FormEditorEngine {
934
+ private _rows;
935
+ private readonly _rowIdField;
936
+ private readonly _onSave?;
937
+ private readonly _onDelete?;
938
+ private _index;
939
+ private _draft;
940
+ private _onChange?;
941
+ constructor(options: FormEditorEngineOptions);
942
+ subscribe(listener: () => void): () => void;
943
+ /** Replace the row set; keeps the panel on the same rowId if still present. */
944
+ setRows(rows: GridRow[]): void;
945
+ get isOpen(): boolean;
946
+ get index(): number;
947
+ /** Open the panel on a row by its ID. */
948
+ openById(rowId: string | number): void;
949
+ /** Open the panel on a row by index. */
950
+ openAt(index: number): void;
951
+ close(): void;
952
+ private _openAt;
953
+ /** The current editable draft (a copy of the row plus unsaved edits). */
954
+ getDraft(): GridRow | null;
955
+ /** The original (unedited) row currently open. */
956
+ getOriginal(): GridRow | null;
957
+ setFieldValue(field: string, value: unknown): void;
958
+ /** True when the draft differs from the original row. */
959
+ get isDirty(): boolean;
960
+ /** Revert unsaved edits. */
961
+ revert(): void;
962
+ get canGoPrev(): boolean;
963
+ get canGoNext(): boolean;
964
+ next(): void;
965
+ prev(): void;
966
+ /** Save the draft: commits it into the row set and calls onSave. */
967
+ save(): Promise<void>;
968
+ /** Delete the open row: removes it and keeps the panel on the next row. */
969
+ delete(): Promise<void>;
970
+ private _rowId;
971
+ private _notify;
972
+ }
973
+
974
+ /**
975
+ * Grid integration bridges — connect the framework-agnostic Pro engines to the
976
+ * open-source `<gd-data-grid>`'s `ColDef` contract, without any DOM coupling.
977
+ * Consumers feed the transformed column defs straight into `[columnDefs]`.
978
+ */
979
+
980
+ /**
981
+ * Return a copy of `columnDefs` whose cells honour a `CellPermissionEngine`:
982
+ * unreadable cells resolve to the engine's mask value (so they never reach
983
+ * renderers, sorting, filtering, or export), and non-editable cells become
984
+ * non-editable regardless of the column's own `editable`. Columns without a
985
+ * `field` (e.g. a checkbox-selection column) pass through unchanged.
986
+ */
987
+ declare function applyCellPermissions<TData>(columnDefs: ColDef<TData>[], engine: CellPermissionEngine): ColDef<TData>[];
988
+ /**
989
+ * Convert open-source grid column defs into `PdfColumn`s for `PDFExportEngine`,
990
+ * carrying each column's `headerName` and `valueFormatter`. Hidden columns and
991
+ * columns without a `field` are omitted.
992
+ */
993
+ declare function toPdfColumns<TData>(columnDefs: ColDef<TData>[]): PdfColumn[];
994
+
995
+ 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, applyCellPermissions, deserializeFilter, evaluateFilter, parseCSV, parseTSV, provideGridEngineLicense, serializeFilter, toNumber, toPdfColumns, toTimestamp };
996
+ 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 };