@opentiny/vue-drawer 2.8.2 → 3.8.2
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/lib/mobile-first.js +202 -172
- package/package.json +3 -3
package/lib/mobile-first.js
CHANGED
|
@@ -2,61 +2,53 @@ import { renderless, api } from "@opentiny/vue-renderless/drawer/vue";
|
|
|
2
2
|
import { props, setup as _setup } from "@opentiny/vue-common";
|
|
3
3
|
import { IconClose } from "@opentiny/vue-icon";
|
|
4
4
|
import Button from "@opentiny/vue-button";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var hook;
|
|
19
|
-
if (moduleIdentifier) {
|
|
20
|
-
hook = function hook2(context) {
|
|
21
|
-
context = context || // cached call
|
|
22
|
-
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
23
|
-
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
24
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
25
|
-
context = __VUE_SSR_CONTEXT__;
|
|
26
|
-
}
|
|
27
|
-
if (injectStyles) {
|
|
28
|
-
injectStyles.call(this, context);
|
|
29
|
-
}
|
|
30
|
-
if (context && context._registeredComponents) {
|
|
31
|
-
context._registeredComponents.add(moduleIdentifier);
|
|
32
|
-
}
|
|
5
|
+
import { resolveComponent, withDirectives, openBlock, createElementBlock, createCommentVNode, normalizeClass, createElementVNode, normalizeStyle, renderSlot, toDisplayString, createVNode, withCtx, createTextVNode, vShow } from "vue";
|
|
6
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
7
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
8
|
+
if (it)
|
|
9
|
+
return (it = it.call(o)).next.bind(it);
|
|
10
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
11
|
+
if (it)
|
|
12
|
+
o = it;
|
|
13
|
+
var i = 0;
|
|
14
|
+
return function() {
|
|
15
|
+
if (i >= o.length)
|
|
16
|
+
return { done: true };
|
|
17
|
+
return { done: false, value: o[i++] };
|
|
33
18
|
};
|
|
34
|
-
options._ssrRegister = hook;
|
|
35
|
-
} else if (injectStyles) {
|
|
36
|
-
hook = shadowMode ? function() {
|
|
37
|
-
injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
|
|
38
|
-
} : injectStyles;
|
|
39
19
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
exports: scriptExports,
|
|
55
|
-
options
|
|
56
|
-
};
|
|
20
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
21
|
+
}
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
23
|
+
if (!o)
|
|
24
|
+
return;
|
|
25
|
+
if (typeof o === "string")
|
|
26
|
+
return _arrayLikeToArray(o, minLen);
|
|
27
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
28
|
+
if (n === "Object" && o.constructor)
|
|
29
|
+
n = o.constructor.name;
|
|
30
|
+
if (n === "Map" || n === "Set")
|
|
31
|
+
return Array.from(o);
|
|
32
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
33
|
+
return _arrayLikeToArray(o, minLen);
|
|
57
34
|
}
|
|
35
|
+
function _arrayLikeToArray(arr, len) {
|
|
36
|
+
if (len == null || len > arr.length)
|
|
37
|
+
len = arr.length;
|
|
38
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
39
|
+
arr2[i] = arr[i];
|
|
40
|
+
return arr2;
|
|
41
|
+
}
|
|
42
|
+
var _export_sfc = function _export_sfc2(sfc, props) {
|
|
43
|
+
var target = sfc.__vccOpts || sfc;
|
|
44
|
+
for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
|
|
45
|
+
var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
|
|
46
|
+
target[key] = val;
|
|
47
|
+
}
|
|
48
|
+
return target;
|
|
49
|
+
};
|
|
58
50
|
|
|
59
|
-
var
|
|
51
|
+
var _sfc_main = {
|
|
60
52
|
components: {
|
|
61
53
|
TinyButton: Button,
|
|
62
54
|
IconClose: IconClose()
|
|
@@ -71,130 +63,168 @@ var __vue2_script = {
|
|
|
71
63
|
});
|
|
72
64
|
}
|
|
73
65
|
};
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
ref: "dragBar",
|
|
126
|
-
class: ["h-full absolute top-0 w-2 cursor-e-resize", _vm.placement === "left" ? "-right-1" : "-left-1"],
|
|
127
|
-
attrs: {
|
|
128
|
-
"data-tag": "drawer-drag-bar"
|
|
129
|
-
}
|
|
130
|
-
}) : _vm._e(), _c("div", {
|
|
131
|
-
class: ["flex-auto flex-col flex max-h-full"]
|
|
132
|
-
}, [_vm.showHeader ? _c("div", {
|
|
133
|
-
ref: "header",
|
|
134
|
-
staticClass: "flex leading-6 p-4 text-base items-center",
|
|
135
|
-
attrs: {
|
|
136
|
-
"data-tag": "drawer-header"
|
|
137
|
-
}
|
|
138
|
-
}, [_vm._t("header", function() {
|
|
139
|
-
return [_vm.title ? _c("div", {
|
|
140
|
-
staticClass: "max-w-[80%] pr-4 text-left truncate"
|
|
141
|
-
}, [_vm._v(_vm._s(_vm.title))]) : _vm._e(), _c("div", {
|
|
142
|
-
staticClass: "flex-1 flex items-center justify-end"
|
|
143
|
-
}, [_vm._t("header-right", function() {
|
|
144
|
-
return [_c("IconClose", {
|
|
145
|
-
attrs: {
|
|
146
|
-
"custom-class": "h-5 w-5 cursor-pointer"
|
|
147
|
-
},
|
|
148
|
-
on: {
|
|
149
|
-
"click": _vm.close
|
|
150
|
-
}
|
|
151
|
-
})];
|
|
152
|
-
})], 2)];
|
|
153
|
-
})], 2) : _vm._e(), _c("div", {
|
|
154
|
-
ref: "body",
|
|
155
|
-
staticClass: "flex-auto flex flex-col overflow-auto",
|
|
156
|
-
attrs: {
|
|
157
|
-
"data-tag": "drawer-body"
|
|
158
|
-
}
|
|
159
|
-
}, [_vm._t("default")], 2), _vm.showFooter ? _c("div", {
|
|
160
|
-
ref: "footer",
|
|
161
|
-
staticClass: "px-4 py-3",
|
|
162
|
-
attrs: {
|
|
163
|
-
"data-tag": "drawer-footer"
|
|
164
|
-
}
|
|
165
|
-
}, [_c("div", {
|
|
166
|
-
staticClass: "flex-1 text-right"
|
|
167
|
-
}, [_vm._t("footer", function() {
|
|
168
|
-
return [_c("tiny-button", {
|
|
169
|
-
attrs: {
|
|
170
|
-
"tiny_mode": "mobile-first"
|
|
66
|
+
var _hoisted_1 = {
|
|
67
|
+
"data-tag": "tiny-drawer",
|
|
68
|
+
class: "text-sm"
|
|
69
|
+
};
|
|
70
|
+
var _hoisted_2 = {
|
|
71
|
+
class: /* @__PURE__ */ normalizeClass(["flex-auto flex-col flex max-h-full"])
|
|
72
|
+
};
|
|
73
|
+
var _hoisted_3 = {
|
|
74
|
+
key: 0,
|
|
75
|
+
"data-tag": "drawer-header",
|
|
76
|
+
ref: "header",
|
|
77
|
+
class: "flex leading-6 p-4 text-base items-center"
|
|
78
|
+
};
|
|
79
|
+
var _hoisted_4 = {
|
|
80
|
+
key: 0,
|
|
81
|
+
class: "max-w-[80%] pr-4 text-left truncate"
|
|
82
|
+
};
|
|
83
|
+
var _hoisted_5 = {
|
|
84
|
+
class: "flex-1 flex items-center justify-end"
|
|
85
|
+
};
|
|
86
|
+
var _hoisted_6 = {
|
|
87
|
+
"data-tag": "drawer-body",
|
|
88
|
+
ref: "body",
|
|
89
|
+
class: "flex-auto flex flex-col overflow-auto"
|
|
90
|
+
};
|
|
91
|
+
var _hoisted_7 = {
|
|
92
|
+
key: 1,
|
|
93
|
+
"data-tag": "drawer-footer",
|
|
94
|
+
ref: "footer",
|
|
95
|
+
class: "px-4 py-3"
|
|
96
|
+
};
|
|
97
|
+
var _hoisted_8 = {
|
|
98
|
+
class: "flex-1 text-right"
|
|
99
|
+
};
|
|
100
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
101
|
+
var _component_IconClose = resolveComponent("IconClose");
|
|
102
|
+
var _component_tiny_button = resolveComponent("tiny-button");
|
|
103
|
+
return withDirectives((openBlock(), createElementBlock(
|
|
104
|
+
"div",
|
|
105
|
+
_hoisted_1,
|
|
106
|
+
[createCommentVNode(" mask "), $props.mask ? (openBlock(), createElementBlock(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
key: 0,
|
|
110
|
+
ref: "mask",
|
|
111
|
+
class: normalizeClass(_ctx.m("fixed z-50 inset-0 w-full h-full bg-black opacity-0 transition-opacity ease-linear duration-200", {
|
|
112
|
+
"opacity-30": _ctx.state.toggle
|
|
113
|
+
})),
|
|
114
|
+
onClick: _cache[0] || (_cache[0] = function($event) {
|
|
115
|
+
return $props.maskClosable && _ctx.close();
|
|
116
|
+
})
|
|
171
117
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
|
|
118
|
+
null,
|
|
119
|
+
2
|
|
120
|
+
/* CLASS */
|
|
121
|
+
)) : createCommentVNode("v-if", true), createCommentVNode(" main "), createElementVNode(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
"data-tag": "tiny-drawer-main",
|
|
125
|
+
ref: "drawerBox",
|
|
126
|
+
class: normalizeClass(_ctx.m("fixed w-full max-w-full flex flex-col bg-white z-50 shadow-sm border-color-border-separator", {
|
|
127
|
+
"transition-all ease-linear duration-200": !_ctx.state.dragEvent.isDrag
|
|
128
|
+
}, {
|
|
129
|
+
"h-full": ["left", "right"].includes($props.placement)
|
|
130
|
+
}, {
|
|
131
|
+
"left-0 bottom-0 translate-y-full border-t-0.5": $props.placement === "bottom"
|
|
132
|
+
}, {
|
|
133
|
+
"left-0 top-0 -translate-y-full border-b-0.5": $props.placement === "top"
|
|
134
|
+
}, {
|
|
135
|
+
"translate-y-0": ["top", "bottom"].includes($props.placement) && _ctx.state.toggle
|
|
136
|
+
}, {
|
|
137
|
+
"left-0 top-0 -translate-x-full border-r-0.5": $props.placement === "left"
|
|
138
|
+
}, {
|
|
139
|
+
"right-0 top-0 translate-x-full border-l-0.5": $props.placement === "right"
|
|
140
|
+
}, {
|
|
141
|
+
"translate-x-0": ["left", "right"].includes($props.placement) && _ctx.state.toggle
|
|
142
|
+
}, $props.customClass)),
|
|
143
|
+
style: normalizeStyle({
|
|
144
|
+
width: ["left", "right"].includes($props.placement) ? _ctx.state.computedWidth : null
|
|
145
|
+
})
|
|
180
146
|
},
|
|
181
|
-
|
|
182
|
-
"
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
147
|
+
[$props.dragable ? (openBlock(), createElementBlock(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
key: 0,
|
|
151
|
+
"data-tag": "drawer-drag-bar",
|
|
152
|
+
ref: "dragBar",
|
|
153
|
+
class: normalizeClass(["h-full absolute top-0 w-2 cursor-e-resize", $props.placement === "left" ? "-right-1" : "-left-1"])
|
|
154
|
+
},
|
|
155
|
+
null,
|
|
156
|
+
2
|
|
157
|
+
/* CLASS */
|
|
158
|
+
)) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_2, [createCommentVNode(" header "), $props.showHeader ? (openBlock(), createElementBlock(
|
|
159
|
+
"div",
|
|
160
|
+
_hoisted_3,
|
|
161
|
+
[renderSlot(_ctx.$slots, "header", {}, function() {
|
|
162
|
+
return [$props.title ? (openBlock(), createElementBlock(
|
|
163
|
+
"div",
|
|
164
|
+
_hoisted_4,
|
|
165
|
+
toDisplayString($props.title),
|
|
166
|
+
1
|
|
167
|
+
/* TEXT */
|
|
168
|
+
)) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_5, [renderSlot(_ctx.$slots, "header-right", {}, function() {
|
|
169
|
+
return [createVNode(_component_IconClose, {
|
|
170
|
+
"custom-class": "h-5 w-5 cursor-pointer",
|
|
171
|
+
onClick: _ctx.close
|
|
172
|
+
}, null, 8, ["onClick"])];
|
|
173
|
+
})])];
|
|
174
|
+
})],
|
|
175
|
+
512
|
|
176
|
+
/* NEED_PATCH */
|
|
177
|
+
)) : createCommentVNode("v-if", true), createCommentVNode(" body "), createElementVNode(
|
|
178
|
+
"div",
|
|
179
|
+
_hoisted_6,
|
|
180
|
+
[renderSlot(_ctx.$slots, "default")],
|
|
181
|
+
512
|
|
182
|
+
/* NEED_PATCH */
|
|
183
|
+
), createCommentVNode(" footer "), $props.showFooter ? (openBlock(), createElementBlock(
|
|
184
|
+
"div",
|
|
185
|
+
_hoisted_7,
|
|
186
|
+
[createElementVNode("div", _hoisted_8, [renderSlot(_ctx.$slots, "footer", {}, function() {
|
|
187
|
+
return [createVNode(_component_tiny_button, {
|
|
188
|
+
tiny_mode: "mobile-first",
|
|
189
|
+
onClick: _ctx.close
|
|
190
|
+
}, {
|
|
191
|
+
default: withCtx(function() {
|
|
192
|
+
return [createTextVNode(
|
|
193
|
+
toDisplayString(_ctx.t("ui.button.cancel")),
|
|
194
|
+
1
|
|
195
|
+
/* TEXT */
|
|
196
|
+
)];
|
|
197
|
+
}),
|
|
198
|
+
_: 1
|
|
199
|
+
/* STABLE */
|
|
200
|
+
}, 8, ["onClick"]), createVNode(_component_tiny_button, {
|
|
201
|
+
tiny_mode: "mobile-first",
|
|
202
|
+
class: "ml-2",
|
|
203
|
+
type: "primary",
|
|
204
|
+
onClick: _ctx.confirm
|
|
205
|
+
}, {
|
|
206
|
+
default: withCtx(function() {
|
|
207
|
+
return [createTextVNode(
|
|
208
|
+
toDisplayString(_ctx.t("ui.button.confirm")),
|
|
209
|
+
1
|
|
210
|
+
/* TEXT */
|
|
211
|
+
)];
|
|
212
|
+
}),
|
|
213
|
+
_: 1
|
|
214
|
+
/* STABLE */
|
|
215
|
+
}, 8, ["onClick"])];
|
|
216
|
+
})])],
|
|
217
|
+
512
|
|
218
|
+
/* NEED_PATCH */
|
|
219
|
+
)) : createCommentVNode("v-if", true)])],
|
|
220
|
+
6
|
|
221
|
+
/* CLASS, STYLE */
|
|
222
|
+
)],
|
|
223
|
+
512
|
|
224
|
+
/* NEED_PATCH */
|
|
225
|
+
)), [[vShow, $props.visible]]);
|
|
194
226
|
}
|
|
195
|
-
var mobileFirst = /* @__PURE__ */
|
|
196
|
-
return __component__.exports;
|
|
197
|
-
}();
|
|
227
|
+
var mobileFirst = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
198
228
|
export {
|
|
199
229
|
mobileFirst as default
|
|
200
230
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-drawer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@opentiny/vue-button": "~
|
|
10
|
-
"@opentiny/vue-common": "~
|
|
9
|
+
"@opentiny/vue-button": "~3.8.2",
|
|
10
|
+
"@opentiny/vue-common": "~3.8.2",
|
|
11
11
|
"@opentiny/vue-renderless": "~3.8.2"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|