@humandialog/forms.svelte 1.3.10 → 1.3.12

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.
@@ -284,21 +284,30 @@
284
284
 
285
285
  }
286
286
 
287
- let page_operations=[
288
- {
289
- icon: FaUserPlus,
290
- caption: '',
291
- action: (focused) => { create_new_user(); }
292
- },
293
- {
294
- separator: true
295
- },
296
- {
297
- icon: FaUserSlash,
298
- caption: '',
299
- action: (f) => {askToDeleteApplicationAccount();}
300
- }
301
- ]
287
+ let page_operations={
288
+ opver: 1,
289
+ operations: [
290
+ {
291
+ caption: 'View',
292
+ operations: [
293
+ {
294
+ icon: FaUserPlus,
295
+ caption: '',
296
+ action: (focused) => { create_new_user(); },
297
+ fab: 'M10',
298
+ tbr: 'A'
299
+ },
300
+ {
301
+ icon: FaUserSlash,
302
+ caption: '',
303
+ action: (f) => {askToDeleteApplicationAccount();},
304
+ fab: 'S00',
305
+ tbr: 'C'
306
+ }
307
+ ]
308
+ }
309
+ ]
310
+ }
302
311
 
303
312
  function get_edit_operations(user)
304
313
  {
@@ -340,39 +349,60 @@
340
349
  let operations = [];
341
350
 
342
351
  if(user.removed)
343
- return [
344
- {
345
- icon: FaUserPlus,
346
- caption: '',
347
- action: (f) => askToAddAgain(user),
348
- }
349
- ];
350
-
351
- let edit_operations = get_edit_operations(user)
352
- if(edit_operations.length == 1)
353
352
  {
354
- operations.push({
355
- icon: FaPen,
356
- caption: '',
357
- action: edit_operations[0].action
358
- });
353
+ operations = [
354
+ {
355
+ icon: FaUserPlus,
356
+ caption: '',
357
+ action: (f) => askToAddAgain(user),
358
+ fab: 'M10',
359
+ tbr: 'B'
360
+ }
361
+ ];
359
362
  }
360
363
  else
361
364
  {
365
+ let edit_operations = get_edit_operations(user)
366
+ if(edit_operations.length == 1)
367
+ {
368
+ operations.push({
369
+ icon: FaPen,
370
+ caption: '',
371
+ action: edit_operations[0].action,
372
+ fab: 'M20',
373
+ tbr: 'B'
374
+ });
375
+ }
376
+ else
377
+ {
378
+ operations.push({
379
+ icon: FaPen,
380
+ caption: '',
381
+ grid: edit_operations,
382
+ fab: 'M20',
383
+ tbr: 'B'
384
+ });
385
+ }
386
+
362
387
  operations.push({
363
- icon: FaPen,
364
388
  caption: '',
365
- grid: edit_operations
389
+ icon: FaUserMinus,
390
+ action: (focused) => askToRemove(user),
391
+ fab: 'M30',
392
+ tbr: 'B'
366
393
  });
367
394
  }
368
395
 
369
- operations.push({
370
- caption: '',
371
- icon: FaUserMinus,
372
- action: (focused) => askToRemove(user)
373
- });
374
-
375
- return operations;
396
+
397
+ return {
398
+ opver: 1,
399
+ operations: [
400
+ {
401
+ caption: 'User',
402
+ operations: operations
403
+ }
404
+ ]
405
+ }
376
406
  }
377
407
 
378
408
  let user_context_menu = (user) => {
package/updates.js CHANGED
@@ -122,14 +122,41 @@ update_request_ticket.subscribe(async (v) => {
122
122
  changes.push(value.item);
123
123
  });
124
124
 
125
-
126
- //console.log('push: ', changes);
125
+ /*
127
126
  const res = await reef.post('/Push', { Items: changes }, onErrorShowAlert);
128
127
 
129
128
  //if(res)
130
129
  //{
131
130
  modified_items_map.clear();
132
131
  //}
132
+ */
133
+
134
+ let path = reef.correct_path_with_api_version_if_needed('/Push')
135
+
136
+ try {
137
+ let res = await reef.fetch(path, {
138
+ method: 'POST',
139
+ body: JSON.stringify( { Items: changes } )
140
+ })
141
+ if (res.ok) {
142
+ modified_items_map.clear();
143
+ }
144
+ else
145
+ {
146
+ if(res.status == 400) // basic exception like access rights
147
+ {
148
+ modified_items_map.clear();
149
+ }
150
+
151
+ const err = await res.text()
152
+ console.error(err)
153
+ onErrorShowAlert(err)
154
+ }
155
+ }
156
+ catch (err) {
157
+ console.error(err);
158
+ onErrorShowAlert(err)
159
+ }
133
160
 
134
161
  }
135
162
  })
package/utils.js CHANGED
@@ -56,8 +56,13 @@ export function activateItem(context_level, itm, operations=null)
56
56
 
57
57
  //chnages.just_changed_context = true;
58
58
 
59
- if(operations && Array.isArray(operations))
60
- contextToolbarOperations.set( [...operations] )
59
+ if(operations)
60
+ {
61
+ if(Array.isArray(operations))
62
+ contextToolbarOperations.set( [...operations] )
63
+ else
64
+ contextToolbarOperations.set( {...operations} )
65
+ }
61
66
  }
62
67
 
63
68
  export function clearActiveItem(context_level)
@@ -80,16 +85,40 @@ export function clearActiveItem(context_level)
80
85
  export function refreshToolbarOperations()
81
86
  {
82
87
  const contextOperations = get(contextToolbarOperations)
83
- if(contextOperations && contextOperations.length)
88
+ if(contextOperations)
84
89
  {
85
- contextToolbarOperations.set([...contextOperations])
86
-
90
+ if(Array.isArray(contextOperations))
91
+ {
92
+ if(contextOperations.length)
93
+ contextToolbarOperations.set([...contextOperations])
94
+ }
95
+ else
96
+ {
97
+ if(contextOperations.operations.length)
98
+ contextToolbarOperations.set({...contextOperations})
99
+ }
87
100
  }
88
101
  else
89
102
  {
90
103
  const pageOperations = get(pageToolbarOperations);
91
- if(pageOperations && pageOperations.length)
92
- pageToolbarOperations.set([...pageOperations])
104
+ if(pageOperations)
105
+ {
106
+ if(Array.isArray(pageOperations))
107
+ {
108
+ if(pageOperations.length > 0)
109
+ {
110
+ pageToolbarOperations.set([...pageOperations])
111
+ }
112
+ }
113
+ else
114
+ {
115
+ if(pageOperations.operations && pageOperations.operations.length > 0)
116
+ {
117
+ pageToolbarOperations.set({...pageOperations})
118
+ }
119
+ }
120
+ }
121
+
93
122
  }
94
123
  }
95
124
 
@@ -609,7 +638,7 @@ export function isOnScreenKeyboardVisible()
609
638
 
610
639
  const sel = window.getSelection();
611
640
  // if we have active selections then it's very possible we have onscreen keyboard visible, se we need to shrink window.innerHeight
612
- if(sel && sel.rangeCount>0 && sel.focusNode && sel.focusNode.nodeType==sel.focusNode.TEXT_NODE)
641
+ if(sel && sel.rangeCount>0 && sel.focusNode /*&& sel.focusNode.nodeType==sel.focusNode.TEXT_NODE*/) // TipTap fix: when cursor blinks at begining of line it's not TEXT_NODE. ProseMirror handles it as special case
613
642
  {
614
643
  const el = sel.focusNode.parentElement;
615
644
  if(el && (el.isContentEditable || el.contentEditable == 'true' || el.tagName == 'INPUT'))
@@ -333,7 +333,7 @@
333
333
  class:bg-orange-500={isSelected}
334
334
  on:click|stopPropagation={()=> (on_tab_clicked(tab.key))}>
335
335
 
336
- <Icon size={6} component={tab.icon}/>
336
+ <Icon class="w-5 h-5" component={tab.icon}/>
337
337
  </button>
338
338
  {/each}
339
339
  </div>