Skip to content
This repository was archived by the owner on Aug 2, 2024. It is now read-only.

Commit 9d64577

Browse files
authored
Merge pull request #659 from smile-io/drop-invoke-action-dep
Drop ember-invoke-action dependency
2 parents a5fd222 + c6db660 commit 9d64577

File tree

10 files changed

+9
-54
lines changed

10 files changed

+9
-54
lines changed

addon/components/polaris-action-list/section.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Component from '@ember/component';
22
import { action, computed } from '@ember/object';
3-
import { invokeAction } from 'ember-invoke-action';
43
import { tagName, layout } from '@ember-decorators/component';
54
import template from '../../templates/components/polaris-action-list/section';
65

@@ -40,11 +39,11 @@ export default class PolarisActionListSection extends Component {
4039
}
4140

4241
@action
43-
onItemAction(item, event) {
42+
handleAction(item, event) {
4443
event.preventDefault();
4544
event.stopPropagation();
4645

47-
invokeAction(item, 'onAction');
48-
invokeAction(this, 'onActionAnyItem');
46+
item.onAction?.();
47+
this.onActionAnyItem?.();
4948
}
5049
}

addon/components/polaris-banner.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { guidFor } from '@ember/object/internals';
66
import { capitalize } from '@ember/string';
77
import { deprecate } from '@ember/application/deprecations';
88
import { tagName, layout } from '@ember-decorators/component';
9-
import { invokeAction } from 'ember-invoke-action';
109
import template from '../templates/components/polaris-banner';
1110
import { handleMouseUpByBlurring } from '../utils/focus';
1211
import deprecateClassArgument from '../utils/deprecate-class-argument';
@@ -210,7 +209,7 @@ export default class PolarisBanner extends Component {
210209
event.stopPropagation();
211210
}
212211

213-
return invokeAction(this, actionObj.onAction);
212+
return this.actionObj?.onAction();
214213
}
215214

216215
@action

addon/components/polaris-page-actions.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import Component from '@ember/component';
2-
import { action, computed } from '@ember/object';
2+
import { computed } from '@ember/object';
33
import { isArray } from '@ember/array';
44
import { tagName, layout as templateLayout } from '@ember-decorators/component';
5-
import { invokeAction } from 'ember-invoke-action';
65
import layout from '../templates/components/polaris-page-actions';
76
import deprecateClassArgument from '../utils/deprecate-class-argument';
87

@@ -36,9 +35,4 @@ export default class PolarisPageActions extends Component {
3635
get showSecondaryActions() {
3736
return isArray(this.secondaryActions);
3837
}
39-
40-
@action
41-
fireAction(act) {
42-
invokeAction(act, 'onAction');
43-
}
4438
}

addon/components/polaris-setting-toggle.js

-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import Component from '@ember/component';
2-
import { action } from '@ember/object';
32
import { or } from '@ember/object/computed';
43
import { deprecate } from '@ember/application/deprecations';
54
import { tagName, layout as templateLayout } from '@ember-decorators/component';
6-
import { invokeAction } from 'ember-invoke-action';
75
import layout from '../templates/components/polaris-setting-toggle';
86

97
/**
@@ -58,9 +56,4 @@ export default class PolarisSettingToggle extends Component {
5856
}
5957
);
6058
}
61-
62-
@action
63-
fireAction(primaryAction) {
64-
invokeAction(primaryAction, 'onAction');
65-
}
6659
}

addon/templates/components/polaris-action-list/section.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@active={{item.active}}
2727
@role={{@actionRole}}
2828
@badge={{item.badge}}
29-
@onAction={{fn this.onItemAction item}}
29+
@onAction={{fn this.handleAction item}}
3030
/>
3131
{{/each}}
3232
</ul>

addon/templates/components/polaris-page-actions.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@loading={{secondaryAction.loading}}
1313
@destructive={{secondaryAction.destructive}}
1414
@icon={{secondaryAction.icon}}
15-
@onClick={{fn this.fireAction secondaryAction}}
15+
@onClick={{secondaryAction.onAction}}
1616
/>
1717
{{/each}}
1818
</PolarisButtonGroup>
@@ -24,7 +24,7 @@
2424
@disabled={{@primaryAction.disabled}}
2525
@loading={{@primaryAction.loading}}
2626
@text={{@primaryAction.text}}
27-
@onClick={{fn this.fireAction @primaryAction}}
27+
@onClick={{@primaryAction.onAction}}
2828
/>
2929
{{/if}}
3030
</PolarisStack>

addon/templates/components/polaris-setting-toggle.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@disabled={{this.mainAction.disabled}}
1616
@loading={{this.mainAction.loading}}
1717
@primary={{@enabled}}
18-
@onClick={{fn this.fireAction this.mainAction}}
18+
@onClick={{this.mainAction.onAction}}
1919
/>
2020
{{/if}}
2121
</div>

addon/utils/map-event-to-action.js

-22
This file was deleted.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"ember-decorators": "^6.1.1",
6666
"ember-element-helper": "^0.3.1",
6767
"ember-event-helpers": "^0.1.0",
68-
"ember-invoke-action": "^1.5.1",
6968
"ember-keyboard": "^6.0.1",
7069
"ember-lifeline": "^4.1.5",
7170
"ember-render-detector": "^1.0.0",

yarn.lock

-7
Original file line numberDiff line numberDiff line change
@@ -6644,13 +6644,6 @@ [email protected]:
66446644
resolved "https://registry.yarnpkg.com/ember-export-application-global/-/ember-export-application-global-2.0.1.tgz#b120a70e322ab208defc9e2daebe8d0dfc2dcd46"
66456645
integrity sha512-B7wiurPgsxsSGzJuPFkpBWnaeuCu2PGpG2BjyrfA1VcL7//o+5RSnZqiCEY326y7qmxb2GoCgo0ft03KBU0rRw==
66466646

6647-
ember-invoke-action@^1.5.1:
6648-
version "1.5.1"
6649-
resolved "https://registry.yarnpkg.com/ember-invoke-action/-/ember-invoke-action-1.5.1.tgz#b6cad51ee729fc227cdbdba83b2b5486f0fa5834"
6650-
integrity sha512-co6Yg9r5qtK4LvZTZHk+u02YLPbnM2c5ZkXvundxEj3V7qdZg7RULfjU09LmohD+rxW5ADZlwgBi/32XIEWTlw==
6651-
dependencies:
6652-
ember-cli-babel "^6.6.0"
6653-
66546647
ember-keyboard@^6.0.1:
66556648
version "6.0.1"
66566649
resolved "https://registry.yarnpkg.com/ember-keyboard/-/ember-keyboard-6.0.1.tgz#2e806c92f36ec9a8a85064ca246e23eb11245dae"

0 commit comments

Comments
 (0)