@humandialog/forms.svelte 0.4.42 → 0.4.43
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
CHANGED
|
@@ -7,7 +7,6 @@ $:
|
|
|
7
7
|
update($page_toolbar_operations, $context_toolbar_operations);
|
|
8
8
|
let operations = [];
|
|
9
9
|
function update(...args) {
|
|
10
|
-
expanded = false;
|
|
11
10
|
if ($context_toolbar_operations && $context_toolbar_operations.length > 0)
|
|
12
11
|
operations = $context_toolbar_operations;
|
|
13
12
|
else
|
|
@@ -224,6 +224,8 @@ async function edit_date(field, prop_idx) {
|
|
|
224
224
|
|
|
225
225
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
226
226
|
{#if item}
|
|
227
|
+
{@const element_title = item[title]}
|
|
228
|
+
|
|
227
229
|
<section class="flex flex-row my-0 w-full text-sm text-slate-700 dark:text-slate-400 cursor-default rounded-md border border-transparent {selected_class} {focused_class}"
|
|
228
230
|
on:contextmenu={on_contextmenu}
|
|
229
231
|
role="menu"
|
|
@@ -233,17 +235,19 @@ async function edit_date(field, prop_idx) {
|
|
|
233
235
|
|
|
234
236
|
<div class="ml-3 w-full py-1" use:selectable={item} on:click={(e) => {activate_row(e, item)}} role="row" tabindex="0">
|
|
235
237
|
<div class="flex flex-row" on:click={(e) => edit_row_property(e, 'top')}>
|
|
236
|
-
<p
|
|
238
|
+
<p class="font-bold whitespace-nowrap overflow-clip flex-none min-h-[1.25rem] w-1/2 sm:w-1/3">
|
|
237
239
|
{#if definition.title_readonly}
|
|
238
240
|
<span id="__hd_list_ctrl_{item[item_key]}_Title" role="gridcell" tabindex="0">
|
|
239
|
-
{
|
|
241
|
+
{element_title}
|
|
240
242
|
</span>
|
|
241
243
|
{:else}
|
|
244
|
+
{#key item[title]} <!-- Wymusza pełne wyrenderowanie zwłasza po zmiane z pustego na tekst -->
|
|
242
245
|
<span id="__hd_list_ctrl_{item[item_key]}_Title" role="gridcell" tabindex="0"
|
|
243
246
|
use:editable={(text) => {change_name(text)}}
|
|
244
247
|
on:click={edit}>
|
|
245
|
-
|
|
248
|
+
{element_title}
|
|
246
249
|
</span>
|
|
250
|
+
{/key}
|
|
247
251
|
{/if}
|
|
248
252
|
</p>
|
|
249
253
|
|
|
@@ -17,7 +17,7 @@ let insertion_paragraph;
|
|
|
17
17
|
<div class="h-4 w-4 mt-1.5 ml-2"></div>
|
|
18
18
|
{/if}
|
|
19
19
|
|
|
20
|
-
<p class="ml-3 py-1 font-bold whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3"
|
|
20
|
+
<p class="ml-3 py-1 font-bold whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3" tabindex="0"
|
|
21
21
|
bind:this={insertion_paragraph}
|
|
22
22
|
use:editable={oninsert} >
|
|
23
23
|
</p>
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -102,7 +102,8 @@ export function editable(node, action)
|
|
|
102
102
|
const org_text = node.textContent;
|
|
103
103
|
const blur_listener = async (e) =>
|
|
104
104
|
{
|
|
105
|
-
|
|
105
|
+
let cancel = !node.textContent
|
|
106
|
+
await finish_editing(cancel, false);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
const key_listener = async (e) =>
|
|
@@ -133,6 +134,8 @@ export function editable(node, action)
|
|
|
133
134
|
let sel = window.getSelection();
|
|
134
135
|
sel.removeAllRanges();
|
|
135
136
|
|
|
137
|
+
//console.log('cell_content', node.textContent)
|
|
138
|
+
|
|
136
139
|
if(cancel)
|
|
137
140
|
{
|
|
138
141
|
node.innerHTML = org_text;
|
|
@@ -156,13 +159,12 @@ export function editable(node, action)
|
|
|
156
159
|
|
|
157
160
|
const edit_listener = async (e) =>
|
|
158
161
|
{
|
|
159
|
-
//console.log('Edit event fired:', itm, "node", node)
|
|
160
162
|
node.contentEditable = "true"
|
|
161
163
|
node.addEventListener("blur", blur_listener);
|
|
162
164
|
node.addEventListener("keydown", key_listener);
|
|
163
165
|
|
|
164
166
|
node.focus();
|
|
165
|
-
|
|
167
|
+
|
|
166
168
|
await tick();
|
|
167
169
|
let range = document.createRange();
|
|
168
170
|
range.selectNodeContents(node);
|
|
@@ -170,7 +172,7 @@ export function editable(node, action)
|
|
|
170
172
|
let end_container = range.endContainer;
|
|
171
173
|
range.setStart(end_container, end_offset)
|
|
172
174
|
range.setEnd(end_container, end_offset)
|
|
173
|
-
|
|
175
|
+
// console.log('range rect: ', range.getBoundingClientRect())
|
|
174
176
|
let sel = window.getSelection();
|
|
175
177
|
sel.removeAllRanges();
|
|
176
178
|
sel.addRange(range);
|
|
@@ -205,7 +207,7 @@ export function start_editing(element, finish_callback)
|
|
|
205
207
|
{
|
|
206
208
|
if(editable_node.contentEditable == "true")
|
|
207
209
|
return;
|
|
208
|
-
|
|
210
|
+
|
|
209
211
|
if(finish_callback)
|
|
210
212
|
{
|
|
211
213
|
editable_node.addEventListener("finish", (e) => { finish_callback(e.detail) })
|