cyc-type-def 4.0.0 → 5.0.1

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/dist/index.cjs CHANGED
@@ -46,6 +46,8 @@ __export(index_exports, {
46
46
  SmallTeam: () => SmallTeam,
47
47
  Title: () => Title,
48
48
  TitleAttendance: () => TitleAttendance,
49
+ cgNum: () => cgNum,
50
+ compareCG: () => compareCG,
49
51
  formatDateDDMMYY: () => formatDateDDMMYY,
50
52
  isDateInRangeIgnoreYear: () => isDateInRangeIgnoreYear,
51
53
  monthStr: () => monthStr,
@@ -603,6 +605,16 @@ var MsjJoinStatusInfo = {
603
605
  }
604
606
  };
605
607
 
608
+ // src/util/common.util.ts
609
+ function cgNum(cgName) {
610
+ var num = cgName.match(/\d+/g);
611
+ if (num) {
612
+ return parseInt(num[0]);
613
+ } else {
614
+ return 0;
615
+ }
616
+ }
617
+
606
618
  // src/util/date.util.ts
607
619
  function formatDateDDMMYY(date) {
608
620
  const day = String(date.getDate()).padStart(2, "0");
@@ -637,6 +649,12 @@ function yearStr(timestamp) {
637
649
  function monthStr(timestamp) {
638
650
  return new Date(timestamp).toLocaleString("default", { month: "long" });
639
651
  }
652
+
653
+ // src/util/sort.util.ts
654
+ function compareCG(a, b) {
655
+ let v = cgNum(a.name) - cgNum(b.name);
656
+ return v;
657
+ }
640
658
  // Annotate the CommonJS export names for ESM import in node:
641
659
  0 && (module.exports = {
642
660
  AppUser,
@@ -665,6 +683,8 @@ function monthStr(timestamp) {
665
683
  SmallTeam,
666
684
  Title,
667
685
  TitleAttendance,
686
+ cgNum,
687
+ compareCG,
668
688
  formatDateDDMMYY,
669
689
  isDateInRangeIgnoreYear,
670
690
  monthStr,
package/dist/index.d.cts CHANGED
@@ -190,6 +190,10 @@ interface Attendance extends Title {
190
190
  idSt: string;
191
191
  idCluster: string;
192
192
  timestamp: number;
193
+ /**
194
+ * time taken to fill in attendance (in seconds)
195
+ */
196
+ timeTaken?: number;
193
197
  arrSessionAttendance: SessionAttendance[];
194
198
  }
195
199
  /**
@@ -529,6 +533,8 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
529
533
  short: string;
530
534
  }>;
531
535
 
536
+ declare function cgNum(cgName: string): number;
537
+
532
538
  declare function formatDateDDMMYY(date: Date): string;
533
539
  declare function parseYYMMDD(str: string): Date;
534
540
  /**
@@ -540,4 +546,6 @@ declare function isDateInRangeIgnoreYear(d: Date, start: Date, end: Date): boole
540
546
  declare function yearStr(timestamp: number): string;
541
547
  declare function monthStr(timestamp: number): string;
542
548
 
543
- export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance, formatDateDDMMYY, isDateInRangeIgnoreYear, monthStr, parseYYMMDD, yearStr };
549
+ declare function compareCG(a: CG, b: CG): number;
550
+
551
+ export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance, cgNum, compareCG, formatDateDDMMYY, isDateInRangeIgnoreYear, monthStr, parseYYMMDD, yearStr };
package/dist/index.d.ts CHANGED
@@ -190,6 +190,10 @@ interface Attendance extends Title {
190
190
  idSt: string;
191
191
  idCluster: string;
192
192
  timestamp: number;
193
+ /**
194
+ * time taken to fill in attendance (in seconds)
195
+ */
196
+ timeTaken?: number;
193
197
  arrSessionAttendance: SessionAttendance[];
194
198
  }
195
199
  /**
@@ -529,6 +533,8 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
529
533
  short: string;
530
534
  }>;
531
535
 
536
+ declare function cgNum(cgName: string): number;
537
+
532
538
  declare function formatDateDDMMYY(date: Date): string;
533
539
  declare function parseYYMMDD(str: string): Date;
534
540
  /**
@@ -540,4 +546,6 @@ declare function isDateInRangeIgnoreYear(d: Date, start: Date, end: Date): boole
540
546
  declare function yearStr(timestamp: number): string;
541
547
  declare function monthStr(timestamp: number): string;
542
548
 
543
- export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance, formatDateDDMMYY, isDateInRangeIgnoreYear, monthStr, parseYYMMDD, yearStr };
549
+ declare function compareCG(a: CG, b: CG): number;
550
+
551
+ export { type AppPage, AppUser, AssignedCG, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, type Claim, ClaimStatus, ClaimType, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, MsjJoinStatus, MsjJoinStatusInfo, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance, cgNum, compareCG, formatDateDDMMYY, isDateInRangeIgnoreYear, monthStr, parseYYMMDD, yearStr };
package/dist/index.js CHANGED
@@ -547,6 +547,16 @@ var MsjJoinStatusInfo = {
547
547
  }
548
548
  };
549
549
 
550
+ // src/util/common.util.ts
551
+ function cgNum(cgName) {
552
+ var num = cgName.match(/\d+/g);
553
+ if (num) {
554
+ return parseInt(num[0]);
555
+ } else {
556
+ return 0;
557
+ }
558
+ }
559
+
550
560
  // src/util/date.util.ts
551
561
  function formatDateDDMMYY(date) {
552
562
  const day = String(date.getDate()).padStart(2, "0");
@@ -581,6 +591,12 @@ function yearStr(timestamp) {
581
591
  function monthStr(timestamp) {
582
592
  return new Date(timestamp).toLocaleString("default", { month: "long" });
583
593
  }
594
+
595
+ // src/util/sort.util.ts
596
+ function compareCG(a, b) {
597
+ let v = cgNum(a.name) - cgNum(b.name);
598
+ return v;
599
+ }
584
600
  export {
585
601
  AppUser,
586
602
  AssignedCG,
@@ -608,6 +624,8 @@ export {
608
624
  SmallTeam,
609
625
  Title,
610
626
  TitleAttendance,
627
+ cgNum,
628
+ compareCG,
611
629
  formatDateDDMMYY,
612
630
  isDateInRangeIgnoreYear,
613
631
  monthStr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyc-type-def",
3
- "version": "4.0.0",
3
+ "version": "5.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",