@humandialog/forms.svelte 0.3.3 → 0.3.5
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.
- package/README.md +1 -1
- package/components/button.svelte +80 -0
- package/components/button.svelte.d.ts +24 -0
- package/components/checkbox.svelte +55 -0
- package/components/checkbox.svelte.d.ts +25 -0
- package/components/combo/combo.d.ts +15 -0
- package/components/combo/combo.item.svelte +14 -0
- package/components/combo/combo.item.svelte.d.ts +19 -0
- package/components/combo/combo.js +15 -0
- package/components/combo/combo.source.svelte +13 -0
- package/components/combo/combo.source.svelte.d.ts +20 -0
- package/components/combo/combo.svelte +527 -0
- package/components/combo/combo.svelte.d.ts +28 -0
- package/components/date.svelte +113 -0
- package/components/date.svelte.d.ts +23 -0
- package/components/document/internal/Document_command.d.ts +9 -0
- package/components/document/internal/Document_command.js +9 -0
- package/components/document/internal/Selection_helper.d.ts +7 -0
- package/components/document/internal/Selection_helper.js +133 -0
- package/components/document/internal/Selection_range.d.ts +26 -0
- package/components/document/internal/Selection_range.js +58 -0
- package/components/document/internal/palette.row.svelte +34 -0
- package/components/document/internal/palette.row.svelte.d.ts +36 -0
- package/components/document/internal/palette.svelte +123 -0
- package/components/document/internal/palette.svelte.d.ts +67 -0
- package/components/document/rich.edit.svelte +733 -0
- package/components/document/rich.edit.svelte.d.ts +23 -0
- package/components/edit.field.svelte +134 -0
- package/components/edit.field.svelte.d.ts +27 -0
- package/components/file.loader.svelte +90 -0
- package/components/file.loader.svelte.d.ts +25 -0
- package/components/input.text.svelte +37 -0
- package/components/input.text.svelte.d.ts +29 -0
- package/components/inputbox.ltop.svelte +110 -0
- package/components/inputbox.ltop.svelte.d.ts +44 -0
- package/components/radio.svelte +53 -0
- package/components/radio.svelte.d.ts +25 -0
- package/components/simple.table.svelte +106 -0
- package/components/simple.table.svelte.d.ts +41 -0
- package/components/table/_template.table.svelte +111 -0
- package/components/table/_template.table.svelte.d.ts +57 -0
- package/components/table/column.svelte +17 -0
- package/components/table/column.svelte.d.ts +19 -0
- package/components/table/item.svelte +10 -0
- package/components/table/item.svelte.d.ts +17 -0
- package/components/table/table.d.ts +11 -0
- package/components/table/table.js +11 -0
- package/components/table/table.svelte +150 -0
- package/components/table/table.svelte.d.ts +73 -0
- package/components/textarea.ltop.svelte +55 -0
- package/components/textarea.ltop.svelte.d.ts +35 -0
- package/components/tile.title.svelte +54 -0
- package/components/tile.title.svelte.d.ts +29 -0
- package/form.box.svelte +60 -0
- package/form.box.svelte.d.ts +35 -0
- package/global.d.ts +1 -0
- package/icon.svelte +105 -0
- package/icon.svelte.d.ts +62 -0
- package/index.d.ts +21 -0
- package/index.js +25 -0
- package/package.json +42 -48
- package/page.row.svelte +31 -0
- package/page.row.svelte.d.ts +31 -0
- package/page.svelte +83 -0
- package/page.svelte.d.ts +39 -0
- package/stores.d.ts +15 -0
- package/stores.js +7 -0
- package/tile.svelte +41 -0
- package/tile.svelte.d.ts +33 -0
- package/tiles.row.svelte +35 -0
- package/tiles.row.svelte.d.ts +31 -0
- package/tiles.vertical.row.svelte +25 -0
- package/tiles.vertical.row.svelte.d.ts +29 -0
- package/updates.d.ts +3 -0
- package/updates.js +95 -0
- package/utils.d.ts +5 -0
- package/utils.js +51 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# <img src="https://objectreef.dev/reef.png" alt="ObjectReef logo" width="26"> @humandialog/
|
|
1
|
+
# <img src="https://objectreef.dev/reef.png" alt="ObjectReef logo" width="26"> @humandialog/forms.svelte
|
|
2
2
|
|
|
3
3
|
Basic Svelte UI components for Object Reef applications
|
|
4
4
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script>import { Button } from "flowbite-svelte";
|
|
2
|
+
import { getContext } from "svelte";
|
|
3
|
+
import { data_tick_store, context_items_store, context_types_store } from "../stores.js";
|
|
4
|
+
import { Auth } from "@humandialog/auth.svelte/dist/index.js";
|
|
5
|
+
export let self = null;
|
|
6
|
+
export let operation = "";
|
|
7
|
+
export let params = null;
|
|
8
|
+
export let context = "";
|
|
9
|
+
export let typename = "";
|
|
10
|
+
export let action = null;
|
|
11
|
+
let ctx = context ? context : getContext("ctx");
|
|
12
|
+
let is_table_component = getContext("rIs-table-component");
|
|
13
|
+
let can_be_activated = true;
|
|
14
|
+
let item = null;
|
|
15
|
+
let additional_class = $$restProps.class ?? "";
|
|
16
|
+
let last_tick = -1;
|
|
17
|
+
$:
|
|
18
|
+
setup($data_tick_store);
|
|
19
|
+
function setup(data_tick_store2) {
|
|
20
|
+
if (data_tick_store2 <= last_tick)
|
|
21
|
+
return;
|
|
22
|
+
last_tick = data_tick_store2;
|
|
23
|
+
if (!action) {
|
|
24
|
+
item = self ?? $context_items_store[ctx];
|
|
25
|
+
if (!typename)
|
|
26
|
+
typename = $context_types_store[ctx];
|
|
27
|
+
}
|
|
28
|
+
if (is_table_component) {
|
|
29
|
+
if ($context_items_store["sel"] != self)
|
|
30
|
+
can_be_activated = false;
|
|
31
|
+
else
|
|
32
|
+
can_be_activated = true;
|
|
33
|
+
} else
|
|
34
|
+
can_be_activated = true;
|
|
35
|
+
}
|
|
36
|
+
async function click() {
|
|
37
|
+
if (action) {
|
|
38
|
+
if (params)
|
|
39
|
+
action(params);
|
|
40
|
+
else
|
|
41
|
+
action();
|
|
42
|
+
$data_tick_store = $data_tick_store + 1;
|
|
43
|
+
} else if (item && operation && typename) {
|
|
44
|
+
try {
|
|
45
|
+
let res;
|
|
46
|
+
if (params) {
|
|
47
|
+
res = await Auth.fetch(
|
|
48
|
+
`json/yav1/${typename}/${item.Id}/${operation}`,
|
|
49
|
+
{
|
|
50
|
+
method: "POST",
|
|
51
|
+
body: JSON.stringify(params)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
} else
|
|
55
|
+
res = await Auth.fetch(`json/yav1/${typename}/${item.Id}/${operation}`);
|
|
56
|
+
if (res.ok)
|
|
57
|
+
$data_tick_store = $data_tick_store + 1;
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.error(err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
{#if is_table_component}
|
|
66
|
+
{#if can_be_activated}
|
|
67
|
+
<Button on:click={click} class="h-7 {additional_class}"
|
|
68
|
+
disabled={!can_be_activated}
|
|
69
|
+
color='alternative'
|
|
70
|
+
>
|
|
71
|
+
<slot/>
|
|
72
|
+
</Button>
|
|
73
|
+
{/if}
|
|
74
|
+
{:else}
|
|
75
|
+
|
|
76
|
+
<Button on:click={click} class="h-7 {additional_class}"
|
|
77
|
+
disabled={!can_be_activated}>
|
|
78
|
+
<slot/>
|
|
79
|
+
</Button>
|
|
80
|
+
{/if}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
self?: null | undefined;
|
|
6
|
+
operation?: string | undefined;
|
|
7
|
+
params?: null | undefined;
|
|
8
|
+
context?: string | undefined;
|
|
9
|
+
typename?: string | undefined;
|
|
10
|
+
action?: null | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type ButtonProps = typeof __propDef.props;
|
|
20
|
+
export type ButtonEvents = typeof __propDef.events;
|
|
21
|
+
export type ButtonSlots = typeof __propDef.slots;
|
|
22
|
+
export default class Button extends SvelteComponentTyped<ButtonProps, ButtonEvents, ButtonSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script>import { getContext } from "svelte";
|
|
2
|
+
import { data_tick_store, context_items_store, context_types_store } from "../stores.js";
|
|
3
|
+
import { inform_modification, push_changes } from "../updates.js";
|
|
4
|
+
import { parse_width_directive } from "../utils.js";
|
|
5
|
+
export let checked = void 0;
|
|
6
|
+
export let disabled = false;
|
|
7
|
+
export let self = null;
|
|
8
|
+
export let a = "";
|
|
9
|
+
export let context = "";
|
|
10
|
+
export let typename = "";
|
|
11
|
+
export let c = "";
|
|
12
|
+
let item = null;
|
|
13
|
+
let additional_class = $$restProps.class ?? "";
|
|
14
|
+
let value = false;
|
|
15
|
+
let ctx = context ? context : getContext("ctx");
|
|
16
|
+
let cs = parse_width_directive(c);
|
|
17
|
+
let color_style = disabled ? "text-gray-400 dark:text-gray-500" : "text-gray-900 dark:text-gray-300";
|
|
18
|
+
let last_tick = -1;
|
|
19
|
+
$:
|
|
20
|
+
setup($data_tick_store);
|
|
21
|
+
function setup(data_tick_store2) {
|
|
22
|
+
if (data_tick_store2 <= last_tick)
|
|
23
|
+
return;
|
|
24
|
+
last_tick = data_tick_store2;
|
|
25
|
+
if (checked === void 0) {
|
|
26
|
+
item = self ?? $context_items_store[ctx];
|
|
27
|
+
if (!typename)
|
|
28
|
+
typename = $context_types_store[ctx];
|
|
29
|
+
value = item && a ? !!item[a] : false;
|
|
30
|
+
} else
|
|
31
|
+
value = checked;
|
|
32
|
+
}
|
|
33
|
+
function on_changed() {
|
|
34
|
+
if (item && a) {
|
|
35
|
+
item[a] = value;
|
|
36
|
+
if (typename) {
|
|
37
|
+
inform_modification(item, a, typename);
|
|
38
|
+
$data_tick_store = $data_tick_store + 1;
|
|
39
|
+
push_changes();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<div class="ml-2 h-6 {cs} {color_style} {additional_class} flex items-center">
|
|
46
|
+
<input type="checkbox"
|
|
47
|
+
bind:checked={value}
|
|
48
|
+
on:change={on_changed}
|
|
49
|
+
{disabled}
|
|
50
|
+
class="w-4 h-4 bg-gray-100 border-gray-300 dark:ring-offset-gray-800 focus:ring-2 mr-2 dark:bg-gray-700 dark:border-gray-600 rounded text-blue-600 focus:ring-blue-500 dark:focus:ring-blue-600"/>
|
|
51
|
+
<span class="text-sm font-medium ml-1">
|
|
52
|
+
<slot/>
|
|
53
|
+
</span>
|
|
54
|
+
|
|
55
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
checked?: boolean | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
self?: null | undefined;
|
|
8
|
+
a?: string | undefined;
|
|
9
|
+
context?: string | undefined;
|
|
10
|
+
typename?: string | undefined;
|
|
11
|
+
c?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type CheckboxProps = typeof __propDef.props;
|
|
21
|
+
export type CheckboxEvents = typeof __propDef.events;
|
|
22
|
+
export type CheckboxSlots = typeof __propDef.slots;
|
|
23
|
+
export default class Checkbox extends SvelteComponentTyped<CheckboxProps, CheckboxEvents, CheckboxSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class rCombo_item {
|
|
2
|
+
Key: any | undefined;
|
|
3
|
+
Name: string | undefined;
|
|
4
|
+
Avatar: string | undefined;
|
|
5
|
+
Color: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare class rCombo_definition {
|
|
8
|
+
source: rCombo_item[];
|
|
9
|
+
collection_expr: string | undefined;
|
|
10
|
+
on_collect: undefined;
|
|
11
|
+
element_key: string | undefined;
|
|
12
|
+
element_name: string | undefined;
|
|
13
|
+
element_avatar: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare const cached_sources: Map<string, Promise<object>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script>import { getContext } from "svelte";
|
|
2
|
+
import { rCombo_definition, rCombo_item } from "./combo";
|
|
3
|
+
export let key = void 0;
|
|
4
|
+
export let name = void 0;
|
|
5
|
+
export let avatar = void 0;
|
|
6
|
+
export let color = void 0;
|
|
7
|
+
let definition = getContext("rCombo-definition");
|
|
8
|
+
let item = new rCombo_item();
|
|
9
|
+
item.Name = name;
|
|
10
|
+
item.Key = key;
|
|
11
|
+
item.Avatar = avatar;
|
|
12
|
+
item.Color = color;
|
|
13
|
+
definition.source.push(item);
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
key?: any | undefined;
|
|
5
|
+
name?: string | undefined;
|
|
6
|
+
avatar?: string | undefined;
|
|
7
|
+
color?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type ComboProps = typeof __propDef.props;
|
|
15
|
+
export type ComboEvents = typeof __propDef.events;
|
|
16
|
+
export type ComboSlots = typeof __propDef.slots;
|
|
17
|
+
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class rCombo_item {
|
|
2
|
+
Key;
|
|
3
|
+
Name;
|
|
4
|
+
Avatar; //url to avatar
|
|
5
|
+
Color;
|
|
6
|
+
}
|
|
7
|
+
export class rCombo_definition {
|
|
8
|
+
source = [];
|
|
9
|
+
collection_expr;
|
|
10
|
+
on_collect = undefined;
|
|
11
|
+
element_key;
|
|
12
|
+
element_name;
|
|
13
|
+
element_avatar;
|
|
14
|
+
}
|
|
15
|
+
export const cached_sources = new Map();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script>import { getContext } from "svelte";
|
|
2
|
+
export let collection = "";
|
|
3
|
+
export let on_collect = void 0;
|
|
4
|
+
export let key = "";
|
|
5
|
+
export let name = "";
|
|
6
|
+
export let avatar = "";
|
|
7
|
+
let definition = getContext("rCombo-definition");
|
|
8
|
+
definition.collection_expr = collection;
|
|
9
|
+
definition.on_collect = on_collect;
|
|
10
|
+
definition.element_key = key;
|
|
11
|
+
definition.element_name = name;
|
|
12
|
+
definition.element_avatar = avatar;
|
|
13
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
collection?: string | undefined;
|
|
5
|
+
on_collect?: undefined;
|
|
6
|
+
key?: string | undefined;
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
avatar?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type ComboProps = typeof __propDef.props;
|
|
16
|
+
export type ComboEvents = typeof __propDef.events;
|
|
17
|
+
export type ComboSlots = typeof __propDef.slots;
|
|
18
|
+
export default class Combo extends SvelteComponentTyped<ComboProps, ComboEvents, ComboSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|