@svadmin/lite 0.7.0 → 0.8.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/README.md +18 -5
- package/dist/components/LiteActivityFeed.svelte +98 -0
- package/dist/components/LiteActivityFeed.svelte.d.ts +19 -0
- package/dist/components/LiteApprovalActionCard.svelte +75 -0
- package/dist/components/LiteApprovalActionCard.svelte.d.ts +10 -0
- package/dist/components/LiteCanvasAnnotation.svelte +136 -0
- package/dist/components/LiteCanvasAnnotation.svelte.d.ts +16 -0
- package/dist/components/LiteColumnHeaderFilter.svelte +38 -0
- package/dist/components/LiteColumnHeaderFilter.svelte.d.ts +8 -0
- package/dist/components/LiteColumnSettings.svelte +82 -0
- package/dist/components/LiteColumnSettings.svelte.d.ts +15 -0
- package/dist/components/LiteDecisionTable.svelte +178 -0
- package/dist/components/LiteDecisionTable.svelte.d.ts +21 -0
- package/dist/components/LiteDraggableRowTable.svelte +70 -0
- package/dist/components/LiteDraggableRowTable.svelte.d.ts +14 -0
- package/dist/components/LiteDrawerForm.svelte +85 -0
- package/dist/components/LiteDrawerForm.svelte.d.ts +13 -0
- package/dist/components/LiteEditableTable.svelte +84 -0
- package/dist/components/LiteEditableTable.svelte.d.ts +19 -0
- package/dist/components/LiteGanttChart.svelte +144 -0
- package/dist/components/LiteGanttChart.svelte.d.ts +17 -0
- package/dist/components/LiteImageCropper.svelte +81 -0
- package/dist/components/LiteImageCropper.svelte.d.ts +9 -0
- package/dist/components/LiteImportWizard.svelte +99 -0
- package/dist/components/LiteImportWizard.svelte.d.ts +11 -0
- package/dist/components/LiteJsonSchemaForm.svelte +102 -0
- package/dist/components/LiteJsonSchemaForm.svelte.d.ts +10 -0
- package/dist/components/LiteKanbanBoard.svelte +169 -0
- package/dist/components/LiteKanbanBoard.svelte.d.ts +21 -0
- package/dist/components/LiteMasterDetailView.svelte +113 -0
- package/dist/components/LiteMasterDetailView.svelte.d.ts +11 -0
- package/dist/components/LiteMediaLibraryModal.svelte +110 -0
- package/dist/components/LiteMediaLibraryModal.svelte.d.ts +17 -0
- package/dist/components/LiteMentionsInput.svelte +98 -0
- package/dist/components/LiteMentionsInput.svelte.d.ts +19 -0
- package/dist/components/LiteModalForm.svelte +84 -0
- package/dist/components/LiteModalForm.svelte.d.ts +13 -0
- package/dist/components/LiteMultiTabKeepAlive.svelte +79 -0
- package/dist/components/LiteMultiTabKeepAlive.svelte.d.ts +15 -0
- package/dist/components/LiteOfflineSyncBanner.svelte +75 -0
- package/dist/components/LiteOfflineSyncBanner.svelte.d.ts +15 -0
- package/dist/components/LitePdfDocumentViewer.svelte +138 -0
- package/dist/components/LitePdfDocumentViewer.svelte.d.ts +17 -0
- package/dist/components/LitePivotTable.svelte +163 -0
- package/dist/components/LitePivotTable.svelte.d.ts +15 -0
- package/dist/components/LitePresenceAvatarGroup.svelte +52 -0
- package/dist/components/LitePresenceAvatarGroup.svelte.d.ts +12 -0
- package/dist/components/LitePrintableBill.svelte +119 -0
- package/dist/components/LitePrintableBill.svelte.d.ts +19 -0
- package/dist/components/LiteSensitiveDataMask.svelte +35 -0
- package/dist/components/LiteSensitiveDataMask.svelte.d.ts +7 -0
- package/dist/components/LiteSignaturePad.svelte +99 -0
- package/dist/components/LiteSignaturePad.svelte.d.ts +11 -0
- package/dist/components/LiteSplitPaneLayout.svelte +66 -0
- package/dist/components/LiteSplitPaneLayout.svelte.d.ts +9 -0
- package/dist/components/LiteSpreadsheetView.svelte +148 -0
- package/dist/components/LiteSpreadsheetView.svelte.d.ts +16 -0
- package/dist/components/LiteStepForm.svelte +144 -0
- package/dist/components/LiteStepForm.svelte.d.ts +18 -0
- package/dist/components/LiteTableSummary.svelte +93 -0
- package/dist/components/LiteTableSummary.svelte.d.ts +17 -0
- package/dist/components/LiteTreeTable.svelte +85 -0
- package/dist/components/LiteTreeTable.svelte.d.ts +13 -0
- package/dist/components/LiteVersionDiffViewer.svelte +129 -0
- package/dist/components/LiteVersionDiffViewer.svelte.d.ts +10 -0
- package/dist/components/LiteVirtualTable.svelte +52 -0
- package/dist/components/LiteVirtualTable.svelte.d.ts +14 -0
- package/dist/components/LiteWatermark.svelte +35 -0
- package/dist/components/LiteWatermark.svelte.d.ts +11 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +34 -0
- package/package.json +2 -2
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface DecisionColumn {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
type: 'condition' | 'action';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DecisionRule {
|
|
9
|
+
id: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
values: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
title?: string;
|
|
16
|
+
columns?: DecisionColumn[];
|
|
17
|
+
rules?: DecisionRule[];
|
|
18
|
+
hitPolicy?: string;
|
|
19
|
+
formAction?: string;
|
|
20
|
+
class?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let {
|
|
24
|
+
title = 'Decision Table Matrix',
|
|
25
|
+
columns = [
|
|
26
|
+
{ key: 'tier', label: 'Tier', type: 'condition' },
|
|
27
|
+
{ key: 'discount', label: 'Discount', type: 'action' },
|
|
28
|
+
],
|
|
29
|
+
rules = [
|
|
30
|
+
{ id: 'r1', description: 'VIP', values: { tier: 'VIP', discount: '20%' } },
|
|
31
|
+
{ id: 'r2', description: 'Standard', values: { tier: 'Standard', discount: '10%' } },
|
|
32
|
+
],
|
|
33
|
+
hitPolicy = 'FIRST',
|
|
34
|
+
formAction = '',
|
|
35
|
+
class: className = '',
|
|
36
|
+
}: Props = $props();
|
|
37
|
+
|
|
38
|
+
const conditionCols = $derived(columns.filter((c) => c.type === 'condition'));
|
|
39
|
+
const actionCols = $derived(columns.filter((c) => c.type === 'action'));
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<div class="sv-lite-decision-container {className}">
|
|
43
|
+
<div class="sv-lite-decision-header">
|
|
44
|
+
<strong>{title}</strong>
|
|
45
|
+
<span class="sv-lite-hit-policy">[Policy: {hitPolicy}]</span>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<form method="POST" action={formAction}>
|
|
49
|
+
<table class="sv-lite-decision-table">
|
|
50
|
+
<thead>
|
|
51
|
+
<tr>
|
|
52
|
+
<th rowspan="2" class="sv-lite-th-idx">#</th>
|
|
53
|
+
<th colspan={conditionCols.length} class="sv-lite-th-cond">Conditions (IF)</th>
|
|
54
|
+
<th colspan={actionCols.length} class="sv-lite-th-act">Actions (THEN)</th>
|
|
55
|
+
</tr>
|
|
56
|
+
<tr>
|
|
57
|
+
{#each conditionCols as col (col.key)}
|
|
58
|
+
<th class="sv-lite-th-sub">{col.label}</th>
|
|
59
|
+
{/each}
|
|
60
|
+
{#each actionCols as col (col.key)}
|
|
61
|
+
<th class="sv-lite-th-sub">{col.label}</th>
|
|
62
|
+
{/each}
|
|
63
|
+
</tr>
|
|
64
|
+
</thead>
|
|
65
|
+
<tbody>
|
|
66
|
+
{#each rules as rule, idx (rule.id)}
|
|
67
|
+
<tr>
|
|
68
|
+
<td class="sv-lite-td-idx">{idx + 1}</td>
|
|
69
|
+
{#each conditionCols as col (col.key)}
|
|
70
|
+
<td>
|
|
71
|
+
<input
|
|
72
|
+
type="text"
|
|
73
|
+
name={`rule_${rule.id}_${col.key}`}
|
|
74
|
+
value={rule.values[col.key] ?? ''}
|
|
75
|
+
class="sv-lite-rule-input"
|
|
76
|
+
/>
|
|
77
|
+
</td>
|
|
78
|
+
{/each}
|
|
79
|
+
{#each actionCols as col (col.key)}
|
|
80
|
+
<td>
|
|
81
|
+
<input
|
|
82
|
+
type="text"
|
|
83
|
+
name={`rule_${rule.id}_${col.key}`}
|
|
84
|
+
value={rule.values[col.key] ?? ''}
|
|
85
|
+
class="sv-lite-rule-input sv-lite-act-input"
|
|
86
|
+
/>
|
|
87
|
+
</td>
|
|
88
|
+
{/each}
|
|
89
|
+
</tr>
|
|
90
|
+
{/each}
|
|
91
|
+
</tbody>
|
|
92
|
+
</table>
|
|
93
|
+
|
|
94
|
+
{#if formAction}
|
|
95
|
+
<div class="sv-lite-decision-actions">
|
|
96
|
+
<button type="submit" class="sv-lite-save-btn">Save Rules</button>
|
|
97
|
+
</div>
|
|
98
|
+
{/if}
|
|
99
|
+
</form>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<style>
|
|
103
|
+
.sv-lite-decision-container {
|
|
104
|
+
display: block;
|
|
105
|
+
border: 1px solid #e2e8f0;
|
|
106
|
+
border-radius: 6px;
|
|
107
|
+
padding: 12px;
|
|
108
|
+
background-color: #ffffff;
|
|
109
|
+
font-size: 12px;
|
|
110
|
+
overflow-x: auto;
|
|
111
|
+
}
|
|
112
|
+
.sv-lite-decision-header {
|
|
113
|
+
margin-bottom: 10px;
|
|
114
|
+
font-size: 13px;
|
|
115
|
+
color: #0f172a;
|
|
116
|
+
}
|
|
117
|
+
.sv-lite-hit-policy {
|
|
118
|
+
font-size: 10px;
|
|
119
|
+
color: #64748b;
|
|
120
|
+
margin-left: 6px;
|
|
121
|
+
}
|
|
122
|
+
.sv-lite-decision-table {
|
|
123
|
+
width: 100%;
|
|
124
|
+
border-collapse: collapse;
|
|
125
|
+
font-family: monospace;
|
|
126
|
+
}
|
|
127
|
+
.sv-lite-decision-table th, .sv-lite-decision-table td {
|
|
128
|
+
border: 1px solid #cbd5e1;
|
|
129
|
+
padding: 4px 6px;
|
|
130
|
+
}
|
|
131
|
+
.sv-lite-th-idx, .sv-lite-td-idx {
|
|
132
|
+
background-color: #f1f5f9;
|
|
133
|
+
text-align: center;
|
|
134
|
+
width: 28px;
|
|
135
|
+
font-size: 10px;
|
|
136
|
+
}
|
|
137
|
+
.sv-lite-th-cond {
|
|
138
|
+
background-color: #e0e7ff;
|
|
139
|
+
color: #3730a3;
|
|
140
|
+
text-align: center;
|
|
141
|
+
font-weight: bold;
|
|
142
|
+
}
|
|
143
|
+
.sv-lite-th-act {
|
|
144
|
+
background-color: #dcfce7;
|
|
145
|
+
color: #166534;
|
|
146
|
+
text-align: center;
|
|
147
|
+
font-weight: bold;
|
|
148
|
+
}
|
|
149
|
+
.sv-lite-th-sub {
|
|
150
|
+
background-color: #f8fafc;
|
|
151
|
+
color: #475569;
|
|
152
|
+
font-weight: 600;
|
|
153
|
+
}
|
|
154
|
+
.sv-lite-rule-input {
|
|
155
|
+
width: 100%;
|
|
156
|
+
border: 1px solid #cbd5e1;
|
|
157
|
+
padding: 3px;
|
|
158
|
+
font-size: 11px;
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
}
|
|
161
|
+
.sv-lite-act-input {
|
|
162
|
+
font-weight: bold;
|
|
163
|
+
color: #4338ca;
|
|
164
|
+
}
|
|
165
|
+
.sv-lite-decision-actions {
|
|
166
|
+
margin-top: 10px;
|
|
167
|
+
text-align: right;
|
|
168
|
+
}
|
|
169
|
+
.sv-lite-save-btn {
|
|
170
|
+
padding: 5px 12px;
|
|
171
|
+
background-color: #4f46e5;
|
|
172
|
+
color: #ffffff;
|
|
173
|
+
border: none;
|
|
174
|
+
border-radius: 3px;
|
|
175
|
+
font-size: 11px;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
}
|
|
178
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface DecisionColumn {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
type: 'condition' | 'action';
|
|
5
|
+
}
|
|
6
|
+
export interface DecisionRule {
|
|
7
|
+
id: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
values: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
interface Props {
|
|
12
|
+
title?: string;
|
|
13
|
+
columns?: DecisionColumn[];
|
|
14
|
+
rules?: DecisionRule[];
|
|
15
|
+
hitPolicy?: string;
|
|
16
|
+
formAction?: string;
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const LiteDecisionTable: import("svelte").Component<Props, {}, "">;
|
|
20
|
+
type LiteDecisionTable = ReturnType<typeof LiteDecisionTable>;
|
|
21
|
+
export default LiteDecisionTable;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface LiteDraggableColumn {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
columns: LiteDraggableColumn[];
|
|
9
|
+
items?: Record<string, unknown>[];
|
|
10
|
+
action?: string;
|
|
11
|
+
method?: 'get' | 'post' | 'dialog' | 'GET' | 'POST' | 'DIALOG' | null;
|
|
12
|
+
rowKey?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
columns,
|
|
17
|
+
items = [],
|
|
18
|
+
action = '',
|
|
19
|
+
method = 'POST',
|
|
20
|
+
rowKey = 'id',
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<div class="lite-sortable-table-card">
|
|
25
|
+
<form {action} {method}>
|
|
26
|
+
<table class="lite-table">
|
|
27
|
+
<thead>
|
|
28
|
+
<tr>
|
|
29
|
+
<th style="width: 70px;">Order</th>
|
|
30
|
+
{#each columns as col (col.key)}
|
|
31
|
+
<th>{col.label}</th>
|
|
32
|
+
{/each}
|
|
33
|
+
</tr>
|
|
34
|
+
</thead>
|
|
35
|
+
<tbody>
|
|
36
|
+
{#each items as item, index (item[rowKey] ?? index)}
|
|
37
|
+
<tr>
|
|
38
|
+
<td>
|
|
39
|
+
<input type="number" name="order_{item[rowKey] ?? index}" value={index + 1} class="lite-input" style="width: 55px;" />
|
|
40
|
+
</td>
|
|
41
|
+
{#each columns as col (col.key)}
|
|
42
|
+
<td>{item[col.key] ?? '—'}</td>
|
|
43
|
+
{/each}
|
|
44
|
+
</tr>
|
|
45
|
+
{/each}
|
|
46
|
+
</tbody>
|
|
47
|
+
</table>
|
|
48
|
+
|
|
49
|
+
<div class="lite-sortable-actions">
|
|
50
|
+
<button type="submit" class="lite-btn lite-btn-primary lite-btn-sm">
|
|
51
|
+
Update Order
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
</form>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.lite-sortable-table-card {
|
|
59
|
+
background: #ffffff;
|
|
60
|
+
border: 1px solid #cbd5e1;
|
|
61
|
+
border-radius: 6px;
|
|
62
|
+
padding: 12px;
|
|
63
|
+
margin-bottom: 16px;
|
|
64
|
+
}
|
|
65
|
+
.lite-sortable-actions {
|
|
66
|
+
margin-top: 12px;
|
|
67
|
+
display: flex;
|
|
68
|
+
justify-content: flex-end;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface LiteDraggableColumn {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
interface Props {
|
|
6
|
+
columns: LiteDraggableColumn[];
|
|
7
|
+
items?: Record<string, unknown>[];
|
|
8
|
+
action?: string;
|
|
9
|
+
method?: 'get' | 'post' | 'dialog' | 'GET' | 'POST' | 'DIALOG' | null;
|
|
10
|
+
rowKey?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const LiteDraggableRowTable: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type LiteDraggableRowTable = ReturnType<typeof LiteDraggableRowTable>;
|
|
14
|
+
export default LiteDraggableRowTable;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
action?: string;
|
|
8
|
+
method?: "get" | "post" | "dialog" | "GET" | "POST" | "DIALOG" | null;
|
|
9
|
+
submitText?: string;
|
|
10
|
+
cancelText?: string;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
action = '',
|
|
18
|
+
method = 'POST',
|
|
19
|
+
submitText = 'Save',
|
|
20
|
+
cancelText = 'Cancel',
|
|
21
|
+
children,
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="lite-drawer-card">
|
|
26
|
+
<div class="lite-drawer-header">
|
|
27
|
+
<h3 class="lite-drawer-title">{title}</h3>
|
|
28
|
+
{#if description}
|
|
29
|
+
<p class="lite-drawer-desc">{description}</p>
|
|
30
|
+
{/if}
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<form {action} {method} class="lite-drawer-form">
|
|
34
|
+
<div class="lite-drawer-body">
|
|
35
|
+
{#if children}
|
|
36
|
+
{@render children()}
|
|
37
|
+
{/if}
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="lite-drawer-footer">
|
|
41
|
+
<button type="button" class="lite-btn lite-btn-outline lite-btn-sm" onclick={() => history.back()}>
|
|
42
|
+
{cancelText}
|
|
43
|
+
</button>
|
|
44
|
+
<button type="submit" class="lite-btn lite-btn-primary lite-btn-sm" style="margin-left: 8px;">
|
|
45
|
+
{submitText}
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
</form>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.lite-drawer-card {
|
|
53
|
+
padding: 16px;
|
|
54
|
+
background: #f8fafc;
|
|
55
|
+
border: 1px solid #cbd5e1;
|
|
56
|
+
border-left: 4px solid #3b82f6;
|
|
57
|
+
border-radius: 4px;
|
|
58
|
+
margin-bottom: 16px;
|
|
59
|
+
}
|
|
60
|
+
.lite-drawer-header {
|
|
61
|
+
padding-bottom: 10px;
|
|
62
|
+
border-bottom: 1px solid #e2e8f0;
|
|
63
|
+
margin-bottom: 12px;
|
|
64
|
+
}
|
|
65
|
+
.lite-drawer-title {
|
|
66
|
+
margin: 0;
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
color: #1e293b;
|
|
69
|
+
}
|
|
70
|
+
.lite-drawer-desc {
|
|
71
|
+
margin: 4px 0 0 0;
|
|
72
|
+
font-size: 12px;
|
|
73
|
+
color: #64748b;
|
|
74
|
+
}
|
|
75
|
+
.lite-drawer-body {
|
|
76
|
+
margin-bottom: 16px;
|
|
77
|
+
font-size: 13px;
|
|
78
|
+
}
|
|
79
|
+
.lite-drawer-footer {
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: flex-end;
|
|
82
|
+
padding-top: 12px;
|
|
83
|
+
border-top: 1px solid #e2e8f0;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
action?: string;
|
|
6
|
+
method?: "get" | "post" | "dialog" | "GET" | "POST" | "DIALOG" | null;
|
|
7
|
+
submitText?: string;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
declare const LiteDrawerForm: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type LiteDrawerForm = ReturnType<typeof LiteDrawerForm>;
|
|
13
|
+
export default LiteDrawerForm;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface LiteEditableTableColumn {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
type?: 'text' | 'number' | 'select' | 'boolean' | 'date';
|
|
6
|
+
options?: Array<{ label: string; value: string | number }>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
columns: LiteEditableTableColumn[];
|
|
11
|
+
data?: Record<string, unknown>[];
|
|
12
|
+
action?: string;
|
|
13
|
+
method?: 'get' | 'post' | 'dialog' | 'GET' | 'POST' | 'DIALOG' | null;
|
|
14
|
+
rowKey?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
columns,
|
|
19
|
+
data = [],
|
|
20
|
+
action = '',
|
|
21
|
+
method = 'POST',
|
|
22
|
+
rowKey = 'id',
|
|
23
|
+
}: Props = $props();
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div class="lite-editable-table-card">
|
|
27
|
+
<form {action} {method}>
|
|
28
|
+
<table class="lite-table">
|
|
29
|
+
<thead>
|
|
30
|
+
<tr>
|
|
31
|
+
{#each columns as col (col.key)}
|
|
32
|
+
<th>{col.label}</th>
|
|
33
|
+
{/each}
|
|
34
|
+
</tr>
|
|
35
|
+
</thead>
|
|
36
|
+
<tbody>
|
|
37
|
+
{#each data as row, rowIndex (row[rowKey] ?? rowIndex)}
|
|
38
|
+
<tr>
|
|
39
|
+
{#each columns as col (col.key)}
|
|
40
|
+
<td>
|
|
41
|
+
{#if col.type === 'select' && col.options}
|
|
42
|
+
<select name="{col.key}_{rowIndex}" class="lite-select">
|
|
43
|
+
{#each col.options as opt (opt.value)}
|
|
44
|
+
<option value={String(opt.value)} selected={String(row[col.key]) === String(opt.value)}>
|
|
45
|
+
{opt.label}
|
|
46
|
+
</option>
|
|
47
|
+
{/each}
|
|
48
|
+
</select>
|
|
49
|
+
{:else if col.type === 'boolean'}
|
|
50
|
+
<input type="checkbox" name="{col.key}_{rowIndex}" checked={Boolean(row[col.key])} />
|
|
51
|
+
{:else if col.type === 'number'}
|
|
52
|
+
<input type="number" name="{col.key}_{rowIndex}" value={Number(row[col.key] ?? 0)} class="lite-input" />
|
|
53
|
+
{:else}
|
|
54
|
+
<input type="text" name="{col.key}_{rowIndex}" value={String(row[col.key] ?? '')} class="lite-input" />
|
|
55
|
+
{/if}
|
|
56
|
+
</td>
|
|
57
|
+
{/each}
|
|
58
|
+
</tr>
|
|
59
|
+
{/each}
|
|
60
|
+
</tbody>
|
|
61
|
+
</table>
|
|
62
|
+
|
|
63
|
+
<div class="lite-editable-actions">
|
|
64
|
+
<button type="submit" class="lite-btn lite-btn-primary lite-btn-sm">
|
|
65
|
+
Save All Changes
|
|
66
|
+
</button>
|
|
67
|
+
</div>
|
|
68
|
+
</form>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.lite-editable-table-card {
|
|
73
|
+
background: #ffffff;
|
|
74
|
+
border: 1px solid #cbd5e1;
|
|
75
|
+
border-radius: 6px;
|
|
76
|
+
padding: 12px;
|
|
77
|
+
margin-bottom: 16px;
|
|
78
|
+
}
|
|
79
|
+
.lite-editable-actions {
|
|
80
|
+
margin-top: 12px;
|
|
81
|
+
display: flex;
|
|
82
|
+
justify-content: flex-end;
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface LiteEditableTableColumn {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
type?: 'text' | 'number' | 'select' | 'boolean' | 'date';
|
|
5
|
+
options?: Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
interface Props {
|
|
11
|
+
columns: LiteEditableTableColumn[];
|
|
12
|
+
data?: Record<string, unknown>[];
|
|
13
|
+
action?: string;
|
|
14
|
+
method?: 'get' | 'post' | 'dialog' | 'GET' | 'POST' | 'DIALOG' | null;
|
|
15
|
+
rowKey?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const LiteEditableTable: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type LiteEditableTable = ReturnType<typeof LiteEditableTable>;
|
|
19
|
+
export default LiteEditableTable;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface GanttTask {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
startDay: number;
|
|
6
|
+
durationDays: number;
|
|
7
|
+
progress?: number;
|
|
8
|
+
status?: 'planned' | 'in_progress' | 'completed' | 'delayed';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
tasks?: GanttTask[];
|
|
13
|
+
totalDays?: number;
|
|
14
|
+
dayLabelPrefix?: string;
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
tasks = [],
|
|
20
|
+
totalDays = 14,
|
|
21
|
+
dayLabelPrefix = 'D',
|
|
22
|
+
class: className = '',
|
|
23
|
+
}: Props = $props();
|
|
24
|
+
|
|
25
|
+
const days = $derived(
|
|
26
|
+
Array.from({ length: totalDays }, (_, i) => `${dayLabelPrefix}${i + 1}`)
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div class="sv-lite-gantt-container {className}">
|
|
31
|
+
<div class="sv-lite-gantt-title">
|
|
32
|
+
<strong>Project Schedule</strong> ({tasks.length} tasks / {totalDays} days)
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<table class="sv-lite-gantt-table">
|
|
36
|
+
<thead>
|
|
37
|
+
<tr>
|
|
38
|
+
<th class="sv-lite-th-task">Task</th>
|
|
39
|
+
<th class="sv-lite-th-status">Status</th>
|
|
40
|
+
{#each days as day (day)}
|
|
41
|
+
<th class="sv-lite-th-day">{day}</th>
|
|
42
|
+
{/each}
|
|
43
|
+
</tr>
|
|
44
|
+
</thead>
|
|
45
|
+
<tbody>
|
|
46
|
+
{#each tasks as task (task.id)}
|
|
47
|
+
<tr>
|
|
48
|
+
<td class="sv-lite-td-task">{task.title}</td>
|
|
49
|
+
<td class="sv-lite-td-status">
|
|
50
|
+
<span class="sv-lite-gantt-badge sv-lite-{task.status ?? 'planned'}">{task.status ?? 'planned'}</span>
|
|
51
|
+
</td>
|
|
52
|
+
{#each days as _, dIdx (dIdx)}
|
|
53
|
+
{@const isCovered = dIdx >= task.startDay && dIdx < task.startDay + task.durationDays}
|
|
54
|
+
<td class="sv-lite-td-cell {isCovered ? 'sv-lite-cell-active sv-lite-bg-' + (task.status ?? 'planned') : ''}">
|
|
55
|
+
{#if isCovered && dIdx === task.startDay && task.progress !== undefined}
|
|
56
|
+
<span class="sv-lite-cell-progress">{task.progress}%</span>
|
|
57
|
+
{/if}
|
|
58
|
+
</td>
|
|
59
|
+
{/each}
|
|
60
|
+
</tr>
|
|
61
|
+
{/each}
|
|
62
|
+
</tbody>
|
|
63
|
+
</table>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
.sv-lite-gantt-container {
|
|
68
|
+
display: block;
|
|
69
|
+
border: 1px solid #e2e8f0;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
padding: 12px;
|
|
72
|
+
background-color: #ffffff;
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
overflow-x: auto;
|
|
75
|
+
}
|
|
76
|
+
.sv-lite-gantt-title {
|
|
77
|
+
margin-bottom: 10px;
|
|
78
|
+
font-size: 13px;
|
|
79
|
+
color: #0f172a;
|
|
80
|
+
}
|
|
81
|
+
.sv-lite-gantt-table {
|
|
82
|
+
width: 100%;
|
|
83
|
+
border-collapse: collapse;
|
|
84
|
+
text-align: center;
|
|
85
|
+
}
|
|
86
|
+
.sv-lite-gantt-table th, .sv-lite-gantt-table td {
|
|
87
|
+
border: 1px solid #e2e8f0;
|
|
88
|
+
padding: 6px;
|
|
89
|
+
}
|
|
90
|
+
.sv-lite-th-task, .sv-lite-td-task {
|
|
91
|
+
text-align: left;
|
|
92
|
+
min-width: 140px;
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
}
|
|
95
|
+
.sv-lite-th-day {
|
|
96
|
+
min-width: 28px;
|
|
97
|
+
font-size: 10px;
|
|
98
|
+
background-color: #f8fafc;
|
|
99
|
+
color: #64748b;
|
|
100
|
+
}
|
|
101
|
+
.sv-lite-gantt-badge {
|
|
102
|
+
display: inline-block;
|
|
103
|
+
padding: 2px 6px;
|
|
104
|
+
border-radius: 3px;
|
|
105
|
+
font-size: 10px;
|
|
106
|
+
text-transform: uppercase;
|
|
107
|
+
}
|
|
108
|
+
.sv-lite-completed {
|
|
109
|
+
background-color: #dcfce7;
|
|
110
|
+
color: #166534;
|
|
111
|
+
}
|
|
112
|
+
.sv-lite-delayed {
|
|
113
|
+
background-color: #fee2e2;
|
|
114
|
+
color: #991b1b;
|
|
115
|
+
}
|
|
116
|
+
.sv-lite-in_progress {
|
|
117
|
+
background-color: #e0e7ff;
|
|
118
|
+
color: #3730a3;
|
|
119
|
+
}
|
|
120
|
+
.sv-lite-planned {
|
|
121
|
+
background-color: #f1f5f9;
|
|
122
|
+
color: #475569;
|
|
123
|
+
}
|
|
124
|
+
.sv-lite-cell-active {
|
|
125
|
+
background-color: #818cf8;
|
|
126
|
+
color: #ffffff;
|
|
127
|
+
}
|
|
128
|
+
.sv-lite-bg-completed {
|
|
129
|
+
background-color: #4ade80;
|
|
130
|
+
}
|
|
131
|
+
.sv-lite-bg-delayed {
|
|
132
|
+
background-color: #f87171;
|
|
133
|
+
}
|
|
134
|
+
.sv-lite-bg-in_progress {
|
|
135
|
+
background-color: #6366f1;
|
|
136
|
+
}
|
|
137
|
+
.sv-lite-bg-planned {
|
|
138
|
+
background-color: #94a3b8;
|
|
139
|
+
}
|
|
140
|
+
.sv-lite-cell-progress {
|
|
141
|
+
font-size: 9px;
|
|
142
|
+
font-weight: bold;
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface GanttTask {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
startDay: number;
|
|
5
|
+
durationDays: number;
|
|
6
|
+
progress?: number;
|
|
7
|
+
status?: 'planned' | 'in_progress' | 'completed' | 'delayed';
|
|
8
|
+
}
|
|
9
|
+
interface Props {
|
|
10
|
+
tasks?: GanttTask[];
|
|
11
|
+
totalDays?: number;
|
|
12
|
+
dayLabelPrefix?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const LiteGanttChart: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type LiteGanttChart = ReturnType<typeof LiteGanttChart>;
|
|
17
|
+
export default LiteGanttChart;
|