vue-devui 1.0.0-pre.0 → 1.0.0-rc.10
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 +149 -187
- package/alert/index.es.js +74 -45
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8182 -296
- package/auto-complete/index.umd.js +29 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +153 -146
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +30 -5
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5741 -127
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +59 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8060 -255
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{accordion → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +379 -0
- package/collapse/index.umd.js +1 -0
- package/{anchor → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +5 -7
- package/countdown/index.umd.js +1 -1
- package/date-picker/index.es.js +8159 -288
- package/date-picker/index.umd.js +27 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +31 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +297 -181
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +525 -154
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +1039 -1175
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +42 -21
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +101 -86
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +197 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +55 -31
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8066 -144
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +269 -183
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +40 -25
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +74 -35
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +412 -204
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +307 -57
- 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/CheckboxGroup.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.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/LoadingOptions.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/overlay/index.es.js +127 -149
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +10 -44
- package/pagination/index.es.js +158 -148
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +317 -246
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +110 -56
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7964 -157
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +77 -55
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +184 -57
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +47 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +3644 -1122
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9144 -597
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +63 -41
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +109 -75
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +469 -349
- package/splitter/index.umd.js +15 -15
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +7 -18
- package/statistic/index.umd.js +1 -1
- package/status/index.es.js +27 -6
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +7794 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10119 -1206
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +342 -141
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +49 -24
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7913 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/{anchor → timeline}/index.d.ts +0 -0
- package/timeline/index.es.js +425 -0
- package/timeline/index.umd.js +1 -0
- package/{back-top → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +308 -236
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +4189 -1851
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +380 -123
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +18121 -23161
- package/vue-devui.umd.js +25 -15
- package/accordion/index.es.js +0 -720
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/back-top/index.d.ts +0 -7
- package/back-top/index.es.js +0 -128
- package/back-top/index.umd.js +0 -1
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/package.json +0 -7
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -329
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5963
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.es.js +0 -8187
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -86
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -331
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/TagInput.js +0 -3
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -258
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -239
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/tag-input/index.d.ts +0 -7
- package/tag-input/index.es.js +0 -329
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/time-axis/index.d.ts +0 -7
- package/time-axis/index.es.js +0 -299
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1237
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7608
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -623
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
package/skeleton/index.es.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineComponent, createVNode, Fragment, withDirectives, vShow, mergeProps } from "vue";
|
|
2
|
-
var skeleton = "";
|
|
3
2
|
const skeletonProps = {
|
|
4
3
|
row: {
|
|
5
4
|
type: Number,
|
|
@@ -46,6 +45,30 @@ const skeletonProps = {
|
|
|
46
45
|
default: ["100%"]
|
|
47
46
|
}
|
|
48
47
|
};
|
|
48
|
+
function createBem(namespace, element, modifier) {
|
|
49
|
+
let cls = namespace;
|
|
50
|
+
if (element) {
|
|
51
|
+
cls += `__${element}`;
|
|
52
|
+
}
|
|
53
|
+
if (modifier) {
|
|
54
|
+
cls += `--${modifier}`;
|
|
55
|
+
}
|
|
56
|
+
return cls;
|
|
57
|
+
}
|
|
58
|
+
function useNamespace(block, needDot = false) {
|
|
59
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
60
|
+
const b = () => createBem(namespace);
|
|
61
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
62
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
63
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
64
|
+
return {
|
|
65
|
+
b,
|
|
66
|
+
e,
|
|
67
|
+
m,
|
|
68
|
+
em
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
var skeleton = "";
|
|
49
72
|
var Skeleton = defineComponent({
|
|
50
73
|
name: "DSkeleton",
|
|
51
74
|
props: skeletonProps,
|
|
@@ -53,8 +76,9 @@ var Skeleton = defineComponent({
|
|
|
53
76
|
const {
|
|
54
77
|
slots
|
|
55
78
|
} = ctx;
|
|
79
|
+
const ns = useNamespace("skeleton");
|
|
56
80
|
function renderAnimate(isAnimated) {
|
|
57
|
-
return isAnimated ? "
|
|
81
|
+
return isAnimated ? ns.e("animated") : "";
|
|
58
82
|
}
|
|
59
83
|
function renderBorderRadius(isRound) {
|
|
60
84
|
return isRound ? "border-radius: 1em;" : "";
|
|
@@ -101,52 +125,52 @@ var Skeleton = defineComponent({
|
|
|
101
125
|
}
|
|
102
126
|
})();
|
|
103
127
|
return withDirectives(createVNode("div", {
|
|
104
|
-
"class": "
|
|
105
|
-
}, [arr.map((
|
|
128
|
+
"class": ns.e("paragraph")
|
|
129
|
+
}, [arr.map((item) => {
|
|
106
130
|
return createVNode("div", {
|
|
107
|
-
"class": "
|
|
108
|
-
"style": round ? "border-radius: 1em;" : `width: ${
|
|
131
|
+
"class": ns.e("item"),
|
|
132
|
+
"style": round ? "border-radius: 1em;" : `width: ${item.width}`
|
|
109
133
|
}, null);
|
|
110
134
|
})]), [[vShow, isShown]]);
|
|
111
135
|
}
|
|
112
136
|
function renderAvatarStyle(avatarSize, avatarShape) {
|
|
113
|
-
function renderAvatarShape(
|
|
114
|
-
return
|
|
137
|
+
function renderAvatarShape() {
|
|
138
|
+
return avatarShape === "square" ? "" : "border-radius:50%;";
|
|
115
139
|
}
|
|
116
|
-
function renderAvatarSize(
|
|
117
|
-
switch (typeof
|
|
140
|
+
function renderAvatarSize() {
|
|
141
|
+
switch (typeof avatarSize) {
|
|
118
142
|
case "string":
|
|
119
|
-
return `width:${
|
|
143
|
+
return `width:${avatarSize};height:${avatarSize};`;
|
|
120
144
|
case "number":
|
|
121
|
-
return `width:${
|
|
145
|
+
return `width:${avatarSize}px;height:${avatarSize}px;`;
|
|
122
146
|
}
|
|
123
147
|
}
|
|
124
|
-
return renderAvatarSize(
|
|
148
|
+
return renderAvatarSize() + renderAvatarShape();
|
|
125
149
|
}
|
|
126
150
|
function renderTitle(isVisible, titleWidth, isRound) {
|
|
127
|
-
function renderTitleWidth(
|
|
128
|
-
switch (typeof
|
|
151
|
+
function renderTitleWidth() {
|
|
152
|
+
switch (typeof titleWidth) {
|
|
129
153
|
case "string":
|
|
130
|
-
return `width: ${
|
|
154
|
+
return `width: ${titleWidth};`;
|
|
131
155
|
case "number":
|
|
132
|
-
return `width: ${
|
|
156
|
+
return `width: ${titleWidth}px;`;
|
|
133
157
|
}
|
|
134
158
|
}
|
|
135
|
-
function renderTitleVisibility(
|
|
136
|
-
return
|
|
159
|
+
function renderTitleVisibility() {
|
|
160
|
+
return isVisible ? null : "visibility: hidden;";
|
|
137
161
|
}
|
|
138
|
-
return renderTitleWidth(
|
|
162
|
+
return renderTitleWidth() + renderBorderRadius(isRound) + renderTitleVisibility();
|
|
139
163
|
}
|
|
140
164
|
function renderDefaultSkeleton() {
|
|
141
165
|
return createVNode(Fragment, null, [withDirectives(createVNode("div", {
|
|
142
|
-
"class": "
|
|
166
|
+
"class": ns.e("avatar")
|
|
143
167
|
}, [createVNode("div", {
|
|
144
168
|
"class": "avatar",
|
|
145
169
|
"style": renderAvatarStyle(props.avatarSize, props.avatarShape)
|
|
146
170
|
}, null)]), [[vShow, props.avatar]]), createVNode("div", {
|
|
147
|
-
"class": "
|
|
171
|
+
"class": ns.e("group")
|
|
148
172
|
}, [createVNode("div", {
|
|
149
|
-
"class": "
|
|
173
|
+
"class": ns.e("title"),
|
|
150
174
|
"style": renderTitle(props.title, props.titleWidth, props.round)
|
|
151
175
|
}, null), renderParagraph(props.paragraph, props.row, props.rowWidth, props.round)])]);
|
|
152
176
|
}
|
|
@@ -154,14 +178,13 @@ var Skeleton = defineComponent({
|
|
|
154
178
|
var _a;
|
|
155
179
|
if (props.loading) {
|
|
156
180
|
return createVNode("div", {
|
|
157
|
-
"class":
|
|
181
|
+
"class": [ns.b(), renderAnimate(props.animate)]
|
|
158
182
|
}, [renderDefaultSkeleton()]);
|
|
159
183
|
}
|
|
160
184
|
return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
161
185
|
};
|
|
162
186
|
}
|
|
163
187
|
});
|
|
164
|
-
var item = "";
|
|
165
188
|
const itemProps = {
|
|
166
189
|
row: {
|
|
167
190
|
type: Number,
|
|
@@ -195,6 +218,7 @@ const itemProps = {
|
|
|
195
218
|
type: String
|
|
196
219
|
}
|
|
197
220
|
};
|
|
221
|
+
var skeletonItem = "";
|
|
198
222
|
var SkeletonItem = defineComponent({
|
|
199
223
|
name: "DSkeletonItem",
|
|
200
224
|
props: itemProps,
|
|
@@ -202,8 +226,9 @@ var SkeletonItem = defineComponent({
|
|
|
202
226
|
const {
|
|
203
227
|
slots
|
|
204
228
|
} = ctx;
|
|
229
|
+
const ns = useNamespace("skeleton");
|
|
205
230
|
function renderAnimate(isAnimated) {
|
|
206
|
-
return isAnimated ? "
|
|
231
|
+
return isAnimated ? ns.e("animated") : "";
|
|
207
232
|
}
|
|
208
233
|
function renderShapeParagraph(rowNum, rowWidth, round) {
|
|
209
234
|
const arr = [];
|
|
@@ -247,19 +272,19 @@ var SkeletonItem = defineComponent({
|
|
|
247
272
|
}
|
|
248
273
|
})();
|
|
249
274
|
return createVNode("div", mergeProps({
|
|
250
|
-
"class":
|
|
251
|
-
}, ctx.attrs), [arr.map((
|
|
275
|
+
"class": [ns.em("shape", "paragraph"), renderAnimate(props.animate)]
|
|
276
|
+
}, ctx.attrs), [arr.map((item) => {
|
|
252
277
|
return createVNode("div", {
|
|
253
|
-
"class": "
|
|
254
|
-
"style": round ? "border-radius: 1em;" : `width: ${
|
|
278
|
+
"class": ns.em("shape", "paragraph-item"),
|
|
279
|
+
"style": round ? "border-radius: 1em;" : `width: ${item.width}`
|
|
255
280
|
}, null);
|
|
256
281
|
})]);
|
|
257
282
|
}
|
|
258
283
|
function renderAvatarStyle(avatarShape) {
|
|
259
|
-
function renderAvatarShape(
|
|
260
|
-
return
|
|
284
|
+
function renderAvatarShape() {
|
|
285
|
+
return avatarShape === "square" ? "" : "border-radius:50%;";
|
|
261
286
|
}
|
|
262
|
-
return renderAvatarShape(
|
|
287
|
+
return renderAvatarShape();
|
|
263
288
|
}
|
|
264
289
|
return () => {
|
|
265
290
|
var _a;
|
|
@@ -267,14 +292,14 @@ var SkeletonItem = defineComponent({
|
|
|
267
292
|
switch (props.shape) {
|
|
268
293
|
case "avatar":
|
|
269
294
|
return createVNode(Fragment, null, [createVNode("div", mergeProps({
|
|
270
|
-
"class":
|
|
295
|
+
"class": [ns.em("shape", "avatar"), renderAnimate(props.animate)],
|
|
271
296
|
"style": renderAvatarStyle(props.avatarShape)
|
|
272
297
|
}, ctx.attrs), null)]);
|
|
273
298
|
case "paragraph":
|
|
274
299
|
return createVNode(Fragment, null, [renderShapeParagraph(props.row, props.rowWidth, props.round)]);
|
|
275
300
|
default:
|
|
276
301
|
return createVNode(Fragment, null, [createVNode("div", mergeProps({
|
|
277
|
-
"class":
|
|
302
|
+
"class": [ns.em("shape", props.shape), renderAnimate(props.animate)]
|
|
278
303
|
}, ctx.attrs), null)]);
|
|
279
304
|
}
|
|
280
305
|
}
|
|
@@ -282,16 +307,13 @@ var SkeletonItem = defineComponent({
|
|
|
282
307
|
};
|
|
283
308
|
}
|
|
284
309
|
});
|
|
285
|
-
Skeleton.install = function(app) {
|
|
286
|
-
app.component(Skeleton.name, Skeleton);
|
|
287
|
-
app.component(SkeletonItem.name, SkeletonItem);
|
|
288
|
-
};
|
|
289
310
|
var index = {
|
|
290
311
|
title: "Skeleton \u9AA8\u67B6\u5C4F",
|
|
291
312
|
category: "\u6570\u636E\u5C55\u793A",
|
|
292
313
|
status: "100%",
|
|
293
314
|
install(app) {
|
|
294
|
-
app.
|
|
315
|
+
app.component(Skeleton.name, Skeleton);
|
|
316
|
+
app.component(SkeletonItem.name, SkeletonItem);
|
|
295
317
|
}
|
|
296
318
|
};
|
|
297
|
-
export { Skeleton, SkeletonItem, index as default };
|
|
319
|
+
export { Skeleton, SkeletonItem, index as default, skeletonProps };
|
package/skeleton/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(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 k={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatar:{type:Boolean,default:!1},title:{type:Boolean,default:!0},paragraph:{type:Boolean,default:!0},avatarSize:{type:[String,Number],default:"40px"},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]}};function p(t,o,u){let r=t;return o&&(r+=`__${o}`),u&&(r+=`--${u}`),r}function V(t,o=!1){const u=o?`.devui-${t}`:`devui-${t}`;return{b:()=>p(u),e:n=>n?p(u,n):"",m:n=>n?p(u,"",n):"",em:(n,d)=>n&&d?p(u,n,d):""}}var x="",S=e.defineComponent({name:"DSkeleton",props:k,setup(t,o){const{slots:u}=o,r=V("skeleton");function m(a){return a?r.e("animated"):""}function y(a){return a?"border-radius: 1em;":""}function g(a,c,i,l){const h=[];function A(b){for(let f=0;f<c;f++)h.push({width:b})}return function(){if(i instanceof Array)for(let f=0;f<c;f++)if(i[f])switch(typeof i[f]){case"string":h.push({width:i[f]});break;case"number":h.push({width:`${i[f]}px`})}else h.push({width:1});else switch(typeof i){case"string":A(i);break;case"number":A(`${i}px`);break}}(),e.withDirectives(e.createVNode("div",{class:r.e("paragraph")},[h.map(b=>e.createVNode("div",{class:r.e("item"),style:l?"border-radius: 1em;":`width: ${b.width}`},null))]),[[e.vShow,a]])}function n(a,c){function i(){return c==="square"?"":"border-radius:50%;"}function l(){switch(typeof a){case"string":return`width:${a};height:${a};`;case"number":return`width:${a}px;height:${a}px;`}}return l()+i()}function d(a,c,i){function l(){switch(typeof c){case"string":return`width: ${c};`;case"number":return`width: ${c}px;`}}function h(){return a?null:"visibility: hidden;"}return l()+y(i)+h()}function w(){return e.createVNode(e.Fragment,null,[e.withDirectives(e.createVNode("div",{class:r.e("avatar")},[e.createVNode("div",{class:"avatar",style:n(t.avatarSize,t.avatarShape)},null)]),[[e.vShow,t.avatar]]),e.createVNode("div",{class:r.e("group")},[e.createVNode("div",{class:r.e("title"),style:d(t.title,t.titleWidth,t.round)},null),g(t.paragraph,t.row,t.rowWidth,t.round)])])}return()=>{var a;return t.loading?e.createVNode("div",{class:[r.b(),m(t.animate)]},[w()]):e.createVNode(e.Fragment,null,[(a=u.default)==null?void 0:a.call(u)])}}});const $={row:{type:Number,default:0},animate:{type:Boolean,default:!0},round:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},avatarShape:{type:String,default:"round"},titleWidth:{type:[String,Number],default:"40%"},rowWidth:{type:[Number,String,Array],default:["100%"]},shape:{type:String}};var P="",N=e.defineComponent({name:"DSkeletonItem",props:$,setup(t,o){const{slots:u}=o,r=V("skeleton");function m(n){return n?r.e("animated"):""}function y(n,d,w){const a=[];function c(i){for(let l=0;l<n;l++)a.push({width:i})}return function(){if(d instanceof Array)for(let l=0;l<n;l++)if(d[l])switch(typeof d[l]){case"string":a.push({width:d[l]});break;case"number":a.push({width:`${d[l]}px`})}else a.push({width:1});else switch(typeof d){case"string":c(d);break;case"number":c(`${d}px`);break}}(),e.createVNode("div",e.mergeProps({class:[r.em("shape","paragraph"),m(t.animate)]},o.attrs),[a.map(i=>e.createVNode("div",{class:r.em("shape","paragraph-item"),style:w?"border-radius: 1em;":`width: ${i.width}`},null))])}function g(n){function d(){return n==="square"?"":"border-radius:50%;"}return d()}return()=>{var n;if(t.loading&&t.shape)switch(t.shape){case"avatar":return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:[r.em("shape","avatar"),m(t.animate)],style:g(t.avatarShape)},o.attrs),null)]);case"paragraph":return e.createVNode(e.Fragment,null,[y(t.row,t.rowWidth,t.round)]);default:return e.createVNode(e.Fragment,null,[e.createVNode("div",e.mergeProps({class:[r.em("shape",t.shape),m(t.animate)]},o.attrs),null)])}return e.createVNode(e.Fragment,null,[(n=u.default)==null?void 0:n.call(u)])}}}),B={title:"Skeleton \u9AA8\u67B6\u5C4F",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.component(S.name,S),t.component(N.name,N)}};s.Skeleton=S,s.SkeletonItem=N,s.default=B,s.skeletonProps=k,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
|
package/skeleton/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-skeleton{display:flex;justify-content:space-between}.devui-skeleton__avatar{display:flex;flex:1;justify-content:center;padding-right:16px}.devui-skeleton__avatar .avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__group{flex:11}.devui-skeleton__item,.devui-skeleton__title{width:100%;height:16px;background-color:#f2f2f2}.devui-skeleton__title{margin-top:24px}.devui-skeleton__paragraph{margin-top:12px}.devui-skeleton__item:last-child{width:60%}.devui-skeleton__avatar>.avatar,.devui-skeleton__group>div>.devui-skeleton__item{margin-top:12px}.devui-skeleton__animated>.devui-skeleton__group>.devui-skeleton__title,.devui-skeleton__animated>.devui-skeleton__group>div>.devui-skeleton__item,.devui-skeleton__animated>.devui-skeleton__avatar>.avatar{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}.devui-
|
|
1
|
+
.devui-skeleton{display:flex;justify-content:space-between}.devui-skeleton__avatar{display:flex;flex:1;justify-content:center;padding-right:16px}.devui-skeleton__avatar .avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__group{flex:11}.devui-skeleton__item,.devui-skeleton__title{width:100%;height:16px;background-color:#f2f2f2}.devui-skeleton__title{margin-top:24px}.devui-skeleton__paragraph{margin-top:12px}.devui-skeleton__item:last-child{width:60%}.devui-skeleton__avatar>.avatar,.devui-skeleton__group>div>.devui-skeleton__item{margin-top:12px}.devui-skeleton__animated>.devui-skeleton__group>.devui-skeleton__title,.devui-skeleton__animated>.devui-skeleton__group>div>.devui-skeleton__item,.devui-skeleton__animated>.devui-skeleton__avatar>.avatar{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}.devui-skeleton__shape--avatar,.devui-skeleton__shape--image,.devui-skeleton__shape--title,.devui-skeleton__shape--button{background-color:#f2f2f2}.devui-skeleton__shape--avatar{width:40px;height:40px;background-color:#f2f2f2}.devui-skeleton__shape--image{width:200px;height:150px;border-radius:4px}.devui-skeleton__shape--title{width:40%;height:24px}.devui-skeleton__shape--paragraph__item{background-color:#f2f2f2;width:100%;height:16px;margin-bottom:10px}.devui-skeleton__shape--paragraph__item:last-child{width:60%}.devui-skeleton__shape--button{width:115px;height:32px}@keyframes skeletonLoading{to{background-position-x:-20%}}.devui-skeleton__animated .devui-skeleton__shape--avatar,.devui-skeleton__animated.devui-skeleton__shape--avatar,.devui-skeleton__animated.devui-skeleton__shape--image,.devui-skeleton__animated.devui-skeleton__shape--title,.devui-skeleton__animated.devui-skeleton__shape--paragraph>.devui-skeleton__shape--paragraph-item,.devui-skeleton__animated.devui-skeleton__shape--button{background:linear-gradient(100deg,rgba(255,255,255,0) 40%,rgba(255,255,255,.5) 50%,rgba(255,255,255,0) 60%) #f2f2f2;background-size:200% 100%;background-position-x:180%;animation:2s skeletonLoading ease-in-out infinite}
|
package/slider/index.es.js
CHANGED
|
@@ -27,8 +27,35 @@ const sliderProps = {
|
|
|
27
27
|
tipsRenderer: {
|
|
28
28
|
type: String,
|
|
29
29
|
default: ""
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ""
|
|
30
34
|
}
|
|
31
35
|
};
|
|
36
|
+
function createBem(namespace, element, modifier) {
|
|
37
|
+
let cls = namespace;
|
|
38
|
+
if (element) {
|
|
39
|
+
cls += `__${element}`;
|
|
40
|
+
}
|
|
41
|
+
if (modifier) {
|
|
42
|
+
cls += `--${modifier}`;
|
|
43
|
+
}
|
|
44
|
+
return cls;
|
|
45
|
+
}
|
|
46
|
+
function useNamespace(block, needDot = false) {
|
|
47
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
48
|
+
const b = () => createBem(namespace);
|
|
49
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
50
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
51
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
52
|
+
return {
|
|
53
|
+
b,
|
|
54
|
+
e,
|
|
55
|
+
m,
|
|
56
|
+
em
|
|
57
|
+
};
|
|
58
|
+
}
|
|
32
59
|
var slider = "";
|
|
33
60
|
var Slider = defineComponent({
|
|
34
61
|
name: "DSlider",
|
|
@@ -38,39 +65,49 @@ var Slider = defineComponent({
|
|
|
38
65
|
let isClick = true;
|
|
39
66
|
let startPosition = 0;
|
|
40
67
|
let startX = 0;
|
|
68
|
+
const ns = useNamespace("slider");
|
|
41
69
|
const popoverShow = ref(false);
|
|
42
70
|
const sliderRunway = ref(null);
|
|
43
71
|
const inputValue = ref(props.modelValue);
|
|
44
72
|
const currentPosition = ref(0);
|
|
45
73
|
const newPostion = ref(0);
|
|
46
74
|
const percentDispaly = ref("");
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
function handleOnInput(event) {
|
|
76
|
+
inputValue.value = parseInt(event.target.value);
|
|
77
|
+
if (!inputValue.value) {
|
|
78
|
+
inputValue.value = props.min;
|
|
79
|
+
percentDispaly.value = "0%";
|
|
80
|
+
} else {
|
|
81
|
+
if (inputValue.value < props.min || inputValue.value > props.max) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const re = /^(?:[1-9]?\d|100)$/;
|
|
85
|
+
if (re.test(`${inputValue.value}`)) {
|
|
86
|
+
percentDispaly.value = (inputValue.value - props.min) * 100 / (props.max - props.min) + "%";
|
|
87
|
+
ctx.emit("update:modelValue", inputValue.value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
61
90
|
}
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
91
|
+
function setPostion(newPosition) {
|
|
92
|
+
const clientWidth = !!sliderRunway.value ? sliderRunway.value.clientWidth : 0;
|
|
93
|
+
const sliderWidth = Math.round(clientWidth);
|
|
94
|
+
if (newPosition < 0) {
|
|
95
|
+
newPosition = 0;
|
|
96
|
+
}
|
|
97
|
+
const LengthPerStep = sliderWidth / ((props.max - props.min) / props.step);
|
|
98
|
+
const steps = Math.round(newPosition / LengthPerStep);
|
|
99
|
+
const value = steps * LengthPerStep;
|
|
100
|
+
if (Math.round(value) >= sliderWidth) {
|
|
101
|
+
currentPosition.value = sliderWidth;
|
|
102
|
+
inputValue.value = props.max;
|
|
103
|
+
percentDispaly.value = "100%";
|
|
104
|
+
ctx.emit("update:modelValue", props.max);
|
|
69
105
|
return;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
106
|
+
}
|
|
107
|
+
percentDispaly.value = Math.round(value * 100 / sliderWidth) + "%";
|
|
108
|
+
inputValue.value = Math.round(value * (props.max - props.min) / sliderWidth) + props.min;
|
|
109
|
+
currentPosition.value = newPosition;
|
|
110
|
+
ctx.emit("update:modelValue", inputValue.value);
|
|
74
111
|
}
|
|
75
112
|
function dragStart(event) {
|
|
76
113
|
isClick = false;
|
|
@@ -93,29 +130,40 @@ var Slider = defineComponent({
|
|
|
93
130
|
window.removeEventListener("mousemove", onDragging);
|
|
94
131
|
window.removeEventListener("mouseup", onDragEnd);
|
|
95
132
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
133
|
+
const renderShowInput = () => {
|
|
134
|
+
return props.showInput ? createVNode("div", {
|
|
135
|
+
"class": ns.e("input-wrap")
|
|
136
|
+
}, [createVNode("input", {
|
|
137
|
+
"onInput": handleOnInput,
|
|
138
|
+
"value": inputValue.value + "",
|
|
139
|
+
"disabled": props.disabled
|
|
140
|
+
}, null)]) : "";
|
|
141
|
+
};
|
|
142
|
+
if (props.modelValue > props.max) {
|
|
143
|
+
percentDispaly.value = "100%";
|
|
144
|
+
} else if (props.modelValue < props.min) {
|
|
145
|
+
percentDispaly.value = "0%";
|
|
146
|
+
} else {
|
|
147
|
+
percentDispaly.value = (props.modelValue - props.min) * 100 / (props.max - props.min) + "%";
|
|
148
|
+
}
|
|
149
|
+
onMounted(() => {
|
|
150
|
+
const sliderWidth = !!sliderRunway.value ? sliderRunway.value.clientWidth : 0;
|
|
151
|
+
currentPosition.value = sliderWidth * (inputValue.value - props.min) / (props.max - props.min);
|
|
152
|
+
});
|
|
153
|
+
function handleButtonMousedown(event) {
|
|
154
|
+
popoverShow.value = true;
|
|
155
|
+
if (props.disabled) {
|
|
109
156
|
return;
|
|
110
157
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
dragStart(event);
|
|
160
|
+
window.addEventListener("mousemove", onDragging);
|
|
161
|
+
window.addEventListener("mouseup", onDragEnd);
|
|
115
162
|
}
|
|
116
163
|
function handleRunwayMousedown(event) {
|
|
117
164
|
if (!props.disabled && isClick) {
|
|
118
|
-
|
|
165
|
+
const _e = event.target;
|
|
166
|
+
startX = _e.getBoundingClientRect().left;
|
|
119
167
|
const currentX = event.clientX;
|
|
120
168
|
setPostion(currentX - startX);
|
|
121
169
|
handleButtonMousedown(event);
|
|
@@ -123,74 +171,60 @@ var Slider = defineComponent({
|
|
|
123
171
|
return;
|
|
124
172
|
}
|
|
125
173
|
}
|
|
126
|
-
function handleOnInput(event) {
|
|
127
|
-
inputValue.value = parseInt(event.target.value);
|
|
128
|
-
if (!inputValue.value) {
|
|
129
|
-
inputValue.value = props.min;
|
|
130
|
-
percentDispaly.value = "0%";
|
|
131
|
-
} else {
|
|
132
|
-
if (inputValue.value < props.min || inputValue.value > props.max) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
const re = /^(?:[1-9]?\d|100)$/;
|
|
136
|
-
if (re.test(`${inputValue.value}`)) {
|
|
137
|
-
percentDispaly.value = (inputValue.value - props.min) * 100 / (props.max - props.min) + "%";
|
|
138
|
-
ctx.emit("update:modelValue", inputValue.value);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
174
|
const disableClass = computed(() => {
|
|
143
175
|
return props.disabled ? " disabled" : "";
|
|
144
176
|
});
|
|
145
177
|
const popover = () => {
|
|
146
178
|
return createVNode("div", {
|
|
147
|
-
"class": "
|
|
179
|
+
"class": ns.e("popover"),
|
|
148
180
|
"style": {
|
|
149
181
|
left: percentDispaly.value,
|
|
150
182
|
opacity: popoverShow.value ? 1 : 0
|
|
151
183
|
}
|
|
152
184
|
}, [createVNode("div", {
|
|
153
|
-
"class": "
|
|
185
|
+
"class": ns.e("popover-arrow")
|
|
154
186
|
}, null), createVNode("div", {
|
|
155
|
-
"class": "
|
|
187
|
+
"class": ns.e("popover-content")
|
|
156
188
|
}, [inputValue.value + " " + props.tipsRenderer])]);
|
|
157
189
|
};
|
|
190
|
+
const color = computed(() => {
|
|
191
|
+
return props.disabled ? "" : props.color;
|
|
192
|
+
});
|
|
158
193
|
return () => createVNode("div", {
|
|
159
|
-
"class":
|
|
194
|
+
"class": ns.b()
|
|
160
195
|
}, [createVNode("div", {
|
|
161
196
|
"ref": sliderRunway,
|
|
162
|
-
"class": "
|
|
197
|
+
"class": [ns.e("runway"), disableClass.value],
|
|
163
198
|
"onMousedown": handleRunwayMousedown,
|
|
164
199
|
"onMouseout": () => popoverShow.value = false
|
|
165
200
|
}, [createVNode("div", {
|
|
166
|
-
"class": "
|
|
201
|
+
"class": [ns.e("bar"), disableClass.value],
|
|
167
202
|
"style": {
|
|
168
|
-
width: percentDispaly.value
|
|
203
|
+
width: percentDispaly.value,
|
|
204
|
+
backgroundColor: color.value
|
|
169
205
|
}
|
|
170
206
|
}, null), createVNode("div", {
|
|
171
|
-
"class": "
|
|
207
|
+
"class": [ns.e("button"), disableClass.value],
|
|
172
208
|
"style": {
|
|
173
|
-
left: percentDispaly.value
|
|
209
|
+
left: percentDispaly.value,
|
|
210
|
+
borderColor: color.value
|
|
174
211
|
},
|
|
175
212
|
"onMousedown": handleButtonMousedown,
|
|
176
213
|
"onMouseenter": () => popoverShow.value = true,
|
|
177
214
|
"onMouseout": () => popoverShow.value = false
|
|
178
215
|
}, null), props.tipsRenderer === "null" ? "" : popover()]), createVNode("span", {
|
|
179
|
-
"class": "
|
|
216
|
+
"class": ns.e("min-count")
|
|
180
217
|
}, [props.min]), createVNode("span", {
|
|
181
|
-
"class": "
|
|
218
|
+
"class": ns.e("max-count")
|
|
182
219
|
}, [props.max]), renderShowInput()]);
|
|
183
220
|
}
|
|
184
221
|
});
|
|
185
|
-
Slider.install = function(app) {
|
|
186
|
-
app.component(Slider.name, Slider);
|
|
187
|
-
};
|
|
188
222
|
var index = {
|
|
189
223
|
title: "Slider \u6ED1\u5757",
|
|
190
224
|
category: "\u6570\u636E\u5F55\u5165",
|
|
191
225
|
status: "100%",
|
|
192
226
|
install(app) {
|
|
193
|
-
app.
|
|
227
|
+
app.component(Slider.name, Slider);
|
|
194
228
|
}
|
|
195
229
|
};
|
|
196
|
-
export { Slider, index as default };
|
|
230
|
+
export { Slider, index as default, sliderProps };
|
package/slider/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.index={},i.Vue))})(this,function(i,t){"use strict";const g={disabled:{type:Boolean,default:!1},max:{type:Number,default:100},min:{type:Number,default:0},modelValue:{type:Number,default:0},showInput:{type:Boolean,default:!1},step:{type:Number,default:1},tipsRenderer:{type:String,default:""},color:{type:String,default:""}};function v(e,r,u){let c=e;return r&&(c+=`__${r}`),u&&(c+=`--${u}`),c}function D(e,r=!1){const u=r?`.devui-${e}`:`devui-${e}`;return{b:()=>v(u),e:l=>l?v(u,l):"",m:l=>l?v(u,"",l):"",em:(l,a)=>l&&a?v(u,l,a):""}}var P="",b=t.defineComponent({name:"DSlider",props:g,emits:["update:modelValue"],setup(e,r){let u=!0,c=0,f=0;const d=D("slider"),m=t.ref(!1),l=t.ref(null),a=t.ref(e.modelValue),h=t.ref(0),y=t.ref(0),o=t.ref("");function R(n){if(a.value=parseInt(n.target.value),!a.value)a.value=e.min,o.value="0%";else{if(a.value<e.min||a.value>e.max)return;/^(?:[1-9]?\d|100)$/.test(`${a.value}`)&&(o.value=(a.value-e.min)*100/(e.max-e.min)+"%",r.emit("update:modelValue",a.value))}}function M(n){const V=l.value?l.value.clientWidth:0,s=Math.round(V);n<0&&(n=0);const C=s/((e.max-e.min)/e.step),N=Math.round(n/C)*C;if(Math.round(N)>=s){h.value=s,a.value=e.max,o.value="100%",r.emit("update:modelValue",e.max);return}o.value=Math.round(N*100/s)+"%",a.value=Math.round(N*(e.max-e.min)/s)+e.min,h.value=n,r.emit("update:modelValue",a.value)}function _(n){u=!1,f=n.clientX,c=h.value,y.value=c}function x(n){m.value=!0;const s=n.clientX-f;y.value=c+s,M(y.value)}function S(){m.value=!1,setTimeout(()=>{u=!0},100),window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",S)}const $=()=>e.showInput?t.createVNode("div",{class:d.e("input-wrap")},[t.createVNode("input",{onInput:R,value:a.value+"",disabled:e.disabled},null)]):"";e.modelValue>e.max?o.value="100%":e.modelValue<e.min?o.value="0%":o.value=(e.modelValue-e.min)*100/(e.max-e.min)+"%",t.onMounted(()=>{const n=l.value?l.value.clientWidth:0;h.value=n*(a.value-e.min)/(e.max-e.min)});function E(n){m.value=!0,!e.disabled&&(n.preventDefault(),_(n),window.addEventListener("mousemove",x),window.addEventListener("mouseup",S))}function B(n){if(!e.disabled&&u){f=n.target.getBoundingClientRect().left;const s=n.clientX;M(s-f),E(n)}else return}const w=t.computed(()=>e.disabled?" disabled":""),L=()=>t.createVNode("div",{class:d.e("popover"),style:{left:o.value,opacity:m.value?1:0}},[t.createVNode("div",{class:d.e("popover-arrow")},null),t.createVNode("div",{class:d.e("popover-content")},[a.value+" "+e.tipsRenderer])]),X=t.computed(()=>e.disabled?"":e.color);return()=>t.createVNode("div",{class:d.b()},[t.createVNode("div",{ref:l,class:[d.e("runway"),w.value],onMousedown:B,onMouseout:()=>m.value=!1},[t.createVNode("div",{class:[d.e("bar"),w.value],style:{width:o.value,backgroundColor:X.value}},null),t.createVNode("div",{class:[d.e("button"),w.value],style:{left:o.value,borderColor:X.value},onMousedown:E,onMouseenter:()=>m.value=!0,onMouseout:()=>m.value=!1},null),e.tipsRenderer==="null"?"":L()]),t.createVNode("span",{class:d.e("min-count")},[e.min]),t.createVNode("span",{class:d.e("max-count")},[e.max]),$()])}}),I={title:"Slider \u6ED1\u5757",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(b.name,b)}};i.Slider=b,i.default=I,i.sliderProps=g,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
|
package/slider/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-slider{position:relative;width:90%;display:block}.devui-slider.disabled{cursor:not-allowed;background-color:var(--devui-disabled-line, #dfe1e6);border-color:var(--devui-disabled-line, #dfe1e6)}.devui-slider__runway{position:relative;width:100%;padding:4px 0;margin:4px 0;cursor:pointer;box-sizing:border-box;height:5px;display:flex;align-items:center;background-color:var(--devui-default-bg, #
|
|
1
|
+
.devui-slider{position:relative;width:90%;display:block}.devui-slider.disabled{cursor:not-allowed;background-color:var(--devui-disabled-line, #dfe1e6);border-color:var(--devui-disabled-line, #dfe1e6)}.devui-slider__runway{position:relative;width:100%;padding:4px 0;margin:4px 0;cursor:pointer;box-sizing:border-box;height:5px;display:flex;align-items:center;background-color:var(--devui-default-bg, #f7f8fa)}.devui-slider__runway.disabled{cursor:not-allowed}.devui-slider__runway .devui-slider__bar{height:6px;background-color:var(--devui-default-line, #5e7ce0);border-top-left-radius:var(--devui-border-radius, 4px);border-bottom-left-radius:var(--devui-border-radius, 4px);position:absolute}.devui-slider__runway .devui-slider__bar.disabled{background-color:var(--devui-disabled-line, #dfe1e6);border-color:var(--devui-disabled-line, #dfe1e6)}.devui-slider__runway .devui-slider__bar.disabled:hover{cursor:not-allowed}.devui-slider__runway .devui-slider__button{position:absolute;width:14px;height:14px;border:2px solid var(--devui-default-line, #5e7ce0);background-color:var(--devui-base-bg, #ffffff);border-radius:50%;margin-left:-7px;transition:transform .2s ease-in-out}.devui-slider__runway .devui-slider__button:hover{transform:scale(1.2)}.devui-slider__runway .devui-slider__button.disabled{background-color:var(--devui-base-bg, #ffffff);border-color:var(--devui-disabled-line, #dfe1e6)}.devui-slider__runway .devui-slider__button.disabled:hover{cursor:not-allowed;transform:none}.devui-slider__runway .devui-slider__popover{position:relative;bottom:26px;transform:translate(-50%);border-radius:var(--devui-border-radius-feedback, 4px);font-size:var(--devui-font-size-sm, 12px);color:var(--devui-feedback-overlay-text, #dfe1e6)}.devui-slider__runway .devui-slider__popover .devui-slider__popover-arrow{position:absolute;left:50%;margin-left:-4px;bottom:-4px;width:8px;height:8px;transform:rotate(45deg);display:block;z-index:-1;background-color:var(--devui-feedback-overlay-bg, #464d6e)}.devui-slider__runway .devui-slider__popover .devui-slider__popover-content{padding:5px 14px;text-align:center;border-radius:var(--devui-border-radius-feedback, 4px);background-color:var(--devui-feedback-overlay-bg, #464d6e)}.devui-slider .devui-slider__min-count{position:absolute;top:15px;left:0;font-size:var(--devui-font-size, 14px);color:var(--devui-text, #252b3a)}.devui-slider .devui-slider__max-count{position:absolute;top:15px;right:0;font-size:var(--devui-font-size, 14px);color:var(--devui-text, #252b3a)}.devui-slider .devui-slider__input-wrap{font-size:var(--devui-font-size, 14px);position:absolute;right:-60px;top:-12px;padding:5px 10px;cursor:text;margin-left:20px}.devui-slider .devui-slider__input-wrap input{width:40px;text-align:center}
|