@svadmin/lite 0.16.11 → 0.22.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/README.md +71 -2
- package/dist/components/LiteActivityFeed.svelte +31 -9
- package/dist/components/LiteActivityFeed.svelte.d.ts +6 -0
- package/dist/components/LiteAffix.svelte +29 -0
- package/dist/components/LiteAffix.svelte.d.ts +13 -0
- package/dist/components/LiteAnchor.svelte +38 -0
- package/dist/components/LiteAnchor.svelte.d.ts +14 -0
- package/dist/components/LiteApprovalActionCard.svelte +8 -5
- package/dist/components/LiteApprovalActionCard.svelte.d.ts +2 -0
- package/dist/components/LiteAuditLog.svelte +9 -9
- package/dist/components/LiteAutoComplete.svelte +41 -0
- package/dist/components/LiteAutoComplete.svelte.d.ts +13 -0
- package/dist/components/LiteBackTop.svelte +16 -0
- package/dist/components/LiteBackTop.svelte.d.ts +8 -0
- package/dist/components/LiteBreadcrumbs.svelte +4 -1
- package/dist/components/LiteBreadcrumbs.svelte.d.ts +2 -0
- package/dist/components/LiteCalendar.svelte +124 -0
- package/dist/components/LiteCalendar.svelte.d.ts +20 -0
- package/dist/components/LiteCanvasAnnotation.svelte +13 -13
- package/dist/components/LiteCarousel.svelte +72 -0
- package/dist/components/LiteCarousel.svelte.d.ts +14 -0
- package/dist/components/LiteChatDialog.svelte +8 -8
- package/dist/components/LiteCollapse.svelte +49 -0
- package/dist/components/LiteCollapse.svelte.d.ts +15 -0
- package/dist/components/LiteColumnHeaderFilter.svelte +4 -1
- package/dist/components/LiteColumnHeaderFilter.svelte.d.ts +2 -0
- package/dist/components/LiteColumnSettings.svelte +7 -4
- package/dist/components/LiteColumnSettings.svelte.d.ts +2 -0
- package/dist/components/LiteCommentThread.svelte +113 -0
- package/dist/components/LiteCommentThread.svelte.d.ts +26 -0
- package/dist/components/LiteConfirmDialog.svelte +2 -2
- package/dist/components/LiteCountdown.svelte +49 -0
- package/dist/components/LiteCountdown.svelte.d.ts +10 -0
- package/dist/components/LiteDecisionTable.svelte +14 -14
- package/dist/components/LiteDetailDrawer.svelte +45 -0
- package/dist/components/LiteDetailDrawer.svelte.d.ts +14 -0
- package/dist/components/LiteDraggableRowTable.svelte +5 -2
- package/dist/components/LiteDraggableRowTable.svelte.d.ts +2 -0
- package/dist/components/LiteDrawerForm.svelte +11 -8
- package/dist/components/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/LiteDynamicFormList.svelte +5 -5
- package/dist/components/LiteEditableTable.svelte +5 -2
- package/dist/components/LiteEditableTable.svelte.d.ts +2 -0
- package/dist/components/LiteEmptyState.svelte +11 -4
- package/dist/components/LiteEmptyState.svelte.d.ts +3 -0
- package/dist/components/LiteFilterBuilder.svelte +8 -5
- package/dist/components/LiteFilterBuilder.svelte.d.ts +2 -0
- package/dist/components/LiteFloatButton.svelte +54 -0
- package/dist/components/LiteFloatButton.svelte.d.ts +15 -0
- package/dist/components/LiteGanttChart.svelte +20 -20
- package/dist/components/LiteGrid.svelte +34 -0
- package/dist/components/LiteGrid.svelte.d.ts +11 -0
- package/dist/components/LiteImage.svelte +54 -0
- package/dist/components/LiteImage.svelte.d.ts +14 -0
- package/dist/components/LiteImageCropper.svelte +7 -4
- package/dist/components/LiteImageCropper.svelte.d.ts +2 -0
- package/dist/components/LiteImagePreview.svelte +36 -0
- package/dist/components/LiteImagePreview.svelte.d.ts +13 -0
- package/dist/components/LiteImportWizard.svelte +7 -7
- package/dist/components/LiteItemList.svelte +50 -0
- package/dist/components/LiteItemList.svelte.d.ts +15 -0
- package/dist/components/LiteJsonSchemaForm.svelte +10 -7
- package/dist/components/LiteJsonSchemaForm.svelte.d.ts +2 -0
- package/dist/components/LiteKanbanBoard.svelte +19 -19
- package/dist/components/LiteLayout.svelte +18 -6
- package/dist/components/LiteLayout.svelte.d.ts +8 -0
- package/dist/components/LiteLink.svelte +32 -0
- package/dist/components/LiteLink.svelte.d.ts +11 -0
- package/dist/components/LiteLogin.svelte +9 -2
- package/dist/components/LiteLogin.svelte.d.ts +2 -0
- package/dist/components/LiteMasterDetailView.svelte +13 -10
- package/dist/components/LiteMasterDetailView.svelte.d.ts +2 -0
- package/dist/components/LiteMediaLibraryModal.svelte +8 -5
- package/dist/components/LiteMediaLibraryModal.svelte.d.ts +2 -0
- package/dist/components/LiteMediaThumbnail.svelte +3 -3
- package/dist/components/LiteMentionsInput.svelte +9 -9
- package/dist/components/LiteMenu.svelte +22 -0
- package/dist/components/LiteMenu.svelte.d.ts +12 -0
- package/dist/components/LiteMenuList.svelte +55 -0
- package/dist/components/LiteMenuList.svelte.d.ts +17 -0
- package/dist/components/LiteModalForm.svelte +9 -6
- package/dist/components/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/LiteMultiTabKeepAlive.svelte +6 -6
- package/dist/components/LiteNotificationCenter.svelte +85 -0
- package/dist/components/LiteNotificationCenter.svelte.d.ts +22 -0
- package/dist/components/LiteOfflineSyncBanner.svelte +6 -6
- package/dist/components/LiteOtpInput.svelte +50 -0
- package/dist/components/LiteOtpInput.svelte.d.ts +15 -0
- package/dist/components/LitePageHeader.svelte +34 -0
- package/dist/components/LitePageHeader.svelte.d.ts +13 -0
- package/dist/components/LitePagination.svelte +10 -2
- package/dist/components/LitePagination.svelte.d.ts +2 -0
- package/dist/components/LitePdfDocumentViewer.svelte +14 -14
- package/dist/components/LitePermissionMatrix.svelte +8 -8
- package/dist/components/LitePivotTable.svelte +11 -11
- package/dist/components/LitePopconfirm.svelte +49 -0
- package/dist/components/LitePopconfirm.svelte.d.ts +14 -0
- package/dist/components/LitePresenceAvatarGroup.svelte +8 -5
- package/dist/components/LitePresenceAvatarGroup.svelte.d.ts +2 -0
- package/dist/components/LitePrintableBill.svelte +12 -9
- package/dist/components/LitePrintableBill.svelte.d.ts +2 -0
- package/dist/components/LiteProgress.svelte +46 -0
- package/dist/components/LiteProgress.svelte.d.ts +12 -0
- package/dist/components/LiteQRCode.svelte +62 -0
- package/dist/components/LiteQRCode.svelte.d.ts +14 -0
- package/dist/components/LiteResizeBox.svelte +34 -0
- package/dist/components/LiteResizeBox.svelte.d.ts +12 -0
- package/dist/components/LiteResult.svelte +52 -0
- package/dist/components/LiteResult.svelte.d.ts +14 -0
- package/dist/components/LiteRowActions.svelte +36 -0
- package/dist/components/LiteRowActions.svelte.d.ts +17 -0
- package/dist/components/LiteSensitiveDataMask.svelte +4 -1
- package/dist/components/LiteSensitiveDataMask.svelte.d.ts +2 -0
- package/dist/components/LiteShow.svelte +1 -1
- package/dist/components/LiteShowField.svelte +2 -2
- package/dist/components/LiteSignaturePad.svelte +9 -9
- package/dist/components/LiteSkeleton.svelte +100 -0
- package/dist/components/LiteSkeleton.svelte.d.ts +19 -0
- package/dist/components/LiteSpace.svelte +31 -0
- package/dist/components/LiteSpace.svelte.d.ts +12 -0
- package/dist/components/LiteSpin.svelte +27 -0
- package/dist/components/LiteSpin.svelte.d.ts +10 -0
- package/dist/components/LiteSplitPaneLayout.svelte +18 -6
- package/dist/components/LiteSplitPaneLayout.svelte.d.ts +8 -0
- package/dist/components/LiteSpreadsheetView.svelte +8 -8
- package/dist/components/LiteStatistic.svelte +63 -0
- package/dist/components/LiteStatistic.svelte.d.ts +15 -0
- package/dist/components/LiteStatsCard.svelte +5 -2
- package/dist/components/LiteStatsCard.svelte.d.ts +2 -0
- package/dist/components/LiteStatusBadge.svelte +33 -0
- package/dist/components/LiteStatusBadge.svelte.d.ts +12 -0
- package/dist/components/LiteStatusTabs.svelte +35 -0
- package/dist/components/LiteStatusTabs.svelte.d.ts +14 -0
- package/dist/components/LiteStepForm.svelte +14 -11
- package/dist/components/LiteStepForm.svelte.d.ts +2 -0
- package/dist/components/LiteSteps.svelte +64 -0
- package/dist/components/LiteSteps.svelte.d.ts +18 -0
- package/dist/components/LiteTable.svelte +5 -2
- package/dist/components/LiteTable.svelte.d.ts +2 -0
- package/dist/components/LiteTableSummary.svelte +8 -5
- package/dist/components/LiteTableSummary.svelte.d.ts +2 -0
- package/dist/components/LiteTabs.svelte +30 -20
- package/dist/components/LiteTabs.svelte.d.ts +11 -2
- package/dist/components/LiteTag.svelte +31 -0
- package/dist/components/LiteTag.svelte.d.ts +13 -0
- package/dist/components/LiteTimeline.svelte +48 -0
- package/dist/components/LiteTimeline.svelte.d.ts +17 -0
- package/dist/components/LiteTour.svelte +54 -0
- package/dist/components/LiteTour.svelte.d.ts +15 -0
- package/dist/components/LiteTransfer.svelte +9 -6
- package/dist/components/LiteTransfer.svelte.d.ts +2 -0
- package/dist/components/LiteTree.svelte +48 -0
- package/dist/components/LiteTree.svelte.d.ts +17 -0
- package/dist/components/LiteTreeTable.svelte +1 -1
- package/dist/components/LiteTwoFactorStepper.svelte +53 -0
- package/dist/components/LiteTwoFactorStepper.svelte.d.ts +16 -0
- package/dist/components/LiteVersionDiffViewer.svelte +16 -13
- package/dist/components/LiteVersionDiffViewer.svelte.d.ts +2 -0
- package/dist/components/LiteVideoPlayer.svelte +67 -0
- package/dist/components/LiteVideoPlayer.svelte.d.ts +22 -0
- package/dist/components/LiteVirtualTable.svelte +1 -1
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte +42 -13
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte.d.ts +10 -4
- package/dist/components/advanced/LiteDraggableHeader.svelte +2 -2
- package/dist/components/advanced/LiteDrawerForm.svelte +4 -1
- package/dist/components/advanced/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/advanced/LiteInlineEdit.svelte +1 -1
- package/dist/components/advanced/LiteModalForm.svelte +4 -1
- package/dist/components/advanced/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/advanced/LiteToast.svelte +3 -3
- package/dist/components/advanced/LiteUndoableNotification.svelte +1 -1
- package/dist/components/compatibility/LiteRealtimeStatus.svelte +41 -2
- package/dist/components/compatibility/LiteRealtimeStatus.svelte.d.ts +15 -0
- package/dist/components/fields/LiteBooleanField.svelte +4 -2
- package/dist/components/fields/LiteBooleanField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteCascader.svelte +5 -2
- package/dist/components/fields/LiteCascader.svelte.d.ts +2 -0
- package/dist/components/fields/LiteDateField.svelte +39 -9
- package/dist/components/fields/LiteDateField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteDateRangeField.svelte +1 -1
- package/dist/components/fields/LiteImageField.svelte +6 -2
- package/dist/components/fields/LiteImageField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteJsonField.svelte +1 -1
- package/dist/components/fields/LiteMarkdownField.svelte +49 -3
- package/dist/components/fields/LiteMarkdownField.svelte.d.ts +5 -0
- package/dist/components/fields/LiteNumberField.svelte +5 -3
- package/dist/components/fields/LiteNumberField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteRichTextField.svelte +49 -12
- package/dist/components/fields/LiteRichTextField.svelte.d.ts +3 -0
- package/dist/components/fields/LiteSelectField.svelte +5 -3
- package/dist/components/fields/LiteSelectField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTagField.svelte +38 -15
- package/dist/components/fields/LiteTagField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTextField.svelte +26 -5
- package/dist/components/fields/LiteTextField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTreeSelect.svelte +5 -2
- package/dist/components/fields/LiteTreeSelect.svelte.d.ts +2 -0
- package/dist/components/fields/LiteUrlField.svelte +5 -3
- package/dist/components/fields/LiteUrlField.svelte.d.ts +2 -0
- package/dist/components/layout/LiteAuthenticated.svelte +2 -2
- package/dist/components/layout/LiteCanAccess.svelte +1 -1
- package/dist/components/layout/LiteErrorComponent.svelte +4 -4
- package/dist/components/layout/LiteHeader.svelte +2 -2
- package/dist/components/layout/LiteSidebar.svelte +6 -3
- package/dist/components/layout/LiteSidebar.svelte.d.ts +2 -0
- package/dist/components/pages/LiteCreatePage.svelte +4 -1
- package/dist/components/pages/LiteCreatePage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteEditPage.svelte +4 -1
- package/dist/components/pages/LiteEditPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteForgotPasswordPage.svelte +7 -7
- package/dist/components/pages/LiteListPage.svelte +6 -3
- package/dist/components/pages/LiteListPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteProfilePage.svelte +2 -2
- package/dist/components/pages/LiteRegisterPage.svelte +6 -6
- package/dist/components/pages/LiteShowPage.svelte +6 -3
- package/dist/components/pages/LiteShowPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteUpdatePasswordPage.svelte +4 -4
- package/dist/components/widgets/LiteAnomalyBadge.svelte +6 -3
- package/dist/components/widgets/LiteAnomalyBadge.svelte.d.ts +2 -0
- package/dist/components/widgets/LiteAreaChart.svelte +20 -0
- package/dist/components/widgets/LiteAreaChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteBarChart.svelte +6 -6
- package/dist/components/widgets/LiteChartSvg.svelte +102 -0
- package/dist/components/widgets/LiteChartSvg.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteChartTable.svelte +44 -0
- package/dist/components/widgets/LiteChartTable.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteDonutChart.svelte +20 -0
- package/dist/components/widgets/LiteDonutChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteFunnelChart.svelte +20 -0
- package/dist/components/widgets/LiteFunnelChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteGaugeChart.svelte +20 -0
- package/dist/components/widgets/LiteGaugeChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte +20 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteInsightCard.svelte +35 -13
- package/dist/components/widgets/LiteInsightCard.svelte.d.ts +7 -4
- package/dist/components/widgets/LiteLineChart.svelte +13 -10
- package/dist/components/widgets/LiteLineChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LitePieChart.svelte +11 -9
- package/dist/components/widgets/LitePieChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LiteRadarChart.svelte +20 -0
- package/dist/components/widgets/LiteRadarChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteRoseChart.svelte +20 -0
- package/dist/components/widgets/LiteRoseChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteScatterChart.svelte +20 -0
- package/dist/components/widgets/LiteScatterChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte +20 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte.d.ts +10 -0
- package/dist/components/widgets/chart-geometry.d.ts +65 -0
- package/dist/components/widgets/chart-geometry.js +229 -0
- package/dist/components/widgets/index.d.ts +10 -0
- package/dist/components/widgets/index.js +10 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +47 -0
- package/dist/lite-code-theme.css +139 -0
- package/dist/lite.css +234 -127
- package/dist/rich-content.d.ts +47 -0
- package/dist/rich-content.js +498 -0
- package/dist/schema-generator.js +3 -1
- package/dist/server-adapter.js +6 -11
- package/dist/value-normalization.d.ts +4 -0
- package/dist/value-normalization.js +13 -0
- package/package.json +18 -4
|
@@ -11,6 +11,8 @@ interface Props {
|
|
|
11
11
|
recordId?: string | number;
|
|
12
12
|
basePath?: string;
|
|
13
13
|
label?: string;
|
|
14
|
+
/** Caller class merged with the built-in class list. */
|
|
15
|
+
class?: string;
|
|
14
16
|
}
|
|
15
17
|
declare const LiteModalForm: import("svelte").Component<Props, {}, "">;
|
|
16
18
|
type LiteModalForm = ReturnType<typeof LiteModalForm>;
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
let { message, type = 'info', dismissUrl }: Props = $props();
|
|
15
15
|
|
|
16
16
|
const colors: Record<NonNullable<Props['type']>, { bg: string; border: string; text: string }> = {
|
|
17
|
-
success: { bg: '#
|
|
18
|
-
error: { bg: '#
|
|
19
|
-
warning: { bg: '#
|
|
17
|
+
success: { bg: '#E8FFEA', border: '#E8FFEA', text: '#009A29' },
|
|
18
|
+
error: { bg: '#FFECE8', border: '#FDCDC5', text: '#CB272D' },
|
|
19
|
+
warning: { bg: '#FFF7E8', border: '#fed7aa', text: '#D25F00' },
|
|
20
20
|
info: { bg: '#eff6ff', border: '#bfdbfe', text: '#1e40af' },
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<div
|
|
17
17
|
role="alert"
|
|
18
|
-
style="padding: 12px 16px; background: #
|
|
18
|
+
style="padding: 12px 16px; background: #FFF7E8; border: 1px solid #FFE4BA; color: #713f12; border-radius: 6px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; font-size: 14px;"
|
|
19
19
|
>
|
|
20
20
|
<span>{message}</span>
|
|
21
21
|
<a
|
|
@@ -1,24 +1,55 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { toSafeHref } from '../../security';
|
|
3
3
|
|
|
4
|
+
type Connection = 'connecting' | 'connected' | 'disconnected';
|
|
5
|
+
|
|
4
6
|
interface Props {
|
|
5
7
|
title?: string;
|
|
8
|
+
/** Free-text snapshot label rendered as a badge. */
|
|
6
9
|
status?: string;
|
|
10
|
+
/** Connection state, mirroring the reference `status` prop. */
|
|
11
|
+
connection?: Connection;
|
|
12
|
+
/** Resource the stream is bound to, shown when details are enabled. */
|
|
13
|
+
resource?: string;
|
|
14
|
+
/** Last received event; only its type and timestamp are rendered. */
|
|
15
|
+
lastEvent?: { type: string; timestamp?: number } | null;
|
|
16
|
+
/** Render resource and last-event details next to the badge. */
|
|
17
|
+
showDetails?: boolean;
|
|
7
18
|
lastUpdated?: string;
|
|
8
19
|
refreshHref?: string;
|
|
9
20
|
refreshLabel?: string;
|
|
10
21
|
refreshSeconds?: number;
|
|
22
|
+
/** Caller class merged with the built-in class list. */
|
|
23
|
+
class?: string;
|
|
11
24
|
}
|
|
12
25
|
|
|
13
26
|
let {
|
|
14
27
|
title = 'Live status',
|
|
15
28
|
status = 'Snapshot',
|
|
29
|
+
connection,
|
|
30
|
+
resource,
|
|
31
|
+
lastEvent = null,
|
|
32
|
+
showDetails = false,
|
|
16
33
|
lastUpdated,
|
|
17
34
|
refreshHref = '',
|
|
18
35
|
refreshLabel = 'Refresh status',
|
|
19
36
|
refreshSeconds = 0,
|
|
37
|
+
class: className = '',
|
|
20
38
|
}: Props = $props();
|
|
21
39
|
|
|
40
|
+
const connectionLabel: Record<Connection, string> = {
|
|
41
|
+
connected: 'Live',
|
|
42
|
+
connecting: 'Connecting…',
|
|
43
|
+
disconnected: 'Offline',
|
|
44
|
+
};
|
|
45
|
+
const connectionTone: Record<Connection, string> = {
|
|
46
|
+
connected: 'lite-badge-success',
|
|
47
|
+
connecting: 'lite-badge-warning',
|
|
48
|
+
disconnected: 'lite-badge-danger',
|
|
49
|
+
};
|
|
50
|
+
const connectionClass = $derived(connection ? connectionTone[connection] : 'lite-badge-info');
|
|
51
|
+
const badgeText = $derived(connection ? connectionLabel[connection] : status);
|
|
52
|
+
|
|
22
53
|
const safeRefreshSeconds = $derived(
|
|
23
54
|
Number.isFinite(refreshSeconds) && refreshSeconds >= 5
|
|
24
55
|
? Math.floor(refreshSeconds)
|
|
@@ -33,10 +64,18 @@
|
|
|
33
64
|
{/if}
|
|
34
65
|
</svelte:head>
|
|
35
66
|
|
|
36
|
-
<section
|
|
67
|
+
<section
|
|
68
|
+
class={`lite-realtime-status ${className}`.trim()}
|
|
69
|
+
aria-live="polite"
|
|
70
|
+
data-connection={connection}
|
|
71
|
+
>
|
|
37
72
|
<div>
|
|
38
73
|
<strong>{title}</strong>
|
|
39
|
-
<span class=
|
|
74
|
+
<span class={`lite-badge ${connectionClass}`} role={connection ? 'status' : undefined}>{badgeText}</span>
|
|
75
|
+
{#if resource}<span class="lite-muted">{resource}</span>{/if}
|
|
76
|
+
{#if showDetails && lastEvent}
|
|
77
|
+
<span class="lite-muted">{lastEvent.type}{#if lastEvent.timestamp} · {new Date(lastEvent.timestamp).toISOString()}{/if}</span>
|
|
78
|
+
{/if}
|
|
40
79
|
{#if lastUpdated}<span class="lite-muted">Updated {lastUpdated}</span>{/if}
|
|
41
80
|
</div>
|
|
42
81
|
{#if safeRefreshHref}<a href={safeRefreshHref} class="lite-btn lite-btn-sm">{refreshLabel}</a>{/if}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
|
+
type Connection = 'connecting' | 'connected' | 'disconnected';
|
|
1
2
|
interface Props {
|
|
2
3
|
title?: string;
|
|
4
|
+
/** Free-text snapshot label rendered as a badge. */
|
|
3
5
|
status?: string;
|
|
6
|
+
/** Connection state, mirroring the reference `status` prop. */
|
|
7
|
+
connection?: Connection;
|
|
8
|
+
/** Resource the stream is bound to, shown when details are enabled. */
|
|
9
|
+
resource?: string;
|
|
10
|
+
/** Last received event; only its type and timestamp are rendered. */
|
|
11
|
+
lastEvent?: {
|
|
12
|
+
type: string;
|
|
13
|
+
timestamp?: number;
|
|
14
|
+
} | null;
|
|
15
|
+
/** Render resource and last-event details next to the badge. */
|
|
16
|
+
showDetails?: boolean;
|
|
4
17
|
lastUpdated?: string;
|
|
5
18
|
refreshHref?: string;
|
|
6
19
|
refreshLabel?: string;
|
|
7
20
|
refreshSeconds?: number;
|
|
21
|
+
/** Caller class merged with the built-in class list. */
|
|
22
|
+
class?: string;
|
|
8
23
|
}
|
|
9
24
|
declare const LiteRealtimeStatus: import("svelte").Component<Props, {}, "">;
|
|
10
25
|
type LiteRealtimeStatus = ReturnType<typeof LiteRealtimeStatus>;
|
|
@@ -7,16 +7,18 @@
|
|
|
7
7
|
value?: unknown;
|
|
8
8
|
error?: string[];
|
|
9
9
|
mode?: 'show' | 'edit' | 'create';
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
let { field, value, error = [], mode = 'show' }: Props = $props();
|
|
14
|
+
let { field, value, error = [], mode = 'show', class: className = '' }: Props = $props();
|
|
13
15
|
let hasError = $derived(error.length > 0);
|
|
14
16
|
|
|
15
17
|
const checked = $derived(isExplicitBooleanTrue(value));
|
|
16
18
|
</script>
|
|
17
19
|
|
|
18
20
|
{#if mode === 'show'}
|
|
19
|
-
<div>
|
|
21
|
+
<div class="lite-field-value {className}">
|
|
20
22
|
<span class="lite-bool {checked ? 'lite-bool-true' : ''}"></span>
|
|
21
23
|
{checked ? '✓ Yes' : '✗ No'}
|
|
22
24
|
</div>
|
|
@@ -4,6 +4,8 @@ interface Props {
|
|
|
4
4
|
value?: unknown;
|
|
5
5
|
error?: string[];
|
|
6
6
|
mode?: 'show' | 'edit' | 'create';
|
|
7
|
+
/** Caller class merged with the built-in class list. */
|
|
8
|
+
class?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const LiteBooleanField: import("svelte").Component<Props, {}, "">;
|
|
9
11
|
type LiteBooleanField = ReturnType<typeof LiteBooleanField>;
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
required?: boolean;
|
|
25
25
|
error?: string[];
|
|
26
26
|
mode?: 'show' | 'edit' | 'create';
|
|
27
|
+
/** Caller class merged with the built-in class list. */
|
|
28
|
+
class?: string;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
let {
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
required = field?.required ?? false,
|
|
39
41
|
error = [],
|
|
40
42
|
mode = 'show',
|
|
43
|
+
class: className = ''
|
|
41
44
|
}: Props = $props();
|
|
42
45
|
|
|
43
46
|
const hasError = $derived(error.length > 0);
|
|
@@ -84,9 +87,9 @@
|
|
|
84
87
|
</script>
|
|
85
88
|
|
|
86
89
|
{#if mode === 'show'}
|
|
87
|
-
<span class="lite-badge">{formatDisplay(value)}</span>
|
|
90
|
+
<span class="lite-badge {className}">{formatDisplay(value)}</span>
|
|
88
91
|
{:else}
|
|
89
|
-
<div class="lite-form-group">
|
|
92
|
+
<div class="lite-form-group {className}">
|
|
90
93
|
{#if label}
|
|
91
94
|
<label class="lite-label" for={name}>
|
|
92
95
|
{label}
|
|
@@ -18,6 +18,8 @@ interface Props {
|
|
|
18
18
|
required?: boolean;
|
|
19
19
|
error?: string[];
|
|
20
20
|
mode?: 'show' | 'edit' | 'create';
|
|
21
|
+
/** Caller class merged with the built-in class list. */
|
|
22
|
+
class?: string;
|
|
21
23
|
}
|
|
22
24
|
declare const LiteCascader: import("svelte").Component<Props, {}, "">;
|
|
23
25
|
type LiteCascader = ReturnType<typeof LiteCascader>;
|
|
@@ -7,21 +7,50 @@
|
|
|
7
7
|
value?: unknown;
|
|
8
8
|
error?: string[];
|
|
9
9
|
mode?: 'show' | 'edit' | 'create';
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
let { field, value, error = [], mode = 'show' }: Props = $props();
|
|
14
|
+
let { field, value, error = [], mode = 'show', class: className = '' }: Props = $props();
|
|
13
15
|
const i18n = useTranslation();
|
|
14
16
|
let hasError = $derived(error.length > 0);
|
|
15
17
|
|
|
18
|
+
/** Native input type follows the field domain: date-only stays date-only. */
|
|
19
|
+
const inputType = $derived(field.type === 'datetime' ? 'datetime-local' : 'date');
|
|
20
|
+
|
|
21
|
+
function pad(value: number): string {
|
|
22
|
+
return String(value).padStart(2, '0');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Normalize into the value shape the native control expects. ISO-ish strings
|
|
27
|
+
* are sliced instead of round-tripped through UTC, so a stored
|
|
28
|
+
* `2024-03-15` never shifts to the previous day.
|
|
29
|
+
*/
|
|
16
30
|
function formatDate(v: unknown): string {
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
31
|
+
if (v == null || v === '') return '';
|
|
32
|
+
if (typeof v === 'string') {
|
|
33
|
+
if (inputType === 'datetime-local') {
|
|
34
|
+
const match = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2})/u.exec(v);
|
|
35
|
+
if (match?.[1] && match[2]) return `${match[1]}T${match[2]}`;
|
|
36
|
+
} else {
|
|
37
|
+
const match = /^(\d{4}-\d{2}-\d{2})/u.exec(v);
|
|
38
|
+
if (match?.[1]) return match[1];
|
|
39
|
+
}
|
|
22
40
|
}
|
|
41
|
+
const date = v instanceof Date ? v : new Date(String(v));
|
|
42
|
+
if (Number.isNaN(date.getTime())) return '';
|
|
43
|
+
const day = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
44
|
+
return inputType === 'datetime-local' ? `${day}T${pad(date.getHours())}:${pad(date.getMinutes())}` : day;
|
|
23
45
|
}
|
|
24
46
|
|
|
47
|
+
const dateOptions = $derived(field.dateInput);
|
|
48
|
+
const boundAttributes = $derived({
|
|
49
|
+
...(dateOptions?.min ? { min: dateOptions.min } : {}),
|
|
50
|
+
...(dateOptions?.max ? { max: dateOptions.max } : {}),
|
|
51
|
+
...(inputType === 'date' && dateOptions?.step ? { step: String(dateOptions.step) } : {}),
|
|
52
|
+
});
|
|
53
|
+
|
|
25
54
|
function displayDate(v: unknown): string {
|
|
26
55
|
if (!v) return '—';
|
|
27
56
|
try {
|
|
@@ -33,16 +62,17 @@
|
|
|
33
62
|
</script>
|
|
34
63
|
|
|
35
64
|
{#if mode === 'show'}
|
|
36
|
-
<span>{displayDate(value)}</span>
|
|
65
|
+
<span class="lite-field-value {className}">{displayDate(value)}</span>
|
|
37
66
|
{:else}
|
|
38
|
-
<div>
|
|
67
|
+
<div class="lite-field-edit {className}">
|
|
39
68
|
<input
|
|
40
|
-
type=
|
|
69
|
+
type={inputType}
|
|
41
70
|
lang={i18n.locale}
|
|
42
71
|
name={field.key}
|
|
43
72
|
id={field.key}
|
|
44
73
|
value={formatDate(value)}
|
|
45
74
|
class="lite-input {hasError ? 'lite-input-error' : ''}"
|
|
75
|
+
{...boundAttributes}
|
|
46
76
|
{...field.required ? { required: true } : {}}
|
|
47
77
|
/>
|
|
48
78
|
{#if hasError}
|
|
@@ -4,6 +4,8 @@ interface Props {
|
|
|
4
4
|
value?: unknown;
|
|
5
5
|
error?: string[];
|
|
6
6
|
mode?: 'show' | 'edit' | 'create';
|
|
7
|
+
/** Caller class merged with the built-in class list. */
|
|
8
|
+
class?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const LiteDateField: import("svelte").Component<Props, {}, "">;
|
|
9
11
|
type LiteDateField = ReturnType<typeof LiteDateField>;
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
placeholder={i18n.t('common.startDate')}
|
|
131
131
|
{...field?.required ? { required: true } : {}}
|
|
132
132
|
/>
|
|
133
|
-
<span style="margin: 0 8px; color: #
|
|
133
|
+
<span style="margin: 0 8px; color: #4E5969;">{separator}</span>
|
|
134
134
|
<input
|
|
135
135
|
type="date"
|
|
136
136
|
lang={i18n.locale}
|
|
@@ -7,9 +7,13 @@
|
|
|
7
7
|
value?: unknown;
|
|
8
8
|
error?: string[];
|
|
9
9
|
mode?: 'show' | 'edit' | 'create';
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
let { field, value, error = [], mode = 'show'
|
|
14
|
+
let { field, value, error = [], mode = 'show',
|
|
15
|
+
class: className = ''
|
|
16
|
+
}: Props = $props();
|
|
13
17
|
let hasError = $derived(error.length > 0);
|
|
14
18
|
|
|
15
19
|
function getUrls(v: unknown): string[] {
|
|
@@ -22,7 +26,7 @@
|
|
|
22
26
|
|
|
23
27
|
{#if mode === 'show'}
|
|
24
28
|
{@const urls = getUrls(value)}
|
|
25
|
-
<div class="lite-inline-md lite-flex-wrap">
|
|
29
|
+
<div class="lite-inline-md lite-flex-wrap {className}">
|
|
26
30
|
{#each urls as url, _i (_i)}
|
|
27
31
|
<LiteMediaThumbnail src={url} alt={field.label} height={100} />
|
|
28
32
|
{:else}
|
|
@@ -4,6 +4,8 @@ interface Props {
|
|
|
4
4
|
value?: unknown;
|
|
5
5
|
error?: string[];
|
|
6
6
|
mode?: 'show' | 'edit' | 'create';
|
|
7
|
+
/** Caller class merged with the built-in class list. */
|
|
8
|
+
class?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const LiteImageField: import("svelte").Component<Props, {}, "">;
|
|
9
11
|
type LiteImageField = ReturnType<typeof LiteImageField>;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
{#if mode === 'show'}
|
|
26
|
-
<pre style="padding: 12px; background: #
|
|
26
|
+
<pre style="padding: 12px; background: #1D2129; color: #F7F8FA; border-radius: 4px; overflow-x: auto; font-size: 13px;">{getJsonString(value)}</pre>
|
|
27
27
|
{:else}
|
|
28
28
|
<div>
|
|
29
29
|
<textarea
|
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { FieldDefinition } from '@svadmin/core';
|
|
3
|
+
import { renderMarkdown, type MarkdownRenderOptions } from '../../rich-content.js';
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
6
|
field: FieldDefinition;
|
|
6
7
|
value?: unknown;
|
|
7
8
|
error?: string[];
|
|
8
9
|
mode?: 'show' | 'edit' | 'create';
|
|
10
|
+
/** Per-field renderer options; app-wide defaults come from configureMarkdownRenderer. */
|
|
11
|
+
renderOptions?: MarkdownRenderOptions;
|
|
12
|
+
/** Caller class merged with the built-in class list. */
|
|
13
|
+
class?: string;
|
|
9
14
|
}
|
|
10
15
|
|
|
11
|
-
let { field, value, error = [], mode = 'show'
|
|
16
|
+
let { field, value, error = [], mode = 'show', renderOptions,
|
|
17
|
+
class: className = ''
|
|
18
|
+
}: Props = $props();
|
|
12
19
|
let hasError = $derived(error.length > 0);
|
|
20
|
+
const preview = $derived(renderMarkdown(value, renderOptions));
|
|
13
21
|
</script>
|
|
14
22
|
|
|
15
23
|
{#if mode === 'show'}
|
|
16
|
-
|
|
24
|
+
{#if preview}
|
|
25
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- 内容由 renderMarkdown 转义,高亮回调仅允许可信服务端实现。 -->
|
|
26
|
+
<div class="lite-markdown-preview {className}">{@html preview}</div>
|
|
27
|
+
{:else}
|
|
28
|
+
<span>—</span>
|
|
29
|
+
{/if}
|
|
17
30
|
{:else}
|
|
18
|
-
<div>
|
|
31
|
+
<div class="lite-field-edit {className}">
|
|
19
32
|
<textarea
|
|
20
33
|
name={field.key}
|
|
21
34
|
id={field.key}
|
|
@@ -29,5 +42,38 @@
|
|
|
29
42
|
<div class="lite-error-text">{err}</div>
|
|
30
43
|
{/each}
|
|
31
44
|
{/if}
|
|
45
|
+
<div class="lite-markdown-preview-block">
|
|
46
|
+
<span class="lite-markdown-preview-block__label">Preview</span>
|
|
47
|
+
{#if preview}
|
|
48
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- 内容由 renderMarkdown 转义,高亮回调仅允许可信服务端实现。 -->
|
|
49
|
+
<div class="lite-markdown-preview">{@html preview}</div>
|
|
50
|
+
{:else}
|
|
51
|
+
<p class="lite-markdown-preview-block__empty">Nothing to preview yet.</p>
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
32
54
|
</div>
|
|
33
55
|
{/if}
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.lite-markdown-preview { padding: 12px; border: 1px solid #E5E6EB; border-radius: 4px; background: #F7F8FA; color: #1D2129; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
|
|
59
|
+
.lite-markdown-preview :global(h1),
|
|
60
|
+
.lite-markdown-preview :global(h2),
|
|
61
|
+
.lite-markdown-preview :global(h3),
|
|
62
|
+
.lite-markdown-preview :global(h4) { margin: 12px 0 6px; font-size: 15px; }
|
|
63
|
+
.lite-markdown-preview :global(p) { margin: 0 0 8px; }
|
|
64
|
+
.lite-markdown-preview :global(ul),
|
|
65
|
+
.lite-markdown-preview :global(ol) { margin: 0 0 8px; padding-left: 20px; }
|
|
66
|
+
.lite-markdown-preview :global(pre) { margin: 0 0 8px; padding: 8px; overflow-x: auto; border-radius: 4px; background: #F2F3F5; }
|
|
67
|
+
.lite-markdown-preview :global(code) { font-family: monospace; font-size: 12px; }
|
|
68
|
+
.lite-markdown-preview :global(blockquote) { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid #E5E6EB; color: #4E5969; }
|
|
69
|
+
.lite-markdown-preview :global(a) { color: #165DFF; }
|
|
70
|
+
.lite-markdown-preview :global(table) { width: 100%; margin: 0 0 8px; border-collapse: collapse; }
|
|
71
|
+
.lite-markdown-preview :global(th),
|
|
72
|
+
.lite-markdown-preview :global(td) { padding: 6px 8px; border: 1px solid #E5E6EB; text-align: left; }
|
|
73
|
+
.lite-markdown-preview :global(th) { background: #F2F3F5; font-weight: 600; }
|
|
74
|
+
.lite-markdown-preview :global(ul.lite-task-list) { padding-left: 2px; list-style: none; }
|
|
75
|
+
.lite-markdown-preview :global(.lite-task-item input) { margin-right: 6px; }
|
|
76
|
+
.lite-markdown-preview-block { margin-top: 8px; }
|
|
77
|
+
.lite-markdown-preview-block__label { display: block; margin-bottom: 4px; color: #86909C; font-size: 11px; font-weight: 600; }
|
|
78
|
+
.lite-markdown-preview-block__empty { margin: 0; padding: 8px 12px; border: 1px dashed #E5E6EB; border-radius: 4px; color: #86909C; font-size: 12px; }
|
|
79
|
+
</style>
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { FieldDefinition } from '@svadmin/core';
|
|
2
|
+
import { type MarkdownRenderOptions } from '../../rich-content.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
field: FieldDefinition;
|
|
4
5
|
value?: unknown;
|
|
5
6
|
error?: string[];
|
|
6
7
|
mode?: 'show' | 'edit' | 'create';
|
|
8
|
+
/** Per-field renderer options; app-wide defaults come from configureMarkdownRenderer. */
|
|
9
|
+
renderOptions?: MarkdownRenderOptions;
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
7
12
|
}
|
|
8
13
|
declare const LiteMarkdownField: import("svelte").Component<Props, {}, "">;
|
|
9
14
|
type LiteMarkdownField = ReturnType<typeof LiteMarkdownField>;
|
|
@@ -6,16 +6,18 @@
|
|
|
6
6
|
value?: unknown;
|
|
7
7
|
error?: string[];
|
|
8
8
|
mode?: 'show' | 'edit' | 'create';
|
|
9
|
+
/** Caller class merged with the built-in class list. */
|
|
10
|
+
class?: string;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
let { field, value, error = [], mode = 'show' }: Props = $props();
|
|
13
|
+
let { field, value, error = [], mode = 'show', class: className = '' }: Props = $props();
|
|
12
14
|
let hasError = $derived(error.length > 0);
|
|
13
15
|
</script>
|
|
14
16
|
|
|
15
17
|
{#if mode === 'show'}
|
|
16
|
-
<span>{value == null ? '—' : Number(value).toLocaleString()}</span>
|
|
18
|
+
<span class="lite-field-value {className}">{value == null ? '—' : Number(value).toLocaleString()}</span>
|
|
17
19
|
{:else}
|
|
18
|
-
<div>
|
|
20
|
+
<div class="lite-field-edit {className}">
|
|
19
21
|
<input
|
|
20
22
|
type="number"
|
|
21
23
|
name={field.key}
|
|
@@ -4,6 +4,8 @@ interface Props {
|
|
|
4
4
|
value?: unknown;
|
|
5
5
|
error?: string[];
|
|
6
6
|
mode?: 'show' | 'edit' | 'create';
|
|
7
|
+
/** Caller class merged with the built-in class list. */
|
|
8
|
+
class?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const LiteNumberField: import("svelte").Component<Props, {}, "">;
|
|
9
11
|
type LiteNumberField = ReturnType<typeof LiteNumberField>;
|
|
@@ -1,38 +1,43 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { FieldDefinition } from '@svadmin/core';
|
|
3
3
|
import { toSafeText } from '../../security.js';
|
|
4
|
+
import { renderRichContent, type MarkdownRenderOptions } from '../../rich-content.js';
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
field: FieldDefinition;
|
|
7
8
|
value?: unknown;
|
|
8
9
|
error?: string[];
|
|
9
10
|
mode?: 'show' | 'edit' | 'create';
|
|
11
|
+
/** Per-field renderer options; app-wide defaults come from configureMarkdownRenderer. */
|
|
12
|
+
renderOptions?: MarkdownRenderOptions;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
let { field, value, error = [], mode = 'show' }: Props = $props();
|
|
15
|
+
let { field, value, error = [], mode = 'show', renderOptions }: Props = $props();
|
|
13
16
|
let hasError = $derived(error.length > 0);
|
|
14
|
-
const
|
|
17
|
+
const preview = $derived(renderRichContent(value, renderOptions));
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
20
|
{#if mode === 'show'}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
|
|
21
|
+
{#if preview}
|
|
22
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- 内容由 renderRichContent 转义或白名单过滤,高亮回调仅允许可信服务端实现。 -->
|
|
23
|
+
<div class="lite-rich-preview">{@html preview}</div>
|
|
24
|
+
{:else}
|
|
25
|
+
<span>—</span>
|
|
26
|
+
{/if}
|
|
22
27
|
{:else}
|
|
23
28
|
<div class="lite-markdown-editor">
|
|
24
|
-
<div class="lite-inline-lg lite-flex-wrap" style="padding: 8px 12px; border: 1px solid #
|
|
25
|
-
<span>Markdown
|
|
26
|
-
<span style="color: #
|
|
27
|
-
<span style="color: #
|
|
28
|
-
<span style="color: #
|
|
29
|
+
<div class="lite-inline-lg lite-flex-wrap" style="padding: 8px 12px; border: 1px solid #E5E6EB; border-bottom: none; border-radius: 6px 6px 0 0; background: #F7F8FA; color: #4E5969; font-size: 12px; font-weight: 500;">
|
|
30
|
+
<span>HTML or Markdown source</span>
|
|
31
|
+
<span style="color: #86909C;">**bold**</span>
|
|
32
|
+
<span style="color: #86909C; font-style: italic;">*italic*</span>
|
|
33
|
+
<span style="color: #86909C;"># heading</span>
|
|
29
34
|
</div>
|
|
30
35
|
<textarea
|
|
31
36
|
name={field.key}
|
|
32
37
|
id={field.key}
|
|
33
38
|
class="lite-input {hasError ? 'lite-input-error' : ''}"
|
|
34
39
|
style="min-height: 280px; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 13px; line-height: 1.6; padding: 16px; border-radius: 0 0 6px 6px; resize: vertical;"
|
|
35
|
-
placeholder="
|
|
40
|
+
placeholder="Rich text editing is disabled in lite mode. Write standard HTML or Markdown; the server renders it through a safe allowlist."
|
|
36
41
|
{...field.required ? { required: true } : {}}
|
|
37
42
|
>{toSafeText(value)}</textarea>
|
|
38
43
|
{#if hasError}
|
|
@@ -40,5 +45,37 @@
|
|
|
40
45
|
<div class="lite-error-text">{err}</div>
|
|
41
46
|
{/each}
|
|
42
47
|
{/if}
|
|
48
|
+
<div class="lite-rich-preview-block">
|
|
49
|
+
<span class="lite-rich-preview-block__label">Preview</span>
|
|
50
|
+
{#if preview}
|
|
51
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- 内容由 renderRichContent 转义或白名单过滤,高亮回调仅允许可信服务端实现。 -->
|
|
52
|
+
<div class="lite-rich-preview">{@html preview}</div>
|
|
53
|
+
{:else}
|
|
54
|
+
<p class="lite-rich-preview-block__empty">Nothing to preview yet.</p>
|
|
55
|
+
{/if}
|
|
56
|
+
</div>
|
|
43
57
|
</div>
|
|
44
58
|
{/if}
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
.lite-rich-preview { padding: 16px; border: 1px solid #E5E6EB; border-radius: 6px; max-height: 500px; overflow-y: auto; background: #fff; color: #1D2129; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
|
|
62
|
+
.lite-rich-preview :global(p) { margin: 0 0 8px; }
|
|
63
|
+
.lite-rich-preview :global(h1),
|
|
64
|
+
.lite-rich-preview :global(h2),
|
|
65
|
+
.lite-rich-preview :global(h3) { margin: 12px 0 6px; font-size: 16px; }
|
|
66
|
+
.lite-rich-preview :global(ul),
|
|
67
|
+
.lite-rich-preview :global(ol) { margin: 0 0 8px; padding-left: 20px; }
|
|
68
|
+
.lite-rich-preview :global(code) { font-family: monospace; font-size: 12px; }
|
|
69
|
+
.lite-rich-preview :global(blockquote) { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid #E5E6EB; color: #4E5969; }
|
|
70
|
+
.lite-rich-preview :global(a) { color: #165DFF; }
|
|
71
|
+
.lite-rich-preview :global(img) { max-width: 100%; height: auto; }
|
|
72
|
+
.lite-rich-preview :global(table) { width: 100%; margin: 0 0 8px; border-collapse: collapse; }
|
|
73
|
+
.lite-rich-preview :global(th),
|
|
74
|
+
.lite-rich-preview :global(td) { padding: 6px 8px; border: 1px solid #E5E6EB; text-align: left; }
|
|
75
|
+
.lite-rich-preview :global(th) { background: #F2F3F5; font-weight: 600; }
|
|
76
|
+
.lite-rich-preview :global(ul.lite-task-list) { padding-left: 2px; list-style: none; }
|
|
77
|
+
.lite-rich-preview :global(.lite-task-item input) { margin-right: 6px; }
|
|
78
|
+
.lite-rich-preview-block { margin-top: 8px; }
|
|
79
|
+
.lite-rich-preview-block__label { display: block; margin-bottom: 4px; color: #86909C; font-size: 11px; font-weight: 600; }
|
|
80
|
+
.lite-rich-preview-block__empty { margin: 0; padding: 8px 12px; border: 1px dashed #E5E6EB; border-radius: 4px; color: #86909C; font-size: 12px; }
|
|
81
|
+
</style>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { FieldDefinition } from '@svadmin/core';
|
|
2
|
+
import { type MarkdownRenderOptions } from '../../rich-content.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
field: FieldDefinition;
|
|
4
5
|
value?: unknown;
|
|
5
6
|
error?: string[];
|
|
6
7
|
mode?: 'show' | 'edit' | 'create';
|
|
8
|
+
/** Per-field renderer options; app-wide defaults come from configureMarkdownRenderer. */
|
|
9
|
+
renderOptions?: MarkdownRenderOptions;
|
|
7
10
|
}
|
|
8
11
|
declare const LiteRichTextField: import("svelte").Component<Props, {}, "">;
|
|
9
12
|
type LiteRichTextField = ReturnType<typeof LiteRichTextField>;
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
value?: unknown;
|
|
8
8
|
error?: string[];
|
|
9
9
|
mode?: 'show' | 'edit' | 'create';
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
let { field, value, error = [], mode = 'show' }: Props = $props();
|
|
14
|
+
let { field, value, error = [], mode = 'show', class: className = '' }: Props = $props();
|
|
13
15
|
let hasError = $derived(error.length > 0);
|
|
14
16
|
|
|
15
17
|
function displaySelect(v: unknown): string {
|
|
@@ -20,9 +22,9 @@
|
|
|
20
22
|
</script>
|
|
21
23
|
|
|
22
24
|
{#if mode === 'show'}
|
|
23
|
-
<span class="lite-badge">{displaySelect(value)}</span>
|
|
25
|
+
<span class="lite-badge {className}">{displaySelect(value)}</span>
|
|
24
26
|
{:else}
|
|
25
|
-
<div>
|
|
27
|
+
<div class="lite-field-edit {className}">
|
|
26
28
|
<select
|
|
27
29
|
name={field.key}
|
|
28
30
|
id={field.key}
|
|
@@ -4,6 +4,8 @@ interface Props {
|
|
|
4
4
|
value?: unknown;
|
|
5
5
|
error?: string[];
|
|
6
6
|
mode?: 'show' | 'edit' | 'create';
|
|
7
|
+
/** Caller class merged with the built-in class list. */
|
|
8
|
+
class?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const LiteSelectField: import("svelte").Component<Props, {}, "">;
|
|
9
11
|
type LiteSelectField = ReturnType<typeof LiteSelectField>;
|