@humandialog/forms.svelte 0.5.12 → 0.5.13

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.
@@ -3,6 +3,7 @@ export declare class rCombo_item {
3
3
  Name: string | undefined;
4
4
  Avatar: string | undefined;
5
5
  Color: string | undefined;
6
+ Icon: any | undefined;
6
7
  }
7
8
  export declare class rCombo_definition {
8
9
  source: rCombo_item[];
@@ -13,5 +14,6 @@ export declare class rCombo_definition {
13
14
  element_key: string | undefined;
14
15
  element_name: string | undefined;
15
16
  element_avatar: string | undefined;
17
+ element_icon: string | undefined;
16
18
  }
17
19
  export declare const cached_sources: Map<string, Promise<object>>;
@@ -4,11 +4,13 @@ export let key = void 0;
4
4
  export let name = void 0;
5
5
  export let avatar = void 0;
6
6
  export let color = void 0;
7
+ export let icon = void 0;
7
8
  let definition = getContext("rCombo-definition");
8
9
  let item = new rCombo_item();
9
10
  item.Name = name;
10
11
  item.Key = key;
11
12
  item.Avatar = avatar;
12
13
  item.Color = color;
14
+ item.Icon = icon;
13
15
  definition.source.push(item);
14
16
  </script>
@@ -5,6 +5,7 @@ declare const __propDef: {
5
5
  name?: string | undefined;
6
6
  avatar?: string | undefined;
7
7
  color?: string | undefined;
8
+ icon?: any | undefined;
8
9
  };
9
10
  events: {
10
11
  [evt: string]: CustomEvent<any>;
@@ -3,6 +3,7 @@ export class rCombo_item {
3
3
  Name;
4
4
  Avatar; //url to avatar
5
5
  Color;
6
+ Icon = undefined;
6
7
  }
7
8
  export class rCombo_definition {
8
9
  source = [];
@@ -13,5 +14,6 @@ export class rCombo_definition {
13
14
  element_key;
14
15
  element_name;
15
16
  element_avatar;
17
+ element_icon;
16
18
  }
17
19
  export const cached_sources = new Map();
@@ -6,6 +6,7 @@ export let onCollect = void 0;
6
6
  export let key = "";
7
7
  export let name = "";
8
8
  export let avatar = "";
9
+ export let icon = "";
9
10
  let definition = getContext("rCombo-definition");
10
11
  definition.collection_expr = association;
11
12
  definition.collection_path = path;
@@ -14,4 +15,5 @@ definition.onCollect = onCollect;
14
15
  definition.element_key = key;
15
16
  definition.element_name = name;
16
17
  definition.element_avatar = avatar;
18
+ definition.element_icon = icon;
17
19
  </script>
@@ -8,6 +8,7 @@ declare const __propDef: {
8
8
  key?: string | undefined;
9
9
  name?: string | undefined;
10
10
  avatar?: string | undefined;
11
+ icon?: string | undefined;
11
12
  };
12
13
  events: {
13
14
  [evt: string]: CustomEvent<any>;
@@ -84,6 +84,14 @@ function setup(...args) {
84
84
  item = self ?? $contextItemsStore[ctx];
85
85
  if (!typename)
86
86
  typename = $contextTypesStore[ctx];
87
+ if (!typename) {
88
+ if (item.$type)
89
+ typename = item.$type;
90
+ else if (item.$ref) {
91
+ let s2 = item.$ref.split("/");
92
+ typename = s2[1];
93
+ }
94
+ }
87
95
  if (!label)
88
96
  label = a;
89
97
  tick_request_internal = tick_request_internal + 1;
@@ -236,6 +244,7 @@ function selected_item(itm, a2) {
236
244
  let found = definition.source.find((e) => e.Key == choosed_value);
237
245
  if (!found)
238
246
  found = definition.source.find((e) => e.Name == choosed_value);
247
+ console.log("found: ", found);
239
248
  if (found)
240
249
  return found;
241
250
  else
@@ -493,6 +502,8 @@ function source_fetched(source) {
493
502
  if (icon) {
494
503
  if (definition.element_avatar)
495
504
  el.Avatar = e[definition.element_avatar];
505
+ else if (definition.element_icon)
506
+ el.Icon = e[definition.element_icon];
496
507
  else
497
508
  el.Avatar = e.$icon;
498
509
  }
@@ -541,6 +552,10 @@ function on_focus_out(e) {
541
552
  {#if icon && sel_item}
542
553
  {#if sel_item.Color}
543
554
  <Icon size={5} circle={true} color={sel_item.Color}/>
555
+ {:else if sel_item.Icon}
556
+ <Icon size={4} component={sel_item.Icon}/>
557
+ {:else if sel_item.Icon == null}
558
+ <div class="w-4 h-4"></div>
544
559
  {:else}
545
560
  <Icon size={5} circle={true} symbol={sel_item.Avatar} label={sel_item.Name}/>
546
561
  {/if}
@@ -591,6 +606,10 @@ function on_focus_out(e) {
591
606
  <Icon size={5} circle={true} color={item.Color}/>
592
607
  {:else if item.Avatar}
593
608
  <Icon size={5} circle={true} symbol={item.Avatar}/>
609
+ {:else if item.Icon}
610
+ <Icon size={4} component={item.Icon}/>
611
+ {:else if item.Icon == null}
612
+ <div class="w-4 h-4"></div>
594
613
  {:else if item.Name}
595
614
  <Icon size={5} circle={true} label={item.Name}/>
596
615
  {:else}
@@ -22,7 +22,7 @@ export function showAsToolbox(rect) {
22
22
  const windowWidth = window.innerWidth - 2 * margin;
23
23
  toolboxX = margin;
24
24
  toolboxY = rect.bottom + margin;
25
- css_style = `position: fixed; left:${toolboxX}px; top:${toolboxY}px;`;
25
+ css_style = `position: absolute; left:${toolboxX}px; top:${toolboxY}px;`;
26
26
  dispatch("palette_shown");
27
27
  }
28
28
  export function show(x, y, up = false) {
@@ -989,7 +989,10 @@ let commands = [
989
989
  // { caption: 'Heading 1', description: 'Big section heading', tags: 'h1', icon: FaHead, icon_size: 6, on_choice: () => { do_format('h2', '') } } ,
990
990
  // { caption: 'Heading 2', description: 'Medium section heading', tags: 'h2', icon: FaHead, icon_size: 5, on_choice: () => { do_format('h3', '') } } ,
991
991
  // { caption: 'Heading 3', description: 'Small section heading', tags: 'h3', icon: FaHead, icon_size: 4, on_choice: () => { do_format('h4', '') } } ,
992
- { caption: "Heading", description: "Description heading", tags: "h2", icon: FaHead, icon_size: 6, on_choice: () => {
992
+ { caption: "Heading 1", description: "Description heading", tags: "h1", icon: FaHead, icon_size: 6, on_choice: () => {
993
+ do_format("h1", "");
994
+ } },
995
+ { caption: "Heading 2", description: "Description heading", tags: "h2", icon: FaHead, icon_size: 6, on_choice: () => {
993
996
  do_format("h2", "");
994
997
  } },
995
998
  // { caption: 'Heading 2', description: 'Medium description heading', tags: 'h3', icon: FaHead, icon_size: 5, on_choice: () => { do_format('h3', '') } } ,
@@ -4,7 +4,7 @@ export const KanbanCardBottom = 3;
4
4
  export class rKanban_column {
5
5
  id;
6
6
  title = '';
7
- width = 'w-[240px]';
7
+ width = '';
8
8
  state = '';
9
9
  finishing = false;
10
10
  operations = undefined;
@@ -1,6 +1,6 @@
1
- <script>import { getContext, afterUpdate, tick } from "svelte";
1
+ <script>import { getContext, afterUpdate, tick, onMount } from "svelte";
2
2
  import { data_tick_store, contextItemsStore, contextTypesStore } from "../../../stores";
3
- import { getActive, activateItem, editable, isActive, isSelected, selectable, startEditing } from "../../../utils.js";
3
+ import { getActive, activateItem, editable, isActive, isSelected, selectable, startEditing, isDeviceSmallerThan } from "../../../utils.js";
4
4
  import Card from "./kanban.card.svelte";
5
5
  import { KanbanColumnTop, KanbanColumnBottom } from "../Kanban";
6
6
  import Inserter from "./kanban.inserter.svelte";
@@ -38,7 +38,6 @@ export function setBorder(what_to_do) {
38
38
  let definition = getContext("rKanban-definition");
39
39
  let columnDef = definition.columns[currentColumnIdx];
40
40
  let column_items = void 0;
41
- let width_class = columnDef.width ? `w-11/12 sm:${columnDef.width}` : "w-11/12 sm:w-[240px]";
42
41
  $:
43
42
  setup_data();
44
43
  $:
@@ -165,6 +164,25 @@ export function activate(e) {
165
164
  }
166
165
  );
167
166
  }
167
+ onMount(() => {
168
+ window.addEventListener("resize", onResizeWindow);
169
+ return () => {
170
+ window.removeEventListener("resize", onResizeWindow);
171
+ };
172
+ });
173
+ let styleWidth = getWidthStyle();
174
+ function onResizeWindow() {
175
+ styleWidth = getWidthStyle();
176
+ }
177
+ function getWidthStyle() {
178
+ const assumed_space = 800;
179
+ const default_column_width = Math.floor(assumed_space / definition.columns.length);
180
+ const column_width = columnDef.width ? columnDef.width : default_column_width;
181
+ if (window.innerWidth >= 640)
182
+ return `width: ${column_width}px; min-width: 180px; max-width: ${column_width}px;`;
183
+ else
184
+ return "width: 92%;";
185
+ }
168
186
  </script>
169
187
 
170
188
  <!-- svelte-ignore a11y-click-events-have-key-events -->
@@ -172,11 +190,11 @@ export function activate(e) {
172
190
  <section class=" snap-center
173
191
  sm:snap-align-none
174
192
  flex-none sm:flex-1
175
- sm:min-w-[180px] sm:max-w-[240px]
176
193
  sm:min-h-[calc(100vh-8rem)]
177
194
  min-h-[calc(100vh-5rem)]
178
195
  rounded-md border border-transparent
179
- {width_class} {selected_class} {focused_class}"
196
+ {selected_class} {focused_class}"
197
+ style={styleWidth}
180
198
  use:selectable={columnDef}
181
199
  on:click={activate}>
182
200
  <header class:cursor-pointer={!is_row_active && columnDef.operations} bind:this={headerElement}>
@@ -237,4 +255,5 @@ export function activate(e) {
237
255
  {/if}
238
256
 
239
257
  </ul>
240
- </section>
258
+ </section>
259
+
@@ -1,7 +1,7 @@
1
1
  <script>import { getContext } from "svelte";
2
2
  import { rKanban_column } from "./Kanban";
3
3
  export let title = "";
4
- export let width = "w-[240px]";
4
+ export let width = "";
5
5
  export let state = "";
6
6
  export let finishing = false;
7
7
  export let operations = void 0;
package/index.d.ts CHANGED
@@ -52,7 +52,7 @@ export { default as KanbanTagsProperty } from './components/kanban/kanban.tags.s
52
52
  export { default as KanbanCallbacks } from './components/kanban/kanban.callbacks.svelte';
53
53
  export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban';
54
54
  export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan } from './utils';
55
- export { mainViewReloader, reloadMainView } from './stores.js';
55
+ export { mainContentPageReloader, reloadMainContentPage } from './stores.js';
56
56
  export { data_tick_store, // tmp
57
57
  hasSelectedItem, hasDataItem, setNavigatorTitle } from "./stores";
58
58
  export { contextToolbarOperations, pageToolbarOperations, contextItemsStore, contextTypesStore } from './stores';
package/index.js CHANGED
@@ -58,7 +58,7 @@ export { default as KanbanTagsProperty } from './components/kanban/kanban.tags.s
58
58
  export { default as KanbanCallbacks } from './components/kanban/kanban.callbacks.svelte';
59
59
  export { KanbanColumnTop, KanbanColumnBottom } from './components/kanban/Kanban';
60
60
  export { selectItem, activateItem, clearActiveItem, isActive, isSelected, getActive, editable, startEditing, saveCurrentEditable, selectable, handleSelect, isDeviceSmallerThan } from './utils';
61
- export { mainViewReloader, reloadMainView } from './stores.js';
61
+ export { mainContentPageReloader, reloadMainContentPage } from './stores.js';
62
62
  export { data_tick_store, // tmp
63
63
  hasSelectedItem, hasDataItem, setNavigatorTitle } from "./stores";
64
64
  export { contextToolbarOperations, pageToolbarOperations, contextItemsStore, contextTypesStore } from './stores'; // tmp
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humandialog/forms.svelte",
3
- "version": "0.5.12",
3
+ "version": "0.5.13",
4
4
  "description": "Basic Svelte UI components for Object Reef applications",
5
5
  "devDependencies": {
6
6
  "@playwright/test": "^1.28.1",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "type": "module",
28
28
  "dependencies": {
29
- "@humandialog/auth.svelte": "^1.5.1",
29
+ "@humandialog/auth.svelte": "^1.5.3",
30
30
  "flowbite-svelte": "^0.29.13",
31
31
  "svelte-icons": "^2.1.0",
32
32
  "svelte-spa-router": "^3.3.0"
package/stores.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export function setNavigatorTitle(key: any, title: any): void;
2
2
  export function hasSelectedItem(): boolean;
3
3
  export function hasDataItem(): boolean;
4
- export function reloadMainView(): void;
4
+ export function reloadMainContentPage(): void;
5
5
  export function set_dark_mode_default(value: any): void;
6
6
  export function set_default_tools_visible(value: any): void;
7
7
  export function restore_defults(): void;
@@ -28,7 +28,7 @@ export const contextToolbarOperations: import("svelte/store").Writable<never[]>;
28
28
  export const pageToolbarOperations: import("svelte/store").Writable<never[]>;
29
29
  export const page_title: import("svelte/store").Writable<string>;
30
30
  export const nav_titles: import("svelte/store").Writable<{}>;
31
- export const mainViewReloader: import("svelte/store").Writable<number>;
31
+ export const mainContentPageReloader: import("svelte/store").Writable<number>;
32
32
  export const dark_mode_store: import("svelte/store").Writable<any>;
33
33
  export const main_sidebar_visible_store: import("svelte/store").Writable<any>;
34
34
  export let previously_visible_sidebar: string;
package/stores.js CHANGED
@@ -10,7 +10,7 @@ export const contextToolbarOperations = writable([]);
10
10
  export const pageToolbarOperations = writable([]);
11
11
  export const page_title = writable('');
12
12
  export const nav_titles = writable({});
13
- export const mainViewReloader = writable(1);
13
+ export const mainContentPageReloader = writable(1);
14
14
 
15
15
  export function setNavigatorTitle(key, title)
16
16
  {
@@ -31,11 +31,11 @@ export function hasDataItem()
31
31
  return itm !== null && itm !== undefined;
32
32
  }
33
33
 
34
- export function reloadMainView()
34
+ export function reloadMainContentPage()
35
35
  {
36
- let val = get(mainViewReloader);
36
+ let val = get(mainContentPageReloader);
37
37
  val += 1;
38
- mainViewReloader.set(val);
38
+ mainContentPageReloader.set(val);
39
39
  }
40
40
 
41
41