lupine.components 1.1.53 → 1.1.55
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/package.json
CHANGED
|
@@ -7,6 +7,7 @@ export interface SearchInputHookProps {
|
|
|
7
7
|
export interface InputWithClearProps {
|
|
8
8
|
placeholder?: string;
|
|
9
9
|
onSearch: (value: string) => void;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
10
11
|
onClear?: () => void;
|
|
11
12
|
onFocus?: () => void;
|
|
12
13
|
onBlur?: () => void;
|
|
@@ -109,6 +110,7 @@ export const SearchInput = (props: InputWithClearProps) => {
|
|
|
109
110
|
onSearch();
|
|
110
111
|
}
|
|
111
112
|
}}
|
|
113
|
+
onInput={(e) => props.onChange?.((e.target as HTMLInputElement).value)}
|
|
112
114
|
onBlur={() => props.onBlur?.()}
|
|
113
115
|
onFocus={() => props.onFocus?.()}
|
|
114
116
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RefProps,
|
|
2
|
-
import {
|
|
1
|
+
import { RefProps, CssProps, callUnload, mountInnerComponent } from 'lupine.web';
|
|
2
|
+
import { Spinner02, SpinnerSize } from './spinner';
|
|
3
3
|
|
|
4
4
|
export type LoadingSpinHookProps = {
|
|
5
5
|
show?: () => void;
|
|
@@ -7,6 +7,7 @@ export type LoadingSpinHookProps = {
|
|
|
7
7
|
};
|
|
8
8
|
export type LoadingSpinProps = {
|
|
9
9
|
hook?: LoadingSpinHookProps;
|
|
10
|
+
text?: string;
|
|
10
11
|
};
|
|
11
12
|
export const LoadingSpinComponent = (props: LoadingSpinProps) => {
|
|
12
13
|
const css: CssProps = {
|
|
@@ -20,8 +21,20 @@ export const LoadingSpinComponent = (props: LoadingSpinProps) => {
|
|
|
20
21
|
zIndex: 'var(--layer-guide)',
|
|
21
22
|
'.loading-gif': {
|
|
22
23
|
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
gap: '12px',
|
|
23
27
|
margin: 'auto',
|
|
24
28
|
},
|
|
29
|
+
'.loading-gif-text': {
|
|
30
|
+
color: '#fff',
|
|
31
|
+
fontSize: '15px',
|
|
32
|
+
fontWeight: '500',
|
|
33
|
+
lineHeight: '22px',
|
|
34
|
+
padding: '0 24px',
|
|
35
|
+
textAlign: 'center',
|
|
36
|
+
textShadow: '0 1px 2px rgba(0, 0, 0, 0.35)',
|
|
37
|
+
},
|
|
25
38
|
};
|
|
26
39
|
if (props.hook) {
|
|
27
40
|
props.hook.show = () => {
|
|
@@ -39,13 +52,14 @@ export const LoadingSpinComponent = (props: LoadingSpinProps) => {
|
|
|
39
52
|
<div ref={ref} css={css} class='loading-gif-box'>
|
|
40
53
|
<div class='loading-gif'>
|
|
41
54
|
<Spinner02 size={SpinnerSize.Large} />
|
|
55
|
+
{props.text && <div class='loading-gif-text'>{props.text}</div>}
|
|
42
56
|
</div>
|
|
43
57
|
</div>
|
|
44
58
|
);
|
|
45
59
|
};
|
|
46
60
|
|
|
47
61
|
export class LoadingSpin {
|
|
48
|
-
static async show(): Promise<() => void> {
|
|
62
|
+
static async show(text?: string): Promise<() => void> {
|
|
49
63
|
const handleClose = async () => {
|
|
50
64
|
await callUnload(base);
|
|
51
65
|
base.remove();
|
|
@@ -53,7 +67,7 @@ export class LoadingSpin {
|
|
|
53
67
|
|
|
54
68
|
const base = document.createElement('div');
|
|
55
69
|
document.body.appendChild(base);
|
|
56
|
-
await mountInnerComponent(base, <LoadingSpinComponent />);
|
|
70
|
+
await mountInnerComponent(base, <LoadingSpinComponent text={text} />);
|
|
57
71
|
return handleClose;
|
|
58
72
|
}
|
|
59
73
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RefProps,
|
|
1
|
+
import { RefProps, refreshPage } from 'lupine.web';
|
|
2
2
|
|
|
3
3
|
export type RedirectProps = {
|
|
4
4
|
title?: string;
|
|
@@ -11,7 +11,7 @@ export const Redirect = ({ title = 'redirect...', url, delaySeconds = 0 }: Redir
|
|
|
11
11
|
const ref: RefProps = {
|
|
12
12
|
onLoad: async (el: Element) => {
|
|
13
13
|
setTimeout(async () => {
|
|
14
|
-
await
|
|
14
|
+
await refreshPage(url);
|
|
15
15
|
}, delaySeconds * 1000);
|
|
16
16
|
},
|
|
17
17
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CssProps, RefProps } from 'lupine.
|
|
1
|
+
import { CssProps, RefProps } from 'lupine.web';
|
|
2
2
|
|
|
3
3
|
export type SelectAngleComponentHookProps = {
|
|
4
4
|
setAngle?: (angle: number) => void;
|
|
@@ -21,7 +21,6 @@ export const SelectAngleComponent = (props: SelectAngleComponentProps) => {
|
|
|
21
21
|
position: 'relative',
|
|
22
22
|
backgroundColor: 'var(--primary-bg-color)',
|
|
23
23
|
cursor: 'pointer',
|
|
24
|
-
touchAction: 'none',
|
|
25
24
|
},
|
|
26
25
|
'&needle': {
|
|
27
26
|
width: '2px',
|
|
@@ -80,9 +79,9 @@ export const SelectAngleComponent = (props: SelectAngleComponentProps) => {
|
|
|
80
79
|
const updateAngle = (ev: PointerEvent) => {
|
|
81
80
|
const dx = ev.clientX - cx;
|
|
82
81
|
const dy = ev.clientY - cy;
|
|
83
|
-
// atan2
|
|
82
|
+
// atan2 return radians, 0° at right, clockwise
|
|
84
83
|
let deg = Math.atan2(dy, dx) * (180 / Math.PI);
|
|
85
|
-
deg = (deg + 450) % 360; //
|
|
84
|
+
deg = (deg + 450) % 360; // top is 0°
|
|
86
85
|
updateAngleSub(deg);
|
|
87
86
|
};
|
|
88
87
|
const updateAngleSub = (deg: number) => {
|
|
@@ -99,7 +98,7 @@ export const SelectAngleComponent = (props: SelectAngleComponentProps) => {
|
|
|
99
98
|
cx = rect.left + rect.width / 2;
|
|
100
99
|
cy = rect.top + rect.height / 2;
|
|
101
100
|
|
|
102
|
-
(ev.
|
|
101
|
+
(ev.target as HTMLElement).setPointerCapture(ev.pointerId);
|
|
103
102
|
updateAngle(ev);
|
|
104
103
|
mv = true;
|
|
105
104
|
};
|
|
@@ -107,11 +106,17 @@ export const SelectAngleComponent = (props: SelectAngleComponentProps) => {
|
|
|
107
106
|
if (!mv) {
|
|
108
107
|
return;
|
|
109
108
|
}
|
|
109
|
+
if (ev.buttons === 0) {
|
|
110
|
+
mv = false;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
110
113
|
updateAngle(ev);
|
|
111
114
|
};
|
|
112
115
|
const pointerup = (ev: PointerEvent) => {
|
|
113
|
-
(ev.currentTarget as HTMLElement).releasePointerCapture(ev.pointerId);
|
|
114
116
|
mv = false;
|
|
117
|
+
try {
|
|
118
|
+
(ev.target as HTMLElement).releasePointerCapture(ev.pointerId);
|
|
119
|
+
} catch (e) {}
|
|
115
120
|
};
|
|
116
121
|
const ref: RefProps = {};
|
|
117
122
|
return (
|