Переглянути джерело

don't replace default classes (#1940)

Falko Schindler 1 рік тому
батько
коміт
54d6ce6c2f

+ 2 - 1
nicegui/elements/aggrid.py

@@ -36,7 +36,8 @@ class AgGrid(Element, component='aggrid.js', libraries=['lib/aggrid/ag-grid-comm
         self._props['options'] = options
         self._props['html_columns'] = html_columns
         self._props['auto_size_columns'] = auto_size_columns
-        self._classes = ['nicegui-aggrid', f'ag-theme-{theme}']
+        self._classes.append('nicegui-aggrid')
+        self._classes.append(f'ag-theme-{theme}')
 
     @staticmethod
     def from_pandas(df: pd.DataFrame, *,

+ 1 - 1
nicegui/elements/card.py

@@ -18,7 +18,7 @@ class Card(Element):
         If you want the padding and borders for nested children, move the children into another container.
         """
         super().__init__('q-card')
-        self._classes = ['nicegui-card']
+        self._classes.append('nicegui-card')
 
     def tight(self) -> Self:
         """Remove padding and gaps between nested elements."""

+ 1 - 1
nicegui/elements/carousel.py

@@ -65,6 +65,6 @@ class CarouselSlide(DisableableElement):
         self.carousel = cast(ValueElement, context.get_slot().parent)
         name = name or f'slide_{len(self.carousel.default_slot.children)}'
         self._props['name'] = name
-        self._classes = ['nicegui-carousel-slide']
+        self._classes.append('nicegui-carousel-slide')
         if self.carousel.value is None:
             self.carousel.value = name

+ 1 - 1
nicegui/elements/column.py

@@ -11,7 +11,7 @@ class Column(Element):
         :param wrap: whether to wrap the content (default: `False`)
         """
         super().__init__('div')
-        self._classes = ['nicegui-column']
+        self._classes.append('nicegui-column')
 
         if wrap:
             self._classes.append('wrap')

+ 1 - 1
nicegui/elements/echart.py

@@ -18,7 +18,7 @@ class EChart(Element, component='echart.js', libraries=['lib/echarts/echarts.min
         """
         super().__init__()
         self._props['options'] = options
-        self._classes = ['nicegui-echart']
+        self._classes.append('nicegui-echart')
 
         if on_point_click:
             def handle_point_click(e: GenericEventArguments) -> None:

+ 1 - 1
nicegui/elements/expansion.py

@@ -25,7 +25,7 @@ class Expansion(ValueElement, DisableableElement):
         if text is not None:
             self._props['label'] = text
         self._props['icon'] = icon
-        self._classes = ['nicegui-expansion']
+        self._classes.append('nicegui-expansion')
 
     def open(self) -> None:
         """Open the expansion."""

+ 1 - 1
nicegui/elements/grid.py

@@ -18,7 +18,7 @@ class Grid(Element):
         :param columns: number of columns in the grid
         """
         super().__init__('div')
-        self._classes = ['nicegui-grid']
+        self._classes.append('nicegui-grid')
         if rows is not None:
             self._style['grid-template-rows'] = f'repeat({rows}, minmax(0, 1fr))'
         if columns is not None:

+ 1 - 1
nicegui/elements/link.py

@@ -31,7 +31,7 @@ class Link(TextElement, component='link.js'):
         elif callable(target):
             self._props['href'] = Client.page_routes[target]
         self._props['target'] = '_blank' if new_tab else '_self'
-        self._classes = ['nicegui-link']
+        self._classes.append('nicegui-link')
 
 
 class LinkTarget(Element):

+ 1 - 1
nicegui/elements/log.py

@@ -17,7 +17,7 @@ class Log(Element, component='log.js'):
         super().__init__()
         self._props['max_lines'] = max_lines
         self._props['lines'] = ''
-        self._classes = ['nicegui-log']
+        self._classes.append('nicegui-log')
         self.lines: deque[str] = deque(maxlen=max_lines)
         self.total_count: int = 0
 

+ 1 - 1
nicegui/elements/row.py

@@ -11,7 +11,7 @@ class Row(Element):
         :param wrap: whether to wrap the content (default: `True`)
         """
         super().__init__('div')
-        self._classes = ['nicegui-row']
+        self._classes.append('nicegui-row')
 
         if wrap:
             self._classes.append('wrap')

+ 1 - 1
nicegui/elements/scroll_area.py

@@ -15,7 +15,7 @@ class ScrollArea(Element):
         :param on_scroll: function to be called when the scroll position changes
         """
         super().__init__('q-scroll-area')
-        self._classes = ['nicegui-scroll-area']
+        self._classes.append('nicegui-scroll-area')
 
         if on_scroll:
             self.on('scroll', lambda e: self._handle_scroll(on_scroll, e), args=[

+ 1 - 1
nicegui/elements/separator.py

@@ -11,4 +11,4 @@ class Separator(Element):
         It serves as a separator for cards, menus and other component containers and is similar to HTML's <hr> tag.
         """
         super().__init__('q-separator')
-        self._classes = ['nicegui-separator']
+        self._classes.append('nicegui-separator')

+ 1 - 1
nicegui/elements/splitter.py

@@ -34,7 +34,7 @@ class Splitter(ValueElement, DisableableElement):
         self._props['horizontal'] = horizontal
         self._props['limits'] = limits
         self._props['reverse'] = reverse
-        self._classes = ['nicegui-splitter']
+        self._classes.append('nicegui-splitter')
 
         self.before = self.add_slot('before')
         self.after = self.add_slot('after')

+ 2 - 2
nicegui/elements/stepper.py

@@ -30,7 +30,7 @@ class Stepper(ValueElement):
         """
         super().__init__(tag='q-stepper', value=value, on_value_change=on_value_change)
         self._props['keep-alive'] = keep_alive
-        self._classes = ['nicegui-stepper']
+        self._classes.append('nicegui-stepper')
 
     def _value_to_model_value(self, value: Any) -> Any:
         return value._props['name'] if isinstance(value, Step) else value  # pylint: disable=protected-access
@@ -66,7 +66,7 @@ class Step(DisableableElement):
         super().__init__(tag='q-step')
         self._props['name'] = name
         self._props['title'] = title if title is not None else name
-        self._classes = ['nicegui-step']
+        self._classes.append('nicegui-step')
         if icon:
             self._props['icon'] = icon
         self.stepper = cast(ValueElement, context.get_slot().parent)

+ 1 - 1
nicegui/elements/tabs.py

@@ -93,4 +93,4 @@ class TabPanel(DisableableElement):
         """
         super().__init__(tag='q-tab-panel')
         self._props['name'] = name._props['name'] if isinstance(name, Tab) else name
-        self._classes = ['nicegui-tab-panel']
+        self._classes.append('nicegui-tab-panel')

+ 1 - 1
nicegui/elements/timeline.py

@@ -71,4 +71,4 @@ class TimelineEntry(Element):
             self._props['title'] = title
         if subtitle is not None:
             self._props['subtitle'] = subtitle
-        self._classes = ['nicegui-timeline-entry']
+        self._classes.append('nicegui-timeline-entry')

+ 2 - 2
nicegui/page_layout.py

@@ -45,7 +45,7 @@ class Header(ValueElement):
         """
         with context.get_client().layout:
             super().__init__(tag='q-header', value=value, on_value_change=None)
-        self._classes = ['nicegui-header']
+        self._classes.append('nicegui-header')
         self._props['bordered'] = bordered
         self._props['elevated'] = elevated
         if wrap:
@@ -115,7 +115,7 @@ class Drawer(Element):
         self._props['side'] = side
         self._props['bordered'] = bordered
         self._props['elevated'] = elevated
-        self._classes = ['nicegui-drawer']
+        self._classes.append('nicegui-drawer')
         code = list(self.client.layout._props['view'])
         code[0 if side == 'left' else 2] = side[0].lower() if top_corner else 'h'
         code[4 if side == 'left' else 6] = side[0].upper() if fixed else side[0].lower()