فهرست منبع

Ticket #5002 - Accounts: Issue with SVG icons in grid and manage menu in Dark mode. Core changes.

AntonLV 1 سال پیش
والد
کامیت
b1c7dea70c
5فایلهای تغییر یافته به همراه31 افزوده شده و 6 حذف شده
  1. 1 1
      install/sql/system.sql
  2. 3 0
      studio/template/css/common.less
  3. 5 0
      studio/template/css/menu.css
  4. 10 1
      template/css/tailwind.css
  5. 12 4
      template/scripts/BxBaseGrid.php

+ 1 - 1
install/sql/system.sql

@@ -5317,7 +5317,7 @@ CREATE TABLE IF NOT EXISTS `sys_grid_actions` (
   `type` enum('bulk','single','independent') NOT NULL,
   `name` varchar(255) NOT NULL,
   `title` varchar(255) NOT NULL,
-  `icon` varchar(255) NOT NULL,
+  `icon` text NOT NULL,
   `icon_only` tinyint(4) NOT NULL DEFAULT '0',
   `confirm` tinyint(4) NOT NULL DEFAULT '1',
   `active` tinyint(4) NOT NULL DEFAULT '1',

+ 3 - 0
studio/template/css/common.less

@@ -99,6 +99,9 @@ div.bx-db-note {
 .bx-popup-content-indent {
     padding: 1.25rem;
 }
+.bx-popup-menu .bx-popup-content-indent {
+  padding: 0.5rem 0 !important;
+}
 .bx-popup-header.bx-def-padding {
     padding: 1.25rem 1.25rem 0 1.25rem;
 }

+ 5 - 0
studio/template/css/menu.css

@@ -23,6 +23,11 @@ ul.bx-menu-toolbar li a .sys-icon-a {
     white-space: nowrap;
 }
 
+.bx-popup-menu ul.bx-menu-ver {
+    margin-top: 0.5rem;
+    margin-bottom: 0.5rem;
+}
+
 /* --------------- Vertical in Popup */
 .bx-popup .bx-menu-ver.bx-menu-object-sys_switch_language_popup .bx-menu-item-icon {
     margin-right: 0 !important;

+ 10 - 1
template/css/tailwind.css

@@ -1114,7 +1114,6 @@
     }
     
     .bx-stl-mii > *,
-    .bx-std .bx-stl-mii > *,
     .bx-stl-mii-sm > *,
     .bx-stl-mil .sys-action-do-icon > *,
     .bx-stl-mil-sm .sys-action-do-icon > *,
@@ -1122,6 +1121,16 @@
     .bx-stl-mil-wo-gaps-sm .sys-action-do-icon > * {
         @apply flex items-center justify-center h-6 w-6 ltr:mr-3 rtl:ml-3;
     }
+    .bx-std .bx-stl-mii > * {
+        @apply flex items-center justify-center h-6 w-6 ltr:mr-3 rtl:ml-3 !important;
+    }
+    .bx-std .bx-stl-mii > svg {
+        @apply text-gray-500 !important;
+    }
+    .bx-std li:hover .bx-stl-mii > svg {
+        @apply text-gray-700 dark:text-gray-300 !important;
+    }
+
     .bx-stl-mii:last-child > *,
     .bx-stl-mii-sm:last-child > *,
     .bx-stl-mil .sys-action-do-icon:last-child > *,

+ 12 - 4
template/scripts/BxBaseGrid.php

@@ -14,6 +14,7 @@
 class BxBaseGrid extends BxDolGrid
 {
     protected $_oTemplate;
+    protected $_oFunctions;
     protected $_aPopupOptions = false;
     protected $_aQueryAppend = [];
     protected $_aQueryAppendExclude = false; // an array of keys which shouldn't be pathed in http requests, but can be stored (used) in 'Query Append' array.
@@ -32,6 +33,8 @@ class BxBaseGrid extends BxDolGrid
         else
             $this->_oTemplate = BxDolTemplate::getInstance();
 
+        $this->_oFunctions = BxTemplFunctions::getInstanceWithTemplate($this->_oTemplate);
+
         $this->_aPopupOptions = [];
 
         $this->_aQueryAppend = [
@@ -827,10 +830,15 @@ class BxBaseGrid extends BxDolGrid
         $sIcon = '';
         $sImage = '';
         if (!empty($a['icon'])) {
-            if (false === strpos($a['icon'], '.'))
-                $sIcon = '<i class="sys-icon ' . $a['icon'] . '"></i>';
-            elseif ($sIconUrl = $this->_oTemplate->getIconUrl($a['icon']))
+            list($sIconFont, $sIconUrl, $sIconA, $sIconHtml) = $this->_oFunctions->getIcon($a['icon']);
+            //var_dump($a['icon'], $sIconFont, $sIconUrl, $sIconA, $sIconHtml, $sIconFontWithHtml); 
+
+            if ($sIconFont)
+                $sIcon = '<i class="sys-icon ' . $sIconFont . '"></i>';
+            else if($sIconUrl)
                 $sImage = '<img style="background-image:url(' . $sIconUrl . ');" src="' . $this->_oTemplate->getIconUrl('spacer.gif') .'" />';
+            else if($sIconHtml)
+                $sImage = $sIconHtml;
         }
 
         return '<button ' . $sAttr . '>' . $sIcon . $sImage . ($a['icon_only'] || empty($a['title']) ? '' : '<u>' . $a['title'] . '</u>') . '</button>';
@@ -878,7 +886,7 @@ class BxBaseGrid extends BxDolGrid
     protected function _limitMaxLength ($mixedValue, $sKey, $aField, $aRow, $isDisplayPopupOnTextOverflow, $bReturnString = true)
     {
         if ($aField['chars_limit'] > 0)
-            $mixedValue = BxTemplFunctions::getInstance()->getStringWithLimitedLength($mixedValue, $aField['chars_limit'], $isDisplayPopupOnTextOverflow, $bReturnString);
+            $mixedValue = $this->_oFunctions->getStringWithLimitedLength($mixedValue, $aField['chars_limit'], $isDisplayPopupOnTextOverflow, $bReturnString);
         return $mixedValue;
     }