@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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<script>import { tick } from "svelte";
|
|
2
|
+
import { rList_definition, rList_property_type } from "../List";
|
|
3
|
+
import Combo from "../../combo/combo.svelte";
|
|
4
|
+
import DatePicker from "../../date.svelte";
|
|
5
|
+
export let definition;
|
|
6
|
+
export let item;
|
|
7
|
+
export let placeholder = "";
|
|
8
|
+
let props = [];
|
|
9
|
+
export function editProperty(field) {
|
|
10
|
+
let prop_idx = definition.properties.findIndex((p) => p.name == field);
|
|
11
|
+
if (prop_idx < 0)
|
|
12
|
+
return;
|
|
13
|
+
let property = definition.properties[prop_idx];
|
|
14
|
+
switch (property.type) {
|
|
15
|
+
case rList_property_type.Date:
|
|
16
|
+
edit_date(field, prop_idx);
|
|
17
|
+
break;
|
|
18
|
+
case rList_property_type.Combo:
|
|
19
|
+
edit_combo(field, prop_idx);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function on_date_changed(value, a) {
|
|
24
|
+
if (!value)
|
|
25
|
+
item[a] = "";
|
|
26
|
+
else
|
|
27
|
+
item[a] = value.toJSON();
|
|
28
|
+
}
|
|
29
|
+
function on_combo_changed(key, name, prop) {
|
|
30
|
+
if (prop.association) {
|
|
31
|
+
let iname = prop.combo_definition.element_name ?? "$display";
|
|
32
|
+
item[prop.a] = {
|
|
33
|
+
$ref: key,
|
|
34
|
+
[iname]: name
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
let value = key ?? name;
|
|
38
|
+
item[prop.a] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function edit_combo(field, prop_idx) {
|
|
42
|
+
let combo = props[prop_idx];
|
|
43
|
+
if (!!combo)
|
|
44
|
+
combo.show();
|
|
45
|
+
else {
|
|
46
|
+
placeholder = field;
|
|
47
|
+
await tick();
|
|
48
|
+
combo = props[prop_idx];
|
|
49
|
+
if (!!combo)
|
|
50
|
+
combo.show(void 0, () => {
|
|
51
|
+
placeholder = "";
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function edit_date(field, prop_idx) {
|
|
56
|
+
let combo = props[prop_idx];
|
|
57
|
+
if (!!combo)
|
|
58
|
+
combo.show();
|
|
59
|
+
else {
|
|
60
|
+
placeholder = field;
|
|
61
|
+
await tick();
|
|
62
|
+
combo = props[prop_idx];
|
|
63
|
+
if (!!combo)
|
|
64
|
+
combo.show(void 0, () => {
|
|
65
|
+
placeholder = "";
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<div class="text-xs grid-{definition.properties.length}">
|
|
72
|
+
{#each definition.properties as prop, prop_index}
|
|
73
|
+
<p class="col-span-1 w-full mr-auto mt-0.5">
|
|
74
|
+
{#if item[prop.a] || placeholder == prop.name}
|
|
75
|
+
<span role="gridcell" tabindex="0">
|
|
76
|
+
{#if prop.type == rList_property_type.Date}
|
|
77
|
+
<DatePicker self={item}
|
|
78
|
+
a={prop.a}
|
|
79
|
+
compact={true}
|
|
80
|
+
onSelect={prop.onSelect}
|
|
81
|
+
s="xs"
|
|
82
|
+
inContext="props sel"
|
|
83
|
+
bind:this={props[prop_index]}
|
|
84
|
+
changed={(value)=>{on_date_changed(value, prop.a)}}
|
|
85
|
+
/>
|
|
86
|
+
{:else if prop.type == rList_property_type.Combo}
|
|
87
|
+
<Combo self={item}
|
|
88
|
+
inContext="props sel"
|
|
89
|
+
compact={true}
|
|
90
|
+
a={prop.a}
|
|
91
|
+
onSelect={prop.onSelect}
|
|
92
|
+
isAssociation={prop.association}
|
|
93
|
+
icon={false}
|
|
94
|
+
bind:this={props[prop_index]}
|
|
95
|
+
definition={prop.combo_definition}
|
|
96
|
+
changed={(key,name)=>{on_combo_changed(key, name, prop)}}
|
|
97
|
+
s='xs'/>
|
|
98
|
+
{:else if prop.type == rList_property_type.Static}
|
|
99
|
+
<span class="dark:text-white text-stone-400 truncate px-2.5 bg-stone-900/10 dark:bg-stone-100/10 rounded-lg">
|
|
100
|
+
{item[prop.a]}
|
|
101
|
+
</span>
|
|
102
|
+
{/if}
|
|
103
|
+
</span>
|
|
104
|
+
{/if}
|
|
105
|
+
</p>
|
|
106
|
+
{/each}
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<style>
|
|
110
|
+
.grid-1
|
|
111
|
+
{
|
|
112
|
+
display: grid;
|
|
113
|
+
grid-template-columns: 100%;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.grid-2
|
|
117
|
+
{
|
|
118
|
+
display: grid;
|
|
119
|
+
grid-template-columns: 50% 50%;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.grid-3
|
|
123
|
+
{
|
|
124
|
+
display: grid;
|
|
125
|
+
grid-template-columns: 33% 33% 33%;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.grid-4
|
|
129
|
+
{
|
|
130
|
+
display: grid;
|
|
131
|
+
grid-template-columns: 25% 25% 25% 25%;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { rList_definition } from '../List';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
definition: rList_definition;
|
|
6
|
+
item: object;
|
|
7
|
+
placeholder?: string | undefined;
|
|
8
|
+
editProperty?: ((field: string) => void) | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type ListProps = typeof __propDef.props;
|
|
16
|
+
export type ListEvents = typeof __propDef.events;
|
|
17
|
+
export type ListSlots = typeof __propDef.slots;
|
|
18
|
+
export default class List extends SvelteComponentTyped<ListProps, ListEvents, ListSlots> {
|
|
19
|
+
get editProperty(): (field: string) => void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script>import {
|
|
2
|
+
editable as _editable
|
|
3
|
+
} from "../../../utils";
|
|
4
|
+
export let id;
|
|
5
|
+
export let readonly = false;
|
|
6
|
+
export let text = "";
|
|
7
|
+
export let placeholder = false;
|
|
8
|
+
export let editable;
|
|
9
|
+
export let clickEdit;
|
|
10
|
+
let user_class = $$props.class ?? "";
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
14
|
+
{#if readonly}
|
|
15
|
+
<p {id} class=" sm:text-xs sm:min-h-[1rem]
|
|
16
|
+
text-base min-h-[1.5rem]
|
|
17
|
+
text-stone-400
|
|
18
|
+
{user_class}"
|
|
19
|
+
on:click>
|
|
20
|
+
{text}
|
|
21
|
+
</p>
|
|
22
|
+
{:else if text}
|
|
23
|
+
<p {id} class=" sm:text-xs sm:min-h-[1rem]
|
|
24
|
+
text-base min-h-[1.5rem]
|
|
25
|
+
text-stone-400
|
|
26
|
+
{user_class}"
|
|
27
|
+
use:_editable={editable}
|
|
28
|
+
on:click>
|
|
29
|
+
{text}
|
|
30
|
+
</p>
|
|
31
|
+
{:else if placeholder}
|
|
32
|
+
<p {id} class="sm:text-xs sm:min-h-[1rem]
|
|
33
|
+
text-base min-h-[1.5rem]
|
|
34
|
+
text-stone-400
|
|
35
|
+
{user_class}"
|
|
36
|
+
use:_editable={editable}
|
|
37
|
+
on:click>
|
|
38
|
+
</p>
|
|
39
|
+
{/if}
|
|
40
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
id: string;
|
|
6
|
+
readonly?: boolean | undefined;
|
|
7
|
+
text?: string | undefined;
|
|
8
|
+
placeholder?: boolean | undefined;
|
|
9
|
+
editable: any;
|
|
10
|
+
clickEdit: any;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
click: MouseEvent;
|
|
14
|
+
} & {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots: {};
|
|
18
|
+
};
|
|
19
|
+
export type ListProps = typeof __propDef.props;
|
|
20
|
+
export type ListEvents = typeof __propDef.events;
|
|
21
|
+
export type ListSlots = typeof __propDef.slots;
|
|
22
|
+
export default class List extends SvelteComponentTyped<ListProps, ListEvents, ListSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
<script>import { tick, getContext } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import { contextItemsStore } from "../../../stores";
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
isSelected,
|
|
5
5
|
selectable,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
activateItem,
|
|
7
|
+
isActive,
|
|
8
8
|
editable,
|
|
9
|
-
|
|
9
|
+
startEditing
|
|
10
10
|
} from "../../../utils";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
11
|
+
import { showGridMenu, showMenu } from "../../menu";
|
|
12
|
+
import { pushChanges, informModification } from "../../../updates";
|
|
13
|
+
import Summary from "./list.element.summary.svelte";
|
|
14
|
+
import Properties from "./list.element.props.svelte";
|
|
15
|
+
import { isDeviceSmallerThan } from "../../../utils";
|
|
15
16
|
import { rList_definition, rList_property_type } from "../List";
|
|
17
|
+
import { push } from "svelte-spa-router";
|
|
16
18
|
export let item;
|
|
17
19
|
export let title = "";
|
|
18
20
|
export let summary = "";
|
|
19
21
|
export let typename = void 0;
|
|
20
|
-
export let
|
|
21
|
-
export let
|
|
22
|
+
export let toolbarOperations;
|
|
23
|
+
export let contextMenu;
|
|
22
24
|
let definition = getContext("rList-definition");
|
|
23
25
|
let placeholder = "";
|
|
24
|
-
let
|
|
26
|
+
let props_sm;
|
|
27
|
+
let props_md;
|
|
25
28
|
$:
|
|
26
|
-
is_row_active = calculate_active(item, $
|
|
29
|
+
is_row_active = calculate_active(item, $contextItemsStore);
|
|
27
30
|
$:
|
|
28
|
-
is_row_selected = selected(item, $
|
|
31
|
+
is_row_selected = selected(item, $contextItemsStore);
|
|
29
32
|
$:
|
|
30
33
|
selected_class = is_row_selected ? "!border-blue-300" : "";
|
|
31
34
|
$:
|
|
32
|
-
focused_class = is_row_active ? "bg-
|
|
35
|
+
focused_class = is_row_active ? "bg-stone-200 dark:bg-stone-700" : "";
|
|
36
|
+
$:
|
|
37
|
+
is_link_like = is_row_selected && (!!definition.title_href || !!definition.title_href_func);
|
|
33
38
|
if (!typename) {
|
|
34
39
|
if (item.$type)
|
|
35
40
|
typename = item.$type;
|
|
@@ -51,18 +56,18 @@ if (!title)
|
|
|
51
56
|
if (!summary)
|
|
52
57
|
summary = definition.summary;
|
|
53
58
|
function calculate_active(...args) {
|
|
54
|
-
return
|
|
59
|
+
return isActive("props", item);
|
|
55
60
|
}
|
|
56
61
|
function selected(...args) {
|
|
57
|
-
return
|
|
62
|
+
return isSelected(item);
|
|
58
63
|
}
|
|
59
64
|
async function change_name(text) {
|
|
60
65
|
if (definition.on_title_changed) {
|
|
61
66
|
definition.on_title_changed(item, text, title);
|
|
62
67
|
} else {
|
|
63
68
|
item[title] = text;
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
informModification(item, title, typename);
|
|
70
|
+
pushChanges();
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
async function change_summary(text) {
|
|
@@ -70,19 +75,19 @@ async function change_summary(text) {
|
|
|
70
75
|
definition.on_summary_changed(item, text, summary);
|
|
71
76
|
} else {
|
|
72
77
|
item[summary] = text;
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
informModification(item, summary, typename);
|
|
79
|
+
pushChanges();
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
function edit(e) {
|
|
78
83
|
if (!is_row_active)
|
|
79
84
|
return;
|
|
80
|
-
|
|
85
|
+
startEditing(e.target);
|
|
81
86
|
}
|
|
82
87
|
export function activate() {
|
|
83
88
|
activate_row(null, item);
|
|
84
89
|
}
|
|
85
|
-
function
|
|
90
|
+
function on_active_row_clicked(e, part) {
|
|
86
91
|
if (!is_row_active)
|
|
87
92
|
return;
|
|
88
93
|
let click_on_empty_space = true;
|
|
@@ -97,82 +102,65 @@ function edit_row_property(e, part) {
|
|
|
97
102
|
}
|
|
98
103
|
let can_show_context_menu = click_on_empty_space;
|
|
99
104
|
can_show_context_menu = false;
|
|
100
|
-
if (can_show_context_menu &&
|
|
105
|
+
if (can_show_context_menu && contextMenu) {
|
|
101
106
|
const pt = new DOMPoint(e.clientX, e.clientY);
|
|
102
|
-
let context_operations =
|
|
107
|
+
let context_operations = contextMenu(item);
|
|
103
108
|
if (context_operations !== null) {
|
|
104
109
|
if (typeof context_operations === "object") {
|
|
105
110
|
if (Array.isArray(context_operations))
|
|
106
|
-
|
|
111
|
+
showMenu(pt, context_operations);
|
|
107
112
|
else if (context_operations.grid)
|
|
108
|
-
|
|
113
|
+
showGridMenu(pt, context_operations.grid);
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
116
|
} else if (click_on_empty_space) {
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
if (definition.title_href || definition.title_href_func) {
|
|
118
|
+
let link = "";
|
|
119
|
+
if (definition.title_href)
|
|
120
|
+
link = definition.title_href;
|
|
121
|
+
else if (definition.title_href_func)
|
|
122
|
+
link = definition.title_href_func(item);
|
|
123
|
+
if (link)
|
|
124
|
+
push(link);
|
|
125
|
+
} else {
|
|
126
|
+
if (part == "top" && !definition.title_readonly)
|
|
127
|
+
force_editing("Title");
|
|
128
|
+
else if (part == "bottom" && !definition.summary_readonly)
|
|
129
|
+
force_editing("Summary");
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
116
132
|
}
|
|
117
133
|
}
|
|
118
134
|
function activate_row(e, item2) {
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
activate_item("props", item2, toolbar_operations(item2));
|
|
135
|
+
activateItem("props", item2, toolbarOperations(item2));
|
|
122
136
|
if (e)
|
|
123
137
|
e.stopPropagation();
|
|
124
138
|
}
|
|
125
139
|
function on_contextmenu(e) {
|
|
126
|
-
if (!
|
|
140
|
+
if (!contextMenu)
|
|
127
141
|
return;
|
|
128
142
|
const pt = new DOMPoint(e.clientX, e.clientY);
|
|
129
|
-
let context_operations =
|
|
143
|
+
let context_operations = contextMenu(item);
|
|
130
144
|
if (context_operations !== null) {
|
|
131
145
|
if (typeof context_operations === "object") {
|
|
132
146
|
if (Array.isArray(context_operations))
|
|
133
|
-
|
|
147
|
+
showMenu(pt, context_operations);
|
|
134
148
|
else if (context_operations.grid)
|
|
135
|
-
|
|
149
|
+
showGridMenu(pt, context_operations.grid);
|
|
136
150
|
}
|
|
137
151
|
}
|
|
138
152
|
e.preventDefault();
|
|
139
153
|
}
|
|
140
|
-
function
|
|
141
|
-
if (!value)
|
|
142
|
-
item[a] = "";
|
|
143
|
-
else
|
|
144
|
-
item[a] = value.toJSON();
|
|
145
|
-
}
|
|
146
|
-
function on_combo_changed(key, name, prop) {
|
|
147
|
-
if (prop.association) {
|
|
148
|
-
let iname = prop.combo_definition.element_name ?? "$display";
|
|
149
|
-
item[prop.a] = {
|
|
150
|
-
$ref: key,
|
|
151
|
-
[iname]: name
|
|
152
|
-
};
|
|
153
|
-
} else {
|
|
154
|
-
let value = key ?? name;
|
|
155
|
-
item[prop.a] = value;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
export function edit_property(field) {
|
|
154
|
+
export function editProperty(field) {
|
|
159
155
|
if (field == title)
|
|
160
156
|
force_editing("Title");
|
|
161
157
|
else if (field == summary)
|
|
162
158
|
force_editing("Summary");
|
|
163
159
|
else {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
switch (property.type) {
|
|
169
|
-
case rList_property_type.Date:
|
|
170
|
-
edit_date(field, prop_idx);
|
|
171
|
-
break;
|
|
172
|
-
case rList_property_type.Combo:
|
|
173
|
-
edit_combo(field, prop_idx);
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
160
|
+
if (isDeviceSmallerThan("sm"))
|
|
161
|
+
props_sm.editProperty(field);
|
|
162
|
+
else
|
|
163
|
+
props_md.editProperty(field);
|
|
176
164
|
}
|
|
177
165
|
}
|
|
178
166
|
async function force_editing(field) {
|
|
@@ -188,135 +176,74 @@ async function force_editing(field) {
|
|
|
188
176
|
if (!element_node.classList.contains("editable")) {
|
|
189
177
|
return;
|
|
190
178
|
}
|
|
191
|
-
|
|
179
|
+
startEditing(element_node, () => {
|
|
192
180
|
placeholder = "";
|
|
193
181
|
});
|
|
194
182
|
}
|
|
195
|
-
async function edit_combo(field, prop_idx) {
|
|
196
|
-
let combo = props[prop_idx];
|
|
197
|
-
if (!!combo)
|
|
198
|
-
combo.show();
|
|
199
|
-
else {
|
|
200
|
-
placeholder = field;
|
|
201
|
-
await tick();
|
|
202
|
-
combo = props[prop_idx];
|
|
203
|
-
if (!!combo)
|
|
204
|
-
combo.show(void 0, () => {
|
|
205
|
-
placeholder = "";
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
async function edit_date(field, prop_idx) {
|
|
210
|
-
let combo = props[prop_idx];
|
|
211
|
-
if (!!combo)
|
|
212
|
-
combo.show();
|
|
213
|
-
else {
|
|
214
|
-
placeholder = field;
|
|
215
|
-
await tick();
|
|
216
|
-
combo = props[prop_idx];
|
|
217
|
-
if (!!combo)
|
|
218
|
-
combo.show(void 0, () => {
|
|
219
|
-
placeholder = "";
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
183
|
</script>
|
|
224
184
|
|
|
225
185
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
226
186
|
{#if item}
|
|
227
187
|
{@const element_title = item[title]}
|
|
228
188
|
|
|
229
|
-
<section class="flex flex-row my-0 w-full text-sm text-
|
|
189
|
+
<section class="mt-3 flex flex-row my-0 w-full text-sm text-stone-700 dark:text-stone-300 cursor-default rounded-md border border-transparent {selected_class} {focused_class}"
|
|
230
190
|
on:contextmenu={on_contextmenu}
|
|
231
191
|
role="menu"
|
|
232
192
|
tabindex="-1">
|
|
233
193
|
|
|
234
194
|
<slot name="left" element={item}/>
|
|
235
195
|
|
|
236
|
-
<div
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
196
|
+
<div class="ml-3 w-full py-1"
|
|
197
|
+
class:sm:hover:cursor-pointer={is_link_like}
|
|
198
|
+
use:selectable={item}
|
|
199
|
+
on:click={(e) => {activate_row(e, item)}}
|
|
200
|
+
role="row"
|
|
201
|
+
tabindex="0">
|
|
202
|
+
<div class="block sm:flex sm:flex-row" on:click={(e) => on_active_row_clicked(e, 'top')}>
|
|
203
|
+
|
|
204
|
+
{#if definition.title_readonly}
|
|
205
|
+
<p class=" text-lg font-semibold min-h-[1.75rem]
|
|
206
|
+
sm:text-sm sm:font-semibold sm:min-h-[1.25rem]
|
|
207
|
+
whitespace-nowrap overflow-clip w-full sm:flex-none sm:w-2/3"
|
|
208
|
+
id="__hd_list_ctrl_{item[item_key]}_Title">
|
|
243
209
|
{element_title}
|
|
244
|
-
</
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
<
|
|
210
|
+
</p>
|
|
211
|
+
{:else}
|
|
212
|
+
{#key item[title]} <!-- Wymusza pełne wyrenderowanie zwłasza po zmiane z pustego na tekst -->
|
|
213
|
+
<p class=" text-lg font-semibold min-h-[1.75rem]
|
|
214
|
+
sm:text-sm sm:font-semibold sm:min-h-[1.25rem]
|
|
215
|
+
whitespace-nowrap overflow-clip w-full sm:flex-none sm:w-2/3"
|
|
216
|
+
id="__hd_list_ctrl_{item[item_key]}_Title"
|
|
248
217
|
use:editable={(text) => {change_name(text)}}
|
|
249
218
|
on:click={edit}>
|
|
250
219
|
{element_title}
|
|
251
|
-
</span>
|
|
252
|
-
{/key}
|
|
253
|
-
{/if}
|
|
254
|
-
</p>
|
|
255
|
-
|
|
256
|
-
<!--div class="flex flex-row justify-between text-xs flex-none w-1/2 sm:w-2/3"-->
|
|
257
|
-
<div class="text-xs flex-none w-1/2 sm:w-2/3 grid-{definition.properties.length}">
|
|
258
|
-
{#each definition.properties as prop, prop_index}
|
|
259
|
-
<p class="col-span-1 w-full mr-auto mt-0.5">
|
|
260
|
-
{#if item[prop.a] || placeholder == prop.name}
|
|
261
|
-
<span role="gridcell" tabindex="0">
|
|
262
|
-
{#if prop.type == rList_property_type.Date}
|
|
263
|
-
<DatePicker self={item}
|
|
264
|
-
a={prop.a}
|
|
265
|
-
compact={true}
|
|
266
|
-
on_select={prop.on_select}
|
|
267
|
-
s="xs"
|
|
268
|
-
in_context="props sel"
|
|
269
|
-
bind:this={props[prop_index]}
|
|
270
|
-
changed={(value)=>{on_date_changed(value, prop.a)}}
|
|
271
|
-
/>
|
|
272
|
-
{:else if prop.type == rList_property_type.Combo}
|
|
273
|
-
<Combo self={item}
|
|
274
|
-
in_context="props sel"
|
|
275
|
-
compact={true}
|
|
276
|
-
a={prop.a}
|
|
277
|
-
on_select={prop.on_select}
|
|
278
|
-
is_association={prop.association}
|
|
279
|
-
icon={false}
|
|
280
|
-
bind:this={props[prop_index]}
|
|
281
|
-
definition={prop.combo_definition}
|
|
282
|
-
changed={(key,name)=>{on_combo_changed(key, name, prop)}}
|
|
283
|
-
s='xs'/>
|
|
284
|
-
{:else if prop.type == rList_property_type.Static}
|
|
285
|
-
<span class="dark:text-white text-gray-400 truncate px-2.5 bg-slate-900/10 dark:bg-slate-100/10 rounded-lg">
|
|
286
|
-
{item[prop.a]}
|
|
287
|
-
</span>
|
|
288
|
-
{/if}
|
|
289
|
-
</span>
|
|
290
|
-
{/if}
|
|
291
220
|
</p>
|
|
292
|
-
{/
|
|
293
|
-
|
|
221
|
+
{/key}
|
|
222
|
+
{/if}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<section class="hidden sm:block w-full sm:flex-none sm:w-1/3">
|
|
226
|
+
<Properties {definition} {item} {placeholder} bind:this={props_md}/>
|
|
227
|
+
</section>
|
|
294
228
|
</div>
|
|
295
229
|
|
|
296
230
|
{#if summary && (item[summary] || placeholder=='Summary')}
|
|
297
231
|
{@const element_id = `__hd_list_ctrl_${item[item_key]}_Summary`}
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
<span id={element_id} role="gridcell" tabindex="0"
|
|
308
|
-
use:editable={(text) => {change_summary(text)}}
|
|
309
|
-
on:click={edit}>
|
|
310
|
-
{item[summary]}
|
|
311
|
-
</span>
|
|
312
|
-
{:else if placeholder == 'Summary'}
|
|
313
|
-
<span id={element_id}
|
|
314
|
-
use:editable={(text) => {change_summary(text)}}>
|
|
315
|
-
</span>
|
|
316
|
-
{/if}
|
|
317
|
-
|
|
318
|
-
</p>
|
|
232
|
+
<Summary
|
|
233
|
+
id={element_id}
|
|
234
|
+
on:click={(e) => on_active_row_clicked(e, 'bottom')}
|
|
235
|
+
text={item[summary]}
|
|
236
|
+
readonly={definition.summary_readonly}
|
|
237
|
+
placeholder={placeholder == 'Summary'}
|
|
238
|
+
editable={(text) => {change_summary(text)}}
|
|
239
|
+
clickEdit={edit}
|
|
240
|
+
/>
|
|
319
241
|
{/if}
|
|
242
|
+
|
|
243
|
+
<section class="block sm:hidden w-full sm:flex-none sm:w-2/3">
|
|
244
|
+
<Properties {definition} {item} {placeholder} bind:this={props_sm}/>
|
|
245
|
+
</section>
|
|
246
|
+
|
|
320
247
|
</div>
|
|
321
248
|
</section>
|
|
322
249
|
{/if}
|
|
@@ -5,10 +5,10 @@ declare const __propDef: {
|
|
|
5
5
|
title?: string | undefined;
|
|
6
6
|
summary?: string | undefined;
|
|
7
7
|
typename?: string | undefined;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
toolbarOperations: any;
|
|
9
|
+
contextMenu: any;
|
|
10
10
|
activate?: (() => void) | undefined;
|
|
11
|
-
|
|
11
|
+
editProperty?: ((field: string) => void) | undefined;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -24,6 +24,6 @@ export type ListEvents = typeof __propDef.events;
|
|
|
24
24
|
export type ListSlots = typeof __propDef.slots;
|
|
25
25
|
export default class List extends SvelteComponentTyped<ListProps, ListEvents, ListSlots> {
|
|
26
26
|
get activate(): () => void;
|
|
27
|
-
get
|
|
27
|
+
get editProperty(): (field: string) => void;
|
|
28
28
|
}
|
|
29
29
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script>import { editable,
|
|
1
|
+
<script>import { editable, startEditing } from "../../../utils";
|
|
2
2
|
import Icon from "../../icon.svelte";
|
|
3
3
|
import { FaPlus } from "svelte-icons/fa";
|
|
4
|
-
export let
|
|
4
|
+
export let onInsert;
|
|
5
5
|
export let icon = false;
|
|
6
6
|
export function run(onclose) {
|
|
7
|
-
|
|
7
|
+
startEditing(insertion_paragraph, onclose);
|
|
8
8
|
}
|
|
9
9
|
let insertion_paragraph;
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
<section class="flex flex-row my-0 w-full text-lg sm:text-sm text-
|
|
12
|
+
<section class="mt-3 flex flex-row my-0 w-full text-lg sm:text-sm text-stone-700 dark:text-stone-400 cursor-default rounded-md border border-transparent bg-stone-200 dark:bg-stone-700">
|
|
13
13
|
{#if icon}
|
|
14
14
|
<!--Icon size={3}
|
|
15
15
|
component={FaPlus}
|
|
@@ -17,8 +17,11 @@ let insertion_paragraph;
|
|
|
17
17
|
<div class="h-5 w-5 sm:h-4 sm:w-4 mt-2 sm:mt-1.5 ml-2"></div>
|
|
18
18
|
{/if}
|
|
19
19
|
|
|
20
|
-
<p class="ml-3 py-1
|
|
20
|
+
<p class=" ml-3 py-1
|
|
21
|
+
text-lg font-semibold min-h-[1.75rem]
|
|
22
|
+
sm:text-sm sm:font-semibold sm:min-h-[1.25rem]
|
|
23
|
+
whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3" tabindex="0"
|
|
21
24
|
bind:this={insertion_paragraph}
|
|
22
|
-
use:editable={
|
|
25
|
+
use:editable={onInsert} >
|
|
23
26
|
</p>
|
|
24
27
|
</section>
|