feat: show arrow on the left on sidebar item

This commit is contained in:
sokumon 2025-11-08 21:06:29 +05:30
parent 86db71f8fa
commit befa024365
5 changed files with 29 additions and 3 deletions

View file

@ -19,6 +19,7 @@
"collapsible",
"indent",
"keep_closed",
"show_arrow",
"column_break_jexf",
"display_depends_on"
],
@ -126,13 +127,20 @@
"fieldname": "url",
"fieldtype": "Data",
"label": "URL"
},
{
"default": "0",
"depends_on": "eval: doc.indent == 1",
"fieldname": "show_arrow",
"fieldtype": "Check",
"label": "Show Arrow"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-10-28 02:05:07.887104",
"modified": "2025-11-07 10:47:58.882767",
"modified_by": "Administrator",
"module": "Desk",
"name": "Workspace Sidebar Item",

View file

@ -25,6 +25,7 @@ class WorkspaceSidebarItem(Document):
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
show_arrow: DF.Check
type: DF.Literal["Link", "Section Break", "Spacer"]
url: DF.Data | None
# end: auto-generated types

View file

@ -518,6 +518,12 @@ frappe.ui.Sidebar = class Sidebar {
fieldtype: "Check",
label: "Indent",
},
{
depends_on: "eval: doc.indent == 1",
fieldname: "show_arrow",
fieldtype: "Check",
label: "Show Arrow",
},
{
default: "1",
depends_on: 'eval: doc.type == "Section Break"',

View file

@ -21,11 +21,18 @@
class="item-anchor"
title="{{ item.label }}"
>
<span class="sidebar-item-icon text-ink-gray-7" item-icon="{{ item.icon }}">
{%= frappe.utils.icon(item.icon || "list-alt", "sm", "", "", "text-ink-gray-7 current-color", true) %}
{% let icon = item.icon %}
{% if (item.show_arrow) { %}
{% icon = "chevron-right" %}
{% } %}
<span class="sidebar-item-icon text-ink-gray-7" item-icon="{{ icon }}">
{%= frappe.utils.icon(icon || "list-alt", "sm", "", "", "text-ink-gray-7 current-color", true) %}
</span>
<span class="sidebar-item-label">{{ item.label }}</span>
{% if (!item.show_arrow) { %}
<div class="sidebar-item-control"></div>
{% } %}
</a>
{% } %}

View file

@ -188,6 +188,10 @@ frappe.ui.sidebar_item.TypeSectionBreak = class SectionBreakSidebarItem extends
) {
this.apply_section_break_state();
}
if (item.show_arrow) {
this.$drop_icon = this.wrapper.find('[item-icon="chevron-right"]');
this.setup_event_listner();
}
}
apply_section_break_state() {
const me = this;