@dosgato/dialog 0.0.58 → 0.0.60

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.
@@ -70,7 +70,6 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
70
70
  section {
71
71
  position: relative;
72
72
  background-color: #f4f4f4;
73
- padding: 1em;
74
73
  overflow: hidden;
75
74
  }
76
75
  section.tiny {
@@ -102,7 +101,6 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
102
101
  display: flex;
103
102
  align-items: center;
104
103
  font-size: 1.1em;
105
- margin: -1em;
106
104
  margin-bottom: 0;
107
105
  padding: 0.5em calc(var(--tabs-padding-hori, 1em) + 0.9em - 3px);
108
106
  background-color: var(--dg-dialog-header-bg, #DDDDDD);
@@ -115,7 +113,6 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
115
113
 
116
114
  .dialog-content {
117
115
  position: relative;
118
- margin: 0 -1em;
119
116
  padding: 1em;
120
117
  min-height: 5em;
121
118
  overflow: auto;
@@ -129,7 +126,6 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
129
126
  justify-content: flex-end;
130
127
  flex-wrap: wrap;
131
128
  background-color: var(--dg-dialog-footer-bg, #DDDDDD);
132
- margin: -1em;
133
129
  margin-top: 0;
134
130
  padding: 0.5em 1em;
135
131
  }
@@ -7,7 +7,7 @@ $: headerComponent = header.component;
7
7
  </script>
8
8
 
9
9
  {#if header.icon}
10
- <span class="icon"><Icon {icon} inline width="1.5em" /></span>
10
+ <span class="icon"><Icon {icon} inline width="1.3em" /></span>
11
11
  {/if}
12
12
  {#if header.component}
13
13
  <svelte:component this={headerComponent} {item} {header} />
@@ -89,6 +89,9 @@ export declare class TreeStore<T extends TreeItemFromDB> extends ActiveStore<ITr
89
89
  notify?: boolean | undefined;
90
90
  toggle?: boolean | undefined;
91
91
  }): void;
92
+ setSelected(items: TypedTreeItem<T>[], { notify }: {
93
+ notify?: boolean | undefined;
94
+ }): void;
92
95
  selectById(id: string, { clear, notify, toggle }: {
93
96
  clear?: boolean | undefined;
94
97
  notify?: boolean | undefined;
@@ -11,15 +11,25 @@ export class TreeStore extends ActiveStore {
11
11
  if (!this.searchableFn || !rootItems?.length || isBlank(filter))
12
12
  return this.value.rootItems;
13
13
  const ret = [];
14
+ const newselected = [];
15
+ let foundfocus = false;
14
16
  for (const itm of this.value.rootItems ?? []) {
15
17
  let found = false;
16
18
  for (const val of this.searchableFn(itm)) {
17
19
  if (val.toLocaleLowerCase().startsWith(filter))
18
20
  found = true;
19
21
  }
20
- if (found)
22
+ if (found) {
23
+ if (this.value.selected.has(itm.id))
24
+ newselected.push(itm);
25
+ if (this.value.focused?.id === itm.id)
26
+ foundfocus = true;
21
27
  ret.push(itm);
28
+ }
22
29
  }
30
+ if (!foundfocus)
31
+ this.focus(ret[0]);
32
+ this.setSelected(newselected, {});
23
33
  return ret;
24
34
  });
25
35
  draggable = derivedStore(this, v => v.draggable && !v.loading);
@@ -167,6 +177,13 @@ export class TreeStore extends ActiveStore {
167
177
  if (notify)
168
178
  this.trigger();
169
179
  }
180
+ setSelected(items, { notify = true }) {
181
+ this.value.selected.clear();
182
+ for (const itm of items)
183
+ this.value.selected.set(itm.id, itm);
184
+ if (notify)
185
+ this.trigger();
186
+ }
170
187
  selectById(id, { clear = false, notify = true, toggle = false }) {
171
188
  const item = this.value.itemsById[id];
172
189
  if (item)
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.58",
4
+ "version": "0.0.60",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",
7
7
  "dev": "vite dev --force",