FIX: various sizing issues on select-kit
This commit is contained in:
parent
abbb2b28eb
commit
329343be06
|
@ -10,7 +10,7 @@ export default Ember.Component.extend({
|
||||||
classNames: ["selected-name", "choice"],
|
classNames: ["selected-name", "choice"],
|
||||||
classNameBindings: ["isHighlighted", "isLocked"],
|
classNameBindings: ["isHighlighted", "isLocked"],
|
||||||
layoutName: "select-kit/templates/components/multi-select/selected-name",
|
layoutName: "select-kit/templates/components/multi-select/selected-name",
|
||||||
tagName: "li",
|
tagName: "span",
|
||||||
tabindex: -1,
|
tabindex: -1,
|
||||||
|
|
||||||
@computed("content")
|
@computed("content")
|
||||||
|
|
|
@ -72,7 +72,7 @@ export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixi
|
||||||
this.set("rowComponentOptions", Ember.Object.create());
|
this.set("rowComponentOptions", Ember.Object.create());
|
||||||
this.set("computedContent", []);
|
this.set("computedContent", []);
|
||||||
|
|
||||||
if ((this.site && this.site.isMobileDevice) || $(window).outerWidth(false) <= 420) {
|
if (this.site && this.site.isMobileDevice) {
|
||||||
this.setProperties({ filterable: false, autoFilterable: false });
|
this.setProperties({ filterable: false, autoFilterable: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,23 +105,23 @@ export default Ember.Mixin.create({
|
||||||
const dHeader = $(".d-header")[0];
|
const dHeader = $(".d-header")[0];
|
||||||
const dHeaderBounds = dHeader ? dHeader.getBoundingClientRect() : {top: 0, height: 0};
|
const dHeaderBounds = dHeader ? dHeader.getBoundingClientRect() : {top: 0, height: 0};
|
||||||
const dHeaderHeight = dHeaderBounds.top + dHeaderBounds.height;
|
const dHeaderHeight = dHeaderBounds.top + dHeaderBounds.height;
|
||||||
const componentHeight = this.$().outerHeight(false);
|
const bodyHeight = this.$body()[0].getBoundingClientRect().height;
|
||||||
const componentWidth = this.$().outerWidth(false);
|
|
||||||
const bodyHeight = this.$body().outerHeight(false);
|
|
||||||
const windowWidth = $(window).width();
|
const windowWidth = $(window).width();
|
||||||
const windowHeight = $(window).height();
|
const windowHeight = $(window).height();
|
||||||
const boundingRect = this.get("element").getBoundingClientRect();
|
const boundingRect = this.get("element").getBoundingClientRect();
|
||||||
|
const componentHeight = boundingRect.height;
|
||||||
|
const componentWidth = boundingRect.width;
|
||||||
const offsetTop = boundingRect.top;
|
const offsetTop = boundingRect.top;
|
||||||
const offsetBottom = boundingRect.bottom;
|
const offsetBottom = boundingRect.bottom;
|
||||||
|
|
||||||
if (this.get("fullWidthOnMobile") && windowWidth <= 420) {
|
if (this.get("fullWidthOnMobile") && (this.site && this.site.isMobileDevice)) {
|
||||||
const margin = 10;
|
const margin = 10;
|
||||||
const relativeLeft = this.$().offset().left - $(window).scrollLeft();
|
const relativeLeft = this.$().offset().left - $(window).scrollLeft();
|
||||||
options.left = margin - relativeLeft;
|
options.left = margin - relativeLeft;
|
||||||
options.width = windowWidth - margin * 2;
|
options.width = windowWidth - margin * 2;
|
||||||
options.maxWidth = options.minWidth = "unset";
|
options.maxWidth = options.minWidth = "unset";
|
||||||
} else {
|
} else {
|
||||||
const bodyWidth = this.$body().outerWidth(false);
|
const bodyWidth = this.$body()[0].getBoundingClientRect().width;
|
||||||
|
|
||||||
if ($("html").css("direction") === "rtl") {
|
if ($("html").css("direction") === "rtl") {
|
||||||
const horizontalSpacing = boundingRect.right;
|
const horizontalSpacing = boundingRect.right;
|
||||||
|
@ -151,10 +151,10 @@ export default Ember.Mixin.create({
|
||||||
const hasAboveSpace = offsetTop - fullHeight - dHeaderHeight > 0;
|
const hasAboveSpace = offsetTop - fullHeight - dHeaderHeight > 0;
|
||||||
if (hasBelowSpace || (!hasBelowSpace && !hasAboveSpace)) {
|
if (hasBelowSpace || (!hasBelowSpace && !hasAboveSpace)) {
|
||||||
this.setProperties({ isBelow: true, isAbove: false });
|
this.setProperties({ isBelow: true, isAbove: false });
|
||||||
options.top = componentHeight + this.get("verticalOffset") - 2;
|
options.top = this.$header()[0].getBoundingClientRect().height + this.get("verticalOffset");
|
||||||
} else {
|
} else {
|
||||||
this.setProperties({ isBelow: false, isAbove: true });
|
this.setProperties({ isBelow: false, isAbove: true });
|
||||||
options.bottom = componentHeight + this.get("verticalOffset") - 1;
|
options.bottom = this.$header()[0].getBoundingClientRect().height + this.get("verticalOffset");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$body().css(options);
|
this.$body().css(options);
|
||||||
|
@ -166,8 +166,9 @@ export default Ember.Mixin.create({
|
||||||
const scrollableParent = this.$().parents(this.get("scrollableParentSelector"));
|
const scrollableParent = this.$().parents(this.get("scrollableParentSelector"));
|
||||||
if (scrollableParent.length === 0) { return; }
|
if (scrollableParent.length === 0) { return; }
|
||||||
|
|
||||||
const width = this.$().outerWidth(false);
|
const boundingRect = this.get("element").getBoundingClientRect();
|
||||||
const height = this.$().outerHeight(false);
|
const width = boundingRect.width;
|
||||||
|
const height = boundingRect.height;
|
||||||
const $placeholder = $(`<div class='select-kit-fixed-placeholder-${this.elementId}'></div>`);
|
const $placeholder = $(`<div class='select-kit-fixed-placeholder-${this.elementId}'></div>`);
|
||||||
|
|
||||||
this._previousScrollParentOverflow = this._previousScrollParentOverflow || scrollableParent.css("overflow");
|
this._previousScrollParentOverflow = this._previousScrollParentOverflow || scrollableParent.css("overflow");
|
||||||
|
@ -222,11 +223,11 @@ export default Ember.Mixin.create({
|
||||||
},
|
},
|
||||||
|
|
||||||
_positionWrapper() {
|
_positionWrapper() {
|
||||||
const componentHeight = this.$().outerHeight(false);
|
const headerBoundingRect = this.$header()[0].getBoundingClientRect();
|
||||||
|
|
||||||
this.$(this.wrapperSelector).css({
|
this.$(this.wrapperSelector).css({
|
||||||
width: this.$().outerWidth(false) - 2,
|
width: this.get("element").getBoundingClientRect().width,
|
||||||
height: componentHeight + this.$body().outerHeight(false)
|
height: headerBoundingRect.height + this.$body()[0].getBoundingClientRect().height
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<ul class="choices">
|
<div class="choices">
|
||||||
{{#each computedContent.selectedComputedContents as |selectedComputedContent|}}
|
{{#each computedContent.selectedComputedContents as |selectedComputedContent|}}
|
||||||
{{component selectedNameComponent onDeselect=onDeselect content=selectedComputedContent}}
|
{{component selectedNameComponent onDeselect=onDeselect content=selectedComputedContent}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<li class="filter choice" tabindex="-1">
|
<span class="filter choice" tabindex="-1">
|
||||||
{{component "select-kit/select-kit-filter"
|
{{component "select-kit/select-kit-filter"
|
||||||
onFilter=onFilter
|
onFilter=onFilter
|
||||||
shouldDisplayFilter=shouldDisplayFilter
|
shouldDisplayFilter=shouldDisplayFilter
|
||||||
isFocused=isFocused
|
isFocused=isFocused
|
||||||
filter=filter
|
filter=filter
|
||||||
}}
|
}}
|
||||||
</li>
|
</span>
|
||||||
</ul>
|
</div>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<span class="name">
|
{{#if isLocked}}
|
||||||
{{#if isLocked}}
|
|
||||||
<span class="delete-icon">
|
<span class="delete-icon">
|
||||||
{{d-icon "lock"}}
|
{{d-icon "lock"}}
|
||||||
</span>
|
</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="locked-icon" {{action onDeselect content bubbles=false}}>
|
<span class="locked-icon" {{action onDeselect content bubbles=false}}>
|
||||||
{{d-icon "times"}}
|
{{d-icon "times"}}
|
||||||
</span>
|
</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
<span class="name">
|
||||||
{{content.name}}
|
{{content.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
.select-kit, .select-kit-box {
|
||||||
|
.selected-name {
|
||||||
|
.badge-wrapper {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -72,7 +72,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-kit-body {
|
.select-kit-body {
|
||||||
border-radius: 3px 3px 0 0;
|
border-radius: 0 0 3px 3px ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,10 @@
|
||||||
.select-kit-header {
|
.select-kit-header {
|
||||||
border-radius: 0 0 3px 3px;
|
border-radius: 0 0 3px 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.select-kit-body {
|
||||||
|
border-radius: 3px 3px 0 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
&.multi-select {
|
&.multi-select {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
background: $secondary;
|
background: $secondary;
|
||||||
border: 1px solid dark-light-diff($primary, $secondary, 90%, -60%);
|
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
|
||||||
.select-box-kit-body, .select-kit-body {
|
.select-box-kit-body, .select-kit-body {
|
||||||
|
@ -22,6 +21,7 @@
|
||||||
|
|
||||||
.multi-select-header {
|
.multi-select-header {
|
||||||
background: $secondary;
|
background: $secondary;
|
||||||
|
border: 1px solid dark-light-diff($primary, $secondary, 90%, -60%);
|
||||||
|
|
||||||
&.is-focused {
|
&.is-focused {
|
||||||
box-shadow: $tertiary 0px 0px 6px 0px;
|
box-shadow: $tertiary 0px 0px 6px 0px;
|
||||||
|
@ -63,23 +63,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.choices {
|
.choices {
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 5px;
|
padding: 2.5px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: inline;
|
display: inline-flex;
|
||||||
list-style-type: none;
|
justify-content: flex-start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
.choice {
|
.choice {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
margin: 2px 0;
|
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
overflow: hidden;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
flex-direction: row;
|
||||||
|
margin: 2.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter {
|
.filter {
|
||||||
|
@ -136,9 +136,10 @@
|
||||||
background-color: $primary-low;
|
background-color: $primary-low;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
outline: none;
|
outline: none;
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
|
overflow: auto;
|
||||||
|
flex: unset;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-box-kit, .select-kit {
|
.select-box-kit, .select-kit {
|
||||||
border: 1px solid transparent;
|
border: none;
|
||||||
min-width: 220px;
|
min-width: 220px;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
|
@ -223,6 +224,7 @@
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
display: -ms-flexbox;
|
display: -ms-flexbox;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
box-sizing: border-box;
|
||||||
-webkit-box-align: center;
|
-webkit-box-align: center;
|
||||||
-ms-flex-align: center;
|
-ms-flex-align: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
Loading…
Reference in New Issue