vue-devui 1.0.0-rc.0 → 1.0.0-rc.11
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 +78 -116
- 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 +8190 -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 +34 -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 +63 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8068 -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 +8167 -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 +1048 -1176
- package/form/index.umd.js +16 -16
- 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 +8074 -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/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/TimeSelect.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/tableProps.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 +11 -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 +7972 -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 +3653 -1122
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9170 -596
- 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 +144 -137
- 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 +41 -34
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +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 +7802 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10459 -1511
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +344 -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 +7921 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/{anchor → time-select}/index.d.ts +0 -0
- package/{color-picker → time-select}/index.es.js +4171 -2898
- package/time-select/index.umd.js +27 -0
- package/{breadcrumb → time-select}/package.json +1 -1
- package/time-select/style.css +1 -0
- package/{back-top → 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 +5198 -1850
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +427 -132
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +12064 -15841
- package/vue-devui.umd.js +30 -20
- 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.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/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.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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, watch, onMounted, defineComponent, computed, createVNode } from "vue";
|
|
2
2
|
const sliderProps = {
|
|
3
3
|
disabled: {
|
|
4
4
|
type: Boolean,
|
|
@@ -16,181 +16,188 @@ const sliderProps = {
|
|
|
16
16
|
type: Number,
|
|
17
17
|
default: 0
|
|
18
18
|
},
|
|
19
|
-
showInput: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: false
|
|
22
|
-
},
|
|
23
19
|
step: {
|
|
24
20
|
type: Number,
|
|
25
21
|
default: 1
|
|
26
22
|
},
|
|
27
23
|
tipsRenderer: {
|
|
28
|
-
type:
|
|
29
|
-
default:
|
|
24
|
+
type: [Function, null],
|
|
25
|
+
default: () => (value) => `${value}`
|
|
30
26
|
}
|
|
31
27
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
28
|
+
function createBem(namespace, element, modifier) {
|
|
29
|
+
let cls = namespace;
|
|
30
|
+
if (element) {
|
|
31
|
+
cls += `__${element}`;
|
|
32
|
+
}
|
|
33
|
+
if (modifier) {
|
|
34
|
+
cls += `--${modifier}`;
|
|
35
|
+
}
|
|
36
|
+
return cls;
|
|
37
|
+
}
|
|
38
|
+
function useNamespace(block, needDot = false) {
|
|
39
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
40
|
+
const b = () => createBem(namespace);
|
|
41
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
42
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
43
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
44
|
+
return {
|
|
45
|
+
b,
|
|
46
|
+
e,
|
|
47
|
+
m,
|
|
48
|
+
em
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const isFunction = (value) => Object.prototype.toString.call(value) === "[object Function]";
|
|
52
|
+
function useSliderEvent(props, ctx) {
|
|
53
|
+
let isClick = true;
|
|
54
|
+
let startPosition = 0;
|
|
55
|
+
let startX = 0;
|
|
56
|
+
const sliderRunway = ref();
|
|
57
|
+
const currentValue = ref(Number(props.modelValue));
|
|
58
|
+
const currentPosition = ref(0);
|
|
59
|
+
const percentDisplay = ref("");
|
|
60
|
+
const popoverShow = ref(false);
|
|
61
|
+
const newPosition = ref(0);
|
|
62
|
+
function getSliderWidth() {
|
|
63
|
+
var _a;
|
|
64
|
+
return Boolean(sliderRunway.value) ? ((_a = sliderRunway.value) == null ? void 0 : _a.clientWidth) || 0 : 0;
|
|
65
|
+
}
|
|
66
|
+
function initCurrentPosition() {
|
|
67
|
+
const sliderWidth = getSliderWidth();
|
|
68
|
+
currentPosition.value = sliderWidth * (currentValue.value - props.min) / (props.max - props.min);
|
|
69
|
+
}
|
|
70
|
+
function setPosition(position) {
|
|
71
|
+
const clientWidth = getSliderWidth();
|
|
72
|
+
const sliderWidth = Math.round(clientWidth);
|
|
73
|
+
if (position < 0) {
|
|
74
|
+
position = 0;
|
|
61
75
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
const LengthPerStep = sliderWidth / ((props.max - props.min) / props.step);
|
|
77
|
+
const steps = Math.round(position / LengthPerStep);
|
|
78
|
+
const value = steps * LengthPerStep;
|
|
79
|
+
if (Math.round(value) >= sliderWidth) {
|
|
80
|
+
currentPosition.value = sliderWidth;
|
|
81
|
+
currentValue.value = props.max;
|
|
82
|
+
percentDisplay.value = "100%";
|
|
83
|
+
ctx.emit("update:modelValue", props.max);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
percentDisplay.value = Math.round(value * 100 / sliderWidth) + "%";
|
|
87
|
+
currentValue.value = Math.round(value * (props.max - props.min) / sliderWidth) + props.min;
|
|
88
|
+
currentPosition.value = position;
|
|
89
|
+
ctx.emit("update:modelValue", currentValue.value);
|
|
90
|
+
}
|
|
91
|
+
function dragStart(event) {
|
|
92
|
+
isClick = false;
|
|
93
|
+
startX = event.clientX;
|
|
94
|
+
startPosition = currentPosition.value;
|
|
95
|
+
newPosition.value = startPosition;
|
|
96
|
+
}
|
|
97
|
+
function onDragging(event) {
|
|
98
|
+
popoverShow.value = true;
|
|
99
|
+
const currentX = event.clientX;
|
|
100
|
+
const pxOffset = currentX - startX;
|
|
101
|
+
newPosition.value = startPosition + pxOffset;
|
|
102
|
+
setPosition(newPosition.value);
|
|
103
|
+
}
|
|
104
|
+
function onDragEnd() {
|
|
105
|
+
popoverShow.value = false;
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
isClick = true;
|
|
108
|
+
}, 100);
|
|
109
|
+
window.removeEventListener("mousemove", onDragging);
|
|
110
|
+
window.removeEventListener("mouseup", onDragEnd);
|
|
111
|
+
}
|
|
112
|
+
function handleButtonMousedown(event) {
|
|
113
|
+
popoverShow.value = true;
|
|
114
|
+
if (!props.disabled) {
|
|
70
115
|
event.preventDefault();
|
|
71
116
|
dragStart(event);
|
|
72
117
|
window.addEventListener("mousemove", onDragging);
|
|
73
118
|
window.addEventListener("mouseup", onDragEnd);
|
|
74
119
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
function onDragging(event) {
|
|
82
|
-
popoverShow.value = true;
|
|
120
|
+
}
|
|
121
|
+
function handleRunwayMousedown(event) {
|
|
122
|
+
if (!props.disabled && isClick) {
|
|
123
|
+
const _e = event.target;
|
|
124
|
+
startX = _e.getBoundingClientRect().left;
|
|
83
125
|
const currentX = event.clientX;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
setPostion(newPostion.value);
|
|
87
|
-
}
|
|
88
|
-
function onDragEnd() {
|
|
89
|
-
popoverShow.value = false;
|
|
90
|
-
setTimeout(() => {
|
|
91
|
-
isClick = true;
|
|
92
|
-
}, 100);
|
|
93
|
-
window.removeEventListener("mousemove", onDragging);
|
|
94
|
-
window.removeEventListener("mouseup", onDragEnd);
|
|
95
|
-
}
|
|
96
|
-
function setPostion(newPosition) {
|
|
97
|
-
const sliderWidth = Math.round(sliderRunway.value.clientWidth);
|
|
98
|
-
if (newPosition < 0) {
|
|
99
|
-
newPosition = 0;
|
|
100
|
-
}
|
|
101
|
-
const LengthPerStep = sliderWidth / ((props.max - props.min) / props.step);
|
|
102
|
-
const steps = Math.round(newPosition / LengthPerStep);
|
|
103
|
-
const value = steps * LengthPerStep;
|
|
104
|
-
if (Math.round(value) >= sliderWidth) {
|
|
105
|
-
currentPosition.value = sliderWidth;
|
|
106
|
-
inputValue.value = props.max;
|
|
107
|
-
percentDispaly.value = "100%";
|
|
108
|
-
ctx.emit("update:modelValue", props.max);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
percentDispaly.value = Math.round(value * 100 / sliderWidth) + "%";
|
|
112
|
-
inputValue.value = Math.round(value * (props.max - props.min) / sliderWidth) + props.min;
|
|
113
|
-
currentPosition.value = newPosition;
|
|
114
|
-
ctx.emit("update:modelValue", inputValue.value);
|
|
126
|
+
setPosition(currentX - startX);
|
|
127
|
+
handleButtonMousedown(event);
|
|
115
128
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
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
|
-
}
|
|
129
|
+
}
|
|
130
|
+
watch(() => props.modelValue, () => {
|
|
131
|
+
currentValue.value = Number(props.modelValue);
|
|
132
|
+
if (currentValue.value > props.max) {
|
|
133
|
+
percentDisplay.value = "100%";
|
|
134
|
+
} else if (currentValue.value < props.min) {
|
|
135
|
+
percentDisplay.value = "0%";
|
|
136
|
+
} else {
|
|
137
|
+
percentDisplay.value = (currentValue.value - props.min) * 100 / (props.max - props.min) + "%";
|
|
141
138
|
}
|
|
139
|
+
initCurrentPosition();
|
|
140
|
+
}, { immediate: true });
|
|
141
|
+
onMounted(initCurrentPosition);
|
|
142
|
+
return { sliderRunway, popoverShow, percentDisplay, currentValue, handleRunwayMousedown, handleButtonMousedown };
|
|
143
|
+
}
|
|
144
|
+
var slider = "";
|
|
145
|
+
var Slider = defineComponent({
|
|
146
|
+
name: "DSlider",
|
|
147
|
+
props: sliderProps,
|
|
148
|
+
emits: ["update:modelValue"],
|
|
149
|
+
setup(props, ctx) {
|
|
150
|
+
const ns = useNamespace("slider");
|
|
151
|
+
const {
|
|
152
|
+
sliderRunway,
|
|
153
|
+
popoverShow,
|
|
154
|
+
percentDisplay,
|
|
155
|
+
currentValue,
|
|
156
|
+
handleRunwayMousedown,
|
|
157
|
+
handleButtonMousedown
|
|
158
|
+
} = useSliderEvent(props, ctx);
|
|
142
159
|
const disableClass = computed(() => {
|
|
143
160
|
return props.disabled ? " disabled" : "";
|
|
144
161
|
});
|
|
145
|
-
const
|
|
146
|
-
return createVNode("div", {
|
|
147
|
-
"class": "devui-slider_popover",
|
|
148
|
-
"style": {
|
|
149
|
-
left: percentDispaly.value,
|
|
150
|
-
opacity: popoverShow.value ? 1 : 0
|
|
151
|
-
}
|
|
152
|
-
}, [createVNode("div", {
|
|
153
|
-
"class": "devui-slider_popover-arrow"
|
|
154
|
-
}, null), createVNode("div", {
|
|
155
|
-
"class": "devui-slider_popover-content"
|
|
156
|
-
}, [inputValue.value + " " + props.tipsRenderer])]);
|
|
157
|
-
};
|
|
162
|
+
const tipsContent = computed(() => isFunction(props.tipsRenderer) ? props.tipsRenderer(currentValue.value) : "");
|
|
158
163
|
return () => createVNode("div", {
|
|
159
|
-
"class":
|
|
164
|
+
"class": ns.b()
|
|
160
165
|
}, [createVNode("div", {
|
|
161
166
|
"ref": sliderRunway,
|
|
162
|
-
"class": "
|
|
167
|
+
"class": [ns.e("runway"), disableClass.value],
|
|
163
168
|
"onMousedown": handleRunwayMousedown,
|
|
164
169
|
"onMouseout": () => popoverShow.value = false
|
|
165
170
|
}, [createVNode("div", {
|
|
166
|
-
"class": "
|
|
171
|
+
"class": [ns.e("bar"), disableClass.value],
|
|
167
172
|
"style": {
|
|
168
|
-
width:
|
|
173
|
+
width: percentDisplay.value
|
|
169
174
|
}
|
|
170
175
|
}, null), createVNode("div", {
|
|
171
|
-
"class": "
|
|
176
|
+
"class": [ns.e("button"), disableClass.value],
|
|
172
177
|
"style": {
|
|
173
|
-
left:
|
|
178
|
+
left: percentDisplay.value
|
|
174
179
|
},
|
|
175
180
|
"onMousedown": handleButtonMousedown,
|
|
176
181
|
"onMouseenter": () => popoverShow.value = true,
|
|
177
182
|
"onMouseout": () => popoverShow.value = false
|
|
178
|
-
}, null), props.tipsRenderer ===
|
|
179
|
-
"class": "
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
}, null), props.tipsRenderer === null ? null : popoverShow.value ? createVNode("div", {
|
|
184
|
+
"class": ns.e("popover"),
|
|
185
|
+
"style": {
|
|
186
|
+
left: percentDisplay.value
|
|
187
|
+
}
|
|
188
|
+
}, [createVNode("div", {
|
|
189
|
+
"class": ns.e("popover-arrow")
|
|
190
|
+
}, null), createVNode("div", {
|
|
191
|
+
"class": ns.e("popover-content")
|
|
192
|
+
}, [tipsContent.value])]) : null])]);
|
|
183
193
|
}
|
|
184
194
|
});
|
|
185
|
-
Slider.install = function(app) {
|
|
186
|
-
app.component(Slider.name, Slider);
|
|
187
|
-
};
|
|
188
195
|
var index = {
|
|
189
196
|
title: "Slider \u6ED1\u5757",
|
|
190
197
|
category: "\u6570\u636E\u5F55\u5165",
|
|
191
198
|
status: "100%",
|
|
192
199
|
install(app) {
|
|
193
|
-
app.
|
|
200
|
+
app.component(Slider.name, Slider);
|
|
194
201
|
}
|
|
195
202
|
};
|
|
196
|
-
export { Slider, index as default };
|
|
203
|
+
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 M={disabled:{type:Boolean,default:!1},max:{type:Number,default:100},min:{type:Number,default:0},modelValue:{type:Number,default:0},step:{type:Number,default:1},tipsRenderer:{type:[Function,null],default:()=>e=>`${e}`}};function w(e,r,u){let d=e;return r&&(d+=`__${r}`),u&&(d+=`--${u}`),d}function E(e,r=!1){const u=r?`.devui-${e}`:`devui-${e}`;return{b:()=>w(u),e:l=>l?w(u,l):"",m:l=>l?w(u,"",l):"",em:(l,o)=>l&&o?w(u,l,o):""}}const D=e=>Object.prototype.toString.call(e)==="[object Function]";function X(e,r){let u=!0,d=0,s=0;const f=t.ref(),a=t.ref(Number(e.modelValue)),l=t.ref(0),o=t.ref(""),m=t.ref(!1),v=t.ref(0);function V(){var n;return Boolean(f.value)&&((n=f.value)==null?void 0:n.clientWidth)||0}function N(){const n=V();l.value=n*(a.value-e.min)/(e.max-e.min)}function g(n){const y=V(),c=Math.round(y);n<0&&(n=0);const R=c/((e.max-e.min)/e.step),b=Math.round(n/R)*R;if(Math.round(b)>=c){l.value=c,a.value=e.max,o.value="100%",r.emit("update:modelValue",e.max);return}o.value=Math.round(b*100/c)+"%",a.value=Math.round(b*(e.max-e.min)/c)+e.min,l.value=n,r.emit("update:modelValue",a.value)}function C(n){u=!1,s=n.clientX,d=l.value,v.value=d}function S(n){m.value=!0;const c=n.clientX-s;v.value=d+c,g(v.value)}function x(){m.value=!1,setTimeout(()=>{u=!0},100),window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",x)}function P(n){m.value=!0,e.disabled||(n.preventDefault(),C(n),window.addEventListener("mousemove",S),window.addEventListener("mouseup",x))}function _(n){if(!e.disabled&&u){s=n.target.getBoundingClientRect().left;const c=n.clientX;g(c-s),P(n)}}return t.watch(()=>e.modelValue,()=>{a.value=Number(e.modelValue),a.value>e.max?o.value="100%":a.value<e.min?o.value="0%":o.value=(a.value-e.min)*100/(e.max-e.min)+"%",N()},{immediate:!0}),t.onMounted(N),{sliderRunway:f,popoverShow:m,percentDisplay:o,currentValue:a,handleRunwayMousedown:_,handleButtonMousedown:P}}var L="",h=t.defineComponent({name:"DSlider",props:M,emits:["update:modelValue"],setup(e,r){const u=E("slider"),{sliderRunway:d,popoverShow:s,percentDisplay:f,currentValue:a,handleRunwayMousedown:l,handleButtonMousedown:o}=X(e,r),m=t.computed(()=>e.disabled?" disabled":""),v=t.computed(()=>D(e.tipsRenderer)?e.tipsRenderer(a.value):"");return()=>t.createVNode("div",{class:u.b()},[t.createVNode("div",{ref:d,class:[u.e("runway"),m.value],onMousedown:l,onMouseout:()=>s.value=!1},[t.createVNode("div",{class:[u.e("bar"),m.value],style:{width:f.value}},null),t.createVNode("div",{class:[u.e("button"),m.value],style:{left:f.value},onMousedown:o,onMouseenter:()=>s.value=!0,onMouseout:()=>s.value=!1},null),e.tipsRenderer===null?null:s.value?t.createVNode("div",{class:u.e("popover"),style:{left:f.value}},[t.createVNode("div",{class:u.e("popover-arrow")},null),t.createVNode("div",{class:u.e("popover-content")},[v.value])]):null])])}}),B={title:"Slider \u6ED1\u5757",category:"\u6570\u636E\u5F55\u5165",status:"100%",install(e){e.component(h.name,h)}};i.Slider=h,i.default=B,i.sliderProps=M,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
|
package/slider/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-slider{position:relative;width:
|
|
1
|
+
.devui-slider{position:relative;width:100%;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;border-radius:var(--devui-border-radius-full, 100px);background-color:var(--devui-area, #f8f8f8)}.devui-slider__runway.disabled{background-color:var(--devui-disabled-bg, #f5f5f5);cursor:not-allowed}.devui-slider__runway:hover .devui-slider__bar:not(.disabled){background-color:var(--devui-brand-hover, #7693f5)}.devui-slider__runway .devui-slider__bar{height:6px;background-color:var(--devui-brand, #5e7ce0);border-top-left-radius:var(--devui-border-radius-full, 100px);border-bottom-left-radius:var(--devui-border-radius-full, 100px);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-brand, #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:not(.disabled){border-color:var(--devui-brand-hover, #7693f5);transform:scale(1.3)}.devui-slider__runway .devui-slider__button.disabled{border-color:var(--devui-disabled-line, #dfe1e6)}.devui-slider__runway .devui-slider__button.disabled{cursor:not-allowed}.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)}
|