@katlux/toolkit 0.1.1-alpha.120 → 0.1.1-alpha.122
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/add-ai-reference.mjs +152 -39
- package/bin/cli.mjs +20 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +14 -11
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +5 -33
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +15 -31
- package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +36 -0
- package/dist/runtime/components/KGantt/KGantt.global.vue +5 -1
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +36 -0
- package/dist/runtime/components/KGantt/KGantt.logic.d.ts +20 -0
- package/dist/runtime/components/KGantt/KGantt.logic.js +16 -0
- package/dist/runtime/composables/useFilterLogic.d.ts +1 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.css +1 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.scss +1 -0
- package/dist/runtime/presets/default/assets/scss/index.css +1 -0
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +4 -4
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +1 -1
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +57 -4
- package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +4 -0
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +16 -2
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +4 -0
- package/dist/runtime/presets/default/components/KGrid/KGrid.vue +1 -0
- package/dist/runtime/presets/default/components/KLayout/KLayout.vue +16 -0
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue +29 -7
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue +1 -0
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +1 -1
- package/package.json +2 -2
package/bin/add-ai-reference.mjs
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* katlux-add-ref
|
|
4
|
-
* Downloads
|
|
5
|
-
*
|
|
4
|
+
* Downloads Katlux AI skill files from the official showcase and installs them
|
|
5
|
+
* into the current project. Safe to re-run at any time to update to the latest.
|
|
6
|
+
*
|
|
7
|
+
* What it does:
|
|
8
|
+
* 1. Downloads .agents/skills/KATLUX_INDEX.md (always overwritten, auto-maintained)
|
|
9
|
+
* 2. Downloads .agents/skills/katlux-[skill]/SKILL.md (always overwritten, auto-maintained)
|
|
10
|
+
* 3. Scaffolds AGENTS.md (created once, never overwritten)
|
|
11
|
+
* 4. Scaffolds .agents/rules/rules.md (created once, never overwritten)
|
|
6
12
|
*
|
|
7
13
|
* Usage:
|
|
8
14
|
* npx @katlux/toolkit katlux-add-ref
|
|
9
15
|
*/
|
|
10
16
|
|
|
11
|
-
import { existsSync, mkdirSync, writeFileSync } from 'fs'
|
|
17
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs'
|
|
12
18
|
import { resolve, join } from 'path'
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
const REFERENCE_URL = 'https://katlux.dev/ai-reference.md'
|
|
20
|
+
const BASE_URL = 'https://katlux.dev/ai-reference'
|
|
16
21
|
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
const
|
|
22
|
+
// Skills to download — script is the only place this list lives on the client side.
|
|
23
|
+
// The server-generated KATLUX_INDEX.md is the canonical skill routing table for agents.
|
|
24
|
+
const SKILLS = [
|
|
25
|
+
'katlux-config',
|
|
26
|
+
'katlux-components',
|
|
27
|
+
'katlux-providers',
|
|
28
|
+
'katlux-presets',
|
|
29
|
+
'katlux-tokens',
|
|
30
|
+
]
|
|
20
31
|
|
|
21
32
|
const RESET = '\x1b[0m'
|
|
22
33
|
const GREEN = '\x1b[32m'
|
|
@@ -30,55 +41,157 @@ function log(color, prefix, message) {
|
|
|
30
41
|
console.log(`${color}${BOLD}${prefix}${RESET} ${message}`)
|
|
31
42
|
}
|
|
32
43
|
|
|
33
|
-
|
|
44
|
+
async function fetchText(url) {
|
|
45
|
+
const response = await fetch(url)
|
|
46
|
+
if (!response.ok) throw new Error(`${response.status} ${response.statusText} — ${url}`)
|
|
47
|
+
return response.text()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ── Start ────────────────────────────────────────────────────────────────────
|
|
34
51
|
console.log()
|
|
35
|
-
log(CYAN, '[katlux-add-ref]', `
|
|
36
|
-
console.log(` ${DIM}${
|
|
52
|
+
log(CYAN, '[katlux-add-ref]', `Downloading Katlux AI skill files...`)
|
|
53
|
+
console.log(` ${DIM}${BASE_URL}${RESET}`)
|
|
37
54
|
console.log()
|
|
38
55
|
|
|
39
|
-
|
|
56
|
+
const projectRoot = process.cwd()
|
|
57
|
+
const agentsDir = resolve(projectRoot, '.agents')
|
|
58
|
+
const skillsDir = resolve(agentsDir, 'skills')
|
|
59
|
+
const rulesDir = resolve(agentsDir, 'rules')
|
|
60
|
+
|
|
61
|
+
// Ensure base directories exist
|
|
62
|
+
if (!existsSync(skillsDir)) mkdirSync(skillsDir, { recursive: true })
|
|
63
|
+
if (!existsSync(rulesDir)) mkdirSync(rulesDir, { recursive: true })
|
|
64
|
+
|
|
65
|
+
// ── 1. Download KATLUX_INDEX.md (always overwrite) ──────────────────────────
|
|
66
|
+
process.stdout.write(` ${DIM}Fetching index...${RESET}`)
|
|
67
|
+
let indexContent
|
|
40
68
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
log(RED, '[katlux-add-ref] ✖', `Server responded with ${response.status} ${response.statusText}`)
|
|
44
|
-
console.log(`\n Make sure the Katlux Showcase is reachable:\n ${REFERENCE_URL}`)
|
|
45
|
-
process.exit(1)
|
|
46
|
-
}
|
|
47
|
-
content = await response.text()
|
|
69
|
+
indexContent = await fetchText(BASE_URL).catch(() => fetchText(`${BASE_URL}/index`))
|
|
70
|
+
process.stdout.write(` ${GREEN}✔${RESET}\n`)
|
|
48
71
|
} catch (err) {
|
|
49
|
-
|
|
72
|
+
process.stdout.write(` ${RED}✖${RESET}\n`)
|
|
73
|
+
log(RED, '[katlux-add-ref] ✖', `Failed to fetch skill index:`)
|
|
50
74
|
console.log(` ${err.message}`)
|
|
51
75
|
console.log(`\n Check your internet connection and try again.`)
|
|
52
76
|
process.exit(1)
|
|
53
77
|
}
|
|
54
78
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
79
|
+
writeFileSync(join(skillsDir, 'KATLUX_INDEX.md'), indexContent, 'utf-8')
|
|
80
|
+
log(GREEN, ' written', '.agents/skills/KATLUX_INDEX.md')
|
|
81
|
+
console.log()
|
|
82
|
+
|
|
83
|
+
// ── 2. Download individual skill files (always overwrite) ────────────────────
|
|
84
|
+
for (const skill of SKILLS) {
|
|
85
|
+
try {
|
|
86
|
+
process.stdout.write(` ${DIM}Fetching ${skill}...${RESET}`)
|
|
87
|
+
const content = await fetchText(`${BASE_URL}/${skill}`)
|
|
88
|
+
process.stdout.write(` ${GREEN}✔${RESET}\n`)
|
|
89
|
+
|
|
90
|
+
const skillDir = join(skillsDir, skill)
|
|
91
|
+
if (!existsSync(skillDir)) mkdirSync(skillDir, { recursive: true })
|
|
92
|
+
writeFileSync(join(skillDir, 'SKILL.md'), content, 'utf-8')
|
|
93
|
+
} catch (err) {
|
|
94
|
+
process.stdout.write(` ${RED}✖${RESET}\n`)
|
|
95
|
+
log(RED, '[katlux-add-ref] ✖', `Failed to fetch ${skill}:`)
|
|
96
|
+
console.log(` ${err.message}`)
|
|
97
|
+
process.exit(1)
|
|
98
|
+
}
|
|
59
99
|
}
|
|
60
100
|
|
|
61
|
-
// ──
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
101
|
+
// ── 3. Scaffold AGENTS.md — created once, never overwritten ─────────────────
|
|
102
|
+
// Intentionally minimal: just two stable references that never need updating.
|
|
103
|
+
// KATLUX_INDEX.md (downloaded above) is what carries the skill routing table.
|
|
104
|
+
console.log()
|
|
105
|
+
const agentsMdPath = resolve(projectRoot, 'AGENTS.md')
|
|
106
|
+
if (!existsSync(agentsMdPath)) {
|
|
107
|
+
writeFileSync(agentsMdPath, `# Agent Context and Guidelines
|
|
108
|
+
|
|
109
|
+
This file serves as the main entry point for AI agents to understand the workspace structure and guidelines.
|
|
110
|
+
|
|
111
|
+
- [Project Rules](.agents/rules/rules.md)
|
|
112
|
+
- [Katlux Skills Index](.agents/skills/KATLUX_INDEX.md)
|
|
113
|
+
`, 'utf-8')
|
|
114
|
+
log(GREEN, ' created', `AGENTS.md ${DIM}(edit this to add project-specific context)${RESET}`)
|
|
115
|
+
} else {
|
|
116
|
+
log(DIM, ' skipped', `AGENTS.md already exists`)
|
|
68
117
|
}
|
|
69
118
|
|
|
70
|
-
// ──
|
|
71
|
-
|
|
72
|
-
|
|
119
|
+
// ── 4. Scaffold .agents/rules/rules.md — created once, never overwritten ────
|
|
120
|
+
// Users add their own project rules here. Katlux standards live in KATLUX_INDEX.md.
|
|
121
|
+
const rulesMdPath = join(rulesDir, 'rules.md')
|
|
122
|
+
if (!existsSync(rulesMdPath)) {
|
|
123
|
+
writeFileSync(rulesMdPath, `# Agent Rules
|
|
124
|
+
|
|
125
|
+
## Project-Specific Rules
|
|
126
|
+
|
|
127
|
+
<!-- Add your own project rules here. -->
|
|
128
|
+
<!-- Example: always use the "users" Pinia store for auth state. -->
|
|
129
|
+
|
|
130
|
+
## Katlux Code Standards
|
|
131
|
+
|
|
132
|
+
1. **Template**: Always use **Pug** (\`lang="pug"\`). Use **Tabs** for indentation.
|
|
133
|
+
2. **Styling**: Use CSS variables (e.g. \`var(--primary-500)\`, \`var(--border-radius-md)\`). Never hardcode colors or sizes.
|
|
134
|
+
3. **Preset Selectors**: Scope CSS rules under \`[data-preset~="preset-name"]\`. Avoid \`!important\`.
|
|
135
|
+
4. **Imports**: Use workspace aliases (e.g. \`#toolkit/composables/...\`). Avoid deep relative imports.
|
|
136
|
+
5. **i18n**: Use \`t('...')\` for all user-facing strings and ARIA labels.
|
|
137
|
+
`, 'utf-8')
|
|
138
|
+
log(GREEN, ' created', `.agents/rules/rules.md ${DIM}(add your project-specific rules here)${RESET}`)
|
|
73
139
|
} else {
|
|
74
|
-
log(
|
|
140
|
+
log(DIM, ' skipped', `.agents/rules/rules.md already exists`)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ── 5. Auto-configure MCP (Model Context Protocol) ───────────────────────────
|
|
144
|
+
// Enables surgical on-demand tool access for Cursor, Antigravity, and VS Code
|
|
145
|
+
// with zero manual JSON configuration required from the developer.
|
|
146
|
+
const localMcpPath = resolve(projectRoot, 'packages/katlux-mcp/bin/katlux-mcp.mjs')
|
|
147
|
+
const isMonorepo = existsSync(localMcpPath)
|
|
148
|
+
|
|
149
|
+
const KATLUX_MCP_SERVER = isMonorepo
|
|
150
|
+
? { command: 'node', args: ['packages/katlux-mcp/bin/katlux-mcp.mjs'] }
|
|
151
|
+
: { command: 'npx', args: ['-y', '@katlux/mcp'] }
|
|
152
|
+
|
|
153
|
+
function updateMcpConfigFile(filePath) {
|
|
154
|
+
let config = {}
|
|
155
|
+
if (existsSync(filePath)) {
|
|
156
|
+
try {
|
|
157
|
+
config = JSON.parse(readFileSync(filePath, 'utf-8'))
|
|
158
|
+
} catch {
|
|
159
|
+
config = {}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!config.mcpServers) config.mcpServers = {}
|
|
163
|
+
config.mcpServers.katlux = KATLUX_MCP_SERVER
|
|
164
|
+
writeFileSync(filePath, JSON.stringify(config, null, 2), 'utf-8')
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// 5a. Antigravity / Agents (.agents/mcp_config.json)
|
|
168
|
+
updateMcpConfigFile(join(agentsDir, 'mcp_config.json'))
|
|
169
|
+
log(GREEN, ' configured', '.agents/mcp_config.json (Antigravity MCP server enabled)')
|
|
170
|
+
|
|
171
|
+
// 5b. Cursor (.cursor/mcp.json)
|
|
172
|
+
const cursorDir = resolve(projectRoot, '.cursor')
|
|
173
|
+
if (existsSync(cursorDir)) {
|
|
174
|
+
updateMcpConfigFile(join(cursorDir, 'mcp.json'))
|
|
175
|
+
log(GREEN, ' configured', '.cursor/mcp.json (Cursor MCP server enabled)')
|
|
75
176
|
}
|
|
177
|
+
|
|
178
|
+
// 5c. VS Code (.vscode/mcp.json)
|
|
179
|
+
const vscodeDir = resolve(projectRoot, '.vscode')
|
|
180
|
+
if (existsSync(vscodeDir)) {
|
|
181
|
+
updateMcpConfigFile(join(vscodeDir, 'mcp.json'))
|
|
182
|
+
log(GREEN, ' configured', '.vscode/mcp.json (VS Code MCP server enabled)')
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ── Done ─────────────────────────────────────────────────────────────────────
|
|
186
|
+
console.log()
|
|
187
|
+
log(GREEN, '[katlux-add-ref] ✔', `Done! ${SKILLS.length} skill files + index installed and MCP server configured.`)
|
|
76
188
|
console.log()
|
|
77
|
-
console.log(` ${CYAN}
|
|
189
|
+
console.log(` ${CYAN}Skills:${RESET} .agents/skills/katlux-*/SKILL.md`)
|
|
190
|
+
console.log(` ${CYAN}Index:${RESET} .agents/skills/KATLUX_INDEX.md ${DIM}(auto-updated each run)${RESET}`)
|
|
191
|
+
console.log(` ${CYAN}MCP:${RESET} @katlux/mcp server ready on stdio`)
|
|
78
192
|
console.log()
|
|
79
|
-
console.log(` ${YELLOW}
|
|
80
|
-
console.log(` point it to this file so it understands the full Katlux component API.`)
|
|
193
|
+
console.log(` ${YELLOW}Next:${RESET} Add your project-specific rules to ${CYAN}.agents/rules/rules.md${RESET}`)
|
|
81
194
|
console.log()
|
|
82
|
-
console.log(` Re-run
|
|
195
|
+
console.log(` Re-run any time to update to the latest version:`)
|
|
83
196
|
console.log(` ${CYAN}npx @katlux/toolkit katlux-add-ref${RESET}`)
|
|
84
197
|
console.log()
|
package/bin/cli.mjs
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
* Supported commands:
|
|
6
6
|
* npx @katlux/toolkit create-preset <preset-name> [--base=<base>]
|
|
7
7
|
* npx @katlux/toolkit katlux-add-ref
|
|
8
|
+
*
|
|
9
|
+
* katlux-add-ref installs 5 focused AI skill files under .agents/skills/katlux-*
|
|
10
|
+
* and scaffolds AGENTS.md + .agents/rules/rules.md if they don't exist.
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
13
|
import { spawn } from 'child_process'
|
|
14
|
+
import { existsSync } from 'fs'
|
|
11
15
|
import { resolve, dirname } from 'path'
|
|
12
16
|
import { fileURLToPath } from 'url'
|
|
13
17
|
|
|
@@ -34,12 +38,17 @@ ${BOLD}Commands:${RESET}
|
|
|
34
38
|
Any preset can be token-only. Base presets leverage cascading inheritance without copying files.
|
|
35
39
|
|
|
36
40
|
${CYAN}katlux-add-ref${RESET}
|
|
37
|
-
Download or update
|
|
41
|
+
Download or update 5 focused Katlux AI skill files into .agents/skills/katlux-*/SKILL.md.
|
|
42
|
+
Also scaffolds AGENTS.md, rules, and auto-configures MCP server for your IDE.
|
|
43
|
+
|
|
44
|
+
${CYAN}mcp${RESET}
|
|
45
|
+
Start the Katlux Model Context Protocol (MCP) server over stdio for AI coding assistants.
|
|
38
46
|
|
|
39
47
|
${BOLD}Examples:${RESET}
|
|
40
48
|
npx @katlux/toolkit create-preset cyber-brand --base=modern
|
|
41
49
|
npx @katlux/toolkit create-preset my-theme
|
|
42
50
|
npx @katlux/toolkit katlux-add-ref
|
|
51
|
+
npx @katlux/toolkit mcp
|
|
43
52
|
`)
|
|
44
53
|
}
|
|
45
54
|
|
|
@@ -57,6 +66,16 @@ if (command === 'create-preset') {
|
|
|
57
66
|
} else if (command === 'katlux-add-ref' || command === 'add-ref') {
|
|
58
67
|
scriptPath = resolve(__dirname, 'add-ai-reference.mjs')
|
|
59
68
|
forwardedArgs = args.slice(1)
|
|
69
|
+
} else if (command === 'mcp') {
|
|
70
|
+
const localMcpBin = resolve(__dirname, '../../katlux-mcp/bin/katlux-mcp.mjs')
|
|
71
|
+
if (existsSync(localMcpBin)) {
|
|
72
|
+
scriptPath = localMcpBin
|
|
73
|
+
forwardedArgs = args.slice(1)
|
|
74
|
+
} else {
|
|
75
|
+
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx'
|
|
76
|
+
const child = spawn(npxCmd, ['-y', '@katlux/mcp', ...args.slice(1)], { stdio: 'inherit' })
|
|
77
|
+
child.on('exit', (code) => process.exit(code ?? 0))
|
|
78
|
+
}
|
|
60
79
|
} else {
|
|
61
80
|
console.log(`${RED}${BOLD}[katlux] ✖${RESET} Unknown command: "${command}"`)
|
|
62
81
|
printHelp()
|
package/dist/module.json
CHANGED
|
@@ -5,20 +5,23 @@ export function getApplicableRows(action, selectedRows, selectAll) {
|
|
|
5
5
|
if (!action.visible) {
|
|
6
6
|
return selectedRows || [];
|
|
7
7
|
}
|
|
8
|
-
if (!selectedRows || selectedRows.length === 0) {
|
|
8
|
+
if (!selectAll && (!selectedRows || selectedRows.length === 0)) {
|
|
9
9
|
return [];
|
|
10
10
|
}
|
|
11
11
|
const isBulkAction = action.isBulk || action.bulk || typeof action.visible === "function" && action.visible.length >= 2;
|
|
12
12
|
if (isBulkAction) {
|
|
13
13
|
try {
|
|
14
|
-
const isVisible = action.visible(selectedRows, selectAll);
|
|
15
|
-
return isVisible ? selectedRows : [];
|
|
14
|
+
const isVisible = action.visible(selectedRows || [], selectAll);
|
|
15
|
+
return isVisible ? selectedRows || [] : [];
|
|
16
16
|
} catch {
|
|
17
|
-
return selectedRows;
|
|
17
|
+
return selectedRows || [];
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
if (selectAll && (!selectedRows || selectedRows.length === 0)) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
20
23
|
let isPerRowPredicate = false;
|
|
21
|
-
if (typeof action.visible === "function") {
|
|
24
|
+
if (typeof action.visible === "function" && selectedRows && selectedRows.length > 0) {
|
|
22
25
|
try {
|
|
23
26
|
const arrayResult = action.visible(selectedRows);
|
|
24
27
|
const singleResult = action.visible(selectedRows[0]);
|
|
@@ -33,7 +36,7 @@ export function getApplicableRows(action, selectedRows, selectAll) {
|
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
if (isPerRowPredicate) {
|
|
36
|
-
return selectedRows.filter((row) => {
|
|
39
|
+
return (selectedRows || []).filter((row) => {
|
|
37
40
|
try {
|
|
38
41
|
return Boolean(action.visible(row));
|
|
39
42
|
} catch {
|
|
@@ -42,10 +45,10 @@ export function getApplicableRows(action, selectedRows, selectAll) {
|
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
try {
|
|
45
|
-
const isVisible = action.visible(selectedRows, selectAll);
|
|
46
|
-
return isVisible ? selectedRows : [];
|
|
48
|
+
const isVisible = action.visible(selectedRows || [], selectAll);
|
|
49
|
+
return isVisible ? selectedRows || [] : [];
|
|
47
50
|
} catch {
|
|
48
|
-
return selectedRows;
|
|
51
|
+
return selectedRows || [];
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
export function useKBulkActionsLogic(props) {
|
|
@@ -54,7 +57,7 @@ export function useKBulkActionsLogic(props) {
|
|
|
54
57
|
const visibleBulkActions = computed(() => {
|
|
55
58
|
return props.bulkActions.filter((action) => {
|
|
56
59
|
if (!action.visible) return true;
|
|
57
|
-
if (!props.selectedRows || props.selectedRows.length === 0) {
|
|
60
|
+
if (!props.selectAll && (!props.selectedRows || props.selectedRows.length === 0)) {
|
|
58
61
|
try {
|
|
59
62
|
return Boolean(action.visible([], props.selectAll));
|
|
60
63
|
} catch {
|
|
@@ -62,7 +65,7 @@ export function useKBulkActionsLogic(props) {
|
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
const applicable = getApplicableRows(action, props.selectedRows, props.selectAll);
|
|
65
|
-
return applicable.length > 0;
|
|
68
|
+
return props.selectAll || applicable.length > 0;
|
|
66
69
|
});
|
|
67
70
|
});
|
|
68
71
|
watch(visibleBulkActions, (actions) => {
|
|
@@ -108,44 +108,16 @@ export function useKDataIteratorLogic(props, emit) {
|
|
|
108
108
|
watch(() => selectAll.value, (newVal) => {
|
|
109
109
|
if (isInternalUpdating || newVal === lastSyncedSelectAll) return;
|
|
110
110
|
lastSyncedSelectAll = newVal;
|
|
111
|
-
|
|
112
|
-
if (newVal === false) {
|
|
113
|
-
const pageIds = new Set(currentRows.map(getRowId));
|
|
114
|
-
selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
|
|
115
|
-
} else {
|
|
116
|
-
const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
|
|
117
|
-
const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
|
|
118
|
-
selectedRows.value = [...selectedRows.value, ...newSelections];
|
|
119
|
-
}
|
|
111
|
+
selectedRows.value = [];
|
|
120
112
|
emit?.("update:selectedRows", selectedRows.value);
|
|
121
113
|
emit?.("update:selectAll", newVal);
|
|
122
114
|
syncToProvider();
|
|
123
115
|
});
|
|
124
|
-
watch(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (selectAll.value) {
|
|
128
|
-
lastSyncedSelectAll = false;
|
|
129
|
-
isInternalUpdating = true;
|
|
130
|
-
selectAll.value = false;
|
|
131
|
-
isInternalUpdating = false;
|
|
132
|
-
emit?.("update:selectAll", false);
|
|
133
|
-
syncToProvider();
|
|
134
|
-
}
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
|
|
138
|
-
const allSelected = currentRows.every((r) => currentSelectedIds.has(getRowId(r)));
|
|
139
|
-
if (selectAll.value !== allSelected) {
|
|
140
|
-
lastSyncedSelectAll = allSelected;
|
|
141
|
-
isInternalUpdating = true;
|
|
142
|
-
selectAll.value = allSelected;
|
|
143
|
-
isInternalUpdating = false;
|
|
144
|
-
emit?.("update:selectAll", allSelected);
|
|
145
|
-
}
|
|
146
|
-
emit?.("update:selectedRows", selectedRows.value);
|
|
116
|
+
watch(() => selectedRows.value, (newVal) => {
|
|
117
|
+
if (isInternalUpdating) return;
|
|
118
|
+
emit?.("update:selectedRows", newVal || []);
|
|
147
119
|
syncToProvider();
|
|
148
|
-
});
|
|
120
|
+
}, { deep: true });
|
|
149
121
|
return {
|
|
150
122
|
selectedRows,
|
|
151
123
|
selectAll,
|
|
@@ -142,44 +142,28 @@ export function useKDatatableLogic(props, emit) {
|
|
|
142
142
|
watch(() => selectAll.value, (newVal) => {
|
|
143
143
|
if (isInternalUpdating || newVal === lastSyncedSelectAll) return;
|
|
144
144
|
lastSyncedSelectAll = newVal;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
if (props.virtualScroll) {
|
|
146
|
+
const currentRows = getTargetRows();
|
|
147
|
+
if (newVal === false) {
|
|
148
|
+
const pageIds = new Set(currentRows.map(getRowId));
|
|
149
|
+
selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
|
|
150
|
+
} else {
|
|
151
|
+
const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
|
|
152
|
+
const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
|
|
153
|
+
selectedRows.value = [...selectedRows.value, ...newSelections];
|
|
154
|
+
}
|
|
149
155
|
} else {
|
|
150
|
-
|
|
151
|
-
const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
|
|
152
|
-
selectedRows.value = [...selectedRows.value, ...newSelections];
|
|
156
|
+
selectedRows.value = [];
|
|
153
157
|
}
|
|
154
158
|
emit?.("update:selectedRows", selectedRows.value);
|
|
155
159
|
emit?.("update:selectAll", newVal);
|
|
156
160
|
syncToProvider();
|
|
157
161
|
});
|
|
158
|
-
watch(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (selectAll.value) {
|
|
162
|
-
lastSyncedSelectAll = false;
|
|
163
|
-
isInternalUpdating = true;
|
|
164
|
-
selectAll.value = false;
|
|
165
|
-
isInternalUpdating = false;
|
|
166
|
-
emit?.("update:selectAll", false);
|
|
167
|
-
syncToProvider();
|
|
168
|
-
}
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const selectedIds = new Set(selectedRows.value.map(getRowId));
|
|
172
|
-
const allCurrentSelected = currentRows.every((r) => selectedIds.has(getRowId(r)));
|
|
173
|
-
if (selectAll.value !== allCurrentSelected) {
|
|
174
|
-
lastSyncedSelectAll = allCurrentSelected;
|
|
175
|
-
isInternalUpdating = true;
|
|
176
|
-
selectAll.value = allCurrentSelected;
|
|
177
|
-
isInternalUpdating = false;
|
|
178
|
-
emit?.("update:selectAll", allCurrentSelected);
|
|
179
|
-
}
|
|
180
|
-
emit?.("update:selectedRows", selectedRows.value);
|
|
162
|
+
watch(() => selectedRows.value, (newVal) => {
|
|
163
|
+
if (isInternalUpdating) return;
|
|
164
|
+
emit?.("update:selectedRows", newVal || []);
|
|
181
165
|
syncToProvider();
|
|
182
|
-
}, {
|
|
166
|
+
}, { deep: true });
|
|
183
167
|
return {
|
|
184
168
|
selectedRows,
|
|
185
169
|
selectAll,
|
|
@@ -67,6 +67,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
67
67
|
type: ObjectConstructor;
|
|
68
68
|
default: () => {};
|
|
69
69
|
};
|
|
70
|
+
virtualScroll: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
itemHeight: {
|
|
75
|
+
type: NumberConstructor;
|
|
76
|
+
default: number;
|
|
77
|
+
};
|
|
78
|
+
viewportHeight: {
|
|
79
|
+
type: NumberConstructor;
|
|
80
|
+
default: number;
|
|
81
|
+
};
|
|
82
|
+
buffer: {
|
|
83
|
+
type: NumberConstructor;
|
|
84
|
+
default: number;
|
|
85
|
+
};
|
|
70
86
|
}>, {
|
|
71
87
|
moveTime: (amount: number) => void;
|
|
72
88
|
zoom: (factor: number) => void;
|
|
@@ -145,6 +161,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
145
161
|
type: ObjectConstructor;
|
|
146
162
|
default: () => {};
|
|
147
163
|
};
|
|
164
|
+
virtualScroll: {
|
|
165
|
+
type: BooleanConstructor;
|
|
166
|
+
default: boolean;
|
|
167
|
+
};
|
|
168
|
+
itemHeight: {
|
|
169
|
+
type: NumberConstructor;
|
|
170
|
+
default: number;
|
|
171
|
+
};
|
|
172
|
+
viewportHeight: {
|
|
173
|
+
type: NumberConstructor;
|
|
174
|
+
default: number;
|
|
175
|
+
};
|
|
176
|
+
buffer: {
|
|
177
|
+
type: NumberConstructor;
|
|
178
|
+
default: number;
|
|
179
|
+
};
|
|
148
180
|
}>> & Readonly<{
|
|
149
181
|
"onUpdate:selectedRows"?: ((...args: any[]) => any) | undefined;
|
|
150
182
|
"onUpdate:selectAll"?: ((...args: any[]) => any) | undefined;
|
|
@@ -153,7 +185,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
153
185
|
"onUpdate:endingPoint"?: ((...args: any[]) => any) | undefined;
|
|
154
186
|
}>, {
|
|
155
187
|
bulkActions: unknown[];
|
|
188
|
+
virtualScroll: boolean;
|
|
189
|
+
itemHeight: number;
|
|
190
|
+
buffer: number;
|
|
156
191
|
rowActions: unknown[];
|
|
192
|
+
viewportHeight: number;
|
|
157
193
|
cellSlots: Record<string, any>;
|
|
158
194
|
headerSlots: Record<string, any>;
|
|
159
195
|
startDate: string | number | Date;
|
|
@@ -58,7 +58,11 @@ const templateProps = computed(() => ({
|
|
|
58
58
|
zoom,
|
|
59
59
|
selectedRows: selectedRows.value,
|
|
60
60
|
selectAll: selectAll.value,
|
|
61
|
-
cellSlots: { ...slots, ...props.cellSlots || {} }
|
|
61
|
+
cellSlots: { ...slots, ...props.cellSlots || {} },
|
|
62
|
+
virtualScroll: props.virtualScroll,
|
|
63
|
+
itemHeight: props.itemHeight,
|
|
64
|
+
viewportHeight: props.viewportHeight,
|
|
65
|
+
buffer: props.buffer
|
|
62
66
|
}));
|
|
63
67
|
</script>
|
|
64
68
|
|
|
@@ -67,6 +67,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
67
67
|
type: ObjectConstructor;
|
|
68
68
|
default: () => {};
|
|
69
69
|
};
|
|
70
|
+
virtualScroll: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
itemHeight: {
|
|
75
|
+
type: NumberConstructor;
|
|
76
|
+
default: number;
|
|
77
|
+
};
|
|
78
|
+
viewportHeight: {
|
|
79
|
+
type: NumberConstructor;
|
|
80
|
+
default: number;
|
|
81
|
+
};
|
|
82
|
+
buffer: {
|
|
83
|
+
type: NumberConstructor;
|
|
84
|
+
default: number;
|
|
85
|
+
};
|
|
70
86
|
}>, {
|
|
71
87
|
moveTime: (amount: number) => void;
|
|
72
88
|
zoom: (factor: number) => void;
|
|
@@ -145,6 +161,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
145
161
|
type: ObjectConstructor;
|
|
146
162
|
default: () => {};
|
|
147
163
|
};
|
|
164
|
+
virtualScroll: {
|
|
165
|
+
type: BooleanConstructor;
|
|
166
|
+
default: boolean;
|
|
167
|
+
};
|
|
168
|
+
itemHeight: {
|
|
169
|
+
type: NumberConstructor;
|
|
170
|
+
default: number;
|
|
171
|
+
};
|
|
172
|
+
viewportHeight: {
|
|
173
|
+
type: NumberConstructor;
|
|
174
|
+
default: number;
|
|
175
|
+
};
|
|
176
|
+
buffer: {
|
|
177
|
+
type: NumberConstructor;
|
|
178
|
+
default: number;
|
|
179
|
+
};
|
|
148
180
|
}>> & Readonly<{
|
|
149
181
|
"onUpdate:selectedRows"?: ((...args: any[]) => any) | undefined;
|
|
150
182
|
"onUpdate:selectAll"?: ((...args: any[]) => any) | undefined;
|
|
@@ -153,7 +185,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
153
185
|
"onUpdate:endingPoint"?: ((...args: any[]) => any) | undefined;
|
|
154
186
|
}>, {
|
|
155
187
|
bulkActions: unknown[];
|
|
188
|
+
virtualScroll: boolean;
|
|
189
|
+
itemHeight: number;
|
|
190
|
+
buffer: number;
|
|
156
191
|
rowActions: unknown[];
|
|
192
|
+
viewportHeight: number;
|
|
157
193
|
cellSlots: Record<string, any>;
|
|
158
194
|
headerSlots: Record<string, any>;
|
|
159
195
|
startDate: string | number | Date;
|
|
@@ -58,6 +58,10 @@ export interface KGanttProps {
|
|
|
58
58
|
taskTypeField?: string;
|
|
59
59
|
/** 'date' (Standard calendar) or 'numeric' (Plain numbers) */
|
|
60
60
|
mode?: 'date' | 'numeric';
|
|
61
|
+
virtualScroll?: boolean;
|
|
62
|
+
itemHeight?: number;
|
|
63
|
+
viewportHeight?: number;
|
|
64
|
+
buffer?: number;
|
|
61
65
|
}
|
|
62
66
|
export declare const KGanttDefaultProps: {
|
|
63
67
|
dataProvider: {
|
|
@@ -128,6 +132,22 @@ export declare const KGanttDefaultProps: {
|
|
|
128
132
|
type: ObjectConstructor;
|
|
129
133
|
default: () => {};
|
|
130
134
|
};
|
|
135
|
+
virtualScroll: {
|
|
136
|
+
type: BooleanConstructor;
|
|
137
|
+
default: boolean;
|
|
138
|
+
};
|
|
139
|
+
itemHeight: {
|
|
140
|
+
type: NumberConstructor;
|
|
141
|
+
default: number;
|
|
142
|
+
};
|
|
143
|
+
viewportHeight: {
|
|
144
|
+
type: NumberConstructor;
|
|
145
|
+
default: number;
|
|
146
|
+
};
|
|
147
|
+
buffer: {
|
|
148
|
+
type: NumberConstructor;
|
|
149
|
+
default: number;
|
|
150
|
+
};
|
|
131
151
|
};
|
|
132
152
|
export declare function useKGanttLogic(props: KGanttProps): {
|
|
133
153
|
globalDateRange: import("vue").ComputedRef<{
|
|
@@ -78,6 +78,22 @@ export const KGanttDefaultProps = {
|
|
|
78
78
|
headerSlots: {
|
|
79
79
|
type: Object,
|
|
80
80
|
default: () => ({})
|
|
81
|
+
},
|
|
82
|
+
virtualScroll: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false
|
|
85
|
+
},
|
|
86
|
+
itemHeight: {
|
|
87
|
+
type: Number,
|
|
88
|
+
default: 40
|
|
89
|
+
},
|
|
90
|
+
viewportHeight: {
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 500
|
|
93
|
+
},
|
|
94
|
+
buffer: {
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 5
|
|
81
97
|
}
|
|
82
98
|
};
|
|
83
99
|
export function useKGanttLogic(props) {
|
|
@@ -171,6 +171,7 @@
|
|
|
171
171
|
--input-focus-border-color: var(--primary-500);
|
|
172
172
|
--input-focus-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
|
|
173
173
|
--input-height: 40px;
|
|
174
|
+
--input-min-width: 140px;
|
|
174
175
|
--input-label-color: var(--font-color-primary);
|
|
175
176
|
--table-border-color: var(--neutral-300);
|
|
176
177
|
--table-header-bg: var(--neutral-200);
|
|
@@ -188,6 +188,7 @@ li {
|
|
|
188
188
|
--input-focus-border-color: var(--primary-500);
|
|
189
189
|
--input-focus-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
|
|
190
190
|
--input-height: 40px;
|
|
191
|
+
--input-min-width: 140px;
|
|
191
192
|
--input-label-color: var(--font-color-primary);
|
|
192
193
|
--table-border-color: var(--neutral-300);
|
|
193
194
|
--table-header-bg: var(--neutral-200);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.k-bulk-actions
|
|
3
3
|
template(v-if="props.bulkActions.length>3")
|
|
4
|
-
KCombobox(:dataProvider="dp" v-model="internalSelected" labelField="label" closeOnSelect :disabled="props.selectedRows.length === 0" :placeholder="t('Select an action')")
|
|
5
|
-
KButton(@click="doAction(internalSelected)" size="small" :disabled="props.selectedRows.length === 0 || internalSelected == undefined") {{ t('Apply') }}
|
|
4
|
+
KCombobox(:dataProvider="dp" v-model="internalSelected" labelField="label" closeOnSelect :disabled="!props.selectAll && props.selectedRows.length === 0" :placeholder="t('Select an action')")
|
|
5
|
+
KButton(@click="doAction(internalSelected)" size="small" :disabled="(!props.selectAll && props.selectedRows.length === 0) || internalSelected == undefined") {{ t('Apply') }}
|
|
6
6
|
template(v-else-if="props.bulkActions.length<=3" v-for="(action, index) in props.bulkActions")
|
|
7
7
|
KTooltip(
|
|
8
8
|
:text="action.label"
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
:type="action.type || 'default'"
|
|
15
15
|
:iconOnly="action.iconOnly || !!action.icon"
|
|
16
16
|
:aria-label="action.label"
|
|
17
|
-
:disabled="props.selectedRows.length === 0"
|
|
17
|
+
:disabled="!props.selectAll && props.selectedRows.length === 0"
|
|
18
18
|
)
|
|
19
19
|
template(#icon v-if="action.icon")
|
|
20
20
|
KIcon(:iconname="action.icon" :width="16" :height="16")
|
|
21
21
|
template(#default v-if="!action.iconOnly && !action.icon") {{action.label}}
|
|
22
|
-
.info {{ t('Selected {count} items').replace('{count}', props.selectedRows.length.toString()) }}
|
|
22
|
+
.info {{ props.selectAll ? t('All items selected') : t('Selected {count} items').replace('{count}', props.selectedRows.length.toString()) }}
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup lang="ts">
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
:class="{ 'selected': isRowSelected(row), 'active-focus': focusedIndex === (props.virtualScroll ? startIndex + index : index), 'alt-row': (props.virtualScroll ? (startIndex + index) % 2 === 1 : index % 2 === 1) }"
|
|
46
46
|
)
|
|
47
47
|
td.check(v-if="props.bulkActions && props.bulkActions.length > 0")
|
|
48
|
-
KCheckbox(:value="row"
|
|
48
|
+
KCheckbox(:model-value="isRowSelected(row)" @update:model-value="toggleRow(row)" :idKey="rowIdKey")
|
|
49
49
|
td(
|
|
50
50
|
v-for="visibleField in visibleFields || props.dataProvider.fields"
|
|
51
51
|
:key="visibleField"
|
|
@@ -168,11 +168,35 @@ const selectedRowIds = computed(() => {
|
|
|
168
168
|
})
|
|
169
169
|
|
|
170
170
|
const isRowSelected = (row: any) => {
|
|
171
|
+
if (selectAll.value) return true
|
|
171
172
|
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
172
173
|
const rowId = row?.[idKey] ?? row?.id ?? row?._id ?? row
|
|
173
174
|
return selectedRowIds.value.has(rowId) || selectedRowIds.value.has(row)
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
const toggleRow = (row: any) => {
|
|
178
|
+
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
179
|
+
const rowId = row?.[idKey] ?? row?.id ?? row?._id ?? row
|
|
180
|
+
if (selectAll.value) {
|
|
181
|
+
selectAll.value = false
|
|
182
|
+
const activeRows = displayRows.value || pageRows.value
|
|
183
|
+
selectedRows.value = activeRows.filter((r: any) => {
|
|
184
|
+
const rId = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
185
|
+
return rId !== rowId && r !== row
|
|
186
|
+
})
|
|
187
|
+
} else {
|
|
188
|
+
const isSelected = isRowSelected(row)
|
|
189
|
+
if (isSelected) {
|
|
190
|
+
selectedRows.value = (selectedRows.value || []).filter((r: any) => {
|
|
191
|
+
const rId = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
192
|
+
return rId !== rowId && r !== row
|
|
193
|
+
})
|
|
194
|
+
} else {
|
|
195
|
+
selectedRows.value = [...(selectedRows.value || []), row]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
176
200
|
const getCellSlot = (fieldName: string) => {
|
|
177
201
|
const slotName = 'cell-' + fieldName
|
|
178
202
|
return props.cellSlots?.[slotName]
|
|
@@ -186,7 +210,11 @@ const getHeaderSlot = (fieldName: string) => {
|
|
|
186
210
|
const getColumnStyle = (field: string) => {
|
|
187
211
|
const w = props.columnWidths?.[field]
|
|
188
212
|
if (!w) return undefined
|
|
189
|
-
|
|
213
|
+
const style: Record<string, string> = { width: w, whiteSpace: 'nowrap' }
|
|
214
|
+
if (w !== '1%' && !w.endsWith('%')) {
|
|
215
|
+
style.minWidth = w
|
|
216
|
+
}
|
|
217
|
+
return style
|
|
190
218
|
}
|
|
191
219
|
|
|
192
220
|
const { pageData, virtualRows, filter: dpFilter, loading: dpLoading, initialLoad: dpInitialLoad } = useDataProvider(props.dataProvider)
|
|
@@ -304,9 +332,13 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
304
332
|
.datatable-container {
|
|
305
333
|
min-height: calc(var(--page-height) * (var(--page-size) + 1));
|
|
306
334
|
position: relative; // Ensure loader overlay is contained
|
|
335
|
+
overflow-x: auto;
|
|
336
|
+
-webkit-overflow-scrolling: touch;
|
|
337
|
+
width: 100%;
|
|
307
338
|
}
|
|
308
339
|
table {
|
|
309
340
|
width: 100%;
|
|
341
|
+
min-width: 100%;
|
|
310
342
|
border-collapse: collapse;
|
|
311
343
|
border: 1px solid var(--table-border-color, #e2e8f0);
|
|
312
344
|
thead {
|
|
@@ -317,7 +349,8 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
317
349
|
color: var(--table-header-color, #334155);
|
|
318
350
|
border-bottom: 1px solid var(--table-border-color, #e2e8f0);
|
|
319
351
|
border-left: 1px solid var(--table-border-color, #e2e8f0);
|
|
320
|
-
padding:
|
|
352
|
+
padding: 6px 8px;
|
|
353
|
+
white-space: nowrap;
|
|
321
354
|
&:first-child {
|
|
322
355
|
border-left: none;
|
|
323
356
|
}
|
|
@@ -340,9 +373,10 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
340
373
|
outline-offset: -2px;
|
|
341
374
|
}
|
|
342
375
|
td {
|
|
343
|
-
padding:
|
|
376
|
+
padding: 6px 8px;
|
|
344
377
|
border-bottom: 1px solid var(--table-border-color, #e2e8f0);
|
|
345
378
|
border-left: 1px solid var(--table-border-color, #e2e8f0);
|
|
379
|
+
white-space: nowrap;
|
|
346
380
|
&:first-child {
|
|
347
381
|
border-left: none;
|
|
348
382
|
}
|
|
@@ -351,6 +385,7 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
351
385
|
text-align: center;
|
|
352
386
|
padding: 20px;
|
|
353
387
|
color: var(--font-color-secondary, #64748b);
|
|
388
|
+
white-space: normal;
|
|
354
389
|
}
|
|
355
390
|
}
|
|
356
391
|
}
|
|
@@ -376,13 +411,31 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
376
411
|
display: flex;
|
|
377
412
|
justify-content: space-between;
|
|
378
413
|
align-items: center;
|
|
414
|
+
gap: var(--spacing-md, 1rem);
|
|
415
|
+
margin-top: var(--spacing-sm, 0.5rem);
|
|
416
|
+
|
|
379
417
|
.pagination {
|
|
380
418
|
flex: 1;
|
|
381
419
|
}
|
|
420
|
+
|
|
421
|
+
@media (max-width: 768px) {
|
|
422
|
+
flex-direction: column;
|
|
423
|
+
align-items: stretch;
|
|
424
|
+
gap: var(--spacing-sm, 0.75rem);
|
|
425
|
+
|
|
426
|
+
.bulk-actions {
|
|
427
|
+
width: 100%;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.pagination {
|
|
431
|
+
width: 100%;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
382
434
|
}
|
|
383
435
|
|
|
384
436
|
&.is-virtual-scroll {
|
|
385
437
|
.datatable-container {
|
|
438
|
+
overflow-x: auto;
|
|
386
439
|
overflow-y: auto;
|
|
387
440
|
max-height: var(--k-datatable-viewport-height, 500px);
|
|
388
441
|
min-height: 0;
|
|
@@ -25,6 +25,10 @@ type __VLS_Props = {
|
|
|
25
25
|
headerSlots?: any;
|
|
26
26
|
endingPoint?: Date | string | number;
|
|
27
27
|
mode?: 'date' | 'numeric';
|
|
28
|
+
virtualScroll?: boolean;
|
|
29
|
+
itemHeight?: number;
|
|
30
|
+
viewportHeight?: number;
|
|
31
|
+
buffer?: number;
|
|
28
32
|
moveTime?: (amount: number) => void;
|
|
29
33
|
zoom?: (factor: number) => void;
|
|
30
34
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KGantt
|
|
2
|
+
.KGantt(:class="{ 'is-virtual-scroll': virtualScroll }")
|
|
3
3
|
.KGantt__scroll-container(
|
|
4
4
|
ref="scrollContainer"
|
|
5
5
|
@wheel="onWheel"
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
:headerSlots="headerSlots"
|
|
17
17
|
:selectedRows="selectedRows"
|
|
18
18
|
:selectAll="selectAll"
|
|
19
|
+
:virtualScroll="virtualScroll"
|
|
20
|
+
:itemHeight="itemHeight"
|
|
21
|
+
:viewportHeight="viewportHeight"
|
|
22
|
+
:buffer="buffer"
|
|
19
23
|
@update:selectedRows="$emit('update:selectedRows', $event)"
|
|
20
24
|
@update:selectAll="$emit('update:selectAll', $event)"
|
|
21
25
|
)
|
|
@@ -88,6 +92,11 @@ const props = defineProps<{
|
|
|
88
92
|
endingPoint?: Date | string | number
|
|
89
93
|
mode?: 'date' | 'numeric'
|
|
90
94
|
|
|
95
|
+
virtualScroll?: boolean
|
|
96
|
+
itemHeight?: number
|
|
97
|
+
viewportHeight?: number
|
|
98
|
+
buffer?: number
|
|
99
|
+
|
|
91
100
|
moveTime?: (amount: number) => void
|
|
92
101
|
zoom?: (factor: number) => void
|
|
93
102
|
}>()
|
|
@@ -328,7 +337,6 @@ onBeforeUnmount(() => {
|
|
|
328
337
|
}
|
|
329
338
|
})
|
|
330
339
|
|
|
331
|
-
// User columns shrink to content; timeline fills remaining space
|
|
332
340
|
const ganttColumns = computed(() => {
|
|
333
341
|
const cols = props.columns.map(col => ({ ...col, width: col.width ?? '1%' }))
|
|
334
342
|
|
|
@@ -371,6 +379,12 @@ const ganttColumns = computed(() => {
|
|
|
371
379
|
}
|
|
372
380
|
}
|
|
373
381
|
|
|
382
|
+
&.is-virtual-scroll {
|
|
383
|
+
.KGantt__scroll-container {
|
|
384
|
+
overflow-y: hidden;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
374
388
|
&__inner {
|
|
375
389
|
min-width: 100%;
|
|
376
390
|
}
|
|
@@ -25,6 +25,10 @@ type __VLS_Props = {
|
|
|
25
25
|
headerSlots?: any;
|
|
26
26
|
endingPoint?: Date | string | number;
|
|
27
27
|
mode?: 'date' | 'numeric';
|
|
28
|
+
virtualScroll?: boolean;
|
|
29
|
+
itemHeight?: number;
|
|
30
|
+
viewportHeight?: number;
|
|
31
|
+
buffer?: number;
|
|
28
32
|
moveTime?: (amount: number) => void;
|
|
29
33
|
zoom?: (factor: number) => void;
|
|
30
34
|
};
|
|
@@ -96,5 +96,21 @@ const layoutClasses = computed(() => [
|
|
|
96
96
|
&__footer {
|
|
97
97
|
grid-area: footer;
|
|
98
98
|
}
|
|
99
|
+
|
|
100
|
+
@media (max-width: 900px) {
|
|
101
|
+
&.has-aside {
|
|
102
|
+
grid-template-columns: 100%;
|
|
103
|
+
grid-template-rows: auto auto minmax(0, 1fr) auto;
|
|
104
|
+
grid-template-areas:
|
|
105
|
+
"header"
|
|
106
|
+
"aside"
|
|
107
|
+
"main"
|
|
108
|
+
"footer";
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&__aside {
|
|
112
|
+
overflow-y: visible;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
99
115
|
}
|
|
100
116
|
</style>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
|
|
3
3
|
ul
|
|
4
|
-
li(v-if="showPrevButton")
|
|
4
|
+
li.nav-prev(v-if="showPrevButton")
|
|
5
5
|
KButton(@click="goToPrev" :href="getPageHref(currentPage - 1)" size="small" variant="outline" :aria-label="t('Previous Page')") ‹
|
|
6
6
|
|
|
7
|
-
li(v-if="showFirstEllipsis")
|
|
7
|
+
li.nav-first(v-if="showFirstEllipsis")
|
|
8
8
|
KButton(@click="goToFirst" :href="getPageHref(1)" size="small" variant="outline" :aria-label="t('Go to Page 1')") 1
|
|
9
9
|
|
|
10
|
-
li(v-if="showFirstEllipsis")
|
|
10
|
+
li.nav-ellipsis.first-ellipsis(v-if="showFirstEllipsis")
|
|
11
11
|
span.ellipsis ...
|
|
12
12
|
|
|
13
|
-
li(v-for="item in visiblePages" :key="item")
|
|
13
|
+
li.nav-page(v-for="item in visiblePages" :key="item" :class="{ 'is-active': item === currentPage }")
|
|
14
14
|
KButton(
|
|
15
15
|
@click="pageClicked(item)"
|
|
16
16
|
:href="getPageHref(item)"
|
|
@@ -20,13 +20,13 @@ nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
|
|
|
20
20
|
:aria-label="t('Page') + ' ' + item"
|
|
21
21
|
) {{item}}
|
|
22
22
|
|
|
23
|
-
li(v-if="showLastEllipsis")
|
|
23
|
+
li.nav-ellipsis.last-ellipsis(v-if="showLastEllipsis")
|
|
24
24
|
span.ellipsis ...
|
|
25
25
|
|
|
26
|
-
li(v-if="showLastEllipsis")
|
|
26
|
+
li.nav-last(v-if="showLastEllipsis")
|
|
27
27
|
KButton(@click="goToLast" :href="getPageHref(totalPages)" size="small" variant="outline" :aria-label="t('Go to Page') + ' ' + totalPages") {{totalPages}}
|
|
28
28
|
|
|
29
|
-
li(v-if="showNextButton")
|
|
29
|
+
li.nav-next(v-if="showNextButton")
|
|
30
30
|
KButton(@click="goToNext" :href="getPageHref(currentPage + 1)" size="small" variant="outline" :aria-label="t('Next Page')") ›
|
|
31
31
|
</template>
|
|
32
32
|
|
|
@@ -79,5 +79,27 @@ const props = defineProps<{
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
@media (max-width: 640px) {
|
|
84
|
+
text-align: center;
|
|
85
|
+
ul {
|
|
86
|
+
justify-content: center;
|
|
87
|
+
gap: 4px;
|
|
88
|
+
|
|
89
|
+
li .ellipsis {
|
|
90
|
+
padding: 4px 6px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media (max-width: 480px) {
|
|
96
|
+
ul {
|
|
97
|
+
li.nav-first,
|
|
98
|
+
li.nav-last,
|
|
99
|
+
li.nav-ellipsis {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
82
104
|
}
|
|
83
105
|
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katlux/toolkit",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.122",
|
|
4
4
|
"description": "Core UI toolkit and utilities for the Katlux ecosystem",
|
|
5
5
|
"author": "Katlux",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"./dist/runtime/presets/*": "./dist/runtime/presets/*"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@katlux/providers": "^0.1.1-alpha.
|
|
44
|
+
"@katlux/providers": "^0.1.1-alpha.109",
|
|
45
45
|
"@nuxt/kit": "^3.12.0",
|
|
46
46
|
"@nuxtjs/i18n": "^10.4.0",
|
|
47
47
|
"pug": "^3.0.0",
|