tailwind-header-dom 4.5.1 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/header/v4/commands/header/template/v6/BuildMenuItem/buildMenuItem.js +34 -0
- package/bin/header/v4/commands/header/template/v6/BuildMenuItem/callKSTable.js +7 -0
- package/bin/header/v4/commands/header/template/v6/BuildMenuItem/getDefaultKSTableConfig.js +80 -0
- package/bin/header/v4/commands/header/template/v6/BuildMenuItem/getKSTableConfig.js +17 -0
- package/bin/header/v4/commands/header/template/v6/BuildMenuItem/orchestrateMenuClick.js +34 -0
- package/bin/header/v4/commands/header/template/v6/BuildNav/buildBrand.js +14 -0
- package/bin/header/v4/commands/header/template/v6/BuildNav/buildHamburger.js +20 -0
- package/bin/header/v4/commands/header/template/v6/BuildNav/buildMenu.js +14 -0
- package/bin/header/v4/commands/header/template/v6/BuildNav/buildNav.js +31 -0
- package/bin/header/v4/commands/header/template/v6/BuildNav/buildWrapper.js +29 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v1/hamburger.js +65 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v1/menuItem.js +135 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v2/menuItem/createAnchor.js +15 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v2/menuItem/createIcon.js +26 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v2/menuItem/createLabel.js +9 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v2/menuItem/createLi.js +5 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v2/menuItem/icons.js +54 -0
- package/bin/header/v4/commands/header/template/v6/WebComponents/v2/menuItem/index.js +64 -0
- package/bin/header/v4/commands/header/template/v6/buildNav.js +29 -0
- package/bin/header/v4/commands/header/template/v6/createAnchor.js +29 -0
- package/bin/header/v4/commands/header/template/v6/createIcon.js +35 -0
- package/bin/header/v4/commands/header/template/v6/createLabel.js +9 -0
- package/bin/header/v4/commands/header/template/v6/createLi.js +5 -0
- package/bin/header/v4/commands/header/template/v6/icons.js +54 -0
- package/bin/header/v4/commands/header/template/v6/initHeader.js +59 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createLi } from "../createLi.js";
|
|
2
|
+
import { createAnchor } from "../createAnchor.js";
|
|
3
|
+
import { createLabel } from "../createLabel.js";
|
|
4
|
+
import { createIcon } from "../createIcon.js";
|
|
5
|
+
import { orchestrateMenuClick } from "./orchestrateMenuClick.js";
|
|
6
|
+
|
|
7
|
+
export const buildMenuItem = ({
|
|
8
|
+
inTextToShow,
|
|
9
|
+
inHtmlId,
|
|
10
|
+
inIconPaths,
|
|
11
|
+
inHref,
|
|
12
|
+
onClick,
|
|
13
|
+
inTableName,
|
|
14
|
+
inClasses,
|
|
15
|
+
inSvgName,
|
|
16
|
+
inConfigUiClasses
|
|
17
|
+
}) => {
|
|
18
|
+
const li = createLi(inClasses.liClass);
|
|
19
|
+
|
|
20
|
+
const a = createAnchor({
|
|
21
|
+
inHtmlId,
|
|
22
|
+
inHref,
|
|
23
|
+
inClass: inClasses?.aClass,
|
|
24
|
+
inTableName,
|
|
25
|
+
inSvgName,
|
|
26
|
+
inSvgDivClass: inConfigUiClasses.svgDivClass,
|
|
27
|
+
inTextToShow: inTextToShow,
|
|
28
|
+
inClassName: inClasses.spanClass
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
li.appendChild(a);
|
|
32
|
+
|
|
33
|
+
return li;
|
|
34
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export const getDefaultKSTableConfig = () => {
|
|
2
|
+
return {
|
|
3
|
+
containerId: 'kSTableContainer',
|
|
4
|
+
|
|
5
|
+
tableName: "",
|
|
6
|
+
|
|
7
|
+
mode: "create",
|
|
8
|
+
|
|
9
|
+
layout: {
|
|
10
|
+
verticalPosition: "top",
|
|
11
|
+
type: "table",
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
endPoints: {
|
|
15
|
+
create: "",
|
|
16
|
+
update: "",
|
|
17
|
+
delete: "",
|
|
18
|
+
read: "",
|
|
19
|
+
find: ""
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
options: {
|
|
23
|
+
firstRow: {
|
|
24
|
+
showSearch: true
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
vertical: {
|
|
28
|
+
showVertical: true,
|
|
29
|
+
isDisabled: false,
|
|
30
|
+
showSaveButton: true
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
dataList: {
|
|
34
|
+
show: true,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
table: {
|
|
38
|
+
isDisabled: false,
|
|
39
|
+
showTable: true,
|
|
40
|
+
showRowOptions: false,
|
|
41
|
+
showSerial: true,
|
|
42
|
+
showFooter: false,
|
|
43
|
+
|
|
44
|
+
footer: {
|
|
45
|
+
showDataList: true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
focus: {
|
|
50
|
+
priority: ["vertical", "footer", "search"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
columnsConfig: [],
|
|
55
|
+
|
|
56
|
+
uiClasses: {
|
|
57
|
+
form: {
|
|
58
|
+
formClass: 'grid grid-cols-3 gap-x-8 gap-y-4 p-6 verticalForm',
|
|
59
|
+
buttonClass: 'mt-2 px-4 py-1 bg-green-500 text-white',
|
|
60
|
+
rowClass: 'flex items-center space-x-4',
|
|
61
|
+
labelClass: 'w-24 text-sm font-medium',
|
|
62
|
+
inputClass: 'flex-1 border rounded px-3 py-2'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
callbacks: {
|
|
67
|
+
table: {
|
|
68
|
+
onDelete: async ({ toDeletePk }) => {
|
|
69
|
+
const fromDelete = await startFetchAsGet({
|
|
70
|
+
inQuery: {
|
|
71
|
+
ParentPk: toDeletePk
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return await fromDelete;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getDefaultKSTableConfig } from "./getDefaultKSTableConfig.js";
|
|
2
|
+
|
|
3
|
+
export const getKSTableConfig = async ({ tableName }) => {
|
|
4
|
+
const config = getDefaultKSTableConfig();
|
|
5
|
+
|
|
6
|
+
const fromPromise = await fetch("/columns.json");
|
|
7
|
+
// debugger;
|
|
8
|
+
const columnsConfig = await fromPromise.json();
|
|
9
|
+
|
|
10
|
+
config.columnsConfig = columnsConfig[tableName].columnsConfig;
|
|
11
|
+
|
|
12
|
+
config.tableName = tableName;
|
|
13
|
+
|
|
14
|
+
config.endPoints.read = `/Api/V1/${tableName}/ShowAll`;
|
|
15
|
+
|
|
16
|
+
return config;
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getKSTableConfig } from "./getKSTableConfig.js";
|
|
2
|
+
import { callKSTable } from "./callKSTable.js";
|
|
3
|
+
|
|
4
|
+
export const orchestrateMenuClick1 = async (event) => {
|
|
5
|
+
event.preventDefault();
|
|
6
|
+
|
|
7
|
+
const currentTarget = event.currentTarget;
|
|
8
|
+
// debugger;
|
|
9
|
+
const config = await getKSTableConfig({
|
|
10
|
+
tableName: currentTarget.dataset.tableName
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
await callKSTable(config);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const orchestrateMenuClick =
|
|
17
|
+
({ onClick }) =>
|
|
18
|
+
async (event) => {
|
|
19
|
+
// debugger;
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
|
|
22
|
+
const currentTarget = event.currentTarget;
|
|
23
|
+
// debugger;
|
|
24
|
+
const config = await getKSTableConfig({
|
|
25
|
+
tableName: currentTarget.dataset.tableName
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const fromCallKSTable = await callKSTable(config);
|
|
29
|
+
console.log("fromCallKSTable : ", fromCallKSTable);
|
|
30
|
+
|
|
31
|
+
if (onClick) {
|
|
32
|
+
await onClick(event);
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// /header/v1/buildBrand.js
|
|
2
|
+
|
|
3
|
+
export const buildBrand = ({ inHeading = "KeshavSoft", inHtmlId = "titlehtmlId" }) => {
|
|
4
|
+
|
|
5
|
+
const div = document.createElement("div");
|
|
6
|
+
|
|
7
|
+
div.className = "text-xl font-semibold";
|
|
8
|
+
|
|
9
|
+
div.innerText = inHeading;
|
|
10
|
+
|
|
11
|
+
div.id = inHtmlId;
|
|
12
|
+
|
|
13
|
+
return div;
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// /header/v1/buildHamburger.js
|
|
2
|
+
|
|
3
|
+
export const buildHamburger = () => {
|
|
4
|
+
|
|
5
|
+
const button = document.createElement("button");
|
|
6
|
+
|
|
7
|
+
button.className = "text-xl px-4 py-1 md:hidden";
|
|
8
|
+
|
|
9
|
+
button.innerText = "☰";
|
|
10
|
+
|
|
11
|
+
button.addEventListener("click", () => {
|
|
12
|
+
|
|
13
|
+
document
|
|
14
|
+
.getElementById("menu")
|
|
15
|
+
.classList.toggle("hidden");
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return button;
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// /header/v1/buildMenu.js
|
|
2
|
+
|
|
3
|
+
export const buildMenu = ({ inUlClass = "" }) => {
|
|
4
|
+
|
|
5
|
+
const ul = document.createElement("ul");
|
|
6
|
+
|
|
7
|
+
ul.id = "menu";
|
|
8
|
+
|
|
9
|
+
ul.className = `w-full hidden flex flex-col space-y-2 mt-4
|
|
10
|
+
md:flex md:flex-row md:space-y-0 md:gap-4
|
|
11
|
+
md:mt-0 md:w-auto md:flex-wrap ${inUlClass}`;
|
|
12
|
+
|
|
13
|
+
return ul;
|
|
14
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// /header/v2/buildNav.js
|
|
2
|
+
|
|
3
|
+
import { buildBrand } from "./buildBrand.js";
|
|
4
|
+
import { buildHamburger } from "./buildHamburger.js";
|
|
5
|
+
import { buildMenu } from "./buildMenu.js";
|
|
6
|
+
import { buildWrapper } from "./buildWrapper.js";
|
|
7
|
+
|
|
8
|
+
export const buildNav = ({ inTitle = {}, inUiClasses = {} }) => {
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
nav,
|
|
12
|
+
innerDiv
|
|
13
|
+
} = buildWrapper();
|
|
14
|
+
|
|
15
|
+
innerDiv.appendChild(
|
|
16
|
+
buildBrand({
|
|
17
|
+
inHeading: inTitle.text,
|
|
18
|
+
inHtmlId: inTitle.htmlId
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
innerDiv.appendChild(
|
|
23
|
+
buildHamburger()
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
innerDiv.appendChild(
|
|
27
|
+
buildMenu({ inUlClass: inUiClasses?.ulClass })
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return nav;
|
|
31
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// /header/v1/buildWrapper.js
|
|
2
|
+
|
|
3
|
+
export const buildWrapper = () => {
|
|
4
|
+
|
|
5
|
+
const nav = document.createElement("nav");
|
|
6
|
+
|
|
7
|
+
nav.className = "bg-gray-800 text-white";
|
|
8
|
+
|
|
9
|
+
const outerDiv = document.createElement("div");
|
|
10
|
+
|
|
11
|
+
outerDiv.className = `mx-auto px-3 py-3
|
|
12
|
+
max-w-3xl
|
|
13
|
+
lg:max-w-5xl
|
|
14
|
+
xl:max-w-full xl:px-10`;
|
|
15
|
+
|
|
16
|
+
const innerDiv = document.createElement("div");
|
|
17
|
+
|
|
18
|
+
innerDiv.className =
|
|
19
|
+
"flex flex-wrap items-center justify-between";
|
|
20
|
+
|
|
21
|
+
outerDiv.appendChild(innerDiv);
|
|
22
|
+
|
|
23
|
+
nav.appendChild(outerDiv);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
nav,
|
|
27
|
+
innerDiv
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
class KSHamburger extends HTMLElement {
|
|
2
|
+
connectedCallback() {
|
|
3
|
+
this.classList.add(
|
|
4
|
+
"text-xl",
|
|
5
|
+
"px-4",
|
|
6
|
+
"py-1",
|
|
7
|
+
"md:hidden"
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
this.style.cursor = "pointer";
|
|
11
|
+
|
|
12
|
+
this.innerHTML = "☰";
|
|
13
|
+
|
|
14
|
+
this.addEventListener("click1", () => {
|
|
15
|
+
document
|
|
16
|
+
.getElementById("menu")
|
|
17
|
+
?.classList.toggle("hidden");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
this.addEventListener("click", (event) => {
|
|
21
|
+
event.currentTarget
|
|
22
|
+
.closest("nav")
|
|
23
|
+
?.querySelector("#menu")
|
|
24
|
+
?.classList.toggle("hidden");
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
customElements.define("ks-hamburger", KSHamburger);
|
|
30
|
+
|
|
31
|
+
class KSAnchor extends HTMLElement {
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
const a = document.createElement("a");
|
|
34
|
+
|
|
35
|
+
a.id = this.getAttribute("html-id") || "";
|
|
36
|
+
a.href = this.getAttribute("href") || "#";
|
|
37
|
+
a.className = this.getAttribute("class-name") || "";
|
|
38
|
+
|
|
39
|
+
const tableName =
|
|
40
|
+
this.getAttribute("table-name");
|
|
41
|
+
|
|
42
|
+
if (tableName) {
|
|
43
|
+
a.dataset.tableName = tableName;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
while (this.firstChild) {
|
|
47
|
+
a.appendChild(this.firstChild);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
a.addEventListener("click", event => {
|
|
51
|
+
|
|
52
|
+
event.currentTarget
|
|
53
|
+
.closest("nav")
|
|
54
|
+
?.querySelector("#menu")
|
|
55
|
+
?.classList.add("hidden");
|
|
56
|
+
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
this.appendChild(a);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
customElements.define("ks-anchor", KSAnchor);
|
|
64
|
+
|
|
65
|
+
export default {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { createIcon } from "../../createIcon.js";
|
|
2
|
+
|
|
3
|
+
class KSMenuItem extends HTMLElement {
|
|
4
|
+
connectedCallback() {
|
|
5
|
+
const a = document.createElement("a");
|
|
6
|
+
|
|
7
|
+
a.id =
|
|
8
|
+
this.getAttribute("html-id") || "";
|
|
9
|
+
|
|
10
|
+
a.href =
|
|
11
|
+
this.getAttribute("href") || "#";
|
|
12
|
+
|
|
13
|
+
a.className =
|
|
14
|
+
this.getAttribute("class-name") || "";
|
|
15
|
+
|
|
16
|
+
const tableName =
|
|
17
|
+
this.getAttribute("table-name");
|
|
18
|
+
|
|
19
|
+
if (tableName) {
|
|
20
|
+
a.dataset.tableName =
|
|
21
|
+
tableName;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const text =
|
|
25
|
+
this.getAttribute("text") || "";
|
|
26
|
+
|
|
27
|
+
const svgName =
|
|
28
|
+
this.getAttribute("svg-name") || "";
|
|
29
|
+
|
|
30
|
+
const svg = createIcon({
|
|
31
|
+
inSvgName: svgName
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const span =
|
|
35
|
+
document.createElement("span");
|
|
36
|
+
|
|
37
|
+
span.textContent = text;
|
|
38
|
+
|
|
39
|
+
span.className =
|
|
40
|
+
this.getAttribute(
|
|
41
|
+
"span-class"
|
|
42
|
+
) || "";
|
|
43
|
+
|
|
44
|
+
while (this.firstChild) {
|
|
45
|
+
a.appendChild(
|
|
46
|
+
this.firstChild
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
a.append(
|
|
51
|
+
svg,
|
|
52
|
+
span
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
a.addEventListener("click", event => {
|
|
56
|
+
|
|
57
|
+
console.log("clicked");
|
|
58
|
+
|
|
59
|
+
const menu = event.currentTarget
|
|
60
|
+
.closest("nav")
|
|
61
|
+
?.querySelector("#menu");
|
|
62
|
+
|
|
63
|
+
console.log("menu : ", menu);
|
|
64
|
+
|
|
65
|
+
menu?.classList.add("hidden");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
a.addEventListener("click1", () => {
|
|
69
|
+
console.log("menu item click");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
this.appendChild(a);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
customElements.define(
|
|
77
|
+
"ks-menu-item",
|
|
78
|
+
KSMenuItem
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
export default {};
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
import { createLi } from "../createLi.js";
|
|
86
|
+
import { createAnchor } from "../createAnchor.js";
|
|
87
|
+
import { createLabel } from "../createLabel.js";
|
|
88
|
+
import { createIcon } from "../createIcon.js";
|
|
89
|
+
import { orchestrateMenuClick } from "./orchestrateMenuClick.js";
|
|
90
|
+
|
|
91
|
+
export const buildMenuItem = ({
|
|
92
|
+
inTextToShow,
|
|
93
|
+
inHtmlId,
|
|
94
|
+
inIconPaths,
|
|
95
|
+
inHref,
|
|
96
|
+
onClick,
|
|
97
|
+
inTableName,
|
|
98
|
+
inClasses,
|
|
99
|
+
inSvgName,
|
|
100
|
+
inConfigUiClasses
|
|
101
|
+
}) => {
|
|
102
|
+
const li = createLi(inClasses.liClass);
|
|
103
|
+
|
|
104
|
+
const a = createAnchor({
|
|
105
|
+
inHtmlId,
|
|
106
|
+
inHref,
|
|
107
|
+
cls: inClasses?.aClass,
|
|
108
|
+
inTableName
|
|
109
|
+
});
|
|
110
|
+
// debugger;
|
|
111
|
+
const span = createLabel({
|
|
112
|
+
inTextToShow: inTextToShow,
|
|
113
|
+
inClassName: inClasses.spanClass
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const svg = createIcon({
|
|
117
|
+
inSvgName,
|
|
118
|
+
inSvgDivClass: inConfigUiClasses.svgDivClass
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (onClick) {
|
|
122
|
+
a.addEventListener(
|
|
123
|
+
"click",
|
|
124
|
+
orchestrateMenuClick({
|
|
125
|
+
onClick
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
a.append(svg, span);
|
|
131
|
+
|
|
132
|
+
li.appendChild(a);
|
|
133
|
+
|
|
134
|
+
return li;
|
|
135
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const createAnchor = ({
|
|
2
|
+
inHtmlId = "", inHref = "#", inClass = "", inTableName = ""
|
|
3
|
+
}) => {
|
|
4
|
+
const a = document.createElement("a");
|
|
5
|
+
|
|
6
|
+
a.id = inHtmlId;
|
|
7
|
+
a.href = inHref;
|
|
8
|
+
a.className = inClass;
|
|
9
|
+
|
|
10
|
+
if (inTableName) {
|
|
11
|
+
a.dataset.tableName = inTableName
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return a;
|
|
15
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import icons from "./icons.js";
|
|
2
|
+
|
|
3
|
+
export const createIcon = ({
|
|
4
|
+
inSvgName, inSvgDivClass = "size-6 flex items-center justify-center"
|
|
5
|
+
}) => {
|
|
6
|
+
if (inSvgName in icons) {
|
|
7
|
+
const icon = document
|
|
8
|
+
.createRange()
|
|
9
|
+
.createContextualFragment(icons[inSvgName])
|
|
10
|
+
.firstElementChild;
|
|
11
|
+
|
|
12
|
+
const div = document.createElement("div");
|
|
13
|
+
|
|
14
|
+
// div.className = "size-6 flex items-center justify-center";
|
|
15
|
+
div.className = inSvgDivClass;
|
|
16
|
+
|
|
17
|
+
div.appendChild(icon);
|
|
18
|
+
|
|
19
|
+
return div;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return document
|
|
23
|
+
.createRange()
|
|
24
|
+
.createContextualFragment(icons.search)
|
|
25
|
+
.firstElementChild;
|
|
26
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// icons.js
|
|
2
|
+
export default {
|
|
3
|
+
serverStack: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M5.25 14.25h13.5m-13.5 0a3 3 0 0 1-3-3m3 3a3 3 0 1 0 0 6h13.5a3 3 0 1 0 0-6m-16.5-3a3 3 0 0 1 3-3h13.5a3 3 0 0 1 3 3m-19.5 0a4.5 4.5 0 0 1 .9-2.7L5.737 5.1a3.375 3.375 0 0 1 2.7-1.35h7.126c1.062 0 2.062.5 2.7 1.35l2.587 3.45a4.5 4.5 0 0 1 .9 2.7m0 0a3 3 0 0 1-3 3m0 3h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Zm-3 6h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Z" />
|
|
5
|
+
</svg>
|
|
6
|
+
`,
|
|
7
|
+
copy: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
8
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z" />
|
|
9
|
+
</svg>
|
|
10
|
+
`,
|
|
11
|
+
puzzle: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-10">
|
|
12
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z" />
|
|
13
|
+
</svg>
|
|
14
|
+
`,
|
|
15
|
+
folderPlus: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-10">
|
|
16
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 10.5v6m3-3H9m4.06-7.19-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z" />
|
|
17
|
+
</svg>
|
|
18
|
+
`,
|
|
19
|
+
download: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
20
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15M9 12l3 3m0 0 3-3m-3 3V2.25" />
|
|
21
|
+
</svg>`,
|
|
22
|
+
search: `
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
24
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
|
25
|
+
</svg>
|
|
26
|
+
`,
|
|
27
|
+
home: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
28
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
|
|
29
|
+
</svg>
|
|
30
|
+
`,
|
|
31
|
+
serial: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
32
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M8.242 5.992h12m-12 6.003H20.24m-12 5.999h12M4.117 7.495v-3.75H2.99m1.125 3.75H2.99m1.125 0H5.24m-1.92 2.577a1.125 1.125 0 1 1 1.591 1.59l-1.83 1.83h2.16M2.99 15.745h1.125a1.125 1.125 0 0 1 0 2.25H3.74m0-.002h.375a1.125 1.125 0 0 1 0 2.25H2.99" />
|
|
33
|
+
</svg>
|
|
34
|
+
`,
|
|
35
|
+
currency: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
36
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 8.25H9m6 3H9m3 6-3-3h1.5a3 3 0 1 0 0-6M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
37
|
+
</svg>
|
|
38
|
+
`,
|
|
39
|
+
wifi: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
40
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M8.288 15.038a5.25 5.25 0 0 1 7.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0M12.53 18.22l-.53.53-.53-.53a.75.75 0 0 1 1.06 0Z" />
|
|
41
|
+
</svg>
|
|
42
|
+
`,
|
|
43
|
+
exclamation: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
44
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z" />
|
|
45
|
+
</svg>
|
|
46
|
+
`,
|
|
47
|
+
search1: `
|
|
48
|
+
<div class="w-10 h-10 flex items-center justify-center">
|
|
49
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
50
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
|
51
|
+
</svg>
|
|
52
|
+
</div>
|
|
53
|
+
`,
|
|
54
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createLi } from "./createLi.js";
|
|
2
|
+
import { createAnchor } from "./createAnchor.js";
|
|
3
|
+
import { createLabel } from "./createLabel.js";
|
|
4
|
+
import { createIcon } from "./createIcon.js";
|
|
5
|
+
// import { orchestrateMenuClick } from "./orchestrateMenuClick.js";
|
|
6
|
+
|
|
7
|
+
class KSMenuItem extends HTMLElement {
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
const a = createAnchor({
|
|
10
|
+
inHtmlId: this.getAttribute("ks-id"),
|
|
11
|
+
inHref: this.getAttribute("ks-href"),
|
|
12
|
+
inTableName: this.getAttribute("ks-table-name"),
|
|
13
|
+
inClass: this.getAttribute("ks-class")
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const text = this.getAttribute("ks-textToShow") || "";
|
|
17
|
+
const className = this.getAttribute("ks-className") || "";
|
|
18
|
+
|
|
19
|
+
const svgName = this.getAttribute("ks-svgName") || "";
|
|
20
|
+
const svgDivClass = this.getAttribute("ks-svgDivClass") || "";
|
|
21
|
+
|
|
22
|
+
const svg = createIcon({
|
|
23
|
+
inSvgName: svgName,
|
|
24
|
+
inSvgDivClass: svgDivClass
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const span =
|
|
28
|
+
document.createElement("span");
|
|
29
|
+
|
|
30
|
+
span.textContent = text;
|
|
31
|
+
|
|
32
|
+
span.className = className;
|
|
33
|
+
|
|
34
|
+
while (this.firstChild) {
|
|
35
|
+
a.appendChild(
|
|
36
|
+
this.firstChild
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
a.append(
|
|
41
|
+
svg,
|
|
42
|
+
span
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
a.addEventListener("click", event => {
|
|
46
|
+
const menu = event.currentTarget
|
|
47
|
+
.closest("nav")
|
|
48
|
+
?.querySelector("#menu");
|
|
49
|
+
|
|
50
|
+
console.log("menu : ", menu);
|
|
51
|
+
|
|
52
|
+
menu?.classList.add("hidden");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
this.appendChild(a);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
customElements.define(
|
|
60
|
+
"ks-menu-item",
|
|
61
|
+
KSMenuItem
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export default {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// /header/v1/buildWrapper.js
|
|
2
|
+
|
|
3
|
+
export const buildWrapper = () => {
|
|
4
|
+
|
|
5
|
+
const nav = document.createElement("nav");
|
|
6
|
+
|
|
7
|
+
nav.className = "bg-gray-800 text-white";
|
|
8
|
+
|
|
9
|
+
const outerDiv = document.createElement("div");
|
|
10
|
+
|
|
11
|
+
outerDiv.className = `mx-auto px-3 py-3
|
|
12
|
+
max-w-3xl
|
|
13
|
+
lg:max-w-5xl
|
|
14
|
+
xl:max-w-full xl:px-10`;
|
|
15
|
+
|
|
16
|
+
const innerDiv = document.createElement("div");
|
|
17
|
+
|
|
18
|
+
innerDiv.className =
|
|
19
|
+
"flex flex-wrap items-center justify-between";
|
|
20
|
+
|
|
21
|
+
outerDiv.appendChild(innerDiv);
|
|
22
|
+
|
|
23
|
+
nav.appendChild(outerDiv);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
nav,
|
|
27
|
+
innerDiv
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const createAnchor = ({
|
|
2
|
+
inHtmlId = "", inHref = "#", inClass = "", inTableName = "",
|
|
3
|
+
inSvgName = "", inSvgDivClass = "", inClassName, inTextToShow
|
|
4
|
+
}) => {
|
|
5
|
+
const a = document.createElement("ks-menu-item");
|
|
6
|
+
|
|
7
|
+
a.setAttribute(
|
|
8
|
+
"ks-id",
|
|
9
|
+
inHtmlId || ""
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
a.setAttribute(
|
|
13
|
+
"ks-href",
|
|
14
|
+
inHref || "#"
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
a.setAttribute(
|
|
18
|
+
"ks-class",
|
|
19
|
+
inClass || ""
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
a.setAttribute("ks-svgName", inSvgName || "");
|
|
23
|
+
a.setAttribute("ks-svgDivClass", inSvgDivClass || "");
|
|
24
|
+
|
|
25
|
+
a.setAttribute("ks-className", inClassName || "");
|
|
26
|
+
a.setAttribute("ks-textToShow", inTextToShow || "");
|
|
27
|
+
|
|
28
|
+
return a;
|
|
29
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import icons from "./icons.js";
|
|
2
|
+
|
|
3
|
+
export const createIcon = ({
|
|
4
|
+
inSvgName, inSvgDivClass = ""
|
|
5
|
+
}) => {
|
|
6
|
+
// console.log("inSvgName : ", inSvgName);
|
|
7
|
+
|
|
8
|
+
// if (inSvgName in icons) {
|
|
9
|
+
// return document
|
|
10
|
+
// .createRange()
|
|
11
|
+
// .createContextualFragment(icons[inSvgName])
|
|
12
|
+
// .firstElementChild;
|
|
13
|
+
// };
|
|
14
|
+
|
|
15
|
+
if (inSvgName in icons) {
|
|
16
|
+
const icon = document
|
|
17
|
+
.createRange()
|
|
18
|
+
.createContextualFragment(icons[inSvgName])
|
|
19
|
+
.firstElementChild;
|
|
20
|
+
|
|
21
|
+
const div = document.createElement("div");
|
|
22
|
+
|
|
23
|
+
// div.className = "size-6 flex items-center justify-center";
|
|
24
|
+
div.className = inSvgDivClass;
|
|
25
|
+
|
|
26
|
+
div.appendChild(icon);
|
|
27
|
+
|
|
28
|
+
return div;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return document
|
|
32
|
+
.createRange()
|
|
33
|
+
.createContextualFragment(icons.search)
|
|
34
|
+
.firstElementChild;
|
|
35
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// icons.js
|
|
2
|
+
export default {
|
|
3
|
+
serverStack: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
4
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M5.25 14.25h13.5m-13.5 0a3 3 0 0 1-3-3m3 3a3 3 0 1 0 0 6h13.5a3 3 0 1 0 0-6m-16.5-3a3 3 0 0 1 3-3h13.5a3 3 0 0 1 3 3m-19.5 0a4.5 4.5 0 0 1 .9-2.7L5.737 5.1a3.375 3.375 0 0 1 2.7-1.35h7.126c1.062 0 2.062.5 2.7 1.35l2.587 3.45a4.5 4.5 0 0 1 .9 2.7m0 0a3 3 0 0 1-3 3m0 3h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Zm-3 6h.008v.008h-.008v-.008Zm0-6h.008v.008h-.008v-.008Z" />
|
|
5
|
+
</svg>
|
|
6
|
+
`,
|
|
7
|
+
copy: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
8
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z" />
|
|
9
|
+
</svg>
|
|
10
|
+
`,
|
|
11
|
+
puzzle: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-10">
|
|
12
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z" />
|
|
13
|
+
</svg>
|
|
14
|
+
`,
|
|
15
|
+
folderPlus: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-10">
|
|
16
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 10.5v6m3-3H9m4.06-7.19-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z" />
|
|
17
|
+
</svg>
|
|
18
|
+
`,
|
|
19
|
+
download: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
20
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15M9 12l3 3m0 0 3-3m-3 3V2.25" />
|
|
21
|
+
</svg>`,
|
|
22
|
+
search: `
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
24
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
|
25
|
+
</svg>
|
|
26
|
+
`,
|
|
27
|
+
home: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
28
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
|
|
29
|
+
</svg>
|
|
30
|
+
`,
|
|
31
|
+
serial: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
32
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M8.242 5.992h12m-12 6.003H20.24m-12 5.999h12M4.117 7.495v-3.75H2.99m1.125 3.75H2.99m1.125 0H5.24m-1.92 2.577a1.125 1.125 0 1 1 1.591 1.59l-1.83 1.83h2.16M2.99 15.745h1.125a1.125 1.125 0 0 1 0 2.25H3.74m0-.002h.375a1.125 1.125 0 0 1 0 2.25H2.99" />
|
|
33
|
+
</svg>
|
|
34
|
+
`,
|
|
35
|
+
currency: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
36
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 8.25H9m6 3H9m3 6-3-3h1.5a3 3 0 1 0 0-6M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
|
37
|
+
</svg>
|
|
38
|
+
`,
|
|
39
|
+
wifi: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
40
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M8.288 15.038a5.25 5.25 0 0 1 7.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0M12.53 18.22l-.53.53-.53-.53a.75.75 0 0 1 1.06 0Z" />
|
|
41
|
+
</svg>
|
|
42
|
+
`,
|
|
43
|
+
exclamation: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
44
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z" />
|
|
45
|
+
</svg>
|
|
46
|
+
`,
|
|
47
|
+
search1: `
|
|
48
|
+
<div class="w-10 h-10 flex items-center justify-center">
|
|
49
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
50
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" />
|
|
51
|
+
</svg>
|
|
52
|
+
</div>
|
|
53
|
+
`,
|
|
54
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "./WebComponents/v2/menuItem/index.js";
|
|
2
|
+
|
|
3
|
+
import { buildMenuItem } from "./BuildMenuItem/buildMenuItem.js";
|
|
4
|
+
import { buildNav } from "./BuildNav/buildNav.js";
|
|
5
|
+
|
|
6
|
+
const initHeader = (config = {}) => {
|
|
7
|
+
|
|
8
|
+
const header = document.getElementById("header");
|
|
9
|
+
|
|
10
|
+
if (!header) return;
|
|
11
|
+
|
|
12
|
+
header.appendChild(
|
|
13
|
+
buildNav({
|
|
14
|
+
inTitle: config.title,
|
|
15
|
+
inUiClasses: config.uiClasses
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const menu = document.getElementById("menu");
|
|
20
|
+
|
|
21
|
+
(config.items || []).forEach(item => {
|
|
22
|
+
|
|
23
|
+
const classes = {
|
|
24
|
+
liClass: "md:text-center",
|
|
25
|
+
|
|
26
|
+
aClass: `${item?.uiClasses?.aClass} flex justify-between items-center
|
|
27
|
+
bg-gray-700 px-4 py-2 rounded-md
|
|
28
|
+
hover:bg-gray-600
|
|
29
|
+
active:bg-gray-500 active:scale-95
|
|
30
|
+
transition-all duration-150
|
|
31
|
+
md:flex-col md:justify-center md:items-center
|
|
32
|
+
lg:bg-transparent lg:px-2 lg:py-1`,
|
|
33
|
+
|
|
34
|
+
spanClass: `ml-3 text-right w-full text-base
|
|
35
|
+
md:w-auto md:text-center md:ml-0 lg:text-lg`,
|
|
36
|
+
|
|
37
|
+
svgClass: "text-gray-300 w-6 h-6 lg:w-7 lg:h-7"
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const li = buildMenuItem({
|
|
41
|
+
inTextToShow: item.text,
|
|
42
|
+
inHtmlId: item.id,
|
|
43
|
+
inIconPaths: item.icon,
|
|
44
|
+
inHref: item.href,
|
|
45
|
+
onClick: item.onClick,
|
|
46
|
+
inTableName: item.tableName,
|
|
47
|
+
inClasses: classes,
|
|
48
|
+
inSvgName: item.svgName,
|
|
49
|
+
inConfigUiClasses: config.uiClasses
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
menu.appendChild(li);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
window.KSHeader = initHeader;
|
|
57
|
+
console.log("KSHeader loaded");
|
|
58
|
+
|
|
59
|
+
export default initHeader;
|