cyc-type-def 3.0.12 → 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
@@ -45,7 +45,14 @@ __export(index_exports, {
45
45
  Sheep: () => Sheep,
46
46
  SmallTeam: () => SmallTeam,
47
47
  Title: () => Title,
48
- TitleAttendance: () => TitleAttendance
48
+ TitleAttendance: () => TitleAttendance,
49
+ cgNum: () => cgNum,
50
+ compareCG: () => compareCG,
51
+ formatDateDDMMYY: () => formatDateDDMMYY,
52
+ isDateInRangeIgnoreYear: () => isDateInRangeIgnoreYear,
53
+ monthStr: () => monthStr,
54
+ parseYYMMDD: () => parseYYMMDD,
55
+ yearStr: () => yearStr
49
56
  });
50
57
  module.exports = __toCommonJS(index_exports);
51
58
 
@@ -540,6 +547,7 @@ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
540
547
  ClickAction2[ClickAction2["P_BIRTHDAY"] = 12] = "P_BIRTHDAY";
541
548
  ClickAction2[ClickAction2["P_CLAIM"] = 13] = "P_CLAIM";
542
549
  ClickAction2[ClickAction2["P_SETTING"] = 14] = "P_SETTING";
550
+ ClickAction2[ClickAction2["P_MSJ_STUDENT_RECORD"] = 15] = "P_MSJ_STUDENT_RECORD";
543
551
  return ClickAction2;
544
552
  })(ClickAction || {});
545
553
 
@@ -596,6 +604,57 @@ var MsjJoinStatusInfo = {
596
604
  short: "Refresh"
597
605
  }
598
606
  };
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
+
618
+ // src/util/date.util.ts
619
+ function formatDateDDMMYY(date) {
620
+ const day = String(date.getDate()).padStart(2, "0");
621
+ const month = String(date.getMonth() + 1).padStart(2, "0");
622
+ const year = String(date.getFullYear()).slice(-2);
623
+ return `${year}${month}${day}`;
624
+ }
625
+ function parseYYMMDD(str) {
626
+ const year = 2e3 + parseInt(str.slice(0, 2));
627
+ const month = parseInt(str.slice(2, 4)) - 1;
628
+ const day = parseInt(str.slice(4, 6));
629
+ return new Date(year, month, day);
630
+ }
631
+ function isDateInRangeIgnoreYear(d, start, end) {
632
+ const code = mdCode(d);
633
+ const s = mdCode(start);
634
+ const e = mdCode(end);
635
+ if (s <= e) {
636
+ return code >= s && code <= e;
637
+ } else {
638
+ return code >= s || code <= e;
639
+ }
640
+ }
641
+ function mdCode(date) {
642
+ const m = date.getUTCMonth() + 1;
643
+ const d = date.getUTCDate();
644
+ return m * 100 + d;
645
+ }
646
+ function yearStr(timestamp) {
647
+ return new Date(timestamp).getFullYear().toString();
648
+ }
649
+ function monthStr(timestamp) {
650
+ return new Date(timestamp).toLocaleString("default", { month: "long" });
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
+ }
599
658
  // Annotate the CommonJS export names for ESM import in node:
600
659
  0 && (module.exports = {
601
660
  AppUser,
@@ -623,5 +682,12 @@ var MsjJoinStatusInfo = {
623
682
  Sheep,
624
683
  SmallTeam,
625
684
  Title,
626
- TitleAttendance
685
+ TitleAttendance,
686
+ cgNum,
687
+ compareCG,
688
+ formatDateDDMMYY,
689
+ isDateInRangeIgnoreYear,
690
+ monthStr,
691
+ parseYYMMDD,
692
+ yearStr
627
693
  });
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
  /**
@@ -478,7 +482,8 @@ declare enum ClickAction {
478
482
  F_ExportVerticalView = 11,
479
483
  P_BIRTHDAY = 12,
480
484
  P_CLAIM = 13,
481
- P_SETTING = 14
485
+ P_SETTING = 14,
486
+ P_MSJ_STUDENT_RECORD = 15
482
487
  }
483
488
 
484
489
  declare class Click {
@@ -528,4 +533,19 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
528
533
  short: string;
529
534
  }>;
530
535
 
531
- 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 };
536
+ declare function cgNum(cgName: string): number;
537
+
538
+ declare function formatDateDDMMYY(date: Date): string;
539
+ declare function parseYYMMDD(str: string): Date;
540
+ /**
541
+ * Returns true if `d` is between `start` and `end` by month/day only (inclusive).
542
+ * Year is ignored. Works even when the range crosses year-end.
543
+ * Uses UTC month/day to avoid timezone surprises.
544
+ */
545
+ declare function isDateInRangeIgnoreYear(d: Date, start: Date, end: Date): boolean;
546
+ declare function yearStr(timestamp: number): string;
547
+ declare function monthStr(timestamp: number): string;
548
+
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
  /**
@@ -478,7 +482,8 @@ declare enum ClickAction {
478
482
  F_ExportVerticalView = 11,
479
483
  P_BIRTHDAY = 12,
480
484
  P_CLAIM = 13,
481
- P_SETTING = 14
485
+ P_SETTING = 14,
486
+ P_MSJ_STUDENT_RECORD = 15
482
487
  }
483
488
 
484
489
  declare class Click {
@@ -528,4 +533,19 @@ declare const MsjJoinStatusInfo: Record<MsjJoinStatus, {
528
533
  short: string;
529
534
  }>;
530
535
 
531
- 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 };
536
+ declare function cgNum(cgName: string): number;
537
+
538
+ declare function formatDateDDMMYY(date: Date): string;
539
+ declare function parseYYMMDD(str: string): Date;
540
+ /**
541
+ * Returns true if `d` is between `start` and `end` by month/day only (inclusive).
542
+ * Year is ignored. Works even when the range crosses year-end.
543
+ * Uses UTC month/day to avoid timezone surprises.
544
+ */
545
+ declare function isDateInRangeIgnoreYear(d: Date, start: Date, end: Date): boolean;
546
+ declare function yearStr(timestamp: number): string;
547
+ declare function monthStr(timestamp: number): string;
548
+
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
@@ -489,6 +489,7 @@ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
489
489
  ClickAction2[ClickAction2["P_BIRTHDAY"] = 12] = "P_BIRTHDAY";
490
490
  ClickAction2[ClickAction2["P_CLAIM"] = 13] = "P_CLAIM";
491
491
  ClickAction2[ClickAction2["P_SETTING"] = 14] = "P_SETTING";
492
+ ClickAction2[ClickAction2["P_MSJ_STUDENT_RECORD"] = 15] = "P_MSJ_STUDENT_RECORD";
492
493
  return ClickAction2;
493
494
  })(ClickAction || {});
494
495
 
@@ -545,6 +546,57 @@ var MsjJoinStatusInfo = {
545
546
  short: "Refresh"
546
547
  }
547
548
  };
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
+
560
+ // src/util/date.util.ts
561
+ function formatDateDDMMYY(date) {
562
+ const day = String(date.getDate()).padStart(2, "0");
563
+ const month = String(date.getMonth() + 1).padStart(2, "0");
564
+ const year = String(date.getFullYear()).slice(-2);
565
+ return `${year}${month}${day}`;
566
+ }
567
+ function parseYYMMDD(str) {
568
+ const year = 2e3 + parseInt(str.slice(0, 2));
569
+ const month = parseInt(str.slice(2, 4)) - 1;
570
+ const day = parseInt(str.slice(4, 6));
571
+ return new Date(year, month, day);
572
+ }
573
+ function isDateInRangeIgnoreYear(d, start, end) {
574
+ const code = mdCode(d);
575
+ const s = mdCode(start);
576
+ const e = mdCode(end);
577
+ if (s <= e) {
578
+ return code >= s && code <= e;
579
+ } else {
580
+ return code >= s || code <= e;
581
+ }
582
+ }
583
+ function mdCode(date) {
584
+ const m = date.getUTCMonth() + 1;
585
+ const d = date.getUTCDate();
586
+ return m * 100 + d;
587
+ }
588
+ function yearStr(timestamp) {
589
+ return new Date(timestamp).getFullYear().toString();
590
+ }
591
+ function monthStr(timestamp) {
592
+ return new Date(timestamp).toLocaleString("default", { month: "long" });
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
+ }
548
600
  export {
549
601
  AppUser,
550
602
  AssignedCG,
@@ -571,5 +623,12 @@ export {
571
623
  Sheep,
572
624
  SmallTeam,
573
625
  Title,
574
- TitleAttendance
626
+ TitleAttendance,
627
+ cgNum,
628
+ compareCG,
629
+ formatDateDDMMYY,
630
+ isDateInRangeIgnoreYear,
631
+ monthStr,
632
+ parseYYMMDD,
633
+ yearStr
575
634
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyc-type-def",
3
- "version": "3.0.12",
3
+ "version": "5.0.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",