diff --git a/taipy/gui/_renderers/__init__.py b/taipy/gui/_renderers/__init__.py index d0250b2968..b0e5c76d5b 100644 --- a/taipy/gui/_renderers/__init__.py +++ b/taipy/gui/_renderers/__init__.py @@ -99,11 +99,8 @@ def __parse_file_content(self, content): self._filepath = content def __sanitize_content(self, content: str) -> str: - # replace all CRLF (\r\n) with LF (\n) - text = re.sub(r'\r\n', '\n', content) - # replace all remaining CR (\r) with LF (\n) - text = re.sub(r'\r', '\n', content) - return text + # Replace all CRLF (\r\n) and CR (\r) by LF (\n) + return re.sub(r"\r", "\n", re.sub(r"\r\n", "\n", content)) def set_content(self, content: str) -> None: if not _is_in_notebook(): diff --git a/taipy/gui/viselements.json b/taipy/gui/viselements.json index e226005715..e41509417b 100644 --- a/taipy/gui/viselements.json +++ b/taipy/gui/viselements.json @@ -184,13 +184,13 @@ "name": "continuous", "type": "bool", "default_value": "True", - "doc": "If set to False, the control emits an on_change notification only when the mouse button is released, otherwise notifications are emitted during the cursor movements.
If lov is defined, the default value is False." + "doc": "If set to False, the control emits an on_change notification only when the mouse button is released, otherwise notifications are emitted during the cursor movements.
If lov is defined, the default value is False." }, { "name": "change_delay", "type": "int", "default_value": "App config", - "doc": "Minimum time between triggering two on_change calls.
The default value is defined at the application configuration level by the change_delay configuration option. if None or 0, there's no delay." + "doc": "Minimum time between triggering two on_change callbacks.
The default value is defined at the application configuration level by the change_delay configuration option. if None or 0, there's no delay." }, { "name": "width", @@ -235,6 +235,12 @@ "default_value": "False", "doc": "If set, this allows de-selection and the value is set to unselected_value." }, + { + "name": "unselected_value", + "type": "any", + "default_value": "None", + "doc": "Value assigned to value when no item is selected." + }, { "name": "mode", "type": "str", @@ -568,17 +574,17 @@ { "name": "template", "type": "dict", - "doc": "The Plotly layout template." + "doc": "The Plotly layout template." }, { "name": "template[dark]", "type": "dict", - "doc": "The Plotly layout template applied over the base template when theme is dark." + "doc": "The Plotly layout template applied over the base template when theme is dark." }, { "name": "template[light]", "type": "dict", - "doc": "The Plotly layout template applied over the base template when theme is not dark." + "doc": "The Plotly layout template applied over the base template when theme is not dark." }, { "name": "decimator", @@ -600,7 +606,7 @@ } ], [ - "file_download", + "table", { "inherits": [ "active", @@ -608,1969 +614,142 @@ ], "properties": [ { - "name": "content", + "name": "data", "default_property": true, - "type": "dynamic(path|file|URL|ReadableBuffer|None)", - "doc": "The content to transfer.
If this is a string, a URL, or a file, then the content is read from this source.
If a readable buffer is provided (such as an array of bytes...), and to prevent the bandwidth from being consumed too much, the way the data is transferred depends on the data_url_max_size parameter of the application configuration (which is set to 50kB by default):\nIf this property is set to None, that indicates that dynamic content is generated. Please take a look at the examples below for details on dynamic generation." - }, - { - "name": "label", - "type": "dynamic(str)", - "doc": "The label of the button." + "required": true, + "type": "dynamic(any)", + "doc": "The data to be represented in this table. This property can be indexed to define other data for comparison." }, { - "name": "on_action", - "type": "Callback", - "doc": "The name of a function that is triggered when the download is terminated (or on user action if content is None).
All the parameters of that function are optional:\n", - "signature": [ - [ - "state", - "State" - ], - [ - "id", - "str" - ], - [ - "payload", - "dict" - ] - ] + "name": "page_size", + "type": "int", + "default_value": "100", + "doc": "For a paginated table, the number of visible rows." }, { - "name": "auto", + "name": "allow_all_rows", "type": "bool", "default_value": "False", - "doc": "If True, the download starts as soon as the page is loaded." + "doc": "For a paginated table, adds an option to show all the rows." }, { - "name": "render", - "type": "dynamic(bool)", - "default_value": "True", - "doc": "If True, the control is displayed.
If False, the control is not displayed." + "name": "show_all", + "type": "bool", + "default_value": "False", + "doc": "For a paginated table, show all the rows." }, { - "name": "bypass_preview", + "name": "auto_loading", "type": "bool", - "default_value": "True", - "doc": "If False, allows the browser to try to show the content in a different tab.
The file download is always performed." + "default_value": "False", + "doc": "If True, the data will be loaded on demand." }, { - "name": "name", + "name": "width[column_name]", "type": "str", - "doc": "A name proposition for the file to save, that the user can change." - } - ] - } - ], - [ - "file_selector", - { - "inherits": [ - "active", - "shared" - ], - "properties": [ + "doc": "The width, in CSS units, of the indicated column." + }, { - "name": "content", - "default_property": true, - "type": "dynamic(str)", - "doc": "The path or the list of paths of the uploaded files." + "name": "selected", + "type": "list[int]|str", + "doc": "The list of the indices of the rows to be displayed as selected." }, { - "name": "label", + "name": "page_size_options", + "type": "list[int]|str", + "default_value": "[50, 100, 500]", + "doc": "The list of available page sizes that users can choose from." + }, + { + "name": "columns", + "type": "str|list[str]|dict[str, dict[str, str|int]]", + "default_value": "shows all columns when empty", + "doc": "The list of the column names to display.\n" + }, + { + "name": "date_format", "type": "str", - "doc": "The label of the button." + "default_value": "\"MM/dd/yyyy\"", + "doc": "The date format used for all date columns when the format is not specifically defined." }, { - "name": "on_action", - "type": "Callback", - "doc": "The name of the function that will be triggered.
All the parameters of that function are optional:\n", - "signature": [ - [ - "state", - "State" - ], - [ - "id", - "str" - ], - [ - "payload", - "dict" - ] - ] + "name": "number_format", + "type": "str", + "doc": "The number format used for all number columns when the format is not specifically defined." }, { - "name": "multiple", + "name": "group_by[column_name]", "type": "bool", "default_value": "False", - "doc": "If set to True, multiple files can be uploaded." + "doc": "Indicates, if True, that the given column can be aggregated.
See below for details." }, { - "name": "extensions", + "name": "apply[column_name]", "type": "str", - "default_value": "\".csv,.xlsx\"", - "doc": "The list of file extensions that can be uploaded." + "default_value": "\"first\"", + "doc": "The name of the aggregation function to use.
This is used only if group_by[column_name] is set to True.
See below for details." }, { - "name": "drop_message", + "name": "style", "type": "str", - "default_value": "\"Drop here to Upload\"", - "doc": "The message that is displayed when the user drags a file above the button." + "doc": "Allows the styling of table lines.
See below for details." }, { - "name": "notify", - "type": "bool", - "default_value": "True", - "doc": "If set to False, the user won't be notified of upload finish." - } - ] - } - ], - [ - "image", - { - "inherits": [ - "active", - "shared" - ], - "properties": [ - { - "name": "content", - "default_property": true, - "type": "dynamic(path|URL|file|ReadableBuffer)", - "doc": "The image source.
If a buffer is provided (string, array of bytes...), and in order to prevent the bandwidth to be consumed too much, the way the image data is transferred depends on the data_url_max_size parameter of the application configuration (which is set to 50kB by default):\n" + "name": "style[column_name]", + "type": "str", + "doc": "Allows the styling of table cells.
See below for details." }, { - "name": "label", - "type": "dynamic(str)", - "doc": "The label for this image." + "name": "tooltip", + "type": "str", + "doc": "The name of the function that must return a tooltip text for a cell.
See below for details." }, { - "name": "on_action", + "name": "tooltip[column_name]", "type": "str", - "doc": "The name of a function that is triggered when the user clicks on the image.
All the parameters of that function are optional:\n", - "signature": [ - [ - "state", - "State" - ], - [ - "id", - "str" - ], - [ - "payload", - "dict" - ] - ] + "doc": "The name of the function that must return a tooltip text for a cell.
See below for details." }, { "name": "width", - "type": "str|int|float", - "default_value": "\"300px\"", - "doc": "The width, in CSS units, of this element." + "type": "str", + "default_value": "\"100%\"", + "doc": "The width, in CSS units, of this table control." }, { "name": "height", - "type": "str|int|float", - "doc": "The height, in CSS units, of this element." - } - ] - } - ], - [ - "indicator", - { - "inherits": [ - "shared" - ], - "properties": [ - { - "name": "display", - "default_property": true, - "type": "dynamic(any)", - "doc": "The label to be displayed.
This can be formatted if it is a numerical value." - }, - { - "name": "value", - "type": "dynamic(int,float)", - "default_value": "min", - "doc": "The location of the label on the [min, max] range." + "type": "str", + "default_value": "\"80vh\"", + "doc": "The height, in CSS units, of this table control." }, { - "name": "min", - "type": "int|float", - "default_value": "0", - "doc": "The minimum value of the range." + "name": "filter", + "type": "bool", + "default_value": "False", + "doc": "Indicates, if True, that all columns can be filtered." }, { - "name": "max", - "type": "int|float", - "default_value": "100", - "doc": "The maximum value of the range." + "name": "filter[column_name]", + "type": "bool", + "default_value": "False", + "doc": "Indicates, if True, that the indicated column can be filtered." }, { - "name": "format", + "name": "nan_value", "type": "str", - "doc": "The format to use when displaying the value.
This uses the printf syntax." + "default_value": "\"\"", + "doc": "The replacement text for NaN (not-a-number) values." }, { - "name": "orientation", + "name": "nan_value[column_name]", "type": "str", - "default_value": "\"horizontal\"", - "doc": "The orientation of this slider." + "default_value": "\"\"", + "doc": "The replacement text for NaN (not-a-number) values for the indicated column." }, { - "name": "width", - "type": "str", - "default_value": "None", - "doc": "The width, in CSS units, of the indicator (used when orientation is horizontal)." - }, - { - "name": "height", - "type": "str", - "default_value": "None", - "doc": "The height, in CSS units, of the indicator (used when orientation is vertical)." - }, - { - "name": "hover_text", - "doc": "TODO not implemented", - "hide": true - } - ] - } - ], - [ - "metric", - { - "inherits": [ - "shared" - ], - "properties": [ - { - "name": "value", - "default_property": true, - "type": "dynamic(int|float)", - "doc": "The value to display." - }, - { - "name": "type", - "default_value": "circular", - "type": "str", - "doc": "The type of the gauge.
Possible values are:\n" - }, - { - "name": "min", - "type": "int|float", - "default_value": "0", - "doc": "The minimum value of the metric indicator" - }, - { - "name": "max", - "type": "int|float", - "default_value": "100", - "doc": "The maximum value of the metric indicator" - }, - { - "name": "delta", - "type": "dynamic(int|float)", - "doc": "The delta value to display." - }, - { - "name": "threshold", - "type": "dynamic(int|float)", - "doc": "The threshold value to display." - }, - { - "name": "show_value", - "type": "bool", - "default_value": "True", - "doc": "If set to False, the value is not displayed." - }, - { - "name": "format", - "type": "str", - "doc": "The format to use when displaying the value.
This uses the printf syntax." - }, - { - "name": "delta_format", - "type": "str", - "doc": "The format to use when displaying the delta value.
This uses the printf syntax." - }, - { - "name": "width", - "type": "str|number", - "default_value": "None", - "doc": "The width, in CSS units, of the metric." - }, - { - "name": "height", - "type": "str|number", - "default_value": "None", - "doc": "The height, in CSS units, of the metric." - }, - { - "name": "template", - "type": "dict", - "doc": "The Plotly layout template." - }, - { - "name": "template[dark]", - "type": "dict", - "doc": "The Plotly layout template applied over the base template when theme is dark." - }, - { - "name": "template[light]", - "type": "dict", - "doc": "The Plotly layout template applied over the base template when theme is not dark." - } - ] - } - ], - [ - "login", - { - "inherits": [ - "shared" - ], - "properties": [ - { - "name": "title", - "default_property": true, - "type": "str", - "default_value": "\"Log in\"", - "doc": "The title of the login dialog." - }, - { - "name": "on_action", - "type": "Callback", - "doc": "The name of the function that is triggered when the dialog button is pressed.

All the parameters of that function are optional:\n
When the button is pressed, and if this property is not set, Taipy will try to find a callback function called on_login() and invoke it with the parameters listed above.", - "signature": [ - [ - "state", - "State" - ], - [ - "id", - "str" - ], - [ - "payload", - "dict" - ] - ] - }, - { - "name": "message", - "type": "dynamic(str)", - "doc": "The message shown in the dialog." - } - ] - } - ], - [ - "menu", - { - "inherits": [ - "active" - ], - "properties": [ - { - "name": "lov", - "default_property": true, - "type": "dynamic(str|list[str|Icon|any])", - "doc": "The list of menu option values." - }, - { - "name": "adapter", - "type": "Function", - "default_value": "`\"lambda x: str(x)\"`", - "doc": "The function that transforms an element of lov into a tuple(id:str, label:str|Icon)." - }, - { - "name": "type", - "type": "str", - "default_value": "Type of the first lov element", - "doc": "Must be specified if lov contains a non specific type of data (ex: dict).
value must be of that type, lov must be an iterable on this type, and the adapter function will receive an object of this type." - }, - { - "name": "label", - "type": "str", - "doc": "The title of the menu." - }, - { - "name": "width", - "type": "str", - "default_value": "\"15vw\"", - "doc": "The width, in CSS units, of the menu when unfolded.
Note that when running on a mobile device, the property width[active] is used instead." - }, - { - "name": "width[mobile]", - "type": "str", - "default_value": "\"85vw\"", - "doc": "The width, in CSS units, of the menu when unfolded, on a mobile device." - }, - { - "name": "on_action", - "type": "Callback", - "doc": "The name of the function that is triggered when a menu option is selected.

All the parameters of that function are optional:\n", - "signature": [ - [ - "state", - "State" - ], - [ - "id", - "str" - ], - [ - "payload", - "dict" - ] - ] - } - ] - } - ], - [ - "navbar", - { - "inherits": [ - "active", - "shared" - ], - "properties": [ - { - "name": "lov", - "default_property": true, - "type": "dict[str, any]", - "doc": "The list of pages. The keys should be:\n\nThe values are labels. See the section on List of Values for details." - } - ] - } - ], - [ - "selector", - { - "inherits": [ - "lovComp", - "propagate" - ], - "properties": [ - { - "name": "label", - "type": "str", - "default_value": "None", - "doc": "The label associated with the selector when in dropdown mode." - }, - { - "name": "mode", - "type": "str", - "doc": "Define the way the selector is displayed: