@dosgato/dialog 0.0.63 → 0.0.65
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/dist/FieldMultiselect.svelte +13 -8
- package/dist/FieldStandard.svelte.d.ts +1 -1
- package/dist/FieldText.svelte +2 -1
- package/dist/FieldText.svelte.d.ts +1 -0
- package/dist/Input.svelte +3 -1
- package/dist/Input.svelte.d.ts +1 -0
- package/dist/Tab.svelte +1 -1
- package/dist/chooser/Chooser.svelte +1 -1
- package/dist/tree/TreeCell.svelte +4 -5
- package/dist/tree/treestore.d.ts +4 -3
- package/dist/tree/treestore.js +4 -1
- package/package.json +1 -1
|
@@ -33,12 +33,11 @@ export let lookupByValue = async (val) => { const options = await getOptions(val
|
|
|
33
33
|
export let related = 0;
|
|
34
34
|
export let extradescid = undefined;
|
|
35
35
|
export let helptext = undefined;
|
|
36
|
-
|
|
37
|
-
// that it finds, so that we can display labels on pills.
|
|
36
|
+
/** Each time we run getOptions we will save the value -> label mappings that it finds, so that we can display labels on pills. */
|
|
38
37
|
const valueToLabel = {};
|
|
39
38
|
async function wrapGetOptions(search) {
|
|
40
39
|
const opts = await getOptions(search);
|
|
41
|
-
|
|
40
|
+
/* If no options are returned with the search term, we can end up with an infinite loop the first time reactToValue calls wrapGetOptions */
|
|
42
41
|
// if (opts.length === 0) opts = await getOptions('')
|
|
43
42
|
for (const opt of opts) {
|
|
44
43
|
valueToLabel[opt.value] = opt.label || opt.value;
|
|
@@ -54,10 +53,9 @@ onMount(async () => {
|
|
|
54
53
|
await reactToValue(defaultValue);
|
|
55
54
|
hasInit = true;
|
|
56
55
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// is currently unknown.
|
|
56
|
+
/**
|
|
57
|
+
If we get a value from the form that we haven't seen in the popup menu yet, we won't have a label for it.
|
|
58
|
+
This function runs getOptions on any selected values for which the label is currently unknown. */
|
|
61
59
|
async function reactToValue(value) {
|
|
62
60
|
await Promise.all(value.map(async (v) => {
|
|
63
61
|
if (!valueToLabel[v]) {
|
|
@@ -75,7 +73,11 @@ async function reactToValue(value) {
|
|
|
75
73
|
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} {related} {helptext} let:value let:valid let:invalid let:id let:onBlur let:setVal let:messagesid let:helptextid>
|
|
76
74
|
{@const _ = reactToValue(value)}
|
|
77
75
|
<div class:valid class:invalid>
|
|
78
|
-
<MultiSelect {id} name={path} usePortal={portal} descid={getDescribedBy([messagesid, helptextid, extradescid])}
|
|
76
|
+
<MultiSelect {id} name={path} usePortal={portal} descid={getDescribedBy([messagesid, helptextid, extradescid])}
|
|
77
|
+
{disabled} {maxSelections} selected={$selectedStore} {placeholder} getOptions={wrapGetOptions}
|
|
78
|
+
inputClass='multiselect-input'
|
|
79
|
+
on:change={e => setVal(e.detail.map(itm => itm.value))} on:blur={onBlur}
|
|
80
|
+
/>
|
|
79
81
|
</div>
|
|
80
82
|
</FieldStandard>
|
|
81
83
|
{/if}
|
|
@@ -84,5 +86,8 @@ async function reactToValue(value) {
|
|
|
84
86
|
.invalid {
|
|
85
87
|
--multiselect-border: 1px solid red;
|
|
86
88
|
}
|
|
89
|
+
:global(.multiselect-input) {
|
|
90
|
+
width: 100%
|
|
91
|
+
}
|
|
87
92
|
|
|
88
93
|
</style>
|
|
@@ -30,7 +30,7 @@ declare const __propDef: {
|
|
|
30
30
|
value: any;
|
|
31
31
|
onBlur: () => void;
|
|
32
32
|
onChange: (e?: any) => void;
|
|
33
|
-
setVal: (val: string | number | boolean | object | Date) => void;
|
|
33
|
+
setVal: (val: string | number | boolean | object | Date | undefined) => void;
|
|
34
34
|
valid: boolean;
|
|
35
35
|
invalid: boolean;
|
|
36
36
|
messagesid: any;
|
package/dist/FieldText.svelte
CHANGED
|
@@ -16,10 +16,11 @@ export let required = false;
|
|
|
16
16
|
export let use = [];
|
|
17
17
|
export let inputelement = undefined;
|
|
18
18
|
export let related = 0;
|
|
19
|
+
export let autocomplete = 'off';
|
|
19
20
|
export let extradescid = undefined;
|
|
20
21
|
export let helptext = undefined;
|
|
21
22
|
</script>
|
|
22
23
|
|
|
23
24
|
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} {related} {helptext} serialize={!notNull ? nullableSerialize : undefined} deserialize={!notNull ? nullableDeserialize : undefined} let:value let:valid let:invalid let:id let:onBlur let:onChange let:messagesid let:helptextid>
|
|
24
|
-
<Input bind:inputelement {type} name={path} {value} {id} class="dialog-input {className}" {allowlastpass} {onChange} {onBlur} {valid} {invalid} {maxlength} {messagesid} {helptextid} {extradescid} {use}></Input>
|
|
25
|
+
<Input bind:inputelement {type} {autocomplete} name={path} {value} {id} class="dialog-input {className}" {allowlastpass} {onChange} {onBlur} {valid} {invalid} {maxlength} {messagesid} {helptextid} {extradescid} {use}></Input>
|
|
25
26
|
</FieldStandard>
|
|
@@ -16,6 +16,7 @@ declare const __propDef: {
|
|
|
16
16
|
use?: HTMLActionEntry[] | undefined;
|
|
17
17
|
inputelement?: HTMLInputElement | undefined;
|
|
18
18
|
related?: number | true | undefined;
|
|
19
|
+
autocomplete?: string | undefined;
|
|
19
20
|
extradescid?: string | undefined;
|
|
20
21
|
helptext?: string | undefined;
|
|
21
22
|
};
|
package/dist/Input.svelte
CHANGED
|
@@ -13,6 +13,7 @@ export let max = undefined;
|
|
|
13
13
|
export let step = undefined;
|
|
14
14
|
export let id = undefined;
|
|
15
15
|
export let disabled = false;
|
|
16
|
+
export let autocomplete = 'off';
|
|
16
17
|
export let extradescid = undefined;
|
|
17
18
|
export let messagesid = undefined;
|
|
18
19
|
export let helptextid = undefined;
|
|
@@ -37,4 +38,5 @@ $: minStr = resolveMinMax(min);
|
|
|
37
38
|
$: maxStr = resolveMinMax(max);
|
|
38
39
|
</script>
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
<!-- svelte-ignore a11y-autocomplete-valid -->
|
|
42
|
+
<input bind:this={inputelement} {type} {id} {autocomplete} class={className} data-lpignore={!allowlastpass} {name} {value} {disabled} {maxlength} min={minStr} max={maxStr} {step} class:valid class:invalid aria-invalid={invalid} aria-describedby={isNotBlank(descby) ? descby : null} on:change={onChange} on:select={onSelect} on:blur={onBlur} on:keyup={onChange} use:passActions={use}>
|
package/dist/Input.svelte.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare const __propDef: {
|
|
|
17
17
|
step?: number | undefined;
|
|
18
18
|
id?: string | undefined;
|
|
19
19
|
disabled?: boolean | undefined;
|
|
20
|
+
autocomplete?: string | undefined;
|
|
20
21
|
extradescid?: string | undefined;
|
|
21
22
|
messagesid?: string | undefined;
|
|
22
23
|
helptextid?: string | undefined;
|
package/dist/Tab.svelte
CHANGED
|
@@ -31,7 +31,7 @@ const last = idx === $store.tabs.length - 1;
|
|
|
31
31
|
width: 100%;
|
|
32
32
|
min-height: 50vh;
|
|
33
33
|
border: var(--tabs-panel-border, var(--tabs-border, 0));
|
|
34
|
-
padding: var(--tabs-margin-top, 2em) var(--tabs-padding-hori, 0.7em) 0 var(--tabs-padding-hori, 0.7em);
|
|
34
|
+
padding: var(--tabs-margin-top, 2em) var(--tabs-padding-hori, 0.7em) 0.5em var(--tabs-padding-hori, 0.7em);
|
|
35
35
|
}
|
|
36
36
|
.tabs-panel.accordion {
|
|
37
37
|
border-left: 0;
|
|
@@ -90,7 +90,7 @@ const previewId = randomid();
|
|
|
90
90
|
<section class="dialog-chooser-chooser">
|
|
91
91
|
{#if $store.initialized}
|
|
92
92
|
<Tree headers={[
|
|
93
|
-
{ label: 'Path', id: 'name', grow: 4, icon: item => item.type === 'asset' ?
|
|
93
|
+
{ label: 'Path', id: 'name', grow: 4, icon: item => ({ icon: item.type === 'asset' ? iconForMime(item.mime) : (item.type === 'folder' ? (item.open ? folderNotchOpen : folderIcon) : applicationOutline) }), get: 'name' }
|
|
94
94
|
]} singleSelect store={treeStore} on:deselect={onDeselect} on:choose={onChoose} />
|
|
95
95
|
{/if}
|
|
96
96
|
</section>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
<script>import { get
|
|
1
|
+
<script>import { get } from 'txstate-utils';
|
|
2
2
|
import { Icon } from '..';
|
|
3
3
|
export let header;
|
|
4
4
|
export let item;
|
|
5
|
-
$: icon = typeof header.icon === 'function' ? header.icon(item)
|
|
6
|
-
$: iconLabel = typeof header.icon === 'function' ? header.icon(item).label : header.icon?.label;
|
|
5
|
+
$: icon = (typeof header.icon === 'function' ? header.icon(item) : header.icon);
|
|
7
6
|
$: headerComponent = header.component;
|
|
8
7
|
</script>
|
|
9
8
|
|
|
10
|
-
{#if
|
|
9
|
+
{#if icon}
|
|
11
10
|
<span class="icon">
|
|
12
|
-
<Icon {icon} tooltip={
|
|
11
|
+
<Icon icon={icon.icon} tooltip={icon.label} inline width="1.5em" hiddenLabel={icon.label} />
|
|
13
12
|
</span>
|
|
14
13
|
{/if}
|
|
15
14
|
{#if header.component}
|
package/dist/tree/treestore.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface ITreeStore<T extends TreeItemFromDB> {
|
|
|
23
23
|
selectedItems: TypedTreeItem<T>[];
|
|
24
24
|
copied: Map<string, TypedTreeItem<T>>;
|
|
25
25
|
cut?: boolean;
|
|
26
|
+
copyRecursive?: boolean;
|
|
26
27
|
draggable: boolean;
|
|
27
28
|
selectedUndraggable?: boolean;
|
|
28
29
|
dragging: boolean;
|
|
@@ -41,11 +42,11 @@ export interface TreeHeader<T extends TreeItemFromDB> {
|
|
|
41
42
|
grow?: number;
|
|
42
43
|
icon?: {
|
|
43
44
|
icon: IconifyIcon;
|
|
44
|
-
label?: string
|
|
45
|
+
label?: string;
|
|
45
46
|
} | ((item: TypedTreeItem<T>) => {
|
|
46
47
|
icon: IconifyIcon;
|
|
47
48
|
label?: string;
|
|
48
|
-
});
|
|
49
|
+
} | undefined);
|
|
49
50
|
get?: string;
|
|
50
51
|
render?: (item: TypedTreeItem<T>) => string;
|
|
51
52
|
component?: SvelteComponent;
|
|
@@ -120,7 +121,7 @@ export declare class TreeStore<T extends TreeItemFromDB> extends ActiveStore<ITr
|
|
|
120
121
|
protected _dropEffect(item: TypedTreeItem<T>, droppedItems: Map<string, TypedTreeItem<T>>, above: boolean, userWantsCopy: boolean): "none" | "copy" | "move";
|
|
121
122
|
dropEffect(item: TypedTreeItem<T>, above: boolean, userWantsCopy: boolean): "none" | "copy" | "move";
|
|
122
123
|
cut(): void;
|
|
123
|
-
copy(): void;
|
|
124
|
+
copy(recursive?: boolean): void;
|
|
124
125
|
cutEligible(): boolean | undefined;
|
|
125
126
|
copyEligible(): boolean | undefined;
|
|
126
127
|
cancelCopy(): void;
|
package/dist/tree/treestore.js
CHANGED
|
@@ -334,11 +334,12 @@ export class TreeStore extends ActiveStore {
|
|
|
334
334
|
this.value.cut = true;
|
|
335
335
|
this.trigger();
|
|
336
336
|
}
|
|
337
|
-
copy() {
|
|
337
|
+
copy(recursive = false) {
|
|
338
338
|
if (!this.copyEligible())
|
|
339
339
|
return;
|
|
340
340
|
this.value.copied = new Map(this.value.selected);
|
|
341
341
|
this.value.cut = false;
|
|
342
|
+
this.value.copyRecursive = recursive;
|
|
342
343
|
this.trigger();
|
|
343
344
|
}
|
|
344
345
|
cutEligible() {
|
|
@@ -350,6 +351,7 @@ export class TreeStore extends ActiveStore {
|
|
|
350
351
|
cancelCopy() {
|
|
351
352
|
this.value.copied = new Map();
|
|
352
353
|
this.value.cut = undefined;
|
|
354
|
+
this.value.copyRecursive = undefined;
|
|
353
355
|
this.trigger();
|
|
354
356
|
}
|
|
355
357
|
pasteEligible(above = false) {
|
|
@@ -365,6 +367,7 @@ export class TreeStore extends ActiveStore {
|
|
|
365
367
|
const cut = this.value.cut;
|
|
366
368
|
this.value.copied = new Map();
|
|
367
369
|
this.value.cut = undefined;
|
|
370
|
+
this.value.copyRecursive = undefined;
|
|
368
371
|
return await this._drop(this.value.selectedItems[0], copied, above, !cut, userWantsRecursive);
|
|
369
372
|
}
|
|
370
373
|
setHeaderOverride(id, width) {
|
package/package.json
CHANGED