Skip to content

Commit

Permalink
tree does not support mode (#2279)
Browse files Browse the repository at this point in the history
* tree does not support mode
resolves #2278

* add copyright

---------

Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
  • Loading branch information
FredLL-Avaiga and Fred Lefévère-Laoide authored Nov 25, 2024
1 parent b1894c8 commit e5c10d4
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
7 changes: 6 additions & 1 deletion frontend/taipy-gui/src/components/Taipy/Selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ const renderBoxSx = {
width: "100%",
} as CSSProperties;

const Selector = (props: SelTreeProps) => {
interface SelectorProps extends SelTreeProps {
dropdown?: boolean;
mode?: string;
}

const Selector = (props: SelectorProps) => {
const {
id,
defaultValue = "",
Expand Down
2 changes: 0 additions & 2 deletions frontend/taipy-gui/src/components/Taipy/lovUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export interface SelTreeProps extends LovProps, TaipyLabelProps {
filter?: boolean;
multiple?: boolean;
width?: string | number;
dropdown?: boolean;
mode?: string;
}

export interface LovProps<T = string | string[], U = string> extends TaipyActiveProps, TaipyChangeProps {
Expand Down
12 changes: 12 additions & 0 deletions frontend/taipy-gui/src/themes/darkThemeTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2021-2024 Avaiga Private Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
export const darkThemeTemplate = {
data: {
barpolar: [
Expand Down
2 changes: 1 addition & 1 deletion taipy/gui/builder/_api_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def find_default_property(property_list: t.List[VisElementProperties]) -> str:

@staticmethod
def get_properties_dict(property_list: t.List[VisElementProperties]) -> t.Dict[str, t.Any]:
return {prop["name"]: prop.get("type", "str") for prop in property_list}
return {prop["name"]: prop.get("type", "str") for prop in property_list if not prop.get("hide", False)}

def add_default(self):
if self.__module is not None:
Expand Down
5 changes: 4 additions & 1 deletion taipy/gui/utils/viselements.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class VisElementProperties(t.TypedDict):
doc: str
default_value: t.Any
default_property: t.Any
hide: t.Optional[bool]


class VisElementDetail(t.TypedDict):
Expand All @@ -40,6 +41,7 @@ def _resolve_inherit_property(element: VisElement, viselements: VisElements) ->
properties = deepcopy(element_detail["properties"])
if "inherits" not in element_detail:
return properties
hidden_property_names = [p.get("name") for p in properties if p.get("hide", False)]
for inherit in element_detail["inherits"]:
inherit_element = None
for element_type in "blocks", "controls", "undocumented":
Expand All @@ -48,7 +50,8 @@ def _resolve_inherit_property(element: VisElement, viselements: VisElements) ->
break
if inherit_element is None:
raise RuntimeError(f"Error resolving inherit element with name {inherit} in viselements.json")
properties = properties + _resolve_inherit_property(inherit_element, viselements)
inherited_props = _resolve_inherit_property(inherit_element, viselements)
properties = properties + [p for p in inherited_props if p.get("name") not in hidden_property_names]
return properties


Expand Down
17 changes: 14 additions & 3 deletions taipy/gui/viselements.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
"type": "dynamic(Union[str,Icon])",
"default_value": "\"\"",
"doc": "The label displayed in the button."
}, {
"name": "size",
},
{
"name": "size",
"type": "str",
"default_value": "\"medium\"",
"doc": "The size of the button. Valid values: \"small\", \"medium\", or \"large\"."
Expand Down Expand Up @@ -1639,7 +1640,9 @@
[
"alert",
{
"inherits": ["shared"],
"inherits": [
"shared"
],
"properties": [
{
"name": "message",
Expand Down Expand Up @@ -1856,6 +1859,14 @@
"name": "row_height",
"type": "str",
"doc": "The height of each row of this tree, in CSS units."
},
{
"name": "mode",
"hide": true
},
{
"name": "dropdown",
"hide": true
}
]
}
Expand Down

0 comments on commit e5c10d4

Please sign in to comment.