@humandialog/forms.svelte 0.4.44 → 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.
@@ -59,7 +59,7 @@ switch (s) {
59
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
 
@@ -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 = "";
@@ -57,11 +58,11 @@ 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}
@@ -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,89 +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=" text-lg font-semibold min-h-[1.75rem]
239
- sm:text-sm sm:font-semibold sm:min-h-[1.25rem]
240
- whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3">
241
- {#if definition.title_readonly}
242
- <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">
243
197
  {element_title}
244
- </span>
245
- {:else}
246
- {#key item[title]} <!-- Wymusza pełne wyrenderowanie zwłasza po zmiane z pustego na tekst -->
247
- <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"
248
205
  use:editable={(text) => {change_name(text)}}
249
206
  on:click={edit}>
250
207
  {element_title}
251
- </span>
252
- {/key}
253
- {/if}
254
- </p>
255
-
256
- <!--div class="flex flex-row justify-between text-xs flex-none w-1/2 sm:w-2/3"-->
257
- <div class="text-xs flex-none w-1/2 sm:w-2/3 grid-{definition.properties.length}">
258
- {#each definition.properties as prop, prop_index}
259
- <p class="col-span-1 w-full mr-auto mt-0.5">
260
- {#if item[prop.a] || placeholder == prop.name}
261
- <span role="gridcell" tabindex="0">
262
- {#if prop.type == rList_property_type.Date}
263
- <DatePicker self={item}
264
- a={prop.a}
265
- compact={true}
266
- on_select={prop.on_select}
267
- s="xs"
268
- in_context="props sel"
269
- bind:this={props[prop_index]}
270
- changed={(value)=>{on_date_changed(value, prop.a)}}
271
- />
272
- {:else if prop.type == rList_property_type.Combo}
273
- <Combo self={item}
274
- in_context="props sel"
275
- compact={true}
276
- a={prop.a}
277
- on_select={prop.on_select}
278
- is_association={prop.association}
279
- icon={false}
280
- bind:this={props[prop_index]}
281
- definition={prop.combo_definition}
282
- changed={(key,name)=>{on_combo_changed(key, name, prop)}}
283
- s='xs'/>
284
- {:else if prop.type == rList_property_type.Static}
285
- <span class="dark:text-white text-gray-400 truncate px-2.5 bg-slate-900/10 dark:bg-slate-100/10 rounded-lg">
286
- {item[prop.a]}
287
- </span>
288
- {/if}
289
- </span>
290
- {/if}
291
208
  </p>
292
- {/each}
293
- </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>
294
216
  </div>
295
217
 
296
218
  {#if summary && (item[summary] || placeholder=='Summary')}
297
219
  {@const element_id = `__hd_list_ctrl_${item[item_key]}_Summary`}
298
- <p class=" sm:text-xs sm:min-h-[1rem]
299
- text-base min-h-[1.5rem]
300
- text-slate-400 "
301
- on:click={(e) => edit_row_property(e, 'bottom')}>
302
- {#if definition.summary_readonly}
303
- <span id={element_id} role="gridcell" tabindex="0">
304
- {item[summary]}
305
- </span>
306
- {:else if item[summary]}
307
- <span id={element_id} role="gridcell" tabindex="0"
308
- use:editable={(text) => {change_summary(text)}}
309
- on:click={edit}>
310
- {item[summary]}
311
- </span>
312
- {:else if placeholder == 'Summary'}
313
- <span id={element_id}
314
- use:editable={(text) => {change_summary(text)}}>
315
- </span>
316
- {/if}
317
-
318
- </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
+ />
319
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
+
320
235
  </div>
321
236
  </section>
322
237
  {/if}
@@ -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"-->
@@ -205,7 +205,7 @@
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
211
  <div class="flex-none ml-auto flex h-12 sm:h-10">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "0.4.44",
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();