1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Ui/js/form/components/button',
'underscore'
], function (Button, _) {
'use strict';
return Button.extend({
defaults: {
entityId: null,
parentId: null,
listens: {
entity: 'changeVisibility'
}
},
/**
* Apply action on target component,
* but previously create this component from template if it is not existed
*
* @param {Object} action - action configuration
*/
applyAction: function (action) {
if (action.params && action.params[0]) {
action.params[0]['entity_id'] = this.entityId;
action.params[0]['parent_id'] = this.parentId;
} else {
action.params = [{
'entity_id': this.entityId,
'parent_id': this.parentId
}];
}
this._super();
},
/**
* Change visibility of the default address shipping/billing blocks
*
* @param {Object} entity - customer address
*/
changeVisibility: function (entity) {
this.visible(!_.isEmpty(entity));
}
});
});