![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/pub/static/frontend/Magento/luma/en_US/Magento_Ui/js/form/ |
/** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** * @api */ define([ 'underscore', 'uiElement', './client', 'mageUtils' ], function (_, Element, Client, utils) { 'use strict'; return Element.extend({ defaults: { clientConfig: { urls: { save: '${ $.submit_url }', beforeSave: '${ $.validate_url }' } }, ignoreTmpls: { data: true } }, /** * Initializes provider component. * * @returns {Provider} Chainable. */ initialize: function () { this._super() .initClient(); return this; }, /** * Initializes client component. * * @returns {Provider} Chainable. */ initClient: function () { this.client = new Client(this.clientConfig); return this; }, /** * Saves currently available data. * * @param {Object} [options] - Addtitional request options. * @returns {Provider} Chainable. */ save: function (options) { var data = this.get('data'); this.client.save(data, options); return this; }, /** * Update data that stored in provider. * * @param {Boolean} isProvider * @param {Object} newData * @param {Object} oldData * * @returns {Provider} */ updateConfig: function (isProvider, newData, oldData) { if (isProvider === true) { this.setData(oldData, newData, this); } return this; }, /** * Set data to provider based on current data. * * @param {Object} oldData * @param {Object} newData * @param {Provider} current * @param {String} parentPath */ setData: function (oldData, newData, current, parentPath) { _.each(newData, function (val, key) { if (_.isObject(val) || _.isArray(val)) { this.setData(oldData[key], val, current[key], utils.fullPath(parentPath, key)); } else if (val != oldData[key] && oldData[key] == current[key]) {//eslint-disable-line eqeqeq this.set(utils.fullPath(parentPath, key), val); } }, this); } }); });