@humandialog/forms.svelte 0.4.13 → 0.4.15

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.
Files changed (49) hide show
  1. package/components/Floating_container.svelte +43 -10
  2. package/components/Floating_container.svelte.d.ts +4 -2
  3. package/components/Grid.menu.svelte +5 -3
  4. package/components/Grid.menu.svelte.d.ts +2 -2
  5. package/components/combo/combo.d.ts +2 -0
  6. package/components/combo/combo.js +2 -0
  7. package/components/combo/combo.source.svelte +6 -2
  8. package/components/combo/combo.source.svelte.d.ts +3 -1
  9. package/components/combo/combo.svelte +127 -83
  10. package/components/combo/combo.svelte.d.ts +5 -0
  11. package/components/contextmenu.svelte +23 -9
  12. package/components/contextmenu.svelte.d.ts +4 -2
  13. package/components/date.svelte +142 -25
  14. package/components/date.svelte.d.ts +7 -0
  15. package/components/list/List.d.ts +28 -0
  16. package/components/list/List.js +34 -0
  17. package/components/list/internal/list.element.svelte +295 -0
  18. package/components/list/internal/list.element.svelte.d.ts +29 -0
  19. package/components/list/internal/list.inserter.svelte +20 -0
  20. package/components/list/internal/list.inserter.svelte.d.ts +18 -0
  21. package/components/list/list.combo.svelte +20 -0
  22. package/components/list/list.combo.svelte.d.ts +21 -0
  23. package/components/list/list.date.svelte +14 -0
  24. package/components/list/list.date.svelte.d.ts +18 -0
  25. package/components/list/list.inserter.svelte +6 -0
  26. package/components/list/list.inserter.svelte.d.ts +16 -0
  27. package/components/list/list.summary.svelte +7 -0
  28. package/components/list/list.summary.svelte.d.ts +17 -0
  29. package/components/list/list.svelte +148 -0
  30. package/components/list/list.svelte.d.ts +41 -0
  31. package/components/list/list.title.svelte +7 -0
  32. package/components/list/list.title.svelte.d.ts +17 -0
  33. package/components/menu.d.ts +3 -3
  34. package/components/menu.js +20 -10
  35. package/components/sidebar/sidebar.item.svelte +27 -15
  36. package/components/sidebar/sidebar.item.svelte.d.ts +3 -0
  37. package/components/table/table.svelte +1 -1
  38. package/desk.svelte +67 -35
  39. package/horizontal.toolbar.svelte +11 -5
  40. package/index.d.ts +10 -3
  41. package/index.js +11 -3
  42. package/operations.svelte +11 -5
  43. package/operations.svelte.d.ts +3 -1
  44. package/package.json +11 -2
  45. package/page.svelte +8 -2
  46. package/stores.js +4 -3
  47. package/utils.d.ts +8 -0
  48. package/utils.js +59 -9
  49. package/vertical.toolbar.svelte +11 -4
@@ -1,60 +1,105 @@
1
1
  <script>import { getContext } from "svelte";
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
- import { parse_width_directive } from "../utils.js";
4
+ import { parse_width_directive, is_device_smaller_than } from "../utils.js";
5
5
  export let self = null;
6
6
  export let a = "";
7
7
  export let context = "";
8
8
  export let typename = "";
9
9
  export let date = null;
10
+ export let on_select = void 0;
11
+ export let type = "date";
12
+ export let changed = void 0;
10
13
  export let s = "sm";
11
14
  export let c = "";
12
- let is_table_component = getContext("rIs-table-component");
15
+ export let compact = false;
16
+ export let in_context = "sel";
17
+ let on_hide_callback = void 0;
18
+ export function show(event, hide_callback) {
19
+ if (event) {
20
+ event.stopPropagation();
21
+ event.preventDefault();
22
+ }
23
+ if (!!hide_callback)
24
+ on_hide_callback = hide_callback;
25
+ else
26
+ on_hide_callback = void 0;
27
+ if (input_element) {
28
+ input_element.focus();
29
+ if (is_device_smaller_than("sm")) {
30
+ input_element.click();
31
+ }
32
+ if ("showPicker" in HTMLInputElement.prototype) {
33
+ input_element.showPicker();
34
+ }
35
+ }
36
+ }
37
+ let is_compact = getContext("rIs-table-component") || compact;
13
38
  let input_pt = "pt-0.5";
14
39
  let input_pb = "pb-1";
40
+ let font_size = "text-sm";
41
+ let line_h = "h-4";
15
42
  switch (s) {
16
43
  case "md":
17
44
  input_pt = "pt-2.5";
18
45
  input_pb = "pb-2.5";
46
+ font_size = "text-sm";
47
+ line_h = "h-5";
48
+ break;
49
+ case "xs":
50
+ input_pt = "pt-0.5";
51
+ input_pb = "pb-0.5";
52
+ font_size = "text-xs";
53
+ line_h = "h-4";
19
54
  break;
20
55
  }
21
56
  let item = null;
22
- let additional_class = $$restProps.class ?? "";
57
+ let user_class = $$restProps.class ?? "";
23
58
  let value = null;
24
59
  let rValue = "";
25
60
  let ctx = context ? context : getContext("ctx");
26
61
  let cs = parse_width_directive(c);
27
62
  let style;
28
- if (!is_table_component) {
63
+ let input_element = void 0;
64
+ let background_class = is_compact ? "bg-slate-900/10 dark:bg-slate-100/10 rounded-lg" : "";
65
+ if (!is_compact) {
29
66
  style = `bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg
30
67
  focus:ring-primary-600 focus:border-primary-600 block w-full ${input_pb} ${input_pt} px-2.5 dark:bg-gray-700
31
68
  dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500`;
32
69
  } else {
33
- style = `bg-transparent text-sm block w-full ${input_pb} ${input_pt} px-2.5`;
70
+ style = `${font_size}`;
34
71
  }
35
72
  let can_be_activated = true;
36
73
  let last_tick = -1;
37
74
  $:
38
- setup($data_tick_store);
39
- function setup(data_tick_store2) {
40
- if (data_tick_store2 <= last_tick)
41
- return;
42
- last_tick = data_tick_store2;
75
+ setup($data_tick_store, $context_items_store);
76
+ function setup(...args) {
77
+ last_tick = data_tick_store;
43
78
  if (!date) {
44
79
  item = self ?? $context_items_store[ctx];
45
80
  if (!typename)
46
81
  typename = $context_types_store[ctx];
82
+ if (!typename) {
83
+ if (item.$type)
84
+ typename = item.$type;
85
+ else if (item.$ref) {
86
+ let s2 = item.$ref.split("/");
87
+ typename = s2[0];
88
+ }
89
+ }
47
90
  if (!item[a])
48
91
  value = null;
49
92
  else
50
93
  value = new Date(item[a]);
51
94
  } else
52
95
  value = date;
53
- if (is_table_component) {
54
- if ($context_items_store["sel"] != self)
55
- can_be_activated = false;
56
- else
57
- can_be_activated = true;
96
+ if (is_compact) {
97
+ can_be_activated = false;
98
+ let contexts = in_context.split(" ");
99
+ contexts.forEach((ctx2) => {
100
+ if ($context_items_store[ctx2] == item)
101
+ can_be_activated = true;
102
+ });
58
103
  } else
59
104
  can_be_activated = true;
60
105
  rValue = get_formatted_date(value);
@@ -75,14 +120,19 @@ function get_formatted_date(d) {
75
120
  hour = "0" + hour;
76
121
  if (minutes.length < 2)
77
122
  minutes = "0" + minutes;
78
- return `${year}-${month}-${day} ${hour}:${minutes}`;
123
+ if (type == "datetime-local")
124
+ return `${year}-${month}-${day} ${hour}:${minutes}`;
125
+ else
126
+ return `${year}-${month}-${day}`;
79
127
  }
80
- function on_changed() {
128
+ async function on_changed() {
81
129
  if (!rValue)
82
130
  value = null;
83
131
  else
84
132
  value = new Date(rValue);
85
- if (item != null) {
133
+ if (on_select) {
134
+ await on_select(value);
135
+ } else if (item != null) {
86
136
  if (value)
87
137
  item[a] = value.toISOString();
88
138
  else
@@ -92,22 +142,89 @@ function on_changed() {
92
142
  $data_tick_store = $data_tick_store + 1;
93
143
  push_changes();
94
144
  }
145
+ if (!!changed)
146
+ changed(value);
95
147
  }
96
148
  }
149
+ function blur(e) {
150
+ if (!!on_hide_callback)
151
+ on_hide_callback();
152
+ }
97
153
  </script>
98
154
 
99
- {#if !can_be_activated}
100
- <span class="{style} ml-0.5 h-7" >{rValue}</span>
155
+ {#if is_compact}
156
+ <div class="inline-block relative {line_h}">
157
+ <span class="dark:text-white {font_size} truncate px-2.5 {background_class}
158
+ absolute left-0 top-0 h-full" >
159
+ {rValue}
160
+
161
+ {#if can_be_activated}
162
+ {#if type == "datetime-local"}
163
+ <input type="datetime-local"
164
+ class="datepicker-input"
165
+ on:change={on_changed}
166
+ bind:value={rValue}
167
+ bind:this={input_element}>
168
+ {:else}
169
+ <input type="date"
170
+ class="datepicker-input"
171
+ on:change={on_changed}
172
+ bind:value={rValue}
173
+ bind:this={input_element}
174
+ on:blur={blur}>
175
+ {/if}
176
+ {/if}
177
+ </span>
178
+ </div>
179
+
101
180
  {:else}
102
- <input class=" {cs} {style} {additional_class}"
103
- type="datetime-local"
104
- on:change={on_changed}
105
- bind:value={rValue}/>
181
+ {#if type == "datetime-local"}
182
+ <input class=" dark:text-white {cs} {style} {line_h} px-2.5 {background_class} {user_class}"
183
+ type="datetime-local"
184
+ on:change={on_changed}
185
+ bind:value={rValue}
186
+ bind:this={input_element}
187
+ />
188
+ {:else}
189
+ <input class=" dark:text-white {cs} {style} {line_h} px-2.5 {background_class} {user_class}"
190
+ type="date"
191
+ on:change={on_changed}
192
+ bind:value={rValue}
193
+ bind:this={input_element}
194
+ />
195
+ {/if}
106
196
  {/if}
107
197
 
108
198
 
199
+
200
+
201
+
109
202
  <style>
110
203
  input:focus {
111
204
  outline: 0px solid transparent;
112
205
  }
113
- </style>
206
+
207
+ .datepicker-input{
208
+ position: absolute;
209
+ left: 0;
210
+ top: 0;
211
+ width: 100%;
212
+ height: 100%;
213
+ opacity: 0;
214
+ cursor: pointer;
215
+ box-sizing: border-box;
216
+ }
217
+
218
+ .datepicker-input::-webkit-calendar-picker-indicator {
219
+ position: absolute;
220
+ left: 0;
221
+ top: 0;
222
+ width: 100%;
223
+ height: 100%;
224
+ margin: 0;
225
+ padding: 0;
226
+ cursor: pointer;
227
+ }
228
+
229
+ </style>
230
+
@@ -7,8 +7,14 @@ declare const __propDef: {
7
7
  context?: string | undefined;
8
8
  typename?: string | undefined;
9
9
  date?: Date | undefined;
10
+ on_select?: undefined;
11
+ type?: string | undefined;
12
+ changed?: undefined;
10
13
  s?: string | undefined;
11
14
  c?: string | undefined;
15
+ compact?: boolean | undefined;
16
+ in_context?: string | undefined;
17
+ show?: ((event: any, hide_callback: any) => void) | undefined;
12
18
  };
13
19
  events: {
14
20
  [evt: string]: CustomEvent<any>;
@@ -19,5 +25,6 @@ export type DateProps = typeof __propDef.props;
19
25
  export type DateEvents = typeof __propDef.events;
20
26
  export type DateSlots = typeof __propDef.slots;
21
27
  export default class Date extends SvelteComponentTyped<DateProps, DateEvents, DateSlots> {
28
+ get show(): (event: any, hide_callback: any) => void;
22
29
  }
23
30
  export {};
@@ -0,0 +1,28 @@
1
+ import { rCombo_definition } from '../combo/combo';
2
+ export declare enum rList_property_type {
3
+ Hidden = 0,
4
+ Text = 1,
5
+ Date = 2,
6
+ Combo = 3
7
+ }
8
+ export declare class rList_property {
9
+ constructor(type: rList_property_type);
10
+ type: rList_property_type;
11
+ name: string;
12
+ a: string;
13
+ on_select: Function | undefined;
14
+ }
15
+ export declare class rList_property_combo extends rList_property {
16
+ constructor();
17
+ association: boolean;
18
+ combo_definition: rCombo_definition;
19
+ }
20
+ export declare class rList_definition {
21
+ title: string;
22
+ title_editable: boolean;
23
+ summary: string;
24
+ summary_editable: boolean;
25
+ can_insert: boolean;
26
+ oninsert: Function | undefined;
27
+ properties: rList_property[];
28
+ }
@@ -0,0 +1,34 @@
1
+ import { rCombo_definition } from '../combo/combo';
2
+ export var rList_property_type;
3
+ (function (rList_property_type) {
4
+ rList_property_type[rList_property_type["Hidden"] = 0] = "Hidden";
5
+ rList_property_type[rList_property_type["Text"] = 1] = "Text";
6
+ rList_property_type[rList_property_type["Date"] = 2] = "Date";
7
+ rList_property_type[rList_property_type["Combo"] = 3] = "Combo";
8
+ })(rList_property_type || (rList_property_type = {}));
9
+ export class rList_property {
10
+ constructor(type) {
11
+ this.type = type;
12
+ }
13
+ type = rList_property_type.Hidden;
14
+ name = '';
15
+ a = '';
16
+ on_select = undefined;
17
+ }
18
+ export class rList_property_combo extends rList_property {
19
+ constructor() {
20
+ super(rList_property_type.Combo);
21
+ this.combo_definition = new rCombo_definition;
22
+ }
23
+ association = false;
24
+ combo_definition;
25
+ }
26
+ export class rList_definition {
27
+ title = '';
28
+ title_editable = false;
29
+ summary = '';
30
+ summary_editable = false;
31
+ can_insert = false;
32
+ oninsert = undefined;
33
+ properties = [];
34
+ }
@@ -0,0 +1,295 @@
1
+ <script>import { tick, getContext } from "svelte";
2
+ import { context_items_store } from "../../../stores";
3
+ import {
4
+ is_selected,
5
+ selectable,
6
+ activate_item,
7
+ is_active,
8
+ editable,
9
+ start_editing
10
+ } from "../../../utils";
11
+ import { show_grid_menu, show_menu } from "../../menu";
12
+ import { push_changes, inform_modification } from "../../../updates";
13
+ import Combo from "../../combo/combo.svelte";
14
+ import DatePicker from "../../date.svelte";
15
+ import { rList_definition, rList_property_type } from "../List";
16
+ export let item;
17
+ export let title = "";
18
+ export let summary = "";
19
+ export let typename = void 0;
20
+ export let toolbar_operations;
21
+ export let context_menu;
22
+ let definition = getContext("rList-definition");
23
+ let placeholder = "";
24
+ let props = [];
25
+ $:
26
+ is_row_active = calculate_active(item, $context_items_store);
27
+ $:
28
+ is_row_selected = selected(item, $context_items_store);
29
+ $:
30
+ selected_class = is_row_selected ? "!border-blue-300" : "";
31
+ $:
32
+ focused_class = is_row_active ? "bg-gray-200 dark:bg-gray-700" : "";
33
+ if (!typename) {
34
+ if (item.$type)
35
+ typename = item.$type;
36
+ else if (item.$ref) {
37
+ let s = item.$ref.split("/");
38
+ typename = s[0];
39
+ }
40
+ }
41
+ if (!title)
42
+ title = definition.title;
43
+ if (!summary)
44
+ summary = definition.summary;
45
+ function calculate_active(...args) {
46
+ return is_active("props", item);
47
+ }
48
+ function selected(...args) {
49
+ return is_selected(item);
50
+ }
51
+ async function change_name(text) {
52
+ item[title] = text;
53
+ inform_modification(item, title, typename);
54
+ push_changes();
55
+ }
56
+ async function change_summary(text) {
57
+ item[summary] = text;
58
+ inform_modification(item, summary, typename);
59
+ push_changes();
60
+ }
61
+ function edit(e) {
62
+ if (!is_row_active)
63
+ return;
64
+ start_editing(e.target);
65
+ }
66
+ export function activate() {
67
+ activate_row(null, item);
68
+ }
69
+ function activate_row(e, item2) {
70
+ if (is_row_active) {
71
+ let can_show_context_menu = true;
72
+ let n = e.target;
73
+ while (n) {
74
+ let is_in_cell = n.getAttribute("role") == "gridcell";
75
+ if (is_in_cell) {
76
+ can_show_context_menu = false;
77
+ break;
78
+ }
79
+ n = n.parentElement;
80
+ }
81
+ if (can_show_context_menu && context_menu) {
82
+ const pt = new DOMPoint(e.clientX, e.clientY);
83
+ let context_operations = context_menu(item2);
84
+ if (context_operations !== null) {
85
+ if (typeof context_operations === "object") {
86
+ if (Array.isArray(context_operations))
87
+ show_menu(pt, context_operations);
88
+ else if (context_operations.grid)
89
+ show_grid_menu(pt, context_operations.grid);
90
+ }
91
+ }
92
+ }
93
+ }
94
+ activate_item("props", item2, toolbar_operations(item2));
95
+ if (e)
96
+ e.stopPropagation();
97
+ }
98
+ function on_contextmenu(e) {
99
+ if (!context_menu)
100
+ return;
101
+ const pt = new DOMPoint(e.clientX, e.clientY);
102
+ let context_operations = context_menu(item);
103
+ if (context_operations !== null) {
104
+ if (typeof context_operations === "object") {
105
+ if (Array.isArray(context_operations))
106
+ show_menu(pt, context_operations);
107
+ else if (context_operations.grid)
108
+ show_grid_menu(pt, context_operations.grid);
109
+ }
110
+ }
111
+ e.preventDefault();
112
+ }
113
+ function on_date_changed(value, a) {
114
+ if (!value)
115
+ item[a] = "";
116
+ else
117
+ item[a] = value.toJSON();
118
+ }
119
+ function on_combo_changed(key, name, prop) {
120
+ if (prop.association) {
121
+ let iname = prop.combo_definition.element_name ?? "$display";
122
+ item[prop.a] = {
123
+ $ref: key,
124
+ [iname]: name
125
+ };
126
+ } else {
127
+ let value = key ?? name;
128
+ item[prop.a] = value;
129
+ }
130
+ }
131
+ export function edit_property(field) {
132
+ if (field == "Summary")
133
+ force_editing("Summary");
134
+ else {
135
+ let prop_idx = definition.properties.findIndex((p) => p.name == field);
136
+ if (prop_idx < 0)
137
+ return;
138
+ let property = definition.properties[prop_idx];
139
+ switch (property.type) {
140
+ case rList_property_type.Date:
141
+ edit_date(field, prop_idx);
142
+ break;
143
+ case rList_property_type.Combo:
144
+ edit_combo(field, prop_idx);
145
+ break;
146
+ }
147
+ }
148
+ }
149
+ async function force_editing(field) {
150
+ let element_id = `__hd_list_ctrl_${item.Id}_${field}`;
151
+ let element_node = document.getElementById(element_id);
152
+ if (!element_node) {
153
+ placeholder = field;
154
+ await tick();
155
+ element_node = document.getElementById(element_id);
156
+ if (!element_node)
157
+ return;
158
+ }
159
+ if (!element_node.classList.contains("editable")) {
160
+ return;
161
+ }
162
+ start_editing(element_node, () => {
163
+ placeholder = "";
164
+ });
165
+ }
166
+ async function edit_combo(field, prop_idx) {
167
+ let combo = props[prop_idx];
168
+ if (!!combo)
169
+ combo.show();
170
+ else {
171
+ placeholder = field;
172
+ await tick();
173
+ combo = props[prop_idx];
174
+ if (!!combo)
175
+ combo.show(void 0, () => {
176
+ placeholder = "";
177
+ });
178
+ }
179
+ }
180
+ async function edit_date(field, prop_idx) {
181
+ let combo = props[prop_idx];
182
+ if (!!combo)
183
+ combo.show();
184
+ else {
185
+ placeholder = field;
186
+ await tick();
187
+ combo = props[prop_idx];
188
+ if (!!combo)
189
+ combo.show(void 0, () => {
190
+ placeholder = "";
191
+ });
192
+ }
193
+ }
194
+ </script>
195
+
196
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
197
+ <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 {selected_class} {focused_class}"
198
+ on:contextmenu={on_contextmenu}
199
+ role="menu"
200
+ tabindex="-1">
201
+
202
+ <slot name="left" element={item}/>
203
+
204
+ <div class="ml-3 w-full py-1" use:selectable={item} on:click={(e) => {activate_row(e, item)}} role="row" tabindex="0">
205
+ <div class="flex flex-row">
206
+ <p class="font-bold whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3">
207
+ <span id="__hd_list_ctrl_{item.Id}_Title" role="gridcell" tabindex="0"
208
+ use:editable={(text) => {change_name(text)}}
209
+ on:click={edit}>
210
+ {item[title]}
211
+ </span>
212
+ </p>
213
+
214
+ <!--div class="flex flex-row justify-between text-xs flex-none w-1/2 sm:w-2/3"-->
215
+ <div class="text-xs flex-none w-1/2 sm:w-2/3 grid-{definition.properties.length}">
216
+ {#each definition.properties as prop, prop_index}
217
+ <p class="col-span-1 w-full mr-auto">
218
+ {#if item[prop.a] || placeholder == prop.name}
219
+ <span role="gridcell" tabindex="0">
220
+ {#if prop.type == rList_property_type.Date}
221
+ <DatePicker self={item}
222
+ a={prop.a}
223
+ compact={true}
224
+ on_select={prop.on_select}
225
+ s="xs"
226
+ in_context="props sel"
227
+ bind:this={props[prop_index]}
228
+ changed={(value)=>{on_date_changed(value, prop.a)}}
229
+ />
230
+ {:else if prop.type == rList_property_type.Combo}
231
+ <Combo self={item}
232
+ in_context="props sel"
233
+ compact={true}
234
+ a={prop.a}
235
+ on_select={prop.on_select}
236
+ is_association={prop.association}
237
+ icon={false}
238
+ bind:this={props[prop_index]}
239
+ definition={prop.combo_definition}
240
+ changed={(key,name)=>{on_combo_changed(key, name, prop)}}
241
+ s='xs'/>
242
+ {/if}
243
+ </span>
244
+ {/if}
245
+ </p>
246
+ {/each}
247
+ </div>
248
+ </div>
249
+
250
+ {#if summary && (item[summary] || placeholder=='Summary')}
251
+ {@const element_id = `__hd_list_ctrl_${item.Id}_Summary`}
252
+ <p class="text-xs text-slate-400" style="min-height: 1rem;">
253
+ {#if item[summary]}
254
+ <span id={element_id} role="gridcell" tabindex="0"
255
+ use:editable={(text) => {change_summary(text)}}
256
+ on:click={edit}>
257
+ {item[summary]}
258
+ </span>
259
+ {:else if placeholder == 'Summary'}
260
+ <span id={element_id}
261
+ use:editable={(text) => {change_summary(text)}}>
262
+ </span>
263
+ {/if}
264
+
265
+ </p>
266
+ {/if}
267
+ </div>
268
+ </section>
269
+
270
+ <style>
271
+ .grid-1
272
+ {
273
+ display: grid;
274
+ grid-template-columns: 100%;
275
+ }
276
+
277
+ .grid-2
278
+ {
279
+ display: grid;
280
+ grid-template-columns: 50% 50%;
281
+ }
282
+
283
+ .grid-3
284
+ {
285
+ display: grid;
286
+ grid-template-columns: 33% 33% 33%;
287
+ }
288
+
289
+ .grid-4
290
+ {
291
+ display: grid;
292
+ grid-template-columns: 25% 25% 25% 25%;
293
+ }
294
+
295
+ </style>
@@ -0,0 +1,29 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ item: object;
5
+ title?: string | undefined;
6
+ summary?: string | undefined;
7
+ typename?: string | undefined;
8
+ toolbar_operations: any;
9
+ context_menu: any;
10
+ activate?: (() => void) | undefined;
11
+ edit_property?: ((field: string) => void) | undefined;
12
+ };
13
+ events: {
14
+ [evt: string]: CustomEvent<any>;
15
+ };
16
+ slots: {
17
+ left: {
18
+ element: object;
19
+ };
20
+ };
21
+ };
22
+ export type ListProps = typeof __propDef.props;
23
+ export type ListEvents = typeof __propDef.events;
24
+ export type ListSlots = typeof __propDef.slots;
25
+ export default class List extends SvelteComponentTyped<ListProps, ListEvents, ListSlots> {
26
+ get activate(): () => void;
27
+ get edit_property(): (field: string) => void;
28
+ }
29
+ export {};
@@ -0,0 +1,20 @@
1
+ <script>import { start_editing } from "../../../utils";
2
+ import Icon from "../../icon.svelte";
3
+ import { FaRegCircle } from "svelte-icons/fa";
4
+ export let oninsert;
5
+ export function run(onclose) {
6
+ start_editing(insertion_paragraph, onclose);
7
+ }
8
+ let insertion_paragraph;
9
+ </script>
10
+
11
+ <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
+ <Icon size={4}
13
+ component={FaRegCircle}
14
+ class="cursor-pointer mt-1.5 ml-2 "/>
15
+
16
+ <p class="ml-3 py-1 font-bold whitespace-nowrap overflow-clip flex-none w-1/2 sm:w-1/3"
17
+ bind:this={insertion_paragraph}
18
+ use:editable={oninsert} >
19
+ </p>
20
+ </section>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ oninsert: any;
5
+ run?: ((onclose: any) => void) | undefined;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type ListProps = typeof __propDef.props;
13
+ export type ListEvents = typeof __propDef.events;
14
+ export type ListSlots = typeof __propDef.slots;
15
+ export default class List extends SvelteComponentTyped<ListProps, ListEvents, ListSlots> {
16
+ get run(): (onclose: any) => void;
17
+ }
18
+ export {};