-
Notifications
You must be signed in to change notification settings - Fork 277
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
[sitecore-jss] [sitecore-jss-angular] Default Placeholder Content for empty fields in editMode metadata #1916
Conversation
…pe (in order to make it compatible with angular package types); updated isFieldValueEmpty function and unit tests for that change
packages/sitecore-jss-angular/src/components/default-empty-field-editing-image.component.ts
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-angular/src/components/default-empty-field-editing-image.component.ts
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-angular/src/components/default-empty-field-editing-image.component.ts
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-angular/src/components/default-empty-field-editing-image.component.ts
Outdated
Show resolved
Hide resolved
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.
Great work. see some comments.
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.
Looks pretty good!
- please, make sure to add jsdoc comments with the right explanation where it's possible and needed
- build is failed
Also see some comments below
export abstract class BaseFieldDirective { | ||
protected viewRef: EmbeddedViewRef<unknown>; | ||
protected abstract field: RenderingField<GenericFieldValue>; | ||
protected abstract emptyFieldEditingTemplate: TemplateRef<unknown>; |
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.
Can we just define an "input" here?
@Input('scDateEmptyFieldEditingTemplate') emptyFieldEditingTemplate: TemplateRef<unknown>;
so, we don't need to define this property on field level, since it's not used directly by field
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.
Also, is it possible to initialize this input with the default value passed by the inherited class via the constructor? So we don't need to pass the default component via "renderEmpty" function
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.
On your second comment: makes sense, Updated.
On your first comment: I tried but seems structural directives require the names of their inputs to be prefixed by the directive selector (see how the property is common but the input alias is different for each directive) - and I could not find a way around that; you can see it is done the same way for the existing inputs in link.directive and generic link directive
…ctives and instantiate it in the constructor instead of passing it as an argument
packages/sitecore-jss-angular/src/components/base-field.directive.spec.ts
Outdated
Show resolved
Hide resolved
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.
Looks good to me 👍
Description / Motivation
This PR enhances the rendering of fields in editing mode for editMode metadata. When a field value is empty, a placeholder content should be rendered to signify that the field has no value. The placeholder should be interactable, so user can add value to the field. Additionally developers can provide their own custom empty field template via the field directive's emptyFieldEditingTemplate imput property, which will be rendered instead of the default one.
The fields with this functionality are:
The PR also includes update to the GenericFieldValue base package type to accept Date type; this change has been made in order to make the base type compatible with the field date type defined in the angular package
Testing Details
Types of changes