@humandialog/forms.svelte 1.4.6 → 1.4.8

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/index.d.ts CHANGED
@@ -59,11 +59,11 @@ export { default as KanbanCallbacks } from './components/kanban/kanban.callbacks
59
59
  export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban';
60
60
  export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, } from './utils';
61
61
  export { getNiceStringDateTime, getFormattedStringDate, getNiceStringDate, dayName, monthName } from './components/date_utils';
62
- export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, tagsReloader, reloadVisibleTags, dark_mode_store } from './stores.js';
62
+ export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
63
63
  export { data_tick_store, // tmp
64
64
  hasSelectedItem, hasDataItem, setNavigatorTitle } from "./stores";
65
65
  export { contextToolbarOperations, pageToolbarOperations, contextItemsStore, contextTypesStore } from './stores';
66
- export { informModification, informModificationEx, informItem, pushChanges } from './updates';
66
+ export { informModification, informModificationEx, informItem, pushChanges, hasModifications } from './updates';
67
67
  export { default as IcH1 } from './components/document/internal/h1.icon.svelte';
68
68
  export { default as IcH2 } from './components/document/internal/h2.icon.svelte';
69
69
  export { default as IcH3 } from './components/document/internal/h3.icon.svelte';
package/index.js CHANGED
@@ -65,11 +65,11 @@ export { default as KanbanCallbacks } from './components/kanban/kanban.callbacks
65
65
  export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban';
66
66
  export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan, resizeImage, refreshToolbarOperations, isOnScreenKeyboardVisible, randomString, UI, } from './utils';
67
67
  export { getNiceStringDateTime, getFormattedStringDate, getNiceStringDate, dayName, monthName } from './components/date_utils';
68
- export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, tagsReloader, reloadVisibleTags, dark_mode_store } from './stores.js';
68
+ export { mainContentPageReloader, reloadMainContentPage, reloadWholeApp, alerts, addAlert, onErrorShowAlert, main_sidebar_visible_store, tagsReloader, reloadVisibleTags, dark_mode_store, showFABAlways } from './stores.js';
69
69
  export { data_tick_store, // tmp
70
70
  hasSelectedItem, hasDataItem, setNavigatorTitle } from "./stores";
71
71
  export { contextToolbarOperations, pageToolbarOperations, contextItemsStore, contextTypesStore } from './stores'; // tmp
72
- export { informModification, informModificationEx, informItem, pushChanges } from './updates'; // tmp
72
+ export { informModification, informModificationEx, informItem, pushChanges, hasModifications } from './updates'; // tmp
73
73
  export { default as IcH1 } from './components/document/internal/h1.icon.svelte';
74
74
  export { default as IcH2 } from './components/document/internal/h2.icon.svelte';
75
75
  export { default as IcH3 } from './components/document/internal/h3.icon.svelte';
package/modal.svelte CHANGED
@@ -19,7 +19,7 @@ export let onCancelCallback = void 0;
19
19
  export function show(on_close_callback = void 0) {
20
20
  open = true;
21
21
  close_callback = on_close_callback;
22
- if (isDeviceSmallerThan("sm")) {
22
+ if (false) {
23
23
  pushToolsActionsOperations({
24
24
  opver: 1,
25
25
  operations: [
@@ -44,7 +44,6 @@ export function hide() {
44
44
  if (!open)
45
45
  return;
46
46
  open = false;
47
- popToolsActionsOperations();
48
47
  }
49
48
  let root;
50
49
  afterUpdate(
@@ -75,7 +74,7 @@ function on_cancel(event) {
75
74
  </script>
76
75
 
77
76
  {#if open}
78
- <div class="relative z-20" aria-labelledby="modal-title" role="dialog" aria-modal="true" bind:this={root}>
77
+ <div class="relative z-30" aria-labelledby="modal-title" role="dialog" aria-modal="true" bind:this={root}>
79
78
  <!--
80
79
  Background backdrop, show/hide based on modal state.
81
80
 
@@ -88,7 +87,7 @@ function on_cancel(event) {
88
87
  -->
89
88
  <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>
90
89
 
91
- <div class="fixed z-20 inset-0 w-screen overflow-y-auto">
90
+ <div class="fixed z-30 inset-0 w-screen overflow-y-auto">
92
91
  <div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
93
92
  <!--
94
93
  Modal panel, show/hide based on modal state.
@@ -107,7 +106,7 @@ function on_cancel(event) {
107
106
  <div class="sm:flex sm:items-start">
108
107
  <div class="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
109
108
  {#if icon}
110
- <Icon component={icon} size={6} class="text-stone-700"/>
109
+ <Icon component={icon} s="2xl" class="text-stone-700"/>
111
110
  {/if}
112
111
  </div>
113
112
  <div class="grow mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "type": "module",
28
28
  "dependencies": {
29
- "@humandialog/auth.svelte": "^1.8.10",
29
+ "@humandialog/auth.svelte": "^1.8.12",
30
30
  "@tiptap/core": "^2.11.0",
31
31
  "@tiptap/extension-bullet-list": "^2.11.5",
32
32
  "@tiptap/extension-code-block": "^2.11.5",
@@ -143,6 +143,7 @@
143
143
  "./components/table/table": "./components/table/table.js",
144
144
  "./components/tag.colors.svelte": "./components/tag.colors.svelte",
145
145
  "./components/tag.svelte": "./components/tag.svelte",
146
+ "./components/tags.palette.svelte": "./components/tags.palette.svelte",
146
147
  "./components/tags.svelte": "./components/tags.svelte",
147
148
  "./components/textarea.ltop.svelte": "./components/textarea.ltop.svelte",
148
149
  "./components/tile.title.svelte": "./components/tile.title.svelte",
package/stores.d.ts CHANGED
@@ -48,3 +48,6 @@ export const tools_visible_store: import("svelte/store").Writable<any>;
48
48
  export const bottom_bar_visible_store: import("svelte/store").Writable<any>;
49
49
  export const right_sidebar_visible_store: import("svelte/store").Writable<boolean>;
50
50
  export const visible_property_tab_store: import("svelte/store").Writable<string>;
51
+ export const fabCollapsed: import("svelte/store").Writable<any>;
52
+ export const showFABAlways: import("svelte/store").Writable<any>;
53
+ export const leftHandedFAB: import("svelte/store").Writable<any>;
package/stores.js CHANGED
@@ -157,6 +157,15 @@ bottom_bar_visible_store.subscribe( (value) => { localStorage.bottom_bar_visible
157
157
  export const right_sidebar_visible_store = writable(false)
158
158
  export const visible_property_tab_store = writable('');
159
159
 
160
+ export const fabCollapsed = writable( (localStorage.fabCollapsed && localStorage.fabCollapsed == 'true') || false )
161
+ fabCollapsed.subscribe( (value) => { localStorage.fabCollapsed = (value ? 'true' : '') } );
162
+
163
+ export const showFABAlways = writable( (localStorage.showFABAlways && localStorage.showFABAlways == 'true') || false )
164
+ showFABAlways.subscribe( (value) => { localStorage.showFABAlways = (value ? 'true' : '') } );
165
+
166
+ export const leftHandedFAB = writable( (localStorage.leftHandedFAB && localStorage.leftHandedFAB == 'true') || false )
167
+ leftHandedFAB.subscribe( (value) => { localStorage.leftHandedFAB = (value ? 'true' : '') } );
168
+
160
169
  export function restore_defults()
161
170
  {
162
171
 
@@ -165,6 +174,9 @@ export function restore_defults()
165
174
  bottom_bar_visible_store.set(false);
166
175
  right_sidebar_visible_store.set(false);
167
176
  visible_property_tab_store.set('');
177
+ fabCollapsed.set(false)
178
+ showFABAlways.set(false)
179
+ leftHandedFAB.set(false)
168
180
  }
169
181
 
170
182
  export function toggle_sidebar(index)
@@ -776,7 +776,7 @@
776
776
  <!--Checkbox class="mt-2 text-xs font-normal" self={new_user} a="maintainer">
777
777
  <div class="flex flex-row items-center">
778
778
  <span class="">Maintainer</span>
779
- <Icon id="b1" size={4} component={FaInfoCircle} class="text-stone-400 ml-5 pt-0 mt-1"/>
779
+ <Icon id="b1" s="md" component={FaInfoCircle} class="text-stone-400 ml-5 pt-0 mt-1"/>
780
780
  <Popover class="w-64 text-sm font-light text-stone-500 bg-white dark:bg-stone-800 dark:border-stone-600 dark:text-stone-400" triggeredBy="#b1" color="dropdown">
781
781
  Means that the invited user will be able to add/remove others and manage permissions in this organization.
782
782
  </Popover>
package/updates.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export function informModification(itm: any, field_name: any, type_name?: undefined): boolean;
2
2
  export function informModificationEx(typeName: any, itemId: any, attribName: any, attribValue: any): boolean;
3
+ export function hasModifications(): boolean;
3
4
  export function informItem(itm: any, type_name?: undefined): boolean;
4
- export function pushChanges(): void;
5
+ export function pushChanges(afterPushCallback?: undefined): void;
package/updates.js CHANGED
@@ -51,6 +51,12 @@ export function informModificationEx(typeName, itemId, attribName, attribValue)
51
51
  return true;
52
52
  }
53
53
 
54
+ export function hasModifications()
55
+ {
56
+ //console.log('hasModifications', modified_items_map.size)
57
+ return modified_items_map.size > 0
58
+ }
59
+
54
60
  export function informItem(itm, type_name=undefined)
55
61
  {
56
62
  if(type_name == undefined)
@@ -81,8 +87,15 @@ export function informItem(itm, type_name=undefined)
81
87
 
82
88
  const update_request_ticket = writable(0);
83
89
  let last_update_ticket = 0;
84
- export function pushChanges()
90
+ let afterPushCallbacks = []
91
+
92
+ export function pushChanges(afterPushCallback=undefined)
85
93
  {
94
+ //console.trace()
95
+
96
+ if(afterPushCallback)
97
+ afterPushCallbacks.push(afterPushCallback);
98
+
86
99
  update_request_ticket.update(n => n + 1);
87
100
  }
88
101
 
@@ -140,13 +153,18 @@ update_request_ticket.subscribe(async (v) => {
140
153
  body: JSON.stringify( { Items: changes } )
141
154
  })
142
155
  if (res.ok) {
156
+
143
157
  modified_items_map.clear();
158
+ afterPushCallbacks.forEach( cb => cb())
159
+ afterPushCallbacks = []
144
160
  }
145
161
  else
146
162
  {
147
163
  if(res.status == 400) // basic exception like access rights
148
164
  {
149
165
  modified_items_map.clear();
166
+ afterPushCallbacks.forEach( cb => cb())
167
+ afterPushCallbacks = []
150
168
  }
151
169
 
152
170
  const err = await res.text()
package/utils.js CHANGED
@@ -84,21 +84,32 @@ export function clearActiveItem(context_level)
84
84
 
85
85
  export function refreshToolbarOperations()
86
86
  {
87
+
88
+ let refreshed = false
89
+
87
90
  const contextOperations = get(contextToolbarOperations)
88
91
  if(contextOperations)
89
92
  {
93
+
90
94
  if(Array.isArray(contextOperations))
91
95
  {
92
- if(contextOperations.length)
96
+ if(contextOperations.length > 0)
97
+ {
93
98
  contextToolbarOperations.set([...contextOperations])
99
+ refreshed = true
100
+ }
94
101
  }
95
102
  else
96
103
  {
97
- if(contextOperations.operations.length)
104
+ if(contextOperations.operations && contextOperations.operations.length > 0)
105
+ {
98
106
  contextToolbarOperations.set({...contextOperations})
107
+ refreshed = true
108
+ }
99
109
  }
100
110
  }
101
- else
111
+
112
+ if(!refreshed)
102
113
  {
103
114
  const pageOperations = get(pageToolbarOperations);
104
115
  if(pageOperations)
@@ -108,6 +119,7 @@ export function refreshToolbarOperations()
108
119
  if(pageOperations.length > 0)
109
120
  {
110
121
  pageToolbarOperations.set([...pageOperations])
122
+ refreshed = true
111
123
  }
112
124
  }
113
125
  else
@@ -115,6 +127,7 @@ export function refreshToolbarOperations()
115
127
  if(pageOperations.operations && pageOperations.operations.length > 0)
116
128
  {
117
129
  pageToolbarOperations.set({...pageOperations})
130
+ refreshed = true
118
131
  }
119
132
  }
120
133
  }
@@ -159,6 +172,7 @@ export function editable(node, params)
159
172
  let onRemove = undefined;
160
173
  let onFinish = undefined;
161
174
  let onSoftEnter = undefined;
175
+ let onSingleChange = undefined
162
176
  if(params instanceof Object)
163
177
  {
164
178
  action = params.action ?? params;
@@ -166,6 +180,7 @@ export function editable(node, params)
166
180
  onRemove = params.remove ?? undefined
167
181
  onFinish = params.onFinish ?? undefined
168
182
  onSoftEnter = params.onSoftEnter ?? undefined;
183
+ onSingleChange = params.onSingleChange ?? undefined
169
184
 
170
185
  if(params.readonly)
171
186
  return;
@@ -323,7 +338,12 @@ export function editable(node, params)
323
338
  currentEditable = node;
324
339
  node.addEventListener("save", save_listener)
325
340
 
326
- observer = new MutationObserver(() => { has_changed = true; });
341
+ observer = new MutationObserver(() => {
342
+ has_changed = true;
343
+ if(onSingleChange)
344
+ onSingleChange(node.textContent)
345
+ });
346
+
327
347
  observer.observe( node, {
328
348
  childList: true,
329
349
  attributes: true,
@@ -19,13 +19,15 @@
19
19
  context_info_store,
20
20
  contextToolbarOperations,
21
21
  data_tick_store,
22
- reloadWholeApp
22
+ reloadWholeApp,
23
+ showFABAlways,
24
+ leftHandedFAB
23
25
  } from "./stores.js";
24
26
  import Icon from './components/icon.svelte';
25
27
  import {session, signInHRef, signOutHRef} from '@humandialog/auth.svelte'
26
28
  import { pop, push } from 'svelte-spa-router';
27
29
  import { tick } from 'svelte';
28
- import { popNavigationPage } from './utils';
30
+ import { isDeviceSmallerThan, popNavigationPage } from './utils';
29
31
 
30
32
 
31
33
  export let appConfig = undefined;
@@ -218,6 +220,22 @@
218
220
  });
219
221
  }
220
222
 
223
+ if(!isDeviceSmallerThan("sm"))
224
+ {
225
+ options.push({
226
+ caption: 'Floating actions',
227
+ icon: $showFABAlways ? FaToggleOn : FaToggleOff,
228
+ action: (f) => { $showFABAlways = !$showFABAlways; }
229
+ })
230
+
231
+ options.push({
232
+ caption: 'Left-handed floating actions',
233
+ icon: $leftHandedFAB ? FaToggleOn : FaToggleOff,
234
+ disabled: !$showFABAlways,
235
+ action: (f) => { $leftHandedFAB = !$leftHandedFAB; }
236
+ })
237
+ }
238
+
221
239
  if(has_selection_details)
222
240
  {
223
241
  options.push( {
@@ -361,7 +379,7 @@
361
379
  class:bg-orange-500={isSelected}
362
380
  on:click={tab.onclick}>
363
381
 
364
- <Icon class="w-5 h-5" component={tab.icon}/>
382
+ <Icon s="xl" component={tab.icon}/>
365
383
  </button>
366
384
  {/each}
367
385
  </div>
@@ -373,7 +391,7 @@
373
391
  {#if show_groups_switch_menu}
374
392
  <button class="h-12 px-0 flex justify-center items-center w-full text-stone-300 hover:text-stone-100"
375
393
  on:click|stopPropagation={show_groups}>
376
- <Icon size={4} component={FaUsers} />
394
+ <Icon s="md" component={FaUsers} />
377
395
  </button>
378
396
  {/if}
379
397
 
@@ -381,7 +399,7 @@
381
399
  class="h-12 px-0 flex justify-center items-center w-full text-stone-300 hover:text-stone-100"
382
400
  on:click|stopPropagation={show_options}>
383
401
 
384
- <Icon size={4} component={FaCog} />
402
+ <Icon s="md" component={FaCog} />
385
403
  </button>
386
404
 
387
405
  </div>