x-next 1.5.0 → 1.6.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/AI_USAGE.md +2 -2
- package/CHANGELOG.md +36 -0
- package/dist/_utils/color.d.ts +53 -0
- package/dist/components/color-picker/ColorPicker.d.ts +239 -0
- package/dist/components/color-picker/gradient-slider.d.ts +52 -0
- package/dist/components/color-picker/index.d.ts +238 -0
- package/dist/components/color-picker/panel.d.ts +721 -0
- package/dist/components/color-picker/sv-panel.d.ts +48 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +3 -3
- package/dist/components/date-picker/index.d.ts +6 -6
- package/dist/components/dropdown/Dropdown.vue.d.ts +34 -4
- package/dist/components/dropdown/DropdownButton.vue.d.ts +35 -5
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +34 -4
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +30 -0
- package/dist/components/dropdown/index.d.ts +209 -29
- package/dist/components/form/FormItem.vue.d.ts +3 -3
- package/dist/components/form/form-item-label.vue.d.ts +3 -3
- package/dist/components/form/index.d.ts +6 -6
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/SelectDropdown.vue.d.ts +30 -0
- package/dist/components/form-select/index.d.ts +66 -6
- package/dist/components/form-slider/Slider.vue.d.ts +3 -3
- package/dist/components/form-slider/index.d.ts +6 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
- package/dist/components/heatmap/Heatmap.d.ts +311 -0
- package/dist/components/heatmap/helpers/matrix.d.ts +58 -0
- package/dist/components/heatmap/index.d.ts +372 -0
- package/dist/components/heatmap/interface.d.ts +57 -0
- package/dist/components/image/Image.vue.d.ts +3 -3
- package/dist/components/image/ImagePreview.vue.d.ts +3 -3
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +3 -3
- package/dist/components/image/index.d.ts +24 -24
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
- package/dist/components/network/Network.vue.d.ts +1 -1
- package/dist/components/network/index.d.ts +3 -3
- package/dist/components/network/utils.d.ts +2 -0
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +9 -0
- package/dist/components/pagination/page-jumper.vue.d.ts +6 -0
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/skeleton/SkeletonShape.vue.d.ts +3 -3
- package/dist/components/skeleton/index.d.ts +6 -6
- package/dist/components/spin/Spin.d.ts +38 -0
- package/dist/components/spin/index.d.ts +30 -0
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
- package/dist/components/time-picker/index.d.ts +6 -6
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/components/watermark/Watermark.d.ts +1 -1
- package/dist/components/watermark/index.d.ts +3 -3
- package/dist/es/_styles/palette-aliases.js +8 -0
- package/dist/es/_utils/color.js +73 -0
- package/dist/es/components/button/Button.js +2 -2
- package/dist/es/components/color-picker/ColorPicker.js +239 -0
- package/dist/es/components/color-picker/gradient-slider.js +79 -0
- package/dist/es/components/color-picker/index.js +8 -0
- package/dist/es/components/color-picker/panel.js +307 -0
- package/dist/es/components/color-picker/sv-panel.js +99 -0
- package/dist/es/components/dropdown/dropdown-panel.vue.js +17 -17
- package/dist/es/components/form-input/Input.js +7 -7
- package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
- package/dist/es/components/form-input/InputSearch.js +2 -2
- package/dist/es/components/form-input-number/InputNumber.js +12 -12
- package/dist/es/components/heatmap/Heatmap.js +334 -0
- package/dist/es/components/heatmap/helpers/matrix.js +106 -0
- package/dist/es/components/heatmap/index.js +8 -0
- package/dist/es/components/index.js +118 -114
- package/dist/es/components/menu/sub-menu-pop.vue2.js +12 -12
- package/dist/es/components/network/Network.vue2.js +72 -72
- package/dist/es/components/network/utils.js +44 -35
- package/dist/es/components/pagination/Pagination.js +113 -104
- package/dist/es/components/pagination/page-item-ellipsis.vue.js +13 -12
- package/dist/es/components/pagination/page-item-ellipsis.vue2.js +19 -15
- package/dist/es/components/pagination/page-jumper.vue.js +13 -12
- package/dist/es/components/pagination/page-jumper.vue2.js +7 -4
- package/dist/es/components/pagination/page-options.vue.js +4 -3
- package/dist/es/components/pagination/page-options.vue2.js +17 -15
- package/dist/es/components/skeleton/Skeleton.vue.js +11 -9
- package/dist/es/components/skeleton/SkeletonLine.vue.js +9 -8
- package/dist/es/components/skeleton/SkeletonShape.vue.js +8 -7
- package/dist/es/components/spin/Spin.js +124 -60
- package/dist/es/components/table/Table.js +3 -1
- package/dist/es/components/trigger/Trigger.js +19 -19
- package/dist/es/icons/_self/empty-better.js +25 -8
- package/dist/es/index.js +162 -158
- package/dist/es/locale/en-US.js +17 -1
- package/dist/es/locale/zh-CN.js +17 -1
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +28 -0
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/color-picker.css +1 -0
- package/dist/style/color-picker.js +2 -0
- package/dist/style/date-picker.css +1 -1
- package/dist/style/empty.css +1 -1
- package/dist/style/form-checkbox.css +1 -1
- package/dist/style/form-input-tag.css +1 -1
- package/dist/style/form-input.css +1 -1
- package/dist/style/form-radio.css +1 -1
- package/dist/style/form-textarea.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/heatmap.css +1 -0
- package/dist/style/heatmap.js +2 -0
- package/dist/style/image.css +1 -1
- package/dist/style/menu.css +1 -1
- package/dist/style/pagination.css +1 -1
- package/dist/style/skeleton.css +1 -1
- package/dist/style/spin.css +1 -1
- package/dist/style/steps.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/volar.d.ts +2 -0
|
@@ -4,159 +4,163 @@ import { ConfigProvider as x } from "./config-provider/index.js";
|
|
|
4
4
|
import { Dialog as n } from "./dialog/index.js";
|
|
5
5
|
import { Drawer as u } from "./drawer/index.js";
|
|
6
6
|
import { Dropdown as c, DropdownButton as d, DropdownGroup as T, DropdownOption as S, DropdownSubmenu as g } from "./dropdown/index.js";
|
|
7
|
-
import { Empty as
|
|
8
|
-
import { DatePicker as b, MonthPicker as s, QuarterPicker as w, RangePicker as L, WeekPicker as
|
|
7
|
+
import { Empty as I } from "./empty/index.js";
|
|
8
|
+
import { DatePicker as b, MonthPicker as s, QuarterPicker as w, RangePicker as L, WeekPicker as C, YearPicker as D } from "./date-picker/index.js";
|
|
9
9
|
import { Form as G, FormItem as h } from "./form/index.js";
|
|
10
10
|
import { Checkbox as M, CheckboxGroup as R } from "./form-checkbox/index.js";
|
|
11
11
|
import { Input as B, InputGroup as E, InputPassword as _, InputSearch as N } from "./form-input/index.js";
|
|
12
12
|
import { InputNumber as j } from "./form-input-number/index.js";
|
|
13
|
-
import { InputTag as
|
|
14
|
-
import { Radio as
|
|
13
|
+
import { InputTag as H } from "./form-input-tag/index.js";
|
|
14
|
+
import { Radio as W, RadioGroup as z } from "./form-radio/index.js";
|
|
15
15
|
import { Select as U, SelectDropdown as Y, SelectOption as Z, SelectOptionGroup as q } from "./form-select/index.js";
|
|
16
16
|
import { Slider as V } from "./form-slider/index.js";
|
|
17
17
|
import { Switch as $ } from "./form-switch/index.js";
|
|
18
18
|
import { Textarea as ro } from "./form-textarea/index.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import { default as Fr } from "./table/table-
|
|
55
|
-
import { default as
|
|
56
|
-
import { default as zr } from "./table/table-
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
19
|
+
import { ColorPicker as to } from "./color-picker/index.js";
|
|
20
|
+
import { Draggable as mo } from "./draggable/index.js";
|
|
21
|
+
import { Col as xo, Grid as ao, GridItem as no, Row as io } from "./grid/index.js";
|
|
22
|
+
import { Heatmap as lo } from "./heatmap/index.js";
|
|
23
|
+
import { Image as To, ImagePreview as So, ImagePreviewAction as go, ImagePreviewGroup as Po } from "./image/index.js";
|
|
24
|
+
import { Layout as ko, LayoutContent as bo, LayoutFooter as so, LayoutHeader as wo, LayoutSidebar as Lo } from "./layout/index.js";
|
|
25
|
+
import { Link as Do } from "./link/index.js";
|
|
26
|
+
import { Menu as Go, MenuItem as ho, MenuItemGroup as vo, MenuSubMenu as Mo } from "./menu/index.js";
|
|
27
|
+
import { Message as Ao } from "./message/index.js";
|
|
28
|
+
import { Network as Eo } from "./network/index.js";
|
|
29
|
+
import { Notification as No } from "./notification/index.js";
|
|
30
|
+
import { Pagination as jo } from "./pagination/index.js";
|
|
31
|
+
import { Popconfirm as Ho } from "./popconfirm/index.js";
|
|
32
|
+
import { Popover as Wo } from "./popover/index.js";
|
|
33
|
+
import { Popup as Qo } from "./popup/index.js";
|
|
34
|
+
import { Progress as Yo } from "./progress/index.js";
|
|
35
|
+
import { Rate as qo } from "./rate/index.js";
|
|
36
|
+
import { ResizeBox as Vo } from "./resize-box/index.js";
|
|
37
|
+
import { Scrollbar as $o } from "./scrollbar-v2/index.js";
|
|
38
|
+
import { Skeleton as rr, SkeletonLine as er, SkeletonShape as tr } from "./skeleton/index.js";
|
|
39
|
+
import { Space as mr } from "./space/index.js";
|
|
40
|
+
import { Spin as xr } from "./spin/index.js";
|
|
41
|
+
import { Step as nr, Steps as ir } from "./steps/index.js";
|
|
42
|
+
import { Table as lr, TableColumn as cr } from "./table/index.js";
|
|
43
|
+
import { TabPane as Tr, Tabs as Sr } from "./tabs/index.js";
|
|
44
|
+
import { Tag as Pr } from "./tag/index.js";
|
|
45
|
+
import { TimePicker as kr } from "./time-picker/index.js";
|
|
46
|
+
import { TimeRangeSelector as sr } from "./time-range-selector/index.js";
|
|
47
|
+
import { Timeline as Lr } from "./timeline/index.js";
|
|
48
|
+
import { TimelineItem as Dr } from "./timeline-item/index.js";
|
|
49
|
+
import { Tooltip as Gr } from "./tooltip/index.js";
|
|
50
|
+
import { TrendChart as vr } from "./trend-chart/index.js";
|
|
51
|
+
import { Trigger as Rr } from "./trigger/index.js";
|
|
52
|
+
import { Watermark as Br } from "./watermark/index.js";
|
|
53
|
+
import { TABLE_LOCALE_EN_US as _r, TABLE_LOCALE_ZH_CN as Nr, formatLocaleText as Or } from "./table/locale.js";
|
|
54
|
+
import { default as Fr } from "./table/table-tbody.js";
|
|
55
|
+
import { default as Kr } from "./table/table-td.js";
|
|
56
|
+
import { default as zr } from "./table/table-th.js";
|
|
57
|
+
import { default as Ur } from "./table/table-thead.js";
|
|
58
|
+
import { default as Zr } from "./table/table-tr.js";
|
|
59
|
+
import { configProviderInjectionKey as Jr } from "./config-provider/context.js";
|
|
60
|
+
import { formInjectionKey as Xr, formItemInjectionKey as $r } from "./form/context.js";
|
|
61
|
+
import { vDraggable as re } from "./draggable/directive.js";
|
|
62
|
+
import { vWatermark as te } from "./watermark/directive.js";
|
|
61
63
|
export {
|
|
62
64
|
e as Alert,
|
|
63
65
|
p as Button,
|
|
64
66
|
m as ButtonGroup,
|
|
65
67
|
M as Checkbox,
|
|
66
68
|
R as CheckboxGroup,
|
|
67
|
-
|
|
69
|
+
xo as Col,
|
|
70
|
+
to as ColorPicker,
|
|
68
71
|
x as ConfigProvider,
|
|
69
72
|
b as DatePicker,
|
|
70
73
|
n as Dialog,
|
|
71
|
-
|
|
74
|
+
mo as Draggable,
|
|
72
75
|
u as Drawer,
|
|
73
76
|
c as Dropdown,
|
|
74
77
|
d as DropdownButton,
|
|
75
78
|
T as DropdownGroup,
|
|
76
79
|
S as DropdownOption,
|
|
77
80
|
g as DropdownSubmenu,
|
|
78
|
-
|
|
81
|
+
I as Empty,
|
|
79
82
|
G as Form,
|
|
80
83
|
h as FormItem,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
ao as Grid,
|
|
85
|
+
no as GridItem,
|
|
86
|
+
lo as Heatmap,
|
|
87
|
+
To as Image,
|
|
88
|
+
So as ImagePreview,
|
|
89
|
+
go as ImagePreviewAction,
|
|
90
|
+
Po as ImagePreviewGroup,
|
|
87
91
|
B as Input,
|
|
88
92
|
E as InputGroup,
|
|
89
93
|
j as InputNumber,
|
|
90
94
|
_ as InputPassword,
|
|
91
95
|
N as InputSearch,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
H as InputTag,
|
|
97
|
+
ko as Layout,
|
|
98
|
+
bo as LayoutContent,
|
|
99
|
+
so as LayoutFooter,
|
|
100
|
+
wo as LayoutHeader,
|
|
101
|
+
Lo as LayoutSidebar,
|
|
102
|
+
Do as Link,
|
|
103
|
+
Go as Menu,
|
|
104
|
+
ho as MenuItem,
|
|
105
|
+
vo as MenuItemGroup,
|
|
106
|
+
Mo as MenuSubMenu,
|
|
107
|
+
Ao as Message,
|
|
104
108
|
s as MonthPicker,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
Eo as Network,
|
|
110
|
+
No as Notification,
|
|
111
|
+
jo as Pagination,
|
|
112
|
+
Ho as Popconfirm,
|
|
113
|
+
Wo as Popover,
|
|
114
|
+
Qo as Popup,
|
|
115
|
+
Yo as Progress,
|
|
112
116
|
w as QuarterPicker,
|
|
113
|
-
|
|
117
|
+
W as Radio,
|
|
114
118
|
z as RadioGroup,
|
|
115
119
|
L as RangePicker,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
qo as Rate,
|
|
121
|
+
Vo as ResizeBox,
|
|
122
|
+
io as Row,
|
|
123
|
+
$o as Scrollbar,
|
|
120
124
|
U as Select,
|
|
121
125
|
Y as SelectDropdown,
|
|
122
126
|
Z as SelectOption,
|
|
123
127
|
q as SelectOptionGroup,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
rr as Skeleton,
|
|
129
|
+
er as SkeletonLine,
|
|
130
|
+
tr as SkeletonShape,
|
|
127
131
|
V as Slider,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
mr as Space,
|
|
133
|
+
xr as Spin,
|
|
134
|
+
nr as Step,
|
|
135
|
+
ir as Steps,
|
|
132
136
|
$ as Switch,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
_r as TABLE_LOCALE_EN_US,
|
|
138
|
+
Nr as TABLE_LOCALE_ZH_CN,
|
|
139
|
+
Tr as TabPane,
|
|
140
|
+
lr as Table,
|
|
141
|
+
cr as TableColumn,
|
|
142
|
+
Sr as Tabs,
|
|
143
|
+
Pr as Tag,
|
|
144
|
+
Fr as Tbody,
|
|
145
|
+
Kr as Td,
|
|
142
146
|
ro as Textarea,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
147
|
+
zr as Th,
|
|
148
|
+
Ur as Thead,
|
|
149
|
+
kr as TimePicker,
|
|
150
|
+
sr as TimeRangeSelector,
|
|
151
|
+
Lr as Timeline,
|
|
152
|
+
Dr as TimelineItem,
|
|
153
|
+
Gr as Tooltip,
|
|
154
|
+
Zr as Tr,
|
|
155
|
+
vr as TrendChart,
|
|
156
|
+
Rr as Trigger,
|
|
157
|
+
Br as Watermark,
|
|
158
|
+
C as WeekPicker,
|
|
159
|
+
D as YearPicker,
|
|
160
|
+
Jr as configProviderInjectionKey,
|
|
161
|
+
Xr as formInjectionKey,
|
|
162
|
+
$r as formItemInjectionKey,
|
|
163
|
+
Or as formatLocaleText,
|
|
164
|
+
re as vDraggable,
|
|
165
|
+
te as vWatermark
|
|
162
166
|
};
|
|
@@ -40,16 +40,16 @@ const Q = S({
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
setup(s) {
|
|
43
|
-
const { key: l } = N(), { level: a } = _(), { selectable: u, disabled: p, isChildrenSelected: C, popupMaxHeight: x } = B(s), t = V(), { onSubMenuClick: r, onMenuItemClick: n } = t, m = o(() => t.prefixCls),
|
|
44
|
-
() => u.value &&
|
|
43
|
+
const { key: l } = N(), { level: a } = _(), { selectable: u, disabled: p, isChildrenSelected: C, popupMaxHeight: x } = B(s), t = V(), { onSubMenuClick: r, onMenuItemClick: n } = t, m = o(() => t.prefixCls), f = o(() => t.mode), v = o(() => t.selectedKeys || []), i = o(() => `${m.value}-pop`), d = o(
|
|
44
|
+
() => u.value && v.value.includes(l.value) || C.value
|
|
45
45
|
), M = o(() => [
|
|
46
46
|
`${i.value}`,
|
|
47
47
|
`${i.value}-header`,
|
|
48
48
|
{
|
|
49
|
-
[`${m.value}-selected`]:
|
|
49
|
+
[`${m.value}-selected`]: d.value
|
|
50
50
|
}
|
|
51
|
-
]), h = o(() =>
|
|
52
|
-
|
|
51
|
+
]), h = o(() => f.value === "horizontal" && !t.inTrigger), g = P(!1), c = (e) => {
|
|
52
|
+
g.value = e;
|
|
53
53
|
}, y = w("trigger"), k = o(() => {
|
|
54
54
|
var e;
|
|
55
55
|
return [
|
|
@@ -63,14 +63,14 @@ const Q = S({
|
|
|
63
63
|
}), b = o(() => I(t.triggerProps || {}, ["class"]));
|
|
64
64
|
return {
|
|
65
65
|
menuPrefixCls: m,
|
|
66
|
-
mode:
|
|
66
|
+
mode: f,
|
|
67
67
|
level: a,
|
|
68
68
|
classNames: M,
|
|
69
|
-
isSelected:
|
|
69
|
+
isSelected: d,
|
|
70
70
|
disabled: p,
|
|
71
|
-
selectedKeys:
|
|
71
|
+
selectedKeys: v,
|
|
72
72
|
needPopOnBottom: h,
|
|
73
|
-
popVisible:
|
|
73
|
+
popVisible: g,
|
|
74
74
|
className: y,
|
|
75
75
|
triggerClassNames: k,
|
|
76
76
|
triggerProps: b,
|
|
@@ -83,13 +83,13 @@ const Q = S({
|
|
|
83
83
|
p.value || s._internalSkipCollect || (r && r(l.value, a.value), u.value && n && n(l.value));
|
|
84
84
|
},
|
|
85
85
|
onKeydown: (e) => {
|
|
86
|
-
p.value || s._internalSkipCollect || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r && r(l.value, a.value), u.value && n && n(l.value));
|
|
86
|
+
p.value || s._internalSkipCollect || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r && r(l.value, a.value), c(!0), u.value && n && n(l.value));
|
|
87
87
|
},
|
|
88
88
|
onMenuItemClick: (e) => {
|
|
89
|
-
n && n(e),
|
|
89
|
+
n && n(e), c(!1);
|
|
90
90
|
},
|
|
91
91
|
onVisibleChange: (e) => {
|
|
92
|
-
|
|
92
|
+
c(e);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useLocale as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { getClassNameMixin as
|
|
4
|
-
import { Network as
|
|
5
|
-
const
|
|
1
|
+
import { useLocale as E } from "../../locale/index.js";
|
|
2
|
+
import { defineComponent as U, ref as m, computed as n, watch as K, onMounted as D, onUnmounted as I } from "vue";
|
|
3
|
+
import { getClassNameMixin as O } from "../../_utils/config.js";
|
|
4
|
+
import { Network as $ } from "./utils.js";
|
|
5
|
+
const C = {
|
|
6
6
|
online: !0,
|
|
7
7
|
quality: "unknown",
|
|
8
8
|
source: "manual",
|
|
9
9
|
reason: "initial",
|
|
10
10
|
lastCheckedAt: 0
|
|
11
|
-
},
|
|
11
|
+
}, B = {
|
|
12
12
|
unknown: "network.checking",
|
|
13
13
|
good: "network.good",
|
|
14
14
|
medium: "network.fair",
|
|
15
15
|
poor: "network.poor",
|
|
16
16
|
offline: "network.offline"
|
|
17
|
-
},
|
|
17
|
+
}, F = ["unknown", "good", "medium", "poor", "offline"], Y = U({
|
|
18
18
|
name: "Network",
|
|
19
19
|
props: {
|
|
20
20
|
size: {
|
|
@@ -40,7 +40,7 @@ const y = {
|
|
|
40
40
|
*/
|
|
41
41
|
status: {
|
|
42
42
|
type: String,
|
|
43
|
-
validator: (
|
|
43
|
+
validator: (t) => F.includes(t)
|
|
44
44
|
},
|
|
45
45
|
/**
|
|
46
46
|
* @zh 主动探测 URL,需要支持 CORS。
|
|
@@ -85,94 +85,94 @@ const y = {
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
emits: {
|
|
88
|
-
change: (
|
|
89
|
-
online: (
|
|
90
|
-
offline: (
|
|
91
|
-
probe: (
|
|
88
|
+
change: (t) => !0,
|
|
89
|
+
online: (t) => !0,
|
|
90
|
+
offline: (t) => !0,
|
|
91
|
+
probe: (t) => !0
|
|
92
92
|
},
|
|
93
|
-
setup(
|
|
94
|
-
const a =
|
|
95
|
-
...
|
|
96
|
-
online:
|
|
97
|
-
quality:
|
|
93
|
+
setup(t, { emit: l, expose: x }) {
|
|
94
|
+
const a = O("network"), r = m(), i = m(C), s = n(() => t.size === "small" || t.size === "mini" ? 3 : t.size === "medium" ? 4 : 5), f = (e) => ({
|
|
95
|
+
...C,
|
|
96
|
+
online: e !== "offline",
|
|
97
|
+
quality: e,
|
|
98
98
|
source: "manual",
|
|
99
99
|
lastCheckedAt: Date.now()
|
|
100
|
-
}),
|
|
101
|
-
() =>
|
|
102
|
-
),
|
|
103
|
-
const [o,
|
|
100
|
+
}), u = n(() => t.status ? f(t.status) : i.value), { t: w } = E(), g = n(() => w(B[u.value.quality])), M = n(
|
|
101
|
+
() => t.ariaLabel || w("network.ariaLabel", { status: g.value })
|
|
102
|
+
), A = (e, o = "--") => e === void 0 ? o : e <= 0 ? "0K/s" : e >= 1024 * 1024 ? `${(e / 1024 / 1024).toFixed(1)}M/s` : `${Math.max(1, Math.round(e / 1024))}K/s`, T = n(() => A(u.value.downloadSpeed)), d = n(() => t.showMetrics), L = (e) => {
|
|
103
|
+
const [o, h] = t.signalStrengthColor, v = {
|
|
104
104
|
unknown: "var(--x-network-color-unknown)",
|
|
105
105
|
good: o || "var(--x-network-color-good)",
|
|
106
|
-
medium:
|
|
107
|
-
poor:
|
|
106
|
+
medium: t.statusColors.medium || "var(--x-network-color-medium)",
|
|
107
|
+
poor: h || "var(--x-network-color-poor)",
|
|
108
108
|
offline: "var(--x-network-color-offline)"
|
|
109
109
|
};
|
|
110
|
-
return
|
|
111
|
-
},
|
|
112
|
-
const
|
|
113
|
-
return Array.from({ length: s.value }, (
|
|
114
|
-
const
|
|
110
|
+
return t.statusColors[e] || v[e];
|
|
111
|
+
}, N = (e) => e === "good" ? s.value : e === "medium" ? Math.max(2, Math.ceil(s.value * 0.6)) : e === "poor" ? Math.max(1, Math.ceil(s.value * 0.4)) : 0, q = n(() => {
|
|
112
|
+
const e = N(u.value.quality), o = L(u.value.quality);
|
|
113
|
+
return Array.from({ length: s.value }, (h, v) => {
|
|
114
|
+
const y = v < e;
|
|
115
115
|
return {
|
|
116
|
-
active:
|
|
117
|
-
color:
|
|
116
|
+
active: y,
|
|
117
|
+
color: y ? o : "var(--x-network-color-inactive)"
|
|
118
118
|
};
|
|
119
119
|
});
|
|
120
|
-
}),
|
|
121
|
-
if (
|
|
122
|
-
const o =
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
var
|
|
126
|
-
if ((
|
|
127
|
-
|
|
120
|
+
}), z = (e, o) => e.online === o.online && e.quality === o.quality && e.source === o.source && e.reason === o.reason && e.latency === o.latency && e.downloadSpeed === o.downloadSpeed && e.effectiveType === o.effectiveType, c = m(void 0), _ = (e) => {
|
|
121
|
+
if (t.status) return;
|
|
122
|
+
const o = c.value ?? i.value;
|
|
123
|
+
i.value = e, (!c.value || !z(c.value, e)) && (c.value = e, l("change", e)), e.source === "probe" && l("probe", e), o.quality !== "offline" && e.quality === "offline" && l("offline", e), o.quality === "offline" && e.quality !== "offline" && l("online", e);
|
|
124
|
+
}, k = () => {
|
|
125
|
+
var e;
|
|
126
|
+
if ((e = r.value) == null || e.destroy(), r.value = void 0, t.status) {
|
|
127
|
+
i.value = f(t.status);
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
r.value = new
|
|
131
|
-
ping:
|
|
132
|
-
interval:
|
|
133
|
-
timeout:
|
|
134
|
-
}),
|
|
135
|
-
},
|
|
136
|
-
var
|
|
137
|
-
if (
|
|
138
|
-
const o =
|
|
139
|
-
return
|
|
130
|
+
r.value = new $(_, {
|
|
131
|
+
ping: t.ping,
|
|
132
|
+
interval: t.interval,
|
|
133
|
+
timeout: t.timeout
|
|
134
|
+
}), i.value = r.value.getSnapshot();
|
|
135
|
+
}, S = async () => {
|
|
136
|
+
var e;
|
|
137
|
+
if (t.status) {
|
|
138
|
+
const o = f(t.status);
|
|
139
|
+
return l("change", o), o;
|
|
140
140
|
}
|
|
141
|
-
return (
|
|
141
|
+
return await ((e = r.value) == null ? void 0 : e.refresh()) ?? i.value;
|
|
142
142
|
};
|
|
143
|
-
|
|
144
|
-
() => [
|
|
143
|
+
K(
|
|
144
|
+
() => [t.status, t.ping, t.interval, t.timeout],
|
|
145
145
|
() => {
|
|
146
|
-
|
|
146
|
+
k();
|
|
147
147
|
}
|
|
148
|
-
),
|
|
149
|
-
|
|
150
|
-
}),
|
|
151
|
-
var
|
|
152
|
-
(
|
|
153
|
-
}),
|
|
154
|
-
const
|
|
148
|
+
), D(() => {
|
|
149
|
+
k();
|
|
150
|
+
}), I(() => {
|
|
151
|
+
var e;
|
|
152
|
+
(e = r.value) == null || e.destroy(), r.value = void 0;
|
|
153
|
+
}), x({ refresh: S });
|
|
154
|
+
const b = n(() => [
|
|
155
155
|
a.block,
|
|
156
|
-
|
|
157
|
-
a.modifier(`status-${
|
|
156
|
+
t.size && a.modifier(t.size),
|
|
157
|
+
a.modifier(`status-${u.value.quality}`),
|
|
158
158
|
{
|
|
159
|
-
[a.is("with-text")]:
|
|
160
|
-
[a.is("with-metrics")]:
|
|
159
|
+
[a.is("with-text")]: d.value,
|
|
160
|
+
[a.is("with-metrics")]: d.value
|
|
161
161
|
}
|
|
162
162
|
]);
|
|
163
163
|
return {
|
|
164
164
|
className: a,
|
|
165
|
-
cls:
|
|
166
|
-
lineItems:
|
|
167
|
-
mergedStatus:
|
|
168
|
-
statusText:
|
|
169
|
-
mergedAriaLabel:
|
|
170
|
-
formattedDownloadSpeed:
|
|
171
|
-
mergedShowMetrics:
|
|
172
|
-
refresh:
|
|
165
|
+
cls: b,
|
|
166
|
+
lineItems: q,
|
|
167
|
+
mergedStatus: u,
|
|
168
|
+
statusText: g,
|
|
169
|
+
mergedAriaLabel: M,
|
|
170
|
+
formattedDownloadSpeed: T,
|
|
171
|
+
mergedShowMetrics: d,
|
|
172
|
+
refresh: S
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
export {
|
|
177
|
-
|
|
177
|
+
Y as default
|
|
178
178
|
};
|