@dosgato/dialog 1.1.13 → 1.1.15
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/Dialog.svelte +4 -4
- package/dist/FieldChoices.svelte +6 -11
- package/dist/FieldChooserLink.svelte +1 -1
- package/dist/FieldRadio.svelte +15 -15
- package/dist/FieldSelect.svelte +17 -14
- package/dist/chooser/Chooser.svelte +0 -2
- package/dist/chooser/ChooserStore.js +2 -1
- package/dist/colorpicker/FieldColorPicker.svelte +14 -15
- package/dist/iconpicker/FieldIconPicker.svelte +1 -1
- package/package.json +1 -1
package/dist/Dialog.svelte
CHANGED
|
@@ -39,7 +39,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<Modal {escapable} {initialfocus} hidefocus={false} includeselector=".ck-body-wrapper" on:escape>
|
|
42
|
-
<section class="{expanded ? 'xl' : size}" use:eq>
|
|
42
|
+
<section class="{expanded ? 'xl expanded' : size}" use:eq>
|
|
43
43
|
{#if title || icon}
|
|
44
44
|
<header id={labelid}>
|
|
45
45
|
<Icon width="1.4em" {icon} inline />{title}
|
|
@@ -118,7 +118,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
|
|
|
118
118
|
width: 95vw;
|
|
119
119
|
max-width: 2000px;
|
|
120
120
|
}
|
|
121
|
-
@media (max-width: 2000px) { section.xl button.expand { display: none; } }
|
|
121
|
+
@media (max-width: 2000px) { section.xl:not(.expanded) button.expand { display: none; } }
|
|
122
122
|
@media (max-width: 800px) { section.xl { width: 97vw; } }
|
|
123
123
|
|
|
124
124
|
header {
|
|
@@ -148,8 +148,8 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
|
|
|
148
148
|
max-height: calc(100vh - 7.5em);
|
|
149
149
|
max-height: calc(100dvh - 7.5em);
|
|
150
150
|
}
|
|
151
|
-
@media (max-width: 800px) { .dialog-content { padding: 1.2em; } }
|
|
152
|
-
@media (max-width: 430px) { .dialog-content { padding: 0.6em; } }
|
|
151
|
+
@media (max-width: 800px) { .dialog-content { padding: 2rem 1.2em; } }
|
|
152
|
+
@media (max-width: 430px) { .dialog-content { padding: 2rem 0.6em; } }
|
|
153
153
|
|
|
154
154
|
section.tiny .dialog-content, section.small .dialog-content {
|
|
155
155
|
padding: 0 1em;
|
package/dist/FieldChoices.svelte
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
The value of the field will be an array corresponding to the values of the checkboxes that are checked.
|
|
6
6
|
-->
|
|
7
7
|
<script>import { getContext, onMount } from 'svelte';
|
|
8
|
-
import { Field, FORM_CONTEXT, arraySerialize } from '@txstate-mws/svelte-forms';
|
|
8
|
+
import { Field, FORM_CONTEXT, arraySerialize, FORM_INHERITED_PATH } from '@txstate-mws/svelte-forms';
|
|
9
9
|
import { derivedStore } from '@txstate-mws/svelte-store';
|
|
10
|
-
import { randomid } from 'txstate-utils';
|
|
10
|
+
import { get, isNotBlank, randomid } from 'txstate-utils';
|
|
11
11
|
import Container from './Container.svelte';
|
|
12
12
|
import Checkbox from './Checkbox.svelte';
|
|
13
13
|
import { getDescribedBy } from './helpers';
|
|
@@ -25,6 +25,8 @@ export let related = 0;
|
|
|
25
25
|
export let extradescid = undefined;
|
|
26
26
|
export let helptext = undefined;
|
|
27
27
|
const store = getContext(FORM_CONTEXT);
|
|
28
|
+
const inheritedPath = getContext(FORM_INHERITED_PATH);
|
|
29
|
+
const finalPath = [inheritedPath, path].filter(isNotBlank).join('.');
|
|
28
30
|
const currentWidth = derivedStore(store, 'width');
|
|
29
31
|
$: cols = Math.min(Math.ceil($currentWidth / maxwidth), choices.length);
|
|
30
32
|
let orders;
|
|
@@ -46,25 +48,18 @@ function onChangeCheckbox(setVal, choice, included) {
|
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
const descid = randomid();
|
|
49
|
-
let val, stVal;
|
|
50
|
-
function updateValue(valu, sVal) {
|
|
51
|
-
val = valu;
|
|
52
|
-
stVal = sVal;
|
|
53
|
-
}
|
|
54
51
|
function reactToChoices(..._) {
|
|
55
|
-
if (!stVal)
|
|
56
|
-
return;
|
|
57
52
|
const choiceSet = new Set(choices?.map(c => c.value));
|
|
53
|
+
const val = get($store, finalPath);
|
|
58
54
|
const filtered = val?.filter(v => choiceSet.has(v));
|
|
59
55
|
if (filtered?.length !== val?.length)
|
|
60
|
-
|
|
56
|
+
store.setField(finalPath, filtered).catch(console.error);
|
|
61
57
|
}
|
|
62
58
|
$: reactToChoices(choices);
|
|
63
59
|
onMount(reactToChoices);
|
|
64
60
|
</script>
|
|
65
61
|
|
|
66
62
|
<Field {path} {defaultValue} {conditional} let:path let:value let:onBlur let:setVal let:messages let:valid let:invalid serialize={arraySerialize}>
|
|
67
|
-
{@const _ = updateValue(value, setVal)}
|
|
68
63
|
<Container {path} {id} {label} {messages} {descid} {related} {helptext} let:messagesid let:helptextid>
|
|
69
64
|
<div class="dialog-choices {className}" class:valid class:invalid>
|
|
70
65
|
{#each choices as choice, idx (choice.value)}
|
|
@@ -183,7 +183,7 @@ $: void updateSelected($value);
|
|
|
183
183
|
<div class="dialog-chooser-entry">
|
|
184
184
|
{#if urlEntry}
|
|
185
185
|
<div class="dialog-chooser-entry-input">
|
|
186
|
-
<input bind:this={urlEntryInput} type="text" data-lpignore="true" value={selectedAsset?.url ?? ''} on:change={userUrlEntry} on:input={userUrlEntry}>
|
|
186
|
+
<input bind:this={urlEntryInput} {id} type="text" data-lpignore="true" value={selectedAsset?.url ?? ''} on:change={userUrlEntry} on:input={userUrlEntry} on:blur={onBlur}>
|
|
187
187
|
<button type="button" on:click={clearUrlEntry}><Icon icon={xCircle} hiddenLabel="clear input" inline/></button>
|
|
188
188
|
</div>
|
|
189
189
|
{/if}
|
package/dist/FieldRadio.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
<script>import { Field } from '@txstate-mws/svelte-forms';
|
|
2
|
-
import { onMount } from 'svelte';
|
|
1
|
+
<script>import { FORM_CONTEXT, FORM_INHERITED_PATH, Field } from '@txstate-mws/svelte-forms';
|
|
2
|
+
import { getContext, onMount } from 'svelte';
|
|
3
|
+
import { get, isNotBlank } from 'txstate-utils';
|
|
3
4
|
import Switcher from './Switcher.svelte';
|
|
4
5
|
let className = '';
|
|
5
6
|
export { className as class };
|
|
@@ -21,27 +22,26 @@ export let datetime = false;
|
|
|
21
22
|
export let boolean = false;
|
|
22
23
|
export let serialize = undefined;
|
|
23
24
|
export let deserialize = undefined;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const store = getContext(FORM_CONTEXT);
|
|
26
|
+
const inheritedPath = getContext(FORM_INHERITED_PATH);
|
|
27
|
+
const finalPath = [inheritedPath, path].filter(isNotBlank).join('.');
|
|
28
|
+
let finalDeserialize;
|
|
29
|
+
function updateDeserialize(fDes) {
|
|
28
30
|
finalDeserialize = fDes;
|
|
29
31
|
}
|
|
30
|
-
function reactToChoices(..._) {
|
|
31
|
-
if (!stVal)
|
|
32
|
-
return;
|
|
32
|
+
async function reactToChoices(..._) {
|
|
33
33
|
if (!choices.length) {
|
|
34
|
-
|
|
35
|
-
return;
|
|
34
|
+
return await store.setField(finalPath, finalDeserialize(''));
|
|
36
35
|
}
|
|
36
|
+
const val = get($store, finalPath);
|
|
37
37
|
if (!choices.some(o => o.value === finalDeserialize(val)))
|
|
38
|
-
|
|
38
|
+
await store.setField(finalPath, notNull ? defaultValue : finalDeserialize(''));
|
|
39
39
|
}
|
|
40
|
-
$: reactToChoices(choices);
|
|
40
|
+
$: reactToChoices(choices).catch(console.error);
|
|
41
41
|
onMount(reactToChoices);
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
|
-
<Field {path} {defaultValue} {conditional} {notNull} {number} {date} {datetime} {boolean} {serialize} {deserialize} let:value let:valid let:invalid let:onBlur let:onChange let:messages let:serialize let:
|
|
45
|
-
{@const _ =
|
|
44
|
+
<Field {path} {defaultValue} {conditional} {notNull} {number} {date} {datetime} {boolean} {serialize} {deserialize} let:value let:valid let:invalid let:onBlur let:onChange let:messages let:serialize let:deserialize>
|
|
45
|
+
{@const _ = updateDeserialize(deserialize)}
|
|
46
46
|
<Switcher bind:id {path} class={className} name={path} {horizontal} {label} iptValue={value} {valid} {invalid} {required} {related} {extradescid} {helptext} {messages} on:change={onChange} {onBlur} choices={choices.map(c => ({ ...c, value: serialize(c.value) }))} />
|
|
47
47
|
</Field>
|
package/dist/FieldSelect.svelte
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { FORM_CONTEXT, FORM_INHERITED_PATH } from '@txstate-mws/svelte-forms';
|
|
2
|
+
import { getContext, onMount } from 'svelte';
|
|
3
|
+
import { isNotBlank, get, equal } from 'txstate-utils';
|
|
2
4
|
import { getDescribedBy } from './';
|
|
3
5
|
import FieldStandard from './FieldStandard.svelte';
|
|
4
6
|
let className = '';
|
|
@@ -23,28 +25,29 @@ export let datetime = false;
|
|
|
23
25
|
export let boolean = false;
|
|
24
26
|
export let serialize = undefined;
|
|
25
27
|
export let deserialize = undefined;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const store = getContext(FORM_CONTEXT);
|
|
29
|
+
const inheritedPath = getContext(FORM_INHERITED_PATH);
|
|
30
|
+
const finalPath = [inheritedPath, path].filter(isNotBlank).join('.');
|
|
31
|
+
let finalDeserialize;
|
|
32
|
+
function updateDeserialize(fDes) {
|
|
30
33
|
finalDeserialize = fDes;
|
|
31
34
|
}
|
|
32
|
-
function reactToChoices(..._) {
|
|
33
|
-
if (!
|
|
35
|
+
async function reactToChoices(..._) {
|
|
36
|
+
if (!finalDeserialize)
|
|
34
37
|
return;
|
|
35
38
|
if (!choices.length) {
|
|
36
|
-
|
|
37
|
-
return;
|
|
39
|
+
return await store.setField(finalPath, finalDeserialize(''));
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
const val = get($store.data, finalPath);
|
|
42
|
+
if (!choices.some(o => equal(o.value, val)))
|
|
43
|
+
await store.setField(finalPath, notNull ? defaultValue : finalDeserialize(''));
|
|
41
44
|
}
|
|
42
|
-
$: reactToChoices(choices);
|
|
45
|
+
$: reactToChoices(choices).catch(console.error);
|
|
43
46
|
onMount(reactToChoices);
|
|
44
47
|
</script>
|
|
45
48
|
|
|
46
|
-
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} {related} {helptext} {notNull} {number} {date} {datetime} {boolean} {serialize} {deserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange let:messagesid let:helptextid let:serialize let:deserialize
|
|
47
|
-
{@const _ =
|
|
49
|
+
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} {related} {helptext} {notNull} {number} {date} {datetime} {boolean} {serialize} {deserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange let:messagesid let:helptextid let:serialize let:deserialize>
|
|
50
|
+
{@const _ = updateDeserialize(deserialize)}
|
|
48
51
|
<select bind:this={inputelement} {id} name={path} {disabled} class="dialog-input dialog-select {className}" on:change={onChange} on:blur={onBlur} class:valid class:invalid aria-describedby={getDescribedBy([messagesid, helptextid, extradescid])}>
|
|
49
52
|
{#if !notNull}<option value="" selected={!value}>{placeholder}</option>{/if}
|
|
50
53
|
{#each choices as choice (choice.value)}
|
|
@@ -6,8 +6,6 @@ import { isNotBlank, randomid } from 'txstate-utils';
|
|
|
6
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
|
-
import Details from './Details.svelte';
|
|
10
|
-
import Thumbnail from './Thumbnail.svelte';
|
|
11
9
|
import ChooserPreview from './ChooserPreview.svelte';
|
|
12
10
|
const chooserClient = getContext(CHOOSER_API_CONTEXT);
|
|
13
11
|
export let label = undefined;
|
|
@@ -39,7 +39,8 @@ export class ChooserStore extends Store {
|
|
|
39
39
|
const $source = this.getSource();
|
|
40
40
|
if (item?.type === 'asset' || !$source)
|
|
41
41
|
return [];
|
|
42
|
-
|
|
42
|
+
const imageFilter = this.options.images ? (itm) => ((itm.type === 'asset' && !!itm.image) || itm.type === 'folder') : nofilter;
|
|
43
|
+
return (await this.client.getChildren($source.name, item?.path ?? '/', this.filter)).filter(imageFilter);
|
|
43
44
|
}
|
|
44
45
|
treeStore = new TreeStore(this.fetchChildren.bind(this));
|
|
45
46
|
sources = derivedStore(this, v => [...(v.sources?.page ?? []), ...(v.sources?.asset ?? [])].filter(s => this.options.activeSources ? this.options.activeSources.has(s.name) : true));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
<script>import { FORM_CONTEXT, FORM_INHERITED_PATH } from '@txstate-mws/svelte-forms';
|
|
2
|
+
import { getContext, onMount } from 'svelte';
|
|
3
|
+
import { get, isNotBlank, randomid, shouldUseWhiteText } from 'txstate-utils';
|
|
4
4
|
import { Radio } from '..';
|
|
5
|
+
import FieldStandard from '../FieldStandard.svelte';
|
|
5
6
|
export let id = undefined;
|
|
6
7
|
let className = '';
|
|
7
8
|
export { className as class };
|
|
@@ -15,25 +16,23 @@ export let defaultValue = notNull ? (addAllOption ? 'alternating' : options[0].v
|
|
|
15
16
|
export let conditional = undefined;
|
|
16
17
|
export let helptext = undefined;
|
|
17
18
|
const groupid = randomid();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!stVal)
|
|
19
|
+
const store = getContext(FORM_CONTEXT);
|
|
20
|
+
const inheritedPath = getContext(FORM_INHERITED_PATH);
|
|
21
|
+
const finalPath = [inheritedPath, path].filter(isNotBlank).join('.');
|
|
22
|
+
async function reactToOptions(..._) {
|
|
23
|
+
const val = get($store.data, finalPath);
|
|
24
|
+
if (!val)
|
|
25
25
|
return;
|
|
26
26
|
if (!options.length)
|
|
27
|
-
|
|
28
|
-
if (val !== 'alternating' && !options.some(o => o.value === val))
|
|
29
|
-
|
|
27
|
+
await store.setField(finalPath, addAllOption ? 'alternating' : undefined);
|
|
28
|
+
else if (val !== 'alternating' && !options.some(o => o.value === val))
|
|
29
|
+
await store.setField(finalPath, notNull ? options[0].value : (addAllOption ? 'alternating' : undefined));
|
|
30
30
|
}
|
|
31
|
-
$: reactToOptions(options);
|
|
31
|
+
$: reactToOptions(options).catch(console.error);
|
|
32
32
|
onMount(reactToOptions);
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<FieldStandard bind:id descid={groupid} {path} {label} {required} {defaultValue} {conditional} {helptext} let:value let:valid let:invalid let:onBlur let:onChange let:messagesid let:helptextid let:setVal>
|
|
36
|
-
{@const _ = void updateValue(value, setVal)}
|
|
37
36
|
<div class="container-query-wrapper">
|
|
38
37
|
<div class="color-container {className}" role="radiogroup" aria-labelledby={groupid} class:invalid class:valid>
|
|
39
38
|
{#if addAllOption}
|
|
@@ -105,7 +105,7 @@ function onKeyDown(e) {
|
|
|
105
105
|
|
|
106
106
|
<FieldStandard bind:id {path} {descid} {label} {required} {defaultValue} {conditional} {helptext} let:value let:valid let:invalid let:id let:onBlur let:setVal let:messagesid let:helptextid>
|
|
107
107
|
<Icon icon={`${value.prefix === 'fab' ? 'fa6-brands' : 'fa6-solid'}:${value.icon?.slice(3) ?? 'graduation-cap'}`}/>
|
|
108
|
-
<button type="button" id
|
|
108
|
+
<button type="button" {id} class="select-icon" on:click={() => { modalOpen = true }} aria-describedby={getDescribedBy([descid, messagesid, helptextid])} on:blur={onBlur}>Select New Icon</button>
|
|
109
109
|
{#if modalOpen}
|
|
110
110
|
<Modal>
|
|
111
111
|
<section>
|
package/package.json
CHANGED