Spamworldpro Mini Shell
Spamworldpro


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/app/code/Amasty/Label/view/adminhtml/web/js/form/element/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/app/code/Amasty/Label/view/adminhtml/web/js/form/element/shape-chooser.js
define([
    'Magento_Ui/js/form/element/abstract',
    'Amasty_Label/js/utils/svg-to-data-url-converter',
    'ko'
], function (Abstract, convertToDataUrl) {
    'use strict';

    return Abstract.extend({
        defaults: {
            elementTmpl: 'Amasty_Label/form/element/shape-chooser',

            /**
             * List of shape data.
             *
             * @example {
             *     'shape_name': {
             *         shapeType: 'rquarter',
             *         shapeContent: '<svg height="100" width="100"><circle fill="blue"></circle></svg>',
             *         shapeDescription: 'Description'
             *     }
             * }
             */
            shapeList: {},
            shapeIdPostfix: '',
            shapeIdPrefix: 'amlabel_shape_type_',
            currentShapeContent: ''
        },

        /**
         * @inheritDoc
         */
        initObservable: function () {
            this._super()
                .observe('currentShapeContent');

            return this;
        },

        /**
         * @param {string} type
         */
        generateShapeId: function (type) {
            return this.shapeIdPrefix + type + this.shapeIdPostfix;
        },

        /**
         * @param {string} svgContent,
         * @returns {string}
         */
        generateDataUrl: function (svgContent) {
            return convertToDataUrl(svgContent);
        },

        /**
         * @param {object} data
         * @return {boolean}
         */
        isShapeSelected: function (data) {
            return this.value() === data.shapeType;
        },

        /**
         *
         * @param {object} data
         */
        chooseShape: function (data) {
            this.value(data.shapeType);
            this.currentShapeContent(data.shapeContent);
        }
    });
});

Spamworldpro Mini