Skip to content

Commit f9f3b43

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-90285' into 2.3-develop-pr18
2 parents a9a88ee + 6a11839 commit f9f3b43

File tree

8 files changed

+49
-34
lines changed

8 files changed

+49
-34
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Attributes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ private function customizeAddAttributeModal(array $meta)
182182
. '.create_new_attribute_modal',
183183
'actionName' => 'toggleModal',
184184
],
185+
[
186+
'targetName' => 'product_form.product_form.add_attribute_modal'
187+
. '.create_new_attribute_modal.product_attribute_add_form',
188+
'actionName' => 'destroyInserted'
189+
],
185190
[
186191
'targetName'
187192
=> 'product_form.product_form.add_attribute_modal'

app/code/Magento/Catalog/view/adminhtml/ui_component/product_attribute_add_form.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@
152152
<item name="isTemplate" xsi:type="boolean">true</item>
153153
<item name="is_collection" xsi:type="boolean">true</item>
154154
<item name="componentType" xsi:type="string">container</item>
155-
<item name="positionProvider" xsi:type="string">attribute_options.position</item>
156155
</item>
157156
</argument>
158157
<field name="is_default" component="Magento_Catalog/js/form/element/checkbox" sortOrder="0" formElement="checkbox">
@@ -189,12 +188,8 @@
189188
</item>
190189
</argument>
191190
<settings>
192-
<additionalClasses>
193-
<class name="_hidden">true</class>
194-
</additionalClasses>
195191
<dataType>text</dataType>
196192
<visible>false</visible>
197-
<dataScope>position</dataScope>
198193
</settings>
199194
</field>
200195
</container>

app/code/Magento/Catalog/view/adminhtml/web/js/form/element/input.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,16 @@ define([
5454
if (!_.isEmpty(this.suffixName) || _.isNumber(this.suffixName)) {
5555
suffixName = '.' + this.suffixName;
5656
}
57-
this.dataScope = 'data.' + this.prefixName + '.' + this.elementName + suffixName;
5857

59-
this.links.value = this.provider + ':' + this.dataScope;
58+
this.exportDataLink = 'data.' + this.prefixName + '.' + this.elementName + suffixName;
59+
this.exports.value = this.provider + ':' + this.exportDataLink;
60+
},
61+
62+
/** @inheritdoc */
63+
destroy: function () {
64+
this._super();
65+
66+
this.source.remove(this.exportDataLink);
6067
},
6168

6269
/**

app/code/Magento/Catalog/view/adminhtml/web/template/form/element/action-delete.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<button class="action-delete"
88
attr="{'data-action': 'remove_row'}"
99
data-bind="
10-
click: function(){ $data.processingDeleteRecord($parents); },
10+
click: function(){ $parent.processingDeleteRecord($record().index, $record.recordId); },
1111
attr: {
1212
title: $parent.deleteButtonLabel
1313
}

app/code/Magento/Swatches/view/adminhtml/ui_component/product_attribute_add_form.xml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
<additionalClasses>
8888
<class name="admin__field-wide">true</class>
8989
</additionalClasses>
90-
<dataScope>text_swatch</dataScope>
9190
<componentType>dynamicRows</componentType>
9291
</settings>
9392
<container name="record" component="Magento_Ui/js/dynamic-rows/record">
@@ -96,8 +95,6 @@
9695
<item name="isTemplate" xsi:type="boolean">true</item>
9796
<item name="is_collection" xsi:type="boolean">true</item>
9897
<item name="componentType" xsi:type="string">container</item>
99-
<item name="positionProvider" xsi:type="string">text_swatch.position</item>
100-
<item name="dataScope" xsi:type="string"/>
10198
</item>
10299
</argument>
103100
<field name="defaulttext" component="Magento_Catalog/js/form/element/checkbox" sortOrder="0" formElement="checkbox">
@@ -183,15 +180,11 @@
183180
</item>
184181
</argument>
185182
<settings>
186-
<additionalClasses>
187-
<class name="_hidden">true</class>
188-
</additionalClasses>
189183
<dataType>text</dataType>
190184
<visible>false</visible>
191-
<dataScope>position</dataScope>
192185
</settings>
193186
</field>
194-
<actionDelete name="action_delete" component="Magento_Catalog/js/form/element/action-delete" template="Magento_Catalog/form/element/action-delete">
187+
<actionDelete name="action_delete">
195188
<argument name="data" xsi:type="array">
196189
<item name="config" xsi:type="array">
197190
<item name="fit" xsi:type="boolean">true</item>
@@ -227,7 +220,6 @@
227220
<class name="swatch-visual-options-container">true</class>
228221
<class name="admin__field-wide">true</class>
229222
</additionalClasses>
230-
<dataScope>visual_swatch</dataScope>
231223
<componentType>dynamicRows</componentType>
232224
</settings>
233225
<container name="record" component="Magento_Ui/js/dynamic-rows/record">
@@ -236,8 +228,6 @@
236228
<item name="isTemplate" xsi:type="boolean">true</item>
237229
<item name="is_collection" xsi:type="boolean">true</item>
238230
<item name="componentType" xsi:type="string">container</item>
239-
<item name="positionProvider" xsi:type="string">text_swatch.position</item>
240-
<item name="dataScope" xsi:type="string"/>
241231
</item>
242232
</argument>
243233
<field name="defaultvisual" component="Magento_Catalog/js/form/element/checkbox" sortOrder="0" formElement="checkbox">
@@ -276,7 +266,6 @@
276266
<class name="swatches-visual-col">true</class>
277267
</additionalClasses>
278268
<label translate="true">Swatch</label>
279-
<dataScope>swatchvisual</dataScope>
280269
</settings>
281270
</field>
282271
<field name="optionvisual_default_store_view" component="Magento_Catalog/js/form/element/input" template="Magento_Catalog/form/element/input" formElement="input">
@@ -290,7 +279,6 @@
290279
<settings>
291280
<dataType>text</dataType>
292281
<label translate="true">Default Store View</label>
293-
<dataScope>optionvisual_default_store_view</dataScope>
294282
</settings>
295283
</field>
296284
<field name="optionvisual_admin" component="Magento_Catalog/js/form/element/input" template="Magento_Catalog/form/element/input" formElement="input">
@@ -304,7 +292,6 @@
304292
<settings>
305293
<dataType>text</dataType>
306294
<label translate="true">Admin</label>
307-
<dataScope>optionvisual_admin</dataScope>
308295
</settings>
309296
</field>
310297
<field name="position" component="Magento_Catalog/js/form/element/input" formElement="input">
@@ -315,15 +302,10 @@
315302
</item>
316303
</argument>
317304
<settings>
318-
<additionalClasses>
319-
<class name="_hidden">true</class>
320-
</additionalClasses>
321-
<dataType>text</dataType>
322-
<visible>false</visible>
323-
<dataScope>position</dataScope>
305+
<visible>false</visible>
324306
</settings>
325307
</field>
326-
<actionDelete name="action_delete" component="Magento_Catalog/js/form/element/action-delete" template="Magento_Catalog/form/element/action-delete">
308+
<actionDelete name="action_delete">
327309
<argument name="data" xsi:type="array">
328310
<item name="config" xsi:type="array">
329311
<item name="fit" xsi:type="boolean">true</item>

app/code/Magento/Swatches/view/adminhtml/web/js/form/element/swatch-visual.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,30 @@ define([
305305
*/
306306
initialize: function () {
307307
this._super()
308-
.initOldCode();
308+
.initOldCode()
309+
.on('value', this.onChangeColor.bind(this));
309310

310311
return this;
311312
},
312313

314+
/**
315+
* Handler function that execute when color changes.
316+
*
317+
* @param {String} data - color
318+
*/
319+
onChangeColor: function (data) {
320+
if (!data) {
321+
jQuery('.' + this.elementName).parent().removeClass('unavailable');
322+
}
323+
},
324+
313325
/**
314326
* Initialize wrapped former implementation.
315327
*
316328
* @returns {Object} Chainable.
317329
*/
318330
initOldCode: function () {
319-
jQuery.async('.' + this.elementName, function (elem) {
331+
jQuery.async('.' + this.elementName, this.name, function (elem) {
320332
oldCode(this.value(), elem.parentElement, this.uploadUrl, this.elementName);
321333
}.bind(this));
322334

@@ -336,9 +348,15 @@ define([
336348
this.elementName = this.prefixElementName + recordId;
337349

338350
this.inputName = prefixName + '[' + this.elementName + ']';
339-
this.dataScope = 'data.' + this.prefixName + '.' + this.elementName;
351+
this.exportDataLink = 'data.' + this.prefixName + '.' + this.elementName;
352+
this.exports.value = this.provider + ':' + this.exportDataLink;
353+
},
354+
355+
/** @inheritdoc */
356+
destroy: function () {
357+
this._super();
340358

341-
this.links.value = this.provider + ':' + this.dataScope;
359+
this.source.remove(this.exportDataLink);
342360
},
343361

344362
/**

app/code/Magento/Swatches/view/adminhtml/web/template/swatch-visual.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
value: value
1313
"/>
14-
<div data-bind="attr: {class: 'swatch_window ' + elementName}"></div>
14+
<div attr="class: 'swatch_window ' + elementName" ko-style="backgroundColor: $data.value"></div>
1515
<div class="swatch_sub-menu_container">
1616
<div class="swatch_row position-relative">
1717
<div class="swatch_row_name colorpicker_handler">

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ define([
224224
return this;
225225
},
226226

227+
/** @inheritdoc */
228+
destroy: function () {
229+
if (this.dnd()) {
230+
this.dnd().destroy();
231+
}
232+
this._super();
233+
},
234+
227235
/**
228236
* Calls 'initObservable' of parent
229237
*

0 commit comments

Comments
 (0)