@humandialog/forms.svelte 0.4.41 → 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.
@@ -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 class="font-bold whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3">
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
- {item[title]}
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
- {item[title]}
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>
@@ -89,7 +89,7 @@ function on_show_menu(e) {
89
89
  class:selected={selected(selectable, context_data)}>
90
90
  <a href={href}
91
91
  on:click={on_link_clicked}
92
- class="flex-1 m-2 inline-flex items-center group">
92
+ class="flex-1 ml-2 my-2 inline-flex items-center group">
93
93
  {#if icon}
94
94
  <Icon size={5} component={icon}/>
95
95
  {/if}
@@ -99,7 +99,7 @@ function on_show_menu(e) {
99
99
  </span>
100
100
  </a>
101
101
 
102
- <section class="flex-0 w-20 h-10 flex-0 flex flex-row"
102
+ <section class="flex-0 w-20 sm:w-12 h-10 flex-0 flex flex-row"
103
103
  use:selectable_if_needed={selectable}>
104
104
  {#if can_show_context_menu(selectable, context_data)}
105
105
  <button class="w-4 h-4 mt-3 mr-2 ml-auto" on:click={on_show_menu}>
package/desk.svelte CHANGED
@@ -198,7 +198,7 @@
198
198
  {sidebar_small_width} sm:w-[320px]
199
199
  z-20 overflow-x-hidden">
200
200
 
201
- <div class=" bg-slate-50 w-full h-full dark:bg-slate-800 overflow-y-auto py-4 px-0">
201
+ <div class=" bg-slate-50 w-full h-full dark:bg-slate-800 overflow-y-auto py-0 px-0">
202
202
  <Configurable config={layout.sidebar[visible_sidebar]}>
203
203
  <div slot='alt'></div>
204
204
  </Configurable>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "0.4.41",
3
+ "version": "0.4.43",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
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
- await finish_editing(false, false);
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
- console.log('range rect: ', range.getBoundingClientRect())
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) })