@humandialog/forms.svelte 0.4.44 → 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 +94 -62
- 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 +165 -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 +134 -0
- package/components/list/internal/list.element.props.svelte.d.ts +21 -0
- package/components/list/internal/list.element.summary.svelte +40 -0
- package/components/list/internal/list.element.summary.svelte.d.ts +24 -0
- package/components/list/internal/list.element.svelte +100 -173
- 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 +3 -3
- 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 +175 -37
- 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 +25 -16
- 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 +14 -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 +201 -51
- package/vertical.toolbar.svelte +22 -13
- package/vertical.toolbar.svelte.d.ts +2 -2
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} SidebarEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SidebarSlots */
|
|
4
4
|
export default class Sidebar extends SvelteComponentTyped<{
|
|
5
|
-
inserter?: any;
|
|
6
5
|
border?: boolean | undefined;
|
|
7
|
-
inserter_placeholder?: string | undefined;
|
|
8
6
|
}, {
|
|
9
7
|
[evt: string]: CustomEvent<any>;
|
|
10
8
|
}, {
|
|
@@ -17,9 +15,7 @@ export type SidebarSlots = typeof __propDef.slots;
|
|
|
17
15
|
import { SvelteComponentTyped } from "svelte";
|
|
18
16
|
declare const __propDef: {
|
|
19
17
|
props: {
|
|
20
|
-
inserter?: any;
|
|
21
18
|
border?: boolean | undefined;
|
|
22
|
-
inserter_placeholder?: string | undefined;
|
|
23
19
|
};
|
|
24
20
|
events: {
|
|
25
21
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script>import Icon from "../icon.svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { contextItemsStore, auto_hide_sidebar, contextToolbarOperations } from "../../stores";
|
|
3
3
|
import FaBars from "svelte-icons/fa/FaBars.svelte";
|
|
4
4
|
import {
|
|
5
5
|
selectable as _selectable,
|
|
6
|
-
|
|
6
|
+
isSelected,
|
|
7
7
|
editable as _editable,
|
|
8
|
-
|
|
8
|
+
handleSelect
|
|
9
9
|
} from "../../utils";
|
|
10
|
-
import {
|
|
10
|
+
import { showMenu } from "../menu";
|
|
11
11
|
export let href;
|
|
12
12
|
export let icon = void 0;
|
|
13
13
|
export let active = false;
|
|
@@ -15,7 +15,7 @@ export let selectable = void 0;
|
|
|
15
15
|
export let editable = void 0;
|
|
16
16
|
export let operations = void 0;
|
|
17
17
|
$:
|
|
18
|
-
context_data = $
|
|
18
|
+
context_data = $contextItemsStore;
|
|
19
19
|
let user_class = $$props.class ?? "";
|
|
20
20
|
let root;
|
|
21
21
|
function selectable_if_needed(node, selectable2) {
|
|
@@ -23,7 +23,7 @@ function selectable_if_needed(node, selectable2) {
|
|
|
23
23
|
_selectable(node, selectable2);
|
|
24
24
|
}
|
|
25
25
|
function selected(itm, context_data2) {
|
|
26
|
-
if (
|
|
26
|
+
if (isSelected(itm))
|
|
27
27
|
return true;
|
|
28
28
|
else
|
|
29
29
|
return false;
|
|
@@ -35,7 +35,7 @@ function editable_if_needed(node, editable2) {
|
|
|
35
35
|
function on_link_clicked(e) {
|
|
36
36
|
auto_hide_sidebar();
|
|
37
37
|
if (selectable)
|
|
38
|
-
|
|
38
|
+
handleSelect(e);
|
|
39
39
|
e.stopPropagation();
|
|
40
40
|
}
|
|
41
41
|
function on_contextmenu(e) {
|
|
@@ -46,7 +46,7 @@ function on_contextmenu(e) {
|
|
|
46
46
|
return;
|
|
47
47
|
if (operations_list.length == 0)
|
|
48
48
|
return;
|
|
49
|
-
|
|
49
|
+
showMenu(new DOMPoint(e.clientX, e.clientY), operations_list);
|
|
50
50
|
e.preventDefault();
|
|
51
51
|
}
|
|
52
52
|
function can_show_context_menu(itm, context_data2) {
|
|
@@ -68,7 +68,7 @@ function on_show_menu(e) {
|
|
|
68
68
|
return;
|
|
69
69
|
if (operations_list.length == 0)
|
|
70
70
|
return;
|
|
71
|
-
|
|
71
|
+
showMenu(rect, operations_list);
|
|
72
72
|
}
|
|
73
73
|
</script>
|
|
74
74
|
|
|
@@ -81,11 +81,11 @@ function on_show_menu(e) {
|
|
|
81
81
|
on:keyup
|
|
82
82
|
class=" border border-transparent rounded-lg
|
|
83
83
|
text-lg sm:text-base font-normal
|
|
84
|
-
text-
|
|
85
|
-
dark:text-white sm:dark:hover:bg-
|
|
84
|
+
text-stone-900 sm:hover:bg-stone-100
|
|
85
|
+
dark:text-white sm:dark:hover:bg-stone-700 {user_class}
|
|
86
86
|
flex flex-row justify-between"
|
|
87
|
-
class:bg-
|
|
88
|
-
class:dark:bg-
|
|
87
|
+
class:bg-stone-200={active}
|
|
88
|
+
class:dark:bg-stone-700={active}
|
|
89
89
|
class:selected={selected(selectable, context_data)}>
|
|
90
90
|
<a href={href}
|
|
91
91
|
on:click={on_link_clicked}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>import Icon from "../icon.svelte";
|
|
2
|
+
import Edit from "../edit.field.svelte";
|
|
3
|
+
import { FaPlus } from "svelte-icons/fa";
|
|
4
|
+
import { getPrev, getNext, swapElements, getLast } from "../../utils";
|
|
5
|
+
import { informModification, pushChanges } from "../../updates";
|
|
6
|
+
export let objects;
|
|
7
|
+
export let orderAttrib = void 0;
|
|
8
|
+
export let inserter = void 0;
|
|
9
|
+
export let inserterPlaceholder = "New";
|
|
10
|
+
export const ORDER_STEP = 64;
|
|
11
|
+
export const MIN_ORDER = 0;
|
|
12
|
+
export function reload(_objects) {
|
|
13
|
+
objects = _objects;
|
|
14
|
+
}
|
|
15
|
+
export function moveUp(element) {
|
|
16
|
+
if (!orderAttrib)
|
|
17
|
+
return;
|
|
18
|
+
let prev = getPrev(objects, element);
|
|
19
|
+
if (prev) {
|
|
20
|
+
objects = swapElements(objects, element, prev);
|
|
21
|
+
const tmp = element[orderAttrib];
|
|
22
|
+
element[orderAttrib] = prev[orderAttrib];
|
|
23
|
+
prev[orderAttrib] = tmp;
|
|
24
|
+
informModification(element, orderAttrib);
|
|
25
|
+
informModification(prev, orderAttrib);
|
|
26
|
+
pushChanges();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function moveDown(element) {
|
|
30
|
+
if (!orderAttrib)
|
|
31
|
+
return;
|
|
32
|
+
let next = getNext(objects, element);
|
|
33
|
+
if (next) {
|
|
34
|
+
objects = swapElements(objects, element, next);
|
|
35
|
+
const tmp = element[orderAttrib];
|
|
36
|
+
element[orderAttrib] = next[orderAttrib];
|
|
37
|
+
next[orderAttrib] = tmp;
|
|
38
|
+
informModification(element, orderAttrib);
|
|
39
|
+
informModification(next, orderAttrib);
|
|
40
|
+
pushChanges();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function onNewElement(text) {
|
|
44
|
+
if (orderAttrib) {
|
|
45
|
+
let newElementOrder;
|
|
46
|
+
const last = getLast(objects);
|
|
47
|
+
if (last)
|
|
48
|
+
newElementOrder = last[orderAttrib] + ORDER_STEP;
|
|
49
|
+
else
|
|
50
|
+
newElementOrder = MIN_ORDER;
|
|
51
|
+
inserter(text, newElementOrder);
|
|
52
|
+
} else
|
|
53
|
+
inserter(text);
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
{#each objects as item (item.Id)}
|
|
58
|
+
<slot {item}/>
|
|
59
|
+
{/each }
|
|
60
|
+
|
|
61
|
+
{#if inserter}
|
|
62
|
+
<Edit class="p-3 sm:p-2 text-lg sm:text-base font-normal text-stone-500 rounded-lg dark:text-stone-400 hover:bg-stone-100 dark:hover:bg-stone-700"
|
|
63
|
+
onEnter={onNewElement}
|
|
64
|
+
placeholder={inserterPlaceholder}
|
|
65
|
+
inserter={true}>
|
|
66
|
+
<Icon size={5} component={FaPlus} class="mr-3"/>
|
|
67
|
+
</Edit>
|
|
68
|
+
{/if}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
objects: object[];
|
|
5
|
+
orderAttrib?: string | undefined;
|
|
6
|
+
inserter?: Function | undefined;
|
|
7
|
+
inserterPlaceholder?: string | undefined;
|
|
8
|
+
ORDER_STEP?: 64 | undefined;
|
|
9
|
+
MIN_ORDER?: 0 | undefined;
|
|
10
|
+
reload?: ((_objects: object[]) => void) | undefined;
|
|
11
|
+
moveUp?: ((element: object) => void) | undefined;
|
|
12
|
+
moveDown?: ((element: object) => void) | undefined;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {
|
|
18
|
+
default: {
|
|
19
|
+
item: object;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type SidebarProps = typeof __propDef.props;
|
|
24
|
+
export type SidebarEvents = typeof __propDef.events;
|
|
25
|
+
export type SidebarSlots = typeof __propDef.slots;
|
|
26
|
+
export default class Sidebar extends SvelteComponentTyped<SidebarProps, SidebarEvents, SidebarSlots> {
|
|
27
|
+
get ORDER_STEP(): 64;
|
|
28
|
+
get MIN_ORDER(): 0;
|
|
29
|
+
get reload(): (_objects: object[]) => void;
|
|
30
|
+
get moveUp(): (element: object) => void;
|
|
31
|
+
get moveDown(): (element: object) => void;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {data_tick_store,
|
|
2
|
+
import {data_tick_store, contextItemsStore, context_info_store } from '../stores.js'
|
|
3
3
|
import {getContext} from 'svelte';
|
|
4
4
|
|
|
5
5
|
export let context = ""
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
let item = null
|
|
20
20
|
if(self == null)
|
|
21
|
-
item = $
|
|
21
|
+
item = $contextItemsStore[ctx];
|
|
22
22
|
else
|
|
23
23
|
item = self
|
|
24
24
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
{
|
|
36
36
|
last_tick = t
|
|
37
37
|
if(self == null)
|
|
38
|
-
item = $
|
|
38
|
+
item = $contextItemsStore[ctx];
|
|
39
39
|
else
|
|
40
40
|
item = self
|
|
41
41
|
|
|
@@ -50,33 +50,33 @@
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
const
|
|
53
|
+
const selectItem = (itm, cinfo) => () => {
|
|
54
54
|
|
|
55
|
-
$
|
|
55
|
+
$contextItemsStore[select] = itm;
|
|
56
56
|
$context_info_store[select] = cinfo;
|
|
57
57
|
|
|
58
58
|
if(focus)
|
|
59
|
-
$
|
|
59
|
+
$contextItemsStore.focused = select
|
|
60
60
|
if(nav)
|
|
61
61
|
$data_tick_store = $data_tick_store + 1;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
let selected_item = $
|
|
65
|
-
$: selected_item = $
|
|
64
|
+
let selected_item = $contextItemsStore[select]
|
|
65
|
+
$: selected_item = $contextItemsStore[select]
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
<table class="min-w-full h-auto divide-
|
|
70
|
-
<thead class="bg-
|
|
69
|
+
<table class="min-w-full h-auto divide-stone-200">
|
|
70
|
+
<thead class="bg-stone-50 sticky">
|
|
71
71
|
<tr>
|
|
72
72
|
{#if headers != null}
|
|
73
73
|
{#each headers as header}
|
|
74
|
-
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-
|
|
74
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-stone-500 uppercase tracking-wider">
|
|
75
75
|
{header}
|
|
76
76
|
</th>
|
|
77
77
|
{/each}
|
|
78
78
|
{:else}
|
|
79
|
-
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-
|
|
79
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-stone-500 uppercase tracking-wider">
|
|
80
80
|
No headers...
|
|
81
81
|
</th>
|
|
82
82
|
{/if}
|
|
@@ -89,13 +89,13 @@
|
|
|
89
89
|
{#if item == selected_item}
|
|
90
90
|
<tr >
|
|
91
91
|
{#each fields as field}
|
|
92
|
-
<td class="px-4 py-1 bg-
|
|
92
|
+
<td class="px-4 py-1 bg-stone-100 whitespace-nowrap text-sm font-normal text-stone-900">{item[field]}</td>
|
|
93
93
|
{/each}
|
|
94
94
|
</tr>
|
|
95
95
|
{:else}
|
|
96
|
-
<tr on:click={
|
|
96
|
+
<tr on:click={selectItem(item, cinfo)}>
|
|
97
97
|
{#each fields as field}
|
|
98
|
-
<td class="px-4 py-1 whitespace-nowrap text-sm font-normal text-
|
|
98
|
+
<td class="px-4 py-1 whitespace-nowrap text-sm font-normal text-stone-900">{item[field]}</td>
|
|
99
99
|
{/each}
|
|
100
100
|
</tr>
|
|
101
101
|
{/if}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} SimpleEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} SimpleSlots */
|
|
4
4
|
export default class Simple extends SvelteComponentTyped<{
|
|
5
|
-
select?: string | undefined;
|
|
6
5
|
focus?: boolean | undefined;
|
|
6
|
+
select?: string | undefined;
|
|
7
7
|
context?: string | undefined;
|
|
8
8
|
self?: null | undefined;
|
|
9
9
|
nav?: boolean | undefined;
|
|
@@ -22,8 +22,8 @@ export type SimpleSlots = typeof __propDef.slots;
|
|
|
22
22
|
import { SvelteComponentTyped } from "svelte";
|
|
23
23
|
declare const __propDef: {
|
|
24
24
|
props: {
|
|
25
|
-
select?: string | undefined;
|
|
26
25
|
focus?: boolean | undefined;
|
|
26
|
+
select?: string | undefined;
|
|
27
27
|
context?: string | undefined;
|
|
28
28
|
self?: null | undefined;
|
|
29
29
|
nav?: boolean | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {data_tick_store,
|
|
2
|
+
import {data_tick_store, contextItemsStore, context_info_store } from '../../stores.js'
|
|
3
3
|
import {getContext} from 'svelte';
|
|
4
4
|
|
|
5
5
|
export let context = ""
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
let item = null
|
|
20
20
|
if(self == null)
|
|
21
|
-
item = $
|
|
21
|
+
item = $contextItemsStore[ctx];
|
|
22
22
|
else
|
|
23
23
|
item = self
|
|
24
24
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
{
|
|
36
36
|
last_tick = t
|
|
37
37
|
if(self == null)
|
|
38
|
-
item = $
|
|
38
|
+
item = $contextItemsStore[ctx];
|
|
39
39
|
else
|
|
40
40
|
item = self
|
|
41
41
|
|
|
@@ -50,46 +50,46 @@
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
const
|
|
53
|
+
const selectItem = (itm, cinfo) => () => {
|
|
54
54
|
|
|
55
|
-
$
|
|
55
|
+
$contextItemsStore[select] = itm;
|
|
56
56
|
$context_info_store[select] = cinfo;
|
|
57
57
|
|
|
58
58
|
if(focus)
|
|
59
|
-
$
|
|
59
|
+
$contextItemsStore.focused = select
|
|
60
60
|
if(nav)
|
|
61
61
|
$data_tick_store = $data_tick_store + 1;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
let selected_item = $
|
|
65
|
-
$: selected_item = $
|
|
64
|
+
let selected_item = $contextItemsStore[select]
|
|
65
|
+
$: selected_item = $contextItemsStore[select]
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
<table class="min-w-full h-auto divide-
|
|
70
|
-
<thead class="bg-
|
|
69
|
+
<table class="min-w-full h-auto divide-stone-200 cursor-default">
|
|
70
|
+
<thead class="bg-stone-50 sticky">
|
|
71
71
|
<tr>
|
|
72
72
|
{#if headers != null}
|
|
73
73
|
{#each headers as header}
|
|
74
|
-
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-
|
|
74
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-stone-500 uppercase tracking-wider">
|
|
75
75
|
{header}
|
|
76
76
|
</th>
|
|
77
77
|
{/each}
|
|
78
78
|
{:else}
|
|
79
|
-
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-
|
|
79
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-stone-500 uppercase tracking-wider">
|
|
80
80
|
No headers...
|
|
81
81
|
</th>
|
|
82
82
|
{/if}
|
|
83
83
|
</tr>
|
|
84
84
|
</thead>
|
|
85
85
|
{#if (items != null && items.length > 0 && fields != null)}
|
|
86
|
-
<tbody class="bg-white dark:bg-
|
|
86
|
+
<tbody class="bg-white dark:bg-stone-900">
|
|
87
87
|
{#each items as item}
|
|
88
88
|
{#if (item != null )}
|
|
89
|
-
<tr on:click={
|
|
90
|
-
class="whitespace-nowrap text-sm font-normal text-
|
|
91
|
-
class:bg-
|
|
92
|
-
class:dark:bg-
|
|
89
|
+
<tr on:click={selectItem(item, cinfo)}
|
|
90
|
+
class="whitespace-nowrap text-sm font-normal text-stone-900 dark:text-stone-300"
|
|
91
|
+
class:bg-stone-100={item==selected_item}
|
|
92
|
+
class:dark:bg-stone-700={item==selected_item}>
|
|
93
93
|
{#if $$slots['row']}
|
|
94
94
|
<slot name='row' {item}/>
|
|
95
95
|
{:else}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} TemplateEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TemplateSlots */
|
|
4
4
|
export default class Template extends SvelteComponentTyped<{
|
|
5
|
-
select?: string | undefined;
|
|
6
5
|
focus?: boolean | undefined;
|
|
6
|
+
select?: string | undefined;
|
|
7
7
|
context?: string | undefined;
|
|
8
8
|
self?: null | undefined;
|
|
9
9
|
nav?: boolean | undefined;
|
|
@@ -30,8 +30,8 @@ export type TemplateSlots = typeof __propDef.slots;
|
|
|
30
30
|
import { SvelteComponentTyped } from "svelte";
|
|
31
31
|
declare const __propDef: {
|
|
32
32
|
props: {
|
|
33
|
-
select?: string | undefined;
|
|
34
33
|
focus?: boolean | undefined;
|
|
34
|
+
select?: string | undefined;
|
|
35
35
|
context?: string | undefined;
|
|
36
36
|
self?: null | undefined;
|
|
37
37
|
nav?: boolean | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script>import { data_tick_store,
|
|
1
|
+
<script>import { data_tick_store, contextItemsStore, context_info_store, contextTypesStore, contextToolbarOperations } from "../../stores.js";
|
|
2
2
|
import { getContext, setContext, onDestroy } from "svelte";
|
|
3
3
|
import { rTable_definition } from "./table";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { parseWidthDirective } from "../../utils.js";
|
|
5
|
+
import { showMenu } from "../menu";
|
|
6
6
|
export let context = "";
|
|
7
7
|
export let collection = "";
|
|
8
8
|
export let self = null;
|
|
@@ -15,8 +15,8 @@ export let focus = true;
|
|
|
15
15
|
export let nav = true;
|
|
16
16
|
export let c = "";
|
|
17
17
|
export let typename = "";
|
|
18
|
-
export let
|
|
19
|
-
export let
|
|
18
|
+
export let toolbarOperations = [];
|
|
19
|
+
export let menuOperations = [];
|
|
20
20
|
let definition = new rTable_definition();
|
|
21
21
|
setContext("rTable-definition", definition);
|
|
22
22
|
setContext("rIs-table-component", true);
|
|
@@ -25,19 +25,19 @@ let items = null;
|
|
|
25
25
|
let item = null;
|
|
26
26
|
let last_tick = -1;
|
|
27
27
|
let selected_item;
|
|
28
|
-
let cs = c ?
|
|
28
|
+
let cs = c ? parseWidthDirective(c) : "w-full min-w-full";
|
|
29
29
|
$: {
|
|
30
30
|
if ($data_tick_store > last_tick)
|
|
31
31
|
refresh();
|
|
32
32
|
}
|
|
33
33
|
$:
|
|
34
|
-
selected_item = $
|
|
34
|
+
selected_item = $contextItemsStore[select];
|
|
35
35
|
onDestroy(() => {
|
|
36
|
-
|
|
36
|
+
selectItem(null, null);
|
|
37
37
|
});
|
|
38
38
|
export function refresh() {
|
|
39
39
|
last_tick = $data_tick_store;
|
|
40
|
-
item = self ?? $
|
|
40
|
+
item = self ?? $contextItemsStore[ctx];
|
|
41
41
|
if (objects)
|
|
42
42
|
items = objects;
|
|
43
43
|
else if (item && collection)
|
|
@@ -45,27 +45,27 @@ export function refresh() {
|
|
|
45
45
|
else
|
|
46
46
|
items = [];
|
|
47
47
|
if (!typename)
|
|
48
|
-
typename = $
|
|
48
|
+
typename = $contextTypesStore[ctx];
|
|
49
49
|
}
|
|
50
|
-
export function
|
|
50
|
+
export function updateObjects(_objects) {
|
|
51
51
|
objects = _objects;
|
|
52
52
|
refresh();
|
|
53
53
|
}
|
|
54
|
-
export function
|
|
54
|
+
export function updateSelf(_self) {
|
|
55
55
|
self = _self;
|
|
56
56
|
refresh();
|
|
57
57
|
}
|
|
58
|
-
export function
|
|
59
|
-
$
|
|
58
|
+
export function selectItem(itm, cinfo2) {
|
|
59
|
+
$contextItemsStore[select] = itm;
|
|
60
60
|
$context_info_store[select] = cinfo2;
|
|
61
61
|
if (itm && itm.oclType)
|
|
62
|
-
$
|
|
62
|
+
$contextTypesStore[select] = itm.oclType;
|
|
63
63
|
if (focus)
|
|
64
|
-
$
|
|
64
|
+
$contextItemsStore.focused = select;
|
|
65
65
|
if (itm)
|
|
66
|
-
$
|
|
66
|
+
$contextToolbarOperations = [...toolbarOperations];
|
|
67
67
|
else
|
|
68
|
-
$
|
|
68
|
+
$contextToolbarOperations = [];
|
|
69
69
|
if (nav)
|
|
70
70
|
$data_tick_store = $data_tick_store + 1;
|
|
71
71
|
}
|
|
@@ -80,33 +80,33 @@ function override_items_from_slot(...args) {
|
|
|
80
80
|
return 0;
|
|
81
81
|
}
|
|
82
82
|
function show_context_menu(e, itm, cinfo2) {
|
|
83
|
-
if (!
|
|
83
|
+
if (!menuOperations)
|
|
84
84
|
return;
|
|
85
|
-
if (
|
|
85
|
+
if (menuOperations.length == 0)
|
|
86
86
|
return;
|
|
87
87
|
e.stopPropagation();
|
|
88
88
|
e.preventDefault();
|
|
89
|
-
|
|
89
|
+
showMenu(new DOMPoint(e.clientX, e.clientY), menuOperations);
|
|
90
90
|
}
|
|
91
91
|
</script>
|
|
92
92
|
|
|
93
93
|
{#if true}
|
|
94
94
|
<slot/> <!-- let definition execute -->
|
|
95
95
|
|
|
96
|
-
<table class="{cs} h-auto divide-
|
|
97
|
-
<thead class="bg-
|
|
96
|
+
<table class="{cs} h-auto divide-stone-200 cursor-default">
|
|
97
|
+
<thead class="bg-stone-50 sticky">
|
|
98
98
|
<tr>
|
|
99
99
|
{#if definition || headers.length }
|
|
100
100
|
{@const lheaders = headers.length ? headers : definition.columns.map( v => v.header )}
|
|
101
101
|
{#if lheaders.length && lheaders.some(s => s.length > 0)}
|
|
102
102
|
{#each lheaders as header}
|
|
103
|
-
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-
|
|
103
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-stone-500 uppercase tracking-wider">
|
|
104
104
|
{header}
|
|
105
105
|
</th>
|
|
106
106
|
{/each}
|
|
107
107
|
{/if}
|
|
108
108
|
{:else}
|
|
109
|
-
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-
|
|
109
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-stone-500 uppercase tracking-wider">
|
|
110
110
|
No headers...
|
|
111
111
|
</th>
|
|
112
112
|
{/if}
|
|
@@ -114,14 +114,14 @@ function show_context_menu(e, itm, cinfo2) {
|
|
|
114
114
|
</thead>
|
|
115
115
|
{#if (items != null) && (items.length > 0)}
|
|
116
116
|
{@const lfields = fields.length ? fields : definition.columns.map( v => v.field )}
|
|
117
|
-
<tbody class="bg-white dark:bg-
|
|
117
|
+
<tbody class="bg-white dark:bg-stone-900">
|
|
118
118
|
{#each items as item}
|
|
119
119
|
{#if (item != null )}
|
|
120
|
-
<tr on:click={ (e) => { e.stopPropagation(); e.preventDefault();
|
|
121
|
-
on:contextmenu={ (e) => {
|
|
122
|
-
class="whitespace-nowrap text-sm font-normal text-
|
|
123
|
-
class:bg-
|
|
124
|
-
class:dark:bg-
|
|
120
|
+
<tr on:click={ (e) => { e.stopPropagation(); e.preventDefault(); selectItem(item, cinfo);} }
|
|
121
|
+
on:contextmenu={ (e) => {selectItem(item, cinfo); show_context_menu(e, item, cinfo)} }
|
|
122
|
+
class="whitespace-nowrap text-sm font-normal text-stone-900 dark:text-stone-300"
|
|
123
|
+
class:bg-stone-100={item==selected_item}
|
|
124
|
+
class:dark:bg-stone-700={item==selected_item}>
|
|
125
125
|
{#each lfields as field, i}
|
|
126
126
|
{@const cc = `c${i}`}
|
|
127
127
|
{@const column = definition.columns[i]}
|
|
@@ -13,12 +13,12 @@ declare const __propDef: {
|
|
|
13
13
|
nav?: boolean | undefined;
|
|
14
14
|
c?: string | undefined;
|
|
15
15
|
typename?: string | undefined;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
toolbarOperations?: any[] | undefined;
|
|
17
|
+
menuOperations?: any[] | undefined;
|
|
18
18
|
refresh?: (() => void) | undefined;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
updateObjects?: ((_objects: any) => void) | undefined;
|
|
20
|
+
updateSelf?: ((_self: any) => void) | undefined;
|
|
21
|
+
selectItem?: ((itm: any, cinfo: any) => void) | undefined;
|
|
22
22
|
};
|
|
23
23
|
events: {
|
|
24
24
|
[evt: string]: CustomEvent<any>;
|
|
@@ -68,8 +68,8 @@ export type TableEvents = typeof __propDef.events;
|
|
|
68
68
|
export type TableSlots = typeof __propDef.slots;
|
|
69
69
|
export default class Table extends SvelteComponentTyped<TableProps, TableEvents, TableSlots> {
|
|
70
70
|
get refresh(): () => void;
|
|
71
|
-
get
|
|
72
|
-
get
|
|
73
|
-
get
|
|
71
|
+
get updateObjects(): (_objects: any) => void;
|
|
72
|
+
get updateSelf(): (_self: any) => void;
|
|
73
|
+
get selectItem(): (itm: any, cinfo: any) => void;
|
|
74
74
|
}
|
|
75
75
|
export {};
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<div class="{col_span}">
|
|
48
|
-
<label for="name" class="block {label_mb} text-xs font-small text-
|
|
48
|
+
<label for="name" class="block {label_mb} text-xs font-small text-stone-900 dark:text-white">{label}</label>
|
|
49
49
|
<textarea id="description" rows="5"
|
|
50
|
-
class="block {input_p} w-full text-sm text-
|
|
51
|
-
rounded-lg border border-
|
|
52
|
-
dark:bg-
|
|
50
|
+
class="block {input_p} w-full text-sm text-stone-900 bg-stone-50
|
|
51
|
+
rounded-lg border border-stone-300 focus:ring-primary-500 focus:border-primary-500
|
|
52
|
+
dark:bg-stone-700 dark:border-stone-600 dark:placeholder-stone-400 dark:text-white
|
|
53
53
|
dark:focus:ring-primary-500 dark:focus:border-primary-500"
|
|
54
54
|
placeholder={placeholder}>{val}</textarea>
|
|
55
55
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {data_tick_store,
|
|
4
|
-
import {
|
|
3
|
+
import {data_tick_store, contextItemsStore} from '../stores.js'
|
|
4
|
+
import { parseWidthDirective} from '../utils.js'
|
|
5
5
|
|
|
6
6
|
export let label = "Label"
|
|
7
7
|
export let a = '';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
let _label = label;
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
let cs =
|
|
13
|
+
let cs = parseWidthDirective(c);
|
|
14
14
|
|
|
15
15
|
let item = null
|
|
16
16
|
let ctx = ''
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
else if(a != '')
|
|
26
26
|
{
|
|
27
|
-
item = $
|
|
27
|
+
item = $contextItemsStore[ctx];
|
|
28
28
|
if(item != null)
|
|
29
29
|
_label = item[a]
|
|
30
30
|
}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
_label = label;
|
|
41
41
|
else
|
|
42
42
|
{
|
|
43
|
-
item = $
|
|
43
|
+
item = $contextItemsStore[ctx];
|
|
44
44
|
if(item != null)
|
|
45
45
|
_label = item[a]
|
|
46
46
|
}
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
}
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
|
-
<p class="{cs} text-
|
|
53
|
+
<p class="{cs} text-stone-900 dark:text-white {$$restProps['class']}">{_label}</p>
|
|
54
54
|
|