cedar-embeddable-editor 2.0.18 → 2.0.19

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
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.19] - 2026-10-02
9
+
10
+ Aligns with `cedar-model-typescript-library@1.0.15`.
11
+
12
+ - Includes `reveal` for taking the user to a field, data quality problems located by the entries that hold them, and stored problems shown at their fields.
13
+
8
14
  ## [2.0.18] - 2026-09-26
9
15
 
10
16
  Aligns with `cedar-model-typescript-library@1.0.15`.
@@ -21,6 +27,17 @@ Aligns with `cedar-model-typescript-library@1.0.13`.
21
27
 
22
28
  ### Added
23
29
 
30
+ - `reveal(location, options)` on `cedar-embeddable-editor`, which takes the user to a field or
31
+ element: it turns to the field's page, moves each repeating field or element above it to the
32
+ named entry, opens the panels around it, scrolls it into view and focuses its control.
33
+ `{ focus: false }` scrolls without taking focus. It resolves to whether the field could be
34
+ shown, and changes nothing when it cannot. A problem from the data quality report is itself a
35
+ location, so a host listing the problems can pass each one straight to `reveal`.
36
+ - `occurrences` on each data quality problem: the entry of each repeating field or element along
37
+ its path, outermost first. A path alone names one place per entry of everything above it, so a
38
+ host could not say which entry held a bad value. The same bad value in two entries is now two
39
+ problems.
40
+
24
41
  - A second element, `cedar-embeddable-field`, registered by the same bundle. It renders one field's
25
42
  control and nothing of the form around it, for a host that holds a field artifact rather
26
43
  than a template — a designer collecting a default value, above all. The value goes in and
@@ -44,6 +61,18 @@ Aligns with `cedar-model-typescript-library@1.0.13`.
44
61
 
45
62
  ### Changed
46
63
 
64
+ - A field shows what is wrong with a value loaded from a stored instance as soon as the form opens.
65
+ The error states waited for the control to be edited or touched, so a field the data quality
66
+ report listed as invalid showed nothing. An empty required field still waits, until the user
67
+ edits it or is taken to it with `reveal`.
68
+ - The data quality report states at the field the problems no control can find: a stored choice
69
+ that is not one of the options, a term missing its label or its IRI, an authority identifier
70
+ that is not a valid IRI, and a list longer than its `maxItems`. A list shorter than its
71
+ `minItems` is stated once the user is taken to it.
72
+ - The data quality report no longer reports `missingProperty`. It described a repeating field or
73
+ element absent from the instance CEE read, which CEE writes out as an empty list, so it warned
74
+ about a defect that saving removed and that no field could show.
75
+
47
76
  - A numeric field's type constraint and a temporal field's errors follow the configured
48
77
  language. The numeric sentence was English written into the validator, and the temporal
49
78
  widget printed the data quality report's diagnostics, such as `Granularity is year, but the
@@ -85,6 +114,9 @@ Aligns with `cedar-model-typescript-library@1.0.13`.
85
114
 
86
115
  ### Fixed
87
116
 
117
+ - `minItems` and `maxItems` on a repeating field inside a repeating element are checked in
118
+ every entry of the element. They were checked in the entry on screen, so the report changed
119
+ with the page the user had moved to.
88
120
  - Reassigning `cedar-embeddable-field.fieldObject` recreates the control even when the field type
89
121
  stays the same, so validators and other initialized settings follow the new artifact.
90
122
  - `cedar-embeddable-field` emits `valueChange` when validity changes even if the normalized value
package/README.md CHANGED
@@ -124,13 +124,40 @@ takes the same page apart step by step, and
124
124
  [Embedding in a Framework](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-editor/frameworks/)
125
125
  covers Angular, React, and Ember.
126
126
 
127
+ A dialog host can set `previewMode: true` in either read-only or editable mode
128
+ to omit CEE's identity header and use compact, content-sized form spacing. Template
129
+ descriptions and page navigation remain available. `readOnlyMode` independently
130
+ controls whether values can be edited. Ordinary embeds retain their existing layout.
131
+
132
+ Trial hosts such as Workspace “Try out” and CED’s editable preview set
133
+ `suppressEmptyFieldErrors: true`. Clearing a control then hides its error state and
134
+ messages even after blur. Nonempty invalid values and incomplete temporal values still
135
+ show errors. This affects presentation only: required fields remain invalid in the quality
136
+ report. Ordinary metadata editing leaves the option off.
137
+
127
138
  ## Embedding a Single Field
128
139
 
129
- The bundle registers a second element. `<cedar-embeddable-field>` renders one field's
130
- control — the same control the editor renders for that field, from the same component
131
- — and nothing of the form around it: no label, no description, no card. A host that
132
- holds a field artifact rather than a template puts this where the control belongs and
133
- draws the rest itself.
140
+ The bundle registers a second element. `<cedar-embeddable-field>` renders one field
141
+ from its artifact. In editable mode it supplies the same bare control CEE uses,
142
+ so a host such as CED can place it in its own form.
143
+
144
+ With `config = { readOnlyMode: true }`, CEF owns the full presentation: label,
145
+ field type, description, constraints, choices, sources and declared defaults where
146
+ present. The type is named by the icon beside the label. A supplied value is shown
147
+ read-only. CEE uses the same field presentation, so preview hosts only need to supply
148
+ the artifact and their dialog shell.
149
+
150
+ Set `previewMode: true` with `readOnlyMode: true` when the host supplies the field name
151
+ in its own header. CEF then omits its header, and with it the type icon, while
152
+ retaining the description and value or specification. A host whose header leaves out
153
+ the type, such as the Workspace's preview, also sets `showFieldType: true`.
154
+ CEF then states the type above the description, with the icon its header would have
155
+ drawn (for example, `Paragraph`). A host whose header already shows the type, as CED's
156
+ field cards do, leaves it unset.
157
+
158
+ Read-only controls have no placeholder text, and fields without constraints draw empty
159
+ boxes. Static fields show their content. A standalone page break is described without
160
+ creating pagination.
134
161
 
135
162
  Designing a template is what this is for. An author giving a field a default value
136
163
  needs somewhere to type it, and the box that collects one has to be the control the
@@ -4,6 +4,6 @@
4
4
  "main.js",
5
5
  "polyfills.js"
6
6
  ],
7
- "bytes": 2182095,
8
- "sha256": "b37efb9f7c3e893b74d2a4a7eaf784fcbd7b0b54586f25a93f6c8d7c596ad73c"
7
+ "bytes": 2207976,
8
+ "sha256": "3420439a5f96c136ee9fe2552891041c826e76496f5663416633c56d1e14082b"
9
9
  }
@@ -4,6 +4,6 @@
4
4
  "main.js",
5
5
  "polyfills.js"
6
6
  ],
7
- "bytes": 2365905,
8
- "sha256": "8e62f446b41da71eaf8c46be9818a78e66639d3b2de7e170de7a06edb991b121"
7
+ "bytes": 2391786,
8
+ "sha256": "daa2df903e9bfb833dd69fa7827d79b22f7148eacf283979452cbfaa9a842535"
9
9
  }
@@ -45,6 +45,16 @@ export type CeeConfigKey = keyof CeeConfig;
45
45
  */
46
46
  export interface CeeConfig {
47
47
  showTemplateDescription?: boolean;
48
+ /** Embedding with a host-provided heading, in either read-only or editable mode. Hides CEE's identity header or CEF's field header; keeps descriptions and controls. */
49
+ previewMode?: boolean;
50
+ /**
51
+ * For a read-only CEF preview whose host heading does not name the field's type. The hidden header
52
+ * carried the icon that names it, so CEF states the type above the description instead, with that
53
+ * icon. A host whose own heading already shows the type leaves this unset.
54
+ */
55
+ showFieldType?: boolean;
56
+ /** Keep empty trial fields quiet without changing validity or nonempty-value errors. */
57
+ suppressEmptyFieldErrors?: boolean;
48
58
  /**
49
59
  * Renders the form without editing controls.
50
60
  *
@@ -151,6 +161,16 @@ export interface CeeValidationProblem {
151
161
  code: string;
152
162
  /** Path to the offending value, outermost first. */
153
163
  path: string[];
164
+ /**
165
+ * The entry taken at each repeating field or element along `path`, outermost first.
166
+ *
167
+ * A path names one place per entry of everything above it that repeats, and this
168
+ * says which entry holds the problem. A problem about a whole list, such as
169
+ * `minItems`, names the entries above the list and none of its own; a `required`
170
+ * problem names none, because any entry would satisfy it. Pass the problem to
171
+ * `reveal` to take the user to it.
172
+ */
173
+ occurrences: number[];
154
174
  /** The field's property name, which is the last path segment. */
155
175
  field: string;
156
176
  /** The field's declared `_ui.inputType`, or null where it declares none. */
@@ -160,6 +180,31 @@ export interface CeeValidationProblem {
160
180
  /** The value that failed, when there is one. */
161
181
  value?: unknown;
162
182
  }
183
+ /**
184
+ * A place on the form: a field or element, in particular entries of what repeats.
185
+ *
186
+ * A `CeeValidationProblem` is one, so a host can pass a problem straight to `reveal`.
187
+ */
188
+ export interface CeeLocation {
189
+ /** Component path from the template root, as a problem's `path` gives it. */
190
+ path: string[];
191
+ /**
192
+ * The entry to show at each repeating field or element along `path`, outermost first.
193
+ *
194
+ * Optional, and may be shorter than the repeating components along the path: those
195
+ * it does not reach stay on the entry they show.
196
+ */
197
+ occurrences?: number[];
198
+ }
199
+ /** What a host may ask of `reveal` beyond showing the field. */
200
+ export interface CeeRevealOptions {
201
+ /**
202
+ * Whether to move keyboard focus to the field's control. Defaults to true. A host
203
+ * keeping focus in its own controls, such as a designer showing the field it has
204
+ * selected, passes false.
205
+ */
206
+ focus?: boolean;
207
+ }
163
208
  /**
164
209
  * What CEE thinks of the instance currently in the form.
165
210
  *
@@ -319,6 +364,20 @@ export interface CedarEmbeddableEditorElement extends HTMLElement {
319
364
  readonly currentMetadataYaml: string;
320
365
  /** What CEE thinks of the instance. Read-only. */
321
366
  readonly dataQualityReport: CeeDataQualityReport;
367
+ /**
368
+ * Take the user to a field or element, and resolve whether it could be shown.
369
+ *
370
+ * Turns to the field's page, moves each repeating field or element above it to the
371
+ * named entry, opens the panels around it, scrolls it into view and focuses its
372
+ * control. A field the user is taken to also states an unanswered requirement, which
373
+ * a field nobody has reached keeps quiet.
374
+ *
375
+ * Resolves false, having changed nothing, for a path the template does not declare,
376
+ * a hidden field, or an entry that does not exist. A repeating element with no
377
+ * entries stops the reveal at the element, since nothing inside it is on the form.
378
+ * Available once the element is in the document and has a template.
379
+ */
380
+ readonly reveal: (location: CeeLocation, options?: CeeRevealOptions) => Promise<boolean>;
322
381
  }
323
382
  /**
324
383
  * What one field holds, in the terms its own type is written in.
@@ -380,23 +439,20 @@ export interface CedarEmbeddableFieldChangeDetail {
380
439
  *
381
440
  * The subset of `CeeConfig` that describes a field rather than the form around one.
382
441
  * The keys left out — the download menu, the expand controls, the template
383
- * description — settle what an editor draws around its fields, and this element draws
384
- * nothing around its own.
442
+ * description — settle what an editor draws around a whole form. Field labels and
443
+ * descriptions belong to this element in read-only mode.
385
444
  */
386
- export type CedarEmbeddableFieldConfig = Pick<CeeConfig, 'readOnlyMode' | 'trustTemplateRichText' | 'terminologyBaseUrl' | 'bridgeBaseUrl' | 'defaultLanguage' | 'fallbackLanguage' | 'languageMapPathPrefix'>;
445
+ export type CedarEmbeddableFieldConfig = Pick<CeeConfig, 'readOnlyMode' | 'previewMode' | 'showFieldType' | 'suppressEmptyFieldErrors' | 'trustTemplateRichText' | 'terminologyBaseUrl' | 'bridgeBaseUrl' | 'defaultLanguage' | 'fallbackLanguage' | 'languageMapPathPrefix'>;
387
446
  /**
388
447
  * One field's control, as a host sees it.
389
448
  *
390
- * Registered as `cedar-embeddable-field`. It renders exactly the widget the editor
391
- * renders for that field — the same component, not a second implementation — and
392
- * reports what the widget holds. Around it there is nothing: no label, no description,
393
- * no card. A host that has a field artifact and wants a value for it draws its own
394
- * surroundings and puts this where the control goes.
449
+ * Registered as `cedar-embeddable-field`. Editable, it renders the same bare value
450
+ * control as CEE, for a host that supplies its own surrounding form.
395
451
  *
396
- * Read-only is the presentation half of the same element. Editable, the field is a
397
- * control to fill in; read-only with nothing in it, the widget is replaced by a
398
- * statement of what the field will accept, which is what the editor shows when it
399
- * renders a template nobody has filled in yet.
452
+ * Read-only, it owns the complete field presentation shared with CEE: label, type,
453
+ * description and applicable constraints, choices, sources and defaults. A supplied
454
+ * value remains visible and cannot be edited. Static content is also described;
455
+ * a standalone page break has a label and type but does not create pagination.
400
456
  *
401
457
  * A field artifact carries no requiredness and no cardinality — both belong to a
402
458
  * field's deployment in a template, and this element deploys nothing — so the value