FIX: sk3 wizard regressions (#14120)

This commit is contained in:
Joffrey JAFFEUX 2021-08-23 19:57:42 +02:00 committed by GitHub
parent 3d6cbb5ab3
commit a230362f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View File

@ -77,7 +77,7 @@ export default Component.extend(
this.set(
"selectKit",
EmberObject.create({
uniqueID: this.attrs?.id || guidFor(this),
uniqueID: this.attrs?.id?.value || this.attrs?.id || guidFor(this),
valueProperty: this.valueProperty,
nameProperty: this.nameProperty,
labelProperty: this.labelProperty,
@ -838,7 +838,7 @@ export default Component.extend(
this.clearErrors();
const inModal = this.element.closest("#discourse-modal");
if (inModal && this.site.mobileView) {
if (inModal && this?.site?.mobileView) {
const modalBody = inModal.querySelector(".modal-body");
modalBody.style = "";
}
@ -870,7 +870,7 @@ export default Component.extend(
`#${this.selectKit.uniqueID}-body`
);
const placementStrategy = this.site.mobileView ? "absolute" : "fixed";
const placementStrategy = this?.site?.mobileView ? "absolute" : "fixed";
const verticalOffset = 3;
this.popper = createPopper(anchor, popper, {

View File

@ -1,4 +1,3 @@
import { propertyEqual } from "discourse/lib/computed";
import { action, computed } from "@ember/object";
import Component from "@ember/component";
import I18n from "I18n";
@ -36,7 +35,7 @@ export default Component.extend(UtilsMixin, {
didInsertElement() {
this._super(...arguments);
if (!this.site.mobileView) {
if (!this?.site?.mobileView) {
this.element.addEventListener("mouseenter", this.handleMouseEnter);
this.element.addEventListener("focus", this.handleMouseEnter);
this.element.addEventListener("blur", this.handleBlur);
@ -45,7 +44,7 @@ export default Component.extend(UtilsMixin, {
willDestroyElement() {
this._super(...arguments);
if (!this.site.mobileView && this.element) {
if (!this?.site?.mobileView && this.element) {
this.element.removeEventListener("mouseenter", this.handleBlur);
this.element.removeEventListener("focus", this.handleMouseEnter);
this.element.removeEventListener("blur", this.handleMouseEnter);
@ -115,9 +114,13 @@ export default Component.extend(UtilsMixin, {
return this.getValue(this.selectKit.highlighted);
}),
isHighlighted: propertyEqual("rowValue", "highlightedValue"),
isHighlighted: computed("rowValue", "highlightedValue", function () {
return this.rowValue === this.highlightedValue;
}),
isSelected: propertyEqual("rowValue", "value"),
isSelected: computed("rowValue", "value", function () {
return this.rowValue === this.value;
}),
@action
handleMouseEnter() {

View File

@ -69,14 +69,15 @@
overflow: hidden;
transition: all 0.25s;
cursor: pointer;
display: flex;
align-items: stretch;
.select-kit-header-wrapper {
box-sizing: border-box;
min-height: 28px;
display: flex;
align-items: center;
flex: 1 0 auto;
width: 100%;
align-items: center;
height: 100%;
}
@ -262,6 +263,8 @@
border-radius: 0;
box-shadow: none;
width: 100%;
box-sizing: border-box;
min-height: 30px;
}
&.is-hidden {