json-crud-ui 1.1.2 → 1.1.4
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/v1/commands/init/template/v2/FormLoad/DomContentLoaded/buildHeader.js +68 -0
- package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
- package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
- package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/start.js +7 -0
- package/bin/v1/commands/init/template/v2/FormLoad/start.js +5 -0
- package/bin/v1/commands/init/template/v2/start.js +7 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/buildHeader.js +58 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
- package/bin/v1/commands/init/template/v3/FormLoad/DomContentLoaded/start.js +7 -0
- package/bin/v1/commands/init/template/v3/FormLoad/start.js +5 -0
- package/bin/v1/commands/init/template/v3/headers.json +45 -0
- package/bin/v1/commands/init/template/v3/start.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { initHeader } from "../../../../../../header/v6/initHeader.js";
|
|
2
|
+
|
|
3
|
+
const buildHeader = () => {
|
|
4
|
+
const headerConfig = {
|
|
5
|
+
items: [
|
|
6
|
+
{
|
|
7
|
+
text: "ShowAll",
|
|
8
|
+
id: "ShowAllHtmlId",
|
|
9
|
+
icon: [
|
|
10
|
+
"M4 6h16",
|
|
11
|
+
"M4 10h16",
|
|
12
|
+
"M4 14h10",
|
|
13
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
text: "StockItems",
|
|
18
|
+
id: "StockItemsHtmlId",
|
|
19
|
+
icon: [
|
|
20
|
+
"M3 7l9 4 9-4",
|
|
21
|
+
"M3 7l9-4 9 4",
|
|
22
|
+
"M3 7v10l9 4 9-4V7",
|
|
23
|
+
"M12 11v10"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
text: "Transactions",
|
|
28
|
+
id: "1",
|
|
29
|
+
icon: [
|
|
30
|
+
|
|
31
|
+
"M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z",
|
|
32
|
+
"M14 2v6h6",
|
|
33
|
+
"M8 12h8",
|
|
34
|
+
"M8 16h8"
|
|
35
|
+
],
|
|
36
|
+
href: "../../Transactions/V7/Create/index.html"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
text: "FromTally",
|
|
40
|
+
id: "ImportHtmlId",
|
|
41
|
+
icon: [
|
|
42
|
+
"M4 6h16",
|
|
43
|
+
"M4 10h16",
|
|
44
|
+
"M4 14h10",
|
|
45
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
initHeader(headerConfig);
|
|
52
|
+
// callKSHeader(headerConfig).then();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const callKSHeader = async (config) => {
|
|
56
|
+
if (window.KSHeader?.initHeader) {
|
|
57
|
+
console.log("table loaded from window.KSTable");
|
|
58
|
+
|
|
59
|
+
return window.KSHeader.initHeader(config); // extension or CDN
|
|
60
|
+
} else {
|
|
61
|
+
// const { initTableOnly } = await import("../../../../../../../../KSTableAi/V28/entry.js"); // local
|
|
62
|
+
const { initTableOnly } = await import("https://keshavsoft.github.io/KsJsTableAi/Public/kstable.js"); // local
|
|
63
|
+
|
|
64
|
+
return initTableOnly(config);
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export { buildHeader };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// orchestrator
|
|
2
|
+
export const buildMenuItem = ({
|
|
3
|
+
inTextToShow,
|
|
4
|
+
inHtmlId,
|
|
5
|
+
inIconPaths,
|
|
6
|
+
inHref
|
|
7
|
+
}) => {
|
|
8
|
+
const textToShow = inTextToShow;
|
|
9
|
+
const htmlId = inHtmlId;
|
|
10
|
+
const iconPaths = inIconPaths;
|
|
11
|
+
|
|
12
|
+
const li = createLi();
|
|
13
|
+
const a = createAnchor({ inHtmlId: htmlId, inHref });
|
|
14
|
+
const span = createLabel({ inTextToShow: textToShow });
|
|
15
|
+
const svg = createIcon({ inIconPaths: iconPaths });
|
|
16
|
+
|
|
17
|
+
a.append(svg, span);
|
|
18
|
+
li.appendChild(a);
|
|
19
|
+
|
|
20
|
+
return li;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const createLi = () => {
|
|
24
|
+
const htmlLi = document.createElement("li");
|
|
25
|
+
|
|
26
|
+
htmlLi.className = "md:text-center";
|
|
27
|
+
|
|
28
|
+
return htmlLi;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// createAnchor
|
|
34
|
+
const createAnchor = ({ inHtmlId = "htmlId",
|
|
35
|
+
inHref = "#"
|
|
36
|
+
}) => {
|
|
37
|
+
const a = document.createElement("a");
|
|
38
|
+
a.id = inHtmlId;
|
|
39
|
+
a.href = inHref;
|
|
40
|
+
// a.className =
|
|
41
|
+
// "group flex items-center md:flex-col md:items-center gap-0 md:gap-1 cursor-pointer hover:bg-gray-700 px-2 py-1 rounded transition-colors duration-200 active:scale-95 focus:outline-none focus:ring-2 focus:ring-gray-500";
|
|
42
|
+
|
|
43
|
+
a.className = `flex justify-between items-center bg-gray-700 px-4 py-2 rounded-md
|
|
44
|
+
hover:bg-gray-600 active:bg-gray-500 active:scale-95
|
|
45
|
+
transition-all duration-150
|
|
46
|
+
md:flex-col md:justify-center md:items-center
|
|
47
|
+
lg:bg-transparent lg:px-2 lg:py-1`;
|
|
48
|
+
|
|
49
|
+
return a;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// createLabel (no transform → no height change)
|
|
53
|
+
const createLabel = ({ inTextToShow = "Menu1" }) => {
|
|
54
|
+
const span = document.createElement("span");
|
|
55
|
+
span.className =
|
|
56
|
+
"ml-3 text-right w-full text-base md:w-auto md:text-center md:ml-0 lg:text-lg";
|
|
57
|
+
|
|
58
|
+
span.textContent = inTextToShow;
|
|
59
|
+
|
|
60
|
+
return span;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// createIcon (safe transform: no layout shift)
|
|
64
|
+
const createIcon = ({ inIconPaths = [] }) => {
|
|
65
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
66
|
+
// svg.setAttribute(
|
|
67
|
+
// "class",
|
|
68
|
+
// "w-6 h-6 md:order-1 md:mb-0 text-gray-400 group-hover:text-white transition-all duration-200 transform group-hover:scale-95 group-hover:-translate-y-0.5"
|
|
69
|
+
// );
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
svg.setAttribute(
|
|
73
|
+
"class",
|
|
74
|
+
"text-gray-300 w-6 h-6 lg:w-7 lg:h-7"
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// <svg class="text-gray-300 w-6 h-6 lg:w-7 lg:h-7" fill="none" stroke="currentColor"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
svg.setAttribute("fill", "none");
|
|
82
|
+
svg.setAttribute("stroke", "currentColor");
|
|
83
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
84
|
+
svg.setAttribute("stroke-width", "1.5");
|
|
85
|
+
svg.setAttribute("stroke-linecap", "round");
|
|
86
|
+
svg.setAttribute("stroke-linejoin", "round");
|
|
87
|
+
|
|
88
|
+
inIconPaths.forEach(d => {
|
|
89
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
90
|
+
path.setAttribute("d", d);
|
|
91
|
+
svg.appendChild(path);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return svg;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// <li class="md:text-center">
|
|
100
|
+
// <a id="LedgersHtmlId"
|
|
101
|
+
// href="#" class="flex justify-between items-center bg-gray-700 px-4 py-2 rounded-md
|
|
102
|
+
// hover:bg-gray-600 active:bg-gray-500 active:scale-95
|
|
103
|
+
// transition-all duration-150
|
|
104
|
+
// md:flex-col md:justify-center md:items-center
|
|
105
|
+
// lg:bg-transparent lg:px-2 lg:py-1">
|
|
106
|
+
|
|
107
|
+
// <!-- LEFT: ICON -->
|
|
108
|
+
// <svg class="text-gray-300 w-6 h-6 lg:w-7 lg:h-7" fill="none" stroke="currentColor"
|
|
109
|
+
// viewBox="0 0 24 24">
|
|
110
|
+
// <path
|
|
111
|
+
// d="M4 6h16M4 10h16M4 14h10M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" />
|
|
112
|
+
// </svg>
|
|
113
|
+
|
|
114
|
+
// <!-- RIGHT: LABEL -->
|
|
115
|
+
// <span class="ml-3 text-right w-full text-base
|
|
116
|
+
// md:w-auto md:text-center md:ml-0
|
|
117
|
+
// lg:text-lg
|
|
118
|
+
// ">Ledgers</span>
|
|
119
|
+
|
|
120
|
+
// </a>
|
|
121
|
+
// </li>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { initHeader } from "../../../../../../header/v6/initHeader.js";
|
|
2
|
+
|
|
3
|
+
const buildHeader = async () => {
|
|
4
|
+
const headerConfig1 = {
|
|
5
|
+
items: [
|
|
6
|
+
{
|
|
7
|
+
text: "ShowAll",
|
|
8
|
+
id: "ShowAllHtmlId",
|
|
9
|
+
icon: [
|
|
10
|
+
"M4 6h16",
|
|
11
|
+
"M4 10h16",
|
|
12
|
+
"M4 14h10",
|
|
13
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
text: "StockItems",
|
|
18
|
+
id: "StockItemsHtmlId",
|
|
19
|
+
icon: [
|
|
20
|
+
"M3 7l9 4 9-4",
|
|
21
|
+
"M3 7l9-4 9 4",
|
|
22
|
+
"M3 7v10l9 4 9-4V7",
|
|
23
|
+
"M12 11v10"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
text: "Transactions",
|
|
28
|
+
id: "1",
|
|
29
|
+
icon: [
|
|
30
|
+
|
|
31
|
+
"M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z",
|
|
32
|
+
"M14 2v6h6",
|
|
33
|
+
"M8 12h8",
|
|
34
|
+
"M8 16h8"
|
|
35
|
+
],
|
|
36
|
+
href: "../../Transactions/V7/Create/index.html"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
text: "FromTally",
|
|
40
|
+
id: "ImportHtmlId",
|
|
41
|
+
icon: [
|
|
42
|
+
"M4 6h16",
|
|
43
|
+
"M4 10h16",
|
|
44
|
+
"M4 14h10",
|
|
45
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const fromFetch = await fetch("./Index/headers.json");
|
|
52
|
+
const headerConfig = await fromFetch.json();
|
|
53
|
+
|
|
54
|
+
await initHeader(headerConfig);
|
|
55
|
+
// callKSHeader(headerConfig).then();
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { buildHeader };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// orchestrator
|
|
2
|
+
export const buildMenuItem = ({
|
|
3
|
+
inTextToShow,
|
|
4
|
+
inHtmlId,
|
|
5
|
+
inIconPaths,
|
|
6
|
+
inHref
|
|
7
|
+
}) => {
|
|
8
|
+
const textToShow = inTextToShow;
|
|
9
|
+
const htmlId = inHtmlId;
|
|
10
|
+
const iconPaths = inIconPaths;
|
|
11
|
+
|
|
12
|
+
const li = createLi();
|
|
13
|
+
const a = createAnchor({ inHtmlId: htmlId, inHref });
|
|
14
|
+
const span = createLabel({ inTextToShow: textToShow });
|
|
15
|
+
const svg = createIcon({ inIconPaths: iconPaths });
|
|
16
|
+
|
|
17
|
+
a.append(svg, span);
|
|
18
|
+
li.appendChild(a);
|
|
19
|
+
|
|
20
|
+
return li;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const createLi = () => {
|
|
24
|
+
const htmlLi = document.createElement("li");
|
|
25
|
+
|
|
26
|
+
htmlLi.className = "md:text-center";
|
|
27
|
+
|
|
28
|
+
return htmlLi;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// createAnchor
|
|
34
|
+
const createAnchor = ({ inHtmlId = "htmlId",
|
|
35
|
+
inHref = "#"
|
|
36
|
+
}) => {
|
|
37
|
+
const a = document.createElement("a");
|
|
38
|
+
a.id = inHtmlId;
|
|
39
|
+
a.href = inHref;
|
|
40
|
+
// a.className =
|
|
41
|
+
// "group flex items-center md:flex-col md:items-center gap-0 md:gap-1 cursor-pointer hover:bg-gray-700 px-2 py-1 rounded transition-colors duration-200 active:scale-95 focus:outline-none focus:ring-2 focus:ring-gray-500";
|
|
42
|
+
|
|
43
|
+
a.className = `flex justify-between items-center bg-gray-700 px-4 py-2 rounded-md
|
|
44
|
+
hover:bg-gray-600 active:bg-gray-500 active:scale-95
|
|
45
|
+
transition-all duration-150
|
|
46
|
+
md:flex-col md:justify-center md:items-center
|
|
47
|
+
lg:bg-transparent lg:px-2 lg:py-1`;
|
|
48
|
+
|
|
49
|
+
return a;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// createLabel (no transform → no height change)
|
|
53
|
+
const createLabel = ({ inTextToShow = "Menu1" }) => {
|
|
54
|
+
const span = document.createElement("span");
|
|
55
|
+
span.className =
|
|
56
|
+
"ml-3 text-right w-full text-base md:w-auto md:text-center md:ml-0 lg:text-lg";
|
|
57
|
+
|
|
58
|
+
span.textContent = inTextToShow;
|
|
59
|
+
|
|
60
|
+
return span;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// createIcon (safe transform: no layout shift)
|
|
64
|
+
const createIcon = ({ inIconPaths = [] }) => {
|
|
65
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
66
|
+
// svg.setAttribute(
|
|
67
|
+
// "class",
|
|
68
|
+
// "w-6 h-6 md:order-1 md:mb-0 text-gray-400 group-hover:text-white transition-all duration-200 transform group-hover:scale-95 group-hover:-translate-y-0.5"
|
|
69
|
+
// );
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
svg.setAttribute(
|
|
73
|
+
"class",
|
|
74
|
+
"text-gray-300 w-6 h-6 lg:w-7 lg:h-7"
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// <svg class="text-gray-300 w-6 h-6 lg:w-7 lg:h-7" fill="none" stroke="currentColor"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
svg.setAttribute("fill", "none");
|
|
82
|
+
svg.setAttribute("stroke", "currentColor");
|
|
83
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
84
|
+
svg.setAttribute("stroke-width", "1.5");
|
|
85
|
+
svg.setAttribute("stroke-linecap", "round");
|
|
86
|
+
svg.setAttribute("stroke-linejoin", "round");
|
|
87
|
+
|
|
88
|
+
inIconPaths.forEach(d => {
|
|
89
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
90
|
+
path.setAttribute("d", d);
|
|
91
|
+
svg.appendChild(path);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return svg;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
// <li class="md:text-center">
|
|
100
|
+
// <a id="LedgersHtmlId"
|
|
101
|
+
// href="#" class="flex justify-between items-center bg-gray-700 px-4 py-2 rounded-md
|
|
102
|
+
// hover:bg-gray-600 active:bg-gray-500 active:scale-95
|
|
103
|
+
// transition-all duration-150
|
|
104
|
+
// md:flex-col md:justify-center md:items-center
|
|
105
|
+
// lg:bg-transparent lg:px-2 lg:py-1">
|
|
106
|
+
|
|
107
|
+
// <!-- LEFT: ICON -->
|
|
108
|
+
// <svg class="text-gray-300 w-6 h-6 lg:w-7 lg:h-7" fill="none" stroke="currentColor"
|
|
109
|
+
// viewBox="0 0 24 24">
|
|
110
|
+
// <path
|
|
111
|
+
// d="M4 6h16M4 10h16M4 14h10M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" />
|
|
112
|
+
// </svg>
|
|
113
|
+
|
|
114
|
+
// <!-- RIGHT: LABEL -->
|
|
115
|
+
// <span class="ml-3 text-right w-full text-base
|
|
116
|
+
// md:w-auto md:text-center md:ml-0
|
|
117
|
+
// lg:text-lg
|
|
118
|
+
// ">Ledgers</span>
|
|
119
|
+
|
|
120
|
+
// </a>
|
|
121
|
+
// </li>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"items": [
|
|
3
|
+
{
|
|
4
|
+
"text": "ShowAll",
|
|
5
|
+
"id": "ShowAllHtmlId",
|
|
6
|
+
"icon": [
|
|
7
|
+
"M4 6h16",
|
|
8
|
+
"M4 10h16",
|
|
9
|
+
"M4 14h10",
|
|
10
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"text": "Search",
|
|
15
|
+
"id": "SearchHtmlId",
|
|
16
|
+
"icon": [
|
|
17
|
+
"M3 7l9 4 9-4",
|
|
18
|
+
"M3 7l9-4 9 4",
|
|
19
|
+
"M3 7v10l9 4 9-4V7",
|
|
20
|
+
"M12 11v10"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"text": "Transactions",
|
|
25
|
+
"id": "1",
|
|
26
|
+
"icon": [
|
|
27
|
+
"M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z",
|
|
28
|
+
"M14 2v6h6",
|
|
29
|
+
"M8 12h8",
|
|
30
|
+
"M8 16h8"
|
|
31
|
+
],
|
|
32
|
+
"href": "../../Transactions/V7/Create/index.html"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"text": "FromTally",
|
|
36
|
+
"id": "ImportHtmlId",
|
|
37
|
+
"icon": [
|
|
38
|
+
"M4 6h16",
|
|
39
|
+
"M4 10h16",
|
|
40
|
+
"M4 14h10",
|
|
41
|
+
"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|