-
Notifications
You must be signed in to change notification settings - Fork 2.8k
propertyValuePresentation extension type for displaying complex property values (fixes #20736)
#20748
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
Open
AndyButland
wants to merge
27
commits into
main
Choose a base branch
from
v17/feature/collection-view-property-display
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+680
−309
Open
propertyValuePresentation extension type for displaying complex property values (fixes #20736)
#20748
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4001fd8
Add editorAlias to values available in collection view.
AndyButland e8c2b44
Add property value presentation for collection views of color, date o…
AndyButland e76564b
Apply to card view.
AndyButland 7f742fc
Renamed enum to match expected convention.
AndyButland afaef0a
Further linting.
AndyButland dcef7d4
Apply for other date pickers, amend sizing of color swatch.
AndyButland efa3c22
Code re-use.
AndyButland 0774248
Merge branch 'main' into v17/feature/collection-view-property-display
AndyButland 05e4ac9
Attempt to improve performance by getting all extension of types once…
AndyButland 3f9ff17
Linting.
AndyButland 89b37f6
Linting.
AndyButland 9d03e33
Linting + adjustments
leekelleher f2e2c44
Linting + refinements
leekelleher 55a807d
Added importmap for "@umbraco-cms/backoffice/property-value-presentat…
leekelleher 6653c3c
Removed "alias" and "display" from `UmbPropertyValuePresentationBaseE…
leekelleher 808dcaf
Refactored `propertyValuePresentation` extension elements
leekelleher d9208fd
Renamed `propertyEditorAlias` to `forPropertyEditorSchemaAlias`
leekelleher 4f347a4
Extracted out the system values to "umb-document-table-column-system-…
leekelleher 3b3d3cb
Refactored "umb-document-table-column-property-value" to focus on use…
leekelleher 3eb3670
Refactored "umb-document-grid-collection-card" to remove markup from …
leekelleher 2da794b
Removed `getPropertyValueByAlias` from `UmbDocumentCollectionContext`
leekelleher 0e6691b
Aligned media collection code
leekelleher 05b0d71
Removed unused imports
leekelleher fd2abf7
Corrected class name (bad code copy)
leekelleher 6f44a72
Merge branch 'main' into v17/feature/collection-view-property-display
AndyButland ab92e2c
Introduced `UmbDocumentCollectionItemDataResolver` to de-duplicate th…
leekelleher 73c540c
Update src/Umbraco.Web.UI.Client/src/packages/documents/documents/col…
leekelleher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/Umbraco.Web.UI.Client/src/packages/core/property-value-presentation/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export { UmbPropertyValuePresentationBaseElement } from './property-value-presentation-base.js'; | ||
| export { UmbPropertyValuePresentationDisplayOption } from './property-value-presentation.extension.js'; | ||
| export type { ManifestPropertyValuePresentation } from './property-value-presentation.extension.js'; |
14 changes: 14 additions & 0 deletions
14
....Client/src/packages/core/property-value-presentation/property-value-presentation-base.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import type { UmbPropertyValuePresentationDisplayOption } from '../../core/property-value-presentation/property-value-presentation.extension.js'; | ||
|
Check failure on line 1 in src/Umbraco.Web.UI.Client/src/packages/core/property-value-presentation/property-value-presentation-base.ts
|
||
| import { property } from '@umbraco-cms/backoffice/external/lit'; | ||
| import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; | ||
|
|
||
| export abstract class UmbPropertyValuePresentationBaseElement<TValue = string> extends UmbLitElement { | ||
| @property() | ||
| alias: string = ''; | ||
|
|
||
| @property() | ||
| display?: UmbPropertyValuePresentationDisplayOption; | ||
|
|
||
| @property({ type: Object }) | ||
| value?: TValue; | ||
| } | ||
17 changes: 17 additions & 0 deletions
17
...nt/src/packages/core/property-value-presentation/property-value-presentation.extension.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import type { ManifestElement } from '@umbraco-cms/backoffice/extension-api'; | ||
|
|
||
| export enum UmbPropertyValuePresentationDisplayOption { | ||
| COLLECTION_COLUMN = 'collection-column', | ||
| COLLECTION_CARD = 'collection-card', | ||
| } | ||
|
|
||
| export interface ManifestPropertyValuePresentation extends ManifestElement { | ||
| type: 'propertyValuePresentation'; | ||
| propertyEditorAlias: string; | ||
| } | ||
|
|
||
| declare global { | ||
| interface UmbExtensionManifestMap { | ||
| umbPropertyValuePresentation: ManifestPropertyValuePresentation; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...nt/src/packages/property-editors/color-picker/property-value-presentation-color-picker.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { | ||
|
Check failure on line 1 in src/Umbraco.Web.UI.Client/src/packages/property-editors/color-picker/property-value-presentation-color-picker.ts
|
||
| UmbPropertyValuePresentationBaseElement, | ||
| UmbPropertyValuePresentationDisplayOption, | ||
| } from '../../core/property-value-presentation/index.js'; | ||
| import { customElement, html, nothing } from '@umbraco-cms/backoffice/external/lit'; | ||
|
|
||
| @customElement('umb-color-picker-property-value-presentation') | ||
| export class UmbColorPickerPropertyValuePresentation extends UmbPropertyValuePresentationBaseElement< | ||
| { value: string; label: string } | string | ||
| > { | ||
| override render() { | ||
| const color = this.#getColor(); | ||
| const label = this.#getLabel(); | ||
| const size = this.display == UmbPropertyValuePresentationDisplayOption.COLLECTION_CARD ? 10 : 12; | ||
leekelleher marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return color | ||
| ? html`<uui-color-swatch label=${label} value=${color} style="--uui-swatch-size: ${size}px"></uui-color-swatch>` | ||
| : nothing; | ||
| } | ||
|
|
||
| #getColor() { | ||
| if (!this.value) { | ||
| return null; | ||
| } | ||
|
|
||
| if (typeof this.value === 'string') { | ||
| return this.value; | ||
| } | ||
|
|
||
| return this.value.value; | ||
| } | ||
|
|
||
| #getLabel() { | ||
| if (!this.value) { | ||
| return ''; | ||
| } | ||
|
|
||
| if (typeof this.value === 'string') { | ||
| return ''; | ||
| } | ||
|
|
||
| return this.value.label; | ||
| } | ||
| } | ||
|
|
||
| export default UmbColorPickerPropertyValuePresentation; | ||
|
|
||
| declare global { | ||
| interface HTMLElementTagNameMap { | ||
| 'umb-color-picker-property-value-presentation': UmbColorPickerPropertyValuePresentation; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.