b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / lib / web / mage /
Filename/home/dev2.destoffenstraat.com/lib/web/mage/deletable-item.js
Size2.24 kb
Permissionrw-r--r--
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified28-Jan-2025 06:45
Last accessed22-Aug-2025 02:27
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* @deprecated since version 2.2.0
*/
define([
'jquery',
'jquery-ui-modules/widget'
], function ($) {
'use strict';

/**
* This widget is used to tag a DOM element as deletable. By default, it will use the click event on the item with a
* data role of delete to trigger the deletion.
*/
$.widget('mage.deletableItem', {
options: {
deleteEvent: 'click',
deleteSelector: '[data-role="delete"]',
hiddenClass: 'no-display'
},

/**
* This method binds elements found in this widget.
*/
_bind: function () {
var handlers = {};

// since the first handler is dynamic, generate the object using array notation
handlers[this.options.deleteEvent + ' ' + this.options.deleteSelector] = '_onDeleteClicked';
handlers.hideDelete = '_onHideDelete';
handlers.showDelete = '_onShowDelete';

this._on(handlers);
},

/**
* This method constructs a new widget.
*/
_create: function () {
this._bind();
},

/**
* This method is to initialize the control
* @private
*/
_init: function () {
this._onHideDelete(); // by default, hide the control
},

/**
* This method removes the entity from the DOM.
* @private
*/
_onDeleteClicked: function (e) {
e.stopPropagation();
this.element.trigger('deleteItem');
},

/**
* This method hides the delete capability of this item (i.e. making it not deletable)
* @private
*/
_onHideDelete: function () {
this.element.find(this.options.deleteSelector).addClass(this.options.hiddenClass);
},

/**
* This method shows the delete capability of this item (i.e. making it deletable)
* @private
*/
_onShowDelete: function () {
this.element.find(this.options.deleteSelector).removeClass(this.options.hiddenClass);
}
});

return $.mage.deletableItem;
});