@humandialog/forms.svelte 1.3.17 → 1.4.1

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.
Files changed (43) hide show
  1. package/components/Fab.svelte +99 -48
  2. package/components/combo/combo.svelte +18 -15
  3. package/components/combo/combo.svelte.d.ts +1 -0
  4. package/components/contextmenu.svelte +54 -16
  5. package/components/date.svelte +10 -4
  6. package/components/date.svelte.d.ts +1 -0
  7. package/components/date_utils.d.ts +1 -0
  8. package/components/date_utils.js +10 -0
  9. package/components/delayed.spinner.svelte +1 -2
  10. package/components/document/editor.svelte +419 -46
  11. package/components/document/editor.svelte.d.ts +115 -0
  12. package/components/document/internal/palette.svelte +22 -0
  13. package/components/kanban/internal/kanban.card.svelte +2 -2
  14. package/components/kanban/internal/kanban.props.svelte +1 -1
  15. package/components/list/List.d.ts +6 -0
  16. package/components/list/List.js +6 -0
  17. package/components/list/internal/list.element.props.svelte +23 -8
  18. package/components/list/internal/list.element.svelte +20 -8
  19. package/components/list/list.combo.svelte +6 -0
  20. package/components/list/list.combo.svelte.d.ts +3 -0
  21. package/components/list/list.date.svelte +8 -0
  22. package/components/list/list.date.svelte.d.ts +4 -0
  23. package/components/list/list.static.svelte +6 -0
  24. package/components/list/list.static.svelte.d.ts +3 -0
  25. package/components/list/list.tags.svelte +32 -0
  26. package/components/list/list.tags.svelte.d.ts +24 -0
  27. package/components/menu.js +4 -0
  28. package/components/sidebar/sidebar.item.svelte +15 -11
  29. package/components/tags.svelte +15 -7
  30. package/components/tags.svelte.d.ts +2 -0
  31. package/desk.svelte +5 -5
  32. package/horizontal.toolbar.svelte +41 -14
  33. package/horizontal.toolbar.svelte.d.ts +6 -2
  34. package/index.d.ts +8 -2
  35. package/index.js +8 -2
  36. package/operations.svelte +71 -19
  37. package/package.json +4 -2
  38. package/stores.d.ts +3 -0
  39. package/stores.js +25 -2
  40. package/tenant.members.svelte +63 -59
  41. package/tenant.members.svelte.d.ts +2 -0
  42. package/vertical.toolbar.svelte +51 -23
  43. package/vertical.toolbar.svelte.d.ts +6 -2
@@ -1,7 +1,8 @@
1
1
  <script>import { each } from "svelte/internal";
2
2
  import { contextToolbarOperations, pageToolbarOperations, contextItemsStore, toolsActionsOperations } from "../stores.js";
3
3
  import { showFloatingToolbar, showMenu, showGridMenu } from "./menu.js";
4
- import { FaChevronUp, FaChevronDown, FaChevronLeft, FaChevronRight, FaCircle } from "svelte-icons/fa/";
4
+ import { FaChevronUp, FaChevronDown, FaChevronLeft, FaChevronRight, FaCircle, FaEllipsisV } from "svelte-icons/fa/";
5
+ import { isDeviceSmallerThan } from "../utils.js";
5
6
  $:
6
7
  setupCurrentContextOperations($pageToolbarOperations, $contextToolbarOperations, $toolsActionsOperations);
7
8
  let operations = [];
@@ -13,49 +14,96 @@ let vToolboxExpanded = false;
13
14
  let hToolboxExpanded = false;
14
15
  let isDirectPositioningMode = false;
15
16
  function setupCurrentContextOperations(...args) {
17
+ let opVer = 0;
18
+ let main_FAB_position = "";
16
19
  isDirectPositioningMode = false;
17
20
  if ($toolsActionsOperations && Array.isArray($toolsActionsOperations) && toolsActionsOperations.length > 0) {
18
21
  operations = $toolsActionsOperations;
19
22
  } else if ($toolsActionsOperations && $toolsActionsOperations.operations && $toolsActionsOperations.operations.length > 0) {
20
23
  operations = $toolsActionsOperations.operations;
21
- if ($toolsActionsOperations.opver && $toolsActionsOperations.opver == 1)
24
+ opVer = $toolsActionsOperations.opver ?? 0;
25
+ main_FAB_position = $toolsActionsOperations.fab ?? "";
26
+ if (opVer > 0)
22
27
  isDirectPositioningMode = true;
23
28
  } else if ($contextToolbarOperations && Array.isArray($contextToolbarOperations) && $contextToolbarOperations.length > 0) {
24
29
  operations = $contextToolbarOperations;
25
30
  } else if ($contextToolbarOperations && $contextToolbarOperations.operations && $contextToolbarOperations.operations.length > 0) {
26
31
  operations = $contextToolbarOperations.operations;
27
- if ($contextToolbarOperations.opver && $contextToolbarOperations.opver == 1)
32
+ opVer = $contextToolbarOperations.opver ?? 0;
33
+ main_FAB_position = $contextToolbarOperations.fab ?? "";
34
+ if (opVer > 0)
28
35
  isDirectPositioningMode = true;
29
36
  } else {
30
37
  if (Array.isArray($pageToolbarOperations))
31
38
  operations = $pageToolbarOperations;
32
39
  else {
33
40
  operations = $pageToolbarOperations.operations;
34
- if ($pageToolbarOperations.opver && $pageToolbarOperations.opver == 1)
41
+ opVer = $pageToolbarOperations.opver ?? 0;
42
+ main_FAB_position = $pageToolbarOperations.fab ?? "";
43
+ if (opVer > 0)
35
44
  isDirectPositioningMode = true;
36
45
  }
37
46
  }
38
- if (isDirectPositioningMode)
39
- return;
40
- if (operations.length > 0)
41
- mainOperation = operations[0];
42
- else
43
- mainOperation = null;
44
- secondaryOperation = null;
45
- toolboxOperations = [];
46
- if (operations.length > 1) {
47
- const operation = operations[1];
48
- if (!operation.separator) {
49
- if (!operation.toolbox)
50
- secondaryOperation = operation;
51
- else
52
- toolboxOperations = operation.toolbox;
47
+ if (opVer == 1) {
48
+ let flatOperations = [];
49
+ operations.forEach((group) => {
50
+ flatOperations = [...flatOperations, ...group.operations];
51
+ });
52
+ operations = flatOperations;
53
+ } else if (opVer == 2) {
54
+ const definedOperations = [...operations];
55
+ if (main_FAB_position) {
56
+ let flatOperations = [];
57
+ definedOperations.forEach((group) => {
58
+ flatOperations.push({
59
+ caption: group.caption,
60
+ separator: true
61
+ });
62
+ flatOperations = [...flatOperations, ...group.operations];
63
+ });
64
+ const realOps = flatOperations.filter((el) => !!el.separator == false);
65
+ if (realOps.length > 1) {
66
+ mainOperation = {
67
+ icon: FaEllipsisV,
68
+ menu: flatOperations,
69
+ fab: main_FAB_position
70
+ };
71
+ operations = [mainOperation];
72
+ } else if (realOps.length == 1) {
73
+ mainOperation = realOps[0];
74
+ mainOperation["fab"] = main_FAB_position;
75
+ operations = [mainOperation];
76
+ } else
77
+ operations = [];
78
+ }
79
+ definedOperations.forEach((group) => {
80
+ group.operations.forEach((op) => {
81
+ if (op.fab) {
82
+ operations = [...operations, op];
83
+ }
84
+ });
85
+ });
86
+ } else {
87
+ if (operations.length > 0)
88
+ mainOperation = operations[0];
89
+ else
90
+ mainOperation = null;
91
+ secondaryOperation = null;
92
+ toolboxOperations = [];
93
+ if (operations.length > 1) {
94
+ const operation = operations[1];
95
+ if (!operation.separator) {
96
+ if (!operation.toolbox)
97
+ secondaryOperation = operation;
98
+ else
99
+ toolboxOperations = operation.toolbox;
100
+ }
53
101
  }
102
+ if (operations.length == 3 && secondaryOperation != null || operations.length > 3 || toolboxOperations.length > 0)
103
+ isExpandable = true;
104
+ else
105
+ isExpandable = false;
54
106
  }
55
- if (operations.length == 3 && secondaryOperation != null || operations.length > 3 || toolboxOperations.length > 0)
56
- isExpandable = true;
57
- else
58
- isExpandable = false;
59
107
  }
60
108
  export function activateMainOperation() {
61
109
  const mainOperationButton = document.getElementById("__hd_fab_mainOperation");
@@ -69,6 +117,8 @@ function on_click(e, operation) {
69
117
  let owner = e.target;
70
118
  while (owner && (owner.tagName != "BUTTON" && owner.tagName != "LI"))
71
119
  owner = owner.parentElement;
120
+ if (operation.preAction)
121
+ operation.preAction(owner);
72
122
  if (operation.action) {
73
123
  operation.action(owner);
74
124
  }
@@ -80,12 +130,17 @@ function on_click(e, operation) {
80
130
  rect.y -= margin;
81
131
  rect.width += 2 * margin;
82
132
  rect.height += 2 * margin;
133
+ const mobile = isDeviceSmallerThan("sm");
83
134
  if (operation.menu)
84
135
  showMenu(rect, operation.menu);
85
136
  else if (operation.toolbar)
86
137
  showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
87
- else if (operation.grid)
88
- showMenu(rect, operation.grid);
138
+ else if (operation.grid) {
139
+ if (mobile)
140
+ showMenu(rect, operation.grid);
141
+ else
142
+ showGridMenu(rect, operation.grid);
143
+ }
89
144
  }
90
145
  function toggleExpandToolboxV(e) {
91
146
  vToolboxExpanded = !vToolboxExpanded;
@@ -178,29 +233,25 @@ function operationVisible(operation) {
178
233
 
179
234
  {#if isDirectPositioningMode}
180
235
  {#if operations && operations.length > 0}
181
- {#each operations as group}
182
- {#if group.operations && group.operations.length > 0}
183
- {#each group.operations as operation}
184
- {#if operationVisible(operation)}
185
- {@const position = calculatePosition(operation)}
186
- {#if position}
187
- <button
188
- class="text-white bg-blue-700/70 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
189
- font-medium rounded-full text-sm text-center shadow-md
190
- w-[35px] h-[35px]
191
- fixed m-0
192
- dark:bg-blue-600/50 dark:hover:bg-blue-700 dark:focus:ring-blue-800
193
- flex items-center justify-center
194
- disable-dbl-tap-zoom
195
- cursor-pointer z-40"
196
- style={position}
197
- on:click|stopPropagation={(e) => {on_click(e, operation)}}
198
- on:mousedown={mousedown} >
199
- <div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
200
- </button>
201
- {/if}
202
- {/if}
203
- {/each}
236
+ {#each operations as operation}
237
+ {#if operationVisible(operation)}
238
+ {@const position = calculatePosition(operation)}
239
+ {#if position}
240
+ <button
241
+ class="text-white bg-blue-700/70 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
242
+ font-medium rounded-full text-sm text-center shadow-md
243
+ w-[35px] h-[35px]
244
+ fixed m-0
245
+ dark:bg-blue-600/50 dark:hover:bg-blue-700 dark:focus:ring-blue-800
246
+ flex items-center justify-center
247
+ disable-dbl-tap-zoom
248
+ cursor-pointer z-40"
249
+ style={position}
250
+ on:click|stopPropagation={(e) => {on_click(e, operation)}}
251
+ on:mousedown={mousedown} >
252
+ <div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
253
+ </button>
254
+ {/if}
204
255
  {/if}
205
256
  {/each}
206
257
  {/if}
@@ -27,6 +27,7 @@ export let cached = false;
27
27
  export let filtered = false;
28
28
  export let pushChangesImmediately = true;
29
29
  export let hasNone = isAssociation;
30
+ export let readOnly = false;
30
31
  let userClass = $$restProps.class ?? "";
31
32
  let is_compact = getContext("rIs-table-component") || compact;
32
33
  if (!definition) {
@@ -92,7 +93,7 @@ else
92
93
  dark:border-stone-600 dark:placeholder-stone-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500`;
93
94
  let cs = c ? parseWidthDirective(c) : "col-span-1";
94
95
  let ctx = context ? context : getContext("ctx");
95
- let can_be_activated = true;
96
+ let can_be_activated = !readOnly;
96
97
  let last_tick = -1;
97
98
  $:
98
99
  setup($data_tick_store, $contextItemsStore);
@@ -110,7 +111,9 @@ function setup(...args) {
110
111
  }
111
112
  }
112
113
  tick_request_internal = tick_request_internal + 1;
113
- if (is_compact) {
114
+ if (readOnly)
115
+ can_be_activated = false;
116
+ else if (is_compact) {
114
117
  can_be_activated = false;
115
118
  let contexts = inContext.split(" ");
116
119
  contexts.forEach((ctx2) => {
@@ -670,7 +673,8 @@ function on_focus_out(e) {
670
673
  {#if definition.source && definition.source.length}
671
674
  {#if hasNone}
672
675
  <!-- svelte-ignore a11y-click-events-have-key-events -->
673
- <li class="rounded p-2 flex flex-row items-center {font_size}"
676
+ <li class="rounded flex flex-row items-center {font_size}
677
+ space-x-10 px-4 py-2 ml-12 sm:ml-0"
674
678
  class:bg-stone-100={highlighted_option == null}
675
679
  class:dark:bg-stone-700={highlighted_option == null}
676
680
  class:dark:hover:bg-stone-700={highlighted_option == null}
@@ -678,46 +682,45 @@ function on_focus_out(e) {
678
682
  on:click|preventDefault|stopPropagation={async () => await on_choose(null)}
679
683
  tabindex="-1">
680
684
 
681
- <div class="ml-2">
685
+ <h4 class="ml-2">
682
686
  &lt;none&gt;
683
- </div>
687
+ </h4>
684
688
  </li>
685
689
  {/if}
686
690
 
687
691
  {@const _filtered_source = filtered_source ? filtered_source : definition.source}
688
692
  {#if _filtered_source.length > 0}
689
693
  {#each _filtered_source as item (item.Key)}
694
+ {@const active=(highlighted_option == item) ? 'bg-stone-400/30 dark:bg-stone-400/30' : ''}
690
695
  <!-- svelte-ignore a11y-click-events-have-key-events -->
691
- <li class="rounded p-2 flex flex-row items-center {font_size}"
692
- class:bg-stone-100={highlighted_option == item}
693
- class:dark:bg-stone-700={highlighted_option == item}
694
- class:dark:hover:bg-stone-700={highlighted_option == item}
696
+ <li class="rounded flex flex-row items-center {font_size}
697
+ space-x-10 px-4 py-2 pl-12 sm:pl-2 {active}"
695
698
  on:mousemove={() => on_mouse_move(item)}
696
699
  on:click|preventDefault|stopPropagation={async () => await on_choose(item)}
697
700
  tabindex="-1">
698
701
 
699
702
  {#if icon}
700
703
  {#if item.Color}
701
- <Icon size={5} circle={true} color={item.Color}/>
704
+ <Icon size={4} circle={true} color={item.Color}/>
702
705
  {:else if item.Avatar}
703
- <Icon size={5} circle={true} symbol={item.Avatar}/>
706
+ <Icon size={4} circle={true} symbol={item.Avatar}/>
704
707
  {:else if item.Icon}
705
708
  <Icon size={4} component={item.Icon}/>
706
709
  {:else if item.Icon == null}
707
710
  <div class="w-4 h-4"></div>
708
711
  {:else if item.Name}
709
- <Icon size={5} circle={true} label={item.Name}/>
712
+ <Icon size={4} circle={true} label={item.Name}/>
710
713
  {:else}
711
- <Icon size={5} circle={true}/>
714
+ <Icon size={4} circle={true}/>
712
715
  {/if}
713
716
  {/if}
714
- <div class="ml-2">
717
+ <h4 class="ml-2">
715
718
  {#if item.Name}
716
719
  {item.Name}
717
720
  {:else if item.Key}
718
721
  {item.Key}
719
722
  {/if}
720
- </div>
723
+ </h4>
721
724
  </li>
722
725
  {/each}
723
726
  {:else}
@@ -24,6 +24,7 @@ declare const __propDef: {
24
24
  filtered?: boolean | undefined;
25
25
  pushChangesImmediately?: boolean | undefined;
26
26
  hasNone?: boolean | undefined;
27
+ readOnly?: boolean | undefined;
27
28
  show?: ((event: any, hide_callback: any) => void) | undefined;
28
29
  hide?: (() => void) | undefined;
29
30
  };
@@ -2,7 +2,7 @@
2
2
  import Icon from "./icon.svelte";
3
3
  import { contextItemsStore, pushToolsActionsOperations, popToolsActionsOperations } from "../stores";
4
4
  import { isDeviceSmallerThan, isOnScreenKeyboardVisible } from "../utils";
5
- import { hideWholeContextMenu } from "./menu";
5
+ import { hideWholeContextMenu, showMenu, showFloatingToolbar, showGridMenu } from "./menu";
6
6
  import { FaTimes } from "svelte-icons/fa";
7
7
  export let widthPx = 400;
8
8
  export let menu_items_id_prefix = "__hd_svelte_menuitem_";
@@ -181,7 +181,7 @@ function on_keydown(e, operation, index) {
181
181
  hide_submenu();
182
182
  break;
183
183
  case "Enter":
184
- execute_action(operation, index);
184
+ execute_action(void 0, operation, index);
185
185
  e.preventDefault();
186
186
  e.stopPropagation();
187
187
  break;
@@ -219,7 +219,7 @@ function on_mouse_move(index) {
219
219
  if (!isDeviceSmallerThan("sm"))
220
220
  focus_menu_item(index);
221
221
  }
222
- function execute_action(operation, index) {
222
+ function execute_action(e, operation, index) {
223
223
  if (operation.menu) {
224
224
  focus_menu_item(index);
225
225
  return;
@@ -227,12 +227,29 @@ function execute_action(operation, index) {
227
227
  hideWholeContextMenu();
228
228
  if (!operation)
229
229
  return;
230
- if (!operation.action)
231
- return;
232
- let context_item = null;
233
- if ($contextItemsStore.focused)
234
- context_item = $contextItemsStore[$contextItemsStore.focused];
235
- operation.action(context_item);
230
+ let owner = e.target;
231
+ while (owner && owner.tagName != "BUTTON")
232
+ owner = owner.parentElement;
233
+ if (operation.preAction)
234
+ operation.preAction(owner);
235
+ const mobile = isDeviceSmallerThan("sm");
236
+ if (operation.action) {
237
+ operation.action(owner, around_rect);
238
+ } else {
239
+ let rect;
240
+ if (around_rect)
241
+ rect = around_rect;
242
+ else
243
+ rect = owner.getBoundingClientRect();
244
+ if (operation.toolbar)
245
+ showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
246
+ else if (operation.grid) {
247
+ if (mobile)
248
+ showMenu(rect, operation.grid);
249
+ else
250
+ showGridMenu(rect, operation.grid);
251
+ }
252
+ }
236
253
  }
237
254
  function focus_menu_item(index) {
238
255
  const operation = operations[index];
@@ -274,10 +291,25 @@ function hide_submenu() {
274
291
  function mousedown(e) {
275
292
  e.preventDefault();
276
293
  }
294
+ function calculateBackground(is_highlighted, active) {
295
+ if (is_highlighted) {
296
+ if (active)
297
+ return "bg-stone-400/40 dark:bg-stone-400/40";
298
+ else
299
+ return "bg-stone-400/30 dark:bg-stone-400/30";
300
+ } else {
301
+ if (active)
302
+ return "bg-stone-400/20 dark:bg-stone-400/20";
303
+ else
304
+ return "";
305
+ }
306
+ }
277
307
  </script>
278
308
 
279
309
  <div id="__hd_svelte_contextmenu"
280
- class=" bg-white dark:bg-stone-700 text-stone-600 dark:text-stone-400 rounded-lg border border-stone-200 dark:border-stone-900 shadow-md
310
+ class=" bg-white dark:bg-stone-800
311
+ text-stone-800 dark:text-stone-400 rounded-lg border
312
+ border-stone-200 dark:border-stone-700 shadow-md
281
313
  z-30 fixed min-w-[{min_width_px}px] w-max overflow-y-auto"
282
314
  style={css_position}
283
315
  bind:this={menu_root}>
@@ -285,7 +317,9 @@ function mousedown(e) {
285
317
  {#each operations as operation, index}
286
318
  {@const is_separator = operation.separator}
287
319
  {#if is_separator}
288
- <hr class="my-1 mx-0 border-1 dark:border-stone-900">
320
+ {#if index>0 && index < operations.length-1}
321
+ <hr class="my-1 mx-4 border-1 border-stone-300 dark:border-stone-700">
322
+ {/if}
289
323
  {:else}
290
324
  {@const mobile = isDeviceSmallerThan("sm")}
291
325
  {@const icon_placeholder_without_desc = mobile ? 12 : 10}
@@ -296,31 +330,35 @@ function mousedown(e) {
296
330
  {@const isBottom = index == operations.length-1}
297
331
  {@const isFocused = index == focused_index}
298
332
  {@const clipFocusedBorder = isFocused ? (isTop ? 'rounded-t-lg' : (isBottom ? 'rounded-b-lg' : '')) : ''}
299
- {@const active = ((!mobile) && isFocused) ? `bg-stone-200 dark:bg-stone-600 ${clipFocusedBorder}` : ''}
333
+ {@const active = calculateBackground(isFocused, false)}
300
334
  {@const has_submenu = operation.menu !== undefined && operation.menu.length > 0}
301
335
 
302
- <button class="font-medium m-0 py-2 pr-4 text-lg sm:text-sm w-full text-left flex flex-row cursor-context-menu {active} focus:outline-none"
336
+ <button class="block w-full pr-4 text-left flex flex-row cursor-context-menu {active} focus:outline-none"
303
337
  id={menu_item_id}
304
338
  bind:this={menu_items[index]}
305
- on:click|stopPropagation={(e) => { execute_action(operation, index) } }
339
+ on:click|stopPropagation={(e) => { execute_action(e, operation, index) } }
306
340
  on:mouseenter = {(e) => {on_mouse_move(index)}}
307
341
  on:keydown|stopPropagation={(e) => on_keydown(e, operation, index)}
308
342
  on:mousedown={mousedown}
309
343
  disabled={operation.disabled}
310
344
  class:opacity-60={operation.disabled}>
311
345
 
312
- <div class="flex items-center justify-center mt-1 sm:mt-0.5" style:width={`${icon_placeholder_size*0.25}rem`}>
346
+ <div class="flex items-center justify-center space-x-10 px-4 py-2 ml-12 sm:ml-0" >
313
347
  {#if operation.icon}
314
348
  {@const cc = mobile ? 7 : 6}
315
349
  {@const icon_size = icon_placeholder_size - cc}
316
350
  <Icon size={icon_size} component={operation.icon}/>
351
+ {:else}
352
+ {@const cc = mobile ? 7 : 6}
353
+ {@const icon_size = icon_placeholder_size - cc}
354
+ <div style="width: {icon_size*0.25}rem; height: {icon_size*0.25}rem;"></div>
317
355
  {/if}
318
356
  </div>
319
357
  <div class="">
320
358
  <p> {operation.caption}</p>
321
359
  {#if operation.description}
322
360
  {@const shortcut_width_px = operation.shortcut ? 80 : 0}
323
- <p class=" text-sm font-normal text-stone-900 dark:text-stone-500 truncate inline-block">
361
+ <p class="truncate inline-block">
324
362
  {operation.description}
325
363
  </p>
326
364
  {/if}
@@ -3,7 +3,7 @@ import { data_tick_store, contextItemsStore, contextTypesStore } from "../stores
3
3
  import { informModification, pushChanges } from "../updates.js";
4
4
  import { parseWidthDirective, isDeviceSmallerThan } from "../utils.js";
5
5
  import FaChevronDown from "svelte-icons/fa/FaChevronDown.svelte";
6
- import { getFormattedStringDate, getNiceStringDate } from "./date_utils.js";
6
+ import { getFormattedStringDate, getNiceStringDate, getNiceStringDateTime } from "./date_utils.js";
7
7
  export let self = null;
8
8
  export let a = "";
9
9
  export let context = "";
@@ -12,6 +12,7 @@ export let date = null;
12
12
  export let onSelect = void 0;
13
13
  export let type = "date";
14
14
  export let changed = void 0;
15
+ export let readOnly = false;
15
16
  export let s = "sm";
16
17
  export let c = "";
17
18
  export let compact = false;
@@ -97,7 +98,7 @@ if (!is_compact) {
97
98
  } else {
98
99
  style = `${font_size}`;
99
100
  }
100
- let can_be_activated = true;
101
+ let can_be_activated = !readOnly;
101
102
  let last_tick = -1;
102
103
  $:
103
104
  setup($data_tick_store, $contextItemsStore);
@@ -124,7 +125,9 @@ function setup(...args) {
124
125
  value = new Date(item[a]);
125
126
  } else
126
127
  value = date;
127
- if (is_compact) {
128
+ if (readOnly)
129
+ can_be_activated = false;
130
+ else if (is_compact) {
128
131
  can_be_activated = false;
129
132
  let contexts = inContext.split(" ");
130
133
  contexts.forEach((ctx2) => {
@@ -134,7 +137,10 @@ function setup(...args) {
134
137
  } else
135
138
  can_be_activated = true;
136
139
  rValue = getFormattedStringDate(value, type);
137
- pretty_value = getNiceStringDate(value);
140
+ if (type == "datetime-local")
141
+ pretty_value = getNiceStringDateTime(value);
142
+ else
143
+ pretty_value = getNiceStringDate(value);
138
144
  }
139
145
  async function on_changed() {
140
146
  if (!rValue)
@@ -10,6 +10,7 @@ declare const __propDef: {
10
10
  onSelect?: undefined;
11
11
  type?: string | undefined;
12
12
  changed?: undefined;
13
+ readOnly?: boolean | undefined;
13
14
  s?: string | undefined;
14
15
  c?: string | undefined;
15
16
  compact?: boolean | undefined;
@@ -1,4 +1,5 @@
1
1
  export function getFormattedStringDate(d: any, type?: string): string;
2
+ export function getNiceStringDateTime(d: any): string;
2
3
  export function getNiceStringDate(d: any): string;
3
4
  export function dayName(d: any): "" | "Sun" | "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat";
4
5
  export function monthName(m: any): "" | "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec";
@@ -28,6 +28,16 @@ export function getFormattedStringDate(d, type = "datetime")
28
28
  return `${year}-${month}-${day}`;
29
29
  }
30
30
 
31
+ export function getNiceStringDateTime(d)
32
+ {
33
+ const dt = getNiceStringDate(d);
34
+ const tm = d.toLocaleTimeString(undefined, {
35
+ timeStyle: 'short'
36
+ })
37
+ return `${dt}, ${tm}`
38
+ }
39
+
40
+
31
41
  export function getNiceStringDate(d)
32
42
  {
33
43
  if(!d)
@@ -1,5 +1,4 @@
1
- <script>import { Spinner } from "flowbite-svelte";
2
- import { onMount } from "svelte";
1
+ <script>import { onMount } from "svelte";
3
2
  export let color = "blue";
4
3
  export let size = 8;
5
4
  export let delay = 1e3;