@memberjunction/ng-entity-viewer 6.2.0-edge.5 → 6.2.0-edge.6
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/README.md +28 -0
- package/dist/lib/aggregate-setup-dialog/aggregate-setup-dialog.component.d.ts +48 -1
- package/dist/lib/aggregate-setup-dialog/aggregate-setup-dialog.component.d.ts.map +1 -1
- package/dist/lib/aggregate-setup-dialog/aggregate-setup-dialog.component.js +631 -279
- package/dist/lib/aggregate-setup-dialog/aggregate-setup-dialog.component.js.map +1 -1
- package/dist/lib/entity-cards/entity-cards.component.d.ts +2 -0
- package/dist/lib/entity-cards/entity-cards.component.d.ts.map +1 -1
- package/dist/lib/entity-cards/entity-cards.component.js +30 -2
- package/dist/lib/entity-cards/entity-cards.component.js.map +1 -1
- package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts +64 -2
- package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts.map +1 -1
- package/dist/lib/entity-data-grid/entity-data-grid.component.js +516 -187
- package/dist/lib/entity-data-grid/entity-data-grid.component.js.map +1 -1
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.d.ts +2 -0
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.d.ts.map +1 -1
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.js +38 -4
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.js.map +1 -1
- package/dist/lib/entity-viewer/entity-viewer.component.d.ts +39 -3
- package/dist/lib/entity-viewer/entity-viewer.component.d.ts.map +1 -1
- package/dist/lib/entity-viewer/entity-viewer.component.js +188 -49
- package/dist/lib/entity-viewer/entity-viewer.component.js.map +1 -1
- package/dist/lib/entity-viewer/view-property-chips.d.ts +17 -0
- package/dist/lib/entity-viewer/view-property-chips.d.ts.map +1 -0
- package/dist/lib/entity-viewer/view-property-chips.js +42 -0
- package/dist/lib/entity-viewer/view-property-chips.js.map +1 -0
- package/dist/lib/recycle-bin/recycle-bin-chip.component.d.ts.map +1 -1
- package/dist/lib/recycle-bin/recycle-bin-chip.component.js +5 -4
- package/dist/lib/recycle-bin/recycle-bin-chip.component.js.map +1 -1
- package/dist/lib/recycle-bin/recycle-bin.component.js +3 -3
- package/dist/lib/recycle-bin/recycle-bin.component.js.map +1 -1
- package/dist/lib/utils/record.util.d.ts +21 -1
- package/dist/lib/utils/record.util.d.ts.map +1 -1
- package/dist/lib/utils/record.util.js +108 -0
- package/dist/lib/utils/record.util.js.map +1 -1
- package/dist/lib/view-config-panel/view-config-panel.component.d.ts +378 -54
- package/dist/lib/view-config-panel/view-config-panel.component.d.ts.map +1 -1
- package/dist/lib/view-config-panel/view-config-panel.component.js +3837 -1010
- package/dist/lib/view-config-panel/view-config-panel.component.js.map +1 -1
- package/dist/lib/view-properties-editor/view-properties-editor.component.d.ts +52 -0
- package/dist/lib/view-properties-editor/view-properties-editor.component.d.ts.map +1 -0
- package/dist/lib/view-properties-editor/view-properties-editor.component.js +445 -0
- package/dist/lib/view-properties-editor/view-properties-editor.component.js.map +1 -0
- package/dist/lib/view-selector/view-selector.component.d.ts +22 -1
- package/dist/lib/view-selector/view-selector.component.d.ts.map +1 -1
- package/dist/lib/view-selector/view-selector.component.js +288 -149
- package/dist/lib/view-selector/view-selector.component.js.map +1 -1
- package/dist/lib/view-types/descriptors/calendar-view-type.d.ts +22 -0
- package/dist/lib/view-types/descriptors/calendar-view-type.d.ts.map +1 -0
- package/dist/lib/view-types/descriptors/calendar-view-type.js +38 -0
- package/dist/lib/view-types/descriptors/calendar-view-type.js.map +1 -0
- package/dist/lib/view-types/index.d.ts +3 -2
- package/dist/lib/view-types/index.d.ts.map +1 -1
- package/dist/lib/view-types/index.js +5 -2
- package/dist/lib/view-types/index.js.map +1 -1
- package/dist/lib/view-types/renderers/calendar-placement.d.ts +97 -0
- package/dist/lib/view-types/renderers/calendar-placement.d.ts.map +1 -0
- package/dist/lib/view-types/renderers/calendar-placement.js +145 -0
- package/dist/lib/view-types/renderers/calendar-placement.js.map +1 -0
- package/dist/lib/view-types/renderers/calendar-view-prop-sheet.component.d.ts +36 -0
- package/dist/lib/view-types/renderers/calendar-view-prop-sheet.component.d.ts.map +1 -0
- package/dist/lib/view-types/renderers/calendar-view-prop-sheet.component.js +167 -0
- package/dist/lib/view-types/renderers/calendar-view-prop-sheet.component.js.map +1 -0
- package/dist/lib/view-types/renderers/calendar-view-renderer.component.d.ts +107 -0
- package/dist/lib/view-types/renderers/calendar-view-renderer.component.d.ts.map +1 -0
- package/dist/lib/view-types/renderers/calendar-view-renderer.component.js +501 -0
- package/dist/lib/view-types/renderers/calendar-view-renderer.component.js.map +1 -0
- package/dist/lib/view-types/renderers/grid-view-renderer.component.d.ts +3 -1
- package/dist/lib/view-types/renderers/grid-view-renderer.component.d.ts.map +1 -1
- package/dist/lib/view-types/renderers/grid-view-renderer.component.js +12 -3
- package/dist/lib/view-types/renderers/grid-view-renderer.component.js.map +1 -1
- package/dist/lib/view-types/renderers/map-view-renderer.component.d.ts.map +1 -1
- package/dist/lib/view-types/renderers/map-view-renderer.component.js +3 -3
- package/dist/lib/view-types/renderers/map-view-renderer.component.js.map +1 -1
- package/dist/lib/view-workspace/view-workspace.component.d.ts +34 -1
- package/dist/lib/view-workspace/view-workspace.component.d.ts.map +1 -1
- package/dist/lib/view-workspace/view-workspace.component.js +177 -15
- package/dist/lib/view-workspace/view-workspace.component.js.map +1 -1
- package/dist/module.d.ts +35 -31
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +21 -3
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +5 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +5 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +22 -21
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { EntityFieldTSType, IsDateOnlySQLType } from '@memberjunction/core';
|
|
2
|
+
import { BuildCalendarWeeks, WEEK_DAYS } from '@memberjunction/ng-ui-components';
|
|
3
|
+
/** Day-of-week labels in Monday-first order, from the shared datepicker labels. */
|
|
4
|
+
export const CALENDAR_WEEK_DAYS = [...WEEK_DAYS.slice(1), WEEK_DAYS[0]];
|
|
5
|
+
/** Local midnight of `date`'s day. */
|
|
6
|
+
export function StartOfDay(date) {
|
|
7
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
8
|
+
}
|
|
9
|
+
/** `date`'s day moved by `days` (DST-safe: works on the calendar fields, not milliseconds). */
|
|
10
|
+
export function AddDays(date, days) {
|
|
11
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
|
|
12
|
+
}
|
|
13
|
+
/** Local midnight of the Monday that starts `date`'s week. */
|
|
14
|
+
export function StartOfWeek(date) {
|
|
15
|
+
return AddDays(date, -((date.getDay() + 6) % 7));
|
|
16
|
+
}
|
|
17
|
+
/** A number unique to a local calendar day (yyyymmdd), used to key days in maps. */
|
|
18
|
+
export function DayKey(date) {
|
|
19
|
+
return date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parses a field value into a Date. A date-only value arrives as UTC midnight (or a bare
|
|
23
|
+
* `yyyy-mm-dd` string, which JavaScript also reads as UTC); its UTC calendar day becomes local
|
|
24
|
+
* midnight, so it never shifts a day west of Greenwich. Returns null for empty or invalid values.
|
|
25
|
+
*/
|
|
26
|
+
export function ToCalendarDate(value, dateOnly) {
|
|
27
|
+
if (value == null || value === '') {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const date = value instanceof Date ? value : typeof value === 'string' || typeof value === 'number' ? new Date(value) : null;
|
|
31
|
+
if (!date || isNaN(date.getTime())) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return dateOnly ? new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) : date;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* True for a date field a calendar can place records by. MJ's `__mj_CreatedAt` / `__mj_UpdatedAt`
|
|
38
|
+
* stamps don't count: every entity has them, so counting them would offer Calendar everywhere and
|
|
39
|
+
* open it on "created at". Nor does a `time` column: it maps to a Date but holds no day.
|
|
40
|
+
*/
|
|
41
|
+
export function IsCalendarDateField(field) {
|
|
42
|
+
const type = (field.Type ?? '').trim().toLowerCase();
|
|
43
|
+
const isTimeOnly = type === 'time' || type.startsWith('time with');
|
|
44
|
+
return field.TSType === EntityFieldTSType.Date && !isTimeOnly && !field.Name.toLowerCase().startsWith('__mj_');
|
|
45
|
+
}
|
|
46
|
+
/** The entity's date fields: `DefaultInView` ones first, each group by Sequence (Timeline's order). */
|
|
47
|
+
export function GetCalendarDateFields(entity) {
|
|
48
|
+
const dateFields = entity?.Fields.filter(IsCalendarDateField) ?? [];
|
|
49
|
+
const bySequence = (a, b) => a.Sequence - b.Sequence;
|
|
50
|
+
return [...dateFields.filter((f) => f.DefaultInView).sort(bySequence), ...dateFields.filter((f) => !f.DefaultInView).sort(bySequence)];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolves the configured start and end fields against the entity. A start that is missing or
|
|
54
|
+
* not a date field falls back to the first date field; an end that is missing, not a date field,
|
|
55
|
+
* or the same as the start is dropped (records then sit on their start).
|
|
56
|
+
*/
|
|
57
|
+
export function ResolveCalendarFields(entity, config) {
|
|
58
|
+
const dateFields = GetCalendarDateFields(entity);
|
|
59
|
+
const find = (name) => (name ? dateFields.find((f) => f.Name.toLowerCase() === name.toLowerCase()) : undefined);
|
|
60
|
+
const start = find(config.startFieldName) ?? dateFields[0];
|
|
61
|
+
const end = find(config.endFieldName);
|
|
62
|
+
const toField = (f) => (f ? { Name: f.Name, DateOnly: IsDateOnlySQLType(f.Type) } : null);
|
|
63
|
+
return { Start: toField(start), End: end && end !== start ? toField(end) : null };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Places one record. Returns null when it has no valid start. With no end (no end field, an
|
|
67
|
+
* empty value, or an end before the start) it sits on its start day. A date-only end is
|
|
68
|
+
* inclusive; a timestamp end is exclusive, so a meeting ending at midnight stays off the next day.
|
|
69
|
+
*/
|
|
70
|
+
export function BuildCalendarItem(record, start, end) {
|
|
71
|
+
const startDate = ToCalendarDate(record[start.Name], start.DateOnly);
|
|
72
|
+
if (!startDate) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const firstDay = StartOfDay(startDate);
|
|
76
|
+
const endDate = end ? ToCalendarDate(record[end.Name], end.DateOnly) : null;
|
|
77
|
+
let lastDay = firstDay;
|
|
78
|
+
if (end && endDate && endDate.getTime() > startDate.getTime()) {
|
|
79
|
+
lastDay = end.DateOnly ? StartOfDay(endDate) : StartOfDay(new Date(endDate.getTime() - 1));
|
|
80
|
+
}
|
|
81
|
+
return { Record: record, Start: startDate, FirstDay: firstDay, LastDay: lastDay, AllDay: start.DateOnly };
|
|
82
|
+
}
|
|
83
|
+
/** Places every record that has a valid start; records without one are left out. */
|
|
84
|
+
export function BuildCalendarItems(records, start, end) {
|
|
85
|
+
if (!start) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
const items = [];
|
|
89
|
+
for (const record of records) {
|
|
90
|
+
const item = BuildCalendarItem(record, start, end);
|
|
91
|
+
if (item) {
|
|
92
|
+
items.push(item);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return items;
|
|
96
|
+
}
|
|
97
|
+
/** The month grid's weeks (Monday-first) around `anchor`, from the shared `BuildCalendarWeeks`. */
|
|
98
|
+
export function GetMonthWeeks(anchor) {
|
|
99
|
+
return BuildCalendarWeeks(anchor, 1).map((week) => week.map((day) => day.date));
|
|
100
|
+
}
|
|
101
|
+
/** The days a layout shows: one day, the Monday-to-Sunday week, or the month grid. */
|
|
102
|
+
export function GetVisibleDays(mode, anchor) {
|
|
103
|
+
if (mode === 'day') {
|
|
104
|
+
return [StartOfDay(anchor)];
|
|
105
|
+
}
|
|
106
|
+
if (mode === 'week') {
|
|
107
|
+
const monday = StartOfWeek(anchor);
|
|
108
|
+
return Array.from({ length: 7 }, (_, i) => AddDays(monday, i));
|
|
109
|
+
}
|
|
110
|
+
return GetMonthWeeks(anchor).flat();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Groups items onto the given days (keyed by {@link DayKey}). A spanning item lands on every
|
|
114
|
+
* visible day it covers; each day's items are ordered by start. Work per item is bounded by the
|
|
115
|
+
* visible range, so a long span costs no more than the days on screen.
|
|
116
|
+
*/
|
|
117
|
+
export function GroupItemsByDay(items, days) {
|
|
118
|
+
const byDay = new Map(days.map((d) => [DayKey(d), []]));
|
|
119
|
+
if (days.length === 0) {
|
|
120
|
+
return byDay;
|
|
121
|
+
}
|
|
122
|
+
const rangeFirst = days[0];
|
|
123
|
+
const rangeLast = days[days.length - 1];
|
|
124
|
+
for (const item of items) {
|
|
125
|
+
if (item.LastDay < rangeFirst || item.FirstDay > rangeLast) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const last = item.LastDay < rangeLast ? item.LastDay : rangeLast;
|
|
129
|
+
for (let day = item.FirstDay > rangeFirst ? item.FirstDay : rangeFirst; day <= last; day = AddDays(day, 1)) {
|
|
130
|
+
byDay.get(DayKey(day))?.push(item);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
for (const list of byDay.values()) {
|
|
134
|
+
list.sort((a, b) => a.Start.getTime() - b.Start.getTime());
|
|
135
|
+
}
|
|
136
|
+
return byDay;
|
|
137
|
+
}
|
|
138
|
+
/** Moves the anchor one layout back (-1) or forward (1): a day, a week, or a month. */
|
|
139
|
+
export function ShiftAnchor(mode, anchor, step) {
|
|
140
|
+
if (mode === 'month') {
|
|
141
|
+
return new Date(anchor.getFullYear(), anchor.getMonth() + step, 1);
|
|
142
|
+
}
|
|
143
|
+
return AddDays(anchor, mode === 'week' ? 7 * step : step);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=calendar-placement.js.map
|
|
@@ -0,0 +1 @@
|
|
|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,IAAY;IACxE,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import { EntityFieldInfo, EntityFieldTSType, EntityInfo, IsDateOnlySQLType } from '@memberjunction/core';\nimport { BuildCalendarWeeks, WEEK_DAYS } from '@memberjunction/ng-ui-components';\n\n/**\n * Calendar view type — placement logic.\n *\n * Pure functions (no Angular) that turn plain record rows into items on calendar days. The\n * renderer only binds what these return. Weeks start on Monday (ISO 8601), the rule the\n * bound-data-access plan fixes for v1. Days are local-time midnights: a timestamp field is an\n * instant shown in the viewer's zone; a SQL `date` field is a calendar day and stays on that\n * day in every zone.\n */\n\n/** The three calendar layouts. */\nexport type CalendarMode = 'day' | 'week' | 'month';\n\n/**\n * The persisted configuration for the Calendar view type. Keys are camelCase, like every other\n * view type's opaque config blob (Timeline's `dateFieldName`, Map's `renderMode`, the grid's\n * `gridState`), since the host stores them side by side in `DisplayState.viewTypeConfigs`.\n */\nexport interface CalendarViewConfig {\n /** The date field a record starts on. Defaults to the entity's first date field. */\n startFieldName?: string; // case-violation-ok-legacy-back-compat: persisted view-type config keys are camelCase in every view type (DisplayState.viewTypeConfigs)\n /** Optional date field a record ends on; with it a record spans its days. */\n endFieldName?: string; // case-violation-ok-legacy-back-compat: persisted view-type config keys are camelCase in every view type (DisplayState.viewTypeConfigs)\n /** The layout the view opens in. Defaults to `'month'`. */\n mode?: CalendarMode; // case-violation-ok-legacy-back-compat: persisted view-type config keys are camelCase in every view type (DisplayState.viewTypeConfigs)\n}\n\n/** A date field resolved for placement: its name and whether it holds a calendar day. */\nexport interface CalendarField {\n Name: string;\n DateOnly: boolean;\n}\n\n/** A record resolved to the days it covers. */\nexport interface CalendarItem {\n /** The raw row, emitted as-is on select/open. */\n Record: Record<string, unknown>;\n /** The start: an instant, or local midnight of the stored day for a date-only field. */\n Start: Date;\n /** Local midnight of the first day the item sits on. */\n FirstDay: Date;\n /** Local midnight of the last day the item sits on (inclusive). */\n LastDay: Date;\n /** True when the start field is date-only, so the item has no time of day. */\n AllDay: boolean;\n}\n\n/** Day-of-week labels in Monday-first order, from the shared datepicker labels. */\nexport const CALENDAR_WEEK_DAYS: string[] = [...WEEK_DAYS.slice(1), WEEK_DAYS[0]];\n\n/** Local midnight of `date`'s day. */\nexport function StartOfDay(date: Date): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n}\n\n/** `date`'s day moved by `days` (DST-safe: works on the calendar fields, not milliseconds). */\nexport function AddDays(date: Date, days: number): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);\n}\n\n/** Local midnight of the Monday that starts `date`'s week. */\nexport function StartOfWeek(date: Date): Date {\n return AddDays(date, -((date.getDay() + 6) % 7));\n}\n\n/** A number unique to a local calendar day (yyyymmdd), used to key days in maps. */\nexport function DayKey(date: Date): number {\n return date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate();\n}\n\n/**\n * Parses a field value into a Date. A date-only value arrives as UTC midnight (or a bare\n * `yyyy-mm-dd` string, which JavaScript also reads as UTC); its UTC calendar day becomes local\n * midnight, so it never shifts a day west of Greenwich. Returns null for empty or invalid values.\n */\nexport function ToCalendarDate(value: unknown, dateOnly: boolean): Date | null {\n if (value == null || value === '') {\n return null;\n }\n const date = value instanceof Date ? value : typeof value === 'string' || typeof value === 'number' ? new Date(value) : null;\n if (!date || isNaN(date.getTime())) {\n return null;\n }\n return dateOnly ? new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) : date;\n}\n\n/**\n * True for a date field a calendar can place records by. MJ's `__mj_CreatedAt` / `__mj_UpdatedAt`\n * stamps don't count: every entity has them, so counting them would offer Calendar everywhere and\n * open it on \"created at\". Nor does a `time` column: it maps to a Date but holds no day.\n */\nexport function IsCalendarDateField(field: EntityFieldInfo): boolean {\n const type = (field.Type ?? '').trim().toLowerCase();\n const isTimeOnly = type === 'time' || type.startsWith('time with');\n return field.TSType === EntityFieldTSType.Date && !isTimeOnly && !field.Name.toLowerCase().startsWith('__mj_');\n}\n\n/** The entity's date fields: `DefaultInView` ones first, each group by Sequence (Timeline's order). */\nexport function GetCalendarDateFields(entity: EntityInfo | null): EntityFieldInfo[] {\n const dateFields = entity?.Fields.filter(IsCalendarDateField) ?? [];\n const bySequence = (a: EntityFieldInfo, b: EntityFieldInfo) => a.Sequence - b.Sequence;\n return [...dateFields.filter((f) => f.DefaultInView).sort(bySequence), ...dateFields.filter((f) => !f.DefaultInView).sort(bySequence)];\n}\n\n/**\n * Resolves the configured start and end fields against the entity. A start that is missing or\n * not a date field falls back to the first date field; an end that is missing, not a date field,\n * or the same as the start is dropped (records then sit on their start).\n */\nexport function ResolveCalendarFields(entity: EntityInfo | null, config: CalendarViewConfig): { Start: CalendarField | null; End: CalendarField | null } {\n const dateFields = GetCalendarDateFields(entity);\n const find = (name?: string) => (name ? dateFields.find((f) => f.Name.toLowerCase() === name.toLowerCase()) : undefined);\n const start = find(config.startFieldName) ?? dateFields[0];\n const end = find(config.endFieldName);\n const toField = (f: EntityFieldInfo | undefined): CalendarField | null => (f ? { Name: f.Name, DateOnly: IsDateOnlySQLType(f.Type) } : null);\n return { Start: toField(start), End: end && end !== start ? toField(end) : null };\n}\n\n/**\n * Places one record. Returns null when it has no valid start. With no end (no end field, an\n * empty value, or an end before the start) it sits on its start day. A date-only end is\n * inclusive; a timestamp end is exclusive, so a meeting ending at midnight stays off the next day.\n */\nexport function BuildCalendarItem(record: Record<string, unknown>, start: CalendarField, end: CalendarField | null): CalendarItem | null {\n const startDate = ToCalendarDate(record[start.Name], start.DateOnly);\n if (!startDate) {\n return null;\n }\n const firstDay = StartOfDay(startDate);\n const endDate = end ? ToCalendarDate(record[end.Name], end.DateOnly) : null;\n let lastDay = firstDay;\n if (end && endDate && endDate.getTime() > startDate.getTime()) {\n lastDay = end.DateOnly ? StartOfDay(endDate) : StartOfDay(new Date(endDate.getTime() - 1));\n }\n return { Record: record, Start: startDate, FirstDay: firstDay, LastDay: lastDay, AllDay: start.DateOnly };\n}\n\n/** Places every record that has a valid start; records without one are left out. */\nexport function BuildCalendarItems(records: Record<string, unknown>[], start: CalendarField | null, end: CalendarField | null): CalendarItem[] {\n if (!start) {\n return [];\n }\n const items: CalendarItem[] = [];\n for (const record of records) {\n const item = BuildCalendarItem(record, start, end);\n if (item) {\n items.push(item);\n }\n }\n return items;\n}\n\n/** The month grid's weeks (Monday-first) around `anchor`, from the shared `BuildCalendarWeeks`. */\nexport function GetMonthWeeks(anchor: Date): Date[][] {\n return BuildCalendarWeeks(anchor, 1).map((week) => week.map((day) => day.date));\n}\n\n/** The days a layout shows: one day, the Monday-to-Sunday week, or the month grid. */\nexport function GetVisibleDays(mode: CalendarMode, anchor: Date): Date[] {\n if (mode === 'day') {\n return [StartOfDay(anchor)];\n }\n if (mode === 'week') {\n const monday = StartOfWeek(anchor);\n return Array.from({ length: 7 }, (_, i) => AddDays(monday, i));\n }\n return GetMonthWeeks(anchor).flat();\n}\n\n/**\n * Groups items onto the given days (keyed by {@link DayKey}). A spanning item lands on every\n * visible day it covers; each day's items are ordered by start. Work per item is bounded by the\n * visible range, so a long span costs no more than the days on screen.\n */\nexport function GroupItemsByDay(items: CalendarItem[], days: Date[]): Map<number, CalendarItem[]> {\n const byDay = new Map<number, CalendarItem[]>(days.map((d) => [DayKey(d), []]));\n if (days.length === 0) {\n return byDay;\n }\n const rangeFirst = days[0];\n const rangeLast = days[days.length - 1];\n for (const item of items) {\n if (item.LastDay < rangeFirst || item.FirstDay > rangeLast) {\n continue;\n }\n const last = item.LastDay < rangeLast ? item.LastDay : rangeLast;\n for (let day = item.FirstDay > rangeFirst ? item.FirstDay : rangeFirst; day <= last; day = AddDays(day, 1)) {\n byDay.get(DayKey(day))?.push(item);\n }\n }\n for (const list of byDay.values()) {\n list.sort((a, b) => a.Start.getTime() - b.Start.getTime());\n }\n return byDay;\n}\n\n/** Moves the anchor one layout back (-1) or forward (1): a day, a week, or a month. */\nexport function ShiftAnchor(mode: CalendarMode, anchor: Date, step: -1 | 1): Date {\n if (mode === 'month') {\n return new Date(anchor.getFullYear(), anchor.getMonth() + step, 1);\n }\n return AddDays(anchor, mode === 'week' ? 7 * step : step);\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { EntityFieldInfo, EntityInfo } from '@memberjunction/core';
|
|
3
|
+
import { IViewPropSheet } from '../view-type.contracts';
|
|
4
|
+
import { CalendarMode, CalendarViewConfig } from './calendar-placement';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* CalendarViewPropSheetComponent
|
|
8
|
+
* ------------------------------
|
|
9
|
+
* The Calendar view type's configuration sheet ({@link IViewPropSheet}): the start field, the
|
|
10
|
+
* optional end field, and the layout the view opens in. Emits the full config on every change.
|
|
11
|
+
*
|
|
12
|
+
* Inputs/outputs use the camelCase names the {@link IViewPropSheet} contract mandates.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CalendarViewPropSheetComponent implements IViewPropSheet<CalendarViewConfig> {
|
|
15
|
+
private _entity;
|
|
16
|
+
/** The entity whose date fields are offered. */
|
|
17
|
+
set entity(value: EntityInfo | null);
|
|
18
|
+
get entity(): EntityInfo | null;
|
|
19
|
+
/** The current configuration. */
|
|
20
|
+
config: CalendarViewConfig;
|
|
21
|
+
/** Emitted with the full updated configuration on every change. */
|
|
22
|
+
configChange: EventEmitter<CalendarViewConfig>;
|
|
23
|
+
/** The entity's date fields, in the order the calendar falls back through them. */
|
|
24
|
+
DateFields: EntityFieldInfo[];
|
|
25
|
+
/** The effective start field (the configured one, or the default the calendar uses). */
|
|
26
|
+
get StartFieldName(): string;
|
|
27
|
+
/** The effective end field, or '' for none. */
|
|
28
|
+
get EndFieldName(): string;
|
|
29
|
+
/** The layout the view opens in. */
|
|
30
|
+
get Mode(): CalendarMode;
|
|
31
|
+
/** Apply a partial change and emit the full config. */
|
|
32
|
+
Patch(change: Partial<CalendarViewConfig>): void;
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarViewPropSheetComponent, never>;
|
|
34
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CalendarViewPropSheetComponent, "mj-calendar-view-prop-sheet", never, { "entity": { "alias": "entity"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "configChange": "configChange"; }, never, never, false, never>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=calendar-view-prop-sheet.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-view-prop-sheet.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/view-types/renderers/calendar-view-prop-sheet.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAqB,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAgD,MAAM,sBAAsB,CAAC;;AAEtH;;;;;;;GAOG;AACH,qBA0Ca,8BAA+B,YAAW,cAAc,CAAC,kBAAkB,CAAC;IACvF,OAAO,CAAC,OAAO,CAA2B;IAC1C,gDAAgD;IAChD,IACI,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,EAGlC;IACD,IAAI,MAAM,IAAI,UAAU,GAAG,IAAI,CAE9B;IAED,iCAAiC;IACxB,MAAM,EAAE,kBAAkB,CAAM;IAEzC,mEAAmE;IACzD,YAAY,mCAA0C;IAEhE,mFAAmF;IAC5E,UAAU,EAAE,eAAe,EAAE,CAAM;IAE1C,wFAAwF;IACxF,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,+CAA+C;IAC/C,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,oCAAoC;IACpC,IAAI,IAAI,IAAI,YAAY,CAEvB;IAED,uDAAuD;IACvD,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI;yCArCrC,8BAA8B;2CAA9B,8BAA8B;CAyC1C"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { GetCalendarDateFields, ResolveCalendarFields } from './calendar-placement';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "@angular/forms";
|
|
5
|
+
const _forTrack0 = ($index, $item) => $item.Name;
|
|
6
|
+
function CalendarViewPropSheetComponent_For_6_Template(rf, ctx) { if (rf & 1) {
|
|
7
|
+
i0.ɵɵelementStart(0, "option", 3);
|
|
8
|
+
i0.ɵɵtext(1);
|
|
9
|
+
i0.ɵɵelementEnd();
|
|
10
|
+
} if (rf & 2) {
|
|
11
|
+
const field_r1 = ctx.$implicit;
|
|
12
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
13
|
+
i0.ɵɵproperty("value", field_r1.Name)("selected", field_r1.Name === ctx_r1.StartFieldName);
|
|
14
|
+
i0.ɵɵadvance();
|
|
15
|
+
i0.ɵɵtextInterpolate(field_r1.DisplayNameOrName);
|
|
16
|
+
} }
|
|
17
|
+
function CalendarViewPropSheetComponent_For_14_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
i0.ɵɵelementStart(0, "option", 3);
|
|
19
|
+
i0.ɵɵtext(1);
|
|
20
|
+
i0.ɵɵelementEnd();
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const field_r3 = i0.ɵɵnextContext().$implicit;
|
|
23
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
24
|
+
i0.ɵɵproperty("value", field_r3.Name)("selected", field_r3.Name === ctx_r1.EndFieldName);
|
|
25
|
+
i0.ɵɵadvance();
|
|
26
|
+
i0.ɵɵtextInterpolate(field_r3.DisplayNameOrName);
|
|
27
|
+
} }
|
|
28
|
+
function CalendarViewPropSheetComponent_For_14_Template(rf, ctx) { if (rf & 1) {
|
|
29
|
+
i0.ɵɵconditionalCreate(0, CalendarViewPropSheetComponent_For_14_Conditional_0_Template, 2, 3, "option", 3);
|
|
30
|
+
} if (rf & 2) {
|
|
31
|
+
const field_r3 = ctx.$implicit;
|
|
32
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
33
|
+
i0.ɵɵconditional(field_r3.Name !== ctx_r1.StartFieldName ? 0 : -1);
|
|
34
|
+
} }
|
|
35
|
+
/**
|
|
36
|
+
* CalendarViewPropSheetComponent
|
|
37
|
+
* ------------------------------
|
|
38
|
+
* The Calendar view type's configuration sheet ({@link IViewPropSheet}): the start field, the
|
|
39
|
+
* optional end field, and the layout the view opens in. Emits the full config on every change.
|
|
40
|
+
*
|
|
41
|
+
* Inputs/outputs use the camelCase names the {@link IViewPropSheet} contract mandates.
|
|
42
|
+
*/
|
|
43
|
+
export class CalendarViewPropSheetComponent {
|
|
44
|
+
_entity = null;
|
|
45
|
+
/** The entity whose date fields are offered. */
|
|
46
|
+
set entity(value) {
|
|
47
|
+
this._entity = value;
|
|
48
|
+
this.DateFields = GetCalendarDateFields(value);
|
|
49
|
+
}
|
|
50
|
+
get entity() {
|
|
51
|
+
return this._entity;
|
|
52
|
+
}
|
|
53
|
+
/** The current configuration. */
|
|
54
|
+
config = {};
|
|
55
|
+
/** Emitted with the full updated configuration on every change. */
|
|
56
|
+
configChange = new EventEmitter();
|
|
57
|
+
/** The entity's date fields, in the order the calendar falls back through them. */
|
|
58
|
+
DateFields = [];
|
|
59
|
+
/** The effective start field (the configured one, or the default the calendar uses). */
|
|
60
|
+
get StartFieldName() {
|
|
61
|
+
return ResolveCalendarFields(this._entity, this.config ?? {}).Start?.Name ?? '';
|
|
62
|
+
}
|
|
63
|
+
/** The effective end field, or '' for none. */
|
|
64
|
+
get EndFieldName() {
|
|
65
|
+
return ResolveCalendarFields(this._entity, this.config ?? {}).End?.Name ?? '';
|
|
66
|
+
}
|
|
67
|
+
/** The layout the view opens in. */
|
|
68
|
+
get Mode() {
|
|
69
|
+
return this.config?.mode ?? 'month';
|
|
70
|
+
}
|
|
71
|
+
/** Apply a partial change and emit the full config. */
|
|
72
|
+
Patch(change) {
|
|
73
|
+
this.config = { ...this.config, ...change };
|
|
74
|
+
this.configChange.emit(this.config);
|
|
75
|
+
}
|
|
76
|
+
static ɵfac = function CalendarViewPropSheetComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CalendarViewPropSheetComponent)(); };
|
|
77
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: CalendarViewPropSheetComponent, selectors: [["mj-calendar-view-prop-sheet"]], inputs: { entity: "entity", config: "config" }, outputs: { configChange: "configChange" }, standalone: false, decls: 25, vars: 4, consts: [[1, "calendar-prop-sheet"], [1, "calendar-prop-row"], [1, "mj-input", 3, "change"], [3, "value", "selected"], ["value", "", 3, "selected"], ["value", "day", 3, "selected"], ["value", "week", 3, "selected"], ["value", "month", 3, "selected"]], template: function CalendarViewPropSheetComponent_Template(rf, ctx) { if (rf & 1) {
|
|
78
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "label", 1)(2, "span");
|
|
79
|
+
i0.ɵɵtext(3, "Starts on");
|
|
80
|
+
i0.ɵɵelementEnd();
|
|
81
|
+
i0.ɵɵelementStart(4, "select", 2);
|
|
82
|
+
i0.ɵɵlistener("change", function CalendarViewPropSheetComponent_Template_select_change_4_listener($event) { return ctx.Patch({ startFieldName: $event.target.value }); });
|
|
83
|
+
i0.ɵɵrepeaterCreate(5, CalendarViewPropSheetComponent_For_6_Template, 2, 3, "option", 3, _forTrack0);
|
|
84
|
+
i0.ɵɵelementEnd()();
|
|
85
|
+
i0.ɵɵelementStart(7, "label", 1)(8, "span");
|
|
86
|
+
i0.ɵɵtext(9, "Ends on");
|
|
87
|
+
i0.ɵɵelementEnd();
|
|
88
|
+
i0.ɵɵelementStart(10, "select", 2);
|
|
89
|
+
i0.ɵɵlistener("change", function CalendarViewPropSheetComponent_Template_select_change_10_listener($event) { return ctx.Patch({ endFieldName: $event.target.value || undefined }); });
|
|
90
|
+
i0.ɵɵelementStart(11, "option", 4);
|
|
91
|
+
i0.ɵɵtext(12, "(none: one day)");
|
|
92
|
+
i0.ɵɵelementEnd();
|
|
93
|
+
i0.ɵɵrepeaterCreate(13, CalendarViewPropSheetComponent_For_14_Template, 1, 1, null, null, _forTrack0);
|
|
94
|
+
i0.ɵɵelementEnd()();
|
|
95
|
+
i0.ɵɵelementStart(15, "label", 1)(16, "span");
|
|
96
|
+
i0.ɵɵtext(17, "Opens in");
|
|
97
|
+
i0.ɵɵelementEnd();
|
|
98
|
+
i0.ɵɵelementStart(18, "select", 2);
|
|
99
|
+
i0.ɵɵlistener("change", function CalendarViewPropSheetComponent_Template_select_change_18_listener($event) { return ctx.Patch({ mode: $event.target.value }); });
|
|
100
|
+
i0.ɵɵelementStart(19, "option", 5);
|
|
101
|
+
i0.ɵɵtext(20, "Day");
|
|
102
|
+
i0.ɵɵelementEnd();
|
|
103
|
+
i0.ɵɵelementStart(21, "option", 6);
|
|
104
|
+
i0.ɵɵtext(22, "Week");
|
|
105
|
+
i0.ɵɵelementEnd();
|
|
106
|
+
i0.ɵɵelementStart(23, "option", 7);
|
|
107
|
+
i0.ɵɵtext(24, "Month");
|
|
108
|
+
i0.ɵɵelementEnd()()()();
|
|
109
|
+
} if (rf & 2) {
|
|
110
|
+
i0.ɵɵadvance(5);
|
|
111
|
+
i0.ɵɵrepeater(ctx.DateFields);
|
|
112
|
+
i0.ɵɵadvance(6);
|
|
113
|
+
i0.ɵɵproperty("selected", !ctx.EndFieldName);
|
|
114
|
+
i0.ɵɵadvance(2);
|
|
115
|
+
i0.ɵɵrepeater(ctx.DateFields);
|
|
116
|
+
i0.ɵɵadvance(6);
|
|
117
|
+
i0.ɵɵproperty("selected", ctx.Mode === "day");
|
|
118
|
+
i0.ɵɵadvance(2);
|
|
119
|
+
i0.ɵɵproperty("selected", ctx.Mode === "week");
|
|
120
|
+
i0.ɵɵadvance(2);
|
|
121
|
+
i0.ɵɵproperty("selected", ctx.Mode === "month");
|
|
122
|
+
} }, dependencies: [i1.NgSelectOption, i1.ɵNgSelectMultipleOption], styles: ["\n .calendar-prop-sheet { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; }\n .calendar-prop-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mj-text-secondary); min-width: 160px; }\n "], encapsulation: 2 });
|
|
123
|
+
}
|
|
124
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CalendarViewPropSheetComponent, [{
|
|
125
|
+
type: Component,
|
|
126
|
+
args: [{ standalone: false, selector: 'mj-calendar-view-prop-sheet', encapsulation: ViewEncapsulation.None, template: `
|
|
127
|
+
<div class="calendar-prop-sheet">
|
|
128
|
+
<label class="calendar-prop-row">
|
|
129
|
+
<span>Starts on</span>
|
|
130
|
+
<select class="mj-input" (change)="Patch({ startFieldName: $any($event.target).value })">
|
|
131
|
+
@for (field of DateFields; track field.Name) {
|
|
132
|
+
<option [value]="field.Name" [selected]="field.Name === StartFieldName">{{ field.DisplayNameOrName }}</option>
|
|
133
|
+
}
|
|
134
|
+
</select>
|
|
135
|
+
</label>
|
|
136
|
+
|
|
137
|
+
<label class="calendar-prop-row">
|
|
138
|
+
<span>Ends on</span>
|
|
139
|
+
<select class="mj-input" (change)="Patch({ endFieldName: $any($event.target).value || undefined })">
|
|
140
|
+
<option value="" [selected]="!EndFieldName">(none: one day)</option>
|
|
141
|
+
@for (field of DateFields; track field.Name) {
|
|
142
|
+
@if (field.Name !== StartFieldName) {
|
|
143
|
+
<option [value]="field.Name" [selected]="field.Name === EndFieldName">{{ field.DisplayNameOrName }}</option>
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
</select>
|
|
147
|
+
</label>
|
|
148
|
+
|
|
149
|
+
<label class="calendar-prop-row">
|
|
150
|
+
<span>Opens in</span>
|
|
151
|
+
<select class="mj-input" (change)="Patch({ mode: $any($event.target).value })">
|
|
152
|
+
<option value="day" [selected]="Mode === 'day'">Day</option>
|
|
153
|
+
<option value="week" [selected]="Mode === 'week'">Week</option>
|
|
154
|
+
<option value="month" [selected]="Mode === 'month'">Month</option>
|
|
155
|
+
</select>
|
|
156
|
+
</label>
|
|
157
|
+
</div>
|
|
158
|
+
`, styles: ["\n .calendar-prop-sheet { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; }\n .calendar-prop-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mj-text-secondary); min-width: 160px; }\n "] }]
|
|
159
|
+
}], null, { entity: [{
|
|
160
|
+
type: Input
|
|
161
|
+
}], config: [{
|
|
162
|
+
type: Input
|
|
163
|
+
}], configChange: [{
|
|
164
|
+
type: Output
|
|
165
|
+
}] }); })();
|
|
166
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(CalendarViewPropSheetComponent, { className: "CalendarViewPropSheetComponent", filePath: "src/lib/view-types/renderers/calendar-view-prop-sheet.component.ts", lineNumber: 56 }); })();
|
|
167
|
+
//# sourceMappingURL=calendar-view-prop-sheet.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-view-prop-sheet.component.js","sourceRoot":"","sources":["../../../../src/lib/view-types/renderers/calendar-view-prop-sheet.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG1F,OAAO,EAAoC,qBAAqB,EAAE,qBAAqB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ewEncapsulation } from '@angular/core';\nimport { EntityFieldInfo, EntityInfo } from '@memberjunction/core';\nimport { IViewPropSheet } from '../view-type.contracts';\nimport { CalendarMode, CalendarViewConfig, GetCalendarDateFields, ResolveCalendarFields } from './calendar-placement';\n\n/**\n * CalendarViewPropSheetComponent\n * ------------------------------\n * The Calendar view type's configuration sheet ({@link IViewPropSheet}): the start field, the\n * optional end field, and the layout the view opens in. Emits the full config on every change.\n *\n * Inputs/outputs use the camelCase names the {@link IViewPropSheet} contract mandates.\n */\n@Component({\n standalone: false,\n selector: 'mj-calendar-view-prop-sheet',\n encapsulation: ViewEncapsulation.None,\n template: `\n <div class=\"calendar-prop-sheet\">\n <label class=\"calendar-prop-row\">\n <span>Starts on</span>\n <select class=\"mj-input\" (change)=\"Patch({ startFieldName: $any($event.target).value })\">\n @for (field of DateFields; track field.Name) {\n <option [value]=\"field.Name\" [selected]=\"field.Name === StartFieldName\">{{ field.DisplayNameOrName }}</option>\n }\n </select>\n </label>\n\n <label class=\"calendar-prop-row\">\n <span>Ends on</span>\n <select class=\"mj-input\" (change)=\"Patch({ endFieldName: $any($event.target).value || undefined })\">\n <option value=\"\" [selected]=\"!EndFieldName\">(none: one day)</option>\n @for (field of DateFields; track field.Name) {\n @if (field.Name !== StartFieldName) {\n <option [value]=\"field.Name\" [selected]=\"field.Name === EndFieldName\">{{ field.DisplayNameOrName }}</option>\n }\n }\n </select>\n </label>\n\n <label class=\"calendar-prop-row\">\n <span>Opens in</span>\n <select class=\"mj-input\" (change)=\"Patch({ mode: $any($event.target).value })\">\n <option value=\"day\" [selected]=\"Mode === 'day'\">Day</option>\n <option value=\"week\" [selected]=\"Mode === 'week'\">Week</option>\n <option value=\"month\" [selected]=\"Mode === 'month'\">Month</option>\n </select>\n </label>\n </div>\n `,\n styles: [`\n .calendar-prop-sheet { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; }\n .calendar-prop-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--mj-text-secondary); min-width: 160px; }\n `],\n})\nexport class CalendarViewPropSheetComponent implements IViewPropSheet<CalendarViewConfig> {\n private _entity: EntityInfo | null = null;\n /** The entity whose date fields are offered. */\n @Input()\n set entity(value: EntityInfo | null) {\n this._entity = value;\n this.DateFields = GetCalendarDateFields(value);\n }\n get entity(): EntityInfo | null {\n return this._entity;\n }\n\n /** The current configuration. */\n @Input() config: CalendarViewConfig = {};\n\n /** Emitted with the full updated configuration on every change. */\n @Output() configChange = new EventEmitter<CalendarViewConfig>();\n\n /** The entity's date fields, in the order the calendar falls back through them. */\n public DateFields: EntityFieldInfo[] = [];\n\n /** The effective start field (the configured one, or the default the calendar uses). */\n get StartFieldName(): string {\n return ResolveCalendarFields(this._entity, this.config ?? {}).Start?.Name ?? '';\n }\n\n /** The effective end field, or '' for none. */\n get EndFieldName(): string {\n return ResolveCalendarFields(this._entity, this.config ?? {}).End?.Name ?? '';\n }\n\n /** The layout the view opens in. */\n get Mode(): CalendarMode {\n return this.config?.mode ?? 'month';\n }\n\n /** Apply a partial change and emit the full config. */\n Patch(change: Partial<CalendarViewConfig>): void {\n this.config = { ...this.config, ...change };\n this.configChange.emit(this.config);\n }\n}\n"]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { EntityInfo } from '@memberjunction/core';
|
|
3
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
4
|
+
import { IViewRenderer, ViewDataRequest } from '../view-type.contracts';
|
|
5
|
+
import { CalendarItem, CalendarMode, CalendarViewConfig } from './calendar-placement';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* CalendarViewRendererComponent
|
|
9
|
+
* -----------------------------
|
|
10
|
+
* The Calendar **view type** ({@link IViewRenderer}): records placed on a day, week (Monday
|
|
11
|
+
* first) or month layout by a start field and an optional end field named in the view's
|
|
12
|
+
* {@link CalendarViewConfig}. Placement is the pure logic in `calendar-placement.ts`; this
|
|
13
|
+
* component only holds the anchor date and binds the result.
|
|
14
|
+
*
|
|
15
|
+
* Like Map, it asks the host for the full record set (`dataRequest({ loadAll: true })`), so it
|
|
16
|
+
* sees up to the host's load-all cap rather than one page. Clicking a record emits
|
|
17
|
+
* `recordSelected` and double-clicking emits `recordOpened`, as the Cards renderer does. A gear
|
|
18
|
+
* button opens the {@link CalendarViewPropSheetComponent} inline, because no host mounts a
|
|
19
|
+
* descriptor's prop sheet yet.
|
|
20
|
+
*
|
|
21
|
+
* Inputs/outputs use the camelCase names the {@link IViewRenderer} contract mandates.
|
|
22
|
+
*/
|
|
23
|
+
export declare class CalendarViewRendererComponent extends BaseAngularComponent implements IViewRenderer<CalendarViewConfig>, OnInit {
|
|
24
|
+
private _entity;
|
|
25
|
+
/** The entity whose records are placed. */
|
|
26
|
+
set entity(value: EntityInfo | null);
|
|
27
|
+
get entity(): EntityInfo | null;
|
|
28
|
+
private _records;
|
|
29
|
+
/** The records to place (loaded/filtered by the host). */
|
|
30
|
+
set records(value: Record<string, unknown>[]);
|
|
31
|
+
get records(): Record<string, unknown>[];
|
|
32
|
+
/** Primary-key string of the selected record. Accepted for contract uniformity. */
|
|
33
|
+
selectedRecordId: string | null;
|
|
34
|
+
/** Active filter text. Accepted for contract uniformity; the host pre-filters `records`. */
|
|
35
|
+
filterText: string | null;
|
|
36
|
+
private _config;
|
|
37
|
+
/** The persisted view config: start/end fields and the layout the view opens in. */
|
|
38
|
+
set config(value: CalendarViewConfig);
|
|
39
|
+
get config(): CalendarViewConfig;
|
|
40
|
+
/** Emitted on a record click with the raw record. */
|
|
41
|
+
recordSelected: EventEmitter<unknown>;
|
|
42
|
+
/** Emitted on a record double-click with the raw record (a navigation request). */
|
|
43
|
+
recordOpened: EventEmitter<unknown>;
|
|
44
|
+
/** Emitted with the full config when the layout or the settings change. */
|
|
45
|
+
configChanged: EventEmitter<CalendarViewConfig>;
|
|
46
|
+
/** Asks the host for the full record set on init. */
|
|
47
|
+
dataRequest: EventEmitter<ViewDataRequest>;
|
|
48
|
+
/** The current layout. */
|
|
49
|
+
Mode: CalendarMode;
|
|
50
|
+
/** A date inside the period on screen. */
|
|
51
|
+
Anchor: Date;
|
|
52
|
+
/** Whether the inline settings sheet is open. */
|
|
53
|
+
ShowSettings: boolean;
|
|
54
|
+
/** Whether the entity has any date field. */
|
|
55
|
+
HasDateFields: boolean;
|
|
56
|
+
/** Month cells shown before "+N more". */
|
|
57
|
+
readonly MaxItemsPerCell = 3;
|
|
58
|
+
/** Monday-first weekday labels. */
|
|
59
|
+
readonly WeekDayLabels: string[];
|
|
60
|
+
/** The layout switch options. */
|
|
61
|
+
readonly ModeOptions: {
|
|
62
|
+
key: string;
|
|
63
|
+
label: string;
|
|
64
|
+
}[];
|
|
65
|
+
/** The month grid's weeks. */
|
|
66
|
+
MonthWeeks: Date[][];
|
|
67
|
+
/** The days of the day/week layout. */
|
|
68
|
+
VisibleDays: Date[];
|
|
69
|
+
private items;
|
|
70
|
+
private itemsByDay;
|
|
71
|
+
private titleFieldName;
|
|
72
|
+
private cdr;
|
|
73
|
+
ngOnInit(): void;
|
|
74
|
+
/** The header label for the period on screen. */
|
|
75
|
+
get Title(): string;
|
|
76
|
+
Previous(): void;
|
|
77
|
+
Next(): void;
|
|
78
|
+
Today(): void;
|
|
79
|
+
/** Switch layout (a `ModeOptions` key) and persist it as the view's mode. */
|
|
80
|
+
SetMode(key: string): void;
|
|
81
|
+
/** Open the day layout on `day` (from a month cell's "+N more"). */
|
|
82
|
+
GoToDay(day: Date): void;
|
|
83
|
+
/** Apply and persist a change from the settings sheet. */
|
|
84
|
+
OnSettingsChange(config: CalendarViewConfig): void;
|
|
85
|
+
ItemsFor(day: Date): CalendarItem[];
|
|
86
|
+
IsToday(day: Date): boolean;
|
|
87
|
+
IsFirstDay(item: CalendarItem, day: Date): boolean;
|
|
88
|
+
/** The record's display title. */
|
|
89
|
+
ItemLabel(item: CalendarItem): string;
|
|
90
|
+
/** The start time, on the item's first day only; empty for a date-only start. */
|
|
91
|
+
ItemTime(item: CalendarItem, day: Date): string;
|
|
92
|
+
DayHeader(day: Date): string;
|
|
93
|
+
OnItemClick(item: CalendarItem): void;
|
|
94
|
+
OnItemOpen(item: CalendarItem): void;
|
|
95
|
+
private moveTo;
|
|
96
|
+
/** Re-resolve fields and re-place every record (entity, records or config changed). */
|
|
97
|
+
private rebuild;
|
|
98
|
+
/** Recompute the days on screen and the items on each. */
|
|
99
|
+
private layout;
|
|
100
|
+
/** The entity's name field, else its first visible text field. */
|
|
101
|
+
private findTitleField;
|
|
102
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CalendarViewRendererComponent, never>;
|
|
103
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CalendarViewRendererComponent, "mj-calendar-view-renderer", never, { "entity": { "alias": "entity"; "required": false; }; "records": { "alias": "records"; "required": false; }; "selectedRecordId": { "alias": "selectedRecordId"; "required": false; }; "filterText": { "alias": "filterText"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "recordSelected": "recordSelected"; "recordOpened": "recordOpened"; "configChanged": "configChanged"; "dataRequest": "dataRequest"; }, never, never, false, never>;
|
|
104
|
+
}
|
|
105
|
+
/** Tree-shaking guard for the dynamically mounted renderer. */
|
|
106
|
+
export declare function LoadCalendarViewRenderer(): void;
|
|
107
|
+
//# sourceMappingURL=calendar-view-renderer.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-view-renderer.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/view-types/renderers/calendar-view-renderer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAEZ,MAAM,EAGP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAqB,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACxE,OA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