@humandialog/forms.svelte 0.4.13 → 0.4.15
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/components/Floating_container.svelte +43 -10
- package/components/Floating_container.svelte.d.ts +4 -2
- package/components/Grid.menu.svelte +5 -3
- package/components/Grid.menu.svelte.d.ts +2 -2
- package/components/combo/combo.d.ts +2 -0
- package/components/combo/combo.js +2 -0
- package/components/combo/combo.source.svelte +6 -2
- package/components/combo/combo.source.svelte.d.ts +3 -1
- package/components/combo/combo.svelte +127 -83
- package/components/combo/combo.svelte.d.ts +5 -0
- package/components/contextmenu.svelte +23 -9
- package/components/contextmenu.svelte.d.ts +4 -2
- package/components/date.svelte +142 -25
- package/components/date.svelte.d.ts +7 -0
- package/components/list/List.d.ts +28 -0
- package/components/list/List.js +34 -0
- package/components/list/internal/list.element.svelte +295 -0
- package/components/list/internal/list.element.svelte.d.ts +29 -0
- package/components/list/internal/list.inserter.svelte +20 -0
- package/components/list/internal/list.inserter.svelte.d.ts +18 -0
- package/components/list/list.combo.svelte +20 -0
- package/components/list/list.combo.svelte.d.ts +21 -0
- package/components/list/list.date.svelte +14 -0
- package/components/list/list.date.svelte.d.ts +18 -0
- package/components/list/list.inserter.svelte +6 -0
- package/components/list/list.inserter.svelte.d.ts +16 -0
- package/components/list/list.summary.svelte +7 -0
- package/components/list/list.summary.svelte.d.ts +17 -0
- package/components/list/list.svelte +148 -0
- package/components/list/list.svelte.d.ts +41 -0
- package/components/list/list.title.svelte +7 -0
- package/components/list/list.title.svelte.d.ts +17 -0
- package/components/menu.d.ts +3 -3
- package/components/menu.js +20 -10
- package/components/sidebar/sidebar.item.svelte +27 -15
- package/components/sidebar/sidebar.item.svelte.d.ts +3 -0
- package/components/table/table.svelte +1 -1
- package/desk.svelte +67 -35
- package/horizontal.toolbar.svelte +11 -5
- package/index.d.ts +10 -3
- package/index.js +11 -3
- package/operations.svelte +11 -5
- package/operations.svelte.d.ts +3 -1
- package/package.json +11 -2
- package/page.svelte +8 -2
- package/stores.js +4 -3
- package/utils.d.ts +8 -0
- package/utils.js +59 -9
- package/vertical.toolbar.svelte +11 -4
package/desk.svelte
CHANGED
|
@@ -16,10 +16,43 @@
|
|
|
16
16
|
set_dark_mode_default } from './stores.js'
|
|
17
17
|
|
|
18
18
|
import {session, AuthorizedView, Authorized, NotAuthorized, Auth} from '@humandialog/auth.svelte'
|
|
19
|
-
import { handle_select } from './utils'
|
|
19
|
+
import { handle_select, is_device_smaller_than } from './utils'
|
|
20
|
+
import { onMount } from 'svelte';
|
|
20
21
|
|
|
21
22
|
export let layout;
|
|
22
23
|
|
|
24
|
+
onMount( () => {
|
|
25
|
+
window.addEventListener('resize', on_resize)
|
|
26
|
+
return () => {
|
|
27
|
+
window.removeEventListener('resize', on_resize)
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
function on_resize()
|
|
32
|
+
{
|
|
33
|
+
auto_hide_sidebar();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const sizes = {
|
|
37
|
+
bottom: 240,
|
|
38
|
+
toolbar: 40,
|
|
39
|
+
operations: 40,
|
|
40
|
+
sidebar: 320
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
$: outerWidth = 0
|
|
44
|
+
$: innerWidth = 0
|
|
45
|
+
$: outerHeight = 0
|
|
46
|
+
$: innerHeight = 0
|
|
47
|
+
|
|
48
|
+
const media_break_sm = 640; //px @media (min-width: 640px) { ... }
|
|
49
|
+
const media_break_md = 768; //px @media (min-width: 768px) { ... }
|
|
50
|
+
const media_break_lg = 1024; //px @media (min-width: 1024px) { ... }
|
|
51
|
+
const media_break_xl = 1280; //px @media (min-width: 1280px) { ... }
|
|
52
|
+
const media_break_2xl = 1536; //px
|
|
53
|
+
let test = "ala\n ma\n\tkota"
|
|
54
|
+
|
|
55
|
+
$: is_small = is_device_smaller_than("sm")
|
|
23
56
|
|
|
24
57
|
let main_side_panel_visibility = "hidden"
|
|
25
58
|
let lg_content_area_horizontal_dim = ""
|
|
@@ -54,7 +87,7 @@
|
|
|
54
87
|
else
|
|
55
88
|
{
|
|
56
89
|
main_side_panel_visibility = "lg:block"
|
|
57
|
-
lg_content_area_horizontal_dim =
|
|
90
|
+
lg_content_area_horizontal_dim = `lg:left-[360px] lg:w-[calc(100vw-360px)]`
|
|
58
91
|
}
|
|
59
92
|
}
|
|
60
93
|
|
|
@@ -63,7 +96,6 @@
|
|
|
63
96
|
let bottom_bar_visibility = "hidden"
|
|
64
97
|
let bottom_bar_visible = false
|
|
65
98
|
let lg_main_sidebar_height = ""
|
|
66
|
-
let lg_main_side_panel_height = "lg:h-[calc(100vh-240px)]"
|
|
67
99
|
let fab_bottom = "bottom-0"
|
|
68
100
|
|
|
69
101
|
let content_top = ""
|
|
@@ -75,34 +107,39 @@
|
|
|
75
107
|
|
|
76
108
|
if(!has_selected_item())
|
|
77
109
|
bottom_bar_visible = false;
|
|
78
|
-
|
|
110
|
+
|
|
79
111
|
if(tools_visible)
|
|
80
112
|
{
|
|
81
113
|
tools_visibility = "fixed"
|
|
82
|
-
|
|
114
|
+
|
|
115
|
+
if(is_small)
|
|
116
|
+
content_top = `top-[80px] sm:top-[40px]`
|
|
117
|
+
else
|
|
118
|
+
content_top = `top-[80px] sm:top-[40px]`
|
|
119
|
+
|
|
83
120
|
if(bottom_bar_visible)
|
|
84
|
-
content_height =
|
|
121
|
+
content_height = `h-[calc(100vh-320px)] sm:h-[calc(100vh-280px)]`
|
|
85
122
|
else
|
|
86
|
-
content_height =
|
|
123
|
+
content_height = `h-[calc(100vh-80px)] sm:h-[calc(100vh-40px)]`
|
|
87
124
|
|
|
88
125
|
}
|
|
89
126
|
else
|
|
90
127
|
{
|
|
91
128
|
tools_visibility = "hidden"
|
|
92
|
-
content_top =
|
|
129
|
+
content_top = `top-[40px] sm:top-0`
|
|
93
130
|
if(bottom_bar_visible)
|
|
94
|
-
content_height =
|
|
131
|
+
content_height = `h-[calc(100vh-280px)] sm:h-[calc(100vh-240px)]`
|
|
95
132
|
else
|
|
96
|
-
content_height =
|
|
133
|
+
content_height = `h-[calc(100vh-40px)] sm:h-screen`
|
|
97
134
|
}
|
|
98
135
|
|
|
99
136
|
|
|
100
137
|
|
|
101
138
|
if(bottom_bar_visible)
|
|
102
139
|
{
|
|
103
|
-
lg_main_sidebar_height =
|
|
140
|
+
lg_main_sidebar_height = `lg:h-[calc(100vh-240px)]`
|
|
104
141
|
bottom_bar_visibility = "fixed"
|
|
105
|
-
fab_bottom =
|
|
142
|
+
fab_bottom = `bottom-[240px]`;
|
|
106
143
|
}
|
|
107
144
|
else
|
|
108
145
|
{
|
|
@@ -113,20 +150,10 @@
|
|
|
113
150
|
|
|
114
151
|
}
|
|
115
152
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
$: innerWidth = 0;
|
|
121
|
-
$: outerHeight = 0;
|
|
122
|
-
$: innerHeight = 0;
|
|
123
|
-
const media_break_sm = 640; //px @media (min-width: 640px) { ... }
|
|
124
|
-
const media_break_md = 768; //px @media (min-width: 768px) { ... }
|
|
125
|
-
const media_break_lg = 1024; //px @media (min-width: 1024px) { ... }
|
|
126
|
-
const media_break_xl = 1280; //px @media (min-width: 1280px) { ... }
|
|
127
|
-
const media_break_2xl = 1536; //px
|
|
128
|
-
let test = "ala\n ma\n\tkota"
|
|
129
|
-
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
130
157
|
//$: screen.width = innerWidth;
|
|
131
158
|
</script>
|
|
132
159
|
|
|
@@ -164,9 +191,12 @@
|
|
|
164
191
|
<!--#######################################################-->
|
|
165
192
|
<!--## MAIN SIDE BAR ##################-->
|
|
166
193
|
<!--#######################################################-->
|
|
167
|
-
<div class="{main_side_panel_visibility} fixed
|
|
168
|
-
|
|
169
|
-
|
|
194
|
+
<div class="{main_side_panel_visibility} fixed
|
|
195
|
+
left-0 sm:left-[40px]
|
|
196
|
+
top-[40px] sm:top-0
|
|
197
|
+
h-[calc(100vh-40px)] sm:h-full {lg_main_sidebar_height}
|
|
198
|
+
w-screen sm:w-[320px]
|
|
199
|
+
z-10 overflow-x-hidden">
|
|
170
200
|
|
|
171
201
|
<div class=" bg-slate-50 w-full h-full dark:bg-slate-800 overflow-y-auto py-4 px-0">
|
|
172
202
|
<Configurable config={layout.sidebar[visible_sidebar]}>
|
|
@@ -178,15 +208,18 @@
|
|
|
178
208
|
<!--## HORIZONTAL TOOLS ######################-->
|
|
179
209
|
<!--###########################################################-->
|
|
180
210
|
|
|
181
|
-
<div class=" {tools_visibility}
|
|
182
|
-
|
|
211
|
+
<div class=" {tools_visibility}
|
|
212
|
+
w-screen sm:w-[calc(100vw-40px)]
|
|
213
|
+
h-[40px]
|
|
214
|
+
left-0 sm:left-[40px]
|
|
215
|
+
top-[40px] sm:top-0
|
|
183
216
|
{lg_content_area_horizontal_dim}
|
|
184
217
|
z-0 overflow-hidden " >
|
|
185
218
|
|
|
186
219
|
<Operations/>
|
|
187
220
|
</div>
|
|
188
221
|
|
|
189
|
-
<div class="{tools_visibility} right-3 {fab_bottom} mb-1 cursor-pointer z-20">
|
|
222
|
+
<div class="!hidden {tools_visibility} right-3 {fab_bottom} mb-1 cursor-pointer z-20">
|
|
190
223
|
<Fab/>
|
|
191
224
|
</div>
|
|
192
225
|
|
|
@@ -200,9 +233,8 @@
|
|
|
200
233
|
{lg_content_area_horizontal_dim}
|
|
201
234
|
z-0 overflow-x-hidden"
|
|
202
235
|
|
|
203
|
-
on:click={(
|
|
204
|
-
|
|
205
|
-
auto_hide_sidebar()}}>
|
|
236
|
+
on:click={(e) => auto_hide_sidebar() }
|
|
237
|
+
on:keydown={(e) => auto_hide_sidebar()}>
|
|
206
238
|
<Configurable config={layout.mainContent}>
|
|
207
239
|
<div slot='alt'></div>
|
|
208
240
|
</Configurable>
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
let sidebar = $main_sidebar_visible_store;
|
|
72
72
|
if(sidebar == "*")
|
|
73
73
|
{
|
|
74
|
-
if(!previously_visible_sidebar)
|
|
74
|
+
if((!previously_visible_sidebar) || previously_visible_sidebar === '*')
|
|
75
75
|
sidebar = Object.keys(app_config.sidebar)[0];
|
|
76
76
|
else
|
|
77
77
|
sidebar = previously_visible_sidebar;
|
|
@@ -83,9 +83,14 @@
|
|
|
83
83
|
|
|
84
84
|
function show_options(e)
|
|
85
85
|
{
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
let owner = e.target;
|
|
87
|
+
while(owner && owner.tagName != 'BUTTON')
|
|
88
|
+
owner = owner.parentElement
|
|
89
|
+
|
|
90
|
+
if(!owner)
|
|
91
|
+
return;
|
|
92
|
+
|
|
93
|
+
let rect = owner.getBoundingClientRect();
|
|
89
94
|
let options = [];
|
|
90
95
|
|
|
91
96
|
if(show_sign_in_out_icons)
|
|
@@ -149,7 +154,8 @@
|
|
|
149
154
|
});
|
|
150
155
|
}
|
|
151
156
|
|
|
152
|
-
|
|
157
|
+
let pt = new DOMPoint(rect.left, rect.bottom)
|
|
158
|
+
show_menu(pt, options);
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
</script>
|
package/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { default as Layout } from './desk.svelte';
|
|
|
7
7
|
export { default as Icon } from "./components/icon.svelte";
|
|
8
8
|
export { default as Button } from './components/button.svelte';
|
|
9
9
|
export { default as Checkbox } from './components/checkbox.svelte';
|
|
10
|
-
export { default as
|
|
10
|
+
export { default as DatePicker } from './components/date.svelte';
|
|
11
11
|
export { default as Edit } from './components/edit.field.svelte';
|
|
12
12
|
export { default as FileLoader } from './components/file.loader.svelte';
|
|
13
13
|
export { default as Input } from './components/inputbox.ltop.svelte';
|
|
@@ -28,6 +28,13 @@ export { default as Sidebar } from './components/sidebar/sidebar.svelte';
|
|
|
28
28
|
export { default as SidebarBrand } from './components/sidebar/sidebar.brand.svelte';
|
|
29
29
|
export { default as SidebarGroup } from './components/sidebar/sidebar.group.svelte';
|
|
30
30
|
export { default as SidebarItem } from './components/sidebar/sidebar.item.svelte';
|
|
31
|
-
export {
|
|
31
|
+
export { default as List } from './components/list/list.svelte';
|
|
32
|
+
export { default as ListTitle } from './components/list/list.title.svelte';
|
|
33
|
+
export { default as ListSummary } from './components/list/list.summary.svelte';
|
|
34
|
+
export { default as ListInserter } from './components/list/list.inserter.svelte';
|
|
35
|
+
export { default as ListDateProperty } from './components/list/list.date.svelte';
|
|
36
|
+
export { default as ListComboProperty } from './components/list/list.combo.svelte';
|
|
37
|
+
export { select_item, activate_item, clear_active_item, is_active, is_selected, get_active, editable, start_editing, selectable, handle_select } from './utils';
|
|
32
38
|
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';
|
|
39
|
+
export { context_toolbar_operations, page_toolbar_operations, context_items_store, context_types_store } from './stores';
|
|
40
|
+
export { inform_modification, inform_item, push_changes } from './updates';
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
+
import { List } from "flowbite-svelte";
|
|
2
3
|
//export { default as Row } from "./page.row.svelte";
|
|
3
4
|
export { default as Page } from "./page.svelte";
|
|
4
5
|
export { default as Tile } from "./tile.svelte";
|
|
@@ -11,7 +12,7 @@ export { default as Layout } from './desk.svelte';
|
|
|
11
12
|
export { default as Icon } from "./components/icon.svelte";
|
|
12
13
|
export { default as Button } from './components/button.svelte';
|
|
13
14
|
export { default as Checkbox } from './components/checkbox.svelte';
|
|
14
|
-
export { default as
|
|
15
|
+
export { default as DatePicker } from './components/date.svelte';
|
|
15
16
|
export { default as Edit } from './components/edit.field.svelte';
|
|
16
17
|
export { default as FileLoader } from './components/file.loader.svelte';
|
|
17
18
|
export { default as Input } from './components/inputbox.ltop.svelte';
|
|
@@ -33,6 +34,13 @@ export { default as Sidebar } from './components/sidebar/sidebar.svelte';
|
|
|
33
34
|
export { default as SidebarBrand } from './components/sidebar/sidebar.brand.svelte';
|
|
34
35
|
export { default as SidebarGroup } from './components/sidebar/sidebar.group.svelte';
|
|
35
36
|
export { default as SidebarItem } from './components/sidebar/sidebar.item.svelte';
|
|
36
|
-
export {
|
|
37
|
+
export { default as List } from './components/list/list.svelte';
|
|
38
|
+
export { default as ListTitle } from './components/list/list.title.svelte';
|
|
39
|
+
export { default as ListSummary } from './components/list/list.summary.svelte';
|
|
40
|
+
export { default as ListInserter } from './components/list/list.inserter.svelte';
|
|
41
|
+
export { default as ListDateProperty } from './components/list/list.date.svelte';
|
|
42
|
+
export { default as ListComboProperty } from './components/list/list.combo.svelte';
|
|
43
|
+
export { select_item, activate_item, clear_active_item, is_active, is_selected, get_active, editable, start_editing, selectable, handle_select } from './utils';
|
|
37
44
|
export { data_tick_store, has_selected_item, has_data_item } from "./stores";
|
|
38
|
-
export { context_toolbar_operations, page_toolbar_operations, context_items_store } from './stores'; // tmp
|
|
45
|
+
export { context_toolbar_operations, page_toolbar_operations, context_items_store, context_types_store } from './stores'; // tmp
|
|
46
|
+
export { inform_modification, inform_item, push_changes } from './updates'; // tmp
|
package/operations.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>import { show_floating_toolbar, show_menu, show_grid_menu } from "./components/menu.js";
|
|
2
2
|
import { context_toolbar_operations, page_toolbar_operations, context_items_store } from "./stores.js";
|
|
3
|
+
export let mobile = false;
|
|
3
4
|
$:
|
|
4
5
|
update($page_toolbar_operations, $context_toolbar_operations);
|
|
5
6
|
let operations = [];
|
|
@@ -25,24 +26,29 @@ function on_click(e, operation) {
|
|
|
25
26
|
if (!owner)
|
|
26
27
|
return;
|
|
27
28
|
let rect = owner.getBoundingClientRect();
|
|
29
|
+
let x = rect.left;
|
|
30
|
+
let y = mobile ? rect.top : rect.bottom;
|
|
28
31
|
if (operation.menu)
|
|
29
|
-
show_menu(rect
|
|
32
|
+
show_menu(rect, operation.menu);
|
|
30
33
|
else if (operation.toolbar)
|
|
31
|
-
show_floating_toolbar(rect
|
|
34
|
+
show_floating_toolbar(rect, operation.toolbar);
|
|
32
35
|
else if (operation.grid)
|
|
33
|
-
show_grid_menu(rect
|
|
36
|
+
show_grid_menu(rect, operation.grid);
|
|
34
37
|
}
|
|
35
38
|
</script>
|
|
36
39
|
|
|
37
|
-
<div
|
|
40
|
+
<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"
|
|
41
|
+
class:flex-row-reverse={mobile}>
|
|
38
42
|
|
|
39
43
|
{#each operations as operation}
|
|
40
44
|
<button type="button"
|
|
41
45
|
class="py-2.5 px-5
|
|
42
46
|
text-xs font-medium text-gray-900 dark:text-gray-400 dark:hover:text-white
|
|
43
47
|
bg-slate-100 hover:bg-slate-200 dark:bg-gray-800 dark:hover:bg-gray-700 active:bg-slate-300 dark:active:bg-gray-600
|
|
44
|
-
border-
|
|
48
|
+
border-gray-200 focus:outline-none dark:border-gray-600
|
|
45
49
|
inline-flex items-center"
|
|
50
|
+
class:border-r={!mobile}
|
|
51
|
+
class:border-l={mobile}
|
|
46
52
|
on:click={(e) => {on_click(e, operation)}}>
|
|
47
53
|
<div class="w-3 h-3"><svelte:component this={operation.icon}/></div>
|
|
48
54
|
<span class="ml-1">{operation.caption}</span>
|
package/operations.svelte.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@humandialog/forms.svelte",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
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.0.
|
|
29
|
+
"@humandialog/auth.svelte": "^1.0.4",
|
|
30
30
|
"flowbite-svelte": "^0.29.13",
|
|
31
31
|
"svelte-icons": "^2.1.0",
|
|
32
32
|
"svelte-spa-router": "^3.3.0"
|
|
@@ -74,6 +74,15 @@
|
|
|
74
74
|
"./components/icon.svelte": "./components/icon.svelte",
|
|
75
75
|
"./components/input.text.svelte": "./components/input.text.svelte",
|
|
76
76
|
"./components/inputbox.ltop.svelte": "./components/inputbox.ltop.svelte",
|
|
77
|
+
"./components/list/internal/list.element.svelte": "./components/list/internal/list.element.svelte",
|
|
78
|
+
"./components/list/internal/list.inserter.svelte": "./components/list/internal/list.inserter.svelte",
|
|
79
|
+
"./components/list/list.combo.svelte": "./components/list/list.combo.svelte",
|
|
80
|
+
"./components/list/list.date.svelte": "./components/list/list.date.svelte",
|
|
81
|
+
"./components/list/list.inserter.svelte": "./components/list/list.inserter.svelte",
|
|
82
|
+
"./components/list/list.summary.svelte": "./components/list/list.summary.svelte",
|
|
83
|
+
"./components/list/list.svelte": "./components/list/list.svelte",
|
|
84
|
+
"./components/list/list.title.svelte": "./components/list/list.title.svelte",
|
|
85
|
+
"./components/list/List": "./components/list/List.js",
|
|
77
86
|
"./components/menu": "./components/menu.js",
|
|
78
87
|
"./components/radio.svelte": "./components/radio.svelte",
|
|
79
88
|
"./components/sidebar/sidebar.brand.svelte": "./components/sidebar/sidebar.brand.svelte",
|
package/page.svelte
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
context_toolbar_operations,
|
|
9
9
|
page_toolbar_operations } from './stores.js'
|
|
10
10
|
|
|
11
|
+
//import {chnages} from './utils.js'
|
|
11
12
|
|
|
12
13
|
export let context = "data"
|
|
13
14
|
export let self = null
|
|
@@ -67,6 +68,8 @@
|
|
|
67
68
|
let t = 0
|
|
68
69
|
$: {
|
|
69
70
|
t = $data_tick_store
|
|
71
|
+
//chnages.just_changed_context = false;
|
|
72
|
+
|
|
70
73
|
if (t > last_tick) {
|
|
71
74
|
last_tick = t
|
|
72
75
|
if (self != null)
|
|
@@ -92,9 +95,12 @@
|
|
|
92
95
|
|
|
93
96
|
function clear_selection(e)
|
|
94
97
|
{
|
|
98
|
+
//console.log('page click', chnages.just_changed_context)
|
|
95
99
|
if(!clears_context)
|
|
96
100
|
return;
|
|
97
101
|
|
|
102
|
+
|
|
103
|
+
|
|
98
104
|
let contexts = clears_context.split(' ');
|
|
99
105
|
contexts.forEach(c =>
|
|
100
106
|
{
|
|
@@ -102,8 +108,8 @@
|
|
|
102
108
|
$context_info_store[c] = '';
|
|
103
109
|
})
|
|
104
110
|
|
|
105
|
-
e.stopPropagation();
|
|
106
|
-
|
|
111
|
+
//e.stopPropagation();
|
|
112
|
+
|
|
107
113
|
$context_toolbar_operations = [];
|
|
108
114
|
$data_tick_store = $data_tick_store + 1;
|
|
109
115
|
}
|
package/stores.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {writable, get} from 'svelte/store';
|
|
3
|
+
import {SCREEN_SIZES} from './utils.js'
|
|
3
4
|
|
|
4
5
|
export const data_tick_store = writable(1);
|
|
5
6
|
export const context_items_store = writable({focused:'', data: null, sel: null})
|
|
@@ -93,12 +94,12 @@ export function toggle_sidebar(index)
|
|
|
93
94
|
|
|
94
95
|
export function auto_hide_sidebar()
|
|
95
96
|
{
|
|
96
|
-
//
|
|
97
|
+
//console.log("sw: " + window.innerWidth, SCREEN_SIZES.lg)
|
|
97
98
|
|
|
98
|
-
if(
|
|
99
|
+
if(window.innerWidth < SCREEN_SIZES.lg)
|
|
99
100
|
hide_sidebar()
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
+
|
|
102
103
|
export function hide_sidebar()
|
|
103
104
|
{
|
|
104
105
|
previously_visible_sidebar = get(main_sidebar_visible_store);
|
package/utils.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export function is_device_smaller_than(br: any): boolean;
|
|
1
2
|
export function select_item(itm: any): void;
|
|
2
3
|
export function activate_item(context_level: any, itm: any, operations?: null): void;
|
|
3
4
|
export function clear_active_item(context_level: any): void;
|
|
4
5
|
export function is_selected(itm: any): boolean;
|
|
5
6
|
export function is_active(context_level: any, itm: any): boolean;
|
|
7
|
+
export function get_active(context_level: any): any;
|
|
6
8
|
export function editable(node: any, action: any): {
|
|
7
9
|
destroy(): void;
|
|
8
10
|
};
|
|
@@ -16,3 +18,9 @@ export function should_be_comapact(): boolean;
|
|
|
16
18
|
export namespace icons {
|
|
17
19
|
const symbols: null;
|
|
18
20
|
}
|
|
21
|
+
export namespace SCREEN_SIZES {
|
|
22
|
+
const sm: number;
|
|
23
|
+
const md: number;
|
|
24
|
+
const lg: number;
|
|
25
|
+
const xl: number;
|
|
26
|
+
}
|
package/utils.js
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import { getContext, tick } from "svelte";
|
|
2
2
|
import {get} from 'svelte/store'
|
|
3
|
-
import { context_items_store, context_toolbar_operations } from "./stores";
|
|
3
|
+
import { context_items_store, context_toolbar_operations, data_tick_store } from "./stores";
|
|
4
4
|
|
|
5
5
|
export let icons = {symbols :null}
|
|
6
6
|
|
|
7
|
+
export const SCREEN_SIZES = {
|
|
8
|
+
sm: 640, //px @media (min-width: 640px) { ... }
|
|
9
|
+
md: 768, //px @media (min-width: 768px) { ... }
|
|
10
|
+
lg: 1024, //px @media (min-width: 1024px) { ... }
|
|
11
|
+
xl: 1280, //px @media (min-width: 1280px) { ... }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function is_device_smaller_than(br)
|
|
15
|
+
{
|
|
16
|
+
return window.innerWidth < SCREEN_SIZES[br]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//export const chnages = {
|
|
20
|
+
// just_changed_context: false
|
|
21
|
+
//}
|
|
22
|
+
|
|
7
23
|
export function select_item(itm)
|
|
8
24
|
{
|
|
9
25
|
let data_context = get(context_items_store);
|
|
10
26
|
data_context['sel'] = itm;
|
|
11
27
|
data_context.focused = 'sel';
|
|
12
28
|
context_items_store.set( {...data_context} )
|
|
29
|
+
|
|
30
|
+
let ticket = get(data_tick_store)
|
|
31
|
+
ticket++;
|
|
32
|
+
data_tick_store.set(ticket)
|
|
33
|
+
|
|
34
|
+
//chnages.just_changed_context = true;
|
|
35
|
+
|
|
13
36
|
}
|
|
14
37
|
|
|
15
38
|
export function activate_item(context_level, itm, operations=null)
|
|
@@ -20,6 +43,12 @@ export function activate_item(context_level, itm, operations=null)
|
|
|
20
43
|
data_context.focused = context_level;
|
|
21
44
|
context_items_store.set( {...data_context} )
|
|
22
45
|
|
|
46
|
+
let ticket = get(data_tick_store)
|
|
47
|
+
ticket++;
|
|
48
|
+
data_tick_store.set(ticket)
|
|
49
|
+
|
|
50
|
+
//chnages.just_changed_context = true;
|
|
51
|
+
|
|
23
52
|
if(operations && Array.isArray(operations))
|
|
24
53
|
context_toolbar_operations.set( [...operations] )
|
|
25
54
|
}
|
|
@@ -31,6 +60,12 @@ export function clear_active_item(context_level)
|
|
|
31
60
|
data_context.focused = context_level;
|
|
32
61
|
context_items_store.set( {...data_context} )
|
|
33
62
|
|
|
63
|
+
let ticket = get(data_tick_store)
|
|
64
|
+
ticket++;
|
|
65
|
+
data_tick_store.set(ticket)
|
|
66
|
+
|
|
67
|
+
//chnages.just_changed_context = true;
|
|
68
|
+
|
|
34
69
|
context_toolbar_operations.set( [] )
|
|
35
70
|
}
|
|
36
71
|
|
|
@@ -53,13 +88,21 @@ export function is_active(context_level, itm)
|
|
|
53
88
|
return false;
|
|
54
89
|
}
|
|
55
90
|
|
|
91
|
+
export function get_active(context_level)
|
|
92
|
+
{
|
|
93
|
+
let data_context = get(context_items_store);
|
|
94
|
+
if(data_context != undefined)
|
|
95
|
+
return data_context[context_level]
|
|
96
|
+
else
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
56
99
|
|
|
57
100
|
export function editable(node, action)
|
|
58
101
|
{
|
|
59
102
|
const org_text = node.textContent;
|
|
60
103
|
const blur_listener = async (e) =>
|
|
61
104
|
{
|
|
62
|
-
await finish_editing(
|
|
105
|
+
await finish_editing(false, false);
|
|
63
106
|
}
|
|
64
107
|
|
|
65
108
|
const key_listener = async (e) =>
|
|
@@ -68,20 +111,20 @@ export function editable(node, action)
|
|
|
68
111
|
{
|
|
69
112
|
case 'Esc':
|
|
70
113
|
case 'Escape':
|
|
71
|
-
await finish_editing(true);
|
|
114
|
+
await finish_editing(true, false);
|
|
72
115
|
e.stopPropagation();
|
|
73
116
|
e.preventDefault();
|
|
74
117
|
break;
|
|
75
118
|
|
|
76
119
|
case 'Enter':
|
|
77
|
-
await finish_editing(false);
|
|
120
|
+
await finish_editing(false, true);
|
|
78
121
|
e.stopPropagation();
|
|
79
122
|
e.preventDefault();
|
|
80
123
|
break;
|
|
81
124
|
}
|
|
82
125
|
}
|
|
83
126
|
|
|
84
|
-
const finish_editing = async (cancel) =>
|
|
127
|
+
const finish_editing = async (cancel, incremental) =>
|
|
85
128
|
{
|
|
86
129
|
node.removeEventListener("blur", blur_listener);
|
|
87
130
|
node.removeEventListener("keydown", key_listener);
|
|
@@ -99,7 +142,15 @@ export function editable(node, action)
|
|
|
99
142
|
await action(node.textContent)
|
|
100
143
|
}
|
|
101
144
|
|
|
102
|
-
|
|
145
|
+
const finish_event = new CustomEvent("finish", {
|
|
146
|
+
detail:
|
|
147
|
+
{
|
|
148
|
+
cancel: cancel,
|
|
149
|
+
incremental: incremental
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
node.dispatchEvent(finish_event);
|
|
103
154
|
node.removeEventListener("finish", (e) => {});
|
|
104
155
|
}
|
|
105
156
|
|
|
@@ -152,7 +203,7 @@ export function start_editing(element, finish_callback)
|
|
|
152
203
|
|
|
153
204
|
if(finish_callback)
|
|
154
205
|
{
|
|
155
|
-
editable_node.addEventListener("finish", (e) => {finish_callback()})
|
|
206
|
+
editable_node.addEventListener("finish", (e) => { finish_callback(e.detail) })
|
|
156
207
|
}
|
|
157
208
|
|
|
158
209
|
const edit_event = new Event("edit")
|
|
@@ -178,8 +229,7 @@ export function selectable(node, itm)
|
|
|
178
229
|
}
|
|
179
230
|
catch(err)
|
|
180
231
|
{
|
|
181
|
-
console.error(err);
|
|
182
|
-
console.log(node);
|
|
232
|
+
console.error(err, node);
|
|
183
233
|
}
|
|
184
234
|
}};
|
|
185
235
|
}
|
package/vertical.toolbar.svelte
CHANGED
|
@@ -76,9 +76,15 @@
|
|
|
76
76
|
|
|
77
77
|
function show_options(e)
|
|
78
78
|
{
|
|
79
|
-
|
|
80
|
-
let
|
|
81
|
-
|
|
79
|
+
|
|
80
|
+
let owner = e.target;
|
|
81
|
+
while(owner && owner.tagName != 'BUTTON')
|
|
82
|
+
owner = owner.parentElement
|
|
83
|
+
|
|
84
|
+
if(!owner)
|
|
85
|
+
return;
|
|
86
|
+
|
|
87
|
+
let rect = owner.getBoundingClientRect();
|
|
82
88
|
let options = [];
|
|
83
89
|
|
|
84
90
|
if(show_sign_in_out_icons)
|
|
@@ -142,7 +148,8 @@
|
|
|
142
148
|
});
|
|
143
149
|
}
|
|
144
150
|
|
|
145
|
-
|
|
151
|
+
let pt = new DOMPoint(rect.right, rect.top)
|
|
152
|
+
show_menu(pt, options);
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
</script>
|