@humandialog/forms.svelte 1.7.12 → 1.7.14

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.
@@ -167,7 +167,7 @@ function on_click(e, operation) {
167
167
  if (false)
168
168
  showMenu(rect, operation.grid);
169
169
  else
170
- showGridMenu(rect, operation.grid);
170
+ showGridMenu(rect, operation.grid, operation.caption ?? "");
171
171
  }
172
172
  }
173
173
  function toggleExpandToolboxV(e) {
@@ -205,7 +205,7 @@ function calculatePosition(operation) {
205
205
  return "";
206
206
  const width = 55;
207
207
  const height = 55;
208
- const margin = 10;
208
+ const margin = 0;
209
209
  let lShift = 0;
210
210
  let tShift = 0;
211
211
  let rShift = 0;
@@ -293,11 +293,7 @@ function operationVisible(operation) {
293
293
  {@const position = calculatePosition(operation)}
294
294
  {#if position}
295
295
  <button
296
- class=" text-stone-500 bg-stone-200/70 hover:bg-stone-200
297
- focus:outline-none font-medium rounded-full text-sm text-center
298
- dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
299
- focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800
300
- w-[30px] h-[30px]
296
+ class=" w-[55px] h-[55px]
301
297
  fixed m-0
302
298
  flex items-center justify-center
303
299
  disable-dbl-tap-zoom
@@ -305,7 +301,18 @@ function operationVisible(operation) {
305
301
  style={position}
306
302
  on:click|stopPropagation={(e) => {on_click(e, operation)}}
307
303
  on:mousedown={mousedown} >
308
- <div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
304
+
305
+ <div class=" text-stone-500 bg-stone-200/70 hover:bg-stone-200
306
+ focus:outline-none font-medium rounded-full text-sm text-center
307
+ dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
308
+ focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800
309
+
310
+ flex items-center justify-center
311
+ w-[30px] h-[30px]">
312
+ <div class="w-5 h-5">
313
+ <svelte:component this={operation.icon}/>
314
+ </div>
315
+ </div>
309
316
  </button>
310
317
  {/if}
311
318
  {/if}
@@ -12,6 +12,7 @@ let around_rect;
12
12
  let rootElement;
13
13
  let internalElement;
14
14
  let closeButtonPos = "";
15
+ let maxHeight = 0;
15
16
  export async function show(around, _toolbar, _props = {}) {
16
17
  if (around instanceof DOMRect) {
17
18
  x = around.left;
@@ -99,21 +100,21 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
99
100
  myRect = null;
100
101
  }
101
102
  if (myRect) {
102
- let maxHeight = screenRect.height / 2 - margin;
103
+ maxHeight = screenRect.height / 2 - margin;
103
104
  if (myRect.height < maxHeight)
104
105
  maxHeight = myRect.height;
105
106
  const width = screenRect.width - 2 * margin;
106
107
  x2 = margin;
107
108
  y2 = screenRect.bottom - maxHeight - margin;
108
- result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
109
+ result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
109
110
  } else {
110
- const maxHeight = screenRect.height / 2 - margin;
111
+ maxHeight = screenRect.height / 2 - margin;
111
112
  const width = screenRect.width - 2 * margin;
112
113
  x2 = margin;
113
114
  y2 = screenRect.bottom - maxHeight - margin;
114
- result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
115
+ result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
115
116
  }
116
- closeButtonPos = `right: ${margin}px; top: calc(${y2}px - 1.75rem)`;
117
+ closeButtonPos = `right: 0.5rem; top: calc(${y2}px + 0.25rem)`;
117
118
  } else {
118
119
  let myRect = null;
119
120
  if (!fresh) {
@@ -143,21 +144,26 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
143
144
  <div id="__hd_svelte_floating_container"
144
145
  class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow-md shadow-stone-500 dark:shadow-black z-40 fixed "
145
146
  style={cssPosition}
147
+ visible={visible}
146
148
  bind:this={rootElement}>
147
149
  {#if closeButtonPos}
148
- <button class=" fixed w-6 h-6 flex items-center justify-center
149
- text-stone-500 bg-stone-200/70 hover:bg-stone-200
150
- focus:outline-none font-medium rounded-full text-sm text-center
151
- dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
152
- focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800"
150
+ <button class=" text-stone-800 dark:text-stone-400
151
+ fixed w-6 h-6 flex items-center justify-center
152
+ focus:outline-none font-medium text-sm text-center"
153
153
  style={closeButtonPos}
154
- on:click={ hide }>
154
+ on:click={ hide }> <!--rounded-full focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 text-stone-500 bg-stone-200/70 hover:bg-stone-200 dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700 -->
155
155
  <Icon component={FaTimes} s="md"/>
156
156
  </button>
157
157
  {/if}
158
158
 
159
159
  {#if toolbar}
160
- <svelte:component this={toolbar} {...props} bind:this={internalElement} />
160
+ <svelte:component this={toolbar} {...props} {maxHeight} bind:this={internalElement} />
161
161
  {/if}
162
162
  </div>
163
163
 
164
+ <style>
165
+ :global(body:has(#__hd_svelte_floating_container[visible="true"]))
166
+ {
167
+ overflow: hidden;
168
+ }
169
+ </style>
@@ -2,6 +2,7 @@
2
2
  import {contextItemsStore} from '../stores.js'
3
3
 
4
4
  export let operations = []
5
+ export let label = ''
5
6
  export let onHide = undefined;
6
7
 
7
8
  $: grid_cols = init(operations);
@@ -115,24 +116,27 @@
115
116
  </script>
116
117
 
117
118
 
118
- <div class="grid gap-2 {grid_cols}">
119
- {#each operations as operation}
120
- {#if !operation.separator}
121
- {@const col=col_span(operation.columns ?? 1)}
122
-
123
- <button class=" py-2.5 px-5 {col}
124
- text-sm font-medium text-stone-900 dark:text-stone-400 dark:hover:text-white
125
- bg-stone-100 hover:bg-stone-200 dark:bg-stone-800 dark:hover:bg-stone-700 active:bg-stone-300 dark:active:bg-stone-600
126
- border rounded border-stone-200 dark:border-stone-600 focus:outline-none
127
- inline-flex items-center justify-center"
128
- on:click={(e) => {execute_action(e, operation)}}>
119
+ <div class="">
120
+ <p class="text-stone-800 dark:text-stone-400 text-sm ml-1 mb-1">{label}</p>
121
+ <div class="grid gap-2 {grid_cols} ">
122
+ {#each operations as operation}
123
+ {#if !operation.separator}
124
+ {@const col=col_span(operation.columns ?? 1)}
129
125
 
130
- {#if operation.icon}
131
- <div class="w-3 h-3 mr-1"><svelte:component this={operation.icon}/></div>
132
- {/if}
133
- <div>{operation.caption}</div>
134
- </button>
135
- {/if}
136
- {/each}
126
+ <button class=" py-2.5 px-5 {col}
127
+ text-sm font-medium text-stone-900 dark:text-stone-400 dark:hover:text-white
128
+ bg-stone-100 hover:bg-stone-200 dark:bg-stone-800 dark:hover:bg-stone-700 active:bg-stone-300 dark:active:bg-stone-600
129
+ border rounded border-stone-200 dark:border-stone-600 focus:outline-none
130
+ inline-flex items-center justify-center"
131
+ on:click={(e) => {execute_action(e, operation)}}>
132
+
133
+ {#if operation.icon}
134
+ <div class="w-3 h-3 mr-1"><svelte:component this={operation.icon}/></div>
135
+ {/if}
136
+ <div>{operation.caption}</div>
137
+ </button>
138
+ {/if}
139
+ {/each}
140
+ </div>
137
141
  </div>
138
142
 
@@ -3,6 +3,7 @@
3
3
  /** @typedef {typeof __propDef.slots} GridSlots */
4
4
  export default class Grid extends SvelteComponentTyped<{
5
5
  operations?: any[] | undefined;
6
+ label?: string | undefined;
6
7
  onHide?: any;
7
8
  }, {
8
9
  [evt: string]: CustomEvent<any>;
@@ -15,6 +16,7 @@ import { SvelteComponentTyped } from "svelte";
15
16
  declare const __propDef: {
16
17
  props: {
17
18
  operations?: any[] | undefined;
19
+ label?: string | undefined;
18
20
  onHide?: any;
19
21
  };
20
22
  events: {
@@ -56,15 +56,15 @@ function calculatePosition(x2, y2, visible2, fresh) {
56
56
  const width = screenRect.width - 2 * margin;
57
57
  x2 = margin;
58
58
  y2 = screenRect.bottom - maxHeight - margin;
59
- result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
59
+ result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
60
60
  } else {
61
61
  const maxHeight = screenRect.height / 2 - margin;
62
62
  const width = screenRect.width - 2 * margin;
63
63
  x2 = margin;
64
64
  y2 = screenRect.bottom - maxHeight - margin;
65
- result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
65
+ result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
66
66
  }
67
- closeButtonPos = `right: ${margin}px; top: calc(${y2}px - 1.75rem)`;
67
+ closeButtonPos = `right: 0.5rem; top: calc(${y2}px + 0.25rem)`;
68
68
  } else {
69
69
  let myRect = null;
70
70
  if (!fresh) {
@@ -311,7 +311,7 @@ function execute_action(e, operation, index) {
311
311
  if (false)
312
312
  showMenu(rect, operation.grid);
313
313
  else
314
- showGridMenu(rect, operation.grid);
314
+ showGridMenu(rect, operation.grid, operation.caption ?? "");
315
315
  } else if (operation.menu) {
316
316
  showMenu(rect, operation.menu);
317
317
  }
@@ -408,18 +408,16 @@ function isOperationDisabled(operation) {
408
408
  class=" bg-white dark:bg-stone-800
409
409
  text-stone-800 dark:text-stone-400 rounded-lg border
410
410
  border-stone-200 dark:border-stone-700 shadow-md
411
- z-40 fixed min-w-60 max-h-screen overflow-y-auto"
411
+ z-40 fixed min-w-60 max-h-screen overflow-y-auto overscroll-contain"
412
412
  style={css_position}
413
+ visible={visible}
413
414
  bind:this={menu_root}>
414
415
 
415
416
  {#if closeButtonPos}
416
417
  <button class=" fixed w-6 h-6 flex items-center justify-center
417
- text-stone-500 bg-stone-200/70 hover:bg-stone-200
418
- focus:outline-none font-medium rounded-full text-sm text-center
419
- dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
420
- focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800"
418
+ focus:outline-none font-medium text-sm text-center"
421
419
  style={closeButtonPos}
422
- on:click={ hide }>
420
+ on:click={ hide }> <!--focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 rounded-full text-stone-500 bg-stone-200/70 hover:bg-stone-200 dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700 -->
423
421
  <Icon component={FaTimes} s="md"/>
424
422
  </button>
425
423
  {/if}
@@ -443,7 +441,7 @@ function isOperationDisabled(operation) {
443
441
  {@const active = calculateBackground(isFocused || isOperationActivated(operation), false)}
444
442
  {@const has_submenu = operation.menu !== undefined && operation.menu.length > 0}
445
443
 
446
- <button class="block w-full pr-4 text-left flex flex-row cursor-context-menu {active} focus:outline-none items-center"
444
+ <button class="block w-full pr-4 text-left flex flex-row cursor-context-menu {active} focus:outline-none items-center"
447
445
  id={menu_item_id}
448
446
  bind:this={menu_items[index]}
449
447
  on:click|stopPropagation={(e) => { execute_action(e, operation, index) } }
@@ -485,4 +483,11 @@ function isOperationDisabled(operation) {
485
483
  </button>
486
484
  {/if}
487
485
  {/each}
488
- </div>
486
+ </div>
487
+
488
+ <style>
489
+ :global(body:has(#__hd_svelte_contextmenu[visible="true"]))
490
+ {
491
+ overflow: hidden;
492
+ }
493
+ </style>
@@ -1,5 +1,5 @@
1
1
  <svelte:options accessors={true}/>
2
- <script>import { tick, afterUpdate } from "svelte";
2
+ <script>import { tick, afterUpdate, onMount } from "svelte";
3
3
  import Pallete_row from "./palette.row.svelte";
4
4
  import { createEventDispatcher } from "svelte";
5
5
  import Icon from "../../icon.svelte";
@@ -38,16 +38,32 @@ afterUpdate(
38
38
  /*isToolbox && */
39
39
  visible && paletteElement
40
40
  ) {
41
- let layoutRoot = document.getElementById("__hd_svelte_layout_root");
42
- if (!layoutRoot)
43
- layoutRoot = document.getElementById("app");
44
- if (!!layoutRoot && paletteElement.parentElement != layoutRoot) {
41
+ const layoutRoot = getLayoutElement();
42
+ if (layoutRoot && paletteElement.parentElement != layoutRoot) {
45
43
  await tick();
46
44
  layoutRoot.appendChild(paletteElement);
47
45
  }
48
46
  }
49
47
  }
50
48
  );
49
+ onMount(
50
+ () => {
51
+ return () => {
52
+ if (paletteElement) {
53
+ const layoutRoot = getLayoutElement();
54
+ visible = false;
55
+ if (layoutRoot && paletteElement.parentElement == layoutRoot)
56
+ layoutRoot.removeChild(paletteElement);
57
+ }
58
+ };
59
+ }
60
+ );
61
+ function getLayoutElement() {
62
+ let layoutRoot = document.getElementById("__hd_svelte_layout_root");
63
+ if (!layoutRoot)
64
+ layoutRoot = document.getElementById("app");
65
+ return layoutRoot;
66
+ }
51
67
  let closeButtonPos = "";
52
68
  export function show(x, y, up = false) {
53
69
  isToolbox = false;
@@ -60,7 +76,8 @@ export function show(x, y, up = false) {
60
76
  if (isDeviceSmallerThan("sm")) {
61
77
  setTimeout(() => {
62
78
  const rect = paletteElement.getBoundingClientRect();
63
- closeButtonPos = `right: ${15}px; top: calc(${rect.y}px - 1.75rem)`;
79
+ closeButtonPos = `right: 0.5rem; top: 0.25rem`;
80
+ console.log("closeButtonPos", closeButtonPos);
64
81
  }, 0);
65
82
  }
66
83
  }
@@ -297,51 +314,53 @@ function isRowActive(cmd) {
297
314
  {:else}
298
315
  <!--div hidden={!visible}-->
299
316
 
300
- {#if visible && closeButtonPos}
301
- {#key closeButtonPos}
302
- <button class=" fixed w-6 h-6 flex items-center justify-center
303
- text-stone-500 bg-stone-200/70 hover:bg-stone-200
304
- focus:outline-none font-medium rounded-full text-sm text-center
305
- dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
306
- focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800"
307
- style={closeButtonPos}
308
- on:mousedown={buttonMousedown}
309
- on:click={ () => hide() }>
310
- <Icon component={FaTimes} s="md"/>
311
- </button>
312
- {/key}
313
- {/if}
314
-
315
317
  <div hidden={!visible}
316
- class="bg-white dark:bg-stone-800 text-stone-500 dark:text-stone-400 rounded-lg border border-stone-200 dark:border-stone-700 shadow-md overflow-y-auto z-40 fixed"
318
+ class=" bg-white dark:bg-stone-800 text-stone-500 dark:text-stone-400 rounded-lg border border-stone-200 dark:border-stone-700 shadow-md
319
+ z-40 fixed"
317
320
  id="__hd_FormattingPalette"
318
321
  bind:this={paletteElement}
319
322
  style={css_style} >
320
323
 
321
- {#if filtered_commands && filtered_commands.length}
322
- {#each filtered_commands as cmd, idx }
323
- {#if cmd.separator}
324
- {#if idx>0 && idx<filtered_commands.length-1} <!-- not first or last place -->
325
- <hr class="mx-4 my-1 border-stone-300 dark:border-stone-700"/>
326
- {/if}
327
- {:else}
328
- {@const id = "cpi_" + idx}
329
- {@const active=isRowActive(cmd)}
330
- <Pallete_row {id}
331
- cmd={cmd}
332
- is_highlighted={cmd == current_command}
333
- on:click={ () => { execute_mouse_click(cmd.on_choice); }}
334
- on:mousemove={ () => { on_mouse_over(cmd); }}
335
- on:mousedown={buttonMousedown}
336
- bind:this={rows[idx]}
337
- {active}
338
- />
339
- {/if}
340
- {/each}
341
- {:else}
342
- <p class="text-sm text-stone-500">No results</p>
324
+ {#if visible && closeButtonPos}
325
+ {#key closeButtonPos}
326
+ <button class=" text-stone-800 dark:text-stone-400
327
+ fixed w-6 h-6 flex items-center justify-center
328
+ focus:outline-none font-medium text-sm text-center"
329
+ style={closeButtonPos}
330
+ on:mousedown={buttonMousedown}
331
+ on:click={ () => hide() }> <!-- rounded-full text-stone-500 bg-stone-200/70 hover:bg-stone-200 dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700 focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 -->
332
+ <Icon component={FaTimes} s="md"/>
333
+ </button>
334
+ {/key}
343
335
  {/if}
344
336
 
337
+ <div class="w-full overflow-y-auto overscroll-contain" style="max-height: {max_height_px}px">
338
+
339
+ {#if filtered_commands && filtered_commands.length}
340
+ {#each filtered_commands as cmd, idx }
341
+ {#if cmd.separator}
342
+ {#if idx>0 && idx<filtered_commands.length-1} <!-- not first or last place -->
343
+ <hr class="mx-4 my-1 border-stone-300 dark:border-stone-700"/>
344
+ {/if}
345
+ {:else}
346
+ {@const id = "cpi_" + idx}
347
+ {@const active=isRowActive(cmd)}
348
+ <Pallete_row {id}
349
+ cmd={cmd}
350
+ is_highlighted={cmd == current_command}
351
+ on:click={ () => { execute_mouse_click(cmd.on_choice); }}
352
+ on:mousemove={ () => { on_mouse_over(cmd); }}
353
+ on:mousedown={buttonMousedown}
354
+ bind:this={rows[idx]}
355
+ {active}
356
+ />
357
+ {/if}
358
+ {/each}
359
+ {:else}
360
+ <p class="text-sm text-stone-500">No results</p>
361
+ {/if}
362
+ </div>
363
+
345
364
  </div>
346
365
  <!---/div-->
347
366
 
@@ -1,6 +1,6 @@
1
1
  <script>import { setContext, getContext, afterUpdate, tick, onMount } from "svelte";
2
2
  import { data_tick_store, contextItemsStore, contextTypesStore } from "../../stores";
3
- import { activateItem, getActive, clearActiveItem, parseWidthDirective, getPrev, getNext, swapElements, getLast, insertAfter, getActiveCount, addActiveItem } from "../../utils";
3
+ import { activateItem, getActive, clearActiveItem, parseWidthDirective, getPrev, getNext, swapElements, getLast, insertAfter, getActiveCount, addActiveItem, getFirst, insertAt, remove as removeFrom } from "../../utils";
4
4
  import Icon from "../icon.svelte";
5
5
  import { FaRegCircle, FaRegCheckCircle } from "svelte-icons/fa/";
6
6
  import { rList_definition } from "./List";
@@ -139,7 +139,8 @@ export function reload(data, selectElement = KEEP_SELECTION) {
139
139
  activate_after_dom_update = itemToActivate;
140
140
  }
141
141
  }
142
- }
142
+ } else
143
+ clearActiveItem(selectionKey);
143
144
  }
144
145
  export async function moveUp(element) {
145
146
  if (!orderAttrib)
@@ -169,6 +170,30 @@ export async function moveDown(element) {
169
170
  informModification(next, orderAttrib);
170
171
  pushChanges();
171
172
  }
173
+ export async function moveTop(element) {
174
+ if (!orderAttrib)
175
+ return;
176
+ let current = getFirst(items);
177
+ if (current == element)
178
+ return;
179
+ const firstOrder = current[orderAttrib];
180
+ while (current != element) {
181
+ const next = getNext(items, current);
182
+ const nextOrder = next[orderAttrib];
183
+ current[orderAttrib] = nextOrder;
184
+ informModification(current, orderAttrib);
185
+ current = next;
186
+ }
187
+ element[orderAttrib] = firstOrder;
188
+ informModification(element, orderAttrib);
189
+ items = removeFrom(items, element);
190
+ items = insertAt(items, 0, element);
191
+ await tick();
192
+ scrollToSelectedElement();
193
+ pushChanges();
194
+ }
195
+ export async function moveBottom(element) {
196
+ }
172
197
  let last_activated_element = null;
173
198
  export async function addRowAfter(after = null) {
174
199
  if (!definition.can_insert)
@@ -343,7 +368,7 @@ export function toggleSelectAll(e) {
343
368
  <!--hr class="hidden sm:block w-full"-->
344
369
  {/if}
345
370
 
346
- <!--div class="w-full h-full overflow-y-auto"-->
371
+ <!--div class="w-full h-full overflow-y-auto overscroll-contain"-->
347
372
 
348
373
 
349
374
  {#if items && items.length > 0 }
@@ -26,6 +26,8 @@ declare const __propDef: {
26
26
  reload?: ((data: object | object[], selectElement?: number) => void) | undefined;
27
27
  moveUp?: ((element: object) => Promise<void>) | undefined;
28
28
  moveDown?: ((element: object) => Promise<void>) | undefined;
29
+ moveTop?: ((element: object) => Promise<void>) | undefined;
30
+ moveBottom?: ((element: object) => Promise<void>) | undefined;
29
31
  addRowAfter?: ((after?: object | null) => Promise<void>) | undefined;
30
32
  remove?: ((element: object) => void) | undefined;
31
33
  edit?: ((element: object, property_name: string) => void) | undefined;
@@ -59,6 +61,8 @@ export default class List extends SvelteComponentTyped<ListProps, ListEvents, Li
59
61
  get reload(): (data: object | object[], selectElement?: number) => void;
60
62
  get moveUp(): (element: object) => Promise<void>;
61
63
  get moveDown(): (element: object) => Promise<void>;
64
+ get moveTop(): (element: object) => Promise<void>;
65
+ get moveBottom(): (element: object) => Promise<void>;
62
66
  get addRowAfter(): (after?: object | null) => Promise<void>;
63
67
  get remove(): (element: object) => void;
64
68
  get edit(): (element: object, property_name: string) => void;
@@ -7,4 +7,4 @@ export declare function showMenu(around: DOMRect | DOMPoint, operations: any, pr
7
7
  export declare function hideWholeContextMenu(): void;
8
8
  export declare function showFloatingToolbar(around: DOMRect | DOMPoint, toolbar: any, props?: {}): Floating_container | null;
9
9
  export declare function hideFloatingToolbar(): void;
10
- export declare function showGridMenu(around: DOMRect | DOMPoint, operations: any): void;
10
+ export declare function showGridMenu(around: DOMRect | DOMPoint, operations: any, label?: string): void;
@@ -64,6 +64,6 @@ export function hideFloatingToolbar() {
64
64
  toolbar_component.hide();
65
65
  }
66
66
  }
67
- export function showGridMenu(around, operations) {
68
- showFloatingToolbar(around, Grid, { operations: operations });
67
+ export function showGridMenu(around, operations, label = '') {
68
+ showFloatingToolbar(around, Grid, { operations: operations, label: label });
69
69
  }
package/console.svelte CHANGED
@@ -168,7 +168,7 @@
168
168
 
169
169
  </script>
170
170
 
171
- <div class="h-full overflow-y-auto">
171
+ <div class="h-full overflow-y-auto overscroll-contain">
172
172
  <button class="fixed right-0 m-2 w-6 h-6 text-stone-200 {protoButtonBorderClass}" on:click={protoChange}>
173
173
  <svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
174
174
  <path d="M16 4C14 4 11 5 11 9C11 13 11 15 11 18C11 21 6 23 6 23C6 23 11 25 11 28C11 31 11 35 11 39C11 43 14 44 16 44"/>
package/desk.svelte CHANGED
@@ -400,7 +400,7 @@
400
400
  {sidebar_small_width} sm:w-[320px]
401
401
  z-20 overflow-x-hidden">
402
402
 
403
- <div class=" bg-stone-50 w-full h-full dark:bg-stone-800 overflow-y-auto py-0 px-0">
403
+ <div class=" bg-stone-50 w-full h-full dark:bg-stone-800 overflow-y-auto overscroll-contain py-0 px-0">
404
404
  <Configurable config={layout.sidebar[visible_sidebar]}>
405
405
  <div slot='alt'></div>
406
406
  </Configurable>
@@ -442,7 +442,7 @@
442
442
  {content_top}
443
443
  {lg_content_area_horizontal_dim}
444
444
  z-0 overflow-x-hidden
445
- {content_height} sm:overflow-y-auto"
445
+ {content_height} sm:overflow-y-auto sm:overscroll-contain"
446
446
  >
447
447
  <Configurable config={layout.mainContent} min_h_class="min-h-screen">
448
448
  <div slot='alt'></div>
package/dialog.svelte ADDED
@@ -0,0 +1,58 @@
1
+ <script>import { afterUpdate, onMount, tick } from "svelte";
2
+ import Icon from "./components/icon.svelte";
3
+ import { pushToolsActionsOperations, popToolsActionsOperations, fabHiddenDueToPopup } from "./stores.js";
4
+ import { isDeviceSmallerThan } from "./utils";
5
+ import { FaTimes } from "svelte-icons/fa";
6
+ import { i18n } from "./i18n.js";
7
+ export let open = false;
8
+ export function show(on_close_callback = void 0) {
9
+ open = true;
10
+ close_callback = on_close_callback;
11
+ if (isDeviceSmallerThan("sm")) {
12
+ $fabHiddenDueToPopup = true;
13
+ }
14
+ }
15
+ export function hide() {
16
+ if (!open)
17
+ return;
18
+ open = false;
19
+ $fabHiddenDueToPopup = false;
20
+ }
21
+ let root;
22
+ afterUpdate(
23
+ async () => {
24
+ if (!!root) {
25
+ let modal_root = document.getElementById("__hd_svelte_modal_root");
26
+ if (!!modal_root && root.parentElement != modal_root) {
27
+ await tick();
28
+ modal_root.appendChild(root);
29
+ }
30
+ }
31
+ }
32
+ );
33
+ let close_callback = void 0;
34
+ </script>
35
+
36
+ {#if open}
37
+ <div id="__hd_svelte_property_dialog_container"
38
+ visible={open}
39
+ class="relative z-30" aria-labelledby="modal-title" role="dialog" aria-modal="true" bind:this={root}>
40
+ <div class="fixed w-screen h-screen inset-0 bg-stone-500 dark:bg-stone-800 bg-opacity-75 dark:bg-opacity-75 transition-opacity"></div>
41
+
42
+ <div class="fixed z-30 inset-0 w-screen overflow-y-auto overscroll-contain">
43
+ <div class="flex min-h-full items-end justify-center p-1 text-center sm:items-center sm:p-0">
44
+ <div class=" p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow-md shadow-stone-500 dark:shadow-black text-left shadow-xl transition-all
45
+ sm:my-8 w-full sm:max-w-lg"> <!-- transform overflow-hidden -->
46
+ <slot/>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ {/if}
52
+
53
+ <style>
54
+ :global(body:has(#__hd_svelte_property_dialog_container[visible="true"]))
55
+ {
56
+ overflow: hidden;
57
+ }
58
+ </style>
@@ -0,0 +1,22 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ open?: boolean | undefined;
5
+ show?: ((on_close_callback?: Function | undefined) => void) | undefined;
6
+ hide?: (() => void) | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {
12
+ default: {};
13
+ };
14
+ };
15
+ export type DialogProps = typeof __propDef.props;
16
+ export type DialogEvents = typeof __propDef.events;
17
+ export type DialogSlots = typeof __propDef.slots;
18
+ export default class Dialog extends SvelteComponentTyped<DialogProps, DialogEvents, DialogSlots> {
19
+ get show(): (on_close_callback?: Function | undefined) => void;
20
+ get hide(): () => void;
21
+ }
22
+ export {};
package/index.d.ts CHANGED
@@ -42,6 +42,7 @@ export { default as ListComboProperty } from './components/list/list.combo.svelt
42
42
  export { default as ListStaticProperty } from './components/list/list.static.svelte';
43
43
  export { default as ListTags } from './components/list/list.tags.svelte';
44
44
  export { default as Modal } from './modal.svelte';
45
+ export { default as Dialog } from './dialog.svelte';
45
46
  export { default as MembersPage } from './tenant.members.svelte';
46
47
  export { default as Console } from './console.svelte';
47
48
  export { default as Tag } from './components/tag.svelte';
package/index.js CHANGED
@@ -48,6 +48,7 @@ export { default as ListComboProperty } from './components/list/list.combo.svelt
48
48
  export { default as ListStaticProperty } from './components/list/list.static.svelte';
49
49
  export { default as ListTags } from './components/list/list.tags.svelte';
50
50
  export { default as Modal } from './modal.svelte';
51
+ export { default as Dialog } from './dialog.svelte';
51
52
  export { default as MembersPage } from './tenant.members.svelte';
52
53
  export { default as Console } from './console.svelte';
53
54
  export { default as Tag } from './components/tag.svelte';
package/modal.svelte CHANGED
@@ -59,7 +59,9 @@ function on_cancel(event) {
59
59
  </script>
60
60
 
61
61
  {#if open}
62
- <div class="relative z-30" aria-labelledby="modal-title" role="dialog" aria-modal="true" bind:this={root}>
62
+ <div id="__hd_svelte_modal_container"
63
+ visible={open}
64
+ class="relative z-30" aria-labelledby="modal-title" role="dialog" aria-modal="true" bind:this={root}>
63
65
  <!--
64
66
  Background backdrop, show/hide based on modal state.
65
67
 
@@ -72,7 +74,7 @@ function on_cancel(event) {
72
74
  -->
73
75
  <div class="fixed w-screen h-screen inset-0 bg-stone-500 dark:bg-stone-800 bg-opacity-75 dark:bg-opacity-75 transition-opacity"></div>
74
76
 
75
- <div class="fixed z-30 inset-0 w-screen overflow-y-auto">
77
+ <div class="fixed z-30 inset-0 w-screen overflow-y-auto overscroll-contain">
76
78
  <div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
77
79
  <!--
78
80
  Modal panel, show/hide based on modal state.
@@ -132,4 +134,11 @@ function on_cancel(event) {
132
134
  </div>
133
135
  </div>
134
136
  </div>
135
- {/if}
137
+ {/if}
138
+
139
+ <style>
140
+ :global(body:has(#__hd_svelte_modal_container[visible="true"]))
141
+ {
142
+ overflow: hidden;
143
+ }
144
+ </style>
package/operations.svelte CHANGED
@@ -182,7 +182,7 @@ function on_click(e, operation, isDisabled) {
182
182
  else if (operation.toolbar)
183
183
  showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
184
184
  else if (operation.grid)
185
- showGridMenu(rect, operation.grid);
185
+ showGridMenu(rect, operation.grid, operation.caption ?? "");
186
186
  }
187
187
  function mousedown(e, operation) {
188
188
  e.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.7.12",
3
+ "version": "1.7.14",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
@@ -156,6 +156,7 @@
156
156
  "./components/tile.title.svelte": "./components/tile.title.svelte",
157
157
  "./console.svelte": "./console.svelte",
158
158
  "./desk.svelte": "./desk.svelte",
159
+ "./dialog.svelte": "./dialog.svelte",
159
160
  "./form.box.svelte": "./form.box.svelte",
160
161
  "./horizontal.toolbar.svelte": "./horizontal.toolbar.svelte",
161
162
  "./i18n-preprocess": "./i18n-preprocess.js",