@humandialog/forms.svelte 1.3.11 → 1.3.13
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/README.md +0 -0
- package/components/Fab.svelte +112 -34
- package/components/Fab.svelte.d.ts +17 -17
- package/components/Floating_container.svelte +86 -21
- package/components/Floating_container.svelte.d.ts +21 -21
- package/components/Grid.menu.svelte.d.ts +25 -25
- package/components/button.svelte.d.ts +26 -26
- package/components/checkbox.svelte.d.ts +26 -26
- package/components/combo/combo.d.ts +19 -19
- package/components/combo/combo.item.svelte.d.ts +20 -20
- package/components/combo/combo.js +19 -19
- package/components/combo/combo.source.svelte.d.ts +23 -23
- package/components/combo/combo.svelte +64 -30
- package/components/combo/combo.svelte.d.ts +44 -44
- package/components/contextmenu.svelte +97 -30
- package/components/contextmenu.svelte.d.ts +26 -26
- package/components/date.svelte +40 -30
- package/components/date.svelte.d.ts +33 -33
- package/components/delayed.spinner.svelte.d.ts +19 -19
- package/components/document/editor.svelte +33 -6
- package/components/document/editor.svelte.d.ts +35 -35
- package/components/document/internal/Document_command.d.ts +12 -11
- package/components/document/internal/Document_command.js +12 -11
- package/components/document/internal/Selection_helper.d.ts +7 -7
- package/components/document/internal/Selection_helper.js +133 -133
- package/components/document/internal/Selection_range.d.ts +26 -26
- package/components/document/internal/Selection_range.js +58 -58
- package/components/document/internal/findSuggestionMatch.d.ts +16 -16
- package/components/document/internal/findSuggestionMatch.js +51 -51
- package/components/document/internal/h1.icon.svelte.d.ts +23 -23
- package/components/document/internal/h2.icon.svelte.d.ts +23 -23
- package/components/document/internal/h3.icon.svelte.d.ts +23 -23
- package/components/document/internal/h4.icon.svelte.d.ts +23 -23
- package/components/document/internal/palette.row.big.svelte.d.ts +46 -46
- package/components/document/internal/palette.row.svelte +1 -1
- package/components/document/internal/palette.row.svelte.d.ts +46 -46
- package/components/document/internal/palette.svelte +23 -15
- package/components/document/internal/palette.svelte.d.ts +82 -82
- package/components/document/internal/suggestion.d.ts +158 -158
- package/components/document/internal/suggestion.js +194 -194
- package/components/document/rich.edit.svelte.d.ts +34 -34
- package/components/edit.field.svelte.d.ts +31 -31
- package/components/file.loader.svelte.d.ts +25 -25
- package/components/icon.ex.svelte.d.ts +62 -62
- package/components/icon.svelte.d.ts +62 -62
- package/components/input.text.svelte.d.ts +29 -29
- package/components/inputbox.ltop.svelte.d.ts +59 -59
- package/components/kanban/Kanban.d.ts +47 -47
- package/components/kanban/Kanban.js +105 -105
- package/components/kanban/internal/kanban.card.svelte +5 -3
- package/components/kanban/internal/kanban.card.svelte.d.ts +32 -32
- package/components/kanban/internal/kanban.column.svelte.d.ts +53 -53
- package/components/kanban/internal/kanban.inserter.svelte.d.ts +18 -18
- package/components/kanban/internal/kanban.move.menu.svelte +135 -135
- package/components/kanban/internal/kanban.move.menu.svelte.d.ts +22 -22
- package/components/kanban/internal/kanban.props.svelte.d.ts +19 -19
- package/components/kanban/kanban.callbacks.svelte +1 -1
- package/components/kanban/kanban.callbacks.svelte.d.ts +18 -18
- package/components/kanban/kanban.column.svelte.d.ts +21 -21
- package/components/kanban/kanban.combo.svelte.d.ts +25 -25
- package/components/kanban/kanban.date.svelte +1 -1
- package/components/kanban/kanban.date.svelte.d.ts +21 -21
- package/components/kanban/kanban.source.svelte.d.ts +23 -23
- package/components/kanban/kanban.static.svelte.d.ts +20 -20
- package/components/kanban/kanban.summary.svelte.d.ts +18 -18
- package/components/kanban/kanban.svelte.d.ts +65 -65
- package/components/kanban/kanban.tags.svelte.d.ts +24 -24
- package/components/kanban/kanban.title.svelte.d.ts +21 -21
- package/components/list/List.d.ts +46 -46
- package/components/list/List.js +54 -54
- package/components/list/internal/list.element.props.svelte +2 -2
- package/components/list/internal/list.element.props.svelte.d.ts +21 -21
- package/components/list/internal/list.element.summary.svelte +46 -46
- package/components/list/internal/list.element.summary.svelte.d.ts +24 -24
- package/components/list/internal/list.element.svelte +8 -6
- package/components/list/internal/list.element.svelte.d.ts +31 -31
- package/components/list/internal/list.inserter.svelte.d.ts +19 -19
- package/components/list/list.combo.svelte.d.ts +22 -22
- package/components/list/list.date.svelte.d.ts +18 -18
- package/components/list/list.inserter.svelte.d.ts +17 -17
- package/components/list/list.static.svelte.d.ts +17 -17
- package/components/list/list.summary.svelte.d.ts +19 -19
- package/components/list/list.svelte.d.ts +59 -59
- package/components/list/list.title.svelte.d.ts +22 -22
- package/components/menu.d.ts +5 -5
- package/components/menu.js +57 -57
- package/components/radio.svelte.d.ts +26 -26
- package/components/sidebar/sidebar.brand.svelte.d.ts +33 -33
- package/components/sidebar/sidebar.group.svelte +2 -2
- package/components/sidebar/sidebar.group.svelte.d.ts +33 -33
- package/components/sidebar/sidebar.item.svelte +52 -29
- package/components/sidebar/sidebar.item.svelte.d.ts +32 -32
- package/components/sidebar/sidebar.list.svelte +4 -2
- package/components/sidebar/sidebar.list.svelte.d.ts +38 -38
- package/components/sidebar/sidebar.svelte.d.ts +27 -27
- package/components/simple.table.svelte.d.ts +41 -41
- package/components/table/_template.table.svelte.d.ts +57 -57
- package/components/table/column.svelte.d.ts +19 -19
- package/components/table/item.svelte.d.ts +17 -17
- package/components/table/table.d.ts +11 -11
- package/components/table/table.js +11 -11
- package/components/table/table.svelte +6 -3
- package/components/table/table.svelte.d.ts +75 -75
- package/components/tag.colors.svelte.d.ts +17 -17
- package/components/tag.svelte +12 -9
- package/components/tag.svelte.d.ts +20 -20
- package/components/tags.svelte +13 -11
- package/components/tags.svelte.d.ts +32 -32
- package/components/textarea.ltop.svelte.d.ts +35 -35
- package/components/tile.title.svelte.d.ts +29 -29
- package/console.svelte.d.ts +23 -23
- package/desk.svelte +60 -27
- package/desk.svelte.d.ts +23 -23
- package/form.box.svelte.d.ts +35 -35
- package/horizontal.toolbar.svelte +3 -3
- package/horizontal.toolbar.svelte.d.ts +25 -25
- package/index.d.ts +63 -63
- package/index.js +69 -69
- package/internal/configurable.content.svelte.d.ts +29 -29
- package/internal/loading.svelte.d.ts +23 -23
- package/modal.svelte.d.ts +39 -39
- package/operations.svelte +37 -8
- package/operations.svelte.d.ts +16 -16
- package/package.json +9 -9
- package/page.row.svelte.d.ts +31 -31
- package/page.svelte +7 -2
- package/page.svelte.d.ts +47 -47
- package/stores.d.ts +45 -44
- package/stores.js +3 -2
- package/tenant.members.svelte +69 -39
- package/tenant.members.svelte.d.ts +33 -33
- package/tile.svelte.d.ts +33 -33
- package/tiles.row.svelte.d.ts +31 -31
- package/tiles.vertical.row.svelte.d.ts +29 -29
- package/updates.d.ts +4 -4
- package/utils.d.ts +50 -50
- package/utils.js +36 -7
- package/vertical.toolbar.svelte +1 -1
- package/vertical.toolbar.svelte.d.ts +27 -27
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
key?: any | undefined;
|
|
5
|
-
name?: string | undefined;
|
|
6
|
-
avatar?: string | undefined;
|
|
7
|
-
color?: string | undefined;
|
|
8
|
-
icon?: any | undefined;
|
|
9
|
-
};
|
|
10
|
-
events: {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {};
|
|
14
|
-
};
|
|
15
|
-
export type ComboProps = typeof __propDef.props;
|
|
16
|
-
export type ComboEvents = typeof __propDef.events;
|
|
17
|
-
export type ComboSlots = typeof __propDef.slots;
|
|
18
|
-
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
key?: any | undefined;
|
|
5
|
+
name?: string | undefined;
|
|
6
|
+
avatar?: string | undefined;
|
|
7
|
+
color?: string | undefined;
|
|
8
|
+
icon?: any | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type ComboProps = typeof __propDef.props;
|
|
16
|
+
export type ComboEvents = typeof __propDef.events;
|
|
17
|
+
export type ComboSlots = typeof __propDef.slots;
|
|
18
|
+
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export class rCombo_item {
|
|
2
|
-
Key;
|
|
3
|
-
Name;
|
|
4
|
-
Avatar; //url to avatar
|
|
5
|
-
Color;
|
|
6
|
-
Icon = undefined;
|
|
7
|
-
}
|
|
8
|
-
export class rCombo_definition {
|
|
9
|
-
source = [];
|
|
10
|
-
collection_expr;
|
|
11
|
-
collection_path;
|
|
12
|
-
collection;
|
|
13
|
-
onCollect = undefined;
|
|
14
|
-
element_key;
|
|
15
|
-
element_name;
|
|
16
|
-
element_avatar;
|
|
17
|
-
element_icon;
|
|
18
|
-
}
|
|
19
|
-
export const cached_sources = new Map();
|
|
1
|
+
export class rCombo_item {
|
|
2
|
+
Key;
|
|
3
|
+
Name;
|
|
4
|
+
Avatar; //url to avatar
|
|
5
|
+
Color;
|
|
6
|
+
Icon = undefined;
|
|
7
|
+
}
|
|
8
|
+
export class rCombo_definition {
|
|
9
|
+
source = [];
|
|
10
|
+
collection_expr;
|
|
11
|
+
collection_path;
|
|
12
|
+
collection;
|
|
13
|
+
onCollect = undefined;
|
|
14
|
+
element_key;
|
|
15
|
+
element_name;
|
|
16
|
+
element_avatar;
|
|
17
|
+
element_icon;
|
|
18
|
+
}
|
|
19
|
+
export const cached_sources = new Map();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
association?: string | undefined;
|
|
5
|
-
path?: string | undefined;
|
|
6
|
-
objects?: object[] | undefined;
|
|
7
|
-
onCollect?: undefined;
|
|
8
|
-
key?: string | undefined;
|
|
9
|
-
name?: string | undefined;
|
|
10
|
-
avatar?: string | undefined;
|
|
11
|
-
icon?: string | undefined;
|
|
12
|
-
};
|
|
13
|
-
events: {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
};
|
|
16
|
-
slots: {};
|
|
17
|
-
};
|
|
18
|
-
export type ComboProps = typeof __propDef.props;
|
|
19
|
-
export type ComboEvents = typeof __propDef.events;
|
|
20
|
-
export type ComboSlots = typeof __propDef.slots;
|
|
21
|
-
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
association?: string | undefined;
|
|
5
|
+
path?: string | undefined;
|
|
6
|
+
objects?: object[] | undefined;
|
|
7
|
+
onCollect?: undefined;
|
|
8
|
+
key?: string | undefined;
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
avatar?: string | undefined;
|
|
11
|
+
icon?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {};
|
|
17
|
+
};
|
|
18
|
+
export type ComboProps = typeof __propDef.props;
|
|
19
|
+
export type ComboEvents = typeof __propDef.events;
|
|
20
|
+
export type ComboSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script>import { data_tick_store, contextItemsStore, contextTypesStore } from "../../stores.js";
|
|
1
|
+
<script>import { data_tick_store, contextItemsStore, contextTypesStore, toolsActionsOperations } from "../../stores.js";
|
|
2
2
|
import { informModification, pushChanges } from "../../updates.js";
|
|
3
|
-
import { parseWidthDirective, shouldBeComapact } from "../../utils.js";
|
|
3
|
+
import { isDeviceSmallerThan, parseWidthDirective, shouldBeComapact } from "../../utils.js";
|
|
4
4
|
import { afterUpdate, getContext, onMount, setContext } from "svelte";
|
|
5
5
|
import { rCombo_definition, rCombo_item, cached_sources } from "./combo";
|
|
6
|
-
import FaChevronDown from "svelte-icons/fa
|
|
6
|
+
import { FaChevronDown, FaTimes } from "svelte-icons/fa";
|
|
7
7
|
import Icon from "../icon.svelte";
|
|
8
8
|
import { reef } from "@humandialog/auth.svelte/dist/index.js";
|
|
9
9
|
export let label = "";
|
|
@@ -54,8 +54,8 @@ switch (s) {
|
|
|
54
54
|
label_mb = "mb-2";
|
|
55
55
|
input_pt = "pt-2.5";
|
|
56
56
|
input_pb = "pb-2.5";
|
|
57
|
-
font_size = "text-
|
|
58
|
-
line_h = "h-
|
|
57
|
+
font_size = "text-base";
|
|
58
|
+
line_h = "h-5 sm:h-5";
|
|
59
59
|
chevron_mt = "mt-2 sm:mt-1";
|
|
60
60
|
break;
|
|
61
61
|
case "xs":
|
|
@@ -75,11 +75,11 @@ switch (s) {
|
|
|
75
75
|
chevron_mt = "";
|
|
76
76
|
break;
|
|
77
77
|
default:
|
|
78
|
-
label_mb = "
|
|
79
|
-
input_pt = "
|
|
80
|
-
input_pb = "
|
|
81
|
-
font_size = "
|
|
82
|
-
line_h = "
|
|
78
|
+
label_mb = "";
|
|
79
|
+
input_pt = "";
|
|
80
|
+
input_pb = "";
|
|
81
|
+
font_size = "";
|
|
82
|
+
line_h = "";
|
|
83
83
|
chevron_mt = "";
|
|
84
84
|
}
|
|
85
85
|
let background_class = is_compact && !icon ? "" : "";
|
|
@@ -153,7 +153,7 @@ let on_hide_callback = void 0;
|
|
|
153
153
|
export function show(event, hide_callback) {
|
|
154
154
|
if (!can_be_activated)
|
|
155
155
|
return;
|
|
156
|
-
if (!
|
|
156
|
+
if (!textbox)
|
|
157
157
|
return;
|
|
158
158
|
if (is_dropdown_open)
|
|
159
159
|
return;
|
|
@@ -171,7 +171,7 @@ export function show(event, hide_callback) {
|
|
|
171
171
|
client_rect.y = 0;
|
|
172
172
|
client_rect.width = window.innerWidth;
|
|
173
173
|
client_rect.height = window.innerHeight;
|
|
174
|
-
let rect =
|
|
174
|
+
let rect = textbox.getBoundingClientRect();
|
|
175
175
|
let top_space = rect.y;
|
|
176
176
|
let bottom_space = client_rect.height - (rect.y + rect.height);
|
|
177
177
|
let palette_max_height_px = 500;
|
|
@@ -198,17 +198,25 @@ export function show(event, hide_callback) {
|
|
|
198
198
|
show_above = true;
|
|
199
199
|
} else
|
|
200
200
|
y = rect.y + rect.height;
|
|
201
|
-
if (
|
|
201
|
+
if (isDeviceSmallerThan("sm")) {
|
|
202
|
+
let screenRect = new DOMRect();
|
|
203
|
+
screenRect.x = 0;
|
|
204
|
+
screenRect.y = 0;
|
|
205
|
+
screenRect.width = window.innerWidth;
|
|
206
|
+
screenRect.height = window.innerHeight;
|
|
207
|
+
const margin = 5;
|
|
208
|
+
const maxHeight = screenRect.height / 2 - margin;
|
|
209
|
+
const width = screenRect.width - 2 * margin;
|
|
210
|
+
x = margin;
|
|
211
|
+
y = screenRect.bottom - margin;
|
|
212
|
+
dropdown_position = `position: fixed; left: ${x}px; top: ${y}px; transform: translate(0, -100%); width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
213
|
+
} else if (show_fullscreen) {
|
|
202
214
|
dropdown_position = `position: fixed; left: 0px; top: 0px; width: ${client_rect.width}px; height: ${client_rect.height}px;`;
|
|
203
215
|
} else {
|
|
204
216
|
dropdown_position = `min-width: ${palette_width_px}px; max-height:${palette_max_height_px}px; position: fixed; left:${x}px; top:${y}px;`;
|
|
205
217
|
if (show_above)
|
|
206
218
|
dropdown_position += " transform: translate(0, -100%);";
|
|
207
219
|
}
|
|
208
|
-
console.log("dropdown_position", dropdown_position, rect, client_rect);
|
|
209
|
-
console.log("preferred_palette_height", preferred_palette_height);
|
|
210
|
-
console.log("bottom_space", bottom_space);
|
|
211
|
-
console.log("top_space", top_space);
|
|
212
220
|
is_dropdown_open = true;
|
|
213
221
|
if (filtered) {
|
|
214
222
|
if (!textbox)
|
|
@@ -226,11 +234,34 @@ export function show(event, hide_callback) {
|
|
|
226
234
|
subtree: true
|
|
227
235
|
});
|
|
228
236
|
}
|
|
237
|
+
if (isDeviceSmallerThan("sm")) {
|
|
238
|
+
$toolsActionsOperations = {
|
|
239
|
+
opver: 1,
|
|
240
|
+
operations: [
|
|
241
|
+
{
|
|
242
|
+
caption: "Menu",
|
|
243
|
+
operations: [
|
|
244
|
+
{
|
|
245
|
+
icon: FaTimes,
|
|
246
|
+
action: (f) => {
|
|
247
|
+
hide();
|
|
248
|
+
},
|
|
249
|
+
fab: "M00",
|
|
250
|
+
tbr: "A"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
};
|
|
256
|
+
}
|
|
229
257
|
}
|
|
230
258
|
export function hide() {
|
|
259
|
+
console.log("combo hide");
|
|
231
260
|
if (mutation_observer)
|
|
232
261
|
mutation_observer.disconnect();
|
|
233
262
|
is_dropdown_open = false;
|
|
263
|
+
$toolsActionsOperations = [];
|
|
264
|
+
dropdown_position = "display: none;";
|
|
234
265
|
combo_text = get_combo_text();
|
|
235
266
|
if (!!textbox)
|
|
236
267
|
textbox.innerHtml = combo_text;
|
|
@@ -579,13 +610,14 @@ function on_focus_out(e) {
|
|
|
579
610
|
{/if}
|
|
580
611
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
581
612
|
<div bind:this={combo}
|
|
582
|
-
on:click={(e) => { show(e, undefined) }}
|
|
583
|
-
class:cursor-pointer={can_be_activated && is_compact}
|
|
584
613
|
class="max-w-full {appearance_class} flex flex-row content-between items-center"
|
|
585
614
|
>
|
|
586
615
|
|
|
587
|
-
<
|
|
588
|
-
{
|
|
616
|
+
<p class="max-w-full flex-1 flex flex-row items-center"
|
|
617
|
+
on:click={(e) => { show(e, undefined) }}
|
|
618
|
+
class:cursor-pointer={can_be_activated && is_compact}>
|
|
619
|
+
|
|
620
|
+
{#if true || !is_dropdown_open}
|
|
589
621
|
{#if icon && sel_item}
|
|
590
622
|
{#if sel_item.Color}
|
|
591
623
|
<Icon size={5} circle={true} color={sel_item.Color}/>
|
|
@@ -600,7 +632,7 @@ function on_focus_out(e) {
|
|
|
600
632
|
{/if}
|
|
601
633
|
|
|
602
634
|
|
|
603
|
-
<
|
|
635
|
+
<span bind:this={textbox}
|
|
604
636
|
class="dark:text-stone-300 {line_h} truncate pl-0 pr-2.5 {background_class} min-w-[2.5rem]"
|
|
605
637
|
class:ml-2={icon}
|
|
606
638
|
class:text-stone-400={ (!is_dropdown_open) && (!sel_item)}
|
|
@@ -609,18 +641,20 @@ function on_focus_out(e) {
|
|
|
609
641
|
contenteditable={is_dropdown_open && filtered}
|
|
610
642
|
on:keydown={on_keydown}
|
|
611
643
|
tabindex="0">
|
|
612
|
-
{combo_text}</
|
|
613
|
-
|
|
644
|
+
{combo_text}</span>
|
|
645
|
+
|
|
646
|
+
{#if can_be_activated }
|
|
647
|
+
<div class="w-3 h-3 no-print flex-none text-stone-700 dark:text-stone-300 {chevron_mt}">
|
|
648
|
+
<FaChevronDown/>
|
|
649
|
+
</div>
|
|
650
|
+
{/if}
|
|
651
|
+
</p>
|
|
652
|
+
|
|
614
653
|
|
|
615
|
-
{#if can_be_activated }
|
|
616
|
-
<div class="w-3 h-3 no-print flex-none text-stone-700 dark:text-stone-300 {chevron_mt}">
|
|
617
|
-
<FaChevronDown/>
|
|
618
|
-
</div>
|
|
619
|
-
{/if}
|
|
620
654
|
</div>
|
|
621
655
|
|
|
622
656
|
<div hidden={!is_dropdown_open}
|
|
623
|
-
class="{cs} 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 overflow-y-auto cursor-pointer z-30"
|
|
657
|
+
class="not-prose {cs} 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 overflow-y-auto cursor-pointer z-30"
|
|
624
658
|
style={dropdown_position}
|
|
625
659
|
use:dropdown_action>
|
|
626
660
|
<ul class="py-1">
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { rCombo_definition } from './combo';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
label?: string | undefined;
|
|
7
|
-
self?: null | undefined;
|
|
8
|
-
a?: string | undefined;
|
|
9
|
-
isAssociation?: boolean | undefined;
|
|
10
|
-
context?: string | undefined;
|
|
11
|
-
typename?: string | undefined;
|
|
12
|
-
choiceCallback?: string | undefined;
|
|
13
|
-
onSelect?: undefined;
|
|
14
|
-
definition?: rCombo_definition | null | undefined;
|
|
15
|
-
changed?: undefined;
|
|
16
|
-
onNewItemCreated?: undefined;
|
|
17
|
-
icon?: boolean | undefined;
|
|
18
|
-
placeholder?: string | undefined;
|
|
19
|
-
s?: string | undefined;
|
|
20
|
-
c?: string | undefined;
|
|
21
|
-
compact?: boolean | undefined;
|
|
22
|
-
inContext?: string | undefined;
|
|
23
|
-
cached?: boolean | undefined;
|
|
24
|
-
filtered?: boolean | undefined;
|
|
25
|
-
pushChangesImmediately?: boolean | undefined;
|
|
26
|
-
hasNone?: boolean | undefined;
|
|
27
|
-
show?: ((event: any, hide_callback: any) => void) | undefined;
|
|
28
|
-
hide?: (() => void) | undefined;
|
|
29
|
-
};
|
|
30
|
-
events: {
|
|
31
|
-
[evt: string]: CustomEvent<any>;
|
|
32
|
-
};
|
|
33
|
-
slots: {
|
|
34
|
-
default: {};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export type ComboProps = typeof __propDef.props;
|
|
38
|
-
export type ComboEvents = typeof __propDef.events;
|
|
39
|
-
export type ComboSlots = typeof __propDef.slots;
|
|
40
|
-
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
41
|
-
get show(): (event: any, hide_callback: any) => void;
|
|
42
|
-
get hide(): () => void;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { rCombo_definition } from './combo';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
label?: string | undefined;
|
|
7
|
+
self?: null | undefined;
|
|
8
|
+
a?: string | undefined;
|
|
9
|
+
isAssociation?: boolean | undefined;
|
|
10
|
+
context?: string | undefined;
|
|
11
|
+
typename?: string | undefined;
|
|
12
|
+
choiceCallback?: string | undefined;
|
|
13
|
+
onSelect?: undefined;
|
|
14
|
+
definition?: rCombo_definition | null | undefined;
|
|
15
|
+
changed?: undefined;
|
|
16
|
+
onNewItemCreated?: undefined;
|
|
17
|
+
icon?: boolean | undefined;
|
|
18
|
+
placeholder?: string | undefined;
|
|
19
|
+
s?: string | undefined;
|
|
20
|
+
c?: string | undefined;
|
|
21
|
+
compact?: boolean | undefined;
|
|
22
|
+
inContext?: string | undefined;
|
|
23
|
+
cached?: boolean | undefined;
|
|
24
|
+
filtered?: boolean | undefined;
|
|
25
|
+
pushChangesImmediately?: boolean | undefined;
|
|
26
|
+
hasNone?: boolean | undefined;
|
|
27
|
+
show?: ((event: any, hide_callback: any) => void) | undefined;
|
|
28
|
+
hide?: (() => void) | undefined;
|
|
29
|
+
};
|
|
30
|
+
events: {
|
|
31
|
+
[evt: string]: CustomEvent<any>;
|
|
32
|
+
};
|
|
33
|
+
slots: {
|
|
34
|
+
default: {};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type ComboProps = typeof __propDef.props;
|
|
38
|
+
export type ComboEvents = typeof __propDef.events;
|
|
39
|
+
export type ComboSlots = typeof __propDef.slots;
|
|
40
|
+
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
41
|
+
get show(): (event: any, hide_callback: any) => void;
|
|
42
|
+
get hide(): () => void;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script>import { afterUpdate, tick } from "svelte";
|
|
2
2
|
import Icon from "./icon.svelte";
|
|
3
|
-
import { contextItemsStore } from "../stores";
|
|
3
|
+
import { contextItemsStore, toolsActionsOperations } from "../stores";
|
|
4
4
|
import { isDeviceSmallerThan, isOnScreenKeyboardVisible } from "../utils";
|
|
5
5
|
import { hideWholeContextMenu } from "./menu";
|
|
6
|
+
import { FaTimes } from "svelte-icons/fa";
|
|
6
7
|
export let widthPx = 400;
|
|
7
8
|
export let menu_items_id_prefix = "__hd_svelte_menuitem_";
|
|
8
9
|
export let owner_menu_item = void 0;
|
|
@@ -16,36 +17,78 @@ let focused_index = 0;
|
|
|
16
17
|
let menu_items = [];
|
|
17
18
|
let submenus = [];
|
|
18
19
|
let around_rect;
|
|
20
|
+
let css_position = "";
|
|
19
21
|
$:
|
|
20
22
|
display = visible ? "block" : "none";
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
24
|
+
let result = "";
|
|
25
|
+
if (!visible2) {
|
|
26
|
+
result = "display: none";
|
|
27
|
+
} else if (isDeviceSmallerThan("sm")) {
|
|
28
|
+
let screenRect = new DOMRect();
|
|
29
|
+
screenRect.x = 0;
|
|
30
|
+
screenRect.y = 0;
|
|
31
|
+
screenRect.width = window.innerWidth;
|
|
32
|
+
screenRect.height = window.innerHeight;
|
|
33
|
+
const margin = 5;
|
|
34
|
+
let myRect = null;
|
|
35
|
+
if (!fresh) {
|
|
36
|
+
myRect = menu_root.getBoundingClientRect();
|
|
37
|
+
if (myRect.height == 0) {
|
|
38
|
+
myRect = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (myRect) {
|
|
42
|
+
let maxHeight = screenRect.height / 2 - margin;
|
|
43
|
+
if (myRect.height < maxHeight)
|
|
44
|
+
maxHeight = myRect.height;
|
|
45
|
+
const width = screenRect.width - 2 * margin;
|
|
46
|
+
x2 = margin;
|
|
47
|
+
y2 = screenRect.bottom - maxHeight - margin;
|
|
48
|
+
result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
49
|
+
} else {
|
|
50
|
+
const maxHeight = screenRect.height / 2 - margin;
|
|
51
|
+
const width = screenRect.width - 2 * margin;
|
|
52
|
+
x2 = margin;
|
|
53
|
+
y2 = screenRect.bottom - maxHeight - margin;
|
|
54
|
+
result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
let myRect = null;
|
|
58
|
+
if (!fresh) {
|
|
59
|
+
myRect = menu_root.getBoundingClientRect();
|
|
60
|
+
if (myRect.height == 0) {
|
|
61
|
+
myRect = null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (myRect) {
|
|
65
|
+
const m = 15;
|
|
66
|
+
let screenRect = new DOMRect(m, 0, window.innerWidth - 2 * m, window.innerHeight);
|
|
67
|
+
let xShifted = false;
|
|
68
|
+
if (myRect.right > screenRect.right) {
|
|
69
|
+
x2 = screenRect.right - myRect.width + m;
|
|
70
|
+
xShifted = true;
|
|
71
|
+
}
|
|
72
|
+
let yShifted = false;
|
|
73
|
+
if (myRect.bottom > screenRect.bottom) {
|
|
74
|
+
y2 = screenRect.bottom - myRect.height - m;
|
|
75
|
+
if (around) {
|
|
76
|
+
if (xShifted)
|
|
77
|
+
x2 -= around.width;
|
|
78
|
+
else
|
|
79
|
+
y2 -= around.height - m;
|
|
80
|
+
}
|
|
81
|
+
yShifted = true;
|
|
82
|
+
}
|
|
83
|
+
if (myRect.left < screenRect.left)
|
|
84
|
+
x2 = screenRect.left;
|
|
85
|
+
if (myRect.top < screenRect.top)
|
|
86
|
+
y2 = screenRect.top;
|
|
87
|
+
}
|
|
88
|
+
result = `left:${x2}px; top:${y2}px; display: block`;
|
|
43
89
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (rect.top < container_rect.top)
|
|
47
|
-
y = container_rect.top;
|
|
48
|
-
});
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
49
92
|
export async function show(around, _operations) {
|
|
50
93
|
if (around instanceof DOMRect) {
|
|
51
94
|
x = around.left;
|
|
@@ -57,6 +100,7 @@ export async function show(around, _operations) {
|
|
|
57
100
|
around_rect = new DOMRect(x, y, 0, 0);
|
|
58
101
|
}
|
|
59
102
|
visible = true;
|
|
103
|
+
css_position = calculatePosition(x, y, around_rect, true, true);
|
|
60
104
|
operations = [..._operations];
|
|
61
105
|
focused_index = operations.findIndex((o) => !o.disabled);
|
|
62
106
|
const is_root_menu = owner_menu_item == void 0;
|
|
@@ -64,7 +108,28 @@ export async function show(around, _operations) {
|
|
|
64
108
|
hide_window_indicator = 0;
|
|
65
109
|
window.addEventListener("click", on_before_window_click, true);
|
|
66
110
|
}
|
|
111
|
+
if (isDeviceSmallerThan("sm")) {
|
|
112
|
+
$toolsActionsOperations = {
|
|
113
|
+
opver: 1,
|
|
114
|
+
operations: [
|
|
115
|
+
{
|
|
116
|
+
caption: "Menu",
|
|
117
|
+
operations: [
|
|
118
|
+
{
|
|
119
|
+
icon: FaTimes,
|
|
120
|
+
action: (f) => {
|
|
121
|
+
hide();
|
|
122
|
+
},
|
|
123
|
+
fab: "M00",
|
|
124
|
+
tbr: "A"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
67
131
|
await tick();
|
|
132
|
+
css_position = calculatePosition(x, y, around_rect, true, false);
|
|
68
133
|
if (is_root_menu)
|
|
69
134
|
menu_root.addEventListener("click", on_before_container_click, true);
|
|
70
135
|
if (menu_items.length && !isDeviceSmallerThan("sm"))
|
|
@@ -74,7 +139,9 @@ export function isVisible() {
|
|
|
74
139
|
return visible;
|
|
75
140
|
}
|
|
76
141
|
export function hide() {
|
|
142
|
+
$toolsActionsOperations = [];
|
|
77
143
|
visible = false;
|
|
144
|
+
css_position = calculatePosition(x, y, around_rect, false, false);
|
|
78
145
|
window.removeEventListener("click", on_before_window_click, true);
|
|
79
146
|
menu_root.removeEventListener("click", on_before_container_click, true);
|
|
80
147
|
}
|
|
@@ -210,8 +277,8 @@ function mousedown(e) {
|
|
|
210
277
|
|
|
211
278
|
<div id="__hd_svelte_contextmenu"
|
|
212
279
|
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
|
|
213
|
-
z-30 fixed min-w-[{min_width_px}px] w-max"
|
|
214
|
-
style={
|
|
280
|
+
z-30 fixed min-w-[{min_width_px}px] w-max overflow-y-auto"
|
|
281
|
+
style={css_position}
|
|
215
282
|
bind:this={menu_root}>
|
|
216
283
|
|
|
217
284
|
{#each operations as operation, index}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
widthPx?: number | undefined;
|
|
5
|
-
menu_items_id_prefix?: string | undefined;
|
|
6
|
-
owner_menu_item?: HTMLElement | undefined;
|
|
7
|
-
show?: ((around: DOMRect | DOMPoint, _operations: any) => Promise<void>) | undefined;
|
|
8
|
-
isVisible?: (() => boolean) | undefined;
|
|
9
|
-
hide?: (() => void) | undefined;
|
|
10
|
-
getRenderedRect?: (() => DOMRect | undefined) | undefined;
|
|
11
|
-
};
|
|
12
|
-
events: {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {};
|
|
16
|
-
};
|
|
17
|
-
export type ContextmenuProps = typeof __propDef.props;
|
|
18
|
-
export type ContextmenuEvents = typeof __propDef.events;
|
|
19
|
-
export type ContextmenuSlots = typeof __propDef.slots;
|
|
20
|
-
export default class Contextmenu extends SvelteComponentTyped<ContextmenuProps, ContextmenuEvents, ContextmenuSlots> {
|
|
21
|
-
get show(): (around: DOMRect | DOMPoint, _operations: any) => Promise<void>;
|
|
22
|
-
get isVisible(): () => boolean;
|
|
23
|
-
get hide(): () => void;
|
|
24
|
-
get getRenderedRect(): () => DOMRect | undefined;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
widthPx?: number | undefined;
|
|
5
|
+
menu_items_id_prefix?: string | undefined;
|
|
6
|
+
owner_menu_item?: HTMLElement | undefined;
|
|
7
|
+
show?: ((around: DOMRect | DOMPoint, _operations: any) => Promise<void>) | undefined;
|
|
8
|
+
isVisible?: (() => boolean) | undefined;
|
|
9
|
+
hide?: (() => void) | undefined;
|
|
10
|
+
getRenderedRect?: (() => DOMRect | undefined) | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {};
|
|
16
|
+
};
|
|
17
|
+
export type ContextmenuProps = typeof __propDef.props;
|
|
18
|
+
export type ContextmenuEvents = typeof __propDef.events;
|
|
19
|
+
export type ContextmenuSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Contextmenu extends SvelteComponentTyped<ContextmenuProps, ContextmenuEvents, ContextmenuSlots> {
|
|
21
|
+
get show(): (around: DOMRect | DOMPoint, _operations: any) => Promise<void>;
|
|
22
|
+
get isVisible(): () => boolean;
|
|
23
|
+
get hide(): () => void;
|
|
24
|
+
get getRenderedRect(): () => DOMRect | undefined;
|
|
25
|
+
}
|
|
26
|
+
export {};
|