@humandialog/forms.svelte 1.3.16 → 1.4.0
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/components/Fab.svelte +77 -46
- package/components/Floating_container.svelte +1 -1
- package/components/combo/combo.svelte +18 -15
- package/components/combo/combo.svelte.d.ts +1 -0
- package/components/contextmenu.svelte +25 -6
- package/components/date.svelte +10 -4
- package/components/date.svelte.d.ts +1 -0
- package/components/date_utils.d.ts +1 -0
- package/components/date_utils.js +10 -0
- package/components/delayed.spinner.svelte +1 -2
- package/components/document/editor.svelte +419 -46
- package/components/document/editor.svelte.d.ts +115 -0
- package/components/document/internal/palette.svelte +20 -0
- package/components/list/List.d.ts +6 -0
- package/components/list/List.js +6 -0
- package/components/list/internal/list.element.props.svelte +23 -8
- package/components/list/internal/list.element.svelte +43 -18
- package/components/list/internal/list.element.svelte.d.ts +1 -0
- package/components/list/list.combo.svelte +6 -0
- package/components/list/list.combo.svelte.d.ts +3 -0
- package/components/list/list.date.svelte +8 -0
- package/components/list/list.date.svelte.d.ts +4 -0
- package/components/list/list.static.svelte +6 -0
- package/components/list/list.static.svelte.d.ts +3 -0
- package/components/list/list.svelte +17 -17
- package/components/list/list.tags.svelte +32 -0
- package/components/list/list.tags.svelte.d.ts +24 -0
- package/components/sidebar/sidebar.item.svelte +25 -8
- package/components/tags.svelte +15 -7
- package/components/tags.svelte.d.ts +2 -0
- package/desk.svelte +9 -6
- package/index.d.ts +7 -2
- package/index.js +7 -2
- package/operations.svelte +61 -12
- package/package.json +4 -2
- package/stores.d.ts +3 -0
- package/stores.js +25 -2
- package/tenant.members.svelte +61 -59
- package/tenant.members.svelte.d.ts +2 -0
package/components/Fab.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
5
|
$:
|
|
6
6
|
setupCurrentContextOperations($pageToolbarOperations, $contextToolbarOperations, $toolsActionsOperations);
|
|
7
7
|
let operations = [];
|
|
@@ -13,49 +13,82 @@ let vToolboxExpanded = false;
|
|
|
13
13
|
let hToolboxExpanded = false;
|
|
14
14
|
let isDirectPositioningMode = false;
|
|
15
15
|
function setupCurrentContextOperations(...args) {
|
|
16
|
+
let opVer = 0;
|
|
16
17
|
isDirectPositioningMode = false;
|
|
17
18
|
if ($toolsActionsOperations && Array.isArray($toolsActionsOperations) && toolsActionsOperations.length > 0) {
|
|
18
19
|
operations = $toolsActionsOperations;
|
|
19
20
|
} else if ($toolsActionsOperations && $toolsActionsOperations.operations && $toolsActionsOperations.operations.length > 0) {
|
|
20
21
|
operations = $toolsActionsOperations.operations;
|
|
21
|
-
|
|
22
|
+
opVer = $toolsActionsOperations.opver ?? 0;
|
|
23
|
+
if (opVer > 0)
|
|
22
24
|
isDirectPositioningMode = true;
|
|
23
25
|
} else if ($contextToolbarOperations && Array.isArray($contextToolbarOperations) && $contextToolbarOperations.length > 0) {
|
|
24
26
|
operations = $contextToolbarOperations;
|
|
25
27
|
} else if ($contextToolbarOperations && $contextToolbarOperations.operations && $contextToolbarOperations.operations.length > 0) {
|
|
26
28
|
operations = $contextToolbarOperations.operations;
|
|
27
|
-
|
|
29
|
+
opVer = $contextToolbarOperations.opver ?? 0;
|
|
30
|
+
if (opVer > 0)
|
|
28
31
|
isDirectPositioningMode = true;
|
|
29
32
|
} else {
|
|
30
33
|
if (Array.isArray($pageToolbarOperations))
|
|
31
34
|
operations = $pageToolbarOperations;
|
|
32
35
|
else {
|
|
33
36
|
operations = $pageToolbarOperations.operations;
|
|
34
|
-
|
|
37
|
+
opVer = $pageToolbarOperations.opver ?? 0;
|
|
38
|
+
if (opVer > 0)
|
|
35
39
|
isDirectPositioningMode = true;
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
if (opVer == 1) {
|
|
43
|
+
let flatOperations = [];
|
|
44
|
+
operations.forEach((group) => {
|
|
45
|
+
flatOperations = [...flatOperations, ...group.operations];
|
|
46
|
+
});
|
|
47
|
+
operations = flatOperations;
|
|
48
|
+
} else if (opVer == 2) {
|
|
49
|
+
let flatOperations = [];
|
|
50
|
+
operations.forEach((group) => {
|
|
51
|
+
flatOperations.push({
|
|
52
|
+
caption: group.caption,
|
|
53
|
+
separator: true
|
|
54
|
+
});
|
|
55
|
+
flatOperations = [...flatOperations, ...group.operations];
|
|
56
|
+
});
|
|
57
|
+
const realOps = flatOperations.filter((el) => !!el.separator == false);
|
|
58
|
+
if (realOps.length > 1) {
|
|
59
|
+
mainOperation = {
|
|
60
|
+
icon: FaEllipsisV,
|
|
61
|
+
menu: flatOperations,
|
|
62
|
+
fab: "M00"
|
|
63
|
+
};
|
|
64
|
+
operations = [mainOperation];
|
|
65
|
+
} else if (realOps.length == 1) {
|
|
66
|
+
mainOperation = realOps[0];
|
|
67
|
+
mainOperation["fab"] = "M00";
|
|
68
|
+
operations = [mainOperation];
|
|
69
|
+
} else
|
|
70
|
+
operations = [];
|
|
71
|
+
} else {
|
|
72
|
+
if (operations.length > 0)
|
|
73
|
+
mainOperation = operations[0];
|
|
74
|
+
else
|
|
75
|
+
mainOperation = null;
|
|
76
|
+
secondaryOperation = null;
|
|
77
|
+
toolboxOperations = [];
|
|
78
|
+
if (operations.length > 1) {
|
|
79
|
+
const operation = operations[1];
|
|
80
|
+
if (!operation.separator) {
|
|
81
|
+
if (!operation.toolbox)
|
|
82
|
+
secondaryOperation = operation;
|
|
83
|
+
else
|
|
84
|
+
toolboxOperations = operation.toolbox;
|
|
85
|
+
}
|
|
53
86
|
}
|
|
87
|
+
if (operations.length == 3 && secondaryOperation != null || operations.length > 3 || toolboxOperations.length > 0)
|
|
88
|
+
isExpandable = true;
|
|
89
|
+
else
|
|
90
|
+
isExpandable = false;
|
|
54
91
|
}
|
|
55
|
-
if (operations.length == 3 && secondaryOperation != null || operations.length > 3 || toolboxOperations.length > 0)
|
|
56
|
-
isExpandable = true;
|
|
57
|
-
else
|
|
58
|
-
isExpandable = false;
|
|
59
92
|
}
|
|
60
93
|
export function activateMainOperation() {
|
|
61
94
|
const mainOperationButton = document.getElementById("__hd_fab_mainOperation");
|
|
@@ -69,6 +102,8 @@ function on_click(e, operation) {
|
|
|
69
102
|
let owner = e.target;
|
|
70
103
|
while (owner && (owner.tagName != "BUTTON" && owner.tagName != "LI"))
|
|
71
104
|
owner = owner.parentElement;
|
|
105
|
+
if (operation.preAction)
|
|
106
|
+
operation.preAction(owner);
|
|
72
107
|
if (operation.action) {
|
|
73
108
|
operation.action(owner);
|
|
74
109
|
}
|
|
@@ -178,29 +213,25 @@ function operationVisible(operation) {
|
|
|
178
213
|
|
|
179
214
|
{#if isDirectPositioningMode}
|
|
180
215
|
{#if operations && operations.length > 0}
|
|
181
|
-
{#each operations as
|
|
182
|
-
{#if
|
|
183
|
-
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
</button>
|
|
201
|
-
{/if}
|
|
202
|
-
{/if}
|
|
203
|
-
{/each}
|
|
216
|
+
{#each operations as operation}
|
|
217
|
+
{#if operationVisible(operation)}
|
|
218
|
+
{@const position = calculatePosition(operation)}
|
|
219
|
+
{#if position}
|
|
220
|
+
<button
|
|
221
|
+
class="text-white bg-blue-700/70 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
|
|
222
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
223
|
+
w-[35px] h-[35px]
|
|
224
|
+
fixed m-0
|
|
225
|
+
dark:bg-blue-600/50 dark:hover:bg-blue-700 dark:focus:ring-blue-800
|
|
226
|
+
flex items-center justify-center
|
|
227
|
+
disable-dbl-tap-zoom
|
|
228
|
+
cursor-pointer z-40"
|
|
229
|
+
style={position}
|
|
230
|
+
on:click|stopPropagation={(e) => {on_click(e, operation)}}
|
|
231
|
+
on:mousedown={mousedown} >
|
|
232
|
+
<div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
|
|
233
|
+
</button>
|
|
234
|
+
{/if}
|
|
204
235
|
{/if}
|
|
205
236
|
{/each}
|
|
206
237
|
{/if}
|
|
@@ -150,7 +150,7 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
|
150
150
|
</script>
|
|
151
151
|
|
|
152
152
|
<div id="__hd_svelte_floating_container"
|
|
153
|
-
class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow
|
|
153
|
+
class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow-md shadow-stone-500 dark:shadow-black z-30 fixed "
|
|
154
154
|
style={cssPosition}
|
|
155
155
|
bind:this={rootElement}>
|
|
156
156
|
<svelte:component this={toolbar} {...props} bind:this={internalElement} />
|
|
@@ -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 =
|
|
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 (
|
|
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
|
|
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
|
-
<
|
|
685
|
+
<h4 class="ml-2">
|
|
682
686
|
<none>
|
|
683
|
-
</
|
|
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
|
|
692
|
-
|
|
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={
|
|
704
|
+
<Icon size={4} circle={true} color={item.Color}/>
|
|
702
705
|
{:else if item.Avatar}
|
|
703
|
-
<Icon size={
|
|
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={
|
|
712
|
+
<Icon size={4} circle={true} label={item.Name}/>
|
|
710
713
|
{:else}
|
|
711
|
-
<Icon size={
|
|
714
|
+
<Icon size={4} circle={true}/>
|
|
712
715
|
{/if}
|
|
713
716
|
{/if}
|
|
714
|
-
<
|
|
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
|
-
</
|
|
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
|
};
|
|
@@ -274,10 +274,23 @@ function hide_submenu() {
|
|
|
274
274
|
function mousedown(e) {
|
|
275
275
|
e.preventDefault();
|
|
276
276
|
}
|
|
277
|
+
function calculateBackground(is_highlighted, active) {
|
|
278
|
+
if (is_highlighted) {
|
|
279
|
+
if (active)
|
|
280
|
+
return "bg-stone-400/40 dark:bg-stone-400/40";
|
|
281
|
+
else
|
|
282
|
+
return "bg-stone-400/30 dark:bg-stone-400/30";
|
|
283
|
+
} else {
|
|
284
|
+
if (active)
|
|
285
|
+
return "bg-stone-400/20 dark:bg-stone-400/20";
|
|
286
|
+
else
|
|
287
|
+
return "";
|
|
288
|
+
}
|
|
289
|
+
}
|
|
277
290
|
</script>
|
|
278
291
|
|
|
279
292
|
<div id="__hd_svelte_contextmenu"
|
|
280
|
-
class=" bg-white dark:bg-stone-
|
|
293
|
+
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
|
|
281
294
|
z-30 fixed min-w-[{min_width_px}px] w-max overflow-y-auto"
|
|
282
295
|
style={css_position}
|
|
283
296
|
bind:this={menu_root}>
|
|
@@ -285,7 +298,9 @@ function mousedown(e) {
|
|
|
285
298
|
{#each operations as operation, index}
|
|
286
299
|
{@const is_separator = operation.separator}
|
|
287
300
|
{#if is_separator}
|
|
288
|
-
|
|
301
|
+
{#if index>0 && index < operations.length-1}
|
|
302
|
+
<hr class="my-1 mx-4 border-1 border-stone-300 dark:border-stone-700">
|
|
303
|
+
{/if}
|
|
289
304
|
{:else}
|
|
290
305
|
{@const mobile = isDeviceSmallerThan("sm")}
|
|
291
306
|
{@const icon_placeholder_without_desc = mobile ? 12 : 10}
|
|
@@ -296,10 +311,10 @@ function mousedown(e) {
|
|
|
296
311
|
{@const isBottom = index == operations.length-1}
|
|
297
312
|
{@const isFocused = index == focused_index}
|
|
298
313
|
{@const clipFocusedBorder = isFocused ? (isTop ? 'rounded-t-lg' : (isBottom ? 'rounded-b-lg' : '')) : ''}
|
|
299
|
-
{@const active = (
|
|
314
|
+
{@const active = calculateBackground(isFocused, false)}
|
|
300
315
|
{@const has_submenu = operation.menu !== undefined && operation.menu.length > 0}
|
|
301
316
|
|
|
302
|
-
<button class="
|
|
317
|
+
<button class="block w-full pr-4 text-left flex flex-row cursor-context-menu {active} focus:outline-none"
|
|
303
318
|
id={menu_item_id}
|
|
304
319
|
bind:this={menu_items[index]}
|
|
305
320
|
on:click|stopPropagation={(e) => { execute_action(operation, index) } }
|
|
@@ -309,18 +324,22 @@ function mousedown(e) {
|
|
|
309
324
|
disabled={operation.disabled}
|
|
310
325
|
class:opacity-60={operation.disabled}>
|
|
311
326
|
|
|
312
|
-
<div class="flex items-center justify-center
|
|
327
|
+
<div class="flex items-center justify-center space-x-10 px-4 py-2 ml-12 sm:ml-0" >
|
|
313
328
|
{#if operation.icon}
|
|
314
329
|
{@const cc = mobile ? 7 : 6}
|
|
315
330
|
{@const icon_size = icon_placeholder_size - cc}
|
|
316
331
|
<Icon size={icon_size} component={operation.icon}/>
|
|
332
|
+
{:else}
|
|
333
|
+
{@const cc = mobile ? 7 : 6}
|
|
334
|
+
{@const icon_size = icon_placeholder_size - cc}
|
|
335
|
+
<div style="width: {icon_size*0.25}rem; height: {icon_size*0.25}rem;"></div>
|
|
317
336
|
{/if}
|
|
318
337
|
</div>
|
|
319
338
|
<div class="">
|
|
320
339
|
<p> {operation.caption}</p>
|
|
321
340
|
{#if operation.description}
|
|
322
341
|
{@const shortcut_width_px = operation.shortcut ? 80 : 0}
|
|
323
|
-
<p class="
|
|
342
|
+
<p class="truncate inline-block">
|
|
324
343
|
{operation.description}
|
|
325
344
|
</p>
|
|
326
345
|
{/if}
|
package/components/date.svelte
CHANGED
|
@@ -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 =
|
|
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 (
|
|
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
|
-
|
|
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)
|
|
@@ -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";
|
package/components/date_utils.js
CHANGED
|
@@ -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)
|