@humandialog/forms.svelte 0.4.45 → 0.5.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/components/Fab.svelte +60 -48
- package/components/Floating_container.svelte +5 -4
- package/components/Floating_container.svelte.d.ts +2 -2
- package/components/Grid.menu.svelte +13 -9
- package/components/Grid.menu.svelte.d.ts +2 -2
- package/components/button.svelte +4 -4
- package/components/checkbox.svelte +12 -10
- package/components/checkbox.svelte.d.ts +1 -0
- package/components/combo/combo.d.ts +1 -1
- package/components/combo/combo.js +1 -1
- package/components/combo/combo.source.svelte +2 -2
- package/components/combo/combo.source.svelte.d.ts +1 -1
- package/components/combo/combo.svelte +92 -61
- package/components/combo/combo.svelte.d.ts +7 -4
- package/components/contextmenu.svelte +20 -19
- package/components/contextmenu.svelte.d.ts +5 -5
- package/components/date.svelte +40 -25
- package/components/date.svelte.d.ts +3 -2
- package/components/delayed.spinner.svelte +2 -2
- package/components/document/internal/palette.row.svelte +3 -3
- package/components/document/internal/palette.svelte +2 -2
- package/components/document/internal/palette.svelte.d.ts +1 -1
- package/components/document/rich.edit.svelte +307 -35
- package/components/document/rich.edit.svelte.d.ts +9 -0
- package/components/edit.field.svelte +17 -15
- package/components/edit.field.svelte.d.ts +2 -1
- package/components/file.loader.svelte +6 -6
- package/components/file.loader.svelte.d.ts +10 -10
- package/components/icon.svelte +2 -2
- package/components/icon.svelte.d.ts +3 -3
- package/components/input.text.svelte +3 -3
- package/components/inputbox.ltop.svelte +19 -17
- package/components/inputbox.ltop.svelte.d.ts +4 -2
- package/components/kanban/Kanban.d.ts +23 -0
- package/components/kanban/Kanban.js +23 -0
- package/components/kanban/internal/kanban.card.svelte +158 -0
- package/components/kanban/internal/kanban.card.svelte.d.ts +35 -0
- package/components/kanban/internal/kanban.column.svelte +181 -0
- package/components/kanban/internal/kanban.column.svelte.d.ts +51 -0
- package/components/kanban/internal/kanban.inserter.svelte +24 -0
- package/components/kanban/internal/kanban.inserter.svelte.d.ts +18 -0
- package/components/kanban/internal/kanban.move.menu.svelte +146 -0
- package/components/kanban/internal/kanban.move.menu.svelte.d.ts +19 -0
- package/components/kanban/kanban.callbacks.svelte +15 -0
- package/components/kanban/kanban.callbacks.svelte.d.ts +21 -0
- package/components/kanban/kanban.column.svelte +20 -0
- package/components/kanban/kanban.column.svelte.d.ts +21 -0
- package/components/kanban/kanban.summary.svelte +5 -0
- package/components/kanban/kanban.summary.svelte.d.ts +16 -0
- package/components/kanban/kanban.svelte +156 -0
- package/components/kanban/kanban.svelte.d.ts +43 -0
- package/components/kanban/kanban.title.svelte +8 -0
- package/components/kanban/kanban.title.svelte.d.ts +17 -0
- package/components/list/List.d.ts +4 -2
- package/components/list/List.js +4 -2
- package/components/list/internal/list.element.props.svelte +7 -8
- package/components/list/internal/list.element.props.svelte.d.ts +2 -2
- package/components/list/internal/list.element.summary.svelte +4 -4
- package/components/list/internal/list.element.summary.svelte.d.ts +1 -1
- package/components/list/internal/list.element.svelte +61 -49
- package/components/list/internal/list.element.svelte.d.ts +4 -4
- package/components/list/internal/list.inserter.svelte +9 -6
- package/components/list/internal/list.inserter.svelte.d.ts +1 -1
- package/components/list/list.combo.svelte +2 -2
- package/components/list/list.combo.svelte.d.ts +1 -1
- package/components/list/list.date.svelte +2 -2
- package/components/list/list.date.svelte.d.ts +1 -1
- package/components/list/list.inserter.svelte +1 -1
- package/components/list/list.summary.svelte +2 -2
- package/components/list/list.summary.svelte.d.ts +1 -1
- package/components/list/list.svelte +173 -35
- package/components/list/list.svelte.d.ts +27 -10
- package/components/list/list.title.svelte +6 -2
- package/components/list/list.title.svelte.d.ts +3 -1
- package/components/menu.d.ts +4 -4
- package/components/menu.js +15 -13
- package/components/radio.svelte +12 -10
- package/components/radio.svelte.d.ts +1 -0
- package/components/sidebar/sidebar.group.svelte +1 -13
- package/components/sidebar/sidebar.group.svelte.d.ts +0 -4
- package/components/sidebar/sidebar.item.svelte +13 -13
- package/components/sidebar/sidebar.list.svelte +68 -0
- package/components/sidebar/sidebar.list.svelte.d.ts +33 -0
- package/components/sidebar/sidebar.svelte +1 -1
- package/components/simple.table.svelte +15 -15
- package/components/simple.table.svelte.d.ts +2 -2
- package/components/table/_template.table.svelte +17 -17
- package/components/table/_template.table.svelte.d.ts +2 -2
- package/components/table/table.svelte +31 -31
- package/components/table/table.svelte.d.ts +8 -8
- package/components/textarea.ltop.svelte +4 -4
- package/components/tile.title.svelte +6 -6
- package/desk.svelte +13 -13
- package/form.box.svelte +2 -2
- package/horizontal.toolbar.svelte +24 -15
- package/horizontal.toolbar.svelte.d.ts +2 -2
- package/index.d.ts +14 -5
- package/index.js +14 -5
- package/modal.svelte +17 -17
- package/modal.svelte.d.ts +4 -4
- package/operations.svelte +42 -27
- package/package.json +12 -1
- package/page.svelte +115 -124
- package/page.svelte.d.ts +4 -4
- package/stores.d.ts +9 -7
- package/stores.js +17 -9
- package/tenant.members.svelte +44 -44
- package/tenant.members.svelte.d.ts +10 -10
- package/tile.svelte +3 -3
- package/tiles.vertical.row.svelte +1 -1
- package/updates.d.ts +3 -3
- package/updates.js +35 -3
- package/utils.d.ts +22 -13
- package/utils.js +198 -50
- package/vertical.toolbar.svelte +22 -13
- package/vertical.toolbar.svelte.d.ts +2 -2
package/components/Fab.svelte
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import {
|
|
1
|
+
<script>import { contextToolbarOperations, pageToolbarOperations, contextItemsStore } from "../stores.js";
|
|
2
|
+
import { showFloatingToolbar, showMenu, showGridMenu } from "./menu.js";
|
|
3
3
|
import FaChevronUp from "svelte-icons/fa/FaChevronUp.svelte";
|
|
4
4
|
import FaChevronDown from "svelte-icons/fa/FaChevronDown.svelte";
|
|
5
5
|
let expanded = false;
|
|
6
6
|
$:
|
|
7
|
-
update($
|
|
7
|
+
update($pageToolbarOperations, $contextToolbarOperations);
|
|
8
8
|
let operations = [];
|
|
9
9
|
function update(...args) {
|
|
10
|
-
if ($
|
|
11
|
-
operations = $
|
|
10
|
+
if ($contextToolbarOperations && $contextToolbarOperations.length > 0)
|
|
11
|
+
operations = $contextToolbarOperations;
|
|
12
12
|
else
|
|
13
|
-
operations = $
|
|
13
|
+
operations = $pageToolbarOperations;
|
|
14
14
|
}
|
|
15
15
|
function on_click(e, operation) {
|
|
16
16
|
if (!operation)
|
|
17
17
|
return;
|
|
18
18
|
if (operation.action) {
|
|
19
19
|
let focused_item = null;
|
|
20
|
-
if ($
|
|
21
|
-
focused_item = $
|
|
20
|
+
if ($contextItemsStore.focused)
|
|
21
|
+
focused_item = $contextItemsStore[$contextItemsStore.focused];
|
|
22
22
|
operation.action(focused_item);
|
|
23
23
|
}
|
|
24
24
|
let owner = e.target;
|
|
@@ -33,15 +33,18 @@ function on_click(e, operation) {
|
|
|
33
33
|
rect.width += 2 * margin;
|
|
34
34
|
rect.height += 2 * margin;
|
|
35
35
|
if (operation.menu)
|
|
36
|
-
|
|
36
|
+
showMenu(rect, operation.menu);
|
|
37
37
|
else if (operation.toolbar)
|
|
38
|
-
|
|
38
|
+
showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
|
|
39
39
|
else if (operation.grid)
|
|
40
|
-
|
|
40
|
+
showMenu(rect, operation.grid);
|
|
41
41
|
}
|
|
42
42
|
function toggle_expand(e) {
|
|
43
43
|
expanded = !expanded;
|
|
44
44
|
}
|
|
45
|
+
function mousedown(e) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
}
|
|
45
48
|
</script>
|
|
46
49
|
|
|
47
50
|
{#if operations && operations.length > 0}
|
|
@@ -54,28 +57,32 @@ function toggle_expand(e) {
|
|
|
54
57
|
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
|
|
55
58
|
flex items-center justify-center
|
|
56
59
|
disable-dbl-tap-zoom"
|
|
57
|
-
on:click|stopPropagation={(e) => {on_click(e, main_operation)}}
|
|
60
|
+
on:click|stopPropagation={(e) => {on_click(e, main_operation)}}
|
|
61
|
+
on:mousedown={mousedown} >
|
|
58
62
|
<div class="w-7 h-7"><svelte:component this={main_operation.icon}/></div>
|
|
59
63
|
</button>
|
|
60
64
|
|
|
61
65
|
{#if operations.length > 1}
|
|
62
66
|
{@const secondary_operation = operations[1]}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
{#if !secondary_operation.separator}
|
|
68
|
+
<button class=" bg-transparent
|
|
69
|
+
w-[55px] h-[55px]
|
|
70
|
+
fixed m-0 absolute bottom-[10px] right-[60px]
|
|
71
|
+
flex items-center justify-center
|
|
72
|
+
disable-dbl-tap-zoom"
|
|
73
|
+
on:click|stopPropagation={(e) => {on_click(e, secondary_operation)}}
|
|
74
|
+
on:mousedown={mousedown} >
|
|
75
|
+
<div class=" w-10 h-10
|
|
76
|
+
text-white bg-zinc-500 hover:bg-zinc-500
|
|
77
|
+
dark:bg-zinc-500 dark:hover:bg-zinc-500
|
|
78
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
79
|
+
flex items-center justify-center">
|
|
80
|
+
<div class="w-5 h-5">
|
|
81
|
+
<svelte:component this={secondary_operation.icon}/>
|
|
82
|
+
</div>
|
|
76
83
|
</div>
|
|
77
|
-
</
|
|
78
|
-
|
|
84
|
+
</button>
|
|
85
|
+
{/if}
|
|
79
86
|
|
|
80
87
|
{#if operations.length == 3}
|
|
81
88
|
{@const thrid_operation = operations[2]}
|
|
@@ -85,7 +92,8 @@ function toggle_expand(e) {
|
|
|
85
92
|
|
|
86
93
|
flex items-center justify-center
|
|
87
94
|
disable-dbl-tap-zoom"
|
|
88
|
-
on:click|stopPropagation={(e) => {on_click(e, thrid_operation)}}
|
|
95
|
+
on:click|stopPropagation={(e) => {on_click(e, thrid_operation)}}
|
|
96
|
+
on:mousedown={mousedown} >
|
|
89
97
|
<div class=" w-10 h-10
|
|
90
98
|
text-white bg-zinc-500 hover:bg-zinc-500
|
|
91
99
|
font-medium rounded-full text-sm text-center shadow-md
|
|
@@ -103,7 +111,8 @@ function toggle_expand(e) {
|
|
|
103
111
|
|
|
104
112
|
flex items-center justify-center
|
|
105
113
|
disable-dbl-tap-zoom"
|
|
106
|
-
on:click|stopPropagation={toggle_expand}
|
|
114
|
+
on:click|stopPropagation={toggle_expand}
|
|
115
|
+
on:mousedown={mousedown}>
|
|
107
116
|
<div class=" w-10 h-10
|
|
108
117
|
text-white bg-zinc-500 hover:bg-zinc-500
|
|
109
118
|
font-medium rounded-full text-sm text-center shadow-md
|
|
@@ -119,28 +128,31 @@ function toggle_expand(e) {
|
|
|
119
128
|
</div>
|
|
120
129
|
</button>
|
|
121
130
|
{#if expanded}
|
|
122
|
-
{@const operations_to_expand = operations.slice(2)}
|
|
131
|
+
{@const operations_to_expand = operations.slice(2).reverse()}
|
|
123
132
|
<ul class="list-none m-0 absolute bottom-[125px] right-0">
|
|
124
133
|
{#each operations_to_expand as operation}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
mx-0 mb-4 w-[55px] h-[55px]
|
|
133
|
-
flex items-center justify-center
|
|
134
|
-
disable-dbl-tap-zoom">
|
|
135
|
-
<div class=" w-[55px] h-[55px]
|
|
136
|
-
text-white bg-zinc-500 group-hover:bg-zinc-500
|
|
137
|
-
dark:bg-zinc-500 dark:group-hover:bg-zinc-500
|
|
138
|
-
font-medium rounded-full text-sm text-center shadow-md
|
|
139
|
-
flex items-center justify-center">
|
|
140
|
-
<div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
|
|
134
|
+
{#if !operation.separator}
|
|
135
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
136
|
+
<li class="flex flex-row px-0 py-0 justify-end group"
|
|
137
|
+
on:click|stopPropagation={(e) => {on_click(e, operation)}}
|
|
138
|
+
on:mousedown={mousedown}>
|
|
139
|
+
<div>
|
|
140
|
+
<span class="block whitespace-nowrap text-sm mt-3 font-semibold text-white mr-3 select-none bg-stone-700 group-hover:bg-stone-800 px-1 shadow-lg rounded">{operation.caption}</span>
|
|
141
141
|
</div>
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
<button class=" bg-transparent
|
|
143
|
+
mx-0 mb-4 w-[55px] h-[55px]
|
|
144
|
+
flex items-center justify-center
|
|
145
|
+
disable-dbl-tap-zoom">
|
|
146
|
+
<div class=" w-[55px] h-[55px]
|
|
147
|
+
text-white bg-zinc-500 group-hover:bg-zinc-500
|
|
148
|
+
dark:bg-zinc-500 dark:group-hover:bg-zinc-500
|
|
149
|
+
font-medium rounded-full text-sm text-center shadow-md
|
|
150
|
+
flex items-center justify-center">
|
|
151
|
+
<div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
|
|
152
|
+
</div>
|
|
153
|
+
</button>
|
|
154
|
+
</li>
|
|
155
|
+
{/if}
|
|
144
156
|
{/each}
|
|
145
157
|
</ul>
|
|
146
158
|
{/if}
|
|
@@ -22,7 +22,7 @@ export async function show(around, _toolbar, _props = {}) {
|
|
|
22
22
|
visible = true;
|
|
23
23
|
toolbar = _toolbar;
|
|
24
24
|
props = _props;
|
|
25
|
-
props.
|
|
25
|
+
props.onHide = () => {
|
|
26
26
|
hide();
|
|
27
27
|
};
|
|
28
28
|
hide_window_indicator = 0;
|
|
@@ -31,7 +31,7 @@ export async function show(around, _toolbar, _props = {}) {
|
|
|
31
31
|
if (!was_visible)
|
|
32
32
|
root_element.addEventListener("click", on_before_container_click, true);
|
|
33
33
|
}
|
|
34
|
-
export function
|
|
34
|
+
export function isVisible() {
|
|
35
35
|
return visible;
|
|
36
36
|
}
|
|
37
37
|
export function hide() {
|
|
@@ -58,7 +58,8 @@ afterUpdate(() => {
|
|
|
58
58
|
let rect = root_element.getBoundingClientRect();
|
|
59
59
|
if (rect.height == 0)
|
|
60
60
|
return;
|
|
61
|
-
|
|
61
|
+
const m = 15;
|
|
62
|
+
let container_rect = new DOMRect(m, 0, window.innerWidth - 2 * m, window.innerHeight);
|
|
62
63
|
if (rect.right > container_rect.right)
|
|
63
64
|
x = container_rect.right - rect.width;
|
|
64
65
|
if (rect.bottom > container_rect.bottom)
|
|
@@ -71,7 +72,7 @@ afterUpdate(() => {
|
|
|
71
72
|
</script>
|
|
72
73
|
|
|
73
74
|
<div id="__hd_svelte_floating_container"
|
|
74
|
-
class="p-2 bg-
|
|
75
|
+
class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow {display} z-30"
|
|
75
76
|
style="left:{x}px; top:{y}px; width: max-content; height:max-content"
|
|
76
77
|
bind:this={root_element}>
|
|
77
78
|
<svelte:component this={toolbar} {...props} />
|
|
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
show?: ((around: DOMRect | DOMPoint, _toolbar: any, _props?: {}) => Promise<void>) | undefined;
|
|
5
|
-
|
|
5
|
+
isVisible?: (() => boolean) | undefined;
|
|
6
6
|
hide?: (() => void) | undefined;
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
@@ -15,7 +15,7 @@ export type FloatingContainerEvents = typeof __propDef.events;
|
|
|
15
15
|
export type FloatingContainerSlots = typeof __propDef.slots;
|
|
16
16
|
export default class FloatingContainer extends SvelteComponentTyped<FloatingContainerProps, FloatingContainerEvents, FloatingContainerSlots> {
|
|
17
17
|
get show(): (around: DOMRect | DOMPoint, _toolbar: any, _props?: {}) => Promise<void>;
|
|
18
|
-
get
|
|
18
|
+
get isVisible(): () => boolean;
|
|
19
19
|
get hide(): () => void;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import {contextItemsStore} from '../stores.js'
|
|
3
3
|
|
|
4
4
|
export let operations = []
|
|
5
|
-
export let
|
|
5
|
+
export let onHide = undefined;
|
|
6
6
|
|
|
7
7
|
$: grid_cols = init(operations);
|
|
8
8
|
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
|
|
95
95
|
function execute_action(e, operation)
|
|
96
96
|
{
|
|
97
|
-
if(!!
|
|
98
|
-
|
|
97
|
+
if(!!onHide)
|
|
98
|
+
onHide();
|
|
99
99
|
|
|
100
100
|
e.stopPropagation();
|
|
101
101
|
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
return;
|
|
107
107
|
|
|
108
108
|
let context_item = null
|
|
109
|
-
if($
|
|
110
|
-
context_item = $
|
|
109
|
+
if($contextItemsStore.focused)
|
|
110
|
+
context_item = $contextItemsStore[$contextItemsStore.focused]
|
|
111
111
|
|
|
112
112
|
operation.action(context_item);
|
|
113
113
|
}
|
|
@@ -121,11 +121,15 @@
|
|
|
121
121
|
{@const col=col_span(operation.columns ?? 1)}
|
|
122
122
|
|
|
123
123
|
<button class=" py-2.5 px-5 {col}
|
|
124
|
-
text-base sm:text-xs font-medium text-
|
|
125
|
-
bg-
|
|
126
|
-
border rounded border-
|
|
124
|
+
text-base sm:text-xs font-medium text-stone-900 dark:text-stone-400 dark:hover:text-white
|
|
125
|
+
bg-stone-100 hover:bg-stone-200 dark:bg-stone-800 dark:hover:bg-stone-700 active:bg-stone-300 dark:active:bg-stone-600
|
|
126
|
+
border rounded border-stone-200 dark:border-stone-600 focus:outline-none
|
|
127
127
|
inline-flex items-center justify-center"
|
|
128
128
|
on:click={(e) => {execute_action(e, operation)}}>
|
|
129
|
+
|
|
130
|
+
{#if operation.icon}
|
|
131
|
+
<div class="w-3 h-3 mr-1"><svelte:component this={operation.icon}/></div>
|
|
132
|
+
{/if}
|
|
129
133
|
<div>{operation.caption}</div>
|
|
130
134
|
</button>
|
|
131
135
|
{/if}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} GridEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} GridSlots */
|
|
4
4
|
export default class Grid extends SvelteComponentTyped<{
|
|
5
|
-
|
|
5
|
+
onHide?: any;
|
|
6
6
|
operations?: any[] | undefined;
|
|
7
7
|
}, {
|
|
8
8
|
[evt: string]: CustomEvent<any>;
|
|
@@ -14,7 +14,7 @@ export type GridSlots = typeof __propDef.slots;
|
|
|
14
14
|
import { SvelteComponentTyped } from "svelte";
|
|
15
15
|
declare const __propDef: {
|
|
16
16
|
props: {
|
|
17
|
-
|
|
17
|
+
onHide?: any;
|
|
18
18
|
operations?: any[] | undefined;
|
|
19
19
|
};
|
|
20
20
|
events: {
|
package/components/button.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { Button } from "flowbite-svelte";
|
|
2
2
|
import { getContext } from "svelte";
|
|
3
|
-
import { data_tick_store,
|
|
3
|
+
import { data_tick_store, contextItemsStore, contextTypesStore } from "../stores.js";
|
|
4
4
|
import { reef } from "@humandialog/auth.svelte/dist/index.js";
|
|
5
5
|
export let self = null;
|
|
6
6
|
export let operation = "";
|
|
@@ -21,12 +21,12 @@ function setup(data_tick_store2) {
|
|
|
21
21
|
return;
|
|
22
22
|
last_tick = data_tick_store2;
|
|
23
23
|
if (!action) {
|
|
24
|
-
item = self ?? $
|
|
24
|
+
item = self ?? $contextItemsStore[ctx];
|
|
25
25
|
if (!typename)
|
|
26
|
-
typename = $
|
|
26
|
+
typename = $contextTypesStore[ctx];
|
|
27
27
|
}
|
|
28
28
|
if (is_table_component) {
|
|
29
|
-
if ($
|
|
29
|
+
if ($contextItemsStore["sel"] != self)
|
|
30
30
|
can_be_activated = false;
|
|
31
31
|
else
|
|
32
32
|
can_be_activated = true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>import { getContext } from "svelte";
|
|
2
|
-
import { data_tick_store,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { data_tick_store, contextItemsStore, contextTypesStore } from "../stores.js";
|
|
3
|
+
import { informModification, pushChanges } from "../updates.js";
|
|
4
|
+
import { parseWidthDirective } from "../utils.js";
|
|
5
5
|
export let checked = void 0;
|
|
6
6
|
export let disabled = false;
|
|
7
7
|
export let self = null;
|
|
@@ -9,12 +9,13 @@ export let a = "";
|
|
|
9
9
|
export let context = "";
|
|
10
10
|
export let typename = "";
|
|
11
11
|
export let c = "";
|
|
12
|
+
export let pushChangesImmediately = true;
|
|
12
13
|
let item = null;
|
|
13
14
|
let additional_class = $$restProps.class ?? "";
|
|
14
15
|
let value = false;
|
|
15
16
|
let ctx = context ? context : getContext("ctx");
|
|
16
|
-
let cs =
|
|
17
|
-
let color_style = disabled ? "text-
|
|
17
|
+
let cs = parseWidthDirective(c);
|
|
18
|
+
let color_style = disabled ? "text-stone-400 dark:text-stone-500" : "text-stone-900 dark:text-stone-300";
|
|
18
19
|
let last_tick = -1;
|
|
19
20
|
$:
|
|
20
21
|
setup($data_tick_store);
|
|
@@ -23,9 +24,9 @@ function setup(data_tick_store2) {
|
|
|
23
24
|
return;
|
|
24
25
|
last_tick = data_tick_store2;
|
|
25
26
|
if (checked === void 0) {
|
|
26
|
-
item = self ?? $
|
|
27
|
+
item = self ?? $contextItemsStore[ctx];
|
|
27
28
|
if (!typename)
|
|
28
|
-
typename = $
|
|
29
|
+
typename = $contextTypesStore[ctx];
|
|
29
30
|
value = item && a ? !!item[a] : false;
|
|
30
31
|
} else
|
|
31
32
|
value = checked;
|
|
@@ -34,9 +35,10 @@ function on_changed() {
|
|
|
34
35
|
if (item && a) {
|
|
35
36
|
item[a] = value;
|
|
36
37
|
if (typename) {
|
|
37
|
-
|
|
38
|
+
informModification(item, a, typename);
|
|
38
39
|
$data_tick_store = $data_tick_store + 1;
|
|
39
|
-
|
|
40
|
+
if (pushChangesImmediately)
|
|
41
|
+
pushChanges();
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -47,7 +49,7 @@ function on_changed() {
|
|
|
47
49
|
bind:checked={value}
|
|
48
50
|
on:change={on_changed}
|
|
49
51
|
{disabled}
|
|
50
|
-
class="w-4 h-4 bg-
|
|
52
|
+
class="w-4 h-4 bg-stone-100 border-stone-300 dark:ring-offset-stone-800 focus:ring-2 mr-2 dark:bg-stone-700 dark:border-stone-600 rounded text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600"/>
|
|
51
53
|
<span class="ml-1">
|
|
52
54
|
<slot/>
|
|
53
55
|
</span>
|
|
@@ -9,7 +9,7 @@ export declare class rCombo_definition {
|
|
|
9
9
|
collection_expr: string | undefined;
|
|
10
10
|
collection_path: string | undefined;
|
|
11
11
|
collection: object[] | undefined;
|
|
12
|
-
|
|
12
|
+
onCollect: undefined;
|
|
13
13
|
element_key: string | undefined;
|
|
14
14
|
element_name: string | undefined;
|
|
15
15
|
element_avatar: string | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export let association = void 0;
|
|
3
3
|
export let path = void 0;
|
|
4
4
|
export let objects = void 0;
|
|
5
|
-
export let
|
|
5
|
+
export let onCollect = void 0;
|
|
6
6
|
export let key = "";
|
|
7
7
|
export let name = "";
|
|
8
8
|
export let avatar = "";
|
|
@@ -10,7 +10,7 @@ let definition = getContext("rCombo-definition");
|
|
|
10
10
|
definition.collection_expr = association;
|
|
11
11
|
definition.collection_path = path;
|
|
12
12
|
definition.collection = objects;
|
|
13
|
-
definition.
|
|
13
|
+
definition.onCollect = onCollect;
|
|
14
14
|
definition.element_key = key;
|
|
15
15
|
definition.element_name = name;
|
|
16
16
|
definition.element_avatar = avatar;
|