@humandialog/forms.svelte 1.3.15 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Fab.svelte +3 -6
- package/components/Floating_container.svelte +6 -5
- package/components/combo/combo.svelte +15 -6
- package/components/contextmenu.svelte +8 -6
- package/components/document/editor.svelte +5 -4
- package/components/inputbox.ltop.svelte +13 -3
- package/components/inputbox.ltop.svelte.d.ts +3 -0
- package/components/kanban/internal/kanban.card.svelte +3 -1
- package/components/kanban/kanban.callbacks.svelte +2 -0
- package/components/kanban/kanban.callbacks.svelte.d.ts +1 -0
- package/components/kanban/kanban.svelte +41 -25
- package/components/kanban/kanban.svelte.d.ts +2 -2
- package/components/list/internal/list.element.svelte +27 -14
- package/components/list/internal/list.element.svelte.d.ts +1 -0
- package/components/list/list.svelte +17 -17
- package/components/sidebar/sidebar.item.svelte +17 -4
- package/desk.svelte +4 -1
- package/modal.svelte +9 -6
- package/operations.svelte +4 -7
- package/package.json +1 -1
- package/stores.d.ts +2 -0
- package/stores.js +25 -0
package/components/Fab.svelte
CHANGED
|
@@ -66,15 +66,12 @@ export function activateMainOperation() {
|
|
|
66
66
|
function on_click(e, operation) {
|
|
67
67
|
if (!operation)
|
|
68
68
|
return;
|
|
69
|
-
if (operation.action) {
|
|
70
|
-
let focused_item = null;
|
|
71
|
-
if ($contextItemsStore.focused)
|
|
72
|
-
focused_item = $contextItemsStore[$contextItemsStore.focused];
|
|
73
|
-
operation.action(focused_item);
|
|
74
|
-
}
|
|
75
69
|
let owner = e.target;
|
|
76
70
|
while (owner && (owner.tagName != "BUTTON" && owner.tagName != "LI"))
|
|
77
71
|
owner = owner.parentElement;
|
|
72
|
+
if (operation.action) {
|
|
73
|
+
operation.action(owner);
|
|
74
|
+
}
|
|
78
75
|
if (!owner)
|
|
79
76
|
return;
|
|
80
77
|
let rect = owner.getBoundingClientRect();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { tick, afterUpdate } from "svelte";
|
|
2
2
|
import { isDeviceSmallerThan } from "../utils";
|
|
3
|
-
import {
|
|
3
|
+
import { pushToolsActionsOperations, popToolsActionsOperations } from "../stores";
|
|
4
4
|
import { FaTimes } from "svelte-icons/fa";
|
|
5
5
|
let x;
|
|
6
6
|
let y;
|
|
@@ -35,7 +35,7 @@ export async function show(around, _toolbar, _props = {}) {
|
|
|
35
35
|
hide_window_indicator = 0;
|
|
36
36
|
window.addEventListener("click", on_before_window_click, true);
|
|
37
37
|
if (isDeviceSmallerThan("sm")) {
|
|
38
|
-
|
|
38
|
+
pushToolsActionsOperations({
|
|
39
39
|
opver: 1,
|
|
40
40
|
operations: [
|
|
41
41
|
{
|
|
@@ -52,7 +52,7 @@ export async function show(around, _toolbar, _props = {}) {
|
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
54
|
]
|
|
55
|
-
};
|
|
55
|
+
});
|
|
56
56
|
}
|
|
57
57
|
await tick();
|
|
58
58
|
if (!was_visible)
|
|
@@ -63,9 +63,10 @@ export function isVisible() {
|
|
|
63
63
|
return visible;
|
|
64
64
|
}
|
|
65
65
|
export function hide() {
|
|
66
|
+
if (visible)
|
|
67
|
+
popToolsActionsOperations();
|
|
66
68
|
visible = false;
|
|
67
69
|
cssPosition = calculatePosition(x, y, around_rect, false, false);
|
|
68
|
-
$toolsActionsOperations = [];
|
|
69
70
|
window.removeEventListener("click", on_before_window_click, true);
|
|
70
71
|
rootElement?.removeEventListener("click", on_before_container_click, true);
|
|
71
72
|
}
|
|
@@ -149,7 +150,7 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
|
149
150
|
</script>
|
|
150
151
|
|
|
151
152
|
<div id="__hd_svelte_floating_container"
|
|
152
|
-
class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow
|
|
153
|
+
class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow-md shadow-stone-500 dark:shadow-black z-30 fixed "
|
|
153
154
|
style={cssPosition}
|
|
154
155
|
bind:this={rootElement}>
|
|
155
156
|
<svelte:component this={toolbar} {...props} bind:this={internalElement} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import { data_tick_store, contextItemsStore, contextTypesStore,
|
|
1
|
+
<script>import { data_tick_store, contextItemsStore, contextTypesStore, pushToolsActionsOperations, popToolsActionsOperations } from "../../stores.js";
|
|
2
2
|
import { informModification, pushChanges } from "../../updates.js";
|
|
3
3
|
import { isDeviceSmallerThan, parseWidthDirective, shouldBeComapact } from "../../utils.js";
|
|
4
4
|
import { afterUpdate, getContext, onMount, setContext } from "svelte";
|
|
@@ -171,7 +171,11 @@ 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;
|
|
175
|
+
if (is_compact)
|
|
176
|
+
rect = textbox.getBoundingClientRect();
|
|
177
|
+
else
|
|
178
|
+
rect = combo.getBoundingClientRect();
|
|
175
179
|
let top_space = rect.y;
|
|
176
180
|
let bottom_space = client_rect.height - (rect.y + rect.height);
|
|
177
181
|
let palette_max_height_px = 500;
|
|
@@ -216,6 +220,8 @@ export function show(event, hide_callback) {
|
|
|
216
220
|
dropdown_position = `min-width: ${palette_width_px}px; max-height:${palette_max_height_px}px; position: fixed; left:${x}px; top:${y}px;`;
|
|
217
221
|
if (show_above)
|
|
218
222
|
dropdown_position += " transform: translate(0, -100%);";
|
|
223
|
+
if (!is_compact)
|
|
224
|
+
dropdown_position += `width: ${preferred_palette_width}px`;
|
|
219
225
|
}
|
|
220
226
|
is_dropdown_open = true;
|
|
221
227
|
if (filtered) {
|
|
@@ -235,7 +241,7 @@ export function show(event, hide_callback) {
|
|
|
235
241
|
});
|
|
236
242
|
}
|
|
237
243
|
if (isDeviceSmallerThan("sm")) {
|
|
238
|
-
|
|
244
|
+
pushToolsActionsOperations({
|
|
239
245
|
opver: 1,
|
|
240
246
|
operations: [
|
|
241
247
|
{
|
|
@@ -252,14 +258,16 @@ export function show(event, hide_callback) {
|
|
|
252
258
|
]
|
|
253
259
|
}
|
|
254
260
|
]
|
|
255
|
-
};
|
|
261
|
+
});
|
|
256
262
|
}
|
|
257
263
|
}
|
|
258
264
|
export function hide() {
|
|
265
|
+
if (!is_dropdown_open)
|
|
266
|
+
return;
|
|
259
267
|
if (mutation_observer)
|
|
260
268
|
mutation_observer.disconnect();
|
|
261
269
|
is_dropdown_open = false;
|
|
262
|
-
|
|
270
|
+
popToolsActionsOperations();
|
|
263
271
|
dropdown_position = "display: none;";
|
|
264
272
|
combo_text = get_combo_text();
|
|
265
273
|
if (!!textbox)
|
|
@@ -643,7 +651,8 @@ function on_focus_out(e) {
|
|
|
643
651
|
{combo_text}</span>
|
|
644
652
|
|
|
645
653
|
{#if can_be_activated }
|
|
646
|
-
<div class="w-3 h-3 no-print flex-none text-stone-700 dark:text-stone-300 {chevron_mt}"
|
|
654
|
+
<div class="w-3 h-3 no-print flex-none text-stone-700 dark:text-stone-300 {chevron_mt}"
|
|
655
|
+
class:ms-auto={!is_compact}>
|
|
647
656
|
<FaChevronDown/>
|
|
648
657
|
</div>
|
|
649
658
|
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { afterUpdate, tick } from "svelte";
|
|
2
2
|
import Icon from "./icon.svelte";
|
|
3
|
-
import { contextItemsStore,
|
|
3
|
+
import { contextItemsStore, pushToolsActionsOperations, popToolsActionsOperations } from "../stores";
|
|
4
4
|
import { isDeviceSmallerThan, isOnScreenKeyboardVisible } from "../utils";
|
|
5
5
|
import { hideWholeContextMenu } from "./menu";
|
|
6
6
|
import { FaTimes } from "svelte-icons/fa";
|
|
@@ -109,7 +109,7 @@ export async function show(around, _operations) {
|
|
|
109
109
|
window.addEventListener("click", on_before_window_click, true);
|
|
110
110
|
}
|
|
111
111
|
if (isDeviceSmallerThan("sm")) {
|
|
112
|
-
|
|
112
|
+
pushToolsActionsOperations({
|
|
113
113
|
opver: 1,
|
|
114
114
|
operations: [
|
|
115
115
|
{
|
|
@@ -126,7 +126,7 @@ export async function show(around, _operations) {
|
|
|
126
126
|
]
|
|
127
127
|
}
|
|
128
128
|
]
|
|
129
|
-
};
|
|
129
|
+
});
|
|
130
130
|
}
|
|
131
131
|
await tick();
|
|
132
132
|
css_position = calculatePosition(x, y, around_rect, true, false);
|
|
@@ -139,7 +139,8 @@ export function isVisible() {
|
|
|
139
139
|
return visible;
|
|
140
140
|
}
|
|
141
141
|
export function hide() {
|
|
142
|
-
|
|
142
|
+
if (visible)
|
|
143
|
+
popToolsActionsOperations();
|
|
143
144
|
visible = false;
|
|
144
145
|
css_position = calculatePosition(x, y, around_rect, false, false);
|
|
145
146
|
window.removeEventListener("click", on_before_window_click, true);
|
|
@@ -319,8 +320,9 @@ function mousedown(e) {
|
|
|
319
320
|
<p> {operation.caption}</p>
|
|
320
321
|
{#if operation.description}
|
|
321
322
|
{@const shortcut_width_px = operation.shortcut ? 80 : 0}
|
|
322
|
-
<p class="text-sm font-normal text-stone-900 dark:text-stone-500 truncate inline-block"
|
|
323
|
-
|
|
323
|
+
<p class=" text-sm font-normal text-stone-900 dark:text-stone-500 truncate inline-block">
|
|
324
|
+
{operation.description}
|
|
325
|
+
</p>
|
|
324
326
|
{/if}
|
|
325
327
|
</div>
|
|
326
328
|
{#if has_submenu}
|
|
@@ -26,7 +26,7 @@ import Underline from "@tiptap/extension-underline";
|
|
|
26
26
|
import Dropcursor from "@tiptap/extension-dropcursor";
|
|
27
27
|
import Gapcursor from "@tiptap/extension-gapcursor";
|
|
28
28
|
import History from "@tiptap/extension-history";
|
|
29
|
-
import { data_tick_store, contextItemsStore, contextTypesStore, onErrorShowAlert,
|
|
29
|
+
import { data_tick_store, contextItemsStore, contextTypesStore, onErrorShowAlert, pushToolsActionsOperations, popToolsActionsOperations } from "../../stores.js";
|
|
30
30
|
import { informModification, pushChanges } from "../../updates.js";
|
|
31
31
|
import { isDeviceSmallerThan, parseWidthDirective, refreshToolbarOperations, UI } from "../../utils.js";
|
|
32
32
|
import Palette from "./internal/palette.svelte";
|
|
@@ -591,7 +591,7 @@ function on_palette_mouse_click() {
|
|
|
591
591
|
function on_palette_shown() {
|
|
592
592
|
is_command_palette_visible = true;
|
|
593
593
|
if (isDeviceSmallerThan("sm")) {
|
|
594
|
-
|
|
594
|
+
pushToolsActionsOperations({
|
|
595
595
|
opver: 1,
|
|
596
596
|
operations: [
|
|
597
597
|
{
|
|
@@ -609,12 +609,13 @@ function on_palette_shown() {
|
|
|
609
609
|
]
|
|
610
610
|
}
|
|
611
611
|
]
|
|
612
|
-
};
|
|
612
|
+
});
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
function on_palette_hidden() {
|
|
616
|
+
if (is_command_palette_visible)
|
|
617
|
+
popToolsActionsOperations();
|
|
616
618
|
is_command_palette_visible = false;
|
|
617
|
-
$toolsActionsOperations = [];
|
|
618
619
|
}
|
|
619
620
|
function show_command_palette(cursor_rect) {
|
|
620
621
|
let client_rect = get_window_box();
|
|
@@ -52,17 +52,27 @@
|
|
|
52
52
|
itype = itype;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
export function refresh(itm=undefined)
|
|
56
|
+
{
|
|
57
|
+
if(itm)
|
|
58
|
+
self = itm;
|
|
59
|
+
|
|
60
|
+
item = self ?? $contextItemsStore[ctx];
|
|
61
|
+
setup()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let userClass = $$restProps.class ?? '';
|
|
55
65
|
|
|
56
66
|
let item = null
|
|
57
67
|
|
|
58
|
-
let labelMargins = '
|
|
68
|
+
let labelMargins = 'mb-0.5' //
|
|
59
69
|
let input_pt = 'pt-0.5'
|
|
60
70
|
let input_pb = 'pb-1'
|
|
61
71
|
|
|
62
72
|
switch (s)
|
|
63
73
|
{
|
|
64
74
|
case 'md':
|
|
65
|
-
labelMargins = '
|
|
75
|
+
labelMargins = 'mb-1';
|
|
66
76
|
input_pt = 'pt-2.5'
|
|
67
77
|
input_pb = 'pb-2.5';
|
|
68
78
|
break;
|
|
@@ -127,7 +137,7 @@
|
|
|
127
137
|
|
|
128
138
|
{#if itype == 'text'}
|
|
129
139
|
{@const border_style = invalid ? "border-red-300 dark:border-red-600" : "border-stone-300 dark:border-stone-500" }
|
|
130
|
-
<div class={cs}>
|
|
140
|
+
<div class="{cs} {userClass}">
|
|
131
141
|
<label for="name" class="block {labelMargins} text-xs font-small text-stone-900 dark:text-white">{label}</label>
|
|
132
142
|
|
|
133
143
|
<input type=text name="name" id="name"
|
|
@@ -20,11 +20,13 @@ export default class Inputbox extends SvelteComponentTyped<{
|
|
|
20
20
|
validation?: any;
|
|
21
21
|
validate?: (() => boolean) | undefined;
|
|
22
22
|
setReadonly?: ((val: any) => void) | undefined;
|
|
23
|
+
refresh?: ((itm?: undefined) => void) | undefined;
|
|
23
24
|
}, {
|
|
24
25
|
[evt: string]: CustomEvent<any>;
|
|
25
26
|
}, {}> {
|
|
26
27
|
get validate(): () => boolean;
|
|
27
28
|
get setReadonly(): (val: any) => void;
|
|
29
|
+
get refresh(): (itm?: undefined) => void;
|
|
28
30
|
}
|
|
29
31
|
export type InputboxProps = typeof __propDef.props;
|
|
30
32
|
export type InputboxEvents = typeof __propDef.events;
|
|
@@ -50,6 +52,7 @@ declare const __propDef: {
|
|
|
50
52
|
validation?: any;
|
|
51
53
|
validate?: (() => boolean) | undefined;
|
|
52
54
|
setReadonly?: ((val: any) => void) | undefined;
|
|
55
|
+
refresh?: ((itm?: undefined) => void) | undefined;
|
|
53
56
|
};
|
|
54
57
|
events: {
|
|
55
58
|
[evt: string]: CustomEvent<any>;
|
|
@@ -210,7 +210,7 @@ function showAttachementIcon() {
|
|
|
210
210
|
{@const canOpen = isLinkLike || hasOpen}
|
|
211
211
|
{@const openableClass = canOpen ? "sm:hover:cursor-pointer underline" : ""}
|
|
212
212
|
{@const showIcon = showAttachementIcon()}
|
|
213
|
-
<h3 class=" text-base font-semibold pb-1
|
|
213
|
+
<h3 class=" h3 text-base font-semibold pb-1
|
|
214
214
|
whitespace-nowrap overflow-clip truncate w-full sm:flex-none
|
|
215
215
|
relative {openableClass}"
|
|
216
216
|
use:editable={{
|
|
@@ -224,7 +224,9 @@ function showAttachementIcon() {
|
|
|
224
224
|
condition: canOpen,
|
|
225
225
|
callback: performOpen}}
|
|
226
226
|
bind:this={titleElement}>
|
|
227
|
+
<!--a href="#"-->
|
|
227
228
|
{item[definition.titleAttrib]}
|
|
229
|
+
<!--/a-->
|
|
228
230
|
|
|
229
231
|
{#if showIcon}
|
|
230
232
|
<span id="attachement" class="absolute top-1 right-0 w-5 h-5 sm:w-3 sm:h-3">
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script>import { getContext } from "svelte";
|
|
2
2
|
export let onAdd = void 0;
|
|
3
3
|
export let onOpen = void 0;
|
|
4
|
+
export let onReplace = void 0;
|
|
4
5
|
export let getCardOperations = void 0;
|
|
5
6
|
let definition = getContext("rKanban-definition");
|
|
6
7
|
definition.onAdd = onAdd;
|
|
7
8
|
definition.onOpen = onOpen;
|
|
9
|
+
definition.onReplace = onReplace;
|
|
8
10
|
definition.getCardOperations = getCardOperations;
|
|
9
11
|
</script>
|
|
@@ -200,7 +200,7 @@ export function moveDown(item) {
|
|
|
200
200
|
}
|
|
201
201
|
const ORDER_STEP = 64;
|
|
202
202
|
const MIN_ORDER = 0;
|
|
203
|
-
function reorderElements(items, from = null) {
|
|
203
|
+
function reorderElements(items, from = null, pushImediatelly = true) {
|
|
204
204
|
const oa = definition.orderAttrib;
|
|
205
205
|
let fromIdx;
|
|
206
206
|
let fromOrder;
|
|
@@ -218,9 +218,10 @@ function reorderElements(items, from = null) {
|
|
|
218
218
|
informModification(el, oa);
|
|
219
219
|
order += ORDER_STEP;
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
if (pushImediatelly)
|
|
222
|
+
pushChanges();
|
|
222
223
|
}
|
|
223
|
-
export function replace(item, toColumnIdx, afterElement) {
|
|
224
|
+
export async function replace(item, toColumnIdx, afterElement) {
|
|
224
225
|
const fromColumnIdx = getColumnIdx(item);
|
|
225
226
|
let allItems = definition.getItems();
|
|
226
227
|
const oa = definition.orderAttrib;
|
|
@@ -230,18 +231,21 @@ export function replace(item, toColumnIdx, afterElement) {
|
|
|
230
231
|
const toListBottom = allItems.findLast((e) => e[sa] == toColumnState);
|
|
231
232
|
const fromColumn = columns[fromColumnIdx];
|
|
232
233
|
const toColumn = columns[toColumnIdx];
|
|
234
|
+
const propsChanges = {
|
|
235
|
+
order: -1,
|
|
236
|
+
state: -1
|
|
237
|
+
};
|
|
233
238
|
switch (afterElement) {
|
|
234
239
|
case KanbanColumnTop:
|
|
235
240
|
if (!toListTop || toListTop[oa] > item[oa]) {
|
|
236
|
-
|
|
237
|
-
informModification(item, sa);
|
|
241
|
+
propsChanges.state = toColumnState;
|
|
238
242
|
} else {
|
|
239
243
|
const prevItem = getPrev(allItems, toListTop);
|
|
240
244
|
if (!prevItem) {
|
|
241
|
-
item[sa] = toColumnState;
|
|
242
245
|
item[oa] = toListTop[oa] - ORDER_STEP;
|
|
243
|
-
informModification(item, sa);
|
|
244
246
|
informModification(item, oa);
|
|
247
|
+
propsChanges.state = toColumnState;
|
|
248
|
+
propsChanges.order = item[oa];
|
|
245
249
|
remove(allItems, item);
|
|
246
250
|
insertAt(allItems, 0, item);
|
|
247
251
|
} else {
|
|
@@ -249,35 +253,31 @@ export function replace(item, toColumnIdx, afterElement) {
|
|
|
249
253
|
let nextOrder = toListTop[oa];
|
|
250
254
|
let orderSpace = nextOrder - prevOrder;
|
|
251
255
|
if (orderSpace < 2) {
|
|
252
|
-
reorderElements(allItems, prevItem);
|
|
256
|
+
reorderElements(allItems, prevItem, false);
|
|
253
257
|
prevOrder = prevItem[oa];
|
|
254
258
|
nextOrder = toListTop[oa];
|
|
255
259
|
orderSpace = nextOrder - prevOrder;
|
|
256
260
|
}
|
|
257
|
-
item[sa] = toColumnState;
|
|
258
261
|
item[oa] = prevOrder + Math.floor(orderSpace / 2);
|
|
259
|
-
informModification(item, sa);
|
|
260
262
|
informModification(item, oa);
|
|
263
|
+
propsChanges.state = toColumnState;
|
|
264
|
+
propsChanges.order = item[oa];
|
|
261
265
|
remove(allItems, item);
|
|
262
266
|
insertAfter(allItems, prevItem, item);
|
|
263
267
|
}
|
|
264
268
|
}
|
|
265
|
-
|
|
266
|
-
fromColumn.reload();
|
|
267
|
-
toColumn.reload();
|
|
268
|
-
return;
|
|
269
|
+
break;
|
|
269
270
|
case KanbanColumnBottom:
|
|
270
271
|
default:
|
|
271
272
|
if (!toListBottom || item[oa] > toListBottom[oa]) {
|
|
272
|
-
|
|
273
|
-
informModification(item, sa);
|
|
273
|
+
propsChanges.state = toColumnState;
|
|
274
274
|
} else {
|
|
275
275
|
const nextItem = getNext(allItems, toListBottom);
|
|
276
276
|
if (!nextItem) {
|
|
277
|
-
item[sa] = toColumnState;
|
|
278
277
|
item[oa] = toListBottom[oa] + ORDER_STEP;
|
|
279
|
-
informModification(item, sa);
|
|
280
278
|
informModification(item, oa);
|
|
279
|
+
propsChanges.state = toColumnState;
|
|
280
|
+
propsChanges.order = item[oa];
|
|
281
281
|
remove(allItems, item);
|
|
282
282
|
insertAfter(allItems, toListBottom, item);
|
|
283
283
|
} else {
|
|
@@ -285,23 +285,39 @@ export function replace(item, toColumnIdx, afterElement) {
|
|
|
285
285
|
let prevOrder = toListBottom[oa];
|
|
286
286
|
let orderSpace = nextOrder - prevOrder;
|
|
287
287
|
if (orderSpace < 2) {
|
|
288
|
-
reorderElements(allItems, toListBottom);
|
|
288
|
+
reorderElements(allItems, toListBottom, false);
|
|
289
289
|
prevOrder = toListBottom[oa];
|
|
290
290
|
nextOrder = nextItem[oa];
|
|
291
291
|
orderSpace = nextOrder - prevOrder;
|
|
292
292
|
}
|
|
293
|
-
item[sa] = toColumnState;
|
|
294
293
|
item[oa] = prevOrder + Math.floor(orderSpace / 2);
|
|
295
|
-
informModification(item, sa);
|
|
296
294
|
informModification(item, oa);
|
|
295
|
+
propsChanges.state = toColumnState;
|
|
296
|
+
propsChanges.order = item[oa];
|
|
297
297
|
remove(allItems, item);
|
|
298
298
|
insertAfter(allItems, toListBottom, item);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
if (definition.onReplace) {
|
|
304
|
+
if (propsChanges.state >= 0) {
|
|
301
305
|
pushChanges();
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
306
|
+
}
|
|
307
|
+
const req = {
|
|
308
|
+
[sa]: propsChanges.state,
|
|
309
|
+
item,
|
|
310
|
+
toColumn: toColumnIdx
|
|
311
|
+
};
|
|
312
|
+
await definition.onReplace(req);
|
|
313
|
+
} else {
|
|
314
|
+
if (propsChanges.state >= 0) {
|
|
315
|
+
item[sa] = propsChanges.state;
|
|
316
|
+
informModification(item, sa);
|
|
317
|
+
}
|
|
318
|
+
pushChanges();
|
|
319
|
+
fromColumn.reload();
|
|
320
|
+
toColumn.reload();
|
|
305
321
|
}
|
|
306
322
|
}
|
|
307
323
|
async function onInsert(columnIdx, title2, summary, afterId) {
|
|
@@ -397,7 +413,7 @@ async function onInsert(columnIdx, title2, summary, afterId) {
|
|
|
397
413
|
}
|
|
398
414
|
}
|
|
399
415
|
if (definition.onAdd)
|
|
400
|
-
await definition.onAdd(newElement);
|
|
416
|
+
await definition.onAdd(newElement, columnIdx);
|
|
401
417
|
}
|
|
402
418
|
export function activateColumn(columnIdx) {
|
|
403
419
|
columns[columnIdx].activate();
|
|
@@ -16,7 +16,7 @@ declare const __propDef: {
|
|
|
16
16
|
scrollViewToCard?: ((item: any) => void) | undefined;
|
|
17
17
|
moveUp?: ((item: object) => void) | undefined;
|
|
18
18
|
moveDown?: ((item: object) => void) | undefined;
|
|
19
|
-
replace?: ((item: any, toColumnIdx: any, afterElement: any) => void) | undefined;
|
|
19
|
+
replace?: ((item: any, toColumnIdx: any, afterElement: any) => Promise<void>) | undefined;
|
|
20
20
|
activateColumn?: ((columnIdx: number) => void) | undefined;
|
|
21
21
|
editColumnName?: ((columnIdx: number, onFinish?: Function | undefined) => void) | undefined;
|
|
22
22
|
moveCardsTo?: ((items: object[], toColumnIdx: number) => void) | undefined;
|
|
@@ -55,7 +55,7 @@ export default class Kanban extends SvelteComponentTyped<KanbanProps, KanbanEven
|
|
|
55
55
|
get scrollViewToCard(): (item: any) => void;
|
|
56
56
|
get moveUp(): (item: object) => void;
|
|
57
57
|
get moveDown(): (item: object) => void;
|
|
58
|
-
get replace(): (item: any, toColumnIdx: any, afterElement: any) => void
|
|
58
|
+
get replace(): (item: any, toColumnIdx: any, afterElement: any) => Promise<void>;
|
|
59
59
|
get activateColumn(): (columnIdx: number) => void;
|
|
60
60
|
get editColumnName(): (columnIdx: number, onFinish?: Function | undefined) => void;
|
|
61
61
|
get moveCardsTo(): (items: object[], toColumnIdx: number) => void;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
selectable,
|
|
6
6
|
activateItem,
|
|
7
7
|
isActive,
|
|
8
|
+
getActive,
|
|
8
9
|
editable,
|
|
9
10
|
startEditing
|
|
10
11
|
} from "../../../utils";
|
|
@@ -23,6 +24,7 @@ export let summary = "";
|
|
|
23
24
|
export let typename = void 0;
|
|
24
25
|
export let toolbarOperations = void 0;
|
|
25
26
|
export let contextMenu = void 0;
|
|
27
|
+
export let key = "";
|
|
26
28
|
let definition = getContext("rList-definition");
|
|
27
29
|
let placeholder = "";
|
|
28
30
|
let props_sm;
|
|
@@ -45,14 +47,6 @@ if (!typename) {
|
|
|
45
47
|
typename = s[1];
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
let item_key = "";
|
|
49
|
-
let keys = Object.keys(item);
|
|
50
|
-
if (keys.includes("$ref"))
|
|
51
|
-
item_key = "$ref";
|
|
52
|
-
else if (keys.includes("Id"))
|
|
53
|
-
item_key = "Id";
|
|
54
|
-
else if (keys.length > 0)
|
|
55
|
-
item_key = keys[0];
|
|
56
50
|
if (!title)
|
|
57
51
|
title = definition.title;
|
|
58
52
|
if (!summary)
|
|
@@ -74,11 +68,30 @@ function calc_horz_division() {
|
|
|
74
68
|
}
|
|
75
69
|
}
|
|
76
70
|
function calculate_active(...args) {
|
|
77
|
-
|
|
71
|
+
const activeItem = getActive("props");
|
|
72
|
+
if (!activeItem)
|
|
73
|
+
return false;
|
|
74
|
+
const activeKey = getItemKey(activeItem);
|
|
75
|
+
const itemKey = getItemKey(item);
|
|
76
|
+
if (activeKey == itemKey) {
|
|
77
|
+
console.log("active: ", itemKey);
|
|
78
|
+
return true;
|
|
79
|
+
} else
|
|
80
|
+
return false;
|
|
78
81
|
}
|
|
79
82
|
function selected(...args) {
|
|
80
83
|
return isSelected(item);
|
|
81
84
|
}
|
|
85
|
+
function getItemKey(item2) {
|
|
86
|
+
if (key)
|
|
87
|
+
return item2[key];
|
|
88
|
+
else if (item2.$ref)
|
|
89
|
+
return item2.$ref;
|
|
90
|
+
else if (item2.Id)
|
|
91
|
+
return item2.Id;
|
|
92
|
+
else
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
82
95
|
async function change_name(text) {
|
|
83
96
|
if (definition.on_title_changed) {
|
|
84
97
|
definition.on_title_changed(item, text, title);
|
|
@@ -186,7 +199,7 @@ export function editProperty(field) {
|
|
|
186
199
|
}
|
|
187
200
|
}
|
|
188
201
|
async function force_editing(field) {
|
|
189
|
-
let element_id = `__hd_list_ctrl_${item
|
|
202
|
+
let element_id = `__hd_list_ctrl_${getItemKey(item)}_${field}`;
|
|
190
203
|
let element_node = document.getElementById(element_id);
|
|
191
204
|
if (!element_node) {
|
|
192
205
|
placeholder = field;
|
|
@@ -264,7 +277,7 @@ export function scrollToView() {
|
|
|
264
277
|
|
|
265
278
|
whitespace-nowrap overflow-clip w-full sm:flex-none sm:{name_w}
|
|
266
279
|
sm:hover:cursor-pointer underline"
|
|
267
|
-
id="__hd_list_ctrl_{item
|
|
280
|
+
id="__hd_list_ctrl_{getItemKey(item)}_Title"
|
|
268
281
|
on:click|stopPropagation={followDefinedHRef}
|
|
269
282
|
use:editable={{
|
|
270
283
|
action: (text) => {change_name(text)},
|
|
@@ -279,7 +292,7 @@ export function scrollToView() {
|
|
|
279
292
|
<p class=" text-base font-semibold
|
|
280
293
|
|
|
281
294
|
whitespace-nowrap overflow-clip w-full sm:flex-none sm:{name_w}"
|
|
282
|
-
id="__hd_list_ctrl_{item
|
|
295
|
+
id="__hd_list_ctrl_{getItemKey(item)}_Title"
|
|
283
296
|
use:editable={{
|
|
284
297
|
action: (text) => {change_name(text)},
|
|
285
298
|
active: true,
|
|
@@ -300,7 +313,7 @@ export function scrollToView() {
|
|
|
300
313
|
<p class=" text-base font-semibold
|
|
301
314
|
|
|
302
315
|
whitespace-nowrap overflow-clip w-full sm:flex-none sm:{name_w}"
|
|
303
|
-
id="__hd_list_ctrl_{item
|
|
316
|
+
id="__hd_list_ctrl_{getItemKey(item)}_Title">
|
|
304
317
|
{element_title}
|
|
305
318
|
</p>
|
|
306
319
|
{/if}
|
|
@@ -316,7 +329,7 @@ export function scrollToView() {
|
|
|
316
329
|
</section>
|
|
317
330
|
|
|
318
331
|
{#if summary && (item[summary] || placeholder=='Summary')}
|
|
319
|
-
{@const element_id = `__hd_list_ctrl_${item
|
|
332
|
+
{@const element_id = `__hd_list_ctrl_${getItemKey(item)}_Summary`}
|
|
320
333
|
{#key item[summary] }
|
|
321
334
|
{#if is_row_active}
|
|
322
335
|
<p id={element_id}
|
|
@@ -7,6 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
typename?: string | undefined;
|
|
8
8
|
toolbarOperations?: undefined;
|
|
9
9
|
contextMenu?: undefined;
|
|
10
|
+
key?: string | undefined;
|
|
10
11
|
activate?: (() => void) | undefined;
|
|
11
12
|
editProperty?: ((field: string) => void) | undefined;
|
|
12
13
|
scrollToView?: (() => void) | undefined;
|
|
@@ -79,42 +79,43 @@ export function rereder() {
|
|
|
79
79
|
}
|
|
80
80
|
export function reload(data, selectElement = KEEP_SELECTION) {
|
|
81
81
|
let currentSelectedItem = getActive("props");
|
|
82
|
-
let
|
|
83
|
-
let
|
|
82
|
+
let currentSelectedItemKey = currentSelectedItem ? getItemKey(currentSelectedItem) : null;
|
|
83
|
+
let selectElementId = null;
|
|
84
|
+
let altSelectElementId = null;
|
|
84
85
|
switch (selectElement) {
|
|
85
86
|
case CLEAR_SELECTION:
|
|
86
87
|
selectElementId = 0;
|
|
87
88
|
break;
|
|
88
89
|
case KEEP_SELECTION:
|
|
89
|
-
selectElementId =
|
|
90
|
+
selectElementId = currentSelectedItemKey;
|
|
90
91
|
break;
|
|
91
92
|
case SELECT_PREVIOUS:
|
|
92
93
|
if (currentSelectedItem) {
|
|
93
|
-
const selectedItemIdx = items?.findIndex((e) => e ==
|
|
94
|
+
const selectedItemIdx = items?.findIndex((e) => getItemKey(e) == currentSelectedItemKey);
|
|
94
95
|
if (selectedItemIdx != void 0 && selectedItemIdx > 0)
|
|
95
|
-
selectElementId = items[selectedItemIdx - 1]
|
|
96
|
+
selectElementId = getItemKey(items[selectedItemIdx - 1]) ?? null;
|
|
96
97
|
}
|
|
97
98
|
break;
|
|
98
99
|
case SELECT_NEXT:
|
|
99
100
|
if (currentSelectedItem) {
|
|
100
|
-
const selectedItemIdx = items?.findIndex((e) => e ==
|
|
101
|
+
const selectedItemIdx = items?.findIndex((e) => getItemKey(e) == currentSelectedItemKey);
|
|
101
102
|
if (selectedItemIdx != void 0 && selectedItemIdx >= 0 && selectedItemIdx < items.length - 1)
|
|
102
|
-
selectElementId = items[selectedItemIdx + 1]
|
|
103
|
+
selectElementId = getItemKey(items[selectedItemIdx + 1]) ?? null;
|
|
103
104
|
}
|
|
104
105
|
break;
|
|
105
106
|
case KEEP_OR_SELECT_NEXT:
|
|
106
107
|
{
|
|
107
108
|
if (currentSelectedItem) {
|
|
108
|
-
selectElementId =
|
|
109
|
-
const selectedItemIdx = items?.findIndex((e) => e ==
|
|
109
|
+
selectElementId = currentSelectedItemKey;
|
|
110
|
+
const selectedItemIdx = items?.findIndex((e) => getItemKey(e) == currentSelectedItemKey);
|
|
110
111
|
if (selectedItemIdx != void 0 && selectedItemIdx >= 0 && selectedItemIdx < items.length - 1)
|
|
111
|
-
altSelectElementId = items[selectedItemIdx + 1]
|
|
112
|
+
altSelectElementId = getItemKey(items[selectedItemIdx + 1]) ?? null;
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
break;
|
|
115
116
|
default:
|
|
116
117
|
if (typeof selectElement === "object" && !Array.isArray(selectElement) && selectElement !== null)
|
|
117
|
-
selectElementId = selectElement
|
|
118
|
+
selectElementId = getItemKey(selectElement);
|
|
118
119
|
else
|
|
119
120
|
selectElementId = selectElement;
|
|
120
121
|
}
|
|
@@ -123,19 +124,17 @@ export function reload(data, selectElement = KEEP_SELECTION) {
|
|
|
123
124
|
else
|
|
124
125
|
self = data;
|
|
125
126
|
rereder();
|
|
126
|
-
if (selectElementId
|
|
127
|
-
let itemToActivate = items?.find((e) => e
|
|
127
|
+
if (selectElementId != null) {
|
|
128
|
+
let itemToActivate = items?.find((e) => getItemKey(e) == selectElementId);
|
|
128
129
|
if (itemToActivate) {
|
|
129
130
|
activate_after_dom_update = itemToActivate;
|
|
130
|
-
} else if (altSelectElementId
|
|
131
|
-
itemToActivate = items?.find((e) => e
|
|
131
|
+
} else if (altSelectElementId != null) {
|
|
132
|
+
itemToActivate = items?.find((e) => getItemKey(e) == altSelectElementId);
|
|
132
133
|
if (itemToActivate) {
|
|
133
134
|
activate_after_dom_update = itemToActivate;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
if (!activate_after_dom_update)
|
|
138
|
-
activateItem("props", null, []);
|
|
139
138
|
}
|
|
140
139
|
export async function moveUp(element) {
|
|
141
140
|
if (!orderAttrib)
|
|
@@ -295,6 +294,7 @@ async function insert(title2, summary, after) {
|
|
|
295
294
|
<List_element item={element}
|
|
296
295
|
{toolbarOperations}
|
|
297
296
|
{contextMenu}
|
|
297
|
+
{key}
|
|
298
298
|
bind:this={rows[i]}
|
|
299
299
|
>
|
|
300
300
|
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
activateItem,
|
|
12
12
|
startEditing,
|
|
13
13
|
getActive,
|
|
14
|
-
isOnNavigationPage
|
|
14
|
+
isOnNavigationPage,
|
|
15
|
+
UI
|
|
15
16
|
} from "../../utils";
|
|
16
17
|
import { showMenu } from "../menu";
|
|
17
18
|
export let href;
|
|
@@ -71,7 +72,17 @@ function calculateIsRowActive(...args) {
|
|
|
71
72
|
if (!item)
|
|
72
73
|
return active;
|
|
73
74
|
const activeItem = getActive("props");
|
|
74
|
-
if (
|
|
75
|
+
if (item.$ref) {
|
|
76
|
+
if (activeItem) {
|
|
77
|
+
return item.$ref == activeItem.$ref;
|
|
78
|
+
} else
|
|
79
|
+
return false;
|
|
80
|
+
} else if (item.Id) {
|
|
81
|
+
if (activeItem) {
|
|
82
|
+
return item.Id == activeItem.Id;
|
|
83
|
+
} else
|
|
84
|
+
return false;
|
|
85
|
+
} else if (activeItem == item)
|
|
75
86
|
return true;
|
|
76
87
|
else
|
|
77
88
|
return false;
|
|
@@ -108,13 +119,15 @@ function on_link_clicked(e) {
|
|
|
108
119
|
e.preventDefault();
|
|
109
120
|
if (isOnPage) {
|
|
110
121
|
if (isRowActive) {
|
|
111
|
-
if (href2)
|
|
122
|
+
if (href2) {
|
|
112
123
|
push(href2);
|
|
124
|
+
}
|
|
113
125
|
}
|
|
114
126
|
} else {
|
|
115
127
|
auto_hide_sidebar();
|
|
116
|
-
if (href2)
|
|
128
|
+
if (href2) {
|
|
117
129
|
push(href2);
|
|
130
|
+
}
|
|
118
131
|
}
|
|
119
132
|
}
|
|
120
133
|
function on_contextmenu(e) {
|
package/desk.svelte
CHANGED
|
@@ -213,6 +213,8 @@
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
onMount( () => {
|
|
216
|
+
|
|
217
|
+
|
|
216
218
|
window.addEventListener('resize', on_resize)
|
|
217
219
|
|
|
218
220
|
const vp = window.visualViewport;
|
|
@@ -223,6 +225,7 @@
|
|
|
223
225
|
//document.addEventListener('focusout', onFocusOut)
|
|
224
226
|
|
|
225
227
|
return () => {
|
|
228
|
+
|
|
226
229
|
// document.removeEventListener('focusout', onFocusOut)
|
|
227
230
|
document.removeEventListener('selectionchange', onSelectionChanged)
|
|
228
231
|
vp?.removeEventListener('resize', onViewportResize)
|
|
@@ -429,7 +432,7 @@
|
|
|
429
432
|
z-0 overflow-x-hidden
|
|
430
433
|
{content_height} sm:overflow-y-auto"
|
|
431
434
|
>
|
|
432
|
-
<Configurable config={layout.mainContent} min_h_class="min-h-
|
|
435
|
+
<Configurable config={layout.mainContent} min_h_class="min-h-screen">
|
|
433
436
|
<div slot='alt'></div>
|
|
434
437
|
</Configurable>
|
|
435
438
|
</div>
|
package/modal.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { afterUpdate, onMount, tick } from "svelte";
|
|
2
2
|
import Icon from "./components/icon.svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { pushToolsActionsOperations, popToolsActionsOperations } from "./stores.js";
|
|
4
4
|
import { isDeviceSmallerThan } from "./utils";
|
|
5
5
|
import { FaTimes } from "svelte-icons/fa";
|
|
6
6
|
export let title = "";
|
|
@@ -20,7 +20,7 @@ export function show(on_close_callback = void 0) {
|
|
|
20
20
|
open = true;
|
|
21
21
|
close_callback = on_close_callback;
|
|
22
22
|
if (isDeviceSmallerThan("sm")) {
|
|
23
|
-
|
|
23
|
+
pushToolsActionsOperations({
|
|
24
24
|
opver: 1,
|
|
25
25
|
operations: [
|
|
26
26
|
{
|
|
@@ -37,12 +37,14 @@ export function show(on_close_callback = void 0) {
|
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
]
|
|
40
|
-
};
|
|
40
|
+
});
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
export function hide() {
|
|
44
|
+
if (!open)
|
|
45
|
+
return;
|
|
44
46
|
open = false;
|
|
45
|
-
|
|
47
|
+
popToolsActionsOperations();
|
|
46
48
|
}
|
|
47
49
|
let root;
|
|
48
50
|
afterUpdate(
|
|
@@ -98,8 +100,9 @@ function on_cancel(event) {
|
|
|
98
100
|
From: "opacity-100 translate-y-0 sm:scale-100"
|
|
99
101
|
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
100
102
|
-->
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
|
|
104
|
+
<div class=" rounded-lg bg-white dark:bg-stone-700 text-left shadow-xl transition-all
|
|
105
|
+
sm:my-8 w-full sm:max-w-lg"> <!-- transform overflow-hidden -->
|
|
103
106
|
<div class="bg-white dark:bg-stone-700 px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
|
|
104
107
|
<div class="sm:flex sm:items-start">
|
|
105
108
|
<div class="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
|
package/operations.svelte
CHANGED
|
@@ -46,16 +46,13 @@ function update(...args) {
|
|
|
46
46
|
function on_click(e, operation) {
|
|
47
47
|
if (!operation)
|
|
48
48
|
return;
|
|
49
|
-
if (operation.action) {
|
|
50
|
-
let focused_item = null;
|
|
51
|
-
if ($contextItemsStore.focused)
|
|
52
|
-
focused_item = $contextItemsStore[$contextItemsStore.focused];
|
|
53
|
-
operation.action(focused_item);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
49
|
let owner = e.target;
|
|
57
50
|
while (owner && owner.tagName != "BUTTON")
|
|
58
51
|
owner = owner.parentElement;
|
|
52
|
+
if (operation.action) {
|
|
53
|
+
operation.action(owner);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
59
56
|
if (!owner)
|
|
60
57
|
return;
|
|
61
58
|
let rect = owner.getBoundingClientRect();
|
package/package.json
CHANGED
package/stores.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export function pushToolsActionsOperations(operations: any): void;
|
|
2
|
+
export function popToolsActionsOperations(): void;
|
|
1
3
|
export function setNavigatorTitle(key: any, title: any): void;
|
|
2
4
|
export function hasSelectedItem(): boolean;
|
|
3
5
|
export function hasDataItem(): boolean;
|
package/stores.js
CHANGED
|
@@ -15,6 +15,31 @@ export const mainContentPageReloader = writable(1);
|
|
|
15
15
|
export const wholeAppReloader = writable(1)
|
|
16
16
|
export const alerts = writable([])
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
let toolsActionsOperationsStack = []
|
|
20
|
+
export function pushToolsActionsOperations(operations)
|
|
21
|
+
{
|
|
22
|
+
toolsActionsOperationsStack.push(operations)
|
|
23
|
+
toolsActionsOperations.set(operations)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function popToolsActionsOperations()
|
|
27
|
+
{
|
|
28
|
+
toolsActionsOperationsStack.pop();
|
|
29
|
+
const stackSize = toolsActionsOperationsStack.length;
|
|
30
|
+
if(stackSize == 0)
|
|
31
|
+
{
|
|
32
|
+
//console.log('stack empty')
|
|
33
|
+
toolsActionsOperations.set([])
|
|
34
|
+
}
|
|
35
|
+
else
|
|
36
|
+
{
|
|
37
|
+
const lastElement = toolsActionsOperationsStack[stackSize-1];
|
|
38
|
+
//console.log('stack not empty (stackSize)', lastElement)
|
|
39
|
+
toolsActionsOperations.set(lastElement)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
18
43
|
export const addAlert = (txt) => {
|
|
19
44
|
let al = get(alerts)
|
|
20
45
|
al = [txt, ...al];
|