Skip to content

Commit

Permalink
Merge pull request #491 from Addepar/pzuraq/upgrade/ember-decorators
Browse files Browse the repository at this point in the history
upgrade(ember-decorators): Upgrade ember-decorators to v2
  • Loading branch information
pzuraq authored Feb 26, 2018
2 parents 2195e74 + af41a01 commit 867d418
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 53 deletions.
2 changes: 1 addition & 1 deletion addon/components/-private/simple-checkbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@ember/component';
import { tagName, attribute } from 'ember-decorators/component';
import { tagName, attribute } from '@ember-decorators/component';
import { argument } from '@ember-decorators/argument';
import { type, optional } from '@ember-decorators/argument/type';
import { Action } from '@ember-decorators/argument/types';
Expand Down
4 changes: 2 additions & 2 deletions addon/components/ember-table-base-cell.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Component from '@ember/component';
import { addObserver, removeObserver } from '@ember/object/observers';
import { htmlSafe } from '@ember/string';
import { action, computed } from 'ember-decorators/object';
import { get } from '@ember/object';
import { scheduler, Token } from 'ember-raf-scheduler';

import { tagName, attribute } from 'ember-decorators/component';
import { action, computed } from '@ember-decorators/object';
import { tagName, attribute } from '@ember-decorators/component';
import { argument } from '@ember-decorators/argument';
import { type, optional } from '@ember-decorators/argument/type';

Expand Down
8 changes: 2 additions & 6 deletions addon/components/ember-table-cell.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import EmberTableBaseCell from './ember-table-base-cell';
import { readOnly } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { className } from 'ember-decorators/component';

import { className } from '@ember-decorators/component';
import { argument } from '@ember-decorators/argument';
import { required } from '@ember-decorators/argument/validation';
import { type } from '@ember-decorators/argument/type';
Expand All @@ -13,9 +11,7 @@ import layout from '../templates/components/ember-table-cell';
export default class EmberTableCell extends EmberTableBaseCell {
layout = layout;

// We have to alias because the class name changes per base cell type
@className('', 'et-td')
@readOnly @alias('isFixed') _isFixed;
@className('', 'et-td') isFixed;

/**
* Whether or not the parent row is selected
Expand Down
9 changes: 3 additions & 6 deletions addon/components/ember-table-footer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import EmberTableBaseCell from './ember-table-base-cell';
import { get } from '@ember/object';

import { action, computed, readOnly } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { className } from 'ember-decorators/component';
import { action, computed } from '@ember-decorators/object';
import { className } from '@ember-decorators/component';
import { argument } from '@ember-decorators/argument';
import { type } from '@ember-decorators/argument/type';
import { Action } from '@ember-decorators/argument/types';
Expand All @@ -13,9 +12,7 @@ import layout from '../templates/components/ember-table-footer';
export default class EmberTableFooter extends EmberTableBaseCell {
layout = layout;

// We have to alias because the class name changes per base cell type
@className('', 'et-tf')
@readOnly @alias('isFixed') _isFixed;
@className('', 'et-tf') isFixed;

@argument
@type(Action)
Expand Down
9 changes: 3 additions & 6 deletions addon/components/ember-table-header.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* global Hammer */
import EmberTableBaseCell from './ember-table-base-cell';

import { action, computed, readOnly } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { attribute, tagName, className } from 'ember-decorators/component';
import { action, computed } from '@ember-decorators/object';
import { attribute, tagName, className } from '@ember-decorators/component';
import { argument } from '@ember-decorators/argument';
import { required } from '@ember-decorators/argument/validation';
import { type } from '@ember-decorators/argument/type';
Expand All @@ -23,9 +22,7 @@ const COLUMN_REORDERING = 2;
export default class EmberTableHeader extends EmberTableBaseCell {
layout = layout;

// We have to alias because the class name changes per base cell type
@className('', 'et-th')
@readOnly @alias('isFixed') _isFixed;
@className('', 'et-th') isFixed;

@argument
@required
Expand Down
22 changes: 11 additions & 11 deletions addon/components/ember-table-row.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { get, set } from '@ember/object';
import Component from '@ember/component';
import { action, computed, readOnly } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { attribute, className, classNames, tagName } from 'ember-decorators/component';
import { action, computed } from '@ember-decorators/object';
import { readOnly } from '@ember-decorators/object/computed';
import { attribute, className, classNames, tagName } from '@ember-decorators/component';

import { argument } from '@ember-decorators/argument';
import { required } from '@ember-decorators/argument/validation';
Expand All @@ -29,16 +29,16 @@ export default class EmberTableRow extends Component {
@type('object')
row;

@readOnly @alias('row.api') api;
@readOnly('row.api') api;

@readOnly @alias('row.value') rowValue;
@readOnly @alias('row.index') rowIndex;
@readOnly('row.value') rowValue;
@readOnly('row.index') rowIndex;

@readOnly @alias('api.columns') columns;
@readOnly @alias('api.cellProxyClass') cellProxyClass;
@readOnly @alias('api.cellCache') cellCache;
@readOnly @alias('api.numFixedColumns') numFixedColumns;
@readOnly @alias('api.selectedRows') selectedRows;
@readOnly('api.columns') columns;
@readOnly('api.cellProxyClass') cellProxyClass;
@readOnly('api.cellCache') cellCache;
@readOnly('api.numFixedColumns') numFixedColumns;
@readOnly('api.selectedRows') selectedRows;

constructor() {
super(...arguments);
Expand Down
4 changes: 2 additions & 2 deletions addon/components/ember-table.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* global ResizeSensor */
import { assert } from '@ember/debug';

import { action, computed } from 'ember-decorators/object';
import { tagName, classNames } from 'ember-decorators/component';
import { action, computed } from '@ember-decorators/object';
import { tagName, classNames } from '@ember-decorators/component';

import { argument } from '@ember-decorators/argument';
import { required } from '@ember-decorators/argument/validation';
Expand Down
5 changes: 2 additions & 3 deletions addon/components/tree-table-row.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import EmberTableRow from './ember-table-row';
import { readOnly } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { readOnly } from '@ember-decorators/object/computed';

export default class TreeTableRow extends EmberTableRow {
/**
Expand All @@ -11,5 +10,5 @@ export default class TreeTableRow extends EmberTableRow {
/**
* @override
*/
@readOnly @alias('row.value.value') rowValue;
@readOnly('row.value.value') rowValue;
}
7 changes: 3 additions & 4 deletions addon/components/tree-table.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import layout from '../templates/components/ember-table';
import EmberTable from './ember-table';
import { action } from 'ember-decorators/object';
import { readOnly } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { action } from '@ember-decorators/object';
import { readOnly } from '@ember-decorators/object/computed';

import { argument } from '@ember-decorators/argument';
import { required } from '@ember-decorators/argument/validation';
Expand All @@ -16,7 +15,7 @@ export default class TreeTable extends EmberTable {
@type('object')
tree;

@readOnly @alias('tree') rows;
@readOnly('tree') rows;

@action
onRowToggled(row) {
Expand Down
8 changes: 4 additions & 4 deletions addon/utils/cell-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import EmberObject, {

import { SUPPORTS_NEW_COMPUTED } from 'ember-compatibility-helpers';

import { computed, readOnly } from 'ember-decorators/object';
import { alias } from 'ember-decorators/object/computed';
import { computed } from '@ember-decorators/object';
import { readOnly } from '@ember-decorators/object/computed';

export default class CellProxy extends EmberObject {
column = null;
Expand All @@ -16,8 +16,8 @@ export default class CellProxy extends EmberObject {
row = null;
targetTable = null;

@readOnly @alias('_rowComponent.rowValue') rowValue;
@readOnly @alias('_rowComponent.rowIndex') rowIndex;
@readOnly('_rowComponent.rowValue') rowValue;
@readOnly('_rowComponent.rowIndex') rowIndex;

@computed('rowValue', 'column.valuePath')
get value() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"ember-cli-node-assets": "^0.2.2",
"ember-cli-sass": "^7.0.0",
"ember-compatibility-helpers": "^0.1.2",
"ember-decorators": "^1.3.3",
"ember-decorators": "^2.0.0-beta.1",
"ember-legacy-class-shim": "^1.0.0",
"ember-raf-scheduler": "^0.1.0",
"hammerjs": "^2.0.8"
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/components/custom-footer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Component from '@ember/component';
import { get } from '@ember/object';

import { computed } from 'ember-decorators/object';
import { classNames } from 'ember-decorators/component';
import { computed } from '@ember-decorators/object';
import { classNames } from '@ember-decorators/component';
import { argument } from '@ember-decorators/argument';

@classNames('custom-footer')
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/components/custom-header.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { classNames } from 'ember-decorators/component';
import { classNames } from '@ember-decorators/component';
import { argument } from '@ember-decorators/argument';
import Component from '@ember/component';

Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/components/tree-table-grouping-cell.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { attribute } from 'ember-decorators/component';
import { computed } from 'ember-decorators/object';
import { attribute } from '@ember-decorators/component';
import { computed } from '@ember-decorators/object';
import { argument } from '@ember-decorators/argument';
import { type, optional } from '@ember-decorators/argument/type';
import { htmlSafe } from '@ember/string';
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/controllers/simple.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Controller from '@ember/controller';
import { action, computed } from 'ember-decorators/object';
import { action, computed } from '@ember-decorators/object';
import { A as emberA } from '@ember/array';

const COLUMN_COUNT = 4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Controller from '@ember/controller';
import { action, computed } from 'ember-decorators/object';
import { action, computed } from '@ember-decorators/object';
import { A as emberA } from '@ember/array';

const COLUMN_COUNT = 4;
Expand Down

0 comments on commit 867d418

Please sign in to comment.