vue-devui 1.0.0-rc.7 → 1.0.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 +163 -146
- package/alert/index.es.js +46 -15
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8230 -231
- package/auto-complete/index.umd.js +29 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +81 -70
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +34 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5706 -98
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +38 -13
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8066 -245
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{date-picker → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +213 -0
- package/collapse/index.umd.js +1 -0
- package/{date-picker → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +56 -13
- package/countdown/index.umd.js +1 -1
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12020 -0
- package/date-picker-pro/index.umd.js +27 -0
- package/date-picker-pro/package.json +7 -0
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.es.js +29 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +178 -142
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +742 -107
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +544 -316
- package/form/index.umd.js +17 -17
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +28 -4
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +71 -50
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +184 -23
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +34 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8250 -131
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +275 -203
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +34 -6
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +34 -10
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8310 -0
- package/mention/index.umd.js +36 -0
- package/mention/package.json +7 -0
- package/mention/style.css +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/index.es.js +934 -0
- package/menu/index.umd.js +1 -0
- package/menu/package.json +7 -0
- package/menu/style.css +1 -0
- package/message/index.d.ts +7 -0
- package/message/index.es.js +538 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.es.js +359 -170
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +236 -65
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Mention.js +3 -0
- package/nuxt/components/Menu.js +3 -0
- package/nuxt/components/MenuItem.js +3 -0
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/SubMenu.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/iconProps.js +1 -0
- package/nuxt/components/mentionProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/treeNodeProps.js +3 -0
- package/overlay/index.es.js +84 -125
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +7 -3
- package/pagination/index.es.js +234 -39
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +274 -220
- package/popover/index.umd.js +13 -13
- package/popover/style.css +1 -1
- package/progress/index.es.js +31 -9
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7969 -152
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +46 -14
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +169 -22
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3823 -1090
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9186 -478
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +110 -259
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +143 -146
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +433 -207
- package/splitter/index.umd.js +17 -17
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +34 -16
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +26 -2
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +386 -0
- package/steps/index.umd.js +1 -0
- package/steps/package.json +7 -0
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.es.js +7802 -59
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +9769 -919
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +309 -96
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +35 -7
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7922 -78
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9549 -0
- package/time-picker/index.umd.js +27 -0
- package/time-picker/package.json +7 -0
- package/time-picker/style.css +1 -0
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9585 -0
- package/time-select/index.umd.js +27 -0
- package/time-select/package.json +7 -0
- package/time-select/style.css +1 -0
- package/timeline/index.es.js +169 -22
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +265 -212
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11343 -795
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +494 -106
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +22849 -13614
- package/vue-devui.umd.js +30 -23
- package/date-picker/index.es.js +0 -1145
- package/date-picker/index.umd.js +0 -1
- package/date-picker/style.css +0 -1
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/formControlProps.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
package/icon/index.es.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineComponent, toRefs, createVNode } from "vue";
|
|
1
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps } from "vue";
|
|
2
|
+
const DEFAULT_PREFIX = "icon";
|
|
2
3
|
const iconProps = {
|
|
3
4
|
name: {
|
|
4
5
|
type: String,
|
|
@@ -6,43 +7,202 @@ const iconProps = {
|
|
|
6
7
|
required: true
|
|
7
8
|
},
|
|
8
9
|
size: {
|
|
9
|
-
type: String,
|
|
10
|
+
type: [Number, String],
|
|
10
11
|
default: "inherit"
|
|
11
12
|
},
|
|
12
13
|
color: {
|
|
13
14
|
type: String,
|
|
14
15
|
default: "inherit"
|
|
15
16
|
},
|
|
17
|
+
component: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
16
21
|
classPrefix: {
|
|
17
22
|
type: String,
|
|
18
|
-
default:
|
|
23
|
+
default: DEFAULT_PREFIX
|
|
24
|
+
},
|
|
25
|
+
operable: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
rotate: {
|
|
34
|
+
type: [Number, String]
|
|
19
35
|
}
|
|
20
36
|
};
|
|
21
|
-
|
|
22
|
-
name:
|
|
23
|
-
|
|
37
|
+
const svgIconProps = {
|
|
38
|
+
name: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "",
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
color: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "inherit"
|
|
46
|
+
},
|
|
47
|
+
size: {
|
|
48
|
+
type: [Number, String],
|
|
49
|
+
default: "inherit"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function createBem(namespace, element, modifier) {
|
|
53
|
+
let cls = namespace;
|
|
54
|
+
if (element) {
|
|
55
|
+
cls += `__${element}`;
|
|
56
|
+
}
|
|
57
|
+
if (modifier) {
|
|
58
|
+
cls += `--${modifier}`;
|
|
59
|
+
}
|
|
60
|
+
return cls;
|
|
61
|
+
}
|
|
62
|
+
function useNamespace(block, needDot = false) {
|
|
63
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
64
|
+
const b = () => createBem(namespace);
|
|
65
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
66
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
67
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
68
|
+
return {
|
|
69
|
+
b,
|
|
70
|
+
e,
|
|
71
|
+
m,
|
|
72
|
+
em
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var icon = "";
|
|
76
|
+
var svgIcon = defineComponent({
|
|
77
|
+
name: "DSvgIcon",
|
|
78
|
+
props: svgIconProps,
|
|
24
79
|
setup(props) {
|
|
25
80
|
const {
|
|
26
81
|
name,
|
|
27
|
-
size,
|
|
28
82
|
color,
|
|
29
|
-
|
|
83
|
+
size
|
|
30
84
|
} = toRefs(props);
|
|
85
|
+
const ns = useNamespace("svg-icon");
|
|
86
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
87
|
+
const iconSize = computed(() => {
|
|
88
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
89
|
+
});
|
|
90
|
+
const styles = {
|
|
91
|
+
width: iconSize.value,
|
|
92
|
+
height: iconSize.value
|
|
93
|
+
};
|
|
94
|
+
return () => {
|
|
95
|
+
return createVNode("svg", {
|
|
96
|
+
"class": ns.b(),
|
|
97
|
+
"style": styles
|
|
98
|
+
}, [createVNode("use", {
|
|
99
|
+
"xlink:href": iconName.value,
|
|
100
|
+
"fill": color.value
|
|
101
|
+
}, null)]);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
function isUrl(value) {
|
|
106
|
+
return /^((http|https):)?\/\//.test(value);
|
|
107
|
+
}
|
|
108
|
+
function useIconDom(props, ctx) {
|
|
109
|
+
const {
|
|
110
|
+
component,
|
|
111
|
+
name,
|
|
112
|
+
size,
|
|
113
|
+
color,
|
|
114
|
+
classPrefix,
|
|
115
|
+
rotate
|
|
116
|
+
} = toRefs(props);
|
|
117
|
+
const ns = useNamespace("icon");
|
|
118
|
+
const iconSize = computed(() => {
|
|
119
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
120
|
+
});
|
|
121
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
122
|
+
const imgIconDom = () => {
|
|
123
|
+
return createVNode("img", mergeProps({
|
|
124
|
+
"src": name.value,
|
|
125
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
126
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
127
|
+
"style": {
|
|
128
|
+
width: iconSize.value || "",
|
|
129
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
|
|
130
|
+
verticalAlign: "middle"
|
|
131
|
+
}
|
|
132
|
+
}, ctx.attrs), null);
|
|
133
|
+
};
|
|
134
|
+
const svgIconDom = () => {
|
|
135
|
+
return createVNode(IconComponent, mergeProps({
|
|
136
|
+
"name": name.value,
|
|
137
|
+
"color": color.value,
|
|
138
|
+
"size": iconSize.value,
|
|
139
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
140
|
+
"style": {
|
|
141
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
142
|
+
}
|
|
143
|
+
}, ctx.attrs), null);
|
|
144
|
+
};
|
|
145
|
+
const fontIconDom = () => {
|
|
146
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
147
|
+
return createVNode("i", mergeProps({
|
|
148
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns.m("spin")],
|
|
149
|
+
"style": {
|
|
150
|
+
fontSize: iconSize.value,
|
|
151
|
+
color: color.value,
|
|
152
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
153
|
+
}
|
|
154
|
+
}, ctx.attrs), null);
|
|
155
|
+
};
|
|
156
|
+
const iconDom = () => {
|
|
157
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
iconDom
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
var Icon = defineComponent({
|
|
164
|
+
name: "DIcon",
|
|
165
|
+
props: iconProps,
|
|
166
|
+
emits: ["click"],
|
|
167
|
+
setup(props, ctx) {
|
|
168
|
+
const {
|
|
169
|
+
disabled,
|
|
170
|
+
operable
|
|
171
|
+
} = toRefs(props);
|
|
172
|
+
const {
|
|
173
|
+
iconDom
|
|
174
|
+
} = useIconDom(props, ctx);
|
|
175
|
+
const ns = useNamespace("icon");
|
|
176
|
+
const wrapClassed = computed(() => ({
|
|
177
|
+
[ns.e("container")]: true,
|
|
178
|
+
[ns.m("disabled")]: disabled.value,
|
|
179
|
+
[ns.m("operable")]: operable.value
|
|
180
|
+
}));
|
|
181
|
+
const onClick = (e) => {
|
|
182
|
+
if (disabled.value) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
ctx.emit("click", e);
|
|
186
|
+
};
|
|
187
|
+
return () => {
|
|
188
|
+
var _a, _b, _c, _d;
|
|
189
|
+
return createVNode("div", {
|
|
190
|
+
"class": wrapClassed.value,
|
|
191
|
+
"onClick": onClick
|
|
192
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
var iconGroup = "";
|
|
197
|
+
var IconGroup = defineComponent({
|
|
198
|
+
name: "DIconGroup",
|
|
199
|
+
setup(_, ctx) {
|
|
200
|
+
const ns = useNamespace("icon-group");
|
|
31
201
|
return () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
width: size.value,
|
|
37
|
-
verticalAlign: "text-bottom"
|
|
38
|
-
}
|
|
39
|
-
}, null) : createVNode("i", {
|
|
40
|
-
"class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
|
|
41
|
-
"style": {
|
|
42
|
-
fontSize: size.value,
|
|
43
|
-
color: color.value
|
|
44
|
-
}
|
|
45
|
-
}, null);
|
|
202
|
+
var _a, _b;
|
|
203
|
+
return createVNode("div", {
|
|
204
|
+
"class": ns.b()
|
|
205
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
46
206
|
};
|
|
47
207
|
}
|
|
48
208
|
});
|
|
@@ -52,6 +212,7 @@ var index = {
|
|
|
52
212
|
status: "100%",
|
|
53
213
|
install(app) {
|
|
54
214
|
app.component(Icon.name, Icon);
|
|
215
|
+
app.component(IconGroup.name, IconGroup);
|
|
55
216
|
}
|
|
56
217
|
};
|
|
57
|
-
export { Icon, index as default, iconProps };
|
|
218
|
+
export { Icon, IconGroup, index as default, iconProps, svgIconProps };
|
package/icon/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(i,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(i=typeof globalThis!="undefined"?globalThis:i||self,n(i.index={},i.Vue))})(this,function(i,n){"use strict";const I={name:{type:String,default:"",required:!0},size:{type:[Number,String],default:"inherit"},color:{type:String,default:"inherit"},component:{type:Object,default:null},classPrefix:{type:String,default:"icon"},operable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},rotate:{type:[Number,String]}},b={name:{type:String,default:"",required:!0},color:{type:String,default:"inherit"},size:{type:[Number,String],default:"inherit"}};function m(s,l,o){let t=s;return l&&(t+=`__${l}`),o&&(t+=`--${o}`),t}function d(s,l=!1){const o=l?`.devui-${s}`:`devui-${s}`;return{b:()=>m(o),e:e=>e?m(o,e):"",m:e=>e?m(o,"",e):"",em:(e,a)=>e&&a?m(o,e,a):""}}var V="",h=n.defineComponent({name:"DSvgIcon",props:b,setup(s){const{name:l,color:o,size:t}=n.toRefs(s),c=d("svg-icon"),r=n.computed(()=>`#icon-${l.value}`),u=n.computed(()=>typeof t.value=="number"?`${t.value}px`:t.value),e={width:u.value,height:u.value};return()=>n.createVNode("svg",{class:c.b(),style:e},[n.createVNode("use",{"xlink:href":r.value,fill:o.value},null)])}});function D(s){return/^((http|https):)?\/\//.test(s)}function S(s,l){const{component:o,name:t,size:c,color:r,classPrefix:u,rotate:e}=n.toRefs(s),a=d("icon"),p=n.computed(()=>typeof c.value=="number"?`${c.value}px`:c.value),f=o.value?n.resolveDynamicComponent(o.value):n.resolveDynamicComponent(h),v=()=>n.createVNode("img",n.mergeProps({src:t.value,alt:t.value.split("/")[t.value.split("/").length-1],class:[(e==null?void 0:e.value)==="infinite"&&a.m("spin")],style:{width:p.value||"",transform:`rotate(${e==null?void 0:e.value}deg)`,verticalAlign:"middle"}},l.attrs),null),P=()=>n.createVNode(f,n.mergeProps({name:t.value,color:r.value,size:p.value,class:[(e==null?void 0:e.value)==="infinite"&&a.m("spin")],style:{transform:`rotate(${e==null?void 0:e.value}deg)`}},l.attrs),null),$=()=>{const C=/^icon-/.test(t.value)?t.value:`${u.value}-${t.value}`;return n.createVNode("i",n.mergeProps({class:[u.value,C,(e==null?void 0:e.value)==="infinite"&&a.m("spin")],style:{fontSize:p.value,color:r.value,transform:`rotate(${e==null?void 0:e.value}deg)`}},l.attrs),null)};return{iconDom:()=>o.value?P():D(t.value)?v():$()}}var g=n.defineComponent({name:"DIcon",props:I,emits:["click"],setup(s,l){const{disabled:o,operable:t}=n.toRefs(s),{iconDom:c}=S(s,l),r=d("icon"),u=n.computed(()=>({[r.e("container")]:!0,[r.m("disabled")]:o.value,[r.m("operable")]:t.value})),e=a=>{o.value||l.emit("click",a)};return()=>{var a,p,f,v;return n.createVNode("div",{class:u.value,onClick:e},[(p=(a=l.slots).prefix)==null?void 0:p.call(a),c(),(v=(f=l.slots).suffix)==null?void 0:v.call(f)])}}}),_="",y=n.defineComponent({name:"DIconGroup",setup(s,l){const o=d("icon-group");return()=>{var t,c;return n.createVNode("div",{class:o.b()},[(c=(t=l.slots).default)==null?void 0:c.call(t)])}}}),N={title:"Icon \u56FE\u6807",category:"\u901A\u7528",status:"100%",install(s){s.component(g.name,g),s.component(y.name,y)}};i.Icon=g,i.IconGroup=y,i.default=N,i.iconProps=I,i.svgIconProps=b,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
|
package/icon/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.devui-icon__container{display:inline-block;color:var(--devui-icon-fill, #71757f)}.devui-icon__container>*:not(:last-child){vertical-align:middle;margin-right:8px}.devui-icon__container i{vertical-align:middle;transition:all var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-icon--disabled{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-icon--disabled i{color:var(--devui-disabled-text, #adb0b8)}.devui-icon--operable:not(.devui-icon--disabled){cursor:pointer;transition:color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-icon--operable:not(.devui-icon--disabled) i{cursor:pointer}.devui-icon--operable:hover:not(.devui-icon--disabled){color:var(--devui-icon-fill-hover, #252b3a)}.devui-icon--operable:hover:not(.devui-icon--disabled).devui-icon__container{background-color:var(--devui-icon-background-hover, var(--devui-list-item-hover-bg, #f2f2f3))}.devui-icon--operable:hover:not(.devui-icon--disabled) i{color:var(--devui-icon-fill-hover, #252b3a)}.devui-icon--operable:active:not(.devui-icon--disabled){color:var(--devui-icon-active-color, var(--devui-icon-fill-active, #252b3a))}.devui-icon--operable:active:not(.devui-icon--disabled).devui-icon__container{background-color:var(--devui-icon-background-active, var(--devui-list-item-active-bg, #f2f5fc))}.devui-icon--operable:active:not(.devui-icon--disabled) i{color:var(--devui-icon-active-color, var(--devui-icon-fill-active, #252b3a))}.devui-icon--operable.devui-icon__container{height:32px;line-height:32px;padding:0 8px;margin-left:-8px;border-radius:var(--devui-border-radius, 4px);transition:all var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-icon--spin{animation:iconSpin 2.5s linear infinite}.devui-svg-icon{vertical-align:middle}@keyframes iconSpin{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}.devui-icon-group{display:inline-flex;align-items:center}.devui-icon-group>.devui-icon__container:not(.devui-icon--operable){padding:8px;margin-left:0}.devui-icon-group>.devui-icon__container:not(.devui-icon--operable):first-child{margin-left:-8px}.devui-icon-group>*:not(:first-child){margin-left:0}
|
|
@@ -5,7 +5,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import { defineComponent, ref, computed, onMounted, onUnmounted, createVNode, Fragment, createTextVNode, createApp } from "vue";
|
|
8
|
-
var imagePreview$1 = "";
|
|
9
8
|
const imagePreviewProps = {
|
|
10
9
|
url: {
|
|
11
10
|
type: String,
|
|
@@ -142,11 +141,36 @@ class Transform {
|
|
|
142
141
|
this.el.style.transform = `translate(${this.transformX}px, ${this.transformY}px) scale(${this.zoom}) rotate(${this.rotate}turn)`;
|
|
143
142
|
}
|
|
144
143
|
}
|
|
144
|
+
function createBem(namespace, element, modifier) {
|
|
145
|
+
let cls = namespace;
|
|
146
|
+
if (element) {
|
|
147
|
+
cls += `__${element}`;
|
|
148
|
+
}
|
|
149
|
+
if (modifier) {
|
|
150
|
+
cls += `--${modifier}`;
|
|
151
|
+
}
|
|
152
|
+
return cls;
|
|
153
|
+
}
|
|
154
|
+
function useNamespace(block, needDot = false) {
|
|
155
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
156
|
+
const b = () => createBem(namespace);
|
|
157
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
158
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
159
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
160
|
+
return {
|
|
161
|
+
b,
|
|
162
|
+
e,
|
|
163
|
+
m,
|
|
164
|
+
em
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
var imagePreview$1 = "";
|
|
145
168
|
var imagePreview = defineComponent({
|
|
146
169
|
name: "DImagePreview",
|
|
147
170
|
props: imagePreviewProps,
|
|
148
171
|
emits: [],
|
|
149
172
|
setup(props) {
|
|
173
|
+
const ns = useNamespace("image-preview");
|
|
150
174
|
let transform = null;
|
|
151
175
|
const index2 = ref(0);
|
|
152
176
|
const url = computed(() => props.previewUrlList[index2.value]);
|
|
@@ -157,7 +181,7 @@ var imagePreview = defineComponent({
|
|
|
157
181
|
zIndex: props.backDropZIndex
|
|
158
182
|
} : {};
|
|
159
183
|
function initTransform() {
|
|
160
|
-
const imageElement = document.querySelector("
|
|
184
|
+
const imageElement = document.querySelector(`.${ns.e("main-image")}`);
|
|
161
185
|
transform = new Transform(imageElement);
|
|
162
186
|
}
|
|
163
187
|
function initIndex() {
|
|
@@ -215,13 +239,13 @@ var imagePreview = defineComponent({
|
|
|
215
239
|
});
|
|
216
240
|
return () => {
|
|
217
241
|
return createVNode(Fragment, null, [createVNode("div", {
|
|
218
|
-
"class":
|
|
242
|
+
"class": ns.b(),
|
|
219
243
|
"style": imageStyle
|
|
220
244
|
}, [createVNode("img", {
|
|
221
|
-
"class": "
|
|
245
|
+
"class": ns.e("main-image"),
|
|
222
246
|
"src": url.value
|
|
223
247
|
}, null), createVNode("button", {
|
|
224
|
-
"class": "
|
|
248
|
+
"class": ns.e("close-btn"),
|
|
225
249
|
"onClick": onClose
|
|
226
250
|
}, [createVNode("svg", {
|
|
227
251
|
"width": "16px",
|
|
@@ -238,7 +262,7 @@ var imagePreview = defineComponent({
|
|
|
238
262
|
"fill-rule": "nonzero",
|
|
239
263
|
"points": "8 6.58578644 12.2426407 2.34314575 13.6568542 3.75735931 9.41421356 8 13.6568542 12.2426407 12.2426407 13.6568542 8 9.41421356 3.75735931 13.6568542 2.34314575 12.2426407 6.58578644 8 2.34314575 3.75735931 3.75735931 2.34314575"
|
|
240
264
|
}, null)])])]), createVNode("button", {
|
|
241
|
-
"class": "
|
|
265
|
+
"class": ns.e("arrow-left"),
|
|
242
266
|
"onClick": onPrev
|
|
243
267
|
}, [createVNode("svg", {
|
|
244
268
|
"width": "18px",
|
|
@@ -255,7 +279,7 @@ var imagePreview = defineComponent({
|
|
|
255
279
|
"fill-rule": "nonzero",
|
|
256
280
|
"points": "10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"
|
|
257
281
|
}, null)])])]), createVNode("button", {
|
|
258
|
-
"class": "
|
|
282
|
+
"class": ns.e("arrow-right"),
|
|
259
283
|
"onClick": onNext
|
|
260
284
|
}, [createVNode("svg", {
|
|
261
285
|
"width": "18px",
|
|
@@ -273,7 +297,7 @@ var imagePreview = defineComponent({
|
|
|
273
297
|
"transform": "translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",
|
|
274
298
|
"points": "11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"
|
|
275
299
|
}, null)])])]), createVNode("div", {
|
|
276
|
-
"class": "
|
|
300
|
+
"class": ns.e("toolbar")
|
|
277
301
|
}, [createVNode("button", {
|
|
278
302
|
"onClick": onZoomIn
|
|
279
303
|
}, [createVNode("svg", {
|
|
@@ -338,9 +362,8 @@ var imagePreview = defineComponent({
|
|
|
338
362
|
"fill-rule": "nonzero",
|
|
339
363
|
"points": "10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"
|
|
340
364
|
}, null)])])]), createVNode("span", {
|
|
341
|
-
"class": "
|
|
365
|
+
"class": ns.e("index")
|
|
342
366
|
}, [index2.value + 1, createTextVNode(":"), props.previewUrlList.length]), createVNode("button", {
|
|
343
|
-
"class": "devui-next",
|
|
344
367
|
"onClick": onNext
|
|
345
368
|
}, [createVNode("svg", {
|
|
346
369
|
"width": "16px",
|
|
@@ -375,7 +398,7 @@ var imagePreview = defineComponent({
|
|
|
375
398
|
}, null)])])]), createVNode("button", {
|
|
376
399
|
"onClick": onZoomOriginal
|
|
377
400
|
}, [createVNode("span", null, [createTextVNode("1:1")])])])]), createVNode("div", {
|
|
378
|
-
"class": "
|
|
401
|
+
"class": ns.e("bg"),
|
|
379
402
|
"style": bgStyle
|
|
380
403
|
}, null)]);
|
|
381
404
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var S=Object.defineProperty;var O=(r,e,u)=>e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):r[e]=u;var n=(r,e,u)=>(O(r,typeof e!="symbol"?e+"":e,u),u);(function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r.index={},r.Vue))})(this,function(r,e){"use strict";var u="";const L={url:{type:String,default:"",required:!0},previewUrlList:{type:Array,default:()=>[],required:!0},zIndex:{type:Number,required:!1},backDropZIndex:{type:Number,required:!1}};class b{constructor(o,i={}){n(this,"el");n(this,"oTransformX",0);n(this,"oTransformY",0);n(this,"transformX");n(this,"transformY");n(this,"zoom");n(this,"rotate");n(this,"STEP",.25);n(this,"MIN_SCALE",.2);n(this,"MAX_SCALE",2.5);n(this,"TRANSFORMX",0);n(this,"TRANSFORMY",0);n(this,"ZOOM",1);n(this,"ROTATE",0);this.el=o,this.transformX=i.transformX||this.TRANSFORMX,this.transformY=i.transformY||this.TRANSFORMY,this.zoom=i.zoom||this.ZOOM,this.rotate=i.rotate||this.ROTATE,this.handleDefaultDraggable(),this.onDraggable(),this.onMouseWheel()}handleDefaultDraggable(){document.body.ondragstart=()=>(window.event.returnValue=!1,!1)}onDraggable(){this.el.onmousedown=o=>{const i=o.clientX,s=o.clientY;document.onmousemove=l=>{const c=l.clientX-i,f=l.clientY-s;this.transformX=this.oTransformX+c,this.transformY=this.oTransformY+f,this.el.style.cursor="grabbing",this.setPosition()}},document.onmouseup=()=>{document.onmousemove=null,this.oTransformX=this.transformX,this.oTransformY=this.transformY,this.el.style.cursor="grab"}}onMouseWheel(){const o=this.throttle(this.setMouseWheel,100);this.el.onmousewheel=i=>{const s=-i.wheelDelta||i.deltaY||i.detail;o(s)}}throttle(o,i){let s=null;return(...l)=>{s||setTimeout(()=>{s=null,o.apply(this,l)},i)}}setMouseWheel(o){if(o<0){if(this.zoom>=this.MAX_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-in",this.setZoomIn(this.STEP)}else{if(this.zoom<=this.MIN_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-out",this.setZoomOut(this.STEP)}this.setPosition()}setZoomIn(o=this.STEP){this.zoom=Math.min(this.MAX_SCALE,this.zoom+o),this.setPosition()}setZoomOut(o=this.STEP){this.zoom=Math.max(this.MIN_SCALE,this.zoom-o),this.setPosition()}setZoomBest(){this.reset(),this.setPosition()}setZoomOriginal(){this.reset(),this.setPosition()}setRotate(){this.rotate+=.25,this.setPosition()}reset(){this.transformX=this.TRANSFORMX,this.transformY=this.TRANSFORMY,this.zoom=this.ZOOM}setPosition(){this.el.style.transform=`translate(${this.transformX}px, ${this.transformY}px) scale(${this.zoom}) rotate(${this.rotate}turn)`}}var V=e.defineComponent({name:"DImagePreview",props:L,emits:[],setup(t){let o=null;const i=e.ref(0),s=e.computed(()=>t.previewUrlList[i.value]),l=t.zIndex?{zIndex:t.zIndex}:{},c=t.backDropZIndex?{zIndex:t.backDropZIndex}:{};function f(){const d=document.querySelector(".devui-image-preview-main-image");o=new b(d)}function M(){i.value=t.previewUrlList.findIndex(d=>d===t.url)}function m(){i.value=i.value<=0?t.previewUrlList.length-1:i.value-1}function g(){i.value=i.value>=t.previewUrlList.length-1?0:i.value+1}function C(){a.close()}function z(){o.setZoomIn()}function P(){o.setZoomOut()}function T(){o.setRotate()}function D(){o.setZoomBest()}function A(){o.setZoomOriginal()}function y(d){d.defaultPrevented||(d.code==="Escape"?C():d.code==="ArrowLeft"?m():d.code==="ArrowRight"&&g())}function $(){document.addEventListener("keydown",y,!1)}function E(){document.removeEventListener("keydown",y,!1)}return e.onMounted(()=>{M(),f(),$()}),e.onUnmounted(()=>{E()}),()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{class:"devui-image-preview",style:l},[e.createVNode("img",{class:"devui-image-preview-main-image",src:s.value},null),e.createVNode("button",{class:"devui-image-preview-close-btn",onClick:C},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"8 6.58578644 12.2426407 2.34314575 13.6568542 3.75735931 9.41421356 8 13.6568542 12.2426407 12.2426407 13.6568542 8 9.41421356 3.75735931 13.6568542 2.34314575 12.2426407 6.58578644 8 2.34314575 3.75735931 3.75735931 2.34314575"},null)])])]),e.createVNode("button",{class:"devui-image-preview-arrow-left",onClick:m},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("button",{class:"devui-image-preview-arrow-right",onClick:g},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("div",{class:"devui-image-preview-toolbar"},[e.createVNode("button",{onClick:z},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M6,6 L6,4 L8,4 L8,6 L10,6 L10,8 L8,8 L8,10 L6,10 L6,8 L4,8 L4,6 L6,6 Z M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z"},null)])])])]),e.createVNode("button",{onClick:P},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z M4,6 L10,6 L10,8 L4,8 L4,6 Z"},null)])])])]),e.createVNode("button",{onClick:T},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M7.5,3.02242151 L7.5,4 L4.5,2 L7.5,0 L7.5,1.01640228 C7.66526181,1.00552468 7.83198572,1 8,1 C12.1421356,1 15.5,4.35786438 15.5,8.5 C15.5,12.6421356 12.1421356,16 8,16 C3.85786438,16 0.5,12.6421356 0.5,8.5 C0.5,6.9828355 0.950484514,5.5708873 1.72499011,4.39061882 L3.42173231,5.4510827 C2.83944149,6.32371289 2.5,7.37221604 2.5,8.5 C2.5,11.5375661 4.96243388,14 8,14 C11.0375661,14 13.5,11.5375661 13.5,8.5 C13.5,5.46243388 11.0375661,3 8,3 C7.83145515,3 7.66468102,3.00758131 7.5,3.02242151 Z M8,11 C6.61928813,11 5.5,9.88071187 5.5,8.5 C5.5,7.11928813 6.61928813,6 8,6 C9.38071187,6 10.5,7.11928813 10.5,8.5 C10.5,9.88071187 9.38071187,11 8,11 Z M8,10 C8.82842712,10 9.5,9.32842712 9.5,8.5 C9.5,7.67157288 8.82842712,7 8,7 C7.17157288,7 6.5,7.67157288 6.5,8.5 C6.5,9.32842712 7.17157288,10 8,10 Z",fill:"#293040"},null)])])]),e.createVNode("button",{onClick:m},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("span",{class:"devui-image-preview-index"},[i.value+1,e.createTextVNode(":"),t.previewUrlList.length]),e.createVNode("button",{class:"devui-next",onClick:g},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("button",{onClick:D},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M16,16 L11.429,16 L11.429,15 L14.456,15 L11.006,11.226 L11.652,10.519 L15.086,14.275 L15.086,11 L16,11 L16,16 Z M15.164,1.544 L12.009,4.994 L11.418,4.348 L14.558,0.914 L11.82,0.914 L11.82,0 L16,0 L16,4.571 L15.164,4.571 L15.164,1.544 Z M5,15 L5,16 L0,16 L0,11 L1,11 L1,14.275 L4.756,10.519 L5.463,11.226 L1.689,15 L5,15 Z M4.365,4.994 L0.914,1.544 L0.914,4.571 L3.41060513e-13,4.571 L3.41060513e-13,0 L4.571,0 L4.571,0.914 L1.578,0.914 L5.011,4.348 L4.365,4.994 Z",fill:"#293040","fill-rule":"nonzero"},null)])])]),e.createVNode("button",{onClick:A},[e.createVNode("span",null,[e.createTextVNode("1:1")])])])]),e.createVNode("div",{class:"devui-image-preview-bg",style:c},null)])}});function k(t){return e.createApp(V,t)}class a{static open(o){this.$body=document.body,this.$div=document.createElement("div"),this.$overflow=this.$body.style.overflow,this.$body.appendChild(this.$div),k(o).mount(this.$div),this.$body.style.setProperty("overflow","hidden","important")}static close(){var o;(o=this.$body)==null||o.style.setProperty("overflow",this.$overflow),this.$overflow=null,this.$div&&this.$body.removeChild(this.$div),this.$body=null,this.$div=null}}n(a,"$body",null),n(a,"$div",null),n(a,"$overflow","");function w(t){a.open({url:t.url,previewUrlList:t.previewUrlList,zIndex:t.zIndex,backDropZIndex:t.backDropZIndex})}function v(){a.close()}function p(t){return[...t.querySelectorAll("img")].map(i=>i.getAttribute("src"))}function x(t){var s;t.stopPropagation();const o=t.currentTarget,i=t.target;if(((s=i==null?void 0:i.nodeName)==null?void 0:s.toLowerCase())==="img"){const l=p(o),c=i.getAttribute("src");w({url:c,previewUrlList:l,zIndex:o==null?void 0:o.zIndex,backDropZIndex:o==null?void 0:o.backDropZIndex})}}function h(t){t.addEventListener("click",x)}function I(t){t.removeEventListener("click",x)}var N={mounted(t,o){if(!o.value)return h(t);const{custom:i,disableDefault:s}=o.value;i instanceof Object&&(i.open=()=>{const l=p(t);w({url:l==null?void 0:l[0],previewUrlList:l,zIndex:t==null?void 0:t.zIndex,backDropZIndex:t==null?void 0:t.backDropZIndex})},i.close=()=>v()),!s&&h(t)},unmounted(){v()},updated(t,o){var i,s;if(t.zIndex=(i=o.value)==null?void 0:i.zIndex,t.backDropZIndex=(s=o.value)==null?void 0:s.backDropZIndex,o.value){const{value:{disableDefault:l},oldValue:{disableDefault:c}}=o;l!==c&&(l?I(t):h(t))}}},Z={title:"ImagePreview \u56FE\u7247\u9884\u89C8",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.directive("d-image-preview",N),t.config.globalProperties.$imagePreviewService=a}};r.ImagePreviewDirective=N,r.ImagePreviewService=a,r.default=Z,r.imagePreviewProps=L,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
|
|
1
|
+
var X=Object.defineProperty;var R=(s,e,d)=>e in s?X(s,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[e]=d;var r=(s,e,d)=>(R(s,typeof e!="symbol"?e+"":e,d),d);(function(s,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,e(s.index={},s.Vue))})(this,function(s,e){"use strict";const d={url:{type:String,default:"",required:!0},previewUrlList:{type:Array,default:()=>[],required:!0},zIndex:{type:Number,required:!1},backDropZIndex:{type:Number,required:!1}};class k{constructor(o,n={}){r(this,"el");r(this,"oTransformX",0);r(this,"oTransformY",0);r(this,"transformX");r(this,"transformY");r(this,"zoom");r(this,"rotate");r(this,"STEP",.25);r(this,"MIN_SCALE",.2);r(this,"MAX_SCALE",2.5);r(this,"TRANSFORMX",0);r(this,"TRANSFORMY",0);r(this,"ZOOM",1);r(this,"ROTATE",0);this.el=o,this.transformX=n.transformX||this.TRANSFORMX,this.transformY=n.transformY||this.TRANSFORMY,this.zoom=n.zoom||this.ZOOM,this.rotate=n.rotate||this.ROTATE,this.handleDefaultDraggable(),this.onDraggable(),this.onMouseWheel()}handleDefaultDraggable(){document.body.ondragstart=()=>(window.event.returnValue=!1,!1)}onDraggable(){this.el.onmousedown=o=>{const n=o.clientX,i=o.clientY;document.onmousemove=l=>{const u=l.clientX-n,m=l.clientY-i;this.transformX=this.oTransformX+u,this.transformY=this.oTransformY+m,this.el.style.cursor="grabbing",this.setPosition()}},document.onmouseup=()=>{document.onmousemove=null,this.oTransformX=this.transformX,this.oTransformY=this.transformY,this.el.style.cursor="grab"}}onMouseWheel(){const o=this.throttle(this.setMouseWheel,100);this.el.onmousewheel=n=>{const i=-n.wheelDelta||n.deltaY||n.detail;o(i)}}throttle(o,n){let i=null;return(...l)=>{i||setTimeout(()=>{i=null,o.apply(this,l)},n)}}setMouseWheel(o){if(o<0){if(this.zoom>=this.MAX_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-in",this.setZoomIn(this.STEP)}else{if(this.zoom<=this.MIN_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-out",this.setZoomOut(this.STEP)}this.setPosition()}setZoomIn(o=this.STEP){this.zoom=Math.min(this.MAX_SCALE,this.zoom+o),this.setPosition()}setZoomOut(o=this.STEP){this.zoom=Math.max(this.MIN_SCALE,this.zoom-o),this.setPosition()}setZoomBest(){this.reset(),this.setPosition()}setZoomOriginal(){this.reset(),this.setPosition()}setRotate(){this.rotate+=.25,this.setPosition()}reset(){this.transformX=this.TRANSFORMX,this.transformY=this.TRANSFORMY,this.zoom=this.ZOOM}setPosition(){this.el.style.transform=`translate(${this.transformX}px, ${this.transformY}px) scale(${this.zoom}) rotate(${this.rotate}turn)`}}function f(t,o,n){let i=t;return o&&(i+=`__${o}`),n&&(i+=`--${n}`),i}function I(t,o=!1){const n=o?`.devui-${t}`:`devui-${t}`;return{b:()=>f(n),e:a=>a?f(n,a):"",m:a=>a?f(n,"",a):"",em:(a,L)=>a&&L?f(n,a,L):""}}var Y="",Z=e.defineComponent({name:"DImagePreview",props:d,emits:[],setup(t){const o=I("image-preview");let n=null;const i=e.ref(0),l=e.computed(()=>t.previewUrlList[i.value]),u=t.zIndex?{zIndex:t.zIndex}:{},m=t.backDropZIndex?{zIndex:t.backDropZIndex}:{};function a(){const h=document.querySelector(`.${o.e("main-image")}`);n=new k(h)}function L(){i.value=t.previewUrlList.findIndex(h=>h===t.url)}function w(){i.value=i.value<=0?t.previewUrlList.length-1:i.value-1}function p(){i.value=i.value>=t.previewUrlList.length-1?0:i.value+1}function y(){c.close()}function T(){n.setZoomIn()}function $(){n.setZoomOut()}function D(){n.setRotate()}function A(){n.setZoomBest()}function E(){n.setZoomOriginal()}function V(h){h.defaultPrevented||(h.code==="Escape"?y():h.code==="ArrowLeft"?w():h.code==="ArrowRight"&&p())}function S(){document.addEventListener("keydown",V,!1)}function O(){document.removeEventListener("keydown",V,!1)}return e.onMounted(()=>{L(),a(),S()}),e.onUnmounted(()=>{O()}),()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{class:o.b(),style:u},[e.createVNode("img",{class:o.e("main-image"),src:l.value},null),e.createVNode("button",{class:o.e("close-btn"),onClick:y},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"8 6.58578644 12.2426407 2.34314575 13.6568542 3.75735931 9.41421356 8 13.6568542 12.2426407 12.2426407 13.6568542 8 9.41421356 3.75735931 13.6568542 2.34314575 12.2426407 6.58578644 8 2.34314575 3.75735931 3.75735931 2.34314575"},null)])])]),e.createVNode("button",{class:o.e("arrow-left"),onClick:w},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("button",{class:o.e("arrow-right"),onClick:p},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("div",{class:o.e("toolbar")},[e.createVNode("button",{onClick:T},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M6,6 L6,4 L8,4 L8,6 L10,6 L10,8 L8,8 L8,10 L6,10 L6,8 L4,8 L4,6 L6,6 Z M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z"},null)])])])]),e.createVNode("button",{onClick:$},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z M4,6 L10,6 L10,8 L4,8 L4,6 Z"},null)])])])]),e.createVNode("button",{onClick:D},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M7.5,3.02242151 L7.5,4 L4.5,2 L7.5,0 L7.5,1.01640228 C7.66526181,1.00552468 7.83198572,1 8,1 C12.1421356,1 15.5,4.35786438 15.5,8.5 C15.5,12.6421356 12.1421356,16 8,16 C3.85786438,16 0.5,12.6421356 0.5,8.5 C0.5,6.9828355 0.950484514,5.5708873 1.72499011,4.39061882 L3.42173231,5.4510827 C2.83944149,6.32371289 2.5,7.37221604 2.5,8.5 C2.5,11.5375661 4.96243388,14 8,14 C11.0375661,14 13.5,11.5375661 13.5,8.5 C13.5,5.46243388 11.0375661,3 8,3 C7.83145515,3 7.66468102,3.00758131 7.5,3.02242151 Z M8,11 C6.61928813,11 5.5,9.88071187 5.5,8.5 C5.5,7.11928813 6.61928813,6 8,6 C9.38071187,6 10.5,7.11928813 10.5,8.5 C10.5,9.88071187 9.38071187,11 8,11 Z M8,10 C8.82842712,10 9.5,9.32842712 9.5,8.5 C9.5,7.67157288 8.82842712,7 8,7 C7.17157288,7 6.5,7.67157288 6.5,8.5 C6.5,9.32842712 7.17157288,10 8,10 Z",fill:"#293040"},null)])])]),e.createVNode("button",{onClick:w},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("span",{class:o.e("index")},[i.value+1,e.createTextVNode(":"),t.previewUrlList.length]),e.createVNode("button",{onClick:p},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("button",{onClick:A},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M16,16 L11.429,16 L11.429,15 L14.456,15 L11.006,11.226 L11.652,10.519 L15.086,14.275 L15.086,11 L16,11 L16,16 Z M15.164,1.544 L12.009,4.994 L11.418,4.348 L14.558,0.914 L11.82,0.914 L11.82,0 L16,0 L16,4.571 L15.164,4.571 L15.164,1.544 Z M5,15 L5,16 L0,16 L0,11 L1,11 L1,14.275 L4.756,10.519 L5.463,11.226 L1.689,15 L5,15 Z M4.365,4.994 L0.914,1.544 L0.914,4.571 L3.41060513e-13,4.571 L3.41060513e-13,0 L4.571,0 L4.571,0.914 L1.578,0.914 L5.011,4.348 L4.365,4.994 Z",fill:"#293040","fill-rule":"nonzero"},null)])])]),e.createVNode("button",{onClick:E},[e.createVNode("span",null,[e.createTextVNode("1:1")])])])]),e.createVNode("div",{class:o.e("bg"),style:m},null)])}});function M(t){return e.createApp(Z,t)}class c{static open(o){this.$body=document.body,this.$div=document.createElement("div"),this.$overflow=this.$body.style.overflow,this.$body.appendChild(this.$div),M(o).mount(this.$div),this.$body.style.setProperty("overflow","hidden","important")}static close(){var o;(o=this.$body)==null||o.style.setProperty("overflow",this.$overflow),this.$overflow=null,this.$div&&this.$body.removeChild(this.$div),this.$body=null,this.$div=null}}r(c,"$body",null),r(c,"$div",null),r(c,"$overflow","");function x(t){c.open({url:t.url,previewUrlList:t.previewUrlList,zIndex:t.zIndex,backDropZIndex:t.backDropZIndex})}function N(){c.close()}function C(t){return[...t.querySelectorAll("img")].map(n=>n.getAttribute("src"))}function v(t){var i;t.stopPropagation();const o=t.currentTarget,n=t.target;if(((i=n==null?void 0:n.nodeName)==null?void 0:i.toLowerCase())==="img"){const l=C(o),u=n.getAttribute("src");x({url:u,previewUrlList:l,zIndex:o==null?void 0:o.zIndex,backDropZIndex:o==null?void 0:o.backDropZIndex})}}function g(t){t.addEventListener("click",v)}function z(t){t.removeEventListener("click",v)}var b={mounted(t,o){if(!o.value)return g(t);const{custom:n,disableDefault:i}=o.value;n instanceof Object&&(n.open=()=>{const l=C(t);x({url:l==null?void 0:l[0],previewUrlList:l,zIndex:t==null?void 0:t.zIndex,backDropZIndex:t==null?void 0:t.backDropZIndex})},n.close=()=>N()),!i&&g(t)},unmounted(){N()},updated(t,o){var n,i;if(t.zIndex=(n=o.value)==null?void 0:n.zIndex,t.backDropZIndex=(i=o.value)==null?void 0:i.backDropZIndex,o.value){const{value:{disableDefault:l},oldValue:{disableDefault:u}}=o;l!==u&&(l?z(t):g(t))}}},P={title:"ImagePreview \u56FE\u7247\u9884\u89C8",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.directive("d-image-preview",b),t.config.globalProperties.$imagePreviewService=c}};s.ImagePreviewDirective=b,s.ImagePreviewService=c,s.default=P,s.imagePreviewProps=d,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
|
package/image-preview/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-image-preview{position:fixed;left:0;top:0;right:0;bottom:0;z-index:calc(var(--devui-z-index-modal, 1050));display:flex;align-items:center;justify-content:center;overflow:hidden}.devui-image-preview svg,.devui-image-preview polygon,.devui-image-preview g,.devui-image-preview path{fill:var(--devui-icon-text, #
|
|
1
|
+
.devui-image-preview{position:fixed;left:0;top:0;right:0;bottom:0;z-index:calc(var(--devui-z-index-modal, 1050));display:flex;align-items:center;justify-content:center;overflow:hidden}.devui-image-preview svg,.devui-image-preview polygon,.devui-image-preview g,.devui-image-preview path{fill:var(--devui-icon-text, #71757f)}.devui-image-preview__main-image{width:auto;height:auto;max-width:90%;max-height:90%;margin-top:-20px;cursor:grab}.devui-image-preview__close-btn{position:fixed;z-index:var(--devui-z-index-modal, 1050);cursor:pointer;width:36px;height:36px;border-radius:50%;border:none;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1));display:inline-flex;align-items:center;justify-content:center;top:15px;right:20px}.devui-image-preview__close-btn:hover{background:var(--devui-area, #f8f8f8)}.devui-image-preview__close-btn svg{width:38px;height:18px}.devui-image-preview__arrow-left{position:fixed;z-index:var(--devui-z-index-modal, 1050);cursor:pointer;width:36px;height:36px;border-radius:50%;border:none;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1));display:inline-flex;align-items:center;justify-content:center;top:50%;left:20px;transform:translateY(-50%)}.devui-image-preview__arrow-left:hover{background:var(--devui-area, #f8f8f8)}.devui-image-preview__arrow-left svg{width:38px;height:18px}.devui-image-preview__arrow-right{position:fixed;z-index:var(--devui-z-index-modal, 1050);cursor:pointer;width:36px;height:36px;border-radius:50%;border:none;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1));display:inline-flex;align-items:center;justify-content:center;top:50%;right:20px;transform:translateY(-50%)}.devui-image-preview__arrow-right:hover{background:var(--devui-area, #f8f8f8)}.devui-image-preview__arrow-right svg{width:38px;height:18px}.devui-image-preview__toolbar{position:fixed;bottom:0;left:0;width:100%;height:50px;display:flex;align-items:center;justify-content:center;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-fullscreen-overlay, 0 12px 24px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1))}.devui-image-preview__toolbar button{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;color:var(--devui-text, #252b3a);border:none;background-color:transparent;cursor:pointer;outline:0;padding:0}.devui-image-preview__toolbar .devui-image-preview__index{display:inline-flex;width:100px;justify-content:center;align-items:center;cursor:pointer}.devui-image-preview__toolbar>:not(:first-child){margin-left:20px}.devui-image-preview__bg{position:fixed;left:0;top:0;right:0;bottom:0;z-index:calc(var(--devui-z-index-modal, 1050) - 1);background:var(--devui-shadow, rgba(37, 43, 58, .2))}
|