@medyll/idae-slotui-svelte 0.122.1 → 0.123.0
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 +47 -47
- package/dist/base/alert/Alert.demo.svelte +62 -62
- package/dist/base/alert/Alert.svelte +121 -121
- package/dist/base/alert/alert.scss +93 -93
- package/dist/base/avatar/Avatar.demo.svelte +41 -41
- package/dist/base/avatar/Avatar.preview.svelte +6 -6
- package/dist/base/avatar/Avatar.svelte +65 -65
- package/dist/base/avatar/avatar.scss +17 -17
- package/dist/base/backdrop/Backdrop.demo.svelte +49 -49
- package/dist/base/backdrop/Backdrop.svelte +78 -78
- package/dist/base/backdrop/backdrop.scss +34 -34
- package/dist/base/badge/Badge.svelte +31 -31
- package/dist/base/badge/badge.scss +19 -19
- package/dist/base/box/Box.demo.svelte +54 -54
- package/dist/base/box/Box.svelte +72 -72
- package/dist/base/box/box.scss +33 -33
- package/dist/base/breadCrumb/BreadCrumb.svelte +23 -23
- package/dist/base/breadCrumb/breadcrumb.scss +11 -11
- package/dist/base/cartouche/Cartouche.demo.svelte +108 -108
- package/dist/base/cartouche/Cartouche.svelte +114 -114
- package/dist/base/cartouche/cartouche.scss +114 -114
- package/dist/base/chipper/Chipper.demo.svelte +45 -45
- package/dist/base/chipper/Chipper.svelte +36 -36
- package/dist/base/chipper/chipper.scss +65 -65
- package/dist/base/columner/Column.svelte +62 -62
- package/dist/base/columner/Columner.demo.svelte +15 -15
- package/dist/base/columner/Columner.svelte +21 -21
- package/dist/base/contentSwitcher/ContentSwitcher.demo.svelte +45 -45
- package/dist/base/contentSwitcher/ContentSwitcher.svelte +63 -63
- package/dist/base/contentSwitcher/content-switcher.scss +22 -22
- package/dist/base/debug/Debug.svelte +21 -21
- package/dist/base/demoer/DemoPage.svelte +40 -40
- package/dist/base/demoer/Demoer.svelte +170 -170
- package/dist/base/demoer/DemoerCode.svelte +45 -45
- package/dist/base/demoer/DemoerComponent.svelte +50 -50
- package/dist/base/divider/Divider.demo.svelte +34 -34
- package/dist/base/divider/Divider.svelte +68 -68
- package/dist/base/divider/divider.scss +19 -19
- package/dist/base/icon/Icon.demo.svelte +24 -24
- package/dist/base/icon/Icon.svelte +117 -117
- package/dist/base/icon/icon.scss +17 -17
- package/dist/base/paper/Paper.demo.svelte +31 -31
- package/dist/base/paper/Paper.svelte +20 -20
- package/dist/base/paper/paper.scss +15 -15
- package/dist/base/titleBar/TitleBar.demo.svelte +30 -30
- package/dist/base/titleBar/TitleBar.svelte +40 -40
- package/dist/base/titleBar/title-bar.scss +29 -29
- package/dist/controls/autocomplete/AutoComplete.demo.svelte +88 -88
- package/dist/controls/autocomplete/AutoComplete.svelte +152 -152
- package/dist/controls/autocomplete/auto-complete.scss +15 -15
- package/dist/controls/button/Button.demo.svelte +165 -165
- package/dist/controls/button/Button.svelte +95 -95
- package/dist/controls/button/ButtonAction.svelte +55 -55
- package/dist/controls/button/ButtonMenu.svelte +55 -55
- package/dist/controls/button/IconButton.svelte +45 -45
- package/dist/controls/button/button-action.scss +8 -8
- package/dist/controls/button/button-menu.scss +36 -36
- package/dist/controls/button/button.scss +293 -293
- package/dist/controls/checkbox/Checkbox.demo.svelte +29 -29
- package/dist/controls/checkbox/Checkbox.svelte +59 -59
- package/dist/controls/checkbox/checkbox.scss +115 -115
- package/dist/controls/confirm/Confirm.demo.svelte +60 -60
- package/dist/controls/confirm/Confirm.preview.svelte +14 -14
- package/dist/controls/confirm/Confirm.svelte +156 -156
- package/dist/controls/confirm/confirm.scss +12 -12
- package/dist/controls/inplaceedit/InPlaceEdit.demo.svelte +41 -41
- package/dist/controls/inplaceedit/InPlaceEdit.svelte +109 -109
- package/dist/controls/progress/Progress.demo.svelte +30 -30
- package/dist/controls/progress/Progress.svelte +26 -26
- package/dist/controls/progress/progress.scss +23 -23
- package/dist/controls/rating/Rating.demo.svelte +45 -45
- package/dist/controls/rating/Rating.svelte +44 -44
- package/dist/controls/rating/rating.scss +9 -9
- package/dist/controls/select/Select.demo.svelte +101 -101
- package/dist/controls/select/Select.svelte +125 -125
- package/dist/controls/select/select.scss +13 -13
- package/dist/controls/slider/Slider.demo.svelte +34 -34
- package/dist/controls/slider/Slider.svelte +153 -153
- package/dist/controls/slider/slider.scss +51 -51
- package/dist/controls/stepper/Stepper.demo.svelte +32 -32
- package/dist/controls/stepper/Stepper.svelte +30 -30
- package/dist/controls/stepper/stepper.scss +23 -23
- package/dist/controls/switch/Switch.demo.svelte +61 -61
- package/dist/controls/switch/Switch.svelte +45 -45
- package/dist/controls/switch/switch.scss +73 -73
- package/dist/controls/textfield/TextField.demo.svelte +79 -79
- package/dist/controls/textfield/TextField.svelte +86 -86
- package/dist/controls/textfield/textfield.scss +68 -68
- package/dist/csss/csss.scss +10 -10
- package/dist/data/dataList/DataList.demo.svelte +151 -151
- package/dist/data/dataList/DataList.preview.svelte +23 -23
- package/dist/data/dataList/DataList.svelte +233 -233
- package/dist/data/dataList/DataListCell.svelte +212 -212
- package/dist/data/dataList/DataListHead.svelte +75 -75
- package/dist/data/dataList/DataListRow.svelte +93 -93
- package/dist/data/dataList/datalist.scss +157 -157
- package/dist/data/finder/Finder.demo.svelte +55 -55
- package/dist/data/finder/Finder.svelte +166 -166
- package/dist/data/finder/finder.scss +14 -14
- package/dist/data/grouper/Grouper.demo.svelte +36 -36
- package/dist/data/grouper/Grouper.svelte +85 -85
- package/dist/data/jsoner/Jsoner.svelte +40 -40
- package/dist/data/list/List.svelte +16 -16
- package/dist/data/list/ListItem.svelte +10 -10
- package/dist/data/list/ListTitle.svelte +8 -8
- package/dist/data/loader/Loader.demo.svelte +95 -95
- package/dist/data/loader/Loader.preview.svelte +7 -7
- package/dist/data/loader/Loader.svelte +99 -99
- package/dist/data/loader/loader.scss +50 -50
- package/dist/data/sorter/Sorter.demo.svelte +62 -62
- package/dist/data/sorter/Sorter.svelte +80 -80
- package/dist/data/sorter/Sorterer.svelte +27 -27
- package/dist/data/sorter/sorterer.scss +11 -11
- package/dist/index.d.ts +39 -38
- package/dist/index.js +39 -38
- package/dist/navigation/drawer/Drawer.demo.svelte +52 -52
- package/dist/navigation/drawer/Drawer.svelte +163 -163
- package/dist/navigation/drawer/drawer.scss +69 -69
- package/dist/navigation/tabs/Tabs.demo.svelte +83 -83
- package/dist/navigation/tabs/Tabs.preview.svelte +22 -22
- package/dist/navigation/tabs/Tabs.svelte +158 -158
- package/dist/navigation/tabs/tabs.scss +92 -92
- package/dist/slotui-css/slotui-css.css +141 -141
- package/dist/slotui-css/slotui-min-css.css +141 -141
- package/dist/styles/slotui-mixins.scss +168 -168
- package/dist/styles/slotui-presets.scss +56 -56
- package/dist/styles/slotuisheet/SlotuiSheet.svelte +36 -36
- package/dist/styles/slotuisheet/SlotyuiSheet.demo.svelte +28 -28
- package/dist/styles/slotuisheet/sheetConfig.scss +7 -7
- package/dist/styles/slotuisheet/slotui-sheet.scss +192 -192
- package/dist/styles/slotuisheet/stylesheet-container.scss +147 -147
- package/dist/styles/slotuisheet/stylesheet.scss +156 -156
- package/dist/types/slotui-ambient.d.ts +27 -27
- package/dist/ui/bootstrapp/BootStrApp.svelte +92 -92
- package/dist/ui/chromeFrame/ChromeFrame.svelte +43 -43
- package/dist/ui/chromeFrame/ChromeFrameButtonList.svelte +33 -33
- package/dist/ui/chromeFrame/ChromeFrameList.svelte +106 -106
- package/dist/ui/chromeFrame/chrome-frame.scss +34 -34
- package/dist/ui/frame/Frame.demo.svelte +48 -48
- package/dist/ui/frame/Frame.svelte +90 -90
- package/dist/ui/frame/frame.scss +46 -46
- package/dist/ui/login/Login.demo.svelte +62 -62
- package/dist/ui/login/Login.svelte +102 -102
- package/dist/ui/marquee/Marquee.demo.svelte +33 -33
- package/dist/ui/marquee/Marquee.svelte +97 -97
- package/dist/ui/marquee/marquee.scss +34 -34
- package/dist/ui/menu/Menu.svelte +9 -9
- package/dist/ui/menu/MenuItem.svelte +9 -9
- package/dist/ui/menu/MenuTitle.svelte +10 -10
- package/dist/ui/menu/menu.scss +61 -61
- package/dist/ui/menuList/MenuList.demo.svelte +73 -73
- package/dist/ui/menuList/MenuList.svelte +143 -143
- package/dist/ui/menuList/MenuListItem.svelte +134 -134
- package/dist/ui/menuList/MenuListTitle.svelte +10 -10
- package/dist/ui/menuList/menu-list.scss +120 -120
- package/dist/ui/panel/Panel.demo.svelte +169 -169
- package/dist/ui/panel/Panel.svelte +96 -96
- package/dist/ui/panel/PanelGrid.svelte +62 -62
- package/dist/ui/panel/PanelSlide.svelte +156 -156
- package/dist/ui/panel/Paneler.svelte +63 -63
- package/dist/ui/panel/panel.scss +32 -32
- package/dist/ui/popper/Popper.demo.svelte +92 -92
- package/dist/ui/popper/Popper.svelte +160 -160
- package/dist/ui/popper/popper.scss +108 -108
- package/dist/ui/preview/Preview.svelte +41 -41
- package/dist/ui/serviceBox/ServiceBox.svelte +24 -24
- package/dist/ui/startMenu/BootMenu.svelte +102 -102
- package/dist/ui/startMenu/boot-menu.scss +86 -86
- package/dist/ui/taskbar/TaskBarContent.svelte +20 -20
- package/dist/ui/taskbar/Taskbar.svelte +26 -26
- package/dist/ui/taskbar/taskbar.scss +28 -28
- package/dist/ui/themeswitcher/ThemeSwitcher.svelte +18 -18
- package/dist/ui/toast/Toast.demo.svelte +19 -19
- package/dist/ui/toast/Toast.svelte +60 -60
- package/dist/ui/toast/Toaster.svelte +18 -18
- package/dist/ui/toggleBar/ToggleBar.demo.svelte +114 -114
- package/dist/ui/toggleBar/ToggleBar.svelte +58 -58
- package/dist/ui/toggleBar/toggle-bar.scss +45 -45
- package/dist/ui/toolBar/ToolBar.demo.svelte +98 -98
- package/dist/ui/toolBar/ToolBar.svelte +30 -30
- package/dist/ui/toolBar/toolbar.scss +32 -32
- package/dist/ui/tree/Tree.demo.svelte +84 -84
- package/dist/ui/tree/Tree.preview.svelte +19 -19
- package/dist/ui/tree/Tree.svelte +182 -182
- package/dist/ui/tree/tree.scss +38 -38
- package/dist/ui/window/Window.demo.svelte +111 -111
- package/dist/ui/window/Window.svelte +177 -177
- package/dist/ui/window/window.scss +66 -66
- package/dist/utils/content/Content.svelte +78 -78
- package/dist/utils/contextRooter/ContextRooter.demo.svelte +33 -33
- package/dist/utils/contextRooter/ContextRooter.svelte +6 -6
- package/dist/utils/css/Css.demo.svelte +5 -5
- package/dist/utils/css/Css.svelte +64 -64
- package/dist/utils/effects/transitions.js +6 -6
- package/dist/utils/looper/Looper.demo.svelte +36 -36
- package/dist/utils/looper/Looper.svelte +47 -47
- package/dist/utils/slotted/Slotted.svelte +21 -21
- package/dist/utils/stylesheet/StyleSheet.demo.svelte +28 -28
- package/dist/utils/stylesheet/StyleSheet.svelte +30 -30
- package/dist/utils/stylesheet/containerConfig.scss +7 -7
- package/dist/utils/stylesheet/stylesheet.scss +147 -147
- package/dist/utils/uses/sx4u/sx4uPreprocess.js +34 -34
- package/package.json +3 -3
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
<script lang="ts" generics="T=any">
|
|
2
|
-
import { fade } from 'svelte/transition';
|
|
3
|
-
import Button from '../button/Button.svelte';
|
|
4
|
-
import { onDestroy } from 'svelte';
|
|
5
|
-
import Slotted from '../../utils/slotted/Slotted.svelte';
|
|
6
|
-
import type { ConfirmProps } from './types.js';
|
|
7
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
8
|
-
|
|
9
|
-
let step: string = $state('initial');
|
|
10
|
-
|
|
11
|
-
let {
|
|
12
|
-
class: className = '',
|
|
13
|
-
initialRef = null,
|
|
14
|
-
contentRef = null,
|
|
15
|
-
tooltipInitial = null,
|
|
16
|
-
primaryInitial = '',
|
|
17
|
-
primaryConfirm = '',
|
|
18
|
-
iconInitial = '',
|
|
19
|
-
iconColorInitial = 'inherit',
|
|
20
|
-
primary = 'confirm',
|
|
21
|
-
icon = 'check-circle-outline',
|
|
22
|
-
iconColor = 'green',
|
|
23
|
-
tall,
|
|
24
|
-
autoClose = true,
|
|
25
|
-
loading,
|
|
26
|
-
data,
|
|
27
|
-
action = () => {},
|
|
28
|
-
iconCancel = { icon: 'mdi:cancel-bold', color: 'red',iconSize:'large' },
|
|
29
|
-
variant,
|
|
30
|
-
buttonInitial,
|
|
31
|
-
buttonConfirm,
|
|
32
|
-
buttonCancel,
|
|
33
|
-
children,
|
|
34
|
-
confirmInitial,
|
|
35
|
-
...rest
|
|
36
|
-
}: ConfirmProps<T> & Partial<Omit<HTMLDivElement, 'style'>> = $props();
|
|
37
|
-
|
|
38
|
-
let rost = rest as HTMLAttributes<any>;
|
|
39
|
-
|
|
40
|
-
let loadingState = $state(false);
|
|
41
|
-
|
|
42
|
-
function handleClickInitial(event: any) {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
event.stopPropagation();
|
|
45
|
-
step = 'confirm';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function handleClickCancel(event: any) {
|
|
49
|
-
event.preventDefault();
|
|
50
|
-
event.stopPropagation();
|
|
51
|
-
step = 'initial';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function handleAction(event: any) {
|
|
55
|
-
event.preventDefault();
|
|
56
|
-
event.stopPropagation();
|
|
57
|
-
if (action) {
|
|
58
|
-
if (action instanceof Promise) loadingState = true;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
loadingState = true;
|
|
62
|
-
action(data).then(() => {
|
|
63
|
-
loadingState = false;
|
|
64
|
-
if (autoClose) step = 'initial';
|
|
65
|
-
|
|
66
|
-
return data;
|
|
67
|
-
});
|
|
68
|
-
} catch (e) {
|
|
69
|
-
if (typeof action == 'function') {
|
|
70
|
-
action(data);
|
|
71
|
-
if (autoClose) step = 'initial';
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/* Promise.resolve(action).then(
|
|
75
|
-
() => {
|
|
76
|
-
loadingState = false;
|
|
77
|
-
console.log('action done');
|
|
78
|
-
if (autoClose) step = 'initial';
|
|
79
|
-
},
|
|
80
|
-
() => {
|
|
81
|
-
console.log('action done done');
|
|
82
|
-
if (autoClose) step = 'initial';
|
|
83
|
-
}
|
|
84
|
-
); */
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
onDestroy(() => {
|
|
89
|
-
step = 'initial';
|
|
90
|
-
});
|
|
91
|
-
</script>
|
|
92
|
-
|
|
93
|
-
<!-- #todo <Content>somecontent</Content> -->
|
|
94
|
-
<div {...rost} class="confirm {className}">
|
|
95
|
-
{#if step === 'initial'}
|
|
96
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
97
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
98
|
-
<div
|
|
99
|
-
class={'confirm-initial ' + className}
|
|
100
|
-
in:fade|global
|
|
101
|
-
onclick={handleClickInitial}
|
|
102
|
-
bind:this={initialRef}
|
|
103
|
-
title={tooltipInitial}
|
|
104
|
-
>
|
|
105
|
-
<Slotted child={confirmInitial} slotArgs={{ step }}>
|
|
106
|
-
{#if buttonInitial}
|
|
107
|
-
<Button {tall} {variant} {...buttonInitial} />
|
|
108
|
-
{:else}
|
|
109
|
-
<Button
|
|
110
|
-
{tall}
|
|
111
|
-
variant= {variant}
|
|
112
|
-
width="full"
|
|
113
|
-
icon={{ icon: iconInitial, color: iconColorInitial }}
|
|
114
|
-
title={tooltipInitial}
|
|
115
|
-
>
|
|
116
|
-
{primaryInitial}
|
|
117
|
-
</Button>
|
|
118
|
-
{/if}
|
|
119
|
-
</Slotted>
|
|
120
|
-
</div>
|
|
121
|
-
{/if}
|
|
122
|
-
{#if step === 'confirm'}
|
|
123
|
-
{#if buttonCancel}
|
|
124
|
-
<Button {tall} {...buttonCancel} onclick={(event:any)=>{handleClickCancel(event);buttonCancel?.onclick?.(event)}} />
|
|
125
|
-
{:else}
|
|
126
|
-
<Button
|
|
127
|
-
onclick={handleClickCancel}
|
|
128
|
-
variant= {'naked'}
|
|
129
|
-
icon={iconCancel}
|
|
130
|
-
{tall}
|
|
131
|
-
title="cancel"
|
|
132
|
-
value="cancel"
|
|
133
|
-
width="auto"
|
|
134
|
-
/>
|
|
135
|
-
{/if}
|
|
136
|
-
<div class={className + ' confirm-validate'} in:fade|global bind:this={contentRef}>
|
|
137
|
-
<Slotted child={children} slotArgs={{ step }}>
|
|
138
|
-
{#if buttonConfirm}
|
|
139
|
-
<Button {tall} {variant} {...buttonConfirm} onclick={(event:any)=>{handleAction(event);buttonConfirm?.onclick?.(event)}} />
|
|
140
|
-
{:else}
|
|
141
|
-
<Button
|
|
142
|
-
title="confirm"
|
|
143
|
-
loading={loadingState}
|
|
144
|
-
{tall}
|
|
145
|
-
onclick={handleAction}
|
|
146
|
-
{icon}
|
|
147
|
-
variant= {variant}
|
|
148
|
-
value={primaryConfirm}
|
|
149
|
-
/>
|
|
150
|
-
{/if}
|
|
151
|
-
</Slotted>
|
|
152
|
-
</div>
|
|
153
|
-
{/if}
|
|
154
|
-
</div>
|
|
155
|
-
|
|
1
|
+
<script lang="ts" generics="T=any">
|
|
2
|
+
import { fade } from 'svelte/transition';
|
|
3
|
+
import Button from '../button/Button.svelte';
|
|
4
|
+
import { onDestroy } from 'svelte';
|
|
5
|
+
import Slotted from '../../utils/slotted/Slotted.svelte';
|
|
6
|
+
import type { ConfirmProps } from './types.js';
|
|
7
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
8
|
+
|
|
9
|
+
let step: string = $state('initial');
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
class: className = '',
|
|
13
|
+
initialRef = null,
|
|
14
|
+
contentRef = null,
|
|
15
|
+
tooltipInitial = null,
|
|
16
|
+
primaryInitial = '',
|
|
17
|
+
primaryConfirm = '',
|
|
18
|
+
iconInitial = '',
|
|
19
|
+
iconColorInitial = 'inherit',
|
|
20
|
+
primary = 'confirm',
|
|
21
|
+
icon = 'check-circle-outline',
|
|
22
|
+
iconColor = 'green',
|
|
23
|
+
tall,
|
|
24
|
+
autoClose = true,
|
|
25
|
+
loading,
|
|
26
|
+
data,
|
|
27
|
+
action = () => {},
|
|
28
|
+
iconCancel = { icon: 'mdi:cancel-bold', color: 'red',iconSize:'large' },
|
|
29
|
+
variant,
|
|
30
|
+
buttonInitial,
|
|
31
|
+
buttonConfirm,
|
|
32
|
+
buttonCancel,
|
|
33
|
+
children,
|
|
34
|
+
confirmInitial,
|
|
35
|
+
...rest
|
|
36
|
+
}: ConfirmProps<T> & Partial<Omit<HTMLDivElement, 'style'>> = $props();
|
|
37
|
+
|
|
38
|
+
let rost = rest as HTMLAttributes<any>;
|
|
39
|
+
|
|
40
|
+
let loadingState = $state(false);
|
|
41
|
+
|
|
42
|
+
function handleClickInitial(event: any) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
step = 'confirm';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function handleClickCancel(event: any) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
event.stopPropagation();
|
|
51
|
+
step = 'initial';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function handleAction(event: any) {
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
if (action) {
|
|
58
|
+
if (action instanceof Promise) loadingState = true;
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
loadingState = true;
|
|
62
|
+
action(data).then(() => {
|
|
63
|
+
loadingState = false;
|
|
64
|
+
if (autoClose) step = 'initial';
|
|
65
|
+
|
|
66
|
+
return data;
|
|
67
|
+
});
|
|
68
|
+
} catch (e) {
|
|
69
|
+
if (typeof action == 'function') {
|
|
70
|
+
action(data);
|
|
71
|
+
if (autoClose) step = 'initial';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/* Promise.resolve(action).then(
|
|
75
|
+
() => {
|
|
76
|
+
loadingState = false;
|
|
77
|
+
console.log('action done');
|
|
78
|
+
if (autoClose) step = 'initial';
|
|
79
|
+
},
|
|
80
|
+
() => {
|
|
81
|
+
console.log('action done done');
|
|
82
|
+
if (autoClose) step = 'initial';
|
|
83
|
+
}
|
|
84
|
+
); */
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onDestroy(() => {
|
|
89
|
+
step = 'initial';
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<!-- #todo <Content>somecontent</Content> -->
|
|
94
|
+
<div {...rost} class="confirm {className}">
|
|
95
|
+
{#if step === 'initial'}
|
|
96
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
97
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
98
|
+
<div
|
|
99
|
+
class={'confirm-initial ' + className}
|
|
100
|
+
in:fade|global
|
|
101
|
+
onclick={handleClickInitial}
|
|
102
|
+
bind:this={initialRef}
|
|
103
|
+
title={tooltipInitial}
|
|
104
|
+
>
|
|
105
|
+
<Slotted child={confirmInitial} slotArgs={{ step }}>
|
|
106
|
+
{#if buttonInitial}
|
|
107
|
+
<Button {tall} {variant} {...buttonInitial} />
|
|
108
|
+
{:else}
|
|
109
|
+
<Button
|
|
110
|
+
{tall}
|
|
111
|
+
variant= {variant}
|
|
112
|
+
width="full"
|
|
113
|
+
icon={{ icon: iconInitial, color: iconColorInitial }}
|
|
114
|
+
title={tooltipInitial}
|
|
115
|
+
>
|
|
116
|
+
{primaryInitial}
|
|
117
|
+
</Button>
|
|
118
|
+
{/if}
|
|
119
|
+
</Slotted>
|
|
120
|
+
</div>
|
|
121
|
+
{/if}
|
|
122
|
+
{#if step === 'confirm'}
|
|
123
|
+
{#if buttonCancel}
|
|
124
|
+
<Button {tall} {...buttonCancel} onclick={(event:any)=>{handleClickCancel(event);buttonCancel?.onclick?.(event)}} />
|
|
125
|
+
{:else}
|
|
126
|
+
<Button
|
|
127
|
+
onclick={handleClickCancel}
|
|
128
|
+
variant= {'naked'}
|
|
129
|
+
icon={iconCancel}
|
|
130
|
+
{tall}
|
|
131
|
+
title="cancel"
|
|
132
|
+
value="cancel"
|
|
133
|
+
width="auto"
|
|
134
|
+
/>
|
|
135
|
+
{/if}
|
|
136
|
+
<div class={className + ' confirm-validate'} in:fade|global bind:this={contentRef}>
|
|
137
|
+
<Slotted child={children} slotArgs={{ step }}>
|
|
138
|
+
{#if buttonConfirm}
|
|
139
|
+
<Button {tall} {variant} {...buttonConfirm} onclick={(event:any)=>{handleAction(event);buttonConfirm?.onclick?.(event)}} />
|
|
140
|
+
{:else}
|
|
141
|
+
<Button
|
|
142
|
+
title="confirm"
|
|
143
|
+
loading={loadingState}
|
|
144
|
+
{tall}
|
|
145
|
+
onclick={handleAction}
|
|
146
|
+
{icon}
|
|
147
|
+
variant= {variant}
|
|
148
|
+
value={primaryConfirm}
|
|
149
|
+
/>
|
|
150
|
+
{/if}
|
|
151
|
+
</Slotted>
|
|
152
|
+
</div>
|
|
153
|
+
{/if}
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
156
|
<style>.confirm {
|
|
157
157
|
display: flex;
|
|
158
158
|
align-items: center;
|
|
@@ -161,4 +161,4 @@
|
|
|
161
161
|
.confirm-validate {
|
|
162
162
|
display: flex;
|
|
163
163
|
align-items: center;
|
|
164
|
-
}</style>
|
|
164
|
+
}</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
@use "../../styles/slotui-mixins.scss";
|
|
2
|
-
.confirm {
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
gap: 0.5rem;
|
|
6
|
-
&-initial {
|
|
7
|
-
}
|
|
8
|
-
&-validate {
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
@use "../../styles/slotui-mixins.scss";
|
|
2
|
+
.confirm {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 0.5rem;
|
|
6
|
+
&-initial {
|
|
7
|
+
}
|
|
8
|
+
&-validate {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ComponentDemo from '../../base/demoer/DemoerComponent.svelte';
|
|
3
|
-
import Demoer from '../../base/demoer/Demoer.svelte';
|
|
4
|
-
import DemoPage from '../../base/demoer/DemoPage.svelte';
|
|
5
|
-
import InPlaceEdit from './InPlaceEdit.svelte';
|
|
6
|
-
import { parameters, componentArgs } from './types.js';
|
|
7
|
-
|
|
8
|
-
let code1 = `
|
|
9
|
-
<InPlaceEdit
|
|
10
|
-
value={value}
|
|
11
|
-
onSave={(newValue) => console.log('Saved:', newValue)}
|
|
12
|
-
/>`;
|
|
13
|
-
|
|
14
|
-
let code2 = `
|
|
15
|
-
<InPlaceEdit {...activeParams} />`;
|
|
16
|
-
|
|
17
|
-
let savedValue = 's';
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<ComponentDemo component="InPlaceEdit" cite="Edit in place, save in haste. - Developer's Proverb">
|
|
21
|
-
<DemoPage component="InPlaceEdit" code={code1}>
|
|
22
|
-
<Demoer {parameters} {componentArgs}>
|
|
23
|
-
{#snippet children({ activeParams })}
|
|
24
|
-
<div class="flex-v gap-medium">
|
|
25
|
-
<div>
|
|
26
|
-
<InPlaceEdit {...activeParams} onSave={() => {}} />
|
|
27
|
-
</div>
|
|
28
|
-
<p>Last saved value: {savedValue}</p>
|
|
29
|
-
</div>
|
|
30
|
-
{/snippet}
|
|
31
|
-
</Demoer>
|
|
32
|
-
</DemoPage>
|
|
33
|
-
|
|
34
|
-
<DemoPage title="Using props" component="InPlaceEdit" code={code2}>
|
|
35
|
-
<Demoer {parameters} {componentArgs}>
|
|
36
|
-
{#snippet children({ activeParams })}
|
|
37
|
-
<InPlaceEdit {...activeParams} />
|
|
38
|
-
{/snippet}
|
|
39
|
-
</Demoer>
|
|
40
|
-
</DemoPage>
|
|
41
|
-
</ComponentDemo>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ComponentDemo from '../../base/demoer/DemoerComponent.svelte';
|
|
3
|
+
import Demoer from '../../base/demoer/Demoer.svelte';
|
|
4
|
+
import DemoPage from '../../base/demoer/DemoPage.svelte';
|
|
5
|
+
import InPlaceEdit from './InPlaceEdit.svelte';
|
|
6
|
+
import { parameters, componentArgs } from './types.js';
|
|
7
|
+
|
|
8
|
+
let code1 = `
|
|
9
|
+
<InPlaceEdit
|
|
10
|
+
value={value}
|
|
11
|
+
onSave={(newValue) => console.log('Saved:', newValue)}
|
|
12
|
+
/>`;
|
|
13
|
+
|
|
14
|
+
let code2 = `
|
|
15
|
+
<InPlaceEdit {...activeParams} />`;
|
|
16
|
+
|
|
17
|
+
let savedValue = 's';
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<ComponentDemo component="InPlaceEdit" cite="Edit in place, save in haste. - Developer's Proverb">
|
|
21
|
+
<DemoPage component="InPlaceEdit" code={code1}>
|
|
22
|
+
<Demoer {parameters} {componentArgs}>
|
|
23
|
+
{#snippet children({ activeParams })}
|
|
24
|
+
<div class="flex-v gap-medium">
|
|
25
|
+
<div>
|
|
26
|
+
<InPlaceEdit {...activeParams} onSave={() => {}} />
|
|
27
|
+
</div>
|
|
28
|
+
<p>Last saved value: {savedValue}</p>
|
|
29
|
+
</div>
|
|
30
|
+
{/snippet}
|
|
31
|
+
</Demoer>
|
|
32
|
+
</DemoPage>
|
|
33
|
+
|
|
34
|
+
<DemoPage title="Using props" component="InPlaceEdit" code={code2}>
|
|
35
|
+
<Demoer {parameters} {componentArgs}>
|
|
36
|
+
{#snippet children({ activeParams })}
|
|
37
|
+
<InPlaceEdit {...activeParams} />
|
|
38
|
+
{/snippet}
|
|
39
|
+
</Demoer>
|
|
40
|
+
</DemoPage>
|
|
41
|
+
</ComponentDemo>
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Icon from '../../base/icon/Icon.svelte';
|
|
3
|
-
import TextField from '../textfield/TextField.svelte';
|
|
4
|
-
import { be } from '@medyll/idae-be';
|
|
5
|
-
|
|
6
|
-
type InPlaceEditProps = {
|
|
7
|
-
value: string;
|
|
8
|
-
spanElement: HTMLElement;
|
|
9
|
-
inputElement: HTMLInputElement;
|
|
10
|
-
inputValue?: any;
|
|
11
|
-
editing?: boolean;
|
|
12
|
-
onSave?: (newValue: string) => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
let initialId: string = 'myText';
|
|
16
|
-
let popperId: string = 'myPopover';
|
|
17
|
-
|
|
18
|
-
let {
|
|
19
|
-
value = '',
|
|
20
|
-
inputElement,
|
|
21
|
-
inputValue,
|
|
22
|
-
editing = $bindable(),
|
|
23
|
-
onSave = (newValue) => {}
|
|
24
|
-
}: InPlaceEditProps = $props();
|
|
25
|
-
|
|
26
|
-
function saveChanges() {
|
|
27
|
-
editing = false;
|
|
28
|
-
onSave(inputValue);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function handleKeyDown(event: KeyboardEvent) {
|
|
32
|
-
if (event.key === 'Enter') {
|
|
33
|
-
saveChanges();
|
|
34
|
-
} else if (event.key === 'Escape') {
|
|
35
|
-
editing = false;
|
|
36
|
-
inputValue = value;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function handleBlur() {
|
|
41
|
-
editing = false;
|
|
42
|
-
saveChanges();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
inputValue = !editing ? value : inputValue;
|
|
46
|
-
|
|
47
|
-
$effect(() => {
|
|
48
|
-
if (editing && inputElement) {
|
|
49
|
-
inputElement.focus();
|
|
50
|
-
}
|
|
51
|
-
popper.addEventListener('toggle', (event) => {
|
|
52
|
-
if (event.newState === 'open') {
|
|
53
|
-
console.log('Le popover est ouvert');
|
|
54
|
-
editing = true;
|
|
55
|
-
} else {
|
|
56
|
-
console.log('Le popover est fermé');
|
|
57
|
-
editing = false;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
console.log(be(`#${initialId}`));
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
$effect(() => {
|
|
65
|
-
editing;
|
|
66
|
-
be(popper).clonePosition(`#${initialId}`, { useTransform: false });
|
|
67
|
-
if (!editing) {
|
|
68
|
-
if (popper.matches(':popover-open')) {
|
|
69
|
-
popper.hidePopover();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
let popper;
|
|
75
|
-
</script>
|
|
76
|
-
|
|
77
|
-
<form />
|
|
78
|
-
|
|
79
|
-
<div class="border pos-rel">
|
|
80
|
-
<dialog id={popperId} open={editing} popover="auto" class="popper" bind:this={popper}>
|
|
81
|
-
<div class="flex gap-4 pad-1" style="gap:4px">
|
|
82
|
-
<TextField
|
|
83
|
-
bind:element={inputElement}
|
|
84
|
-
bind:value={inputValue}
|
|
85
|
-
style="field-sizing: content;min-width: 350px;"
|
|
86
|
-
onblur={handleBlur}
|
|
87
|
-
onkeydown={handleKeyDown}
|
|
88
|
-
>{#snippet inputLast()}
|
|
89
|
-
<button variant="contained square" class="button">
|
|
90
|
-
<Icon style="display:block;width:100%;" icon="fluent-mdl2:accept-medium" />
|
|
91
|
-
</button>
|
|
92
|
-
{/snippet}
|
|
93
|
-
</TextField>
|
|
94
|
-
<button
|
|
95
|
-
variant="flat naked square"
|
|
96
|
-
width="tiny"
|
|
97
|
-
class="button"
|
|
98
|
-
style="align-items:center;align-content:center;text-align:center;display:block;"
|
|
99
|
-
popovertarget={popperId}
|
|
100
|
-
popovertargetaction="hide"
|
|
101
|
-
>
|
|
102
|
-
<Icon icon="icons8:cancel" style="display:block;width:100%;" />
|
|
103
|
-
</button>
|
|
104
|
-
</div>
|
|
105
|
-
</dialog>
|
|
106
|
-
</div>
|
|
107
|
-
<button role="button" id={initialId} popovertarget={popperId} popovertargetaction="toggle">
|
|
108
|
-
Afficher le popover
|
|
109
|
-
</button>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Icon from '../../base/icon/Icon.svelte';
|
|
3
|
+
import TextField from '../textfield/TextField.svelte';
|
|
4
|
+
import { be } from '@medyll/idae-be';
|
|
5
|
+
|
|
6
|
+
type InPlaceEditProps = {
|
|
7
|
+
value: string;
|
|
8
|
+
spanElement: HTMLElement;
|
|
9
|
+
inputElement: HTMLInputElement;
|
|
10
|
+
inputValue?: any;
|
|
11
|
+
editing?: boolean;
|
|
12
|
+
onSave?: (newValue: string) => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
let initialId: string = 'myText';
|
|
16
|
+
let popperId: string = 'myPopover';
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
value = '',
|
|
20
|
+
inputElement,
|
|
21
|
+
inputValue,
|
|
22
|
+
editing = $bindable(),
|
|
23
|
+
onSave = (newValue) => {}
|
|
24
|
+
}: InPlaceEditProps = $props();
|
|
25
|
+
|
|
26
|
+
function saveChanges() {
|
|
27
|
+
editing = false;
|
|
28
|
+
onSave(inputValue);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
32
|
+
if (event.key === 'Enter') {
|
|
33
|
+
saveChanges();
|
|
34
|
+
} else if (event.key === 'Escape') {
|
|
35
|
+
editing = false;
|
|
36
|
+
inputValue = value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function handleBlur() {
|
|
41
|
+
editing = false;
|
|
42
|
+
saveChanges();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
inputValue = !editing ? value : inputValue;
|
|
46
|
+
|
|
47
|
+
$effect(() => {
|
|
48
|
+
if (editing && inputElement) {
|
|
49
|
+
inputElement.focus();
|
|
50
|
+
}
|
|
51
|
+
popper.addEventListener('toggle', (event) => {
|
|
52
|
+
if (event.newState === 'open') {
|
|
53
|
+
console.log('Le popover est ouvert');
|
|
54
|
+
editing = true;
|
|
55
|
+
} else {
|
|
56
|
+
console.log('Le popover est fermé');
|
|
57
|
+
editing = false;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
console.log(be(`#${initialId}`));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
$effect(() => {
|
|
65
|
+
editing;
|
|
66
|
+
be(popper).clonePosition(`#${initialId}`, { useTransform: false });
|
|
67
|
+
if (!editing) {
|
|
68
|
+
if (popper.matches(':popover-open')) {
|
|
69
|
+
popper.hidePopover();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
let popper;
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<form />
|
|
78
|
+
|
|
79
|
+
<div class="border pos-rel">
|
|
80
|
+
<dialog id={popperId} open={editing} popover="auto" class="popper" bind:this={popper}>
|
|
81
|
+
<div class="flex gap-4 pad-1" style="gap:4px">
|
|
82
|
+
<TextField
|
|
83
|
+
bind:element={inputElement}
|
|
84
|
+
bind:value={inputValue}
|
|
85
|
+
style="field-sizing: content;min-width: 350px;"
|
|
86
|
+
onblur={handleBlur}
|
|
87
|
+
onkeydown={handleKeyDown}
|
|
88
|
+
>{#snippet inputLast()}
|
|
89
|
+
<button variant="contained square" class="button">
|
|
90
|
+
<Icon style="display:block;width:100%;" icon="fluent-mdl2:accept-medium" />
|
|
91
|
+
</button>
|
|
92
|
+
{/snippet}
|
|
93
|
+
</TextField>
|
|
94
|
+
<button
|
|
95
|
+
variant="flat naked square"
|
|
96
|
+
width="tiny"
|
|
97
|
+
class="button"
|
|
98
|
+
style="align-items:center;align-content:center;text-align:center;display:block;"
|
|
99
|
+
popovertarget={popperId}
|
|
100
|
+
popovertargetaction="hide"
|
|
101
|
+
>
|
|
102
|
+
<Icon icon="icons8:cancel" style="display:block;width:100%;" />
|
|
103
|
+
</button>
|
|
104
|
+
</div>
|
|
105
|
+
</dialog>
|
|
106
|
+
</div>
|
|
107
|
+
<button role="button" id={initialId} popovertarget={popperId} popovertargetaction="toggle">
|
|
108
|
+
Afficher le popover
|
|
109
|
+
</button>
|