@memberjunction/ng-timeline 6.2.0-edge.0 → 6.2.0-edge.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.
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @module @memberjunction/ng-timeline/timeline-group
9
9
  */
10
- import { IMetadataProvider } from '@memberjunction/core';
10
+ import { EntityInfo, IMetadataProvider } from '@memberjunction/core';
11
11
  import { TimelineCardConfig, TimelineEventConfig } from './types';
12
12
  /**
13
13
  * Extracts a field value from a record, supporting both BaseEntity and plain objects.
@@ -30,6 +30,8 @@ import { TimelineCardConfig, TimelineEventConfig } from './types';
30
30
  * const name = getFieldValue(obj, 'name'); // Uses obj['name']
31
31
  * ```
32
32
  */
33
+ export declare function GetFieldValue(record: any, fieldName: string): unknown;
34
+ /** @deprecated Use {@link GetFieldValue}. */
33
35
  export declare function getFieldValue(record: any, fieldName: string): unknown;
34
36
  /**
35
37
  * Extracts an ID from a record, trying common ID field names.
@@ -38,6 +40,8 @@ export declare function getFieldValue(record: any, fieldName: string): unknown;
38
40
  * @param idFieldName - Optional explicit ID field name
39
41
  * @returns The record ID as a string, or a generated fallback ID
40
42
  */
43
+ export declare function GetRecordId(record: any, idFieldName?: string): string;
44
+ /** @deprecated Use {@link GetRecordId}. */
41
45
  export declare function getRecordId(record: any, idFieldName?: string): string;
42
46
  /**
43
47
  * Configures a data source for the timeline component.
@@ -118,6 +122,15 @@ export declare class TimelineGroup<T = any> {
118
122
  * @example 'Tasks', 'MJ: AI Agents', 'Users'
119
123
  */
120
124
  EntityName?: string;
125
+ /**
126
+ * Metadata for the entity this group's records come from, for records that do not carry their own.
127
+ *
128
+ * A BaseEntity record exposes `EntityInfo`, and the group reads field types from it. A plain object
129
+ * (an `'array'` group fed `simple` RunView rows, as the entity viewer's timeline does) has none, so
130
+ * without this a SQL `date` field is read as an instant and lands a day early west of Greenwich.
131
+ * A record's own `EntityInfo` wins when it has one.
132
+ */
133
+ EntityInfo?: EntityInfo;
121
134
  /**
122
135
  * How data is provided to the timeline.
123
136
  * - `'array'`: Data is provided via the `EntityObjects` array (works with any object type)
@@ -267,6 +280,8 @@ export declare class TimelineGroup<T = any> {
267
280
  *
268
281
  * @returns The merged card configuration
269
282
  */
283
+ GetEffectiveCardConfig(): TimelineCardConfig;
284
+ /** @deprecated Use {@link GetEffectiveCardConfig}. */
270
285
  getEffectiveCardConfig(): TimelineCardConfig;
271
286
  /**
272
287
  * Extracts a field value from a record in this group.
@@ -275,6 +290,8 @@ export declare class TimelineGroup<T = any> {
275
290
  * @param fieldName - The field name to extract
276
291
  * @returns The field value
277
292
  */
293
+ GetValue(record: T, fieldName: string): unknown;
294
+ /** @deprecated Use {@link GetValue}. */
278
295
  getValue(record: T, fieldName: string): unknown;
279
296
  /**
280
297
  * Gets the ID of a record in this group.
@@ -282,6 +299,8 @@ export declare class TimelineGroup<T = any> {
282
299
  * @param record - The source record
283
300
  * @returns The record ID
284
301
  */
302
+ GetId(record: T): string;
303
+ /** @deprecated Use {@link GetId}. */
285
304
  getId(record: T): string;
286
305
  /**
287
306
  * Gets the title from a record.
@@ -289,6 +308,8 @@ export declare class TimelineGroup<T = any> {
289
308
  * @param record - The source record
290
309
  * @returns The title string
291
310
  */
311
+ GetTitle(record: T): string;
312
+ /** @deprecated Use {@link GetTitle}. */
292
313
  getTitle(record: T): string;
293
314
  /**
294
315
  * Gets the date from a record.
@@ -296,6 +317,15 @@ export declare class TimelineGroup<T = any> {
296
317
  * @param record - The source record
297
318
  * @returns The date object
298
319
  */
320
+ GetDate(record: T): Date;
321
+ /**
322
+ * Whether `DateFieldName` is a SQL `date` column (a calendar day), from the record's own entity
323
+ * metadata, else the group's {@link EntityInfo}. Entity-sourced groups load BaseEntity objects,
324
+ * which carry it; a plain object relies on the group's. With neither, the date is treated as an
325
+ * instant, as before.
326
+ */
327
+ private isDateOnlyDateField;
328
+ /** @deprecated Use {@link GetDate}. */
299
329
  getDate(record: T): Date;
300
330
  /**
301
331
  * Gets the subtitle from a record.
@@ -303,6 +333,8 @@ export declare class TimelineGroup<T = any> {
303
333
  * @param record - The source record
304
334
  * @returns The subtitle string, or undefined
305
335
  */
336
+ GetSubtitle(record: T): string | undefined;
337
+ /** @deprecated Use {@link GetSubtitle}. */
306
338
  getSubtitle(record: T): string | undefined;
307
339
  /**
308
340
  * Gets the description from a record.
@@ -310,6 +342,8 @@ export declare class TimelineGroup<T = any> {
310
342
  * @param record - The source record
311
343
  * @returns The description string, or undefined
312
344
  */
345
+ GetDescription(record: T): string | undefined;
346
+ /** @deprecated Use {@link GetDescription}. */
313
347
  getDescription(record: T): string | undefined;
314
348
  /**
315
349
  * Gets the image URL from a record.
@@ -317,6 +351,8 @@ export declare class TimelineGroup<T = any> {
317
351
  * @param record - The source record
318
352
  * @returns The image URL, or undefined
319
353
  */
354
+ GetImageUrl(record: T): string | undefined;
355
+ /** @deprecated Use {@link GetImageUrl}. */
320
356
  getImageUrl(record: T): string | undefined;
321
357
  /**
322
358
  * Gets the event configuration for a specific record.
@@ -324,6 +360,8 @@ export declare class TimelineGroup<T = any> {
324
360
  * @param record - The source record
325
361
  * @returns The event configuration (from EventConfigFunction or defaults)
326
362
  */
363
+ GetEventConfig(record: T): TimelineEventConfig;
364
+ /** @deprecated Use {@link GetEventConfig}. */
327
365
  getEventConfig(record: T): TimelineEventConfig;
328
366
  /**
329
367
  * Creates a TimelineGroup from MemberJunction RunViewParams.
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-group.d.ts","sourceRoot":"","sources":["../../src/lib/timeline-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAMjB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,G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C,GAAG,mBAAmB;IAO9C,8CAA8C;IAC9C,cAAc,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAmB;IAQ9C;;;;;;;;;;;;;;;;;;;;;;OAsBG;WACiB,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE;QAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,oEAAoE;QACpE,QAAQ,CAAC,EAAE,iBAAiB,CAAC;QAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAkC7B;;;;;;;;;;;;;;;;;OAiBG;WACW,SAAS,CAAC,CAAC,GAAG,GAAG,EAC7B,IAAI,EAAE,CAAC,EAAE,EACT,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,aAAa,CAAC,CAAC,CAAC;CAyBpB"}
@@ -7,9 +7,26 @@
7
7
  *
8
8
  * @module @memberjunction/ng-timeline/timeline-group
9
9
  */
10
- import { Metadata, RunView } from '@memberjunction/core';
10
+ import { IsDateOnlySQLType, Metadata, RunView } from '@memberjunction/core';
11
11
  import { DEFAULT_CARD_CONFIG } from './types';
12
12
  // ============================================================================
13
+ // HELPER FUNCTION - CALENDAR DAYS
14
+ // ============================================================================
15
+ /**
16
+ * A SQL `date` value re-anchored on LOCAL midnight of the day it stores.
17
+ *
18
+ * A calendar day arrives as UTC midnight. The timeline groups and labels every event with local
19
+ * getters (day, week, month, quarter, year segments and its own date formatter), which read that as
20
+ * the previous day west of Greenwich: an event dated Oct 1 fell into a "September 30" day segment
21
+ * and, on the 1st of a month, into the prior month. Carrying the day as local midnight makes every
22
+ * one of those local readings return the stored day.
23
+ */
24
+ function calendarDayAsLocalDate(date) {
25
+ if (isNaN(date.getTime()))
26
+ return date;
27
+ return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
28
+ }
29
+ // ============================================================================
13
30
  // HELPER FUNCTION - FIELD VALUE ACCESS
14
31
  // ============================================================================
15
32
  /**
@@ -33,7 +50,7 @@ import { DEFAULT_CARD_CONFIG } from './types';
33
50
  * const name = getFieldValue(obj, 'name'); // Uses obj['name']
34
51
  * ```
35
52
  */
36
- export function getFieldValue(record, fieldName) {
53
+ export function GetFieldValue(record, fieldName) {
37
54
  if (record == null) {
38
55
  return undefined;
39
56
  }
@@ -44,6 +61,10 @@ export function getFieldValue(record, fieldName) {
44
61
  // Plain object - use bracket notation
45
62
  return record[fieldName];
46
63
  }
64
+ /** @deprecated Use {@link GetFieldValue}. */
65
+ export function getFieldValue(record, fieldName) {
66
+ return GetFieldValue(record, fieldName);
67
+ }
47
68
  /**
48
69
  * Extracts an ID from a record, trying common ID field names.
49
70
  *
@@ -51,13 +72,13 @@ export function getFieldValue(record, fieldName) {
51
72
  * @param idFieldName - Optional explicit ID field name
52
73
  * @returns The record ID as a string, or a generated fallback ID
53
74
  */
54
- export function getRecordId(record, idFieldName) {
75
+ export function GetRecordId(record, idFieldName) {
55
76
  if (record == null) {
56
77
  return `generated-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
57
78
  }
58
79
  // Try explicit field name first
59
80
  if (idFieldName) {
60
- const id = getFieldValue(record, idFieldName);
81
+ const id = GetFieldValue(record, idFieldName);
61
82
  if (id != null) {
62
83
  return String(id);
63
84
  }
@@ -65,7 +86,7 @@ export function getRecordId(record, idFieldName) {
65
86
  // Try common ID field names
66
87
  const commonIdFields = ['ID', 'id', 'Id', '_id', 'uuid', 'UUID'];
67
88
  for (const field of commonIdFields) {
68
- const id = getFieldValue(record, field);
89
+ const id = GetFieldValue(record, field);
69
90
  if (id != null) {
70
91
  return String(id);
71
92
  }
@@ -73,6 +94,10 @@ export function getRecordId(record, idFieldName) {
73
94
  // Fallback: generate a unique ID
74
95
  return `generated-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
75
96
  }
97
+ /** @deprecated Use {@link GetRecordId}. */
98
+ export function getRecordId(record, idFieldName) {
99
+ return GetRecordId(record, idFieldName);
100
+ }
76
101
  // ============================================================================
77
102
  // TIMELINE GROUP CLASS
78
103
  // ============================================================================
@@ -158,6 +183,15 @@ export class TimelineGroup {
158
183
  * @example 'Tasks', 'MJ: AI Agents', 'Users'
159
184
  */
160
185
  EntityName;
186
+ /**
187
+ * Metadata for the entity this group's records come from, for records that do not carry their own.
188
+ *
189
+ * A BaseEntity record exposes `EntityInfo`, and the group reads field types from it. A plain object
190
+ * (an `'array'` group fed `simple` RunView rows, as the entity viewer's timeline does) has none, so
191
+ * without this a SQL `date` field is read as an instant and lands a day early west of Greenwich.
192
+ * A record's own `EntityInfo` wins when it has one.
193
+ */
194
+ EntityInfo;
161
195
  /**
162
196
  * How data is provided to the timeline.
163
197
  * - `'array'`: Data is provided via the `EntityObjects` array (works with any object type)
@@ -322,12 +356,16 @@ export class TimelineGroup {
322
356
  *
323
357
  * @returns The merged card configuration
324
358
  */
325
- getEffectiveCardConfig() {
359
+ GetEffectiveCardConfig() {
326
360
  return {
327
361
  ...DEFAULT_CARD_CONFIG,
328
362
  ...this.CardConfig
329
363
  };
330
364
  }
365
+ /** @deprecated Use {@link GetEffectiveCardConfig}. */
366
+ getEffectiveCardConfig() {
367
+ return this.GetEffectiveCardConfig();
368
+ }
331
369
  /**
332
370
  * Extracts a field value from a record in this group.
333
371
  *
@@ -335,8 +373,12 @@ export class TimelineGroup {
335
373
  * @param fieldName - The field name to extract
336
374
  * @returns The field value
337
375
  */
376
+ GetValue(record, fieldName) {
377
+ return GetFieldValue(record, fieldName);
378
+ }
379
+ /** @deprecated Use {@link GetValue}. */
338
380
  getValue(record, fieldName) {
339
- return getFieldValue(record, fieldName);
381
+ return this.GetValue(record, fieldName);
340
382
  }
341
383
  /**
342
384
  * Gets the ID of a record in this group.
@@ -344,8 +386,12 @@ export class TimelineGroup {
344
386
  * @param record - The source record
345
387
  * @returns The record ID
346
388
  */
389
+ GetId(record) {
390
+ return GetRecordId(record, this.IdFieldName);
391
+ }
392
+ /** @deprecated Use {@link GetId}. */
347
393
  getId(record) {
348
- return getRecordId(record, this.IdFieldName);
394
+ return this.GetId(record);
349
395
  }
350
396
  /**
351
397
  * Gets the title from a record.
@@ -353,25 +399,51 @@ export class TimelineGroup {
353
399
  * @param record - The source record
354
400
  * @returns The title string
355
401
  */
356
- getTitle(record) {
357
- const value = this.getValue(record, this.TitleFieldName);
402
+ GetTitle(record) {
403
+ const value = this.GetValue(record, this.TitleFieldName);
358
404
  return value != null ? String(value) : '';
359
405
  }
406
+ /** @deprecated Use {@link GetTitle}. */
407
+ getTitle(record) {
408
+ return this.GetTitle(record);
409
+ }
360
410
  /**
361
411
  * Gets the date from a record.
362
412
  *
363
413
  * @param record - The source record
364
414
  * @returns The date object
365
415
  */
366
- getDate(record) {
367
- const value = this.getValue(record, this.DateFieldName);
416
+ GetDate(record) {
417
+ const value = this.GetValue(record, this.DateFieldName);
418
+ let date;
368
419
  if (value instanceof Date) {
369
- return value;
420
+ date = value;
370
421
  }
371
- if (typeof value === 'string' || typeof value === 'number') {
372
- return new Date(value);
422
+ else if (typeof value === 'string' || typeof value === 'number') {
423
+ date = new Date(value);
373
424
  }
374
- return new Date();
425
+ else {
426
+ return new Date();
427
+ }
428
+ return this.isDateOnlyDateField(record) ? calendarDayAsLocalDate(date) : date;
429
+ }
430
+ /**
431
+ * Whether `DateFieldName` is a SQL `date` column (a calendar day), from the record's own entity
432
+ * metadata, else the group's {@link EntityInfo}. Entity-sourced groups load BaseEntity objects,
433
+ * which carry it; a plain object relies on the group's. With neither, the date is treated as an
434
+ * instant, as before.
435
+ */
436
+ isDateOnlyDateField(record) {
437
+ const fieldName = this.DateFieldName?.trim().toLowerCase();
438
+ if (!fieldName)
439
+ return false;
440
+ const entityInfo = record?.EntityInfo ?? this.EntityInfo;
441
+ const field = entityInfo?.Fields?.find(f => f.Name.trim().toLowerCase() === fieldName);
442
+ return IsDateOnlySQLType(field?.Type);
443
+ }
444
+ /** @deprecated Use {@link GetDate}. */
445
+ getDate(record) {
446
+ return this.GetDate(record);
375
447
  }
376
448
  /**
377
449
  * Gets the subtitle from a record.
@@ -379,57 +451,73 @@ export class TimelineGroup {
379
451
  * @param record - The source record
380
452
  * @returns The subtitle string, or undefined
381
453
  */
382
- getSubtitle(record) {
454
+ GetSubtitle(record) {
383
455
  if (!this.SubtitleFieldName) {
384
456
  return undefined;
385
457
  }
386
- const value = this.getValue(record, this.SubtitleFieldName);
458
+ const value = this.GetValue(record, this.SubtitleFieldName);
387
459
  return value != null ? String(value) : undefined;
388
460
  }
461
+ /** @deprecated Use {@link GetSubtitle}. */
462
+ getSubtitle(record) {
463
+ return this.GetSubtitle(record);
464
+ }
389
465
  /**
390
466
  * Gets the description from a record.
391
467
  *
392
468
  * @param record - The source record
393
469
  * @returns The description string, or undefined
394
470
  */
395
- getDescription(record) {
471
+ GetDescription(record) {
396
472
  // Use custom summary function if provided
397
473
  if (this.SummaryFunction) {
398
474
  return this.SummaryFunction(record);
399
475
  }
400
476
  // Use description field
401
477
  if (this.DescriptionFieldName) {
402
- const value = this.getValue(record, this.DescriptionFieldName);
478
+ const value = this.GetValue(record, this.DescriptionFieldName);
403
479
  return value != null ? String(value) : undefined;
404
480
  }
405
481
  return undefined;
406
482
  }
483
+ /** @deprecated Use {@link GetDescription}. */
484
+ getDescription(record) {
485
+ return this.GetDescription(record);
486
+ }
407
487
  /**
408
488
  * Gets the image URL from a record.
409
489
  *
410
490
  * @param record - The source record
411
491
  * @returns The image URL, or undefined
412
492
  */
413
- getImageUrl(record) {
493
+ GetImageUrl(record) {
414
494
  const fieldName = this.CardConfig?.imageField || this.ImageFieldName;
415
495
  if (!fieldName) {
416
496
  return undefined;
417
497
  }
418
- const value = this.getValue(record, fieldName);
498
+ const value = this.GetValue(record, fieldName);
419
499
  return value != null ? String(value) : undefined;
420
500
  }
501
+ /** @deprecated Use {@link GetImageUrl}. */
502
+ getImageUrl(record) {
503
+ return this.GetImageUrl(record);
504
+ }
421
505
  /**
422
506
  * Gets the event configuration for a specific record.
423
507
  *
424
508
  * @param record - The source record
425
509
  * @returns The event configuration (from EventConfigFunction or defaults)
426
510
  */
427
- getEventConfig(record) {
511
+ GetEventConfig(record) {
428
512
  if (this.EventConfigFunction) {
429
513
  return this.EventConfigFunction(record);
430
514
  }
431
515
  return {};
432
516
  }
517
+ /** @deprecated Use {@link GetEventConfig}. */
518
+ getEventConfig(record) {
519
+ return this.GetEventConfig(record);
520
+ }
433
521
  // ============================================================================
434
522
  // STATIC FACTORY METHODS
435
523
  // ============================================================================
@@ -1 +1 @@
1
- {"version":3,"file":"timeline-group.js","sourceRoot":"","sources":["../../src/lib/timeline-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAqB,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAGL,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,MAAW,EAAE,SAAiB;IAC1D,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,oDAAoD;IACpD,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;QAC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AAG,MAAM,CAAC,aAAa,CAAC;QAC/C,KAAK,CAAC,oBAAoB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACrD,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC;QACzC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QACnC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAErC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;YACjC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC;QAClC,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,KAAK,CAAC,gBAAgB,GAAG,QAAQ,CAAC;YAClC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC;QACpC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/**\n * @fileoverview TimelineGroup class for configuring timeline data sources.\n *\n * The TimelineGroup class defines how data is loaded and displayed in the timeline.\n * It supports both MemberJunction BaseEntity objects and plain JavaScript objects,\n * making it usable in any Angular application.\n *\n * @module @memberjunction/ng-timeline/timeline-group\n */\n\nimport { IMetadataProvider, Metadata, RunView } from '@memberjunction/core';\nimport {\n TimelineCardConfig,\n TimelineEventConfig,\n DEFAULT_CARD_CONFIG\n} from './types';\n\n// ============================================================================\n// HELPER FUNCTION - FIELD VALUE ACCESS\n// ============================================================================\n\n/**\n * Extracts a field value from a record, supporting both BaseEntity and plain objects.\n *\n * For BaseEntity objects (detected by presence of `.Get()` method), uses the `.Get()` method.\n * For plain JavaScript objects, uses standard bracket notation.\n *\n * @param record - The source record (BaseEntity or plain object)\n * @param fieldName - The name of the field to extract\n * @returns The field value, or undefined if not found\n *\n * @example\n * ```typescript\n * // Works with BaseEntity\n * const entity = await md.GetEntityObject<MJTaskEntity>('Tasks');\n * const name = getFieldValue(entity, 'Name'); // Uses entity.Get('Name')\n *\n * // Works with plain objects\n * const obj = { name: 'My Task', status: 'Open' };\n * const name = getFieldValue(obj, 'name'); // Uses obj['name']\n * ```\n */\nexport function getFieldValue(record: any, fieldName: string): unknown {\n if (record == null) {\n return undefined;\n }\n\n // Check if this is a BaseEntity (has .Get() method)\n if (typeof record.Get === 'function') {\n return record.Get(fieldName);\n }\n\n // Plain object - use bracket notation\n return record[fieldName];\n}\n\n/**\n * Extracts an ID from a record, trying common ID field names.\n *\n * @param record - The source record\n * @param idFieldName - Optional explicit ID field name\n * @returns The record ID as a string, or a generated fallback ID\n */\nexport function getRecordId(record: any, idFieldName?: string): string {\n if (record == null) {\n return `generated-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n }\n\n // Try explicit field name first\n if (idFieldName) {\n const id = getFieldValue(record, idFieldName);\n if (id != null) {\n return String(id);\n }\n }\n\n // Try common ID field names\n const commonIdFields = ['ID', 'id', 'Id', '_id', 'uuid', 'UUID'];\n for (const field of commonIdFields) {\n const id = getFieldValue(record, field);\n if (id != null) {\n return String(id);\n }\n }\n\n // Fallback: generate a unique ID\n return `generated-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n}\n\n// ============================================================================\n// TIMELINE GROUP CLASS\n// ============================================================================\n\n/**\n * Configures a data source for the timeline component.\n *\n * TimelineGroup defines how records are loaded, which fields to display,\n * and how they should be styled. Multiple groups can be used to display\n * different types of events on the same timeline.\n *\n * @typeParam T - The type of the source records. Defaults to `any` for maximum\n * flexibility. MemberJunction users can specify BaseEntity subclasses\n * for full type safety.\n *\n * @example Basic usage with plain objects\n * ```typescript\n * interface MyEvent {\n * id: string;\n * title: string;\n * eventDate: Date;\n * description: string;\n * }\n *\n * const group = new TimelineGroup<MyEvent>();\n * group.DataSourceType = 'array';\n * group.EntityObjects = myEventsArray;\n * group.TitleFieldName = 'title';\n * group.DateFieldName = 'eventDate';\n * group.DescriptionFieldName = 'description';\n * ```\n *\n * @example MemberJunction usage with BaseEntity\n * ```typescript\n * import { MJTaskEntity } from '@memberjunction/core-entities';\n *\n * const group = new TimelineGroup<MJTaskEntity>();\n * group.EntityName = 'Tasks';\n * group.DataSourceType = 'entity';\n * group.Filter = \"Status = 'Open'\";\n * group.TitleFieldName = 'Name';\n * group.DateFieldName = 'DueDate';\n * ```\n *\n * @example With full configuration\n * ```typescript\n * const group = new TimelineGroup<MJTaskEntity>();\n * group.EntityName = 'Tasks';\n * group.TitleFieldName = 'Name';\n * group.DateFieldName = 'CompletedAt';\n * group.SubtitleFieldName = 'Category';\n * group.DescriptionFieldName = 'Description';\n * group.DisplayIcon = 'fa-solid fa-check-circle';\n * group.DisplayColor = '#4caf50';\n * group.GroupLabel = 'Completed Tasks';\n *\n * group.CardConfig = {\n * collapsible: true,\n * defaultExpanded: false,\n * summaryFields: [\n * { fieldName: 'AssignedTo', label: 'Assignee', icon: 'fa-solid fa-user' },\n * { fieldName: 'Priority', icon: 'fa-solid fa-flag' }\n * ],\n * actions: [\n * { id: 'view', label: 'View', variant: 'primary' },\n * { id: 'edit', label: 'Edit', variant: 'secondary' }\n * ]\n * };\n *\n * group.EventConfigFunction = (task) => ({\n * icon: task.Priority === 'High' ? 'fa-solid fa-exclamation' : undefined,\n * color: task.Status === 'Overdue' ? '#f44336' : undefined\n * });\n * ```\n */\nexport class TimelineGroup<T = any> {\n // ============================================================================\n // DATA SOURCE CONFIGURATION\n // ============================================================================\n\n /**\n * The MemberJunction entity name for this group.\n * Required when `DataSourceType` is `'entity'`.\n *\n * @example 'Tasks', 'MJ: AI Agents', 'Users'\n */\n EntityName?: string;\n\n /**\n * How data is provided to the timeline.\n * - `'array'`: Data is provided via the `EntityObjects` array (works with any object type)\n * - `'entity'`: Data is loaded using MemberJunction's RunView (requires MJ core)\n *\n * @default 'entity'\n */\n DataSourceType: 'array' | 'entity' = 'entity';\n\n /**\n * SQL WHERE clause filter for entity queries.\n * Only used when `DataSourceType` is `'entity'`.\n *\n * @example \"Status = 'Open' AND Priority = 'High'\"\n */\n Filter?: string;\n\n /**\n * Pre-loaded data array.\n * Used when `DataSourceType` is `'array'`, or populated after loading when using `'entity'`.\n */\n EntityObjects: T[] = [];\n\n /**\n * SQL ORDER BY clause for entity queries.\n * Only used when `DataSourceType` is `'entity'`.\n *\n * @example 'CreatedAt DESC', 'Priority ASC, DueDate DESC'\n */\n OrderBy?: string;\n\n /**\n * Maximum number of records to load per batch.\n * Used for virtual scrolling.\n *\n * @default undefined (uses component's virtualScroll.batchSize)\n */\n MaxRecords?: number;\n\n // ============================================================================\n // FIELD MAPPINGS\n // ============================================================================\n\n /**\n * Field name for the event title.\n * This is the primary text displayed on each timeline card.\n *\n * @required\n */\n TitleFieldName!: string;\n\n /**\n * Field name for the event date.\n * Used for chronological ordering and date display.\n *\n * @required\n */\n DateFieldName!: string;\n\n /**\n * Field name for the subtitle.\n * Displayed below the title in smaller text.\n */\n SubtitleFieldName?: string;\n\n /**\n * Field name for the description/body text.\n * Displayed in the card body when expanded.\n */\n DescriptionFieldName?: string;\n\n /**\n * Field name containing an image URL.\n * When set, displays an image in the card.\n */\n ImageFieldName?: string;\n\n /**\n * Field name for the unique record ID.\n * Defaults to 'ID' or 'id' if not specified.\n */\n IdFieldName?: string;\n\n // ============================================================================\n // GROUP-LEVEL DISPLAY\n // ============================================================================\n\n /**\n * Icon display mode.\n * - `'standard'`: Uses a default icon based on the group index\n * - `'custom'`: Uses the icon specified in `DisplayIcon`\n *\n * @default 'standard'\n */\n DisplayIconMode: 'standard' | 'custom' = 'standard';\n\n /**\n * Custom icon class (Font Awesome).\n * Only used when `DisplayIconMode` is `'custom'`.\n *\n * @example 'fa-solid fa-check', 'fa-regular fa-calendar'\n */\n DisplayIcon?: string;\n\n /**\n * Color assignment mode.\n * - `'auto'`: System assigns colors based on group index\n * - `'manual'`: Uses the color specified in `DisplayColor`\n *\n * @default 'auto'\n */\n DisplayColorMode: 'auto' | 'manual' = 'auto';\n\n /**\n * Custom color for this group's markers and accents.\n * Only used when `DisplayColorMode` is `'manual'`.\n * Any valid CSS color value.\n *\n * @example '#4caf50', 'rgb(66, 135, 245)', 'var(--primary-color)'\n */\n DisplayColor?: string;\n\n /**\n * Human-readable label for this group.\n * Used in legends, headers, or when distinguishing multiple groups.\n *\n * @example 'Completed Tasks', 'System Events', 'User Activities'\n */\n GroupLabel?: string;\n\n // ============================================================================\n // CARD CONFIGURATION\n // ============================================================================\n\n /**\n * Card display configuration for this group.\n * Defines how event cards are rendered.\n * If not set, uses the component's `defaultCardConfig`.\n */\n CardConfig?: TimelineCardConfig;\n\n // ============================================================================\n // CUSTOM FUNCTIONS\n // ============================================================================\n\n /**\n * Custom function to generate the event summary/description.\n * Takes precedence over `DescriptionFieldName`.\n *\n * @param record - The source record\n * @returns HTML string or plain text to display\n *\n * @example\n * ```typescript\n * group.SummaryFunction = (task) => {\n * return `<strong>${task.Status}</strong>: ${task.Description}`;\n * };\n * ```\n */\n SummaryFunction?: (record: T) => string;\n\n /**\n * Custom function to configure individual events.\n * Allows per-event customization of icons, colors, and actions.\n *\n * @param record - The source record\n * @returns Configuration overrides for this event\n *\n * @example\n * ```typescript\n * group.EventConfigFunction = (task) => ({\n * icon: task.Priority === 'High' ? 'fa-solid fa-exclamation' : undefined,\n * color: task.IsOverdue ? '#f44336' : undefined,\n * actions: task.CanEdit ? [{ id: 'edit', label: 'Edit' }] : []\n * });\n * ```\n */\n EventConfigFunction?: (record: T) => TimelineEventConfig;\n\n // ============================================================================\n // METHODS\n // ============================================================================\n\n /**\n * Gets the effective card configuration, merging with defaults.\n *\n * @returns The merged card configuration\n */\n getEffectiveCardConfig(): TimelineCardConfig {\n return {\n ...DEFAULT_CARD_CONFIG,\n ...this.CardConfig\n };\n }\n\n /**\n * Extracts a field value from a record in this group.\n *\n * @param record - The source record\n * @param fieldName - The field name to extract\n * @returns The field value\n */\n getValue(record: T, fieldName: string): unknown {\n return getFieldValue(record, fieldName);\n }\n\n /**\n * Gets the ID of a record in this group.\n *\n * @param record - The source record\n * @returns The record ID\n */\n getId(record: T): string {\n return getRecordId(record, this.IdFieldName);\n }\n\n /**\n * Gets the title from a record.\n *\n * @param record - The source record\n * @returns The title string\n */\n getTitle(record: T): string {\n const value = this.getValue(record, this.TitleFieldName);\n return value != null ? String(value) : '';\n }\n\n /**\n * Gets the date from a record.\n *\n * @param record - The source record\n * @returns The date object\n */\n getDate(record: T): Date {\n const value = this.getValue(record, this.DateFieldName);\n if (value instanceof Date) {\n return value;\n }\n if (typeof value === 'string' || typeof value === 'number') {\n return new Date(value);\n }\n return new Date();\n }\n\n /**\n * Gets the subtitle from a record.\n *\n * @param record - The source record\n * @returns The subtitle string, or undefined\n */\n getSubtitle(record: T): string | undefined {\n if (!this.SubtitleFieldName) {\n return undefined;\n }\n const value = this.getValue(record, this.SubtitleFieldName);\n return value != null ? String(value) : undefined;\n }\n\n /**\n * Gets the description from a record.\n *\n * @param record - The source record\n * @returns The description string, or undefined\n */\n getDescription(record: T): string | undefined {\n // Use custom summary function if provided\n if (this.SummaryFunction) {\n return this.SummaryFunction(record);\n }\n\n // Use description field\n if (this.DescriptionFieldName) {\n const value = this.getValue(record, this.DescriptionFieldName);\n return value != null ? String(value) : undefined;\n }\n\n return undefined;\n }\n\n /**\n * Gets the image URL from a record.\n *\n * @param record - The source record\n * @returns The image URL, or undefined\n */\n getImageUrl(record: T): string | undefined {\n const fieldName = this.CardConfig?.imageField || this.ImageFieldName;\n if (!fieldName) {\n return undefined;\n }\n const value = this.getValue(record, fieldName);\n return value != null ? String(value) : undefined;\n }\n\n /**\n * Gets the event configuration for a specific record.\n *\n * @param record - The source record\n * @returns The event configuration (from EventConfigFunction or defaults)\n */\n getEventConfig(record: T): TimelineEventConfig {\n if (this.EventConfigFunction) {\n return this.EventConfigFunction(record);\n }\n return {};\n }\n\n // ============================================================================\n // STATIC FACTORY METHODS\n // ============================================================================\n\n /**\n * Creates a TimelineGroup from MemberJunction RunViewParams.\n *\n * This is a convenience method for MemberJunction applications.\n * It loads data immediately and returns a configured group.\n *\n * **Note**: This method requires `@memberjunction/core` to be available.\n * It will throw an error if used in non-MJ applications.\n *\n * @param params - RunView parameters for loading data\n * @returns A configured TimelineGroup with loaded data\n *\n * @example\n * ```typescript\n * const group = await TimelineGroup.FromView<MJTaskEntity>({\n * EntityName: 'Tasks',\n * ExtraFilter: \"Status = 'Open'\",\n * OrderBy: 'DueDate DESC'\n * });\n * group.TitleFieldName = 'Name';\n * group.DateFieldName = 'DueDate';\n * ```\n */\n public static async FromView<T = any>(params: {\n EntityName?: string;\n ExtraFilter?: string;\n OrderBy?: string;\n MaxRows?: number;\n /** The provider to read through. Omit to use the global default. */\n Provider?: IMetadataProvider;\n [key: string]: unknown;\n }): Promise<TimelineGroup<T>> {\n const group = new TimelineGroup<T>();\n\n try {\n // Provider-scoped, and a STATIC import: the dynamic form here hid the dependency from the\n // bundler and from readers while the package depends on @memberjunction/core regardless.\n const rv = RunView.FromMetadataProvider(params.Provider ?? Metadata.Provider);\n // `Provider` scopes the read; it is not a RunView parameter, so it must not be forwarded.\n const { Provider: _provider, ...viewFields } = params;\n const viewParams = {\n ...viewFields,\n ResultType: 'entity_object' as const\n };\n\n const result = await rv.RunView(viewParams);\n\n if (result?.Success) {\n group.EntityName = params.EntityName;\n group.EntityObjects = result.Results as T[];\n group.DataSourceType = 'array'; // Already loaded\n group.Filter = params.ExtraFilter;\n group.OrderBy = params.OrderBy;\n }\n } catch (error) {\n console.warn(\n 'TimelineGroup.FromView requires @memberjunction/core. ' +\n 'Use DataSourceType=\"array\" with EntityObjects for non-MJ applications.',\n error\n );\n }\n\n return group;\n }\n\n /**\n * Creates a TimelineGroup from a plain array of objects.\n *\n * This is a convenience method that sets up the group for array-based data.\n *\n * @param data - Array of objects to display\n * @param config - Configuration for field mappings\n * @returns A configured TimelineGroup\n *\n * @example\n * ```typescript\n * const group = TimelineGroup.FromArray(myEvents, {\n * titleField: 'name',\n * dateField: 'eventDate',\n * descriptionField: 'details'\n * });\n * ```\n */\n public static FromArray<T = any>(\n data: T[],\n config: {\n titleField: string;\n dateField: string;\n subtitleField?: string;\n descriptionField?: string;\n imageField?: string;\n idField?: string;\n groupLabel?: string;\n icon?: string;\n color?: string;\n }\n ): TimelineGroup<T> {\n const group = new TimelineGroup<T>();\n\n group.DataSourceType = 'array';\n group.EntityObjects = data;\n group.TitleFieldName = config.titleField;\n group.DateFieldName = config.dateField;\n group.SubtitleFieldName = config.subtitleField;\n group.DescriptionFieldName = config.descriptionField;\n group.ImageFieldName = config.imageField;\n group.IdFieldName = config.idField;\n group.GroupLabel = config.groupLabel;\n\n if (config.icon) {\n group.DisplayIconMode = 'custom';\n group.DisplayIcon = config.icon;\n }\n\n if (config.color) {\n group.DisplayColorMode = 'manual';\n group.DisplayColor = config.color;\n }\n\n return group;\n }\n}\n"]}
1
+ {"version":3,"file":"timeline-group.js","sourceRoot":"","sources":["../../src/lib/timeline-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAiC,iBAAiB,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAGL,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,+EAA+E;AAC/E,kCAAkC;AAClC,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,SAAS,sBAAsB,CAAC,IAAU;IACxC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,MAAW,EAAE,SAAiB;IAC1D,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAA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AG,QAAQ,CAAC;YAClC,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC;QACpC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/**\n * @fileoverview TimelineGroup class for configuring timeline data sources.\n *\n * The TimelineGroup class defines how data is loaded and displayed in the timeline.\n * It supports both MemberJunction BaseEntity objects and plain JavaScript objects,\n * making it usable in any Angular application.\n *\n * @module @memberjunction/ng-timeline/timeline-group\n */\n\nimport { EntityInfo, IMetadataProvider, IsDateOnlySQLType, Metadata, RunView } from '@memberjunction/core';\nimport {\n TimelineCardConfig,\n TimelineEventConfig,\n DEFAULT_CARD_CONFIG\n} from './types';\n\n// ============================================================================\n// HELPER FUNCTION - CALENDAR DAYS\n// ============================================================================\n\n/**\n * A SQL `date` value re-anchored on LOCAL midnight of the day it stores.\n *\n * A calendar day arrives as UTC midnight. The timeline groups and labels every event with local\n * getters (day, week, month, quarter, year segments and its own date formatter), which read that as\n * the previous day west of Greenwich: an event dated Oct 1 fell into a \"September 30\" day segment\n * and, on the 1st of a month, into the prior month. Carrying the day as local midnight makes every\n * one of those local readings return the stored day.\n */\nfunction calendarDayAsLocalDate(date: Date): Date {\n if (isNaN(date.getTime())) return date;\n return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n}\n\n// ============================================================================\n// HELPER FUNCTION - FIELD VALUE ACCESS\n// ============================================================================\n\n/**\n * Extracts a field value from a record, supporting both BaseEntity and plain objects.\n *\n * For BaseEntity objects (detected by presence of `.Get()` method), uses the `.Get()` method.\n * For plain JavaScript objects, uses standard bracket notation.\n *\n * @param record - The source record (BaseEntity or plain object)\n * @param fieldName - The name of the field to extract\n * @returns The field value, or undefined if not found\n *\n * @example\n * ```typescript\n * // Works with BaseEntity\n * const entity = await md.GetEntityObject<MJTaskEntity>('Tasks');\n * const name = getFieldValue(entity, 'Name'); // Uses entity.Get('Name')\n *\n * // Works with plain objects\n * const obj = { name: 'My Task', status: 'Open' };\n * const name = getFieldValue(obj, 'name'); // Uses obj['name']\n * ```\n */\nexport function GetFieldValue(record: any, fieldName: string): unknown {\n if (record == null) {\n return undefined;\n }\n\n // Check if this is a BaseEntity (has .Get() method)\n if (typeof record.Get === 'function') {\n return record.Get(fieldName);\n }\n\n // Plain object - use bracket notation\n return record[fieldName];\n}\n\n/** @deprecated Use {@link GetFieldValue}. */\nexport function getFieldValue(record: any, fieldName: string): unknown {\n return GetFieldValue(record, fieldName);\n}\n\n/**\n * Extracts an ID from a record, trying common ID field names.\n *\n * @param record - The source record\n * @param idFieldName - Optional explicit ID field name\n * @returns The record ID as a string, or a generated fallback ID\n */\nexport function GetRecordId(record: any, idFieldName?: string): string {\n if (record == null) {\n return `generated-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n }\n\n // Try explicit field name first\n if (idFieldName) {\n const id = GetFieldValue(record, idFieldName);\n if (id != null) {\n return String(id);\n }\n }\n\n // Try common ID field names\n const commonIdFields = ['ID', 'id', 'Id', '_id', 'uuid', 'UUID'];\n for (const field of commonIdFields) {\n const id = GetFieldValue(record, field);\n if (id != null) {\n return String(id);\n }\n }\n\n // Fallback: generate a unique ID\n return `generated-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n}\n\n/** @deprecated Use {@link GetRecordId}. */\nexport function getRecordId(record: any, idFieldName?: string): string {\n return GetRecordId(record, idFieldName);\n}\n\n// ============================================================================\n// TIMELINE GROUP CLASS\n// ============================================================================\n\n/**\n * Configures a data source for the timeline component.\n *\n * TimelineGroup defines how records are loaded, which fields to display,\n * and how they should be styled. Multiple groups can be used to display\n * different types of events on the same timeline.\n *\n * @typeParam T - The type of the source records. Defaults to `any` for maximum\n * flexibility. MemberJunction users can specify BaseEntity subclasses\n * for full type safety.\n *\n * @example Basic usage with plain objects\n * ```typescript\n * interface MyEvent {\n * id: string;\n * title: string;\n * eventDate: Date;\n * description: string;\n * }\n *\n * const group = new TimelineGroup<MyEvent>();\n * group.DataSourceType = 'array';\n * group.EntityObjects = myEventsArray;\n * group.TitleFieldName = 'title';\n * group.DateFieldName = 'eventDate';\n * group.DescriptionFieldName = 'description';\n * ```\n *\n * @example MemberJunction usage with BaseEntity\n * ```typescript\n * import { MJTaskEntity } from '@memberjunction/core-entities';\n *\n * const group = new TimelineGroup<MJTaskEntity>();\n * group.EntityName = 'Tasks';\n * group.DataSourceType = 'entity';\n * group.Filter = \"Status = 'Open'\";\n * group.TitleFieldName = 'Name';\n * group.DateFieldName = 'DueDate';\n * ```\n *\n * @example With full configuration\n * ```typescript\n * const group = new TimelineGroup<MJTaskEntity>();\n * group.EntityName = 'Tasks';\n * group.TitleFieldName = 'Name';\n * group.DateFieldName = 'CompletedAt';\n * group.SubtitleFieldName = 'Category';\n * group.DescriptionFieldName = 'Description';\n * group.DisplayIcon = 'fa-solid fa-check-circle';\n * group.DisplayColor = '#4caf50';\n * group.GroupLabel = 'Completed Tasks';\n *\n * group.CardConfig = {\n * collapsible: true,\n * defaultExpanded: false,\n * summaryFields: [\n * { fieldName: 'AssignedTo', label: 'Assignee', icon: 'fa-solid fa-user' },\n * { fieldName: 'Priority', icon: 'fa-solid fa-flag' }\n * ],\n * actions: [\n * { id: 'view', label: 'View', variant: 'primary' },\n * { id: 'edit', label: 'Edit', variant: 'secondary' }\n * ]\n * };\n *\n * group.EventConfigFunction = (task) => ({\n * icon: task.Priority === 'High' ? 'fa-solid fa-exclamation' : undefined,\n * color: task.Status === 'Overdue' ? '#f44336' : undefined\n * });\n * ```\n */\nexport class TimelineGroup<T = any> {\n // ============================================================================\n // DATA SOURCE CONFIGURATION\n // ============================================================================\n\n /**\n * The MemberJunction entity name for this group.\n * Required when `DataSourceType` is `'entity'`.\n *\n * @example 'Tasks', 'MJ: AI Agents', 'Users'\n */\n EntityName?: string;\n\n /**\n * Metadata for the entity this group's records come from, for records that do not carry their own.\n *\n * A BaseEntity record exposes `EntityInfo`, and the group reads field types from it. A plain object\n * (an `'array'` group fed `simple` RunView rows, as the entity viewer's timeline does) has none, so\n * without this a SQL `date` field is read as an instant and lands a day early west of Greenwich.\n * A record's own `EntityInfo` wins when it has one.\n */\n EntityInfo?: EntityInfo;\n\n /**\n * How data is provided to the timeline.\n * - `'array'`: Data is provided via the `EntityObjects` array (works with any object type)\n * - `'entity'`: Data is loaded using MemberJunction's RunView (requires MJ core)\n *\n * @default 'entity'\n */\n DataSourceType: 'array' | 'entity' = 'entity';\n\n /**\n * SQL WHERE clause filter for entity queries.\n * Only used when `DataSourceType` is `'entity'`.\n *\n * @example \"Status = 'Open' AND Priority = 'High'\"\n */\n Filter?: string;\n\n /**\n * Pre-loaded data array.\n * Used when `DataSourceType` is `'array'`, or populated after loading when using `'entity'`.\n */\n EntityObjects: T[] = [];\n\n /**\n * SQL ORDER BY clause for entity queries.\n * Only used when `DataSourceType` is `'entity'`.\n *\n * @example 'CreatedAt DESC', 'Priority ASC, DueDate DESC'\n */\n OrderBy?: string;\n\n /**\n * Maximum number of records to load per batch.\n * Used for virtual scrolling.\n *\n * @default undefined (uses component's virtualScroll.batchSize)\n */\n MaxRecords?: number;\n\n // ============================================================================\n // FIELD MAPPINGS\n // ============================================================================\n\n /**\n * Field name for the event title.\n * This is the primary text displayed on each timeline card.\n *\n * @required\n */\n TitleFieldName!: string;\n\n /**\n * Field name for the event date.\n * Used for chronological ordering and date display.\n *\n * @required\n */\n DateFieldName!: string;\n\n /**\n * Field name for the subtitle.\n * Displayed below the title in smaller text.\n */\n SubtitleFieldName?: string;\n\n /**\n * Field name for the description/body text.\n * Displayed in the card body when expanded.\n */\n DescriptionFieldName?: string;\n\n /**\n * Field name containing an image URL.\n * When set, displays an image in the card.\n */\n ImageFieldName?: string;\n\n /**\n * Field name for the unique record ID.\n * Defaults to 'ID' or 'id' if not specified.\n */\n IdFieldName?: string;\n\n // ============================================================================\n // GROUP-LEVEL DISPLAY\n // ============================================================================\n\n /**\n * Icon display mode.\n * - `'standard'`: Uses a default icon based on the group index\n * - `'custom'`: Uses the icon specified in `DisplayIcon`\n *\n * @default 'standard'\n */\n DisplayIconMode: 'standard' | 'custom' = 'standard';\n\n /**\n * Custom icon class (Font Awesome).\n * Only used when `DisplayIconMode` is `'custom'`.\n *\n * @example 'fa-solid fa-check', 'fa-regular fa-calendar'\n */\n DisplayIcon?: string;\n\n /**\n * Color assignment mode.\n * - `'auto'`: System assigns colors based on group index\n * - `'manual'`: Uses the color specified in `DisplayColor`\n *\n * @default 'auto'\n */\n DisplayColorMode: 'auto' | 'manual' = 'auto';\n\n /**\n * Custom color for this group's markers and accents.\n * Only used when `DisplayColorMode` is `'manual'`.\n * Any valid CSS color value.\n *\n * @example '#4caf50', 'rgb(66, 135, 245)', 'var(--primary-color)'\n */\n DisplayColor?: string;\n\n /**\n * Human-readable label for this group.\n * Used in legends, headers, or when distinguishing multiple groups.\n *\n * @example 'Completed Tasks', 'System Events', 'User Activities'\n */\n GroupLabel?: string;\n\n // ============================================================================\n // CARD CONFIGURATION\n // ============================================================================\n\n /**\n * Card display configuration for this group.\n * Defines how event cards are rendered.\n * If not set, uses the component's `defaultCardConfig`.\n */\n CardConfig?: TimelineCardConfig;\n\n // ============================================================================\n // CUSTOM FUNCTIONS\n // ============================================================================\n\n /**\n * Custom function to generate the event summary/description.\n * Takes precedence over `DescriptionFieldName`.\n *\n * @param record - The source record\n * @returns HTML string or plain text to display\n *\n * @example\n * ```typescript\n * group.SummaryFunction = (task) => {\n * return `<strong>${task.Status}</strong>: ${task.Description}`;\n * };\n * ```\n */\n SummaryFunction?: (record: T) => string;\n\n /**\n * Custom function to configure individual events.\n * Allows per-event customization of icons, colors, and actions.\n *\n * @param record - The source record\n * @returns Configuration overrides for this event\n *\n * @example\n * ```typescript\n * group.EventConfigFunction = (task) => ({\n * icon: task.Priority === 'High' ? 'fa-solid fa-exclamation' : undefined,\n * color: task.IsOverdue ? '#f44336' : undefined,\n * actions: task.CanEdit ? [{ id: 'edit', label: 'Edit' }] : []\n * });\n * ```\n */\n EventConfigFunction?: (record: T) => TimelineEventConfig;\n\n // ============================================================================\n // METHODS\n // ============================================================================\n\n /**\n * Gets the effective card configuration, merging with defaults.\n *\n * @returns The merged card configuration\n */\n GetEffectiveCardConfig(): TimelineCardConfig {\n return {\n ...DEFAULT_CARD_CONFIG,\n ...this.CardConfig\n };\n }\n\n /** @deprecated Use {@link GetEffectiveCardConfig}. */\n getEffectiveCardConfig(): TimelineCardConfig {\n return this.GetEffectiveCardConfig();\n }\n\n /**\n * Extracts a field value from a record in this group.\n *\n * @param record - The source record\n * @param fieldName - The field name to extract\n * @returns The field value\n */\n GetValue(record: T, fieldName: string): unknown {\n return GetFieldValue(record, fieldName);\n }\n\n /** @deprecated Use {@link GetValue}. */\n getValue(record: T, fieldName: string): unknown {\n return this.GetValue(record, fieldName);\n }\n\n /**\n * Gets the ID of a record in this group.\n *\n * @param record - The source record\n * @returns The record ID\n */\n GetId(record: T): string {\n return GetRecordId(record, this.IdFieldName);\n }\n\n /** @deprecated Use {@link GetId}. */\n getId(record: T): string {\n return this.GetId(record);\n }\n\n /**\n * Gets the title from a record.\n *\n * @param record - The source record\n * @returns The title string\n */\n GetTitle(record: T): string {\n const value = this.GetValue(record, this.TitleFieldName);\n return value != null ? String(value) : '';\n }\n\n /** @deprecated Use {@link GetTitle}. */\n getTitle(record: T): string {\n return this.GetTitle(record);\n }\n\n /**\n * Gets the date from a record.\n *\n * @param record - The source record\n * @returns The date object\n */\n GetDate(record: T): Date {\n const value = this.GetValue(record, this.DateFieldName);\n let date: Date;\n if (value instanceof Date) {\n date = value;\n } else if (typeof value === 'string' || typeof value === 'number') {\n date = new Date(value);\n } else {\n return new Date();\n }\n return this.isDateOnlyDateField(record) ? calendarDayAsLocalDate(date) : date;\n }\n\n /**\n * Whether `DateFieldName` is a SQL `date` column (a calendar day), from the record's own entity\n * metadata, else the group's {@link EntityInfo}. Entity-sourced groups load BaseEntity objects,\n * which carry it; a plain object relies on the group's. With neither, the date is treated as an\n * instant, as before.\n */\n private isDateOnlyDateField(record: T): boolean {\n const fieldName = this.DateFieldName?.trim().toLowerCase();\n if (!fieldName) return false;\n const entityInfo = (record as { EntityInfo?: EntityInfo } | null)?.EntityInfo ?? this.EntityInfo;\n const field = entityInfo?.Fields?.find(f => f.Name.trim().toLowerCase() === fieldName);\n return IsDateOnlySQLType(field?.Type);\n }\n\n /** @deprecated Use {@link GetDate}. */\n getDate(record: T): Date {\n return this.GetDate(record);\n }\n\n /**\n * Gets the subtitle from a record.\n *\n * @param record - The source record\n * @returns The subtitle string, or undefined\n */\n GetSubtitle(record: T): string | undefined {\n if (!this.SubtitleFieldName) {\n return undefined;\n }\n const value = this.GetValue(record, this.SubtitleFieldName);\n return value != null ? String(value) : undefined;\n }\n\n /** @deprecated Use {@link GetSubtitle}. */\n getSubtitle(record: T): string | undefined {\n return this.GetSubtitle(record);\n }\n\n /**\n * Gets the description from a record.\n *\n * @param record - The source record\n * @returns The description string, or undefined\n */\n GetDescription(record: T): string | undefined {\n // Use custom summary function if provided\n if (this.SummaryFunction) {\n return this.SummaryFunction(record);\n }\n\n // Use description field\n if (this.DescriptionFieldName) {\n const value = this.GetValue(record, this.DescriptionFieldName);\n return value != null ? String(value) : undefined;\n }\n\n return undefined;\n }\n\n /** @deprecated Use {@link GetDescription}. */\n getDescription(record: T): string | undefined {\n return this.GetDescription(record);\n }\n\n /**\n * Gets the image URL from a record.\n *\n * @param record - The source record\n * @returns The image URL, or undefined\n */\n GetImageUrl(record: T): string | undefined {\n const fieldName = this.CardConfig?.imageField || this.ImageFieldName;\n if (!fieldName) {\n return undefined;\n }\n const value = this.GetValue(record, fieldName);\n return value != null ? String(value) : undefined;\n }\n\n /** @deprecated Use {@link GetImageUrl}. */\n getImageUrl(record: T): string | undefined {\n return this.GetImageUrl(record);\n }\n\n /**\n * Gets the event configuration for a specific record.\n *\n * @param record - The source record\n * @returns The event configuration (from EventConfigFunction or defaults)\n */\n GetEventConfig(record: T): TimelineEventConfig {\n if (this.EventConfigFunction) {\n return this.EventConfigFunction(record);\n }\n return {};\n }\n\n /** @deprecated Use {@link GetEventConfig}. */\n getEventConfig(record: T): TimelineEventConfig {\n return this.GetEventConfig(record);\n }\n\n // ============================================================================\n // STATIC FACTORY METHODS\n // ============================================================================\n\n /**\n * Creates a TimelineGroup from MemberJunction RunViewParams.\n *\n * This is a convenience method for MemberJunction applications.\n * It loads data immediately and returns a configured group.\n *\n * **Note**: This method requires `@memberjunction/core` to be available.\n * It will throw an error if used in non-MJ applications.\n *\n * @param params - RunView parameters for loading data\n * @returns A configured TimelineGroup with loaded data\n *\n * @example\n * ```typescript\n * const group = await TimelineGroup.FromView<MJTaskEntity>({\n * EntityName: 'Tasks',\n * ExtraFilter: \"Status = 'Open'\",\n * OrderBy: 'DueDate DESC'\n * });\n * group.TitleFieldName = 'Name';\n * group.DateFieldName = 'DueDate';\n * ```\n */\n public static async FromView<T = any>(params: {\n EntityName?: string;\n ExtraFilter?: string;\n OrderBy?: string;\n MaxRows?: number;\n /** The provider to read through. Omit to use the global default. */\n Provider?: IMetadataProvider;\n [key: string]: unknown;\n }): Promise<TimelineGroup<T>> {\n const group = new TimelineGroup<T>();\n\n try {\n // Provider-scoped, and a STATIC import: the dynamic form here hid the dependency from the\n // bundler and from readers while the package depends on @memberjunction/core regardless.\n const rv = RunView.FromMetadataProvider(params.Provider ?? Metadata.Provider);\n // `Provider` scopes the read; it is not a RunView parameter, so it must not be forwarded.\n const { Provider: _provider, ...viewFields } = params;\n const viewParams = {\n ...viewFields,\n ResultType: 'entity_object' as const\n };\n\n const result = await rv.RunView(viewParams);\n\n if (result?.Success) {\n group.EntityName = params.EntityName;\n group.EntityObjects = result.Results as T[];\n group.DataSourceType = 'array'; // Already loaded\n group.Filter = params.ExtraFilter;\n group.OrderBy = params.OrderBy;\n }\n } catch (error) {\n console.warn(\n 'TimelineGroup.FromView requires @memberjunction/core. ' +\n 'Use DataSourceType=\"array\" with EntityObjects for non-MJ applications.',\n error\n );\n }\n\n return group;\n }\n\n /**\n * Creates a TimelineGroup from a plain array of objects.\n *\n * This is a convenience method that sets up the group for array-based data.\n *\n * @param data - Array of objects to display\n * @param config - Configuration for field mappings\n * @returns A configured TimelineGroup\n *\n * @example\n * ```typescript\n * const group = TimelineGroup.FromArray(myEvents, {\n * titleField: 'name',\n * dateField: 'eventDate',\n * descriptionField: 'details'\n * });\n * ```\n */\n public static FromArray<T = any>(\n data: T[],\n config: {\n titleField: string;\n dateField: string;\n subtitleField?: string;\n descriptionField?: string;\n imageField?: string;\n idField?: string;\n groupLabel?: string;\n icon?: string;\n color?: string;\n }\n ): TimelineGroup<T> {\n const group = new TimelineGroup<T>();\n\n group.DataSourceType = 'array';\n group.EntityObjects = data;\n group.TitleFieldName = config.titleField;\n group.DateFieldName = config.dateField;\n group.SubtitleFieldName = config.subtitleField;\n group.DescriptionFieldName = config.descriptionField;\n group.ImageFieldName = config.imageField;\n group.IdFieldName = config.idField;\n group.GroupLabel = config.groupLabel;\n\n if (config.icon) {\n group.DisplayIconMode = 'custom';\n group.DisplayIcon = config.icon;\n }\n\n if (config.color) {\n group.DisplayColorMode = 'manual';\n group.DisplayColor = config.color;\n }\n\n return group;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-timeline",
3
- "version": "6.2.0-edge.0",
3
+ "version": "6.2.0-edge.2",
4
4
  "description": "MemberJunction: Responsive timeline component for Angular. Works with MemberJunction entities or plain JavaScript objects. No external dependencies.",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -20,7 +20,7 @@
20
20
  "devDependencies": {
21
21
  "@angular/compiler": "21.2.22",
22
22
  "@angular/compiler-cli": "21.2.22",
23
- "@memberjunction/ng-test-utils": "6.2.0-edge.0",
23
+ "@memberjunction/ng-test-utils": "6.2.0-edge.2",
24
24
  "vitest": "^4.0.18"
25
25
  },
26
26
  "peerDependencies": {
@@ -33,9 +33,9 @@
33
33
  }
34
34
  },
35
35
  "dependencies": {
36
- "@memberjunction/ng-base-types": "6.2.0-edge.0",
37
- "@memberjunction/ng-ui-components": "6.2.0-edge.0",
38
- "@memberjunction/core": "6.2.0-edge.0",
36
+ "@memberjunction/ng-base-types": "6.2.0-edge.2",
37
+ "@memberjunction/ng-ui-components": "6.2.0-edge.2",
38
+ "@memberjunction/core": "6.2.0-edge.2",
39
39
  "rxjs": "~7.8.2",
40
40
  "tslib": "^2.8.1"
41
41
  },