lupine.components 1.1.13 → 1.1.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/README.md +3 -3
- package/package.json +42 -42
- package/src/components/action-sheet.tsx +419 -419
- package/src/components/button-push-animation.tsx +147 -138
- package/src/components/button.tsx +55 -55
- package/src/components/desktop-footer.tsx +17 -17
- package/src/components/desktop-header.tsx +52 -52
- package/src/components/drag-refresh.tsx +129 -129
- package/src/components/editable-label.tsx +83 -83
- package/src/components/float-window.tsx +233 -233
- package/src/components/grid.tsx +18 -18
- package/src/components/html-load.tsx +41 -41
- package/src/components/html-var.tsx +81 -81
- package/src/components/index.ts +43 -44
- package/src/components/input-with-title.tsx +24 -24
- package/src/components/link-item.tsx +13 -13
- package/src/components/link-list.tsx +62 -62
- package/src/components/menu-bar.tsx +219 -219
- package/src/components/menu-item-props.tsx +13 -13
- package/src/components/menu-sidebar.tsx +325 -318
- package/src/components/message-box.tsx +44 -44
- package/src/components/meta-data.tsx +36 -36
- package/src/components/meta-description.tsx +12 -12
- package/src/components/mobile-components/icon-menu-item-props.ts +6 -6
- package/src/components/mobile-components/index.ts +8 -9
- package/src/components/mobile-components/mobile-footer-menu.tsx +95 -95
- package/src/components/mobile-components/mobile-header-component.tsx +101 -101
- package/src/components/mobile-components/mobile-header-title-icon.tsx +109 -101
- package/src/components/mobile-components/mobile-header-with-back.tsx +127 -117
- package/src/components/mobile-components/mobile-side-menu.tsx +154 -154
- package/src/components/mobile-components/mobile-top-sys-icon.tsx +18 -18
- package/src/components/mobile-components/mobile-top-sys-menu.tsx +62 -62
- package/src/components/modal.tsx +33 -33
- package/src/components/notice-message.tsx +118 -118
- package/src/components/page-title.tsx +6 -6
- package/src/components/paging-link.tsx +175 -175
- package/src/components/panel.tsx +21 -21
- package/src/components/popup-menu.tsx +289 -289
- package/src/components/progress.tsx +91 -91
- package/src/components/radio-label-component.tsx +36 -36
- package/src/components/redirect.tsx +19 -19
- package/src/components/resizable-splitter.tsx +128 -128
- package/src/components/select-angle-component.tsx +127 -127
- package/src/components/select-with-title.tsx +37 -37
- package/src/components/slide-tab-component.tsx +144 -149
- package/src/components/spinner.tsx +106 -100
- package/src/components/stars-component.tsx +66 -66
- package/src/components/svg.tsx +24 -24
- package/src/components/tabs.tsx +279 -279
- package/src/components/text-glow.tsx +37 -37
- package/src/components/text-scale.tsx +42 -42
- package/src/components/text-wave.tsx +55 -55
- package/src/components/theme-selector.tsx +28 -28
- package/src/components/toggle-base.tsx +285 -269
- package/src/components/toggle-switch.tsx +160 -160
- package/src/frames/index.ts +3 -3
- package/src/frames/responsive-frame.tsx +83 -83
- package/src/frames/slider-frame.tsx +111 -111
- package/src/frames/top-frame.tsx +30 -30
- package/src/index.ts +5 -5
- package/src/lib/back-action-helper.ts +54 -54
- package/src/lib/base62.ts +23 -23
- package/src/lib/blob-utils.ts +23 -23
- package/src/lib/calculate-text-width.ts +13 -13
- package/src/lib/date-utils.ts +317 -317
- package/src/lib/deep-merge.ts +37 -37
- package/src/lib/document-ready.ts +34 -34
- package/src/lib/dom-utils.ts +32 -32
- package/src/lib/download-file.ts +118 -118
- package/src/lib/download-link.ts +12 -12
- package/src/lib/download-stream.ts +19 -19
- package/src/lib/drag-util.ts +118 -118
- package/src/lib/dynamical-load.ts +134 -134
- package/src/lib/encode-html.ts +27 -27
- package/src/lib/find-parent-tag.ts +8 -8
- package/src/lib/format-bytes.ts +11 -11
- package/src/lib/index.ts +24 -24
- package/src/lib/lite-dom.ts +225 -225
- package/src/lib/message-hub.ts +103 -104
- package/src/lib/observable.ts +188 -188
- package/src/lib/path-utils.ts +42 -42
- package/src/lib/promise-timeout.ts +1 -1
- package/src/lib/simple-storage.ts +40 -40
- package/src/lib/stop-propagation.ts +7 -7
- package/src/lib/upload-file.ts +101 -101
- package/src/styles/base-themes.ts +17 -17
- package/src/styles/dark-themes.ts +99 -99
- package/src/styles/index.ts +5 -5
- package/src/styles/light-themes.ts +106 -106
- package/src/styles/media-query.ts +93 -93
- package/src/styles/shared-themes.ts +57 -57
- package/tsconfig.json +113 -113
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
import { backActionHelper, CssProps, RefProps, VNode } from 'lupine.components';
|
|
2
|
-
|
|
3
|
-
export class MobileSideMenuHelper {
|
|
4
|
-
static show() {
|
|
5
|
-
const ref = document.querySelector('.mobile-side-menu-mask') as HTMLDivElement;
|
|
6
|
-
ref.classList.add('show');
|
|
7
|
-
setTimeout(() => {
|
|
8
|
-
ref.classList.add('animate-show');
|
|
9
|
-
}, 1);
|
|
10
|
-
|
|
11
|
-
const backActionId = backActionHelper.genBackActionId();
|
|
12
|
-
ref.setAttribute('data-back-action', backActionId);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static hide() {
|
|
16
|
-
const ref = document.querySelector('.mobile-side-menu-mask') as HTMLDivElement;
|
|
17
|
-
ref.removeAttribute('data-back-action');
|
|
18
|
-
ref.classList.remove('animate-show');
|
|
19
|
-
setTimeout(() => {
|
|
20
|
-
ref.classList.remove('show');
|
|
21
|
-
}, 300);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static isTouchEventAdded = false;
|
|
25
|
-
static addTouchEvent() {
|
|
26
|
-
if (this.isTouchEventAdded) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
this.isTouchEventAdded = true;
|
|
31
|
-
let touchstartY = 0;
|
|
32
|
-
let touchstartX = 0;
|
|
33
|
-
let direction = '';
|
|
34
|
-
let moveStart = false;
|
|
35
|
-
let isOpen = false;
|
|
36
|
-
const maskDom = document.querySelector('.mobile-side-menu-mask') as HTMLDivElement;
|
|
37
|
-
document.addEventListener('touchstart', (e) => {
|
|
38
|
-
touchstartY = e.touches[0].clientY;
|
|
39
|
-
touchstartX = e.touches[0].clientX;
|
|
40
|
-
direction = '';
|
|
41
|
-
moveStart = false;
|
|
42
|
-
isOpen = maskDom?.classList.contains('show');
|
|
43
|
-
if (isOpen) {
|
|
44
|
-
if (touchstartX > 80) {
|
|
45
|
-
moveStart = true;
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
if (touchstartX < 40) {
|
|
49
|
-
moveStart = true;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// if (e.touches[0].clientX < 30 && !maskDom?.classList.contains('show')) {
|
|
53
|
-
// // 靠左边缘, 如果菜单已经打开,忽略手势
|
|
54
|
-
// touchStartX = e.touches[0].clientX;
|
|
55
|
-
// } else {
|
|
56
|
-
// touchStartX = -1; // 忽略非左侧边缘手势
|
|
57
|
-
// }
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
document.addEventListener('touchmove', (e) => {
|
|
61
|
-
if (!moveStart) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// console.log('touchmove', e.touches[0].clientX);
|
|
66
|
-
if (direction === '') {
|
|
67
|
-
if (e.touches[0].clientX - touchstartX !== 0) {
|
|
68
|
-
direction = 'X';
|
|
69
|
-
} else {
|
|
70
|
-
moveStart = false;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (isOpen) {
|
|
76
|
-
if (e.touches[0].clientX - touchstartX < 30) {
|
|
77
|
-
MobileSideMenuHelper.hide();
|
|
78
|
-
moveStart = false;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
if (e.touches[0].clientX - touchstartX > 80) {
|
|
83
|
-
MobileSideMenuHelper.show();
|
|
84
|
-
moveStart = false;
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
document.addEventListener('touchend', () => {
|
|
91
|
-
moveStart = false;
|
|
92
|
-
direction = '';
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export const MobileSideMenu = (props: { children: VNode<any> }) => {
|
|
97
|
-
const css: CssProps = {
|
|
98
|
-
'.mobile-side-menu-mask': {
|
|
99
|
-
display: 'none',
|
|
100
|
-
flexDirection: 'column',
|
|
101
|
-
position: 'fixed',
|
|
102
|
-
top: '0',
|
|
103
|
-
left: '0',
|
|
104
|
-
right: '0',
|
|
105
|
-
bottom: '0',
|
|
106
|
-
zIndex: 'var(--layer-menu)',
|
|
107
|
-
backgroundColor: '#000000b0',
|
|
108
|
-
'&.show': {
|
|
109
|
-
display: 'flex',
|
|
110
|
-
},
|
|
111
|
-
'&.animate-show .mobile-side-menu': {
|
|
112
|
-
transform: 'scaleX(1)',
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
'.mobile-side-menu': {
|
|
116
|
-
display: 'flex',
|
|
117
|
-
flexDirection: 'column',
|
|
118
|
-
padding: '16px',
|
|
119
|
-
transition: 'transform 0.3s ease-in-out',
|
|
120
|
-
backgroundColor: 'var(--primary-bg-color)',
|
|
121
|
-
width: '70%',
|
|
122
|
-
maxWidth: '300px',
|
|
123
|
-
height: '100%',
|
|
124
|
-
overflowX: 'hidden',
|
|
125
|
-
overflowY: 'auto',
|
|
126
|
-
transformOrigin: 'left',
|
|
127
|
-
transform: 'scaleX(0)',
|
|
128
|
-
// boxShadow: 'var(--block-box-shadow)',
|
|
129
|
-
boxShadow: 'var(--cover-box-shadow)',
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const onClickContainer = (event: Event) => {
|
|
134
|
-
if (
|
|
135
|
-
event.target instanceof HTMLDivElement &&
|
|
136
|
-
(event.target as HTMLDivElement).classList.contains('mobile-side-menu-mask')
|
|
137
|
-
) {
|
|
138
|
-
MobileSideMenuHelper.hide();
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
const ref: RefProps = {
|
|
142
|
-
onLoad: async () => {
|
|
143
|
-
MobileSideMenuHelper.addTouchEvent();
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
return (
|
|
147
|
-
<div css={css} ref={ref}>
|
|
148
|
-
{/* <SliderFrame hook={props.sliderFrameHook} /> */}
|
|
149
|
-
<div class='mobile-side-menu-mask' onClick={onClickContainer}>
|
|
150
|
-
<div class='mobile-side-menu'>{props.children}</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
1
|
+
import { backActionHelper, CssProps, RefProps, VNode } from 'lupine.components';
|
|
2
|
+
|
|
3
|
+
export class MobileSideMenuHelper {
|
|
4
|
+
static show() {
|
|
5
|
+
const ref = document.querySelector('.mobile-side-menu-mask') as HTMLDivElement;
|
|
6
|
+
ref.classList.add('show');
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
ref.classList.add('animate-show');
|
|
9
|
+
}, 1);
|
|
10
|
+
|
|
11
|
+
const backActionId = backActionHelper.genBackActionId();
|
|
12
|
+
ref.setAttribute('data-back-action', backActionId);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static hide() {
|
|
16
|
+
const ref = document.querySelector('.mobile-side-menu-mask') as HTMLDivElement;
|
|
17
|
+
ref.removeAttribute('data-back-action');
|
|
18
|
+
ref.classList.remove('animate-show');
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
ref.classList.remove('show');
|
|
21
|
+
}, 300);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static isTouchEventAdded = false;
|
|
25
|
+
static addTouchEvent() {
|
|
26
|
+
if (this.isTouchEventAdded) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this.isTouchEventAdded = true;
|
|
31
|
+
let touchstartY = 0;
|
|
32
|
+
let touchstartX = 0;
|
|
33
|
+
let direction = '';
|
|
34
|
+
let moveStart = false;
|
|
35
|
+
let isOpen = false;
|
|
36
|
+
const maskDom = document.querySelector('.mobile-side-menu-mask') as HTMLDivElement;
|
|
37
|
+
document.addEventListener('touchstart', (e) => {
|
|
38
|
+
touchstartY = e.touches[0].clientY;
|
|
39
|
+
touchstartX = e.touches[0].clientX;
|
|
40
|
+
direction = '';
|
|
41
|
+
moveStart = false;
|
|
42
|
+
isOpen = maskDom?.classList.contains('show');
|
|
43
|
+
if (isOpen) {
|
|
44
|
+
if (touchstartX > 80) {
|
|
45
|
+
moveStart = true;
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
if (touchstartX < 40) {
|
|
49
|
+
moveStart = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// if (e.touches[0].clientX < 30 && !maskDom?.classList.contains('show')) {
|
|
53
|
+
// // 靠左边缘, 如果菜单已经打开,忽略手势
|
|
54
|
+
// touchStartX = e.touches[0].clientX;
|
|
55
|
+
// } else {
|
|
56
|
+
// touchStartX = -1; // 忽略非左侧边缘手势
|
|
57
|
+
// }
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
document.addEventListener('touchmove', (e) => {
|
|
61
|
+
if (!moveStart) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// console.log('touchmove', e.touches[0].clientX);
|
|
66
|
+
if (direction === '') {
|
|
67
|
+
if (e.touches[0].clientX - touchstartX !== 0) {
|
|
68
|
+
direction = 'X';
|
|
69
|
+
} else {
|
|
70
|
+
moveStart = false;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (isOpen) {
|
|
76
|
+
if (e.touches[0].clientX - touchstartX < 30) {
|
|
77
|
+
MobileSideMenuHelper.hide();
|
|
78
|
+
moveStart = false;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
if (e.touches[0].clientX - touchstartX > 80) {
|
|
83
|
+
MobileSideMenuHelper.show();
|
|
84
|
+
moveStart = false;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
document.addEventListener('touchend', () => {
|
|
91
|
+
moveStart = false;
|
|
92
|
+
direction = '';
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export const MobileSideMenu = (props: { children: VNode<any> }) => {
|
|
97
|
+
const css: CssProps = {
|
|
98
|
+
'.mobile-side-menu-mask': {
|
|
99
|
+
display: 'none',
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
position: 'fixed',
|
|
102
|
+
top: '0',
|
|
103
|
+
left: '0',
|
|
104
|
+
right: '0',
|
|
105
|
+
bottom: '0',
|
|
106
|
+
zIndex: 'var(--layer-menu)',
|
|
107
|
+
backgroundColor: '#000000b0',
|
|
108
|
+
'&.show': {
|
|
109
|
+
display: 'flex',
|
|
110
|
+
},
|
|
111
|
+
'&.animate-show .mobile-side-menu': {
|
|
112
|
+
transform: 'scaleX(1)',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
'.mobile-side-menu': {
|
|
116
|
+
display: 'flex',
|
|
117
|
+
flexDirection: 'column',
|
|
118
|
+
padding: '16px',
|
|
119
|
+
transition: 'transform 0.3s ease-in-out',
|
|
120
|
+
backgroundColor: 'var(--primary-bg-color)',
|
|
121
|
+
width: '70%',
|
|
122
|
+
maxWidth: '300px',
|
|
123
|
+
height: '100%',
|
|
124
|
+
overflowX: 'hidden',
|
|
125
|
+
overflowY: 'auto',
|
|
126
|
+
transformOrigin: 'left',
|
|
127
|
+
transform: 'scaleX(0)',
|
|
128
|
+
// boxShadow: 'var(--block-box-shadow)',
|
|
129
|
+
boxShadow: 'var(--cover-box-shadow)',
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const onClickContainer = (event: Event) => {
|
|
134
|
+
if (
|
|
135
|
+
event.target instanceof HTMLDivElement &&
|
|
136
|
+
(event.target as HTMLDivElement).classList.contains('mobile-side-menu-mask')
|
|
137
|
+
) {
|
|
138
|
+
MobileSideMenuHelper.hide();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const ref: RefProps = {
|
|
142
|
+
onLoad: async () => {
|
|
143
|
+
MobileSideMenuHelper.addTouchEvent();
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
return (
|
|
147
|
+
<div css={css} ref={ref}>
|
|
148
|
+
{/* <SliderFrame hook={props.sliderFrameHook} /> */}
|
|
149
|
+
<div class='mobile-side-menu-mask' onClick={onClickContainer}>
|
|
150
|
+
<div class='mobile-side-menu'>{props.children}</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// import { NotificationColor, NotificationMessage, updateTheme, PopupMenuWithIcon, CssProps } from 'lupine.components';
|
|
2
|
-
import { CssProps } from 'lupine.components';
|
|
3
|
-
import { MobileSideMenuHelper } from './mobile-side-menu';
|
|
4
|
-
|
|
5
|
-
export const MobileTopSysIcon = () => {
|
|
6
|
-
const css: CssProps = {
|
|
7
|
-
cursor: 'pointer',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flexDirection: 'row',
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
fontSize: '28px',
|
|
12
|
-
};
|
|
13
|
-
return (
|
|
14
|
-
<div css={css} onClick={() => MobileSideMenuHelper.show()}>
|
|
15
|
-
<i class='ifc-icon bs-list'></i>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
1
|
+
// import { NotificationColor, NotificationMessage, updateTheme, PopupMenuWithIcon, CssProps } from 'lupine.components';
|
|
2
|
+
import { CssProps } from 'lupine.components';
|
|
3
|
+
import { MobileSideMenuHelper } from './mobile-side-menu';
|
|
4
|
+
|
|
5
|
+
export const MobileTopSysIcon = () => {
|
|
6
|
+
const css: CssProps = {
|
|
7
|
+
cursor: 'pointer',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
fontSize: '28px',
|
|
12
|
+
};
|
|
13
|
+
return (
|
|
14
|
+
<div css={css} onClick={() => MobileSideMenuHelper.show()}>
|
|
15
|
+
<i class='ifc-icon bs-list'></i>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
/*
|
|
2
|
-
const onLogout = async () => {
|
|
3
|
-
logout('/');
|
|
4
|
-
};
|
|
5
|
-
const userCookie = getCookieUser();
|
|
6
|
-
const listMenu = [
|
|
7
|
-
userCookie && (userCookie.email || userCookie.phone || userCookie.wx) ? '退出登录' : '登录',
|
|
8
|
-
'',
|
|
9
|
-
'浅色模式',
|
|
10
|
-
'深色模式',
|
|
11
|
-
'系统模式',
|
|
12
|
-
'',
|
|
13
|
-
'帮助',
|
|
14
|
-
'关于',
|
|
15
|
-
];
|
|
16
|
-
if (userCookie && userCookie.admin === '1') {
|
|
17
|
-
listMenu.splice(0, 0, '管理员');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const handleSelected = (value: string) => {
|
|
21
|
-
if (value === '浅色模式') {
|
|
22
|
-
updateTheme('light');
|
|
23
|
-
} else if (value === '深色模式') {
|
|
24
|
-
updateTheme('dark');
|
|
25
|
-
} else if (value === '系统模式') {
|
|
26
|
-
const themeMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
27
|
-
if (themeMedia.matches) {
|
|
28
|
-
document.documentElement.classList.remove('dark');
|
|
29
|
-
document.documentElement.classList.add('light');
|
|
30
|
-
} else {
|
|
31
|
-
document.documentElement.classList.remove('light');
|
|
32
|
-
document.documentElement.classList.add('dark');
|
|
33
|
-
}
|
|
34
|
-
} else if (value === '退出登录') {
|
|
35
|
-
onLogout();
|
|
36
|
-
} else if (value === '登录') {
|
|
37
|
-
window.location.href = '/login';
|
|
38
|
-
} else if (value === '管理员') {
|
|
39
|
-
window.open('/admin');
|
|
40
|
-
} else {
|
|
41
|
-
NotificationMessage.sendMessage('Selected: ' + value, NotificationColor.Success);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
*/
|
|
45
|
-
import { PopupMenuWithIcon } from 'lupine.components';
|
|
46
|
-
|
|
47
|
-
export const MobileTopSysMenu = (props: { menuItems: string[]; handleSelected: (value: string) => void }) => {
|
|
48
|
-
return (
|
|
49
|
-
<PopupMenuWithIcon
|
|
50
|
-
list={props.menuItems}
|
|
51
|
-
defaultValue=''
|
|
52
|
-
tips=''
|
|
53
|
-
minWidth='auto'
|
|
54
|
-
maxWidth='200px'
|
|
55
|
-
maxHeight='300px'
|
|
56
|
-
align='right'
|
|
57
|
-
noTriangleIcon={true}
|
|
58
|
-
handleSelected={props.handleSelected}
|
|
59
|
-
noUpdateLabel={true}
|
|
60
|
-
></PopupMenuWithIcon>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
const onLogout = async () => {
|
|
3
|
+
logout('/');
|
|
4
|
+
};
|
|
5
|
+
const userCookie = getCookieUser();
|
|
6
|
+
const listMenu = [
|
|
7
|
+
userCookie && (userCookie.email || userCookie.phone || userCookie.wx) ? '退出登录' : '登录',
|
|
8
|
+
'',
|
|
9
|
+
'浅色模式',
|
|
10
|
+
'深色模式',
|
|
11
|
+
'系统模式',
|
|
12
|
+
'',
|
|
13
|
+
'帮助',
|
|
14
|
+
'关于',
|
|
15
|
+
];
|
|
16
|
+
if (userCookie && userCookie.admin === '1') {
|
|
17
|
+
listMenu.splice(0, 0, '管理员');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const handleSelected = (value: string) => {
|
|
21
|
+
if (value === '浅色模式') {
|
|
22
|
+
updateTheme('light');
|
|
23
|
+
} else if (value === '深色模式') {
|
|
24
|
+
updateTheme('dark');
|
|
25
|
+
} else if (value === '系统模式') {
|
|
26
|
+
const themeMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
27
|
+
if (themeMedia.matches) {
|
|
28
|
+
document.documentElement.classList.remove('dark');
|
|
29
|
+
document.documentElement.classList.add('light');
|
|
30
|
+
} else {
|
|
31
|
+
document.documentElement.classList.remove('light');
|
|
32
|
+
document.documentElement.classList.add('dark');
|
|
33
|
+
}
|
|
34
|
+
} else if (value === '退出登录') {
|
|
35
|
+
onLogout();
|
|
36
|
+
} else if (value === '登录') {
|
|
37
|
+
window.location.href = '/login';
|
|
38
|
+
} else if (value === '管理员') {
|
|
39
|
+
window.open('/admin');
|
|
40
|
+
} else {
|
|
41
|
+
NotificationMessage.sendMessage('Selected: ' + value, NotificationColor.Success);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
*/
|
|
45
|
+
import { PopupMenuWithIcon } from 'lupine.components';
|
|
46
|
+
|
|
47
|
+
export const MobileTopSysMenu = (props: { menuItems: string[]; handleSelected: (value: string) => void }) => {
|
|
48
|
+
return (
|
|
49
|
+
<PopupMenuWithIcon
|
|
50
|
+
list={props.menuItems}
|
|
51
|
+
defaultValue=''
|
|
52
|
+
tips=''
|
|
53
|
+
minWidth='auto'
|
|
54
|
+
maxWidth='200px'
|
|
55
|
+
maxHeight='300px'
|
|
56
|
+
align='right'
|
|
57
|
+
noTriangleIcon={true}
|
|
58
|
+
handleSelected={props.handleSelected}
|
|
59
|
+
noUpdateLabel={true}
|
|
60
|
+
></PopupMenuWithIcon>
|
|
61
|
+
);
|
|
62
|
+
};
|
package/src/components/modal.tsx
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { FloatWindow, FloatWindowCloseProps, FloatWindowShowProps } from './float-window';
|
|
2
|
-
|
|
3
|
-
export class ModalWindow {
|
|
4
|
-
static async show({
|
|
5
|
-
title,
|
|
6
|
-
children,
|
|
7
|
-
contentMaxHeight,
|
|
8
|
-
contentMinWidth,
|
|
9
|
-
buttons,
|
|
10
|
-
noMoving = true,
|
|
11
|
-
noModal = false,
|
|
12
|
-
closeEvent,
|
|
13
|
-
handleClicked,
|
|
14
|
-
closeWhenClickOutside = true,
|
|
15
|
-
zIndex,
|
|
16
|
-
contentOverflowY,
|
|
17
|
-
}: FloatWindowShowProps): Promise<FloatWindowCloseProps> {
|
|
18
|
-
return FloatWindow.show({
|
|
19
|
-
title,
|
|
20
|
-
children,
|
|
21
|
-
contentMaxHeight,
|
|
22
|
-
contentMinWidth,
|
|
23
|
-
buttons,
|
|
24
|
-
noMoving,
|
|
25
|
-
noModal,
|
|
26
|
-
closeEvent,
|
|
27
|
-
handleClicked,
|
|
28
|
-
closeWhenClickOutside,
|
|
29
|
-
zIndex,
|
|
30
|
-
contentOverflowY,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { FloatWindow, FloatWindowCloseProps, FloatWindowShowProps } from './float-window';
|
|
2
|
+
|
|
3
|
+
export class ModalWindow {
|
|
4
|
+
static async show({
|
|
5
|
+
title,
|
|
6
|
+
children,
|
|
7
|
+
contentMaxHeight,
|
|
8
|
+
contentMinWidth,
|
|
9
|
+
buttons,
|
|
10
|
+
noMoving = true,
|
|
11
|
+
noModal = false,
|
|
12
|
+
closeEvent,
|
|
13
|
+
handleClicked,
|
|
14
|
+
closeWhenClickOutside = true,
|
|
15
|
+
zIndex,
|
|
16
|
+
contentOverflowY,
|
|
17
|
+
}: FloatWindowShowProps): Promise<FloatWindowCloseProps> {
|
|
18
|
+
return FloatWindow.show({
|
|
19
|
+
title,
|
|
20
|
+
children,
|
|
21
|
+
contentMaxHeight,
|
|
22
|
+
contentMinWidth,
|
|
23
|
+
buttons,
|
|
24
|
+
noMoving,
|
|
25
|
+
noModal,
|
|
26
|
+
closeEvent,
|
|
27
|
+
handleClicked,
|
|
28
|
+
closeWhenClickOutside,
|
|
29
|
+
zIndex,
|
|
30
|
+
contentOverflowY,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|