@humandialog/forms.svelte 1.7.3 → 1.7.5

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.
@@ -1,4 +1,4 @@
1
- <script>import { contextToolbarOperations, pageToolbarOperations, leftHandedFAB, toolsActionsOperations, fabCollapsed, bottom_bar_visible_store, main_sidebar_visible_store } from "../stores.js";
1
+ <script>import { contextToolbarOperations, pageToolbarOperations, leftHandedFAB, toolsActionsOperations, fabCollapsed, bottom_bar_visible_store, main_sidebar_visible_store, fabHiddenDueToPopup } from "../stores.js";
2
2
  import { showFloatingToolbar, showMenu, showGridMenu } from "./menu.js";
3
3
  import { FaChevronUp, FaChevronDown, FaChevronLeft, FaChevronRight, FaCircle, FaEllipsisV, FaRegDotCircle, FaDotCircle } from "svelte-icons/fa/";
4
4
  import { isDeviceSmallerThan } from "../utils.js";
@@ -12,7 +12,8 @@ $:
12
12
  $fabCollapsed,
13
13
  $bottom_bar_visible_store,
14
14
  $main_sidebar_visible_store,
15
- $leftHandedFAB
15
+ $leftHandedFAB,
16
+ $fabHiddenDueToPopup
16
17
  );
17
18
  let operations = [];
18
19
  let mainOperation = null;
@@ -23,6 +24,10 @@ let vToolboxExpanded = false;
23
24
  let hToolboxExpanded = false;
24
25
  let isDirectPositioningMode = false;
25
26
  async function setupCurrentContextOperations(...args) {
27
+ if ($fabHiddenDueToPopup) {
28
+ operations = [];
29
+ return;
30
+ }
26
31
  await tick();
27
32
  let opVer = 0;
28
33
  let main_FAB_position = "";
@@ -1,6 +1,6 @@
1
1
  <script>import { tick, afterUpdate } from "svelte";
2
2
  import { isDeviceSmallerThan } from "../utils";
3
- import { pushToolsActionsOperations, popToolsActionsOperations } from "../stores";
3
+ import { pushToolsActionsOperations, popToolsActionsOperations, fabHiddenDueToPopup } from "../stores";
4
4
  import { FaTimes } from "svelte-icons/fa";
5
5
  import Icon from "./icon.svelte";
6
6
  let x;
@@ -36,25 +36,8 @@ export async function show(around, _toolbar, _props = {}) {
36
36
  props.onSizeChanged = () => onSizeChanged();
37
37
  hide_window_indicator = 0;
38
38
  window.addEventListener("click", on_before_window_click, true);
39
- if (false) {
40
- pushToolsActionsOperations({
41
- opver: 1,
42
- operations: [
43
- {
44
- caption: "Menu",
45
- operations: [
46
- {
47
- icon: FaTimes,
48
- action: (f) => {
49
- hide();
50
- },
51
- fab: "M00",
52
- tbr: "A"
53
- }
54
- ]
55
- }
56
- ]
57
- });
39
+ if (isDeviceSmallerThan("sm")) {
40
+ $fabHiddenDueToPopup = true;
58
41
  }
59
42
  await tick();
60
43
  if (!was_visible)
@@ -65,8 +48,9 @@ export function isVisible() {
65
48
  return visible;
66
49
  }
67
50
  export function hide() {
68
- if (false)
69
- popToolsActionsOperations();
51
+ if (visible) {
52
+ $fabHiddenDueToPopup = false;
53
+ }
70
54
  visible = false;
71
55
  toolbar = null;
72
56
  cssPosition = calculatePosition(x, y, around_rect, false, false);
@@ -2,6 +2,7 @@
2
2
  import {location, link, querystring} from 'svelte-spa-router'
3
3
  import {randomString, isDeviceSmallerThan} from '../utils'
4
4
  import { ext } from '../i18n.js';
5
+ import { afterUpdate } from 'svelte';
5
6
 
6
7
  export let path;
7
8
  export let collapseLonger = false
@@ -42,15 +43,60 @@
42
43
  return idx < entriesNo-maxEntriesNo
43
44
  }
44
45
 
46
+ let scrollableElement
47
+ /*let isScrolling = false
48
+ let startScrollLeft = 0
49
+ let startDragX = 0
50
+ let startDragY = 0
51
+ function mouseDown(e)
52
+ {
53
+
54
+ isScrolling = true
55
+ startDragX = e.offsetX
56
+ startDragY = e.offsetY
57
+ startScrollLeft = scrollableElement.scrollLeft
58
+ }
59
+
60
+ function mouseMove(e)
61
+ {
62
+ if(isScrolling)
63
+ {
64
+ const deltaX = startDragX - e.offsetX
65
+ //console.log('mouseMove', deltaX)
66
+
67
+ scrollableElement.scrollLeft = startScrollLeft + deltaX
68
+ }
69
+ }
70
+
71
+ function mouseUp(e)
72
+ {
73
+ console.log('mouseUp', e)
74
+ isScrolling = false
75
+ startDragX = 0
76
+ startDragY = 0
77
+ startScrollLeft = 0
78
+ }
79
+ */
80
+
81
+ let pathElements = []
82
+ afterUpdate( () =>
83
+ {
84
+ const elementsNo = pathElements.length
85
+ if(elementsNo > 0)
86
+ {
87
+ const lastElement = pathElements[elementsNo-1]
88
+ lastElement.scrollIntoView({ container: "nearest"})
89
+ }
90
+ })
91
+
45
92
  </script>
46
93
 
47
- <nav class="flex {userClass}" aria-label="Breadcrumb">
48
- <ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse flex-wrap">
94
+ <nav class="{userClass} w-full sm:w-fit sm:max-w-full overflow-x-auto sm:overflow-x-hidden" aria-label="Breadcrumb">
95
+ <ol class="flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse flex-nowrap min-h-[1.25rem]" bind:this={scrollableElement}>
49
96
 
50
- {#if (segments && segments.length > 1)}
97
+ {#if (segments && segments.length > 0)}
51
98
  {#each segments as segment, idx (segment.uniqueKey)}
52
99
  {@const isFirst = idx == 0}
53
- {@const isLast = idx == segments.length-1}
54
100
  {@const isCollapsed = shouldBeCollapsed(idx)}
55
101
  {@const isFirstCollapsed = isCollapsed && idx == 0}
56
102
 
@@ -64,28 +110,27 @@
64
110
  </span>
65
111
  {/if}
66
112
  {:else}
67
- <li>
113
+ <li bind:this={pathElements[idx]}>
68
114
  <div class="flex items-center">
69
115
  {#if !isFirst}
70
- <svg class="rtl:rotate-180 w-3 h-3 text-stone-400 mx-1" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
116
+ <!--svg class="rtl:rotate-180 w-3 h-3 text-stone-400 mx-1" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
71
117
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 9 4-4-4-4"/>
72
- </svg>
118
+ </svg-->
119
+ <span class="text-sm font-medium text-stone-700 dark:text-stone-400 ">
120
+ /
121
+ </span>
73
122
  {/if}
74
- {#if isLast}
75
- <span class="ms-1 text-sm md:ms-2 font-semibold text-stone-900 dark:text-stone-100 whitespace-nowrap">
123
+
124
+ {#if segment.href}
125
+ <a href={segment.href} use:link class="ms-1 text-sm font-medium md:ms-2 text-stone-700 hover:text-stone-900 dark:text-stone-400 dark:hover:text-white whitespace-nowrap">
76
126
  {ext(segment.name)}
77
- </span>
127
+ </a>
78
128
  {:else}
79
- {#if segment.href}
80
- <a href={segment.href} use:link class="ms-1 text-sm font-medium md:ms-2 text-stone-700 hover:text-stone-900 dark:text-stone-400 dark:hover:text-white whitespace-nowrap">
81
- {ext(segment.name)}
82
- </a>
83
- {:else}
84
- <span class="ms-1 text-sm font-medium md:ms-2 text-stone-700 dark:text-stone-400 whitespace-nowrap">
85
- {ext(segment.name)}
86
- </span>
87
- {/if}
129
+ <span class="ms-1 text-sm font-medium md:ms-2 text-stone-700 dark:text-stone-400 whitespace-nowrap">
130
+ {ext(segment.name)}
131
+ </span>
88
132
  {/if}
133
+
89
134
  </div>
90
135
  </li>
91
136
  {/if}
@@ -1,4 +1,4 @@
1
- <script>import { data_tick_store, contextItemsStore, contextTypesStore, pushToolsActionsOperations, popToolsActionsOperations } from "../../stores.js";
1
+ <script>import { data_tick_store, contextItemsStore, contextTypesStore, pushToolsActionsOperations, popToolsActionsOperations, fabHiddenDueToPopup } from "../../stores.js";
2
2
  import { informModification, pushChanges } from "../../updates.js";
3
3
  import { isDeviceSmallerThan, parseWidthDirective, shouldBeComapact } from "../../utils.js";
4
4
  import { afterUpdate, getContext, onMount, setContext } from "svelte";
@@ -200,25 +200,8 @@ export function show(event, hide_callback) {
200
200
  subtree: true
201
201
  });
202
202
  }
203
- if (false) {
204
- pushToolsActionsOperations({
205
- opver: 1,
206
- operations: [
207
- {
208
- caption: "Menu",
209
- operations: [
210
- {
211
- icon: FaTimes,
212
- action: (f) => {
213
- hide();
214
- },
215
- fab: "M00",
216
- tbr: "A"
217
- }
218
- ]
219
- }
220
- ]
221
- });
203
+ if (isDeviceSmallerThan("sm")) {
204
+ $fabHiddenDueToPopup = true;
222
205
  }
223
206
  }
224
207
  function openDropdownAsMenu() {
@@ -251,6 +234,7 @@ export function hide() {
251
234
  if (mutation_observer)
252
235
  mutation_observer.disconnect();
253
236
  is_dropdown_open = false;
237
+ $fabHiddenDueToPopup = false;
254
238
  dropdown_position = "display: none;";
255
239
  combo_text = get_combo_text();
256
240
  if (!!textbox)
@@ -1,6 +1,6 @@
1
1
  <script>import { afterUpdate, tick } from "svelte";
2
2
  import Icon from "./icon.svelte";
3
- import { contextItemsStore, pushToolsActionsOperations, popToolsActionsOperations } from "../stores";
3
+ import { contextItemsStore, pushToolsActionsOperations, popToolsActionsOperations, fabHiddenDueToPopup } from "../stores";
4
4
  import { isDeviceSmallerThan, isOnScreenKeyboardVisible } from "../utils";
5
5
  import {
6
6
  hideWholeContextMenu,
@@ -200,25 +200,8 @@ export async function show(around, _operations, preference = 0) {
200
200
  hide_window_indicator = 0;
201
201
  window.addEventListener("click", on_before_window_click, true);
202
202
  }
203
- if (false) {
204
- pushToolsActionsOperations({
205
- opver: 1,
206
- operations: [
207
- {
208
- caption: "Menu",
209
- operations: [
210
- {
211
- icon: FaTimes,
212
- action: (f) => {
213
- hide();
214
- },
215
- fab: "M00",
216
- tbr: "A"
217
- }
218
- ]
219
- }
220
- ]
221
- });
203
+ if (isDeviceSmallerThan("sm")) {
204
+ $fabHiddenDueToPopup = true;
222
205
  }
223
206
  await tick();
224
207
  css_position = calculatePosition(x, y, true, false);
@@ -231,8 +214,9 @@ export function isVisible() {
231
214
  return visible;
232
215
  }
233
216
  export function hide() {
234
- if (false)
235
- popToolsActionsOperations();
217
+ if (visible) {
218
+ $fabHiddenDueToPopup = false;
219
+ }
236
220
  visible = false;
237
221
  css_position = calculatePosition(x, y, false, false);
238
222
  window.removeEventListener("click", on_before_window_click, true);
@@ -308,7 +292,7 @@ function execute_action(e, operation, index) {
308
292
  hideWholeContextMenu();
309
293
  if (!operation)
310
294
  return;
311
- let owner = e.target;
295
+ let owner = e?.target;
312
296
  while (owner && owner.tagName != "BUTTON")
313
297
  owner = owner.parentElement;
314
298
  if (operation.preAction)
@@ -373,18 +357,7 @@ function focus_menu_item(index) {
373
357
  if (submenus && submenus.length) {
374
358
  if (submenus[focused_index]) {
375
359
  let rect = element.getBoundingClientRect();
376
- let container_rect = new DOMRect(0, 0, window.innerWidth, window.innerHeight);
377
- let _x = rect.right;
378
- let _y = rect.top;
379
- let submenu_width = min_width_px;
380
- let rendered_rect = submenus[focused_index].getRenderedRect();
381
- if (rendered_rect && rendered_rect.width > 0)
382
- submenu_width = rendered_rect.width;
383
- if (_x + submenu_width > container_rect.right) {
384
- if (rect.left - container_rect.left > container_rect.right - rect.right)
385
- _x = rect.left - submenu_width;
386
- }
387
- submenus[focused_index].show(new DOMPoint(_x, _y), operations[focused_index].menu);
360
+ submenus[focused_index].show(rect, operations[focused_index].menu, SHOW_MENU_RIGHT);
388
361
  }
389
362
  for (let i = 0; i < submenus.length; i++) {
390
363
  if (i != focused_index) {
@@ -416,6 +389,18 @@ function calculateBackground(is_highlighted, active) {
416
389
  return "";
417
390
  }
418
391
  }
392
+ function isOperationActivated(operation) {
393
+ if (operation.activeFunc)
394
+ return operation.activeFunc();
395
+ else
396
+ return operation.active ?? false;
397
+ }
398
+ function isOperationDisabled(operation) {
399
+ if (operation.disabledFunc)
400
+ return operation.disabledFunc();
401
+ else
402
+ return operation.disabled ?? false;
403
+ }
419
404
  </script>
420
405
 
421
406
 
@@ -455,7 +440,7 @@ function calculateBackground(is_highlighted, active) {
455
440
  {@const isBottom = index == operations.length-1}
456
441
  {@const isFocused = index == focused_index}
457
442
  {@const clipFocusedBorder = isFocused ? (isTop ? 'rounded-t-lg' : (isBottom ? 'rounded-b-lg' : '')) : ''}
458
- {@const active = calculateBackground(isFocused, false)}
443
+ {@const active = calculateBackground(isFocused || isOperationActivated(operation), false)}
459
444
  {@const has_submenu = operation.menu !== undefined && operation.menu.length > 0}
460
445
 
461
446
  <button class="block w-full pr-4 text-left flex flex-row cursor-context-menu {active} focus:outline-none items-center"
@@ -465,8 +450,8 @@ function calculateBackground(is_highlighted, active) {
465
450
  on:mouseenter = {(e) => {on_mouse_move(index)}}
466
451
  on:keydown|stopPropagation={(e) => on_keydown(e, operation, index)}
467
452
  on:mousedown={mousedown}
468
- disabled={operation.disabled}
469
- class:opacity-60={operation.disabled}>
453
+ disabled={isOperationDisabled(operation)}
454
+ class:opacity-60={isOperationDisabled(operation)}>
470
455
 
471
456
  <div class="flex justify-center space-x-10 px-4 py-2 ml-12 sm:ml-0" >
472
457
  {#if operation.icon}
@@ -28,7 +28,7 @@ import Gapcursor from "@tiptap/extension-gapcursor";
28
28
  import History from "@tiptap/extension-history";
29
29
  import { Plugin, PluginKey } from "@tiptap/pm/state";
30
30
  import { getAttributes } from "@tiptap/core";
31
- import { data_tick_store, contextItemsStore, contextTypesStore, onErrorShowAlert, pushToolsActionsOperations, popToolsActionsOperations } from "../../stores.js";
31
+ import { data_tick_store, contextItemsStore, contextTypesStore, onErrorShowAlert, pushToolsActionsOperations, popToolsActionsOperations, fabHiddenDueToPopup } from "../../stores.js";
32
32
  import { informModification, pushChanges } from "../../updates.js";
33
33
  import { isDeviceSmallerThan, parseWidthDirective, refreshToolbarOperations, UI } from "../../utils.js";
34
34
  import Palette from "./internal/palette.svelte";
@@ -771,31 +771,14 @@ function on_palette_mouse_click() {
771
771
  }
772
772
  function on_palette_shown() {
773
773
  is_command_palette_visible = true;
774
- if (false) {
775
- pushToolsActionsOperations({
776
- opver: 1,
777
- operations: [
778
- {
779
- caption: "Palette",
780
- operations: [
781
- {
782
- icon: FaTimes,
783
- action: (f) => {
784
- palette.hide();
785
- editor?.commands.focus();
786
- },
787
- fab: "M00",
788
- tbr: "A"
789
- }
790
- ]
791
- }
792
- ]
793
- });
774
+ if (isDeviceSmallerThan("sm")) {
775
+ $fabHiddenDueToPopup = true;
794
776
  }
795
777
  }
796
778
  function on_palette_hidden() {
797
- if (false)
798
- popToolsActionsOperations();
779
+ if (is_command_palette_visible) {
780
+ $fabHiddenDueToPopup = false;
781
+ }
799
782
  editor?.commands.focus();
800
783
  is_command_palette_visible = false;
801
784
  }
@@ -28,7 +28,7 @@ export let summary = "";
28
28
  export let typename = void 0;
29
29
  export let toolbarOperations = void 0;
30
30
  export let contextMenu = void 0;
31
- export let multiselecOperations = (items) => [];
31
+ export let multiselectOperations = (items) => [];
32
32
  export let key = "";
33
33
  export let selectionKey = "props";
34
34
  export let multiselect = false;
@@ -182,7 +182,10 @@ function getHRef() {
182
182
  function activate_row(e, item2) {
183
183
  const openable = !!definition.title_href || !!definition.title_href_func;
184
184
  if (toolbarOperations) {
185
- activateItem(selectionKey, item2, toolbarOperations(item2));
185
+ if (multiselect)
186
+ activateItem(selectionKey, item2, multiselectOperations);
187
+ else
188
+ activateItem(selectionKey, item2, toolbarOperations(item2));
186
189
  if (e)
187
190
  e.stopPropagation();
188
191
  } else {
@@ -269,9 +272,9 @@ export function scrollToView() {
269
272
  }
270
273
  function onToggleMultiSelect(e) {
271
274
  if (!is_row_active)
272
- addActiveItem(selectionKey, item, multiselecOperations);
275
+ addActiveItem(selectionKey, item, multiselectOperations);
273
276
  else
274
- removeActiveItem(selectionKey, item, multiselecOperations);
277
+ removeActiveItem(selectionKey, item, multiselectOperations);
275
278
  if (e)
276
279
  e.stopPropagation();
277
280
  }
@@ -7,7 +7,7 @@ declare const __propDef: {
7
7
  typename?: string | undefined;
8
8
  toolbarOperations?: undefined;
9
9
  contextMenu?: undefined;
10
- multiselecOperations?: ((items: any) => never[]) | undefined;
10
+ multiselectOperations?: ((items: any) => never[]) | undefined;
11
11
  key?: string | undefined;
12
12
  selectionKey?: string | undefined;
13
13
  multiselect?: boolean | undefined;
@@ -17,7 +17,7 @@ export let typename = "";
17
17
  export let c = "";
18
18
  export let toolbarOperations = void 0;
19
19
  export let contextMenu = void 0;
20
- export let multiselecOperations = (items2) => [];
20
+ export let multiselectOperations = (items2) => [];
21
21
  export let key = "";
22
22
  export let selectionKey = "props";
23
23
  export let multiselect = false;
@@ -224,14 +224,29 @@ export function edit(element, property_name) {
224
224
  }
225
225
  export function toggleMultiselection() {
226
226
  multiselect = !multiselect;
227
- let lastSelectedItem = getActive(selectionKey);
228
- if (lastSelectedItem) {
229
- let ops = [];
230
- if (toolbarOperations)
231
- ops = toolbarOperations(lastSelectedItem);
232
- activateItem(selectionKey, lastSelectedItem, ops);
233
- } else
234
- clearActiveItem(selectionKey);
227
+ if (multiselect) {
228
+ let lastSelectedItem = getActive(selectionKey);
229
+ if (lastSelectedItem) {
230
+ let ops = [];
231
+ if (multiselectOperations)
232
+ ops = multiselectOperations;
233
+ activateItem(selectionKey, lastSelectedItem, ops);
234
+ } else {
235
+ clearActiveItem(selectionKey);
236
+ }
237
+ } else {
238
+ let lastSelectedItem = getActive(selectionKey);
239
+ if (lastSelectedItem) {
240
+ let ops = [];
241
+ if (toolbarOperations)
242
+ ops = toolbarOperations(lastSelectedItem);
243
+ activateItem(selectionKey, lastSelectedItem, ops);
244
+ } else
245
+ clearActiveItem(selectionKey);
246
+ }
247
+ }
248
+ export function isMultiselectionEnabled() {
249
+ return multiselect;
235
250
  }
236
251
  function reorderElements(items2, from = null) {
237
252
  let fromIdx;
@@ -308,14 +323,15 @@ function calcMultiSelectionMode(...args) {
308
323
  }
309
324
  $:
310
325
  multiselectionMode = calcMultiSelectionMode($contextItemsStore);
311
- function toggleSelectAll(e) {
326
+ export function toggleSelectAll(e) {
312
327
  if (multiselectionMode == UNSELECT_ALL)
313
328
  clearActiveItem(selectionKey);
314
329
  else {
315
- const operations = multiselecOperations(items);
330
+ const operations = multiselectOperations(items);
316
331
  items?.forEach((itm) => addActiveItem(selectionKey, itm, operations));
317
332
  }
318
- e.stopPropagation();
333
+ if (e)
334
+ e.stopPropagation();
319
335
  }
320
336
  </script>
321
337
 
@@ -331,7 +347,7 @@ function toggleSelectAll(e) {
331
347
 
332
348
 
333
349
  {#if items && items.length > 0 }
334
- {#if multiselect}
350
+ {#if false && multiselect}
335
351
  {@const icon = (multiselectionMode == SELECT_ALL) ? FaRegSquare : FaRegCheckSquare}
336
352
  <Icon component={icon} class="h-5 w-5 sm:h-4 sm:w-4 text-stone-500 dark:text-stone-400 cursor-pointer mt-2 sm:mt-1.5 ml-2 mr-3"
337
353
  on:click={toggleSelectAll}/>
@@ -344,7 +360,7 @@ function toggleSelectAll(e) {
344
360
  {contextMenu}
345
361
  {key}
346
362
  {multiselect}
347
- {multiselecOperations}
363
+ {multiselectOperations}
348
364
  {selectionKey}
349
365
  bind:this={rows[i]}
350
366
  >
@@ -11,7 +11,7 @@ declare const __propDef: {
11
11
  c?: string | undefined;
12
12
  toolbarOperations?: undefined;
13
13
  contextMenu?: undefined;
14
- multiselecOperations?: ((items: any) => never[]) | undefined;
14
+ multiselectOperations?: ((items: any) => never[]) | undefined;
15
15
  key?: string | undefined;
16
16
  selectionKey?: string | undefined;
17
17
  multiselect?: boolean | undefined;
@@ -30,7 +30,9 @@ declare const __propDef: {
30
30
  remove?: ((element: object) => void) | undefined;
31
31
  edit?: ((element: object, property_name: string) => void) | undefined;
32
32
  toggleMultiselection?: (() => void) | undefined;
33
+ isMultiselectionEnabled?: (() => boolean) | undefined;
33
34
  assignOrder?: ((after: object | null) => number) | undefined;
35
+ toggleSelectAll?: ((e: any) => void) | undefined;
34
36
  };
35
37
  events: {
36
38
  [evt: string]: CustomEvent<any>;
@@ -61,6 +63,8 @@ export default class List extends SvelteComponentTyped<ListProps, ListEvents, Li
61
63
  get remove(): (element: object) => void;
62
64
  get edit(): (element: object, property_name: string) => void;
63
65
  get toggleMultiselection(): () => void;
66
+ get isMultiselectionEnabled(): () => boolean;
64
67
  get assignOrder(): (after: object | null) => number;
68
+ get toggleSelectAll(): (e: any) => void;
65
69
  }
66
70
  export {};
package/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban'
60
60
  export { default as Paginator } from './components/paginator.svelte';
61
61
  export { default as Breadcrumb } from './components/breadcrumb.svelte';
62
62
  export { breadcrumbAdd, breadcrumbParse, breadcrumbStringify, breadcrumbClipName } from './components/breadcrumb_utils';
63
- export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, getActiveItems, getActiveCount, addActiveItem, removeActiveItem, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, NAV_MODE_SIDEBAR, NAV_MODE_FULL_PAGE, navGetMode, navIsVisible, navGetKey, navShow, navHide, navToggle, navPrevVisibleKey, navAutoHide, } from './utils';
63
+ export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, getActiveItems, getActiveCount, addActiveItem, removeActiveItem, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, reloadPageToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, NAV_MODE_SIDEBAR, NAV_MODE_FULL_PAGE, navGetMode, navIsVisible, navGetKey, navShow, navHide, navToggle, navPrevVisibleKey, navAutoHide, insertAt, insertAfter, getPrev, getNext, getFirst, getLast, removeAt, remove, swapElements } from './utils';
64
64
  export { getNiceStringDateTime, getFormattedStringDate, getNiceStringDate, dayName, monthName } from './components/date_utils';
65
65
  export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, wholeAppReloader, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, navKey, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
66
66
  export { data_tick_store, // tmp
package/index.js CHANGED
@@ -66,7 +66,7 @@ export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban'
66
66
  export { default as Paginator } from './components/paginator.svelte';
67
67
  export { default as Breadcrumb } from './components/breadcrumb.svelte';
68
68
  export { breadcrumbAdd, breadcrumbParse, breadcrumbStringify, breadcrumbClipName } from './components/breadcrumb_utils';
69
- export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, getActiveItems, getActiveCount, addActiveItem, removeActiveItem, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, NAV_MODE_SIDEBAR, NAV_MODE_FULL_PAGE, navGetMode, navIsVisible, navGetKey, navShow, navHide, navToggle, navPrevVisibleKey, navAutoHide, } from './utils';
69
+ export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, getActiveItems, getActiveCount, addActiveItem, removeActiveItem, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, reloadPageToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, NAV_MODE_SIDEBAR, NAV_MODE_FULL_PAGE, navGetMode, navIsVisible, navGetKey, navShow, navHide, navToggle, navPrevVisibleKey, navAutoHide, insertAt, insertAfter, getPrev, getNext, getFirst, getLast, removeAt, remove, swapElements } from './utils';
70
70
  export { getNiceStringDateTime, getFormattedStringDate, getNiceStringDate, dayName, monthName } from './components/date_utils';
71
71
  export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, wholeAppReloader, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, navKey, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
72
72
  export { data_tick_store, // tmp
package/modal.svelte CHANGED
@@ -1,6 +1,6 @@
1
1
  <script>import { afterUpdate, onMount, tick } from "svelte";
2
2
  import Icon from "./components/icon.svelte";
3
- import { pushToolsActionsOperations, popToolsActionsOperations } from "./stores.js";
3
+ import { pushToolsActionsOperations, popToolsActionsOperations, fabHiddenDueToPopup } from "./stores.js";
4
4
  import { isDeviceSmallerThan } from "./utils";
5
5
  import { FaTimes } from "svelte-icons/fa";
6
6
  import { i18n } from "./i18n.js";
@@ -20,31 +20,15 @@ export let onCancelCallback = void 0;
20
20
  export function show(on_close_callback = void 0) {
21
21
  open = true;
22
22
  close_callback = on_close_callback;
23
- if (false) {
24
- pushToolsActionsOperations({
25
- opver: 1,
26
- operations: [
27
- {
28
- caption: "Modal",
29
- operations: [
30
- {
31
- icon: FaTimes,
32
- action: (f) => {
33
- on_cancel(void 0);
34
- },
35
- fab: "M00",
36
- tbr: "A"
37
- }
38
- ]
39
- }
40
- ]
41
- });
23
+ if (isDeviceSmallerThan("sm")) {
24
+ $fabHiddenDueToPopup = true;
42
25
  }
43
26
  }
44
27
  export function hide() {
45
28
  if (!open)
46
29
  return;
47
30
  open = false;
31
+ $fabHiddenDueToPopup = false;
48
32
  }
49
33
  let root;
50
34
  afterUpdate(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
package/stores.d.ts CHANGED
@@ -52,4 +52,5 @@ export const visible_property_tab_store: import("svelte/store").Writable<string>
52
52
  export const fabCollapsed: import("svelte/store").Writable<any>;
53
53
  export const showFABAlways: import("svelte/store").Writable<any>;
54
54
  export const leftHandedFAB: import("svelte/store").Writable<any>;
55
+ export const fabHiddenDueToPopup: import("svelte/store").Writable<boolean>;
55
56
  export const navKey: import("svelte/store").Readable<any>;
package/stores.js CHANGED
@@ -168,6 +168,8 @@ showFABAlways.subscribe( (value) => { localStorage.showFABAlways = (value ? 'tru
168
168
  export const leftHandedFAB = writable( (localStorage.leftHandedFAB && localStorage.leftHandedFAB == 'true') || false )
169
169
  leftHandedFAB.subscribe( (value) => { localStorage.leftHandedFAB = (value ? 'true' : '') } );
170
170
 
171
+ export const fabHiddenDueToPopup = writable(false)
172
+
171
173
  export function restore_defults()
172
174
  {
173
175
 
package/utils.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export function isDeviceSmallerThan(br: any): boolean;
2
2
  export function selectItem(itm: any): void;
3
3
  export function activateItem(context_level: any, itm: any, operations?: null): void;
4
- export function clearActiveItem(context_level: any): void;
4
+ export function clearActiveItem(context_level: any, operations?: undefined): void;
5
5
  export function addActiveItem(context_level: any, itm: any, operations?: null): void;
6
6
  export function removeActiveItem(context_level: any, itm: any, operations?: null): void;
7
7
  export function isSelected(itm: any): boolean;
@@ -9,6 +9,7 @@ export function isActive(context_level: any, itm: any, key?: undefined): boolean
9
9
  export function getActive(context_level: any): any;
10
10
  export function getActiveItems(context_level: any): any[];
11
11
  export function getActiveCount(context_level: any): number;
12
+ export function reloadPageToolbarOperations(operations: any): void;
12
13
  export function refreshToolbarOperations(): void;
13
14
  export function editable(node: any, params: any): {
14
15
  destroy(): void;
package/utils.js CHANGED
@@ -55,14 +55,19 @@ export function activateItem(context_level, itm, operations=null)
55
55
 
56
56
  if(operations && context_level == 'props')
57
57
  {
58
- if(Array.isArray(operations))
58
+ if(typeof operations === 'function')
59
+ {
60
+ const calculatedOps = operations([itm])
61
+ contextToolbarOperations.set(calculatedOps)
62
+ }
63
+ else if(Array.isArray(operations))
59
64
  contextToolbarOperations.set( [...operations] )
60
65
  else
61
66
  contextToolbarOperations.set( {...operations} )
62
67
  }
63
68
  }
64
69
 
65
- export function clearActiveItem(context_level)
70
+ export function clearActiveItem(context_level, operations=undefined)
66
71
  {
67
72
  let data_context = get(contextItemsStore);
68
73
  data_context[context_level] = null;
@@ -78,7 +83,22 @@ export function clearActiveItem(context_level)
78
83
  //chnages.just_changed_context = true;
79
84
 
80
85
  if(context_level == 'props')
81
- contextToolbarOperations.set( [] )
86
+ {
87
+ if(operations)
88
+ {
89
+ if(typeof operations === 'function')
90
+ {
91
+ const calculatedOps = operations([])
92
+ contextToolbarOperations.set(calculatedOps)
93
+ }
94
+ else if(Array.isArray(operations))
95
+ contextToolbarOperations.set( [...operations] )
96
+ else
97
+ contextToolbarOperations.set( {...operations} )
98
+ }
99
+ else
100
+ contextToolbarOperations.set( [] )
101
+ }
82
102
  }
83
103
 
84
104
  export function addActiveItem(context_level, itm, operations = null)
@@ -257,6 +277,10 @@ export function getActiveCount(context_level)
257
277
  return 1
258
278
  }
259
279
 
280
+ export function reloadPageToolbarOperations(operations)
281
+ {
282
+ pageToolbarOperations.set(operations)
283
+ }
260
284
 
261
285
  export function refreshToolbarOperations()
262
286
  {