@humandialog/forms.svelte 0.3.5 → 0.4.1
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 +30 -17
- package/components/Fab.svelte +82 -0
- package/components/Fab.svelte.d.ts +14 -0
- package/components/combo/combo.svelte +1 -1
- package/components/contextmenu.svelte +188 -0
- package/components/contextmenu.svelte.d.ts +24 -0
- package/components/delayed.spinner.svelte +18 -0
- package/components/delayed.spinner.svelte.d.ts +16 -0
- package/components/document/internal/palette.row.svelte +1 -1
- package/{icon.svelte → components/icon.svelte} +1 -6
- package/components/inputbox.ltop.svelte.d.ts +4 -4
- package/components/menu.d.ts +1 -0
- package/components/menu.js +16 -0
- package/components/simple.table.svelte.d.ts +4 -4
- package/components/table/_template.table.svelte.d.ts +4 -4
- package/components/table/table.svelte +19 -2
- package/components/table/table.svelte.d.ts +2 -0
- package/components/textarea.ltop.svelte.d.ts +2 -2
- package/components/tile.title.svelte.d.ts +2 -2
- package/desk.svelte +202 -0
- package/desk.svelte.d.ts +23 -0
- package/horizontal.toolbar.svelte +150 -0
- package/horizontal.toolbar.svelte.d.ts +23 -0
- package/index.d.ts +9 -1
- package/index.js +9 -1
- package/internal/configurable.content.svelte +81 -0
- package/internal/configurable.content.svelte.d.ts +27 -0
- package/internal/loading.svelte +6 -0
- package/internal/loading.svelte.d.ts +23 -0
- package/operations.svelte +35 -0
- package/operations.svelte.d.ts +14 -0
- package/package.json +19 -4
- package/page.svelte +34 -12
- package/page.svelte.d.ts +4 -0
- package/stores.d.ts +15 -0
- package/stores.js +72 -1
- package/vertical.toolbar.svelte +146 -0
- package/vertical.toolbar.svelte.d.ts +23 -0
- package/LICENSE +0 -21
- /package/{icon.svelte.d.ts → components/icon.svelte.d.ts} +0 -0
package/desk.svelte
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import HorizontalToolbar from './horizontal.toolbar.svelte'
|
|
3
|
+
import VerticalToolbar from './vertical.toolbar.svelte'
|
|
4
|
+
import Configurable from './internal/configurable.content.svelte'
|
|
5
|
+
import Operations from './operations.svelte'
|
|
6
|
+
import Fab from './components/Fab.svelte'
|
|
7
|
+
|
|
8
|
+
import {main_sidebar_visible_store,
|
|
9
|
+
tools_visible_store,
|
|
10
|
+
bottom_bar_visible_store,
|
|
11
|
+
auto_hide_sidebar,
|
|
12
|
+
has_selected_item,
|
|
13
|
+
dark_mode_store,
|
|
14
|
+
data_tick_store } from './stores.js'
|
|
15
|
+
|
|
16
|
+
import {session, AuthorizedView, Authorized, NotAuthorized, Auth} from '@humandialog/auth.svelte'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export let layout;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
let main_side_panel_visibility = "hidden"
|
|
23
|
+
let lg_content_area_horizontal_dim = ""
|
|
24
|
+
|
|
25
|
+
let visible_sidebar = "*"
|
|
26
|
+
|
|
27
|
+
$: { visible_sidebar = $main_sidebar_visible_store
|
|
28
|
+
|
|
29
|
+
if(visible_sidebar == "*")
|
|
30
|
+
{
|
|
31
|
+
main_side_panel_visibility = "hidden"
|
|
32
|
+
lg_content_area_horizontal_dim = ""
|
|
33
|
+
}
|
|
34
|
+
else
|
|
35
|
+
{
|
|
36
|
+
main_side_panel_visibility = "lg:block"
|
|
37
|
+
lg_content_area_horizontal_dim = "lg:left-[360px] lg:w-[calc(100vw-360px)]"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let tools_visibility = "hidden"
|
|
42
|
+
let tools_visible = false
|
|
43
|
+
let bottom_bar_visibility = "hidden"
|
|
44
|
+
let bottom_bar_visible = false
|
|
45
|
+
let lg_main_sidebar_height = ""
|
|
46
|
+
let lg_main_side_panel_height = "lg:h-[calc(100vh-240px)]"
|
|
47
|
+
let fab_bottom = "bottom-0"
|
|
48
|
+
|
|
49
|
+
let content_top = ""
|
|
50
|
+
let content_height = ""
|
|
51
|
+
|
|
52
|
+
$: { tools_visible = $tools_visible_store
|
|
53
|
+
bottom_bar_visible = $bottom_bar_visible_store
|
|
54
|
+
let dts = $data_tick_store;
|
|
55
|
+
|
|
56
|
+
if(!has_selected_item())
|
|
57
|
+
bottom_bar_visible = false;
|
|
58
|
+
|
|
59
|
+
if(tools_visible)
|
|
60
|
+
{
|
|
61
|
+
tools_visibility = "fixed"
|
|
62
|
+
content_top = "top-20 sm:top-10"
|
|
63
|
+
if(bottom_bar_visible)
|
|
64
|
+
content_height = "h-[calc(100vh-320px)] sm:h-[calc(100vh-280px)]"
|
|
65
|
+
else
|
|
66
|
+
content_height = "h-[calc(100vh-80px)] sm:h-[calc(100vh-40px)]"
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
{
|
|
71
|
+
tools_visibility = "hidden"
|
|
72
|
+
content_top = "top-10 sm:top-0"
|
|
73
|
+
if(bottom_bar_visible)
|
|
74
|
+
content_height = "h-[calc(100vh-280px)] sm:h-[calc(100vh-240px)]"
|
|
75
|
+
else
|
|
76
|
+
content_height = "h-[calc(100vh-40px)] sm:h-screen"
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if(bottom_bar_visible)
|
|
82
|
+
{
|
|
83
|
+
lg_main_sidebar_height = "lg:h-[calc(100vh-240px)]"
|
|
84
|
+
bottom_bar_visibility = "fixed"
|
|
85
|
+
fab_bottom = "bottom-[240px]";
|
|
86
|
+
}
|
|
87
|
+
else
|
|
88
|
+
{
|
|
89
|
+
lg_main_sidebar_height = ""
|
|
90
|
+
bottom_bar_visibility = "hidden"
|
|
91
|
+
fab_bottom = "bottom-0"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let sm_main_side_panel_width = "sm:w-[320px]"
|
|
97
|
+
let lg_main_content_height = "lg:h-[calc(100vh-280px)]"
|
|
98
|
+
|
|
99
|
+
$: outerWidth = 0;
|
|
100
|
+
$: innerWidth = 0;
|
|
101
|
+
$: outerHeight = 0;
|
|
102
|
+
$: innerHeight = 0;
|
|
103
|
+
const media_break_sm = 640; //px @media (min-width: 640px) { ... }
|
|
104
|
+
const media_break_md = 768; //px @media (min-width: 768px) { ... }
|
|
105
|
+
const media_break_lg = 1024; //px @media (min-width: 1024px) { ... }
|
|
106
|
+
const media_break_xl = 1280; //px @media (min-width: 1280px) { ... }
|
|
107
|
+
const media_break_2xl = 1536; //px
|
|
108
|
+
let test = "ala\n ma\n\tkota"
|
|
109
|
+
|
|
110
|
+
//$: screen.width = innerWidth;
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<svelte:window bind:innerWidth bind:outerWidth bind:innerHeight bind:outerHeight />
|
|
114
|
+
|
|
115
|
+
<AuthorizedView>
|
|
116
|
+
<div class="{$dark_mode_store}">
|
|
117
|
+
<div class="bg-white dark:bg-gray-900 dark:text-white min-h-screen h-screen">
|
|
118
|
+
<!--###########################################################-->
|
|
119
|
+
<!--## HORIZONTAL TOOLBAR (FOR PHONES) ######################-->
|
|
120
|
+
<!--###########################################################-->
|
|
121
|
+
<header class="fixed sm:hidden w-screen top-0 h-[40px] z-50 overflow-auto shadow shadow-slate-900/5 dark:shadow-none" >
|
|
122
|
+
<div class=" flex flex-row justify-between bg-slate-900 text-gray-100 ">
|
|
123
|
+
<HorizontalToolbar app_config={layout}/>
|
|
124
|
+
<div>
|
|
125
|
+
</header>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
<!--HorizontalToolbar /-->
|
|
129
|
+
<!--#######################################################-->
|
|
130
|
+
<!--## VERTICAL TOOLBAR ##################-->
|
|
131
|
+
<!--#######################################################-->
|
|
132
|
+
<div class="hidden sm:block fixed left-0 top-0 w-[40px] h-screen z-20 inset-0 overflow-hidden">
|
|
133
|
+
<div class="sticky top-0 flex h-full w-10 bg-slate-900 flex-col items-center text-gray-100 shadow">
|
|
134
|
+
<VerticalToolbar app_config={layout}/>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<!--VerticalToolbar /-->
|
|
139
|
+
|
|
140
|
+
<!--#######################################################-->
|
|
141
|
+
<!--## MAIN SIDE BAR ##################-->
|
|
142
|
+
<!--#######################################################-->
|
|
143
|
+
<div class="{main_side_panel_visibility} fixed left-0 top-10 w-screen h-[calc(100vh-40px)] z-10 overflow-x-hidden
|
|
144
|
+
sm:left-10 sm:top-0 {sm_main_side_panel_width} sm:h-full
|
|
145
|
+
{lg_main_sidebar_height}" >
|
|
146
|
+
|
|
147
|
+
<div class=" bg-slate-50 w-full h-full dark:bg-slate-800 overflow-y-auto py-4 px-0">
|
|
148
|
+
<Configurable config={layout.sidebar[visible_sidebar]}>
|
|
149
|
+
<div slot='alt'></div>
|
|
150
|
+
</Configurable>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
<!--###########################################################-->
|
|
154
|
+
<!--## HORIZONTAL TOOLS ######################-->
|
|
155
|
+
<!--###########################################################-->
|
|
156
|
+
|
|
157
|
+
<div class=" {tools_visibility} left-0 top-10 w-screen h-[40px]
|
|
158
|
+
sm:left-[40px] sm:top-0 sm:w-[calc(100vw-40px)]
|
|
159
|
+
{lg_content_area_horizontal_dim}
|
|
160
|
+
z-0 overflow-hidden " >
|
|
161
|
+
|
|
162
|
+
<Operations/>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<div class="{tools_visibility} right-3 {fab_bottom} mb-1 cursor-pointer z-20">
|
|
166
|
+
<Fab/>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<!--#######################################################-->
|
|
170
|
+
<!--## CONTENT ##################-->
|
|
171
|
+
<!--#######################################################-->
|
|
172
|
+
<div class="fixed left-0 w-screen
|
|
173
|
+
sm:left-[40px] sm:w-[calc(100vw-40px)]
|
|
174
|
+
{content_top}
|
|
175
|
+
{content_height}
|
|
176
|
+
{lg_content_area_horizontal_dim}
|
|
177
|
+
z-0 overflow-x-hidden"
|
|
178
|
+
|
|
179
|
+
on:click={(event) => {
|
|
180
|
+
auto_hide_sidebar()}} on:keydown={(event) => {
|
|
181
|
+
auto_hide_sidebar()}}>
|
|
182
|
+
<Configurable config={layout.mainContent}>
|
|
183
|
+
<div slot='alt'></div>
|
|
184
|
+
</Configurable>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
<!--###########################################################-->
|
|
190
|
+
<!--## BOTTOM SIDEBAR ###############################-->
|
|
191
|
+
<!--###########################################################-->
|
|
192
|
+
|
|
193
|
+
<div class="{bottom_bar_visibility} left-0 bottom-0 w-screen h-[240px] z-10 overflow-y-hidden overflow-x-auto
|
|
194
|
+
sm:left-[40px] sm:w-[100vw-40px] " >
|
|
195
|
+
<Configurable config={layout.selectionDetails} >
|
|
196
|
+
<div slot="alt"></div>
|
|
197
|
+
</Configurable>
|
|
198
|
+
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</AuthorizedView>
|
package/desk.svelte.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} DeskProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} DeskEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} DeskSlots */
|
|
4
|
+
export default class Desk extends SvelteComponentTyped<{
|
|
5
|
+
layout: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type DeskProps = typeof __propDef.props;
|
|
11
|
+
export type DeskEvents = typeof __propDef.events;
|
|
12
|
+
export type DeskSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
layout: any;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import FaMoon from 'svelte-icons/fa/FaMoon.svelte'
|
|
3
|
+
import FaSun from 'svelte-icons/fa/FaSun.svelte'
|
|
4
|
+
import FaEllipsisH from 'svelte-icons/fa/FaEllipsisH.svelte'
|
|
5
|
+
import FaTools from 'svelte-icons/fa/FaTools.svelte'
|
|
6
|
+
import GoPrimitiveDot from 'svelte-icons/go/GoPrimitiveDot.svelte'
|
|
7
|
+
import FaSignInAlt from 'svelte-icons/fa/FaSignInAlt.svelte'
|
|
8
|
+
import FaSignOutAlt from 'svelte-icons/fa/FaSignOutAlt.svelte'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
dark_mode_store,
|
|
12
|
+
toggle_sidebar,
|
|
13
|
+
show_sidebar,
|
|
14
|
+
hide_sidebar,
|
|
15
|
+
tools_visible_store,
|
|
16
|
+
bottom_bar_visible_store,
|
|
17
|
+
right_sidebar_visible_store,
|
|
18
|
+
main_sidebar_visible_store
|
|
19
|
+
} from "./stores.js";
|
|
20
|
+
import Icon from './components/icon.svelte';
|
|
21
|
+
import {session, signin_href, signout_href} from '@humandialog/auth.svelte'
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export let app_config;
|
|
25
|
+
|
|
26
|
+
let tabs = new Array();
|
|
27
|
+
let config = null;
|
|
28
|
+
let has_selection_details = false;
|
|
29
|
+
let has_horizontal_tools = false;
|
|
30
|
+
|
|
31
|
+
let show_sign_in_out_icons = false;
|
|
32
|
+
let is_logged_in = false;
|
|
33
|
+
let sign_in_href = '';
|
|
34
|
+
let sign_out_href = '';
|
|
35
|
+
|
|
36
|
+
$:
|
|
37
|
+
{
|
|
38
|
+
config = app_config.mainToolbar;
|
|
39
|
+
has_selection_details = app_config.selectionDetails;
|
|
40
|
+
has_horizontal_tools = app_config.horizontalTools;
|
|
41
|
+
is_logged_in = $session.is_active;
|
|
42
|
+
show_sign_in_out_icons = app_config.auth ? true : false;
|
|
43
|
+
sign_in_href = $signin_href;
|
|
44
|
+
sign_out_href = $signout_href;
|
|
45
|
+
|
|
46
|
+
tabs = new Array();
|
|
47
|
+
|
|
48
|
+
Object.keys(app_config.sidebar).forEach( (key) =>
|
|
49
|
+
{
|
|
50
|
+
const ctab = app_config.sidebar[key];
|
|
51
|
+
const can_show = (ctab.authorized && is_logged_in) || (!ctab.authorized)
|
|
52
|
+
if(can_show)
|
|
53
|
+
tabs.push({key: key, icon: ctab.icon});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// there is no current visible sidebar
|
|
57
|
+
if($main_sidebar_visible_store != '*')
|
|
58
|
+
{
|
|
59
|
+
if(tabs.every( (e) => e.key != $main_sidebar_visible_store))
|
|
60
|
+
{
|
|
61
|
+
if(tabs.length)
|
|
62
|
+
show_sidebar(tabs[0].key);
|
|
63
|
+
else
|
|
64
|
+
hide_sidebar();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<div class="mr-0 flex h-10">
|
|
72
|
+
{#each tabs as tab}
|
|
73
|
+
<button type="button" class=" w-16 h-full flex justify-center items-center hover:bg-orange-500"
|
|
74
|
+
class:text-blue-300={$main_sidebar_visible_store == tab.key}
|
|
75
|
+
on:click={()=> (toggle_sidebar(tab.key))}>
|
|
76
|
+
|
|
77
|
+
<Icon size={6} component={tab.icon}/>
|
|
78
|
+
</button>
|
|
79
|
+
{/each}
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div class="ml-auto flex h-10">
|
|
83
|
+
|
|
84
|
+
{#if show_sign_in_out_icons }
|
|
85
|
+
{#if !is_logged_in}
|
|
86
|
+
<a href={sign_in_href} class="h-full w-16 px-0 flex justify-center items-center text-slate-100 hover:bg-orange-500">
|
|
87
|
+
<Icon size={6} component={FaSignInAlt}/>
|
|
88
|
+
</a>
|
|
89
|
+
{:else}
|
|
90
|
+
<a href={sign_out_href} class="h-full w-16 px-0 flex justify-center items-center text-slate-100 hover:bg-orange-500">
|
|
91
|
+
<Icon size={6} component={FaSignOutAlt}/>
|
|
92
|
+
</a>
|
|
93
|
+
{/if}
|
|
94
|
+
{/if}
|
|
95
|
+
|
|
96
|
+
{#if has_horizontal_tools}
|
|
97
|
+
<button
|
|
98
|
+
class="h-full w-16 px-0 flex justify-center items-center text-slate-100 hover:bg-orange-500"
|
|
99
|
+
class:text-blue-300={$tools_visible_store}
|
|
100
|
+
on:click={()=> ($tools_visible_store = !$tools_visible_store)}
|
|
101
|
+
>
|
|
102
|
+
<Icon size={6} component={FaTools}/>
|
|
103
|
+
</button>
|
|
104
|
+
{/if}
|
|
105
|
+
|
|
106
|
+
{#if !config || config.darkMode }
|
|
107
|
+
{#if $dark_mode_store == ''}
|
|
108
|
+
<button
|
|
109
|
+
class="h-full w-16 px-0 flex justify-center items-center text-slate-100 hover:bg-orange-500"
|
|
110
|
+
on:click={()=> ($dark_mode_store = 'dark')}
|
|
111
|
+
>
|
|
112
|
+
<div class="w-6 h-6">
|
|
113
|
+
<FaMoon />
|
|
114
|
+
</div>
|
|
115
|
+
</button>
|
|
116
|
+
{:else}
|
|
117
|
+
<button
|
|
118
|
+
class="h-full w-16 px-0 flex justify-center items-center text-slate-100 hover:bg-orange-500"
|
|
119
|
+
on:click={()=> ($dark_mode_store = '')}
|
|
120
|
+
>
|
|
121
|
+
<div class="w-6 h-6">
|
|
122
|
+
<FaSun />
|
|
123
|
+
</div>
|
|
124
|
+
</button>
|
|
125
|
+
{/if}
|
|
126
|
+
{/if}
|
|
127
|
+
|
|
128
|
+
{#if !config || config.gotoRoot }
|
|
129
|
+
<a href='#/'>
|
|
130
|
+
<button
|
|
131
|
+
class="h-full w-16 px-0 flex justify-center items-center text-slate-100 hover:bg-orange-500"
|
|
132
|
+
>
|
|
133
|
+
<Icon size={6} component={GoPrimitiveDot} />
|
|
134
|
+
</button>
|
|
135
|
+
</a>
|
|
136
|
+
{/if}
|
|
137
|
+
|
|
138
|
+
{#if has_selection_details}
|
|
139
|
+
<button
|
|
140
|
+
class="h-full w-16 px-0 flex justify-center items-center text-slate-100 hover:bg-orange-500"
|
|
141
|
+
class:text-blue-300={$bottom_bar_visible_store}
|
|
142
|
+
on:click={()=> ($bottom_bar_visible_store = !$bottom_bar_visible_store)}
|
|
143
|
+
>
|
|
144
|
+
<div class="w-6 h-6">
|
|
145
|
+
<FaEllipsisH />
|
|
146
|
+
</div>
|
|
147
|
+
</button>
|
|
148
|
+
{/if}
|
|
149
|
+
|
|
150
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} HorizontalProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} HorizontalEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} HorizontalSlots */
|
|
4
|
+
export default class Horizontal extends SvelteComponentTyped<{
|
|
5
|
+
app_config: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type HorizontalProps = typeof __propDef.props;
|
|
11
|
+
export type HorizontalEvents = typeof __propDef.events;
|
|
12
|
+
export type HorizontalSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
app_config: any;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ export { default as Page } from "./page.svelte";
|
|
|
2
2
|
export { default as Tile } from "./tile.svelte";
|
|
3
3
|
export { default as Row } from "./tiles.row.svelte";
|
|
4
4
|
export { default as Box } from "./form.box.svelte";
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as Operations } from './operations.svelte';
|
|
6
|
+
export { default as Layout } from './desk.svelte';
|
|
7
|
+
export { default as Icon } from "./components/icon.svelte";
|
|
6
8
|
export { default as Button } from './components/button.svelte';
|
|
7
9
|
export { default as Checkbox } from './components/checkbox.svelte';
|
|
8
10
|
export { default as Date } from './components/date.svelte';
|
|
@@ -19,3 +21,9 @@ export { default as Combo } from './components/combo/combo.svelte';
|
|
|
19
21
|
export { default as ComboSource } from './components/combo/combo.source.svelte';
|
|
20
22
|
export { default as ComboItem } from './components/combo/combo.item.svelte';
|
|
21
23
|
export { default as RichEdit } from './components/document/rich.edit.svelte';
|
|
24
|
+
export { default as Spinner } from './components/delayed.spinner.svelte';
|
|
25
|
+
export { default as Menu } from './components/contextmenu.svelte';
|
|
26
|
+
export { show_menu } from './components/menu';
|
|
27
|
+
export { default as Fab } from './components/Fab.svelte';
|
|
28
|
+
export { data_tick_store, has_selected_item, has_data_item } from "./stores";
|
|
29
|
+
export { context_toolbar_operations, page_toolbar_operations, context_items_store } from './stores';
|
package/index.js
CHANGED
|
@@ -5,8 +5,10 @@ export { default as Tile } from "./tile.svelte";
|
|
|
5
5
|
export { default as Row } from "./tiles.row.svelte";
|
|
6
6
|
export { default as Box } from "./form.box.svelte";
|
|
7
7
|
//export { default as TilesVerticalRow } from "./tiles.vertical.row.svelte";
|
|
8
|
+
export { default as Operations } from './operations.svelte';
|
|
9
|
+
export { default as Layout } from './desk.svelte';
|
|
8
10
|
// @ts-ignore
|
|
9
|
-
export { default as Icon } from "./icon.svelte";
|
|
11
|
+
export { default as Icon } from "./components/icon.svelte";
|
|
10
12
|
export { default as Button } from './components/button.svelte';
|
|
11
13
|
export { default as Checkbox } from './components/checkbox.svelte';
|
|
12
14
|
export { default as Date } from './components/date.svelte';
|
|
@@ -23,3 +25,9 @@ export { default as Combo } from './components/combo/combo.svelte';
|
|
|
23
25
|
export { default as ComboSource } from './components/combo/combo.source.svelte';
|
|
24
26
|
export { default as ComboItem } from './components/combo/combo.item.svelte';
|
|
25
27
|
export { default as RichEdit } from './components/document/rich.edit.svelte';
|
|
28
|
+
export { default as Spinner } from './components/delayed.spinner.svelte';
|
|
29
|
+
export { default as Menu } from './components/contextmenu.svelte';
|
|
30
|
+
export { show_menu } from './components/menu';
|
|
31
|
+
export { default as Fab } from './components/Fab.svelte';
|
|
32
|
+
export { data_tick_store, has_selected_item, has_data_item } from "./stores";
|
|
33
|
+
export { context_toolbar_operations, page_toolbar_operations, context_items_store } from './stores'; // tmp
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Router from 'svelte-spa-router'
|
|
3
|
+
import {wrap} from 'svelte-spa-router/wrap'
|
|
4
|
+
import Loading from './loading.svelte'
|
|
5
|
+
|
|
6
|
+
export let config;
|
|
7
|
+
|
|
8
|
+
let component = null;
|
|
9
|
+
let props = {};
|
|
10
|
+
let routes = null;
|
|
11
|
+
|
|
12
|
+
$: {
|
|
13
|
+
if(config)
|
|
14
|
+
{
|
|
15
|
+
if(config.props)
|
|
16
|
+
props = config.props;
|
|
17
|
+
|
|
18
|
+
if(config.module)
|
|
19
|
+
{
|
|
20
|
+
import(config.module).then( (module) => {
|
|
21
|
+
component = module.default || module;
|
|
22
|
+
} );
|
|
23
|
+
}
|
|
24
|
+
else if(config.component)
|
|
25
|
+
component = config.component;
|
|
26
|
+
else if(config.routes)
|
|
27
|
+
{
|
|
28
|
+
routes = new Map();
|
|
29
|
+
Object.keys(config.routes).forEach((path) =>
|
|
30
|
+
{
|
|
31
|
+
const route_element = config.routes[path];
|
|
32
|
+
|
|
33
|
+
if(route_element.component)
|
|
34
|
+
{
|
|
35
|
+
routes.set(path, wrap({
|
|
36
|
+
component: route_element.component,
|
|
37
|
+
props: route_element.props,
|
|
38
|
+
conditions: route_element.conditions
|
|
39
|
+
}))
|
|
40
|
+
}
|
|
41
|
+
else if(route_element.module)
|
|
42
|
+
{
|
|
43
|
+
routes.set(path, wrap({
|
|
44
|
+
asyncComponent: () => import(route_element.module),
|
|
45
|
+
loadingComponent: Loading,
|
|
46
|
+
loadingParams: { message: 'Loading the route '+ route_element.module },
|
|
47
|
+
props: route_element.props,
|
|
48
|
+
conditions: route_element.conditions
|
|
49
|
+
}))
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
{
|
|
55
|
+
component = null;
|
|
56
|
+
props = {};
|
|
57
|
+
routes = null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
{
|
|
62
|
+
component = null;
|
|
63
|
+
props = {};
|
|
64
|
+
routes = null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
{#if routes}
|
|
72
|
+
<Router {routes}/>
|
|
73
|
+
{:else if component}
|
|
74
|
+
<svelte:component this={component} {...props}/>
|
|
75
|
+
{:else if config && config.module}
|
|
76
|
+
<p>Loading component...</p>
|
|
77
|
+
{:else}
|
|
78
|
+
<slot name="alt" />
|
|
79
|
+
{/if}
|
|
80
|
+
|
|
81
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} ConfigurableProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} ConfigurableEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} ConfigurableSlots */
|
|
4
|
+
export default class Configurable extends SvelteComponentTyped<{
|
|
5
|
+
config: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {
|
|
9
|
+
alt: {};
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type ConfigurableProps = typeof __propDef.props;
|
|
13
|
+
export type ConfigurableEvents = typeof __propDef.events;
|
|
14
|
+
export type ConfigurableSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
config: any;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {
|
|
24
|
+
alt: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} LoadingProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} LoadingEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} LoadingSlots */
|
|
4
|
+
export default class Loading extends SvelteComponentTyped<{
|
|
5
|
+
params: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type LoadingProps = typeof __propDef.props;
|
|
11
|
+
export type LoadingEvents = typeof __propDef.events;
|
|
12
|
+
export type LoadingSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
params: any;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script>import { context_toolbar_operations, page_toolbar_operations, context_items_store } from "./stores.js";
|
|
2
|
+
$:
|
|
3
|
+
update($page_toolbar_operations, $context_toolbar_operations);
|
|
4
|
+
let operations = [];
|
|
5
|
+
function update(...args) {
|
|
6
|
+
if ($context_toolbar_operations && $context_toolbar_operations.length > 0)
|
|
7
|
+
operations = $context_toolbar_operations;
|
|
8
|
+
else
|
|
9
|
+
operations = $page_toolbar_operations;
|
|
10
|
+
}
|
|
11
|
+
function on_click(operation) {
|
|
12
|
+
if (!operation)
|
|
13
|
+
return;
|
|
14
|
+
if (!operation.action)
|
|
15
|
+
return;
|
|
16
|
+
let focused_item = null;
|
|
17
|
+
if ($context_items_store.focused)
|
|
18
|
+
focused_item = $context_items_store[$context_items_store.focused];
|
|
19
|
+
operation.action(focused_item);
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div class="bg-slate-100 w-full h-10 dark:bg-slate-800 overflow-x-clip overflow-y-hidden py-0 text-xs flex flex-row">
|
|
24
|
+
|
|
25
|
+
{#each operations as operation}
|
|
26
|
+
<button type="button" class="py-2.5 px-5 text-xs font-medium text-gray-900 bg-slate-100 hover:bg-slate-200 border-r border-gray-200 focus:outline-none dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 inline-flex items-center"
|
|
27
|
+
on:click={(e) => {on_click(operation)}}>
|
|
28
|
+
<div class="w-3 h-3"><svelte:component this={operation.icon}/></div>
|
|
29
|
+
<span class="ml-1">{operation.caption}</span>
|
|
30
|
+
</button>
|
|
31
|
+
{/each}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type OperationsProps = typeof __propDef.props;
|
|
10
|
+
export type OperationsEvents = typeof __propDef.events;
|
|
11
|
+
export type OperationsSlots = typeof __propDef.slots;
|
|
12
|
+
export default class Operations extends SvelteComponentTyped<OperationsProps, OperationsEvents, OperationsSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|