@humandialog/forms.svelte 0.3.5 → 0.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.
- package/README.md +30 -17
- package/components/Fab.svelte +82 -0
- package/components/Fab.svelte.d.ts +14 -0
- package/components/combo/combo.svelte +1 -1
- package/components/contextmenu.svelte +188 -0
- package/components/contextmenu.svelte.d.ts +24 -0
- package/components/delayed.spinner.svelte +18 -0
- package/components/delayed.spinner.svelte.d.ts +16 -0
- package/components/document/internal/palette.row.svelte +1 -1
- package/{icon.svelte → components/icon.svelte} +1 -6
- package/components/inputbox.ltop.svelte.d.ts +4 -4
- package/components/menu.d.ts +1 -0
- package/components/menu.js +16 -0
- package/components/simple.table.svelte.d.ts +4 -4
- package/components/table/_template.table.svelte.d.ts +4 -4
- package/components/table/table.svelte +19 -2
- package/components/table/table.svelte.d.ts +2 -0
- package/components/textarea.ltop.svelte.d.ts +2 -2
- package/components/tile.title.svelte.d.ts +2 -2
- package/desk.svelte +202 -0
- package/desk.svelte.d.ts +23 -0
- package/horizontal.toolbar.svelte +150 -0
- package/horizontal.toolbar.svelte.d.ts +23 -0
- package/index.d.ts +9 -1
- package/index.js +9 -1
- package/internal/configurable.content.svelte +81 -0
- package/internal/configurable.content.svelte.d.ts +27 -0
- package/internal/loading.svelte +6 -0
- package/internal/loading.svelte.d.ts +23 -0
- package/operations.svelte +35 -0
- package/operations.svelte.d.ts +14 -0
- package/package.json +19 -4
- package/page.svelte +34 -12
- package/page.svelte.d.ts +4 -0
- package/stores.d.ts +15 -0
- package/stores.js +72 -1
- package/vertical.toolbar.svelte +146 -0
- package/vertical.toolbar.svelte.d.ts +23 -0
- package/LICENSE +0 -21
- /package/{icon.svelte.d.ts → components/icon.svelte.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
# <img src="https://objectreef.dev/reef.png" alt="ObjectReef logo" width="26"> @humandialog/forms.svelte
|
|
2
|
-
|
|
3
|
-
Basic Svelte UI components for Object Reef applications
|
|
4
|
-
|
|
5
|
-
## Installing
|
|
6
|
-
To install the package on your Svelte project type:\
|
|
7
|
-
`npm install @humandialog/forms.svelte`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
# <img src="https://objectreef.dev/reef.png" alt="ObjectReef logo" width="26"> @humandialog/forms.svelte
|
|
2
|
+
|
|
3
|
+
Basic Svelte UI components for Object Reef applications
|
|
4
|
+
|
|
5
|
+
## Installing
|
|
6
|
+
To install the package on your Svelte project type:\
|
|
7
|
+
`npm install @humandialog/forms.svelte`
|
|
8
|
+
|
|
9
|
+
in your tailwind.config.cjs file add:
|
|
10
|
+
```js
|
|
11
|
+
const config = {
|
|
12
|
+
content: [ ...
|
|
13
|
+
'./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}',
|
|
14
|
+
'./node_modules/@humandialog/forms.svelte/**/*.{html,js,svelte,ts}']
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
To be continued..
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## About ObjectReef®
|
|
27
|
+
Object Reef is a complete platform to design, test and deploy any high performance backend service. It ensures robust, scalability and security with zero tech debt. That Low Code Backend as a Services (BaaS) solution offers you everything you need to develop, maintain, integrate and run the software without the advanced technical knowledge.
|
|
28
|
+
|
|
29
|
+
No matter, if you are creating the simple or complex and critical product, Object Reef is the platform, that simplifies the process of delivering the application backend. It has never been so quick and so robust.
|
|
30
|
+
|
|
18
31
|
More info you'll find at https://objectreef.dev/
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script>import { context_toolbar_operations, page_toolbar_operations, context_items_store } from "../stores.js";
|
|
2
|
+
let expanded = false;
|
|
3
|
+
$:
|
|
4
|
+
update($page_toolbar_operations, $context_toolbar_operations);
|
|
5
|
+
let operations = [];
|
|
6
|
+
function update(...args) {
|
|
7
|
+
if ($context_toolbar_operations && $context_toolbar_operations.length > 0)
|
|
8
|
+
operations = $context_toolbar_operations;
|
|
9
|
+
else
|
|
10
|
+
operations = $page_toolbar_operations;
|
|
11
|
+
}
|
|
12
|
+
function on_click(operation) {
|
|
13
|
+
expanded = false;
|
|
14
|
+
if (!operation)
|
|
15
|
+
return;
|
|
16
|
+
if (!operation.action)
|
|
17
|
+
return;
|
|
18
|
+
let focused_item = null;
|
|
19
|
+
if ($context_items_store.focused)
|
|
20
|
+
focused_item = $context_items_store[$context_items_store.focused];
|
|
21
|
+
operation.action(focused_item);
|
|
22
|
+
}
|
|
23
|
+
function toggle_expand(e) {
|
|
24
|
+
expanded = !expanded;
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
{#if operations && operations.length > 0}
|
|
29
|
+
|
|
30
|
+
{#if operations.length == 1}
|
|
31
|
+
{@const operation = operations[0]}
|
|
32
|
+
<button class="text-white bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
|
|
33
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
34
|
+
mr-2 mb-2 w-10 h-10
|
|
35
|
+
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
|
|
36
|
+
flex items-center justify-center"
|
|
37
|
+
on:click|stopPropagation={(e) => {on_click(operation)}} >
|
|
38
|
+
<div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
|
|
39
|
+
</button>
|
|
40
|
+
{:else}
|
|
41
|
+
<button class="text-white bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
|
|
42
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
43
|
+
mr-2 mb-2 w-10 h-10
|
|
44
|
+
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
|
|
45
|
+
flex items-center justify-center"
|
|
46
|
+
on:click|stopPropagation={toggle_expand}>
|
|
47
|
+
<div class="w-5 h-5">
|
|
48
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
49
|
+
viewBox="0 0 192 512"
|
|
50
|
+
style=" stroke: currentColor;
|
|
51
|
+
fill: currentColor;
|
|
52
|
+
stroke-width: 0;
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: auto;
|
|
55
|
+
max-height: 100%;">
|
|
56
|
+
<path d="M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z" />
|
|
57
|
+
</svg>
|
|
58
|
+
</div>
|
|
59
|
+
</button>
|
|
60
|
+
{#if expanded}
|
|
61
|
+
<ul class="list-none m-0 absolute bottom-[60px] right-0">
|
|
62
|
+
{#each operations as operation}
|
|
63
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
64
|
+
<li class="flex flex-row px-1 py-0 justify-end group"
|
|
65
|
+
on:click|stopPropagation={(e) => {on_click(operation)}}>
|
|
66
|
+
<div>
|
|
67
|
+
<span class="block whitespace-nowrap text-sm mt-3 font-semibold text-white mr-3 select-none bg-slate-700 group-hover:bg-slate-800 px-1 shadow-lg rounded">{operation.caption}</span>
|
|
68
|
+
</div>
|
|
69
|
+
<button class=" text-white bg-blue-700 group-hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
|
|
70
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
71
|
+
mr-1 mb-2 w-10 h-10
|
|
72
|
+
dark:bg-blue-600 dark:group-hover:bg-blue-700 dark:focus:ring-blue-800
|
|
73
|
+
flex items-center justify-center">
|
|
74
|
+
<div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
|
|
75
|
+
</button>
|
|
76
|
+
</li>
|
|
77
|
+
{/each}
|
|
78
|
+
</ul>
|
|
79
|
+
{/if}
|
|
80
|
+
{/if}
|
|
81
|
+
{/if}
|
|
82
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type FabProps = typeof __propDef.props;
|
|
10
|
+
export type FabEvents = typeof __propDef.events;
|
|
11
|
+
export type FabSlots = typeof __propDef.slots;
|
|
12
|
+
export default class Fab extends SvelteComponentTyped<FabProps, FabEvents, FabSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import { parse_width_directive, should_be_comapact } from "../../utils.js";
|
|
|
4
4
|
import { afterUpdate, getContext, setContext } from "svelte";
|
|
5
5
|
import { rCombo_definition, rCombo_item, cached_sources } from "./combo";
|
|
6
6
|
import FaChevronDown from "svelte-icons/fa/FaChevronDown.svelte";
|
|
7
|
-
import Icon from "
|
|
7
|
+
import Icon from "../icon.svelte";
|
|
8
8
|
import { Auth } from "@humandialog/auth.svelte/dist/index.js";
|
|
9
9
|
export let label = "";
|
|
10
10
|
export let self = null;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script>import { afterUpdate, tick } from "svelte";
|
|
2
|
+
import Icon from "./icon.svelte";
|
|
3
|
+
import { context_items_store } from "../stores";
|
|
4
|
+
export let width_px = 400;
|
|
5
|
+
export let menu_items_id_prefix = "__hd_svelte_menuitem_";
|
|
6
|
+
export let owner_menu_item = void 0;
|
|
7
|
+
let x = 0;
|
|
8
|
+
let y = 0;
|
|
9
|
+
let visible = false;
|
|
10
|
+
let menu_root;
|
|
11
|
+
let operations = [];
|
|
12
|
+
let min_width_px = 200;
|
|
13
|
+
let focused_index = 0;
|
|
14
|
+
let menu_items = [];
|
|
15
|
+
let submenus = [];
|
|
16
|
+
$:
|
|
17
|
+
display = visible ? "block" : "none";
|
|
18
|
+
afterUpdate(() => {
|
|
19
|
+
let rect = menu_root.getBoundingClientRect();
|
|
20
|
+
if (rect.height == 0)
|
|
21
|
+
return;
|
|
22
|
+
let container_rect = new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
23
|
+
if (rect.right > container_rect.right)
|
|
24
|
+
x = container_rect.right - rect.width;
|
|
25
|
+
if (rect.bottom > container_rect.bottom)
|
|
26
|
+
y = container_rect.bottom - rect.height;
|
|
27
|
+
if (rect.left < container_rect.left)
|
|
28
|
+
x = container_rect.left;
|
|
29
|
+
if (rect.top < container_rect.top)
|
|
30
|
+
y = container_rect.top;
|
|
31
|
+
});
|
|
32
|
+
export async function show(_x, _y, _operations) {
|
|
33
|
+
x = _x;
|
|
34
|
+
y = _y;
|
|
35
|
+
visible = true;
|
|
36
|
+
operations = [..._operations];
|
|
37
|
+
focused_index = 0;
|
|
38
|
+
await tick();
|
|
39
|
+
if (menu_items.length)
|
|
40
|
+
focus_menu_item(focused_index);
|
|
41
|
+
}
|
|
42
|
+
export function hide() {
|
|
43
|
+
visible = false;
|
|
44
|
+
}
|
|
45
|
+
export function get_rendered_rect() {
|
|
46
|
+
if (menu_root)
|
|
47
|
+
return menu_root.getBoundingClientRect();
|
|
48
|
+
else
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
function on_keydown(e, operation, index) {
|
|
52
|
+
switch (e.key) {
|
|
53
|
+
case "Esc":
|
|
54
|
+
case "Escape":
|
|
55
|
+
hide();
|
|
56
|
+
break;
|
|
57
|
+
case "ArrowDown":
|
|
58
|
+
navigate_down();
|
|
59
|
+
break;
|
|
60
|
+
case "ArrowUp":
|
|
61
|
+
navigate_up();
|
|
62
|
+
break;
|
|
63
|
+
case "ArrowLeft":
|
|
64
|
+
hide_submenu();
|
|
65
|
+
break;
|
|
66
|
+
case "Enter":
|
|
67
|
+
execute_action(operation, index);
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function navigate_up() {
|
|
74
|
+
let index = focused_index;
|
|
75
|
+
while (index > 0 && menu_items.length > 0) {
|
|
76
|
+
let prev_item = menu_items[--index];
|
|
77
|
+
if (prev_item) {
|
|
78
|
+
focus_menu_item(index);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function navigate_down() {
|
|
84
|
+
let index = focused_index;
|
|
85
|
+
while (index + 1 < menu_items.length) {
|
|
86
|
+
let next_item = menu_items[++index];
|
|
87
|
+
if (next_item) {
|
|
88
|
+
focus_menu_item(index);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function on_change_focus(e) {
|
|
94
|
+
if (e.relatedTarget && e.relatedTarget.id.startsWith(menu_items_id_prefix))
|
|
95
|
+
return;
|
|
96
|
+
else
|
|
97
|
+
hide();
|
|
98
|
+
}
|
|
99
|
+
function on_mouse_move(index) {
|
|
100
|
+
focus_menu_item(index);
|
|
101
|
+
}
|
|
102
|
+
function execute_action(operation, index) {
|
|
103
|
+
if (operation.menu) {
|
|
104
|
+
focus_menu_item(index);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
hide();
|
|
108
|
+
if (!operation)
|
|
109
|
+
return;
|
|
110
|
+
if (!operation.action)
|
|
111
|
+
return;
|
|
112
|
+
let context_item = null;
|
|
113
|
+
if ($context_items_store.focused)
|
|
114
|
+
context_item = $context_items_store[$context_items_store.focused];
|
|
115
|
+
operation.action(context_item);
|
|
116
|
+
}
|
|
117
|
+
function focus_menu_item(index) {
|
|
118
|
+
focused_index = index;
|
|
119
|
+
let element = menu_items[focused_index];
|
|
120
|
+
element.focus();
|
|
121
|
+
if (submenus && submenus.length && submenus[focused_index]) {
|
|
122
|
+
let rect = element.getBoundingClientRect();
|
|
123
|
+
let container_rect = new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
124
|
+
let _x = rect.right;
|
|
125
|
+
let _y = rect.top;
|
|
126
|
+
let submenu_width = min_width_px;
|
|
127
|
+
let rendered_rect = submenus[focused_index].get_rendered_rect();
|
|
128
|
+
if (rendered_rect && rendered_rect.width > 0)
|
|
129
|
+
submenu_width = rendered_rect.width;
|
|
130
|
+
if (_x + submenu_width > container_rect.right) {
|
|
131
|
+
if (rect.left - container_rect.left > container_rect.right - rect.right)
|
|
132
|
+
_x = rect.left - submenu_width;
|
|
133
|
+
}
|
|
134
|
+
submenus[focused_index].show(_x, _y, operations[focused_index].menu);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function hide_submenu() {
|
|
138
|
+
if (!owner_menu_item)
|
|
139
|
+
return;
|
|
140
|
+
owner_menu_item.focus();
|
|
141
|
+
}
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<div id="__hd_svelte_contextmenu"
|
|
145
|
+
class="bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 rounded-lg border border-gray-200 dark:border-gray-700 shadow-md z-20 fixed min-w-[{min_width_px}px]"
|
|
146
|
+
style={`left:${x}px; top:${y}px; display:${display}`}
|
|
147
|
+
bind:this={menu_root}
|
|
148
|
+
on:focusout={on_change_focus}>
|
|
149
|
+
|
|
150
|
+
{#each operations as operation, index}
|
|
151
|
+
{@const is_separator = operation.separator}
|
|
152
|
+
{#if is_separator}
|
|
153
|
+
<hr class="my-1 mx-1">
|
|
154
|
+
{:else}
|
|
155
|
+
{@const icon_placeholder_size = operation.description ? 12 : 10}
|
|
156
|
+
{@const menu_item_id = menu_items_id_prefix + index}
|
|
157
|
+
{@const active = focused_index == index ? 'bg-gray-200 dark:bg-gray-700' : ''}
|
|
158
|
+
{@const has_submenu = operation.menu !== undefined && operation.menu.length > 0}
|
|
159
|
+
|
|
160
|
+
<button class="font-medium m-0 p-2 text-sm w-full text-left flex flex-row cursor-context-menu {active} focus:outline-none"
|
|
161
|
+
id={menu_item_id}
|
|
162
|
+
bind:this={menu_items[index]}
|
|
163
|
+
on:click|stopPropagation={(e) => { execute_action(operation, index) } }
|
|
164
|
+
on:mouseenter = {(e) => {on_mouse_move(index)}}
|
|
165
|
+
on:keydown|stopPropagation={(e) => on_keydown(e, operation, index)}>
|
|
166
|
+
|
|
167
|
+
<div class="flex items-center justify-center" style:width={`${icon_placeholder_size*0.25}rem`}>
|
|
168
|
+
{#if operation.icon}
|
|
169
|
+
{@const icon_size = icon_placeholder_size - 6}
|
|
170
|
+
<Icon size={icon_size} component={operation.icon}/>
|
|
171
|
+
{/if}
|
|
172
|
+
</div>
|
|
173
|
+
<div class="">
|
|
174
|
+
<p>{operation.caption}</p>
|
|
175
|
+
{#if operation.description}
|
|
176
|
+
{@const shortcut_width_px = operation.shortcut ? 80 : 0}
|
|
177
|
+
<p class="text-sm font-normal text-gray-400 dark:text-gray-500 truncate inline-block"
|
|
178
|
+
style:max-width={`calc(${width_px-shortcut_width_px} - 3rem)`} >{operation.description}</p>
|
|
179
|
+
{/if}
|
|
180
|
+
</div>
|
|
181
|
+
{#if has_submenu}
|
|
182
|
+
<p class="ms-auto pr-1 text-sm font-mono text-gray-500">→</p>
|
|
183
|
+
<svelte:self bind:this={submenus[index]} menu_items_id_prefix={`${menu_item_id}_`} owner_menu_item={menu_items[index]}/>
|
|
184
|
+
{/if}
|
|
185
|
+
</button>
|
|
186
|
+
{/if}
|
|
187
|
+
{/each}
|
|
188
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
width_px?: number | undefined;
|
|
5
|
+
menu_items_id_prefix?: string | undefined;
|
|
6
|
+
owner_menu_item?: HTMLElement | undefined;
|
|
7
|
+
show?: ((_x: number, _y: number, _operations: any) => Promise<void>) | undefined;
|
|
8
|
+
hide?: (() => void) | undefined;
|
|
9
|
+
get_rendered_rect?: (() => DOMRect | undefined) | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
};
|
|
16
|
+
export type ContextmenuProps = typeof __propDef.props;
|
|
17
|
+
export type ContextmenuEvents = typeof __propDef.events;
|
|
18
|
+
export type ContextmenuSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Contextmenu extends SvelteComponentTyped<ContextmenuProps, ContextmenuEvents, ContextmenuSlots> {
|
|
20
|
+
get show(): (_x: number, _y: number, _operations: any) => Promise<void>;
|
|
21
|
+
get hide(): () => void;
|
|
22
|
+
get get_rendered_rect(): () => DOMRect | undefined;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import { Spinner } from "flowbite-svelte";
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
export let delay = 100;
|
|
4
|
+
let visible = false;
|
|
5
|
+
onMount(() => {
|
|
6
|
+
visible = false;
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
visible = true;
|
|
9
|
+
}, delay);
|
|
10
|
+
return () => {
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
{#if visible}
|
|
17
|
+
<Spinner/>
|
|
18
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
delay?: number | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type DelayedProps = typeof __propDef.props;
|
|
12
|
+
export type DelayedEvents = typeof __propDef.events;
|
|
13
|
+
export type DelayedSlots = typeof __propDef.slots;
|
|
14
|
+
export default class Delayed extends SvelteComponentTyped<DelayedProps, DelayedEvents, DelayedSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<svelte:options accessors={true}/>
|
|
2
|
-
<script>import { icons } from "
|
|
2
|
+
<script>import { icons } from "../utils.js";
|
|
3
3
|
export let component = null;
|
|
4
4
|
export let module_name = "fa/FaQuestion";
|
|
5
5
|
export let img = "";
|
|
@@ -53,11 +53,6 @@ $: {
|
|
|
53
53
|
_bg = color;
|
|
54
54
|
} else if (symbol) {
|
|
55
55
|
} else if (!component) {
|
|
56
|
-
import("../../node_modules/svelte-icons/" + module_name + ".svelte").then(
|
|
57
|
-
(module) => {
|
|
58
|
-
component = module.default || module;
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
56
|
} else
|
|
62
57
|
component = component;
|
|
63
58
|
}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} InputboxSlots */
|
|
4
4
|
export default class Inputbox extends SvelteComponentTyped<{
|
|
5
5
|
[x: string]: any;
|
|
6
|
+
label?: string | undefined;
|
|
7
|
+
a?: string | undefined;
|
|
6
8
|
context?: string | undefined;
|
|
7
9
|
self?: null | undefined;
|
|
8
10
|
c?: string | undefined;
|
|
9
|
-
label?: string | undefined;
|
|
10
11
|
typename?: string | undefined;
|
|
11
|
-
a?: string | undefined;
|
|
12
12
|
s?: string | undefined;
|
|
13
13
|
placeholder?: string | undefined;
|
|
14
14
|
itype?: string | undefined;
|
|
@@ -25,12 +25,12 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
25
25
|
declare const __propDef: {
|
|
26
26
|
props: {
|
|
27
27
|
[x: string]: any;
|
|
28
|
+
label?: string | undefined;
|
|
29
|
+
a?: string | undefined;
|
|
28
30
|
context?: string | undefined;
|
|
29
31
|
self?: null | undefined;
|
|
30
32
|
c?: string | undefined;
|
|
31
|
-
label?: string | undefined;
|
|
32
33
|
typename?: string | undefined;
|
|
33
|
-
a?: string | undefined;
|
|
34
34
|
s?: string | undefined;
|
|
35
35
|
placeholder?: string | undefined;
|
|
36
36
|
itype?: string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function show_menu(x: number, y: number, operations: any): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Menu from './contextmenu.svelte';
|
|
2
|
+
let menu_comopnent = null;
|
|
3
|
+
export function show_menu(x, y, operations) {
|
|
4
|
+
let menu_element = document.getElementById("__hd_svelte_contextmenu");
|
|
5
|
+
if (!menu_element) {
|
|
6
|
+
menu_comopnent = new Menu({
|
|
7
|
+
target: document.body,
|
|
8
|
+
props: {}
|
|
9
|
+
});
|
|
10
|
+
menu_comopnent.show(x, y, operations);
|
|
11
|
+
}
|
|
12
|
+
else if (menu_comopnent)
|
|
13
|
+
menu_comopnent.show(x, y, operations);
|
|
14
|
+
else
|
|
15
|
+
console.error('what now?');
|
|
16
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} SimpleEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SimpleSlots */
|
|
4
4
|
export default class Simple extends SvelteComponentTyped<{
|
|
5
|
-
context?: string | undefined;
|
|
6
|
-
self?: null | undefined;
|
|
7
5
|
focus?: boolean | undefined;
|
|
8
6
|
select?: string | undefined;
|
|
7
|
+
context?: string | undefined;
|
|
8
|
+
self?: null | undefined;
|
|
9
9
|
nav?: boolean | undefined;
|
|
10
10
|
collection?: string | undefined;
|
|
11
11
|
objects?: null | undefined;
|
|
@@ -22,10 +22,10 @@ export type SimpleSlots = typeof __propDef.slots;
|
|
|
22
22
|
import { SvelteComponentTyped } from "svelte";
|
|
23
23
|
declare const __propDef: {
|
|
24
24
|
props: {
|
|
25
|
-
context?: string | undefined;
|
|
26
|
-
self?: null | undefined;
|
|
27
25
|
focus?: boolean | undefined;
|
|
28
26
|
select?: string | undefined;
|
|
27
|
+
context?: string | undefined;
|
|
28
|
+
self?: null | undefined;
|
|
29
29
|
nav?: boolean | undefined;
|
|
30
30
|
collection?: string | undefined;
|
|
31
31
|
objects?: null | undefined;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} TemplateEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TemplateSlots */
|
|
4
4
|
export default class Template extends SvelteComponentTyped<{
|
|
5
|
-
context?: string | undefined;
|
|
6
|
-
self?: null | undefined;
|
|
7
5
|
focus?: boolean | undefined;
|
|
8
6
|
select?: string | undefined;
|
|
7
|
+
context?: string | undefined;
|
|
8
|
+
self?: null | undefined;
|
|
9
9
|
nav?: boolean | undefined;
|
|
10
10
|
collection?: string | undefined;
|
|
11
11
|
objects?: null | undefined;
|
|
@@ -30,10 +30,10 @@ export type TemplateSlots = typeof __propDef.slots;
|
|
|
30
30
|
import { SvelteComponentTyped } from "svelte";
|
|
31
31
|
declare const __propDef: {
|
|
32
32
|
props: {
|
|
33
|
-
context?: string | undefined;
|
|
34
|
-
self?: null | undefined;
|
|
35
33
|
focus?: boolean | undefined;
|
|
36
34
|
select?: string | undefined;
|
|
35
|
+
context?: string | undefined;
|
|
36
|
+
self?: null | undefined;
|
|
37
37
|
nav?: boolean | undefined;
|
|
38
38
|
collection?: string | undefined;
|
|
39
39
|
objects?: null | undefined;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
<script>import { data_tick_store, context_items_store, context_info_store, context_types_store } from "../../stores.js";
|
|
1
|
+
<script>import { data_tick_store, context_items_store, context_info_store, context_types_store, context_toolbar_operations } from "../../stores.js";
|
|
2
2
|
import { getContext, setContext, onDestroy } from "svelte";
|
|
3
3
|
import { rTable_definition } from "./table";
|
|
4
4
|
import { parse_width_directive } from "../../utils.js";
|
|
5
|
+
import { show_menu } from "../menu";
|
|
5
6
|
export let context = "";
|
|
6
7
|
export let collection = "";
|
|
7
8
|
export let self = null;
|
|
@@ -14,6 +15,8 @@ export let focus = true;
|
|
|
14
15
|
export let nav = true;
|
|
15
16
|
export let c = "";
|
|
16
17
|
export let typename = "";
|
|
18
|
+
export let toolbar_operations = [];
|
|
19
|
+
export let menu_operations = [];
|
|
17
20
|
let definition = new rTable_definition();
|
|
18
21
|
setContext("rTable-definition", definition);
|
|
19
22
|
setContext("rIs-table-component", true);
|
|
@@ -59,6 +62,10 @@ export function select_item(itm, cinfo2) {
|
|
|
59
62
|
$context_types_store[select] = itm.oclType;
|
|
60
63
|
if (focus)
|
|
61
64
|
$context_items_store.focused = select;
|
|
65
|
+
if (itm)
|
|
66
|
+
$context_toolbar_operations = [...toolbar_operations];
|
|
67
|
+
else
|
|
68
|
+
$context_toolbar_operations = [];
|
|
62
69
|
if (nav)
|
|
63
70
|
$data_tick_store = $data_tick_store + 1;
|
|
64
71
|
}
|
|
@@ -72,6 +79,15 @@ function override_items_from_slot(...args) {
|
|
|
72
79
|
}
|
|
73
80
|
return 0;
|
|
74
81
|
}
|
|
82
|
+
function show_context_menu(e, itm, cinfo2) {
|
|
83
|
+
if (!menu_operations)
|
|
84
|
+
return;
|
|
85
|
+
if (menu_operations.length == 0)
|
|
86
|
+
return;
|
|
87
|
+
e.stopPropagation();
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
show_menu(e.clientX, e.clientY, menu_operations);
|
|
90
|
+
}
|
|
75
91
|
</script>
|
|
76
92
|
|
|
77
93
|
{#if true}
|
|
@@ -101,7 +117,8 @@ function override_items_from_slot(...args) {
|
|
|
101
117
|
<tbody class="bg-white dark:bg-slate-900">
|
|
102
118
|
{#each items as item}
|
|
103
119
|
{#if (item != null )}
|
|
104
|
-
<tr on:click={ (e) => { select_item(item, cinfo);} }
|
|
120
|
+
<tr on:click={ (e) => { e.stopPropagation(); e.preventDefault(); select_item(item, cinfo);} }
|
|
121
|
+
on:contextmenu={ (e) => {select_item(item, cinfo); show_context_menu(e, item, cinfo)} }
|
|
105
122
|
class="whitespace-nowrap text-sm font-normal text-gray-900 dark:text-gray-300"
|
|
106
123
|
class:bg-slate-100={item==selected_item}
|
|
107
124
|
class:dark:bg-slate-700={item==selected_item}>
|
|
@@ -13,6 +13,8 @@ declare const __propDef: {
|
|
|
13
13
|
nav?: boolean | undefined;
|
|
14
14
|
c?: string | undefined;
|
|
15
15
|
typename?: string | undefined;
|
|
16
|
+
toolbar_operations?: any[] | undefined;
|
|
17
|
+
menu_operations?: any[] | undefined;
|
|
16
18
|
refresh?: (() => void) | undefined;
|
|
17
19
|
update_objects?: ((_objects: any) => void) | undefined;
|
|
18
20
|
update_self?: ((_self: any) => void) | undefined;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} TextareaEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TextareaSlots */
|
|
4
4
|
export default class Textarea extends SvelteComponentTyped<{
|
|
5
|
-
c?: string | undefined;
|
|
6
5
|
label?: string | undefined;
|
|
6
|
+
c?: string | undefined;
|
|
7
7
|
s?: string | undefined;
|
|
8
8
|
placeholder?: string | undefined;
|
|
9
9
|
val?: string | undefined;
|
|
@@ -19,8 +19,8 @@ export type TextareaSlots = typeof __propDef.slots;
|
|
|
19
19
|
import { SvelteComponentTyped } from "svelte";
|
|
20
20
|
declare const __propDef: {
|
|
21
21
|
props: {
|
|
22
|
-
c?: string | undefined;
|
|
23
22
|
label?: string | undefined;
|
|
23
|
+
c?: string | undefined;
|
|
24
24
|
s?: string | undefined;
|
|
25
25
|
placeholder?: string | undefined;
|
|
26
26
|
val?: string | undefined;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TileSlots */
|
|
4
4
|
export default class Tile extends SvelteComponentTyped<{
|
|
5
5
|
[x: string]: any;
|
|
6
|
-
c?: string | undefined;
|
|
7
6
|
label?: string | undefined;
|
|
8
7
|
a?: string | undefined;
|
|
8
|
+
c?: string | undefined;
|
|
9
9
|
}, {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
}, {}> {
|
|
@@ -17,9 +17,9 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
17
17
|
declare const __propDef: {
|
|
18
18
|
props: {
|
|
19
19
|
[x: string]: any;
|
|
20
|
-
c?: string | undefined;
|
|
21
20
|
label?: string | undefined;
|
|
22
21
|
a?: string | undefined;
|
|
22
|
+
c?: string | undefined;
|
|
23
23
|
};
|
|
24
24
|
events: {
|
|
25
25
|
[evt: string]: CustomEvent<any>;
|