cyc-type-def 1.0.3 → 2.0.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/dist/index.cjs ADDED
@@ -0,0 +1,564 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ AppUser: () => AppUser,
24
+ AttSheep: () => AttSheep,
25
+ Attendance: () => Attendance,
26
+ BackupAttendance: () => BackupAttendance,
27
+ CG: () => CG,
28
+ Click: () => Click,
29
+ ClickAction: () => ClickAction,
30
+ Cluster: () => Cluster,
31
+ Column: () => Column,
32
+ DisplayAttendance: () => DisplayAttendance,
33
+ FollowUpStatus: () => FollowUpStatus,
34
+ LIST_STATUS: () => LIST_STATUS,
35
+ METHOD: () => METHOD,
36
+ PERMISSION: () => PERMISSION,
37
+ ReportSheep: () => ReportSheep,
38
+ Session: () => Session,
39
+ SessionAttendance: () => SessionAttendance,
40
+ Sheep: () => Sheep,
41
+ SmallTeam: () => SmallTeam,
42
+ Title: () => Title,
43
+ TitleAttendance: () => TitleAttendance
44
+ });
45
+ module.exports = __toCommonJS(index_exports);
46
+
47
+ // src/constants/method.constant.ts
48
+ var METHOD = {
49
+ SKY: "S",
50
+ GROUND: "G",
51
+ TOTAL: "T"
52
+ };
53
+
54
+ // src/constants/status.constant.ts
55
+ var LIST_STATUS = ["OM", "NB", "AC", "NF", "RNF"];
56
+
57
+ // src/classes/attendance/SessionAttendance.ts
58
+ var SessionAttendance = class {
59
+ constructor(session) {
60
+ this.arrSheep = [];
61
+ if (session) {
62
+ this.code = session.code;
63
+ this.type = session.type;
64
+ this.desc = session.desc;
65
+ this.seq = session.seq;
66
+ this.needAbsReason = session.needAbsReason;
67
+ }
68
+ }
69
+ sortedArrAttSheep() {
70
+ let arrStatusCopy = LIST_STATUS;
71
+ return this.arrSheep.sort((a, b) => {
72
+ if (a.attended && b.attended || !a.attended && !b.attended) {
73
+ let indexA = arrStatusCopy.indexOf(a.status);
74
+ let indexB = arrStatusCopy.indexOf(b.status);
75
+ if (indexA < 0) {
76
+ return 1;
77
+ } else if (indexB < 0) {
78
+ return -1;
79
+ } else {
80
+ if (indexA < indexB) {
81
+ return -1;
82
+ } else if (indexA > indexB) {
83
+ return 1;
84
+ } else {
85
+ return a.name.localeCompare(b.name);
86
+ }
87
+ }
88
+ } else if (a.attended) {
89
+ return -1;
90
+ } else if (b.attended) {
91
+ return 1;
92
+ } else {
93
+ return -1;
94
+ }
95
+ });
96
+ }
97
+ get arrFilteredSheep() {
98
+ return this.input ? this.arrSheep.filter(
99
+ (sheep) => sheep.name.toLowerCase().includes(this.input.toLowerCase())
100
+ ) : this.arrSheep.slice();
101
+ }
102
+ getCnt(status, attType) {
103
+ if (!this.arrSheep) return 0;
104
+ else {
105
+ let cnt = 0;
106
+ for (let s of this.arrSheep) {
107
+ if (attType == METHOD.GROUND || attType == METHOD.SKY) {
108
+ if (attType == s.method && s.status == status && s.attended) cnt++;
109
+ } else if (attType == METHOD.TOTAL) {
110
+ if (s.status == status && s.attended) cnt++;
111
+ }
112
+ }
113
+ return cnt;
114
+ }
115
+ }
116
+ getAbsCnt() {
117
+ if (!this.arrSheep) return 0;
118
+ else {
119
+ let cnt = 0;
120
+ for (let s of this.arrSheep) {
121
+ if (s.status == "OM" && !s.attended) cnt++;
122
+ }
123
+ return cnt;
124
+ }
125
+ }
126
+ getDesc(status, attType) {
127
+ if (!this.arrSheep) return "";
128
+ else {
129
+ let desc = "";
130
+ for (let s of this.arrSheep) {
131
+ if (attType == METHOD.GROUND || attType == METHOD.SKY) {
132
+ if (attType == s.method && s.status == status && s.attended)
133
+ desc += s.name + ", ";
134
+ } else if (attType == METHOD.TOTAL) {
135
+ if (s.status == status && s.attended) desc += s.name + ", ";
136
+ }
137
+ }
138
+ desc = desc.slice(0, desc.length - 2);
139
+ return desc;
140
+ }
141
+ }
142
+ getAbsDesc() {
143
+ if (!this.arrSheep) return "";
144
+ else {
145
+ let desc = "";
146
+ for (let s of this.arrSheep) {
147
+ if (s.status == "OM" && !s.attended)
148
+ desc += s.name + " - " + s.absReason + ", ";
149
+ }
150
+ desc = desc.slice(0, desc.length - 2);
151
+ return desc;
152
+ }
153
+ }
154
+ calc() {
155
+ this.ground = new DisplayAttendance();
156
+ this.sky = new DisplayAttendance();
157
+ this.total = new DisplayAttendance();
158
+ this.calcFigure();
159
+ this.calcDesc();
160
+ }
161
+ /** generate count of OM, NB, AC, NF, RNF */
162
+ calcFigure() {
163
+ for (let status of LIST_STATUS) {
164
+ this.ground["cnt" + status] = this.getCnt(status, METHOD.GROUND);
165
+ this.ground.calcTotal();
166
+ }
167
+ for (let status of LIST_STATUS) {
168
+ this.sky["cnt" + status] = this.getCnt(status, METHOD.SKY);
169
+ this.sky.calcTotal();
170
+ }
171
+ for (let status of LIST_STATUS) {
172
+ this.total["cnt" + status] = this.getCnt(status, METHOD.TOTAL);
173
+ this.total.calcTotal();
174
+ }
175
+ this.cntAbs = this.getAbsCnt();
176
+ }
177
+ /** generate description of OM, NB, AC, NF, RNF */
178
+ calcDesc() {
179
+ for (let status of LIST_STATUS) {
180
+ this.ground["des" + status] = this.getDesc(status, METHOD.GROUND);
181
+ }
182
+ for (let status of LIST_STATUS) {
183
+ this.sky["des" + status] = this.getDesc(status, METHOD.SKY);
184
+ }
185
+ for (let status of LIST_STATUS) {
186
+ this.total["des" + status] = this.getDesc(status, METHOD.TOTAL);
187
+ }
188
+ this.desAbs = this.getAbsDesc();
189
+ }
190
+ /**
191
+ * reset all display attendance figure to zero
192
+ */
193
+ resetDisplayAttendance() {
194
+ this.ground = new DisplayAttendance();
195
+ this.sky = new DisplayAttendance();
196
+ this.total = new DisplayAttendance();
197
+ for (let status of LIST_STATUS) {
198
+ this.ground["cnt" + status] = 0;
199
+ this.sky["cnt" + status] = 0;
200
+ this.total["cnt" + status] = 0;
201
+ }
202
+ this.ground.total = 0;
203
+ this.sky.total = 0;
204
+ this.total.total = 0;
205
+ this.cntAbs = 0;
206
+ }
207
+ /**
208
+ * Sums CG's sessionAttendance into total sessionAttendance.
209
+ * @param sessionAttendance
210
+ */
211
+ sum(sessionAttendance) {
212
+ for (let status of LIST_STATUS) {
213
+ this.ground["cnt" + status] += sessionAttendance.ground["cnt" + status];
214
+ this.sky["cnt" + status] += sessionAttendance.sky["cnt" + status];
215
+ this.total["cnt" + status] += sessionAttendance.total["cnt" + status];
216
+ }
217
+ this.ground.total += sessionAttendance.ground.total;
218
+ this.sky.total += sessionAttendance.sky.total;
219
+ this.total.total += sessionAttendance.total.total;
220
+ this.cntAbs += sessionAttendance.cntAbs;
221
+ }
222
+ };
223
+ var AttSheep = class {
224
+ /**
225
+ * initialize AttSheep object from Sheep object
226
+ * @param sheep
227
+ */
228
+ constructor(sheep) {
229
+ this.idSheep = sheep.id;
230
+ this.name = sheep.name;
231
+ this.status = sheep.status;
232
+ this.attended = false;
233
+ this.absReason = "";
234
+ this.method = METHOD.GROUND;
235
+ }
236
+ copyAtt(attSheep) {
237
+ this.attended = attSheep.attended;
238
+ this.absReason = attSheep.absReason;
239
+ this.method = attSheep.method;
240
+ }
241
+ };
242
+ var DisplayAttendance = class {
243
+ calcTotal() {
244
+ this.total = this.cntOM + this.cntNB + this.cntAC + this.cntNF + this.cntRNF;
245
+ }
246
+ };
247
+
248
+ // src/classes/attendance/Attendance.ts
249
+ var Attendance = class {
250
+ constructor(attendance) {
251
+ if (attendance) {
252
+ Object.assign(this, attendance);
253
+ }
254
+ }
255
+ getSessionAttendance(session) {
256
+ }
257
+ setSessionAttendance(arrSession) {
258
+ if (this.arrSessionAttendance) {
259
+ let oriArr = this.deepCopySessionAttendance(this.arrSessionAttendance);
260
+ this.arrSessionAttendance = [];
261
+ for (let s of arrSession) {
262
+ this.arrSessionAttendance.push(new SessionAttendance(s));
263
+ }
264
+ for (let oriSession of oriArr) {
265
+ for (let newSession of this.arrSessionAttendance) {
266
+ if (oriSession.code == newSession.code) {
267
+ if (oriSession.arrSheep) {
268
+ newSession.arrSheep = [...oriSession.arrSheep];
269
+ }
270
+ }
271
+ }
272
+ }
273
+ } else {
274
+ this.arrSessionAttendance = [];
275
+ for (let s of arrSession) {
276
+ this.arrSessionAttendance.push(new SessionAttendance(s));
277
+ }
278
+ }
279
+ }
280
+ deepCopySessionAttendance(arrSessionAttendance) {
281
+ let arrRtn = [];
282
+ for (let s of arrSessionAttendance) {
283
+ let sessionAtt = new SessionAttendance();
284
+ sessionAtt.code = s.code;
285
+ sessionAtt.desc = s.desc;
286
+ sessionAtt.type = s.type;
287
+ sessionAtt.seq = s.seq;
288
+ sessionAtt.needAbsReason = s.needAbsReason;
289
+ sessionAtt.arrSheep = [];
290
+ for (let sheep of s.arrSheep) {
291
+ sessionAtt.arrSheep.push(sheep);
292
+ }
293
+ arrRtn.push(sessionAtt);
294
+ }
295
+ return arrRtn;
296
+ }
297
+ clearArrAttSheep(idCG, arrSheepForRef) {
298
+ if (this.arrSessionAttendance) {
299
+ for (let sessionAtt of this.arrSessionAttendance) {
300
+ sessionAtt.arrSheep = sessionAtt.arrSheep.filter((s) => {
301
+ return arrSheepForRef[s.idSheep] ? arrSheepForRef[s.idSheep].cg == idCG : false;
302
+ });
303
+ }
304
+ }
305
+ }
306
+ setArrAttSheep(arrSheep) {
307
+ for (let sessionAtt of this.arrSessionAttendance) {
308
+ for (let sheep of arrSheep) {
309
+ let found = false;
310
+ for (let attSheep of sessionAtt.arrSheep) {
311
+ if (attSheep.idSheep == sheep.id) {
312
+ found = true;
313
+ }
314
+ }
315
+ if (!found) sessionAtt.arrSheep.push(new AttSheep(sheep));
316
+ }
317
+ sessionAtt.arrSheep = sessionAtt.sortedArrAttSheep();
318
+ }
319
+ }
320
+ addSheep(sheep) {
321
+ for (let sessionAtt of this.arrSessionAttendance) {
322
+ sessionAtt.arrSheep.push(new AttSheep(sheep));
323
+ sessionAtt.arrSheep = sessionAtt.sortedArrAttSheep();
324
+ }
325
+ }
326
+ setCG(cg) {
327
+ this.idCg = cg.id;
328
+ this.idSt = cg.st;
329
+ this.idCluster = cg.cluster;
330
+ }
331
+ /**
332
+ * remove sheep where attended=false from arrSheep to submit attendance,
333
+ * won't remove OM
334
+ */
335
+ removeNotAttendForSubmission() {
336
+ for (let sessionAtt of this.arrSessionAttendance) {
337
+ sessionAtt.arrSheep = sessionAtt.arrSheep.filter(
338
+ (sheep) => sheep.attended || sheep.status == "OM"
339
+ );
340
+ }
341
+ }
342
+ /** calculate session attendance's figure & description */
343
+ calc() {
344
+ for (let sessionAtt of this.arrSessionAttendance) {
345
+ sessionAtt.calc();
346
+ }
347
+ }
348
+ /** Reset all display attendance figure to zero. */
349
+ resetDisplayAttendance() {
350
+ for (let session of this.arrSessionAttendance) {
351
+ session.resetDisplayAttendance();
352
+ }
353
+ }
354
+ getSessionAttendanceByCode(code) {
355
+ for (let session of this.arrSessionAttendance) {
356
+ if (session.code == code) {
357
+ return session;
358
+ }
359
+ }
360
+ return new SessionAttendance();
361
+ }
362
+ /**
363
+ * copy attendance to the writing panel
364
+ * @param attendance
365
+ */
366
+ copy(attendance) {
367
+ for (let sessionAtt of this.arrSessionAttendance) {
368
+ for (let prevSessionAtt of attendance.arrSessionAttendance) {
369
+ if (sessionAtt.code == prevSessionAtt.code) {
370
+ for (let attSheep of sessionAtt.arrSheep) {
371
+ let found = false;
372
+ for (let prevAttSheep of prevSessionAtt.arrSheep) {
373
+ if (attSheep.idSheep == prevAttSheep.idSheep) {
374
+ attSheep.copyAtt(prevAttSheep);
375
+ found = true;
376
+ }
377
+ }
378
+ if (!found) attSheep.attended = false;
379
+ }
380
+ }
381
+ }
382
+ }
383
+ }
384
+ };
385
+
386
+ // src/classes/attendance/BackupAttendance.ts
387
+ var BackupAttendance = class {
388
+ };
389
+
390
+ // src/classes/attendance/Session.ts
391
+ var Session = class {
392
+ constructor() {
393
+ }
394
+ };
395
+
396
+ // src/classes/attendance/Title.ts
397
+ var Title = class {
398
+ getKey() {
399
+ return "dddd";
400
+ }
401
+ };
402
+
403
+ // src/classes/pastoral-team/Sheep.ts
404
+ var Sheep = class {
405
+ constructor(id, name, status, cg, st, cluster, deleted, show, attCnt) {
406
+ this.id = id;
407
+ this.name = name;
408
+ this.status = status;
409
+ this.cg = cg;
410
+ this.st = st;
411
+ this.cluster = cluster;
412
+ this.deleted = deleted;
413
+ this.show = show;
414
+ this.attCnt = attCnt;
415
+ }
416
+ };
417
+
418
+ // src/classes/attendance-report/ReportSheep.ts
419
+ var ReportSheep = class extends Sheep {
420
+ constructor(sheep) {
421
+ super(
422
+ sheep.id,
423
+ sheep.name,
424
+ sheep.status,
425
+ sheep.cg,
426
+ sheep.st,
427
+ sheep.cluster,
428
+ sheep.deleted,
429
+ sheep.show,
430
+ sheep.attCnt
431
+ );
432
+ this.attMap = {};
433
+ }
434
+ };
435
+
436
+ // src/classes/attendance-report/TitleAttendance.ts
437
+ var TitleAttendance = class {
438
+ constructor(cgAtt, serviceAtt, title) {
439
+ this.cgAtt = cgAtt;
440
+ this.serviceAtt = serviceAtt;
441
+ this.title = title;
442
+ }
443
+ };
444
+
445
+ // src/classes/flw-up/FollowUpStatus.ts
446
+ var FollowUpStatus = class {
447
+ constructor() {
448
+ this.id = "";
449
+ this.method = "";
450
+ this.cluster = "";
451
+ this.st = "";
452
+ this.cg = "";
453
+ this.sheep = "";
454
+ this.in_list = true;
455
+ this.status = "";
456
+ this.timeStamp = "";
457
+ this.date = "";
458
+ this.discipler = "";
459
+ }
460
+ };
461
+
462
+ // src/classes/pastoral-team/CG.ts
463
+ var CG = class {
464
+ constructor(id, name, st, cluster, deleted) {
465
+ this.id = id;
466
+ this.name = name;
467
+ this.st = st;
468
+ this.cluster = cluster;
469
+ this.deleted = deleted;
470
+ }
471
+ };
472
+
473
+ // src/classes/pastoral-team/Cluster.ts
474
+ var Cluster = class {
475
+ constructor(id, name, deleted) {
476
+ this.id = id;
477
+ this.name = name;
478
+ this.deleted = deleted;
479
+ }
480
+ };
481
+
482
+ // src/classes/pastoral-team/SmallTeam.ts
483
+ var SmallTeam = class {
484
+ constructor(id, name, cluster, deleted) {
485
+ this.id = id;
486
+ this.name = name;
487
+ this.cluster = cluster;
488
+ this.deleted = deleted;
489
+ }
490
+ };
491
+
492
+ // src/classes/AppUser.ts
493
+ var AppUser = class {
494
+ constructor(id, name, phoneNum, permission) {
495
+ this.id = id;
496
+ this.name = name;
497
+ this.phoneNum = phoneNum;
498
+ this.permission = permission;
499
+ }
500
+ };
501
+
502
+ // src/classes/Click.ts
503
+ var Click = class {
504
+ };
505
+
506
+ // src/classes/Column.ts
507
+ var Column = class {
508
+ constructor(name) {
509
+ this.visible = false;
510
+ this.name = name;
511
+ }
512
+ };
513
+
514
+ // src/constants/click.constant.ts
515
+ var ClickAction = /* @__PURE__ */ ((ClickAction2) => {
516
+ ClickAction2[ClickAction2["P_WeeklyAttendance"] = 0] = "P_WeeklyAttendance";
517
+ ClickAction2[ClickAction2["P_AttendanceReport"] = 1] = "P_AttendanceReport";
518
+ ClickAction2[ClickAction2["P_CGNameList"] = 2] = "P_CGNameList";
519
+ ClickAction2[ClickAction2["F_CopyAttendance"] = 3] = "F_CopyAttendance";
520
+ ClickAction2[ClickAction2["F_CheckAttendanceHistory"] = 4] = "F_CheckAttendanceHistory";
521
+ ClickAction2[ClickAction2["F_AttendanceReminder"] = 5] = "F_AttendanceReminder";
522
+ ClickAction2[ClickAction2["F_ExportWeekAttendance"] = 6] = "F_ExportWeekAttendance";
523
+ ClickAction2[ClickAction2["F_ClickEditSheep"] = 7] = "F_ClickEditSheep";
524
+ ClickAction2[ClickAction2["F_EditSheep"] = 8] = "F_EditSheep";
525
+ ClickAction2[ClickAction2["F_VerticalViewAttendance"] = 9] = "F_VerticalViewAttendance";
526
+ return ClickAction2;
527
+ })(ClickAction || {});
528
+
529
+ // src/constants/permission.constant.ts
530
+ var PERMISSION = {
531
+ SUPER_USER: "Super user",
532
+ TL: "TL",
533
+ SCGL: "SCGL",
534
+ CGL: "CGL",
535
+ FL: "FL",
536
+ WM: "WM",
537
+ NOT_VERIFIED: "Not verified",
538
+ PASTORAL_ADMIN: "Pastoral Admin",
539
+ ST_ADMIN: "Small Team Admin"
540
+ };
541
+ // Annotate the CommonJS export names for ESM import in node:
542
+ 0 && (module.exports = {
543
+ AppUser,
544
+ AttSheep,
545
+ Attendance,
546
+ BackupAttendance,
547
+ CG,
548
+ Click,
549
+ ClickAction,
550
+ Cluster,
551
+ Column,
552
+ DisplayAttendance,
553
+ FollowUpStatus,
554
+ LIST_STATUS,
555
+ METHOD,
556
+ PERMISSION,
557
+ ReportSheep,
558
+ Session,
559
+ SessionAttendance,
560
+ Sheep,
561
+ SmallTeam,
562
+ Title,
563
+ TitleAttendance
564
+ });
@@ -0,0 +1,386 @@
1
+ interface Base {
2
+ id: string;
3
+ deleted: boolean;
4
+ createdAt?: number;
5
+ createdBy?: string;
6
+ updatedAt?: number;
7
+ updatedBy?: string;
8
+ remark?: string;
9
+ }
10
+
11
+ declare class CG implements Base {
12
+ id: string;
13
+ deleted: boolean;
14
+ name: string;
15
+ /** small team id */
16
+ st: string;
17
+ /** cluster id */
18
+ cluster: string;
19
+ cglCnt?: number;
20
+ sglCnt?: number;
21
+ cglName?: string;
22
+ constructor(id: string, name: string, st: string, cluster: string, deleted: boolean);
23
+ }
24
+
25
+ interface MsjStudClass {
26
+ idClass?: string;
27
+ attended: boolean;
28
+ classNo: number;
29
+ replaced?: boolean;
30
+ absReason?: string;
31
+ markBy?: string;
32
+ markAt?: number;
33
+ provedAbsent?: boolean;
34
+ isWatchedRecording?: boolean;
35
+ markByName?: string;
36
+ }
37
+
38
+ interface MsjStudBatch extends Base {
39
+ idSheep: string;
40
+ idBatch: string;
41
+ completed?: boolean;
42
+ proceed?: boolean;
43
+ attendance?: MsjStudClass[];
44
+ status?: string;
45
+ }
46
+
47
+ declare class Sheep implements Base {
48
+ name: string;
49
+ st: string;
50
+ cluster: string;
51
+ cg: string;
52
+ status: string;
53
+ discipler?: string;
54
+ age?: number;
55
+ show: boolean;
56
+ birthday?: number;
57
+ isBaptised?: boolean;
58
+ dtBaptism?: number;
59
+ attCnt: number;
60
+ hideAtt?: boolean;
61
+ id: string;
62
+ deleted: boolean;
63
+ createdAt?: number;
64
+ createdBy?: string;
65
+ updatedAt?: number;
66
+ updatedBy?: string;
67
+ remark?: string;
68
+ arrFlwUpCnt?: number[];
69
+ msj?: Map<String, MsjStudBatch>;
70
+ msjRecords?: Map<String, MsjStudBatch[]>;
71
+ constructor(id: string, name: string, status: string, cg: string, st: string, cluster: string, deleted: boolean, show: boolean, attCnt: number);
72
+ }
73
+
74
+ interface Session extends Base {
75
+ code: string;
76
+ desc: string;
77
+ seq: number;
78
+ type: string;
79
+ needAbsReason: boolean;
80
+ }
81
+ /** Session object indicating session of title */
82
+ declare class Session implements Session {
83
+ constructor();
84
+ }
85
+
86
+ interface SessionAttendance extends Session {
87
+ /** array of attendance sheep (AttSheep) */
88
+ arrSheep: AttSheep[];
89
+ input: string;
90
+ sky: DisplayAttendance;
91
+ ground: DisplayAttendance;
92
+ total: DisplayAttendance;
93
+ cntAbs: number;
94
+ desAbs: string;
95
+ }
96
+ /**
97
+ * attendance of a session
98
+ *
99
+ * @extends
100
+ * Session
101
+ */
102
+ declare class SessionAttendance implements SessionAttendance {
103
+ constructor();
104
+ constructor(session: Session);
105
+ sortedArrAttSheep(): AttSheep[];
106
+ get arrFilteredSheep(): AttSheep[];
107
+ getCnt(status: string, attType: string): number;
108
+ getAbsCnt(): number;
109
+ getDesc(status: string, attType: string): string;
110
+ getAbsDesc(): string;
111
+ calc(): void;
112
+ /** generate count of OM, NB, AC, NF, RNF */
113
+ calcFigure(): void;
114
+ /** generate description of OM, NB, AC, NF, RNF */
115
+ calcDesc(): void;
116
+ /**
117
+ * reset all display attendance figure to zero
118
+ */
119
+ resetDisplayAttendance(): void;
120
+ /**
121
+ * Sums CG's sessionAttendance into total sessionAttendance.
122
+ * @param sessionAttendance
123
+ */
124
+ sum(sessionAttendance: SessionAttendance): void;
125
+ }
126
+ interface AttSheep {
127
+ idSheep: string;
128
+ name: string;
129
+ status: string;
130
+ attended: boolean;
131
+ absReason: string;
132
+ method: string;
133
+ }
134
+ /** represents a single member in a SessionAttendance. */
135
+ declare class AttSheep implements AttSheep {
136
+ /**
137
+ * initialize AttSheep object from Sheep object
138
+ * @param sheep
139
+ */
140
+ constructor(sheep: Sheep);
141
+ copyAtt(attSheep: AttSheep): void;
142
+ }
143
+ /**
144
+ * Contains a SessionAttendance data, to display.
145
+ * Ground/Sky/Total
146
+ */
147
+ declare class DisplayAttendance {
148
+ [key: string]: any;
149
+ cntOM: number;
150
+ cntNB: number;
151
+ cntAC: number;
152
+ cntNF: number;
153
+ cntRNF: number;
154
+ desOM: string;
155
+ desNB: string;
156
+ desAC: string;
157
+ desNF: string;
158
+ desRNF: string;
159
+ total: number;
160
+ calcTotal(): void;
161
+ }
162
+
163
+ interface Title extends Base {
164
+ startDt: number;
165
+ endDt: number;
166
+ code: string;
167
+ arrSession: Session[];
168
+ }
169
+ /** represents a week */
170
+ declare class Title implements Title {
171
+ getKey(): string;
172
+ }
173
+
174
+ interface Attendance extends Title {
175
+ idTitle: string;
176
+ idCg: string;
177
+ idSt: string;
178
+ idCluster: string;
179
+ timestamp: number;
180
+ arrSessionAttendance: SessionAttendance[];
181
+ }
182
+ /**
183
+ * attendance of week
184
+ *
185
+ * @extends Title
186
+ */
187
+ declare class Attendance implements Attendance {
188
+ constructor();
189
+ constructor(attendance: Attendance);
190
+ getSessionAttendance(session: Session): void;
191
+ setSessionAttendance(arrSession: Session[]): void;
192
+ deepCopySessionAttendance(arrSessionAttendance: SessionAttendance[]): SessionAttendance[];
193
+ clearArrAttSheep(idCG: string, arrSheepForRef: {
194
+ [key: string]: Sheep;
195
+ }): void;
196
+ setArrAttSheep(arrSheep: Sheep[]): void;
197
+ addSheep(sheep: Sheep): void;
198
+ setCG(cg: CG): void;
199
+ /**
200
+ * remove sheep where attended=false from arrSheep to submit attendance,
201
+ * won't remove OM
202
+ */
203
+ removeNotAttendForSubmission(): void;
204
+ /** calculate session attendance's figure & description */
205
+ calc(): void;
206
+ /** Reset all display attendance figure to zero. */
207
+ resetDisplayAttendance(): void;
208
+ getSessionAttendanceByCode(code: string): SessionAttendance;
209
+ /**
210
+ * copy attendance to the writing panel
211
+ * @param attendance
212
+ */
213
+ copy(attendance: Attendance): void;
214
+ }
215
+
216
+ interface BackupAttendance {
217
+ attendance: Attendance;
218
+ timestamp: number;
219
+ }
220
+ declare class BackupAttendance implements BackupAttendance {
221
+ }
222
+
223
+ declare class TitleAttendance {
224
+ cgAtt: AttSheep;
225
+ serviceAtt: AttSheep;
226
+ title: Title;
227
+ constructor(cgAtt: AttSheep, serviceAtt: AttSheep, title: Title);
228
+ }
229
+
230
+ declare class ReportSheep extends Sheep {
231
+ attMap: {
232
+ [key: string]: TitleAttendance;
233
+ };
234
+ constructor(sheep: Sheep);
235
+ }
236
+
237
+ interface MsjClassType extends Base {
238
+ title: string;
239
+ seq?: number;
240
+ defaultMinAtt?: number;
241
+ }
242
+
243
+ interface MsjClassBatch extends Base {
244
+ idMsjClassType: string;
245
+ yearTimestamp: number;
246
+ monthTimestamp: number;
247
+ msjClassType?: MsjClassType;
248
+ numOfClass: number;
249
+ dt?: Date;
250
+ minAtt?: number;
251
+ }
252
+
253
+ interface MsjClassTime extends Base {
254
+ idMsjClassBatch: string;
255
+ time: number;
256
+ msjClassBatch?: MsjClassBatch;
257
+ classNo: number;
258
+ backtracked?: boolean;
259
+ }
260
+
261
+ declare class FollowUpStatus {
262
+ id: string;
263
+ method: string;
264
+ st: string;
265
+ cluster: string;
266
+ cg: string;
267
+ sheep: string;
268
+ in_list: boolean;
269
+ status: string;
270
+ timeStamp: string;
271
+ date: string;
272
+ discipler: string;
273
+ user?: string;
274
+ constructor();
275
+ }
276
+
277
+ declare class Cluster implements Base {
278
+ id: string;
279
+ deleted: boolean;
280
+ name: string;
281
+ createdAt?: number;
282
+ createdBy: string | undefined;
283
+ updatedAt?: number;
284
+ updatedBy: string | undefined;
285
+ remark?: string;
286
+ constructor(id: string, name: string, deleted: boolean);
287
+ }
288
+
289
+ declare class SmallTeam implements Base {
290
+ id: string;
291
+ name: string;
292
+ /** cluster id */
293
+ cluster: string;
294
+ deleted: boolean;
295
+ constructor(id: string, name: string, cluster: string, deleted: boolean);
296
+ }
297
+
298
+ /** Navigation List Item */
299
+ interface AppPage {
300
+ /** Title shown in navigation list */
301
+ title: string;
302
+ /** redirect target */
303
+ url: string;
304
+ /** Ionic icon name */
305
+ icon: string;
306
+ /** control whether show in navigation list or not */
307
+ canAccess: boolean;
308
+ category: string;
309
+ /** Angular Material icon name */
310
+ matIcon: string;
311
+ /** user need sign in to view */
312
+ isSecure: boolean;
313
+ /** Permissions need to view. Blank indicates everyone can view. */
314
+ permissions: string[];
315
+ }
316
+
317
+ interface PastoralTeam {
318
+ cg?: string;
319
+ cluster?: string;
320
+ st?: string;
321
+ }
322
+ declare class AppUser {
323
+ id: string;
324
+ name: string;
325
+ /** Login id: phone number/email */
326
+ phoneNum: string;
327
+ permission: string;
328
+ pastoral_team?: PastoralTeam;
329
+ permissions?: string[];
330
+ constructor(id: string, name: string, phoneNum: string, permission: string);
331
+ }
332
+
333
+ interface BaseDialog {
334
+ close(): void;
335
+ }
336
+
337
+ declare enum ClickAction {
338
+ P_WeeklyAttendance = 0,
339
+ P_AttendanceReport = 1,
340
+ P_CGNameList = 2,
341
+ F_CopyAttendance = 3,
342
+ F_CheckAttendanceHistory = 4,
343
+ F_AttendanceReminder = 5,
344
+ F_ExportWeekAttendance = 6,
345
+ F_ClickEditSheep = 7,
346
+ F_EditSheep = 8,
347
+ F_VerticalViewAttendance = 9
348
+ }
349
+
350
+ declare class Click {
351
+ action: ClickAction;
352
+ timeStamp: number;
353
+ userId?: string;
354
+ }
355
+
356
+ declare class Column {
357
+ visible: boolean;
358
+ name: string;
359
+ constructor(name: string);
360
+ }
361
+
362
+ interface Device extends Base {
363
+ version?: number;
364
+ }
365
+
366
+ declare const METHOD: {
367
+ SKY: string;
368
+ GROUND: string;
369
+ TOTAL: string;
370
+ };
371
+
372
+ declare const PERMISSION: {
373
+ SUPER_USER: string;
374
+ TL: string;
375
+ SCGL: string;
376
+ CGL: string;
377
+ FL: string;
378
+ WM: string;
379
+ NOT_VERIFIED: string;
380
+ PASTORAL_ADMIN: string;
381
+ ST_ADMIN: string;
382
+ };
383
+
384
+ declare const LIST_STATUS: string[];
385
+
386
+ export { type AppPage, AppUser, AttSheep, Attendance, BackupAttendance, type Base, type BaseDialog, CG, Click, ClickAction, Cluster, Column, type Device, DisplayAttendance, FollowUpStatus, LIST_STATUS, METHOD, type MsjClassBatch, type MsjClassTime, type MsjClassType, type MsjStudBatch, type MsjStudClass, PERMISSION, type PastoralTeam, ReportSheep, Session, SessionAttendance, Sheep, SmallTeam, Title, TitleAttendance };
package/dist/index.js CHANGED
@@ -1,49 +1,3 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- AppUser: () => AppUser,
24
- AttSheep: () => AttSheep,
25
- Attendance: () => Attendance,
26
- BackupAttendance: () => BackupAttendance,
27
- CG: () => CG,
28
- Click: () => Click,
29
- ClickAction: () => ClickAction,
30
- Cluster: () => Cluster,
31
- Column: () => Column,
32
- DisplayAttendance: () => DisplayAttendance,
33
- FollowUpStatus: () => FollowUpStatus,
34
- LIST_STATUS: () => LIST_STATUS,
35
- METHOD: () => METHOD,
36
- PERMISSION: () => PERMISSION,
37
- ReportSheep: () => ReportSheep,
38
- Session: () => Session,
39
- SessionAttendance: () => SessionAttendance,
40
- Sheep: () => Sheep,
41
- SmallTeam: () => SmallTeam,
42
- Title: () => Title,
43
- TitleAttendance: () => TitleAttendance
44
- });
45
- module.exports = __toCommonJS(index_exports);
46
-
47
1
  // src/constants/method.constant.ts
48
2
  var METHOD = {
49
3
  SKY: "S",
@@ -538,8 +492,7 @@ var PERMISSION = {
538
492
  PASTORAL_ADMIN: "Pastoral Admin",
539
493
  ST_ADMIN: "Small Team Admin"
540
494
  };
541
- // Annotate the CommonJS export names for ESM import in node:
542
- 0 && (module.exports = {
495
+ export {
543
496
  AppUser,
544
497
  AttSheep,
545
498
  Attendance,
@@ -561,4 +514,4 @@ var PERMISSION = {
561
514
  SmallTeam,
562
515
  Title,
563
516
  TitleAttendance
564
- });
517
+ };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "cyc-type-def",
3
- "version": "1.0.3",
3
+ "version": "2.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
+ "type": "module",
6
7
  "files": [
7
8
  "dist"
8
9
  ],