@dosgato/dialog 0.0.23 → 0.0.25
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/chooser/Chooser.svelte
CHANGED
|
@@ -88,7 +88,7 @@ onMount(async () => {
|
|
|
88
88
|
<section class="dialog-chooser-window">
|
|
89
89
|
<header class="dialog-chooser-controls">
|
|
90
90
|
{#if $sources.length > 1}
|
|
91
|
-
<Tabs bind:store={tabStore} tabs={$sources.map(s => ({
|
|
91
|
+
<Tabs bind:store={tabStore} tabs={$sources.map(s => ({ name: s.name, title: s.label ?? s.name }))} />
|
|
92
92
|
{/if}
|
|
93
93
|
</header>
|
|
94
94
|
<section class="dialog-chooser-chooser">
|
|
@@ -50,6 +50,6 @@ export declare class ChooserStore<F = any> extends Store<IAssetStore> {
|
|
|
50
50
|
init(options: ChooserStoreOptions<F>): Promise<void>;
|
|
51
51
|
setPreview(item?: AnyItem): void;
|
|
52
52
|
clearPreview(): void;
|
|
53
|
-
setSource(name
|
|
53
|
+
setSource(name?: string, init?: boolean): void;
|
|
54
54
|
}
|
|
55
55
|
export {};
|
package/chooser/ChooserStore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Store, derivedStore } from '@txstate-mws/svelte-store';
|
|
2
2
|
import { tick } from 'svelte';
|
|
3
|
-
import { findIndex } from 'txstate-utils';
|
|
3
|
+
import { findIndex, isBlank } from 'txstate-utils';
|
|
4
4
|
export const CHOOSER_STORE_CONTEXT = {};
|
|
5
5
|
const nofilter = (x) => true;
|
|
6
6
|
export function combinePath(path, name) {
|
|
@@ -54,9 +54,7 @@ export class ChooserStore extends Store {
|
|
|
54
54
|
return { ...v, sources };
|
|
55
55
|
});
|
|
56
56
|
this.setSource(this.value.preview?.source ?? this.options.initialSource, true);
|
|
57
|
-
console.log('before initialized', this.value);
|
|
58
57
|
await tick();
|
|
59
|
-
console.log('just before initialized');
|
|
60
58
|
this.update(v => ({ ...v, initialized: true }));
|
|
61
59
|
}
|
|
62
60
|
setPreview(item) {
|
|
@@ -73,6 +71,7 @@ export class ChooserStore extends Store {
|
|
|
73
71
|
this.update(v => {
|
|
74
72
|
if (!v.initialized && !init)
|
|
75
73
|
return v;
|
|
74
|
+
name ??= [...(v.sources?.page ?? []), ...(v.sources?.asset ?? [])].filter(s => this.options.activeSources ? this.options.activeSources.has(s.name) : true)[0].name;
|
|
76
75
|
const pageSource = v.sources?.page.findIndex(s => s.name === name);
|
|
77
76
|
const assetSource = v.sources?.asset.findIndex(s => s.name === name);
|
|
78
77
|
if (pageSource >= 0)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dosgato/dialog",
|
|
3
3
|
"description": "A component library for building forms that edit a JSON document.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.25",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@txstate-mws/svelte-components": "^1.3.5",
|
|
7
7
|
"@txstate-mws/svelte-forms": "^1.1.2",
|