@opentinyvue/vue-drawer 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/index.d.ts +2 -0
- package/lib/index.js +184 -0
- package/lib/mobile-first.js +189 -0
- package/lib/pc.js +233 -0
- package/package.json +19 -0
- package/src/index.d.ts +75 -0
- package/src/mobile-first.vue.d.ts +2 -0
- package/src/pc.vue.d.ts +2 -0
- package/src/service.d.ts +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - present TinyVue Authors.
|
|
4
|
+
Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
3
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
4
|
+
var t = arguments[e];
|
|
5
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
6
|
+
}
|
|
7
|
+
return n;
|
|
8
|
+
}, _extends.apply(null, arguments);
|
|
9
|
+
}
|
|
10
|
+
import { defineComponent, $prefix, $setup, $props, createComponent, appProperties, hooks, setupComponent } from "@opentinyvue/vue-common";
|
|
11
|
+
import PcTemplate from "./pc.js";
|
|
12
|
+
import MobileFirstTemplate from "./mobile-first.js";
|
|
13
|
+
var template = function template2(mode) {
|
|
14
|
+
var _process$env;
|
|
15
|
+
var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
|
|
16
|
+
if ("pc" === (tinyMode || mode)) {
|
|
17
|
+
return PcTemplate;
|
|
18
|
+
}
|
|
19
|
+
if ("mobile-first" === (tinyMode || mode)) {
|
|
20
|
+
return MobileFirstTemplate;
|
|
21
|
+
}
|
|
22
|
+
return PcTemplate;
|
|
23
|
+
};
|
|
24
|
+
var $constants = {
|
|
25
|
+
SCROLL_LOCK_CLASS: function SCROLL_LOCK_CLASS(mode) {
|
|
26
|
+
var scrollLockClasses = {
|
|
27
|
+
"mobile-first": "overflow-hidden",
|
|
28
|
+
"pc": "popup-parent--hidden dialog-box__scroll-lock"
|
|
29
|
+
};
|
|
30
|
+
return scrollLockClasses[mode] || "";
|
|
31
|
+
},
|
|
32
|
+
DEFAULT_WIDTH: "500px",
|
|
33
|
+
DEFAULT_HEIGHT: "100vh"
|
|
34
|
+
};
|
|
35
|
+
var drawerProps = _extends({}, $props, {
|
|
36
|
+
_constants: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default: function _default() {
|
|
39
|
+
return $constants;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
visible: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
customClass: [String, Object, Array],
|
|
47
|
+
placement: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "right"
|
|
50
|
+
},
|
|
51
|
+
width: {
|
|
52
|
+
type: String
|
|
53
|
+
},
|
|
54
|
+
height: {
|
|
55
|
+
type: String
|
|
56
|
+
},
|
|
57
|
+
title: String,
|
|
58
|
+
showClose: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
showHeader: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
showFooter: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
mask: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: true
|
|
73
|
+
},
|
|
74
|
+
maskClosable: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: true
|
|
77
|
+
},
|
|
78
|
+
dragable: Boolean,
|
|
79
|
+
lockScroll: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: true
|
|
82
|
+
},
|
|
83
|
+
flex: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
zIndex: {
|
|
88
|
+
type: Number,
|
|
89
|
+
default: 2e3
|
|
90
|
+
},
|
|
91
|
+
beforeClose: Function,
|
|
92
|
+
tipsProps: Object,
|
|
93
|
+
// tiny 新增:用于方法调用组件
|
|
94
|
+
customSlots: Object
|
|
95
|
+
});
|
|
96
|
+
var Drawer = defineComponent({
|
|
97
|
+
name: $prefix + "Drawer",
|
|
98
|
+
props: drawerProps,
|
|
99
|
+
setup: function setup(props, context) {
|
|
100
|
+
return $setup({
|
|
101
|
+
props,
|
|
102
|
+
context,
|
|
103
|
+
template
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
var defaultConfigs = {
|
|
108
|
+
customClass: null,
|
|
109
|
+
placement: "right",
|
|
110
|
+
width: null,
|
|
111
|
+
height: null,
|
|
112
|
+
title: "",
|
|
113
|
+
showClose: true,
|
|
114
|
+
showHeader: true,
|
|
115
|
+
showFooter: false,
|
|
116
|
+
mask: true,
|
|
117
|
+
maskClosable: true,
|
|
118
|
+
dragable: false,
|
|
119
|
+
lockScroll: true,
|
|
120
|
+
flex: false,
|
|
121
|
+
zIndex: 2e3,
|
|
122
|
+
beforeClose: null,
|
|
123
|
+
tipsProps: null
|
|
124
|
+
};
|
|
125
|
+
var service = function service2(configs) {
|
|
126
|
+
var _appProperties$tiny_m;
|
|
127
|
+
if (configs === void 0) {
|
|
128
|
+
configs = {};
|
|
129
|
+
}
|
|
130
|
+
var events = {
|
|
131
|
+
onOpen: function onOpen(params) {
|
|
132
|
+
var _configs$events;
|
|
133
|
+
if (typeof ((_configs$events = configs.events) == null ? void 0 : _configs$events.open) === "function") {
|
|
134
|
+
configs.events.open(params);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
onClose: function onClose(params) {
|
|
138
|
+
var _configs$events2;
|
|
139
|
+
if (typeof ((_configs$events2 = configs.events) == null ? void 0 : _configs$events2.close) === "function") {
|
|
140
|
+
configs.events.close(params);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
onConfirm: function onConfirm(params) {
|
|
144
|
+
var _configs$events3;
|
|
145
|
+
if (typeof ((_configs$events3 = configs.events) == null ? void 0 : _configs$events3.confirm) === "function") {
|
|
146
|
+
configs.events.confirm(params);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var options = _extends({}, defaultConfigs, configs, events);
|
|
151
|
+
var instance = createComponent({
|
|
152
|
+
component: Drawer,
|
|
153
|
+
propsData: _extends({}, options, {
|
|
154
|
+
_constants: $constants,
|
|
155
|
+
tiny_mode: configs.tiny_mode || ((_appProperties$tiny_m = appProperties().tiny_mode) == null ? void 0 : _appProperties$tiny_m.value)
|
|
156
|
+
}),
|
|
157
|
+
el: document.createElement("div")
|
|
158
|
+
});
|
|
159
|
+
var parent = document.body;
|
|
160
|
+
parent.appendChild(instance.$el);
|
|
161
|
+
hooks.nextTick(function() {
|
|
162
|
+
instance.open();
|
|
163
|
+
});
|
|
164
|
+
return instance;
|
|
165
|
+
};
|
|
166
|
+
var version = "2.21.0";
|
|
167
|
+
Drawer.model = {
|
|
168
|
+
prop: "visible",
|
|
169
|
+
event: "update:visible"
|
|
170
|
+
};
|
|
171
|
+
Drawer.service = service;
|
|
172
|
+
Drawer.install = function(Vue) {
|
|
173
|
+
Vue.component(Drawer.name, Drawer);
|
|
174
|
+
};
|
|
175
|
+
Drawer.version = version;
|
|
176
|
+
setupComponent.TINYDrawer = {
|
|
177
|
+
init: function init(root) {
|
|
178
|
+
var prefix = root.$apiPrefix || "$";
|
|
179
|
+
root[prefix + "drawer"] = service;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
export {
|
|
183
|
+
Drawer as default
|
|
184
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/drawer/vue';
|
|
2
|
+
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import { IconClose } from '@opentinyvue/vue-icon';
|
|
4
|
+
import Button from '@opentinyvue/vue-button';
|
|
5
|
+
|
|
6
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
7
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
8
|
+
if (render) {
|
|
9
|
+
options.render = render;
|
|
10
|
+
options.staticRenderFns = staticRenderFns;
|
|
11
|
+
options._compiled = true;
|
|
12
|
+
}
|
|
13
|
+
var hook;
|
|
14
|
+
if (injectStyles) {
|
|
15
|
+
hook = injectStyles;
|
|
16
|
+
}
|
|
17
|
+
if (hook) {
|
|
18
|
+
if (options.functional) {
|
|
19
|
+
options._injectStyles = hook;
|
|
20
|
+
var originalRender = options.render;
|
|
21
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
22
|
+
hook.call(context);
|
|
23
|
+
return originalRender(h, context);
|
|
24
|
+
};
|
|
25
|
+
} else {
|
|
26
|
+
var existing = options.beforeCreate;
|
|
27
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
exports: scriptExports,
|
|
32
|
+
options
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var __vue2_script = defineComponent({
|
|
37
|
+
components: {
|
|
38
|
+
TinyButton: Button,
|
|
39
|
+
IconClose: IconClose()
|
|
40
|
+
},
|
|
41
|
+
props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable", "lockScroll", "flex", "beforeClose"]),
|
|
42
|
+
emits: ["update:visible", "open", "close", "confirm"],
|
|
43
|
+
setup: function setup$1(props2, context) {
|
|
44
|
+
return setup({
|
|
45
|
+
props: props2,
|
|
46
|
+
context,
|
|
47
|
+
renderless,
|
|
48
|
+
api
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var render = function render2() {
|
|
53
|
+
var _vm = this;
|
|
54
|
+
var _h = _vm.$createElement;
|
|
55
|
+
var _c = _vm._self._c || _h;
|
|
56
|
+
return _c("div", {
|
|
57
|
+
directives: [{
|
|
58
|
+
name: "show",
|
|
59
|
+
rawName: "v-show",
|
|
60
|
+
value: _vm.visible,
|
|
61
|
+
expression: "visible"
|
|
62
|
+
}],
|
|
63
|
+
staticClass: "text-sm",
|
|
64
|
+
attrs: {
|
|
65
|
+
"data-tag": "tiny-drawer"
|
|
66
|
+
}
|
|
67
|
+
}, [_vm.mask ? _c("div", {
|
|
68
|
+
ref: "mask",
|
|
69
|
+
class: _vm.m("fixed z-50 left-0 right-0 top-0 bottom-0 w-full h-full transition ease-linear duration-200", {
|
|
70
|
+
"bg-color-bg-7": _vm.state.visible
|
|
71
|
+
}),
|
|
72
|
+
on: {
|
|
73
|
+
"click": function click($event) {
|
|
74
|
+
return _vm.handleClose("mask");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}) : _vm._e(), _c("div", {
|
|
78
|
+
ref: "drawerBox",
|
|
79
|
+
class: _vm.m("fixed w-full max-w-full flex flex-col bg-color-bg-1 z-50 shadow-sm border-color-border-separator", {
|
|
80
|
+
"transition-all ease-linear duration-200": !_vm.state.dragEvent.isDrag
|
|
81
|
+
}, {
|
|
82
|
+
"h-full": ["left", "right"].includes(_vm.placement)
|
|
83
|
+
}, {
|
|
84
|
+
"max-h-full": ["top", "bottom"].includes(_vm.placement)
|
|
85
|
+
}, {
|
|
86
|
+
"left-0 bottom-0 translate-y-full border-t-0.5 rounded-t-lg": _vm.placement === "bottom"
|
|
87
|
+
}, {
|
|
88
|
+
"left-0 top-0 -translate-y-full border-b-0.5 rounded-b-lg": _vm.placement === "top"
|
|
89
|
+
}, {
|
|
90
|
+
"translate-y-0": ["top", "bottom"].includes(_vm.placement) && _vm.state.visible
|
|
91
|
+
}, {
|
|
92
|
+
"left-0 top-0 -translate-x-full border-r-0.5 rounded-r-lg": _vm.placement === "left"
|
|
93
|
+
}, {
|
|
94
|
+
"right-0 top-0 translate-x-full border-l-0.5 rounded-l-lg": _vm.placement === "right"
|
|
95
|
+
}, {
|
|
96
|
+
"translate-x-0": ["left", "right"].includes(_vm.placement) && _vm.state.visible
|
|
97
|
+
}, _vm.customClass),
|
|
98
|
+
style: {
|
|
99
|
+
width: ["left", "right"].includes(_vm.placement) ? _vm.state.computedWidth : null,
|
|
100
|
+
height: ["top", "bottom"].includes(_vm.placement) && _vm.dragable && _vm.state.height ? _vm.state.height + "px" : null
|
|
101
|
+
},
|
|
102
|
+
attrs: {
|
|
103
|
+
"data-tag": "tiny-drawer-main"
|
|
104
|
+
}
|
|
105
|
+
}, [_vm.dragable ? _c("div", {
|
|
106
|
+
ref: "dragBar",
|
|
107
|
+
class: ["absolute", ["left", "right"].includes(_vm.placement) && "cursor-e-resize h-full top-0 w-2", ["top", "bottom"].includes(_vm.placement) && "cursor-n-resize w-full h-2 left-0", _vm.placement === "left" && "-right-1", _vm.placement === "right" && "-left-1", _vm.placement === "top" && "-bottom-1", _vm.placement === "bottom" && "-top-1"],
|
|
108
|
+
attrs: {
|
|
109
|
+
"data-tag": "drawer-drag-bar"
|
|
110
|
+
}
|
|
111
|
+
}) : _vm._e(), _c("div", {
|
|
112
|
+
class: ["flex-auto flex-col flex max-h-full overflow-hidden"]
|
|
113
|
+
}, [_vm.showHeader ? _c("div", {
|
|
114
|
+
ref: "header",
|
|
115
|
+
staticClass: "flex-none flex leading-6 p-4 text-base items-center",
|
|
116
|
+
attrs: {
|
|
117
|
+
"data-tag": "drawer-header"
|
|
118
|
+
}
|
|
119
|
+
}, [_vm._t("header", function() {
|
|
120
|
+
return [_vm.title ? _c("div", {
|
|
121
|
+
staticClass: "max-w-[80%] pr-4 text-left truncate text-color-text-primary"
|
|
122
|
+
}, [_vm._v(_vm._s(_vm.title))]) : _vm._e(), _c("div", {
|
|
123
|
+
staticClass: "flex-1 flex items-center justify-end"
|
|
124
|
+
}, [_vm._t("header-right", function() {
|
|
125
|
+
return [_c("IconClose", {
|
|
126
|
+
staticClass: "fill-color-icon-primary",
|
|
127
|
+
attrs: {
|
|
128
|
+
"custom-class": "h-5 w-5 cursor-pointer"
|
|
129
|
+
},
|
|
130
|
+
on: {
|
|
131
|
+
"click": function click($event) {
|
|
132
|
+
return _vm.handleClose("close");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
})];
|
|
136
|
+
})], 2)];
|
|
137
|
+
})], 2) : _vm._e(), _c("div", {
|
|
138
|
+
ref: "body",
|
|
139
|
+
class: ["flex-auto overflow-auto", {
|
|
140
|
+
"flex flex-col": _vm.flex
|
|
141
|
+
}],
|
|
142
|
+
attrs: {
|
|
143
|
+
"data-tag": "drawer-body"
|
|
144
|
+
}
|
|
145
|
+
}, [_vm._t("default")], 2), _vm.showFooter ? _c("div", {
|
|
146
|
+
ref: "footer",
|
|
147
|
+
staticClass: "px-4 py-3",
|
|
148
|
+
attrs: {
|
|
149
|
+
"data-tag": "drawer-footer"
|
|
150
|
+
}
|
|
151
|
+
}, [_c("div", {
|
|
152
|
+
staticClass: "flex-1 text-right"
|
|
153
|
+
}, [_vm._t("footer", function() {
|
|
154
|
+
return [_c("tiny-button", {
|
|
155
|
+
attrs: {
|
|
156
|
+
"tiny_mode": "mobile-first"
|
|
157
|
+
},
|
|
158
|
+
on: {
|
|
159
|
+
"click": function click($event) {
|
|
160
|
+
return _vm.handleClose("cancel");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, [_vm._v(_vm._s(_vm.t("ui.button.cancel")))]), _c("tiny-button", {
|
|
164
|
+
staticClass: "ml-2",
|
|
165
|
+
attrs: {
|
|
166
|
+
"tiny_mode": "mobile-first",
|
|
167
|
+
"type": "primary"
|
|
168
|
+
},
|
|
169
|
+
on: {
|
|
170
|
+
"click": function click($event) {
|
|
171
|
+
return _vm.handleClose("confirm");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, [_vm._v(_vm._s(_vm.t("ui.button.confirm")))])];
|
|
175
|
+
})], 2)]) : _vm._e()])])]);
|
|
176
|
+
};
|
|
177
|
+
var staticRenderFns = [];
|
|
178
|
+
var __cssModules = {};
|
|
179
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
180
|
+
function __vue2_injectStyles(context) {
|
|
181
|
+
for (var o in __cssModules) {
|
|
182
|
+
this[o] = __cssModules[o];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
var mobileFirst = /* @__PURE__ */ function() {
|
|
186
|
+
return __component__.exports;
|
|
187
|
+
}();
|
|
188
|
+
|
|
189
|
+
export { mobileFirst as default };
|
package/lib/pc.js
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/drawer/vue';
|
|
2
|
+
import { defineComponent, h, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import '@opentinyvue/vue-theme/drawer/index.css';
|
|
4
|
+
import { iconClose, iconHelpCircle } from '@opentinyvue/vue-icon';
|
|
5
|
+
import Button from '@opentinyvue/vue-button';
|
|
6
|
+
import Tooltip from '@opentinyvue/vue-tooltip';
|
|
7
|
+
|
|
8
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
9
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
10
|
+
if (render) {
|
|
11
|
+
options.render = render;
|
|
12
|
+
options.staticRenderFns = staticRenderFns;
|
|
13
|
+
options._compiled = true;
|
|
14
|
+
}
|
|
15
|
+
var hook;
|
|
16
|
+
if (injectStyles) {
|
|
17
|
+
hook = injectStyles;
|
|
18
|
+
}
|
|
19
|
+
if (hook) {
|
|
20
|
+
if (options.functional) {
|
|
21
|
+
options._injectStyles = hook;
|
|
22
|
+
var originalRender = options.render;
|
|
23
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
24
|
+
hook.call(context);
|
|
25
|
+
return originalRender(h, context);
|
|
26
|
+
};
|
|
27
|
+
} else {
|
|
28
|
+
var existing = options.beforeCreate;
|
|
29
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
exports: scriptExports,
|
|
34
|
+
options
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var __vue2_script = defineComponent({
|
|
39
|
+
components: {
|
|
40
|
+
TinyButton: Button,
|
|
41
|
+
TinyTooltip: Tooltip,
|
|
42
|
+
IconClose: iconClose(),
|
|
43
|
+
IconHelpCircle: iconHelpCircle(),
|
|
44
|
+
// tiny新增: 适配Vue2下, 在模板中渲染VNode
|
|
45
|
+
SlotWrapper: {
|
|
46
|
+
props: ["node"],
|
|
47
|
+
render: function render() {
|
|
48
|
+
var node = this.node;
|
|
49
|
+
if (typeof node === "function") {
|
|
50
|
+
return node(h);
|
|
51
|
+
} else {
|
|
52
|
+
return node;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "height", "mask", "dragable", "maskClosable", "lockScroll", "flex", "showClose", "zIndex", "beforeClose", "tipsProps", "customSlots"]),
|
|
58
|
+
emits: ["update:visible", "open", "close", "confirm", "drag"],
|
|
59
|
+
setup: function setup$1(props2, context) {
|
|
60
|
+
return setup({
|
|
61
|
+
props: props2,
|
|
62
|
+
context,
|
|
63
|
+
renderless,
|
|
64
|
+
api
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
var render2 = function render3() {
|
|
69
|
+
var _vm = this;
|
|
70
|
+
var _h = _vm.$createElement;
|
|
71
|
+
var _c = _vm._self._c || _h;
|
|
72
|
+
return _c("div", {
|
|
73
|
+
staticClass: "tiny-drawer",
|
|
74
|
+
attrs: {
|
|
75
|
+
"data-tag": "tiny-drawer"
|
|
76
|
+
}
|
|
77
|
+
}, [_c("transition", {
|
|
78
|
+
attrs: {
|
|
79
|
+
"name": "drawer-fade"
|
|
80
|
+
}
|
|
81
|
+
}, [_vm.mask && _vm.state.visible ? _c("div", {
|
|
82
|
+
ref: "mask",
|
|
83
|
+
staticClass: "tiny-drawer__mask show-bg-color",
|
|
84
|
+
style: {
|
|
85
|
+
zIndex: _vm.zIndex
|
|
86
|
+
},
|
|
87
|
+
on: {
|
|
88
|
+
"click": function click($event) {
|
|
89
|
+
return _vm.handleClose("mask");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}) : _vm._e()]), _c("transition", {
|
|
93
|
+
attrs: {
|
|
94
|
+
"name": "drawer-slide-" + _vm.placement
|
|
95
|
+
}
|
|
96
|
+
}, [_c("div", {
|
|
97
|
+
directives: [{
|
|
98
|
+
name: "show",
|
|
99
|
+
rawName: "v-show",
|
|
100
|
+
value: _vm.state.visible,
|
|
101
|
+
expression: "state.visible"
|
|
102
|
+
}],
|
|
103
|
+
ref: "drawerBox",
|
|
104
|
+
class: ["tiny-drawer__main", {
|
|
105
|
+
"is-left": _vm.placement === "left",
|
|
106
|
+
"is-right": _vm.placement === "right",
|
|
107
|
+
"is-top": _vm.placement === "top",
|
|
108
|
+
"is-bottom": _vm.placement === "bottom",
|
|
109
|
+
"drag-effects": !_vm.state.dragEvent.isDrag,
|
|
110
|
+
"toggle": _vm.state.visible
|
|
111
|
+
}, "tiny-drawer-main", _vm.customClass],
|
|
112
|
+
style: {
|
|
113
|
+
width: ["left", "right"].includes(_vm.placement) ? _vm.state.computedWidth : null,
|
|
114
|
+
height: ["top", "bottom", "left", "right"].includes(_vm.placement) || _vm.dragable ? _vm.state.computedHeight : null,
|
|
115
|
+
zIndex: _vm.zIndex
|
|
116
|
+
},
|
|
117
|
+
attrs: {
|
|
118
|
+
"data-tag": "tiny-drawer-main"
|
|
119
|
+
}
|
|
120
|
+
}, [_vm.dragable ? _c("div", {
|
|
121
|
+
ref: "dragBar",
|
|
122
|
+
class: ["tiny-drawer__drag-bar", ["left", "right"].includes(_vm.placement) && "p-left-Right", ["top", "bottom"].includes(_vm.placement) && "p-top-Bottom", _vm.placement === "left" && "p-left", _vm.placement === "right" && "p-right", _vm.placement === "top" && "p-top", _vm.placement === "bottom" && "p-bottom"],
|
|
123
|
+
attrs: {
|
|
124
|
+
"data-tag": "drawer-drag-bar"
|
|
125
|
+
}
|
|
126
|
+
}) : _vm._e(), _c("div", {
|
|
127
|
+
staticClass: "tiny-drawer__box"
|
|
128
|
+
}, [_vm.showHeader ? _c("div", {
|
|
129
|
+
ref: "header",
|
|
130
|
+
staticClass: "tiny-drawer__header-wrapper",
|
|
131
|
+
attrs: {
|
|
132
|
+
"data-tag": "drawer-header"
|
|
133
|
+
}
|
|
134
|
+
}, [_vm._t("header", function() {
|
|
135
|
+
var _vm$customSlots;
|
|
136
|
+
return [(_vm$customSlots = _vm.customSlots) !== null && _vm$customSlots !== void 0 && _vm$customSlots.header ? _c("slot-wrapper", {
|
|
137
|
+
attrs: {
|
|
138
|
+
"node": _vm.customSlots.header
|
|
139
|
+
}
|
|
140
|
+
}) : _c("div", {
|
|
141
|
+
staticClass: "tiny-drawer__header"
|
|
142
|
+
}, [_c("div", {
|
|
143
|
+
staticClass: "tiny-drawer__header-left"
|
|
144
|
+
}, [_vm.title ? _c("div", {
|
|
145
|
+
staticClass: "tiny-drawer__title"
|
|
146
|
+
}, [_vm._v(_vm._s(_vm.title))]) : _vm._e(), _vm.tipsProps ? _c("tiny-tooltip", _vm._b({}, "tiny-tooltip", _vm.tipsProps, false), [_c("icon-help-circle", {
|
|
147
|
+
staticClass: "tiny-drawer__help-icon"
|
|
148
|
+
})], 1) : _vm._e()], 1), _c("div", {
|
|
149
|
+
staticClass: "tiny-drawer__header-right"
|
|
150
|
+
}, [_vm._t("header-right", function() {
|
|
151
|
+
var _vm$customSlots2;
|
|
152
|
+
return [(_vm$customSlots2 = _vm.customSlots) !== null && _vm$customSlots2 !== void 0 && _vm$customSlots2.headerRight ? _c("slot-wrapper", {
|
|
153
|
+
attrs: {
|
|
154
|
+
"node": _vm.customSlots.headerRight
|
|
155
|
+
}
|
|
156
|
+
}) : _vm._e()];
|
|
157
|
+
})], 2)])];
|
|
158
|
+
}), _vm.showClose ? _c("button", {
|
|
159
|
+
staticClass: "tiny-drawer__headerbtn",
|
|
160
|
+
attrs: {
|
|
161
|
+
"type": "button",
|
|
162
|
+
"aria-label": "Close"
|
|
163
|
+
},
|
|
164
|
+
on: {
|
|
165
|
+
"click": function click($event) {
|
|
166
|
+
return _vm.handleClose("close");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, [_c("icon-close", {
|
|
170
|
+
staticClass: "tiny-svg-size tiny-drawer__close"
|
|
171
|
+
})], 1) : _vm._e()], 2) : _vm._e(), _c("div", {
|
|
172
|
+
ref: "body",
|
|
173
|
+
class: ["tiny-drawer__body", {
|
|
174
|
+
"flex flex-col": _vm.flex
|
|
175
|
+
}, "drawer-body"],
|
|
176
|
+
attrs: {
|
|
177
|
+
"data-tag": "drawer-body"
|
|
178
|
+
}
|
|
179
|
+
}, [_vm._t("default", function() {
|
|
180
|
+
var _vm$customSlots3;
|
|
181
|
+
return [_c("slot-wrapper", {
|
|
182
|
+
attrs: {
|
|
183
|
+
"node": (_vm$customSlots3 = _vm.customSlots) === null || _vm$customSlots3 === void 0 ? void 0 : _vm$customSlots3.default
|
|
184
|
+
}
|
|
185
|
+
})];
|
|
186
|
+
})], 2), _vm.showFooter ? _c("div", {
|
|
187
|
+
ref: "footer",
|
|
188
|
+
staticClass: "tiny-drawer__footer",
|
|
189
|
+
attrs: {
|
|
190
|
+
"data-tag": "drawer-footer"
|
|
191
|
+
}
|
|
192
|
+
}, [_vm._t("footer", function() {
|
|
193
|
+
var _vm$customSlots4;
|
|
194
|
+
return [(_vm$customSlots4 = _vm.customSlots) !== null && _vm$customSlots4 !== void 0 && _vm$customSlots4.footer ? _c("slot-wrapper", {
|
|
195
|
+
attrs: {
|
|
196
|
+
"node": _vm.customSlots.footer
|
|
197
|
+
}
|
|
198
|
+
}) : [_c("tiny-button", {
|
|
199
|
+
staticClass: "tiny-drawer__cancel-btn",
|
|
200
|
+
attrs: {
|
|
201
|
+
"plain": ""
|
|
202
|
+
},
|
|
203
|
+
on: {
|
|
204
|
+
"click": function click($event) {
|
|
205
|
+
return _vm.handleClose("cancel");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, [_vm._v(_vm._s(_vm.t("ui.button.cancel")))]), _c("tiny-button", {
|
|
209
|
+
staticClass: "tiny-drawer__confirm-btn",
|
|
210
|
+
attrs: {
|
|
211
|
+
"type": "primary"
|
|
212
|
+
},
|
|
213
|
+
on: {
|
|
214
|
+
"click": function click($event) {
|
|
215
|
+
return _vm.handleClose("confirm");
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, [_vm._v(_vm._s(_vm.t("ui.button.confirm")))])]];
|
|
219
|
+
})], 2) : _vm._e()])])])], 1);
|
|
220
|
+
};
|
|
221
|
+
var staticRenderFns = [];
|
|
222
|
+
var __cssModules = {};
|
|
223
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render2, staticRenderFns, false, __vue2_injectStyles);
|
|
224
|
+
function __vue2_injectStyles(context) {
|
|
225
|
+
for (var o in __cssModules) {
|
|
226
|
+
this[o] = __cssModules[o];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
var pc = /* @__PURE__ */ function() {
|
|
230
|
+
return __component__.exports;
|
|
231
|
+
}();
|
|
232
|
+
|
|
233
|
+
export { pc as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-drawer",
|
|
3
|
+
"version": "2.21.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@opentinyvue/vue-button": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-tooltip": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
13
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
14
|
+
"@opentinyvue/vue-icon": "~2.21.0",
|
|
15
|
+
"@opentinyvue/vue-theme": "~3.21.0"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"types": "index.d.ts"
|
|
19
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare const $constants: {
|
|
2
|
+
SCROLL_LOCK_CLASS(mode: string): string;
|
|
3
|
+
DEFAULT_WIDTH: string;
|
|
4
|
+
DEFAULT_HEIGHT: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const drawerProps: {
|
|
7
|
+
_constants: {
|
|
8
|
+
type: ObjectConstructor;
|
|
9
|
+
default: () => {
|
|
10
|
+
SCROLL_LOCK_CLASS(mode: string): string;
|
|
11
|
+
DEFAULT_WIDTH: string;
|
|
12
|
+
DEFAULT_HEIGHT: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
visible: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
customClass: (StringConstructor | ArrayConstructor | ObjectConstructor)[];
|
|
20
|
+
placement: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
width: {
|
|
25
|
+
type: StringConstructor;
|
|
26
|
+
};
|
|
27
|
+
height: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
};
|
|
30
|
+
title: StringConstructor;
|
|
31
|
+
showClose: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
showHeader: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
showFooter: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
mask: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
maskClosable: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: boolean;
|
|
50
|
+
};
|
|
51
|
+
dragable: BooleanConstructor;
|
|
52
|
+
lockScroll: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
flex: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
zIndex: {
|
|
61
|
+
type: NumberConstructor;
|
|
62
|
+
default: number;
|
|
63
|
+
};
|
|
64
|
+
beforeClose: FunctionConstructor;
|
|
65
|
+
tipsProps: ObjectConstructor;
|
|
66
|
+
customSlots: ObjectConstructor;
|
|
67
|
+
tiny_mode: StringConstructor;
|
|
68
|
+
tiny_mode_root: BooleanConstructor;
|
|
69
|
+
tiny_template: (ObjectConstructor | FunctionConstructor)[];
|
|
70
|
+
tiny_renderless: FunctionConstructor;
|
|
71
|
+
tiny_theme: StringConstructor;
|
|
72
|
+
tiny_chart_theme: ObjectConstructor;
|
|
73
|
+
};
|
|
74
|
+
declare const _default: any;
|
|
75
|
+
export default _default;
|
package/src/pc.vue.d.ts
ADDED
package/src/service.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 - present TinyVue Authors.
|
|
3
|
+
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license.
|
|
6
|
+
*
|
|
7
|
+
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
|
|
8
|
+
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
|
|
9
|
+
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare const defaultConfigs: {
|
|
13
|
+
customClass: null;
|
|
14
|
+
placement: string;
|
|
15
|
+
width: null;
|
|
16
|
+
height: null;
|
|
17
|
+
title: string;
|
|
18
|
+
showClose: boolean;
|
|
19
|
+
showHeader: boolean;
|
|
20
|
+
showFooter: boolean;
|
|
21
|
+
mask: boolean;
|
|
22
|
+
maskClosable: boolean;
|
|
23
|
+
dragable: boolean;
|
|
24
|
+
lockScroll: boolean;
|
|
25
|
+
flex: boolean;
|
|
26
|
+
zIndex: number;
|
|
27
|
+
beforeClose: null;
|
|
28
|
+
tipsProps: null;
|
|
29
|
+
};
|
|
30
|
+
declare const _default: (configs?: {}) => import("vue/types/vue").CombinedVueInstance<Record<never, any> & import("vue").default, object, object, object, Record<never, any>>;
|
|
31
|
+
export default _default;
|