@opentiny/vue-drawer 3.16.0 → 3.17.1

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/index.js CHANGED
@@ -1,18 +1,14 @@
1
1
  function _extends() {
2
- _extends = Object.assign ? Object.assign.bind() : function(target) {
3
- for (var i = 1; i < arguments.length; i++) {
4
- var source = arguments[i];
5
- for (var key in source) {
6
- if (Object.prototype.hasOwnProperty.call(source, key)) {
7
- target[key] = source[key];
8
- }
9
- }
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)
6
+ ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
10
7
  }
11
- return target;
12
- };
13
- return _extends.apply(this, arguments);
8
+ return n;
9
+ }, _extends.apply(null, arguments);
14
10
  }
15
- import { defineComponent, $prefix, $setup, $props } from "@opentiny/vue-common";
11
+ import { defineComponent, $prefix, $setup, $props, createComponent, appProperties, hooks, setupComponent } from "@opentiny/vue-common";
16
12
  import PcTemplate from "./pc.js";
17
13
  import MobileFirstTemplate from "./mobile-first.js";
18
14
  var template = function template2(mode) {
@@ -30,7 +26,7 @@ var $constants = {
30
26
  SCROLL_LOCK_CLASS: function SCROLL_LOCK_CLASS(mode) {
31
27
  var scrollLockClasses = {
32
28
  "mobile-first": "overflow-hidden",
33
- "pc": "tiny-popup-parent--hidden tiny-dialog-box__scroll-lock"
29
+ "pc": "popup-parent--hidden dialog-box__scroll-lock"
34
30
  };
35
31
  return scrollLockClasses[mode] || "";
36
32
  },
@@ -90,7 +86,9 @@ var drawerProps = _extends({}, $props, {
90
86
  default: 2e3
91
87
  },
92
88
  beforeClose: Function,
93
- tipsProps: Object
89
+ tipsProps: Object,
90
+ // tiny 新增:用于方法调用组件
91
+ customSlots: Object
94
92
  });
95
93
  var Drawer = defineComponent({
96
94
  name: $prefix + "Drawer",
@@ -103,15 +101,80 @@ var Drawer = defineComponent({
103
101
  });
104
102
  }
105
103
  });
106
- var version = "3.16.0";
104
+ var defaultConfigs = {
105
+ customClass: null,
106
+ placement: "right",
107
+ width: null,
108
+ title: "",
109
+ showClose: true,
110
+ showHeader: true,
111
+ showFooter: false,
112
+ mask: true,
113
+ maskClosable: true,
114
+ dragable: false,
115
+ lockScroll: true,
116
+ flex: false,
117
+ zIndex: 2e3,
118
+ beforeClose: null,
119
+ tipsProps: null
120
+ };
121
+ var service = function service2(configs) {
122
+ var _appProperties$tiny_m;
123
+ if (configs === void 0) {
124
+ configs = {};
125
+ }
126
+ var events = {
127
+ onOpen: function onOpen(params) {
128
+ var _configs$events;
129
+ if (typeof ((_configs$events = configs.events) == null ? void 0 : _configs$events.open) === "function") {
130
+ configs.events.open(params);
131
+ }
132
+ },
133
+ onClose: function onClose(params) {
134
+ var _configs$events2;
135
+ if (typeof ((_configs$events2 = configs.events) == null ? void 0 : _configs$events2.close) === "function") {
136
+ configs.events.close(params);
137
+ }
138
+ },
139
+ onConfirm: function onConfirm(params) {
140
+ var _configs$events3;
141
+ if (typeof ((_configs$events3 = configs.events) == null ? void 0 : _configs$events3.confirm) === "function") {
142
+ configs.events.confirm(params);
143
+ }
144
+ }
145
+ };
146
+ var options = _extends({}, defaultConfigs, configs, events);
147
+ var instance = createComponent({
148
+ component: Drawer,
149
+ propsData: _extends({}, options, {
150
+ _constants: $constants,
151
+ tiny_mode: configs.tiny_mode || ((_appProperties$tiny_m = appProperties().tiny_mode) == null ? void 0 : _appProperties$tiny_m.value)
152
+ }),
153
+ el: document.createElement("div")
154
+ });
155
+ var parent = document.body;
156
+ parent.appendChild(instance.$el);
157
+ hooks.nextTick(function() {
158
+ instance.open();
159
+ });
160
+ return instance;
161
+ };
162
+ var version = "3.undefined";
107
163
  Drawer.model = {
108
- prop: "modelValue",
109
- event: "update:modelValue"
164
+ prop: "visible",
165
+ event: "update:visible"
110
166
  };
167
+ Drawer.service = service;
111
168
  Drawer.install = function(Vue) {
112
169
  Vue.component(Drawer.name, Drawer);
113
170
  };
114
171
  Drawer.version = version;
172
+ setupComponent.TINYDrawer = {
173
+ init: function init(root) {
174
+ var prefix = root.$apiPrefix || "$";
175
+ root[prefix + "drawer"] = service;
176
+ }
177
+ };
115
178
  export {
116
179
  Drawer as default
117
180
  };
@@ -4,41 +4,32 @@ import { IconClose } from '@opentiny/vue-icon';
4
4
  import Button from '@opentiny/vue-button';
5
5
  import { resolveComponent, withDirectives, openBlock, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString, createVNode, withCtx, createTextVNode, vShow } from 'vue';
6
6
 
7
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
8
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
9
- if (it)
10
- return (it = it.call(o)).next.bind(it);
11
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
12
- if (it)
13
- o = it;
14
- var i = 0;
7
+ function _createForOfIteratorHelperLoose(r, e) {
8
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
9
+ if (t)
10
+ return (t = t.call(r)).next.bind(t);
11
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
12
+ t && (r = t);
13
+ var o = 0;
15
14
  return function() {
16
- if (i >= o.length)
17
- return { done: true };
18
- return { done: false, value: o[i++] };
15
+ return o >= r.length ? { done: true } : { done: false, value: r[o++] };
19
16
  };
20
17
  }
21
18
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22
19
  }
23
- function _unsupportedIterableToArray(o, minLen) {
24
- if (!o)
25
- return;
26
- if (typeof o === "string")
27
- return _arrayLikeToArray(o, minLen);
28
- var n = Object.prototype.toString.call(o).slice(8, -1);
29
- if (n === "Object" && o.constructor)
30
- n = o.constructor.name;
31
- if (n === "Map" || n === "Set")
32
- return Array.from(o);
33
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
34
- return _arrayLikeToArray(o, minLen);
20
+ function _unsupportedIterableToArray(r, a) {
21
+ if (r) {
22
+ if ("string" == typeof r)
23
+ return _arrayLikeToArray(r, a);
24
+ var t = {}.toString.call(r).slice(8, -1);
25
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
26
+ }
35
27
  }
36
- function _arrayLikeToArray(arr, len) {
37
- if (len == null || len > arr.length)
38
- len = arr.length;
39
- for (var i = 0, arr2 = new Array(len); i < len; i++)
40
- arr2[i] = arr[i];
41
- return arr2;
28
+ function _arrayLikeToArray(r, a) {
29
+ (null == a || a > r.length) && (a = r.length);
30
+ for (var e = 0, n = Array(a); e < a; e++)
31
+ n[e] = r[e];
32
+ return n;
42
33
  }
43
34
  var _export_sfc = function _export_sfc2(sfc, props) {
44
35
  var target = sfc.__vccOpts || sfc;
@@ -55,6 +46,7 @@ var _sfc_main = defineComponent({
55
46
  IconClose: IconClose()
56
47
  },
57
48
  props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable", "lockScroll", "flex", "beforeClose"]),
49
+ emits: ["update:visible", "open", "close", "confirm"],
58
50
  setup: function setup$1(props2, context) {
59
51
  return setup({
60
52
  props: props2,
@@ -104,8 +96,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
104
96
  {
105
97
  key: 0,
106
98
  ref: "mask",
107
- class: normalizeClass(_ctx.m("fixed z-50 left-0 right-0 top-0 bottom-0 w-full h-full transition-opacity ease-linear duration-200", {
108
- "bg-color-bg-7": _ctx.state.toggle
99
+ class: normalizeClass(_ctx.m("fixed z-50 left-0 right-0 top-0 bottom-0 w-full h-full transition ease-linear duration-200", {
100
+ "bg-color-bg-7": _ctx.state.visible
109
101
  })),
110
102
  onClick: _cache[0] || (_cache[0] = function($event) {
111
103
  return _ctx.handleClose("mask");
@@ -130,13 +122,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
130
122
  }, {
131
123
  "left-0 top-0 -translate-y-full border-b-0.5 rounded-b-lg": _ctx.placement === "top"
132
124
  }, {
133
- "translate-y-0": ["top", "bottom"].includes(_ctx.placement) && _ctx.state.toggle
125
+ "translate-y-0": ["top", "bottom"].includes(_ctx.placement) && _ctx.state.visible
134
126
  }, {
135
127
  "left-0 top-0 -translate-x-full border-r-0.5 rounded-r-lg": _ctx.placement === "left"
136
128
  }, {
137
129
  "right-0 top-0 translate-x-full border-l-0.5 rounded-l-lg": _ctx.placement === "right"
138
130
  }, {
139
- "translate-x-0": ["left", "right"].includes(_ctx.placement) && _ctx.state.toggle
131
+ "translate-x-0": ["left", "right"].includes(_ctx.placement) && _ctx.state.visible
140
132
  }, _ctx.customClass)),
141
133
  style: normalizeStyle({
142
134
  width: ["left", "right"].includes(_ctx.placement) ? _ctx.state.computedWidth : null,
package/lib/pc.js CHANGED
@@ -1,46 +1,37 @@
1
1
  import { renderless, api } from '@opentiny/vue-renderless/drawer/vue';
2
- import { defineComponent, props, setup } from '@opentiny/vue-common';
2
+ import { defineComponent, h, props, setup } from '@opentiny/vue-common';
3
3
  import '@opentiny/vue-theme/drawer/index.css';
4
4
  import { iconClose, iconHelpCircle } from '@opentiny/vue-icon';
5
5
  import Button from '@opentiny/vue-button';
6
6
  import Tooltip from '@opentiny/vue-tooltip';
7
- import { resolveComponent, openBlock, createElementBlock, createVNode, Transition, withCtx, normalizeClass, normalizeStyle, createCommentVNode, withDirectives, createElementVNode, renderSlot, toDisplayString, createBlock, normalizeProps, mergeProps, createTextVNode, vShow } from 'vue';
7
+ import { resolveComponent, openBlock, createElementBlock, createVNode, Transition, withCtx, normalizeStyle, createCommentVNode, withDirectives, createElementVNode, normalizeClass, renderSlot, createBlock, toDisplayString, normalizeProps, mergeProps, Fragment, createTextVNode, vShow } from 'vue';
8
8
 
9
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
10
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
11
- if (it)
12
- return (it = it.call(o)).next.bind(it);
13
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
14
- if (it)
15
- o = it;
16
- var i = 0;
9
+ function _createForOfIteratorHelperLoose(r, e) {
10
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
11
+ if (t)
12
+ return (t = t.call(r)).next.bind(t);
13
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
14
+ t && (r = t);
15
+ var o = 0;
17
16
  return function() {
18
- if (i >= o.length)
19
- return { done: true };
20
- return { done: false, value: o[i++] };
17
+ return o >= r.length ? { done: true } : { done: false, value: r[o++] };
21
18
  };
22
19
  }
23
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.");
24
21
  }
25
- function _unsupportedIterableToArray(o, minLen) {
26
- if (!o)
27
- return;
28
- if (typeof o === "string")
29
- return _arrayLikeToArray(o, minLen);
30
- var n = Object.prototype.toString.call(o).slice(8, -1);
31
- if (n === "Object" && o.constructor)
32
- n = o.constructor.name;
33
- if (n === "Map" || n === "Set")
34
- return Array.from(o);
35
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
36
- return _arrayLikeToArray(o, minLen);
22
+ function _unsupportedIterableToArray(r, a) {
23
+ if (r) {
24
+ if ("string" == typeof r)
25
+ return _arrayLikeToArray(r, a);
26
+ var t = {}.toString.call(r).slice(8, -1);
27
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
28
+ }
37
29
  }
38
- function _arrayLikeToArray(arr, len) {
39
- if (len == null || len > arr.length)
40
- len = arr.length;
41
- for (var i = 0, arr2 = new Array(len); i < len; i++)
42
- arr2[i] = arr[i];
43
- return arr2;
30
+ function _arrayLikeToArray(r, a) {
31
+ (null == a || a > r.length) && (a = r.length);
32
+ for (var e = 0, n = Array(a); e < a; e++)
33
+ n[e] = r[e];
34
+ return n;
44
35
  }
45
36
  var _export_sfc = function _export_sfc2(sfc, props) {
46
37
  var target = sfc.__vccOpts || sfc;
@@ -56,9 +47,22 @@ var _sfc_main = defineComponent({
56
47
  TinyButton: Button,
57
48
  TinyTooltip: Tooltip,
58
49
  IconClose: iconClose(),
59
- IconHelpCircle: iconHelpCircle()
50
+ IconHelpCircle: iconHelpCircle(),
51
+ // tiny新增: 适配Vue2下, 在模板中渲染VNode
52
+ SlotWrapper: {
53
+ props: ["node"],
54
+ render: function render() {
55
+ var node = this.node;
56
+ if (typeof node === "function") {
57
+ return node(h);
58
+ } else {
59
+ return node;
60
+ }
61
+ }
62
+ }
60
63
  },
61
- props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable", "lockScroll", "flex", "showClose", "zIndex", "beforeClose", "tipsProps"]),
64
+ props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable", "lockScroll", "flex", "showClose", "zIndex", "beforeClose", "tipsProps", "customSlots"]),
65
+ emits: ["update:visible", "open", "close", "confirm", "drag"],
62
66
  setup: function setup$1(props2, context) {
63
67
  return setup({
64
68
  props: props2,
@@ -82,6 +86,7 @@ var _hoisted_3 = {
82
86
  class: "tiny-drawer__header-wrapper"
83
87
  };
84
88
  var _hoisted_4 = {
89
+ key: 1,
85
90
  class: "tiny-drawer__header"
86
91
  };
87
92
  var _hoisted_5 = {
@@ -101,6 +106,7 @@ var _hoisted_8 = {
101
106
  class: "tiny-drawer__footer"
102
107
  };
103
108
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
109
+ var _component_slot_wrapper = resolveComponent("slot-wrapper");
104
110
  var _component_icon_help_circle = resolveComponent("icon-help-circle");
105
111
  var _component_tiny_tooltip = resolveComponent("tiny-tooltip");
106
112
  var _component_icon_close = resolveComponent("icon-close");
@@ -109,14 +115,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
109
115
  name: "drawer-fade"
110
116
  }, {
111
117
  default: withCtx(function() {
112
- return [_ctx.mask && _ctx.visible ? (openBlock(), createElementBlock(
118
+ return [_ctx.mask && _ctx.state.visible ? (openBlock(), createElementBlock(
113
119
  "div",
114
120
  {
115
121
  key: 0,
116
122
  ref: "mask",
117
- class: normalizeClass(["tiny-drawer__mask", {
118
- "show-bg-color": _ctx.state.toggle
119
- }]),
123
+ class: "tiny-drawer__mask show-bg-color",
120
124
  style: normalizeStyle({
121
125
  zIndex: _ctx.zIndex
122
126
  }),
@@ -125,8 +129,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
125
129
  })
126
130
  },
127
131
  null,
128
- 6
129
- /* CLASS, STYLE */
132
+ 4
133
+ /* STYLE */
130
134
  )) : createCommentVNode("v-if", true)];
131
135
  }),
132
136
  _: 1
@@ -147,7 +151,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
147
151
  "is-top": _ctx.placement === "top",
148
152
  "is-bottom": _ctx.placement === "bottom",
149
153
  "drag-effects": !_ctx.state.dragEvent.isDrag,
150
- "toggle": _ctx.state.toggle
154
+ "toggle": _ctx.state.visible
151
155
  }, "tiny-drawer-main", _ctx.customClass]),
152
156
  style: normalizeStyle({
153
157
  width: ["left", "right"].includes(_ctx.placement) ? _ctx.state.computedWidth : null,
@@ -170,7 +174,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
170
174
  "div",
171
175
  _hoisted_3,
172
176
  [renderSlot(_ctx.$slots, "header", {}, function() {
173
- return [createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [_ctx.title ? (openBlock(), createElementBlock(
177
+ var _ctx$customSlots;
178
+ return [(_ctx$customSlots = _ctx.customSlots) != null && _ctx$customSlots.header ? (openBlock(), createBlock(_component_slot_wrapper, {
179
+ key: 0,
180
+ node: _ctx.customSlots.header
181
+ }, null, 8, ["node"])) : (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [_ctx.title ? (openBlock(), createElementBlock(
174
182
  "div",
175
183
  _hoisted_6,
176
184
  toDisplayString(_ctx.title),
@@ -192,7 +200,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
192
200
  },
193
201
  16
194
202
  /* FULL_PROPS */
195
- )) : createCommentVNode("v-if", true)]), createElementVNode("div", _hoisted_7, [renderSlot(_ctx.$slots, "header-right")])])];
203
+ )) : createCommentVNode("v-if", true)]), createElementVNode("div", _hoisted_7, [renderSlot(_ctx.$slots, "header-right", {}, function() {
204
+ var _ctx$customSlots2;
205
+ return [(_ctx$customSlots2 = _ctx.customSlots) != null && _ctx$customSlots2.headerRight ? (openBlock(), createBlock(_component_slot_wrapper, {
206
+ key: 0,
207
+ node: _ctx.customSlots.headerRight
208
+ }, null, 8, ["node"])) : createCommentVNode("v-if", true)];
209
+ })])]))];
196
210
  }), _ctx.showClose ? (openBlock(), createElementBlock("button", {
197
211
  key: 0,
198
212
  type: "button",
@@ -215,57 +229,73 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
215
229
  "flex flex-col": _ctx.flex
216
230
  }, "drawer-body"])
217
231
  },
218
- [renderSlot(_ctx.$slots, "default")],
232
+ [renderSlot(_ctx.$slots, "default", {}, function() {
233
+ return [createVNode(_component_slot_wrapper, {
234
+ node: _ctx.customSlots.default
235
+ }, null, 8, ["node"])];
236
+ })],
219
237
  2
220
238
  /* CLASS */
221
239
  ), _ctx.showFooter ? (openBlock(), createElementBlock(
222
240
  "div",
223
241
  _hoisted_8,
224
242
  [renderSlot(_ctx.$slots, "footer", {}, function() {
225
- return [createVNode(_component_tiny_button, {
226
- type: "primary",
227
- class: normalizeClass(["tiny-drawer__confirm-btn", {
228
- reverse: _ctx.state.btnOrderReversed
229
- }]),
230
- onClick: _cache[2] || (_cache[2] = function($event) {
231
- return _ctx.handleClose("confirm");
232
- })
233
- }, {
234
- default: withCtx(function() {
235
- return [createTextVNode(
236
- toDisplayString(_ctx.t("ui.button.confirm")),
237
- 1
238
- /* TEXT */
239
- )];
240
- }),
241
- _: 1
242
- /* STABLE */
243
- }, 8, ["class"]), createVNode(_component_tiny_button, {
244
- plain: "",
245
- class: normalizeClass(["tiny-drawer__cancel-btn", {
246
- reverse: _ctx.state.btnOrderReversed
247
- }]),
248
- onClick: _cache[3] || (_cache[3] = function($event) {
249
- return _ctx.handleClose("cancel");
250
- })
251
- }, {
252
- default: withCtx(function() {
253
- return [createTextVNode(
254
- toDisplayString(_ctx.t("ui.button.cancel")),
255
- 1
256
- /* TEXT */
257
- )];
258
- }),
259
- _: 1
260
- /* STABLE */
261
- }, 8, ["class"])];
243
+ var _ctx$customSlots3;
244
+ return [(_ctx$customSlots3 = _ctx.customSlots) != null && _ctx$customSlots3.footer ? (openBlock(), createBlock(_component_slot_wrapper, {
245
+ key: 0,
246
+ node: _ctx.customSlots.footer
247
+ }, null, 8, ["node"])) : (openBlock(), createElementBlock(
248
+ Fragment,
249
+ {
250
+ key: 1
251
+ },
252
+ [createVNode(_component_tiny_button, {
253
+ type: "primary",
254
+ class: normalizeClass(["tiny-drawer__confirm-btn", {
255
+ reverse: _ctx.state.btnOrderReversed
256
+ }]),
257
+ onClick: _cache[2] || (_cache[2] = function($event) {
258
+ return _ctx.handleClose("confirm");
259
+ })
260
+ }, {
261
+ default: withCtx(function() {
262
+ return [createTextVNode(
263
+ toDisplayString(_ctx.t("ui.button.confirm")),
264
+ 1
265
+ /* TEXT */
266
+ )];
267
+ }),
268
+ _: 1
269
+ /* STABLE */
270
+ }, 8, ["class"]), createVNode(_component_tiny_button, {
271
+ plain: "",
272
+ class: normalizeClass(["tiny-drawer__cancel-btn", {
273
+ reverse: _ctx.state.btnOrderReversed
274
+ }]),
275
+ onClick: _cache[3] || (_cache[3] = function($event) {
276
+ return _ctx.handleClose("cancel");
277
+ })
278
+ }, {
279
+ default: withCtx(function() {
280
+ return [createTextVNode(
281
+ toDisplayString(_ctx.t("ui.button.cancel")),
282
+ 1
283
+ /* TEXT */
284
+ )];
285
+ }),
286
+ _: 1
287
+ /* STABLE */
288
+ }, 8, ["class"])],
289
+ 64
290
+ /* STABLE_FRAGMENT */
291
+ ))];
262
292
  })],
263
293
  512
264
294
  /* NEED_PATCH */
265
295
  )) : createCommentVNode("v-if", true)])],
266
296
  6
267
297
  /* CLASS, STYLE */
268
- ), [[vShow, _ctx.visible]])];
298
+ ), [[vShow, _ctx.state.visible]])];
269
299
  }),
270
300
  _: 3
271
301
  /* FORWARDED */
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@opentiny/vue-drawer",
3
- "version": "3.16.0",
3
+ "version": "3.17.1",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
7
7
  "sideEffects": false,
8
8
  "type": "module",
9
9
  "dependencies": {
10
- "@opentiny/vue-button": "~3.16.0",
11
- "@opentiny/vue-tooltip": "~3.16.0",
12
- "@opentiny/vue-common": "~3.16.0",
13
- "@opentiny/vue-renderless": "~3.16.0",
14
- "@opentiny/vue-icon": "~3.16.0",
15
- "@opentiny/vue-theme": "~3.16.0"
10
+ "@opentiny/vue-button": "~3.17.0",
11
+ "@opentiny/vue-tooltip": "~3.17.0",
12
+ "@opentiny/vue-common": "~3.17.0",
13
+ "@opentiny/vue-renderless": "~3.17.0",
14
+ "@opentiny/vue-icon": "~3.17.0",
15
+ "@opentiny/vue-theme": "~3.17.0"
16
16
  },
17
17
  "license": "MIT",
18
18
  "types": "index.d.ts"
package/src/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ export declare const $constants: {
2
+ SCROLL_LOCK_CLASS(mode: string): string;
3
+ DEFAULT_WIDTH: string;
4
+ };
1
5
  export declare const drawerProps: {
2
6
  _constants: {
3
7
  type: ObjectConstructor;
@@ -10,7 +14,7 @@ export declare const drawerProps: {
10
14
  type: BooleanConstructor;
11
15
  default: boolean;
12
16
  };
13
- customClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
17
+ customClass: (ObjectConstructor | StringConstructor | ArrayConstructor)[];
14
18
  placement: {
15
19
  type: StringConstructor;
16
20
  default: string;
@@ -54,6 +58,7 @@ export declare const drawerProps: {
54
58
  };
55
59
  beforeClose: FunctionConstructor;
56
60
  tipsProps: ObjectConstructor;
61
+ customSlots: ObjectConstructor;
57
62
  tiny_mode: StringConstructor;
58
63
  tiny_mode_root: BooleanConstructor;
59
64
  tiny_template: (ObjectConstructor | FunctionConstructor)[];
@@ -73,7 +78,7 @@ declare const _default: import("@vue/runtime-core").DefineComponent<{
73
78
  type: BooleanConstructor;
74
79
  default: boolean;
75
80
  };
76
- customClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
81
+ customClass: (ObjectConstructor | StringConstructor | ArrayConstructor)[];
77
82
  placement: {
78
83
  type: StringConstructor;
79
84
  default: string;
@@ -117,6 +122,7 @@ declare const _default: import("@vue/runtime-core").DefineComponent<{
117
122
  };
118
123
  beforeClose: FunctionConstructor;
119
124
  tipsProps: ObjectConstructor;
125
+ customSlots: ObjectConstructor;
120
126
  tiny_mode: StringConstructor;
121
127
  tiny_mode_root: BooleanConstructor;
122
128
  tiny_template: (ObjectConstructor | FunctionConstructor)[];
@@ -137,7 +143,7 @@ declare const _default: import("@vue/runtime-core").DefineComponent<{
137
143
  type: BooleanConstructor;
138
144
  default: boolean;
139
145
  };
140
- customClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
146
+ customClass: (ObjectConstructor | StringConstructor | ArrayConstructor)[];
141
147
  placement: {
142
148
  type: StringConstructor;
143
149
  default: string;
@@ -181,6 +187,7 @@ declare const _default: import("@vue/runtime-core").DefineComponent<{
181
187
  };
182
188
  beforeClose: FunctionConstructor;
183
189
  tipsProps: ObjectConstructor;
190
+ customSlots: ObjectConstructor;
184
191
  tiny_mode: StringConstructor;
185
192
  tiny_mode_root: BooleanConstructor;
186
193
  tiny_template: (ObjectConstructor | FunctionConstructor)[];
@@ -188,18 +195,18 @@ declare const _default: import("@vue/runtime-core").DefineComponent<{
188
195
  tiny_theme: StringConstructor;
189
196
  tiny_chart_theme: ObjectConstructor;
190
197
  }>>, {
198
+ mask: boolean;
199
+ placement: string;
191
200
  tiny_mode_root: boolean;
192
201
  _constants: Record<string, any>;
193
- placement: string;
194
- zIndex: number;
195
- mask: boolean;
196
202
  visible: boolean;
197
- showClose: boolean;
198
203
  showHeader: boolean;
199
204
  showFooter: boolean;
200
- maskClosable: boolean;
201
205
  dragable: boolean;
206
+ maskClosable: boolean;
202
207
  lockScroll: boolean;
203
208
  flex: boolean;
209
+ zIndex: number;
210
+ showClose: boolean;
204
211
  }, {}>;
205
212
  export default _default;
@@ -1,4 +1,6 @@
1
1
  declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
2
+ mask?: any;
3
+ placement?: any;
2
4
  title?: any;
3
5
  tiny_mode?: any;
4
6
  tiny_mode_root?: any;
@@ -8,14 +10,12 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
8
10
  tiny_theme?: any;
9
11
  tiny_chart_theme?: any;
10
12
  width?: any;
11
- placement?: any;
12
- mask?: any;
13
- visible?: any;
14
13
  customClass?: any;
14
+ visible?: any;
15
15
  showHeader?: any;
16
16
  showFooter?: any;
17
- maskClosable?: any;
18
17
  dragable?: any;
18
+ maskClosable?: any;
19
19
  lockScroll?: any;
20
20
  flex?: any;
21
21
  beforeClose?: any;
@@ -27,7 +27,9 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
27
27
  d: (props: any) => void;
28
28
  dp: (props: any) => void;
29
29
  gcls: (key: any) => any;
30
- }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
30
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("close" | "confirm" | "open" | "update:visible")[], "close" | "confirm" | "open" | "update:visible", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
31
+ mask?: any;
32
+ placement?: any;
31
33
  title?: any;
32
34
  tiny_mode?: any;
33
35
  tiny_mode_root?: any;
@@ -37,18 +39,23 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
37
39
  tiny_theme?: any;
38
40
  tiny_chart_theme?: any;
39
41
  width?: any;
40
- placement?: any;
41
- mask?: any;
42
- visible?: any;
43
42
  customClass?: any;
43
+ visible?: any;
44
44
  showHeader?: any;
45
45
  showFooter?: any;
46
- maskClosable?: any;
47
46
  dragable?: any;
47
+ maskClosable?: any;
48
48
  lockScroll?: any;
49
49
  flex?: any;
50
50
  beforeClose?: any;
51
- }>>>, {
51
+ }>>> & {
52
+ onClose?: ((...args: any[]) => any) | undefined;
53
+ onConfirm?: ((...args: any[]) => any) | undefined;
54
+ onOpen?: ((...args: any[]) => any) | undefined;
55
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
56
+ }, {
57
+ readonly mask?: any;
58
+ readonly placement?: any;
52
59
  readonly title?: any;
53
60
  readonly tiny_mode?: any;
54
61
  readonly tiny_mode_root?: any;
@@ -58,14 +65,12 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
58
65
  readonly tiny_theme?: any;
59
66
  readonly tiny_chart_theme?: any;
60
67
  readonly width?: any;
61
- readonly placement?: any;
62
- readonly mask?: any;
63
- readonly visible?: any;
64
68
  readonly customClass?: any;
69
+ readonly visible?: any;
65
70
  readonly showHeader?: any;
66
71
  readonly showFooter?: any;
67
- readonly maskClosable?: any;
68
72
  readonly dragable?: any;
73
+ readonly maskClosable?: any;
69
74
  readonly lockScroll?: any;
70
75
  readonly flex?: any;
71
76
  readonly beforeClose?: any;
package/src/pc.vue.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
2
+ mask?: any;
3
+ placement?: any;
2
4
  title?: any;
3
5
  tiny_mode?: any;
4
6
  tiny_mode_root?: any;
@@ -8,20 +10,19 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
8
10
  tiny_theme?: any;
9
11
  tiny_chart_theme?: any;
10
12
  width?: any;
11
- placement?: any;
12
- zIndex?: any;
13
- mask?: any;
14
- visible?: any;
15
13
  customClass?: any;
16
- showClose?: any;
14
+ visible?: any;
17
15
  showHeader?: any;
18
16
  showFooter?: any;
19
- maskClosable?: any;
20
17
  dragable?: any;
18
+ maskClosable?: any;
21
19
  lockScroll?: any;
22
20
  flex?: any;
23
21
  beforeClose?: any;
22
+ zIndex?: any;
23
+ showClose?: any;
24
24
  tipsProps?: any;
25
+ customSlots?: any;
25
26
  }>, {
26
27
  t: (this: any, path: any, options?: any) => any;
27
28
  vm: any;
@@ -30,7 +31,9 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
30
31
  d: (props: any) => void;
31
32
  dp: (props: any) => void;
32
33
  gcls: (key: any) => any;
33
- }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
34
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("close" | "confirm" | "drag" | "open" | "update:visible")[], "close" | "confirm" | "drag" | "open" | "update:visible", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
35
+ mask?: any;
36
+ placement?: any;
34
37
  title?: any;
35
38
  tiny_mode?: any;
36
39
  tiny_mode_root?: any;
@@ -40,21 +43,28 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
40
43
  tiny_theme?: any;
41
44
  tiny_chart_theme?: any;
42
45
  width?: any;
43
- placement?: any;
44
- zIndex?: any;
45
- mask?: any;
46
- visible?: any;
47
46
  customClass?: any;
48
- showClose?: any;
47
+ visible?: any;
49
48
  showHeader?: any;
50
49
  showFooter?: any;
51
- maskClosable?: any;
52
50
  dragable?: any;
51
+ maskClosable?: any;
53
52
  lockScroll?: any;
54
53
  flex?: any;
55
54
  beforeClose?: any;
55
+ zIndex?: any;
56
+ showClose?: any;
56
57
  tipsProps?: any;
57
- }>>>, {
58
+ customSlots?: any;
59
+ }>>> & {
60
+ onClose?: ((...args: any[]) => any) | undefined;
61
+ onDrag?: ((...args: any[]) => any) | undefined;
62
+ onConfirm?: ((...args: any[]) => any) | undefined;
63
+ onOpen?: ((...args: any[]) => any) | undefined;
64
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
65
+ }, {
66
+ readonly mask?: any;
67
+ readonly placement?: any;
58
68
  readonly title?: any;
59
69
  readonly tiny_mode?: any;
60
70
  readonly tiny_mode_root?: any;
@@ -64,19 +74,18 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
64
74
  readonly tiny_theme?: any;
65
75
  readonly tiny_chart_theme?: any;
66
76
  readonly width?: any;
67
- readonly placement?: any;
68
- readonly zIndex?: any;
69
- readonly mask?: any;
70
- readonly visible?: any;
71
77
  readonly customClass?: any;
72
- readonly showClose?: any;
78
+ readonly visible?: any;
73
79
  readonly showHeader?: any;
74
80
  readonly showFooter?: any;
75
- readonly maskClosable?: any;
76
81
  readonly dragable?: any;
82
+ readonly maskClosable?: any;
77
83
  readonly lockScroll?: any;
78
84
  readonly flex?: any;
79
85
  readonly beforeClose?: any;
86
+ readonly zIndex?: any;
87
+ readonly showClose?: any;
80
88
  readonly tipsProps?: any;
89
+ readonly customSlots?: any;
81
90
  }, {}>;
82
91
  export default _default;
@@ -0,0 +1,30 @@
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
+ title: string;
17
+ showClose: boolean;
18
+ showHeader: boolean;
19
+ showFooter: boolean;
20
+ mask: boolean;
21
+ maskClosable: boolean;
22
+ dragable: boolean;
23
+ lockScroll: boolean;
24
+ flex: boolean;
25
+ zIndex: number;
26
+ beforeClose: null;
27
+ tipsProps: null;
28
+ };
29
+ declare const _default: (configs?: {}) => any;
30
+ export default _default;