@humandialog/forms.svelte 1.6.1 → 1.6.3

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.
@@ -1094,15 +1094,15 @@ const paletteInsertCommands = () => [
1094
1094
  ];
1095
1095
  const paletteCommands = [
1096
1096
  {
1097
- caption: i18n({ en: "Text", es: "Texto", pl: "Tekst" }),
1097
+ caption: i18n({ en: "Styles", es: "Estilos", pl: "Style" }),
1098
1098
  separator: true
1099
1099
  },
1100
- ...paletteMarksCommands(),
1100
+ ...paletteStylesCommands(),
1101
1101
  {
1102
- caption: i18n({ en: "Styles", es: "Estilos", pl: "Style" }),
1102
+ caption: i18n({ en: "Text", es: "Texto", pl: "Tekst" }),
1103
1103
  separator: true
1104
1104
  },
1105
- ...paletteStylesCommands(),
1105
+ ...paletteMarksCommands(),
1106
1106
  {
1107
1107
  caption: i18n({ en: "Insert", es: "Insertar", pl: "Wstaw" }),
1108
1108
  separator: true
@@ -1162,10 +1162,10 @@ function getPaletteCommands() {
1162
1162
  });
1163
1163
  commands.push({ separator: true });
1164
1164
  }
1165
- commands = [...commands, { caption: i18n({ en: "Text", es: "Texto", pl: "Tekst" }), separator: true }];
1166
- commands = [...commands, ...paletteMarksCommands()];
1167
1165
  commands = [...commands, { caption: i18n({ en: "Styles", es: "Estilos", pl: "Style" }), separator: true }];
1168
1166
  commands = [...commands, ...paletteStylesCommands()];
1167
+ commands = [...commands, { caption: i18n({ en: "Text", es: "Texto", pl: "Tekst" }), separator: true }];
1168
+ commands = [...commands, ...paletteMarksCommands()];
1169
1169
  commands = [...commands, { caption: i18n({ en: "Insert", es: "Insertar", pl: "Wstaw" }), separator: true }];
1170
1170
  if (extraInsertPaletteCommands && extraInsertPaletteCommands.length > 0) {
1171
1171
  extraInsertPaletteCommands.forEach((exc) => {
@@ -29,7 +29,6 @@ export function showAsToolbox(rect) {
29
29
  toolboxY = rect.bottom + margin;
30
30
  toolboxY += window.scrollY;
31
31
  css_style = `left:${toolboxX}px; top:${toolboxY}px;`;
32
- console.log("toolbox: ", css_style);
33
32
  dispatch("palette_shown");
34
33
  }
35
34
  let paletteElement;
@@ -62,7 +61,6 @@ export function show(x, y, up = false) {
62
61
  const rect = paletteElement.getBoundingClientRect();
63
62
  closeButtonPos = `right: ${15}px; top: calc(${rect.y}px - 1.75rem)`;
64
63
  }, 0);
65
- console.trace();
66
64
  }
67
65
  export function show_fullscreen(_width_px, _height_px) {
68
66
  isToolbox = false;
@@ -319,7 +317,7 @@ function isRowActive(cmd) {
319
317
  style={css_style} >
320
318
 
321
319
  {#if filtered_commands && filtered_commands.length}
322
- {#each filtered_commands as cmd, idx (cmd.caption)}
320
+ {#each filtered_commands as cmd, idx }
323
321
  {#if cmd.separator}
324
322
  {#if idx>0 && idx<filtered_commands.length-1} <!-- not first or last place -->
325
323
  <hr class="mx-4 my-1 border-stone-300 dark:border-stone-700"/>
@@ -18,6 +18,7 @@ import { rList_definition, rList_property_type } from "../List";
18
18
  import { push, link } from "svelte-spa-router";
19
19
  import { FaExternalLinkAlt } from "svelte-icons/fa/";
20
20
  import Tags from "../../tags.svelte";
21
+ import { ext } from "../../../i18n";
21
22
  export let item;
22
23
  export let title = "";
23
24
  export let summary = "";
@@ -164,10 +165,15 @@ function getHRef() {
164
165
  return "";
165
166
  }
166
167
  function activate_row(e, item2) {
168
+ const openable = !!definition.title_href || !!definition.title_href_func;
167
169
  if (toolbarOperations) {
168
170
  activateItem("props", item2, toolbarOperations(item2));
169
171
  if (e)
170
172
  e.stopPropagation();
173
+ } else if (openable) {
174
+ activateItem("props", item2, []);
175
+ if (e)
176
+ e.stopPropagation();
171
177
  }
172
178
  }
173
179
  function on_contextmenu(e) {
@@ -250,7 +256,7 @@ export function scrollToView() {
250
256
 
251
257
  <!-- svelte-ignore a11y-click-events-have-key-events -->
252
258
  {#if item}
253
- {@const element_title = item[title]}
259
+ {@const element_title = ext(item[title])}
254
260
 
255
261
  <section class="my-1 flex flex-row w-full text-stone-900 dark:text-stone-300 cursor-default rounded-md border border-transparent {selected_class} {focused_class} scroll-mt-[50px] sm:scroll-mt-[40px]"
256
262
  role="menu"
@@ -328,8 +334,9 @@ export function scrollToView() {
328
334
  </section>
329
335
 
330
336
  {#if summary && (item[summary] || placeholder=='Summary')}
337
+ {@const summaryText = ext(item[summary])}
331
338
  {@const element_id = `__hd_list_ctrl_${getItemKey(item)}_Summary`}
332
- {#key item[summary] }
339
+ {#key summaryText }
333
340
  {#if is_row_active}
334
341
  <p id={element_id}
335
342
  class=" text-sm
@@ -340,14 +347,14 @@ export function scrollToView() {
340
347
  onFinish: (d) => {placeholder='';},
341
348
  active: true
342
349
  }}>
343
- {item[summary]}
350
+ {summaryText}
344
351
  </p>
345
352
  {:else}
346
353
  <p id={element_id}
347
354
  class=" text-sm
348
355
  text-stone-600 dark:text-stone-400"
349
356
  on:click={(e) => on_active_row_clicked(e, 'bottom')}>
350
- {item[summary]}
357
+ {summaryText}
351
358
  </p>
352
359
  {/if}
353
360
  {/key}
@@ -1,12 +1,15 @@
1
1
  <script>
2
2
  import {FaChevronDown, FaChevronUp} from 'svelte-icons/fa'
3
+ import {i18n} from '../../i18n'
4
+ import {link} from 'svelte-spa-router'
3
5
 
4
6
  export let border = false;
5
7
  export let title = ''
6
8
  export let collapsable = false;
7
9
  export let onExpand = undefined
10
+ export let moreHref = undefined
8
11
 
9
- let border_class = border ? " pt-4 mt-4 border-t border-stone-200 dark:border-stone-700" : ""
12
+ let border_class = border ? " pt-4 mt-4 border-t border-stone-200 dark:border-stone-700" : "mt-6"
10
13
  let title_border = title ? border_class : ""
11
14
  let list_border = title ? "" : border_class
12
15
  let collapsed = true;
@@ -18,21 +21,35 @@
18
21
 
19
22
  collapsed = !collapsed;
20
23
  }
24
+
25
+
26
+
21
27
  </script>
22
28
 
23
29
  {#if title}
24
- <p class="text-base sm:text-xs uppercase font-semibold {title_border}">
25
- {title}
26
- {#if collapsable}
27
- <button class="inline-block ml-3 sm:ml-2 sm:mt-0.5 w-4 sm:w-3 h-4 sm:h-3" on:click={toggleCollapsed}>
28
- {#if collapsed}
29
- <FaChevronDown/>
30
- {:else}
31
- <FaChevronUp/>
32
- {/if}
33
- </button>
30
+ <div class="w-full flex flex-row justify-between {title_border} mb-2">
31
+ <p class="text-xs uppercase font-semibold">
32
+ {title}
33
+ {#if collapsable}
34
+ <button class="inline-block ml-3 sm:ml-2 sm:mt-0.5 w-4 sm:w-3 h-4 sm:h-3" on:click={toggleCollapsed}>
35
+ {#if collapsed}
36
+ <FaChevronDown/>
37
+ {:else}
38
+ <FaChevronUp/>
39
+ {/if}
40
+ </button>
41
+ {/if}
42
+ </p>
43
+
44
+ {#if moreHref}
45
+ <p class="text-xs uppercase font-semibold mr-2 text-stone-900 dark:text-stone-400">
46
+ <a href={moreHref} class="text-right" use:link>
47
+ {i18n({en: 'More...', es: 'Más...', pl: 'Więcej...'})}
48
+ </a>
49
+ </p>
34
50
  {/if}
35
- </p>
51
+ </div>
52
+
36
53
  {/if}
37
54
 
38
55
  {#if !collapsable}
@@ -6,6 +6,7 @@ export default class Sidebar extends SvelteComponentTyped<{
6
6
  border?: boolean | undefined;
7
7
  collapsable?: boolean | undefined;
8
8
  onExpand?: any;
9
+ moreHref?: any;
9
10
  }, {
10
11
  [evt: string]: CustomEvent<any>;
11
12
  }, {
@@ -22,6 +23,7 @@ declare const __propDef: {
22
23
  border?: boolean | undefined;
23
24
  collapsable?: boolean | undefined;
24
25
  onExpand?: any;
26
+ moreHref?: any;
25
27
  };
26
28
  events: {
27
29
  [evt: string]: CustomEvent<any>;
package/i18n.js CHANGED
@@ -162,6 +162,9 @@ export function i18n(list)
162
162
 
163
163
  export function extractTranslated(str)
164
164
  {
165
+ if(!str)
166
+ return ""
167
+
165
168
  if(str.startsWith('_;'))
166
169
  {
167
170
  const body = str.replace(/^_;\s*/, ''); // cut prefix "_; "
package/kicks.js CHANGED
@@ -100,7 +100,7 @@ function checkKicks(informObservers=true)
100
100
  {
101
101
  const s = get(session)
102
102
  const appId = s.appId ? s.appId : 'octopus'
103
- const tid = s.tid ? s.tid : 'octopus/15'
103
+ const tid = s.tid ? s.tid : 'octopus/13'
104
104
  console.log(s.isActive, appId, tid)
105
105
  if(s.isActive && appId && tid)
106
106
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",