@humandialog/forms.svelte 0.3.2 → 0.3.4
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/LICENSE +21 -0
- package/README.md +17 -17
- 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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import {data_tick_store, context_items_store, context_info_store } from '../stores.js'
|
|
3
|
+
import {getContext} from 'svelte';
|
|
4
|
+
|
|
5
|
+
export let context = ""
|
|
6
|
+
export let collection = ""
|
|
7
|
+
export let self = null
|
|
8
|
+
export let objects = null;
|
|
9
|
+
export let headers = [];
|
|
10
|
+
export let fields = [];
|
|
11
|
+
export let select = "sel"
|
|
12
|
+
export let cinfo = 'default'
|
|
13
|
+
export let focus = true
|
|
14
|
+
export let nav = true
|
|
15
|
+
let items = null;
|
|
16
|
+
|
|
17
|
+
let ctx = context ? context : getContext('ctx');
|
|
18
|
+
|
|
19
|
+
let item = null
|
|
20
|
+
if(self == null)
|
|
21
|
+
item = $context_items_store[ctx];
|
|
22
|
+
else
|
|
23
|
+
item = self
|
|
24
|
+
|
|
25
|
+
if(objects != null)
|
|
26
|
+
items = objects
|
|
27
|
+
else if (item != null)
|
|
28
|
+
items = item[collection]
|
|
29
|
+
|
|
30
|
+
let last_tick = $data_tick_store
|
|
31
|
+
|
|
32
|
+
let t = 0
|
|
33
|
+
$:{ t = $data_tick_store
|
|
34
|
+
if(t > last_tick)
|
|
35
|
+
{
|
|
36
|
+
last_tick = t
|
|
37
|
+
if(self == null)
|
|
38
|
+
item = $context_items_store[ctx];
|
|
39
|
+
else
|
|
40
|
+
item = self
|
|
41
|
+
|
|
42
|
+
if(objects != null)
|
|
43
|
+
items = objects
|
|
44
|
+
else if (item != null)
|
|
45
|
+
items = item[collection]
|
|
46
|
+
|
|
47
|
+
//console.log("t["+ctx+", "+collection + "]: " + t + ", " + last_tick)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
const select_item = (itm, cinfo) => () => {
|
|
54
|
+
|
|
55
|
+
$context_items_store[select] = itm;
|
|
56
|
+
$context_info_store[select] = cinfo;
|
|
57
|
+
|
|
58
|
+
if(focus)
|
|
59
|
+
$context_items_store.focused = select
|
|
60
|
+
if(nav)
|
|
61
|
+
$data_tick_store = $data_tick_store + 1;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
let selected_item = $context_items_store[select]
|
|
65
|
+
$: selected_item = $context_items_store[select]
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<table class="min-w-full h-auto divide-gray-200">
|
|
70
|
+
<thead class="bg-gray-50 sticky">
|
|
71
|
+
<tr>
|
|
72
|
+
{#if headers != null}
|
|
73
|
+
{#each headers as header}
|
|
74
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
75
|
+
{header}
|
|
76
|
+
</th>
|
|
77
|
+
{/each}
|
|
78
|
+
{:else}
|
|
79
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
80
|
+
No headers...
|
|
81
|
+
</th>
|
|
82
|
+
{/if}
|
|
83
|
+
</tr>
|
|
84
|
+
</thead>
|
|
85
|
+
{#if (items != null && items.length > 0 && fields != null)}
|
|
86
|
+
<tbody class="bg-white ">
|
|
87
|
+
{#each items as item}
|
|
88
|
+
{#if (item != null )}
|
|
89
|
+
{#if item == selected_item}
|
|
90
|
+
<tr >
|
|
91
|
+
{#each fields as field}
|
|
92
|
+
<td class="px-4 py-1 bg-slate-100 whitespace-nowrap text-sm font-normal text-gray-900">{item[field]}</td>
|
|
93
|
+
{/each}
|
|
94
|
+
</tr>
|
|
95
|
+
{:else}
|
|
96
|
+
<tr on:click={select_item(item, cinfo)}>
|
|
97
|
+
{#each fields as field}
|
|
98
|
+
<td class="px-4 py-1 whitespace-nowrap text-sm font-normal text-gray-900">{item[field]}</td>
|
|
99
|
+
{/each}
|
|
100
|
+
</tr>
|
|
101
|
+
{/if}
|
|
102
|
+
{/if}
|
|
103
|
+
{/each}
|
|
104
|
+
</tbody>
|
|
105
|
+
{/if}
|
|
106
|
+
</table>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} SimpleProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} SimpleEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} SimpleSlots */
|
|
4
|
+
export default class Simple extends SvelteComponentTyped<{
|
|
5
|
+
context?: string | undefined;
|
|
6
|
+
self?: null | undefined;
|
|
7
|
+
focus?: boolean | undefined;
|
|
8
|
+
select?: string | undefined;
|
|
9
|
+
nav?: boolean | undefined;
|
|
10
|
+
collection?: string | undefined;
|
|
11
|
+
objects?: null | undefined;
|
|
12
|
+
headers?: any[] | undefined;
|
|
13
|
+
fields?: any[] | undefined;
|
|
14
|
+
cinfo?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}> {
|
|
18
|
+
}
|
|
19
|
+
export type SimpleProps = typeof __propDef.props;
|
|
20
|
+
export type SimpleEvents = typeof __propDef.events;
|
|
21
|
+
export type SimpleSlots = typeof __propDef.slots;
|
|
22
|
+
import { SvelteComponentTyped } from "svelte";
|
|
23
|
+
declare const __propDef: {
|
|
24
|
+
props: {
|
|
25
|
+
context?: string | undefined;
|
|
26
|
+
self?: null | undefined;
|
|
27
|
+
focus?: boolean | undefined;
|
|
28
|
+
select?: string | undefined;
|
|
29
|
+
nav?: boolean | undefined;
|
|
30
|
+
collection?: string | undefined;
|
|
31
|
+
objects?: null | undefined;
|
|
32
|
+
headers?: any[] | undefined;
|
|
33
|
+
fields?: any[] | undefined;
|
|
34
|
+
cinfo?: string | undefined;
|
|
35
|
+
};
|
|
36
|
+
events: {
|
|
37
|
+
[evt: string]: CustomEvent<any>;
|
|
38
|
+
};
|
|
39
|
+
slots: {};
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import {data_tick_store, context_items_store, context_info_store } from '../../stores.js'
|
|
3
|
+
import {getContext} from 'svelte';
|
|
4
|
+
|
|
5
|
+
export let context = ""
|
|
6
|
+
export let collection = ""
|
|
7
|
+
export let self = null
|
|
8
|
+
export let objects = null;
|
|
9
|
+
export let headers = [];
|
|
10
|
+
export let fields = [];
|
|
11
|
+
export let select = "sel"
|
|
12
|
+
export let cinfo = 'default'
|
|
13
|
+
export let focus = true
|
|
14
|
+
export let nav = true
|
|
15
|
+
let items = null;
|
|
16
|
+
|
|
17
|
+
let ctx = context ? context : getContext('ctx');
|
|
18
|
+
|
|
19
|
+
let item = null
|
|
20
|
+
if(self == null)
|
|
21
|
+
item = $context_items_store[ctx];
|
|
22
|
+
else
|
|
23
|
+
item = self
|
|
24
|
+
|
|
25
|
+
if(objects != null)
|
|
26
|
+
items = objects
|
|
27
|
+
else if (item != null)
|
|
28
|
+
items = item[collection]
|
|
29
|
+
|
|
30
|
+
let last_tick = $data_tick_store
|
|
31
|
+
|
|
32
|
+
let t = 0
|
|
33
|
+
$:{ t = $data_tick_store
|
|
34
|
+
if(t > last_tick)
|
|
35
|
+
{
|
|
36
|
+
last_tick = t
|
|
37
|
+
if(self == null)
|
|
38
|
+
item = $context_items_store[ctx];
|
|
39
|
+
else
|
|
40
|
+
item = self
|
|
41
|
+
|
|
42
|
+
if(objects != null)
|
|
43
|
+
items = objects
|
|
44
|
+
else if (item != null)
|
|
45
|
+
items = item[collection]
|
|
46
|
+
|
|
47
|
+
//console.log("t["+ctx+", "+collection + "]: " + t + ", " + last_tick)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
const select_item = (itm, cinfo) => () => {
|
|
54
|
+
|
|
55
|
+
$context_items_store[select] = itm;
|
|
56
|
+
$context_info_store[select] = cinfo;
|
|
57
|
+
|
|
58
|
+
if(focus)
|
|
59
|
+
$context_items_store.focused = select
|
|
60
|
+
if(nav)
|
|
61
|
+
$data_tick_store = $data_tick_store + 1;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
let selected_item = $context_items_store[select]
|
|
65
|
+
$: selected_item = $context_items_store[select]
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<table class="min-w-full h-auto divide-gray-200 cursor-default">
|
|
70
|
+
<thead class="bg-gray-50 sticky">
|
|
71
|
+
<tr>
|
|
72
|
+
{#if headers != null}
|
|
73
|
+
{#each headers as header}
|
|
74
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
75
|
+
{header}
|
|
76
|
+
</th>
|
|
77
|
+
{/each}
|
|
78
|
+
{:else}
|
|
79
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
80
|
+
No headers...
|
|
81
|
+
</th>
|
|
82
|
+
{/if}
|
|
83
|
+
</tr>
|
|
84
|
+
</thead>
|
|
85
|
+
{#if (items != null && items.length > 0 && fields != null)}
|
|
86
|
+
<tbody class="bg-white dark:bg-slate-900">
|
|
87
|
+
{#each items as item}
|
|
88
|
+
{#if (item != null )}
|
|
89
|
+
<tr on:click={select_item(item, cinfo)}
|
|
90
|
+
class="whitespace-nowrap text-sm font-normal text-gray-900 dark:text-gray-300"
|
|
91
|
+
class:bg-slate-100={item==selected_item}
|
|
92
|
+
class:dark:bg-slate-700={item==selected_item}>
|
|
93
|
+
{#if $$slots['row']}
|
|
94
|
+
<slot name='row' {item}/>
|
|
95
|
+
{:else}
|
|
96
|
+
{#each fields as field}
|
|
97
|
+
<td class="px-4 py-1">
|
|
98
|
+
{#if $$slots['cell']}
|
|
99
|
+
<slot name='cell' {field} value={item[field]}></slot>
|
|
100
|
+
{:else}
|
|
101
|
+
{item[field]}
|
|
102
|
+
{/if}
|
|
103
|
+
</td>
|
|
104
|
+
{/each}
|
|
105
|
+
{/if}
|
|
106
|
+
</tr>
|
|
107
|
+
{/if}
|
|
108
|
+
{/each}
|
|
109
|
+
</tbody>
|
|
110
|
+
{/if}
|
|
111
|
+
</table>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} TemplateProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} TemplateEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} TemplateSlots */
|
|
4
|
+
export default class Template extends SvelteComponentTyped<{
|
|
5
|
+
context?: string | undefined;
|
|
6
|
+
self?: null | undefined;
|
|
7
|
+
focus?: boolean | undefined;
|
|
8
|
+
select?: string | undefined;
|
|
9
|
+
nav?: boolean | undefined;
|
|
10
|
+
collection?: string | undefined;
|
|
11
|
+
objects?: null | undefined;
|
|
12
|
+
headers?: any[] | undefined;
|
|
13
|
+
fields?: any[] | undefined;
|
|
14
|
+
cinfo?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {
|
|
18
|
+
row: {
|
|
19
|
+
item: any;
|
|
20
|
+
};
|
|
21
|
+
cell: {
|
|
22
|
+
field: any;
|
|
23
|
+
value: any;
|
|
24
|
+
};
|
|
25
|
+
}> {
|
|
26
|
+
}
|
|
27
|
+
export type TemplateProps = typeof __propDef.props;
|
|
28
|
+
export type TemplateEvents = typeof __propDef.events;
|
|
29
|
+
export type TemplateSlots = typeof __propDef.slots;
|
|
30
|
+
import { SvelteComponentTyped } from "svelte";
|
|
31
|
+
declare const __propDef: {
|
|
32
|
+
props: {
|
|
33
|
+
context?: string | undefined;
|
|
34
|
+
self?: null | undefined;
|
|
35
|
+
focus?: boolean | undefined;
|
|
36
|
+
select?: string | undefined;
|
|
37
|
+
nav?: boolean | undefined;
|
|
38
|
+
collection?: string | undefined;
|
|
39
|
+
objects?: null | undefined;
|
|
40
|
+
headers?: any[] | undefined;
|
|
41
|
+
fields?: any[] | undefined;
|
|
42
|
+
cinfo?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
events: {
|
|
45
|
+
[evt: string]: CustomEvent<any>;
|
|
46
|
+
};
|
|
47
|
+
slots: {
|
|
48
|
+
row: {
|
|
49
|
+
item: any;
|
|
50
|
+
};
|
|
51
|
+
cell: {
|
|
52
|
+
field: any;
|
|
53
|
+
value: any;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script>import { getContext, setContext } from "svelte";
|
|
2
|
+
import { rTable_definition, rTable_column } from "./table";
|
|
3
|
+
export let header = "";
|
|
4
|
+
export let field = "";
|
|
5
|
+
export let size = 0;
|
|
6
|
+
let table_definition = null;
|
|
7
|
+
table_definition = getContext("rTable-definition");
|
|
8
|
+
let col = new rTable_column();
|
|
9
|
+
col.field = field;
|
|
10
|
+
col.header = header;
|
|
11
|
+
col.size = size;
|
|
12
|
+
if ($$restProps["class"])
|
|
13
|
+
col.cl = $$restProps["class"];
|
|
14
|
+
table_definition.columns.push(col);
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
header?: string | undefined;
|
|
6
|
+
field?: string | undefined;
|
|
7
|
+
size?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type ColumnProps = typeof __propDef.props;
|
|
15
|
+
export type ColumnEvents = typeof __propDef.events;
|
|
16
|
+
export type ColumnSlots = typeof __propDef.slots;
|
|
17
|
+
export default class Column extends SvelteComponentTyped<ColumnProps, ColumnEvents, ColumnSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script>import { getContext } from "svelte";
|
|
2
|
+
export let e;
|
|
3
|
+
export let idx;
|
|
4
|
+
let definition = null;
|
|
5
|
+
definition = getContext("rTable-definition");
|
|
6
|
+
if (!idx)
|
|
7
|
+
definition.items = new Array();
|
|
8
|
+
definition.items.push(e);
|
|
9
|
+
definition.items_ticket++;
|
|
10
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
e: any;
|
|
5
|
+
idx: number;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type ItemProps = typeof __propDef.props;
|
|
13
|
+
export type ItemEvents = typeof __propDef.events;
|
|
14
|
+
export type ItemSlots = typeof __propDef.slots;
|
|
15
|
+
export default class Item extends SvelteComponentTyped<ItemProps, ItemEvents, ItemSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<script>import { data_tick_store, context_items_store, context_info_store, context_types_store } from "../../stores.js";
|
|
2
|
+
import { getContext, setContext, onDestroy } from "svelte";
|
|
3
|
+
import { rTable_definition } from "./table";
|
|
4
|
+
import { parse_width_directive } from "../../utils.js";
|
|
5
|
+
export let context = "";
|
|
6
|
+
export let collection = "";
|
|
7
|
+
export let self = null;
|
|
8
|
+
export let objects = null;
|
|
9
|
+
export let headers = [];
|
|
10
|
+
export let fields = [];
|
|
11
|
+
export let select = "sel";
|
|
12
|
+
export let cinfo = "default";
|
|
13
|
+
export let focus = true;
|
|
14
|
+
export let nav = true;
|
|
15
|
+
export let c = "";
|
|
16
|
+
export let typename = "";
|
|
17
|
+
let definition = new rTable_definition();
|
|
18
|
+
setContext("rTable-definition", definition);
|
|
19
|
+
setContext("rIs-table-component", true);
|
|
20
|
+
let ctx = context ? context : getContext("ctx");
|
|
21
|
+
let items = null;
|
|
22
|
+
let item = null;
|
|
23
|
+
let last_tick = -1;
|
|
24
|
+
let selected_item;
|
|
25
|
+
let cs = c ? parse_width_directive(c) : "w-full min-w-full";
|
|
26
|
+
$: {
|
|
27
|
+
if ($data_tick_store > last_tick)
|
|
28
|
+
refresh();
|
|
29
|
+
}
|
|
30
|
+
$:
|
|
31
|
+
selected_item = $context_items_store[select];
|
|
32
|
+
onDestroy(() => {
|
|
33
|
+
select_item(null, null);
|
|
34
|
+
});
|
|
35
|
+
export function refresh() {
|
|
36
|
+
last_tick = $data_tick_store;
|
|
37
|
+
item = self ?? $context_items_store[ctx];
|
|
38
|
+
if (objects)
|
|
39
|
+
items = objects;
|
|
40
|
+
else if (item && collection)
|
|
41
|
+
items = item[collection];
|
|
42
|
+
else
|
|
43
|
+
items = [];
|
|
44
|
+
if (!typename)
|
|
45
|
+
typename = $context_types_store[ctx];
|
|
46
|
+
}
|
|
47
|
+
export function update_objects(_objects) {
|
|
48
|
+
objects = _objects;
|
|
49
|
+
refresh();
|
|
50
|
+
}
|
|
51
|
+
export function update_self(_self) {
|
|
52
|
+
self = _self;
|
|
53
|
+
refresh();
|
|
54
|
+
}
|
|
55
|
+
export function select_item(itm, cinfo2) {
|
|
56
|
+
$context_items_store[select] = itm;
|
|
57
|
+
$context_info_store[select] = cinfo2;
|
|
58
|
+
if (itm && itm.oclType)
|
|
59
|
+
$context_types_store[select] = itm.oclType;
|
|
60
|
+
if (focus)
|
|
61
|
+
$context_items_store.focused = select;
|
|
62
|
+
if (nav)
|
|
63
|
+
$data_tick_store = $data_tick_store + 1;
|
|
64
|
+
}
|
|
65
|
+
let last_tick_internal = -1;
|
|
66
|
+
function override_items_from_slot(...args) {
|
|
67
|
+
if (last_tick_internal != definition.items_ticket) {
|
|
68
|
+
last_tick_internal = definition.items_ticket;
|
|
69
|
+
if (definition.items)
|
|
70
|
+
items = definition.items;
|
|
71
|
+
console.log("override_items_from_slot", definition.items, definition.items_ticket);
|
|
72
|
+
}
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
{#if true}
|
|
78
|
+
<slot/> <!-- let definition execute -->
|
|
79
|
+
|
|
80
|
+
<table class="{cs} h-auto divide-gray-200 cursor-default">
|
|
81
|
+
<thead class="bg-gray-50 sticky">
|
|
82
|
+
<tr>
|
|
83
|
+
{#if definition || headers.length }
|
|
84
|
+
{@const lheaders = headers.length ? headers : definition.columns.map( v => v.header )}
|
|
85
|
+
{#if lheaders.length && lheaders.some(s => s.length > 0)}
|
|
86
|
+
{#each lheaders as header}
|
|
87
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
88
|
+
{header}
|
|
89
|
+
</th>
|
|
90
|
+
{/each}
|
|
91
|
+
{/if}
|
|
92
|
+
{:else}
|
|
93
|
+
<th scope="col" class="py-1 px-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
94
|
+
No headers...
|
|
95
|
+
</th>
|
|
96
|
+
{/if}
|
|
97
|
+
</tr>
|
|
98
|
+
</thead>
|
|
99
|
+
{#if (items != null) && (items.length > 0)}
|
|
100
|
+
{@const lfields = fields.length ? fields : definition.columns.map( v => v.field )}
|
|
101
|
+
<tbody class="bg-white dark:bg-slate-900">
|
|
102
|
+
{#each items as item}
|
|
103
|
+
{#if (item != null )}
|
|
104
|
+
<tr on:click={ (e) => { select_item(item, cinfo);} }
|
|
105
|
+
class="whitespace-nowrap text-sm font-normal text-gray-900 dark:text-gray-300"
|
|
106
|
+
class:bg-slate-100={item==selected_item}
|
|
107
|
+
class:dark:bg-slate-700={item==selected_item}>
|
|
108
|
+
{#each lfields as field, i}
|
|
109
|
+
{@const cc = `c${i}`}
|
|
110
|
+
{@const column = definition.columns[i]}
|
|
111
|
+
{@const col_size = (column && column.size) ? `${column.size*0.25}rem` : '' }
|
|
112
|
+
<td class="pl-4 py-1 {column.cl}" style:width={col_size}>
|
|
113
|
+
{#if $$slots[cc]}
|
|
114
|
+
{#if cc=='c0'}
|
|
115
|
+
<slot name='c0' {item}/>
|
|
116
|
+
{:else if cc=='c1'}
|
|
117
|
+
<slot name='c1' {item}/>
|
|
118
|
+
{:else if cc=='c2'}
|
|
119
|
+
<slot name='c2' {item}/>
|
|
120
|
+
{:else if cc=='c3'}
|
|
121
|
+
<slot name='c3' {item}/>
|
|
122
|
+
{:else if cc=='c4'}
|
|
123
|
+
<slot name='c4' {item}/>
|
|
124
|
+
{:else if cc=='c5'}
|
|
125
|
+
<slot name='c5' {item}/>
|
|
126
|
+
{:else if cc=='c6'}
|
|
127
|
+
<slot name='c6' {item}/>
|
|
128
|
+
{:else if cc=='c7'}
|
|
129
|
+
<slot name='c7' {item}/>
|
|
130
|
+
{:else if cc=='c8'}
|
|
131
|
+
<slot name='c8' {item}/>
|
|
132
|
+
{:else if cc=='c9'}
|
|
133
|
+
<slot name='c9' {item}/>
|
|
134
|
+
{:else if cc=='c10'}
|
|
135
|
+
<slot name='c10' {item}/>
|
|
136
|
+
{:else if cc=='c11'}
|
|
137
|
+
<slot name='c11' {item}/>
|
|
138
|
+
{/if}
|
|
139
|
+
{:else}
|
|
140
|
+
{item[field]}
|
|
141
|
+
{/if}
|
|
142
|
+
</td>
|
|
143
|
+
{/each}
|
|
144
|
+
</tr>
|
|
145
|
+
{/if}
|
|
146
|
+
{/each}
|
|
147
|
+
</tbody>
|
|
148
|
+
{/if}
|
|
149
|
+
</table>
|
|
150
|
+
{/if}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
context?: string | undefined;
|
|
5
|
+
collection?: string | undefined;
|
|
6
|
+
self?: null | undefined;
|
|
7
|
+
objects?: null | undefined;
|
|
8
|
+
headers?: any[] | undefined;
|
|
9
|
+
fields?: any[] | undefined;
|
|
10
|
+
select?: string | undefined;
|
|
11
|
+
cinfo?: string | undefined;
|
|
12
|
+
focus?: boolean | undefined;
|
|
13
|
+
nav?: boolean | undefined;
|
|
14
|
+
c?: string | undefined;
|
|
15
|
+
typename?: string | undefined;
|
|
16
|
+
refresh?: (() => void) | undefined;
|
|
17
|
+
update_objects?: ((_objects: any) => void) | undefined;
|
|
18
|
+
update_self?: ((_self: any) => void) | undefined;
|
|
19
|
+
select_item?: ((itm: any, cinfo: any) => void) | undefined;
|
|
20
|
+
};
|
|
21
|
+
events: {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots: {
|
|
25
|
+
default: {};
|
|
26
|
+
c0: {
|
|
27
|
+
item: unknown;
|
|
28
|
+
};
|
|
29
|
+
c1: {
|
|
30
|
+
item: unknown;
|
|
31
|
+
};
|
|
32
|
+
c2: {
|
|
33
|
+
item: unknown;
|
|
34
|
+
};
|
|
35
|
+
c3: {
|
|
36
|
+
item: unknown;
|
|
37
|
+
};
|
|
38
|
+
c4: {
|
|
39
|
+
item: unknown;
|
|
40
|
+
};
|
|
41
|
+
c5: {
|
|
42
|
+
item: unknown;
|
|
43
|
+
};
|
|
44
|
+
c6: {
|
|
45
|
+
item: unknown;
|
|
46
|
+
};
|
|
47
|
+
c7: {
|
|
48
|
+
item: unknown;
|
|
49
|
+
};
|
|
50
|
+
c8: {
|
|
51
|
+
item: unknown;
|
|
52
|
+
};
|
|
53
|
+
c9: {
|
|
54
|
+
item: unknown;
|
|
55
|
+
};
|
|
56
|
+
c10: {
|
|
57
|
+
item: unknown;
|
|
58
|
+
};
|
|
59
|
+
c11: {
|
|
60
|
+
item: unknown;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export type TableProps = typeof __propDef.props;
|
|
65
|
+
export type TableEvents = typeof __propDef.events;
|
|
66
|
+
export type TableSlots = typeof __propDef.slots;
|
|
67
|
+
export default class Table extends SvelteComponentTyped<TableProps, TableEvents, TableSlots> {
|
|
68
|
+
get refresh(): () => void;
|
|
69
|
+
get update_objects(): (_objects: any) => void;
|
|
70
|
+
get update_self(): (_self: any) => void;
|
|
71
|
+
get select_item(): (itm: any, cinfo: any) => void;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export let label = 'lbl'
|
|
3
|
+
export let placeholder = 'Ex. Audi'
|
|
4
|
+
export let val = ''
|
|
5
|
+
export let sy = 'm'
|
|
6
|
+
|
|
7
|
+
export let r = 5;
|
|
8
|
+
|
|
9
|
+
export let s = 'sm'
|
|
10
|
+
let label_mb = '' //
|
|
11
|
+
let input_p = ''
|
|
12
|
+
|
|
13
|
+
switch (s)
|
|
14
|
+
{
|
|
15
|
+
case 'md':
|
|
16
|
+
label_mb = 'mb-2';
|
|
17
|
+
input_p = 'pt-2.5 pb-2.5'
|
|
18
|
+
break;
|
|
19
|
+
default:
|
|
20
|
+
label_mb = 'mb-1'
|
|
21
|
+
input_p = 'pt-0.5 pb-1'
|
|
22
|
+
break;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export let c='4-8'
|
|
28
|
+
let col_span = ''
|
|
29
|
+
switch (c)
|
|
30
|
+
{
|
|
31
|
+
case '4-4':
|
|
32
|
+
col_span = 'col-span-4';
|
|
33
|
+
break;
|
|
34
|
+
case '4-8':
|
|
35
|
+
col_span = 'col-span-4 sm:col-span-8';
|
|
36
|
+
break;
|
|
37
|
+
case '4-8-12':
|
|
38
|
+
col_span = 'col-span-4 sm:col-span-8 xl:col-span-12';
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
col_span = 'col-span-4 sm:col-span-8 xl:col-span-12';
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<div class="{col_span}">
|
|
48
|
+
<label for="name" class="block {label_mb} text-xs font-small text-gray-900 dark:text-white">{label}</label>
|
|
49
|
+
<textarea id="description" rows="5"
|
|
50
|
+
class="block {input_p} w-full text-sm text-gray-900 bg-gray-50
|
|
51
|
+
rounded-lg border border-gray-300 focus:ring-primary-500 focus:border-primary-500
|
|
52
|
+
dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white
|
|
53
|
+
dark:focus:ring-primary-500 dark:focus:border-primary-500"
|
|
54
|
+
placeholder={placeholder}>{val}</textarea>
|
|
55
|
+
</div>
|