ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Api;
|
||||
|
||||
use Magento\Framework\Data\OptionSourceInterface;
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface ImageRadioButtonSourceInterface extends OptionSourceInterface
|
||||
{
|
||||
/**
|
||||
* Return array of options with additional configuration to show images
|
||||
*
|
||||
* Format:
|
||||
* [
|
||||
* [
|
||||
* 'value' => '<value>', - value to save
|
||||
* 'label' => '<label>', - label
|
||||
* 'preview' => '<previewUrl>', - url of preview image
|
||||
* 'image' => '<imageUrl>', - image to display
|
||||
* 'image2x' => '<retinaImageUrl>', - image for high DPA displays
|
||||
* 'anim' => '<animationUrl>', - plays on preview hover
|
||||
* 'anim2x' => '<retinaAnimationUrl>', - animation for high DPA displays
|
||||
* ],
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
public function toOptionArray(): array;
|
||||
}
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Backend\Block\Template;
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
use Magento\Framework\Escaper;
|
||||
use Magento\Framework\Serialize\SerializerInterface;
|
||||
use Magento\Framework\Stdlib\ArrayManager;
|
||||
|
||||
/**
|
||||
* Color picker for system settings
|
||||
*
|
||||
* For using you have to load Plumrocket_ExtendedAdminUi::css/lib/pickr/monolith.min.css on the page
|
||||
*
|
||||
* @since 1.0.3
|
||||
*/
|
||||
class ColorPicker extends Field
|
||||
{
|
||||
/**
|
||||
* @var \Magento\Framework\Stdlib\ArrayManager
|
||||
*/
|
||||
private $arrayManager;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Serialize\SerializerInterface
|
||||
*/
|
||||
private $serializer;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Escaper
|
||||
*/
|
||||
private $escaper;
|
||||
|
||||
/**
|
||||
* @param \Magento\Backend\Block\Template\Context $context
|
||||
* @param \Magento\Framework\Stdlib\ArrayManager $arrayManager
|
||||
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
|
||||
* @param \Magento\Framework\Escaper $escaper
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
ArrayManager $arrayManager,
|
||||
SerializerInterface $serializer,
|
||||
Escaper $escaper,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
$this->arrayManager = $arrayManager;
|
||||
$this->serializer = $serializer;
|
||||
$this->escaper = $escaper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element): string
|
||||
{
|
||||
$element->addClass('pr-color-picker-value');
|
||||
|
||||
$pickerPlaceholderId = $element->getHtmlId() . '_color_picker';
|
||||
$pickerContainerHtml = '<div id="' . $pickerPlaceholderId . '"></div>' ;
|
||||
|
||||
/** @var Template $pickerConfigsBlock */
|
||||
$pickerConfigsBlock = $this->getLayout()->createBlock(Template::class);
|
||||
$pickerConfigsBlock
|
||||
->setTemplate('Plumrocket_ExtendedAdminUi::system/config/color_picker.phtml')
|
||||
->setData('escaper', $this->escaper)
|
||||
->setData('jsonConfig', $this->serializer->serialize($this->getConfig($element, $pickerPlaceholderId)))
|
||||
->setData('elementId', $element->getHtmlId());
|
||||
|
||||
return "{$pickerContainerHtml}{$element->getElementHtml()}{$pickerConfigsBlock->toHtml()}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorate field row html
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @param string $html
|
||||
* @return string
|
||||
*/
|
||||
protected function _decorateRowHtml(AbstractElement $element, $html): string
|
||||
{
|
||||
return '<tr id="row_' . $element->getHtmlId() . '" class="pr-color-picker-field">' . $html . '</tr>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color picker config.
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @param string $pickerPlaceholderId
|
||||
* @return array
|
||||
*/
|
||||
private function getConfig(AbstractElement $element, string $pickerPlaceholderId): array
|
||||
{
|
||||
$config = $this->getDefaultConfigs();
|
||||
$config['el'] = '#' . $pickerPlaceholderId;
|
||||
$config['default'] = $element->getEscapedValue() ?: null;
|
||||
$config['disabled'] = (bool) $element->getData('disabled');
|
||||
|
||||
if ($element->getData('field_config/canRestore')) {
|
||||
$config = $this->arrayManager->set('components/interaction/clear', $config, false);
|
||||
}
|
||||
|
||||
foreach ($element->getData('field_config') as $key => $fieldConfigValue) {
|
||||
if (0 !== strpos($key, 'pr_pickr/')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = str_replace('pr_pickr/', '', $key);
|
||||
$value = is_numeric($fieldConfigValue) ? (int) $fieldConfigValue : $fieldConfigValue;
|
||||
$config = $this->arrayManager->set($path, $config, $value);
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default configs.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getDefaultConfigs(): array
|
||||
{
|
||||
return [
|
||||
'theme' => 'monolith',
|
||||
'useAsButton'=> false,
|
||||
'comparison' => false,
|
||||
'swatches' => [
|
||||
'rgba(244, 67, 54, 1)',
|
||||
'rgba(233, 30, 99, 0.95)',
|
||||
'rgba(156, 39, 176, 0.9)',
|
||||
'rgba(103, 58, 183, 0.85)',
|
||||
'rgba(63, 81, 181, 0.8)',
|
||||
'rgba(33, 150, 243, 0.75)',
|
||||
'rgba(3, 169, 244, 0.7)',
|
||||
'rgba(0, 188, 212, 0.7)',
|
||||
'rgba(0, 150, 136, 0.75)',
|
||||
'rgba(76, 175, 80, 0.8)',
|
||||
'rgba(139, 195, 74, 0.85)',
|
||||
'rgba(205, 220, 57, 0.9)',
|
||||
'rgba(255, 235, 59, 0.95)',
|
||||
'rgba(255, 193, 7, 1)'
|
||||
],
|
||||
'components' => [
|
||||
// Main components
|
||||
'preview' => true,
|
||||
'opacity' => true,
|
||||
'hue' => true,
|
||||
// Input / output Options
|
||||
'interaction' => [
|
||||
'hex' => true,
|
||||
'rgba' => true,
|
||||
'hsla' => false,
|
||||
'hsva' => false,
|
||||
'cmyk' => false,
|
||||
'input' => true,
|
||||
'clear' => true,
|
||||
'save' => false
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
use Magento\Framework\View\Asset\Repository;
|
||||
|
||||
/**
|
||||
* Frontend model for render customizations.
|
||||
*
|
||||
* See README.md for instruction
|
||||
*
|
||||
* @since 1.0.4
|
||||
*/
|
||||
class CustomisableField extends Field
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\View\Asset\Repository
|
||||
*/
|
||||
private $viewAssetRepository;
|
||||
|
||||
/**
|
||||
* @param \Magento\Backend\Block\Template\Context $context
|
||||
* @param \Magento\Framework\View\Asset\Repository $viewAssetRepository
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Repository $viewAssetRepository,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
$this->viewAssetRepository = $viewAssetRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render element value
|
||||
*
|
||||
* @param \Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\ImageRadioButtons $element
|
||||
* @return string
|
||||
*/
|
||||
protected function _renderValue(AbstractElement $element): string
|
||||
{
|
||||
$valueCssClass = $element->getPrValueCustomCssClass();
|
||||
$this->addAttributes($element);
|
||||
|
||||
if ($element->getTooltip()) {
|
||||
$html = '<td class="value with-tooltip ' . $valueCssClass . '">';
|
||||
$html .= $this->_getElementHtml($element);
|
||||
$html .= '<div class="tooltip"><span class="help"><span></span></span>';
|
||||
$html .= '<div class="tooltip-content">' . $element->getTooltip() . '</div></div>';
|
||||
} else {
|
||||
$html = '<td class="value ' . $valueCssClass . '">';
|
||||
$html .= $this->_getElementHtml($element);
|
||||
}
|
||||
$comment = (string) $element->getComment();
|
||||
if ($comment) {
|
||||
$html .= '<p class="note"><span>' . $this->filterTooltipMediaVariables($element, $comment) . '</span></p>';
|
||||
}
|
||||
$html .= '</td>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable checkbox if needed.
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return bool
|
||||
*/
|
||||
protected function _isInheritCheckboxRequired(AbstractElement $element): bool
|
||||
{
|
||||
if ($element->getData('field_config/pr_disable_inherit_checkbox')
|
||||
|| $element->getPrDisableInheritCheckbox()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return parent::_isInheritCheckboxRequired($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable scope label if needed.
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
protected function _renderScopeLabel(AbstractElement $element): string
|
||||
{
|
||||
if ($element->getData('field_config/pr_disable_scope_label')) {
|
||||
return '';
|
||||
}
|
||||
return parent::_renderScopeLabel($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace media directives by urls.
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @param string $comment
|
||||
* @return string
|
||||
*/
|
||||
private function filterTooltipMediaVariables(AbstractElement $element, string $comment): string
|
||||
{
|
||||
if (! $element->getData('field_config/pr_allow_variables')) {
|
||||
return $comment;
|
||||
}
|
||||
|
||||
if (preg_match_all('/{{media url="(.*?)".*?}}/', $comment, $media)) {
|
||||
$urls = [];
|
||||
foreach ($media[1] as $fieldId) {
|
||||
$urls[] = $this->viewAssetRepository->getUrl($fieldId);
|
||||
}
|
||||
$comment = str_replace($media[0], $urls, $comment);
|
||||
}
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add defined in system.xml attributes as element custom attributes.
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return void
|
||||
*/
|
||||
private function addAttributes(AbstractElement $element): void
|
||||
{
|
||||
if (! is_array($element->getData('field_config'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($element->getData('field_config') as $key => $value) {
|
||||
if (0 !== strpos($key, 'pr_element_attribute/')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$attrName = str_replace('pr_element_attribute/', '', $key);
|
||||
$element->addCustomAttribute($attrName, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Backend\Block\Widget\Button;
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
use Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\DynamicTable\InputTable;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
abstract class DynamicTable extends Field
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element)
|
||||
{
|
||||
$html = '<input type="hidden" name="' . $element->getname() . '" value="" />';
|
||||
|
||||
/** @var \Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\DynamicTable\InputTable $table */
|
||||
$table = $this->getLayout()->createBlock(InputTable::class);
|
||||
$table->setContainerFieldId((string) $element->getName())
|
||||
->setRowKey('name');
|
||||
foreach ($this->getColumns() as $columnId => $column) {
|
||||
$table->addColumn($columnId, $column);
|
||||
}
|
||||
$table->setArray($this->_getValue($element->getValue()));
|
||||
|
||||
$html .= $table->toHtml();
|
||||
$html .= $this->getNewRowButtonHtml();
|
||||
$html .= $this->getInitScriptHtml($element);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field table columns settings.
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
abstract protected function getColumns(): array;
|
||||
|
||||
/**
|
||||
* Get prepared field value.
|
||||
*
|
||||
* @param array $data
|
||||
* @return array[]
|
||||
*/
|
||||
protected function _getValue(array $data = []): array
|
||||
{
|
||||
$rows = [
|
||||
'_TMPNAME_' => [],
|
||||
];
|
||||
|
||||
if ($data && is_array($data)) {
|
||||
$rows = array_merge($rows, $data);
|
||||
}
|
||||
|
||||
foreach ($rows as $name => &$row) {
|
||||
$row += ['name' => $name];
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get new row button HTML.
|
||||
*
|
||||
* @return string
|
||||
* @throws \Magento\Framework\Exception\LocalizedException
|
||||
*/
|
||||
protected function getNewRowButtonHtml(): string
|
||||
{
|
||||
return $this->getLayout()
|
||||
->createBlock(Button::class)
|
||||
->addData($this->getButtonData())
|
||||
->toHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings for new row button.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getButtonData(): array
|
||||
{
|
||||
return [
|
||||
'label' => __('Add Row'),
|
||||
'type' => 'button',
|
||||
'class' => 'add dynamic-table-field add-row-value',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field init script HTML
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
protected function getInitScriptHtml(AbstractElement $element): string
|
||||
{
|
||||
return <<<HTML
|
||||
<script>
|
||||
require([
|
||||
'Plumrocket_ExtendedAdminUi/js/form/element/dynamic-table',
|
||||
'domReady!'
|
||||
], function (dynamicTable) {
|
||||
dynamicTable.initialize('row_{$element->getHtmlId()}')
|
||||
});
|
||||
</script>
|
||||
HTML;
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Magento\Cms\Model\Wysiwyg\Config;
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
/**
|
||||
* Extended wysiwyg with possibility to add configurations.
|
||||
*
|
||||
* @since 1.0.6
|
||||
*/
|
||||
class Editor extends Field
|
||||
{
|
||||
/**
|
||||
* If field has attribute witch started with this prefix, value will be set to wysiwyg config
|
||||
* Wysiwyg key is symbols after prefix
|
||||
*/
|
||||
public const EDITOR_CONFIG_ATTRIBUTE_PREFIX = 'pr_editor_';
|
||||
|
||||
/**
|
||||
* @var \Magento\Cms\Model\Wysiwyg\Config
|
||||
*/
|
||||
protected $_wysiwygConfig;
|
||||
|
||||
/**
|
||||
* @param \Magento\Backend\Block\Template\Context $context
|
||||
* @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Config $wysiwygConfig,
|
||||
array $data = []
|
||||
) {
|
||||
$this->_wysiwygConfig = $wysiwygConfig;
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element html
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element)
|
||||
{
|
||||
$fieldConfig = $element->getData('field_config');
|
||||
$config = $this->_wysiwygConfig->getConfig();
|
||||
|
||||
foreach ($fieldConfig as $key => $value) {
|
||||
if (strpos($key, self::EDITOR_CONFIG_ATTRIBUTE_PREFIX) === 0) {
|
||||
$wysiwygKey = str_replace(self::EDITOR_CONFIG_ATTRIBUTE_PREFIX, '', $key);
|
||||
$config->setData($wysiwygKey, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$element->setConfig($config);
|
||||
return $element->getElementHtml() . $this->_getJs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive js html
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getJs()
|
||||
{
|
||||
return "<script>require(['Magento_Variable/variables']);</script>";
|
||||
}
|
||||
}
|
||||
+246
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\DynamicTable;
|
||||
|
||||
use Magento\Backend\Block\Widget;
|
||||
use Magento\Backend\Block\Widget\Grid\Extended;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
use Magento\Framework\Data\Form\Element\Renderer\RendererInterface;
|
||||
use Magento\Framework\DataObject;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\DynamicTable\InputTable\Column;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class InputTable extends Extended implements RendererInterface
|
||||
{
|
||||
private const HIDDEN_ELEMENT_CLASS = 'hidden-input-table';
|
||||
|
||||
/** @var \Magento\Framework\Data\Form\Element\AbstractElement */
|
||||
protected $_element;
|
||||
|
||||
/** @var string */
|
||||
protected $_containerFieldId;
|
||||
|
||||
/** @var string */
|
||||
protected $_rowKey;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Data\CollectionFactory
|
||||
*/
|
||||
private $collectionFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\DataObjectFactory
|
||||
*/
|
||||
private $dataObjectFactory;
|
||||
|
||||
/**
|
||||
* @param \Magento\Backend\Block\Template\Context $context
|
||||
* @param \Magento\Backend\Helper\Data $backendHelper
|
||||
* @param \Magento\Framework\Data\CollectionFactory $collectionFactory
|
||||
* @param \Magento\Framework\DataObjectFactory $dataObjectFactory
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Backend\Block\Template\Context $context,
|
||||
\Magento\Backend\Helper\Data $backendHelper,
|
||||
\Magento\Framework\Data\CollectionFactory $collectionFactory,
|
||||
\Magento\Framework\DataObjectFactory $dataObjectFactory,
|
||||
array $data = []
|
||||
) {
|
||||
$this->collectionFactory = $collectionFactory;
|
||||
$this->dataObjectFactory = $dataObjectFactory;
|
||||
parent::__construct(
|
||||
$context,
|
||||
$backendHelper,
|
||||
$data
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure table.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Magento\Framework\Exception\FileSystemException
|
||||
*/
|
||||
public function _construct()
|
||||
{
|
||||
parent::_construct();
|
||||
$this->setPagerVisibility(false);
|
||||
$this->setFilterVisibility(false);
|
||||
$this->setMessageBlockVisibility(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addColumn($columnId, $column): self
|
||||
{
|
||||
if (is_array($column)) {
|
||||
$column['sortable'] = false;
|
||||
$this->getColumnSet()->setChild(
|
||||
$columnId,
|
||||
$this->getLayout()
|
||||
->createBlock(Column::class)
|
||||
->setData($column)
|
||||
->setId($columnId)
|
||||
->setGrid($this)
|
||||
);
|
||||
$this->getColumnSet()->getChildBlock($columnId)->setGrid($this);
|
||||
} else {
|
||||
throw new LocalizedException(__('Please correct the column format and try again.'));
|
||||
}
|
||||
|
||||
$this->_lastColumnId = $columnId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function canDisplayContainer(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function _prepareLayout()
|
||||
{
|
||||
return Widget::_prepareLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare field values.
|
||||
*
|
||||
* @param array $array
|
||||
* @return $this
|
||||
*/
|
||||
public function setArray(array $array): InputTable
|
||||
{
|
||||
$collection = $this->collectionFactory->create();
|
||||
$i = 1;
|
||||
foreach ($array as $item) {
|
||||
if (! $item instanceof DataObject) {
|
||||
$item = $this->dataObjectFactory->create(['data' => $item]);
|
||||
}
|
||||
|
||||
if (! $item->getId()) {
|
||||
$item->setId($i);
|
||||
}
|
||||
|
||||
$collection->addItem($item);
|
||||
$i++;
|
||||
}
|
||||
$this->setCollection($collection);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get row key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRowKey(): string
|
||||
{
|
||||
return $this->_rowKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set row key.
|
||||
*
|
||||
* @param string $key
|
||||
* @return $this
|
||||
*/
|
||||
public function setRowKey($key): InputTable
|
||||
{
|
||||
$this->_rowKey = $key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get container field id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContainerFieldId(): string
|
||||
{
|
||||
return $this->_containerFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set container field id.
|
||||
*
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setContainerFieldId(string $name): InputTable
|
||||
{
|
||||
$this->_containerFieldId = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function _toHtml(): string
|
||||
{
|
||||
$html = parent::_toHtml();
|
||||
$html = preg_replace(
|
||||
'/(\s+class\s*=\s*["\'](?:\s*|[^"\']*\s+)messages)((?:\s*|\s+[^"\']*)["\'])/isU',
|
||||
'$1 ' . self::HIDDEN_ELEMENT_CLASS . ' $2',
|
||||
$html
|
||||
);
|
||||
|
||||
return str_replace(
|
||||
'<div class="admin__data-grid-wrap',
|
||||
'<div id="' . $this->getHtmlId() . '_wrap" class="admin__data-grid-wrap dynamic-table-field',
|
||||
$html
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function render(AbstractElement $element): string
|
||||
{
|
||||
$this->setElement($element);
|
||||
return
|
||||
'<tr>
|
||||
<td class="label">' . $element->getLabelHtml() . '</td>
|
||||
<td class="value">' . $this->toHtml() . '</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set element.
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return $this
|
||||
*/
|
||||
public function setElement(AbstractElement $element): self
|
||||
{
|
||||
$this->_element = $element;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element.
|
||||
*
|
||||
* @return \Magento\Framework\Data\Form\Element\AbstractElement
|
||||
*/
|
||||
public function getElement(): AbstractElement
|
||||
{
|
||||
return $this->_element;
|
||||
}
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\DynamicTable\InputTable;
|
||||
|
||||
use Magento\Backend\Block\Widget\Grid\Column\Extended;
|
||||
use Magento\Framework\DataObject;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class Column extends Extended
|
||||
{
|
||||
/**
|
||||
* Table row key value.
|
||||
*
|
||||
* @var null
|
||||
*/
|
||||
protected $_rowKeyValue;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return preg_replace('#-$#', '', $this->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getRowField(DataObject $row)
|
||||
{
|
||||
if (null !== $this->getGrid()->getRowKey()) {
|
||||
$this->_rowKeyValue = $row->getData($this->getGrid()->getRowKey());
|
||||
}
|
||||
|
||||
if (! $this->_rowKeyValue) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return parent::getRowField($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get column field name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldName(): string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get column html name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHtmlName(): string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get column name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return sprintf(
|
||||
'%s[%s][%s]',
|
||||
$this->getGrid()->getContainerFieldId(),
|
||||
$this->_rowKeyValue,
|
||||
parent::getId()
|
||||
);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\DynamicTable\Renderer;
|
||||
|
||||
use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer;
|
||||
use Magento\Framework\DataObject;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class Button extends AbstractRenderer
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function render(DataObject $row): string
|
||||
{
|
||||
return $this->getLayout()
|
||||
->createBlock(\Magento\Backend\Block\Widget\Button::class)
|
||||
->addData(
|
||||
[
|
||||
'id' => 'preload_url_list_remove_button',
|
||||
'label' => __('Remove'),
|
||||
'type' => 'button',
|
||||
'class' => 'delete remove-row-value ' . $this->getColumn()->getId(),
|
||||
]
|
||||
)
|
||||
->toHtml();
|
||||
}
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element;
|
||||
|
||||
use Magento\Framework\Data\Form\Element\Radios;
|
||||
|
||||
/**
|
||||
* Frontend model for select field
|
||||
*
|
||||
* See README.md for instruction
|
||||
*
|
||||
* @method bool|null getDisabled()
|
||||
*
|
||||
* @since 1.0.4
|
||||
*/
|
||||
class ImageRadioButtons extends Radios
|
||||
{
|
||||
|
||||
/**
|
||||
* Get custom CSS class.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrValueCustomCssClass(): string
|
||||
{
|
||||
return 'plum_admin__field-wrapper';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function _optionToHtml($option, $selected): string
|
||||
{
|
||||
$html = '<div class="admin__field admin__field-option plum_admin__field-image-radio-buttons">';
|
||||
|
||||
$inputId = $this->getHtmlId() . $option['value'];
|
||||
|
||||
$html .= $this->createOptionInput($option, $inputId, $selected);
|
||||
$html .= $this->createOptionLabel($option, $inputId);
|
||||
|
||||
return $html . '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create input html.
|
||||
*
|
||||
* @param array $option
|
||||
* @param string $inputId
|
||||
* @param int|string|array $selected
|
||||
* @return string
|
||||
*/
|
||||
private function createOptionInput(array $option, string $inputId, $selected): string
|
||||
{
|
||||
$html = '<input type="radio" ' . $this->getRadioButtonAttributes($option);
|
||||
|
||||
$html .= 'value="' . $this->_escape($option['value']). '" ' .
|
||||
'class="admin__control-radio" ' .
|
||||
'id="' . $inputId . '"';
|
||||
|
||||
if ($option['value'] == $selected) {
|
||||
$html .= ' checked="checked"';
|
||||
}
|
||||
|
||||
if ($this->getDisabled()) {
|
||||
$html .= ' disabled';
|
||||
}
|
||||
|
||||
return $html . ' />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create label with image in it.
|
||||
*
|
||||
* @param array $option
|
||||
* @param string $inputId
|
||||
* @return string
|
||||
*/
|
||||
protected function createOptionLabel(array $option, string $inputId): string
|
||||
{
|
||||
if (empty($option['image'])) {
|
||||
$option['image'] = '';
|
||||
}
|
||||
|
||||
$optionHtml = '<label class="admin__field-label" for="' . $inputId . '">' .
|
||||
'<span class="pr-radio-img-label">' . $option['label'] . '</span>' .
|
||||
'<div class="pr-radio-img-wrp">' .
|
||||
'<img alt="' . $option['label'] . ' preview" ' .
|
||||
'src="' . $option['image'] . '" '.
|
||||
$this->createSourceSet($option, 'image') .
|
||||
($this->getDisabled() ? 'style="display: none;"' : '') .
|
||||
'>';
|
||||
|
||||
if (isset($option['anim'])) {
|
||||
$optionHtml .= "<img class=\"image__anim\" alt=\"{$option['label']} animation\"" .
|
||||
$this->createSourceSet($option, 'anim') .
|
||||
'src="' . $option['anim'] . '" ' .
|
||||
($this->getDisabled() ? 'style="display: none;"' : '') .
|
||||
'>';
|
||||
}
|
||||
|
||||
$optionHtml .= '</div></label>';
|
||||
|
||||
return $optionHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create source set for retina.
|
||||
*
|
||||
* @param array $option
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
private function createSourceSet(array $option, string $type): string
|
||||
{
|
||||
$retinaUrl = $type . '2x';
|
||||
if (! isset($option[$retinaUrl]) || ! $option[$retinaUrl]) {
|
||||
return '';
|
||||
}
|
||||
return "srcset=\"{$option['image']}, {$option['image2x']} 2x\" ";
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2025 Plumrocket Inc.
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
/**
|
||||
* Select element rendered as listbox (multiselect-like) but allowing single selection only.
|
||||
*
|
||||
* Visually:
|
||||
* - Uses Magento multiselect styling via classes + size attribute.
|
||||
* Behaviour:
|
||||
* - Standard single-select (no multiple="multiple").
|
||||
*/
|
||||
class ListboxSingleSelect extends Field
|
||||
{
|
||||
/**
|
||||
* Render select element with size attribute.
|
||||
*
|
||||
* @param AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element)
|
||||
{
|
||||
$element->addClass('select multiselect admin__control-multiselect pr-listbox-single-select');
|
||||
$html = parent::_getElementHtml($element);
|
||||
$html = preg_replace('/(<select[^>]*)(>)/i','$1 size="8"$2', $html);
|
||||
$html .= '<style>
|
||||
.pr-listbox-single-select {
|
||||
background: #fff !important;
|
||||
background-image: none !important;
|
||||
padding-right: 1rem !important;
|
||||
}
|
||||
</style>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Config\Block\System\Config\Form\Field;
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
/**
|
||||
* Color picker for system settings
|
||||
*
|
||||
* @since 1.0.3
|
||||
*/
|
||||
class Notice extends Field
|
||||
{
|
||||
|
||||
/**
|
||||
* Render notice.
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
public function render(AbstractElement $element): string
|
||||
{
|
||||
$short = (bool) $element->getData('field_config/pr_notice__short');
|
||||
|
||||
if ($short || $element->getLabel()) {
|
||||
$html = '<td class="label"><label for="' .
|
||||
$element->getHtmlId() . '"><span>' .
|
||||
$element->getLabel() .
|
||||
'</span></label></td>';
|
||||
$html .= '<td class="value pr-notice__content-wrapper">';
|
||||
} else {
|
||||
$html = '<td class="value pr-notice__content-wrapper" colspan="3">';
|
||||
}
|
||||
|
||||
$html .= '<div class="pr-notice__content">';
|
||||
$html .= $this->_getElementHtml($element);
|
||||
$html .= '</div>';
|
||||
$html .= '</td>';
|
||||
|
||||
return $this->_decorateRowHtml($element, $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function _getElementHtml(AbstractElement $element): string
|
||||
{
|
||||
return $element->getData('field_config/pr_notice__text') ?: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorate field row html
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @param string $html
|
||||
* @return string
|
||||
*/
|
||||
protected function _decorateRowHtml(AbstractElement $element, $html): string
|
||||
{
|
||||
$level = $element->getData('field_config/pr_notice__level') ?: 'info';
|
||||
$class = 'pr_notice pr_notice--' . $level . ($element->getLabel() ? '' : ' pr-notice--full-width');
|
||||
return '<tr id="row_' . $element->getHtmlId() . '" class="' . $class . '">'
|
||||
. $html
|
||||
. '</tr>';
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
|
||||
/**
|
||||
* Custom fieldset without any visible elements.
|
||||
*
|
||||
* @since 1.0.6
|
||||
*/
|
||||
class PureFieldset extends \Magento\Config\Block\System\Config\Form\Fieldset
|
||||
{
|
||||
|
||||
/**
|
||||
* Render field group without header and footer
|
||||
*
|
||||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
public function render(AbstractElement $element)
|
||||
{
|
||||
$this->setElement($element);
|
||||
return $this->_getChildrenElementsHtml($element);
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form;
|
||||
|
||||
use Magento\Framework\Data\Form\Element\Radios;
|
||||
use Magento\Framework\DataObject;
|
||||
|
||||
/**
|
||||
* For using this block you have to
|
||||
*
|
||||
* @deprecated since 1.0.4
|
||||
* @see \Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\ImageRadioButtons
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class RadiosWithImage extends Radios
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function _optionToHtml($option, $selected)
|
||||
{
|
||||
$html = '<div class="admin__field admin__field-option plum_admin__field-radios-with-image">' .
|
||||
'<input type="radio" ' . $this->getRadioButtonAttributes($option);
|
||||
if (is_array($option)) {
|
||||
$html .= 'value="' . $this->_escape(
|
||||
$option['value']
|
||||
) . '" class="admin__control-radio" id="' . $this->getHtmlId() . $option['value'] . '"';
|
||||
if ($option['value'] == $selected) {
|
||||
$html .= ' checked="checked"';
|
||||
}
|
||||
$html .= ' />';
|
||||
$html .= '<label class="admin__field-label" for="' .
|
||||
$this->getHtmlId() .
|
||||
$option['value'] .
|
||||
'"><span>' .
|
||||
$option['label'] .
|
||||
'</span>' .
|
||||
'<div class="pr-radio-img-wrp">' .
|
||||
'<img src="' . $option['image'] . '" alt="' . $option['label'] . ' Icon">' .
|
||||
'</div>
|
||||
</label>';
|
||||
|
||||
} elseif ($option instanceof DataObject) {
|
||||
$html .= 'id="' . $this->getHtmlId() . $option->getValue() . '"' . $option->serialize(
|
||||
['label', 'title', 'value', 'class', 'style']
|
||||
);
|
||||
if (in_array($option->getValue(), $selected)) {
|
||||
$html .= ' checked="checked"';
|
||||
}
|
||||
$html .= ' />';
|
||||
$html .= '<label class="inline" for="' .
|
||||
$this->getHtmlId() .
|
||||
$option->getValue() .
|
||||
'">' .
|
||||
$option->getLabel() .
|
||||
'<div class="pr-radio-img-wrp">' .
|
||||
'<img src="' . $option->getImage() . '" alt="' . $option->getLabel() . ' Icon">' .
|
||||
'</div>
|
||||
</label>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Model\Backend\Config;
|
||||
|
||||
use Magento\Framework\App\Cache\TypeListInterface;
|
||||
use Magento\Framework\App\Config\ScopeConfigInterface;
|
||||
use Magento\Framework\App\Config\Value;
|
||||
use Magento\Framework\Data\Collection\AbstractDb;
|
||||
use Magento\Framework\Model\Context;
|
||||
use Magento\Framework\Model\ResourceModel\AbstractResource;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Framework\Serialize\SerializerInterface;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class DynamicTableValue extends Value
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Serialize\SerializerInterface
|
||||
*/
|
||||
private $serializer;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\Model\Context $context
|
||||
* @param \Magento\Framework\Registry $registry
|
||||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
|
||||
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
|
||||
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
|
||||
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
|
||||
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
|
||||
*/
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $registry,
|
||||
ScopeConfigInterface $config,
|
||||
TypeListInterface $cacheTypeList,
|
||||
SerializerInterface $serializer,
|
||||
?AbstractResource $resource = null,
|
||||
?AbstractDb $resourceCollection = null
|
||||
) {
|
||||
parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection);
|
||||
$this->serializer = $serializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare field value after load.
|
||||
*
|
||||
* @return \Plumrocket\ExtendedAdminUi\Model\Backend\Config\DynamicTableValue
|
||||
*/
|
||||
public function afterLoad()
|
||||
{
|
||||
$value = $this->getValue() ?? '{}';
|
||||
$value = $this->serializer->unserialize((string) $value);
|
||||
$value = $this->prepareTableFieldValue($value);
|
||||
$this->setValue($value);
|
||||
return parent::afterLoad();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare field value before save.
|
||||
*
|
||||
* @return \Plumrocket\ExtendedAdminUi\Model\Backend\Config\DynamicTableValue
|
||||
*/
|
||||
public function beforeSave()
|
||||
{
|
||||
$value = $this->prepareTableFieldValue($this->getValue());
|
||||
$value = $this->serializer->serialize($value);
|
||||
$this->setValue($value);
|
||||
return parent::beforeSave();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the table field value, it must be an array type
|
||||
*
|
||||
* @param array|string $value
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareTableFieldValue($value): array
|
||||
{
|
||||
if (empty($value) && ! is_array($value)) {
|
||||
$value = [];
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Model\OptionSource;
|
||||
|
||||
use Plumrocket\Base\Model\OptionSource\AbstractSource;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class EnabledRecommended extends AbstractSource
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toOptionHash(): array
|
||||
{
|
||||
return [
|
||||
1 => __('Enabled (Recommended)'),
|
||||
0 => __('Disabled'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\ExtendedAdminUi\Model\OptionSource;
|
||||
|
||||
use Plumrocket\Base\Model\OptionSource\AbstractSource;
|
||||
|
||||
/**
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class YesRecommended extends AbstractSource
|
||||
{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function toOptionHash(): array
|
||||
{
|
||||
return [
|
||||
1 => __('Yes (Recommended)'),
|
||||
0 => __('No'),
|
||||
];
|
||||
}
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
Module Extended Admin UI provides components for building common interfaces across Plumrocket Extensions.
|
||||
|
||||
|
||||
# System Config
|
||||
|
||||
## Customisable Field
|
||||
|
||||
Provides the ability to customize basic properties of the field. For example: Css class, inherit checkbox, scope label, element attributes.
|
||||
|
||||
system.xml
|
||||
|
||||
```xml
|
||||
<field>
|
||||
<frontend_model>Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\CustomisableField</frontend_model>
|
||||
<attribute type="pr_disable_inherit_checkbox">1</attribute>
|
||||
<attribute type="pr_disable_scope_label">1</attribute>
|
||||
<attribute type="pr_element_attribute/readonly">readonly</attribute>
|
||||
</field>
|
||||
```
|
||||
|
||||
## Color Picker
|
||||
|
||||
For using Color Picker you should
|
||||
|
||||
1. Add frontend_model as in example below
|
||||
2. Add one of pickr css themes to system config layout
|
||||
|
||||
Css theme 1 `Plumrocket_ExtendedAdminUi::css/lib/pickr/monolith.min.css`
|
||||
Css theme 2 `Plumrocket_ExtendedAdminUi::css/form/element/color-picker.css`
|
||||
|
||||
system.xml
|
||||
|
||||
```xml
|
||||
<field id="background_color" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Background Color</label>
|
||||
<frontend_model>Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\ColorPicker</frontend_model>
|
||||
</field>
|
||||
```
|
||||
|
||||
pr_system_config_edit_{section}.xml
|
||||
```xml
|
||||
<head>
|
||||
<css src="Plumrocket_ExtendedAdminUi::css/lib/pickr/monolith.min.css"/>
|
||||
</head>
|
||||
```
|
||||
|
||||
### Settings
|
||||
|
||||
Use can use attributes to change color picker configs, for example
|
||||
|
||||
```xml
|
||||
<attribute type="pr_pickr/components/interaction/clear">0</attribute>
|
||||
```
|
||||
|
||||
## Radio With Images
|
||||
|
||||
For using Radio With Images you should
|
||||
|
||||
1. Change "select" or "radios" type as in example below
|
||||
2. Add css to system config layout
|
||||
3. Create a source model implementing \Plumrocket\ExtendedAdminUi\Api\ImageRadioButtonSourceInterface
|
||||
|
||||
```xml
|
||||
<field id="template" translate="label" type="Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Element\ImageRadioButtons" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Template</label>
|
||||
<source_model>Plumrocket\ModuleName\Model\OptionSource\Template</source_model>
|
||||
<frontend_model>Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\CustomisableField</frontend_model>
|
||||
</field>
|
||||
```
|
||||
|
||||
pr_system_config_edit_{section}.xml
|
||||
```xml
|
||||
<head>
|
||||
<css src="Plumrocket_ExtendedAdminUi::css/image-radio-buttons.css"/>
|
||||
</head>
|
||||
```
|
||||
|
||||
## Text editor (wysiwyg)
|
||||
|
||||
frontend_model `Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Editor`
|
||||
|
||||
Exist possibility modify wysiwyg config by adding attributes
|
||||
|
||||
```xml
|
||||
<field id="notice_text" translate="label" type="editor" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<label>Notice Text</label>
|
||||
<frontend_model>Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Editor</frontend_model>
|
||||
<config_path>prgdpr/cookie_consent/notice_text</config_path>
|
||||
<attribute type="pr_editor_height">300px</attribute>
|
||||
</field>
|
||||
```
|
||||
|
||||
## Pure Fieldset
|
||||
|
||||
frontend_model `Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\PureFieldset`
|
||||
|
||||
Exist possibility to display fields in module configurations without a group header
|
||||
|
||||
```xml
|
||||
<group id="pure_fieldset" translate="label" type="text" showInDefault="1" showInWebsite="1" showInStore="1">
|
||||
<frontend_model>Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\PureFieldset</frontend_model>
|
||||
<field></field>
|
||||
</group>
|
||||
```
|
||||
|
||||
## Notice
|
||||
|
||||
_since 1.1.0_
|
||||
|
||||
Notice is an element designed to give customers tips related to the module configurations or field set but not for a single configuration field.
|
||||
Styles were completely copied from magento messages to make them build-in like.
|
||||
|
||||
There are two variants of notices:
|
||||
1. Full width
|
||||

|
||||
2. With label
|
||||

|
||||
|
||||
Also, there are five levels of notice: **note, info, warning, success, error**
|
||||
|
||||
Example for full width info notice:
|
||||
```xml
|
||||
<!-- File: system.xml -->
|
||||
<field id="" translate="label" type="label">
|
||||
<frontend_model>Plumrocket\ExtendedAdminUi\Block\Adminhtml\System\Config\Form\Notice</frontend_model>
|
||||
<attribute type="pr_notice__level">info</attribute>
|
||||
<attribute type="pr_notice__text">
|
||||
<![CDATA[Please follow this <a href="https://plumrocket.com/docs" target="_blank">developer guide</a>.]]>
|
||||
</attribute>
|
||||
</field>
|
||||
```
|
||||
To add styles use update handle
|
||||
```xml
|
||||
<!-- File: pr_system_config_edit_{extension_section}.xml -->
|
||||
<update handle="pr_system_config_element_notice"/>
|
||||
```
|
||||
|
||||
## Option source models
|
||||
|
||||
### Yes (Recommended)/No
|
||||
|
||||
_since 1.1.0_
|
||||
|
||||
`Plumrocket\ExtendedAdminUi\Model\OptionSource\YesRecommended`
|
||||
|
||||
### Enabled (Recommended)/Disabled
|
||||
|
||||
_since 1.1.0_
|
||||
|
||||
`Plumrocket\ExtendedAdminUi\Model\OptionSource\EnabledRecommended`
|
||||
|
||||
|
||||
# UI Forms
|
||||
|
||||
## Color Picker
|
||||
|
||||
Added for 2.2 because from 2.3 magento has its own [color picker](https://devdocs.magento.com/guides/v2.4/ui_comp_guide/components/ui-colorpicker.html)
|
||||
|
||||
Component `Plumrocket_ExtendedAdminUi/js/form/element/color-picker`
|
||||
Template `Plumrocket_ExtendedAdminUi/form/element/color-picker`
|
||||
|
||||
### Example form field
|
||||
```xml
|
||||
<field name="label_color" formElement="input" component="Plumrocket_ExtendedAdminUi/js/form/element/color-picker">
|
||||
<settings>
|
||||
<label translate="true">Label Color</label>
|
||||
<elementTmpl>Plumrocket_ExtendedAdminUi/form/element/color-picker</elementTmpl>
|
||||
<validation>
|
||||
<rule name="validate-color" xsi:type="boolean">true</rule>
|
||||
</validation>
|
||||
</settings>
|
||||
</field>
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "plumrocket/module-extended-admin-ui",
|
||||
"version": "1.1.10",
|
||||
"description": "Extended Admin UI Extension for Magento 2",
|
||||
"type": "magento2-module",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"registration.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Plumrocket\\ExtendedAdminUi\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Plumrocket_ExtendedAdminUi"/>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
-->
|
||||
<extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:module:Plumrocket_Base:etc/pr_extensions.xsd">
|
||||
<extension is_service="true" name="ExtendedAdminUi" title="Extended Admin UI"/>
|
||||
</extensions>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Plumrocket_ExtendedAdminUi', __DIR__);
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<css src="Plumrocket_ExtendedAdminUi::css/lib/chosen.css"/>
|
||||
</head>
|
||||
</page>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2023 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<css src="Plumrocket_ExtendedAdminUi::css/tooltip.css"/>
|
||||
</head>
|
||||
</page>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<css src="Plumrocket_ExtendedAdminUi::css/notice.css"/>
|
||||
</head>
|
||||
</page>
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
?>
|
||||
<?php /** @var \Magento\Backend\Block\Template $block */ ?>
|
||||
<?php
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
$escaper = $escaper ?? $block->getEscaper();
|
||||
?>
|
||||
<script>
|
||||
require(['pickr'], function(Pickr) {
|
||||
var input = document.getElementById('<?= $escaper->escapeHtml($block->getData('elementId')) ?>');
|
||||
var inheritCheckbox = document.getElementById(
|
||||
'<?= $escaper->escapeHtml($block->getData('elementId')) ?>_inherit'
|
||||
);
|
||||
var pickr = Pickr.create(JSON.parse('<?= /* @noEscape */ $block->getData('jsonConfig') ?>'));
|
||||
|
||||
pickr.on('change', function (color, instance) {
|
||||
if (null === color) {
|
||||
input.value = '';
|
||||
} else {
|
||||
input.value = color.toHEXA();
|
||||
}
|
||||
});
|
||||
|
||||
pickr.on('clear', function (instance) {
|
||||
input.value = '';
|
||||
});
|
||||
|
||||
input.addEventListener('change', function (ev) {
|
||||
if (ev.target.value === '') {
|
||||
pickr.setColor(null);
|
||||
} else {
|
||||
pickr.setColor(ev.target.value);
|
||||
}
|
||||
});
|
||||
|
||||
// Use default/use system value
|
||||
if (inheritCheckbox) {
|
||||
inheritCheckbox.addEventListener('change', function (event) {
|
||||
if (event.target.checked) {
|
||||
pickr.disable();
|
||||
} else {
|
||||
pickr.enable();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
.colorpicker-input {
|
||||
vertical-align: middle;
|
||||
width: 50% !important;
|
||||
}
|
||||
|
||||
.admin__field-control > .pickr {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
padding: 3px;
|
||||
display: inline-block;
|
||||
border: solid 1px #adadad;
|
||||
background: #eaeaea;
|
||||
color: #333;
|
||||
vertical-align: middle;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.admin__field-control > .pickr > button {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
display: block;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.admin__field-control > .pickr > button:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
.messages.hidden-input-table {
|
||||
display: none
|
||||
}
|
||||
|
||||
div.dynamic-table-field {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.accordion .form-inline .config .dynamic-table-field td {
|
||||
padding: 1rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.dynamic-table-field td input.checkbox[disabled] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.dynamic-table-field tr.not-active td,
|
||||
div.dynamic-table-field tr.not-active input.input-text {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
div.dynamic-table-field td.dynamic-table-column-width-10 {
|
||||
width: 10%;
|
||||
}
|
||||
div.dynamic-table-field td.dynamic-table-column-width-20 {
|
||||
width: 20%;
|
||||
}
|
||||
div.dynamic-table-field td.dynamic-table-column-width-30 {
|
||||
width: 30%;
|
||||
}
|
||||
div.dynamic-table-field td.dynamic-table-column-width-40 {
|
||||
width: 40%;
|
||||
}
|
||||
div.dynamic-table-field td.dynamic-table-column-width-50 {
|
||||
width: 50%;
|
||||
}
|
||||
div.dynamic-table-field td.dynamic-table-column-width-60 {
|
||||
width: 60%;
|
||||
}
|
||||
div.dynamic-table-field td.dynamic-table-column-width-70 {
|
||||
width: 70%;
|
||||
}
|
||||
div.dynamic-table-field td.dynamic-table-column-width-80 {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
button.dynamic-table-field.add-row-value {
|
||||
margin-top: 5px;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2021 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
.plum_admin__field-wrapper{
|
||||
width: 54% !important;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
margin: 0 4rem 2rem 0 !important;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.plum_admin__field-wrapper .plum_admin__field-image-radio-buttons:last-of-type{
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons .pr-radio-img-wrp {
|
||||
margin-top: 1.5rem;
|
||||
margin-left: -2.6rem;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons.admin__field-option > .admin__control-radio {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons .admin__field-label:hover img{
|
||||
box-shadow: 3px 3px 5px -1px #0000007d;
|
||||
transition: .2s all ease-in-out;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons > .admin__control-radio:checked + label .pr-radio-img-wrp{
|
||||
border: 1px solid #7f8eb5;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons .pr-radio-img-wrp{
|
||||
position: relative;
|
||||
border: 1px solid transparent;
|
||||
padding: 0;
|
||||
transition: .2s all ease-in-out;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons .pr-radio-img-wrp img{
|
||||
display: block !important;
|
||||
min-height: 40px;
|
||||
}
|
||||
.plum_admin__field-image-radio-buttons .pr-radio-img-wrp .image__anim{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.pr-radio-img-wrp:hover .image__anim{
|
||||
display: block !important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.image__anim{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons > .admin__control-radio:checked + label .pr-radio-img-wrp:before{
|
||||
content: "";
|
||||
position: absolute;
|
||||
background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg fill='%23fff' version='1.1' id='Capa_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='10px' height='10px' viewBox='0 0 78.369 78.369' xml:space='preserve'%3E%3Cg%3E%3Cpath d='M78.049,19.015L29.458,67.606c-0.428,0.428-1.121,0.428-1.548,0L0.32,40.015c-0.427-0.426-0.427-1.119,0-1.547l6.704-6.704 c0.428-0.427,1.121-0.427,1.548,0l20.113,20.112l41.113-41.113c0.429-0.427,1.12-0.427,1.548,0l6.703,6.704 C78.477,17.894,78.477,18.586,78.049,19.015z'/%3E%3C/g%3E%3C/svg%3E%0A");
|
||||
top: 7px;
|
||||
right: 7px;
|
||||
z-index: 1;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.plum_admin__field-image-radio-buttons > .admin__control-radio:checked + label .pr-radio-img-wrp:after{
|
||||
content: "";
|
||||
border: 20px solid transparent;
|
||||
border-top: 20px solid #e0510f;
|
||||
border-right: 20px solid #e0510f;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
@@ -0,0 +1,469 @@
|
||||
/*!
|
||||
!!! FILE WAS EDITED TO TURN IT IN MAGENTO STYLE !!!
|
||||
|
||||
Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||
by Patrick Filler for Harvest, http://getharvest.com
|
||||
|
||||
Version 1.8.7
|
||||
Full source at https://github.com/harvesthq/chosen
|
||||
Copyright (c) 2011-2018 Harvest http://getharvest.com
|
||||
|
||||
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||
This file is generated by `grunt build`, do not edit it by hand.
|
||||
*/
|
||||
.chosen-container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
font-size: 13px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none
|
||||
}
|
||||
|
||||
.chosen-container * {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box
|
||||
}
|
||||
|
||||
.chosen-container .chosen-drop {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
z-index: 1010;
|
||||
width: 100%;
|
||||
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
||||
clip: rect(0, 0, 0, 0);
|
||||
-webkit-clip-path: inset(100% 100%);
|
||||
clip-path: inset(100% 100%);
|
||||
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #007bdb;
|
||||
border-radius: 1px;
|
||||
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
|
||||
color: #41362f;
|
||||
font-weight: 400;
|
||||
left: 0;
|
||||
list-style: none;
|
||||
margin: 2px 0 0;
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.chosen-container.chosen-with-drop .chosen-drop {
|
||||
clip: auto;
|
||||
-webkit-clip-path: none;
|
||||
clip-path: none
|
||||
}
|
||||
|
||||
.chosen-container a {
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.chosen-container .chosen-single .group-name, .chosen-container .search-choice .group-name {
|
||||
margin-right: 4px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: 400;
|
||||
color: #999
|
||||
}
|
||||
|
||||
.chosen-container .chosen-single .group-name:after, .chosen-container .search-choice .group-name:after {
|
||||
content: ":";
|
||||
padding-left: 2px;
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single {
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding: 0 0 0 8px;
|
||||
height: 25px;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #fff), color-stop(50%, #f6f6f6), color-stop(52%, #eee), to(#f4f4f4));
|
||||
background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);
|
||||
background-clip: padding-box;
|
||||
-webkit-box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, .1);
|
||||
box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, .1);
|
||||
color: #444;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
line-height: 24px
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-default {
|
||||
color: #999
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin-right: 26px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single-with-deselect span {
|
||||
margin-right: 38px
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single abbr {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 26px;
|
||||
display: block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: url(../images/chosen-sprite.png) -42px 1px no-repeat;
|
||||
font-size: 1px
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single abbr:hover {
|
||||
background-position: -42px -10px
|
||||
}
|
||||
|
||||
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
||||
background-position: -42px -10px
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single div b {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: url(../images/chosen-sprite.png) no-repeat 0 2px
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-search {
|
||||
position: relative;
|
||||
z-index: 1010;
|
||||
margin: 0;
|
||||
padding: 3px 4px;
|
||||
white-space: nowrap
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-search input[type=text] {
|
||||
margin: 1px 0;
|
||||
padding: 4px 20px 4px 5px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
outline: 0;
|
||||
border: 1px solid #aaa;
|
||||
background: url(../images/chosen-sprite.png) no-repeat 100% -20px;
|
||||
font-size: 1em;
|
||||
font-family: sans-serif;
|
||||
line-height: normal;
|
||||
border-radius: 0
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-drop {
|
||||
margin-top: -1px;
|
||||
border-radius: 0 0 4px 4px;
|
||||
background-clip: padding-box
|
||||
}
|
||||
|
||||
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
-webkit-clip-path: inset(100% 100%);
|
||||
clip-path: inset(100% 100%)
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results {
|
||||
color: #444;
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
margin: 0 4px 4px 0;
|
||||
padding: 0 0 0 4px;
|
||||
max-height: 240px;
|
||||
-webkit-overflow-scrolling: touch
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li {
|
||||
display: none;
|
||||
margin: 0;
|
||||
padding: 5px 6px;
|
||||
list-style: none;
|
||||
line-height: 15px;
|
||||
word-wrap: break-word;
|
||||
-webkit-touch-callout: none
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.active-result {
|
||||
display: list-item;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.disabled-result {
|
||||
display: list-item;
|
||||
color: #ccc;
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.highlighted {
|
||||
background-image: linear-gradient(#e3e3e3 20%, #e3e3e3 90%);
|
||||
background-color: #e3e3e3;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.no-results {
|
||||
color: #777;
|
||||
display: list-item;
|
||||
background: #f4f4f4
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.group-result {
|
||||
display: list-item;
|
||||
font-weight: 700;
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li {
|
||||
padding: .6875em 1em;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li em {
|
||||
font-style: normal;
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border: 1px solid #aaa;
|
||||
background-color: #fff;
|
||||
cursor: text
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li {
|
||||
float: left;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-field {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-field input[type=text] {
|
||||
margin: 1px 0;
|
||||
height: 25px;
|
||||
outline: 0;
|
||||
border: 0 !important;
|
||||
background: 0 0 !important;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
color: #999;
|
||||
font-size: 100%;
|
||||
font-family: sans-serif;
|
||||
line-height: normal;
|
||||
border-radius: 0;
|
||||
width: 25px
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice,
|
||||
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #a79d95;
|
||||
border-radius: 1px;
|
||||
display: inline-block;
|
||||
font-size: 1.2rem;
|
||||
margin: 0.3rem;
|
||||
padding: 0.3rem 2.4rem 0.4rem 1rem;
|
||||
position: relative;
|
||||
transition: border-color 0.1s linear;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice span {
|
||||
word-wrap: break-word
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
||||
bottom: 0;
|
||||
font-size: .5em;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 2rem;
|
||||
display: inline-block;
|
||||
padding: 0.6rem 1em 0.6rem;
|
||||
text-align: center;
|
||||
vertical-align: baseline;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-family: 'Admin Icons', sans-serif;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
speak: none;
|
||||
color: #514943;
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:before {
|
||||
content: '\e62f';
|
||||
transition: color 0.1s linear;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
||||
padding-right: 1rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
||||
background: #d4d4d4
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
||||
background-position: -42px -10px
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-results {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-drop .result-selected {
|
||||
display: list-item;
|
||||
background-color: #e0f6fe;
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.chosen-container-active .chosen-single {
|
||||
border-color: #007bdb;
|
||||
}
|
||||
|
||||
.chosen-container-active.chosen-with-drop .chosen-single {
|
||||
border: 1px solid #aaa;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-left: none;
|
||||
background: 0 0
|
||||
}
|
||||
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
||||
background-position: -18px 2px
|
||||
}
|
||||
|
||||
.chosen-container-active .chosen-choices {
|
||||
border-color: #007bdb;
|
||||
}
|
||||
|
||||
.chosen-container-active .chosen-choices li.search-field input[type=text] {
|
||||
color: #222 !important
|
||||
}
|
||||
|
||||
.chosen-disabled {
|
||||
opacity: .5 !important;
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.chosen-disabled .chosen-single {
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.chosen-rtl {
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single {
|
||||
overflow: visible;
|
||||
padding: 0 8px 0 0
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single span {
|
||||
margin-right: 0;
|
||||
margin-left: 26px;
|
||||
direction: rtl
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single-with-deselect span {
|
||||
margin-left: 38px
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single div {
|
||||
right: auto;
|
||||
left: 3px
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single abbr {
|
||||
right: auto;
|
||||
left: 26px
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li {
|
||||
float: right
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li.search-field input[type=text] {
|
||||
direction: rtl
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li.search-choice {
|
||||
margin: 3px 5px 3px 0;
|
||||
padding: 3px 5px 3px 19px
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
||||
right: auto;
|
||||
left: 4px
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-single .chosen-results {
|
||||
margin: 0 0 4px 4px;
|
||||
padding: 0 4px 0 0
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-results li.group-option {
|
||||
padding-right: 15px;
|
||||
padding-left: 0
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-right: none
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-search input[type=text] {
|
||||
padding: 4px 5px 4px 20px;
|
||||
background: url(../images/chosen-sprite.png) no-repeat -30px -20px;
|
||||
direction: rtl
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-single .chosen-single div b {
|
||||
background-position: 6px 2px
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
||||
background-position: -12px 2px
|
||||
}
|
||||
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
|
||||
.chosen-container .chosen-results-scroll-down span, .chosen-container .chosen-results-scroll-up span, .chosen-container-multi .chosen-choices .search-choice .search-choice-close, .chosen-container-single .chosen-search input[type=text], .chosen-container-single .chosen-single abbr, .chosen-container-single .chosen-single div b, .chosen-rtl .chosen-search input[type=text] {
|
||||
background-image: url(../images/chosen-sprite@2x.png) !important;
|
||||
background-size: 52px 37px !important;
|
||||
background-repeat: no-repeat !important
|
||||
}
|
||||
}
|
||||
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
.accordion .config .pr_notice .pr-notice__content-wrapper {
|
||||
padding-top: 2.2rem;
|
||||
}
|
||||
|
||||
.accordion .form-inline .config .pr-notice__content {
|
||||
background: #fffbbb;
|
||||
color: #333333;
|
||||
font-size: 1.4rem;
|
||||
margin: 0 0 1px;
|
||||
padding: 1.8rem 4rem 1.8rem 5.5rem;
|
||||
position: relative;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.accordion .form-inline .config .pr_notice--error .pr-notice__content {
|
||||
background: #ffcccc;
|
||||
}
|
||||
|
||||
.accordion .form-inline .config .pr_notice--note .pr-notice__content {
|
||||
background: #f1f1f1;
|
||||
}
|
||||
|
||||
.pr-notice__content::before {
|
||||
background: none;
|
||||
border: 0;
|
||||
font-family: 'Admin Icons';
|
||||
font-size: 1.9rem;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
height: auto;
|
||||
left: 1.9rem;
|
||||
line-height: inherit;
|
||||
position: absolute;
|
||||
speak: none;
|
||||
text-shadow: none;
|
||||
top: 50%;
|
||||
margin-top: -1.25rem;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.pr_notice--note .pr-notice__content::before {
|
||||
color: #007bdb;
|
||||
content: '\e61a';
|
||||
}
|
||||
|
||||
.pr_notice--info .pr-notice__content::before {
|
||||
color: #007bdb;
|
||||
content: '\e61a';
|
||||
}
|
||||
|
||||
.pr_notice--success .pr-notice__content::before {
|
||||
color: #79a22e;
|
||||
content: '\e62d';
|
||||
}
|
||||
|
||||
.pr_notice--warning .pr-notice__content::before {
|
||||
color: #eb5202;
|
||||
content: '\e623';
|
||||
}
|
||||
|
||||
.pr_notice--error .pr-notice__content::before {
|
||||
color: #e22626;
|
||||
content: '\e632';
|
||||
font-size: 1.5rem;
|
||||
left: 2.2rem;
|
||||
margin-top: -1.1rem;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
.plum_admin__field-radios-with-image {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
margin-right: 4rem;
|
||||
}
|
||||
|
||||
.plum_admin__field-radios-with-image .pr-radio-img-wrp {
|
||||
margin-top: 1.5rem;
|
||||
margin-left: -2.6rem;
|
||||
}
|
||||
|
||||
.plum_admin__field-radios-with-image.admin__field-option > .admin__control-radio {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
.pr-tooltip {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 5px 0;
|
||||
margin: -5px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pr-tooltip-toggle {
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
.pr-tooltip .pr-tooltip-content {
|
||||
visibility: hidden;
|
||||
width: 248px;
|
||||
max-width: 248px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 100%;
|
||||
text-align: center;
|
||||
padding: 18px;
|
||||
border-radius: 5px;
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
background-color:
|
||||
rgba(49, 48, 43, 0.8);
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
cursor: auto;
|
||||
}
|
||||
.pr-tooltip:hover .pr-tooltip-content {
|
||||
visibility: visible;
|
||||
}
|
||||
.pr-tooltip-content:before {
|
||||
border-bottom: 0;
|
||||
border-left: 5px solid transparent;
|
||||
border-right: 5px solid transparent;
|
||||
border-top: 5px solid #35302c;
|
||||
bottom: -5px;
|
||||
content: '';
|
||||
height: 0;
|
||||
left: auto;
|
||||
opacity: .8;
|
||||
position: absolute;
|
||||
right: 142px;
|
||||
top: auto;
|
||||
width: 0;
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'Plumrocket_ExtendedAdminUi/js/lib/chosen.jquery.min'
|
||||
], function ($) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
/**
|
||||
* Registry for all selects with class pr-chosen
|
||||
*/
|
||||
initializedSelects: [],
|
||||
|
||||
/**
|
||||
* @param {string} selector
|
||||
* @param {{enabled: boolean, allIndex: string}} dependConfig
|
||||
*/
|
||||
initializeChosen: function (selector, dependConfig) {
|
||||
var selects = this.getChosenSelects(selector);
|
||||
selects.forEach(function (select) {
|
||||
if (! this.isInitializedSelect(select)) {
|
||||
this.initializeSelect(select);
|
||||
this.initializeOptionDepends(select, dependConfig);
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} selector
|
||||
* @returns {HTMLSelectElement[]}
|
||||
*/
|
||||
getChosenSelects: function (selector) {
|
||||
var result = $(selector);
|
||||
return result.length ? result.toArray() : [];
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @param {HTMLSelectElement} select
|
||||
* @returns {boolean|number|*}
|
||||
*/
|
||||
initializeSelect: function (select) {
|
||||
if (!select instanceof HTMLElement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isInitializedSelect(select)) {
|
||||
return this.getIndexOfRegisteredSelect(select);
|
||||
}
|
||||
|
||||
var enableSearch = true;
|
||||
if ('readonly' === select.getAttribute('readonly')) {
|
||||
enableSearch = false;
|
||||
}
|
||||
|
||||
$(select).chosen({
|
||||
'display_selected_options': true,
|
||||
'display_disabled_options': true,
|
||||
'hide_results_on_select': true,
|
||||
'group_search': enableSearch
|
||||
});
|
||||
|
||||
return this.initializedSelects.push(select.name);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {HTMLSelectElement} select
|
||||
* @returns {number}
|
||||
*/
|
||||
getIndexOfRegisteredSelect: function (select) {
|
||||
return this.initializedSelects.indexOf(select.name);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {HTMLSelectElement} select
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isInitializedSelect: function (select) {
|
||||
return -1 !== this.getIndexOfRegisteredSelect(select);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {HTMLSelectElement} select
|
||||
*/
|
||||
reinitializeSelect: function (select) {
|
||||
if (this.isInitializedSelect(select)) {
|
||||
$(select).chosen('destroy');
|
||||
this.initializedSelects.splice(this.getIndexOfRegisteredSelect(select), 1);
|
||||
this.initializeSelect(select);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {HTMLSelectElement} select
|
||||
*/
|
||||
updateSelect: function (select) {
|
||||
this.initializeSelect(select);
|
||||
$(select).trigger('chosen:updated');
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {HTMLSelectElement} select
|
||||
* @param {{enabled: boolean, allIndex: string}} dependConfig
|
||||
*/
|
||||
initializeOptionDepends: function (select, dependConfig) {
|
||||
if (! dependConfig.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.initializeSelect(select);
|
||||
|
||||
var $select = $(select);
|
||||
|
||||
var initialValues = !$select.val() ? [] : $select.val();
|
||||
var initialShowToAllIndex = initialValues.indexOf(dependConfig.allIndex);
|
||||
|
||||
var chosenModel = this;
|
||||
$select.on('change', function () {
|
||||
var values = !$(this).val() ? [] : $(this).val();
|
||||
var showToAllIndex = values.indexOf(dependConfig.allIndex);
|
||||
|
||||
if (-1 !== initialShowToAllIndex) {
|
||||
if (-1 !== showToAllIndex && values.length > 1) {
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
values.splice(showToAllIndex, 1);
|
||||
}
|
||||
$select.val(values);
|
||||
}
|
||||
} else {
|
||||
if (-1 !== showToAllIndex && values.length > 1) {
|
||||
$select.val([dependConfig.allIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$(this).val()) {
|
||||
$(this).val([dependConfig.allIndex]);
|
||||
}
|
||||
|
||||
initialValues = $(this).val() === null ? [] : $(this).val();
|
||||
initialShowToAllIndex = initialValues.indexOf(dependConfig.allIndex);
|
||||
chosenModel.updateSelect(select);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated added for magento 2.2
|
||||
* for magento >= 2.3 please use their color picker
|
||||
* @link https://devdocs.magento.com/guides/v2.4/ui_comp_guide/components/ui-colorpicker.html
|
||||
*/
|
||||
define([
|
||||
'mage/translate',
|
||||
'Magento_Ui/js/form/element/abstract',
|
||||
'pickr',
|
||||
], function ($t, Abstract, Pickr) {
|
||||
'use strict';
|
||||
|
||||
return Abstract.extend({
|
||||
|
||||
defaults: {
|
||||
colorPickerConfig: {
|
||||
theme: 'monolith',
|
||||
useAsButton: false,
|
||||
comparison: false,
|
||||
swatches: [
|
||||
'rgba(244, 67, 54, 1)',
|
||||
'rgba(233, 30, 99, 0.95)',
|
||||
'rgba(156, 39, 176, 0.9)',
|
||||
'rgba(103, 58, 183, 0.85)',
|
||||
'rgba(63, 81, 181, 0.8)',
|
||||
'rgba(33, 150, 243, 0.75)',
|
||||
'rgba(3, 169, 244, 0.7)',
|
||||
'rgba(0, 188, 212, 0.7)',
|
||||
'rgba(0, 150, 136, 0.75)',
|
||||
'rgba(76, 175, 80, 0.8)',
|
||||
'rgba(139, 195, 74, 0.85)',
|
||||
'rgba(205, 220, 57, 0.9)',
|
||||
'rgba(255, 235, 59, 0.95)',
|
||||
'rgba(255, 193, 7, 1)'
|
||||
],
|
||||
|
||||
components: {
|
||||
|
||||
// Main components
|
||||
preview: true,
|
||||
opacity: true,
|
||||
hue: true,
|
||||
|
||||
// Input / output Options
|
||||
interaction: {
|
||||
hex: true,
|
||||
rgba: true,
|
||||
hsla: false,
|
||||
hsva: false,
|
||||
cmyk: false,
|
||||
input: true,
|
||||
clear: true,
|
||||
save: false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Invokes initialize method of parent class,
|
||||
* contains initialization logic
|
||||
*/
|
||||
initialize: function () {
|
||||
this._super();
|
||||
|
||||
this.colorPickerConfig.default = this.value() ? this.value() : null;
|
||||
this.colorPickerConfig.disabled = this.disabled();
|
||||
this.colorPickerConfig.el = '#' + this.uid + '_color_picker';
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
initColorPicker: function () {
|
||||
var self = this;
|
||||
var pickr = Pickr.create(self.colorPickerConfig);
|
||||
|
||||
pickr.on('change', function (color, instance) {
|
||||
if (null === color) {
|
||||
self.value('');
|
||||
} else {
|
||||
self.value(color.toHEXA().toString());
|
||||
}
|
||||
});
|
||||
|
||||
pickr.on('clear', function (instance) {
|
||||
self.value('');
|
||||
});
|
||||
|
||||
self.value.subscribe(function (newValue) {
|
||||
if (newValue === '') {
|
||||
pickr.setColor(null);
|
||||
} else {
|
||||
pickr.setColor(newValue);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2022 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
*/
|
||||
|
||||
define([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
return {
|
||||
initialize: function (rowId) {
|
||||
var $grid = $('#' + rowId + ' > td.value .data-grid tbody');
|
||||
|
||||
this.waitMageInitialization($grid, function (rowId, $grid) {
|
||||
const $inherit = $('#' + rowId + '_inherit:checked');
|
||||
if ($inherit.length) {
|
||||
$inherit.click();
|
||||
}
|
||||
|
||||
let rowTemplate = $grid.find('tr:first-child').html();
|
||||
$grid.find('tr:first-child').remove();
|
||||
$grid.addClass('loaded');
|
||||
|
||||
this.initAddButton(rowId, $grid, rowTemplate);
|
||||
this.initRemoveButton($grid);
|
||||
}.bind(this, rowId, $grid))
|
||||
},
|
||||
initAddButton: function (rowId, $grid, template) {
|
||||
$('#' + rowId + ' > td.value > .add-row-value').on('click', function () {
|
||||
let name = 'row-value-' + Date.now();
|
||||
$grid.append('<tr>'+ template.split('_TMPNAME_').join(name) +'</tr>');
|
||||
return false;
|
||||
});
|
||||
},
|
||||
initRemoveButton: function ($grid) {
|
||||
$grid.on('click', '.remove-row-value', function () {
|
||||
$(this).parent().parent().remove();
|
||||
});
|
||||
},
|
||||
waitMageInitialization: function ($grid, callback) {
|
||||
let interval = setInterval(function () {
|
||||
if ($grid.find('*[data-mage-init]').length === 0) {
|
||||
callback();
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
});
|
||||
+6
File diff suppressed because one or more lines are too long
+3
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_Extension
|
||||
* @copyright Copyright (c) 2026 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
var __prinitparam = 'MzM5Njkw';
|
||||
@@ -0,0 +1,7 @@
|
||||
var config = {
|
||||
map: {
|
||||
'*': {
|
||||
pickr: 'Plumrocket_ExtendedAdminUi/js/lib/pickr.es5.min',
|
||||
}
|
||||
}
|
||||
};
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<!--
|
||||
* @package Plumrocket_ExtendedAdminUi
|
||||
* @copyright Copyright (c) 2020 Plumrocket Inc. (https://plumrocket.com)
|
||||
* @license https://plumrocket.com/license/ End-user License Agreement
|
||||
-->
|
||||
|
||||
<div class="admin__field-control"
|
||||
visible="visible"
|
||||
css="$data.additionalClasses">
|
||||
<div attr="id: uid + '_color_picker'"></div>
|
||||
<input type="text" class="admin__control-text colorpicker-input"
|
||||
ko-value="value" hasFocus="focused" disable="disabled"
|
||||
attr="name: inputName, id: uid, placeholder: placeholder"
|
||||
afterRender="initColorPicker">
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
var config = {
|
||||
config: {
|
||||
mixins: {
|
||||
'Magento_Ui/js/form/components/tab_group': {
|
||||
'Plumrocket_ExtendedAdminUi/js/form/components/tab_group_mixin': true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
define([
|
||||
'uiRegistry'
|
||||
], function (uiRegistry) {
|
||||
'use strict';
|
||||
|
||||
const mixin = {
|
||||
initialize: function () {
|
||||
this._super();
|
||||
if (this.template === 'ui/tab') {
|
||||
this.template = 'Plumrocket_ExtendedAdminUi/form/components/tab';
|
||||
}
|
||||
},
|
||||
onAfterRender: function () {
|
||||
let activeTabName = new URL(location.href).hash.split('=')[1] ?? '',
|
||||
activeTab = uiRegistry.get('customer_form.areas.' + activeTabName);
|
||||
|
||||
if (typeof activeTab != 'undefined') {
|
||||
activeTab.activate();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return function (target) {
|
||||
return target.extend(mixin);
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
<div class="admin__page-nav">
|
||||
<div class="admin__page-nav-title" css="_collapsible: collapsible, _opened: opened && collapsible" click="toggleOpened" keyboard="13: toggleOpened">
|
||||
<strong tabindex="1" text="label" keyboard="13: toggleOpened"></strong>
|
||||
</div>
|
||||
<ul class="admin__page-nav-items items" each="elems" visible="opened" data-bind="afterRender: onAfterRender">
|
||||
<li class="admin__page-nav-item" tabindex="2" css="_active: active, _loading: loading" click="activate" keyboard="13: activate">
|
||||
<a class="admin__page-nav-link" href="#" css="_changed: changed" attr="id: 'tab_' + index">
|
||||
<span text="label"></span>
|
||||
<span class="admin__page-nav-item-messages">
|
||||
<span class="admin__page-nav-item-message _changed">
|
||||
<span class="admin__page-nav-item-message-icon"></span>
|
||||
<span class="admin__page-nav-item-message-tooltip"
|
||||
translate="'Changes have been made to this section that have not been saved.'"></span>
|
||||
</span>
|
||||
<span class="admin__page-nav-item-message-loader">
|
||||
<span class="spinner">
|
||||
<span repeat="8"></span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
Reference in New Issue
Block a user