@svadmin/ui 0.118.0 → 0.119.0
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/dist/app.css +198 -52
- package/dist/app.theme.css +198 -52
- package/dist/components/AboutSettings.svelte +1 -1
- package/dist/components/AuditLogDrawer.svelte +165 -55
- package/dist/components/AuditLogDrawer.svelte.d.ts +4 -2
- package/dist/components/Authenticated.svelte +2 -2
- package/dist/components/AutoSaveIndicator.svelte +2 -2
- package/dist/components/AutoTable.svelte +1 -1
- package/dist/components/Breadcrumbs.svelte +1 -1
- package/dist/components/Breadcrumbs.svelte.d.ts +1 -1
- package/dist/components/CanAccess.svelte +2 -2
- package/dist/components/CancelTaskButton.svelte +2 -2
- package/dist/components/Cascader.svelte +19 -19
- package/dist/components/Cascader.svelte.d.ts +19 -19
- package/dist/components/ColorPicker.svelte +9 -9
- package/dist/components/ColorPicker.svelte.d.ts +9 -9
- package/dist/components/ComboboxField.svelte +15 -15
- package/dist/components/ComboboxField.svelte.d.ts +15 -15
- package/dist/components/ConcurrentConflictModal.svelte +292 -0
- package/dist/components/ConcurrentConflictModal.svelte.d.ts +24 -0
- package/dist/components/ConfigErrorScreen.svelte +2 -2
- package/dist/components/ConfirmDialog.svelte +6 -4
- package/dist/components/ConfirmDialog.svelte.d.ts +2 -2
- package/dist/components/CronExpressionBuilder.svelte +389 -0
- package/dist/components/CronExpressionBuilder.svelte.d.ts +20 -0
- package/dist/components/DateRangeInput.svelte +22 -22
- package/dist/components/DateRangeInput.svelte.d.ts +22 -22
- package/dist/components/DateTimeInput.svelte +2 -2
- package/dist/components/DateTimeInput.svelte.d.ts +2 -2
- package/dist/components/EmptyState.svelte +2 -2
- package/dist/components/ErrorComponent.svelte +2 -2
- package/dist/components/ErrorSummary.svelte +2 -2
- package/dist/components/FieldRenderer.svelte +3 -3
- package/dist/components/FileUpload.svelte +16 -16
- package/dist/components/FileUpload.svelte.d.ts +16 -16
- package/dist/components/FileUploadField.svelte +7 -7
- package/dist/components/FileUploadField.svelte.d.ts +7 -7
- package/dist/components/FilterDropdown.svelte.d.ts +1 -1
- package/dist/components/ForgotPasswordPage.svelte +2 -2
- package/dist/components/Header.svelte +2 -2
- package/dist/components/LiveIndicator.svelte +2 -2
- package/dist/components/LoginPage.svelte +2 -2
- package/dist/components/MetricGrid.svelte +163 -0
- package/dist/components/MetricGrid.svelte.d.ts +39 -0
- package/dist/components/MicroAppFrame.svelte +290 -0
- package/dist/components/MicroAppFrame.svelte.d.ts +36 -0
- package/dist/components/MoneyInput.svelte +15 -15
- package/dist/components/MoneyInput.svelte.d.ts +15 -15
- package/dist/components/NotificationCenter.svelte +16 -16
- package/dist/components/NotificationCenter.svelte.d.ts +16 -16
- package/dist/components/NumberInput.svelte +13 -13
- package/dist/components/NumberInput.svelte.d.ts +13 -13
- package/dist/components/NumericInput.svelte +16 -16
- package/dist/components/NumericInput.svelte.d.ts +16 -16
- package/dist/components/OfflineGuard.svelte +65 -0
- package/dist/components/OfflineGuard.svelte.d.ts +15 -0
- package/dist/components/OrgChart.svelte +171 -0
- package/dist/components/OrgChart.svelte.d.ts +26 -0
- package/dist/components/PageSkeleton.svelte +2 -2
- package/dist/components/PercentInput.svelte +14 -14
- package/dist/components/PercentInput.svelte.d.ts +14 -14
- package/dist/components/PresenceAvatarGroup.svelte +78 -29
- package/dist/components/PresenceAvatarGroup.svelte.d.ts +14 -8
- package/dist/components/Rate.svelte +9 -9
- package/dist/components/Rate.svelte.d.ts +9 -9
- package/dist/components/RegisterPage.svelte +2 -2
- package/dist/components/ResizeBox.svelte.d.ts +1 -1
- package/dist/components/RetryTaskButton.svelte +2 -2
- package/dist/components/SafeDeleteConfirm.svelte +301 -0
- package/dist/components/SafeDeleteConfirm.svelte.d.ts +24 -0
- package/dist/components/SignaturePad.svelte +19 -3
- package/dist/components/SignaturePad.svelte.d.ts +3 -0
- package/dist/components/SliderCaptcha.svelte +448 -0
- package/dist/components/SliderCaptcha.svelte.d.ts +26 -0
- package/dist/components/TagsInput.svelte +10 -10
- package/dist/components/TagsInput.svelte.d.ts +10 -10
- package/dist/components/TaskCenter.svelte +450 -0
- package/dist/components/TaskCenter.svelte.d.ts +37 -0
- package/dist/components/TaskDetails.svelte +2 -2
- package/dist/components/TaskList.svelte +2 -2
- package/dist/components/TaskProgressBar.svelte +2 -2
- package/dist/components/TaskStatusBadge.svelte +2 -2
- package/dist/components/ThemedTitle.svelte +2 -2
- package/dist/components/Tour.svelte +9 -1
- package/dist/components/Tour.svelte.d.ts +2 -1
- package/dist/components/Transfer.svelte +11 -11
- package/dist/components/Transfer.svelte.d.ts +11 -11
- package/dist/components/TreeSelect.svelte +17 -17
- package/dist/components/TreeSelect.svelte.d.ts +17 -17
- package/dist/components/TreeTable.svelte.d.ts +1 -1
- package/dist/components/TrendIndicator.svelte +177 -0
- package/dist/components/TrendIndicator.svelte.d.ts +27 -0
- package/dist/components/UndoableNotification.svelte +2 -2
- package/dist/components/UpdatePasswordPage.svelte +2 -2
- package/dist/components/VirtualTreeSelect.svelte +431 -0
- package/dist/components/VirtualTreeSelect.svelte.d.ts +34 -0
- package/dist/components/buttons/CreateButton.svelte +2 -2
- package/dist/components/buttons/ExportButton.svelte +2 -2
- package/dist/components/buttons/ListButton.svelte +2 -2
- package/dist/components/buttons/RefreshButton.svelte +2 -2
- package/dist/components/buttons/SaveButton.svelte +2 -2
- package/dist/components/charts/GaugeChart.svelte +452 -57
- package/dist/components/charts/GaugeChart.svelte.d.ts +61 -10
- package/dist/components/content/AuditTimeline.svelte +125 -28
- package/dist/components/content/AuditTimeline.svelte.d.ts +30 -16
- package/dist/components/fields/JsonField.svelte +2 -2
- package/dist/components/fields/MultiSelectField.svelte +2 -2
- package/dist/components/fields/RelationField.svelte +2 -2
- package/dist/components/fields/RichTextField.svelte +2 -2
- package/dist/components/fields/SelectField.svelte +2 -2
- package/dist/components/list-state.svelte.d.ts +1 -1
- package/dist/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
- package/dist/components/ui/command/index.d.ts +1 -1
- package/dist/components/ui/input/input.svelte.d.ts +1 -1
- package/dist/components/ui/switch/switch.svelte.d.ts +1 -1
- package/dist/components/useNetworkStatus.d.svelte.ts +1 -0
- package/dist/components/useNetworkStatus.svelte.d.ts +30 -0
- package/dist/components/useNetworkStatus.svelte.js +74 -0
- package/dist/design-system.d.ts +4 -4
- package/dist/index.d.ts +31 -5
- package/dist/index.js +23 -3
- package/dist/recipes.d.ts +91 -619
- package/package.json +30 -30
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Clock, Check, Play, Copy } from '@lucide/svelte';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
export interface CronPreset {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CronExpressionBuilderProps {
|
|
12
|
+
/** Bound cron string, e.g. "0 9 * * 1-5" (5-part format) */
|
|
13
|
+
value?: string | undefined;
|
|
14
|
+
/** Extra class names */
|
|
15
|
+
class?: string | undefined;
|
|
16
|
+
/** Whether to show next execution preview (default: true) */
|
|
17
|
+
showPreview?: boolean | undefined;
|
|
18
|
+
/** Preset shortcuts */
|
|
19
|
+
presets?: CronPreset[] | undefined;
|
|
20
|
+
/** Change callback */
|
|
21
|
+
onchange?: ((cron: string) => void) | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const defaultPresets: CronPreset[] = [
|
|
25
|
+
{ label: 'Every Minute', value: '* * * * *', description: 'Triggers every single minute' },
|
|
26
|
+
{ label: 'Hourly', value: '0 * * * *', description: 'Triggers at the start of every hour' },
|
|
27
|
+
{ label: 'Daily at 00:00', value: '0 0 * * *', description: 'Triggers every day at midnight' },
|
|
28
|
+
{ label: 'Daily at 09:00', value: '0 9 * * *', description: 'Triggers every morning at 9:00 AM' },
|
|
29
|
+
{ label: 'Workdays at 09:00', value: '0 9 * * 1-5', description: 'Monday to Friday at 9:00 AM' },
|
|
30
|
+
{ label: 'Weekly (Mon 00:00)', value: '0 0 * * 1', description: 'Every Monday at midnight' },
|
|
31
|
+
{ label: 'Monthly (1st at 00:00)', value: '0 0 1 * *', description: '1st of every month at midnight' },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
let {
|
|
35
|
+
value = $bindable('* * * * *'),
|
|
36
|
+
class: className = '',
|
|
37
|
+
showPreview = true,
|
|
38
|
+
presets = defaultPresets,
|
|
39
|
+
onchange,
|
|
40
|
+
}: CronExpressionBuilderProps = $props();
|
|
41
|
+
|
|
42
|
+
type TabType = 'minute' | 'hour' | 'day' | 'month' | 'week';
|
|
43
|
+
let activeTab = $state<TabType>('minute');
|
|
44
|
+
|
|
45
|
+
// 解析当前 cron 字符串各部分
|
|
46
|
+
const parts = $derived.by(() => {
|
|
47
|
+
const raw = (value || '* * * * *').trim().split(/\s+/);
|
|
48
|
+
return {
|
|
49
|
+
minute: raw[0] ?? '*',
|
|
50
|
+
hour: raw[1] ?? '*',
|
|
51
|
+
day: raw[2] ?? '*',
|
|
52
|
+
month: raw[3] ?? '*',
|
|
53
|
+
week: raw[4] ?? '*',
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
function updatePart(type: TabType, partVal: string) {
|
|
58
|
+
const p = { ...parts, [type]: partVal };
|
|
59
|
+
const nextCron = `${p.minute} ${p.hour} ${p.day} ${p.month} ${p.week}`;
|
|
60
|
+
value = nextCron;
|
|
61
|
+
onchange?.(nextCron);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 快捷套用预设
|
|
65
|
+
function applyPreset(presetVal: string) {
|
|
66
|
+
value = presetVal;
|
|
67
|
+
onchange?.(presetVal);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 人类可读语义描述推导
|
|
71
|
+
const humanReadableSummary = $derived.by<string>(() => {
|
|
72
|
+
const { minute, hour, day, month, week } = parts;
|
|
73
|
+
if (minute === '*' && hour === '*' && day === '*' && month === '*' && week === '*') {
|
|
74
|
+
return 'Every minute';
|
|
75
|
+
}
|
|
76
|
+
if (minute === '0' && hour === '*' && day === '*' && month === '*' && week === '*') {
|
|
77
|
+
return 'Every hour, at minute 0';
|
|
78
|
+
}
|
|
79
|
+
if (day === '*' && month === '*' && week === '1-5' && !hour.includes('*') && !minute.includes('*')) {
|
|
80
|
+
return `Every workday (Mon-Fri) at ${hour.padStart(2, '0')}:${minute.padStart(2, '0')}`;
|
|
81
|
+
}
|
|
82
|
+
if (day === '*' && month === '*' && week === '*' && !hour.includes('*') && !minute.includes('*')) {
|
|
83
|
+
return `Every day at ${hour.padStart(2, '0')}:${minute.padStart(2, '0')}`;
|
|
84
|
+
}
|
|
85
|
+
if (day === '*' && month === '*' && week !== '*' && !hour.includes('*') && !minute.includes('*')) {
|
|
86
|
+
return `Every week on day ${week} at ${hour.padStart(2, '0')}:${minute.padStart(2, '0')}`;
|
|
87
|
+
}
|
|
88
|
+
return `Cron rule: [${value}]`;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 未来 5 次触发模拟预估
|
|
92
|
+
const nextExecutions = $derived.by<string[]>(() => {
|
|
93
|
+
const list: string[] = [];
|
|
94
|
+
const now = new Date();
|
|
95
|
+
// 简易前瞻推算模拟时间展示
|
|
96
|
+
for (let i = 1; i <= 5; i++) {
|
|
97
|
+
const future = new Date(now.getTime() + i * 3600 * 1000);
|
|
98
|
+
const y = future.getFullYear();
|
|
99
|
+
const m = String(future.getMonth() + 1).padStart(2, '0');
|
|
100
|
+
const d = String(future.getDate()).padStart(2, '0');
|
|
101
|
+
const h = parts.hour === '*' ? String(future.getHours()).padStart(2, '0') : parts.hour.padStart(2, '0');
|
|
102
|
+
const min = parts.minute === '*' ? String(future.getMinutes()).padStart(2, '0') : parts.minute.padStart(2, '0');
|
|
103
|
+
list.push(`${y}-${m}-${d} ${h}:${min}:00`);
|
|
104
|
+
}
|
|
105
|
+
return list;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
let copied = $state(false);
|
|
109
|
+
function copyCron() {
|
|
110
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard) {
|
|
111
|
+
navigator.clipboard.writeText(value);
|
|
112
|
+
copied = true;
|
|
113
|
+
setTimeout(() => { copied = false; }, 2000);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<div
|
|
119
|
+
data-svadmin-component="CronExpressionBuilder"
|
|
120
|
+
class={cn('rounded-xl border border-border bg-card p-4 shadow-xs text-xs space-y-4 font-sans', className)}
|
|
121
|
+
>
|
|
122
|
+
<!-- Header: Cron Display & Copy -->
|
|
123
|
+
<div class="flex flex-wrap items-center justify-between gap-3 pb-3 border-b border-border/60">
|
|
124
|
+
<div class="flex items-center gap-2">
|
|
125
|
+
<Clock class="h-4 w-4 text-primary" />
|
|
126
|
+
<span class="font-semibold text-foreground text-sm">Cron Expression Builder</span>
|
|
127
|
+
<span class="text-muted-foreground font-mono text-xs">({humanReadableSummary})</span>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div class="flex items-center gap-2">
|
|
131
|
+
<div class="flex items-center gap-1.5 rounded-md border border-input bg-background px-3 py-1 font-mono text-xs font-medium text-foreground">
|
|
132
|
+
<span>{value}</span>
|
|
133
|
+
</div>
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
onclick={copyCron}
|
|
137
|
+
class="inline-flex h-7 items-center gap-1 rounded-md border border-border bg-background px-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors"
|
|
138
|
+
>
|
|
139
|
+
{#if copied}
|
|
140
|
+
<Check class="h-3 w-3 text-success" />
|
|
141
|
+
<span class="text-success">Copied</span>
|
|
142
|
+
{:else}
|
|
143
|
+
<Copy class="h-3 w-3" />
|
|
144
|
+
<span>Copy</span>
|
|
145
|
+
{/if}
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<!-- Common Presets Shortcuts -->
|
|
151
|
+
<div class="space-y-1.5">
|
|
152
|
+
<div class="text-[11px] font-semibold text-muted-foreground uppercase tracking-wider">
|
|
153
|
+
Common Presets
|
|
154
|
+
</div>
|
|
155
|
+
<div class="flex flex-wrap gap-1.5">
|
|
156
|
+
{#each presets as p (p.value)}
|
|
157
|
+
<button
|
|
158
|
+
type="button"
|
|
159
|
+
onclick={() => applyPreset(p.value)}
|
|
160
|
+
class={cn(
|
|
161
|
+
'inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium transition-colors border',
|
|
162
|
+
value === p.value
|
|
163
|
+
? 'border-primary bg-primary text-primary-foreground'
|
|
164
|
+
: 'border-border/70 bg-background text-muted-foreground hover:text-foreground hover:bg-muted'
|
|
165
|
+
)}
|
|
166
|
+
title={p.description ?? p.value}
|
|
167
|
+
>
|
|
168
|
+
<span>{p.label}</span>
|
|
169
|
+
<span class="font-mono text-[10px] opacity-70">({p.value})</span>
|
|
170
|
+
</button>
|
|
171
|
+
{/each}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<!-- Segment Tabs -->
|
|
176
|
+
<div class="flex items-center gap-1 border-b border-border/80 pb-2">
|
|
177
|
+
{#each [
|
|
178
|
+
{ id: 'minute', label: 'Minute (0-59)', part: parts.minute },
|
|
179
|
+
{ id: 'hour', label: 'Hour (0-23)', part: parts.hour },
|
|
180
|
+
{ id: 'day', label: 'Day (1-31)', part: parts.day },
|
|
181
|
+
{ id: 'month', label: 'Month (1-12)', part: parts.month },
|
|
182
|
+
{ id: 'week', label: 'Week (0-6)', part: parts.week },
|
|
183
|
+
] as tab (tab.id)}
|
|
184
|
+
<button
|
|
185
|
+
type="button"
|
|
186
|
+
onclick={() => { activeTab = tab.id as TabType; }}
|
|
187
|
+
class={cn(
|
|
188
|
+
'flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors',
|
|
189
|
+
activeTab === tab.id
|
|
190
|
+
? 'bg-primary/10 text-primary font-semibold'
|
|
191
|
+
: 'text-muted-foreground hover:text-foreground hover:bg-muted/50'
|
|
192
|
+
)}
|
|
193
|
+
>
|
|
194
|
+
<span>{tab.label}</span>
|
|
195
|
+
<span class="rounded bg-muted px-1.5 py-0.2 font-mono text-[10px] text-foreground font-normal">
|
|
196
|
+
{tab.part}
|
|
197
|
+
</span>
|
|
198
|
+
</button>
|
|
199
|
+
{/each}
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<!-- Tab Content Panel -->
|
|
203
|
+
<div class="rounded-lg border border-border/60 bg-background/50 p-3 space-y-3">
|
|
204
|
+
{#if activeTab === 'minute'}
|
|
205
|
+
<div class="space-y-2">
|
|
206
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
207
|
+
<input
|
|
208
|
+
type="radio"
|
|
209
|
+
name="minute-mode"
|
|
210
|
+
checked={parts.minute === '*'}
|
|
211
|
+
onchange={() => updatePart('minute', '*')}
|
|
212
|
+
class="text-primary focus:ring-primary"
|
|
213
|
+
/>
|
|
214
|
+
<span>Every minute (*)</span>
|
|
215
|
+
</label>
|
|
216
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
217
|
+
<input
|
|
218
|
+
type="radio"
|
|
219
|
+
name="minute-mode"
|
|
220
|
+
checked={parts.minute === '0'}
|
|
221
|
+
onchange={() => updatePart('minute', '0')}
|
|
222
|
+
class="text-primary focus:ring-primary"
|
|
223
|
+
/>
|
|
224
|
+
<span>At minute 00</span>
|
|
225
|
+
</label>
|
|
226
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
227
|
+
<input
|
|
228
|
+
type="radio"
|
|
229
|
+
name="minute-mode"
|
|
230
|
+
checked={parts.minute === '*/5'}
|
|
231
|
+
onchange={() => updatePart('minute', '*/5')}
|
|
232
|
+
class="text-primary focus:ring-primary"
|
|
233
|
+
/>
|
|
234
|
+
<span>Every 5 minutes (*/5)</span>
|
|
235
|
+
</label>
|
|
236
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
237
|
+
<input
|
|
238
|
+
type="radio"
|
|
239
|
+
name="minute-mode"
|
|
240
|
+
checked={parts.minute === '*/15'}
|
|
241
|
+
onchange={() => updatePart('minute', '*/15')}
|
|
242
|
+
class="text-primary focus:ring-primary"
|
|
243
|
+
/>
|
|
244
|
+
<span>Every 15 minutes (*/15)</span>
|
|
245
|
+
</label>
|
|
246
|
+
</div>
|
|
247
|
+
{:else if activeTab === 'hour'}
|
|
248
|
+
<div class="space-y-2">
|
|
249
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
250
|
+
<input
|
|
251
|
+
type="radio"
|
|
252
|
+
name="hour-mode"
|
|
253
|
+
checked={parts.hour === '*'}
|
|
254
|
+
onchange={() => updatePart('hour', '*')}
|
|
255
|
+
class="text-primary focus:ring-primary"
|
|
256
|
+
/>
|
|
257
|
+
<span>Every hour (*)</span>
|
|
258
|
+
</label>
|
|
259
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
260
|
+
<input
|
|
261
|
+
type="radio"
|
|
262
|
+
name="hour-mode"
|
|
263
|
+
checked={parts.hour === '0'}
|
|
264
|
+
onchange={() => updatePart('hour', '0')}
|
|
265
|
+
class="text-primary focus:ring-primary"
|
|
266
|
+
/>
|
|
267
|
+
<span>At midnight (00:00)</span>
|
|
268
|
+
</label>
|
|
269
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
270
|
+
<input
|
|
271
|
+
type="radio"
|
|
272
|
+
name="hour-mode"
|
|
273
|
+
checked={parts.hour === '9'}
|
|
274
|
+
onchange={() => updatePart('hour', '9')}
|
|
275
|
+
class="text-primary focus:ring-primary"
|
|
276
|
+
/>
|
|
277
|
+
<span>At 09:00 AM</span>
|
|
278
|
+
</label>
|
|
279
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
280
|
+
<input
|
|
281
|
+
type="radio"
|
|
282
|
+
name="hour-mode"
|
|
283
|
+
checked={parts.hour === '*/2'}
|
|
284
|
+
onchange={() => updatePart('hour', '*/2')}
|
|
285
|
+
class="text-primary focus:ring-primary"
|
|
286
|
+
/>
|
|
287
|
+
<span>Every 2 hours (*/2)</span>
|
|
288
|
+
</label>
|
|
289
|
+
</div>
|
|
290
|
+
{:else if activeTab === 'day'}
|
|
291
|
+
<div class="space-y-2">
|
|
292
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
293
|
+
<input
|
|
294
|
+
type="radio"
|
|
295
|
+
name="day-mode"
|
|
296
|
+
checked={parts.day === '*'}
|
|
297
|
+
onchange={() => updatePart('day', '*')}
|
|
298
|
+
class="text-primary focus:ring-primary"
|
|
299
|
+
/>
|
|
300
|
+
<span>Every day (*)</span>
|
|
301
|
+
</label>
|
|
302
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
303
|
+
<input
|
|
304
|
+
type="radio"
|
|
305
|
+
name="day-mode"
|
|
306
|
+
checked={parts.day === '1'}
|
|
307
|
+
onchange={() => updatePart('day', '1')}
|
|
308
|
+
class="text-primary focus:ring-primary"
|
|
309
|
+
/>
|
|
310
|
+
<span>First day of month (1)</span>
|
|
311
|
+
</label>
|
|
312
|
+
</div>
|
|
313
|
+
{:else if activeTab === 'month'}
|
|
314
|
+
<div class="space-y-2">
|
|
315
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
316
|
+
<input
|
|
317
|
+
type="radio"
|
|
318
|
+
name="month-mode"
|
|
319
|
+
checked={parts.month === '*'}
|
|
320
|
+
onchange={() => updatePart('month', '*')}
|
|
321
|
+
class="text-primary focus:ring-primary"
|
|
322
|
+
/>
|
|
323
|
+
<span>Every month (*)</span>
|
|
324
|
+
</label>
|
|
325
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
326
|
+
<input
|
|
327
|
+
type="radio"
|
|
328
|
+
name="month-mode"
|
|
329
|
+
checked={parts.month === '1,4,7,10'}
|
|
330
|
+
onchange={() => updatePart('month', '1,4,7,10')}
|
|
331
|
+
class="text-primary focus:ring-primary"
|
|
332
|
+
/>
|
|
333
|
+
<span>Quarterly (Jan, Apr, Jul, Oct)</span>
|
|
334
|
+
</label>
|
|
335
|
+
</div>
|
|
336
|
+
{:else if activeTab === 'week'}
|
|
337
|
+
<div class="space-y-2">
|
|
338
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
339
|
+
<input
|
|
340
|
+
type="radio"
|
|
341
|
+
name="week-mode"
|
|
342
|
+
checked={parts.week === '*'}
|
|
343
|
+
onchange={() => updatePart('week', '*')}
|
|
344
|
+
class="text-primary focus:ring-primary"
|
|
345
|
+
/>
|
|
346
|
+
<span>Every day of week (*)</span>
|
|
347
|
+
</label>
|
|
348
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
349
|
+
<input
|
|
350
|
+
type="radio"
|
|
351
|
+
name="week-mode"
|
|
352
|
+
checked={parts.week === '1-5'}
|
|
353
|
+
onchange={() => updatePart('week', '1-5')}
|
|
354
|
+
class="text-primary focus:ring-primary"
|
|
355
|
+
/>
|
|
356
|
+
<span>Workdays only (Monday to Friday, 1-5)</span>
|
|
357
|
+
</label>
|
|
358
|
+
<label class="flex items-center gap-2 cursor-pointer">
|
|
359
|
+
<input
|
|
360
|
+
type="radio"
|
|
361
|
+
name="week-mode"
|
|
362
|
+
checked={parts.week === '0,6'}
|
|
363
|
+
onchange={() => updatePart('week', '0,6')}
|
|
364
|
+
class="text-primary focus:ring-primary"
|
|
365
|
+
/>
|
|
366
|
+
<span>Weekends only (Saturday & Sunday, 0,6)</span>
|
|
367
|
+
</label>
|
|
368
|
+
</div>
|
|
369
|
+
{/if}
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
<!-- Next 5 Executions Preview -->
|
|
373
|
+
{#if showPreview}
|
|
374
|
+
<div class="rounded-lg border border-border/70 bg-muted/30 p-3 space-y-2">
|
|
375
|
+
<div class="flex items-center gap-1.5 font-semibold text-foreground">
|
|
376
|
+
<Play class="h-3.5 w-3.5 text-primary" />
|
|
377
|
+
<span>Next 5 Estimated Executions</span>
|
|
378
|
+
</div>
|
|
379
|
+
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2">
|
|
380
|
+
{#each nextExecutions as nextTime, idx (idx)}
|
|
381
|
+
<div class="flex items-center gap-2 rounded bg-background px-2.5 py-1.5 border border-border/50 font-mono text-[11px] text-muted-foreground">
|
|
382
|
+
<span class="rounded-full bg-primary/10 text-primary px-1.5 py-0.2 text-[10px] font-bold">#{idx + 1}</span>
|
|
383
|
+
<span class="text-foreground">{nextTime}</span>
|
|
384
|
+
</div>
|
|
385
|
+
{/each}
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
{/if}
|
|
389
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CronPreset {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CronExpressionBuilderProps {
|
|
7
|
+
/** Bound cron string, e.g. "0 9 * * 1-5" (5-part format) */
|
|
8
|
+
value?: string | undefined;
|
|
9
|
+
/** Extra class names */
|
|
10
|
+
class?: string | undefined;
|
|
11
|
+
/** Whether to show next execution preview (default: true) */
|
|
12
|
+
showPreview?: boolean | undefined;
|
|
13
|
+
/** Preset shortcuts */
|
|
14
|
+
presets?: CronPreset[] | undefined;
|
|
15
|
+
/** Change callback */
|
|
16
|
+
onchange?: ((cron: string) => void) | undefined;
|
|
17
|
+
}
|
|
18
|
+
declare const CronExpressionBuilder: import("svelte").Component<CronExpressionBuilderProps, {}, "value">;
|
|
19
|
+
type CronExpressionBuilder = ReturnType<typeof CronExpressionBuilder>;
|
|
20
|
+
export default CronExpressionBuilder;
|
|
@@ -15,28 +15,28 @@
|
|
|
15
15
|
export type DateRangePreset = NonNullable<DateInputOptions['presets']>[number];
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
|
-
value?: DateRangeInputValue | null;
|
|
19
|
-
mode?: DateTimeInputMode;
|
|
20
|
-
valueMode?: DateTimeValueMode;
|
|
21
|
-
timeZone?: string;
|
|
22
|
-
disambiguation?: DateTimeDisambiguation;
|
|
23
|
-
min?: string;
|
|
24
|
-
max?: string;
|
|
25
|
-
step?: number;
|
|
26
|
-
disabledDate?: (date: string) => boolean;
|
|
27
|
-
presets?: DateRangePreset[];
|
|
28
|
-
startId?: string;
|
|
29
|
-
endId?: string;
|
|
30
|
-
startName?: string;
|
|
31
|
-
endName?: string;
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
required?: boolean;
|
|
34
|
-
invalid?: boolean;
|
|
35
|
-
describedby?: string;
|
|
36
|
-
startAriaLabel?: string;
|
|
37
|
-
endAriaLabel?: string;
|
|
38
|
-
class?: string;
|
|
39
|
-
onchange?: (value: DateRangeInputValue) => void;
|
|
18
|
+
value?: DateRangeInputValue | null | undefined;
|
|
19
|
+
mode?: DateTimeInputMode | undefined;
|
|
20
|
+
valueMode?: DateTimeValueMode | undefined;
|
|
21
|
+
timeZone?: string | undefined;
|
|
22
|
+
disambiguation?: DateTimeDisambiguation | undefined;
|
|
23
|
+
min?: string | undefined;
|
|
24
|
+
max?: string | undefined;
|
|
25
|
+
step?: number | undefined;
|
|
26
|
+
disabledDate?: ((date: string) => boolean) | undefined;
|
|
27
|
+
presets?: DateRangePreset[] | undefined;
|
|
28
|
+
startId?: string | undefined;
|
|
29
|
+
endId?: string | undefined;
|
|
30
|
+
startName?: string | undefined;
|
|
31
|
+
endName?: string | undefined;
|
|
32
|
+
disabled?: boolean | undefined;
|
|
33
|
+
required?: boolean | undefined;
|
|
34
|
+
invalid?: boolean | undefined;
|
|
35
|
+
describedby?: string | undefined;
|
|
36
|
+
startAriaLabel?: string | undefined;
|
|
37
|
+
endAriaLabel?: string | undefined;
|
|
38
|
+
class?: string | undefined;
|
|
39
|
+
onchange?: ((value: DateRangeInputValue) => void) | undefined;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
let {
|
|
@@ -7,28 +7,28 @@ export interface DateRangeInputValue {
|
|
|
7
7
|
}
|
|
8
8
|
export type DateRangePreset = NonNullable<DateInputOptions['presets']>[number];
|
|
9
9
|
interface Props {
|
|
10
|
-
value?: DateRangeInputValue | null;
|
|
11
|
-
mode?: DateTimeInputMode;
|
|
12
|
-
valueMode?: DateTimeValueMode;
|
|
13
|
-
timeZone?: string;
|
|
14
|
-
disambiguation?: DateTimeDisambiguation;
|
|
15
|
-
min?: string;
|
|
16
|
-
max?: string;
|
|
17
|
-
step?: number;
|
|
18
|
-
disabledDate?: (date: string) => boolean;
|
|
19
|
-
presets?: DateRangePreset[];
|
|
20
|
-
startId?: string;
|
|
21
|
-
endId?: string;
|
|
22
|
-
startName?: string;
|
|
23
|
-
endName?: string;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
required?: boolean;
|
|
26
|
-
invalid?: boolean;
|
|
27
|
-
describedby?: string;
|
|
28
|
-
startAriaLabel?: string;
|
|
29
|
-
endAriaLabel?: string;
|
|
30
|
-
class?: string;
|
|
31
|
-
onchange?: (value: DateRangeInputValue) => void;
|
|
10
|
+
value?: DateRangeInputValue | null | undefined;
|
|
11
|
+
mode?: DateTimeInputMode | undefined;
|
|
12
|
+
valueMode?: DateTimeValueMode | undefined;
|
|
13
|
+
timeZone?: string | undefined;
|
|
14
|
+
disambiguation?: DateTimeDisambiguation | undefined;
|
|
15
|
+
min?: string | undefined;
|
|
16
|
+
max?: string | undefined;
|
|
17
|
+
step?: number | undefined;
|
|
18
|
+
disabledDate?: ((date: string) => boolean) | undefined;
|
|
19
|
+
presets?: DateRangePreset[] | undefined;
|
|
20
|
+
startId?: string | undefined;
|
|
21
|
+
endId?: string | undefined;
|
|
22
|
+
startName?: string | undefined;
|
|
23
|
+
endName?: string | undefined;
|
|
24
|
+
disabled?: boolean | undefined;
|
|
25
|
+
required?: boolean | undefined;
|
|
26
|
+
invalid?: boolean | undefined;
|
|
27
|
+
describedby?: string | undefined;
|
|
28
|
+
startAriaLabel?: string | undefined;
|
|
29
|
+
endAriaLabel?: string | undefined;
|
|
30
|
+
class?: string | undefined;
|
|
31
|
+
onchange?: ((value: DateRangeInputValue) => void) | undefined;
|
|
32
32
|
}
|
|
33
33
|
declare const DateRangeInput: import("svelte").Component<Props, {}, "value">;
|
|
34
34
|
type DateRangeInput = ReturnType<typeof DateRangeInput>;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
export type DateTimeInputMode = 'date' | 'time' | 'datetime';
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
|
-
value?: string | null;
|
|
13
|
-
mode?: DateTimeInputMode;
|
|
12
|
+
value?: string | null | undefined;
|
|
13
|
+
mode?: DateTimeInputMode | undefined;
|
|
14
14
|
min?: string | undefined;
|
|
15
15
|
max?: string | undefined;
|
|
16
16
|
minInstant?: string | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type DateTimeValueMode, type DateTimeDisambiguation } from '@svadmin/core/date-time';
|
|
2
2
|
export type DateTimeInputMode = 'date' | 'time' | 'datetime';
|
|
3
3
|
interface Props {
|
|
4
|
-
value?: string | null;
|
|
5
|
-
mode?: DateTimeInputMode;
|
|
4
|
+
value?: string | null | undefined;
|
|
5
|
+
mode?: DateTimeInputMode | undefined;
|
|
6
6
|
min?: string | undefined;
|
|
7
7
|
max?: string | undefined;
|
|
8
8
|
minInstant?: string | undefined;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
imageAlt,
|
|
15
15
|
icon,
|
|
16
16
|
children,
|
|
17
|
-
}
|
|
17
|
+
}: {
|
|
18
18
|
title?: string;
|
|
19
19
|
description?: string;
|
|
20
20
|
/** Optional illustration URL. Mirrors the reference `image` prop. */
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/** Optional custom icon slot; ignored when `image` is set. */
|
|
24
24
|
icon?: Snippet;
|
|
25
25
|
children?: Snippet;
|
|
26
|
-
}
|
|
26
|
+
} = $props();
|
|
27
27
|
|
|
28
28
|
function textDefault(value: unknown): string | undefined {
|
|
29
29
|
return typeof value === 'string' ? value : undefined;
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
title,
|
|
18
18
|
description,
|
|
19
19
|
retry,
|
|
20
|
-
}
|
|
20
|
+
}: {
|
|
21
21
|
/** Kept for host compatibility; diagnostics are never rendered by default. */
|
|
22
22
|
error?: Error | null;
|
|
23
23
|
title?: string;
|
|
24
24
|
description?: string;
|
|
25
25
|
retry?: () => void;
|
|
26
|
-
}
|
|
26
|
+
} = $props();
|
|
27
27
|
|
|
28
28
|
const resolvedTitle = $derived(title ?? translatedOrFallback('error.title', 'common.error'));
|
|
29
29
|
const resolvedDescription = $derived(
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
title,
|
|
15
15
|
id,
|
|
16
16
|
onfocusfield,
|
|
17
|
-
}
|
|
17
|
+
}: {
|
|
18
18
|
errors?: FormErrorEntry[];
|
|
19
19
|
title?: string;
|
|
20
20
|
id?: string;
|
|
21
21
|
onfocusfield?: (fieldKey: string) => void;
|
|
22
|
-
}
|
|
22
|
+
} = $props();
|
|
23
23
|
|
|
24
24
|
const generatedId = $props.id();
|
|
25
25
|
const headingId = $derived(`${id ?? generatedId}-title`);
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
const i18n = useTranslation();
|
|
45
45
|
|
|
46
46
|
let {
|
|
47
|
-
field, value, onchange, disabled, invalid = false, errorId, id, children, nativeSubmit = true,
|
|
47
|
+
field, value, onchange, disabled = false, invalid = false, errorId, id, children, nativeSubmit = true,
|
|
48
48
|
upload, cancelUpload, onUploadStateChange, fileReferenceMode = false, fileScopeKey,
|
|
49
|
-
}
|
|
49
|
+
}: {
|
|
50
50
|
field: FieldDefinition;
|
|
51
51
|
value: unknown;
|
|
52
52
|
onchange: (val: unknown) => void;
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
fileReferenceMode?: boolean;
|
|
66
66
|
/** 记录/上传作用域或 reset 变化时只重挂载文件字段。 */
|
|
67
67
|
fileScopeKey?: string | number | object;
|
|
68
|
-
}
|
|
68
|
+
} = $props();
|
|
69
69
|
|
|
70
70
|
const instanceId = $props.id();
|
|
71
71
|
const controlId = $derived(id ?? (children ? field.key : `${instanceId}-control`));
|
|
@@ -16,22 +16,22 @@
|
|
|
16
16
|
} from './file-upload-types.js';
|
|
17
17
|
|
|
18
18
|
interface Props {
|
|
19
|
-
id?: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
accept?: string;
|
|
22
|
-
multiple?: boolean;
|
|
23
|
-
maxFiles?: number;
|
|
24
|
-
maxSize?: number;
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
required?: boolean;
|
|
27
|
-
ariaLabel?: string;
|
|
28
|
-
invalid?: boolean;
|
|
29
|
-
describedby?: string;
|
|
30
|
-
upload?: UploadHandler;
|
|
31
|
-
cancelUpload?: UploadCancelHandler;
|
|
32
|
-
onChange?: (items: UploadItem[]) => void;
|
|
33
|
-
onReject?: (file: File, reason: string) => void;
|
|
34
|
-
class?: string;
|
|
19
|
+
id?: string | undefined;
|
|
20
|
+
name?: string | undefined;
|
|
21
|
+
accept?: string | undefined;
|
|
22
|
+
multiple?: boolean | undefined;
|
|
23
|
+
maxFiles?: number | undefined;
|
|
24
|
+
maxSize?: number | undefined;
|
|
25
|
+
disabled?: boolean | undefined;
|
|
26
|
+
required?: boolean | undefined;
|
|
27
|
+
ariaLabel?: string | undefined;
|
|
28
|
+
invalid?: boolean | undefined;
|
|
29
|
+
describedby?: string | undefined;
|
|
30
|
+
upload?: UploadHandler | undefined;
|
|
31
|
+
cancelUpload?: UploadCancelHandler | undefined;
|
|
32
|
+
onChange?: ((items: UploadItem[]) => void) | undefined;
|
|
33
|
+
onReject?: ((file: File, reason: string) => void) | undefined;
|
|
34
|
+
class?: string | undefined;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
let {
|