@dosgato/dialog 1.1.9 → 1.1.10
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.
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} FieldComboboxProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FieldComboboxEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FieldComboboxSlots */
|
|
4
|
+
export default class FieldCombobox extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type FieldComboboxProps = typeof __propDef.props;
|
|
11
|
+
export type FieldComboboxEvents = typeof __propDef.events;
|
|
12
|
+
export type FieldComboboxSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
package/dist/Tab.svelte
CHANGED
|
@@ -34,10 +34,12 @@ setContext(TAB_NAME_CONTEXT, tabNameStore);
|
|
|
34
34
|
<style>
|
|
35
35
|
.tabs-panel {
|
|
36
36
|
width: 100%;
|
|
37
|
-
min-height: 50vh;
|
|
38
37
|
border: var(--tabs-panel-border, var(--tabs-border, 0));
|
|
39
38
|
padding: var(--tabs-margin-top, 1.5em) var(--tabs-padding-hori, 0.7em) 0.5em var(--tabs-padding-hori, 0.7em);
|
|
40
39
|
}
|
|
40
|
+
:global(.dialog-content) .tabs-panel {
|
|
41
|
+
min-height: 50vh;
|
|
42
|
+
}
|
|
41
43
|
.tabs-panel.accordion {
|
|
42
44
|
border-left: 0;
|
|
43
45
|
border-right: 0;
|
|
@@ -3,7 +3,7 @@ import folderIcon from '@iconify-icons/ph/folder';
|
|
|
3
3
|
import folderNotchOpen from '@iconify-icons/ph/folder-notch-open';
|
|
4
4
|
import { createEventDispatcher, getContext, onMount, setContext, tick } from 'svelte';
|
|
5
5
|
import { isNotBlank, randomid } from 'txstate-utils';
|
|
6
|
-
import { Button, Dialog, iconForMime, Tabs, Tree, UploadUI } from '..';
|
|
6
|
+
import { Button, Dialog, iconForMime, Tabs, Tree, UploadUI, expandTreePath } from '..';
|
|
7
7
|
import { CHOOSER_API_CONTEXT } from './ChooserAPI';
|
|
8
8
|
import { CHOOSER_STORE_CONTEXT, ChooserStore } from './ChooserStore';
|
|
9
9
|
import Details from './Details.svelte';
|
|
@@ -45,26 +45,11 @@ function onUploadComplete() {
|
|
|
45
45
|
treeStore.openAndRefresh($selected).catch(console.error);
|
|
46
46
|
showuploader = false;
|
|
47
47
|
}
|
|
48
|
-
async function openRecursive(pathSplit, depth) {
|
|
49
|
-
let curr = $treeStore.rootItems?.find(itm => itm.name === pathSplit[0]);
|
|
50
|
-
for (let i = 0; i < depth; i++) {
|
|
51
|
-
curr = curr?.children?.find(c => c.name === pathSplit[i + 1]);
|
|
52
|
-
}
|
|
53
|
-
if (!curr) {
|
|
54
|
-
console.warn('tried to preload a path', '/' + pathSplit.join('/'), 'that does not exist ');
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
await treeStore.open(curr, false);
|
|
58
|
-
if (depth + 1 >= pathSplit.length)
|
|
59
|
-
return curr;
|
|
60
|
-
return await openRecursive(pathSplit, depth + 1);
|
|
61
|
-
}
|
|
62
48
|
async function selectPreview(preloadPath) {
|
|
63
49
|
if (!$store.initialized)
|
|
64
50
|
return;
|
|
65
51
|
if (preloadPath) {
|
|
66
|
-
const currentSelection = await
|
|
67
|
-
treeStore.trigger();
|
|
52
|
+
const currentSelection = await expandTreePath(treeStore, preloadPath.split('/').filter(isNotBlank));
|
|
68
53
|
if (!currentSelection)
|
|
69
54
|
return;
|
|
70
55
|
store.setPreview(currentSelection);
|
package/dist/tree/treestore.d.ts
CHANGED
|
@@ -137,3 +137,6 @@ export declare function getHashId(str: string): string;
|
|
|
137
137
|
export declare const lazyObserver: IntersectionObserver | undefined;
|
|
138
138
|
export type SearchableType<T> = keyof T | (keyof T)[] | ((item: T) => string | string[]) | undefined;
|
|
139
139
|
export declare function transformSearchable<T>(searchable: SearchableType<T>): undefined | ((itm: T) => string[]);
|
|
140
|
+
export declare function expandTreePath<T extends TreeItemFromDB & {
|
|
141
|
+
name: string;
|
|
142
|
+
}>(treeStore: TreeStore<T>, pathSplit: string[], depth?: number): Promise<TypedTreeItem<T> | undefined>;
|
package/dist/tree/treestore.js
CHANGED
|
@@ -404,3 +404,19 @@ export function transformSearchable(searchable) {
|
|
|
404
404
|
? (itm) => searchable.map(k => itm[k]).filter(isNotBlank)
|
|
405
405
|
: (itm) => isNotBlank(itm[searchable]) ? [itm[searchable]] : []));
|
|
406
406
|
}
|
|
407
|
+
export async function expandTreePath(treeStore, pathSplit, depth = 0) {
|
|
408
|
+
let curr = treeStore.value.rootItems?.find(itm => itm.name === pathSplit[0]);
|
|
409
|
+
for (let i = 0; i < depth; i++) {
|
|
410
|
+
curr = curr?.children?.find(c => c.name === pathSplit[i + 1]);
|
|
411
|
+
}
|
|
412
|
+
if (!curr) {
|
|
413
|
+
console.warn('tried to preload a path', '/' + pathSplit.join('/'), 'that does not exist ');
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
await treeStore.open(curr, false);
|
|
417
|
+
if (depth + 1 >= pathSplit.length) {
|
|
418
|
+
treeStore.focus(curr, false);
|
|
419
|
+
return curr;
|
|
420
|
+
}
|
|
421
|
+
return await expandTreePath(treeStore, pathSplit, depth + 1);
|
|
422
|
+
}
|
package/package.json
CHANGED