@humandialog/forms.svelte 0.5.4 → 0.5.5
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 +5 -3
- package/components/combo/combo.svelte +1 -1
- package/components/document/rich.edit.svelte +30 -7
- package/components/document/rich.edit.svelte.d.ts +2 -2
- package/components/kanban/Kanban.d.ts +24 -4
- package/components/kanban/Kanban.js +60 -4
- package/components/kanban/internal/kanban.card.svelte +148 -70
- package/components/kanban/internal/kanban.card.svelte.d.ts +2 -5
- package/components/kanban/internal/kanban.column.svelte +116 -72
- package/components/kanban/internal/kanban.column.svelte.d.ts +9 -9
- package/components/kanban/internal/kanban.inserter.svelte +1 -1
- package/components/kanban/internal/kanban.move.menu.svelte +11 -8
- package/components/kanban/internal/kanban.move.menu.svelte.d.ts +3 -0
- package/components/kanban/internal/kanban.props.svelte +140 -0
- package/components/kanban/internal/kanban.props.svelte.d.ts +19 -0
- package/components/kanban/kanban.callbacks.svelte +2 -8
- package/components/kanban/kanban.callbacks.svelte.d.ts +1 -4
- package/components/kanban/kanban.column.svelte +8 -8
- package/components/kanban/kanban.column.svelte.d.ts +4 -4
- package/components/kanban/kanban.combo.svelte +36 -0
- package/components/kanban/kanban.combo.svelte.d.ts +24 -0
- package/components/kanban/kanban.date.svelte +30 -0
- package/components/kanban/kanban.date.svelte.d.ts +21 -0
- package/components/kanban/kanban.source.svelte +25 -0
- package/components/kanban/kanban.source.svelte.d.ts +23 -0
- package/components/kanban/kanban.static.svelte +28 -0
- package/components/kanban/kanban.static.svelte.d.ts +20 -0
- package/components/kanban/kanban.summary.svelte +4 -0
- package/components/kanban/kanban.summary.svelte.d.ts +2 -0
- package/components/kanban/kanban.svelte +390 -55
- package/components/kanban/kanban.svelte.d.ts +32 -12
- package/components/kanban/kanban.tags.svelte +34 -0
- package/components/kanban/kanban.tags.svelte.d.ts +23 -0
- package/components/kanban/kanban.title.svelte +2 -0
- package/components/kanban/kanban.title.svelte.d.ts +1 -0
- package/components/list/List.d.ts +8 -1
- package/components/list/List.js +9 -0
- package/components/list/internal/list.element.summary.svelte +21 -7
- package/components/list/internal/list.element.summary.svelte.d.ts +1 -0
- package/components/list/internal/list.element.svelte +16 -11
- package/components/list/list.svelte +1 -1
- package/components/sidebar/sidebar.group.svelte +41 -3
- package/components/sidebar/sidebar.group.svelte.d.ts +6 -0
- package/components/tag.svelte +40 -0
- package/components/tag.svelte.d.ts +19 -0
- package/components/tags.svelte +203 -0
- package/components/tags.svelte.d.ts +31 -0
- package/horizontal.toolbar.svelte +23 -4
- package/horizontal.toolbar.svelte.d.ts +2 -0
- package/index.d.ts +9 -2
- package/index.js +9 -2
- package/operations.svelte +52 -23
- package/package.json +9 -1
- package/page.svelte +3 -3
- package/page.svelte.d.ts +2 -2
- package/tenant.members.svelte +1 -1
- package/updates.d.ts +1 -0
- package/updates.js +16 -0
- package/utils.js +11 -1
- package/vertical.toolbar.svelte +31 -6
- package/vertical.toolbar.svelte.d.ts +2 -0
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
<script>import { getContext, afterUpdate, tick } from "svelte";
|
|
2
2
|
import { data_tick_store, contextItemsStore, contextTypesStore } from "../../../stores";
|
|
3
|
-
import { getActive, activateItem } from "../../../utils.js";
|
|
3
|
+
import { getActive, activateItem, editable, isActive, isSelected, selectable, startEditing } from "../../../utils.js";
|
|
4
4
|
import Card from "./kanban.card.svelte";
|
|
5
5
|
import { KanbanColumnTop, KanbanColumnBottom } from "../Kanban";
|
|
6
6
|
import Inserter from "./kanban.inserter.svelte";
|
|
7
|
-
import { FaPlus } from "svelte-icons/fa";
|
|
8
|
-
export let title = "";
|
|
9
|
-
export let width = "w-[240px]";
|
|
10
|
-
export let self = void 0;
|
|
11
|
-
export let a = "";
|
|
12
|
-
export let objects = void 0;
|
|
13
|
-
export let context = "";
|
|
14
|
-
export let key = "";
|
|
7
|
+
import { FaPlus, FaCheck } from "svelte-icons/fa";
|
|
15
8
|
export let currentColumnIdx;
|
|
16
|
-
export let
|
|
17
|
-
export let scrollViewToCard = void 0;
|
|
9
|
+
export let onInsert;
|
|
18
10
|
let column_element;
|
|
19
11
|
export function getHeight() {
|
|
20
12
|
return column_element.getBoundingClientRect().height;
|
|
21
13
|
}
|
|
14
|
+
let titleElement;
|
|
15
|
+
export function editName(onFinish = void 0) {
|
|
16
|
+
startEditing(titleElement, onFinish);
|
|
17
|
+
}
|
|
22
18
|
export const SET_LEFT = 0;
|
|
23
19
|
export const SET_RIGHT = 1;
|
|
24
20
|
export const CLEAR_LEFT = 2;
|
|
@@ -40,58 +36,70 @@ export function setBorder(what_to_do) {
|
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
let definition = getContext("rKanban-definition");
|
|
43
|
-
let
|
|
44
|
-
let
|
|
45
|
-
let
|
|
46
|
-
let last_tick = -1;
|
|
47
|
-
let item_key = "";
|
|
48
|
-
let width_class = width ? `w-11/12 sm:${width}` : "w-11/12 sm:w-[240px]";
|
|
39
|
+
let columnDef = definition.columns[currentColumnIdx];
|
|
40
|
+
let column_items = void 0;
|
|
41
|
+
let width_class = columnDef.width ? `w-11/12 sm:${columnDef.width}` : "w-11/12 sm:w-[240px]";
|
|
49
42
|
$:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
43
|
+
setup_data();
|
|
44
|
+
$:
|
|
45
|
+
is_row_active = calculate_active($contextItemsStore);
|
|
46
|
+
$:
|
|
47
|
+
is_row_selected = selected($contextItemsStore);
|
|
48
|
+
$:
|
|
49
|
+
selected_class = is_row_selected ? "!border-blue-300" : "";
|
|
50
|
+
$:
|
|
51
|
+
focused_class = is_row_active ? "bg-stone-50 dark:bg-stone-700" : "";
|
|
52
|
+
$:
|
|
53
|
+
force_rerender($data_tick_store, $contextItemsStore);
|
|
54
|
+
export function reload() {
|
|
55
|
+
let allItems = definition.getItems();
|
|
56
|
+
if (definition.stateAttrib)
|
|
57
|
+
column_items = allItems.filter((e) => e[definition.stateAttrib] == columnDef.state);
|
|
58
|
+
}
|
|
59
|
+
function setup_data(...args) {
|
|
60
|
+
reload();
|
|
61
|
+
}
|
|
62
|
+
function force_rerender(...args) {
|
|
63
|
+
column_items = [...column_items];
|
|
64
|
+
}
|
|
65
|
+
function calculate_active(...args) {
|
|
66
|
+
if (!!columnDef.operations)
|
|
67
|
+
return isActive("props", columnDef);
|
|
68
|
+
else
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
function selected(...args) {
|
|
72
|
+
if (!!columnDef.operations)
|
|
73
|
+
return isSelected(columnDef);
|
|
74
|
+
else
|
|
75
|
+
return false;
|
|
75
76
|
}
|
|
76
77
|
let cards = [];
|
|
77
|
-
export function findCardByItem(
|
|
78
|
+
export function findCardByItem(item) {
|
|
78
79
|
if (!cards)
|
|
79
80
|
return null;
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
return cards[
|
|
81
|
+
const itemIdx = column_items?.findIndex((i) => i == item);
|
|
82
|
+
if (itemIdx >= 0) {
|
|
83
|
+
return cards[itemIdx];
|
|
83
84
|
} else
|
|
84
85
|
return null;
|
|
85
86
|
}
|
|
87
|
+
export function activateByItemId(id) {
|
|
88
|
+
const itemIdx = column_items?.findIndex((e) => e.Id == id);
|
|
89
|
+
if (itemIdx >= 0) {
|
|
90
|
+
const card = cards[itemIdx];
|
|
91
|
+
card.activate();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
86
94
|
let inserter;
|
|
87
95
|
const None = 0;
|
|
88
|
-
let
|
|
96
|
+
let showInserterAfterId = None;
|
|
89
97
|
let activateAfterDomUpdate = null;
|
|
90
98
|
let lastActivatedElement = null;
|
|
91
99
|
export async function add(after = KanbanColumnTop) {
|
|
92
100
|
if (!definition.onAdd)
|
|
93
101
|
return;
|
|
94
|
-
|
|
102
|
+
showInserterAfterId = after.Id ?? KanbanColumnTop;
|
|
95
103
|
if (activateAfterDomUpdate)
|
|
96
104
|
activateAfterDomUpdate = null;
|
|
97
105
|
lastActivatedElement = getActive("props");
|
|
@@ -101,56 +109,92 @@ export async function add(after = KanbanColumnTop) {
|
|
|
101
109
|
if (!inserter)
|
|
102
110
|
return;
|
|
103
111
|
inserter.run(async (detail) => {
|
|
104
|
-
|
|
112
|
+
showInserterAfterId = None;
|
|
105
113
|
if (detail.cancel)
|
|
106
114
|
activateAfterDomUpdate = lastActivatedElement;
|
|
107
115
|
else {
|
|
108
116
|
if (detail.incremental) {
|
|
109
117
|
let currentActive = activateAfterDomUpdate ?? getActive("props");
|
|
110
|
-
|
|
118
|
+
if (currentActive)
|
|
119
|
+
await add(currentActive);
|
|
111
120
|
}
|
|
112
121
|
}
|
|
113
122
|
});
|
|
114
123
|
}
|
|
115
|
-
async function insert(title2, after) {
|
|
116
|
-
let newElement = await definition.onAdd(title2, currentColumnIdx, after);
|
|
117
|
-
if (!newElement)
|
|
118
|
-
return;
|
|
119
|
-
activateAfterDomUpdate = newElement;
|
|
120
|
-
}
|
|
121
124
|
afterUpdate(() => {
|
|
122
125
|
if (activateAfterDomUpdate) {
|
|
123
|
-
let activateAfterDomUpdateIdx =
|
|
126
|
+
let activateAfterDomUpdateIdx = column_items.findIndex((e) => e == activateAfterDomUpdate);
|
|
124
127
|
activateAfterDomUpdate = null;
|
|
125
128
|
if (activateAfterDomUpdateIdx >= 0) {
|
|
126
129
|
cards[activateAfterDomUpdateIdx].activate();
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
});
|
|
133
|
+
function getItemKey(item) {
|
|
134
|
+
if (definition.key)
|
|
135
|
+
return item[definition.key];
|
|
136
|
+
else if (item.Id)
|
|
137
|
+
return item.Id;
|
|
138
|
+
else if (item.$ref)
|
|
139
|
+
return item.$ref;
|
|
140
|
+
else
|
|
141
|
+
return 0;
|
|
142
|
+
}
|
|
143
|
+
function onTitleChanged(text) {
|
|
144
|
+
if (columnDef.onTitleChanged)
|
|
145
|
+
columnDef.onTitleChanged(text);
|
|
146
|
+
}
|
|
147
|
+
let rootElement;
|
|
148
|
+
export function activate(e) {
|
|
149
|
+
if (e)
|
|
150
|
+
e.stopPropagation();
|
|
151
|
+
if (!columnDef.operations)
|
|
152
|
+
return;
|
|
153
|
+
if (isActive("props", columnDef)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
activateItem("props", columnDef, columnDef.operations);
|
|
157
|
+
rootElement?.scrollIntoView();
|
|
158
|
+
}
|
|
130
159
|
</script>
|
|
131
160
|
|
|
161
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
132
162
|
|
|
133
|
-
<section class="flex-none sm:flex-1 sm:min-w-[180px] sm:max-w-[240px] {width_class}"
|
|
134
|
-
|
|
135
|
-
|
|
163
|
+
<section class="snap-center sm:snap-align-none flex-none sm:flex-1 sm:min-w-[180px] sm:max-w-[240px] rounded-md border border-transparent {width_class} {selected_class} {focused_class}"
|
|
164
|
+
bind:this={rootElement}>
|
|
165
|
+
<header class:cursor-pointer={!is_row_active && columnDef.operations}
|
|
166
|
+
use:selectable={columnDef}
|
|
167
|
+
on:click={activate}>
|
|
168
|
+
<h2 class="mt-2 mb-2 text-lg sm:text-xs uppercase w-full min-h-[1rem] text-center whitespace-nowrap relative">
|
|
169
|
+
<span
|
|
170
|
+
use:editable={{
|
|
171
|
+
action: (text) => onTitleChanged(text),
|
|
172
|
+
active: false
|
|
173
|
+
}}
|
|
174
|
+
bind:this={titleElement}>
|
|
175
|
+
{columnDef.title}
|
|
176
|
+
</span>
|
|
177
|
+
|
|
178
|
+
{#if columnDef.finishing}
|
|
179
|
+
<div class="inline-block text-green-600 h-3 w-3 ml-2">
|
|
180
|
+
<FaCheck/>
|
|
181
|
+
</div>
|
|
182
|
+
{/if}
|
|
136
183
|
<button class="absolute right-2 w-4 sm:w-2.5"
|
|
137
|
-
on:click={(e) => add(KanbanColumnTop)}>
|
|
184
|
+
on:click|stopPropagation={(e) => add(KanbanColumnTop)}>
|
|
138
185
|
<FaPlus/>
|
|
139
186
|
</button>
|
|
140
187
|
</h2>
|
|
141
188
|
</header>
|
|
142
189
|
<ul class="w-full border-stone-700" bind:this={column_element}>
|
|
143
|
-
{#if
|
|
144
|
-
<Inserter onInsert={async (text) => {await
|
|
190
|
+
{#if showInserterAfterId === KanbanColumnTop}
|
|
191
|
+
<Inserter onInsert={async (text) => {await onInsert(currentColumnIdx, text, KanbanColumnTop)}}
|
|
145
192
|
bind:this={inserter} />
|
|
146
193
|
{/if}
|
|
147
194
|
|
|
148
|
-
{#if
|
|
149
|
-
{#each
|
|
195
|
+
{#if column_items && column_items.length > 0}
|
|
196
|
+
{#each column_items as element, item_idx (getItemKey(element))}
|
|
150
197
|
<Card item={element}
|
|
151
|
-
{showMoveOperationsForItem}
|
|
152
|
-
{scrollViewToCard}
|
|
153
|
-
runInserter={add}
|
|
154
198
|
bind:this={cards[item_idx]}>
|
|
155
199
|
<svelte:fragment slot="kanbanCardTopProps" let:element>
|
|
156
200
|
<slot name="kanbanCardTopProps" {element}/>
|
|
@@ -165,15 +209,15 @@ afterUpdate(() => {
|
|
|
165
209
|
</svelte:fragment>
|
|
166
210
|
</Card>
|
|
167
211
|
|
|
168
|
-
{#if
|
|
169
|
-
<Inserter onInsert={async (text) => {await
|
|
212
|
+
{#if showInserterAfterId == element.Id}
|
|
213
|
+
<Inserter onInsert={async (text) => {await onInsert(currentColumnIdx, text, showInserterAfterId)}}
|
|
170
214
|
bind:this={inserter} />
|
|
171
215
|
{/if}
|
|
172
216
|
{/each}
|
|
173
217
|
{/if}
|
|
174
218
|
|
|
175
|
-
{#if
|
|
176
|
-
<Inserter onInsert={async (text) => {await
|
|
219
|
+
{#if showInserterAfterId === KanbanColumnBottom}
|
|
220
|
+
<Inserter onInsert={async (text) => {await onInsert(currentColumnIdx, text, KanbanColumnBottom)}}
|
|
177
221
|
bind:this={inserter} />
|
|
178
222
|
{/if}
|
|
179
223
|
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
title?: string | undefined;
|
|
5
|
-
width?: string | undefined;
|
|
6
|
-
self?: object | undefined;
|
|
7
|
-
a?: string | undefined;
|
|
8
|
-
objects?: object[] | undefined;
|
|
9
|
-
context?: string | undefined;
|
|
10
|
-
key?: string | undefined;
|
|
11
4
|
currentColumnIdx: number;
|
|
12
|
-
|
|
13
|
-
scrollViewToCard?: Function | undefined;
|
|
5
|
+
onInsert: Function;
|
|
14
6
|
getHeight?: (() => number) | undefined;
|
|
7
|
+
editName?: ((onFinish?: Function | undefined) => void) | undefined;
|
|
15
8
|
SET_LEFT?: 0 | undefined;
|
|
16
9
|
SET_RIGHT?: 1 | undefined;
|
|
17
10
|
CLEAR_LEFT?: 2 | undefined;
|
|
18
11
|
CLEAR_RIGHT?: 3 | undefined;
|
|
19
12
|
setBorder?: ((what_to_do: number) => void) | undefined;
|
|
13
|
+
reload?: (() => void) | undefined;
|
|
20
14
|
findCardByItem?: ((item: object) => any) | undefined;
|
|
15
|
+
activateByItemId?: ((id: number) => void) | undefined;
|
|
21
16
|
add?: ((after?: object | number) => Promise<void>) | undefined;
|
|
17
|
+
activate?: ((e: any) => void) | undefined;
|
|
22
18
|
};
|
|
23
19
|
events: {
|
|
24
20
|
[evt: string]: CustomEvent<any>;
|
|
@@ -40,12 +36,16 @@ export type KanbanEvents = typeof __propDef.events;
|
|
|
40
36
|
export type KanbanSlots = typeof __propDef.slots;
|
|
41
37
|
export default class Kanban extends SvelteComponentTyped<KanbanProps, KanbanEvents, KanbanSlots> {
|
|
42
38
|
get getHeight(): () => number;
|
|
39
|
+
get editName(): (onFinish?: Function | undefined) => void;
|
|
43
40
|
get SET_LEFT(): 0;
|
|
44
41
|
get SET_RIGHT(): 1;
|
|
45
42
|
get CLEAR_LEFT(): 2;
|
|
46
43
|
get CLEAR_RIGHT(): 3;
|
|
47
44
|
get setBorder(): (what_to_do: number) => void;
|
|
45
|
+
get reload(): () => void;
|
|
48
46
|
get findCardByItem(): (item: object) => any;
|
|
47
|
+
get activateByItemId(): (id: number) => void;
|
|
49
48
|
get add(): (after?: number | object) => Promise<void>;
|
|
49
|
+
get activate(): (e: any) => void;
|
|
50
50
|
}
|
|
51
51
|
export {};
|
|
@@ -16,7 +16,7 @@ let insertion_paragraph;
|
|
|
16
16
|
|
|
17
17
|
<h3 class=" text-lg font-semibold min-h-[1.75rem]
|
|
18
18
|
sm:text-sm sm:font-semibold sm:min-h-[1.25rem]
|
|
19
|
-
whitespace-nowrap overflow-clip w-full sm:flex-none
|
|
19
|
+
whitespace-nowrap overflow-clip w-full sm:flex-none "
|
|
20
20
|
use:editable={onInsert}
|
|
21
21
|
bind:this={insertion_paragraph}>
|
|
22
22
|
|
|
@@ -3,6 +3,9 @@ import { KanbanColumnTop, KanbanColumnBottom, rKanban_definition } from "../Kanb
|
|
|
3
3
|
export let definition;
|
|
4
4
|
export let item;
|
|
5
5
|
export let afterActionOperation = void 0;
|
|
6
|
+
export let onMoveUp;
|
|
7
|
+
export let onMoveDown;
|
|
8
|
+
export let onReplace;
|
|
6
9
|
function replaceMenu() {
|
|
7
10
|
if (afterActionOperation)
|
|
8
11
|
setTimeout(() => {
|
|
@@ -21,7 +24,7 @@ function replaceMenu() {
|
|
|
21
24
|
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
|
|
22
25
|
border rounded border-stone-200 dark:border-stone-600 focus:outline-none
|
|
23
26
|
inline-flex items-center justify-center"
|
|
24
|
-
on:click={(e) => {
|
|
27
|
+
on:click={(e) => { onMoveUp(item); replaceMenu()}}>
|
|
25
28
|
<div class="w-3 h-3"><FaAngleUp/></div>
|
|
26
29
|
</button>
|
|
27
30
|
|
|
@@ -30,7 +33,7 @@ function replaceMenu() {
|
|
|
30
33
|
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
|
|
31
34
|
border rounded border-stone-200 dark:border-stone-600 focus:outline-none
|
|
32
35
|
inline-flex items-center justify-center"
|
|
33
|
-
on:click={(e) => {
|
|
36
|
+
on:click={(e) => { onMoveDown(item); replaceMenu()}}>
|
|
34
37
|
<div class="w-3 h-3"><FaAngleDown/></div>
|
|
35
38
|
</button>
|
|
36
39
|
</section>
|
|
@@ -44,7 +47,7 @@ function replaceMenu() {
|
|
|
44
47
|
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
|
|
45
48
|
border rounded border-stone-200 dark:border-stone-600 focus:outline-none
|
|
46
49
|
inline-flex items-center justify-center"
|
|
47
|
-
on:click={(e) => {
|
|
50
|
+
on:click={(e) => { onReplace(item, idx, KanbanColumnTop); replaceMenu()}}>
|
|
48
51
|
<div class="w-3 h-3"><FaAngleDoubleUp/></div>
|
|
49
52
|
</button>
|
|
50
53
|
|
|
@@ -53,7 +56,7 @@ function replaceMenu() {
|
|
|
53
56
|
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
|
|
54
57
|
border rounded border-stone-200 dark:border-stone-600 focus:outline-none
|
|
55
58
|
inline-flex items-center justify-center"
|
|
56
|
-
on:click={(e) => {
|
|
59
|
+
on:click={(e) => { onReplace(item, idx, KanbanColumnBottom); replaceMenu()}}>
|
|
57
60
|
<div class="w-3 h-3"><FaAngleDoubleDown/></div>
|
|
58
61
|
</button>
|
|
59
62
|
</section>
|
|
@@ -70,7 +73,7 @@ function replaceMenu() {
|
|
|
70
73
|
m-0
|
|
71
74
|
flex items-center justify-center
|
|
72
75
|
disable-dbl-tap-zoom"
|
|
73
|
-
on:click={(e) => {
|
|
76
|
+
on:click={(e) => { onMoveUp(item); replaceMenu()}}>
|
|
74
77
|
<div class=" w-10 h-10
|
|
75
78
|
text-white bg-zinc-500 hover:bg-zinc-500
|
|
76
79
|
font-medium rounded-full text-sm text-center shadow-md
|
|
@@ -87,7 +90,7 @@ function replaceMenu() {
|
|
|
87
90
|
m-0
|
|
88
91
|
flex items-center justify-center
|
|
89
92
|
disable-dbl-tap-zoom"
|
|
90
|
-
on:click={(e) => {
|
|
93
|
+
on:click={(e) => { onMoveDown(item); replaceMenu()}}>
|
|
91
94
|
<div class=" w-10 h-10
|
|
92
95
|
text-white bg-zinc-500 hover:bg-zinc-500
|
|
93
96
|
font-medium rounded-full text-sm text-center shadow-md
|
|
@@ -111,7 +114,7 @@ function replaceMenu() {
|
|
|
111
114
|
m-0
|
|
112
115
|
flex items-center justify-center
|
|
113
116
|
disable-dbl-tap-zoom"
|
|
114
|
-
on:click={(e) => {
|
|
117
|
+
on:click={(e) => { onReplace(item, idx, KanbanColumnTop); replaceMenu()}}>
|
|
115
118
|
<div class=" w-10 h-10
|
|
116
119
|
text-white bg-zinc-500 hover:bg-zinc-500
|
|
117
120
|
font-medium rounded-full text-sm text-center shadow-md
|
|
@@ -128,7 +131,7 @@ function replaceMenu() {
|
|
|
128
131
|
m-0
|
|
129
132
|
flex items-center justify-center
|
|
130
133
|
disable-dbl-tap-zoom"
|
|
131
|
-
on:click={(e) => {
|
|
134
|
+
on:click={(e) => { onReplace(item, idx, KanbanColumnBottom); replaceMenu()}}>
|
|
132
135
|
<div class=" w-10 h-10
|
|
133
136
|
text-white bg-zinc-500 hover:bg-zinc-500
|
|
134
137
|
font-medium rounded-full text-sm text-center shadow-md
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script>import { getContext, tick } from "svelte";
|
|
2
|
+
import { rList_property_type } from "../../list/List";
|
|
3
|
+
import Combo from "../../combo/combo.svelte";
|
|
4
|
+
import DatePicker from "../../date.svelte";
|
|
5
|
+
import Tags from "../../tags.svelte";
|
|
6
|
+
export let position;
|
|
7
|
+
export let item;
|
|
8
|
+
let definition = getContext("rKanban-definition");
|
|
9
|
+
let properties = definition.properties.filter((p) => p.position == position);
|
|
10
|
+
let propElements = [];
|
|
11
|
+
let placeholder = "";
|
|
12
|
+
export function editProperty(field) {
|
|
13
|
+
let propIdx = properties.findIndex((p) => p.name == field);
|
|
14
|
+
if (propIdx < 0)
|
|
15
|
+
return;
|
|
16
|
+
let property = properties[propIdx];
|
|
17
|
+
switch (property.type) {
|
|
18
|
+
case rList_property_type.Date:
|
|
19
|
+
editDate(field, propIdx);
|
|
20
|
+
break;
|
|
21
|
+
case rList_property_type.Combo:
|
|
22
|
+
editCombo(field, propIdx);
|
|
23
|
+
break;
|
|
24
|
+
case rList_property_type.Tags:
|
|
25
|
+
editTags(field, propIdx);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function on_date_changed(value, a) {
|
|
30
|
+
if (!value)
|
|
31
|
+
item[a] = "";
|
|
32
|
+
else
|
|
33
|
+
item[a] = value.toJSON();
|
|
34
|
+
}
|
|
35
|
+
function on_combo_changed(key, name, prop) {
|
|
36
|
+
if (prop.association) {
|
|
37
|
+
let iname = prop.combo_definition.element_name ?? "$display";
|
|
38
|
+
item[prop.a] = {
|
|
39
|
+
$ref: key,
|
|
40
|
+
[iname]: name
|
|
41
|
+
};
|
|
42
|
+
} else {
|
|
43
|
+
let value = key ?? name;
|
|
44
|
+
item[prop.a] = value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function editCombo(field, propIdx) {
|
|
48
|
+
let combo = propElements[propIdx];
|
|
49
|
+
if (!!combo)
|
|
50
|
+
combo.show();
|
|
51
|
+
else {
|
|
52
|
+
placeholder = field;
|
|
53
|
+
await tick();
|
|
54
|
+
combo = propElements[propIdx];
|
|
55
|
+
if (!!combo)
|
|
56
|
+
combo.show(void 0, () => {
|
|
57
|
+
placeholder = "";
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function editDate(field, propIdx) {
|
|
62
|
+
let combo = propElements[propIdx];
|
|
63
|
+
if (!!combo)
|
|
64
|
+
combo.show();
|
|
65
|
+
else {
|
|
66
|
+
placeholder = field;
|
|
67
|
+
await tick();
|
|
68
|
+
combo = propElements[propIdx];
|
|
69
|
+
if (!!combo)
|
|
70
|
+
combo.show(void 0, () => {
|
|
71
|
+
placeholder = "";
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function editTags(field, propIdx) {
|
|
76
|
+
let tags = propElements[propIdx];
|
|
77
|
+
if (!!tags)
|
|
78
|
+
tags.show();
|
|
79
|
+
else {
|
|
80
|
+
placeholder = field;
|
|
81
|
+
await tick();
|
|
82
|
+
tags = propElements[propIdx];
|
|
83
|
+
if (!!tags)
|
|
84
|
+
tags.show(void 0, () => {
|
|
85
|
+
placeholder = "";
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<section class="flex flex-row justify-between">
|
|
92
|
+
{#each properties as prop, idx}
|
|
93
|
+
{#if item[prop.a] || placeholder==prop.name}
|
|
94
|
+
{#if prop.type == rList_property_type.Date}
|
|
95
|
+
<DatePicker
|
|
96
|
+
self={item}
|
|
97
|
+
a={prop.a}
|
|
98
|
+
compact={true}
|
|
99
|
+
s="xs"
|
|
100
|
+
inContext="props"
|
|
101
|
+
bind:this={propElements[idx]}/>
|
|
102
|
+
{:else if prop.type == rList_property_type.Combo}
|
|
103
|
+
<Combo
|
|
104
|
+
compact={true}
|
|
105
|
+
inContext="props"
|
|
106
|
+
self={item}
|
|
107
|
+
a={prop.a}
|
|
108
|
+
onSelect={prop.onSelect}
|
|
109
|
+
isAssociation={prop.association}
|
|
110
|
+
icon={false}
|
|
111
|
+
definition={prop.combo_definition}
|
|
112
|
+
s="xs"
|
|
113
|
+
bind:this={propElements[idx]}/>
|
|
114
|
+
{:else if prop.type == rList_property_type.Static}
|
|
115
|
+
<p
|
|
116
|
+
class=" h-6
|
|
117
|
+
sm:text-xs sm:min-h-[1rem]
|
|
118
|
+
text-base min-h-[1.5rem]
|
|
119
|
+
text-stone-400
|
|
120
|
+
text-right"
|
|
121
|
+
bind:this={propElements[idx]}>
|
|
122
|
+
{item[prop.a]}
|
|
123
|
+
</p>
|
|
124
|
+
{:else if prop.type == rList_property_type.Tags}
|
|
125
|
+
<Tags
|
|
126
|
+
class="mt-2"
|
|
127
|
+
compact
|
|
128
|
+
inContext="props"
|
|
129
|
+
self={item}
|
|
130
|
+
a={prop.a}
|
|
131
|
+
globalTags={prop.allTags}
|
|
132
|
+
s="xs"
|
|
133
|
+
onSelect={prop.onSelect}
|
|
134
|
+
onCreate={prop.onCreate}
|
|
135
|
+
bind:this={propElements[idx]}
|
|
136
|
+
/>
|
|
137
|
+
{/if}
|
|
138
|
+
{/if}
|
|
139
|
+
{/each}
|
|
140
|
+
</section>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
position: number;
|
|
5
|
+
item: object;
|
|
6
|
+
editProperty?: ((field: string) => void) | undefined;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type KanbanProps = typeof __propDef.props;
|
|
14
|
+
export type KanbanEvents = typeof __propDef.events;
|
|
15
|
+
export type KanbanSlots = typeof __propDef.slots;
|
|
16
|
+
export default class Kanban extends SvelteComponentTyped<KanbanProps, KanbanEvents, KanbanSlots> {
|
|
17
|
+
get editProperty(): (field: string) => void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
<script>import { getContext } from "svelte";
|
|
2
|
-
export let onUp = void 0;
|
|
3
|
-
export let onDown = void 0;
|
|
4
2
|
export let onAdd = void 0;
|
|
5
|
-
export let onRemove = void 0;
|
|
6
|
-
export let onReplace = void 0;
|
|
7
3
|
export let onOpen = void 0;
|
|
4
|
+
export let getCardOperations = void 0;
|
|
8
5
|
let definition = getContext("rKanban-definition");
|
|
9
|
-
definition.onUp = onUp;
|
|
10
|
-
definition.onDown = onDown;
|
|
11
6
|
definition.onAdd = onAdd;
|
|
12
|
-
definition.onRemove = onRemove;
|
|
13
|
-
definition.onReplace = onReplace;
|
|
14
7
|
definition.onOpen = onOpen;
|
|
8
|
+
definition.getCardOperations = getCardOperations;
|
|
15
9
|
</script>
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
onUp?: Function | undefined;
|
|
5
|
-
onDown?: Function | undefined;
|
|
6
4
|
onAdd?: Function | undefined;
|
|
7
|
-
onRemove?: Function | undefined;
|
|
8
|
-
onReplace?: Function | undefined;
|
|
9
5
|
onOpen?: Function | undefined;
|
|
6
|
+
getCardOperations?: Function | undefined;
|
|
10
7
|
};
|
|
11
8
|
events: {
|
|
12
9
|
[evt: string]: CustomEvent<any>;
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
import { rKanban_column } from "./Kanban";
|
|
3
3
|
export let title = "";
|
|
4
4
|
export let width = "w-[240px]";
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
5
|
+
export let state = "";
|
|
6
|
+
export let finishing = false;
|
|
7
|
+
export let operations = void 0;
|
|
8
|
+
export let onTitleChanged = void 0;
|
|
9
9
|
let definition = getContext("rKanban-definition");
|
|
10
10
|
let column = new rKanban_column();
|
|
11
11
|
column.id = definition.columns.length + 1;
|
|
12
12
|
column.title = title;
|
|
13
13
|
column.width = width;
|
|
14
|
-
column.
|
|
15
|
-
column.
|
|
16
|
-
column.
|
|
17
|
-
column.
|
|
14
|
+
column.state = state;
|
|
15
|
+
column.finishing = finishing;
|
|
16
|
+
column.operations = operations;
|
|
17
|
+
column.onTitleChanged = onTitleChanged;
|
|
18
18
|
definition.columns.push(column);
|
|
19
19
|
</script>
|
|
20
20
|
|
|
@@ -3,10 +3,10 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
title?: string | undefined;
|
|
5
5
|
width?: string | undefined;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
state?: any;
|
|
7
|
+
finishing?: boolean | undefined;
|
|
8
|
+
operations?: object[] | undefined;
|
|
9
|
+
onTitleChanged?: Function | undefined;
|
|
10
10
|
};
|
|
11
11
|
events: {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|