@humandialog/forms.svelte 1.7.9 → 1.7.11
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 +1 -1
- package/components/Grid.menu.svelte +1 -1
- package/components/contextmenu.svelte +2 -2
- package/components/document/editor.svelte +21 -5
- package/components/document/editor.svelte.d.ts +6 -0
- package/components/kanban/internal/kanban.card.svelte +4 -2
- package/components/kanban/internal/kanban.inserter.svelte +2 -1
- package/components/kanban/internal/kanban.props.svelte +5 -4
- package/components/list/List.d.ts +1 -0
- package/components/list/List.js +1 -0
- package/components/list/list.inserter.svelte +2 -0
- package/components/list/list.inserter.svelte.d.ts +1 -0
- package/components/list/list.svelte +1 -1
- package/operations.svelte +25 -6
- package/package.json +1 -1
package/components/Fab.svelte
CHANGED
|
@@ -164,7 +164,7 @@ function on_click(e, operation) {
|
|
|
164
164
|
else if (operation.toolbar)
|
|
165
165
|
showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
|
|
166
166
|
else if (operation.grid) {
|
|
167
|
-
if (
|
|
167
|
+
if (false)
|
|
168
168
|
showMenu(rect, operation.grid);
|
|
169
169
|
else
|
|
170
170
|
showGridMenu(rect, operation.grid);
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
{@const col=col_span(operation.columns ?? 1)}
|
|
122
122
|
|
|
123
123
|
<button class=" py-2.5 px-5 {col}
|
|
124
|
-
text-
|
|
124
|
+
text-sm font-medium text-stone-900 dark:text-stone-400 dark:hover:text-white
|
|
125
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
126
|
border rounded border-stone-200 dark:border-stone-600 focus:outline-none
|
|
127
127
|
inline-flex items-center justify-center"
|
|
@@ -27,7 +27,7 @@ let menu_items = [];
|
|
|
27
27
|
let submenus = [];
|
|
28
28
|
let around_rect;
|
|
29
29
|
let around_preference = 0;
|
|
30
|
-
let css_position = "";
|
|
30
|
+
let css_position = "display: none";
|
|
31
31
|
let closeButtonPos = "";
|
|
32
32
|
$:
|
|
33
33
|
display = visible ? "block" : "none";
|
|
@@ -308,7 +308,7 @@ function execute_action(e, operation, index) {
|
|
|
308
308
|
if (operation.toolbar)
|
|
309
309
|
showFloatingToolbar(rect, operation.toolbar, operation.props ?? {});
|
|
310
310
|
else if (operation.grid) {
|
|
311
|
-
if (
|
|
311
|
+
if (false)
|
|
312
312
|
showMenu(rect, operation.grid);
|
|
313
313
|
else
|
|
314
314
|
showGridMenu(rect, operation.grid);
|
|
@@ -864,7 +864,7 @@ export function removeTemporaryImage(temporarySrc) {
|
|
|
864
864
|
editor.commands.deleteRange(image.range);
|
|
865
865
|
}
|
|
866
866
|
export function addLink(title, href) {
|
|
867
|
-
editor.chain().setLink({ href }).insertContent(title).unsetMark("link").insertContent(" ").focus().run();
|
|
867
|
+
editor.chain().insertContent(" ").setLink({ href }).insertContent(title).unsetMark("link").insertContent(" ").focus().run();
|
|
868
868
|
}
|
|
869
869
|
export function getInnerHtml() {
|
|
870
870
|
return editor.getHTML();
|
|
@@ -1045,6 +1045,12 @@ export function preventBlur() {
|
|
|
1045
1045
|
export function hasChanged() {
|
|
1046
1046
|
return hasChangedValue;
|
|
1047
1047
|
}
|
|
1048
|
+
export function getCurrentCursorPos() {
|
|
1049
|
+
return editor.state.selection.$anchor.pos;
|
|
1050
|
+
}
|
|
1051
|
+
export function setCursorPos(num) {
|
|
1052
|
+
editor.commands.focus(num);
|
|
1053
|
+
}
|
|
1048
1054
|
const paletteMarksCommands = () => [
|
|
1049
1055
|
{ caption: i18n({ en: "Bold", es: "Negrita", pl: "Pogrubiony" }), description: "Marks text as bolded", tags: "strong,bold", icon: FaBold, on_choice: makeBold, is_active: () => editor?.isActive("bold") },
|
|
1050
1056
|
{ caption: i18n({ en: "Italic", es: "Cursiva", pl: "Kursywa" }), description: "Marks text as italic", tags: "italic,em", icon: FaItalic, on_choice: makeItalic, is_active: () => editor?.isActive("italic") },
|
|
@@ -1181,8 +1187,11 @@ function getPaletteCommands() {
|
|
|
1181
1187
|
on_choice: (range) => {
|
|
1182
1188
|
if (range)
|
|
1183
1189
|
editor.chain().focus().deleteRange(range).run();
|
|
1190
|
+
let stayFocused = false;
|
|
1184
1191
|
if (exc.action)
|
|
1185
|
-
exc.action();
|
|
1192
|
+
stayFocused = exc.action();
|
|
1193
|
+
if (!stayFocused)
|
|
1194
|
+
editor.commands.blur();
|
|
1186
1195
|
},
|
|
1187
1196
|
is_active: () => {
|
|
1188
1197
|
if (exc.is_active)
|
|
@@ -1209,8 +1218,11 @@ function getPaletteCommands() {
|
|
|
1209
1218
|
on_choice: (range) => {
|
|
1210
1219
|
if (range)
|
|
1211
1220
|
editor.chain().focus().deleteRange(range).run();
|
|
1221
|
+
let stayFocused = false;
|
|
1212
1222
|
if (exc.action)
|
|
1213
|
-
exc.action();
|
|
1223
|
+
stayFocused = exc.action();
|
|
1224
|
+
if (!stayFocused)
|
|
1225
|
+
editor.commands.blur();
|
|
1214
1226
|
},
|
|
1215
1227
|
is_active: () => {
|
|
1216
1228
|
if (exc.is_active)
|
|
@@ -1233,8 +1245,11 @@ function getPaletteCommands() {
|
|
|
1233
1245
|
on_choice: (range) => {
|
|
1234
1246
|
if (range)
|
|
1235
1247
|
editor.chain().focus().deleteRange(range).run();
|
|
1248
|
+
let stayFocused = false;
|
|
1236
1249
|
if (exc.action)
|
|
1237
|
-
exc.action();
|
|
1250
|
+
stayFocused = exc.action();
|
|
1251
|
+
if (!stayFocused)
|
|
1252
|
+
editor.commands.blur();
|
|
1238
1253
|
},
|
|
1239
1254
|
is_active: () => {
|
|
1240
1255
|
if (exc.is_active)
|
|
@@ -1251,7 +1266,8 @@ function getPaletteCommands() {
|
|
|
1251
1266
|
|
|
1252
1267
|
|
|
1253
1268
|
|
|
1254
|
-
<div
|
|
1269
|
+
<div on:click
|
|
1270
|
+
bind:this={editorElement} />
|
|
1255
1271
|
|
|
1256
1272
|
<Palette commands={getPaletteCommands()}
|
|
1257
1273
|
bind:this={palette}
|
|
@@ -88,8 +88,12 @@ declare const __propDef: {
|
|
|
88
88
|
isActiveHorizontalRule?: (() => boolean) | undefined;
|
|
89
89
|
preventBlur?: (() => void) | undefined;
|
|
90
90
|
hasChanged?: (() => boolean) | undefined;
|
|
91
|
+
getCurrentCursorPos?: (() => any) | undefined;
|
|
92
|
+
setCursorPos?: ((num: any) => void) | undefined;
|
|
91
93
|
};
|
|
92
94
|
events: {
|
|
95
|
+
click: MouseEvent;
|
|
96
|
+
} & {
|
|
93
97
|
[evt: string]: CustomEvent<any>;
|
|
94
98
|
};
|
|
95
99
|
slots: {};
|
|
@@ -163,5 +167,7 @@ export default class Editor extends SvelteComponentTyped<EditorProps, EditorEven
|
|
|
163
167
|
get isActiveHorizontalRule(): () => boolean;
|
|
164
168
|
get preventBlur(): () => void;
|
|
165
169
|
get hasChanged(): () => boolean;
|
|
170
|
+
get getCurrentCursorPos(): () => any;
|
|
171
|
+
get setCursorPos(): (num: any) => void;
|
|
166
172
|
}
|
|
167
173
|
export {};
|
|
@@ -210,8 +210,9 @@ function showAttachementIcon() {
|
|
|
210
210
|
{@const canOpen = isLinkLike || hasOpen}
|
|
211
211
|
{@const openableClass = canOpen ? "sm:hover:cursor-pointer underline" : ""}
|
|
212
212
|
{@const showIcon = showAttachementIcon()}
|
|
213
|
+
<!-- whitespace-nowrap overflow-clip -->
|
|
213
214
|
<h3 class=" h3 text-base font-semibold pb-1
|
|
214
|
-
|
|
215
|
+
w-full sm:flex-none
|
|
215
216
|
relative {openableClass}"
|
|
216
217
|
use:editable={{
|
|
217
218
|
action: (text) => onTitleChanged(text),
|
|
@@ -246,9 +247,10 @@ function showAttachementIcon() {
|
|
|
246
247
|
|
|
247
248
|
|
|
248
249
|
{:else}
|
|
250
|
+
<!-- whitespace-nowrap overflow-clip -->
|
|
249
251
|
<h3 class=" text-base font-semibold pb-1
|
|
250
252
|
sm:text-base sm:font-semibold
|
|
251
|
-
|
|
253
|
+
w-full sm:flex-none
|
|
252
254
|
relative">
|
|
253
255
|
{item[definition.titleAttrib]}
|
|
254
256
|
|
|
@@ -31,9 +31,10 @@ async function onSummaryChanged(text) {
|
|
|
31
31
|
<li class=" mx-2 pt-2 pb-4 px-1 rounded-md border border-transparent
|
|
32
32
|
bg-stone-100 dark:bg-stone-700">
|
|
33
33
|
|
|
34
|
+
<!-- whitespace-nowrap overflow-clip -->
|
|
34
35
|
<h3 class=" text-base font-semibold min-h-[1.75rem]
|
|
35
36
|
sm:min-h-[1.25rem]
|
|
36
|
-
|
|
37
|
+
w-full sm:flex-none "
|
|
37
38
|
use:editable={{
|
|
38
39
|
action: (text) => onInsert(text, ''),
|
|
39
40
|
active: false,
|
|
@@ -90,8 +90,9 @@ async function editTags(field, propIdx) {
|
|
|
90
90
|
|
|
91
91
|
<section class="flex flex-row justify-between">
|
|
92
92
|
{#each properties as prop, idx}
|
|
93
|
-
{#if
|
|
94
|
-
{
|
|
93
|
+
{#if true}
|
|
94
|
+
{@const notEmpty = item[prop.a] || placeholder==prop.name}
|
|
95
|
+
{#if prop.type == rList_property_type.Date && notEmpty}
|
|
95
96
|
<DatePicker
|
|
96
97
|
self={item}
|
|
97
98
|
a={prop.a}
|
|
@@ -99,7 +100,7 @@ async function editTags(field, propIdx) {
|
|
|
99
100
|
s="sm"
|
|
100
101
|
inContext="props"
|
|
101
102
|
bind:this={propElements[idx]}/>
|
|
102
|
-
{:else if prop.type == rList_property_type.Combo}
|
|
103
|
+
{:else if prop.type == rList_property_type.Combo && notEmpty}
|
|
103
104
|
<Combo
|
|
104
105
|
compact={true}
|
|
105
106
|
inContext="props"
|
|
@@ -123,7 +124,7 @@ async function editTags(field, propIdx) {
|
|
|
123
124
|
bind:this={propElements[idx]}>
|
|
124
125
|
{item[prop.a]}
|
|
125
126
|
</p>
|
|
126
|
-
{:else if prop.type == rList_property_type.Tags}
|
|
127
|
+
{:else if prop.type == rList_property_type.Tags && notEmpty}
|
|
127
128
|
<Tags
|
|
128
129
|
class="mt-1"
|
|
129
130
|
compact
|
package/components/list/List.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script>import { getContext } from "svelte";
|
|
2
2
|
export let action;
|
|
3
3
|
export let icon = false;
|
|
4
|
+
export let incremental = true;
|
|
4
5
|
let definition = getContext("rList-definition");
|
|
5
6
|
definition.can_insert = true;
|
|
6
7
|
definition.onInsert = action;
|
|
7
8
|
definition.inserter_icon = icon;
|
|
9
|
+
definition.insert_incremental = incremental;
|
|
8
10
|
</script>
|
|
@@ -187,7 +187,7 @@ export async function addRowAfter(after = null) {
|
|
|
187
187
|
if (detail.cancel)
|
|
188
188
|
activate_after_dom_update = last_activated_element;
|
|
189
189
|
else {
|
|
190
|
-
if (detail.incremental) {
|
|
190
|
+
if (detail.incremental && definition.insert_incremental) {
|
|
191
191
|
let current_active = getActive(selectionKey);
|
|
192
192
|
await addRowAfter(current_active);
|
|
193
193
|
}
|
package/operations.svelte
CHANGED
|
@@ -61,7 +61,8 @@ function update(...args) {
|
|
|
61
61
|
icon: operationsRoot.icon ?? FaEllipsisV,
|
|
62
62
|
menu: allFlatOperations,
|
|
63
63
|
tbr: operationsRoot.tbr,
|
|
64
|
-
preAction: operationsRoot.preAction ?? void 0
|
|
64
|
+
preAction: operationsRoot.preAction ?? void 0,
|
|
65
|
+
disabled: operationsRoot.disabled
|
|
65
66
|
};
|
|
66
67
|
switch (operationsRoot.tbr) {
|
|
67
68
|
case "A":
|
|
@@ -79,6 +80,7 @@ function update(...args) {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
operations.forEach((group) => {
|
|
83
|
+
let previousOperationGroupName = "";
|
|
82
84
|
if (group.tbr) {
|
|
83
85
|
const expandOperation = {
|
|
84
86
|
caption: group.caption ?? "",
|
|
@@ -105,15 +107,32 @@ function update(...args) {
|
|
|
105
107
|
group.operations.forEach((op) => {
|
|
106
108
|
if (op.tbr) {
|
|
107
109
|
const tbrOperation = {
|
|
108
|
-
...op
|
|
110
|
+
...op,
|
|
111
|
+
group: group.caption
|
|
109
112
|
};
|
|
110
113
|
if (op.hideToolbarCaption)
|
|
111
114
|
tbrOperation.caption = "";
|
|
115
|
+
const shouldAddSeparator = (list, groupName) => {
|
|
116
|
+
if (!groupName)
|
|
117
|
+
return false;
|
|
118
|
+
if (list && list.length > 0) {
|
|
119
|
+
const last = list[list.length - 1];
|
|
120
|
+
if (last.group && last.group != groupName) {
|
|
121
|
+
return true;
|
|
122
|
+
} else
|
|
123
|
+
return false;
|
|
124
|
+
} else
|
|
125
|
+
return false;
|
|
126
|
+
};
|
|
112
127
|
switch (op.tbr) {
|
|
113
128
|
case "A":
|
|
129
|
+
if (shouldAddSeparator(AOperations, tbrOperation.group))
|
|
130
|
+
AOperations.push({ separator: true });
|
|
114
131
|
AOperations.push(tbrOperation);
|
|
115
132
|
break;
|
|
116
133
|
case "B":
|
|
134
|
+
if (shouldAddSeparator(BOperations, group.caption))
|
|
135
|
+
BOperations.push({ separator: true });
|
|
117
136
|
BOperations.push(tbrOperation);
|
|
118
137
|
break;
|
|
119
138
|
case "C":
|
|
@@ -205,7 +224,7 @@ function isOperationDisabled(operation) {
|
|
|
205
224
|
on:mousedown={(e) => mousedown(e, operation)}
|
|
206
225
|
on:click={(e) => {on_click(e, operation, isDisabled)}}>
|
|
207
226
|
{#if operation.icon}
|
|
208
|
-
<div class="w-
|
|
227
|
+
<div class="w-4 h-4 mr-1"><svelte:component this={operation.icon}/></div>
|
|
209
228
|
{/if}
|
|
210
229
|
{#if operation.caption}
|
|
211
230
|
<span class="ml-1">{operation.caption}</span>
|
|
@@ -235,7 +254,7 @@ function isOperationDisabled(operation) {
|
|
|
235
254
|
on:mousedown={(e) => mousedown(e, operation)}
|
|
236
255
|
on:click={(e) => {on_click(e, operation, isDisabled)}}>
|
|
237
256
|
{#if operation.icon}
|
|
238
|
-
<div class="w-
|
|
257
|
+
<div class="w-4 h-4 mr-1"><svelte:component this={operation.icon}/></div>
|
|
239
258
|
{/if}
|
|
240
259
|
{#if operation.caption}
|
|
241
260
|
<span class="ml-1">{operation.caption}</span>
|
|
@@ -243,7 +262,7 @@ function isOperationDisabled(operation) {
|
|
|
243
262
|
</button>
|
|
244
263
|
{/if}
|
|
245
264
|
{:else}
|
|
246
|
-
<div class="border-l
|
|
265
|
+
<div class="border border-l my-1.5 mx-2 border-stone-200 dark:border-stone-800"></div>
|
|
247
266
|
<!--div class="border-l my-2"></div-->
|
|
248
267
|
{/if}
|
|
249
268
|
{/each}
|
|
@@ -277,7 +296,7 @@ function isOperationDisabled(operation) {
|
|
|
277
296
|
on:mousedown={(e) => mousedown(e, operation)}
|
|
278
297
|
on:click={(e) => {on_click(e, operation, isDisabled)}}>
|
|
279
298
|
{#if operation.icon}
|
|
280
|
-
<div class="w-
|
|
299
|
+
<div class="w-4 h-4 mr-1"><svelte:component this={operation.icon}/></div>
|
|
281
300
|
{/if}
|
|
282
301
|
{#if operation.caption}
|
|
283
302
|
<span class="ml-1">{operation.caption}</span>
|