json-crud-ui 1.1.1 → 1.1.3

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.
Files changed (149) hide show
  1. package/bin/cli.js +1 -1
  2. package/bin/v1/commands/init/steps/announce.js +3 -0
  3. package/bin/{v12/tasks/tables/AddTableName/steps/createFolder.js → v1/commands/init/steps/createProject.js} +2 -2
  4. package/bin/v1/commands/init/steps/locateDestination.js +5 -0
  5. package/bin/{v11/tasks/tables/AddTableName → v1/commands/init}/steps/locateSource.js +4 -1
  6. package/bin/{v10/tasks/tables/AddTableName → v1/commands/init}/steps/resolveFolderName.js +3 -6
  7. package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildHeader.js +68 -0
  8. package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
  9. package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
  10. package/bin/v1/commands/init/template/v1/Index/FormLoad/DomContentLoaded/start.js +7 -0
  11. package/bin/v1/commands/init/template/v1/Index/FormLoad/start.js +5 -0
  12. package/bin/v1/commands/init/template/v1/Index/start.js +7 -0
  13. package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/buildHeader.js +68 -0
  14. package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/buildMenuItem.js +121 -0
  15. package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/runAfterDomLoad.js +7 -0
  16. package/bin/v1/commands/init/template/v2/FormLoad/DomContentLoaded/start.js +7 -0
  17. package/bin/v1/commands/init/template/v2/FormLoad/start.js +5 -0
  18. package/bin/v1/commands/init/template/v2/start.js +7 -0
  19. package/bin/v1/commands/init.js +22 -0
  20. package/bin/{v10 → v1}/core/parseInput.js +2 -2
  21. package/bin/v1/core/resolveCommand.js +10 -0
  22. package/bin/{v10 → v1}/core/showUsage.js +1 -1
  23. package/bin/{v10 → v1}/start.js +7 -5
  24. package/package.json +2 -2
  25. package/bin/v10/commands/exportCommands/endPointsJs.js +0 -5
  26. package/bin/v10/core/createFolder.js +0 -34
  27. package/bin/v10/core/resolveCommand.js +0 -13
  28. package/bin/v10/tasks/actions/EndPointsJs/Distinct/index.js +0 -32
  29. package/bin/v10/tasks/actions/EndPointsJs/Distinct/insertImport.js +0 -15
  30. package/bin/v10/tasks/actions/EndPointsJs/Distinct/insertUsage.js +0 -15
  31. package/bin/v10/tasks/actions/EndPointsJs/Insert/index.js +0 -33
  32. package/bin/v10/tasks/actions/EndPointsJs/Insert/insertImport.js +0 -15
  33. package/bin/v10/tasks/actions/EndPointsJs/Insert/insertUsage.js +0 -15
  34. package/bin/v10/tasks/actions/EndPointsJs/ShowAll/index.js +0 -33
  35. package/bin/v10/tasks/actions/EndPointsJs/ShowAll/insertImport.js +0 -15
  36. package/bin/v10/tasks/actions/EndPointsJs/ShowAll/insertUsage.js +0 -15
  37. package/bin/v10/tasks/actions/EndPointsJs/index.js +0 -37
  38. package/bin/v10/tasks/actions/EndPointsJs/showUsage.js +0 -38
  39. package/bin/v10/tasks/actions/appJs.js +0 -6
  40. package/bin/v10/tasks/common/SourceEditor.js +0 -66
  41. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/common/readFile.js +0 -8
  42. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/common/writeFile.js +0 -10
  43. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/index.js +0 -9
  44. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -9
  45. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -8
  46. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -10
  47. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/index.js +0 -41
  48. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -11
  49. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -8
  50. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -10
  51. package/bin/v10/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/index.js +0 -42
  52. package/bin/v10/tasks/tables/AddTableName/steps/announce.js +0 -9
  53. package/bin/v10/tasks/tables/AddTableName/steps/createFolder.js +0 -7
  54. package/bin/v10/tasks/tables/AddTableName/steps/decideTemplate.js +0 -3
  55. package/bin/v10/tasks/tables/AddTableName/steps/locateDestination.js +0 -6
  56. package/bin/v10/tasks/tables/AddTableName/steps/locateSource.js +0 -13
  57. package/bin/v10/tasks/tables/AddTableName/steps/updateConfig.js +0 -16
  58. package/bin/v10/tasks/tables/AddTableName/steps/updateEndPointsFile.js +0 -30
  59. package/bin/v10/tasks/tables/AddTableName/steps/updateTableName.js +0 -30
  60. package/bin/v10/tasks/tables/AddTableName/template/Config/schema.json +0 -3
  61. package/bin/v10/tasks/tables/AddTableName/template/end-points.js +0 -7
  62. package/bin/v10/tasks/tables/addTableName.js +0 -56
  63. package/bin/v11/commands/loadCommand.js +0 -7
  64. package/bin/v11/config/actions.json +0 -35
  65. package/bin/v11/config/actionsV1.json +0 -20
  66. package/bin/v11/config/actionsV2.json +0 -27
  67. package/bin/v11/core/createFolder.js +0 -34
  68. package/bin/v11/core/parseInput.js +0 -8
  69. package/bin/v11/core/resolveCommand.js +0 -13
  70. package/bin/v11/core/showUsage.js +0 -39
  71. package/bin/v11/start.js +0 -29
  72. package/bin/v11/tasks/actions/EndPointsJs/AlterJsFile/index.js +0 -31
  73. package/bin/v11/tasks/actions/EndPointsJs/AlterJsFile/insertImport.js +0 -15
  74. package/bin/v11/tasks/actions/EndPointsJs/AlterJsFile/insertUsage.js +0 -15
  75. package/bin/v11/tasks/actions/EndPointsJs/Distinct/index.js +0 -32
  76. package/bin/v11/tasks/actions/EndPointsJs/Distinct/insertImport.js +0 -15
  77. package/bin/v11/tasks/actions/EndPointsJs/Distinct/insertUsage.js +0 -15
  78. package/bin/v11/tasks/actions/EndPointsJs/Insert/index.js +0 -33
  79. package/bin/v11/tasks/actions/EndPointsJs/Insert/insertImport.js +0 -15
  80. package/bin/v11/tasks/actions/EndPointsJs/Insert/insertUsage.js +0 -15
  81. package/bin/v11/tasks/actions/EndPointsJs/ShowAll/index.js +0 -33
  82. package/bin/v11/tasks/actions/EndPointsJs/ShowAll/insertImport.js +0 -15
  83. package/bin/v11/tasks/actions/EndPointsJs/ShowAll/insertUsage.js +0 -15
  84. package/bin/v11/tasks/actions/EndPointsJs/index.js +0 -19
  85. package/bin/v11/tasks/actions/EndPointsJs/showUsage.js +0 -38
  86. package/bin/v11/tasks/actions/appJs.js +0 -6
  87. package/bin/v11/tasks/common/SourceEditor.js +0 -66
  88. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/common/readFile.js +0 -8
  89. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/common/writeFile.js +0 -10
  90. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/index.js +0 -9
  91. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -9
  92. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -8
  93. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -10
  94. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/index.js +0 -41
  95. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -11
  96. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -8
  97. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -10
  98. package/bin/v11/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/index.js +0 -42
  99. package/bin/v11/tasks/tables/AddTableName/steps/announce.js +0 -9
  100. package/bin/v11/tasks/tables/AddTableName/steps/createFolder.js +0 -7
  101. package/bin/v11/tasks/tables/AddTableName/steps/decideTemplate.js +0 -3
  102. package/bin/v11/tasks/tables/AddTableName/steps/locateDestination.js +0 -6
  103. package/bin/v11/tasks/tables/AddTableName/steps/resolveFolderName.js +0 -20
  104. package/bin/v11/tasks/tables/AddTableName/steps/updateConfig.js +0 -16
  105. package/bin/v11/tasks/tables/AddTableName/steps/updateEndPointsFile.js +0 -30
  106. package/bin/v11/tasks/tables/AddTableName/steps/updateTableName.js +0 -30
  107. package/bin/v11/tasks/tables/AddTableName/template/Config/schema.json +0 -3
  108. package/bin/v11/tasks/tables/AddTableName/template/end-points.js +0 -7
  109. package/bin/v11/tasks/tables/addTableName.js +0 -56
  110. package/bin/v12/commands/loadCommand.js +0 -7
  111. package/bin/v12/config/actions.json +0 -46
  112. package/bin/v12/config/actionsV1.json +0 -20
  113. package/bin/v12/config/actionsV2.json +0 -27
  114. package/bin/v12/config/actionsV3.json +0 -35
  115. package/bin/v12/config/actionsV4.json +0 -35
  116. package/bin/v12/core/createFolder.js +0 -34
  117. package/bin/v12/core/parseInput.js +0 -8
  118. package/bin/v12/core/resolveCommand.js +0 -13
  119. package/bin/v12/core/showUsage.js +0 -39
  120. package/bin/v12/start.js +0 -21
  121. package/bin/v12/tasks/actions/EndPointsJs/AlterJsFile/index.js +0 -31
  122. package/bin/v12/tasks/actions/EndPointsJs/AlterJsFile/insertImport.js +0 -15
  123. package/bin/v12/tasks/actions/EndPointsJs/AlterJsFile/insertUsage.js +0 -15
  124. package/bin/v12/tasks/actions/EndPointsJs/index.js +0 -19
  125. package/bin/v12/tasks/actions/EndPointsJs/showUsage.js +0 -38
  126. package/bin/v12/tasks/actions/appJs.js +0 -6
  127. package/bin/v12/tasks/common/SourceEditor.js +0 -66
  128. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/common/readFile.js +0 -8
  129. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/common/writeFile.js +0 -10
  130. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/index.js +0 -9
  131. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/buildImport.js +0 -9
  132. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/checkDuplicate.js +0 -8
  133. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/findInsertIndex.js +0 -10
  134. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateImports/index.js +0 -41
  135. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/buildUseLine.js +0 -11
  136. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/checkDuplicate.js +0 -8
  137. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/findInsertIndex.js +0 -10
  138. package/bin/v12/tasks/tables/AddTableName/steps/UpdateRoutesJs/updateUse/index.js +0 -42
  139. package/bin/v12/tasks/tables/AddTableName/steps/announce.js +0 -9
  140. package/bin/v12/tasks/tables/AddTableName/steps/decideTemplate.js +0 -3
  141. package/bin/v12/tasks/tables/AddTableName/steps/locateDestination.js +0 -6
  142. package/bin/v12/tasks/tables/AddTableName/steps/locateSource.js +0 -13
  143. package/bin/v12/tasks/tables/AddTableName/steps/resolveFolderName.js +0 -20
  144. package/bin/v12/tasks/tables/AddTableName/steps/updateConfig.js +0 -16
  145. package/bin/v12/tasks/tables/AddTableName/steps/updateEndPointsFile.js +0 -30
  146. package/bin/v12/tasks/tables/AddTableName/steps/updateTableName.js +0 -30
  147. package/bin/v12/tasks/tables/AddTableName/template/Config/schema.json +0 -3
  148. package/bin/v12/tasks/tables/AddTableName/template/end-points.js +0 -7
  149. package/bin/v12/tasks/tables/addTableName.js +0 -56
package/bin/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  import getLatestVersion from "./core/getLatestVersion.js";
4
4
  import loadRunner from "./core/loadRunner.js";
@@ -0,0 +1,3 @@
1
+ export const announce = ({ inResolvedFolderName }) => {
2
+ console.log(`[keshavsoft] Project created: ${inResolvedFolderName}`);
3
+ };
@@ -1,7 +1,7 @@
1
1
  import fs from "fs";
2
2
 
3
- export const createFolder = ({ source, destination }) => {
3
+ export const createProject = ({ source, destination }) => {
4
4
  fs.mkdirSync(destination, { recursive: true });
5
-
5
+
6
6
  fs.cpSync(source, destination, { recursive: true });
7
7
  };
@@ -0,0 +1,5 @@
1
+ import path from "path";
2
+
3
+ export const locateDestination = ({ inResolvedFolderName }) => {
4
+ return path.join(process.cwd(), inResolvedFolderName);
5
+ };
@@ -4,10 +4,13 @@ import { fileURLToPath } from "url";
4
4
  const __filename = fileURLToPath(import.meta.url);
5
5
  const __dirname = path.dirname(__filename);
6
6
 
7
+ const sourceVersion = "v1";
8
+
7
9
  export const locateSource = () => {
8
10
  return path.join(
9
11
  __dirname,
10
12
  "..",
11
- "template"
13
+ "template",
14
+ sourceVersion
12
15
  );
13
16
  };
@@ -1,7 +1,7 @@
1
1
  import fs from "fs";
2
2
 
3
- export default function resolveFolderName({ name }) {
4
- const defaultFolerName = "KSTable1";
3
+ export default function resolveFolderName({ name, inType = "basic" }) {
4
+ const defaultFolerName = "Index";
5
5
 
6
6
  // case 1: force new → timestamp
7
7
  if (name === null) {
@@ -10,10 +10,7 @@ export default function resolveFolderName({ name }) {
10
10
 
11
11
  // case 2: user provided → strict
12
12
  if (fs.existsSync(name)) {
13
- return {
14
- KTF: false,
15
- KReason: `Folder already exists : ${name}`
16
- };
13
+ throw new Error(`Folder already exists: ${name}`);
17
14
  };
18
15
 
19
16
  return name;
@@ -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,7 @@
1
+ import { buildHeader } from "./buildHeader.js";
2
+
3
+ const runAfterDomLoad = () => {
4
+ buildHeader();
5
+ };
6
+
7
+ export { runAfterDomLoad };
@@ -0,0 +1,7 @@
1
+ import { runAfterDomLoad } from "./runAfterDomLoad.js";
2
+
3
+ export function startDomContentLoaded() {
4
+ document.addEventListener("DOMContentLoaded", () => {
5
+ runAfterDomLoad();
6
+ });
7
+ }
@@ -0,0 +1,5 @@
1
+ import { startDomContentLoaded } from "./DomContentLoaded/start.js";
2
+
3
+ export function startFormLoad() {
4
+ startDomContentLoaded();
5
+ }
@@ -0,0 +1,7 @@
1
+ import { startFormLoad } from "./FormLoad/start.js";
2
+
3
+ function startApp() {
4
+ startFormLoad();
5
+ };
6
+
7
+ startApp();
@@ -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,7 @@
1
+ import { buildHeader } from "./buildHeader.js";
2
+
3
+ const runAfterDomLoad = () => {
4
+ buildHeader();
5
+ };
6
+
7
+ export { runAfterDomLoad };
@@ -0,0 +1,7 @@
1
+ import { runAfterDomLoad } from "./runAfterDomLoad.js";
2
+
3
+ export function startDomContentLoaded() {
4
+ document.addEventListener("DOMContentLoaded", () => {
5
+ runAfterDomLoad();
6
+ });
7
+ }
@@ -0,0 +1,5 @@
1
+ import { startDomContentLoaded } from "./DomContentLoaded/start.js";
2
+
3
+ export function startFormLoad() {
4
+ startDomContentLoaded();
5
+ }
@@ -0,0 +1,7 @@
1
+ import { startFormLoad } from "./FormLoad/start.js";
2
+
3
+ function startApp() {
4
+ startFormLoad();
5
+ };
6
+
7
+ startApp();
@@ -0,0 +1,22 @@
1
+ import { locateSource } from "./init/steps/locateSource.js";
2
+ import { locateDestination } from "./init/steps/locateDestination.js";
3
+
4
+ import { createProject } from "./init/steps/createProject.js";
5
+ import { announce } from "./init/steps/announce.js";
6
+
7
+ import resolveFolderName from "./init/steps/resolveFolderName.js";
8
+
9
+ export default ({ folderName = "", toPath = process.cwd(), inAnnounce = true }) => {
10
+ const resolvedFolderName = resolveFolderName({
11
+ name: folderName
12
+ });
13
+
14
+ const source = locateSource();
15
+ const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
16
+
17
+ createProject({ source, destination });
18
+
19
+ if (inAnnounce) announce({ inResolvedFolderName: resolvedFolderName });
20
+
21
+ console.log("aaaaaaaaa ", folderName, toPath, resolvedFolderName);
22
+ };
@@ -1,9 +1,9 @@
1
1
  export default function parseInput() {
2
- const [cmd, action] = process.argv.slice(2);
2
+ const [cmd, folderName] = process.argv.slice(2);
3
3
 
4
4
  return {
5
5
  cmd: cmd || null,
6
- action: action || null,
6
+ folderName: folderName || null,
7
7
  toPath: process.cwd()
8
8
  };
9
9
  };
@@ -0,0 +1,10 @@
1
+ import init from "../commands/init.js";
2
+
3
+ // resolveCommand.js
4
+ const map = {
5
+ init
6
+ };
7
+
8
+ export default function resolveCommand(cmd) {
9
+ return map[cmd] || null;
10
+ };
@@ -22,7 +22,7 @@ export default function showUsage(version) {
22
22
  const r = "\x1b[0m";
23
23
 
24
24
  console.log(`
25
- ${c}🚀 KSchema Api Generator v${version}${r}
25
+ ${c}🚀 json-crud-ui v${version}${r}
26
26
 
27
27
  ${y}Usage:${r}
28
28
  ${g}npx @keshavsoft/kschema-api-gen${r} <command> [options]
@@ -1,6 +1,8 @@
1
1
  import parseInput from "./core/parseInput.js";
2
- import resolveCommand from "./core/resolveCommand.js";
3
2
  import showUsage from './core/showUsage.js';
3
+
4
+ import resolveCommand from "./core/resolveCommand.js";
5
+
4
6
  import pkg from '../../package.json' with { type: 'json' };
5
7
 
6
8
  const version = pkg.version;
@@ -8,15 +10,15 @@ const version = pkg.version;
8
10
  const run = async () => {
9
11
  const input = parseInput();
10
12
 
11
- if (!input.cmd) return showUsage(version);
12
-
13
- if (input.cmd === "--help" || input.cmd === "-h" || input.cmd === "help") return showUsage(version);
13
+ if (input.action === "--help" || input.action === "-h" || input.action === "help") return showUsage(version);
14
14
 
15
15
  const command = resolveCommand(input.cmd);
16
16
 
17
17
  if (!command) return (console.log(`Unknown command: ${input.cmd}\n`), showUsage(version));
18
18
 
19
- await command(input);
19
+ await command({
20
+ folderName: input.folderName
21
+ });
20
22
  };
21
23
 
22
24
  export default run;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "json-crud-ui",
3
- "version": "1.1.1",
4
- "description": "working on single js of express",
3
+ "version": "1.1.3",
4
+ "description": "working on ui for our json crud using modules",
5
5
  "keywords": [
6
6
  "cli",
7
7
  "scaffold",
@@ -1,5 +0,0 @@
1
- // bin/v9/commands/exportCommands/endPointsJs.js
2
-
3
- import endPointsJs from "../../tasks/actions/EndPointsJs/index.js";
4
-
5
- export default endPointsJs;
@@ -1,34 +0,0 @@
1
- import fs from "fs";
2
-
3
- export const createFolder = ({ source, destination, checkBeforeCreate = false, isAnnounce = true }) => {
4
- if (checkBeforeCreate) {
5
- return createFolderWithCheck({ source, destination, isAnnounce });
6
- } else {
7
- return createOnly({ source, destination });
8
- };
9
- };
10
-
11
- const createOnly = ({ source, destination }) => {
12
- fs.mkdirSync(destination, { recursive: true });
13
-
14
- fs.cpSync(source, destination, { recursive: true });
15
-
16
- return {
17
- KTF: true
18
- };
19
- };
20
-
21
- const createFolderWithCheck = ({ source, destination, isAnnounce }) => {
22
- if (fs.existsSync(destination)) {
23
- if (isAnnounce) console.log("Folder already exists :", destination);
24
-
25
- return {
26
- KTF: false,
27
- KReason: "Folder already exists"
28
- };
29
- };
30
-
31
- if (isAnnounce) console.log("Folder created :", destination);
32
-
33
- return createOnly({ source, destination });
34
- };
@@ -1,13 +0,0 @@
1
- // import endPointsJs from "../tasks/actions/EndPointsJs/ShowAll/index.js";
2
- import appJs from "../tasks/actions/appJs.js";
3
- import endPointsJs from "../tasks/actions/EndPointsJs/index.js";
4
-
5
- // resolveCommand.js
6
- const map = {
7
- endPointsJs,
8
- appJs
9
- };
10
-
11
- export default function resolveCommand(cmd) {
12
- return map[cmd] || null;
13
- };