Skip to content
Snippets Groups Projects
Verified Commit a9a93525 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: add issue example #233

parent 657d5044
No related branches found
No related tags found
No related merge requests found
File moved
File moved
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>optimize tree-menu #233</title>
<script src="233.mjs" type="module"></script>
</head>
<body>
<h1>optimize tree-menu #233</h1>
<p></p>
<ul>
<li class="monster-theme-primary-1"><a
href="https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/233">Issue #233</a></li>
<li><a href="/">Back to overview</a></li>
</ul>
<main>
<monster-datasource-rest id="menu-rest"
data-monster-option-read-path="dataset"
data-monster-option-features-autoinit="true"
data-monster-option-read-url="/issue-233.json"
>
</monster-datasource-rest>
<monster-datasource-dom id="menu-dom">
<script type="application/json">
{
"1": {
"id": "1",
"title": "Test 1",
"address": "Here 1",
"parent": "2"
},
"2": {
"id": "2",
"title": "Test 2",
"address": "Here 2",
"parent": "0"
},
"3": {
"id": "3",
"title": "Test 3",
"address": "Here 3",
"parent": "2"
},
"4": {
"id": "4",
"title": "Test 4",
"address": "Here 4",
"parent": "0"
},
"5": {
"id": "5",
"title": "Test 5",
"address": "Here 5",
"parent": "0"
},
"6": {
"id": "6",
"title": "Test 6",
"address": "Here 6",
"parent": "4"
},
"7": {
"id": "7",
"title": "Test 7",
"address": "Here 7",
"parent": "1"
}
}
</script>
</monster-datasource-dom>
<monster-panel>
<monster-split-panel>
<monster-panel id="inner2" data-monster-option-heightadjustment="5"
slot="start">
<monster-tree-menu
data-monster-option-mapping-idtemplate="id"
data-monster-option-mapping-parentkey="parent_id"
data-monster-option-mapping-labeltemplate="${title}"
data-monster-option-mapping-valuetemplate="${path:url | tostring}"
data-monster-option-mapping-icontemplate="${path:icon | default:default}"
data-monster-option-datasource-selector="#menu-rest"
value=""
>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="box" viewBox="0 0 16 16">
<path d="M6 9a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3A.5.5 0 0 1 6 9M3.854 4.146a.5.5 0 1 0-.708.708L4.793 6.5 3.146 8.146a.5.5 0 1 0 .708.708l2-2a.5.5 0 0 0 0-.708z"/>
<path d="M2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2zm12 1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z"/>
</symbol>
<symbol id="default" viewBox="0 0 16 16">
<path d="M11 2a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3zM5 1a4 4 0 0 0-4 4v6a4 4 0 0 0 4 4h6a4 4 0 0 0 4-4V5a4 4 0 0 0-4-4z"/>
</symbol>
<symbol id="balloon" viewBox="0 0 16 16">
<path d="M8 9.984C10.403 9.506 12 7.48 12 5a4 4 0 0 0-8 0c0 2.48 1.597 4.506 4 4.984M13 5c0 2.837-1.789 5.227-4.52 5.901l.244.487a.25.25 0 1 1-.448.224l-.008-.017c.008.11.02.202.037.29.054.27.161.488.419 1.003.288.578.235 1.15.076 1.629-.157.469-.422.867-.588 1.115l-.004.007a.25.25 0 1 1-.416-.278c.168-.252.4-.6.533-1.003.133-.396.163-.824-.049-1.246l-.013-.028c-.24-.48-.38-.758-.448-1.102a3 3 0 0 1-.052-.45l-.04.08a.25.25 0 1 1-.447-.224l.244-.487C4.789 10.227 3 7.837 3 5a5 5 0 0 1 10 0m-6.938-.495a2 2 0 0 1 1.443-1.443C7.773 2.994 8 2.776 8 2.5s-.226-.504-.498-.459a3 3 0 0 0-2.46 2.461c-.046.272.182.498.458.498s.494-.227.562-.495"/>
</symbol>
<symbol id="cart" viewBox="0 0 16 16">
<path d="M8 1a2.5 2.5 0 0 1 2.5 2.5V4h-5v-.5A2.5 2.5 0 0 1 8 1m3.5 3v-.5a3.5 3.5 0 1 0-7 0V4H1v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4zM2 5h12v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1z"/>
</symbol>
<symbol id="box2" viewBox="0 0 16 16">
<path d="M8 7.982C9.664 6.309 13.825 9.236 8 13 2.175 9.236 6.336 6.31 8 7.982"/>
<path d="M3.75 0a1 1 0 0 0-.8.4L.1 4.2a.5.5 0 0 0-.1.3V15a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V4.5a.5.5 0 0 0-.1-.3L13.05.4a1 1 0 0 0-.8-.4zm0 1H7.5v3h-6zM8.5 4V1h3.75l2.25 3zM15 5v10H1V5z"/>
</symbol>
</svg>
</monster-tree-menu>
</monster-panel>
</monster-split-panel>
</monster-panel>
</main>
</body>
</html>
/**
* @file development/issues/open/191.mjs
* @url https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/191
* @description optimize tree-menu
* @issue 191
*/
import "../../../source/components/style/property.pcss";
import "../../../source/components/style/color.pcss";
import "../../../source/components/style/link.pcss";
import "../../../source/components/style/normalize.pcss";
import "../../../source/components/style/typography.pcss";
import "../../../source/components/tree-menu/tree-menu.mjs";
import "../../../source/components/layout/split-panel.mjs";
import "../../../source/components/layout/panel.mjs";
import "../../../source/components/datatable/datasource/dom.mjs";
import "../../../source/components/datatable/datasource/rest.mjs";
setTimeout(() => {
const obj = document.querySelector("monster-tree-menu");
obj.selectEntry("/alvine/?cmd=9130")
setTimeout(() => {
//obj.selectEntry("/ebay")
obj.selectEntry("/alvine/?cmd=8157")
}, 1000)
}, 1000)
const json =
`{
"dataset": [
{
"id": 308004,
"parent_id": 0,
"title": "Bestellungen",
"url": "/apps/commerce/order-list",
"weight": 2,
"icon": "cart",
"css_classes": ""
},
{
"id": 108003,
"parent_id": 308004,
"title": "Bestellung suchen",
"url": "/alvine/?cmd=8003",
"weight": 2,
"icon": "box2",
"css_classes": ""
},
{
"id": 108004,
"parent_id": 308004,
"title": "Bestellungen (Legacy)",
"url": "/alvine/?cmd=8004",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 109700,
"parent_id": 308004,
"title": "Visuelle Überprüfung",
"url": "/alvine/?cmd=9700",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 108007,
"parent_id": 308004,
"title": "Wiedervorlagen",
"url": "/alvine/?cmd=8007",
"weight": 3,
"icon": null,
"css_classes": ""
},
{
"id": 108073,
"parent_id": 308004,
"title": "Zahlungseingang",
"url": "/alvine/?cmd=8073",
"weight": 4,
"icon": null,
"css_classes": ""
},
{
"id": 114000,
"parent_id": 308004,
"title": "Angebote",
"url": "/alvine/?cmd=14000",
"weight": 5,
"icon": null,
"css_classes": ""
},
{
"id": 131600,
"parent_id": 308004,
"title": "Bestelleingangsregeln",
"url": "/alvine/?cmd=31600",
"weight": 6,
"icon": null,
"css_classes": ""
},
{
"id": 300125,
"parent_id": 0,
"title": "Kunden",
"url": "/apps/commerce/user-list",
"weight": 3,
"icon": "balloon",
"css_classes": ""
},
{
"id": 100220,
"parent_id": 300125,
"title": "Tickets",
"url": "/alvine/?cmd=220",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 100125,
"parent_id": 300125,
"title": "Kunden (Legacy)",
"url": "/alvine/?cmd=125",
"weight": 3,
"icon": null,
"css_classes": ""
},
{
"id": 124013,
"parent_id": 300125,
"title": "Kundensperrliste",
"url": "/alvine/?cmd=24013",
"weight": 3,
"icon": null,
"css_classes": ""
},
{
"id": 100117,
"parent_id": 300125,
"title": "Gruppen",
"url": "/alvine/?cmd=117",
"weight": 4,
"icon": null,
"css_classes": ""
},
{
"id": 126038,
"parent_id": 300125,
"title": "Kundenbewertungen",
"url": "/alvine/?cmd=26038",
"weight": 5,
"icon": null,
"css_classes": ""
},
{
"id": 108181,
"parent_id": 300125,
"title": "Merklisten",
"url": "/alvine/?cmd=8181",
"weight": 6,
"icon": null,
"css_classes": ""
},
{
"id": 209231,
"parent_id": 0,
"title": "Marketing",
"url": "/alvine/?cmd=209231",
"weight": 4,
"icon": null,
"css_classes": ""
},
{
"id": 109231,
"parent_id": 209231,
"title": "Partnerverwaltung",
"url": "/alvine/?cmd=9231",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 122002,
"parent_id": 209231,
"title": "Gutscheine",
"url": "/alvine/?cmd=22002",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 100600,
"parent_id": 209231,
"title": "Serienbrief",
"url": "/alvine/?cmd=600",
"weight": 3,
"icon": null,
"css_classes": ""
},
{
"id": 100320,
"parent_id": 209231,
"title": "E-Mail-Sperrliste",
"url": "/alvine/?cmd=320",
"weight": 4,
"icon": null,
"css_classes": ""
},
{
"id": 150040,
"parent_id": 209231,
"title": "Kampagnen",
"url": "/alvine/?cmd=50040",
"weight": 5,
"icon": null,
"css_classes": ""
},
{
"id": 100330,
"parent_id": 209231,
"title": "Marketingadressen",
"url": "/alvine/?cmd=330",
"weight": 6,
"icon": null,
"css_classes": ""
},
{
"id": 200001,
"parent_id": 0,
"title": "Vertriebskanäle",
"url": "/",
"weight": 5,
"icon": null,
"css_classes": ""
},
{
"id": 100001,
"parent_id": 200001,
"title": "eBay",
"url": "/ebay",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 100002,
"parent_id": 200001,
"title": "Amazon",
"url": "/",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 201023,
"parent_id": 0,
"title": "Produkte",
"url": "/",
"weight": 6,
"icon": null,
"css_classes": ""
},
{
"id": 101023,
"parent_id": 201023,
"title": "Produkte (Legacy)",
"url": "/alvine/?cmd=1023",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 208124,
"parent_id": 201023,
"title": "Katalog",
"url": "/",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 108113,
"parent_id": 208124,
"title": "Marken",
"url": "/alvine/?cmd=8113",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 109010,
"parent_id": 208124,
"title": "Abteilungen",
"url": "/alvine/?cmd=9010",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 108124,
"parent_id": 208124,
"title": "Farben",
"url": "/alvine/?cmd=8124",
"weight": 3,
"icon": null,
"css_classes": ""
},
{
"id": 109119,
"parent_id": 208124,
"title": "Raster",
"url": "/alvine/?cmd=9119",
"weight": 4,
"icon": null,
"css_classes": ""
},
{
"id": 109081,
"parent_id": 208124,
"title": "Ausführung",
"url": "/alvine/?cmd=9081",
"weight": 5,
"icon": null,
"css_classes": ""
},
{
"id": 109130,
"parent_id": 208124,
"title": "Material",
"url": "/alvine/?cmd=9130",
"weight": 6,
"icon": null,
"css_classes": ""
},
{
"id": 108053,
"parent_id": 208124,
"title": "Kollektion",
"url": "/alvine/?cmd=8053",
"weight": 7,
"icon": null,
"css_classes": ""
},
{
"id": 126013,
"parent_id": 208124,
"title": "Saison",
"url": "/alvine/?cmd=26013",
"weight": 8,
"icon": null,
"css_classes": ""
},
{
"id": 109258,
"parent_id": 208124,
"title": "Zuweisung 1",
"url": "/alvine/?cmd=9258",
"weight": 9,
"icon": null,
"css_classes": ""
},
{
"id": 109269,
"parent_id": 208124,
"title": "Zuweisung 2",
"url": "/alvine/?cmd=9269",
"weight": 10,
"icon": null,
"css_classes": ""
},
{
"id": 109310,
"parent_id": 208124,
"title": "Zuweisung 3",
"url": "/alvine/?cmd=9310",
"weight": 10,
"icon": null,
"css_classes": ""
},
{
"id": 131531,
"parent_id": 201023,
"title": "Lagerliste",
"url": "/alvine/?cmd=31531",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 108157,
"parent_id": 201023,
"title": "Stückliste Liste",
"url": "/alvine/?cmd=8157",
"weight": 4,
"icon": null,
"css_classes": ""
},
{
"id": 109025,
"parent_id": 201023,
"title": "Varianten",
"url": "/alvine/?cmd=9025",
"weight": 5,
"icon": null,
"css_classes": ""
},
{
"id": 109058,
"parent_id": 201023,
"title": "Kategorien",
"url": "/alvine/?cmd=9058",
"weight": 7,
"icon": null,
"css_classes": ""
},
{
"id": 126035,
"parent_id": 201023,
"title": "Massenbearbeitung",
"url": "/alvine/?cmd=26035",
"weight": 8,
"icon": null,
"css_classes": ""
},
{
"id": 110000,
"parent_id": 201023,
"title": "Konditionsübersicht",
"url": "/alvine/?cmd=10000",
"weight": 9,
"icon": null,
"css_classes": ""
},
{
"id": 209211,
"parent_id": 0,
"title": "Wareneingang",
"url": "/",
"weight": 8,
"icon": null,
"css_classes": ""
},
{
"id": 109211,
"parent_id": 209211,
"title": "Avise",
"url": "/alvine/?cmd=9211",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 209221,
"parent_id": 209211,
"title": "Retoure",
"url": "/",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 109221,
"parent_id": 209221,
"title": "Retouren",
"url": "/alvine/?cmd=9221",
"weight": 1,
"icon": null,
"css_classes": ""
},
{
"id": 109037,
"parent_id": 209221,
"title": "Tagesabschluss Retoureneingang",
"url": "/alvine/?cmd=9037",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 108064,
"parent_id": 209211,
"title": "Avis scannen",
"url": "/alvine/?cmd=8064",
"weight": 2,
"icon": null,
"css_classes": ""
},
{
"id": 109201,
"parent_id": 209211,
"title": "Lieferungen",
"url": "/alvine/?cmd=9201",
"weight": 3,
"icon": null,
"css_classes": ""
}
],
"sys": {
"code": 200,
"result": {},
"api_version": "1"
}
}
`;
// check if json is valid
JSON.parse(json)
const requestDelay = 100
export default [
{
url: '/issue-191.json',
method: 'get',
rawResponse: async (req, res) => {
res.setHeader('Content-Type', 'application/json')
res.statusCode = 200
setTimeout(function() {
res.end(json)
}, requestDelay);
},
}
];
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment