tailwind-header-dom 3.4.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/LICENSE +21 -0
- package/README.md +61 -0
- package/bin/cli.js +12 -0
- package/bin/core/getLatestVersion.js +13 -0
- package/bin/core/loadRunner.js +9 -0
- package/bin/header/v2/commands/header/steps/announce.js +3 -0
- package/bin/header/v2/commands/header/steps/checks.js +21 -0
- package/bin/header/v2/commands/header/steps/createProject.js +7 -0
- package/bin/header/v2/commands/header/steps/getLatestVersion.js +25 -0
- package/bin/header/v2/commands/header/steps/locateDestination.js +5 -0
- package/bin/header/v2/commands/header/steps/locateSource copy.js +32 -0
- package/bin/header/v2/commands/header/steps/locateSource.js +19 -0
- package/bin/header/v2/commands/header/steps/resolveFolderName.js +15 -0
- package/bin/header/v2/commands/header/template/v2/BuildMenuItem/buildMenuItem.js +49 -0
- package/bin/header/v2/commands/header/template/v2/BuildMenuItem/callKSTable.js +7 -0
- package/bin/header/v2/commands/header/template/v2/BuildMenuItem/getDefaultKSTableConfig.js +80 -0
- package/bin/header/v2/commands/header/template/v2/BuildMenuItem/getKSTableConfig.js +17 -0
- package/bin/header/v2/commands/header/template/v2/BuildMenuItem/orchestrateMenuClick.js +34 -0
- package/bin/header/v2/commands/header/template/v2/BuildNav/buildBrand.js +14 -0
- package/bin/header/v2/commands/header/template/v2/BuildNav/buildHamburger.js +20 -0
- package/bin/header/v2/commands/header/template/v2/BuildNav/buildMenu.js +14 -0
- package/bin/header/v2/commands/header/template/v2/BuildNav/buildNav.js +31 -0
- package/bin/header/v2/commands/header/template/v2/BuildNav/buildWrapper.js +29 -0
- package/bin/header/v2/commands/header/template/v2/buildNav.js +29 -0
- package/bin/header/v2/commands/header/template/v2/createAnchor.js +15 -0
- package/bin/header/v2/commands/header/template/v2/createIcon.js +19 -0
- package/bin/header/v2/commands/header/template/v2/createLabel.js +9 -0
- package/bin/header/v2/commands/header/template/v2/createLi.js +5 -0
- package/bin/header/v2/commands/header/template/v2/initHeader.js +49 -0
- package/bin/header/v2/commands/header/template/v3/BuildMenuItem/buildMenuItem.js +49 -0
- package/bin/header/v2/commands/header/template/v3/BuildMenuItem/callKSTable.js +7 -0
- package/bin/header/v2/commands/header/template/v3/BuildMenuItem/getDefaultKSTableConfig.js +80 -0
- package/bin/header/v2/commands/header/template/v3/BuildMenuItem/getKSTableConfig.js +17 -0
- package/bin/header/v2/commands/header/template/v3/BuildMenuItem/orchestrateMenuClick.js +34 -0
- package/bin/header/v2/commands/header/template/v3/BuildNav/buildBrand.js +14 -0
- package/bin/header/v2/commands/header/template/v3/BuildNav/buildHamburger.js +20 -0
- package/bin/header/v2/commands/header/template/v3/BuildNav/buildMenu.js +14 -0
- package/bin/header/v2/commands/header/template/v3/BuildNav/buildNav.js +31 -0
- package/bin/header/v2/commands/header/template/v3/BuildNav/buildWrapper.js +29 -0
- package/bin/header/v2/commands/header/template/v3/buildNav.js +29 -0
- package/bin/header/v2/commands/header/template/v3/createAnchor.js +15 -0
- package/bin/header/v2/commands/header/template/v3/createIcon.js +19 -0
- package/bin/header/v2/commands/header/template/v3/createLabel.js +9 -0
- package/bin/header/v2/commands/header/template/v3/createLi.js +5 -0
- package/bin/header/v2/commands/header/template/v3/initHeader.js +49 -0
- package/bin/header/v2/commands/header.js +74 -0
- package/bin/header/v2/core/parseInput.js +9 -0
- package/bin/header/v2/core/resolveCommand.js +16 -0
- package/bin/header/v2/core/showUsage.js +49 -0
- package/bin/header/v2/start.js +24 -0
- package/bin/header/v3/commands/header/steps/announce.js +3 -0
- package/bin/header/v3/commands/header/steps/checks.js +21 -0
- package/bin/header/v3/commands/header/steps/createProject.js +7 -0
- package/bin/header/v3/commands/header/steps/getLatestVersion.js +25 -0
- package/bin/header/v3/commands/header/steps/locateDestination.js +5 -0
- package/bin/header/v3/commands/header/steps/locateSource copy.js +32 -0
- package/bin/header/v3/commands/header/steps/locateSource.js +19 -0
- package/bin/header/v3/commands/header/steps/resolveFolderName.js +15 -0
- package/bin/header/v3/commands/header/template/v2/BuildMenuItem/buildMenuItem.js +49 -0
- package/bin/header/v3/commands/header/template/v2/BuildMenuItem/callKSTable.js +7 -0
- package/bin/header/v3/commands/header/template/v2/BuildMenuItem/getDefaultKSTableConfig.js +80 -0
- package/bin/header/v3/commands/header/template/v2/BuildMenuItem/getKSTableConfig.js +17 -0
- package/bin/header/v3/commands/header/template/v2/BuildMenuItem/orchestrateMenuClick.js +34 -0
- package/bin/header/v3/commands/header/template/v2/BuildNav/buildBrand.js +14 -0
- package/bin/header/v3/commands/header/template/v2/BuildNav/buildHamburger.js +20 -0
- package/bin/header/v3/commands/header/template/v2/BuildNav/buildMenu.js +14 -0
- package/bin/header/v3/commands/header/template/v2/BuildNav/buildNav.js +31 -0
- package/bin/header/v3/commands/header/template/v2/BuildNav/buildWrapper.js +29 -0
- package/bin/header/v3/commands/header/template/v2/buildNav.js +29 -0
- package/bin/header/v3/commands/header/template/v2/createAnchor.js +15 -0
- package/bin/header/v3/commands/header/template/v2/createIcon.js +19 -0
- package/bin/header/v3/commands/header/template/v2/createLabel.js +9 -0
- package/bin/header/v3/commands/header/template/v2/createLi.js +5 -0
- package/bin/header/v3/commands/header/template/v2/initHeader.js +49 -0
- package/bin/header/v3/commands/header/template/v3/BuildMenuItem/buildMenuItem.js +49 -0
- package/bin/header/v3/commands/header/template/v3/BuildMenuItem/callKSTable.js +7 -0
- package/bin/header/v3/commands/header/template/v3/BuildMenuItem/getDefaultKSTableConfig.js +80 -0
- package/bin/header/v3/commands/header/template/v3/BuildMenuItem/getKSTableConfig.js +17 -0
- package/bin/header/v3/commands/header/template/v3/BuildMenuItem/orchestrateMenuClick.js +34 -0
- package/bin/header/v3/commands/header/template/v3/BuildNav/buildBrand.js +14 -0
- package/bin/header/v3/commands/header/template/v3/BuildNav/buildHamburger.js +20 -0
- package/bin/header/v3/commands/header/template/v3/BuildNav/buildMenu.js +14 -0
- package/bin/header/v3/commands/header/template/v3/BuildNav/buildNav.js +31 -0
- package/bin/header/v3/commands/header/template/v3/BuildNav/buildWrapper.js +29 -0
- package/bin/header/v3/commands/header/template/v3/buildNav.js +29 -0
- package/bin/header/v3/commands/header/template/v3/createAnchor.js +15 -0
- package/bin/header/v3/commands/header/template/v3/createIcon.js +19 -0
- package/bin/header/v3/commands/header/template/v3/createLabel.js +9 -0
- package/bin/header/v3/commands/header/template/v3/createLi.js +5 -0
- package/bin/header/v3/commands/header/template/v3/initHeader.js +49 -0
- package/bin/header/v3/commands/header/template/v4/BuildMenuItem/buildMenuItem.js +47 -0
- package/bin/header/v3/commands/header/template/v4/BuildMenuItem/callKSTable.js +7 -0
- package/bin/header/v3/commands/header/template/v4/BuildMenuItem/getDefaultKSTableConfig.js +80 -0
- package/bin/header/v3/commands/header/template/v4/BuildMenuItem/getKSTableConfig.js +17 -0
- package/bin/header/v3/commands/header/template/v4/BuildMenuItem/orchestrateMenuClick.js +34 -0
- package/bin/header/v3/commands/header/template/v4/BuildNav/buildBrand.js +14 -0
- package/bin/header/v3/commands/header/template/v4/BuildNav/buildHamburger.js +20 -0
- package/bin/header/v3/commands/header/template/v4/BuildNav/buildMenu.js +14 -0
- package/bin/header/v3/commands/header/template/v4/BuildNav/buildNav.js +31 -0
- package/bin/header/v3/commands/header/template/v4/BuildNav/buildWrapper.js +29 -0
- package/bin/header/v3/commands/header/template/v4/buildNav.js +29 -0
- package/bin/header/v3/commands/header/template/v4/createAnchor.js +15 -0
- package/bin/header/v3/commands/header/template/v4/createIcon.js +19 -0
- package/bin/header/v3/commands/header/template/v4/createLabel.js +9 -0
- package/bin/header/v3/commands/header/template/v4/createLi.js +5 -0
- package/bin/header/v3/commands/header/template/v4/icons.js +20 -0
- package/bin/header/v3/commands/header/template/v4/initHeader.js +50 -0
- package/bin/header/v3/commands/header/template/v4/svg/icons.json +6 -0
- package/bin/header/v3/commands/header/template/v4/svg/search.svg +3 -0
- package/bin/header/v3/commands/header/template/v4/svg/show.svg +3 -0
- package/bin/header/v3/commands/header.js +74 -0
- package/bin/header/v3/core/parseInput.js +9 -0
- package/bin/header/v3/core/resolveCommand.js +16 -0
- package/bin/header/v3/core/showUsage.js +49 -0
- package/bin/header/v3/start.js +24 -0
- package/bin/v5/commands/header/steps/announce.js +3 -0
- package/bin/v5/commands/header/steps/checks.js +21 -0
- package/bin/v5/commands/header/steps/createProject.js +7 -0
- package/bin/v5/commands/header/steps/getLatestVersion.js +25 -0
- package/bin/v5/commands/header/steps/locateDestination.js +5 -0
- package/bin/v5/commands/header/steps/locateSource copy.js +32 -0
- package/bin/v5/commands/header/steps/locateSource.js +19 -0
- package/bin/v5/commands/header/steps/resolveFolderName.js +15 -0
- package/bin/v5/commands/header/template/v4/BuildMenuItem/buildMenuItem.js +49 -0
- package/bin/v5/commands/header/template/v4/BuildMenuItem/callKSTable.js +7 -0
- package/bin/v5/commands/header/template/v4/BuildMenuItem/getDefaultKSTableConfig.js +80 -0
- package/bin/v5/commands/header/template/v4/BuildMenuItem/getKSTableConfig.js +17 -0
- package/bin/v5/commands/header/template/v4/BuildMenuItem/orchestrateMenuClick.js +34 -0
- package/bin/v5/commands/header/template/v4/BuildNav/buildBrand.js +14 -0
- package/bin/v5/commands/header/template/v4/BuildNav/buildHamburger.js +20 -0
- package/bin/v5/commands/header/template/v4/BuildNav/buildMenu.js +14 -0
- package/bin/v5/commands/header/template/v4/BuildNav/buildNav.js +31 -0
- package/bin/v5/commands/header/template/v4/BuildNav/buildWrapper.js +29 -0
- package/bin/v5/commands/header/template/v4/buildNav.js +29 -0
- package/bin/v5/commands/header/template/v4/createAnchor.js +15 -0
- package/bin/v5/commands/header/template/v4/createIcon.js +19 -0
- package/bin/v5/commands/header/template/v4/createLabel.js +9 -0
- package/bin/v5/commands/header/template/v4/createLi.js +5 -0
- package/bin/v5/commands/header/template/v4/initHeader.js +49 -0
- package/bin/v5/commands/header.js +74 -0
- package/bin/v5/core/parseInput.js +9 -0
- package/bin/v5/core/resolveCommand.js +16 -0
- package/bin/v5/core/showUsage.js +46 -0
- package/bin/v5/core/showUsageV1.js +49 -0
- package/bin/v5/start.js +24 -0
- package/index.js +8 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KeshavSoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to do so, subject to the
|
|
10
|
+
following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# tailwind-todo
|
|
2
|
+
|
|
3
|
+
CLI to scaffold Tailwind based starter projects quickly.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g tailwind-todo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx tailwind-todo
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
tailwind-todo
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- Tailwind starter setup
|
|
26
|
+
- Boilerplate generation
|
|
27
|
+
- CLI based workflow
|
|
28
|
+
- Fast project scaffolding
|
|
29
|
+
- Zero dependency
|
|
30
|
+
- Simple folder structure
|
|
31
|
+
|
|
32
|
+
## Generated Structure
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Project
|
|
36
|
+
├── Public
|
|
37
|
+
├── Config
|
|
38
|
+
├── index.html
|
|
39
|
+
├── app.js
|
|
40
|
+
└── package.json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
tailwind-todo
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Select template and project gets created automatically.
|
|
50
|
+
|
|
51
|
+
## Keywords
|
|
52
|
+
|
|
53
|
+
tailwind, cli, scaffold, boilerplate, starter, template
|
|
54
|
+
|
|
55
|
+
## Author
|
|
56
|
+
|
|
57
|
+
KeshavSoft
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import getLatestVersion from "./core/getLatestVersion.js";
|
|
4
|
+
import loadRunner from "./core/loadRunner.js";
|
|
5
|
+
|
|
6
|
+
const run = async () => {
|
|
7
|
+
const version = getLatestVersion();
|
|
8
|
+
const runner = await loadRunner(version);
|
|
9
|
+
await runner();
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
run();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
export default function getLatestVersion() {
|
|
8
|
+
const versions = fs.readdirSync(path.join(__dirname, ".."))
|
|
9
|
+
.filter(n => /^v\d+$/.test(n))
|
|
10
|
+
.sort((a, b) => parseInt(a.slice(1)) - parseInt(b.slice(1)));
|
|
11
|
+
|
|
12
|
+
return versions.at(-1);
|
|
13
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
const validate = ({ toPath, inFolderName, inShowLog }) => {
|
|
5
|
+
const fullPath = path.join(toPath, inFolderName);
|
|
6
|
+
|
|
7
|
+
if (!fs.existsSync(fullPath)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const files = fs.readdirSync(fullPath);
|
|
12
|
+
|
|
13
|
+
if (files.length > 0) {
|
|
14
|
+
console.log("Folder should be empty");
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default validate;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const templatePath = path.join(
|
|
10
|
+
__dirname,
|
|
11
|
+
"..",
|
|
12
|
+
"template"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const versions = fs
|
|
16
|
+
.readdirSync(templatePath)
|
|
17
|
+
.filter(item => item.startsWith("v"));
|
|
18
|
+
|
|
19
|
+
const highestVersion =
|
|
20
|
+
versions.sort().at(-1);
|
|
21
|
+
|
|
22
|
+
const sourceVersion =
|
|
23
|
+
highestVersion;
|
|
24
|
+
|
|
25
|
+
export default sourceVersion;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
const templatePath = path.join(
|
|
10
|
+
__dirname,
|
|
11
|
+
"..",
|
|
12
|
+
"template"
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const versions = fs
|
|
16
|
+
.readdirSync(templatePath)
|
|
17
|
+
.filter(item => item.startsWith("v"));
|
|
18
|
+
|
|
19
|
+
const highestVersion =
|
|
20
|
+
versions.sort().at(-1);
|
|
21
|
+
|
|
22
|
+
const sourceVersion =
|
|
23
|
+
highestVersion;
|
|
24
|
+
|
|
25
|
+
export const locateSource = () => {
|
|
26
|
+
return path.join(
|
|
27
|
+
__dirname,
|
|
28
|
+
"..",
|
|
29
|
+
"template",
|
|
30
|
+
sourceVersion
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
|
|
3
|
+
import sourceVersion from "./getLatestVersion.js";
|
|
4
|
+
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
export const locateSource = () => {
|
|
13
|
+
return path.join(
|
|
14
|
+
__dirname,
|
|
15
|
+
"..",
|
|
16
|
+
"template",
|
|
17
|
+
sourceVersion
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
export default function resolveFolderName({ name, defaultFolerName = "headerV1" }) {
|
|
4
|
+
// case 1: force new → timestamp
|
|
5
|
+
if (name === null) {
|
|
6
|
+
name = defaultFolerName;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// case 2: user provided → strict
|
|
10
|
+
if (fs.existsSync(name)) {
|
|
11
|
+
throw new Error(`Folder already exists: ${name}`);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return name;
|
|
15
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
}) => {
|
|
16
|
+
const li = createLi(inClasses.liClass);
|
|
17
|
+
|
|
18
|
+
const a = createAnchor({
|
|
19
|
+
inHtmlId,
|
|
20
|
+
inHref,
|
|
21
|
+
cls: inClasses.aClass,
|
|
22
|
+
inTableName
|
|
23
|
+
});
|
|
24
|
+
// debugger;
|
|
25
|
+
const span = createLabel({
|
|
26
|
+
inTextToShow: inTextToShow,
|
|
27
|
+
inClassName: inClasses.spanClass
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const svg = createIcon({
|
|
31
|
+
inClassName: inClasses.svgClass,
|
|
32
|
+
inIconPaths
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (onClick) {
|
|
36
|
+
a.addEventListener(
|
|
37
|
+
"click",
|
|
38
|
+
orchestrateMenuClick({
|
|
39
|
+
onClick
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
a.append(svg, span);
|
|
45
|
+
|
|
46
|
+
li.appendChild(a);
|
|
47
|
+
|
|
48
|
+
return li;
|
|
49
|
+
};
|
|
@@ -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 = () => {
|
|
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`;
|
|
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 = {}) => {
|
|
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()
|
|
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,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,15 @@
|
|
|
1
|
+
export const createAnchor = ({
|
|
2
|
+
inHtmlId = "", inHref = "#", cls = "", inTableName = ""
|
|
3
|
+
}) => {
|
|
4
|
+
const a = document.createElement("a");
|
|
5
|
+
|
|
6
|
+
a.id = inHtmlId;
|
|
7
|
+
a.href = inHref;
|
|
8
|
+
a.className = cls;
|
|
9
|
+
|
|
10
|
+
if (inTableName) {
|
|
11
|
+
a.dataset.tableName = inTableName
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return a;
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const createIcon = ({
|
|
2
|
+
inIconPaths = [],
|
|
3
|
+
inClassName = ""
|
|
4
|
+
}) => {
|
|
5
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
6
|
+
|
|
7
|
+
svg.setAttribute("class", inClassName);
|
|
8
|
+
svg.setAttribute("fill", "none");
|
|
9
|
+
svg.setAttribute("stroke", "currentColor");
|
|
10
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
11
|
+
|
|
12
|
+
inIconPaths.forEach(d => {
|
|
13
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
14
|
+
path.setAttribute("d", d);
|
|
15
|
+
svg.appendChild(path);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return svg;
|
|
19
|
+
};
|