@object-ui/plugin-calendar 17.5.0 → 17.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,253 @@
1
1
  # @object-ui/plugin-calendar
2
2
 
3
+ ## 17.6.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 5edc0c5: `object-gantt` / `object-map` / `object-calendar` no longer drop a sort entry that omits `order`.
8
+
9
+ The three blocks each inlined a byte-identical private copy of the `sort` →
10
+ `$orderby` conversion. That copy required BOTH `field` and `order` on an array
11
+ entry and silently skipped any entry missing one, so a stored view sorting by
12
+ `[{ field: 'amount' }]` reached the wire with no ordering at all — the authored
13
+ sort key was lost, not applied. The same copy already treated the STRING
14
+ spelling `"amount"` as ascending, so this was an inconsistency between two
15
+ spellings of one thing rather than deliberate strictness.
16
+
17
+ All three now import the shared `convertSortToQueryParams` sink from
18
+ `@object-ui/core` (introduced by objectstack#7137, already used by
19
+ `object-timeline` and `record:line_items`), and the private copies are gone —
20
+ the sink is the repo's only definition. Two behavior changes come with it, both
21
+ of which make the blocks more faithful to what is already declared rather than
22
+ more tolerant:
23
+
24
+ - An array entry that omits `order` now orders ASCENDING instead of vanishing.
25
+ That is what `QueryParams.$orderby`'s own member shape
26
+ (`{ field: string; order?: 'asc' | 'desc' }`) says, and what
27
+ `@object-ui/data-objectstack`'s `serializeOrderBy` already did with a missing
28
+ direction.
29
+ - When nothing orderable was authored, the query now carries no `$orderby` at
30
+ all instead of an empty object. `{}` is truthy and meant "no ordering" only by
31
+ accident of the adapter's serializer.
32
+
33
+ Reachability, so the size of this is not overstated: `SortConfig.order` and
34
+ `ElementDataSourceSort.order` are REQUIRED in objectui's own types, so a typed
35
+ caller could never author the dropped shape. The affected surface is untyped
36
+ stored view metadata (`ElementSavedView` is a loose record by design) — which is
37
+ exactly where an order-less entry can arrive today.
38
+ - 1cd46bd: Correct the published "works with the `api` data provider" claim for plugin-calendar,
39
+ which `ObjectCalendar` does not implement. `data.provider: 'api'` reaches
40
+ `console.warn('API provider not yet implemented for ObjectCalendar')`
41
+ (`ObjectCalendar.tsx:294-296`), sets the record set to empty and renders a calendar
42
+ with no events; `endpoint` and `method` have no read point anywhere in
43
+ `packages/plugin-calendar/src`, and the package never resolves an `ApiDataSource`.
44
+
45
+ Four publication sites corrected:
46
+
47
+ - `packages/plugin-calendar/src/ObjectCalendar.tsx:22` (file-header JSDoc): "Works
48
+ with object/api/value data providers" → "Works with object/value data providers".
49
+ - `content/docs/plugins/plugin-calendar.mdx:178` (Features list): "Works seamlessly
50
+ with object/api/value data providers" → "Works seamlessly with object/value data
51
+ providers".
52
+ - `content/docs/plugins/index.md:168` (Calendar Plugin section): "Works with
53
+ object/api/value providers" → "Works with object/value providers".
54
+ - `content/docs/plugins/plugin-calendar.mdx` "API Provider" section: the
55
+ copy-pasteable `provider: 'api'` + `endpoint` + `method` recipe is replaced by a
56
+ statement of the real behaviour, matching the merged plugin-map wording.
57
+
58
+ The identical sentence published for **plugin-gantt** is left untouched: there
59
+ `provider: 'api'` is genuinely implemented (`ObjectGantt.tsx:442-445` resolves a real
60
+ `ApiDataSource` through `resolveDataSource`, and `:1155` / `:1495` route write-backs
61
+ through it), so the gantt claim is true and this is a shared sentence, not a shared
62
+ defect.
63
+
64
+ Implementing the `api` provider for calendar is capability expansion and is explicitly
65
+ out of scope here, the same line objectui#5163 drew for plugin-map. No runtime
66
+ behaviour changes: a source comment and docs prose only.
67
+ - e7c5a80: `plugin-calendar`'s README no longer documents imports the package does not export.
68
+
69
+ Three defects in `packages/plugin-calendar/README.md`, all of which made a
70
+ copy-pasted snippet fail to compile. Checked by taking the package's real export
71
+ name set off `src/index.tsx` through the TypeScript compiler API and cross-checking
72
+ every import statement in the README against it — including multi-line import
73
+ blocks, which a single-line grep cannot see.
74
+
75
+ 1. **Fabricated (deleted).** A "Manual Registration" section taught
76
+ `import { calendarComponents } from '@object-ui/plugin-calendar'` followed by
77
+ `Object.entries(calendarComponents).forEach(register)`. There is no
78
+ `calendarComponents` export and never was — the identifier does not occur
79
+ anywhere in `src/`. Copying it gave `undefined`, and `Object.entries(undefined)`
80
+ throws a `TypeError`, so the section could not run at all. Registration in this
81
+ package is purely a side effect of importing the entry point, so there is no
82
+ components map to iterate. The fabricated section is replaced by what the
83
+ side-effect import actually claims (the three registered schema types and their
84
+ namespaced keys) and by the package's real export surface — `ObjectCalendar`,
85
+ `CalendarView`, `ObjectCalendarRenderer` plus the component prop types. Hosts
86
+ that want their own registry key are shown the honest way to get one:
87
+ registering the exported `ObjectCalendarRenderer` under it.
88
+
89
+ 2. **Wrong import path (path corrected).** `CalendarViewSchema` was imported from
90
+ `@object-ui/plugin-calendar`. The type is real but belongs to `@object-ui/types`;
91
+ this package imports it and does not re-export it, so the documented import was
92
+ a "no exported member" error. The path now points at `@object-ui/types`.
93
+
94
+ 3. **Name collision (import re-pointed).** Correcting (2) alone still left the
95
+ snippet uncompilable: the same example imported `CalendarEvent` from
96
+ `@object-ui/plugin-calendar`, which is a real export but a *different* type —
97
+ the `CalendarView` component's runtime shape (`id: string | number`,
98
+ `start: Date`), not the authored JSON shape (`id: string`, `start: string | Date`)
99
+ that `CalendarViewSchema.events` requires and that the README's own "Calendar
100
+ Event Structure" section documents. The example's ISO-string values therefore did
101
+ not typecheck, and the plugin's event type was not assignable to the schema's.
102
+ Both authored types now come from `@object-ui/types`, and the two same-named
103
+ types are documented side by side so the next reader does not re-pick the wrong one.
104
+
105
+ No exports were added to make the README true — the docs were moved to the code,
106
+ not the reverse.
107
+ - 2165d88: Rename four component-props types off the names `@objectstack/spec` starts owning in
108
+ 17.0.0, keeping the old spellings as deprecated aliases. No behaviour changes and no
109
+ importer breaks.
110
+
111
+ `@objectstack/spec/ui` exports `ObjectCalendarProps`, `ObjectFormProps`, `ObjectGridProps`
112
+ and `ObjectKanbanProps` from 17.0.0, where each is the AUTHORED props document of the
113
+ matching element — a serialisable authoring surface (`z.input< typeof
114
+ ObjectGridPropsSchema >`). The same-named interfaces here are the RENDERERS' props: a live
115
+ `dataSource`, records pre-fetched by a parent, and the host callbacks. Two different things
116
+ under one word, so the local ones are renamed rather than derived, following the split this
117
+ repo already made for `PageHeaderProps` -> `PageHeaderComponentProps` and the
118
+ `Record*ComponentProps` family in `@object-ui/types`:
119
+
120
+ | package | new name | old name |
121
+ |---|---|---|
122
+ | `@object-ui/plugin-calendar` | `ObjectCalendarComponentProps` | `ObjectCalendarProps` |
123
+ | `@object-ui/plugin-form` | `ObjectFormComponentProps` | `ObjectFormProps` |
124
+ | `@object-ui/plugin-grid` | `ObjectGridComponentProps` | `ObjectGridProps` |
125
+ | `@object-ui/plugin-kanban` | `ObjectKanbanComponentProps` | `ObjectKanbanProps` |
126
+
127
+ Every old name is still exported from its package barrel as a `@deprecated` alias denoting
128
+ the SAME type, pinned per package by `spec-symbol-4650.test.ts`, so existing imports keep
129
+ compiling. New code should use the `ComponentProps` spelling.
130
+
131
+ `@object-ui/app-shell` carries no API change: its `SECRET_MASK` — the ADR-0100 credential
132
+ read mask, which 17.0.0 moves into `@objectstack/spec/data` — is renamed to
133
+ `OBJECTUI_SECRET_MASK` at its declaration in `views/metadata-admin/widgets.tsx`. That
134
+ constant is package-internal and is not re-exported from the barrel, so nothing published
135
+ changes; the rename exists so the local copy cannot be read as the spec's own definition
136
+ while this repo is still pinned below the release that exports it.
137
+ - Updated dependencies [88085e3]
138
+ - Updated dependencies [69251bf]
139
+ - Updated dependencies [57e668f]
140
+ - Updated dependencies [516663d]
141
+ - Updated dependencies [41ac1b7]
142
+ - Updated dependencies [1eaf0a1]
143
+ - Updated dependencies [7c297e3]
144
+ - Updated dependencies [a09bc33]
145
+ - Updated dependencies [460c4d0]
146
+ - Updated dependencies [0ae27f7]
147
+ - Updated dependencies [2533ec5]
148
+ - Updated dependencies [78c0f9a]
149
+ - Updated dependencies [bbe8b86]
150
+ - Updated dependencies [8477be5]
151
+ - Updated dependencies [279fb13]
152
+ - Updated dependencies [2e82ab2]
153
+ - Updated dependencies [ad07b65]
154
+ - Updated dependencies [41f498b]
155
+ - Updated dependencies [ef0d150]
156
+ - Updated dependencies [f34226e]
157
+ - Updated dependencies [564b605]
158
+ - Updated dependencies [e1d4251]
159
+ - Updated dependencies [40d3a33]
160
+ - Updated dependencies [8b9dc62]
161
+ - Updated dependencies [1184192]
162
+ - Updated dependencies [a2a9747]
163
+ - Updated dependencies [65e88e6]
164
+ - Updated dependencies [a1609a6]
165
+ - Updated dependencies [53f23bc]
166
+ - Updated dependencies [c4533dc]
167
+ - Updated dependencies [be60815]
168
+ - Updated dependencies [37f6844]
169
+ - Updated dependencies [93de4f6]
170
+ - Updated dependencies [2b50261]
171
+ - Updated dependencies [384f30d]
172
+ - Updated dependencies [ac600e5]
173
+ - Updated dependencies [97fba31]
174
+ - Updated dependencies [232f61a]
175
+ - Updated dependencies [d374caf]
176
+ - Updated dependencies [5673576]
177
+ - Updated dependencies [c1ef923]
178
+ - Updated dependencies [911ceaa]
179
+ - Updated dependencies [98eab36]
180
+ - Updated dependencies [af5e292]
181
+ - Updated dependencies [3fbbea1]
182
+ - Updated dependencies [0bffb18]
183
+ - Updated dependencies [800f455]
184
+ - Updated dependencies [5458414]
185
+ - Updated dependencies [3241559]
186
+ - Updated dependencies [7f96b10]
187
+ - Updated dependencies [167ec42]
188
+ - Updated dependencies [616a2a5]
189
+ - Updated dependencies [6c68b13]
190
+ - Updated dependencies [0046d8f]
191
+ - Updated dependencies [f1d4748]
192
+ - Updated dependencies [bea374e]
193
+ - Updated dependencies [b1119ec]
194
+ - Updated dependencies [5607092]
195
+ - Updated dependencies [9f23d2b]
196
+ - Updated dependencies [578e025]
197
+ - Updated dependencies [af025ee]
198
+ - Updated dependencies [d109a4d]
199
+ - Updated dependencies [598c89a]
200
+ - Updated dependencies [4a0bd17]
201
+ - Updated dependencies [b8b9af4]
202
+ - Updated dependencies [31676be]
203
+ - Updated dependencies [8c0d52e]
204
+ - Updated dependencies [aff10e2]
205
+ - Updated dependencies [70a774b]
206
+ - Updated dependencies [7dd93c0]
207
+ - Updated dependencies [229b17e]
208
+ - Updated dependencies [9ce096f]
209
+ - Updated dependencies [e05db88]
210
+ - Updated dependencies [7458a41]
211
+ - Updated dependencies [ad13d63]
212
+ - Updated dependencies [5ffcc14]
213
+ - Updated dependencies [d971e51]
214
+ - Updated dependencies [97abb24]
215
+ - Updated dependencies [deb157a]
216
+ - Updated dependencies [9c60144]
217
+ - Updated dependencies [e7747f1]
218
+ - Updated dependencies [d2ce342]
219
+ - Updated dependencies [9695da7]
220
+ - Updated dependencies [ac2f332]
221
+ - Updated dependencies [a777058]
222
+ - Updated dependencies [75444e3]
223
+ - Updated dependencies [58b8346]
224
+ - Updated dependencies [2d0bd16]
225
+ - Updated dependencies [a9e17b4]
226
+ - Updated dependencies [b8ce7dc]
227
+ - Updated dependencies [dad51e5]
228
+ - Updated dependencies [1c9c342]
229
+ - Updated dependencies [787c738]
230
+ - Updated dependencies [8396656]
231
+ - Updated dependencies [dbbd38a]
232
+ - Updated dependencies [8871c14]
233
+ - Updated dependencies [93fe362]
234
+ - Updated dependencies [dfc6975]
235
+ - Updated dependencies [3cf4de0]
236
+ - Updated dependencies [c9dc811]
237
+ - Updated dependencies [144ef9b]
238
+ - Updated dependencies [138ab04]
239
+ - Updated dependencies [a0b9e91]
240
+ - Updated dependencies [99bd015]
241
+ - Updated dependencies [21e4585]
242
+ - @object-ui/types@17.6.0
243
+ - @object-ui/fields@17.6.0
244
+ - @object-ui/i18n@17.6.0
245
+ - @object-ui/react@17.6.0
246
+ - @object-ui/plugin-detail@17.6.0
247
+ - @object-ui/components@17.6.0
248
+ - @object-ui/core@17.6.0
249
+ - @object-ui/mobile@17.6.0
250
+
3
251
  ## 17.5.0
4
252
 
5
253
  ### Minor Changes
package/README.md CHANGED
@@ -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,112 @@ 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 13 keys of
153
+ its own, converged on what the registered `calendar-view` renderer actually
154
+ reads (objectui#5667). Two of them — `data` and `className` — refine common
155
+ `BaseSchema` keys; the rest of `BaseSchema` (`id`, `visible`, ...) applies as on
156
+ any node.
120
157
 
121
158
  ```typescript
122
159
  {
123
160
  type: 'calendar-view',
124
- events?: CalendarEvent[],
125
- defaultDate?: string, // ISO date string
126
- onEventClick?: (event) => void,
127
- onDateClick?: (date) => void,
128
- className?: string
161
+ data?: any, // records rendered as events (array, or a binding expression)
162
+ titleField?: string, // default 'title'
163
+ startDateField?: string, // default 'start'
164
+ endDateField?: string, // default 'end'
165
+ allDayField?: string, // default 'allDay'
166
+ colorField?: string, // default 'color'
167
+ view?: CalendarViewMode, // 'month' | 'week' | 'day' (default 'month')
168
+ currentDate?: string | Date, // ISO string authored; Date from a React host
169
+ allowCreate?: boolean, // default false — shows the "New event" button
170
+ className?: string, // Tailwind classes for the container
171
+ onEventClick?: (event: CalendarEvent) => void, // HOST-ONLY (see below)
172
+ onViewChange?: (view: CalendarViewMode) => void // HOST-ONLY (see below)
129
173
  }
130
174
  ```
131
175
 
176
+ There is deliberately **no authorable `events` key**: the renderer computes its
177
+ events from `data` plus the field-name keys, and drops an authored `events`
178
+ (objectui#4433). Nine formerly declared keys — `events`, `defaultView`,
179
+ `defaultDate`, `date`, `views`, `editable`, `onEventCreate`, `onEventUpdate`,
180
+ `onDateChange` — were retired in objectui#5667 because nothing read them on the
181
+ authored-node path and no measured app authors them. `onDateClick` is **not**
182
+ on this schema — it is a `CalendarViewProps` component prop (see
183
+ [Drag-and-Drop](#drag-and-drop) and [Click-to-Create](#click-to-create)).
184
+
185
+ > **The handlers are host-only.** `onEventClick` and `onViewChange` are
186
+ > forwarded to the component only when the value really is a function, which
187
+ > authored JSON can never produce — supply them from a React host
188
+ > (`<SchemaRenderer ... onEventClick={fn} />`). Authored as JSON strings they
189
+ > are dropped, same as absent.
190
+
132
191
  ### Calendar Event Structure
133
192
 
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
- }
193
+ Events are not authored directly — the renderer computes one event per record
194
+ in the node's `data` array, reading the fields the field-name keys point at:
195
+
196
+ ```text
197
+ id: record.id // falls back to record._id, then the array index
198
+ title: record[titleField] // default field 'title'
199
+ start: record[startDateField] // default field 'start' (ISO datetime string)
200
+ end: record[endDateField] // default field 'end' (optional)
201
+ allDay: record[allDayField] // default field 'allDay'
202
+ color: record[colorField] // default field 'color'
203
+ data: record // the whole record rides along
144
204
  ```
145
205
 
206
+ `@object-ui/types` still exports the `CalendarEvent` interface — it is the
207
+ declared payload type of the host-only `onEventClick` callback.
208
+
146
209
  ## Examples
147
210
 
148
211
  ### Basic Calendar
@@ -150,7 +213,7 @@ interface CalendarEvent {
150
213
  ```typescript
151
214
  const schema = {
152
215
  type: 'calendar-view',
153
- events: [
216
+ data: [
154
217
  {
155
218
  id: '1',
156
219
  title: 'Product Launch',
@@ -169,6 +232,11 @@ const schema = {
169
232
  };
170
233
  ```
171
234
 
235
+ The records above already use the default field names (`title`, `start`, `end`,
236
+ `color`), so no field-name keys are needed; point `titleField` /
237
+ `startDateField` / `endDateField` / `allDayField` / `colorField` at your own
238
+ fields when they differ.
239
+
172
240
  ### With ObjectQL Integration
173
241
 
174
242
  ```typescript
@@ -184,21 +252,28 @@ const schema = {
184
252
 
185
253
  ### Interactive Calendar
186
254
 
255
+ The handlers are host-only — a function can only come from a React host
256
+ building the node in code, never from authored JSON:
257
+
187
258
  ```typescript
188
259
  const schema = {
189
260
  type: 'calendar-view',
190
- events: [],
261
+ data: [],
191
262
  onEventClick: (event) => {
192
263
  console.log('Event clicked:', event);
193
264
  // Open event details modal
194
265
  },
195
- onDateClick: (date) => {
196
- console.log('Date clicked:', date);
197
- // Create new event
266
+ onViewChange: (view) => {
267
+ console.log('View changed:', view);
268
+ // React to the calendar switching between month/week/day
198
269
  }
199
270
  };
200
271
  ```
201
272
 
273
+ Authored JSON reacts to clicks through the node's action channel instead
274
+ (`allowCreate: true` dispatches `{ type: 'create' }`; event clicks dispatch
275
+ `{ type: 'event-click' }`).
276
+
202
277
  ## ObjectQL Integration
203
278
 
204
279
  When using with ObjectStack, the calendar can automatically fetch and display events:
@@ -232,28 +307,49 @@ Style the calendar with Tailwind classes:
232
307
  const schema = {
233
308
  type: 'calendar-view',
234
309
  className: 'border rounded-lg shadow-lg',
235
- events: [...]
310
+ data: [...]
236
311
  };
237
312
  ```
238
313
 
239
314
  ## TypeScript Support
240
315
 
241
- ```typescript
242
- import type { CalendarViewSchema, CalendarEvent } from '@object-ui/plugin-calendar';
316
+ The **authored** (JSON metadata) types live in `@object-ui/types`, not in this
317
+ package — this package imports them too, and does not re-export them:
243
318
 
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
- };
319
+ ```typescript
320
+ import type { CalendarViewSchema } from '@object-ui/types';
250
321
 
251
322
  const schema: CalendarViewSchema = {
252
323
  type: 'calendar-view',
253
- events: [event]
324
+ data: [
325
+ { id: '1', name: 'Meeting', begins: '2024-01-15T10:00:00', ends: '2024-01-15T11:00:00' }
326
+ ],
327
+ titleField: 'name',
328
+ startDateField: 'begins',
329
+ endDateField: 'ends',
330
+ view: 'week',
331
+ allowCreate: true
254
332
  };
255
333
  ```
256
334
 
335
+ > **Two calendar event types — pick by which side you are on.**
336
+ > `@object-ui/types` exports **`CalendarEvent`**, the AUTHORING event
337
+ > (`id: string`, `start` / `end` accept ISO strings with `end` required, plus
338
+ > `description`) — since objectui#5667 it is no longer part of the authored
339
+ > surface (a `calendar-view` node carries `data` records, not events; see
340
+ > [Calendar Event Structure](#calendar-event-structure)), but it remains the
341
+ > declared payload type of the host-only `onEventClick` callback. This package
342
+ > exports **`CalendarViewEvent`** (`CalendarViewProps['events']`), the
343
+ > `CalendarView` **component's runtime** type: `id: string | number` and
344
+ > `start: Date` / `end?: Date`. They are not interchangeable — neither is
345
+ > assignable to the other.
346
+ >
347
+ > Both were spelled `CalendarEvent` until objectui#5044, where IDE auto-import
348
+ > chose between them at random and the wrong pick failed as a remote `TS2322`
349
+ > about `Date`. This package still exports `CalendarEvent` as a **`@deprecated`
350
+ > alias of `CalendarViewEvent`**, so existing importers keep compiling; write
351
+ > `CalendarViewEvent` in new code.
352
+
257
353
  ## Links
258
354
 
259
355
  - 📚 [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,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,GAAG,CAAA;CACX;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAA;IACxB,IAAI,CAAC,EAAE,OAAO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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,qBA8OnB;AAmhCD,OAAO,EAAE,YAAY,EAAE,CAAA;AACvB,OAAO,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,CAAA"}
@@ -12,7 +12,23 @@ export interface CalendarSchema {
12
12
  /** Initial view mode */
13
13
  defaultView?: 'month' | 'week' | 'day';
14
14
  }
15
- export interface ObjectCalendarProps {
15
+ /**
16
+ * Props of the `ObjectCalendar` React component.
17
+ *
18
+ * Renamed off the bare `ObjectCalendarProps` (objectui#4650): from 17.0.0
19
+ * `@objectstack/spec/ui` owns that name, where it is the AUTHORED props
20
+ * document of the `object-calendar` element — `z.input<typeof
21
+ * ObjectCalendarPropsSchema>`, i.e. serialisable authoring keys only. This is
22
+ * the RENDERER's props: a live `dataSource`, records pre-fetched by a parent,
23
+ * and the host callbacks below, none of which can exist in authored metadata.
24
+ * Two layers under one word, resolved the way this repo already resolved it for
25
+ * `PageHeaderProps` -> `PageHeaderComponentProps` (app-shell) and the
26
+ * `Record*ComponentProps` family in `@object-ui/types`.
27
+ *
28
+ * The barrel keeps `ObjectCalendarProps` as a deprecated alias of this type, so
29
+ * no importer breaks. Tripwire: `__tests__/spec-symbol-4650.test.ts`.
30
+ */
31
+ export interface ObjectCalendarComponentProps {
16
32
  schema: ObjectGridSchema | CalendarSchema;
17
33
  dataSource?: DataSource;
18
34
  className?: string;
@@ -30,5 +46,5 @@ export interface ObjectCalendarProps {
30
46
  onEventDrop?: (record: any, newStart: Date, newEnd?: Date) => void;
31
47
  locale?: string;
32
48
  }
33
- export declare const ObjectCalendar: React.FC<ObjectCalendarProps>;
49
+ export declare const ObjectCalendar: React.FC<ObjectCalendarComponentProps>;
34
50
  //# 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;IAClB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,MAAM,EAA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AAU,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;IAClB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,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;AAuDD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAgjBjE,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';
3
3
  export { ObjectCalendar };
4
- export type { ObjectCalendarProps };
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';
5
13
  export { CalendarView } from './CalendarView';
6
- export type { CalendarViewProps, CalendarEvent } from './CalendarView';
14
+ export type { CalendarViewProps, CalendarViewEvent } from './CalendarView';
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';
7
31
  export declare const ObjectCalendarRenderer: React.FC<{
8
32
  schema: any;
9
33
  [key: string]: any;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAGpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,aAAa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