@xleddyl/443-components-vue 0.16.104 → 0.16.105
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/CATALOG.md +1 -1
- package/README.md +9 -9
- package/dist/components/layout/AppShell.vue +32 -12
- package/dist/components/overlays/ConfirmDialog.vue.d.ts +4 -6
- package/dist/components/overlays/ConfirmHost.vue.d.ts +4 -6
- package/dist/components/overlays/Drawer.vue +4 -6
- package/dist/components/overlays/Drawer.vue.d.ts +4 -6
- package/dist/components/overlays/Modal.vue.d.ts +4 -6
- package/dist/components/templates/FormDrawer.vue.d.ts +2 -3
- package/dist/components/templates/FormModal.vue.d.ts +2 -3
- package/dist/components/templates/SettingsModal.vue.d.ts +4 -6
- package/dist/internal/overlays/DialogFrame.vue +17 -29
- package/dist/internal/overlays/DialogFrame.vue.d.ts +4 -6
- package/dist/internal/overlays/OverlayView.vue.d.ts +4 -6
- package/dist/internal/overlays/dialog.d.ts +0 -1
- package/dist/internal/overlays/dialog.mjs +0 -1
- package/dist/internal/overlays/dock.d.ts +6 -0
- package/dist/internal/overlays/dock.mjs +6 -0
- package/dist/locale/de.mjs +2 -2
- package/dist/locale/en.mjs +2 -2
- package/dist/locale/it.mjs +2 -2
- package/dist/locale/types.d.ts +2 -2
- package/dist/styles/layout/app-shell.css +1 -1
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -211,7 +211,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
211
211
|
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
212
212
|
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
|
|
213
213
|
| `Modal` | Centered dialog for forms and content. Use `Drawer` for a side panel, `useConfirm` for a yes or no question. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `size` (sm to xl, full, fit, fullscreen), `width`, `minHeight`, `height` (fixed, capped at the viewport), `dismissible`, `hideClose`, `sheet`, `flush`, `fill`, `loading`, `beforeClose(reason)`, `tabs` (tabs in the header), `trail` (breadcrumb title and back button; a long trail stays on one line, the middle crumbs collapse into a "..." menu and the current title truncates), `backLabel`, `guard` (default `true`: closing, or a trail navigation, with a dirty `Form` inside asks to discard first; `beforeClose` runs after), `guardTitle`, `guardMessage`. Slots: default (`{ tab }`), `header`, `actions` (header, before the close button), `toolbar` (a full width row of controls under the title and the description, such as filters), `footer`, `title-trailing`. Events: `open`, `close`, `afterLeave`, `navigate(index)`. Exposes `close()`, `confirmLeave()`, `dirty`. | `overlays/modal.vue` |
|
|
214
|
-
| `Drawer` | Panel from the side or bottom for details and edit forms. Use `Modal` for short focused dialogs. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `side` (left, right, bottom), `size` (sm to xl, full), `dismissible`, `hideClose`, `flush`, `fill` (the body content takes the full height, for a table or a grid), `loading`, `beforeClose(reason)`, `tabs`, `trail`, `backLabel`, `guard`, `guardTitle`, `guardMessage` (as `Modal`), `docked` (a right drawer stays in the dock of `AppShell` beside the page, not modal, from 1280px of shell width; the dock shows an empty state while it is closed;
|
|
214
|
+
| `Drawer` | Panel from the side or bottom for details and edit forms. Use `Modal` for short focused dialogs. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `side` (left, right, bottom), `size` (sm to xl, full), `dismissible`, `hideClose`, `flush`, `fill` (the body content takes the full height, for a table or a grid), `loading`, `beforeClose(reason)`, `tabs`, `trail`, `backLabel`, `guard`, `guardTitle`, `guardMessage` (as `Modal`), `docked` (a right drawer stays in the dock of `AppShell` beside the page, not modal, from 1280px of shell width; the dock shows an empty state while it is closed; a header button detaches or docks the whole dock, saved in the preferences, `detachLabel`, `attachLabel`). The body is a size container (`k-drawer`): use container queries inside. Slots like `Modal`. Events: `open`, `close`, `afterLeave`, `navigate(index)`. Exposes `close()`, `confirmLeave()`, `dirty`. | `overlays/drawer.vue` |
|
|
215
215
|
| `ConfirmDialog` | Declarative confirm dialog. Prefer `useConfirm()`. Use this one only when the dialog state lives in the template. | Model: `v-model:open`. Props: `title`, `description`, `confirmLabel`, `cancelLabel`, `tone`, `icon`, `hideCancel`, `onConfirm`. Events: `resolve(confirmed)`, `cancel`, `afterLeave`. | `overlays/confirm-dialog.vue` |
|
|
216
216
|
| `ConfirmHost` | Renders the dialogs of `useConfirm`, `useAlert`, `usePrompt`. `OverlayHost` includes it. Do not mount it alone. | None. | - |
|
|
217
217
|
| `OverlayHost` | One mount point for toasts, confirm dialogs, programmatic modals and loading indicators. | Props: `toaster` (true or options), `confirm`, `modals`, `loading` (true or `{ bar, delay, label }`). | `overlays/hooks.vue` |
|
package/README.md
CHANGED
|
@@ -234,14 +234,14 @@ Buttons show `icon` before the label and `trailingIcon` after it. Put action ico
|
|
|
234
234
|
|
|
235
235
|
UI choices are kept in one preferences store: the theme, the preset, the collapsed sidebar, the DataGrid columns and page size, and the WorkspaceLayout panes. By default the store is `localStorage` (keys `k-pref:<key>`, JSON, SSR safe, never throws, synced across tabs). Give the app your own store to keep the choices per user in a database, so they follow the user across devices.
|
|
236
236
|
|
|
237
|
-
| Key | Value | Written by
|
|
238
|
-
| ------------------------ | --------------------------------------------------------------------------------------- |
|
|
239
|
-
| `theme` | `'system' \| 'light' \| 'dark'` | `useTheme().set`, `ThemeSwitch`, `AppearanceSettings`
|
|
240
|
-
| `preset` | `ThemePreset` | `usePreset().set`, `AppearanceSettings`
|
|
241
|
-
| `shell:<storageKey>` | `boolean` (collapsed) | `AppShell` and `DashboardLayout` (`shell:k-sidebar-collapsed`)
|
|
242
|
-
| `grid:<storageKey>` | `GridPreference` (`{ columns?: GridColumnState[], pageSize }`) | `DataGrid` with `storageKey`: visibility, order, width, pinned, page size
|
|
243
|
-
| `workspace:<storageKey>` | `WorkspacePreference` (`{ left?: { width, collapsed }, right?: { width, collapsed } }`) | `WorkspaceLayout` with `storageKey`: side pane widths and collapsed state
|
|
244
|
-
| `dock:<dockStorageKey>` | `number` (px) | `AppShell` and `DashboardLayout`: the width of the
|
|
237
|
+
| Key | Value | Written by |
|
|
238
|
+
| ------------------------ | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
239
|
+
| `theme` | `'system' \| 'light' \| 'dark'` | `useTheme().set`, `ThemeSwitch`, `AppearanceSettings` |
|
|
240
|
+
| `preset` | `ThemePreset` | `usePreset().set`, `AppearanceSettings` |
|
|
241
|
+
| `shell:<storageKey>` | `boolean` (collapsed) | `AppShell` and `DashboardLayout` (`shell:k-sidebar-collapsed`) |
|
|
242
|
+
| `grid:<storageKey>` | `GridPreference` (`{ columns?: GridColumnState[], pageSize }`) | `DataGrid` with `storageKey`: visibility, order, width, pinned, page size |
|
|
243
|
+
| `workspace:<storageKey>` | `WorkspacePreference` (`{ left?: { width, collapsed }, right?: { width, collapsed } }`) | `WorkspaceLayout` with `storageKey`: side pane widths and collapsed state |
|
|
244
|
+
| `dock:<dockStorageKey>` | `number` (px) | `AppShell` and `DashboardLayout`: the width of the dock and the detached choice |
|
|
245
245
|
|
|
246
246
|
`PREFERENCE_KEYS` builds them (`PREFERENCE_KEYS.grid('orders')`). Your own keys work too: use a namespace of your app (`app:<name>`).
|
|
247
247
|
|
|
@@ -778,7 +778,7 @@ const confirmDiscard = () => !dirty.value || confirm({ title: 'Discard changes?'
|
|
|
778
778
|
- It needs a `DashboardLayout` or an `AppShell` around the page, and a shell width of at least 1280px. Otherwise (and on a phone) it is the normal overlay drawer, and it changes mode while it is open when the window is resized.
|
|
779
779
|
- The shell shows a dock on the right of the page as long as a docked drawer is mounted, also while it is closed: a page with a docked drawer shows the empty state of the dock ("Nothing selected", `dockEmptyTitle` and `dockEmptyDescription` of the layout), and a page without one shows no dock. The open drawer fills the dock.
|
|
780
780
|
- The dock has a resize handle on its left edge (min 22rem, max 48rem and at most 45% of the shell, double click resets to 30rem). The width goes to the preferences store under `dock:<dockStorageKey>` (default `k-dock`, `false` keeps it only in memory).
|
|
781
|
-
- `size` gives the width of the overlay mode only.
|
|
781
|
+
- `size` gives the width of the overlay mode only. Every docked drawer has a dock button in the header (`detachLabel`, `attachLabel`): it detaches the whole dock, so every docked drawer of the app opens as a normal overlay and no page shows the dock, and the same button in the overlay docks them again. The choice is saved with the width (`dock:<dockStorageKey>`, `{ width, detached }`).
|
|
782
782
|
- A docked drawer is not modal: no backdrop, no scroll lock, focus stays where it was when it opens, and Escape closes it only when the focus is inside it (and no menu or nested dialog is open). The leave guard is the same: closing it, its trail and a navigation ask before they drop a dirty form.
|
|
783
783
|
- `useRouteRecord().openRecord(id)` asks the discard question when it replaces another open record (the user clicked another row with a dirty form). The default `beforeLeave` reads the topmost modal dialog, else the docked drawer. A discard accepted by a scope also answers the next question of the same scope in the same task, so a drawer that asks and then calls `openRecord()` asks once.
|
|
784
784
|
- Toasts move to the left of the dock.
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
'is-nav-open': open,
|
|
9
9
|
'is-mobile': mobile,
|
|
10
10
|
'is-named': viewTransition,
|
|
11
|
-
'is-fill': contentMode === 'bleed'
|
|
11
|
+
'is-fill': contentMode === 'bleed',
|
|
12
|
+
'is-dock-detached': dockDetached
|
|
12
13
|
}"
|
|
13
14
|
:data-content="contentMode"
|
|
14
15
|
@keydown.esc="onEscape"
|
|
@@ -147,7 +148,13 @@ import Skeleton from "../feedback/Skeleton.vue";
|
|
|
147
148
|
import SkeletonList from "../feedback/SkeletonList.vue";
|
|
148
149
|
import ResizeHandle from "./ResizeHandle.vue";
|
|
149
150
|
import { focusFirst } from "../../internal/core/focus";
|
|
150
|
-
import {
|
|
151
|
+
import {
|
|
152
|
+
DOCK_BREAKPOINT,
|
|
153
|
+
DOCK_KEY,
|
|
154
|
+
DOCK_WIDTH,
|
|
155
|
+
dockFrame,
|
|
156
|
+
isDockPreference
|
|
157
|
+
} from "../../internal/overlays/dock";
|
|
151
158
|
import { PREFERENCE_KEYS, usePreference } from "../../composables/usePreferences";
|
|
152
159
|
const props = defineProps({
|
|
153
160
|
variant: { type: String, required: false, default: "inset" },
|
|
@@ -257,10 +264,18 @@ watch(open, (value) => {
|
|
|
257
264
|
const dockSlot = useTemplateRef("dockSlot");
|
|
258
265
|
const dockFrameRef = useTemplateRef("dockFrameRef");
|
|
259
266
|
const dockWide = computed(() => shellWidth.value >= DOCK_BREAKPOINT);
|
|
260
|
-
const dockPreference = props.dockStorageKey ? usePreference(
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
267
|
+
const dockPreference = props.dockStorageKey ? usePreference(
|
|
268
|
+
PREFERENCE_KEYS.dock(props.dockStorageKey),
|
|
269
|
+
{},
|
|
270
|
+
{
|
|
271
|
+
validate: isDockPreference
|
|
272
|
+
}
|
|
273
|
+
) : ref({});
|
|
274
|
+
const storedDock = computed(
|
|
275
|
+
() => typeof dockPreference.value === "number" ? { width: dockPreference.value } : dockPreference.value
|
|
276
|
+
);
|
|
277
|
+
const dockWidth = ref(storedDock.value.width ?? DOCK_WIDTH.initial);
|
|
278
|
+
const dockDetached = ref(storedDock.value.detached ?? false);
|
|
264
279
|
const dockResizing = ref(false);
|
|
265
280
|
const dockMax = computed(
|
|
266
281
|
() => Math.max(
|
|
@@ -269,14 +284,19 @@ const dockMax = computed(
|
|
|
269
284
|
)
|
|
270
285
|
);
|
|
271
286
|
const dockSize = computed(() => Math.min(Math.max(dockWidth.value, DOCK_WIDTH.min), dockMax.value));
|
|
272
|
-
watch(
|
|
273
|
-
|
|
287
|
+
watch(storedDock, (value) => {
|
|
288
|
+
const width = value.width ?? DOCK_WIDTH.initial;
|
|
289
|
+
if (!dockResizing.value && width !== dockWidth.value) dockWidth.value = width;
|
|
290
|
+
const detached = value.detached ?? false;
|
|
291
|
+
if (detached !== dockDetached.value) dockDetached.value = detached;
|
|
274
292
|
});
|
|
275
293
|
function persistDock() {
|
|
276
|
-
if (dockResizing.value
|
|
277
|
-
|
|
294
|
+
if (dockResizing.value) return;
|
|
295
|
+
const stored = storedDock.value;
|
|
296
|
+
if (stored.width === dockWidth.value && (stored.detached ?? false) === dockDetached.value) return;
|
|
297
|
+
dockPreference.value = { width: dockWidth.value, detached: dockDetached.value };
|
|
278
298
|
}
|
|
279
|
-
watch(dockWidth, persistDock);
|
|
299
|
+
watch([dockWidth, dockDetached], persistDock);
|
|
280
300
|
function endDockResize() {
|
|
281
301
|
dockResizing.value = false;
|
|
282
302
|
persistDock();
|
|
@@ -296,7 +316,7 @@ useResizeObserver(
|
|
|
296
316
|
onBeforeUnmount(() => {
|
|
297
317
|
if (dockFrame.value && dockFrame.value === dockFrameRef.value) dockFrame.value = null;
|
|
298
318
|
});
|
|
299
|
-
provide(DOCK_KEY, { target: dockSlot, wide: dockWide });
|
|
319
|
+
provide(DOCK_KEY, { target: dockSlot, wide: dockWide, detached: dockDetached });
|
|
300
320
|
provide(SHELL_KEY, {
|
|
301
321
|
sidebarId,
|
|
302
322
|
collapsed,
|
|
@@ -238,9 +238,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
238
238
|
backLabel?: string;
|
|
239
239
|
guardTitle?: string;
|
|
240
240
|
guardMessage?: string;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
collapseLabel?: string;
|
|
241
|
+
detachLabel?: string;
|
|
242
|
+
attachLabel?: string;
|
|
244
243
|
onOpen?: (() => any) | undefined;
|
|
245
244
|
"onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
246
245
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
@@ -483,9 +482,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
483
482
|
backLabel?: string;
|
|
484
483
|
guardTitle?: string;
|
|
485
484
|
guardMessage?: string;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
collapseLabel?: string;
|
|
485
|
+
detachLabel?: string;
|
|
486
|
+
attachLabel?: string;
|
|
489
487
|
onOpen?: (() => any) | undefined;
|
|
490
488
|
"onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
491
489
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
@@ -228,9 +228,8 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
228
228
|
readonly backLabel?: string | undefined;
|
|
229
229
|
readonly guardTitle?: string | undefined;
|
|
230
230
|
readonly guardMessage?: string | undefined;
|
|
231
|
-
readonly
|
|
232
|
-
readonly
|
|
233
|
-
readonly collapseLabel?: string | undefined;
|
|
231
|
+
readonly detachLabel?: string | undefined;
|
|
232
|
+
readonly attachLabel?: string | undefined;
|
|
234
233
|
readonly onOpen?: (() => any) | undefined;
|
|
235
234
|
readonly "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
236
235
|
readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
|
|
@@ -469,9 +468,8 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
469
468
|
readonly backLabel?: string | undefined;
|
|
470
469
|
readonly guardTitle?: string | undefined;
|
|
471
470
|
readonly guardMessage?: string | undefined;
|
|
472
|
-
readonly
|
|
473
|
-
readonly
|
|
474
|
-
readonly collapseLabel?: string | undefined;
|
|
471
|
+
readonly detachLabel?: string | undefined;
|
|
472
|
+
readonly attachLabel?: string | undefined;
|
|
475
473
|
readonly onOpen?: (() => any) | undefined;
|
|
476
474
|
readonly "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
477
475
|
readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
:trail="trail"
|
|
22
22
|
:back-label="backLabel"
|
|
23
23
|
:dock="docked && side === 'right'"
|
|
24
|
-
:
|
|
25
|
-
:
|
|
26
|
-
:collapse-label="collapseLabel"
|
|
24
|
+
:detach-label="detachLabel"
|
|
25
|
+
:attach-label="attachLabel"
|
|
27
26
|
v-model:tab="tab"
|
|
28
27
|
@navigate="(index) => emit('navigate', index)"
|
|
29
28
|
@open="emit('open')"
|
|
@@ -59,10 +58,9 @@ defineProps({
|
|
|
59
58
|
guardTitle: { type: String, required: false },
|
|
60
59
|
guardMessage: { type: String, required: false },
|
|
61
60
|
docked: { type: Boolean, required: false },
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
detachLabel: { type: String, required: false },
|
|
62
|
+
attachLabel: { type: String, required: false }
|
|
64
63
|
});
|
|
65
|
-
const EXPANDABLE_SIZES = ["lg", "xl", "full"];
|
|
66
64
|
const slots = defineSlots();
|
|
67
65
|
const slotNames = () => Object.keys(slots);
|
|
68
66
|
const emit = defineEmits(["open", "close", "afterLeave", "navigate"]);
|
|
@@ -22,8 +22,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
22
22
|
guardTitle?: string;
|
|
23
23
|
guardMessage?: string;
|
|
24
24
|
docked?: boolean;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
detachLabel?: string;
|
|
26
|
+
attachLabel?: string;
|
|
27
27
|
open?: boolean | undefined;
|
|
28
28
|
tab?: TabItem["value"];
|
|
29
29
|
key?: PropertyKey | undefined;
|
|
@@ -226,7 +226,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
226
226
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
227
227
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
228
228
|
rootClass?: unknown;
|
|
229
|
-
expandable?: boolean;
|
|
230
229
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
231
230
|
}, {
|
|
232
231
|
close: () => Promise<boolean>;
|
|
@@ -260,8 +259,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
260
259
|
guardTitle?: string;
|
|
261
260
|
guardMessage?: string;
|
|
262
261
|
docked?: boolean;
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
detachLabel?: string;
|
|
263
|
+
attachLabel?: string;
|
|
265
264
|
open?: boolean | undefined;
|
|
266
265
|
tab?: TabItem["value"];
|
|
267
266
|
key?: PropertyKey | undefined;
|
|
@@ -464,7 +463,6 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
464
463
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
465
464
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
466
465
|
rootClass?: unknown;
|
|
467
|
-
expandable?: boolean;
|
|
468
466
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
469
467
|
}> & Readonly<{
|
|
470
468
|
onClose?: (() => any) | undefined;
|
|
@@ -226,9 +226,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
226
226
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
227
227
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
228
228
|
rootClass?: unknown;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
collapseLabel?: string;
|
|
229
|
+
detachLabel?: string;
|
|
230
|
+
attachLabel?: string;
|
|
232
231
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
233
232
|
}, {
|
|
234
233
|
close: () => Promise<boolean>;
|
|
@@ -466,9 +465,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
466
465
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
467
466
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
468
467
|
rootClass?: unknown;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
collapseLabel?: string;
|
|
468
|
+
detachLabel?: string;
|
|
469
|
+
attachLabel?: string;
|
|
472
470
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
473
471
|
}> & Readonly<{
|
|
474
472
|
onClose?: (() => any) | undefined;
|
|
@@ -64,8 +64,8 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
64
64
|
readonly guardTitle?: string | undefined;
|
|
65
65
|
readonly guardMessage?: string | undefined;
|
|
66
66
|
readonly docked?: boolean | undefined;
|
|
67
|
-
readonly
|
|
68
|
-
readonly
|
|
67
|
+
readonly detachLabel?: string | undefined;
|
|
68
|
+
readonly attachLabel?: string | undefined;
|
|
69
69
|
readonly open?: boolean | undefined;
|
|
70
70
|
readonly tab?: TabItem["value"] | undefined;
|
|
71
71
|
readonly key?: PropertyKey | undefined;
|
|
@@ -268,7 +268,6 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
268
268
|
readonly onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
269
269
|
readonly onCancel?: ((payload: Event) => void) | undefined;
|
|
270
270
|
readonly rootClass?: unknown;
|
|
271
|
-
readonly expandable?: boolean | undefined;
|
|
272
271
|
readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
|
|
273
272
|
readonly onClose?: (() => any) | undefined;
|
|
274
273
|
readonly onOpen?: (() => any) | undefined;
|
|
@@ -263,9 +263,8 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
263
263
|
readonly onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
264
264
|
readonly onCancel?: ((payload: Event) => void) | undefined;
|
|
265
265
|
readonly rootClass?: unknown;
|
|
266
|
-
readonly
|
|
267
|
-
readonly
|
|
268
|
-
readonly collapseLabel?: string | undefined;
|
|
266
|
+
readonly detachLabel?: string | undefined;
|
|
267
|
+
readonly attachLabel?: string | undefined;
|
|
269
268
|
readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
|
|
270
269
|
readonly onClose?: (() => any) | undefined;
|
|
271
270
|
readonly onOpen?: (() => any) | undefined;
|
|
@@ -267,9 +267,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
267
267
|
trail?: string[];
|
|
268
268
|
rootClass?: unknown;
|
|
269
269
|
hideClose?: boolean;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
collapseLabel?: string;
|
|
270
|
+
detachLabel?: string;
|
|
271
|
+
attachLabel?: string;
|
|
273
272
|
"onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
274
273
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
275
274
|
minHeight?: string;
|
|
@@ -527,9 +526,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
527
526
|
trail?: string[];
|
|
528
527
|
rootClass?: unknown;
|
|
529
528
|
hideClose?: boolean;
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
collapseLabel?: string;
|
|
529
|
+
detachLabel?: string;
|
|
530
|
+
attachLabel?: string;
|
|
533
531
|
"onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
534
532
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
535
533
|
minHeight?: string;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Teleport :to="dockTarget" :disabled="!
|
|
2
|
+
<Teleport :to="dockTarget" :disabled="!docked">
|
|
3
3
|
<dialog
|
|
4
4
|
ref="dialogRef"
|
|
5
5
|
v-bind="$attrs"
|
|
6
|
-
:class="[
|
|
7
|
-
prefix,
|
|
8
|
-
rootClass,
|
|
9
|
-
{ 'is-dockable': dockable, 'is-docked': docked, 'is-expanded': teleported && expanded }
|
|
10
|
-
]"
|
|
6
|
+
:class="[prefix, rootClass, { 'is-dockable': dockable, 'is-docked': docked }]"
|
|
11
7
|
:aria-labelledby="labelledBy"
|
|
12
8
|
:aria-label="labelledBy ? void 0 : label"
|
|
13
9
|
:aria-describedby="hasDescription ? descriptionId : void 0"
|
|
@@ -55,7 +51,7 @@
|
|
|
55
51
|
</div>
|
|
56
52
|
</template>
|
|
57
53
|
<div
|
|
58
|
-
v-if="$slots.actions || showClose || hasTrail ||
|
|
54
|
+
v-if="$slots.actions || showClose || hasTrail || showDockToggle"
|
|
59
55
|
:class="`${prefix}-actions`"
|
|
60
56
|
>
|
|
61
57
|
<Button
|
|
@@ -71,14 +67,14 @@
|
|
|
71
67
|
</Button>
|
|
72
68
|
<slot name="actions" :close="close" />
|
|
73
69
|
<Button
|
|
74
|
-
v-if="
|
|
75
|
-
:icon="
|
|
70
|
+
v-if="showDockToggle"
|
|
71
|
+
:icon="docked ? 'arrows-pointing-out' : 'arrows-pointing-in'"
|
|
76
72
|
variant="ghost"
|
|
77
73
|
tone="neutral"
|
|
78
74
|
size="sm"
|
|
79
75
|
:disabled="loading"
|
|
80
|
-
:aria-label="
|
|
81
|
-
@click="
|
|
76
|
+
:aria-label="docked ? detachText : attachText"
|
|
77
|
+
@click="toggleDock"
|
|
82
78
|
/>
|
|
83
79
|
<Button
|
|
84
80
|
v-if="showClose"
|
|
@@ -178,9 +174,8 @@ const props = defineProps({
|
|
|
178
174
|
guardTitle: { type: String, required: false },
|
|
179
175
|
guardMessage: { type: String, required: false },
|
|
180
176
|
dock: { type: Boolean, required: false },
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
collapseLabel: { type: String, required: false }
|
|
177
|
+
detachLabel: { type: String, required: false },
|
|
178
|
+
attachLabel: { type: String, required: false }
|
|
184
179
|
});
|
|
185
180
|
provideFieldBoundary();
|
|
186
181
|
const parentScope = useLeaveScope();
|
|
@@ -200,18 +195,20 @@ async function guardedClose(reason) {
|
|
|
200
195
|
const { t } = useLocale();
|
|
201
196
|
const closeText = computed(() => props.closeLabel ?? t("common.close"));
|
|
202
197
|
const backText = computed(() => props.backLabel ?? t("common.back"));
|
|
203
|
-
const
|
|
204
|
-
const
|
|
198
|
+
const detachText = computed(() => props.detachLabel ?? t("dock.detach"));
|
|
199
|
+
const attachText = computed(() => props.attachLabel ?? t("dock.attach"));
|
|
205
200
|
const dockHost = inject(DOCK_KEY, null);
|
|
206
201
|
const mounted = ref(false);
|
|
207
|
-
const expanded = ref(false);
|
|
208
202
|
const dockable = computed(() => Boolean(props.dock && dockHost));
|
|
209
203
|
const dockTarget = computed(() => dockHost?.target.value ?? null);
|
|
210
|
-
const
|
|
204
|
+
const dockAvailable = computed(
|
|
211
205
|
() => dockable.value && mounted.value && !!dockTarget.value && !!dockHost?.wide.value
|
|
212
206
|
);
|
|
213
|
-
const docked = computed(() =>
|
|
214
|
-
const
|
|
207
|
+
const docked = computed(() => dockAvailable.value && !dockHost?.detached.value);
|
|
208
|
+
const showDockToggle = dockAvailable;
|
|
209
|
+
function toggleDock() {
|
|
210
|
+
if (dockHost) dockHost.detached.value = !dockHost.detached.value;
|
|
211
|
+
}
|
|
215
212
|
const slots = defineSlots();
|
|
216
213
|
const emit = defineEmits(["open", "close", "afterLeave", "navigate"]);
|
|
217
214
|
const open = defineModel("open", { type: Boolean, ...{ required: true } });
|
|
@@ -259,12 +256,6 @@ const { present, requestClose, onCancel, onClose, onPointerDown, onClick } = use
|
|
|
259
256
|
panel: panelRef,
|
|
260
257
|
open,
|
|
261
258
|
modal: () => !docked.value,
|
|
262
|
-
interceptClose: (reason) => {
|
|
263
|
-
if (!expanded.value || !teleported.value) return false;
|
|
264
|
-
if (reason !== "escape" && reason !== "backdrop") return false;
|
|
265
|
-
expanded.value = false;
|
|
266
|
-
return true;
|
|
267
|
-
},
|
|
268
259
|
dismissible: () => props.dismissible && !props.loading,
|
|
269
260
|
beforeClose: () => leave.dirty.value || props.beforeClose ? guardedClose : void 0,
|
|
270
261
|
onOpen: () => emit("open"),
|
|
@@ -279,9 +270,6 @@ function onDockedEscape(event) {
|
|
|
279
270
|
event.preventDefault();
|
|
280
271
|
if (props.dismissible && !props.loading) requestClose("escape");
|
|
281
272
|
}
|
|
282
|
-
watch(open, (value) => {
|
|
283
|
-
if (!value) expanded.value = false;
|
|
284
|
-
});
|
|
285
273
|
async function navigate(index) {
|
|
286
274
|
if (props.loading) return;
|
|
287
275
|
if (!await leave.confirmLeave()) return;
|
|
@@ -45,9 +45,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
45
45
|
guardTitle?: string;
|
|
46
46
|
guardMessage?: string;
|
|
47
47
|
dock?: boolean;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
collapseLabel?: string;
|
|
48
|
+
detachLabel?: string;
|
|
49
|
+
attachLabel?: string;
|
|
51
50
|
open: boolean;
|
|
52
51
|
tab?: TabItem["value"];
|
|
53
52
|
key?: PropertyKey | undefined;
|
|
@@ -274,9 +273,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
274
273
|
guardTitle?: string;
|
|
275
274
|
guardMessage?: string;
|
|
276
275
|
dock?: boolean;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
collapseLabel?: string;
|
|
276
|
+
detachLabel?: string;
|
|
277
|
+
attachLabel?: string;
|
|
280
278
|
open: boolean;
|
|
281
279
|
tab?: TabItem["value"];
|
|
282
280
|
key?: PropertyKey | undefined;
|
|
@@ -226,9 +226,8 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
226
226
|
backLabel?: string;
|
|
227
227
|
guardTitle?: string;
|
|
228
228
|
guardMessage?: string;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
collapseLabel?: string;
|
|
229
|
+
detachLabel?: string;
|
|
230
|
+
attachLabel?: string;
|
|
232
231
|
onOpen?: ((() => any) & (() => any)) | undefined;
|
|
233
232
|
"onUpdate:tab"?: (((value: string | number | undefined) => any) & ((value: string | number | undefined) => any)) | undefined;
|
|
234
233
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
@@ -465,9 +464,8 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
465
464
|
backLabel?: string;
|
|
466
465
|
guardTitle?: string;
|
|
467
466
|
guardMessage?: string;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
collapseLabel?: string;
|
|
467
|
+
detachLabel?: string;
|
|
468
|
+
attachLabel?: string;
|
|
471
469
|
onOpen?: ((() => any) & (() => any)) | undefined;
|
|
472
470
|
"onUpdate:tab"?: (((value: string | number | undefined) => any) & ((value: string | number | undefined) => any)) | undefined;
|
|
473
471
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
@@ -8,7 +8,6 @@ export interface ModalDialogOptions {
|
|
|
8
8
|
panel: Readonly<Ref<HTMLElement | null | undefined>>;
|
|
9
9
|
open: Ref<boolean>;
|
|
10
10
|
modal?: () => boolean;
|
|
11
|
-
interceptClose?: (reason: DialogCloseReason) => boolean;
|
|
12
11
|
dismissible: () => boolean;
|
|
13
12
|
beforeClose?: () => DialogBeforeClose | undefined;
|
|
14
13
|
onOpen?: () => void;
|
|
@@ -35,7 +35,6 @@ export function useModalDialog(options) {
|
|
|
35
35
|
}
|
|
36
36
|
async function requestClose(reason) {
|
|
37
37
|
if (!options.open.value) return true;
|
|
38
|
-
if (options.interceptClose?.(reason)) return false;
|
|
39
38
|
if (!await allowClose(reason)) return false;
|
|
40
39
|
options.open.value = false;
|
|
41
40
|
return true;
|
|
@@ -9,7 +9,13 @@ export declare const DOCK_WIDTH: {
|
|
|
9
9
|
export interface DockHost {
|
|
10
10
|
target: Readonly<Ref<HTMLElement | null>>;
|
|
11
11
|
wide: Readonly<Ref<boolean>>;
|
|
12
|
+
detached: Ref<boolean>;
|
|
12
13
|
}
|
|
14
|
+
export interface DockPreference {
|
|
15
|
+
width?: number;
|
|
16
|
+
detached?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function isDockPreference(value: unknown): value is DockPreference | number;
|
|
13
19
|
export declare const DOCK_KEY: InjectionKey<DockHost>;
|
|
14
20
|
export declare const dockedStack: import("vue").ShallowReactive<HTMLDialogElement[]>;
|
|
15
21
|
export declare const dockFrame: import("vue").ShallowRef<HTMLElement | null, HTMLElement | null>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { shallowReactive, shallowRef } from "vue";
|
|
2
2
|
export const DOCK_BREAKPOINT = 1280;
|
|
3
3
|
export const DOCK_WIDTH = { initial: 480, min: 352, max: 768, share: 0.45 };
|
|
4
|
+
export function isDockPreference(value) {
|
|
5
|
+
if (typeof value === "number") return value > 0;
|
|
6
|
+
if (!value || typeof value !== "object") return false;
|
|
7
|
+
const record = value;
|
|
8
|
+
return (record.width === void 0 || typeof record.width === "number" && record.width > 0) && (record.detached === void 0 || typeof record.detached === "boolean");
|
|
9
|
+
}
|
|
4
10
|
export const DOCK_KEY = Symbol("k-dock");
|
|
5
11
|
export const dockedStack = shallowReactive([]);
|
|
6
12
|
export const dockFrame = shallowRef(null);
|
package/dist/locale/de.mjs
CHANGED
|
@@ -264,8 +264,8 @@ export const de = {
|
|
|
264
264
|
emptyTitle: "Nichts ausgew\xE4hlt",
|
|
265
265
|
emptyDescription: "W\xE4hlen Sie ein Element der Liste, um hier seine Details zu sehen.",
|
|
266
266
|
resize: "Gr\xF6\xDFe des Detailbereichs \xE4ndern",
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
detach: "Bereich l\xF6sen",
|
|
268
|
+
attach: "Seitlich andocken"
|
|
269
269
|
},
|
|
270
270
|
formDrawer: {
|
|
271
271
|
discardDescription: "Die \xC4nderungen an diesem Element gehen verloren."
|
package/dist/locale/en.mjs
CHANGED
|
@@ -264,8 +264,8 @@ export const en = {
|
|
|
264
264
|
emptyTitle: "Nothing selected",
|
|
265
265
|
emptyDescription: "Select an item in the list to see its details here.",
|
|
266
266
|
resize: "Resize the details panel",
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
detach: "Detach the panel",
|
|
268
|
+
attach: "Dock to the side"
|
|
269
269
|
},
|
|
270
270
|
formDrawer: {
|
|
271
271
|
discardDescription: "The changes to this item will be lost."
|
package/dist/locale/it.mjs
CHANGED
|
@@ -264,8 +264,8 @@ export const it = {
|
|
|
264
264
|
emptyTitle: "Nessun elemento selezionato",
|
|
265
265
|
emptyDescription: "Seleziona un elemento della lista per vederne qui i dettagli.",
|
|
266
266
|
resize: "Ridimensiona il pannello dei dettagli",
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
detach: "Stacca il pannello",
|
|
268
|
+
attach: "Aggancia a lato"
|
|
269
269
|
},
|
|
270
270
|
formDrawer: {
|
|
271
271
|
discardDescription: "Le modifiche a questo elemento andranno perse."
|
package/dist/locale/types.d.ts
CHANGED
package/package.json
CHANGED