vue-devui 1.0.0-beta.1 → 1.0.0-beta.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/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +186 -139
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +2 -3
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +1 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +1 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/button/index.d.ts +7 -0
- package/button/index.es.js +9 -8
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +1 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +5 -4
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1239 -83
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +43 -8
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +176 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +32 -21
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +161 -41
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +527 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5718 -469
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +14 -4
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +6 -5
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +72 -11
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +24 -13
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +5 -4
- package/input-number/index.umd.js +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +1 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +117 -99
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/MultiUpload.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +110 -93
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +6 -33
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +3 -3
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +25 -22
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +5 -2
- package/popover/index.umd.js +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +1 -1
- package/progress/index.umd.js +2 -2
- package/quadrant-diagram/index.d.ts +7 -0
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +1 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +1 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +5 -2
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +35 -21
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +47 -11
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +148 -26
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +30 -177
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +107 -89
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +2 -2
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +101 -73
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +1 -1
- package/switch/index.umd.js +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1498 -156
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +6 -3
- package/tabs/index.umd.js +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +1 -13
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +241 -21
- package/time-axis/index.umd.js +1 -1
- package/time-axis/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +50 -26
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +8 -7
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +368 -79
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +171 -35
- package/tree/index.umd.js +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +8 -7
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +19214 -7637
- package/vue-devui.umd.js +29 -3
package/overlay/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive,
|
|
20
|
+
import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, toRef, isRef } from "vue";
|
|
21
21
|
var overlay = "";
|
|
22
22
|
function _isSlot(s) {
|
|
23
23
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -42,9 +42,6 @@ const overlayProps = {
|
|
|
42
42
|
visible: {
|
|
43
43
|
type: Boolean
|
|
44
44
|
},
|
|
45
|
-
"onUpdate:visible": {
|
|
46
|
-
type: Function
|
|
47
|
-
},
|
|
48
45
|
backgroundBlock: {
|
|
49
46
|
type: Boolean,
|
|
50
47
|
default: false
|
|
@@ -56,27 +53,57 @@ const overlayProps = {
|
|
|
56
53
|
backgroundStyle: {
|
|
57
54
|
type: [String, Object]
|
|
58
55
|
},
|
|
59
|
-
|
|
56
|
+
onBackdropClick: {
|
|
60
57
|
type: Function
|
|
61
58
|
},
|
|
62
59
|
backdropClose: {
|
|
63
60
|
type: Boolean,
|
|
64
61
|
default: true
|
|
62
|
+
},
|
|
63
|
+
hasBackdrop: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
|
-
|
|
68
|
+
const overlayEmits = ["update:visible", "backdropClick"];
|
|
69
|
+
const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
|
|
70
|
+
overlayStyle: {
|
|
71
|
+
type: [String, Object],
|
|
72
|
+
default: void 0
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const flexibleOverlayProps = __spreadValues({
|
|
76
|
+
origin: {
|
|
77
|
+
type: Object,
|
|
78
|
+
require: true
|
|
79
|
+
},
|
|
80
|
+
position: {
|
|
81
|
+
type: Object,
|
|
82
|
+
default: () => ({
|
|
83
|
+
originX: "left",
|
|
84
|
+
originY: "top",
|
|
85
|
+
overlayX: "left",
|
|
86
|
+
overlayY: "top"
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
}, overlayProps);
|
|
90
|
+
function useOverlayLogic(props, ctx) {
|
|
68
91
|
const backgroundClass = computed(() => {
|
|
69
|
-
return [
|
|
92
|
+
return [
|
|
93
|
+
"devui-overlay-background",
|
|
94
|
+
props.backgroundClass,
|
|
95
|
+
!props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
|
|
96
|
+
];
|
|
70
97
|
});
|
|
71
98
|
const overlayClass = computed(() => {
|
|
72
99
|
return "devui-overlay";
|
|
73
100
|
});
|
|
74
101
|
const handleBackdropClick = (event) => {
|
|
75
|
-
var _a
|
|
102
|
+
var _a;
|
|
76
103
|
event.preventDefault();
|
|
77
|
-
(_a = props.
|
|
104
|
+
(_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
|
|
78
105
|
if (props.backdropClose) {
|
|
79
|
-
(
|
|
106
|
+
ctx.emit("update:visible", false);
|
|
80
107
|
}
|
|
81
108
|
};
|
|
82
109
|
const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
|
|
@@ -112,19 +139,15 @@ function useOverlayLogic(props) {
|
|
|
112
139
|
}
|
|
113
140
|
const FixedOverlay = defineComponent({
|
|
114
141
|
name: "DFixedOverlay",
|
|
115
|
-
props:
|
|
116
|
-
|
|
117
|
-
type: Object,
|
|
118
|
-
default: void 0
|
|
119
|
-
}
|
|
120
|
-
}),
|
|
142
|
+
props: fixedOverlayProps,
|
|
143
|
+
emits: overlayEmits,
|
|
121
144
|
setup(props, ctx) {
|
|
122
145
|
const {
|
|
123
146
|
backgroundClass,
|
|
124
147
|
overlayClass,
|
|
125
148
|
handleBackdropClick,
|
|
126
149
|
handleOverlayBubbleCancel
|
|
127
|
-
} = useOverlayLogic(props);
|
|
150
|
+
} = useOverlayLogic(props, ctx);
|
|
128
151
|
return () => createVNode(CommonOverlay, null, {
|
|
129
152
|
default: () => [withDirectives(createVNode("div", {
|
|
130
153
|
"class": backgroundClass.value,
|
|
@@ -138,76 +161,61 @@ const FixedOverlay = defineComponent({
|
|
|
138
161
|
});
|
|
139
162
|
}
|
|
140
163
|
});
|
|
164
|
+
function isComponent(target) {
|
|
165
|
+
return !!(target == null ? void 0 : target.$el);
|
|
166
|
+
}
|
|
167
|
+
function getElement(element) {
|
|
168
|
+
if (element instanceof Element) {
|
|
169
|
+
return element;
|
|
170
|
+
}
|
|
171
|
+
if (element && typeof element === "object" && element.$el instanceof Element) {
|
|
172
|
+
return element.$el;
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
141
176
|
const FlexibleOverlay = defineComponent({
|
|
142
177
|
name: "DFlexibleOverlay",
|
|
143
|
-
props:
|
|
144
|
-
|
|
145
|
-
type: Object,
|
|
146
|
-
require: true
|
|
147
|
-
},
|
|
148
|
-
position: {
|
|
149
|
-
type: Object,
|
|
150
|
-
default: () => ({
|
|
151
|
-
originX: "left",
|
|
152
|
-
originY: "top",
|
|
153
|
-
overlayX: "left",
|
|
154
|
-
overlayY: "top"
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
}, overlayProps),
|
|
158
|
-
emits: ["onUpdate:visible"],
|
|
178
|
+
props: flexibleOverlayProps,
|
|
179
|
+
emits: overlayEmits,
|
|
159
180
|
setup(props, ctx) {
|
|
160
181
|
const overlayRef = ref(null);
|
|
161
182
|
const positionedStyle = reactive({
|
|
162
183
|
position: "absolute"
|
|
163
184
|
});
|
|
164
|
-
const instance = getCurrentInstance();
|
|
165
185
|
onMounted(async () => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (!overlay2) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const origin = getOrigin(props.origin);
|
|
172
|
-
if (!origin) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
const handleRectChange = (rect) => {
|
|
176
|
-
const point = calculatePosition(props.position, rect, origin);
|
|
186
|
+
const handleRectChange = (position, rect, origin) => {
|
|
187
|
+
const point = calculatePosition(position, rect, origin);
|
|
177
188
|
positionedStyle.left = `${point.x}px`;
|
|
178
189
|
positionedStyle.top = `${point.y}px`;
|
|
179
190
|
};
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
191
|
+
const locationElements = computed(() => {
|
|
192
|
+
const overlay2 = overlayRef.value;
|
|
193
|
+
const origin = getOrigin(props.origin);
|
|
194
|
+
if (!overlay2 || !origin) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
origin,
|
|
199
|
+
overlay: overlay2
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
const visibleRef = toRef(props, "visible");
|
|
203
|
+
const positionRef = toRef(props, "position");
|
|
204
|
+
watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
|
|
205
|
+
if (!visible || !locationElements2) {
|
|
206
|
+
return;
|
|
186
207
|
}
|
|
208
|
+
const {
|
|
209
|
+
origin,
|
|
210
|
+
overlay: overlay2
|
|
211
|
+
} = locationElements2;
|
|
212
|
+
handleRectChange(position, overlay2.getBoundingClientRect(), origin);
|
|
213
|
+
const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
|
|
187
214
|
onInvalidate(() => {
|
|
188
|
-
|
|
215
|
+
unsubscriptions.forEach((fn) => fn());
|
|
189
216
|
});
|
|
190
217
|
});
|
|
191
|
-
|
|
192
|
-
handleChange();
|
|
193
|
-
});
|
|
194
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
195
|
-
handleRectChange(entries[0].contentRect);
|
|
196
|
-
});
|
|
197
|
-
resizeObserver.observe(overlay2);
|
|
198
|
-
onBeforeUnmount(() => {
|
|
199
|
-
resizeObserver.disconnect();
|
|
200
|
-
}, instance);
|
|
201
|
-
if (origin instanceof Element) {
|
|
202
|
-
const observer = new MutationObserver(handleChange);
|
|
203
|
-
observer.observe(origin, {
|
|
204
|
-
attributeFilter: ["style"]
|
|
205
|
-
});
|
|
206
|
-
onBeforeUnmount(() => {
|
|
207
|
-
observer.disconnect();
|
|
208
|
-
}, instance);
|
|
209
|
-
}
|
|
210
|
-
}, instance);
|
|
218
|
+
});
|
|
211
219
|
const {
|
|
212
220
|
backgroundClass,
|
|
213
221
|
overlayClass,
|
|
@@ -216,6 +224,7 @@ const FlexibleOverlay = defineComponent({
|
|
|
216
224
|
} = useOverlayLogic(props);
|
|
217
225
|
return () => createVNode(CommonOverlay, null, {
|
|
218
226
|
default: () => [withDirectives(createVNode("div", {
|
|
227
|
+
"style": props.backgroundStyle,
|
|
219
228
|
"class": backgroundClass.value,
|
|
220
229
|
"onClick": handleBackdropClick
|
|
221
230
|
}, [createVNode("div", {
|
|
@@ -227,15 +236,6 @@ const FlexibleOverlay = defineComponent({
|
|
|
227
236
|
});
|
|
228
237
|
}
|
|
229
238
|
});
|
|
230
|
-
function getElement(element) {
|
|
231
|
-
if (element instanceof Element) {
|
|
232
|
-
return element;
|
|
233
|
-
}
|
|
234
|
-
if (element && typeof element === "object" && element.$el instanceof Element) {
|
|
235
|
-
return element.$el;
|
|
236
|
-
}
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
239
|
function getOrigin(origin) {
|
|
240
240
|
if (origin instanceof Element) {
|
|
241
241
|
return origin;
|
|
@@ -243,17 +243,14 @@ function getOrigin(origin) {
|
|
|
243
243
|
if (isRef(origin)) {
|
|
244
244
|
return getElement(origin.value);
|
|
245
245
|
}
|
|
246
|
+
if (isComponent(origin)) {
|
|
247
|
+
return getElement(origin);
|
|
248
|
+
}
|
|
246
249
|
return origin;
|
|
247
250
|
}
|
|
248
|
-
function calculatePosition(position,
|
|
251
|
+
function calculatePosition(position, rect, origin) {
|
|
249
252
|
const originRect = getOriginRect(origin);
|
|
250
253
|
const originPoint = getOriginRelativePoint(originRect, position);
|
|
251
|
-
let rect;
|
|
252
|
-
if (panelOrRect instanceof HTMLElement) {
|
|
253
|
-
rect = panelOrRect.getBoundingClientRect();
|
|
254
|
-
} else {
|
|
255
|
-
rect = panelOrRect;
|
|
256
|
-
}
|
|
257
254
|
return getOverlayPoint(originPoint, rect, position);
|
|
258
255
|
}
|
|
259
256
|
function getOriginRect(origin) {
|
|
@@ -317,11 +314,31 @@ function subscribeLayoutEvent(event) {
|
|
|
317
314
|
window.addEventListener("scroll", event, true);
|
|
318
315
|
window.addEventListener("resize", event);
|
|
319
316
|
window.addEventListener("orientationchange", event);
|
|
317
|
+
return () => {
|
|
318
|
+
window.removeEventListener("scroll", event, true);
|
|
319
|
+
window.removeEventListener("resize", event);
|
|
320
|
+
window.removeEventListener("orientationchange", event);
|
|
321
|
+
};
|
|
320
322
|
}
|
|
321
|
-
function
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
function subscribeOverlayResize(overlay2, callback) {
|
|
324
|
+
if (overlay2 instanceof Element) {
|
|
325
|
+
const resizeObserver = new ResizeObserver(callback);
|
|
326
|
+
resizeObserver.observe(overlay2);
|
|
327
|
+
return () => resizeObserver.disconnect();
|
|
328
|
+
}
|
|
329
|
+
return () => {
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function subscribeOriginResize(origin, callback) {
|
|
333
|
+
if (origin instanceof Element) {
|
|
334
|
+
const observer = new MutationObserver(callback);
|
|
335
|
+
observer.observe(origin, {
|
|
336
|
+
attributeFilter: ["style"]
|
|
337
|
+
});
|
|
338
|
+
return () => observer.disconnect();
|
|
339
|
+
}
|
|
340
|
+
return () => {
|
|
341
|
+
};
|
|
325
342
|
}
|
|
326
343
|
const inBrowser = typeof window !== "undefined";
|
|
327
344
|
FlexibleOverlay.install = function(app) {
|
|
@@ -333,7 +350,7 @@ FixedOverlay.install = function(app) {
|
|
|
333
350
|
var index = {
|
|
334
351
|
title: "Overlay \u906E\u7F69\u5C42",
|
|
335
352
|
category: "\u901A\u7528",
|
|
336
|
-
status: "
|
|
353
|
+
status: "100%",
|
|
337
354
|
install(app) {
|
|
338
355
|
app.use(FixedOverlay);
|
|
339
356
|
app.use(FlexibleOverlay);
|
package/overlay/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var F=(l,t,a)=>t in l?J(l,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[t]=a,B=(l,t)=>{for(var a in t||(t={}))W.call(t,a)&&F(l,a,t[a]);if(V)for(var a of V(t))Z.call(t,a)&&F(l,a,t[a]);return l},N=(l,t)=>K(l,Q(t));(function(l,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(l=typeof globalThis!="undefined"?globalThis:l||self,t(l.index={},l.Vue))})(this,function(l,t){"use strict";var a="";function L(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const x=t.defineComponent({setup(e,n){return()=>{let o;return t.createVNode(t.Teleport,{to:"#d-overlay-anchor"},{default:()=>[t.createVNode(t.Transition,{name:"devui-overlay-fade"},L(o=t.renderSlot(n.slots,"default"))?o:{default:()=>[o]})]})}}}),E={visible:{type:Boolean},backgroundBlock:{type:Boolean,default:!1},backgroundClass:{type:String,default:""},backgroundStyle:{type:[String,Object]},onBackdropClick:{type:Function},backdropClose:{type:Boolean,default:!0},hasBackdrop:{type:Boolean,default:!0}},S=["update:visible","backdropClick"],X=N(B({},E),{overlayStyle:{type:[String,Object],default:void 0}}),Y=B({origin:{type:Object,require:!0},position:{type:Object,default:()=>({originX:"left",originY:"top",overlayX:"left",overlayY:"top"})}},E);function R(e,n){const o=t.computed(()=>["devui-overlay-background",e.backgroundClass,e.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),i=t.computed(()=>"devui-overlay"),c=r=>{var d;r.preventDefault(),(d=e.onBackdropClick)==null||d.call(e),e.backdropClose&&n.emit("update:visible",!1)},s=r=>r.cancelBubble=!0;return t.onMounted(()=>{const r=document.body,d=r.style.overflow,f=r.style.position;t.watch([()=>e.visible,()=>e.backgroundBlock],([p,w])=>{if(w){const C=r.getBoundingClientRect().y;p?(r.style.overflowY="scroll",r.style.position=p?"fixed":"",r.style.top=`${C}px`):(r.style.overflowY=d,r.style.position=f,r.style.top="",window.scrollTo(0,-C))}}),t.onUnmounted(()=>{document.body.style.overflow=d})}),{backgroundClass:o,overlayClass:i,handleBackdropClick:c,handleOverlayBubbleCancel:s}}const v=t.defineComponent({name:"DFixedOverlay",props:X,emits:S,setup(e,n){const{backgroundClass:o,overlayClass:i,handleBackdropClick:c,handleOverlayBubbleCancel:s}=R(e,n);return()=>t.createVNode(x,null,{default:()=>[t.withDirectives(t.createVNode("div",{class:o.value,style:e.backgroundStyle,onClick:c},[t.createVNode("div",{class:i.value,style:e.overlayStyle,onClick:s},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function _(e){return!!(e==null?void 0:e.$el)}function j(e){return e instanceof Element?e:e&&typeof e=="object"&&e.$el instanceof Element?e.$el:null}const h=t.defineComponent({name:"DFlexibleOverlay",props:Y,emits:S,setup(e,n){const o=t.ref(null),i=t.reactive({position:"absolute"});t.onMounted(async()=>{const f=(u,y,b)=>{const g=T(u,y,b);i.left=`${g.x}px`,i.top=`${g.y}px`},p=t.computed(()=>{const u=o.value,y=z(e.origin);if(!(!u||!y))return{origin:y,overlay:u}}),w=t.toRef(e,"visible"),C=t.toRef(e,"position");t.watch([p,w,C],async([u,y,b],g,G)=>{if(!y||!u)return;const{origin:m,overlay:k}=u;f(b,k.getBoundingClientRect(),m);const H=[P(()=>f(b,k.getBoundingClientRect(),m)),A(k,O=>f(b,O[0].contentRect,m)),q(m,()=>f(b,k.getBoundingClientRect(),m))];G(()=>{H.forEach(O=>O())})})});const{backgroundClass:c,overlayClass:s,handleBackdropClick:r,handleOverlayBubbleCancel:d}=R(e);return()=>t.createVNode(x,null,{default:()=>[t.withDirectives(t.createVNode("div",{style:e.backgroundStyle,class:c.value,onClick:r},[t.createVNode("div",{ref:o,class:s.value,style:i,onClick:d},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function z(e){return e instanceof Element?e:t.isRef(e)?j(e.value):_(e)?j(e):e}function T(e,n,o){const i=$(o),c=M(i,e);return D(c,n,e)}function $(e){if(e instanceof Element)return e.getBoundingClientRect();const n=e.width||0,o=e.height||0;return{top:e.y,bottom:e.y+o,left:e.x,right:e.x+n,height:o,width:n}}function D(e,n,o){let i;const{width:c,height:s}=n;o.overlayX=="center"?i=e.x-c/2:i=o.overlayX=="left"?e.x:e.x-c;let r;return o.overlayY=="center"?r=e.y-s/2:r=o.overlayY=="top"?e.y:e.y-s,{x:i,y:r}}function M(e,n){let o;if(n.originX=="center")o=e.left+e.width/2;else{const c=e.left,s=e.right;o=n.originX=="left"?c:s}let i;return n.originY=="center"?i=e.top+e.height/2:i=n.originY=="top"?e.top:e.bottom,{x:o,y:i}}function P(e){return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}}function A(e,n){if(e instanceof Element){const o=new ResizeObserver(n);return o.observe(e),()=>o.disconnect()}return()=>{}}function q(e,n){if(e instanceof Element){const o=new MutationObserver(n);return o.observe(e,{attributeFilter:["style"]}),()=>o.disconnect()}return()=>{}}const I=typeof window!="undefined";h.install=function(e){e.component(h.name,h)},v.install=function(e){e.component(v.name,v)};var U={title:"Overlay \u906E\u7F69\u5C42",category:"\u901A\u7528",status:"100%",install(e){if(e.use(v),e.use(h),I&&!document.getElementById("d-overlay-anchor")){const n=document.createElement("div");n.setAttribute("id","d-overlay-anchor"),n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.zIndex="1000",document.body.appendChild(n)}}};l.FixedOverlay=v,l.FlexibleOverlay=h,l.default=U,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
|
package/overlay/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-overlay-background{position:fixed;top:0;left:0;height:100vh;width:100vw;display:flex}.devui-overlay-background__color{background:rgba(0,0,0,.4)}.devui-overlay-background .devui-overlay{position:relative;z-index:1000;pointer-events:auto}@keyframes d-overlay-fade{0%{opacity:0}to{opacity:1}}.devui-overlay-fade-enter{opacity:0}.devui-overlay-fade-enter-active{animation-name:d-overlay-fade;animation-duration:.3s}.devui-overlay-fade-leave{opacity:1}.devui-overlay-fade-leave-active{animation-name:d-overlay-fade;animation-duration:.3s;animation-direction:reverse}
|
|
1
|
+
.devui-overlay-background{position:fixed;top:0;left:0;height:100vh;width:100vw;display:flex}.devui-overlay-background__color{background:rgba(0,0,0,.4)}.devui-overlay-background .devui-overlay{position:relative;z-index:1000;pointer-events:auto}.devui-overlay-background__disabled{pointer-events:none}@keyframes d-overlay-fade{0%{opacity:0}to{opacity:1}}.devui-overlay-fade-enter{opacity:0}.devui-overlay-fade-enter-active{animation-name:d-overlay-fade;animation-duration:.3s}.devui-overlay-fade-leave{opacity:1}.devui-overlay-fade-leave-active{animation-name:d-overlay-fade;animation-duration:.3s;animation-direction:reverse}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-devui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "DevUI components based on Vite and Vue3",
|
|
6
6
|
"keywords": [
|
|
@@ -18,33 +18,12 @@
|
|
|
18
18
|
"main": "vue-devui.umd.js",
|
|
19
19
|
"module": "vue-devui.es.js",
|
|
20
20
|
"style": "style.css",
|
|
21
|
-
"bin": {
|
|
22
|
-
"devui-cli": "./devui-cli/index.js"
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"dev": "vitepress dev docs",
|
|
26
|
-
"build": "vitepress build docs && cp public/* docs/.vitepress/dist/assets",
|
|
27
|
-
"serve": "vitepress serve docs",
|
|
28
|
-
"app:dev": "vite",
|
|
29
|
-
"app:build": "vite build",
|
|
30
|
-
"build:lib": "yarn predev && yarn build:components && yarn generate:theme && yarn copy",
|
|
31
|
-
"test": "jest --config jest.config.js",
|
|
32
|
-
"ls-lint": "ls-lint",
|
|
33
|
-
"lint": "eslint \"{src,devui}/**/*.{vue,js,ts,jsx,tsx}\"",
|
|
34
|
-
"lint:fix": "eslint --fix \"{src,devui}/**/*.{vue,js,ts,jsx,tsx}\"",
|
|
35
|
-
"stylelint": "stylelint --fix \"{devui,src}/**/*.{scss,css}\"",
|
|
36
|
-
"build:components": "node ./devui-cli/index.js build",
|
|
37
|
-
"generate:theme": "node ./devui-cli/index.js generate:theme",
|
|
38
|
-
"copy": "cp package.json build && cp README.md build && cp devui/theme/theme.scss build/theme",
|
|
39
|
-
"clean:cli": "npm uninstall -g devui-cli & npm uninstall -g vue-devui",
|
|
40
|
-
"cli:create": "node ./devui-cli/index.js create -t component",
|
|
41
|
-
"predev": "node ./devui-cli/index.js create -t vue-devui --ignore-parse-error",
|
|
42
|
-
"prebuild": "node ./devui-cli/index.js create -t vue-devui --ignore-parse-error"
|
|
43
|
-
},
|
|
44
21
|
"dependencies": {
|
|
45
22
|
"@devui-design/icons": "^1.3.0",
|
|
46
23
|
"@types/lodash-es": "^4.17.4",
|
|
24
|
+
"async-validator": "^4.0.2",
|
|
47
25
|
"lodash-es": "^4.17.20",
|
|
26
|
+
"mitt": "^3.0.0",
|
|
48
27
|
"vue": "^3.1.1",
|
|
49
28
|
"vue-router": "^4.0.3"
|
|
50
29
|
},
|
|
@@ -76,7 +55,7 @@
|
|
|
76
55
|
"eslint": "^7.28.0",
|
|
77
56
|
"eslint-plugin-import": "^2.24.2",
|
|
78
57
|
"eslint-plugin-vue": "^7.11.1",
|
|
79
|
-
"husky": "^
|
|
58
|
+
"husky": "^7.0.4",
|
|
80
59
|
"inquirer": "^8.1.2",
|
|
81
60
|
"jest": "^27.0.4",
|
|
82
61
|
"lint-staged": "^11.0.0",
|
|
@@ -92,17 +71,11 @@
|
|
|
92
71
|
"vite": "^2.4.4",
|
|
93
72
|
"vite-plugin-md": "^0.6.0",
|
|
94
73
|
"vite-svg-loader": "^2.2.0",
|
|
95
|
-
"vitepress": "
|
|
96
|
-
"vitepress-theme-demoblock": "
|
|
74
|
+
"vitepress": "0.20.1",
|
|
75
|
+
"vitepress-theme-demoblock": "1.3.2",
|
|
97
76
|
"vue-tsc": "^0.2.2",
|
|
98
77
|
"yarn": "^1.22.11"
|
|
99
78
|
},
|
|
100
|
-
"husky": {
|
|
101
|
-
"hooks": {
|
|
102
|
-
"pre-commit": "ls-lint && lint-staged",
|
|
103
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
79
|
"lint-staged": {
|
|
107
80
|
"{src,devui}/**/*.{js,ts,jsx,tsx,vue}": "eslint --fix",
|
|
108
81
|
"{src,devui}/**/*.{scss,css}": "stylelint --fix"
|
package/pagination/index.es.js
CHANGED
|
@@ -323,8 +323,8 @@ var JumpPage = defineComponent({
|
|
|
323
323
|
createVNode(resolveComponent("d-input"), {
|
|
324
324
|
"class": ["devui-pagination-input", size ? "devui-pagination-input-" + size : ""],
|
|
325
325
|
"size": size,
|
|
326
|
-
"
|
|
327
|
-
"onUpdate:
|
|
326
|
+
"modelValue": String(inputNum),
|
|
327
|
+
"onUpdate:modelValue": jumpPageChange,
|
|
328
328
|
"onKeydown": jump
|
|
329
329
|
}, null),
|
|
330
330
|
goToText === "\u8DF3\u81F3" && "\u9875",
|
|
@@ -634,7 +634,7 @@ Pagination.install = (app) => {
|
|
|
634
634
|
var index = {
|
|
635
635
|
title: "Pagination \u5206\u9875",
|
|
636
636
|
category: "\u5BFC\u822A",
|
|
637
|
-
status: "
|
|
637
|
+
status: "100%",
|
|
638
638
|
install(app) {
|
|
639
639
|
app.use(Pagination);
|
|
640
640
|
}
|
package/pagination/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis!="undefined"?globalThis:u||self,e(u.index={},u.Vue))})(this,function(u,e){"use strict";const E={pageSize:{type:Number,default:10},total:{type:Number,default:0},pageSizeOptions:{type:Array,default:()=>[5,10,20,50]},pageSizeDirection:{type:Array,default:()=>["centerDown","centerUp"]},pageIndex:{type:Number,default:1},maxItems:{type:Number,default:10},preLink:{type:String,default:"<"},nextLink:{type:String,default:">"},size:{type:String,default:""},canJumpPage:{type:Boolean,default:!1},canChangePageSize:{type:Boolean,default:!1},canViewTotal:{type:Boolean,default:!1},totalItemText:{type:String,default:"\u6240\u6709\u6761\u76EE"},goToText:{type:String,default:"\u8DF3\u81F3"},showJumpButton:{type:Boolean,default:!1},showTruePageIndex:{type:Boolean,default:!1},lite:{type:Boolean,default:!1},showPageSelector:{type:Boolean,default:!0},haveConfigMenu:{type:Boolean,default:!1},autoFixPageIndex:{type:Boolean,default:!0},autoHide:{type:Boolean,default:!1},"onUpdate:pageIndex":{type:Function},"onUpdate:pageSize":{type:Function},onPageIndexChange:{type:Function},onPageSizeChange:{type:Function}},F=(t,n,a)=>{const r=t,s=n;if(s>=a)return[2,a];const o=s-2;let i=r-(o>>1),c=r+(o-1>>1);return i<2&&(i=2,c=s-2),c>a&&(i=a-s+3,c=a),[i,c]};function L(t){return new Array(t||1).fill(0).map((n,a)=>({name:`${a+1}/${t}`,value:a+1}))}function h(t,n,a){document.addEventListener?t&&n&&a&&t.addEventListener(n,a,!1):t&&n&&a&&t.attachEvent("on"+n,a)}function j(t,n,a){document.removeEventListener?t&&n&&a&&t.removeEventListener(n,a,!1):t&&n&&a&&t.detachEvent("on"+n,a)}const M=typeof window!="undefined",g=Symbol("@@clickoutside"),N=new Map;let y,V=0,z=!0;function b(t,n,a){return M&&z&&(z=!1,h(document,"mousedown",r=>{y=r}),h(document,"mouseup",r=>{for(const[s,o]of N)o[g].documentHandler(r,y)})),function(r,s){!a||!n.instance||!r.target||!s.target||t.contains(r.target)||t.contains(s.target)||t===r.target||t[g].bindingFn&&t[g].bindingFn()}}const D={beforeMount:function(t,n,a){V++,N.set(V,t),t[g]={nid:V,documentHandler:b(t,n,a),bindingFn:n.value}},updated:function(t,n,a){t[g].documentHandler=b(t,n,a),t[g].bindingFn=n.value},unmounted:function(t){N.delete(t[g].nid),delete t[g]}};var H=e.defineComponent({directives:{clickoutside:D},props:{currentPageSize:Number,pageSizeChange:Function,pageSizeOptions:Array},setup(){const t=e.ref(null),n=e.ref(!1);e.onMounted(()=>{h(t.value,"click",a)}),e.onUnmounted(()=>{j(t.value,"click",a)});const a=r=>{n.value=n.value?!1:!!r};return{paginationConfig:t,isShowConfig:n,closeConfigMenu:a}},render(){var i;const{closeConfigMenu:t,currentPageSize:n,pageSizeChange:a,pageSizeOptions:r,isShowConfig:s,$slots:o}=this;return e.withDirectives(e.createVNode("div",{class:"devui-pagination-config",ref:"paginationConfig"},[e.createVNode("div",{class:"devui-setup-icon"},[e.createVNode("i",{class:"icon-setting",style:"font-weight: bold;"},null)]),s&&e.createVNode("div",{class:"devui-config-container"},[(i=o.default)==null?void 0:i.call(o),e.createVNode("div",{class:"pagination-config-item"},[e.createVNode("div",{class:"config-item-title"},[e.createTextVNode("\u6BCF\u9875\u6761\u6570")]),e.createVNode("div",{class:"devui-page-number"},[r.map(c=>e.createVNode("div",{class:{choosed:c===n},key:c,onClick:a.bind(null,{value:c})},[c]))])])])]),[[e.resolveDirective("clickoutside"),t]])}});const O={goToText:String,size:{type:String,default:""},pageIndex:Number,showJumpButton:Boolean,totalPages:Number,cursor:Number,onChangeCursorEmit:Function};var J=e.defineComponent({props:O,emits:["changeCursorEmit"],setup(t,{emit:n}){const{pageIndex:a,totalPages:r,cursor:s}=e.toRefs(t),o=e.ref(a.value);e.watch(()=>a.value,l=>{o.value=l});let i=a.value;return{inputNum:o,jumpPageChange:l=>{i=+l,o.value=l,isNaN(l)&&setTimeout(()=>{o.value=a.value},300)},jump:l=>{i>r.value||(l==="btn"||l.key==="Enter")&&s.value!==i&&n("changeCursorEmit",i)}}},render(){const{goToText:t,size:n,inputNum:a,jumpPageChange:r,jump:s,showJumpButton:o}=this;return e.createVNode("div",{class:"devui-jump-container"},[t,e.createVNode(e.resolveComponent("d-input"),{class:["devui-pagination-input",n?"devui-pagination-input-"+n:""],size:n,modelValue:String(a),"onUpdate:modelValue":r,onKeydown:s},null),t==="\u8DF3\u81F3"&&"\u9875",o&&e.createVNode("div",{class:["devui-jump-button",n?"devui-jump-size-"+n:"devui-jump-size-default"],onClick:s.bind(null,"btn"),title:t},[e.createVNode("div",{class:"devui-pagination-go"},null)])])}});const A={size:{type:String,default:""},preLink:String,nextLink:String,lite:Boolean,cursor:Number,maxItems:Number,totalPages:Number,onChangeCursorEmit:Function,showTruePageIndex:Boolean};var U=e.defineComponent({props:A,emits:["changeCursorEmit"],setup(t,{emit:n}){return{showPageNum:e.computed(()=>F(t.cursor,t.maxItems,t.totalPages)),changeCursor:i=>{if(isNaN(i))return;const c=i<1?1:i>t.totalPages?t.totalPages:i|0;n("changeCursorEmit",c)},prevChange:i=>{if(t.cursor>1){const c=i===-1?t.cursor-1:i;n("changeCursorEmit",c)}},nextChange:i=>{if(t.cursor<t.totalPages){const c=i===-1?t.cursor+1:i;n("changeCursorEmit",c)}}}},render(){const{size:t,preLink:n,nextLink:a,lite:r,changeCursor:s,cursor:o,showPageNum:i,prevChange:c,totalPages:d,nextChange:l,showTruePageIndex:P}=this;return e.createVNode("ul",{class:["devui-pagination-list",t?"devui-pagination-"+t:""]},[e.createVNode("li",{onClick:c.bind(null,-1),class:{"devui-pagination-item":!0,disabled:o<=1}},[e.createVNode("a",{innerHTML:n,class:"devui-pagination-link"},null)]),!r&&e.createVNode(e.Fragment,null,[e.createVNode("li",{onClick:s.bind(null,1),class:{"devui-pagination-item":!0,active:o===1}},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("1")])]),i[0]>2&&e.createVNode("li",{onClick:c.bind(null,i[0]-1),class:"devui-pagination-item"},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("...")])]),(()=>{const C=[];for(let p=i[0];p<=i[1];p++)C.push(e.createVNode("li",{onClick:s.bind(null,p),key:p,class:{"devui-pagination-item":!0,active:o===p}},[e.createVNode("a",{class:"devui-pagination-link"},[p])]));return C})(),i[1]<d-1&&e.createVNode("li",{onClick:l.bind(null,i[1]+1),class:"devui-pagination-item"},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("...")])]),i[1]<d&&e.createVNode("li",{onClick:s.bind(null,d),class:{"devui-pagination-item":!0,active:o===d}},[e.createVNode("a",{class:"devui-pagination-link"},[d])]),P&&o>d&&d>0&&e.createVNode(e.Fragment,null,[o>d+1&&e.createVNode("li",{class:"devui-pagination-item disabled"},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("...")])]),e.createVNode("li",{class:"devui-pagination-item disabled active"},[e.createVNode("a",{class:"devui-pagination-link"},[o])])])]),e.createVNode("li",{onClick:l.bind(null,-1),class:{"devui-pagination-item":!0,disabled:o>=d}},[e.createVNode("a",{innerHTML:a,class:"devui-pagination-link"},null)])])}}),X="",m=e.defineComponent({name:"DPagination",components:{ConfigMenu:H,JumpPage:J,PageNumBtn:U},props:E,emits:["pageIndexChange","pageSizeChange","update:pageSize","update:pageIndex"],setup(t,{emit:n}){const a=e.computed(()=>L(o.value)),r=e.computed({get(){return!t.showTruePageIndex&&t.pageIndex>o.value?(n("update:pageIndex",o.value||1),o.value||1):t.pageIndex||1},set(l){n("update:pageIndex",l)}}),s=e.computed({get(){return t.pageSize},set(l){n("update:pageSize",l)}}),o=e.computed(()=>Math.ceil(t.total/t.pageSize)),i=l=>{r.value=l,n("pageIndexChange",l)};return{cursor:r,totalPages:o,changeCursorEmit:i,currentPageSize:s,pageSizeChange:l=>{s.value=l.value,t.autoFixPageIndex&&e.nextTick(()=>{r.value>o.value&&i(o.value)}),n("pageSizeChange",l.value)},litePageOptions:a,litePageIndexChange:l=>{i(l.value)}}},render(){const{total:t,pageIndex:n,pageSizeOptions:a,pageSizeDirection:r,preLink:s,nextLink:o,size:i,canJumpPage:c,canChangePageSize:d,canViewTotal:l,totalItemText:P,goToText:C,maxItems:p,showJumpButton:q,showTruePageIndex:K,lite:f,showPageSelector:k,haveConfigMenu:R,autoHide:G,$slots:x,cursor:S,totalPages:v,currentPageSize:T,pageSizeChange:I,changeCursorEmit:w,litePageOptions:Q,litePageIndexChange:W}=this;return G&&Math.min(...a)>t?null:e.createVNode("div",{class:"devui-pagination"},[d&&!f&&e.createVNode("div",{class:["devui-page-size",i?"devui-page-size-"+i:""]},[e.createVNode(e.resolveComponent("d-select"),{options:a,modelValue:T,onValueChange:I,pageSizeDirection:r},null)]),(!f||f&&k)&&l&&e.createVNode("div",{class:"devui-total-size"},[P,e.createTextVNode(": "),t]),f&&k&&e.createVNode("div",{class:"devui-page-size"},[e.createVNode(e.resolveComponent("d-select"),{options:Q,disabled:t===0,modelValue:S,onValueChange:W,pageSizeDirection:r},null)]),e.createVNode(e.resolveComponent("page-num-btn"),e.mergeProps({cursor:S,totalPages:v,size:i,lite:f,maxItems:p,preLink:s,nextLink:o,showTruePageIndex:K},{onChangeCursorEmit:w}),null),c&&!f&&e.createVNode(e.resolveComponent("jump-page"),e.mergeProps({goToText:C,size:i,pageIndex:n,totalPages:v,cursor:S,showJumpButton:q},{onChangeCursorEmit:w}),null),f&&R&&e.createVNode(e.resolveComponent("config-menu"),{currentPageSize:T,pageSizeChange:I,pageSizeOptions:a},{default:()=>{var B;return[(B=x.default)==null?void 0:B.call(x)]}})])}});m.install=t=>{t.component(m.name,m)};var _={title:"Pagination \u5206\u9875",category:"\u5BFC\u822A",status:"100%",install(t){t.use(m)}};u.Pagination=m,u.default=_,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
|
package/panel/index.d.ts
ADDED
package/panel/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive, ref, defineComponent, provide,
|
|
1
|
+
import { reactive, ref, defineComponent, provide, computed, createVNode, inject, onMounted, Transition } from "vue";
|
|
2
2
|
var panel = "";
|
|
3
3
|
const PanelProps = {
|
|
4
4
|
type: {
|
|
@@ -11,7 +11,7 @@ const PanelProps = {
|
|
|
11
11
|
},
|
|
12
12
|
isCollapsed: {
|
|
13
13
|
type: Boolean,
|
|
14
|
-
default:
|
|
14
|
+
default: false
|
|
15
15
|
},
|
|
16
16
|
beforeToggle: {
|
|
17
17
|
type: Function,
|
|
@@ -47,28 +47,23 @@ var Panel = defineComponent({
|
|
|
47
47
|
props: PanelProps,
|
|
48
48
|
setup(props, ctx) {
|
|
49
49
|
provide("beforeToggle", props.beforeToggle);
|
|
50
|
-
provide("showAnimation", props.showAnimation);
|
|
51
|
-
provide("hasLeftPadding", props.hasLeftPadding);
|
|
50
|
+
provide("showAnimation", computed(() => props.showAnimation));
|
|
51
|
+
provide("hasLeftPadding", computed(() => props.hasLeftPadding));
|
|
52
52
|
const isCollapsed = ref(props.isCollapsed);
|
|
53
|
-
const
|
|
53
|
+
const type = computed(() => props.type);
|
|
54
|
+
const cssClass = computed(() => props.cssClass);
|
|
54
55
|
const onToggle = () => {
|
|
55
56
|
var _a;
|
|
56
57
|
(_a = props.toggle) == null ? void 0 : _a.call(props, Store.getByKey(`isCollapsed[${timeStamp}]`));
|
|
57
58
|
};
|
|
58
|
-
onMounted(() => {
|
|
59
|
-
if (bodyEl.value) {
|
|
60
|
-
const dom = bodyEl.value;
|
|
61
|
-
if (isCollapsed.value)
|
|
62
|
-
dom.style.height = `${dom.offsetHeight}px`;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
59
|
const timeStamp = new Date().getTime().toString();
|
|
66
60
|
Store.setData(`isCollapsed[${timeStamp}]`, isCollapsed.value);
|
|
67
61
|
return () => {
|
|
62
|
+
var _a, _b;
|
|
68
63
|
return createVNode("div", {
|
|
69
64
|
"onClick": onToggle,
|
|
70
|
-
"class": `devui-panel devui-panel-${
|
|
71
|
-
}, [ctx.slots.default()]);
|
|
65
|
+
"class": `devui-panel devui-panel-${type.value} ${cssClass.value}`
|
|
66
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
72
67
|
};
|
|
73
68
|
}
|
|
74
69
|
});
|
|
@@ -80,6 +75,8 @@ var PanelHeader = defineComponent({
|
|
|
80
75
|
const keys = Object.keys(Store.state());
|
|
81
76
|
const key = keys.pop();
|
|
82
77
|
const isCollapsed = ref(Store.state()[key]);
|
|
78
|
+
let changeFlag = ref();
|
|
79
|
+
let header = null;
|
|
83
80
|
const canToggle = () => {
|
|
84
81
|
let changeResult = Promise.resolve(true);
|
|
85
82
|
if (beforeToggle) {
|
|
@@ -94,28 +91,34 @@ var PanelHeader = defineComponent({
|
|
|
94
91
|
}
|
|
95
92
|
return changeResult;
|
|
96
93
|
};
|
|
94
|
+
canToggle().then((val) => changeFlag.value = val);
|
|
97
95
|
const toggleBody = () => {
|
|
98
96
|
canToggle().then((val) => {
|
|
99
|
-
var _a;
|
|
97
|
+
var _a, _b;
|
|
98
|
+
changeFlag.value = val;
|
|
100
99
|
if (!val) {
|
|
100
|
+
if (!isCollapsed.value) {
|
|
101
|
+
Store.setData(`${key}`, !isCollapsed.value);
|
|
102
|
+
isCollapsed.value = !isCollapsed.value;
|
|
103
|
+
(_a = props.toggle) == null ? void 0 : _a.call(props, isCollapsed.value);
|
|
104
|
+
}
|
|
101
105
|
return;
|
|
102
106
|
}
|
|
103
107
|
if (isCollapsed.value !== void 0) {
|
|
104
108
|
Store.setData(`${key}`, !isCollapsed.value);
|
|
105
109
|
isCollapsed.value = !isCollapsed.value;
|
|
106
|
-
(
|
|
110
|
+
(_b = props.toggle) == null ? void 0 : _b.call(props, isCollapsed.value);
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
113
|
};
|
|
110
114
|
return () => {
|
|
111
115
|
var _a, _b;
|
|
112
|
-
let header = null;
|
|
113
116
|
if (ctx.slots.default) {
|
|
114
117
|
header = createVNode("div", {
|
|
115
118
|
"class": "devui-panel-heading",
|
|
116
119
|
"onClick": toggleBody,
|
|
117
120
|
"style": {
|
|
118
|
-
"cursor":
|
|
121
|
+
"cursor": changeFlag.value ? "pointer" : "auto"
|
|
119
122
|
}
|
|
120
123
|
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
121
124
|
}
|
|
@@ -127,8 +130,8 @@ var PanelBody = defineComponent({
|
|
|
127
130
|
name: "DPanelBody",
|
|
128
131
|
props: PanelProps,
|
|
129
132
|
setup(props, ctx) {
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
let animationName = inject("showAnimation");
|
|
134
|
+
let hasLeftPadding = inject("hasLeftPadding");
|
|
132
135
|
const keys = Object.keys(Store.state());
|
|
133
136
|
const key = keys.pop();
|
|
134
137
|
const isCollapsed = Store.state();
|
|
@@ -156,7 +159,7 @@ var PanelBody = defineComponent({
|
|
|
156
159
|
return createVNode("div", {
|
|
157
160
|
"class": `devui-panel devui-panel-${props.type} ${props.cssClass}`
|
|
158
161
|
}, [createVNode(Transition, {
|
|
159
|
-
"name": animationName,
|
|
162
|
+
"name": animationName.value ? "devui-panel" : "",
|
|
160
163
|
"onEnter": enter,
|
|
161
164
|
"onLeave": leave
|
|
162
165
|
}, {
|
|
@@ -164,7 +167,7 @@ var PanelBody = defineComponent({
|
|
|
164
167
|
var _a, _b;
|
|
165
168
|
return [isCollapsed[key] === void 0 || isCollapsed[key] ? createVNode("div", {
|
|
166
169
|
"ref": bodyEl,
|
|
167
|
-
"class": `devui-panel-body ${isCollapsed[key] !== void 0 ? "devui-panel-body-collapse" : ""} ${hasLeftPadding}`
|
|
170
|
+
"class": `devui-panel-body ${isCollapsed[key] !== void 0 ? "devui-panel-body-collapse" : ""} ${!hasLeftPadding.value ? "no-left-padding" : ""}`
|
|
168
171
|
}, [createVNode("div", {
|
|
169
172
|
"class": "devui-panel-content"
|
|
170
173
|
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]) : null];
|