-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Value Presets: also run value presets on load #20239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ture/run-value-presets-on-load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements value preset generation on load to handle document variants where only some variants were saved during creation. This ensures that new properties added to existing document types and unsaved variants receive appropriate preset values when the workspace loads.
Key changes:
- Modified property value preset generation to run on data load instead of only during creation
- Enhanced slider property editor with improved type safety and form validation
- Updated workspace context to process incoming data through value presets
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
slider/types.ts | Extracts slider value object interface for better type safety |
slider/property-editor-ui-slider.element.ts | Adds form control mixing, improves value handling and type safety |
entity-detail-workspace-base.ts | Adds _processIncomingData method to handle data processing on load |
property-value-preset/types.ts | Adds value field to API call arguments for existing value awareness |
property-value-preset-variant-builder.controller.ts | Updates to pass existing values to preset generation |
property-value-preset-variant-builder.controller.test.ts | Adds test coverage for preset value handling with existing values |
property-value-preset-builder.controller.ts | Implements logic to only generate presets when value is undefined |
input-slider/input-slider.element.ts | Enhances slider component with validation and form control support |
input-number-range/input-number-range.element.ts | Updates validation message to use localization key |
content-detail-workspace-base.ts | Implements _processIncomingData to run presets on load with existing values |
content-detail-validation-path-translator.test.ts | Removes deprecated entityType from test data |
content/types.ts | Marks entityType as deprecated in UmbElementValueModel |
content-type-workspace-context-base.ts | Adds _processIncomingData call to scaffold method |
localization.controller.ts | Adds JSDoc examples for term method usage |
lang/en.ts | Adds new validation message for range exceeding validation |
return this.localize.term('validation_numberMaximum', [this.max?.toString()]); | ||
}, | ||
() => { | ||
if (this.min !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition should check this.max
instead of this.min
for the rangeOverflow validator. This will cause the validator to never trigger when values exceed the maximum.
if (this.min !== undefined) { | |
if (this.max !== undefined) { |
Copilot uses AI. Check for mistakes.
alias: propertyType.alias, | ||
value, | ||
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType; | ||
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line contains redundant type casting with as UmbPropertyValueDataPotentiallyWithEditorAlias
appearing twice. Remove the duplicate cast.
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType; | |
} satisfies UmbPropertyValueDataPotentiallyWithEditorAlias as ReturnType; |
Copilot uses AI. Check for mistakes.
…ture/run-value-presets-on-load
Merge this first: #20228
Run Value Presets on load, to cover a case of Document with Variants where only one or some of the Variants was saved when the Document got Created.
In that case the Preset Values that was generated for the not-saved variants will when have been forgotten and never return, until this feature. So with this when you only save or save & publish one variant you will see that the others, after a refresh will get Preset Values generated.
Illustrated below:

This also means Presets will run if there is no value stored — still not a fallback value.
It will also cover the case of adding a new Property to an existing Document-Type, the new property will, until saved for the given Variant, be given a generated value from the Value Preset Manager.