@humandialog/forms.svelte 0.4.43 → 0.4.45

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.
@@ -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-xs font-medium text-gray-900 dark:text-gray-400 dark:hover:text-white
124
+ text-base sm:text-xs font-medium text-gray-900 dark:text-gray-400 dark:hover:text-white
125
125
  bg-slate-100 hover:bg-slate-200 dark:bg-gray-800 dark:hover:bg-gray-700 active:bg-slate-300 dark:active:bg-gray-600
126
126
  border rounded border-gray-200 dark:border-gray-600 focus:outline-none
127
127
  inline-flex items-center justify-center"
@@ -48,18 +48,18 @@ switch (s) {
48
48
  label_mb = "mb-2";
49
49
  input_pt = "pt-2.5";
50
50
  input_pb = "pb-2.5";
51
- font_size = "text-sm";
52
- line_h = "h-5";
51
+ font_size = "text-lg sm:text-sm";
52
+ line_h = "h-7 sm:h-5";
53
53
  break;
54
54
  case "xs":
55
55
  label_mb = "mb-0.5";
56
56
  input_pt = "pt-0.5";
57
57
  input_pb = "pb-0.5";
58
- font_size = "text-xs";
59
- line_h = "h-4";
58
+ font_size = "text-base sm:text-xs";
59
+ line_h = "h-6 sm:h-4";
60
60
  break;
61
61
  }
62
- let background_class = is_compact && !icon ? "bg-slate-900/10 dark:bg-slate-100/10 rounded-lg" : "";
62
+ let background_class = is_compact && !icon ? "" : "";
63
63
  let appearance_class;
64
64
  if (is_compact)
65
65
  appearance_class = `${font_size}`;
@@ -175,6 +175,7 @@ export function show(event, hide_callback) {
175
175
  if (show_above)
176
176
  dropdown_position += " transform: translate(0, -100%);";
177
177
  }
178
+ console.log("combo show pos", dropdown_position, "rect", rect, "client_rect", client_rect, "combo", combo);
178
179
  is_dropdown_open = true;
179
180
  if (!textbox)
180
181
  return;
@@ -527,7 +528,7 @@ function on_focus_out(e) {
527
528
 
528
529
 
529
530
  <p bind:this={textbox}
530
- class="dark:text-white {line_h} truncate px-2.5 {background_class}"
531
+ class="dark:text-gray-300 {line_h} truncate sm:pl-2.5 pr-2.5 {background_class}"
531
532
  class:ml-2={icon}
532
533
  class:text-gray-400={ (!is_dropdown_open) && (!sel_item)}
533
534
  class:text-gray-700={ is_dropdown_open || sel_item }
@@ -537,8 +538,8 @@ function on_focus_out(e) {
537
538
  {combo_text}</p>
538
539
  </div>
539
540
 
540
- {#if can_be_activated && !is_compact }
541
- <Icon size={3} component={FaChevronDown} class="flex-none text-gray-700 dark:text-gray-200"/>
541
+ {#if can_be_activated }
542
+ <Icon size={3} component={FaChevronDown} class="flex-none text-gray-700 dark:text-gray-300"/>
542
543
  {/if}
543
544
  </div>
544
545
 
@@ -553,7 +554,7 @@ function on_focus_out(e) {
553
554
  {#if _filtered_source.length > 0}
554
555
  {#each _filtered_source as item (item.Key)}
555
556
  <!-- svelte-ignore a11y-click-events-have-key-events -->
556
- <li class="rounded p-2 flex flex-row items-center"
557
+ <li class="rounded p-2 flex flex-row items-center {font_size}"
557
558
  class:bg-gray-100={highlighted_option == item}
558
559
  class:dark:bg-gray-700={highlighted_option == item}
559
560
  class:dark:hover:bg-gray-700={highlighted_option == item}
@@ -188,30 +188,35 @@ function hide_submenu() {
188
188
  </script>
189
189
 
190
190
  <div id="__hd_svelte_contextmenu"
191
- class="bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 rounded-lg border border-gray-200 dark:border-gray-700 shadow-md z-30 fixed min-w-[{min_width_px}px] w-max"
191
+ class=" bg-white dark:bg-gray-700 text-slate-600 dark:text-gray-400 rounded-lg border border-gray-200 dark:border-gray-900 shadow-md
192
+ z-30 fixed min-w-[{min_width_px}px] w-max"
192
193
  style={`left:${x}px; top:${y}px; display:${display}`}
193
194
  bind:this={menu_root}>
194
195
 
195
196
  {#each operations as operation, index}
196
197
  {@const is_separator = operation.separator}
197
198
  {#if is_separator}
198
- <hr class="my-1 mx-1">
199
+ <hr class="my-1 mx-0 border-1 dark:border-slate-900">
199
200
  {:else}
200
- {@const icon_placeholder_size = operation.description ? 12 : 10}
201
+ {@const mobile = is_device_smaller_than("sm")}
202
+ {@const icon_placeholder_without_desc = mobile ? 12 : 10}
203
+ {@const icon_placeholder_with_desc = mobile ? 14 : 12}
204
+ {@const icon_placeholder_size = operation.description ? icon_placeholder_with_desc : icon_placeholder_without_desc}
201
205
  {@const menu_item_id = menu_items_id_prefix + index}
202
- {@const active = focused_index == index ? 'bg-gray-200 dark:bg-gray-700' : ''}
206
+ {@const active = focused_index == index ? 'bg-gray-200 dark:bg-gray-600' : ''}
203
207
  {@const has_submenu = operation.menu !== undefined && operation.menu.length > 0}
204
208
 
205
- <button class="font-medium m-0 p-2 text-sm w-full text-left flex flex-row cursor-context-menu {active} focus:outline-none"
209
+ <button class="font-medium m-0 p-2 text-lg sm:text-sm w-full text-left flex flex-row cursor-context-menu {active} focus:outline-none"
206
210
  id={menu_item_id}
207
211
  bind:this={menu_items[index]}
208
212
  on:click|stopPropagation={(e) => { execute_action(operation, index) } }
209
213
  on:mouseenter = {(e) => {on_mouse_move(index)}}
210
214
  on:keydown|stopPropagation={(e) => on_keydown(e, operation, index)}>
211
215
 
212
- <div class="flex items-center justify-center" style:width={`${icon_placeholder_size*0.25}rem`}>
216
+ <div class="flex items-center justify-center mt-1 sm:mt-0.5" style:width={`${icon_placeholder_size*0.25}rem`}>
213
217
  {#if operation.icon}
214
- {@const icon_size = icon_placeholder_size - 6}
218
+ {@const cc = mobile ? 7 : 6}
219
+ {@const icon_size = icon_placeholder_size - cc}
215
220
  <Icon size={icon_size} component={operation.icon}/>
216
221
  {/if}
217
222
  </div>
@@ -219,7 +224,7 @@ function hide_submenu() {
219
224
  <p>{operation.caption}</p>
220
225
  {#if operation.description}
221
226
  {@const shortcut_width_px = operation.shortcut ? 80 : 0}
222
- <p class="text-sm font-normal text-gray-400 dark:text-gray-500 truncate inline-block"
227
+ <p class="text-sm font-normal text-slate-900 dark:text-gray-500 truncate inline-block"
223
228
  style:max-width={`calc(${width_px-shortcut_width_px} - 3rem)`} >{operation.description}</p>
224
229
  {/if}
225
230
  </div>
@@ -2,6 +2,7 @@
2
2
  import { data_tick_store, context_items_store, context_types_store } from "../stores.js";
3
3
  import { inform_modification, push_changes } from "../updates.js";
4
4
  import { parse_width_directive, is_device_smaller_than } from "../utils.js";
5
+ import FaChevronDown from "svelte-icons/fa/FaChevronDown.svelte";
5
6
  export let self = null;
6
7
  export let a = "";
7
8
  export let context = "";
@@ -37,31 +38,31 @@ export function show(event, hide_callback) {
37
38
  let is_compact = getContext("rIs-table-component") || compact;
38
39
  let input_pt = "pt-0.5";
39
40
  let input_pb = "pb-1";
40
- let font_size = "text-sm";
41
- let line_h = "h-4";
41
+ let font_size = "text-lg sm:text-sm";
42
+ let line_h = "h-7 sm:h-5";
42
43
  switch (s) {
43
44
  case "md":
44
45
  input_pt = "pt-2.5";
45
46
  input_pb = "pb-2.5";
46
- font_size = "text-sm";
47
- line_h = "h-5";
47
+ font_size = "text-lg sm:text-sm";
48
+ line_h = "h-7 sm:h-5";
48
49
  break;
49
50
  case "xs":
50
51
  input_pt = "pt-0.5";
51
52
  input_pb = "pb-0.5";
52
- font_size = "text-xs";
53
- line_h = "h-4";
53
+ font_size = "text-base sm:text-xs";
54
+ line_h = "h-6 sm:h-4";
54
55
  break;
55
56
  }
56
57
  let item = null;
57
58
  let user_class = $$restProps.class ?? "";
58
59
  let value = null;
59
60
  let rValue = "";
61
+ let pretty_value = "";
60
62
  let ctx = context ? context : getContext("ctx");
61
63
  let cs = parse_width_directive(c);
62
64
  let style;
63
65
  let input_element = void 0;
64
- let background_class = is_compact ? "bg-slate-900/10 dark:bg-slate-100/10 rounded-lg" : "";
65
66
  if (!is_compact) {
66
67
  style = `bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg
67
68
  focus:ring-primary-600 focus:border-primary-600 block w-full ${input_pb} ${input_pt} px-2.5 dark:bg-gray-700
@@ -103,6 +104,119 @@ function setup(...args) {
103
104
  } else
104
105
  can_be_activated = true;
105
106
  rValue = get_formatted_date(value);
107
+ pretty_value = get_pretty_value(value);
108
+ }
109
+ function get_pretty_value(d) {
110
+ if (!d)
111
+ return "";
112
+ let month = d.getMonth();
113
+ let day = d.getDate();
114
+ let year = d.getFullYear();
115
+ const now = new Date(Date.now());
116
+ let current_month = now.getMonth();
117
+ let current_day = now.getDate();
118
+ let current_year = now.getFullYear();
119
+ let is_far_date = true;
120
+ const far_date_threshold = 14 * 24 * 60 * 60 * 1e3;
121
+ if (Math.abs(now.getTime() - d.getTime()) < far_date_threshold)
122
+ is_far_date = false;
123
+ if (year != current_year) {
124
+ if (is_far_date)
125
+ return `${day} ${month_name(month)} ${year}`;
126
+ else
127
+ return `${day_name(d.getDay())}, ${day} ${month_name(month)}`;
128
+ }
129
+ if (month != current_month) {
130
+ if (is_far_date)
131
+ return `${day} ${month_name(month)}`;
132
+ else
133
+ return `${day_name(d.getDay())}, ${day} ${month_name(month)}`;
134
+ } else {
135
+ let day_of_week = d.getDay();
136
+ let current_day_of_week = now.getDay();
137
+ if (day_of_week == 0)
138
+ day_of_week = 7;
139
+ if (current_day_of_week == 0)
140
+ current_day_of_week = 7;
141
+ let days_diff = day - current_day;
142
+ if (days_diff == 0)
143
+ return "Today";
144
+ else if (days_diff == 1)
145
+ return "Tomorrow";
146
+ else if (days_diff == -1)
147
+ return "Yesterday";
148
+ else if (days_diff > 0 && days_diff <= 7) {
149
+ if (day_of_week > current_day_of_week)
150
+ return day_name(day_of_week);
151
+ else
152
+ return `${day_name(day_of_week)}, ${d.getDate()} ${month_name(d.getMonth())}`;
153
+ } else if (days_diff > 0) {
154
+ if (is_far_date)
155
+ return `${d.getDate()} ${month_name(d.getMonth())}`;
156
+ else
157
+ return `${day_name(day_of_week)}, ${d.getDate()} ${month_name(d.getMonth())}`;
158
+ } else if (days_diff < 0 && days_diff > -7) {
159
+ if (day_of_week < current_day_of_week)
160
+ return day_name(day_of_week);
161
+ else
162
+ return `${day_name(day_of_week)}, ${d.getDate()} ${month_name(d.getMonth())}`;
163
+ } else {
164
+ if (is_far_date)
165
+ return `${d.getDate()} ${month_name(d.getMonth())}`;
166
+ else
167
+ return `${day_name(day_of_week)}, ${d.getDate()} ${month_name(d.getMonth())}`;
168
+ }
169
+ }
170
+ }
171
+ function day_name(d) {
172
+ switch (d) {
173
+ case 0:
174
+ return "Sun";
175
+ case 1:
176
+ return "Mon";
177
+ case 2:
178
+ return "Tue";
179
+ case 3:
180
+ return "Wed";
181
+ case 4:
182
+ return "Thu";
183
+ case 5:
184
+ return "Fri";
185
+ case 6:
186
+ return "Sat";
187
+ case 7:
188
+ return "Sun";
189
+ }
190
+ return "";
191
+ }
192
+ function month_name(m) {
193
+ switch (m) {
194
+ case 0:
195
+ return "Jan";
196
+ case 1:
197
+ return "Feb";
198
+ case 2:
199
+ return "Mar";
200
+ case 3:
201
+ return "Apr";
202
+ case 4:
203
+ return "May";
204
+ case 5:
205
+ return "Jun";
206
+ case 6:
207
+ return "Jul";
208
+ case 7:
209
+ return "Aug";
210
+ case 8:
211
+ return "Sep";
212
+ case 9:
213
+ return "Oct";
214
+ case 10:
215
+ return "Nov";
216
+ case 11:
217
+ return "Dec";
218
+ }
219
+ return "";
106
220
  }
107
221
  function get_formatted_date(d) {
108
222
  if (!d)
@@ -154,9 +268,16 @@ function blur(e) {
154
268
 
155
269
  {#if is_compact}
156
270
  <div class="inline-block relative {line_h}">
157
- <span class="dark:text-white {font_size} truncate px-2.5 {background_class}
271
+ <span class="dark:text-gray-300 {font_size} truncate
272
+ pl-2.5 pr-5
158
273
  absolute left-0 top-0 h-full" >
159
- {rValue}
274
+ {pretty_value}
275
+
276
+ {#if can_be_activated}
277
+ <div class="w-3 h-3 absolute right-0 top-1.5 sm:top-0.5 text-gray-700 dark:text-gray-300">
278
+ <FaChevronDown/>
279
+ </div>
280
+ {/if}
160
281
 
161
282
  {#if can_be_activated}
162
283
  {#if type == "datetime-local"}
@@ -173,13 +294,17 @@ function blur(e) {
173
294
  bind:this={input_element}
174
295
  on:blur={blur}>
175
296
  {/if}
297
+
298
+
176
299
  {/if}
177
300
  </span>
301
+
302
+
178
303
  </div>
179
304
 
180
305
  {:else}
181
306
  {#if type == "datetime-local"}
182
- <input class=" dark:text-white {cs} {style} {line_h} px-2.5 {background_class} {user_class}"
307
+ <input class=" dark:text-white {cs} {style} {line_h} px-2.5 {user_class}"
183
308
  type="datetime-local"
184
309
  on:change={on_changed}
185
310
  bind:value={rValue}
@@ -6,7 +6,7 @@ export let img = "";
6
6
  export let label = "";
7
7
  export let symbol = "";
8
8
  export let color = "";
9
- export let size = 5;
9
+ export let size = void 0;
10
10
  export let bg = "";
11
11
  export let circle = false;
12
12
  let additional_class = $$restProps.class ?? "";
@@ -14,7 +14,6 @@ let id = $$restProps.id ?? "";
14
14
  let _bg;
15
15
  let txt = "";
16
16
  let symbol_html = "";
17
- let icon_size = `${size * 0.25}rem`;
18
17
  $: {
19
18
  if (symbol) {
20
19
  if (symbol.startsWith("label:"))
@@ -57,11 +56,24 @@ $: {
57
56
  } else
58
57
  component = component;
59
58
  }
59
+ let style;
60
+ $: {
61
+ if (size == void 0) {
62
+ if (!additional_class) {
63
+ size = 5;
64
+ let icon_size = `${size * 0.25}rem`;
65
+ style = `width: ${icon_size}; height: ${icon_size}`;
66
+ } else
67
+ style = "";
68
+ } else {
69
+ let icon_size = `${size * 0.25}rem`;
70
+ style = `width: ${icon_size}; height: ${icon_size}`;
71
+ }
72
+ }
60
73
  </script>
61
74
 
62
75
  <div class=" {additional_class}"
63
- style:width={icon_size}
64
- style:height={icon_size}
76
+ style="{style}"
65
77
  style:background-color={_bg}
66
78
  style:border-radius={ circle ? '50%' : ''}
67
79
  {id}
@@ -0,0 +1,135 @@
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 edit_property(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
+ console.log("edit_propery", field, combo);
58
+ if (!!combo)
59
+ combo.show();
60
+ else {
61
+ placeholder = field;
62
+ await tick();
63
+ combo = props[prop_idx];
64
+ if (!!combo)
65
+ combo.show(void 0, () => {
66
+ placeholder = "";
67
+ });
68
+ }
69
+ }
70
+ </script>
71
+
72
+ <div class="text-xs grid-{definition.properties.length}">
73
+ {#each definition.properties as prop, prop_index}
74
+ <p class="col-span-1 w-full mr-auto mt-0.5">
75
+ {#if item[prop.a] || placeholder == prop.name}
76
+ <span role="gridcell" tabindex="0">
77
+ {#if prop.type == rList_property_type.Date}
78
+ <DatePicker self={item}
79
+ a={prop.a}
80
+ compact={true}
81
+ on_select={prop.on_select}
82
+ s="xs"
83
+ in_context="props sel"
84
+ bind:this={props[prop_index]}
85
+ changed={(value)=>{on_date_changed(value, prop.a)}}
86
+ />
87
+ {:else if prop.type == rList_property_type.Combo}
88
+ <Combo self={item}
89
+ in_context="props sel"
90
+ compact={true}
91
+ a={prop.a}
92
+ on_select={prop.on_select}
93
+ is_association={prop.association}
94
+ icon={false}
95
+ bind:this={props[prop_index]}
96
+ definition={prop.combo_definition}
97
+ changed={(key,name)=>{on_combo_changed(key, name, prop)}}
98
+ s='xs'/>
99
+ {:else if prop.type == rList_property_type.Static}
100
+ <span class="dark:text-white text-gray-400 truncate px-2.5 bg-slate-900/10 dark:bg-slate-100/10 rounded-lg">
101
+ {item[prop.a]}
102
+ </span>
103
+ {/if}
104
+ </span>
105
+ {/if}
106
+ </p>
107
+ {/each}
108
+ </div>
109
+
110
+ <style>
111
+ .grid-1
112
+ {
113
+ display: grid;
114
+ grid-template-columns: 100%;
115
+ }
116
+
117
+ .grid-2
118
+ {
119
+ display: grid;
120
+ grid-template-columns: 50% 50%;
121
+ }
122
+
123
+ .grid-3
124
+ {
125
+ display: grid;
126
+ grid-template-columns: 33% 33% 33%;
127
+ }
128
+
129
+ .grid-4
130
+ {
131
+ display: grid;
132
+ grid-template-columns: 25% 25% 25% 25%;
133
+ }
134
+
135
+ </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
+ edit_property?: ((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 edit_property(): (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 click_edit;
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-slate-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-slate-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-slate-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
+ click_edit: 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 {};
@@ -10,8 +10,9 @@ import {
10
10
  } from "../../../utils";
11
11
  import { show_grid_menu, show_menu } from "../../menu";
12
12
  import { push_changes, inform_modification } from "../../../updates";
13
- import Combo from "../../combo/combo.svelte";
14
- import DatePicker from "../../date.svelte";
13
+ import Summary from "./list.element.summary.svelte";
14
+ import Properties from "./list.element.props.svelte";
15
+ import { is_device_smaller_than } from "../../../utils";
15
16
  import { rList_definition, rList_property_type } from "../List";
16
17
  export let item;
17
18
  export let title = "";
@@ -21,7 +22,8 @@ export let toolbar_operations;
21
22
  export let context_menu;
22
23
  let definition = getContext("rList-definition");
23
24
  let placeholder = "";
24
- let props = [];
25
+ let props_sm;
26
+ let props_md;
25
27
  $:
26
28
  is_row_active = calculate_active(item, $context_items_store);
27
29
  $:
@@ -30,6 +32,8 @@ $:
30
32
  selected_class = is_row_selected ? "!border-blue-300" : "";
31
33
  $:
32
34
  focused_class = is_row_active ? "bg-gray-200 dark:bg-gray-700" : "";
35
+ $:
36
+ is_small = is_device_smaller_than("sm");
33
37
  if (!typename) {
34
38
  if (item.$type)
35
39
  typename = item.$type;
@@ -113,11 +117,14 @@ function edit_row_property(e, part) {
113
117
  force_editing("Title");
114
118
  else if (part == "bottom" && !definition.summary_readonly)
115
119
  force_editing("Summary");
120
+ } else {
121
+ if (part == "top" && !definition.title_readonly)
122
+ force_editing("Title");
123
+ else if (part == "bottom" && !definition.summary_readonly)
124
+ force_editing("Summary");
116
125
  }
117
126
  }
118
127
  function activate_row(e, item2) {
119
- if (is_row_active) {
120
- }
121
128
  activate_item("props", item2, toolbar_operations(item2));
122
129
  if (e)
123
130
  e.stopPropagation();
@@ -137,42 +144,16 @@ function on_contextmenu(e) {
137
144
  }
138
145
  e.preventDefault();
139
146
  }
140
- function on_date_changed(value, a) {
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
147
  export function edit_property(field) {
159
148
  if (field == title)
160
149
  force_editing("Title");
161
150
  else if (field == summary)
162
151
  force_editing("Summary");
163
152
  else {
164
- let prop_idx = definition.properties.findIndex((p) => p.name == field);
165
- if (prop_idx < 0)
166
- return;
167
- let property = definition.properties[prop_idx];
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
- }
153
+ if (is_device_smaller_than("sm"))
154
+ props_sm.edit_property(field);
155
+ else
156
+ props_md.edit_property(field);
176
157
  }
177
158
  }
178
159
  async function force_editing(field) {
@@ -192,41 +173,13 @@ async function force_editing(field) {
192
173
  placeholder = "";
193
174
  });
194
175
  }
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
176
  </script>
224
177
 
225
178
  <!-- svelte-ignore a11y-click-events-have-key-events -->
226
179
  {#if item}
227
180
  {@const element_title = item[title]}
228
181
 
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}"
182
+ <section class="mt-3 flex flex-row my-0 w-full text-sm text-slate-700 dark:text-slate-300 cursor-default rounded-md border border-transparent {selected_class} {focused_class}"
230
183
  on:contextmenu={on_contextmenu}
231
184
  role="menu"
232
185
  tabindex="-1">
@@ -234,84 +187,51 @@ async function edit_date(field, prop_idx) {
234
187
  <slot name="left" element={item}/>
235
188
 
236
189
  <div class="ml-3 w-full py-1" use:selectable={item} on:click={(e) => {activate_row(e, item)}} role="row" tabindex="0">
237
- <div class="flex flex-row" on:click={(e) => edit_row_property(e, 'top')}>
238
- <p class="font-bold whitespace-nowrap overflow-clip flex-none min-h-[1.25rem] w-1/2 sm:w-1/3">
239
- {#if definition.title_readonly}
240
- <span id="__hd_list_ctrl_{item[item_key]}_Title" role="gridcell" tabindex="0">
190
+ <div class="block sm:flex sm:flex-row" on:click={(e) => edit_row_property(e, 'top')}>
191
+
192
+ {#if definition.title_readonly}
193
+ <p class=" text-lg font-semibold min-h-[1.75rem]
194
+ sm:text-sm sm:font-semibold sm:min-h-[1.25rem]
195
+ whitespace-nowrap overflow-clip w-full sm:flex-none sm:w-2/3"
196
+ id="__hd_list_ctrl_{item[item_key]}_Title">
241
197
  {element_title}
242
- </span>
243
- {:else}
244
- {#key item[title]} <!-- Wymusza pełne wyrenderowanie zwłasza po zmiane z pustego na tekst -->
245
- <span id="__hd_list_ctrl_{item[item_key]}_Title" role="gridcell" tabindex="0"
198
+ </p>
199
+ {:else}
200
+ {#key item[title]} <!-- Wymusza pełne wyrenderowanie zwłasza po zmiane z pustego na tekst -->
201
+ <p class=" text-lg font-semibold min-h-[1.75rem]
202
+ sm:text-sm sm:font-semibold sm:min-h-[1.25rem]
203
+ whitespace-nowrap overflow-clip w-full sm:flex-none sm:w-2/3"
204
+ id="__hd_list_ctrl_{item[item_key]}_Title"
246
205
  use:editable={(text) => {change_name(text)}}
247
206
  on:click={edit}>
248
207
  {element_title}
249
- </span>
250
- {/key}
251
- {/if}
252
- </p>
253
-
254
- <!--div class="flex flex-row justify-between text-xs flex-none w-1/2 sm:w-2/3"-->
255
- <div class="text-xs flex-none w-1/2 sm:w-2/3 grid-{definition.properties.length}">
256
- {#each definition.properties as prop, prop_index}
257
- <p class="col-span-1 w-full mr-auto mt-0.5">
258
- {#if item[prop.a] || placeholder == prop.name}
259
- <span role="gridcell" tabindex="0">
260
- {#if prop.type == rList_property_type.Date}
261
- <DatePicker self={item}
262
- a={prop.a}
263
- compact={true}
264
- on_select={prop.on_select}
265
- s="xs"
266
- in_context="props sel"
267
- bind:this={props[prop_index]}
268
- changed={(value)=>{on_date_changed(value, prop.a)}}
269
- />
270
- {:else if prop.type == rList_property_type.Combo}
271
- <Combo self={item}
272
- in_context="props sel"
273
- compact={true}
274
- a={prop.a}
275
- on_select={prop.on_select}
276
- is_association={prop.association}
277
- icon={false}
278
- bind:this={props[prop_index]}
279
- definition={prop.combo_definition}
280
- changed={(key,name)=>{on_combo_changed(key, name, prop)}}
281
- s='xs'/>
282
- {:else if prop.type == rList_property_type.Static}
283
- <span class="dark:text-white text-gray-400 truncate px-2.5 bg-slate-900/10 dark:bg-slate-100/10 rounded-lg">
284
- {item[prop.a]}
285
- </span>
286
- {/if}
287
- </span>
288
- {/if}
289
208
  </p>
290
- {/each}
291
- </div>
209
+ {/key}
210
+ {/if}
211
+
212
+
213
+ <section class="hidden sm:block w-full sm:flex-none sm:w-1/3">
214
+ <Properties {definition} {item} {placeholder} bind:this={props_md}/>
215
+ </section>
292
216
  </div>
293
217
 
294
218
  {#if summary && (item[summary] || placeholder=='Summary')}
295
219
  {@const element_id = `__hd_list_ctrl_${item[item_key]}_Summary`}
296
- <p class="text-xs text-slate-400" style="min-height: 1rem;" on:click={(e) => edit_row_property(e, 'bottom')}>
297
- {#if definition.summary_readonly}
298
- <span id={element_id} role="gridcell" tabindex="0">
299
- {item[summary]}
300
- </span>
301
- {:else if item[summary]}
302
- <span id={element_id} role="gridcell" tabindex="0"
303
- use:editable={(text) => {change_summary(text)}}
304
- on:click={edit}>
305
- {item[summary]}
306
- </span>
307
- {:else if placeholder == 'Summary'}
308
- <span id={element_id}
309
- use:editable={(text) => {change_summary(text)}}>
310
- </span>
311
- {/if}
312
-
313
- </p>
220
+ <Summary
221
+ id={element_id}
222
+ on:click={(e) => edit_row_property(e, 'bottom')}
223
+ text={item[summary]}
224
+ readonly={definition.summary_readonly}
225
+ placeholder={placeholder == 'Summary'}
226
+ editable={(text) => {change_summary(text)}}
227
+ click_edit={edit}
228
+ />
314
229
  {/if}
230
+
231
+ <section class="block sm:hidden w-full sm:flex-none sm:w-2/3">
232
+ <Properties {definition} {item} {placeholder} bind:this={props_sm}/>
233
+ </section>
234
+
315
235
  </div>
316
236
  </section>
317
237
  {/if}
@@ -9,15 +9,15 @@ export function run(onclose) {
9
9
  let insertion_paragraph;
10
10
  </script>
11
11
 
12
- <section class="flex flex-row my-0 w-full text-sm text-slate-700 dark:text-slate-400 cursor-default rounded-md border-2 border-transparent bg-gray-200 dark:bg-gray-700">
12
+ <section class="flex flex-row my-0 w-full text-lg sm:text-sm text-slate-700 dark:text-slate-400 cursor-default rounded-md border-2 border-transparent bg-gray-200 dark:bg-gray-700">
13
13
  {#if icon}
14
14
  <!--Icon size={3}
15
15
  component={FaPlus}
16
16
  class="mt-1.5 ml-2 "/-->
17
- <div class="h-4 w-4 mt-1.5 ml-2"></div>
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 font-bold whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3" tabindex="0"
20
+ <p class="ml-3 py-1 font-semibold sm: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>
@@ -1,4 +1,4 @@
1
- <script>import { getContext } from "svelte";
1
+ <script>import { getContext } from "svelte";
2
2
  import { rList_property_type, rList_property } from "./List";
3
3
  export let name;
4
4
  export let a = "";
@@ -133,8 +133,8 @@ export function edit(element, property_name) {
133
133
 
134
134
 
135
135
  {#if title}
136
- <p class="hidden sm:block mt-3 uppercase text-sm text-center">{title}</p>
137
- <hr class="hidden sm:block w-full">
136
+ <p class="hidden sm:block mt-3 ml-3 pb-5 text-lg text-left">{title}</p>
137
+ <!--hr class="hidden sm:block w-full"-->
138
138
  {/if}
139
139
 
140
140
  <!--div class="w-full h-full overflow-y-auto"-->
@@ -14,7 +14,7 @@
14
14
  <slot/>
15
15
 
16
16
  {#if inserter}
17
- <Edit class="p-2 text-base font-normal text-gray-500 rounded-lg dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700" on_enter={inserter} placeholder={inserter_placeholder} inserter={true}>
17
+ <Edit class="p-3 sm:p-2 text-lg sm:text-base font-normal text-gray-500 rounded-lg dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700" on_enter={inserter} placeholder={inserter_placeholder} inserter={true}>
18
18
  <Icon size={5} component={FaPlus} class="mr-3"/>
19
19
  </Edit>
20
20
  {/if}
@@ -80,7 +80,7 @@ function on_show_menu(e) {
80
80
  on:keydown
81
81
  on:keyup
82
82
  class=" border border-transparent rounded-lg
83
- text-base font-normal
83
+ text-lg sm:text-base font-normal
84
84
  text-gray-900 sm:hover:bg-gray-100
85
85
  dark:text-white sm:dark:hover:bg-gray-700 {user_class}
86
86
  flex flex-row justify-between"
@@ -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 ml-2 my-2 inline-flex items-center group">
92
+ class="flex-1 ml-2 my-3 sm:my-2 inline-flex items-center group">
93
93
  {#if icon}
94
94
  <Icon size={5} component={icon}/>
95
95
  {/if}
@@ -102,7 +102,7 @@ function on_show_menu(e) {
102
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
- <button class="w-4 h-4 mt-3 mr-2 ml-auto" on:click={on_show_menu}>
105
+ <button class="w-6 sm:w-4 h-6 sm:h-4 mt-3 mr-3 sm:mr-2 ml-auto" on:click={on_show_menu}>
106
106
  <FaBars/>
107
107
  </button>
108
108
  {/if}
package/desk.svelte CHANGED
@@ -115,22 +115,22 @@
115
115
  tools_visibility = "hidden sm:block sm:fixed"
116
116
  fab_visibility = "fixed sm:hidden"
117
117
 
118
- content_top = 'top-[40px] sm:top-[40px]'
118
+ content_top = 'top-[50px] sm:top-[40px]'
119
119
 
120
120
  if(bottom_bar_visible)
121
- content_height = `h-[calc(100vh-320px)] sm:h-[calc(100vh-280px)]`
121
+ content_height = `h-[calc(100vh-290px)] sm:h-[calc(100vh-280px)]`
122
122
  else
123
- content_height = `h-[calc(100vh-80px)] sm:h-[calc(100vh-40px)]`
123
+ content_height = `h-[calc(100vh-50px)] sm:h-[calc(100vh-40px)]`
124
124
 
125
125
  }
126
126
  else
127
127
  {
128
128
  tools_visibility = "hidden"
129
- content_top = `top-[40px] sm:top-0`
129
+ content_top = `top-[50px] sm:top-0`
130
130
  if(bottom_bar_visible)
131
- content_height = `h-[calc(100vh-280px)] sm:h-[calc(100vh-240px)]`
131
+ content_height = `h-[calc(100vh-290px)] sm:h-[calc(100vh-240px)]`
132
132
  else
133
- content_height = `h-[calc(100vh-40px)] sm:h-screen`
133
+ content_height = `h-[calc(100vh-50px)] sm:h-screen`
134
134
  }
135
135
 
136
136
 
@@ -165,8 +165,8 @@
165
165
  <!--###########################################################-->
166
166
  <!--## HORIZONTAL TOOLBAR (FOR PHONES) ######################-->
167
167
  <!--###########################################################-->
168
- <header class="fixed sm:hidden w-screen top-0 h-[40px] z-20 overflow-auto shadow shadow-slate-900/5 dark:shadow-none" >
169
- <div class=" flex flex-row justify-between bg-slate-900 text-gray-100 ">
168
+ <header class="fixed sm:hidden w-screen top-0 h-[50px] sm:h-[40px] z-20 overflow-auto shadow shadow-slate-900/5 dark:shadow-none" >
169
+ <div class=" flex flex-row justify-between h-full bg-slate-900 text-gray-100 ">
170
170
  <HorizontalToolbar app_config={layout}/>
171
171
  <div>
172
172
  </header>
@@ -176,7 +176,7 @@
176
176
  <!--#######################################################-->
177
177
  <!--## VERTICAL TOOLBAR ##################-->
178
178
  <!--#######################################################-->
179
- <div class="hidden sm:block fixed left-0 top-0 w-[40px] h-screen z-20 inset-0 overflow-hidden">
179
+ <div class="hidden sm:block fixed left-0 top-0 w-[50px] sm:w-[40px] h-screen z-20 inset-0 overflow-hidden">
180
180
  <div class="sticky top-0 flex h-full w-10 bg-slate-900 flex-col items-center text-gray-100 shadow">
181
181
  <VerticalToolbar app_config={layout}/>
182
182
  </div>
@@ -188,13 +188,13 @@
188
188
  <!--## MAIN SIDE BAR ##################-->
189
189
  <!--#######################################################-->
190
190
  {#if true}
191
- {@const sidebar_left = $sidebar_left_pos==0 ? "left-0" : "left-[40px]"}
192
- {@const sidebar_small_width = $sidebar_left_pos==0 ? "w-full" : "w-[calc(100vw-40px)]"}
191
+ {@const sidebar_left = $sidebar_left_pos==0 ? "left-0" : "left-[50px]"}
192
+ {@const sidebar_small_width = $sidebar_left_pos==0 ? "w-full" : "w-[calc(100vw-50px)]"}
193
193
 
194
194
  <div class="{main_side_panel_visibility}
195
195
  {sidebar_left} sm:left-[40px]
196
- top-[40px] sm:top-0
197
- h-[calc(100vh-40px)] sm:h-full {lg_main_sidebar_height}
196
+ top-[50px] sm:top-0
197
+ h-[calc(100vh-50px)] sm:h-full {lg_main_sidebar_height}
198
198
  {sidebar_small_width} sm:w-[320px]
199
199
  z-20 overflow-x-hidden">
200
200
 
@@ -256,6 +256,14 @@
256
256
 
257
257
  </div>
258
258
 
259
+ <!-- #########################################################-->
260
+ <!-- ## MODAL DIALOG #########################################-->
261
+ <!-- #########################################################-->
262
+ <div id="__hd_svelte_modal_root" class="z-30">
263
+ <!-- after <Modal/> component is shown it's rettached to above div
264
+ see: modal.svelte afterUpdate -->
265
+ </div>
266
+
259
267
  </section>
260
268
 
261
269
  </div>
@@ -197,23 +197,23 @@
197
197
  </script>
198
198
 
199
199
  <div class="flex flex-row w-full">
200
- <div class="flex-none left-0 flex h-10">
201
- <button class="w-10 h-full flex justify-center items-center text-slate-300 hover:text-slate-100" on:click={toggle_navigator}>
202
- <Icon size={6} component={icon}/>
200
+ <div class="flex-none left-0 flex h-12 sm:h-10">
201
+ <button class="w-12 sm:w-10 h-full flex justify-center items-center text-slate-300 hover:text-slate-100" on:click={toggle_navigator}>
202
+ <Icon class="w-8 sm:w-6 h-8 sm:h-6" component={icon}/>
203
203
  </button>
204
204
  </div>
205
205
 
206
206
  <div class="grow">
207
207
 
208
- <div class="block sm:hidden mt-3 uppercase text-sm text-center">{@html title}</div>
208
+ <div class="block sm:hidden mt-4 sm:mt-3 uppercase text-sm text-center">{@html title}</div>
209
209
  </div>
210
210
 
211
- <div class="flex-none ml-auto flex h-10">
211
+ <div class="flex-none ml-auto flex h-12 sm:h-10">
212
212
  <button
213
- class="h-full w-10 px-0 flex justify-center items-center text-slate-300 hover:text-slate-100"
213
+ class="h-full w-12 sm:w-10 px-0 flex justify-center items-center text-slate-300 hover:text-slate-100"
214
214
  on:click={show_options}>
215
215
 
216
- <Icon size={4} component={FaCog} />
216
+ <Icon class="w-5 sm:w-4 h-5 sm:h-4" component={FaCog} />
217
217
  </button>
218
218
  </div>
219
219
 
package/modal.svelte CHANGED
@@ -1,4 +1,5 @@
1
- <script>import Icon from "./components/icon.svelte";
1
+ <script>import { afterUpdate, onMount, tick } from "svelte";
2
+ import Icon from "./components/icon.svelte";
2
3
  export let title = "";
3
4
  export let open = false;
4
5
  export let content = "";
@@ -15,6 +16,18 @@ export function show(on_close_callback = void 0) {
15
16
  open = true;
16
17
  close_callback = on_close_callback;
17
18
  }
19
+ let root;
20
+ afterUpdate(
21
+ async () => {
22
+ if (!!root) {
23
+ let modal_root = document.getElementById("__hd_svelte_modal_root");
24
+ if (!!modal_root && root.parentElement != modal_root) {
25
+ await tick();
26
+ modal_root.appendChild(root);
27
+ }
28
+ }
29
+ }
30
+ );
18
31
  let close_callback = void 0;
19
32
  function on_ok(event) {
20
33
  if (on_ok_callback)
@@ -32,7 +45,7 @@ function on_cancel(event) {
32
45
  </script>
33
46
 
34
47
  {#if open}
35
- <div class="relative z-20" aria-labelledby="modal-title" role="dialog" aria-modal="true">
48
+ <div class="relative z-20" aria-labelledby="modal-title" role="dialog" aria-modal="true" bind:this={root}>
36
49
  <!--
37
50
  Background backdrop, show/hide based on modal state.
38
51
 
@@ -43,9 +56,9 @@ function on_cancel(event) {
43
56
  From: "opacity-100"
44
57
  To: "opacity-0"
45
58
  -->
46
- <div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
59
+ <div class="fixed w-screen h-screen inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
47
60
 
48
- <div class="fixed inset-0 z-20 w-screen overflow-y-auto">
61
+ <div class="fixed z-20 inset-0 w-screen overflow-y-auto">
49
62
  <div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
50
63
  <!--
51
64
  Modal panel, show/hide based on modal state.
@@ -57,7 +70,8 @@ function on_cancel(event) {
57
70
  From: "opacity-100 translate-y-0 sm:scale-100"
58
71
  To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
59
72
  -->
60
- <div class="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
73
+ <div class=" transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all
74
+ sm:my-8 w-full sm:max-w-lg">
61
75
  <div class="bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
62
76
  <div class="sm:flex sm:items-start">
63
77
  <div class="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "0.4.43",
3
+ "version": "0.4.45",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
@@ -75,6 +75,8 @@
75
75
  "./components/input.text.svelte": "./components/input.text.svelte",
76
76
  "./components/inputbox.ltop.svelte": "./components/inputbox.ltop.svelte",
77
77
  "./components/list/List": "./components/list/List.js",
78
+ "./components/list/internal/list.element.props.svelte": "./components/list/internal/list.element.props.svelte",
79
+ "./components/list/internal/list.element.summary.svelte": "./components/list/internal/list.element.summary.svelte",
78
80
  "./components/list/internal/list.element.svelte": "./components/list/internal/list.element.svelte",
79
81
  "./components/list/internal/list.inserter.svelte": "./components/list/internal/list.inserter.svelte",
80
82
  "./components/list/list.combo.svelte": "./components/list/list.combo.svelte",
package/utils.js CHANGED
@@ -162,7 +162,7 @@ export function editable(node, action)
162
162
  node.contentEditable = "true"
163
163
  node.addEventListener("blur", blur_listener);
164
164
  node.addEventListener("keydown", key_listener);
165
-
165
+
166
166
  node.focus();
167
167
 
168
168
  await tick();
@@ -172,6 +172,8 @@ export function editable(node, action)
172
172
  let end_container = range.endContainer;
173
173
  range.setStart(end_container, end_offset)
174
174
  range.setEnd(end_container, end_offset)
175
+ //range.setStart(node, 0)
176
+ //range.setEnd(node, 0)
175
177
  // console.log('range rect: ', range.getBoundingClientRect())
176
178
  let sel = window.getSelection();
177
179
  sel.removeAllRanges();