@sneat/mod-schedulus-core 0.2.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/esm2022/index.js +2 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/contexts/happening-context.js +11 -0
- package/esm2022/lib/contexts/happening-context.js.map +1 -0
- package/esm2022/lib/contexts/index.js +2 -0
- package/esm2022/lib/contexts/index.js.map +1 -0
- package/esm2022/lib/dto/calendarium.js +2 -0
- package/esm2022/lib/dto/calendarium.js.map +1 -0
- package/esm2022/lib/dto/dto-calendar-day.js +2 -0
- package/esm2022/lib/dto/dto-calendar-day.js.map +1 -0
- package/esm2022/lib/dto/happening-types.js +2 -0
- package/esm2022/lib/dto/happening-types.js.map +1 -0
- package/esm2022/lib/dto/happening.js +60 -0
- package/esm2022/lib/dto/happening.js.map +1 -0
- package/esm2022/lib/dto/index.js +6 -0
- package/esm2022/lib/dto/index.js.map +1 -0
- package/esm2022/lib/dto/reminder.js +2 -0
- package/esm2022/lib/dto/reminder.js.map +1 -0
- package/esm2022/lib/dto/todo_move_funcs.js +6 -0
- package/esm2022/lib/dto/todo_move_funcs.js.map +1 -0
- package/esm2022/lib/index.js +7 -0
- package/esm2022/lib/index.js.map +1 -0
- package/esm2022/lib/pipes/index.js +2 -0
- package/esm2022/lib/pipes/index.js.map +1 -0
- package/esm2022/lib/pipes/wd-to-weekday.pipe.js +36 -0
- package/esm2022/lib/pipes/wd-to-weekday.pipe.js.map +1 -0
- package/esm2022/lib/schedule-nav-service.module.js +15 -0
- package/esm2022/lib/schedule-nav-service.module.js.map +1 -0
- package/esm2022/lib/schedule-nav.service.js +29 -0
- package/esm2022/lib/schedule-nav.service.js.map +1 -0
- package/esm2022/lib/view-models.js +24 -0
- package/esm2022/lib/view-models.js.map +1 -0
- package/esm2022/sneat-mod-schedulus-core.js +5 -0
- package/esm2022/sneat-mod-schedulus-core.js.map +1 -0
- package/index.d.ts +1 -0
- package/lib/contexts/happening-context.d.ts +12 -0
- package/lib/contexts/index.d.ts +1 -0
- package/lib/dto/calendarium.d.ts +13 -0
- package/lib/dto/dto-calendar-day.d.ts +20 -0
- package/lib/dto/happening-types.d.ts +6 -0
- package/lib/dto/happening.d.ts +109 -0
- package/lib/dto/index.d.ts +6 -0
- package/lib/dto/reminder.d.ts +9 -0
- package/lib/dto/todo_move_funcs.d.ts +4 -0
- package/lib/index.d.ts +6 -0
- package/lib/pipes/index.d.ts +1 -0
- package/lib/pipes/wd-to-weekday.pipe.d.ts +9 -0
- package/lib/schedule-nav-service.module.d.ts +6 -0
- package/lib/schedule-nav.service.d.ts +11 -0
- package/lib/view-models.d.ts +39 -0
- package/package.json +26 -0
- package/sneat-mod-schedulus-core.d.ts +5 -0
- package/tsconfig.lib.prod.tsbuildinfo +1 -0
package/esm2022/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/extensions/schedulus/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC","sourcesContent":["export * from './lib';\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function newEmptyHappeningContext(space, type, kind, status) {
|
|
2
|
+
// console.log('newEmptyHappeningContext', space, kind, status, kind);
|
|
3
|
+
const brief = {
|
|
4
|
+
type,
|
|
5
|
+
kind,
|
|
6
|
+
status,
|
|
7
|
+
title: '',
|
|
8
|
+
};
|
|
9
|
+
return { id: '', space, brief, dbo: { ...brief } };
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=happening-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"happening-context.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/contexts/happening-context.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,wBAAwB,CACtC,KAAoB,EACpB,IAAmB,EACnB,IAAmB,EACnB,MAAuB;IAEvB,sEAAsE;IACtE,MAAM,KAAK,GAAoB;QAC7B,IAAI;QACJ,IAAI;QACJ,MAAM;QACN,KAAK,EAAE,EAAE;KACV,CAAC;IACF,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,EAAE,CAAC;AACrD,CAAC","sourcesContent":["import { DeleteOperationState } from '@sneat/core';\nimport { UiState } from '@sneat/dto';\nimport { ISpaceContext, ISpaceItemNavContext } from '@sneat/space-models';\nimport {\n HappeningKind,\n HappeningStatus,\n HappeningType,\n IHappeningBrief,\n IHappeningDbo,\n} from '../dto/happening';\n\nexport type IHappeningContext = ISpaceItemNavContext<\n IHappeningBrief,\n IHappeningDbo\n>;\n\nexport interface IHappeningWithUiState extends IHappeningContext {\n readonly state: UiState;\n}\n\nexport function newEmptyHappeningContext(\n space: ISpaceContext,\n type: HappeningType,\n kind: HappeningKind,\n status: HappeningStatus,\n): IHappeningContext {\n // console.log('newEmptyHappeningContext', space, kind, status, kind);\n const brief: IHappeningBrief = {\n type,\n kind,\n status,\n title: '',\n };\n return { id: '', space, brief, dbo: { ...brief } };\n}\n\nexport type CancelOperationState =\n | 'cancelling-single'\n | 'cancelling-series'\n | 'cancelling-adjustment'\n | 'canceled'\n | undefined;\n\nexport type RevokeCancellationOperationState =\n | 'revoking-cancellation'\n | undefined;\n\nexport type HappeningUIState =\n | DeleteOperationState\n | CancelOperationState\n | RevokeCancellationOperationState\n | undefined;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './happening-context';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarium.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/dto/calendarium.ts"],"names":[],"mappings":"","sourcesContent":["import { IIdAndDbo } from '@sneat/core';\nimport { IWithRelatedOnly } from '@sneat/dto';\nimport { ISpaceItemWithOptionalDbo } from '@sneat/space-models';\nimport { IHappeningBrief } from './happening';\n\nexport interface ICalendarHappeningBrief\n extends IHappeningBrief, IWithRelatedOnly {}\n\nexport type CalendarHappeningBriefsByID = Record<\n string,\n ICalendarHappeningBrief\n>;\n\nexport interface ICalendariumSpaceDbo {\n readonly recurringHappenings?: Readonly<CalendarHappeningBriefsByID>;\n}\n\nexport type CalendarHappeningBriefsBySpaceID = Record<\n string,\n CalendarHappeningBriefsByID\n>;\n\nexport type ICalendariumSpaceDboWithID = IIdAndDbo<ICalendariumSpaceDbo>;\n\nexport type ICalendariumSpaceContext =\n ISpaceItemWithOptionalDbo<ICalendariumSpaceDbo>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto-calendar-day.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/dto/dto-calendar-day.ts"],"names":[],"mappings":"","sourcesContent":["import { IByUser } from '@sneat/dto';\nimport { IHappeningSlot } from './happening';\n\nexport interface ICancellation {\n readonly at: string;\n readonly by: IByUser;\n}\n\nexport interface ISlotAdjustment {\n readonly canceled?: ICancellation;\n readonly adjustment?: IHappeningSlot;\n}\n\nexport interface IHappeningAdjustment {\n readonly slots: Readonly<Record<string, ISlotAdjustment>>;\n}\n\nexport interface ICalendarDayBrief {\n readonly spaceID: string;\n readonly date: string;\n readonly happeningIDs?: string[];\n readonly happeningAdjustments: Readonly<Record<string, IHappeningAdjustment>>;\n}\n\nexport type ICalendarDayDbo = ICalendarDayBrief;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"happening-types.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/dto/happening-types.ts"],"names":[],"mappings":"","sourcesContent":["export type WeekdayCode2 = 'mo' | 'tu' | 'we' | 'th' | 'fr' | 'sa' | 'su';\n\nexport type MonthlyMode =\n | 'monthly-day'\n | 'monthly-week-1'\n | 'monthly-week-2'\n | 'monthly-week-3'\n | 'monthly-week-4'\n | 'monthly-week-last';\n\nexport type RepeatPeriod =\n | 'UNKNOWN'\n | 'once'\n // | 'daily'\n | 'weekly'\n | 'fortnightly'\n | 'monthly'\n | 'yearly';\nexport type ActivityType = 'appointment' | 'school' | 'lesson' | 'todo'; // TODO: Is it same as HappeningKind?\nexport type EventType = 'workshop' | 'fixture' | 'appointment';\nexport type ShowBy = 'event' | 'contact';\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export function validateHappeningDto(dto) {
|
|
2
|
+
if (!dto.title) {
|
|
3
|
+
throw new Error('happening has no title');
|
|
4
|
+
}
|
|
5
|
+
if (dto.title !== dto.title.trim()) {
|
|
6
|
+
throw new Error('happening title has leading or closing whitespace characters');
|
|
7
|
+
}
|
|
8
|
+
switch (dto.type) {
|
|
9
|
+
case 'single':
|
|
10
|
+
break;
|
|
11
|
+
case 'recurring':
|
|
12
|
+
break;
|
|
13
|
+
default:
|
|
14
|
+
if (!dto.type) {
|
|
15
|
+
throw new Error('happening has no type');
|
|
16
|
+
}
|
|
17
|
+
throw new Error('happening has unknown type: ' + dto.type);
|
|
18
|
+
}
|
|
19
|
+
if (!dto.type) {
|
|
20
|
+
throw new Error('happening has no type');
|
|
21
|
+
}
|
|
22
|
+
if (!Object.keys(dto.slots || {})?.length) {
|
|
23
|
+
throw new Error('!dto.slots?.length');
|
|
24
|
+
}
|
|
25
|
+
switch (dto.type) {
|
|
26
|
+
case 'single':
|
|
27
|
+
Object.entries(dto.slots || {}).forEach(([slotID, slot]) => validateSingleHappeningSlot(slotID, slot));
|
|
28
|
+
break;
|
|
29
|
+
case 'recurring':
|
|
30
|
+
Object.entries(dto.slots || {}).forEach(([slotID, slot]) => validateRecurringHappeningSlot(slotID, slot));
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function validateRecurringHappeningSlot(slotID, slot) {
|
|
35
|
+
if (slot.repeats === 'once' || slot.repeats === 'UNKNOWN') {
|
|
36
|
+
throw new Error(`slots[${slotID}]: slot.repeats is not valid for recurring happening: ${slot.repeats}`);
|
|
37
|
+
}
|
|
38
|
+
validateHappeningSlot(slotID, slot);
|
|
39
|
+
}
|
|
40
|
+
export function validateSingleHappeningSlot(slotID, slot) {
|
|
41
|
+
if (slot.repeats != 'once') {
|
|
42
|
+
throw new Error(`slots[${slotID}]: slot repeats is not 'once': ${slot.repeats}`);
|
|
43
|
+
}
|
|
44
|
+
validateHappeningSlot(slotID, slot);
|
|
45
|
+
}
|
|
46
|
+
function validateHappeningSlot(slotID, slot) {
|
|
47
|
+
if (!slot.start?.time &&
|
|
48
|
+
!(slot.repeats.startsWith('monthly') || slot.repeats.startsWith('yearly'))) {
|
|
49
|
+
throw new Error(`slots[${slotID}]: slot has no start time: ${slot}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export const emptyTiming = {
|
|
53
|
+
// durationMinutes: 0,
|
|
54
|
+
};
|
|
55
|
+
export const emptyHappeningSlot = {
|
|
56
|
+
id: '',
|
|
57
|
+
repeats: 'UNKNOWN',
|
|
58
|
+
...emptyTiming,
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=happening.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"happening.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/dto/happening.ts"],"names":[],"mappings":"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","sourcesContent":["import { IWithRelatedOnly, IWithSpaceIDs } from '@sneat/dto';\nimport { ActivityType, RepeatPeriod, WeekdayCode2 } from './happening-types';\nimport { IWithStringID } from './todo_move_funcs';\n\nexport interface ISlotParticipant {\n readonly roles?: string[];\n // readonly type: 'member' | 'contact';\n // readonly title: string;\n}\n\nexport interface IHappeningParticipant {\n readonly roles?: string[];\n // readonly type: 'member' | 'contact';\n // readonly title: string;\n}\n\nexport type TermUnit =\n | 'single'\n | 'second'\n | 'minute'\n | 'hour'\n | 'day'\n | 'week'\n | 'month'\n | 'quarter'\n | 'year';\n\nexport interface ITerm {\n readonly length: number;\n readonly unit: TermUnit;\n}\n\nexport type CurrencyCode = 'USD' | 'EUR' | 'RUB' | string;\n\nexport interface IAmount {\n readonly currency: CurrencyCode;\n readonly value: number;\n}\n\nexport interface IHappeningPrice {\n readonly id: string;\n readonly term: ITerm;\n readonly amount: IAmount;\n readonly expenseQuantity?: number;\n}\n\nexport interface IHappeningBase extends IWithRelatedOnly {\n readonly type: HappeningType;\n readonly status: HappeningStatus;\n readonly kind: HappeningKind;\n readonly activityType?: ActivityType; // TODO: Is it same as HappeningKind?\n readonly title: string;\n readonly summary?: string;\n readonly levels?: Level[];\n // readonly contactIDs?: readonly string[]; // obsolete\n readonly slots?: Readonly<Record<string, IHappeningSlot>>;\n readonly prices?: readonly IHappeningPrice[];\n // readonly participants?: Record<string, Readonly<IHappeningParticipant>>;\n}\n\nexport type IHappeningBrief = IHappeningBase;\n\nexport interface IWithDates {\n readonly dates?: string[];\n}\n\nexport interface IWithSpaceDates extends IWithSpaceIDs, IWithDates {\n readonly spaceDates?: string[]; // ISO date strings prefixed with spaceID e.g. [`abc123:2019-12-01`, `abc123:2019-12-02`]\n}\n\nexport interface IHappeningDbo extends IHappeningBrief, IWithSpaceDates {\n readonly description?: string;\n}\n\nexport function validateHappeningDto(dto: IHappeningDbo): void {\n if (!dto.title) {\n throw new Error('happening has no title');\n }\n if (dto.title !== dto.title.trim()) {\n throw new Error(\n 'happening title has leading or closing whitespace characters',\n );\n }\n switch (dto.type) {\n case 'single':\n break;\n case 'recurring':\n break;\n default:\n if (!dto.type) {\n throw new Error('happening has no type');\n }\n throw new Error('happening has unknown type: ' + dto.type);\n }\n if (!dto.type) {\n throw new Error('happening has no type');\n }\n if (!Object.keys(dto.slots || {})?.length) {\n throw new Error('!dto.slots?.length');\n }\n switch (dto.type) {\n case 'single':\n Object.entries(dto.slots || {}).forEach(([slotID, slot]) =>\n validateSingleHappeningSlot(slotID, slot),\n );\n break;\n case 'recurring':\n Object.entries(dto.slots || {}).forEach(([slotID, slot]) =>\n validateRecurringHappeningSlot(slotID, slot),\n );\n break;\n }\n}\n\nexport function validateRecurringHappeningSlot(\n slotID: string,\n slot: IHappeningSlot,\n): void {\n if (slot.repeats === 'once' || slot.repeats === 'UNKNOWN') {\n throw new Error(\n `slots[${slotID}]: slot.repeats is not valid for recurring happening: ${slot.repeats}`,\n );\n }\n validateHappeningSlot(slotID, slot);\n}\n\nexport function validateSingleHappeningSlot(\n slotID: string,\n slot: IHappeningSlot,\n): void {\n if (slot.repeats != 'once') {\n throw new Error(\n `slots[${slotID}]: slot repeats is not 'once': ${slot.repeats}`,\n );\n }\n validateHappeningSlot(slotID, slot);\n}\n\nfunction validateHappeningSlot(slotID: string, slot: IHappeningSlot): void {\n if (\n !slot.start?.time &&\n !(slot.repeats.startsWith('monthly') || slot.repeats.startsWith('yearly'))\n ) {\n throw new Error(`slots[${slotID}]: slot has no start time: ${slot}`);\n }\n}\n\nexport type HappeningType = 'recurring' | 'single';\n\nexport type HappeningStatus = 'draft' | 'active' | 'canceled' | 'archived';\n\nexport type HappeningKind = 'appointment' | 'activity' | 'task';\n\nexport interface SlotLocation {\n readonly title?: string;\n readonly address?: string;\n}\n\ninterface IFortnightly {\n readonly title: string;\n}\n\n/*\n// tslint:disable-next-line:no-magic-numbers\ntype MonthlyDay = -5 | -4 | -3 | -2 | -1\n// tslint:disable-next-line:no-magic-numbers\n\t| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10\n// tslint:disable-next-line:no-magic-numbers\n\t| 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19\n// tslint:disable-next-line:no-magic-numbers\n\t| 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28;\n*/\n\nexport interface IDateTime {\n readonly date?: string;\n readonly time?: string;\n}\n\nexport interface ITiming {\n readonly start?: IDateTime;\n readonly end?: IDateTime;\n readonly durationMinutes?: number;\n}\n\nexport interface IHappeningSlotSingleRef {\n readonly repeats: RepeatPeriod;\n readonly weekday?: WeekdayCode2;\n readonly week?: number;\n}\n\nexport type Month =\n | 'January'\n | 'February'\n | 'March'\n | 'April'\n | 'May'\n | 'June'\n | 'July'\n | 'August'\n | 'September'\n | 'October'\n | 'November'\n | 'December';\n\nexport interface IHappeningSlotTiming extends ITiming {\n readonly repeats: RepeatPeriod;\n readonly weekdays?: readonly WeekdayCode2[];\n readonly day?: number;\n readonly month?: Month;\n readonly weeks?: readonly number[];\n readonly fortnightly?: Readonly<{\n readonly odd: IFortnightly;\n readonly even: IFortnightly;\n }>;\n}\n\nexport type Level = 'beginners' | 'intermediate' | 'advanced';\n\nexport interface IHappeningTask {\n readonly serviceProvider?: {\n readonly id: string;\n readonly title: string;\n };\n}\n\nexport interface IHappeningSlot extends IHappeningSlotTiming {\n readonly location?: SlotLocation;\n readonly groupIds?: string[]; // TODO: What is this?\n}\n\nexport type IHappeningSlotWithID = IWithStringID<IHappeningSlot>;\n\nexport const emptyTiming: ITiming = {\n // durationMinutes: 0,\n};\n\nexport const emptyHappeningSlot: IHappeningSlotWithID = {\n id: '',\n repeats: 'UNKNOWN',\n ...emptyTiming,\n};\n\nexport interface ISingleHappeningDbo extends IHappeningDbo {\n readonly dtStarts?: number; // UTC\n readonly dtEnds?: number; // UTC\n readonly weekdays?: WeekdayCode2[];\n}\n\nexport interface DtoSingleTask extends ISingleHappeningDbo {\n readonly isCompleted: boolean;\n readonly completion?: number; // In percents, max value is 100.\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/dto/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './happening';\nexport * from './dto-calendar-day';\nexport * from './happening-types';\nexport * from './calendarium';\nexport * from './todo_move_funcs';\nexport { IReminderDbo } from './reminder';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reminder.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/dto/reminder.ts"],"names":[],"mappings":"","sourcesContent":["import { ITitledRecord } from '@sneat/dto';\n\nexport interface IReminderDbo extends ITitledRecord {\n dueOn: string;\n dueTimes?: number;\n assetId?: string;\n liabilityId?: string;\n contactIds?: string[];\n memberIds?: string[];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todo_move_funcs.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/dto/todo_move_funcs.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAChC,CAAgC;IAEhC,OAAO,CAAC;QACN,CAAC,CAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CACrC,MAAM,CAAC,MAAM,CAAC,KAAe,EAAE,EAAE,EAAE,EAAE,CAAC,CAChB;QAC1B,CAAC,CAAC,EAAE,CAAC;AACT,CAAC","sourcesContent":["export type IWithStringID<T> = T & { readonly id: string };\n\nexport function mergeValuesWithIDs<T extends object>(\n o: Record<string, T> | undefined,\n): IWithStringID<T>[] {\n return o\n ? (Object.entries(o).map(([id, value]) =>\n Object.assign(value as object, { id }),\n ) as IWithStringID<T>[])\n : [];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/extensions/schedulus/core/src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,eAAe,CAAC","sourcesContent":["export * from './contexts';\nexport * from './dto';\nexport * from './pipes';\nexport * from './schedule-nav.service';\nexport * from './schedule-nav-service.module';\nexport * from './view-models';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/pipes/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './wd-to-weekday.pipe';\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Pipe } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export function wdCodeToWeekdayLongName(wd) {
|
|
4
|
+
switch (wd) {
|
|
5
|
+
case 'mo':
|
|
6
|
+
return 'Monday';
|
|
7
|
+
case 'tu':
|
|
8
|
+
return 'Tuesday';
|
|
9
|
+
case 'we':
|
|
10
|
+
return 'Wednesday';
|
|
11
|
+
case 'th':
|
|
12
|
+
return 'Thursday';
|
|
13
|
+
case 'fr':
|
|
14
|
+
return 'Friday';
|
|
15
|
+
case 'sa':
|
|
16
|
+
return 'Saturday';
|
|
17
|
+
case 'su':
|
|
18
|
+
return 'Sunday';
|
|
19
|
+
default:
|
|
20
|
+
return '' + wd;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class WdToWeekdayPipe {
|
|
24
|
+
transform(wd) {
|
|
25
|
+
return wdCodeToWeekdayLongName(wd);
|
|
26
|
+
}
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: WdToWeekdayPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
28
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: WdToWeekdayPipe, isStandalone: true, name: "wdToWeekday" }); }
|
|
29
|
+
}
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: WdToWeekdayPipe, decorators: [{
|
|
31
|
+
type: Pipe,
|
|
32
|
+
args: [{
|
|
33
|
+
name: 'wdToWeekday',
|
|
34
|
+
}]
|
|
35
|
+
}] });
|
|
36
|
+
//# sourceMappingURL=wd-to-weekday.pipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wd-to-weekday.pipe.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/core/src/lib/pipes/wd-to-weekday.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;;AAGpD,MAAM,UAAU,uBAAuB,CAAC,EAAiB;IACvD,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,IAAI;YACP,OAAO,QAAQ,CAAC;QAClB,KAAK,IAAI;YACP,OAAO,SAAS,CAAC;QACnB,KAAK,IAAI;YACP,OAAO,WAAW,CAAC;QACrB,KAAK,IAAI;YACP,OAAO,UAAU,CAAC;QACpB,KAAK,IAAI;YACP,OAAO,QAAQ,CAAC;QAClB,KAAK,IAAI;YACP,OAAO,UAAU,CAAC;QACpB,KAAK,IAAI;YACP,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,EAAE,GAAG,EAAE,CAAC;IACnB,CAAC;AACH,CAAC;AAKD,MAAM,OAAO,eAAe;IAC1B,SAAS,CAAC,EAAiB;QACzB,OAAO,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;8GAHU,eAAe;4GAAf,eAAe;;2FAAf,eAAe;kBAH3B,IAAI;mBAAC;oBACJ,IAAI,EAAE,aAAa;iBACpB","sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { WeekdayCode2 } from '../dto';\n\nexport function wdCodeToWeekdayLongName(wd?: WeekdayCode2): string {\n switch (wd) {\n case 'mo':\n return 'Monday';\n case 'tu':\n return 'Tuesday';\n case 'we':\n return 'Wednesday';\n case 'th':\n return 'Thursday';\n case 'fr':\n return 'Friday';\n case 'sa':\n return 'Saturday';\n case 'su':\n return 'Sunday';\n default:\n return '' + wd;\n }\n}\n\n@Pipe({\n name: 'wdToWeekday',\n})\nexport class WdToWeekdayPipe implements PipeTransform {\n transform(wd?: WeekdayCode2): string {\n return wdCodeToWeekdayLongName(wd);\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { ScheduleNavService } from './schedule-nav.service';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class ScheduleNavServiceModule {
|
|
5
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ScheduleNavServiceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
6
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: ScheduleNavServiceModule }); }
|
|
7
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ScheduleNavServiceModule, providers: [ScheduleNavService] }); }
|
|
8
|
+
}
|
|
9
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ScheduleNavServiceModule, decorators: [{
|
|
10
|
+
type: NgModule,
|
|
11
|
+
args: [{
|
|
12
|
+
providers: [ScheduleNavService],
|
|
13
|
+
}]
|
|
14
|
+
}] });
|
|
15
|
+
//# sourceMappingURL=schedule-nav-service.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-nav-service.module.js","sourceRoot":"","sources":["../../../../../../../libs/extensions/schedulus/core/src/lib/schedule-nav-service.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;;AAK5D,MAAM,OAAO,wBAAwB;8GAAxB,wBAAwB;+GAAxB,wBAAwB;+GAAxB,wBAAwB,aAFxB,CAAC,kBAAkB,CAAC;;2FAEpB,wBAAwB;kBAHpC,QAAQ;mBAAC;oBACR,SAAS,EAAE,CAAC,kBAAkB,CAAC;iBAChC","sourcesContent":["import { NgModule } from '@angular/core';\nimport { ScheduleNavService } from './schedule-nav.service';\n\n@NgModule({\n providers: [ScheduleNavService],\n})\nexport class ScheduleNavServiceModule {}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Injectable, inject } from '@angular/core';
|
|
2
|
+
import { excludeEmpty } from '@sneat/core';
|
|
3
|
+
import { ErrorLogger } from '@sneat/core';
|
|
4
|
+
import { SpaceNavService } from '@sneat/space-services';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class ScheduleNavService {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.spaceNavService = inject(SpaceNavService);
|
|
9
|
+
this.errorLogger = inject(ErrorLogger);
|
|
10
|
+
}
|
|
11
|
+
goCalendar(space, queryParams) {
|
|
12
|
+
return this.spaceNavService.navigateForwardToSpacePage(space, 'calendar', {
|
|
13
|
+
queryParams,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
goNewHappening(space, params) {
|
|
17
|
+
this.spaceNavService
|
|
18
|
+
.navigateForwardToSpacePage(space, 'new-happening', {
|
|
19
|
+
queryParams: excludeEmpty(params),
|
|
20
|
+
})
|
|
21
|
+
.catch(this.errorLogger.logErrorHandler('failed to navigate to new happening page'));
|
|
22
|
+
}
|
|
23
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ScheduleNavService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
24
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ScheduleNavService }); }
|
|
25
|
+
}
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ScheduleNavService, decorators: [{
|
|
27
|
+
type: Injectable
|
|
28
|
+
}] });
|
|
29
|
+
//# sourceMappingURL=schedule-nav.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-nav.service.js","sourceRoot":"","sources":["../../../../../../../libs/extensions/schedulus/core/src/lib/schedule-nav.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;;AAIxD,MAAM,OAAO,kBAAkB;IAD/B;QAEmB,oBAAe,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;QAC1C,gBAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;KAyBlE;IAvBQ,UAAU,CACf,KAAoB,EACpB,WAAiC;QAEjC,OAAO,IAAI,CAAC,eAAe,CAAC,0BAA0B,CAAC,KAAK,EAAE,UAAU,EAAE;YACxE,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IAEM,cAAc,CACnB,KAAoB,EACpB,MAA0B;QAE1B,IAAI,CAAC,eAAe;aACjB,0BAA0B,CAAC,KAAK,EAAE,eAAe,EAAE;YAClD,WAAW,EAAE,YAAY,CAAC,MAAM,CAAC;SAClC,CAAC;aACD,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,0CAA0C,CAC3C,CACF,CAAC;IACN,CAAC;8GA1BU,kBAAkB;kHAAlB,kBAAkB;;2FAAlB,kBAAkB;kBAD9B,UAAU","sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { excludeEmpty } from '@sneat/core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { ISpaceContext } from '@sneat/space-models';\nimport { SpaceNavService } from '@sneat/space-services';\nimport { ISchedulePageParams, NewHappeningParams } from './view-models';\n\n@Injectable()\nexport class ScheduleNavService {\n private readonly spaceNavService = inject(SpaceNavService);\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n\n public goCalendar(\n space: ISpaceContext,\n queryParams?: ISchedulePageParams,\n ): Promise<boolean> {\n return this.spaceNavService.navigateForwardToSpacePage(space, 'calendar', {\n queryParams,\n });\n }\n\n public goNewHappening(\n space: ISpaceContext,\n params: NewHappeningParams,\n ): void {\n this.spaceNavService\n .navigateForwardToSpacePage(space, 'new-happening', {\n queryParams: excludeEmpty(params),\n })\n .catch(\n this.errorLogger.logErrorHandler(\n 'failed to navigate to new happening page',\n ),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const sortSlotItems = (a, b) => a.timing.start?.time === b.timing.start?.time
|
|
2
|
+
? a.title.localeCompare(b.title)
|
|
3
|
+
: a.timing.start?.time?.localeCompare(b.timing.start?.time || '') || 0;
|
|
4
|
+
export const wd2 = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'];
|
|
5
|
+
const wd2js = ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'];
|
|
6
|
+
export function jsDayToWeekday(day) {
|
|
7
|
+
if (day < 0 || day > 6) {
|
|
8
|
+
throw new Error(`Unknown day number: ${day}`);
|
|
9
|
+
}
|
|
10
|
+
return wd2js[day];
|
|
11
|
+
}
|
|
12
|
+
export function getWd2(d) {
|
|
13
|
+
return jsDayToWeekday(d.getDay());
|
|
14
|
+
}
|
|
15
|
+
export function dateToTimeOnlyStr(d) {
|
|
16
|
+
const h = d.getHours().toString();
|
|
17
|
+
const m = d.getMinutes().toString();
|
|
18
|
+
return `${h.length === 1 ? `0${h}` : h}:${m.length === 1 ? `0${m}` : m}`;
|
|
19
|
+
}
|
|
20
|
+
export function timeToStr(n) {
|
|
21
|
+
const d = new Date(n);
|
|
22
|
+
return dateToTimeOnlyStr(d);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=view-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-models.js","sourceRoot":"","sources":["../../../../../../../libs/extensions/schedulus/core/src/lib/view-models.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAiB,EAAE,CAAiB,EAAU,EAAE,CAC5E,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI;IAC3C,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC;IAChC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;AA6B3E,MAAM,CAAC,MAAM,GAAG,GAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9E,MAAM,KAAK,GAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAIzE,MAAM,UAAU,cAAc,CAAC,GAAkB;IAC/C,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,CAAO;IAC5B,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,EAAmB,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,CAAO;IACvC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC;IACpC,OAAO,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,CAAS;IACjC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import { IHappeningContext } from './contexts/happening-context';\nimport {\n HappeningType,\n IHappeningSlotWithID,\n ISlotAdjustment,\n ISlotParticipant,\n ITiming,\n Level,\n RepeatPeriod,\n SlotLocation,\n WeekdayCode2,\n} from './dto';\n\nexport interface ISchedulePageParams {\n readonly member?: string;\n readonly date?: string;\n}\n\nexport interface NewHappeningParams {\n readonly type?: HappeningType;\n readonly wd?: WeekdayCode2;\n readonly date?: string;\n}\n\nexport const sortSlotItems = (a: ISlotUIContext, b: ISlotUIContext): number =>\n a.timing.start?.time === b.timing.start?.time\n ? a.title.localeCompare(b.title)\n : a.timing.start?.time?.localeCompare(b.timing.start?.time || '') || 0;\n\nexport interface ISlotUIContext {\n // readonly id: string; Not sure how to make an ID yet\n // readonly slotID: string;\n readonly slot: IHappeningSlotWithID;\n readonly adjustment?: ISlotAdjustment;\n readonly wd?: WeekdayCode2;\n // readonly date: string;\n readonly error?: unknown;\n readonly happening: IHappeningContext;\n readonly title: string;\n readonly timing: ITiming;\n readonly repeats: RepeatPeriod;\n readonly location?: SlotLocation;\n readonly participants?: Readonly<Record<string, ISlotParticipant>>;\n readonly levels?: Level[];\n}\nexport interface ISlotUIEvent {\n slot: ISlotUIContext;\n event: Event;\n}\n\nexport type SlotsByWeekday = Record<string, ISlotUIContext[]>;\n\nexport interface RecurringSlots {\n readonly byWeekday: SlotsByWeekday;\n}\n\nexport const wd2: WeekdayCode2[] = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'];\nconst wd2js: WeekdayCode2[] = ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'];\n\nexport type WeekdayNumber = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport function jsDayToWeekday(day: WeekdayNumber): WeekdayCode2 {\n if (day < 0 || day > 6) {\n throw new Error(`Unknown day number: ${day}`);\n }\n return wd2js[day];\n}\n\nexport function getWd2(d: Date): WeekdayCode2 {\n return jsDayToWeekday(d.getDay() as WeekdayNumber);\n}\n\nexport function dateToTimeOnlyStr(d: Date): string {\n const h = d.getHours().toString();\n const m = d.getMinutes().toString();\n return `${h.length === 1 ? `0${h}` : h}:${m.length === 1 ? `0${m}` : m}`;\n}\n\nexport function timeToStr(n: number): string {\n const d = new Date(n);\n return dateToTimeOnlyStr(d);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sneat-mod-schedulus-core.js","sourceRoot":"","sources":["../../../../../../libs/extensions/schedulus/core/src/sneat-mod-schedulus-core.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeleteOperationState } from '@sneat/core';
|
|
2
|
+
import { UiState } from '@sneat/dto';
|
|
3
|
+
import { ISpaceContext, ISpaceItemNavContext } from '@sneat/space-models';
|
|
4
|
+
import { HappeningKind, HappeningStatus, HappeningType, IHappeningBrief, IHappeningDbo } from '../dto/happening';
|
|
5
|
+
export type IHappeningContext = ISpaceItemNavContext<IHappeningBrief, IHappeningDbo>;
|
|
6
|
+
export interface IHappeningWithUiState extends IHappeningContext {
|
|
7
|
+
readonly state: UiState;
|
|
8
|
+
}
|
|
9
|
+
export declare function newEmptyHappeningContext(space: ISpaceContext, type: HappeningType, kind: HappeningKind, status: HappeningStatus): IHappeningContext;
|
|
10
|
+
export type CancelOperationState = 'cancelling-single' | 'cancelling-series' | 'cancelling-adjustment' | 'canceled' | undefined;
|
|
11
|
+
export type RevokeCancellationOperationState = 'revoking-cancellation' | undefined;
|
|
12
|
+
export type HappeningUIState = DeleteOperationState | CancelOperationState | RevokeCancellationOperationState | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './happening-context';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IIdAndDbo } from '@sneat/core';
|
|
2
|
+
import { IWithRelatedOnly } from '@sneat/dto';
|
|
3
|
+
import { ISpaceItemWithOptionalDbo } from '@sneat/space-models';
|
|
4
|
+
import { IHappeningBrief } from './happening';
|
|
5
|
+
export interface ICalendarHappeningBrief extends IHappeningBrief, IWithRelatedOnly {
|
|
6
|
+
}
|
|
7
|
+
export type CalendarHappeningBriefsByID = Record<string, ICalendarHappeningBrief>;
|
|
8
|
+
export interface ICalendariumSpaceDbo {
|
|
9
|
+
readonly recurringHappenings?: Readonly<CalendarHappeningBriefsByID>;
|
|
10
|
+
}
|
|
11
|
+
export type CalendarHappeningBriefsBySpaceID = Record<string, CalendarHappeningBriefsByID>;
|
|
12
|
+
export type ICalendariumSpaceDboWithID = IIdAndDbo<ICalendariumSpaceDbo>;
|
|
13
|
+
export type ICalendariumSpaceContext = ISpaceItemWithOptionalDbo<ICalendariumSpaceDbo>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IByUser } from '@sneat/dto';
|
|
2
|
+
import { IHappeningSlot } from './happening';
|
|
3
|
+
export interface ICancellation {
|
|
4
|
+
readonly at: string;
|
|
5
|
+
readonly by: IByUser;
|
|
6
|
+
}
|
|
7
|
+
export interface ISlotAdjustment {
|
|
8
|
+
readonly canceled?: ICancellation;
|
|
9
|
+
readonly adjustment?: IHappeningSlot;
|
|
10
|
+
}
|
|
11
|
+
export interface IHappeningAdjustment {
|
|
12
|
+
readonly slots: Readonly<Record<string, ISlotAdjustment>>;
|
|
13
|
+
}
|
|
14
|
+
export interface ICalendarDayBrief {
|
|
15
|
+
readonly spaceID: string;
|
|
16
|
+
readonly date: string;
|
|
17
|
+
readonly happeningIDs?: string[];
|
|
18
|
+
readonly happeningAdjustments: Readonly<Record<string, IHappeningAdjustment>>;
|
|
19
|
+
}
|
|
20
|
+
export type ICalendarDayDbo = ICalendarDayBrief;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type WeekdayCode2 = 'mo' | 'tu' | 'we' | 'th' | 'fr' | 'sa' | 'su';
|
|
2
|
+
export type MonthlyMode = 'monthly-day' | 'monthly-week-1' | 'monthly-week-2' | 'monthly-week-3' | 'monthly-week-4' | 'monthly-week-last';
|
|
3
|
+
export type RepeatPeriod = 'UNKNOWN' | 'once' | 'weekly' | 'fortnightly' | 'monthly' | 'yearly';
|
|
4
|
+
export type ActivityType = 'appointment' | 'school' | 'lesson' | 'todo';
|
|
5
|
+
export type EventType = 'workshop' | 'fixture' | 'appointment';
|
|
6
|
+
export type ShowBy = 'event' | 'contact';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { IWithRelatedOnly, IWithSpaceIDs } from '@sneat/dto';
|
|
2
|
+
import { ActivityType, RepeatPeriod, WeekdayCode2 } from './happening-types';
|
|
3
|
+
import { IWithStringID } from './todo_move_funcs';
|
|
4
|
+
export interface ISlotParticipant {
|
|
5
|
+
readonly roles?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface IHappeningParticipant {
|
|
8
|
+
readonly roles?: string[];
|
|
9
|
+
}
|
|
10
|
+
export type TermUnit = 'single' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
11
|
+
export interface ITerm {
|
|
12
|
+
readonly length: number;
|
|
13
|
+
readonly unit: TermUnit;
|
|
14
|
+
}
|
|
15
|
+
export type CurrencyCode = 'USD' | 'EUR' | 'RUB' | string;
|
|
16
|
+
export interface IAmount {
|
|
17
|
+
readonly currency: CurrencyCode;
|
|
18
|
+
readonly value: number;
|
|
19
|
+
}
|
|
20
|
+
export interface IHappeningPrice {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly term: ITerm;
|
|
23
|
+
readonly amount: IAmount;
|
|
24
|
+
readonly expenseQuantity?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface IHappeningBase extends IWithRelatedOnly {
|
|
27
|
+
readonly type: HappeningType;
|
|
28
|
+
readonly status: HappeningStatus;
|
|
29
|
+
readonly kind: HappeningKind;
|
|
30
|
+
readonly activityType?: ActivityType;
|
|
31
|
+
readonly title: string;
|
|
32
|
+
readonly summary?: string;
|
|
33
|
+
readonly levels?: Level[];
|
|
34
|
+
readonly slots?: Readonly<Record<string, IHappeningSlot>>;
|
|
35
|
+
readonly prices?: readonly IHappeningPrice[];
|
|
36
|
+
}
|
|
37
|
+
export type IHappeningBrief = IHappeningBase;
|
|
38
|
+
export interface IWithDates {
|
|
39
|
+
readonly dates?: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface IWithSpaceDates extends IWithSpaceIDs, IWithDates {
|
|
42
|
+
readonly spaceDates?: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface IHappeningDbo extends IHappeningBrief, IWithSpaceDates {
|
|
45
|
+
readonly description?: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function validateHappeningDto(dto: IHappeningDbo): void;
|
|
48
|
+
export declare function validateRecurringHappeningSlot(slotID: string, slot: IHappeningSlot): void;
|
|
49
|
+
export declare function validateSingleHappeningSlot(slotID: string, slot: IHappeningSlot): void;
|
|
50
|
+
export type HappeningType = 'recurring' | 'single';
|
|
51
|
+
export type HappeningStatus = 'draft' | 'active' | 'canceled' | 'archived';
|
|
52
|
+
export type HappeningKind = 'appointment' | 'activity' | 'task';
|
|
53
|
+
export interface SlotLocation {
|
|
54
|
+
readonly title?: string;
|
|
55
|
+
readonly address?: string;
|
|
56
|
+
}
|
|
57
|
+
interface IFortnightly {
|
|
58
|
+
readonly title: string;
|
|
59
|
+
}
|
|
60
|
+
export interface IDateTime {
|
|
61
|
+
readonly date?: string;
|
|
62
|
+
readonly time?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ITiming {
|
|
65
|
+
readonly start?: IDateTime;
|
|
66
|
+
readonly end?: IDateTime;
|
|
67
|
+
readonly durationMinutes?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface IHappeningSlotSingleRef {
|
|
70
|
+
readonly repeats: RepeatPeriod;
|
|
71
|
+
readonly weekday?: WeekdayCode2;
|
|
72
|
+
readonly week?: number;
|
|
73
|
+
}
|
|
74
|
+
export type Month = 'January' | 'February' | 'March' | 'April' | 'May' | 'June' | 'July' | 'August' | 'September' | 'October' | 'November' | 'December';
|
|
75
|
+
export interface IHappeningSlotTiming extends ITiming {
|
|
76
|
+
readonly repeats: RepeatPeriod;
|
|
77
|
+
readonly weekdays?: readonly WeekdayCode2[];
|
|
78
|
+
readonly day?: number;
|
|
79
|
+
readonly month?: Month;
|
|
80
|
+
readonly weeks?: readonly number[];
|
|
81
|
+
readonly fortnightly?: Readonly<{
|
|
82
|
+
readonly odd: IFortnightly;
|
|
83
|
+
readonly even: IFortnightly;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
export type Level = 'beginners' | 'intermediate' | 'advanced';
|
|
87
|
+
export interface IHappeningTask {
|
|
88
|
+
readonly serviceProvider?: {
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly title: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface IHappeningSlot extends IHappeningSlotTiming {
|
|
94
|
+
readonly location?: SlotLocation;
|
|
95
|
+
readonly groupIds?: string[];
|
|
96
|
+
}
|
|
97
|
+
export type IHappeningSlotWithID = IWithStringID<IHappeningSlot>;
|
|
98
|
+
export declare const emptyTiming: ITiming;
|
|
99
|
+
export declare const emptyHappeningSlot: IHappeningSlotWithID;
|
|
100
|
+
export interface ISingleHappeningDbo extends IHappeningDbo {
|
|
101
|
+
readonly dtStarts?: number;
|
|
102
|
+
readonly dtEnds?: number;
|
|
103
|
+
readonly weekdays?: WeekdayCode2[];
|
|
104
|
+
}
|
|
105
|
+
export interface DtoSingleTask extends ISingleHappeningDbo {
|
|
106
|
+
readonly isCompleted: boolean;
|
|
107
|
+
readonly completion?: number;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './wd-to-weekday.pipe';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import { WeekdayCode2 } from '../dto';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare function wdCodeToWeekdayLongName(wd?: WeekdayCode2): string;
|
|
5
|
+
export declare class WdToWeekdayPipe implements PipeTransform {
|
|
6
|
+
transform(wd?: WeekdayCode2): string;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WdToWeekdayPipe, never>;
|
|
8
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<WdToWeekdayPipe, "wdToWeekday", true>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScheduleNavServiceModule {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScheduleNavServiceModule, never>;
|
|
4
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ScheduleNavServiceModule, never, never, never>;
|
|
5
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ScheduleNavServiceModule>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ISpaceContext } from '@sneat/space-models';
|
|
2
|
+
import { ISchedulePageParams, NewHappeningParams } from './view-models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ScheduleNavService {
|
|
5
|
+
private readonly spaceNavService;
|
|
6
|
+
private readonly errorLogger;
|
|
7
|
+
goCalendar(space: ISpaceContext, queryParams?: ISchedulePageParams): Promise<boolean>;
|
|
8
|
+
goNewHappening(space: ISpaceContext, params: NewHappeningParams): void;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScheduleNavService, never>;
|
|
10
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ScheduleNavService>;
|
|
11
|
+
}
|