@humandialog/forms.svelte 1.7.28 → 1.8.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.25.svelte +473 -0
- package/components/Fab.25.svelte.d.ts +18 -0
- package/components/Fab.svelte +51 -170
- package/components/Floating_container.25.svelte +178 -0
- package/components/Floating_container.25.svelte.d.ts +23 -0
- package/components/Floating_container.svelte +18 -6
- package/components/Grid.menu.svelte +15 -16
- package/components/Grid.menu.svelte.d.ts +2 -2
- package/components/breadcrumb.svelte +27 -27
- package/components/checkbox.svelte +1 -1
- package/components/combo/combo.svelte +60 -79
- package/components/combo/combo.svelte.d.ts +1 -0
- package/components/contextmenu-25.svelte +518 -0
- package/components/contextmenu-25.svelte.d.ts +26 -0
- package/components/contextmenu.svelte +179 -65
- package/components/contextmenu.svelte.d.ts +2 -2
- package/components/date.svelte +42 -21
- package/components/date.svelte.d.ts +1 -0
- package/components/delayed.spinner.svelte +2 -1
- package/components/document/editor.svelte +21 -31
- package/components/document/editor.svelte.d.ts +0 -2
- package/components/document/internal/palette.row.svelte +10 -8
- package/components/document/internal/palette.svelte +7 -8
- package/components/document/rich.edit.svelte +10 -10
- package/components/edit.field.svelte +1 -1
- package/components/input.text.svelte.d.ts +2 -2
- package/components/inputbox.ltop.svelte +1 -1
- package/components/inputbox.ltop.svelte.d.ts +12 -12
- package/components/kanban/internal/kanban.card.svelte +27 -47
- package/components/kanban/internal/kanban.column.svelte +44 -24
- package/components/kanban/internal/kanban.inserter.svelte +11 -14
- package/components/kanban/internal/kanban.move.menu.svelte +12 -12
- package/components/kanban/internal/kanban.props.svelte +24 -9
- package/components/kanban/kanban.svelte +24 -77
- package/components/kanban/kanban.svelte.d.ts +2 -0
- package/components/kanban copy.zip +0 -0
- package/components/list/List.d.ts +1 -0
- package/components/list/List.js +1 -0
- package/components/list/internal/list.element copy.svelte +530 -0
- package/components/list/internal/list.element copy.svelte.d.ts +35 -0
- package/components/list/internal/list.element.svelte +308 -268
- package/components/list/internal/list.element.svelte.d.ts +5 -7
- package/components/list/internal/list.inserter.svelte +38 -6
- package/components/list/internal/note.txt +5 -0
- package/components/list/list.svelte +32 -11
- package/components/list/list.svelte.d.ts +5 -3
- package/components/list/list.title.svelte +2 -0
- package/components/list/list.title.svelte.d.ts +1 -0
- package/components/menu.d.ts +1 -1
- package/components/menu.js +3 -3
- package/components/paginator.svelte +79 -9
- package/components/prose.editable.p.svelte.d.ts +2 -2
- package/components/prose.editable.span.svelte.d.ts +2 -2
- package/components/r.edit.svelte +9 -0
- package/components/r.edit.svelte.d.ts +23 -0
- package/components/r.editable.svelte +74 -0
- package/components/r.editable.svelte.d.ts +31 -0
- package/components/r.figcaption.svelte +5 -0
- package/components/r.figcaption.svelte.d.ts +27 -0
- package/components/r.figure.svelte +25 -0
- package/components/r.figure.svelte.d.ts +29 -0
- package/components/r.icon.svelte +229 -0
- package/components/r.icon.svelte.d.ts +33 -0
- package/components/radio.svelte +1 -1
- package/components/ricons/arrow-up.svelte +11 -0
- package/components/ricons/arrow-up.svelte.d.ts +27 -0
- package/components/ricons/barcode.svelte +14 -0
- package/components/ricons/barcode.svelte.d.ts +27 -0
- package/components/ricons/bold.svelte +10 -0
- package/components/ricons/bold.svelte.d.ts +27 -0
- package/components/ricons/calendar.svelte +13 -0
- package/components/ricons/calendar.svelte.d.ts +27 -0
- package/components/ricons/calendars.svelte +16 -0
- package/components/ricons/calendars.svelte.d.ts +27 -0
- package/components/ricons/cat.svelte +14 -0
- package/components/ricons/cat.svelte.d.ts +27 -0
- package/components/ricons/check-check.svelte +12 -0
- package/components/ricons/check-check.svelte.d.ts +27 -0
- package/components/ricons/check.svelte +18 -0
- package/components/ricons/check.svelte.d.ts +27 -0
- package/components/ricons/chess-rook.svelte +17 -0
- package/components/ricons/chess-rook.svelte.d.ts +27 -0
- package/components/ricons/chevron-down.svelte +11 -0
- package/components/ricons/chevron-down.svelte.d.ts +27 -0
- package/components/ricons/chevron-left.svelte +11 -0
- package/components/ricons/chevron-left.svelte.d.ts +27 -0
- package/components/ricons/chevron-right.svelte +11 -0
- package/components/ricons/chevron-right.svelte.d.ts +27 -0
- package/components/ricons/chevron-up.svelte +11 -0
- package/components/ricons/chevron-up.svelte.d.ts +27 -0
- package/components/ricons/chevrons-down.svelte +12 -0
- package/components/ricons/chevrons-down.svelte.d.ts +27 -0
- package/components/ricons/chevrons-left-right.svelte +12 -0
- package/components/ricons/chevrons-left-right.svelte.d.ts +27 -0
- package/components/ricons/chevrons-left.svelte +12 -0
- package/components/ricons/chevrons-left.svelte.d.ts +27 -0
- package/components/ricons/chevrons-right.svelte +12 -0
- package/components/ricons/chevrons-right.svelte.d.ts +27 -0
- package/components/ricons/chevrons-up-down.svelte +12 -0
- package/components/ricons/chevrons-up-down.svelte.d.ts +27 -0
- package/components/ricons/chevrons-up.svelte +12 -0
- package/components/ricons/chevrons-up.svelte.d.ts +27 -0
- package/components/ricons/circle-check.svelte +28 -0
- package/components/ricons/circle-check.svelte.d.ts +23 -0
- package/components/ricons/circle-dashed.svelte +19 -0
- package/components/ricons/circle-dashed.svelte.d.ts +27 -0
- package/components/ricons/circle-dot-dashed.svelte +20 -0
- package/components/ricons/circle-dot-dashed.svelte.d.ts +27 -0
- package/components/ricons/circle.svelte +30 -0
- package/components/ricons/circle.svelte.d.ts +23 -0
- package/components/ricons/clipboard-list.svelte +17 -0
- package/components/ricons/clipboard-list.svelte.d.ts +27 -0
- package/components/ricons/clipboard-minus.svelte +9 -0
- package/components/ricons/clipboard-minus.svelte.d.ts +23 -0
- package/components/ricons/clipboard-pen-line.svelte +18 -0
- package/components/ricons/clipboard-pen-line.svelte.d.ts +27 -0
- package/components/ricons/code-xml.svelte +12 -0
- package/components/ricons/code-xml.svelte.d.ts +27 -0
- package/components/ricons/download.svelte +13 -0
- package/components/ricons/download.svelte.d.ts +27 -0
- package/components/ricons/ellipsis-vertical.svelte +14 -0
- package/components/ricons/ellipsis-vertical.svelte.d.ts +27 -0
- package/components/ricons/file-archive.svelte +18 -0
- package/components/ricons/file-archive.svelte.d.ts +27 -0
- package/components/ricons/file-text.svelte +17 -0
- package/components/ricons/file-text.svelte.d.ts +27 -0
- package/components/ricons/folder.svelte +12 -0
- package/components/ricons/folder.svelte.d.ts +27 -0
- package/components/ricons/heading-1.svelte +13 -0
- package/components/ricons/heading-1.svelte.d.ts +27 -0
- package/components/ricons/heading-2.svelte +13 -0
- package/components/ricons/heading-2.svelte.d.ts +27 -0
- package/components/ricons/heading-3.svelte +14 -0
- package/components/ricons/heading-3.svelte.d.ts +27 -0
- package/components/ricons/heading-4.svelte +14 -0
- package/components/ricons/heading-4.svelte.d.ts +27 -0
- package/components/ricons/heading-5.svelte +14 -0
- package/components/ricons/heading-5.svelte.d.ts +27 -0
- package/components/ricons/image.svelte +12 -0
- package/components/ricons/image.svelte.d.ts +27 -0
- package/components/ricons/italic.svelte +12 -0
- package/components/ricons/italic.svelte.d.ts +27 -0
- package/components/ricons/languages.svelte +15 -0
- package/components/ricons/languages.svelte.d.ts +27 -0
- package/components/ricons/list-checks.svelte +15 -0
- package/components/ricons/list-checks.svelte.d.ts +27 -0
- package/components/ricons/list-minus.svelte +14 -0
- package/components/ricons/list-minus.svelte.d.ts +27 -0
- package/components/ricons/list-ordered.svelte +16 -0
- package/components/ricons/list-ordered.svelte.d.ts +27 -0
- package/components/ricons/list-plus.svelte +14 -0
- package/components/ricons/list-plus.svelte.d.ts +27 -0
- package/components/ricons/list.svelte +15 -0
- package/components/ricons/list.svelte.d.ts +27 -0
- package/components/ricons/loader-circle.svelte +19 -0
- package/components/ricons/loader-circle.svelte.d.ts +27 -0
- package/components/ricons/log-in.svelte +12 -0
- package/components/ricons/log-in.svelte.d.ts +27 -0
- package/components/ricons/log-out.svelte +12 -0
- package/components/ricons/log-out.svelte.d.ts +27 -0
- package/components/ricons/message-square.svelte +12 -0
- package/components/ricons/message-square.svelte.d.ts +27 -0
- package/components/ricons/messages-square.svelte +15 -0
- package/components/ricons/messages-square.svelte.d.ts +27 -0
- package/components/ricons/minus.svelte +10 -0
- package/components/ricons/minus.svelte.d.ts +27 -0
- package/components/ricons/notebook-tabs.svelte +19 -0
- package/components/ricons/notebook-tabs.svelte.d.ts +27 -0
- package/components/ricons/notebook.svelte +16 -0
- package/components/ricons/notebook.svelte.d.ts +27 -0
- package/components/ricons/package.svelte +22 -0
- package/components/ricons/package.svelte.d.ts +27 -0
- package/components/ricons/paperclip.svelte +12 -0
- package/components/ricons/paperclip.svelte.d.ts +27 -0
- package/components/ricons/pencil.svelte +12 -0
- package/components/ricons/pencil.svelte.d.ts +27 -0
- package/components/ricons/pilcrow.svelte +12 -0
- package/components/ricons/pilcrow.svelte.d.ts +27 -0
- package/components/ricons/save.svelte +12 -0
- package/components/ricons/save.svelte.d.ts +27 -0
- package/components/ricons/square-check-big.svelte +13 -0
- package/components/ricons/square-check-big.svelte.d.ts +27 -0
- package/components/ricons/square-pen.svelte +14 -0
- package/components/ricons/square-pen.svelte.d.ts +27 -0
- package/components/ricons/square.svelte +10 -0
- package/components/ricons/square.svelte.d.ts +27 -0
- package/components/ricons/strikethrough.svelte +13 -0
- package/components/ricons/strikethrough.svelte.d.ts +27 -0
- package/components/ricons/sun-moon.svelte +15 -0
- package/components/ricons/sun-moon.svelte.d.ts +27 -0
- package/components/ricons/table.svelte +13 -0
- package/components/ricons/table.svelte.d.ts +27 -0
- package/components/ricons/tag.svelte +12 -0
- package/components/ricons/tag.svelte.d.ts +27 -0
- package/components/ricons/text-quote.svelte +14 -0
- package/components/ricons/text-quote.svelte.d.ts +27 -0
- package/components/ricons/turtle.svelte +13 -0
- package/components/ricons/turtle.svelte.d.ts +27 -0
- package/components/ricons/underline.svelte +11 -0
- package/components/ricons/underline.svelte.d.ts +27 -0
- package/components/ricons/upload.svelte +13 -0
- package/components/ricons/upload.svelte.d.ts +27 -0
- package/components/ricons/user.svelte +12 -0
- package/components/ricons/user.svelte.d.ts +27 -0
- package/components/ricons/users.svelte +14 -0
- package/components/ricons/users.svelte.d.ts +27 -0
- package/components/ricons/x.svelte +11 -0
- package/components/ricons/x.svelte.d.ts +27 -0
- package/components/sidebar/sidebar.brand.svelte +14 -13
- package/components/sidebar/sidebar.brand.svelte.d.ts +2 -2
- package/components/sidebar/sidebar.group.svelte +52 -30
- package/components/sidebar/sidebar.item.svelte +35 -141
- package/components/sidebar/sidebar.item.svelte.d.ts +2 -5
- package/components/sidebar/sidebar.list.svelte +8 -8
- package/components/sidebar/sidebar.svelte +19 -2
- package/components/simple.table.svelte.d.ts +4 -4
- package/components/table/_template.table.svelte.d.ts +4 -4
- package/components/tags.svelte +10 -3
- package/components/tags.svelte.d.ts +1 -0
- package/components/textarea.ltop.svelte.d.ts +2 -2
- package/components/tile.title.svelte.d.ts +2 -2
- package/desk.svelte +122 -128
- package/dialog.svelte +17 -7
- package/form.box.svelte.d.ts +4 -4
- package/horizontal.nav.tabs.svelte +197 -23
- package/horizontal.nav.tabs.svelte.d.ts +2 -2
- package/horizontal.toolbar.svelte +25 -18
- package/horizontal.toolbar.svelte.d.ts +2 -2
- package/index.d.ts +10 -3
- package/index.js +10 -3
- package/operations.svelte +51 -22
- package/package.json +89 -1
- package/page.row.svelte.d.ts +2 -2
- package/page.svelte +17 -7
- package/page.svelte.d.ts +10 -10
- package/paper.header.svelte +4 -0
- package/paper.header.svelte.d.ts +27 -0
- package/paper.nav.svelte +8 -0
- package/paper.nav.svelte.d.ts +27 -0
- package/paper.svelte +22 -6
- package/paper.svelte.d.ts +2 -0
- package/paper.table.svelte +27 -0
- package/paper.table.svelte.d.ts +27 -0
- package/paper.top.margin.svelte +5 -0
- package/paper.top.margin.svelte.d.ts +27 -0
- package/stores.d.ts +1 -1
- package/tenant.create.svelte +93 -0
- package/tenant.create.svelte.d.ts +29 -0
- package/tenant.members.svelte +116 -93
- package/tile.svelte.d.ts +4 -4
- package/tiles.row.svelte.d.ts +2 -2
- package/tiles.vertical.row.svelte.d.ts +2 -2
- package/updates.d.ts +4 -0
- package/updates.js +56 -14
- package/utils.d.ts +16 -4
- package/utils.js +214 -99
- package/vertical.toolbar.svelte +62 -47
- package/vertical.toolbar.svelte.d.ts +2 -2
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
<script>import { contextToolbarOperations, pageToolbarOperations, leftHandedFAB, toolsActionsOperations, fabCollapsed, bottom_bar_visible_store, main_sidebar_visible_store, fabHiddenDueToPopup } from "../stores.js";
|
|
2
|
+
import { showFloatingToolbar, showMenu, showGridMenu } from "./menu.js";
|
|
3
|
+
import { FaChevronUp, FaChevronDown, FaChevronLeft, FaChevronRight, FaCircle, FaEllipsisV, FaRegDotCircle, FaDotCircle } from "svelte-icons/fa/";
|
|
4
|
+
import { isDeviceSmallerThan } from "../utils.js";
|
|
5
|
+
import { tick } from "svelte";
|
|
6
|
+
import Ricon from "./r.icon.svelte";
|
|
7
|
+
export let mainPageCoords = void 0;
|
|
8
|
+
$:
|
|
9
|
+
setupCurrentContextOperations(
|
|
10
|
+
$pageToolbarOperations,
|
|
11
|
+
$contextToolbarOperations,
|
|
12
|
+
$toolsActionsOperations,
|
|
13
|
+
$fabCollapsed,
|
|
14
|
+
$bottom_bar_visible_store,
|
|
15
|
+
$main_sidebar_visible_store,
|
|
16
|
+
$leftHandedFAB,
|
|
17
|
+
$fabHiddenDueToPopup
|
|
18
|
+
);
|
|
19
|
+
let operations = [];
|
|
20
|
+
let mainOperation = null;
|
|
21
|
+
let secondaryOperation = null;
|
|
22
|
+
let toolboxOperations = [];
|
|
23
|
+
let isExpandable = false;
|
|
24
|
+
let vToolboxExpanded = false;
|
|
25
|
+
let hToolboxExpanded = false;
|
|
26
|
+
let isDirectPositioningMode = false;
|
|
27
|
+
async function setupCurrentContextOperations(...args) {
|
|
28
|
+
if ($fabHiddenDueToPopup) {
|
|
29
|
+
operations = [];
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
await tick();
|
|
33
|
+
let opVer = 0;
|
|
34
|
+
let main_FAB_position = "";
|
|
35
|
+
isDirectPositioningMode = false;
|
|
36
|
+
if ($toolsActionsOperations && Array.isArray($toolsActionsOperations) && toolsActionsOperations.length > 0) {
|
|
37
|
+
operations = $toolsActionsOperations;
|
|
38
|
+
} else if ($toolsActionsOperations && $toolsActionsOperations.operations && $toolsActionsOperations.operations.length > 0) {
|
|
39
|
+
operations = $toolsActionsOperations.operations;
|
|
40
|
+
opVer = $toolsActionsOperations.opver ?? 0;
|
|
41
|
+
main_FAB_position = $toolsActionsOperations.fab ?? "";
|
|
42
|
+
if (opVer > 0)
|
|
43
|
+
isDirectPositioningMode = true;
|
|
44
|
+
} else if ($contextToolbarOperations && Array.isArray($contextToolbarOperations) && $contextToolbarOperations.length > 0) {
|
|
45
|
+
operations = $contextToolbarOperations;
|
|
46
|
+
} else if ($contextToolbarOperations && $contextToolbarOperations.operations && $contextToolbarOperations.operations.length > 0) {
|
|
47
|
+
operations = $contextToolbarOperations.operations;
|
|
48
|
+
opVer = $contextToolbarOperations.opver ?? 0;
|
|
49
|
+
main_FAB_position = $contextToolbarOperations.fab ?? "";
|
|
50
|
+
if (opVer > 0)
|
|
51
|
+
isDirectPositioningMode = true;
|
|
52
|
+
} else {
|
|
53
|
+
if (Array.isArray($pageToolbarOperations))
|
|
54
|
+
operations = $pageToolbarOperations;
|
|
55
|
+
else {
|
|
56
|
+
operations = $pageToolbarOperations.operations;
|
|
57
|
+
opVer = $pageToolbarOperations.opver ?? 0;
|
|
58
|
+
main_FAB_position = $pageToolbarOperations.fab ?? "";
|
|
59
|
+
if (opVer > 0)
|
|
60
|
+
isDirectPositioningMode = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (opVer == 1) {
|
|
64
|
+
let flatOperations = [];
|
|
65
|
+
operations.forEach((group) => {
|
|
66
|
+
flatOperations = [...flatOperations, ...group.operations];
|
|
67
|
+
});
|
|
68
|
+
operations = flatOperations;
|
|
69
|
+
} else if (opVer == 2) {
|
|
70
|
+
const definedOperations = [...operations];
|
|
71
|
+
if (main_FAB_position) {
|
|
72
|
+
let flatOperations = [];
|
|
73
|
+
definedOperations.forEach((group) => {
|
|
74
|
+
flatOperations.push({
|
|
75
|
+
caption: group.caption,
|
|
76
|
+
separator: true
|
|
77
|
+
});
|
|
78
|
+
flatOperations = [...flatOperations, ...group.operations];
|
|
79
|
+
});
|
|
80
|
+
const realOps = flatOperations.filter((el) => !!el.separator == false);
|
|
81
|
+
if (realOps.length > 1) {
|
|
82
|
+
mainOperation = {
|
|
83
|
+
icon: FaEllipsisV,
|
|
84
|
+
menu: flatOperations,
|
|
85
|
+
fab: main_FAB_position
|
|
86
|
+
};
|
|
87
|
+
operations = [mainOperation];
|
|
88
|
+
} else if (realOps.length == 1) {
|
|
89
|
+
mainOperation = realOps[0];
|
|
90
|
+
mainOperation["fab"] = main_FAB_position;
|
|
91
|
+
operations = [mainOperation];
|
|
92
|
+
} else
|
|
93
|
+
operations = [];
|
|
94
|
+
}
|
|
95
|
+
definedOperations.forEach((group) => {
|
|
96
|
+
group.operations.forEach((op) => {
|
|
97
|
+
if (op.fab) {
|
|
98
|
+
operations = [...operations, op];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
if (operations.length > 1) {
|
|
103
|
+
if (!operations.find((op) => op.fab == "M10")) {
|
|
104
|
+
const collapseFAB = {
|
|
105
|
+
icon: $fabCollapsed ? FaRegDotCircle : FaDotCircle,
|
|
106
|
+
fab: "M10",
|
|
107
|
+
action: (f) => toggleExpandAdditionalOperations()
|
|
108
|
+
};
|
|
109
|
+
operations = [...operations, collapseFAB];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
if (operations.length > 0)
|
|
114
|
+
mainOperation = operations[0];
|
|
115
|
+
else
|
|
116
|
+
mainOperation = null;
|
|
117
|
+
secondaryOperation = null;
|
|
118
|
+
toolboxOperations = [];
|
|
119
|
+
if (operations.length > 1) {
|
|
120
|
+
const operation = operations[1];
|
|
121
|
+
if (!operation.separator) {
|
|
122
|
+
if (!operation.toolbox)
|
|
123
|
+
secondaryOperation = operation;
|
|
124
|
+
else
|
|
125
|
+
toolboxOperations = operation.toolbox;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (operations.length == 3 && secondaryOperation != null || operations.length > 3 || toolboxOperations.length > 0)
|
|
129
|
+
isExpandable = true;
|
|
130
|
+
else
|
|
131
|
+
isExpandable = false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function toggleExpandAdditionalOperations() {
|
|
135
|
+
$fabCollapsed = !$fabCollapsed;
|
|
136
|
+
}
|
|
137
|
+
export function activateMainOperation() {
|
|
138
|
+
const mainOperationButton = document.getElementById("__hd_fab_mainOperation");
|
|
139
|
+
if (!mainOperationButton)
|
|
140
|
+
return;
|
|
141
|
+
mainOperationButton.click();
|
|
142
|
+
}
|
|
143
|
+
function on_click(e, operation) {
|
|
144
|
+
if (!operation)
|
|
145
|
+
return;
|
|
146
|
+
let owner = e.target;
|
|
147
|
+
while (owner && (owner.tagName != "BUTTON" && owner.tagName != "LI"))
|
|
148
|
+
owner = owner.parentElement;
|
|
149
|
+
if (operation.preAction)
|
|
150
|
+
operation.preAction(owner);
|
|
151
|
+
if (operation.action) {
|
|
152
|
+
operation.action(owner);
|
|
153
|
+
}
|
|
154
|
+
if (!owner)
|
|
155
|
+
return;
|
|
156
|
+
let rect = owner.getBoundingClientRect();
|
|
157
|
+
const margin = 15;
|
|
158
|
+
rect.x -= margin;
|
|
159
|
+
rect.y -= margin;
|
|
160
|
+
rect.width += 2 * margin;
|
|
161
|
+
rect.height += 2 * margin;
|
|
162
|
+
const mobile = isDeviceSmallerThan("sm");
|
|
163
|
+
if (operation.menu)
|
|
164
|
+
showMenu(rect, operation.menu);
|
|
165
|
+
else if (operation.toolbar)
|
|
166
|
+
showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
|
|
167
|
+
else if (operation.grid) {
|
|
168
|
+
if (false)
|
|
169
|
+
showMenu(rect, operation.grid);
|
|
170
|
+
else
|
|
171
|
+
showGridMenu(rect, operation.grid, operation.caption ?? "");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function toggleExpandToolboxV(e) {
|
|
175
|
+
vToolboxExpanded = !vToolboxExpanded;
|
|
176
|
+
hToolboxExpanded = vToolboxExpanded;
|
|
177
|
+
}
|
|
178
|
+
function toggleExpandToolboxH(e) {
|
|
179
|
+
hToolboxExpanded = !hToolboxExpanded;
|
|
180
|
+
vToolboxExpanded = hToolboxExpanded;
|
|
181
|
+
}
|
|
182
|
+
function mousedown(e) {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
}
|
|
185
|
+
function getSelectionPos() {
|
|
186
|
+
const selection = window.getSelection();
|
|
187
|
+
if (selection?.rangeCount > 0) {
|
|
188
|
+
const range = selection.getRangeAt(0);
|
|
189
|
+
let rect;
|
|
190
|
+
rect = range.getBoundingClientRect();
|
|
191
|
+
let result = window.innerHeight - rect.top;
|
|
192
|
+
result = Math.floor(result);
|
|
193
|
+
return result;
|
|
194
|
+
} else
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
function calculatePosition(operation) {
|
|
198
|
+
let result = "";
|
|
199
|
+
const fab = operation.fab;
|
|
200
|
+
if (fab.length != 3)
|
|
201
|
+
return "";
|
|
202
|
+
const section = fab[0];
|
|
203
|
+
const col_no = parseInt(fab[1]);
|
|
204
|
+
const row_no = parseInt(fab[2]);
|
|
205
|
+
if (col_no == NaN || row_no == NaN)
|
|
206
|
+
return "";
|
|
207
|
+
const width = 55;
|
|
208
|
+
const height = 55;
|
|
209
|
+
const margin = 0;
|
|
210
|
+
let lShift = 0;
|
|
211
|
+
let tShift = 0;
|
|
212
|
+
let rShift = 0;
|
|
213
|
+
let bShift = 0;
|
|
214
|
+
let vMiddle = "50vh";
|
|
215
|
+
if (!isDeviceSmallerThan("sm")) {
|
|
216
|
+
const container = document.getElementById("__hd_svelte_main_content_container");
|
|
217
|
+
if (container) {
|
|
218
|
+
const containerRect = container?.getBoundingClientRect();
|
|
219
|
+
lShift = containerRect.x;
|
|
220
|
+
tShift = containerRect.y;
|
|
221
|
+
bShift = window.innerHeight - containerRect.bottom;
|
|
222
|
+
rShift = window.innerWidth - containerRect.right;
|
|
223
|
+
vMiddle = `${containerRect.x + containerRect.width / 2}px`;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (!$leftHandedFAB) {
|
|
227
|
+
switch (section) {
|
|
228
|
+
case "M":
|
|
229
|
+
result = `right: ${rShift + margin + col_no * width}px; bottom: ${bShift + margin + row_no * height}px`;
|
|
230
|
+
break;
|
|
231
|
+
case "S":
|
|
232
|
+
result = `left: ${lShift + margin + col_no * width}px; bottom: ${bShift + margin + row_no * height}px`;
|
|
233
|
+
break;
|
|
234
|
+
case "A":
|
|
235
|
+
result = `right: ${rShift + margin + col_no * width}px; top: calc(${vMiddle} - ${row_no * height}px)`;
|
|
236
|
+
break;
|
|
237
|
+
case "C":
|
|
238
|
+
result = `left: ${lShift + margin + col_no * width}px; top: calc(${vMiddle} - ${row_no * height}px)`;
|
|
239
|
+
break;
|
|
240
|
+
case "T":
|
|
241
|
+
result = `right: ${rShift + margin + col_no * width}px; top: ${tShift + margin + row_no * height}px`;
|
|
242
|
+
break;
|
|
243
|
+
case "F":
|
|
244
|
+
result = `left: ${lShift + margin + col_no * width}px; top: ${tShift + margin + row_no * height}px`;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
switch (section) {
|
|
249
|
+
case "M":
|
|
250
|
+
result = `left: ${lShift + margin + col_no * width}px; bottom: ${bShift + margin + row_no * height}px`;
|
|
251
|
+
break;
|
|
252
|
+
case "S":
|
|
253
|
+
result = `right: ${rShift + margin + col_no * width}px; bottom: ${bShift + margin + row_no * height}px`;
|
|
254
|
+
break;
|
|
255
|
+
case "A":
|
|
256
|
+
result = `left: ${lShift + margin + col_no * width}px; top: calc(${vMiddle} - ${row_no * height}px)`;
|
|
257
|
+
break;
|
|
258
|
+
case "C":
|
|
259
|
+
result = `right: ${rShift + margin + col_no * width}px; top: calc(${vMiddle} - ${row_no * height}px)`;
|
|
260
|
+
break;
|
|
261
|
+
case "T":
|
|
262
|
+
result = `left: ${lShift + margin + col_no * width}px; top: ${tShift + margin + row_no * height}px`;
|
|
263
|
+
break;
|
|
264
|
+
case "F":
|
|
265
|
+
result = `right: ${rShift + margin + col_no * width}px; top: ${tShift + margin + row_no * height}px`;
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return result;
|
|
270
|
+
}
|
|
271
|
+
function operationVisible(operation) {
|
|
272
|
+
if (!operation.fab)
|
|
273
|
+
return false;
|
|
274
|
+
if ($fabCollapsed) {
|
|
275
|
+
if (operation.fab == "M00")
|
|
276
|
+
return true;
|
|
277
|
+
if (operation.fab == "M10")
|
|
278
|
+
return true;
|
|
279
|
+
return false;
|
|
280
|
+
} else {
|
|
281
|
+
if (operation.disabledFunc)
|
|
282
|
+
return !operation.disabledFunc();
|
|
283
|
+
else if (operation.disabled)
|
|
284
|
+
return false;
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
</script>
|
|
289
|
+
|
|
290
|
+
{#if isDirectPositioningMode}
|
|
291
|
+
{#if operations && operations.length > 0}
|
|
292
|
+
{#each operations as operation}
|
|
293
|
+
{#if operationVisible(operation)}
|
|
294
|
+
{@const position = calculatePosition(operation)}
|
|
295
|
+
{#if position}
|
|
296
|
+
<button
|
|
297
|
+
class=" w-[55px] h-[55px]
|
|
298
|
+
fixed m-0
|
|
299
|
+
flex items-center justify-center
|
|
300
|
+
disable-dbl-tap-zoom
|
|
301
|
+
cursor-pointer z-20"
|
|
302
|
+
style={position}
|
|
303
|
+
on:click|stopPropagation={(e) => {on_click(e, operation)}}
|
|
304
|
+
on:mousedown={mousedown} >
|
|
305
|
+
|
|
306
|
+
<div class=" text-stone-500 bg-stone-200/70 hover:bg-stone-200
|
|
307
|
+
focus:outline-none font-medium rounded-full text-sm text-center
|
|
308
|
+
dark:text-stone-400 dark:bg-stone-700/80 dark:hover:bg-stone-700
|
|
309
|
+
focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800
|
|
310
|
+
|
|
311
|
+
flex items-center justify-center
|
|
312
|
+
w-6 h-6">
|
|
313
|
+
<div class="w-4 h-4">
|
|
314
|
+
<svelte:component this={operation.icon}/>
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
</button>
|
|
318
|
+
{/if}
|
|
319
|
+
{/if}
|
|
320
|
+
{/each}
|
|
321
|
+
{/if}
|
|
322
|
+
{:else}
|
|
323
|
+
|
|
324
|
+
{#if operations && operations.length > 0}
|
|
325
|
+
{@const topPosition = 350}
|
|
326
|
+
{@const verticalPosition = mainOperation.aboveKeyboard ? `bottom: ${topPosition}px` : "bottom: 10px"}
|
|
327
|
+
<button id="__hd_fab_mainOperation"
|
|
328
|
+
class="text-white bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
|
|
329
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
330
|
+
w-[55px] h-[55px]
|
|
331
|
+
fixed m-0 bottom-0 right-[0px]
|
|
332
|
+
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
|
|
333
|
+
flex items-center justify-center
|
|
334
|
+
disable-dbl-tap-zoom"
|
|
335
|
+
style={verticalPosition}
|
|
336
|
+
on:click|stopPropagation={(e) => {on_click(e, mainOperation)}}
|
|
337
|
+
on:mousedown={mousedown} >
|
|
338
|
+
<div class="w-7 h-7"><svelte:component this={mainOperation.icon}/></div>
|
|
339
|
+
</button>
|
|
340
|
+
|
|
341
|
+
{#if secondaryOperation || isExpandable}
|
|
342
|
+
|
|
343
|
+
<!-- horizontal container -->
|
|
344
|
+
<div class="flex flex-row m-0 fixed bottom-[10px] right-[60px]">
|
|
345
|
+
|
|
346
|
+
{#if isExpandable}
|
|
347
|
+
<!-- Expander -->
|
|
348
|
+
<button class=" bg-transparent mr-2
|
|
349
|
+
w-[55px] h-[55px]
|
|
350
|
+
flex items-center justify-center
|
|
351
|
+
disable-dbl-tap-zoom"
|
|
352
|
+
on:click|stopPropagation={toggleExpandToolboxH}
|
|
353
|
+
on:mousedown={mousedown}>
|
|
354
|
+
<div class=" w-2 h-2
|
|
355
|
+
text-white bg-zinc-500 hover:bg-zinc-500
|
|
356
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
357
|
+
dark:bg-zinc-500 dark:hover:bg-zinc-500
|
|
358
|
+
flex items-center justify-center">
|
|
359
|
+
<div class="w-2 h-2">
|
|
360
|
+
{#if hToolboxExpanded}
|
|
361
|
+
<FaCircle/>
|
|
362
|
+
{:else}
|
|
363
|
+
<FaCircle/>
|
|
364
|
+
{/if}
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
</button>
|
|
368
|
+
|
|
369
|
+
{#if hToolboxExpanded}
|
|
370
|
+
{#if secondaryOperation}
|
|
371
|
+
<button class=" bg-transparent
|
|
372
|
+
mx-0 mr-2 w-[55px] h-[55px]
|
|
373
|
+
flex items-center justify-center
|
|
374
|
+
disable-dbl-tap-zoom"
|
|
375
|
+
on:click|stopPropagation={(e) => {on_click(e, secondaryOperation)}}
|
|
376
|
+
on:mousedown={mousedown}>
|
|
377
|
+
<div class=" w-2 h-2
|
|
378
|
+
text-white bg-zinc-500 group-hover:bg-zinc-500
|
|
379
|
+
dark:bg-zinc-500 dark:group-hover:bg-zinc-500
|
|
380
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
381
|
+
flex items-center justify-center">
|
|
382
|
+
<div class="w-4 h-4"><svelte:component this={secondaryOperation.icon}/></div>
|
|
383
|
+
</div>
|
|
384
|
+
</button>
|
|
385
|
+
{:else if toolboxOperations.length > 0}
|
|
386
|
+
{@const toolbox=toolboxOperations.reverse()}
|
|
387
|
+
{#each toolbox as operation}
|
|
388
|
+
{#if !operation.separator}
|
|
389
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
390
|
+
<button class=" bg-transparent
|
|
391
|
+
mx-0 mr-2 w-[55px] h-[55px]
|
|
392
|
+
flex items-center justify-center
|
|
393
|
+
disable-dbl-tap-zoom"
|
|
394
|
+
on:click|stopPropagation={(e) => {on_click(e, operation)}}
|
|
395
|
+
on:mousedown={mousedown}>
|
|
396
|
+
<div class=" w-2 h-2
|
|
397
|
+
text-white bg-zinc-500 group-hover:bg-zinc-500
|
|
398
|
+
dark:bg-zinc-500 dark:group-hover:bg-zinc-500
|
|
399
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
400
|
+
flex items-center justify-center">
|
|
401
|
+
<div class="w-4 h-4"><svelte:component this={operation.icon}/></div>
|
|
402
|
+
</div>
|
|
403
|
+
</button>
|
|
404
|
+
{/if}
|
|
405
|
+
{/each}
|
|
406
|
+
|
|
407
|
+
{/if}
|
|
408
|
+
{/if}
|
|
409
|
+
{:else}
|
|
410
|
+
<button class=" bg-transparent
|
|
411
|
+
mx-0 mr-2 w-[55px] h-[55px]
|
|
412
|
+
flex items-center justify-center
|
|
413
|
+
disable-dbl-tap-zoom"
|
|
414
|
+
on:click|stopPropagation={(e) => {on_click(e, secondaryOperation)}}
|
|
415
|
+
on:mousedown={mousedown}>
|
|
416
|
+
<div class=" w-2 h-2
|
|
417
|
+
text-white bg-zinc-500 group-hover:bg-zinc-500
|
|
418
|
+
dark:bg-zinc-500 dark:group-hover:bg-zinc-500
|
|
419
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
420
|
+
flex items-center justify-center">
|
|
421
|
+
<div class="w-4 h-4"><svelte:component this={secondaryOperation.icon}/></div>
|
|
422
|
+
</div>
|
|
423
|
+
</button>
|
|
424
|
+
{/if}
|
|
425
|
+
|
|
426
|
+
</div>
|
|
427
|
+
{/if}
|
|
428
|
+
|
|
429
|
+
{#if operations.length > 2} <!-- has vertical operations -->
|
|
430
|
+
<!-- vertical tools container -->
|
|
431
|
+
<ul class="list-none m-0 fixed bottom-[70px] right-0">
|
|
432
|
+
{#if (isExpandable && vToolboxExpanded) || !isExpandable}
|
|
433
|
+
{@const verticalOperations = operations.slice(2).reverse()}
|
|
434
|
+
{#each verticalOperations as operation}
|
|
435
|
+
{#if !operation.separator}
|
|
436
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
437
|
+
<li class="flex flex-row px-0 py-0 justify-end group"
|
|
438
|
+
on:click|stopPropagation={(e) => {on_click(e, operation)}}
|
|
439
|
+
on:mousedown={mousedown}>
|
|
440
|
+
{#if operation.caption}
|
|
441
|
+
<div>
|
|
442
|
+
<span class="block whitespace-nowrap text-sm mt-3 font-semibold text-white mr-3
|
|
443
|
+
select-none bg-stone-700 group-hover:bg-stone-800 px-1 shadow-lg rounded">{operation.caption}</span>
|
|
444
|
+
</div>
|
|
445
|
+
{/if}
|
|
446
|
+
<button class=" bg-transparent
|
|
447
|
+
mx-0 mb-2 w-[55px] h-[55px]
|
|
448
|
+
flex items-center justify-center
|
|
449
|
+
disable-dbl-tap-zoom">
|
|
450
|
+
<div class=" w-2 h-2
|
|
451
|
+
text-white bg-zinc-500 group-hover:bg-zinc-500
|
|
452
|
+
dark:bg-zinc-500 dark:group-hover:bg-zinc-500
|
|
453
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
454
|
+
flex items-center justify-center">
|
|
455
|
+
<div class="w-4 h-4"><svelte:component this={operation.icon}/></div>
|
|
456
|
+
</div>
|
|
457
|
+
</button>
|
|
458
|
+
</li>
|
|
459
|
+
{/if}
|
|
460
|
+
{/each}
|
|
461
|
+
{/if}
|
|
462
|
+
</ul>
|
|
463
|
+
{/if}
|
|
464
|
+
|
|
465
|
+
{/if}
|
|
466
|
+
{/if}
|
|
467
|
+
|
|
468
|
+
<style>
|
|
469
|
+
|
|
470
|
+
.disable-dbl-tap-zoom {
|
|
471
|
+
touch-action: manipulation;
|
|
472
|
+
}
|
|
473
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
mainPageCoords?: undefined;
|
|
5
|
+
activateMainOperation?: (() => void) | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type FabProps = typeof __propDef.props;
|
|
13
|
+
export type FabEvents = typeof __propDef.events;
|
|
14
|
+
export type FabSlots = typeof __propDef.slots;
|
|
15
|
+
export default class Fab extends SvelteComponentTyped<FabProps, FabEvents, FabSlots> {
|
|
16
|
+
get activateMainOperation(): () => void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|