Skip to content
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

Fix initial value in type selectbox #141

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/GrampsjsFilterType.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class GrampsjsFilterType extends GrampsjsTranslateMixin(LitElement) {
filters: {type: Array},
label: {type: String},
types: {type: Object},
loadingTypes: {type: Boolean},
typesLocale: {type: Object},
typeName: {type: String},
rule: {type: String},
Expand All @@ -42,6 +43,7 @@ export class GrampsjsFilterType extends GrampsjsTranslateMixin(LitElement) {
this.types = {}
this.typesLocale = {}
this.typeName = ''
this.loadingTypes = false
this.rule = 'HasType'
}

Expand All @@ -57,6 +59,7 @@ export class GrampsjsFilterType extends GrampsjsTranslateMixin(LitElement) {
.strings="${this.strings}"
typeName="${this.typeName}"
defaultTypeName=""
?loadingTypes=${this.loadingTypes}
.types="${this.types}"
.typesLocale="${this.typesLocale}"
@formdata:changed="${this._handleChange}"
Expand Down
2 changes: 2 additions & 0 deletions src/components/GrampsjsFormChildRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GrampsjsFormChildRef extends GrampsjsObjectForm {
id="child-frel"
heading="${this._('Relationship to _Father:').replace(':', '')}"
.strings="${this.strings}"
?loadingTypes=${this.loadingTypes}
typeName="child_reference_types"
.types="${this.types}"
.typesLocale="${this.typesLocale}"
Expand All @@ -40,6 +41,7 @@ class GrampsjsFormChildRef extends GrampsjsObjectForm {
id="child-mrel"
heading="${this._('Relationship to _Mother:').replace(':', '')}"
.strings="${this.strings}"
?loadingTypes=${this.loadingTypes}
typeName="child_reference_types"
.types="${this.types}"
.typesLocale="${this.typesLocale}"
Expand Down
1 change: 1 addition & 0 deletions src/components/GrampsjsFormEditAttribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GrampsjsFormEditAttribute extends GrampsjsObjectForm {
heading="${this._('Type')}"
.strings="${this.strings}"
typeName="attribute_types"
?loadingTypes=${this.loadingTypes}
.types="${this.types}"
.typesLocale="${this.typesLocale}"
.data="${this.data}"
Expand Down
2 changes: 2 additions & 0 deletions src/components/GrampsjsFormEditName.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class GrampsjsFormEditName extends GrampsjsObjectForm {
label="${this._('Name type')}"
.strings="${this.strings}"
typeName="name_types"
?loadingTypes=${this.loadingTypes}
defaultTypeName="Birth Name"
initialValue=${this.data?.type || ''}
.types="${this.types}"
Expand All @@ -32,6 +33,7 @@ class GrampsjsFormEditName extends GrampsjsObjectForm {
showMore
id="name"
@formdata:changed="${this._handleFormData}"
?loadingTypes=${this.loadingTypes}
.strings="${this.strings}"
.data="${this.data}"
.types="${this.types}"
Expand Down
1 change: 1 addition & 0 deletions src/components/GrampsjsFormEditUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class GrampsjsFormEditUrl extends GrampsjsObjectForm {
heading="${this._('Type')}"
.strings="${this.strings}"
typeName="url_types"
?loadingTypes=${this.loadingTypes}
.types="${this.types}"
.typesLocale="${this.typesLocale}"
.data="${this.data}"
Expand Down
1 change: 1 addition & 0 deletions src/components/GrampsjsFormEventRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class GrampsjsFormEventRef extends GrampsjsObjectForm {
id="event-role-type"
.strings="${this.strings}"
typeName="event_role_types"
?loadingTypes=${this.loadingTypes}
.types="${this.types}"
.typesLocale="${this.typesLocale}"
>
Expand Down
29 changes: 15 additions & 14 deletions src/components/GrampsjsFormName.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class GrampsjsFormName extends GrampsjsTranslateMixin(LitElement) {
return {
data: {type: Object},
showMore: {type: Boolean},
loadingTypes: {type: Boolean},
types: {type: Object},
typesLocale: {type: Object},
origintype: {type: Boolean},
Expand All @@ -50,6 +51,7 @@ class GrampsjsFormName extends GrampsjsTranslateMixin(LitElement) {
this.showMore = false
this.types = {}
this.typesLocale = {}
this.loadingTypes = false
this.origintype = false
}

Expand Down Expand Up @@ -110,9 +112,9 @@ class GrampsjsFormName extends GrampsjsTranslateMixin(LitElement) {
></grampsjs-form-string>
</p>

<h4 class="label ${classMap({hide: !this.showMore})}">${this._(
'Surnames'
)}</h4>
<h4 class="label ${classMap({hide: !this.showMore})}">
${this._('Surnames')}
</h4>

${(this.data.surname_list || [{}]).map(
(obj, i, arr) => html`
Expand All @@ -125,6 +127,7 @@ class GrampsjsFormName extends GrampsjsTranslateMixin(LitElement) {
.strings="${this.strings}"
.data="${obj}"
.types="${this.types}"
?loadingTypes=${this.loadingTypes}
.typesLocale="${this.typesLocale}"
>
</grampsjs-form-surname>
Expand All @@ -136,19 +139,17 @@ class GrampsjsFormName extends GrampsjsTranslateMixin(LitElement) {
<mwc-icon-button
@click="${this._handleAddSurname}"
icon="add"
></mwc-button>
></mwc-icon-button>
</p>

${
this.showMore
? ''
: html`
<mwc-icon-button
@click="${this._handleShowMore}"
icon="more_horiz"
></mwc-button>
`
}
${this.showMore
? ''
: html`
<mwc-icon-button
@click="${this._handleShowMore}"
icon="more_horiz"
></mwc-icon-button>
`}
`
}

Expand Down
1 change: 0 additions & 1 deletion src/components/GrampsjsFormNoteRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class GrampsjsFormNoteRef extends GrampsjsObjectForm {
label="${this._('Select')}"
class="edit"
></grampsjs-form-select-object-list>
</grampsjs-form-select-type>
`
}
}
Expand Down
1 change: 1 addition & 0 deletions src/components/GrampsjsFormRepoRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class GrampsjsFormRepoRef extends GrampsjsObjectForm {
heading="${this._('Type')}"
.strings="${this.strings}"
typeName="source_media_types"
?loadingTypes=${this.loadingTypes}
defaultTypeName="Book"
.types="${this.types}"
.typesLocale="${this.typesLocale}"
Expand Down
6 changes: 2 additions & 4 deletions src/components/GrampsjsFormSelectType.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class GrampsjsFormSelectType extends GrampsjsTranslateMixin(LitElement) {
defaultTypeName: {type: String},
types: {type: Object},
typesLocale: {type: Object},
disabled: {type: Boolean},
loadingTypes: {type: Boolean},
required: {type: Boolean},
initialValue: {type: String},
Expand All @@ -37,7 +36,6 @@ class GrampsjsFormSelectType extends GrampsjsTranslateMixin(LitElement) {
super()
this.types = {}
this.typesLocale = {}
this.disabled = false
this.typeName = ''
this.heading = ''
this.label = ''
Expand Down Expand Up @@ -70,8 +68,8 @@ class GrampsjsFormSelectType extends GrampsjsTranslateMixin(LitElement) {
<p>
<mwc-select
style="width:100%"
?required=${!this._hasCustomType && !this.nocustom}
?disabled=${this._hasCustomType}
?required=${this.required && !this._hasCustomType && !this.nocustom}
?disabled=${this.loadingTypes || this._hasCustomType}
validationMessage="${this._('This field is mandatory')}"
@change="${this.handleChange}"
label="${this.loadingTypes ? this._('Loading items...') : this.label}"
Expand Down
3 changes: 3 additions & 0 deletions src/components/GrampsjsFormSurname.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class GrampsjsFormSurname extends GrampsjsTranslateMixin(LitElement) {
idx: {type: Number},
types: {type: Object},
typesLocale: {type: Object},
loadingTypes: {type: Boolean},
origintype: {type: Boolean},
}
}
Expand All @@ -51,6 +52,7 @@ class GrampsjsFormSurname extends GrampsjsTranslateMixin(LitElement) {
this.idx = 0
this.types = {}
this.typesLocale = {}
this.loadingTypes = false
this.origintype = false
}

Expand All @@ -70,6 +72,7 @@ class GrampsjsFormSurname extends GrampsjsTranslateMixin(LitElement) {
initialValue=${this.data?.origintype || ''}
.types="${this.types}"
.typesLocale="${this.typesLocale}"
?loadingTypes=${this.loadingTypes}
@formdata:changed="${this._handleFormData}"
>
</grampsjs-form-select-type>
Expand Down
1 change: 0 additions & 1 deletion src/mixins/GrampsjsNewNoteMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const GrampsjsNewNoteMixin = superClass =>
id="select-note-type"
.strings="${this.strings}"
?loadingTypes="${this.loadingTypes}"
?disabled="${this.loadingTypes}"
typeName="note_types"
defaultTypeName="General"
.types="${this.types}"
Expand Down
1 change: 0 additions & 1 deletion src/views/GrampsjsViewNewEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export class GrampsjsViewNewEvent extends GrampsjsViewNewObject {
id="select-type"
.strings="${this.strings}"
?loadingTypes="${this.loadingTypes}"
?disabled="${this.loadingTypes}"
typeName="event_types"
.types="${this.types}"
.typesLocale="${this.typesLocale}"
Expand Down
1 change: 0 additions & 1 deletion src/views/GrampsjsViewNewPlace.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class GrampsjsViewNewPlace extends GrampsjsViewNewObject {
id="select-place-type"
.strings="${this.strings}"
?loadingTypes="${this.loadingTypes}"
?disabled="${this.loadingTypes}"
typeName="place_types"
.types="${this.types}"
.typesLocale="${this.typesLocale}"
Expand Down
1 change: 0 additions & 1 deletion src/views/GrampsjsViewNewRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class GrampsjsViewNewRepository extends GrampsjsViewNewObject {
id="select-repository-type"
.strings="${this.strings}"
?loadingTypes="${this.loadingTypes}"
?disabled="${this.loadingTypes}"
typeName="repository_types"
.types="${this.types}"
.typesLocale="${this.typesLocale}"
Expand Down