@object-ui/plugin-calendar 17.5.0 → 17.7.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/README.md CHANGED
@@ -28,8 +28,8 @@ Calendar view plugins for Object UI - includes both ObjectQL-integrated and stan
28
28
 
29
29
  | Gesture | Effect |
30
30
  | --- | --- |
31
- | Drag the event pill body to another day cell | Shifts both `startDateField` and `endDateField` by the day delta. Grab cell → drop cell defines the delta, so dragging from any day of a multi-day span works as expected. |
32
- | Drag the right-edge handle of a multi-day pill | Adjusts only `endDateField`; start is preserved. Refuses drops earlier than start. |
31
+ | Drag the event pill body to another day cell | Moves both `startDateField` and `endDateField` by the calendar days from the grabbed cell to the drop cell, each keeping its time of day: a 10:00 event stays at 10:00, even across a DST change. Grab cell → drop cell defines the days, so dragging from any day of a multi-day span works as expected. |
32
+ | Drag the right-edge handle of a multi-day pill | Moves only `endDateField` to the drop day, keeping its time of day; start is preserved. Refuses drops earlier than start. |
33
33
 
34
34
  ### Week / Day view (time grid)
35
35
 
@@ -89,7 +89,7 @@ import '@object-ui/plugin-calendar';
89
89
  // Now you can use calendar types in your schemas
90
90
  const schema = {
91
91
  type: 'calendar-view',
92
- events: [
92
+ data: [
93
93
  {
94
94
  id: '1',
95
95
  title: 'Team Meeting',
@@ -100,49 +100,138 @@ const schema = {
100
100
  };
101
101
  ```
102
102
 
103
- ### Manual Registration
103
+ ### What the side-effect import registers
104
+
105
+ Registration is *only* a side effect of importing the package — the single
106
+ `import '@object-ui/plugin-calendar'` above is the whole of it. There is no
107
+ components map to iterate over: importing the entry point runs the
108
+ `ComponentRegistry.register(...)` calls in `src/index.tsx` and
109
+ `src/calendar-view-renderer.tsx`, which claim these schema types:
110
+
111
+ | Schema `type` | Namespaced key | Renderer |
112
+ | --- | --- | --- |
113
+ | `object-calendar` | `plugin-calendar:object-calendar` | `ObjectCalendarRenderer` |
114
+ | `calendar` | `view:calendar` | `ObjectCalendarRenderer` |
115
+ | `calendar-view` | `plugin-calendar:calendar-view` | internal wrapper around `CalendarView` (not exported) |
116
+
117
+ Both spellings work — the namespaced key and the bare `type` fallback.
118
+
119
+ ### Public exports
120
+
121
+ The package exports components and their types, not a registry map:
122
+
123
+ ```typescript
124
+ import {
125
+ ObjectCalendar, // ObjectQL-integrated calendar component
126
+ CalendarView, // standalone calendar component
127
+ ObjectCalendarRenderer, // the registered renderer for `object-calendar` / `calendar`
128
+ } from '@object-ui/plugin-calendar';
129
+
130
+ import type {
131
+ ObjectCalendarComponentProps,
132
+ CalendarViewProps,
133
+ CalendarViewEvent,
134
+ } from '@object-ui/plugin-calendar';
135
+ ```
136
+
137
+ To serve the calendar under a registry key of your own, register the exported
138
+ renderer under that key:
104
139
 
105
140
  ```typescript
106
- import { calendarComponents } from '@object-ui/plugin-calendar';
107
141
  import { ComponentRegistry } from '@object-ui/core';
142
+ import { ObjectCalendarRenderer } from '@object-ui/plugin-calendar';
108
143
 
109
- // Register calendar components
110
- Object.entries(calendarComponents).forEach(([type, component]) => {
111
- ComponentRegistry.register(type, component);
112
- });
144
+ ComponentRegistry.register('my-calendar', ObjectCalendarRenderer);
113
145
  ```
114
146
 
115
147
  ## Schema API
116
148
 
117
149
  ### CalendarView
118
150
 
119
- Display a monthly calendar with events:
151
+ Display a calendar computed from the node's `data` records. This is the full
152
+ authored surface: `CalendarViewSchema` in `@object-ui/types` declares 15 keys of
153
+ its own. **13 of them are authorable**, converged on what the registered
154
+ `calendar-view` renderer actually reads (objectui#5667), and they are the ones
155
+ listed below. Two of them — `data` and `className` — refine common `BaseSchema`
156
+ keys; the rest of `BaseSchema` (`id`, `visible`, ...) applies as on any node.
157
+
158
+ **The other two are REFUSALS, not keys you can write.** `body` and `children`
159
+ are declared `never` (objectui#9256): a read-site sweep of every package that
160
+ registers a component measured that no renderer read consumes either content
161
+ channel for a `calendar-view` node — it renders events computed from `data`, not
162
+ child nodes — so authoring one is now refused at `tsc` and at validation instead
163
+ of silently rendering nothing. They are counted above because the interface
164
+ declares them; they are absent from the listing below because the listing is the
165
+ *authorable* surface.
120
166
 
121
167
  ```typescript
122
- {
123
- type: 'calendar-view',
124
- events?: CalendarEvent[],
125
- defaultDate?: string, // ISO date string
126
- onEventClick?: (event) => void,
127
- onDateClick?: (date) => void,
128
- className?: string
129
- }
168
+ import type { CalendarViewSchema, CalendarViewMode, CalendarEvent } from '@object-ui/types';
169
+
170
+ type CalendarViewNode = {
171
+ type: 'calendar-view';
172
+ data?: any; // records rendered as events (array, or a binding expression)
173
+ titleField?: string; // default 'title'
174
+ startDateField?: string; // default 'start'
175
+ endDateField?: string; // default 'end'
176
+ allDayField?: string; // default 'allDay'
177
+ colorField?: string; // default 'color'
178
+ view?: CalendarViewMode; // 'month' | 'week' | 'day' (default 'month')
179
+ currentDate?: string | Date; // ISO string authored; Date from a React host
180
+ allowCreate?: boolean; // default false — shows the "New event" button
181
+ className?: string; // Tailwind classes for the container
182
+ onEventClick?: (event: CalendarEvent) => void; // HOST-ONLY (see below)
183
+ onViewChange?: (view: CalendarViewMode) => void; // HOST-ONLY (see below)
184
+ };
185
+
186
+ // The listing above is held to the shipped type BY THE COMPILER, both
187
+ // directions, rather than by this paragraph: a key whose type here disagrees
188
+ // with what `CalendarViewSchema` declares is a compile error.
189
+ declare const authored: CalendarViewNode;
190
+ declare const shipped: CalendarViewSchema;
191
+ const forwards: CalendarViewSchema = authored;
192
+ const backwards: CalendarViewNode = shipped;
130
193
  ```
131
194
 
195
+ > **What those two assignments do and do not buy.** They check every key's
196
+ > **type**, in both directions. They do **not** check a key's **spelling**:
197
+ > `CalendarViewSchema` extends `BaseSchema`, whose `[key: string]: any` accepts
198
+ > any name, so a key invented or misspelled here is `any` rather than an error
199
+ > (objectui#7927). Key-level validity is the strict `@objectstack/spec` twin's
200
+ > question, not TypeScript's.
201
+
202
+ There is deliberately **no authorable `events` key**: the renderer computes its
203
+ events from `data` plus the field-name keys, and drops an authored `events`
204
+ (objectui#4433). Nine formerly declared keys — `events`, `defaultView`,
205
+ `defaultDate`, `date`, `views`, `editable`, `onEventCreate`, `onEventUpdate`,
206
+ `onDateChange` — were retired in objectui#5667 because nothing read them on the
207
+ authored-node path and no measured app authors them. `onDateClick` is **not**
208
+ on this schema — it is a `CalendarViewProps` component prop (see
209
+ [Drag-and-Drop](#drag-and-drop) and [Click-to-Create](#click-to-create)).
210
+
211
+ > **The handlers are host-only.** `onEventClick` and `onViewChange` are
212
+ > forwarded to the component only when the value really is a function, which
213
+ > authored JSON can never produce — supply them from a React host
214
+ > (`<SchemaRenderer ... onEventClick={fn} />`). Authored as JSON strings they
215
+ > are dropped, same as absent.
216
+
132
217
  ### Calendar Event Structure
133
218
 
134
- ```typescript
135
- interface CalendarEvent {
136
- id: string;
137
- title: string;
138
- start: string; // ISO datetime string
139
- end: string; // ISO datetime string
140
- description?: string;
141
- color?: string; // Tailwind color class
142
- allDay?: boolean;
143
- }
219
+ Events are not authored directly — the renderer computes one event per record
220
+ in the node's `data` array, reading the fields the field-name keys point at:
221
+
222
+ ```text
223
+ id: record.id // falls back to record._id, then the array index
224
+ title: record[titleField] // default field 'title'
225
+ start: record[startDateField] // default field 'start' (ISO datetime string)
226
+ end: record[endDateField] // default field 'end' (optional)
227
+ allDay: record[allDayField] // default field 'allDay'
228
+ color: record[colorField] // default field 'color'
229
+ data: record // the whole record rides along
144
230
  ```
145
231
 
232
+ `@object-ui/types` still exports the `CalendarEvent` interface — it is the
233
+ declared payload type of the host-only `onEventClick` callback.
234
+
146
235
  ## Examples
147
236
 
148
237
  ### Basic Calendar
@@ -150,7 +239,7 @@ interface CalendarEvent {
150
239
  ```typescript
151
240
  const schema = {
152
241
  type: 'calendar-view',
153
- events: [
242
+ data: [
154
243
  {
155
244
  id: '1',
156
245
  title: 'Product Launch',
@@ -169,91 +258,211 @@ const schema = {
169
258
  };
170
259
  ```
171
260
 
261
+ The records above already use the default field names (`title`, `start`, `end`,
262
+ `color`), so no field-name keys are needed; on a `calendar-view` node, point
263
+ `titleField` / `startDateField` / `endDateField` / `allDayField` / `colorField`
264
+ at your own fields when they differ. They sit flat on this node because
265
+ `CalendarViewSchema` has no `calendar` block: here the flat keys are the only
266
+ spelling. An `object-calendar` takes the same five inside its `calendar` block
267
+ instead (next section).
268
+
172
269
  ### With ObjectQL Integration
173
270
 
271
+ Every key below is one `ObjectCalendarSchema` declares. The five field-name keys
272
+ go inside the `calendar` block: `getCalendarConfig` reads that block first and
273
+ returns it whole. A misspelt start-date key inside it is therefore not a partial
274
+ failure either: no record has a date to be placed by, so every one is counted
275
+ as unscheduled under the calendar instead of drawn.
276
+
277
+ `startDateField` is the only one of the five the calendar needs — `titleField`
278
+ is optional, and an event with no explicit title resolves one through the
279
+ ADR-0079 record display-name chain. A calendar authored with no `calendar`
280
+ block renders the "Calendar configuration required" refusal screen, which says
281
+ so and also names where the key belongs: the view's `calendar` block. That
282
+ matters on an **interface page**, whose `interfaceConfig` has no calendar slot
283
+ of its own — the only lever there is `sourceView`, pointed at a view that
284
+ declares the block (objectui#8170).
285
+
286
+ The same five keys written flat on the node are **not** a second way to author
287
+ this. That flat spelling is the runtime handoff — `ObjectView` and `ListView`
288
+ emit it on the node they build, and `getCalendarConfig` falls back to it only
289
+ when the node has no `calendar` block — so `ObjectCalendarSchema` declares it
290
+ because the renderer reads it. `@objectstack/spec` refuses it at authoring with
291
+ `unrecognized_keys` and names the `calendar` block in the same diagnostic (one
292
+ key per concept, its Prime Directive #12).
293
+
174
294
  ```typescript
175
- const schema = {
295
+ import type { ObjectCalendarSchema } from '@object-ui/types';
296
+
297
+ // What this annotation buys, and what it does not - measured, objectui#7925.
298
+ // It type-checks the VALUES of the declared keys: `defaultView: 'agenda'` and
299
+ // `calendar: { titleField: 42 }` are both compile errors, and
300
+ // `check:doc-snippets` re-runs that check on every commit. It does NOT check
301
+ // key NAMES - this interface extends `BaseSchema`, whose `[key: string]: any`
302
+ // admits any spelling, and the `calendar` block is open the same way, so a
303
+ // misspelt key still compiles clean. Read the block as type-checked values,
304
+ // never as a guarded key set.
305
+ const schema: ObjectCalendarSchema = {
176
306
  type: 'object-calendar',
177
- object: 'events',
178
- titleField: 'name',
179
- startField: 'startDate',
180
- endField: 'endDate',
181
- colorField: 'category.color'
307
+ objectName: 'events',
308
+ calendar: {
309
+ titleField: 'name',
310
+ startDateField: 'startDate',
311
+ endDateField: 'endDate',
312
+ allDayField: 'isAllDay',
313
+ colorField: 'statusColor'
314
+ },
315
+ defaultView: 'month',
316
+ navigation: { mode: 'modal' } // what an event click opens - see below
182
317
  };
183
318
  ```
184
319
 
320
+ `navigation` is what an event click opens — the spec's `NavigationConfig` by
321
+ reference, `ViewNavigationConfig` in `@object-ui/types`, the type
322
+ `ObjectGridSchema.navigation` uses: `mode` (`page`, `drawer`, `modal`, `split`,
323
+ `popover`, `new_window` or `none`) with `size`, `openNewTab` and
324
+ `preventNavigation`. With the key absent a click opens the record in a drawer.
325
+ An overlay mode keeps the click from a parent view's `onRowClick` /
326
+ `onEventClick`; any other mode hands it to them. `page` — and a block written
327
+ without `mode`, which takes the spec's `page` default — opens the record page
328
+ through the record navigator the host publishes on `RelatedRecordActionsContext`
329
+ (objectui#11293); the console publishes one on its custom pages, record pages and
330
+ list views. Under a host that publishes none, such as an embedded renderer,
331
+ there is no record page to open and the click opens nothing.
332
+
185
333
  ### Interactive Calendar
186
334
 
335
+ The handlers are host-only — a function can only come from a React host
336
+ building the node in code, never from authored JSON:
337
+
187
338
  ```typescript
188
- const schema = {
339
+ import type { CalendarViewSchema } from '@object-ui/types';
340
+
341
+ // The annotation is what types the two handler parameters: `event` is
342
+ // `CalendarEvent` and `view` is `CalendarViewMode`, read off the shipped
343
+ // schema. Without it both are implicitly `any`.
344
+ const schema: CalendarViewSchema = {
189
345
  type: 'calendar-view',
190
- events: [],
346
+ data: [],
191
347
  onEventClick: (event) => {
192
- console.log('Event clicked:', event);
348
+ console.log('Event clicked:', event.title);
193
349
  // Open event details modal
194
350
  },
195
- onDateClick: (date) => {
196
- console.log('Date clicked:', date);
197
- // Create new event
351
+ onViewChange: (view) => {
352
+ console.log('View changed:', view);
353
+ // React to the calendar switching between month/week/day
198
354
  }
199
355
  };
200
356
  ```
201
357
 
358
+ Authored JSON reacts to clicks through the node's action channel instead
359
+ (`allowCreate: true` dispatches `{ type: 'create' }`; event clicks dispatch
360
+ `{ type: 'event-click' }`).
361
+
202
362
  ## ObjectQL Integration
203
363
 
204
- When using with ObjectStack, the calendar can automatically fetch and display events:
364
+ When using with ObjectStack, the calendar can automatically fetch and display
365
+ events. The adapter is **not** a schema key: `ObjectCalendarRenderer` reads it
366
+ from the renderer context that `SchemaRendererProvider` supplies. The schema
367
+ names the object with `objectName` and its fields inside the same `calendar`
368
+ block as above - there is no `fields` container.
205
369
 
206
370
  ```typescript
207
371
  import { createObjectStackAdapter } from '@object-ui/data-objectstack';
372
+ import type { ObjectCalendarSchema } from '@object-ui/types';
208
373
 
209
374
  const dataSource = createObjectStackAdapter({
210
375
  baseUrl: 'https://api.example.com',
211
376
  token: 'your-auth-token'
212
377
  });
213
378
 
214
- const schema = {
379
+ // The annotation checks the values of the declared keys, not the key names -
380
+ // see the note on the first `object-calendar` block above.
381
+ const schema: ObjectCalendarSchema = {
215
382
  type: 'object-calendar',
216
- dataSource,
217
- object: 'calendar_events',
218
- fields: {
219
- title: 'title',
220
- start: 'start_time',
221
- end: 'end_time',
222
- color: 'category_color'
223
- }
383
+ objectName: 'calendar_events',
384
+ calendar: {
385
+ titleField: 'title',
386
+ startDateField: 'start_time',
387
+ endDateField: 'end_time'
388
+ },
389
+ defaultView: 'month'
224
390
  };
225
391
  ```
226
392
 
393
+ Pass the adapter to `SchemaRendererProvider` to wire the fetch up.
394
+
395
+ **The provider does not change which query keys apply** (objectui#9061, the port
396
+ of objectui#8769). An authored `filter` and `sort` narrow and order the records
397
+ on **every** provider, inline ones included — both `staticData` and
398
+ `data: { provider: 'value', items }` reach the same in-memory adapter the
399
+ `object` provider goes through, so `filter` is evaluated with the same matcher.
400
+ Before objectui#9061 the inline provider skipped that query and drew every
401
+ authored record with an authored `filter` silently dropped. The platform row
402
+ ceiling (2,000 drawn rows, with a footnote naming both numbers — objectui#7210,
403
+ ruling a′) applies to inline records too, and it is applied to the **filtered**
404
+ set, never to the raw one: a large inline array that a `filter` cuts below the
405
+ ceiling draws every matching record and shows no footnote.
406
+
407
+ ⚠️ Two consequences of routing inline records through the adapter. They reach the
408
+ calendar as that adapter's own deep copy rather than as the authored array's
409
+ object identities, so code comparing a record handed to `onEventClick` against
410
+ the authored array with `===` needs `id` equality instead; and the copy is a JSON
411
+ round-trip, so inline records must be JSON-serializable.
412
+
227
413
  ## Customization
228
414
 
229
415
  Style the calendar with Tailwind classes:
230
416
 
231
417
  ```typescript
232
- const schema = {
418
+ import type { CalendarViewSchema } from '@object-ui/types';
419
+
420
+ const schema: CalendarViewSchema = {
233
421
  type: 'calendar-view',
234
422
  className: 'border rounded-lg shadow-lg',
235
- events: [...]
423
+ data: [] // your records
236
424
  };
237
425
  ```
238
426
 
239
427
  ## TypeScript Support
240
428
 
241
- ```typescript
242
- import type { CalendarViewSchema, CalendarEvent } from '@object-ui/plugin-calendar';
429
+ The **authored** (JSON metadata) types live in `@object-ui/types`, not in this
430
+ package — this package imports them too, and does not re-export them:
243
431
 
244
- const event: CalendarEvent = {
245
- id: '1',
246
- title: 'Meeting',
247
- start: '2024-01-15T10:00:00',
248
- end: '2024-01-15T11:00:00'
249
- };
432
+ ```typescript
433
+ import type { CalendarViewSchema } from '@object-ui/types';
250
434
 
251
435
  const schema: CalendarViewSchema = {
252
436
  type: 'calendar-view',
253
- events: [event]
437
+ data: [
438
+ { id: '1', name: 'Meeting', begins: '2024-01-15T10:00:00', ends: '2024-01-15T11:00:00' }
439
+ ],
440
+ titleField: 'name',
441
+ startDateField: 'begins',
442
+ endDateField: 'ends',
443
+ view: 'week',
444
+ allowCreate: true
254
445
  };
255
446
  ```
256
447
 
448
+ > **Two calendar event types — pick by which side you are on.**
449
+ > `@object-ui/types` exports **`CalendarEvent`**, the AUTHORING event
450
+ > (`id: string`, `start` / `end` accept ISO strings with `end` required, plus
451
+ > `description`) — since objectui#5667 it is no longer part of the authored
452
+ > surface (a `calendar-view` node carries `data` records, not events; see
453
+ > [Calendar Event Structure](#calendar-event-structure)), but it remains the
454
+ > declared payload type of the host-only `onEventClick` callback. This package
455
+ > exports **`CalendarViewEvent`** (`CalendarViewProps['events']`), the
456
+ > `CalendarView` **component's runtime** type: `id: string | number` and
457
+ > `start: Date` / `end?: Date`. They are not interchangeable — neither is
458
+ > assignable to the other.
459
+ >
460
+ > Both were spelled `CalendarEvent` until objectui#5044, where IDE auto-import
461
+ > chose between them at random and the wrong pick failed as a remote `TS2322`
462
+ > about `Date`. This package still exports `CalendarEvent` as a **`@deprecated`
463
+ > alias of `CalendarViewEvent`**, so existing importers keep compiling; write
464
+ > `CalendarViewEvent` in new code.
465
+
257
466
  ## Links
258
467
 
259
468
  - 📚 [Documentation](https://www.objectui.org/docs/plugins/plugin-calendar)
@@ -21,7 +21,27 @@ declare function resolveEventColor(raw: string | undefined | null): {
21
21
  className: string;
22
22
  inlineColor?: string;
23
23
  };
24
- export interface CalendarEvent {
24
+ /**
25
+ * The `CalendarView` component's RUNTIME event: what the React component
26
+ * receives on its `events` prop, already parsed — `start` / `end` are real
27
+ * `Date` objects, and `id` may be the numeric key a data source returned.
28
+ *
29
+ * Renamed from `CalendarEvent` in objectui#5044, following the objectui#4650
30
+ * precedent (`ObjectCalendarProps` -> `ObjectCalendarComponentProps`).
31
+ * `@object-ui/types` owns `CalendarEvent`, where it is the AUTHORING event —
32
+ * `id: string`, `start` / `end` accepting ISO strings with `end` REQUIRED, plus
33
+ * a `description` this one does not have. The two are structurally
34
+ * incompatible in BOTH directions (`id` and `start` each conflict), so picking
35
+ * the wrong one out of IDE auto-import failed as a remote `TS2322` about
36
+ * `Date`, never as "you imported from the wrong package" — measured on
37
+ * `README.md`'s own example, which stayed uncompilable through objectui#5010's
38
+ * import-path fix because both names were real exports.
39
+ *
40
+ * `index.tsx` keeps a `@deprecated` `CalendarEvent` alias for this type, so
41
+ * existing importers keep compiling; the rename is what stops the collision,
42
+ * not a removal.
43
+ */
44
+ export interface CalendarViewEvent {
25
45
  id: string | number;
26
46
  title: string;
27
47
  start: Date;
@@ -31,16 +51,16 @@ export interface CalendarEvent {
31
51
  data?: any;
32
52
  }
33
53
  export interface CalendarViewProps {
34
- events?: CalendarEvent[];
54
+ events?: CalendarViewEvent[];
35
55
  view?: "month" | "week" | "day";
36
56
  currentDate?: Date;
37
57
  locale?: string;
38
- onEventClick?: (event: CalendarEvent) => void;
58
+ onEventClick?: (event: CalendarViewEvent) => void;
39
59
  onDateClick?: (date: Date) => void;
40
60
  onViewChange?: (view: "month" | "week" | "day") => void;
41
61
  onNavigate?: (date: Date) => void;
42
62
  onAddClick?: () => void;
43
- onEventDrop?: (event: CalendarEvent, newStart: Date, newEnd?: Date) => void;
63
+ onEventDrop?: (event: CalendarViewEvent, newStart: Date, newEnd?: Date) => void;
44
64
  /**
45
65
  * Fired in WeekView/DayView when the user drags across an empty area of
46
66
  * the time grid to select a time range. The default ObjectCalendar
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarView.d.ts","sourceRoot":"","sources":["../src/CalendarView.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA0C9B;;;;;;;;;;GAUG;AACH,iBAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAUtG;AAsBD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,IAAI,CAAA;IACX,GAAG,CAAC,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,K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,MAAM,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;IAC/E;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAA;IACpD;2EACuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,iBAAS,YAAY,CAAC,EACpB,MAAW,EACX,IAAc,EACd,WAAiC,EACjC,MAAkB,EAClB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,WAAgB,EAChB,SAAS,GACV,EAAE,iBAAiB,qBAmQnB;AAqpCD,OAAO,EAAE,YAAY,EAAE,CAAA;AACvB,OAAO,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,CAAA"}
@@ -1,19 +1,70 @@
1
1
  import { default as React } from 'react';
2
- import { ObjectGridSchema, DataSource } from '@object-ui/types';
3
- export interface CalendarSchema {
4
- type: 'calendar';
5
- objectName?: string;
6
- dateField?: string;
7
- endField?: string;
8
- titleField?: string;
9
- colorField?: string;
10
- filter?: any;
11
- sort?: any;
12
- /** Initial view mode */
13
- defaultView?: 'month' | 'week' | 'day';
14
- }
15
- export interface ObjectCalendarProps {
16
- schema: ObjectGridSchema | CalendarSchema;
2
+ import { ObjectCalendarSchema, DataSource } from '@object-ui/types';
3
+ /**
4
+ * ⛔ RETIRED (objectui#8651) — a plugin-local `CalendarSchema` used to sit here,
5
+ * and `ObjectCalendarComponentProps.schema` below was the union of it with
6
+ * `ObjectGridSchema`. Both arms are gone; the prop is now the published schema
7
+ * of the element this file is registered as (`index.tsx`, both tags).
8
+ *
9
+ * What the union cost, measured with the TypeScript checker on the merge-base
10
+ * (`getPropertyOfType`, never a grep — objectui#8410). Of the fifteen keys this
11
+ * renderer reads off the node, FOUR were declared on neither arm and EIGHT on
12
+ * exactly one, while `ObjectCalendarSchema` already declared ELEVEN of the
13
+ * fifteen.
14
+ *
15
+ * ⚠️ But the cast count is NOT twelve, and an earlier cut of this comment said
16
+ * it was. `ObjectGridSchema` carries `BaseSchema`'s `[key: string]: any`, so on
17
+ * the UNION the five `CalendarSchema`-only keys resolved through that index
18
+ * signature and compiled with no cast at all. The checker on the union itself:
19
+ * DECLARED 8 of 15 (`colorField` `dateField` `defaultView` `endField` `filter`
20
+ * `objectName` `sort` `titleField`), NOT declared 7 (`allDayField` `calendar`
21
+ * `data` `endDateField` `navigation` `startDateField` `staticData`), nonsense
22
+ * control `false`. ⇒ SEVEN reads needed a cast, not twelve.
23
+ *
24
+ * ⭐ That reading is worse for the old shape, not better: those five compiled
25
+ * silently as `any` — admitted through an index signature, never examined —
26
+ * which is the objectui#6914 defect itself rather than an absence of one. A
27
+ * cast at least announces the gap. The union's own index signature is `false`,
28
+ * which is why the other seven had to be cast.
29
+ *
30
+ * The two arms failed differently and neither was salvageable:
31
+ *
32
+ * - `ObjectGridSchema` is `type: 'object-grid'`. No producer hands this
33
+ * component one: the single call site is this package's `index.tsx`, whose
34
+ * two registrations both publish `OBJECT_CALENDAR_INPUTS`.
35
+ * - the local interface was absent from this package's barrel, so no importer
36
+ * could name it, and it SHADOWED `@object-ui/types`' own published
37
+ * `CalendarSchema` — the date-picker primitive reachable at `ui:calendar`
38
+ * only (objectui#8499). Its two distinctive members were the alias spellings
39
+ * `dateField` / `endField`, which objectui#8355 has since RETIRED at both
40
+ * faces — `getCalendarConfig` below reads the declared spellings only, and
41
+ * `@object-ui/types` refuses the two by name.
42
+ *
43
+ * The shape this leaves is the family's: `ObjectKanban` takes
44
+ * `ObjectKanbanSchema`, `ObjectGantt` takes `ObjectGanttSchema`, `ObjectMap`
45
+ * takes `ObjectMapSchema` — and `plugin-map` is registered under two tags with
46
+ * one published props type, exactly as this package is.
47
+ *
48
+ * Pinned in `__tests__/calendarUnionReads-8651.test.tsx`.
49
+ */
50
+ /**
51
+ * Props of the `ObjectCalendar` React component.
52
+ *
53
+ * Renamed off the bare `ObjectCalendarProps` (objectui#4650): from 17.0.0
54
+ * `@objectstack/spec/ui` owns that name, where it is the AUTHORED props
55
+ * document of the `object-calendar` element — `z.input<typeof
56
+ * ObjectCalendarPropsSchema>`, i.e. serialisable authoring keys only. This is
57
+ * the RENDERER's props: a live `dataSource`, records pre-fetched by a parent,
58
+ * and the host callbacks below, none of which can exist in authored metadata.
59
+ * Two layers under one word, resolved the way this repo already resolved it for
60
+ * `PageHeaderProps` -> `PageHeaderComponentProps` (app-shell) and the
61
+ * `Record*ComponentProps` family in `@object-ui/types`.
62
+ *
63
+ * The barrel keeps `ObjectCalendarProps` as a deprecated alias of this type, so
64
+ * no importer breaks. Tripwire: `__tests__/spec-symbol-4650.test.ts`.
65
+ */
66
+ export interface ObjectCalendarComponentProps {
67
+ schema: ObjectCalendarSchema;
17
68
  dataSource?: DataSource;
18
69
  className?: string;
19
70
  /** Pre-fetched records passed by a parent (e.g. ObjectView). When provided, skips internal data fetching. */
@@ -21,7 +72,21 @@ export interface ObjectCalendarProps {
21
72
  /** Loading state propagated from a parent. Respected only when `data` is also provided. */
22
73
  loading?: boolean;
23
74
  onEventClick?: (record: any) => void;
24
- onRowClick?: (record: any) => void;
75
+ /**
76
+ * TWO parameters since objectui#9357, and the second is not decoration: this
77
+ * prop reaches `useNavigationOverlay` as its `onRowClick`, and `handleClick`
78
+ * invokes it as `onRowClick(record, event)` — the modifier payload a host
79
+ * needs to implement Cmd/Ctrl/middle-click for itself. Declaring one
80
+ * parameter hid the second on the ONE line a host reads. Spelled `any` and
81
+ * not `HandleClickModifiers` for the reason objectui#9341 measured on
82
+ * `ObjectKanbanSchema.onCardClick`: that interface lives in
83
+ * `@object-ui/react`, the published twins in `@object-ui/types` may not name
84
+ * it, and a host that discovered the payload from the implementation
85
+ * annotated it `React.MouseEvent` — which a narrower declaration refuses
86
+ * contravariantly. `BaseSchema`'s own `onClick` / `onChange` / `onSubmit`
87
+ * already use this spelling for exactly this situation.
88
+ */
89
+ onRowClick?: (record: any, event?: any) => void;
25
90
  onDateClick?: (date: Date) => void;
26
91
  onEdit?: (record: any) => void;
27
92
  onDelete?: (record: any) => void;
@@ -30,5 +95,5 @@ export interface ObjectCalendarProps {
30
95
  onEventDrop?: (record: any, newStart: Date, newEnd?: Date) => void;
31
96
  locale?: string;
32
97
  }
33
- export declare const ObjectCalendar: React.FC<ObjectCalendarProps>;
98
+ export declare const ObjectCalendar: React.FC<ObjectCalendarComponentProps>;
34
99
  //# sourceMappingURL=ObjectCalendar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectCalendar.d.ts","sourceRoot":"","sources":["../src/ObjectCalendar.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAA4B,MAAM,kBAAkB,CAAC;AAyB/F,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,wBAAwB;IACxB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAAC;IAC1C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6GAA6G;IAC7G,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;I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AAC,EAAE,GAAG,EAAE,CAAC;IACb,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC;IACxD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqLD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA0sCjE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,33 @@
1
1
  import { default as React } from 'react';
2
- import { ObjectCalendar, ObjectCalendarProps } from './ObjectCalendar';
2
+ import { ObjectCalendar, ObjectCalendarComponentProps } from './ObjectCalendar.js';
3
3
  export { ObjectCalendar };
4
- export type { ObjectCalendarProps };
5
- export { CalendarView } from './CalendarView';
6
- export type { CalendarViewProps, CalendarEvent } from './CalendarView';
4
+ export type { ObjectCalendarComponentProps };
5
+ /**
6
+ * @deprecated Use `ObjectCalendarComponentProps`. Renamed in objectui#4650
7
+ * because `@objectstack/spec/ui` owns `ObjectCalendarProps` from 17.0.0, where
8
+ * it means the AUTHORED props document of the `object-calendar` element — not
9
+ * this component's props. The alias denotes the SAME type and is kept only so
10
+ * existing importers keep compiling.
11
+ */
12
+ export type { ObjectCalendarComponentProps as ObjectCalendarProps } from './ObjectCalendar.js';
13
+ export { CalendarView } from './CalendarView.js';
14
+ export type { CalendarViewProps, CalendarViewEvent } from './CalendarView.js';
15
+ /**
16
+ * @deprecated Use `CalendarViewEvent`. Renamed in objectui#5044 because
17
+ * `@object-ui/types` owns `CalendarEvent`, where it means the AUTHORING event
18
+ * (`id: string`, `start` / `end` accepting ISO strings with `end` required,
19
+ * plus `description`) — not this component's runtime event, whose `start` is a
20
+ * real `Date` and whose `id` may be a number. The two are structurally
21
+ * incompatible in both directions, so IDE auto-import picking the wrong one
22
+ * failed as a remote `TS2322`. The alias denotes the SAME type and is kept only
23
+ * so existing importers keep compiling.
24
+ *
25
+ * Spelled with its `from` clause for the same reason the
26
+ * `ObjectCalendarProps` alias above is (objectui#4650): a re-export with no
27
+ * module specifier is judged as its own declaration by
28
+ * `scripts/check-spec-symbol-derivation.mjs`.
29
+ */
30
+ export type { CalendarViewEvent as CalendarEvent } from './CalendarView.js';
7
31
  export declare const ObjectCalendarRenderer: React.FC<{
8
32
  schema: any;
9
33
  [key: string]: any;