@mintplayer/ng-spark 0.0.8 → 0.1.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@mintplayer/ng-spark",
3
3
  "private": false,
4
- "version": "0.0.8",
4
+ "version": "0.1.0",
5
5
  "description": "Angular component library for MintPlayer.Spark CRUD applications",
6
6
  "repository": {
7
7
  "type": "git",
@@ -13,7 +13,7 @@
13
13
  "@angular/common": "^21.0.0",
14
14
  "@angular/router": "^21.0.0",
15
15
  "@angular/forms": "^21.0.0",
16
- "@mintplayer/ng-bootstrap": "^21.9.0",
16
+ "@mintplayer/ng-bootstrap": "^21.12.4",
17
17
  "@mintplayer/pagination": "*",
18
18
  "rxjs": "~7.8.0"
19
19
  },
@@ -1,9 +1,11 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { WritableSignal, InjectionToken, Type, TemplateRef, PipeTransform, InputSignal, Provider } from '@angular/core';
3
+ import { SortColumn, PaginationResponse } from '@mintplayer/pagination';
4
+ import { Observable } from 'rxjs';
3
5
  import { Color } from '@mintplayer/ng-bootstrap';
4
6
  import { DatatableSettings } from '@mintplayer/ng-bootstrap/datatable';
5
- import { PaginationResponse } from '@mintplayer/pagination';
6
7
  import * as _mintplayer_ng_spark from '@mintplayer/ng-spark';
8
+ import { VirtualDatatableDataSource } from '@mintplayer/ng-bootstrap/virtual-datatable';
7
9
  import * as _angular_platform_browser from '@angular/platform-browser';
8
10
  import { SafeHtml } from '@angular/platform-browser';
9
11
  import { Route, Routes } from '@angular/router';
@@ -150,20 +152,34 @@ interface ValidationError {
150
152
  ruleType: string;
151
153
  }
152
154
 
155
+ type SparkQueryRenderMode = 'Pagination' | 'VirtualScrolling';
156
+ interface SparkQuerySortColumn {
157
+ property: string;
158
+ direction: string;
159
+ }
153
160
  interface SparkQuery {
154
161
  id: string;
155
162
  name: string;
156
163
  description?: TranslatedString;
157
164
  source: string;
158
165
  alias?: string;
159
- sortBy?: string;
160
- sortDirection: string;
166
+ sortColumns: SparkQuerySortColumn[];
167
+ renderMode?: SparkQueryRenderMode;
161
168
  /** Optional RavenDB index name for queries using indexes */
162
169
  indexName?: string;
163
170
  /** When true, uses the projection type from [QueryType] attribute */
164
171
  useProjection?: boolean;
165
172
  /** Optional entity type name (e.g., "Person"). When set, used for entity type resolution. */
166
173
  entityType?: string;
174
+ /** When true, this query uses WebSocket streaming with snapshot + patch updates. */
175
+ isStreamingQuery?: boolean;
176
+ }
177
+
178
+ interface QueryResult {
179
+ data: PersistentObject[];
180
+ totalRecords: number;
181
+ skip: number;
182
+ take: number;
167
183
  }
168
184
 
169
185
  interface ProgramUnit {
@@ -250,6 +266,24 @@ interface SparkConfig {
250
266
  declare const SPARK_CONFIG: InjectionToken<SparkConfig>;
251
267
  declare const defaultSparkConfig: SparkConfig;
252
268
 
269
+ interface StreamingSnapshotMessage {
270
+ type: 'snapshot';
271
+ data: PersistentObject[];
272
+ }
273
+ interface StreamingPatchItem {
274
+ id: string;
275
+ attributes: Record<string, any>;
276
+ }
277
+ interface StreamingPatchMessage {
278
+ type: 'patch';
279
+ updated: StreamingPatchItem[];
280
+ }
281
+ interface StreamingErrorMessage {
282
+ type: 'error';
283
+ message: string;
284
+ }
285
+ type StreamingMessage = StreamingSnapshotMessage | StreamingPatchMessage | StreamingErrorMessage;
286
+
253
287
  declare class SparkService {
254
288
  private readonly config;
255
289
  private readonly baseUrl;
@@ -262,8 +296,15 @@ declare class SparkService {
262
296
  getQueries(): Promise<SparkQuery[]>;
263
297
  getQuery(id: string): Promise<SparkQuery>;
264
298
  getQueryByName(name: string): Promise<SparkQuery | undefined>;
265
- executeQuery(queryId: string, sortBy?: string, sortDirection?: string, parentId?: string, parentType?: string): Promise<PersistentObject[]>;
266
- executeQueryByName(queryName: string): Promise<PersistentObject[]>;
299
+ executeQuery(queryId: string, options?: {
300
+ sortColumns?: SortColumn[];
301
+ parentId?: string;
302
+ parentType?: string;
303
+ skip?: number;
304
+ take?: number;
305
+ search?: string;
306
+ }): Promise<QueryResult>;
307
+ executeQueryByName(queryName: string): Promise<QueryResult>;
267
308
  getProgramUnits(): Promise<ProgramUnitsConfiguration>;
268
309
  list(type: string): Promise<PersistentObject[]>;
269
310
  get(type: string, id: string): Promise<PersistentObject>;
@@ -285,6 +326,16 @@ declare class SparkService {
285
326
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<SparkService>;
286
327
  }
287
328
 
329
+ declare class SparkStreamingService {
330
+ private readonly config;
331
+ private readonly baseUrl;
332
+ private readonly ngZone;
333
+ connectToStreamingQuery(queryId: string): Observable<StreamingMessage>;
334
+ private buildWebSocketUrl;
335
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SparkStreamingService, never>;
336
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<SparkStreamingService>;
337
+ }
338
+
288
339
  declare class SparkLanguageService {
289
340
  private readonly http;
290
341
  private readonly config;
@@ -338,7 +389,7 @@ declare class SparkPoFormComponent {
338
389
  referenceModalItems: _angular_core.WritableSignal<PersistentObject[]>;
339
390
  referenceModalEntityType: _angular_core.WritableSignal<EntityType>;
340
391
  referenceModalPagination: _angular_core.WritableSignal<PaginationResponse<PersistentObject>>;
341
- referenceModalSettings: DatatableSettings;
392
+ referenceModalSettings: _angular_core.WritableSignal<DatatableSettings>;
342
393
  referenceSearchTerm: string;
343
394
  editingLookupAttr: _angular_core.WritableSignal<EntityAttributeDefinition>;
344
395
  showLookupModal: _angular_core.WritableSignal<boolean>;
@@ -489,7 +540,9 @@ declare class SparkQueryListComponent {
489
540
  private readonly route;
490
541
  private readonly router;
491
542
  private readonly sparkService;
543
+ private readonly streamingService;
492
544
  private readonly rendererRegistry;
545
+ private readonly destroyRef;
493
546
  extraActionsTemplate: _angular_core.InputSignal<TemplateRef<void>>;
494
547
  rowClicked: _angular_core.OutputEmitterRef<PersistentObject>;
495
548
  createClicked: _angular_core.OutputEmitterRef<void>;
@@ -498,30 +551,38 @@ declare class SparkQueryListComponent {
498
551
  query: _angular_core.WritableSignal<SparkQuery>;
499
552
  entityType: _angular_core.WritableSignal<EntityType>;
500
553
  allEntityTypes: _angular_core.WritableSignal<EntityType[]>;
501
- allItems: _angular_core.WritableSignal<PersistentObject[]>;
502
554
  lookupReferenceOptions: _angular_core.WritableSignal<Record<string, LookupReference>>;
503
555
  paginationData: _angular_core.WritableSignal<PaginationResponse<PersistentObject>>;
504
556
  searchTerm: string;
505
557
  canRead: _angular_core.WritableSignal<boolean>;
506
558
  canCreate: _angular_core.WritableSignal<boolean>;
507
- settings: DatatableSettings;
508
- private currentSortProperty;
509
- private currentSortDirection;
559
+ isStreaming: _angular_core.WritableSignal<boolean>;
560
+ private streamingSub;
561
+ private allItems;
562
+ private filteredItems;
563
+ settings: _angular_core.WritableSignal<DatatableSettings>;
564
+ virtualDataSource: _angular_core.WritableSignal<VirtualDatatableDataSource<PersistentObject>>;
565
+ virtualSettings: _angular_core.WritableSignal<DatatableSettings>;
510
566
  constructor();
511
567
  private onParamsChange;
512
568
  private resolveEntityTypeForQuery;
513
569
  private extractSourceName;
514
570
  private singularize;
571
+ private initVirtualDataSource;
515
572
  loadItems(): Promise<void>;
516
573
  onSettingsChange(): void;
517
574
  onSearchChange(): void;
518
- applyFilter(): void;
519
575
  clearSearch(): void;
576
+ isVirtualScrolling: _angular_core.Signal<boolean>;
520
577
  visibleAttributes: _angular_core.Signal<EntityAttributeDefinition[]>;
521
578
  getColumnRendererComponent(attr: EntityAttributeDefinition): Type<any> | null;
522
579
  getColumnRendererInputs(item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any>;
523
580
  private loadLookupReferenceOptions;
524
581
  onCreate(): void;
582
+ private connectStreaming;
583
+ private disconnectStreaming;
584
+ private handleStreamingMessage;
585
+ private applyFilter;
525
586
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SparkQueryListComponent, never>;
526
587
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SparkQueryListComponent, "spark-query-list", never, { "extraActionsTemplate": { "alias": "extraActionsTemplate"; "required": false; "isSignal": true; }; }, { "rowClicked": "rowClicked"; "createClicked": "createClicked"; }, never, never, true, never>;
527
588
  }
@@ -535,13 +596,18 @@ declare class SparkSubQueryComponent {
535
596
  query: _angular_core.WritableSignal<SparkQuery>;
536
597
  entityType: _angular_core.WritableSignal<EntityType>;
537
598
  allEntityTypes: _angular_core.WritableSignal<EntityType[]>;
538
- items: _angular_core.WritableSignal<PersistentObject[]>;
599
+ paginationData: _angular_core.WritableSignal<PaginationResponse<PersistentObject>>;
539
600
  lookupReferenceOptions: _angular_core.WritableSignal<Record<string, LookupReference>>;
540
601
  loading: _angular_core.WritableSignal<boolean>;
541
602
  canRead: _angular_core.WritableSignal<boolean>;
603
+ settings: _angular_core.WritableSignal<DatatableSettings>;
604
+ virtualDataSource: _angular_core.WritableSignal<VirtualDatatableDataSource<PersistentObject>>;
605
+ virtualSettings: _angular_core.WritableSignal<DatatableSettings>;
542
606
  visibleAttributes: _angular_core.Signal<EntityAttributeDefinition[]>;
543
607
  constructor();
544
608
  private loadData;
609
+ private loadPage;
610
+ onSettingsChange(): void;
545
611
  private loadLookupReferenceOptions;
546
612
  getColumnRendererComponent(attr: EntityAttributeDefinition): Type<any> | null;
547
613
  getColumnRendererInputs(item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any>;
@@ -789,5 +855,5 @@ declare function sparkRoutes(config?: SparkRouteConfig): Routes;
789
855
 
790
856
  declare function provideSpark(config?: Partial<SparkConfig>): Provider[];
791
857
 
792
- export { ArrayValuePipe, AsDetailCellValuePipe, AsDetailColumnsPipe, AsDetailDisplayValuePipe, AsDetailTypePipe, AttributeValuePipe, CanCreateDetailRowPipe, CanDeleteDetailRowPipe, ELookupDisplayType, ErrorForAttributePipe, IconNamePipe, InlineRefOptionsPipe, InputTypePipe, LookupDisplayTypePipe, LookupDisplayValuePipe, LookupOptionsPipe, RawAttributeValuePipe, ReferenceAttrValuePipe, ReferenceDisplayValuePipe, ReferenceLinkRoutePipe, ResolveTranslationPipe, RetryActionService, RouterLinkPipe, SPARK_ATTRIBUTE_RENDERERS, SPARK_CONFIG, ShowedOn, SparkIconComponent, SparkIconRegistry, SparkLanguageService, SparkPoCreateComponent, SparkPoDetailComponent, SparkPoEditComponent, SparkPoFormComponent, SparkQueryListComponent, SparkRetryActionModalComponent, SparkService, SparkSubQueryComponent, TranslateKeyPipe, currentLanguage, defaultSparkConfig, hasShowedOnFlag, provideSpark, provideSparkAttributeRenderers, resolveTranslation, sparkRoutes };
793
- export type { AttributeGroup, AttributeTab, CustomActionDefinition, EntityAttributeDefinition, EntityPermissions, EntityType, LookupReference, LookupReferenceListItem, LookupReferenceValue, PersistentObject, PersistentObjectAttribute, ProgramUnit, ProgramUnitGroup, ProgramUnitsConfiguration, RetryActionPayload, RetryActionResult, SparkAttributeColumnRenderer, SparkAttributeDetailRenderer, SparkAttributeEditRenderer, SparkAttributeRendererRegistration, SparkConfig, SparkQuery, SparkRouteConfig, TranslatedString, ValidationError, ValidationRule };
858
+ export { ArrayValuePipe, AsDetailCellValuePipe, AsDetailColumnsPipe, AsDetailDisplayValuePipe, AsDetailTypePipe, AttributeValuePipe, CanCreateDetailRowPipe, CanDeleteDetailRowPipe, ELookupDisplayType, ErrorForAttributePipe, IconNamePipe, InlineRefOptionsPipe, InputTypePipe, LookupDisplayTypePipe, LookupDisplayValuePipe, LookupOptionsPipe, RawAttributeValuePipe, ReferenceAttrValuePipe, ReferenceDisplayValuePipe, ReferenceLinkRoutePipe, ResolveTranslationPipe, RetryActionService, RouterLinkPipe, SPARK_ATTRIBUTE_RENDERERS, SPARK_CONFIG, ShowedOn, SparkIconComponent, SparkIconRegistry, SparkLanguageService, SparkPoCreateComponent, SparkPoDetailComponent, SparkPoEditComponent, SparkPoFormComponent, SparkQueryListComponent, SparkRetryActionModalComponent, SparkService, SparkStreamingService, SparkSubQueryComponent, TranslateKeyPipe, currentLanguage, defaultSparkConfig, hasShowedOnFlag, provideSpark, provideSparkAttributeRenderers, resolveTranslation, sparkRoutes };
859
+ export type { AttributeGroup, AttributeTab, CustomActionDefinition, EntityAttributeDefinition, EntityPermissions, EntityType, LookupReference, LookupReferenceListItem, LookupReferenceValue, PersistentObject, PersistentObjectAttribute, ProgramUnit, ProgramUnitGroup, ProgramUnitsConfiguration, QueryResult, RetryActionPayload, RetryActionResult, SparkAttributeColumnRenderer, SparkAttributeDetailRenderer, SparkAttributeEditRenderer, SparkAttributeRendererRegistration, SparkConfig, SparkQuery, SparkQueryRenderMode, SparkQuerySortColumn, SparkRouteConfig, StreamingErrorMessage, StreamingMessage, StreamingPatchItem, StreamingPatchMessage, StreamingSnapshotMessage, TranslatedString, ValidationError, ValidationRule };