@acorex/connectivity 19.3.0-next.2 → 19.3.0-next.3
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.
@@ -10,7 +10,7 @@ import * as i0 from '@angular/core';
|
|
10
10
|
import { inject, Injectable, NgModule } from '@angular/core';
|
11
11
|
import { applySortArray, applyFilterArray, AXPDataGenerator as AXPDataGenerator$1 } from '@acorex/platform/core';
|
12
12
|
import Dexie from 'dexie';
|
13
|
-
import { AXPBarChartWidget, AXPClockCalendarWidget, AXPWeatherWidget, AXPStickyNoteWidget, AXPDonutChartWidget, AXPGaugeChartWidget } from '@acorex/platform/widgets';
|
13
|
+
import { AXPBarChartWidget, AXPClockCalendarWidget, AXPWeatherWidget, AXPStickyNoteWidget, AXPNotificationWidget, AXPDonutChartWidget, AXPGaugeChartWidget, AXPTaskListWidget } from '@acorex/platform/widgets';
|
14
14
|
import { RootConfig } from '@acorex/modules/common';
|
15
15
|
import * as i1 from '@acorex/modules/conversation';
|
16
16
|
import { AXMConverstionModuleConst, AXMChatServiceImpl, AXMCommentServiceImpl, AXMChatModule, AXMChatService } from '@acorex/modules/conversation';
|
@@ -374,7 +374,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
|
|
374
374
|
}] });
|
375
375
|
|
376
376
|
// Widget types that can be used for generating mock data
|
377
|
-
const widgetTypes = [
|
377
|
+
const widgetTypes = [
|
378
|
+
'bar-chart',
|
379
|
+
'donut-chart',
|
380
|
+
'gauge-chart',
|
381
|
+
'map',
|
382
|
+
'clock-calendar',
|
383
|
+
'weather',
|
384
|
+
'sticky-note',
|
385
|
+
'notification',
|
386
|
+
'task-list',
|
387
|
+
];
|
378
388
|
// Generate bar chart widget
|
379
389
|
function generateBarChartWidget() {
|
380
390
|
const uniqueId = AXPDataGenerator$1.alphabet(3).toUpperCase();
|
@@ -398,7 +408,7 @@ function generateBarChartWidget() {
|
|
398
408
|
width: 600,
|
399
409
|
height: 400,
|
400
410
|
color: ['red', 'yellow', 'blue'],
|
401
|
-
|
411
|
+
hasConfiguration: true,
|
402
412
|
},
|
403
413
|
},
|
404
414
|
};
|
@@ -426,7 +436,7 @@ function generateClockCalendarWidget() {
|
|
426
436
|
accentColor: AXPDataGenerator$1.color(),
|
427
437
|
}),
|
428
438
|
options: {
|
429
|
-
|
439
|
+
hasConfiguration: true,
|
430
440
|
},
|
431
441
|
},
|
432
442
|
};
|
@@ -445,7 +455,7 @@ function generateWeatherWidget() {
|
|
445
455
|
type: 'weather',
|
446
456
|
options: {
|
447
457
|
city: AXPDataGenerator$1.city(),
|
448
|
-
|
458
|
+
hasConfiguration: true,
|
449
459
|
},
|
450
460
|
meta: {
|
451
461
|
...AXPWeatherWidget.meta,
|
@@ -468,7 +478,100 @@ function generateStickyNoteWidget() {
|
|
468
478
|
defaultValue: `Note from ${AXPDataGenerator$1.firstName()} ${AXPDataGenerator$1.lastName()}:
|
469
479
|
Remember to complete the ${AXPDataGenerator$1.pick(['project', 'task', 'meeting', 'report'])} by end of day.`,
|
470
480
|
options: {
|
471
|
-
|
481
|
+
hasConfiguration: false,
|
482
|
+
},
|
483
|
+
},
|
484
|
+
};
|
485
|
+
}
|
486
|
+
// Generate notification widget
|
487
|
+
function generateNotificationWidget() {
|
488
|
+
const uniqueId = AXPDataGenerator$1.alphabet(3).toUpperCase();
|
489
|
+
// Generate 3-8 random notifications
|
490
|
+
const notifications = Array.from({ length: AXPDataGenerator$1.number(3, 8) }).map((_, index) => {
|
491
|
+
const firstName = AXPDataGenerator$1.firstName();
|
492
|
+
const lastName = AXPDataGenerator$1.lastName();
|
493
|
+
// Select a random notification type
|
494
|
+
const type = AXPDataGenerator$1.pick(['File', 'Person', 'Notification']);
|
495
|
+
// Select a random notification priority
|
496
|
+
const priority = AXPDataGenerator$1.pick(['Warning', 'Danger', 'Notice']);
|
497
|
+
// Create message based on type
|
498
|
+
let message = '';
|
499
|
+
switch (type) {
|
500
|
+
case 'File':
|
501
|
+
message = `New document "${AXPDataGenerator$1.alphabet(AXPDataGenerator$1.number(5, 20))}.${AXPDataGenerator$1.pick([
|
502
|
+
'pdf',
|
503
|
+
'docx',
|
504
|
+
'xlsx',
|
505
|
+
])}" has been shared with you`;
|
506
|
+
break;
|
507
|
+
case 'Person':
|
508
|
+
message = `${firstName} ${lastName} ${AXPDataGenerator$1.pick([
|
509
|
+
'sent you a message',
|
510
|
+
'mentioned you in a comment',
|
511
|
+
'added you to a project',
|
512
|
+
'requested your feedback',
|
513
|
+
])}`;
|
514
|
+
break;
|
515
|
+
case 'Notification':
|
516
|
+
message = AXPDataGenerator$1.pick([
|
517
|
+
'Your task is due tomorrow',
|
518
|
+
'Meeting starts in 15 minutes',
|
519
|
+
'Your report has been approved',
|
520
|
+
'Project status has been updated',
|
521
|
+
'New announcement from the team',
|
522
|
+
]);
|
523
|
+
break;
|
524
|
+
}
|
525
|
+
// Create a random timestamp within the last week
|
526
|
+
const now = new Date();
|
527
|
+
const weekAgo = new Date();
|
528
|
+
weekAgo.setDate(now.getDate() - 7);
|
529
|
+
const timestamp = AXPDataGenerator$1.date(weekAgo, now);
|
530
|
+
// Make some notifications read and some unread
|
531
|
+
const isRead = index < 2 ? false : AXPDataGenerator$1.boolean();
|
532
|
+
return {
|
533
|
+
id: AXPDataGenerator$1.uuid(),
|
534
|
+
title: `${firstName} ${lastName}`,
|
535
|
+
body: message,
|
536
|
+
channel: 'InApp',
|
537
|
+
content: {
|
538
|
+
type,
|
539
|
+
data: {},
|
540
|
+
},
|
541
|
+
user: {
|
542
|
+
id: AXPDataGenerator$1.uuid(),
|
543
|
+
name: `${firstName} ${lastName}`,
|
544
|
+
// image: `assets/images/avatar/user-${AXPDataGenerator.number(1, 12)}.png`,
|
545
|
+
image: `https://picsum.photos/300/300`,
|
546
|
+
},
|
547
|
+
template: {
|
548
|
+
category: 'Inbox',
|
549
|
+
priority,
|
550
|
+
icon: `fa-light fa-${AXPDataGenerator$1.pick(['envelope', 'bell', 'file', 'user', 'calendar'])}`,
|
551
|
+
isPinned: AXPDataGenerator$1.boolean(),
|
552
|
+
},
|
553
|
+
readAt: isRead ? AXPDataGenerator$1.date(weekAgo, timestamp) : null,
|
554
|
+
createdAt: timestamp,
|
555
|
+
};
|
556
|
+
});
|
557
|
+
return {
|
558
|
+
config: {
|
559
|
+
id: AXPDataGenerator$1.uuid(),
|
560
|
+
...AXPNotificationWidget?.meta?.['dimensions'],
|
561
|
+
},
|
562
|
+
node: {
|
563
|
+
name: `notification-${uniqueId}`,
|
564
|
+
path: 'notification',
|
565
|
+
type: 'notification',
|
566
|
+
defaultValue: {
|
567
|
+
data: notifications,
|
568
|
+
total: notifications.length,
|
569
|
+
},
|
570
|
+
options: {
|
571
|
+
maxItems: 10,
|
572
|
+
showAvatar: true,
|
573
|
+
showTimestamp: true,
|
574
|
+
hasConfiguration: true,
|
472
575
|
},
|
473
576
|
},
|
474
577
|
};
|
@@ -498,7 +601,7 @@ function generateDonutChartWidget() {
|
|
498
601
|
showTooltip: true,
|
499
602
|
showPercentage: true,
|
500
603
|
showValue: true,
|
501
|
-
|
604
|
+
hasConfiguration: true,
|
502
605
|
},
|
503
606
|
},
|
504
607
|
};
|
@@ -527,17 +630,140 @@ function generateGaugeChartWidget() {
|
|
527
630
|
},
|
528
631
|
};
|
529
632
|
}
|
633
|
+
// Generate task list widget
|
634
|
+
function generateTaskListWidget() {
|
635
|
+
const uniqueId = AXPDataGenerator$1.alphabet(3).toUpperCase();
|
636
|
+
// Generate 5-12 random tasks
|
637
|
+
const tasks = Array.from({ length: AXPDataGenerator$1.number(5, 12) }).map((_, index) => {
|
638
|
+
// Generate random due date between yesterday and next month
|
639
|
+
const yesterday = new Date();
|
640
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
641
|
+
const nextMonth = new Date();
|
642
|
+
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
643
|
+
const dueDate = AXPDataGenerator$1.date(yesterday, nextMonth);
|
644
|
+
// Generate random task data
|
645
|
+
const firstName = AXPDataGenerator$1.firstName();
|
646
|
+
const lastName = AXPDataGenerator$1.lastName();
|
647
|
+
// Random priority
|
648
|
+
const priority = AXPDataGenerator$1.pick(['low', 'medium', 'high']);
|
649
|
+
// Random category
|
650
|
+
const category = AXPDataGenerator$1.pick([
|
651
|
+
'Development',
|
652
|
+
'Design',
|
653
|
+
'Marketing',
|
654
|
+
'Meeting',
|
655
|
+
'Research',
|
656
|
+
'Planning',
|
657
|
+
'Documentation',
|
658
|
+
]);
|
659
|
+
// Generate sample data for second person in a meeting task
|
660
|
+
const secondPersonFirstName = AXPDataGenerator$1.firstName();
|
661
|
+
const secondPersonLastName = AXPDataGenerator$1.lastName();
|
662
|
+
// Random task title
|
663
|
+
const taskTitle = AXPDataGenerator$1.pick([
|
664
|
+
`${AXPDataGenerator$1.pick(['Create', 'Update', 'Fix', 'Review', 'Finalize'])} ${AXPDataGenerator$1.pick([
|
665
|
+
'dashboard',
|
666
|
+
'report',
|
667
|
+
'component',
|
668
|
+
'feature',
|
669
|
+
'documentation',
|
670
|
+
'presentation',
|
671
|
+
])}`,
|
672
|
+
`${AXPDataGenerator$1.pick([
|
673
|
+
'Prepare',
|
674
|
+
'Schedule',
|
675
|
+
'Attend',
|
676
|
+
'Summarize',
|
677
|
+
])} meeting with ${secondPersonFirstName} ${secondPersonLastName}`,
|
678
|
+
`${AXPDataGenerator$1.pick(['Research', 'Analyze', 'Document'])} ${AXPDataGenerator$1.pick([
|
679
|
+
'market trends',
|
680
|
+
'user feedback',
|
681
|
+
'competitor features',
|
682
|
+
'new technology',
|
683
|
+
])}`,
|
684
|
+
`${AXPDataGenerator$1.pick(['Deploy', 'Test', 'Debug'])} ${AXPDataGenerator$1.pick([
|
685
|
+
'application',
|
686
|
+
'feature',
|
687
|
+
'hotfix',
|
688
|
+
'release',
|
689
|
+
])}`,
|
690
|
+
`${AXPDataGenerator$1.pick(['Contact', 'Follow up with', 'Email'])} ${firstName} about ${AXPDataGenerator$1.pick([
|
691
|
+
'project status',
|
692
|
+
'contract',
|
693
|
+
'feedback',
|
694
|
+
'requirements',
|
695
|
+
])}`,
|
696
|
+
]);
|
697
|
+
// Calculate days difference for due date
|
698
|
+
const today = new Date();
|
699
|
+
today.setHours(0, 0, 0, 0);
|
700
|
+
const dueDateCopy = new Date(dueDate);
|
701
|
+
dueDateCopy.setHours(0, 0, 0, 0);
|
702
|
+
const diffTime = dueDateCopy.getTime() - today.getTime();
|
703
|
+
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
704
|
+
// Task is completed if it's in the past 30% of the time
|
705
|
+
const isCompleted = diffDays < 0 ? Math.random() < 0.8 : Math.random() < 0.3;
|
706
|
+
return {
|
707
|
+
id: AXPDataGenerator$1.uuid(),
|
708
|
+
title: taskTitle,
|
709
|
+
completed: isCompleted,
|
710
|
+
priority: priority,
|
711
|
+
dueDate: dueDate,
|
712
|
+
category: category,
|
713
|
+
assignedTo: {
|
714
|
+
id: AXPDataGenerator$1.uuid(),
|
715
|
+
name: `${firstName} ${lastName}`,
|
716
|
+
image: Math.random() < 0.3 ? `https://i.pravatar.cc/150?u=${AXPDataGenerator$1.uuid()}` : undefined,
|
717
|
+
},
|
718
|
+
createdAt: AXPDataGenerator$1.date(new Date(new Date().setDate(new Date().getDate() - 30)), new Date()),
|
719
|
+
};
|
720
|
+
});
|
721
|
+
return {
|
722
|
+
config: {
|
723
|
+
id: AXPDataGenerator$1.uuid(),
|
724
|
+
...AXPTaskListWidget?.meta?.['dimensions'],
|
725
|
+
},
|
726
|
+
node: {
|
727
|
+
name: `task-list-${uniqueId}`,
|
728
|
+
path: 'task-list',
|
729
|
+
type: 'task-list',
|
730
|
+
defaultValue: {
|
731
|
+
data: tasks,
|
732
|
+
},
|
733
|
+
options: {
|
734
|
+
maxItems: 10,
|
735
|
+
showDate: true,
|
736
|
+
showAssignee: true,
|
737
|
+
groupByCategory: AXPDataGenerator$1.boolean(),
|
738
|
+
showPriority: AXPDataGenerator$1.boolean(),
|
739
|
+
allowMarkComplete: true,
|
740
|
+
hasConfiguration: true,
|
741
|
+
},
|
742
|
+
},
|
743
|
+
};
|
744
|
+
}
|
530
745
|
// Widget generator factory
|
531
746
|
function getWidgetGenerator(type) {
|
532
|
-
|
533
|
-
'bar-chart':
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
'
|
538
|
-
|
539
|
-
|
540
|
-
|
747
|
+
switch (type) {
|
748
|
+
case 'bar-chart':
|
749
|
+
return generateBarChartWidget;
|
750
|
+
case 'donut-chart':
|
751
|
+
return generateDonutChartWidget;
|
752
|
+
case 'gauge-chart':
|
753
|
+
return generateGaugeChartWidget;
|
754
|
+
case 'clock-calendar':
|
755
|
+
return generateClockCalendarWidget;
|
756
|
+
case 'weather':
|
757
|
+
return generateWeatherWidget;
|
758
|
+
case 'sticky-note':
|
759
|
+
return generateStickyNoteWidget;
|
760
|
+
case 'notification':
|
761
|
+
return generateNotificationWidget;
|
762
|
+
case 'task-list':
|
763
|
+
return generateTaskListWidget;
|
764
|
+
default:
|
765
|
+
return generateBarChartWidget;
|
766
|
+
}
|
541
767
|
}
|
542
768
|
// Generate a random dashboard widget
|
543
769
|
function generateRandomWidget() {
|