@xleddyl/443-components-vue 0.16.10 → 0.16.12

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.
@@ -0,0 +1,297 @@
1
+ import type { FormSchema, UseFormReturn } from '../../composables/useForm';
2
+ import type { TabItem } from '../layout/types';
3
+ import type { DialogBeforeClose, DrawerSide, DrawerSize } from '../overlays/types';
4
+ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<({
6
+ title?: string;
7
+ description?: string;
8
+ label?: string;
9
+ side?: DrawerSide;
10
+ size?: DrawerSize;
11
+ tabs?: TabItem[];
12
+ trail?: string[];
13
+ backLabel?: string;
14
+ form?: UseFormReturn<S, V>;
15
+ loading?: boolean;
16
+ readonly?: boolean;
17
+ creating?: boolean;
18
+ requireDirty?: boolean;
19
+ deletable?: boolean;
20
+ deleteDisabled?: boolean;
21
+ deleteHint?: string;
22
+ submitLabel?: string;
23
+ cancelLabel?: string;
24
+ deleteLabel?: string;
25
+ guard?: boolean;
26
+ guardTitle?: string;
27
+ guardMessage?: string;
28
+ beforeClose?: DialogBeforeClose;
29
+ onCancel?: () => unknown;
30
+ } & {
31
+ open?: boolean;
32
+ tab?: TabItem["value"];
33
+ }) & {
34
+ onDelete?: (() => any) | undefined;
35
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
36
+ onNavigate?: ((index: number) => any) | undefined;
37
+ onAfterLeave?: (() => any) | undefined;
38
+ "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
39
+ } & Partial<NonNullable<{
40
+ readonly title?: string | undefined | undefined;
41
+ readonly description?: string | undefined;
42
+ readonly label?: string | undefined;
43
+ readonly side?: DrawerSide | undefined;
44
+ readonly size?: DrawerSize | undefined;
45
+ readonly dismissible?: boolean | undefined;
46
+ readonly hideClose?: boolean | undefined;
47
+ readonly closeLabel?: string | undefined;
48
+ readonly flush?: boolean | undefined;
49
+ readonly loading?: boolean | undefined;
50
+ readonly beforeClose?: DialogBeforeClose | undefined;
51
+ readonly tabs?: TabItem[] | undefined;
52
+ readonly trail?: string[] | undefined;
53
+ readonly backLabel?: string | undefined;
54
+ readonly open?: boolean | undefined;
55
+ readonly tab?: TabItem["value"] | undefined;
56
+ readonly key?: PropertyKey | undefined;
57
+ readonly prefix?: "k-modal" | "k-drawer" | undefined;
58
+ readonly style?: import("vue").StyleValue;
59
+ readonly results?: (string | number) | undefined;
60
+ readonly placeholder?: string | undefined | undefined;
61
+ readonly dir?: string | undefined | undefined;
62
+ readonly contextmenu?: string | undefined | undefined;
63
+ readonly hidden?: "" | "hidden" | (boolean | "true" | "false") | "until-found" | undefined;
64
+ readonly class?: import("vue").ClassValue;
65
+ readonly role?: string | undefined | undefined;
66
+ readonly 'aria-label'?: string | undefined | undefined;
67
+ readonly 'aria-hidden'?: (boolean | "true" | "false") | undefined;
68
+ readonly onCopy?: ((payload: ClipboardEvent) => void) | undefined;
69
+ readonly onCut?: ((payload: ClipboardEvent) => void) | undefined;
70
+ readonly onPaste?: ((payload: ClipboardEvent) => void) | undefined;
71
+ readonly onCompositionend?: ((payload: CompositionEvent) => void) | undefined;
72
+ readonly onCompositionstart?: ((payload: CompositionEvent) => void) | undefined;
73
+ readonly onCompositionupdate?: ((payload: CompositionEvent) => void) | undefined;
74
+ readonly onDrag?: ((payload: DragEvent) => void) | undefined;
75
+ readonly onDragend?: ((payload: DragEvent) => void) | undefined;
76
+ readonly onDragenter?: ((payload: DragEvent) => void) | undefined;
77
+ readonly onDragexit?: ((payload: DragEvent) => void) | undefined;
78
+ readonly onDragleave?: ((payload: DragEvent) => void) | undefined;
79
+ readonly onDragover?: ((payload: DragEvent) => void) | undefined;
80
+ readonly onDragstart?: ((payload: DragEvent) => void) | undefined;
81
+ readonly onDrop?: ((payload: DragEvent) => void) | undefined;
82
+ readonly onFocus?: ((payload: FocusEvent) => void) | undefined;
83
+ readonly onFocusin?: ((payload: FocusEvent) => void) | undefined;
84
+ readonly onFocusout?: ((payload: FocusEvent) => void) | undefined;
85
+ readonly onBlur?: ((payload: FocusEvent) => void) | undefined;
86
+ readonly onChange?: ((payload: Event) => void) | undefined;
87
+ readonly onBeforeinput?: ((payload: InputEvent) => void) | undefined;
88
+ readonly onFormdata?: ((payload: FormDataEvent) => void) | undefined;
89
+ readonly onInput?: ((payload: InputEvent) => void) | undefined;
90
+ readonly onReset?: ((payload: Event) => void) | undefined;
91
+ readonly onSubmit?: ((payload: SubmitEvent) => void) | undefined;
92
+ readonly onInvalid?: ((payload: Event) => void) | undefined;
93
+ readonly onFullscreenchange?: ((payload: Event) => void) | undefined;
94
+ readonly onFullscreenerror?: ((payload: Event) => void) | undefined;
95
+ readonly onLoad?: ((payload: Event) => void) | undefined;
96
+ readonly onError?: ((payload: Event) => void) | undefined;
97
+ readonly onKeydown?: ((payload: KeyboardEvent) => void) | undefined;
98
+ readonly onKeypress?: ((payload: KeyboardEvent) => void) | undefined;
99
+ readonly onKeyup?: ((payload: KeyboardEvent) => void) | undefined;
100
+ readonly onDblclick?: ((payload: MouseEvent) => void) | undefined;
101
+ readonly onMousedown?: ((payload: MouseEvent) => void) | undefined;
102
+ readonly onMouseenter?: ((payload: MouseEvent) => void) | undefined;
103
+ readonly onMouseleave?: ((payload: MouseEvent) => void) | undefined;
104
+ readonly onMousemove?: ((payload: MouseEvent) => void) | undefined;
105
+ readonly onMouseout?: ((payload: MouseEvent) => void) | undefined;
106
+ readonly onMouseover?: ((payload: MouseEvent) => void) | undefined;
107
+ readonly onMouseup?: ((payload: MouseEvent) => void) | undefined;
108
+ readonly onAbort?: ((payload: UIEvent) => void) | undefined;
109
+ readonly onCanplay?: ((payload: Event) => void) | undefined;
110
+ readonly onCanplaythrough?: ((payload: Event) => void) | undefined;
111
+ readonly onDurationchange?: ((payload: Event) => void) | undefined;
112
+ readonly onEmptied?: ((payload: Event) => void) | undefined;
113
+ readonly onEncrypted?: ((payload: MediaEncryptedEvent) => void) | undefined;
114
+ readonly onEnded?: ((payload: Event) => void) | undefined;
115
+ readonly onLoadeddata?: ((payload: Event) => void) | undefined;
116
+ readonly onLoadedmetadata?: ((payload: Event) => void) | undefined;
117
+ readonly onLoadstart?: ((payload: Event) => void) | undefined;
118
+ readonly onPause?: ((payload: Event) => void) | undefined;
119
+ readonly onPlay?: ((payload: Event) => void) | undefined;
120
+ readonly onPlaying?: ((payload: Event) => void) | undefined;
121
+ readonly onProgress?: ((payload: ProgressEvent<EventTarget>) => void) | undefined;
122
+ readonly onRatechange?: ((payload: Event) => void) | undefined;
123
+ readonly onSeeked?: ((payload: Event) => void) | undefined;
124
+ readonly onSeeking?: ((payload: Event) => void) | undefined;
125
+ readonly onStalled?: ((payload: Event) => void) | undefined;
126
+ readonly onSuspend?: ((payload: Event) => void) | undefined;
127
+ readonly onTimeupdate?: ((payload: Event) => void) | undefined;
128
+ readonly onVolumechange?: ((payload: Event) => void) | undefined;
129
+ readonly onWaiting?: ((payload: Event) => void) | undefined;
130
+ readonly onSelect?: ((payload: Event) => void) | undefined;
131
+ readonly onScroll?: ((payload: Event) => void) | undefined;
132
+ readonly onScrollend?: ((payload: Event) => void) | undefined;
133
+ readonly onTouchcancel?: ((payload: TouchEvent) => void) | undefined;
134
+ readonly onTouchend?: ((payload: TouchEvent) => void) | undefined;
135
+ readonly onTouchmove?: ((payload: TouchEvent) => void) | undefined;
136
+ readonly onTouchstart?: ((payload: TouchEvent) => void) | undefined;
137
+ readonly onAuxclick?: ((payload: PointerEvent) => void) | undefined;
138
+ readonly onClick?: ((payload: PointerEvent) => void) | undefined;
139
+ readonly onContextmenu?: ((payload: PointerEvent) => void) | undefined;
140
+ readonly onGotpointercapture?: ((payload: PointerEvent) => void) | undefined;
141
+ readonly onLostpointercapture?: ((payload: PointerEvent) => void) | undefined;
142
+ readonly onPointerdown?: ((payload: PointerEvent) => void) | undefined;
143
+ readonly onPointermove?: ((payload: PointerEvent) => void) | undefined;
144
+ readonly onPointerup?: ((payload: PointerEvent) => void) | undefined;
145
+ readonly onPointercancel?: ((payload: PointerEvent) => void) | undefined;
146
+ readonly onPointerenter?: ((payload: PointerEvent) => void) | undefined;
147
+ readonly onPointerleave?: ((payload: PointerEvent) => void) | undefined;
148
+ readonly onPointerover?: ((payload: PointerEvent) => void) | undefined;
149
+ readonly onPointerout?: ((payload: PointerEvent) => void) | undefined;
150
+ readonly onBeforetoggle?: ((payload: ToggleEvent) => void) | undefined;
151
+ readonly onToggle?: ((payload: ToggleEvent) => void) | undefined;
152
+ readonly onWheel?: ((payload: WheelEvent) => void) | undefined;
153
+ readonly onAnimationcancel?: ((payload: AnimationEvent) => void) | undefined;
154
+ readonly onAnimationstart?: ((payload: AnimationEvent) => void) | undefined;
155
+ readonly onAnimationend?: ((payload: AnimationEvent) => void) | undefined;
156
+ readonly onAnimationiteration?: ((payload: AnimationEvent) => void) | undefined;
157
+ readonly onSecuritypolicyviolation?: ((payload: SecurityPolicyViolationEvent) => void) | undefined;
158
+ readonly onTransitioncancel?: ((payload: TransitionEvent) => void) | undefined;
159
+ readonly onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
160
+ readonly onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
161
+ readonly onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
162
+ readonly innerHTML?: string | undefined | undefined;
163
+ readonly color?: string | undefined | undefined;
164
+ readonly id?: string | undefined | undefined;
165
+ readonly lang?: string | undefined | undefined;
166
+ readonly tabindex?: (string | number) | undefined;
167
+ readonly 'aria-activedescendant'?: string | undefined | undefined;
168
+ readonly 'aria-atomic'?: (boolean | "true" | "false") | undefined;
169
+ readonly 'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined | undefined;
170
+ readonly 'aria-busy'?: (boolean | "true" | "false") | undefined;
171
+ readonly 'aria-checked'?: (boolean | "true" | "false") | "mixed" | undefined;
172
+ readonly 'aria-colcount'?: (string | number) | undefined;
173
+ readonly 'aria-colindex'?: (string | number) | undefined;
174
+ readonly 'aria-colspan'?: (string | number) | undefined;
175
+ readonly 'aria-controls'?: string | undefined | undefined;
176
+ readonly 'aria-current'?: "page" | "time" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
177
+ readonly 'aria-describedby'?: string | undefined | undefined;
178
+ readonly 'aria-details'?: string | undefined | undefined;
179
+ readonly 'aria-disabled'?: (boolean | "true" | "false") | undefined;
180
+ readonly 'aria-dropeffect'?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
181
+ readonly 'aria-errormessage'?: string | undefined | undefined;
182
+ readonly 'aria-expanded'?: (boolean | "true" | "false") | undefined;
183
+ readonly 'aria-flowto'?: string | undefined | undefined;
184
+ readonly 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
185
+ readonly 'aria-haspopup'?: "grid" | "tree" | "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | undefined;
186
+ readonly 'aria-invalid'?: (boolean | "true" | "false") | "grammar" | "spelling" | undefined;
187
+ readonly 'aria-keyshortcuts'?: string | undefined | undefined;
188
+ readonly 'aria-labelledby'?: string | undefined | undefined;
189
+ readonly 'aria-level'?: (string | number) | undefined;
190
+ readonly 'aria-live'?: "off" | "assertive" | "polite" | undefined | undefined;
191
+ readonly 'aria-modal'?: (boolean | "true" | "false") | undefined;
192
+ readonly 'aria-multiline'?: (boolean | "true" | "false") | undefined;
193
+ readonly 'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
194
+ readonly 'aria-orientation'?: "horizontal" | "vertical" | undefined | undefined;
195
+ readonly 'aria-owns'?: string | undefined | undefined;
196
+ readonly 'aria-placeholder'?: string | undefined | undefined;
197
+ readonly 'aria-posinset'?: (string | number) | undefined;
198
+ readonly 'aria-pressed'?: (boolean | "true" | "false") | "mixed" | undefined;
199
+ readonly 'aria-readonly'?: (boolean | "true" | "false") | undefined;
200
+ readonly 'aria-relevant'?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
201
+ readonly 'aria-required'?: (boolean | "true" | "false") | undefined;
202
+ readonly 'aria-roledescription'?: string | undefined | undefined;
203
+ readonly 'aria-rowcount'?: (string | number) | undefined;
204
+ readonly 'aria-rowindex'?: (string | number) | undefined;
205
+ readonly 'aria-rowspan'?: (string | number) | undefined;
206
+ readonly 'aria-selected'?: (boolean | "true" | "false") | undefined;
207
+ readonly 'aria-setsize'?: (string | number) | undefined;
208
+ readonly 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
209
+ readonly 'aria-valuemax'?: (string | number) | undefined;
210
+ readonly 'aria-valuemin'?: (string | number) | undefined;
211
+ readonly 'aria-valuenow'?: (string | number) | undefined;
212
+ readonly 'aria-valuetext'?: string | undefined | undefined;
213
+ readonly ref?: import("vue").VNodeRef | undefined;
214
+ readonly ref_for?: boolean | undefined | undefined;
215
+ readonly ref_key?: string | undefined | undefined;
216
+ readonly accesskey?: string | undefined | undefined;
217
+ readonly contenteditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
218
+ readonly draggable?: (boolean | "true" | "false") | undefined;
219
+ readonly enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
220
+ readonly enterKeyHint?: "search" | "done" | "previous" | "next" | "enter" | "go" | "send" | undefined;
221
+ readonly inert?: (boolean | "true" | "false") | undefined;
222
+ readonly spellcheck?: (boolean | "true" | "false") | undefined;
223
+ readonly translate?: "yes" | "no" | undefined | undefined;
224
+ readonly radiogroup?: string | undefined | undefined;
225
+ readonly about?: string | undefined | undefined;
226
+ readonly datatype?: string | undefined | undefined;
227
+ readonly inlist?: any;
228
+ readonly property?: string | undefined | undefined;
229
+ readonly resource?: string | undefined | undefined;
230
+ readonly typeof?: string | undefined | undefined;
231
+ readonly vocab?: string | undefined | undefined;
232
+ readonly autocapitalize?: string | undefined | undefined;
233
+ readonly autocorrect?: string | undefined | undefined;
234
+ readonly autosave?: string | undefined | undefined;
235
+ readonly itemprop?: string | undefined | undefined;
236
+ readonly itemscope?: (boolean | "true" | "false") | undefined;
237
+ readonly itemtype?: string | undefined | undefined;
238
+ readonly itemid?: string | undefined | undefined;
239
+ readonly itemref?: string | undefined | undefined;
240
+ readonly security?: string | undefined | undefined;
241
+ readonly unselectable?: "on" | "off" | undefined | undefined;
242
+ readonly inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
243
+ readonly is?: string | undefined | undefined;
244
+ readonly exportparts?: string | undefined;
245
+ readonly part?: string | undefined;
246
+ readonly popover?: (import("../../index.ts").PopoverMode | "" | boolean) | undefined;
247
+ readonly onVnodeBeforeMount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
248
+ readonly onVnodeMounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
249
+ readonly onVnodeBeforeUpdate?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
250
+ readonly onVnodeUpdated?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
251
+ readonly onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
252
+ readonly onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
253
+ readonly onCancel?: ((payload: Event) => void) | undefined;
254
+ readonly rootClass?: unknown;
255
+ readonly closedby?: import("../../index.ts").DialogClosedBy | undefined;
256
+ readonly onClose?: (() => any) | undefined;
257
+ readonly onOpen?: (() => any) | undefined;
258
+ readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
259
+ readonly onNavigate?: ((index: number) => any) | undefined;
260
+ readonly onAfterLeave?: (() => any) | undefined;
261
+ readonly "onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
262
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps>>> & (typeof globalThis extends {
263
+ __VLS_PROPS_FALLBACK: infer P;
264
+ } ? P : {});
265
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
266
+ confirmDiscard: () => Promise<boolean>;
267
+ close: () => Promise<boolean>;
268
+ }>) => void;
269
+ attrs: any;
270
+ slots: {
271
+ 'title-trailing'?: (props: {}) => any;
272
+ } & {
273
+ actions?: (props: {}) => any;
274
+ } & {
275
+ skeleton?: (props: {}) => any;
276
+ } & {
277
+ default?: (props: {
278
+ tab: string | number | undefined;
279
+ }) => any;
280
+ } & {
281
+ default?: (props: {
282
+ tab: string | number | undefined;
283
+ }) => any;
284
+ } & {
285
+ footer?: (props: {}) => any;
286
+ };
287
+ emit: (((evt: "delete") => void) & ((evt: "navigate", index: number) => void) & ((evt: "afterLeave") => void)) & (((event: "update:open", value: boolean) => void) & ((event: "update:tab", value: string | number | undefined) => void));
288
+ }>) => import("vue").VNode & {
289
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
290
+ };
291
+ declare const _default: typeof __VLS_export;
292
+ export default _default;
293
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
294
+ [K in keyof T]: T[K];
295
+ } : {
296
+ [K in keyof T as K]: T[K];
297
+ }) & {};
@@ -7,6 +7,7 @@ export { default as DashboardPage } from './DashboardPage.vue';
7
7
  export { default as DetailPage } from './DetailPage.vue';
8
8
  export { default as EmptyPage } from './EmptyPage.vue';
9
9
  export { default as ErrorPage } from './ErrorPage.vue';
10
+ export { default as FormDrawer } from './FormDrawer.vue';
10
11
  export { default as FormPage } from './FormPage.vue';
11
12
  export { default as ListPage } from './ListPage.vue';
12
13
  export { default as NotFoundPage } from './NotFoundPage.vue';
@@ -7,6 +7,7 @@ export { default as DashboardPage } from "./DashboardPage.vue";
7
7
  export { default as DetailPage } from "./DetailPage.vue";
8
8
  export { default as EmptyPage } from "./EmptyPage.vue";
9
9
  export { default as ErrorPage } from "./ErrorPage.vue";
10
+ export { default as FormDrawer } from "./FormDrawer.vue";
10
11
  export { default as FormPage } from "./FormPage.vue";
11
12
  export { default as ListPage } from "./ListPage.vue";
12
13
  export { default as NotFoundPage } from "./NotFoundPage.vue";
@@ -101,7 +101,20 @@
101
101
  />
102
102
  </form>
103
103
 
104
- <EditorContent class="k-editor-content" :editor="editor" />
104
+ <EditorContent v-show="!sourceMode" class="k-editor-content" :editor="editor" />
105
+ <textarea
106
+ v-if="sourceMode"
107
+ ref="sourceRef"
108
+ class="k-editor-source"
109
+ :class="{ 'is-invalid': sourceInvalid }"
110
+ :value="sourceText"
111
+ :readonly="!editable"
112
+ :aria-label="text.source"
113
+ :aria-invalid="sourceInvalid ? 'true' : void 0"
114
+ :style="{ minHeight, maxHeight }"
115
+ spellcheck="false"
116
+ @input="onSourceInput($event.target.value)"
117
+ />
105
118
 
106
119
  <div v-if="showCount" class="k-editor-footer">
107
120
  <span
@@ -134,6 +147,7 @@ const icons = {
134
147
  undo: "M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3",
135
148
  redo: "m15 15 6-6m0 0-6-6m6 6H9a6 6 0 0 0 0 12h3",
136
149
  bulletList: "M9 6h12M9 12h12M9 18h12M4 6h.01M4 12h.01M4 18h.01",
150
+ source: "M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5",
137
151
  link: "M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"
138
152
  };
139
153
  const props = defineProps({
@@ -153,7 +167,8 @@ const props = defineProps({
153
167
  toolbar: { type: Array, required: false },
154
168
  extensions: { type: Array, required: false, default: () => [] },
155
169
  linkTypes: { type: Array, required: false, default: () => ["url"] },
156
- messages: { type: Object, required: false }
170
+ messages: { type: Object, required: false },
171
+ source: { type: Boolean, required: false }
157
172
  });
158
173
  const model = defineModel({ type: [String, Object, null], ...{ default: null } });
159
174
  const control = useFieldControl({
@@ -171,6 +186,10 @@ const linkUrl = ref("");
171
186
  const linkText = ref("");
172
187
  const linkType = ref("url");
173
188
  const linkNeedsText = ref(false);
189
+ const sourceRef = useTemplateRef("sourceRef");
190
+ const sourceMode = ref(false);
191
+ const sourceText = ref("");
192
+ const sourceInvalid = ref(false);
174
193
  const linkPrefixes = { url: "", email: "mailto:", phone: "tel:" };
175
194
  const linkTypeLabels = computed(() => ({
176
195
  url: text.value.linkTypeUrl,
@@ -400,7 +419,15 @@ const defaultToolbar = computed(() => [
400
419
  }
401
420
  ]
402
421
  ]);
422
+ const sourceItem = computed(() => ({
423
+ id: "source",
424
+ label: text.value.source,
425
+ icon: icons.source,
426
+ active: () => sourceMode.value,
427
+ run: toggleSource
428
+ }));
403
429
  const optionalItems = computed(() => [
430
+ sourceItem.value,
404
431
  mark(
405
432
  "underline",
406
433
  text.value.underline,
@@ -423,7 +450,10 @@ function splitToolbar(toolbar) {
423
450
  return result;
424
451
  }
425
452
  const groups = computed(() => {
426
- if (!props.toolbar) return defaultToolbar.value.filter((group) => group.length);
453
+ if (!props.toolbar)
454
+ return [...defaultToolbar.value, props.source ? [sourceItem.value] : []].filter(
455
+ (group) => group.length
456
+ );
427
457
  const byId = new Map(
428
458
  [...defaultToolbar.value.flat(), ...optionalItems.value].map((item) => [item.id, item])
429
459
  );
@@ -437,7 +467,8 @@ const groups = computed(() => {
437
467
  ).filter((group) => group.length);
438
468
  });
439
469
  function itemAttributes(item) {
440
- const disabled = item.enabled ? !item.enabled() : false;
470
+ const locked = sourceMode.value && item.id !== "source";
471
+ const disabled = locked || (item.enabled ? !item.enabled() : false);
441
472
  return {
442
473
  "aria-label": item.label,
443
474
  title: item.label,
@@ -448,6 +479,43 @@ function itemAttributes(item) {
448
479
  onClick: item.run
449
480
  };
450
481
  }
482
+ function sourceOf(value) {
483
+ if (value === null || value === "") return "";
484
+ return typeof value === "string" ? value : JSON.stringify(value, null, 2);
485
+ }
486
+ async function toggleSource() {
487
+ if (sourceMode.value) {
488
+ sourceMode.value = false;
489
+ sourceInvalid.value = false;
490
+ await nextTick();
491
+ editor.value?.commands.focus();
492
+ return;
493
+ }
494
+ linkOpen.value = false;
495
+ sourceText.value = sourceOf(model.value);
496
+ sourceInvalid.value = false;
497
+ sourceMode.value = true;
498
+ await nextTick();
499
+ sourceRef.value?.focus();
500
+ }
501
+ function onSourceInput(value) {
502
+ sourceText.value = value;
503
+ if (!value.trim()) {
504
+ sourceInvalid.value = false;
505
+ model.value = null;
506
+ return;
507
+ }
508
+ if (props.format !== "json") {
509
+ model.value = value;
510
+ return;
511
+ }
512
+ try {
513
+ model.value = JSON.parse(value);
514
+ sourceInvalid.value = false;
515
+ } catch {
516
+ sourceInvalid.value = true;
517
+ }
518
+ }
451
519
  function toggleLink() {
452
520
  if (linkOpen.value) {
453
521
  closeLink();
@@ -19,6 +19,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
19
19
  extensions?: Extensions;
20
20
  linkTypes?: EditorLinkType[];
21
21
  messages?: Partial<EditorMessages>;
22
+ source?: boolean;
22
23
  modelValue?: EditorValue;
23
24
  key?: PropertyKey | undefined;
24
25
  prefix?: string | undefined | undefined;
@@ -234,6 +235,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
234
235
  extensions?: Extensions;
235
236
  linkTypes?: EditorLinkType[];
236
237
  messages?: Partial<EditorMessages>;
238
+ source?: boolean;
237
239
  modelValue?: EditorValue;
238
240
  key?: PropertyKey | undefined;
239
241
  prefix?: string | undefined | undefined;
@@ -291,3 +291,23 @@
291
291
  .k-editor-count.is-over {
292
292
  color: var(--k-danger-text);
293
293
  }
294
+
295
+ .k-editor-source {
296
+ flex: 1;
297
+ width: 100%;
298
+ min-width: 0;
299
+ padding: 0.625rem 0.875rem;
300
+ overflow-y: auto;
301
+ font-family: var(--k-font-mono);
302
+ font-size: 0.8125rem;
303
+ line-height: 1.6;
304
+ color: var(--k-text-toned);
305
+ background: transparent;
306
+ border: 0;
307
+ outline: none;
308
+ resize: vertical;
309
+ }
310
+
311
+ .k-editor-source.is-invalid {
312
+ color: var(--k-danger-text);
313
+ }
@@ -6,5 +6,5 @@ export type EditorMessages = KMessages['editor'];
6
6
  export type EditorHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
7
7
  export type EditorHeadingLabel = 'level' | 'relative';
8
8
  export type EditorLinkType = 'url' | 'email' | 'phone';
9
- export type EditorToolbarItem = 'undo' | 'redo' | 'headings' | `h${EditorHeadingLevel}` | 'bold' | 'italic' | 'underline' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'link' | '|';
9
+ export type EditorToolbarItem = 'undo' | 'redo' | 'headings' | `h${EditorHeadingLevel}` | 'bold' | 'italic' | 'underline' | 'strike' | 'code' | 'bulletList' | 'orderedList' | 'blockquote' | 'link' | 'source' | '|';
10
10
  export type EditorToolbar = EditorToolbarItem[] | EditorToolbarItem[][];
@@ -28,7 +28,9 @@ export const de = {
28
28
  opensInNewTab: "(\xF6ffnet in einem neuen Tab)",
29
29
  copyFailed: "Kopieren fehlgeschlagen",
30
30
  readonly: "Schreibgesch\xFCtzt",
31
- empty: "Leer"
31
+ empty: "Leer",
32
+ create: "Erstellen",
33
+ delete: "L\xF6schen"
32
34
  },
33
35
  form: {
34
36
  required: "Dieses Feld ist erforderlich",
@@ -71,7 +73,8 @@ export const de = {
71
73
  linkText: "Linktext",
72
74
  characters: "{count} Zeichen | {count} Zeichen",
73
75
  limit: "{count} von {max} Zeichen",
74
- limitReached: "Zeichenlimit erreicht"
76
+ limitReached: "Zeichenlimit erreicht",
77
+ source: "Quelltext"
75
78
  },
76
79
  grid: {
77
80
  noRows: "Keine Zeilen vorhanden",
@@ -211,6 +214,9 @@ export const de = {
211
214
  confirm: "\xC4nderungen verwerfen",
212
215
  cancel: "Weiter bearbeiten"
213
216
  },
217
+ formDrawer: {
218
+ discardDescription: "Die \xC4nderungen an diesem Element gehen verloren."
219
+ },
214
220
  emptyPage: {
215
221
  title: "Willkommen",
216
222
  steps: "Erste Schritte",
@@ -28,7 +28,9 @@ export const en = {
28
28
  opensInNewTab: "(opens in a new tab)",
29
29
  copyFailed: "Could not copy",
30
30
  readonly: "Read only",
31
- empty: "Empty"
31
+ empty: "Empty",
32
+ create: "Create",
33
+ delete: "Delete"
32
34
  },
33
35
  form: {
34
36
  required: "This field is required",
@@ -71,7 +73,8 @@ export const en = {
71
73
  linkText: "Link text",
72
74
  characters: "{count} character | {count} characters",
73
75
  limit: "{count} of {max} characters",
74
- limitReached: "Character limit reached"
76
+ limitReached: "Character limit reached",
77
+ source: "Source"
75
78
  },
76
79
  grid: {
77
80
  noRows: "No rows to show",
@@ -211,6 +214,9 @@ export const en = {
211
214
  confirm: "Discard changes",
212
215
  cancel: "Keep editing"
213
216
  },
217
+ formDrawer: {
218
+ discardDescription: "The changes to this item will be lost."
219
+ },
214
220
  emptyPage: {
215
221
  title: "Welcome aboard",
216
222
  steps: "Getting started",
@@ -28,7 +28,9 @@ export const it = {
28
28
  opensInNewTab: "(si apre in una nuova scheda)",
29
29
  copyFailed: "Impossibile copiare",
30
30
  readonly: "Sola lettura",
31
- empty: "Vuoto"
31
+ empty: "Vuoto",
32
+ create: "Crea",
33
+ delete: "Elimina"
32
34
  },
33
35
  form: {
34
36
  required: "Campo obbligatorio",
@@ -71,7 +73,8 @@ export const it = {
71
73
  linkText: "Testo del link",
72
74
  characters: "{count} carattere | {count} caratteri",
73
75
  limit: "{count} di {max} caratteri",
74
- limitReached: "Limite di caratteri raggiunto"
76
+ limitReached: "Limite di caratteri raggiunto",
77
+ source: "Codice sorgente"
75
78
  },
76
79
  grid: {
77
80
  noRows: "Nessuna riga da mostrare",
@@ -211,6 +214,9 @@ export const it = {
211
214
  confirm: "Scarta modifiche",
212
215
  cancel: "Continua a modificare"
213
216
  },
217
+ formDrawer: {
218
+ discardDescription: "Le modifiche a questo elemento andranno perse."
219
+ },
214
220
  emptyPage: {
215
221
  title: "Benvenuto a bordo",
216
222
  steps: "Per iniziare",
@@ -27,6 +27,8 @@ export interface KMessages {
27
27
  copyFailed: string;
28
28
  readonly: string;
29
29
  empty: string;
30
+ create: string;
31
+ delete: string;
30
32
  };
31
33
  form: {
32
34
  required: string;
@@ -70,6 +72,7 @@ export interface KMessages {
70
72
  characters: string;
71
73
  limit: string;
72
74
  limitReached: string;
75
+ source: string;
73
76
  };
74
77
  grid: {
75
78
  noRows: string;
@@ -209,6 +212,9 @@ export interface KMessages {
209
212
  confirm: string;
210
213
  cancel: string;
211
214
  };
215
+ formDrawer: {
216
+ discardDescription: string;
217
+ };
212
218
  emptyPage: {
213
219
  title: string;
214
220
  steps: string;
@@ -66,3 +66,49 @@
66
66
  display: none;
67
67
  }
68
68
  }
69
+
70
+ .k-skeleton-form {
71
+ display: grid;
72
+ grid-template-columns: repeat(var(--k-skeleton-form-columns, 1), minmax(0, 1fr));
73
+ gap: 1rem;
74
+ }
75
+
76
+ .k-skeleton-form-field {
77
+ display: flex;
78
+ flex-direction: column;
79
+ gap: 0.5rem;
80
+ }
81
+
82
+ .k-skeleton-form-control.k-skeleton-rect {
83
+ height: var(--k-size-md);
84
+ border-radius: var(--k-radius-md);
85
+ }
86
+
87
+ .k-skeleton-list {
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: 1rem;
91
+ margin: 0;
92
+ padding: 0;
93
+ list-style: none;
94
+ }
95
+
96
+ .k-skeleton-list-row {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: 0.75rem;
100
+ }
101
+
102
+ .k-skeleton-list-text {
103
+ display: flex;
104
+ flex: 1;
105
+ flex-direction: column;
106
+ gap: 0.375rem;
107
+ min-width: 0;
108
+ }
109
+
110
+ @media (max-width: 640px) {
111
+ .k-skeleton-form {
112
+ grid-template-columns: minmax(0, 1fr);
113
+ }
114
+ }