mirror of https://github.com/status-im/consul.git
ui: Remove ember-computed-style to avoid deprecation error (#9218)
This commit is contained in:
parent
b2605d90d2
commit
4e1c62361e
|
@ -1,6 +1,8 @@
|
||||||
<div
|
<div
|
||||||
class="list-collection list-collection-scroll-{{scroll}}"
|
class="list-collection list-collection-scroll-{{scroll}}"
|
||||||
style={{{style}}}
|
style={{{concat
|
||||||
|
'height:' style.height 'px'
|
||||||
|
}}}
|
||||||
id={{guid}}
|
id={{guid}}
|
||||||
...attributes
|
...attributes
|
||||||
>
|
>
|
||||||
|
|
|
@ -2,17 +2,16 @@ import { inject as service } from '@ember/service';
|
||||||
import { computed, get, set } from '@ember/object';
|
import { computed, get, set } from '@ember/object';
|
||||||
import Component from 'ember-collection/components/ember-collection';
|
import Component from 'ember-collection/components/ember-collection';
|
||||||
import PercentageColumns from 'ember-collection/layouts/percentage-columns';
|
import PercentageColumns from 'ember-collection/layouts/percentage-columns';
|
||||||
import style from 'ember-computed-style';
|
|
||||||
import Slotted from 'block-slots';
|
import Slotted from 'block-slots';
|
||||||
|
|
||||||
const formatItemStyle = PercentageColumns.prototype.formatItemStyle;
|
const formatItemStyle = PercentageColumns.prototype.formatItemStyle;
|
||||||
|
|
||||||
export default Component.extend(Slotted, {
|
export default Component.extend(Slotted, {
|
||||||
|
tagName: '',
|
||||||
dom: service('dom'),
|
dom: service('dom'),
|
||||||
tagName: '',
|
tagName: '',
|
||||||
height: 500,
|
height: 500,
|
||||||
cellHeight: 70,
|
cellHeight: 70,
|
||||||
style: style('getStyle'),
|
|
||||||
checked: null,
|
checked: null,
|
||||||
scroll: 'virtual',
|
scroll: 'virtual',
|
||||||
init: function() {
|
init: function() {
|
||||||
|
@ -43,7 +42,7 @@ export default Component.extend(Slotted, {
|
||||||
return style;
|
return style;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getStyle: computed('height', function() {
|
style: computed('height', function() {
|
||||||
if (this.scroll !== 'virtual') {
|
if (this.scroll !== 'virtual') {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
<table
|
||||||
|
class="tabular-collection dom-recycling {{if hasActions 'has-actions' ''}}"
|
||||||
|
id={{guid}}
|
||||||
|
style={{{concat
|
||||||
|
'height:' style.height 'px'
|
||||||
|
}}}
|
||||||
|
...attributes
|
||||||
|
>
|
||||||
{{on-window 'resize' (action "resize") }}
|
{{on-window 'resize' (action "resize") }}
|
||||||
{{yield}}
|
{{yield}}
|
||||||
{{#if hasCaption}}
|
{{#if hasCaption}}
|
||||||
|
@ -25,4 +33,5 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</tr>
|
</tr>
|
||||||
{{~/each~}}
|
{{~/each~}}
|
||||||
</EmberNativeScrollable>
|
</EmberNativeScrollable>
|
||||||
|
</table>
|
|
@ -3,18 +3,13 @@ import { computed, get, set } from '@ember/object';
|
||||||
import CollectionComponent from 'ember-collection/components/ember-collection';
|
import CollectionComponent from 'ember-collection/components/ember-collection';
|
||||||
import needsRevalidate from 'ember-collection/utils/needs-revalidate';
|
import needsRevalidate from 'ember-collection/utils/needs-revalidate';
|
||||||
import Grid from 'ember-collection/layouts/grid';
|
import Grid from 'ember-collection/layouts/grid';
|
||||||
import style from 'ember-computed-style';
|
|
||||||
import Slotted from 'block-slots';
|
import Slotted from 'block-slots';
|
||||||
|
|
||||||
const formatItemStyle = Grid.prototype.formatItemStyle;
|
const formatItemStyle = Grid.prototype.formatItemStyle;
|
||||||
|
|
||||||
export default CollectionComponent.extend(Slotted, {
|
export default CollectionComponent.extend(Slotted, {
|
||||||
tagName: 'table',
|
tagName: '',
|
||||||
classNames: ['dom-recycling'],
|
|
||||||
classNameBindings: ['hasActions'],
|
|
||||||
attributeBindings: ['style'],
|
|
||||||
dom: service('dom'),
|
dom: service('dom'),
|
||||||
style: style('getStyle'),
|
|
||||||
width: 1150,
|
width: 1150,
|
||||||
rowHeight: 50,
|
rowHeight: 50,
|
||||||
maxHeight: 500,
|
maxHeight: 500,
|
||||||
|
@ -22,6 +17,7 @@ export default CollectionComponent.extend(Slotted, {
|
||||||
hasCaption: false,
|
hasCaption: false,
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
this.guid = this.dom.guid(this);
|
||||||
// TODO: The row height should auto calculate properly from the CSS
|
// TODO: The row height should auto calculate properly from the CSS
|
||||||
const o = this;
|
const o = this;
|
||||||
this['cell-layout'] = new Grid(get(this, 'width'), get(this, 'rowHeight'));
|
this['cell-layout'] = new Grid(get(this, 'width'), get(this, 'rowHeight'));
|
||||||
|
@ -35,9 +31,10 @@ export default CollectionComponent.extend(Slotted, {
|
||||||
},
|
},
|
||||||
didInsertElement: function() {
|
didInsertElement: function() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
this.$element = this.dom.element(`#${this.guid}`);
|
||||||
this.actions.resize.apply(this, [{ target: this.dom.viewport() }]);
|
this.actions.resize.apply(this, [{ target: this.dom.viewport() }]);
|
||||||
},
|
},
|
||||||
getStyle: computed('rowHeight', '_items', 'maxRows', 'maxHeight', function() {
|
style: computed('rowHeight', '_items', 'maxRows', 'maxHeight', function() {
|
||||||
const maxRows = get(this, 'rows');
|
const maxRows = get(this, 'rows');
|
||||||
let height = get(this, 'maxHeight');
|
let height = get(this, 'maxHeight');
|
||||||
if (maxRows) {
|
if (maxRows) {
|
||||||
|
@ -68,7 +65,7 @@ export default CollectionComponent.extend(Slotted, {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
resize: function(e) {
|
resize: function(e) {
|
||||||
const $tbody = this.element;
|
const $tbody = this.$element;
|
||||||
const $appContent = this.dom.element('.app-view');
|
const $appContent = this.dom.element('.app-view');
|
||||||
if ($appContent) {
|
if ($appContent) {
|
||||||
const border = 1;
|
const border = 1;
|
||||||
|
|
|
@ -104,7 +104,6 @@
|
||||||
"ember-cli-yadda": "^0.5.0",
|
"ember-cli-yadda": "^0.5.0",
|
||||||
"ember-collection": "^1.0.0-alpha.9",
|
"ember-collection": "^1.0.0-alpha.9",
|
||||||
"ember-composable-helpers": "~4.0.0",
|
"ember-composable-helpers": "~4.0.0",
|
||||||
"ember-computed-style": "^0.3.0",
|
|
||||||
"ember-data": "~3.20.4",
|
"ember-data": "~3.20.4",
|
||||||
"ember-data-model-fragments": "5.0.0-beta.0",
|
"ember-data-model-fragments": "5.0.0-beta.0",
|
||||||
"ember-exam": "^4.0.0",
|
"ember-exam": "^4.0.0",
|
||||||
|
|
|
@ -7935,13 +7935,6 @@ ember-composable-helpers@~4.0.0:
|
||||||
ember-cli-babel "^7.11.1"
|
ember-cli-babel "^7.11.1"
|
||||||
resolve "^1.10.0"
|
resolve "^1.10.0"
|
||||||
|
|
||||||
ember-computed-style@^0.3.0:
|
|
||||||
version "0.3.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/ember-computed-style/-/ember-computed-style-0.3.0.tgz#a04375f8b48fbf72fd61e76da3358075bd195ae9"
|
|
||||||
integrity sha512-EMMlKa8HKUCUapkJVgi/2VPyqUTWxIGs/rNsxMcMiOLFErHv6D1Mw8tvByuXeCtW8KrbwAFX3vaCMNYsAZAjvQ==
|
|
||||||
dependencies:
|
|
||||||
ember-cli-babel "^6.6.0"
|
|
||||||
|
|
||||||
ember-concurrency-decorators@^2.0.0:
|
ember-concurrency-decorators@^2.0.0:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/ember-concurrency-decorators/-/ember-concurrency-decorators-2.0.1.tgz#f5465785e6cf44684fb158ae6ab3aa1b131fae43"
|
resolved "https://registry.yarnpkg.com/ember-concurrency-decorators/-/ember-concurrency-decorators-2.0.1.tgz#f5465785e6cf44684fb158ae6ab3aa1b131fae43"
|
||||||
|
|
Loading…
Reference in New Issue