@dosgato/dialog 0.0.8 → 0.0.11
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/FieldAutocomplete.svelte +2 -2
- package/FieldDate.svelte +2 -2
- package/FieldDualListbox.svelte +5 -9
- package/FieldSelect.svelte +2 -2
- package/FieldText.svelte +2 -2
- package/FieldTextArea.svelte +24 -0
- package/FieldTextArea.svelte.d.ts +25 -0
- package/Form.svelte +20 -1
- package/chooser/ChooserAPI.d.ts +4 -4
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -1
package/FieldAutocomplete.svelte
CHANGED
|
@@ -50,8 +50,8 @@ async function checkifchanged(e) {
|
|
|
50
50
|
}
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
|
-
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:setVal let:valid let:invalid let:id let:onBlur let:onChange>
|
|
54
|
-
<input bind:this={inputelement} bind:value={inputvalue} {id} {placeholder} class="dialog-input {className}" class:valid class:invalid aria-invalid={invalid} {onBlur} {onChange} aria-owns={listId} autocapitalize="none" type="text" autocomplete="off" aria-autocomplete="list" role="combobox" aria-expanded="false" {disabled} aria-describedby={helptext.length ? helpTextId : ''} on:keydown={checkifchanged}>
|
|
53
|
+
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:setVal let:valid let:invalid let:id let:onBlur let:onChange let:messagesid>
|
|
54
|
+
<input bind:this={inputelement} bind:value={inputvalue} {id} {placeholder} class="dialog-input {className}" class:valid class:invalid aria-invalid={invalid} {onBlur} {onChange} aria-owns={listId} autocapitalize="none" type="text" autocomplete="off" aria-autocomplete="list" role="combobox" aria-expanded="false" {disabled} aria-describedby={`${messagesid ?? ''} ${helptext.length ? helpTextId : ''}`} on:keydown={checkifchanged}>
|
|
55
55
|
<PopupMenu align="bottomleft" items={filteredChoices} buttonelement={inputelement} bind:value={popupvalue} on:change={onchangepopup(setVal)} emptyText="No options available"/>
|
|
56
56
|
{#if helptext.length}
|
|
57
57
|
<span id={helpTextId} class="field-help-text">{helptext}</span>
|
package/FieldDate.svelte
CHANGED
|
@@ -14,6 +14,6 @@ export let conditional = undefined;
|
|
|
14
14
|
export let required = false;
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={dateSerialize} deserialize={dateDeserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange>
|
|
18
|
-
<Input type="date" name={path} {value} {id} class="dialog-input {className}" {onChange} {onBlur} {valid} {invalid} {min} {max} {step} />
|
|
17
|
+
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={dateSerialize} deserialize={dateDeserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange let:messagesid>
|
|
18
|
+
<Input type="date" name={path} {value} {id} class="dialog-input {className}" {onChange} {onBlur} {valid} {invalid} {min} {max} {step} {messagesid} />
|
|
19
19
|
</FieldStandard>
|
package/FieldDualListbox.svelte
CHANGED
|
@@ -15,8 +15,8 @@ export let choices;
|
|
|
15
15
|
export let defaultValue = [];
|
|
16
16
|
export let conditional = undefined;
|
|
17
17
|
export let required = false;
|
|
18
|
-
let itemsToAdd = []; //the items selected in the left listbox
|
|
19
|
-
let itemsToRemove = []; //the items selected in the right listbox
|
|
18
|
+
let itemsToAdd = []; // the items selected in the left listbox
|
|
19
|
+
let itemsToRemove = []; // the items selected in the right listbox
|
|
20
20
|
let instructions = 'test';
|
|
21
21
|
$: {
|
|
22
22
|
if (itemsToAdd.length === 1)
|
|
@@ -46,10 +46,6 @@ function addToAvailable(value, setVal) {
|
|
|
46
46
|
setVal(selected);
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
let valueToLabel = {};
|
|
50
|
-
for (const choice of choices) {
|
|
51
|
-
valueToLabel[choice.value] = choice.label || choice.value;
|
|
52
|
-
}
|
|
53
49
|
function valueToSelectedChoices(value) {
|
|
54
50
|
// keep the selected options ordered as they were in the available options
|
|
55
51
|
const valueSet = new Set(value);
|
|
@@ -88,7 +84,7 @@ function onkeydown(value, setVal) {
|
|
|
88
84
|
<ScreenReaderOnly>
|
|
89
85
|
<span aria-live="polite">{instructions}</span>
|
|
90
86
|
</ScreenReaderOnly>
|
|
91
|
-
<Listbox label={sourceLabel} multiselect={multiselect} items={getAvailable(value)} {descid} {valid} {invalid} on:change={e => itemsToAdd = e.detail} selected={itemsToAdd} on:blur={onBlur}/>
|
|
87
|
+
<Listbox label={sourceLabel} multiselect={multiselect} items={getAvailable(value)} {descid} {valid} {invalid} on:change={e => { itemsToAdd = e.detail }} selected={itemsToAdd} on:blur={onBlur}/>
|
|
92
88
|
<div class="toolbar">
|
|
93
89
|
<button type="button" class="toolbar-button" title="Move selection to {selectedLabel}" disabled={itemsToAdd.length === 0} on:click={addToSelected(value, setVal)}>
|
|
94
90
|
<Icon icon={menuRight} width='3em'/>
|
|
@@ -97,7 +93,7 @@ function onkeydown(value, setVal) {
|
|
|
97
93
|
<Icon icon={menuLeft} width='3em'/>
|
|
98
94
|
</button>
|
|
99
95
|
</div>
|
|
100
|
-
<Listbox label={selectedLabel} multiselect={multiselect} items={valueToSelectedChoices(value)} {descid} {valid} {invalid} on:change={e => itemsToRemove = e.detail} selected={itemsToRemove} on:blur={onBlur}/>
|
|
96
|
+
<Listbox label={selectedLabel} multiselect={multiselect} items={valueToSelectedChoices(value)} {descid} {valid} {invalid} on:change={e => { itemsToRemove = e.detail }} selected={itemsToRemove} on:blur={onBlur}/>
|
|
101
97
|
</div>
|
|
102
98
|
</FieldStandard>
|
|
103
99
|
|
|
@@ -115,4 +111,4 @@ function onkeydown(value, setVal) {
|
|
|
115
111
|
border: 0;
|
|
116
112
|
padding: 0;
|
|
117
113
|
}
|
|
118
|
-
</style>
|
|
114
|
+
</style>
|
package/FieldSelect.svelte
CHANGED
|
@@ -14,8 +14,8 @@ export let conditional = undefined;
|
|
|
14
14
|
export let required = false;
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange>
|
|
18
|
-
<select {id} name={path} {disabled} class="dialog-input dialog-select {className}" on:change={onChange} on:blur={onBlur} class:valid class:invalid>
|
|
17
|
+
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange let:messagesid>
|
|
18
|
+
<select {id} name={path} {disabled} class="dialog-input dialog-select {className}" on:change={onChange} on:blur={onBlur} class:valid class:invalid aria-describedby={messagesid}>
|
|
19
19
|
{#if !notNull}<option value="" selected={!value}>{placeholder}</option>{/if}
|
|
20
20
|
{#each choices as choice (choice.value)}
|
|
21
21
|
<option value={choice.value} disabled={choice.disabled} selected={value === choice.value}>{choice.label || choice.value}</option>
|
package/FieldText.svelte
CHANGED
|
@@ -15,6 +15,6 @@ export let conditional = undefined;
|
|
|
15
15
|
export let required = false;
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange>
|
|
19
|
-
<Input {type} name={path} {value} {id} class="dialog-input {className}" {allowlastpass} {onChange} {onBlur} {valid} {invalid} {maxlength}></Input>
|
|
18
|
+
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange let:messagesid>
|
|
19
|
+
<Input {type} name={path} {value} {id} class="dialog-input {className}" {allowlastpass} {onChange} {onBlur} {valid} {invalid} {maxlength} {messagesid}></Input>
|
|
20
20
|
</FieldStandard>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script>import { nullableSerialize, nullableDeserialize } from '@txstate-mws/svelte-forms';
|
|
2
|
+
import FieldStandard from './FieldStandard.svelte';
|
|
3
|
+
let className = '';
|
|
4
|
+
export { className as class };
|
|
5
|
+
export let id = undefined;
|
|
6
|
+
export let path;
|
|
7
|
+
export let label = '';
|
|
8
|
+
export let notNull = false;
|
|
9
|
+
export let defaultValue = notNull ? '' : undefined;
|
|
10
|
+
export let maxlength = undefined;
|
|
11
|
+
export let rows = undefined;
|
|
12
|
+
export let conditional = undefined;
|
|
13
|
+
export let required = false;
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<FieldStandard bind:id {label} {path} {required} {defaultValue} {conditional} serialize={!notNull && nullableSerialize} deserialize={!notNull && nullableDeserialize} let:value let:valid let:invalid let:id let:onBlur let:onChange let:messagesid>
|
|
17
|
+
<textarea name={path} {value} {id} {rows} class="dialog-input dialog-textarea {className}" class:valid class:invalid aria-invalid={invalid} aria-describedby={messagesid} on:change={onChange} on:blur={onBlur} on:keyup={onChange} {maxlength}></textarea>
|
|
18
|
+
</FieldStandard>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
textarea {
|
|
22
|
+
resize: vertical;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
class?: string;
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
path: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
notNull?: boolean;
|
|
9
|
+
defaultValue?: any;
|
|
10
|
+
maxlength?: number | undefined;
|
|
11
|
+
rows?: number | undefined;
|
|
12
|
+
conditional?: boolean | undefined;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
};
|
|
15
|
+
events: {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
};
|
|
18
|
+
slots: {};
|
|
19
|
+
};
|
|
20
|
+
export declare type FieldTextAreaProps = typeof __propDef.props;
|
|
21
|
+
export declare type FieldTextAreaEvents = typeof __propDef.events;
|
|
22
|
+
export declare type FieldTextAreaSlots = typeof __propDef.slots;
|
|
23
|
+
export default class FieldTextArea extends SvelteComponentTyped<FieldTextAreaProps, FieldTextAreaEvents, FieldTextAreaSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
package/Form.svelte
CHANGED
|
@@ -13,8 +13,23 @@ export let preload = undefined;
|
|
|
13
13
|
setContext(CHOOSER_API_CONTEXT, chooserClient);
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<Form bind:store class="{className} dialog-form" {submit} {validate} on:saved {autocomplete} {name} {preload} let:messages let:saved let:valid let:invalid let:validating let:submitting>
|
|
16
|
+
<Form bind:store class="{className} dialog-form" {submit} {validate} on:saved {autocomplete} {name} {preload} let:messages let:allMessages let:saved let:valid let:invalid let:validating let:submitting>
|
|
17
17
|
<slot {messages} {saved} {validating} {submitting} {valid} {invalid} />
|
|
18
|
+
<div class="form-errors" aria-live='assertive'>
|
|
19
|
+
{#if messages.length}
|
|
20
|
+
<ul>
|
|
21
|
+
{#each messages as message}
|
|
22
|
+
<li>{message.message}</li>
|
|
23
|
+
{/each}
|
|
24
|
+
{#if invalid}
|
|
25
|
+
<li>More errors. See inline messages for details.</li>
|
|
26
|
+
{/if}
|
|
27
|
+
</ul>
|
|
28
|
+
{:else if invalid}
|
|
29
|
+
This form contains validation errors. See inline messages for details.
|
|
30
|
+
{/if}
|
|
31
|
+
</div>
|
|
32
|
+
<slot name="submit" {saved} {validating} {submitting} {valid} {invalid} />
|
|
18
33
|
</Form>
|
|
19
34
|
|
|
20
35
|
<style>
|
|
@@ -24,4 +39,8 @@ setContext(CHOOSER_API_CONTEXT, chooserClient);
|
|
|
24
39
|
:global(.dialog-form) {
|
|
25
40
|
padding: 0;
|
|
26
41
|
}
|
|
42
|
+
.form-errors {
|
|
43
|
+
color: #9a3332;
|
|
44
|
+
padding: 1em;
|
|
45
|
+
}
|
|
27
46
|
</style>
|
package/chooser/ChooserAPI.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ export declare type ChooserType = 'asset' | 'page';
|
|
|
3
3
|
export declare type AnyItem = Asset | Folder | Page;
|
|
4
4
|
export interface Client<F = any> {
|
|
5
5
|
getSources: (type: ChooserType) => Promise<Source[]>;
|
|
6
|
-
getChildren: (source: string, path: string, filters: F) => Promise<
|
|
7
|
-
find: (source: string, path: string, searchstring: string, filters: F) => Promise<
|
|
8
|
-
findById: (id: string) => Promise<AnyItem>;
|
|
9
|
-
findByUrl?: (url: string) => Promise<AnyItem>;
|
|
6
|
+
getChildren: (source: string, path: string, filters: F) => Promise<AnyItem[]>;
|
|
7
|
+
find: (source: string, path: string, searchstring: string, filters: F) => Promise<AnyItem[]>;
|
|
8
|
+
findById: (id: string) => Promise<AnyItem | undefined>;
|
|
9
|
+
findByUrl?: (url: string) => Promise<AnyItem | undefined>;
|
|
10
10
|
urlToValue?: (url: string) => string;
|
|
11
11
|
upload: (source: string, path: string, files: FileList) => Promise<void>;
|
|
12
12
|
}
|
package/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { default as FieldRadio } from './FieldRadio.svelte';
|
|
|
14
14
|
export { default as FieldSelect } from './FieldSelect.svelte';
|
|
15
15
|
export { default as FieldStandard } from './FieldStandard.svelte';
|
|
16
16
|
export { default as FieldText } from './FieldText.svelte';
|
|
17
|
+
export { default as FieldTextArea } from './FieldTextArea.svelte';
|
|
17
18
|
export { default as Form } from './Form.svelte';
|
|
18
19
|
export { default as Icon } from './Icon.svelte';
|
|
19
20
|
export { default as InlineMessage } from './InlineMessage.svelte';
|
package/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { default as FieldRadio } from './FieldRadio.svelte';
|
|
|
14
14
|
export { default as FieldSelect } from './FieldSelect.svelte';
|
|
15
15
|
export { default as FieldStandard } from './FieldStandard.svelte';
|
|
16
16
|
export { default as FieldText } from './FieldText.svelte';
|
|
17
|
+
export { default as FieldTextArea } from './FieldTextArea.svelte';
|
|
17
18
|
export { default as Form } from './Form.svelte';
|
|
18
19
|
export { default as Icon } from './Icon.svelte';
|
|
19
20
|
export { default as InlineMessage } from './InlineMessage.svelte';
|
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.11",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@txstate-mws/svelte-components": "^1.2.9",
|
|
7
7
|
"@txstate-mws/svelte-forms": "^0.0.18",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"./FieldSelect.svelte": "./FieldSelect.svelte",
|
|
43
43
|
"./FieldStandard.svelte": "./FieldStandard.svelte",
|
|
44
44
|
"./FieldText.svelte": "./FieldText.svelte",
|
|
45
|
+
"./FieldTextArea.svelte": "./FieldTextArea.svelte",
|
|
45
46
|
"./FileIcon.svelte": "./FileIcon.svelte",
|
|
46
47
|
"./Form.svelte": "./Form.svelte",
|
|
47
48
|
"./Icon.svelte": "./Icon.svelte",
|