@dosgato/dialog 0.0.20 → 0.0.21
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/Button.svelte.d.ts +3 -3
- package/ButtonGroup.svelte.d.ts +3 -3
- package/Checkbox.svelte.d.ts +3 -3
- package/Container.svelte.d.ts +3 -3
- package/Dialog.svelte +22 -4
- package/Dialog.svelte.d.ts +5 -4
- package/FieldAutocomplete.svelte.d.ts +3 -3
- package/FieldCheckbox.svelte.d.ts +3 -3
- package/FieldChoices.svelte.d.ts +3 -3
- package/FieldChooserLink.svelte +14 -12
- package/FieldChooserLink.svelte.d.ts +3 -5
- package/FieldDate.svelte.d.ts +3 -3
- package/FieldDateTime.svelte.d.ts +3 -3
- package/FieldDualListbox.svelte.d.ts +3 -3
- package/FieldHidden.svelte.d.ts +3 -3
- package/FieldIdentifier.svelte.d.ts +3 -3
- package/FieldMultiple.svelte.d.ts +3 -3
- package/FieldMultiselect.svelte.d.ts +3 -3
- package/FieldNumber.svelte.d.ts +3 -3
- package/FieldRadio.svelte.d.ts +3 -3
- package/FieldSelect.svelte.d.ts +3 -3
- package/FieldStandard.svelte.d.ts +3 -3
- package/FieldText.svelte.d.ts +3 -3
- package/FieldTextArea.svelte.d.ts +3 -3
- package/FileIcon.svelte.d.ts +3 -3
- package/Form.svelte.d.ts +3 -3
- package/FormDialog.svelte.d.ts +3 -3
- package/Icon.svelte.d.ts +3 -3
- package/InlineMessage.svelte.d.ts +3 -3
- package/InlineMessages.svelte.d.ts +3 -3
- package/Input.svelte.d.ts +3 -3
- package/Listbox.svelte.d.ts +3 -3
- package/Radio.svelte.d.ts +3 -3
- package/Tab.svelte.d.ts +3 -3
- package/TabStore.d.ts +3 -0
- package/TabStore.js +12 -0
- package/Tabs.svelte +5 -4
- package/Tabs.svelte.d.ts +3 -3
- package/chooser/Chooser.svelte +76 -99
- package/chooser/Chooser.svelte.d.ts +5 -5
- package/chooser/ChooserAPI.d.ts +10 -3
- package/chooser/ChooserStore.d.ts +15 -33
- package/chooser/ChooserStore.js +32 -149
- package/chooser/Details.svelte.d.ts +6 -5
- package/chooser/Thumbnail.svelte +9 -2
- package/chooser/Thumbnail.svelte.d.ts +6 -5
- package/colorpicker/FieldColorPicker.svelte +78 -24
- package/colorpicker/FieldColorPicker.svelte.d.ts +5 -6
- package/iconpicker/FieldIconPicker.svelte +4 -2
- package/iconpicker/FieldIconPicker.svelte.d.ts +4 -3
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/package.json +9 -6
- package/tree/LoadIcon.svelte +24 -0
- package/tree/LoadIcon.svelte.d.ts +23 -0
- package/tree/Tree.svelte +203 -0
- package/tree/Tree.svelte.d.ts +28 -0
- package/tree/TreeCell.svelte +18 -0
- package/tree/TreeCell.svelte.d.ts +18 -0
- package/tree/TreeNode.svelte +418 -0
- package/tree/TreeNode.svelte.d.ts +30 -0
- package/tree/index.d.ts +3 -0
- package/tree/index.js +3 -0
- package/tree/treestore.d.ts +117 -0
- package/tree/treestore.js +336 -0
- package/chooser/Asset.svelte +0 -83
- package/chooser/Asset.svelte.d.ts +0 -25
- package/chooser/AssetFolder.svelte +0 -127
- package/chooser/AssetFolder.svelte.d.ts +0 -25
- package/chooser/Page.svelte +0 -121
- package/chooser/Page.svelte.d.ts +0 -25
package/chooser/ChooserStore.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Store, derivedStore } from '@txstate-mws/svelte-store';
|
|
2
|
+
import { tick } from 'svelte';
|
|
3
|
+
import { findIndex } from 'txstate-utils';
|
|
3
4
|
export const CHOOSER_STORE_CONTEXT = {};
|
|
4
5
|
const nofilter = (x) => true;
|
|
5
6
|
export function combinePath(path, name) {
|
|
@@ -12,28 +13,28 @@ export function bytesToHuman(bytes) {
|
|
|
12
13
|
const scale = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
13
14
|
return String(parseFloat((bytes / Math.pow(1024, scale)).toPrecision(3))) + scales[scale];
|
|
14
15
|
}
|
|
15
|
-
export class ChooserStore extends
|
|
16
|
+
export class ChooserStore extends Store {
|
|
16
17
|
client;
|
|
17
18
|
options;
|
|
18
19
|
constructor(client) {
|
|
19
|
-
super({ activetype: 'page', activesource: 0 });
|
|
20
|
+
super({ activetype: 'page', activesource: 0, initialized: false });
|
|
20
21
|
this.client = client;
|
|
21
22
|
this.setOptions({});
|
|
22
23
|
}
|
|
23
24
|
setOptions(options) {
|
|
24
|
-
const activeTypes = options.activeTypes?.length ? options.activeTypes : ['asset', 'page'];
|
|
25
25
|
const userFilter = options.filter ?? nofilter;
|
|
26
|
-
const filter = options.
|
|
26
|
+
const filter = options.images
|
|
27
27
|
? (itm) => ((itm.type === 'asset' && !!itm.image) || itm.type === 'folder') && userFilter(itm)
|
|
28
28
|
: userFilter;
|
|
29
29
|
this.options = {
|
|
30
30
|
...options,
|
|
31
|
-
activeTypes,
|
|
32
31
|
activeSources: options.activeSources ? new Set(options.activeSources) : undefined,
|
|
33
|
-
initialType: options.initialType ?? activeTypes[0],
|
|
34
32
|
filter
|
|
35
33
|
};
|
|
36
34
|
}
|
|
35
|
+
sources = derivedStore(this, v => [...(v.sources?.page ?? []), ...(v.sources?.asset ?? [])].filter(s => this.options.activeSources ? this.options.activeSources.has(s.name) : true));
|
|
36
|
+
source = derivedStore(this, v => this.getSource(v));
|
|
37
|
+
preview = derivedStore(this, 'preview');
|
|
37
38
|
getSource(state = this.value) {
|
|
38
39
|
return state.sources?.[state.activetype]?.[state.activesource];
|
|
39
40
|
}
|
|
@@ -44,158 +45,40 @@ export class ChooserStore extends SafeStore {
|
|
|
44
45
|
}
|
|
45
46
|
async init(options) {
|
|
46
47
|
this.setOptions(options);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.options.activeTypes.includes('page') ? this.client.getSources('page') : [],
|
|
52
|
-
this.options.activeTypes.includes('asset') ? this.client.getSources('asset') : []
|
|
53
|
-
]);
|
|
54
|
-
this.update(v => {
|
|
55
|
-
v.sources = { page: pageSources.filter(s => !this.options.activeSources || this.options.activeSources.has(s)) ?? [], asset: assetSources.filter(s => !this.options.activeSources || this.options.activeSources.has(s)) ?? [] };
|
|
56
|
-
v.activesource = this.getSourceIndex(this.options.initialSource, v);
|
|
57
|
-
return v;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (this.value.preview)
|
|
61
|
-
await this.openPathRecursive(this.value.preview.path);
|
|
62
|
-
else if (this.options.initialPath)
|
|
63
|
-
await this.openPathRecursive(this.options.initialPath);
|
|
64
|
-
else
|
|
65
|
-
await this.openPathRecursive('/');
|
|
66
|
-
this.update(v => ({ ...v, loading: false }));
|
|
67
|
-
}
|
|
68
|
-
itemByPath(state, path) {
|
|
69
|
-
const parts = path.substring(1).split('/');
|
|
70
|
-
const source = this.getSource(state);
|
|
71
|
-
let item = source.children?.find(c => c.name === parts[0]);
|
|
72
|
-
for (const part of parts.slice(1).filter(isNotBlank)) {
|
|
73
|
-
if (item.type === 'asset')
|
|
74
|
-
return undefined;
|
|
75
|
-
item = item?.children?.find(c => c.name === part);
|
|
76
|
-
}
|
|
77
|
-
return item;
|
|
78
|
-
}
|
|
79
|
-
async open(folder) {
|
|
80
|
-
return await this.openPath(folder.path);
|
|
81
|
-
}
|
|
82
|
-
async openPath(path) {
|
|
83
|
-
const folder = this.itemByPath(this.value, path);
|
|
84
|
-
if (!folder || folder.type === 'asset' || folder.open)
|
|
85
|
-
return;
|
|
86
|
-
this.update(v => {
|
|
87
|
-
const folder = this.itemByPath(v, path);
|
|
88
|
-
folder.loading = true;
|
|
89
|
-
v.focus = folder.id;
|
|
90
|
-
return v;
|
|
91
|
-
});
|
|
92
|
-
try {
|
|
93
|
-
const children = await filterAsync(await this.client.getChildren(this.getSource().name, path, this.options.passthruFilters), this.options.filter);
|
|
94
|
-
this.update(v => {
|
|
95
|
-
const folder = this.itemByPath(v, path);
|
|
96
|
-
folder.open = true;
|
|
97
|
-
folder.loading = false;
|
|
98
|
-
folder.children = children;
|
|
99
|
-
return v;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
console.error(e);
|
|
104
|
-
this.update(v => {
|
|
105
|
-
const folder = this.itemByPath(v, path);
|
|
106
|
-
folder.loading = false;
|
|
107
|
-
return v;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
async openPathRecursive(path) {
|
|
112
|
-
const parts = path.substring(1).split('/');
|
|
113
|
-
const source = this.getSource(this.clone(this.value));
|
|
114
|
-
if (!source.children)
|
|
115
|
-
source.children = await filterAsync(await this.client.getChildren(source.name, '/', this.options.passthruFilters), this.options.filter);
|
|
116
|
-
let current = source.children.find(c => c.name === parts[0]) ?? source.children[0];
|
|
117
|
-
for (const part of parts.slice(1).filter(isNotBlank)) {
|
|
118
|
-
if (!current || current.type === 'asset')
|
|
119
|
-
break;
|
|
120
|
-
if (!current.open) {
|
|
121
|
-
current.children = await filterAsync(await this.client.getChildren(source.name, current.path, this.options.passthruFilters), this.options.filter);
|
|
122
|
-
current.loading = false;
|
|
123
|
-
current.open = true;
|
|
124
|
-
}
|
|
125
|
-
current = current.children.find(c => c.name === part);
|
|
126
|
-
}
|
|
48
|
+
const [pageSources, assetSources] = await Promise.all([
|
|
49
|
+
this.options.pages ? this.client.getSources('page') : [],
|
|
50
|
+
this.options.assets ? this.client.getSources('asset') : []
|
|
51
|
+
]);
|
|
127
52
|
this.update(v => {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
return v;
|
|
131
|
-
v.sources[v.activetype][v.activesource] = source;
|
|
132
|
-
if (!current)
|
|
133
|
-
return v;
|
|
134
|
-
v.focus = current.id;
|
|
135
|
-
v.focusPath = current.path;
|
|
136
|
-
return v;
|
|
53
|
+
const sources = { page: pageSources.filter(s => !this.options.activeSources || this.options.activeSources.has(s)) ?? [], asset: assetSources.filter(s => !this.options.activeSources || this.options.activeSources.has(s)) ?? [] };
|
|
54
|
+
return { ...v, sources };
|
|
137
55
|
});
|
|
56
|
+
this.setSource(this.value.preview?.source ?? this.options.initialSource, true);
|
|
57
|
+
console.log('before initialized', this.value);
|
|
58
|
+
await tick();
|
|
59
|
+
console.log('just before initialized');
|
|
60
|
+
this.update(v => ({ ...v, initialized: true }));
|
|
138
61
|
}
|
|
139
|
-
|
|
140
|
-
return await this.closePath(folder.path);
|
|
141
|
-
}
|
|
142
|
-
async closePath(path) {
|
|
143
|
-
this.update(v => {
|
|
144
|
-
const folder = this.itemByPath(v, path);
|
|
145
|
-
if (folder && folder.type !== 'asset')
|
|
146
|
-
folder.open = false;
|
|
147
|
-
return v;
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
async toggle(folder) {
|
|
151
|
-
if (folder.open)
|
|
152
|
-
await this.close(folder);
|
|
153
|
-
else
|
|
154
|
-
await this.open(folder);
|
|
155
|
-
}
|
|
156
|
-
preview(item) {
|
|
62
|
+
setPreview(item) {
|
|
157
63
|
if (!item)
|
|
158
64
|
return this.clearPreview();
|
|
159
|
-
if (item.type === 'folder' && !this.options.
|
|
65
|
+
if (item.type === 'folder' && !this.options.folders)
|
|
160
66
|
return;
|
|
161
|
-
this.update(v => ({ ...v, preview: item
|
|
67
|
+
this.update(v => ({ ...v, preview: item }));
|
|
162
68
|
}
|
|
163
69
|
clearPreview() {
|
|
164
70
|
this.update(v => ({ ...v, preview: undefined }));
|
|
165
71
|
}
|
|
166
|
-
|
|
167
|
-
if (idx >= this.value.sources[this.value.activetype].length || idx < 0)
|
|
168
|
-
return;
|
|
169
|
-
this.update(v => {
|
|
170
|
-
v.activesource = idx;
|
|
171
|
-
const source = this.getSource(v);
|
|
172
|
-
if (source.children?.length) {
|
|
173
|
-
const firstchild = source.children[0];
|
|
174
|
-
v.focus = firstchild.id;
|
|
175
|
-
v.focusPath = firstchild.path;
|
|
176
|
-
}
|
|
177
|
-
return v;
|
|
178
|
-
});
|
|
179
|
-
const source = this.getSource();
|
|
180
|
-
const children = await filterAsync(await this.client.getChildren(source.name, '/', this.options.passthruFilters), this.options.filter);
|
|
72
|
+
setSource(name, init) {
|
|
181
73
|
this.update(v => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
v.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.update(v => ({ ...v, activetype: type }));
|
|
191
|
-
await this.changeSource(0);
|
|
192
|
-
}
|
|
193
|
-
setFocus(itm) {
|
|
194
|
-
if (!itm)
|
|
195
|
-
return;
|
|
196
|
-
this.update(v => {
|
|
197
|
-
v.focus = itm.id;
|
|
198
|
-
v.focusPath = itm.path;
|
|
74
|
+
if (!v.initialized && !init)
|
|
75
|
+
return v;
|
|
76
|
+
const pageSource = v.sources?.page.findIndex(s => s.name === name);
|
|
77
|
+
const assetSource = v.sources?.asset.findIndex(s => s.name === name);
|
|
78
|
+
if (pageSource >= 0)
|
|
79
|
+
return { ...v, activetype: 'page', activesource: pageSource };
|
|
80
|
+
else if (assetSource >= 0)
|
|
81
|
+
return { ...v, activetype: 'asset', activesource: assetSource };
|
|
199
82
|
return v;
|
|
200
83
|
});
|
|
201
84
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import
|
|
2
|
+
import type { AnyItem } from './ChooserAPI';
|
|
3
|
+
import { type RawURL } from './ChooserStore';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
|
-
item:
|
|
6
|
+
item: AnyItem | RawURL;
|
|
6
7
|
};
|
|
7
8
|
events: {
|
|
8
9
|
[evt: string]: CustomEvent<any>;
|
|
@@ -11,9 +12,9 @@ declare const __propDef: {
|
|
|
11
12
|
default: {};
|
|
12
13
|
};
|
|
13
14
|
};
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
15
|
+
export type DetailsProps = typeof __propDef.props;
|
|
16
|
+
export type DetailsEvents = typeof __propDef.events;
|
|
17
|
+
export type DetailsSlots = typeof __propDef.slots;
|
|
17
18
|
export default class Details extends SvelteComponentTyped<DetailsProps, DetailsEvents, DetailsSlots> {
|
|
18
19
|
}
|
|
19
20
|
export {};
|
package/chooser/Thumbnail.svelte
CHANGED
|
@@ -25,12 +25,19 @@ export let item;
|
|
|
25
25
|
width: 100%;
|
|
26
26
|
padding-top: 75%;
|
|
27
27
|
}
|
|
28
|
-
img {
|
|
28
|
+
.dialog-chooser-thumbnail img {
|
|
29
29
|
width: 100%;
|
|
30
30
|
height: 100%;
|
|
31
31
|
object-fit: scale-down;
|
|
32
32
|
}
|
|
33
|
-
.dialog-chooser-thumbnail
|
|
33
|
+
.dialog-chooser-thumbnail :global(svg) {
|
|
34
|
+
width: 60%;
|
|
35
|
+
height: 60%;
|
|
36
|
+
min-width: 4.5em;
|
|
37
|
+
min-height: 4.5em;
|
|
38
|
+
object-fit: scale-down;
|
|
39
|
+
}
|
|
40
|
+
.dialog-chooser-thumbnail > :global(*) {
|
|
34
41
|
display: block;
|
|
35
42
|
position: absolute;
|
|
36
43
|
top: 50%;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnyItem } from './ChooserAPI';
|
|
3
|
+
import type { RawURL } from './ChooserStore';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
|
-
item:
|
|
6
|
+
item: AnyItem | RawURL;
|
|
6
7
|
};
|
|
7
8
|
events: {
|
|
8
9
|
[evt: string]: CustomEvent<any>;
|
|
9
10
|
};
|
|
10
11
|
slots: {};
|
|
11
12
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type ThumbnailProps = typeof __propDef.props;
|
|
14
|
+
export type ThumbnailEvents = typeof __propDef.events;
|
|
15
|
+
export type ThumbnailSlots = typeof __propDef.slots;
|
|
15
16
|
export default class Thumbnail extends SvelteComponentTyped<ThumbnailProps, ThumbnailEvents, ThumbnailSlots> {
|
|
16
17
|
}
|
|
17
18
|
export {};
|
|
@@ -1,43 +1,97 @@
|
|
|
1
1
|
<script>import FieldStandard from '../FieldStandard.svelte';
|
|
2
|
-
import {
|
|
2
|
+
import { getDescribedBy, Radio } from '..';
|
|
3
|
+
import { randomid } from 'txstate-utils';
|
|
3
4
|
export let id = undefined;
|
|
4
5
|
let className = '';
|
|
5
6
|
export { className as class };
|
|
6
7
|
export let path;
|
|
7
8
|
export let options;
|
|
9
|
+
export let addAllOption = false;
|
|
8
10
|
export let label = '';
|
|
9
11
|
export let required = false;
|
|
10
|
-
export let disabled = false;
|
|
11
12
|
export let notNull = false;
|
|
12
|
-
export let defaultValue = notNull ? options[0].value : undefined;
|
|
13
|
+
export let defaultValue = notNull ? (addAllOption ? 'alternating' : options[0].value) : undefined;
|
|
13
14
|
export let conditional = undefined;
|
|
14
|
-
export let
|
|
15
|
-
|
|
16
|
-
const colorsByValue = keyby(options, 'value');
|
|
15
|
+
export let helptext = undefined;
|
|
16
|
+
const groupid = randomid();
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
|
-
<FieldStandard bind:id {path} {label} {required} {defaultValue} {conditional}
|
|
20
|
-
<div class="
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
<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>
|
|
20
|
+
<div class="color-container {className}" role="radiogroup" aria-labelledby={groupid} class:invalid class:valid>
|
|
21
|
+
{#if addAllOption}
|
|
22
|
+
<label for={`${path}.alt`} class="colorsel alternating">
|
|
23
|
+
<Radio id={`${path}.alt`} name={path} value="alternating" selected={value === 'alternating'} {onChange} {onBlur} {helptextid}/>
|
|
24
|
+
<span class="alternating-bg">
|
|
25
|
+
{#each options as option}
|
|
26
|
+
<span style={`background-color: ${option.color}`}></span>
|
|
27
|
+
{/each}
|
|
28
|
+
</span>
|
|
29
|
+
<span class="alternating-text">Alternating</span>
|
|
30
|
+
</label>
|
|
31
|
+
{/if}
|
|
32
|
+
{#each options as option, idx (option.value) }
|
|
33
|
+
{@const radioid = `${path}.${idx}`}
|
|
34
|
+
<label for={radioid} class="colorsel">
|
|
35
|
+
<Radio id={radioid} name={path} value={option.value} selected={value === option.value} {onChange} {onBlur} {helptextid}/>
|
|
36
|
+
<span style={`background-color: ${option.color}`}>{option.name || option.value}</span>
|
|
37
|
+
</label>
|
|
38
|
+
{/each}
|
|
28
39
|
</div>
|
|
29
40
|
</FieldStandard>
|
|
30
41
|
|
|
31
42
|
<style>
|
|
32
|
-
.
|
|
43
|
+
.color-container {
|
|
44
|
+
display: grid;
|
|
45
|
+
grid-gap: 10px;
|
|
46
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
label.colorsel :global(input[type="radio"]) {
|
|
50
|
+
border: 0;
|
|
51
|
+
clip: rect(0 0 0 0);
|
|
52
|
+
height: 1px;
|
|
53
|
+
margin: -1px;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
padding: 0;
|
|
56
|
+
position: absolute;
|
|
57
|
+
width: 1px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
label.colorsel :global(input[type="radio"] + span) {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
font-weight: bold;
|
|
63
|
+
padding: 1rem;
|
|
64
|
+
width: 100%;
|
|
65
|
+
text-align: center;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
border: 1px solid #D1D1D1;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
label.colorsel :global(input[type="radio"]:checked + span) {
|
|
71
|
+
outline: 5px solid #93BBC4;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
label.colorsel.alternating {
|
|
75
|
+
position: relative;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
label.colorsel.alternating span.alternating-bg {
|
|
33
79
|
display: flex;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
80
|
+
padding: 0;
|
|
81
|
+
height: 100%;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
label.colorsel.alternating span.alternating-bg span {
|
|
85
|
+
width: 100%;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
label.colorsel.alternating span.alternating-text {
|
|
89
|
+
position: absolute;
|
|
90
|
+
left: 50%;
|
|
91
|
+
top: 50%;
|
|
92
|
+
transform: translate(-50%, -50%);
|
|
93
|
+
font-weight: bold;
|
|
94
|
+
color: white;
|
|
95
|
+
text-shadow: 1px 1px 0 #222, 1px -1px 0 #222, -1px 1px 0 #222, -1px -1px 0 #222;
|
|
42
96
|
}
|
|
43
97
|
</style>
|
|
@@ -6,23 +6,22 @@ declare const __propDef: {
|
|
|
6
6
|
class?: string;
|
|
7
7
|
path: string;
|
|
8
8
|
options: ColorPickerOption[];
|
|
9
|
+
addAllOption?: boolean;
|
|
9
10
|
label?: string;
|
|
10
11
|
required?: boolean;
|
|
11
|
-
disabled?: boolean;
|
|
12
12
|
notNull?: boolean;
|
|
13
13
|
defaultValue?: any;
|
|
14
14
|
conditional?: boolean | undefined;
|
|
15
|
-
|
|
16
|
-
inputelement?: HTMLSelectElement;
|
|
15
|
+
helptext?: string | undefined;
|
|
17
16
|
};
|
|
18
17
|
events: {
|
|
19
18
|
[evt: string]: CustomEvent<any>;
|
|
20
19
|
};
|
|
21
20
|
slots: {};
|
|
22
21
|
};
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
22
|
+
export type FieldColorPickerProps = typeof __propDef.props;
|
|
23
|
+
export type FieldColorPickerEvents = typeof __propDef.events;
|
|
24
|
+
export type FieldColorPickerSlots = typeof __propDef.slots;
|
|
26
25
|
export default class FieldColorPicker extends SvelteComponentTyped<FieldColorPickerProps, FieldColorPickerEvents, FieldColorPickerSlots> {
|
|
27
26
|
}
|
|
28
27
|
export {};
|
|
@@ -3,12 +3,14 @@ import { ScreenReaderOnly, Modal, modifierKey } from '@txstate-mws/svelte-compon
|
|
|
3
3
|
import { FontAwesomeIcons, IconCategories } from './iconpicker';
|
|
4
4
|
import Icon from '@iconify/svelte';
|
|
5
5
|
import { randomid, keyby } from 'txstate-utils';
|
|
6
|
+
import { getDescribedBy } from '../helpers';
|
|
6
7
|
export let id = undefined;
|
|
7
8
|
export let path;
|
|
8
9
|
export let label = '';
|
|
9
10
|
export let required = false;
|
|
10
11
|
export let defaultValue = { icon: 'fa-graduation-cap', prefix: 'fas' };
|
|
11
12
|
export let conditional = undefined;
|
|
13
|
+
export let helptext = undefined;
|
|
12
14
|
const labelid = randomid();
|
|
13
15
|
const descid = randomid();
|
|
14
16
|
let modalOpen = false;
|
|
@@ -101,9 +103,9 @@ function onKeyDown(e) {
|
|
|
101
103
|
}
|
|
102
104
|
</script>
|
|
103
105
|
|
|
104
|
-
<FieldStandard bind:id {path} {label} {required} {defaultValue} {conditional} let:value let:valid let:invalid let:id let:onBlur let:setVal>
|
|
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>
|
|
105
107
|
<Icon icon={`${value.prefix === 'fab' ? 'fa-brands' : 'fa-solid'}:${value.icon.slice(3)}`}/>
|
|
106
|
-
<button id="btnSelectIcon" on:click={() => { modalOpen = true }}>Select New Icon</button>
|
|
108
|
+
<button id="btnSelectIcon" on:click={() => { modalOpen = true }} aria-describedby={getDescribedBy([descid, messagesid, helptextid])}>Select New Icon</button>
|
|
107
109
|
{#if modalOpen}
|
|
108
110
|
<Modal>
|
|
109
111
|
<section>
|
|
@@ -10,15 +10,16 @@ declare const __propDef: {
|
|
|
10
10
|
prefix: string;
|
|
11
11
|
};
|
|
12
12
|
conditional?: boolean | undefined;
|
|
13
|
+
helptext?: string | undefined;
|
|
13
14
|
};
|
|
14
15
|
events: {
|
|
15
16
|
[evt: string]: CustomEvent<any>;
|
|
16
17
|
};
|
|
17
18
|
slots: {};
|
|
18
19
|
};
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
20
|
+
export type FieldIconPickerProps = typeof __propDef.props;
|
|
21
|
+
export type FieldIconPickerEvents = typeof __propDef.events;
|
|
22
|
+
export type FieldIconPickerSlots = typeof __propDef.slots;
|
|
22
23
|
export default class FieldIconPicker extends SvelteComponentTyped<FieldIconPickerProps, FieldIconPickerEvents, FieldIconPickerSlots> {
|
|
23
24
|
}
|
|
24
25
|
export {};
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Button } from './Button.svelte';
|
|
2
|
+
export { default as ButtonGroup } from './ButtonGroup.svelte';
|
|
2
3
|
export { default as Checkbox } from './Checkbox.svelte';
|
|
3
4
|
export { default as Container } from './Container.svelte';
|
|
4
5
|
export { default as Dialog } from './Dialog.svelte';
|
|
@@ -10,6 +11,7 @@ export { default as FieldDate } from './FieldDate.svelte';
|
|
|
10
11
|
export { default as FieldDateTime } from './FieldDateTime.svelte';
|
|
11
12
|
export { default as FieldDualListbox } from './FieldDualListbox.svelte';
|
|
12
13
|
export { default as FieldHidden } from './FieldHidden.svelte';
|
|
14
|
+
export { default as FieldIdentifier } from './FieldIdentifier.svelte';
|
|
13
15
|
export { default as FieldMultiple } from './FieldMultiple.svelte';
|
|
14
16
|
export { default as FieldMultiselect } from './FieldMultiselect.svelte';
|
|
15
17
|
export { default as FieldNumber } from './FieldNumber.svelte';
|
|
@@ -35,3 +37,4 @@ export * from './TabStore.js';
|
|
|
35
37
|
export * from './iconpicker/index.js';
|
|
36
38
|
export * from './colorpicker/index.js';
|
|
37
39
|
export * from './helpers.js';
|
|
40
|
+
export * from './tree/index.js';
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Button } from './Button.svelte';
|
|
2
|
+
export { default as ButtonGroup } from './ButtonGroup.svelte';
|
|
2
3
|
export { default as Checkbox } from './Checkbox.svelte';
|
|
3
4
|
export { default as Container } from './Container.svelte';
|
|
4
5
|
export { default as Dialog } from './Dialog.svelte';
|
|
@@ -10,6 +11,7 @@ export { default as FieldDate } from './FieldDate.svelte';
|
|
|
10
11
|
export { default as FieldDateTime } from './FieldDateTime.svelte';
|
|
11
12
|
export { default as FieldDualListbox } from './FieldDualListbox.svelte';
|
|
12
13
|
export { default as FieldHidden } from './FieldHidden.svelte';
|
|
14
|
+
export { default as FieldIdentifier } from './FieldIdentifier.svelte';
|
|
13
15
|
export { default as FieldMultiple } from './FieldMultiple.svelte';
|
|
14
16
|
export { default as FieldMultiselect } from './FieldMultiselect.svelte';
|
|
15
17
|
export { default as FieldNumber } from './FieldNumber.svelte';
|
|
@@ -35,3 +37,4 @@ export * from './TabStore.js';
|
|
|
35
37
|
export * from './iconpicker/index.js';
|
|
36
38
|
export * from './colorpicker/index.js';
|
|
37
39
|
export * from './helpers.js';
|
|
40
|
+
export * from './tree/index.js';
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.21",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@txstate-mws/svelte-components": "^1.3.
|
|
6
|
+
"@txstate-mws/svelte-components": "^1.3.5",
|
|
7
7
|
"@txstate-mws/svelte-forms": "^1.1.2",
|
|
8
8
|
"@iconify/svelte": "^3.0.0",
|
|
9
9
|
"@iconify-icons/mdi": "^1.2.22",
|
|
@@ -60,13 +60,10 @@
|
|
|
60
60
|
"./Tab.svelte": "./Tab.svelte",
|
|
61
61
|
"./TabStore": "./TabStore.js",
|
|
62
62
|
"./Tabs.svelte": "./Tabs.svelte",
|
|
63
|
-
"./chooser/Asset.svelte": "./chooser/Asset.svelte",
|
|
64
|
-
"./chooser/AssetFolder.svelte": "./chooser/AssetFolder.svelte",
|
|
65
63
|
"./chooser/Chooser.svelte": "./chooser/Chooser.svelte",
|
|
66
64
|
"./chooser/ChooserAPI": "./chooser/ChooserAPI.js",
|
|
67
65
|
"./chooser/ChooserStore": "./chooser/ChooserStore.js",
|
|
68
66
|
"./chooser/Details.svelte": "./chooser/Details.svelte",
|
|
69
|
-
"./chooser/Page.svelte": "./chooser/Page.svelte",
|
|
70
67
|
"./chooser/Thumbnail.svelte": "./chooser/Thumbnail.svelte",
|
|
71
68
|
"./chooser": "./chooser/index.js",
|
|
72
69
|
"./colorpicker/FieldColorPicker.svelte": "./colorpicker/FieldColorPicker.svelte",
|
|
@@ -77,7 +74,13 @@
|
|
|
77
74
|
"./iconpicker/FieldIconPicker.svelte": "./iconpicker/FieldIconPicker.svelte",
|
|
78
75
|
"./iconpicker/iconpicker": "./iconpicker/iconpicker.js",
|
|
79
76
|
"./iconpicker": "./iconpicker/index.js",
|
|
80
|
-
".": "./index.js"
|
|
77
|
+
".": "./index.js",
|
|
78
|
+
"./tree/LoadIcon.svelte": "./tree/LoadIcon.svelte",
|
|
79
|
+
"./tree/Tree.svelte": "./tree/Tree.svelte",
|
|
80
|
+
"./tree/TreeCell.svelte": "./tree/TreeCell.svelte",
|
|
81
|
+
"./tree/TreeNode.svelte": "./tree/TreeNode.svelte",
|
|
82
|
+
"./tree": "./tree/index.js",
|
|
83
|
+
"./tree/treestore": "./tree/treestore.js"
|
|
81
84
|
},
|
|
82
85
|
"svelte": "./index.js"
|
|
83
86
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export let size = '1em'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<i aria-hidden="true" style:width={size} style:padding-top={size}></i>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
i {
|
|
9
|
+
display: inline-block;
|
|
10
|
+
box-sizing: content-box;
|
|
11
|
+
border-color: var(--loadicon-bg-color, #FFFFFF);
|
|
12
|
+
border-top-color: var(--loadicon-moving-color, #333333);
|
|
13
|
+
border-style: solid;
|
|
14
|
+
border-radius: 50%;
|
|
15
|
+
animation: spin 2s linear infinite;
|
|
16
|
+
margin-left: 0.3em;
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@keyframes spin {
|
|
21
|
+
0% { transform: rotate(0deg); }
|
|
22
|
+
100% { transform: rotate(360deg); }
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} LoadIconProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} LoadIconEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} LoadIconSlots */
|
|
4
|
+
export default class LoadIcon extends SvelteComponentTyped<{
|
|
5
|
+
size?: string;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type LoadIconProps = typeof __propDef.props;
|
|
11
|
+
export type LoadIconEvents = typeof __propDef.events;
|
|
12
|
+
export type LoadIconSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
size?: string;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|