@opentiny/vue-drawer 3.15.0 → 3.17.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/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.15.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.17.0";
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,
@@ -79,7 +71,7 @@ var _hoisted_3 = {
79
71
  };
80
72
  var _hoisted_4 = {
81
73
  key: 0,
82
- class: "max-w-[80%] pr-4 text-left truncate"
74
+ class: "max-w-[80%] pr-4 text-left truncate text-color-text-primary"
83
75
  };
84
76
  var _hoisted_5 = {
85
77
  class: "flex-1 flex items-center justify-end"
@@ -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,16 +122,17 @@ 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
- width: ["left", "right"].includes(_ctx.placement) ? _ctx.state.computedWidth : null
134
+ width: ["left", "right"].includes(_ctx.placement) ? _ctx.state.computedWidth : null,
135
+ height: ["top", "bottom"].includes(_ctx.placement) && _ctx.dragable && _ctx.state.height ? _ctx.state.height + "px" : null
143
136
  })
144
137
  },
145
138
  [_ctx.dragable ? (openBlock(), createElementBlock(
@@ -148,7 +141,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
148
141
  key: 0,
149
142
  "data-tag": "drawer-drag-bar",
150
143
  ref: "dragBar",
151
- class: normalizeClass(["h-full absolute top-0 w-2 cursor-e-resize", _ctx.placement === "left" ? "-right-1" : "-left-1"])
144
+ class: normalizeClass(["absolute", ["left", "right"].includes(_ctx.placement) && "cursor-e-resize h-full top-0 w-2", ["top", "bottom"].includes(_ctx.placement) && "cursor-n-resize w-full h-2 left-0", _ctx.placement === "left" && "-right-1", _ctx.placement === "right" && "-left-1", _ctx.placement === "top" && "-bottom-1", _ctx.placement === "bottom" && "-top-1"])
152
145
  },
153
146
  null,
154
147
  2
@@ -166,6 +159,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
166
159
  )) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_5, [renderSlot(_ctx.$slots, "header-right", {}, function() {
167
160
  return [createVNode(_component_IconClose, {
168
161
  "custom-class": "h-5 w-5 cursor-pointer",
162
+ class: "fill-color-icon-primary",
169
163
  onClick: _cache[1] || (_cache[1] = function($event) {
170
164
  return _ctx.handleClose("close");
171
165
  })
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"],
62
66
  setup: function setup$1(props2, context) {
63
67
  return setup({
64
68
  props: props2,
@@ -73,40 +77,36 @@ var _hoisted_1 = {
73
77
  class: "tiny-drawer"
74
78
  };
75
79
  var _hoisted_2 = {
76
- key: 0,
77
- "data-tag": "drawer-drag-bar",
78
- ref: "dragBar",
79
- class: /* @__PURE__ */ normalizeClass(["tiny-drawer__drag-bar"])
80
- };
81
- var _hoisted_3 = {
82
80
  class: "tiny-drawer__box"
83
81
  };
84
- var _hoisted_4 = {
82
+ var _hoisted_3 = {
85
83
  key: 0,
86
84
  "data-tag": "drawer-header",
87
85
  ref: "header",
88
86
  class: "tiny-drawer__header-wrapper"
89
87
  };
90
- var _hoisted_5 = {
88
+ var _hoisted_4 = {
89
+ key: 1,
91
90
  class: "tiny-drawer__header"
92
91
  };
93
- var _hoisted_6 = {
92
+ var _hoisted_5 = {
94
93
  class: "tiny-drawer__header-left"
95
94
  };
96
- var _hoisted_7 = {
95
+ var _hoisted_6 = {
97
96
  key: 0,
98
97
  class: "tiny-drawer__title"
99
98
  };
100
- var _hoisted_8 = {
99
+ var _hoisted_7 = {
101
100
  class: "tiny-drawer__header-right"
102
101
  };
103
- var _hoisted_9 = {
102
+ var _hoisted_8 = {
104
103
  key: 1,
105
104
  "data-tag": "drawer-footer",
106
105
  ref: "footer",
107
106
  class: "tiny-drawer__footer"
108
107
  };
109
108
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
109
+ var _component_slot_wrapper = resolveComponent("slot-wrapper");
110
110
  var _component_icon_help_circle = resolveComponent("icon-help-circle");
111
111
  var _component_tiny_tooltip = resolveComponent("tiny-tooltip");
112
112
  var _component_icon_close = resolveComponent("icon-close");
@@ -115,14 +115,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
115
115
  name: "drawer-fade"
116
116
  }, {
117
117
  default: withCtx(function() {
118
- return [_ctx.mask && _ctx.visible ? (openBlock(), createElementBlock(
118
+ return [_ctx.mask && _ctx.state.visible ? (openBlock(), createElementBlock(
119
119
  "div",
120
120
  {
121
121
  key: 0,
122
122
  ref: "mask",
123
- class: normalizeClass(["tiny-drawer__mask", {
124
- "show-bg-color": _ctx.state.toggle
125
- }]),
123
+ class: "tiny-drawer__mask show-bg-color",
126
124
  style: normalizeStyle({
127
125
  zIndex: _ctx.zIndex
128
126
  }),
@@ -131,8 +129,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
131
129
  })
132
130
  },
133
131
  null,
134
- 6
135
- /* CLASS, STYLE */
132
+ 4
133
+ /* STYLE */
136
134
  )) : createCommentVNode("v-if", true)];
137
135
  }),
138
136
  _: 1
@@ -153,26 +151,36 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
153
151
  "is-top": _ctx.placement === "top",
154
152
  "is-bottom": _ctx.placement === "bottom",
155
153
  "drag-effects": !_ctx.state.dragEvent.isDrag,
156
- "toggle": _ctx.state.toggle
154
+ "toggle": _ctx.state.visible
157
155
  }, "tiny-drawer-main", _ctx.customClass]),
158
156
  style: normalizeStyle({
159
157
  width: ["left", "right"].includes(_ctx.placement) ? _ctx.state.computedWidth : null,
158
+ height: ["top", "bottom"].includes(_ctx.placement) && _ctx.dragable && _ctx.state.height ? _ctx.state.height + "px" : null,
160
159
  zIndex: _ctx.zIndex
161
160
  })
162
161
  },
163
162
  [_ctx.dragable ? (openBlock(), createElementBlock(
164
163
  "div",
165
- _hoisted_2,
164
+ {
165
+ key: 0,
166
+ "data-tag": "drawer-drag-bar",
167
+ ref: "dragBar",
168
+ class: normalizeClass(["tiny-drawer__drag-bar", ["left", "right"].includes(_ctx.placement) && "p-left-Right", ["top", "bottom"].includes(_ctx.placement) && "p-top-Bottom", _ctx.placement === "left" && "p-left", _ctx.placement === "right" && "p-right", _ctx.placement === "top" && "p-top", _ctx.placement === "bottom" && "p-bottom"])
169
+ },
166
170
  null,
167
- 512
168
- /* NEED_PATCH */
169
- )) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_3, [_ctx.showHeader ? (openBlock(), createElementBlock(
171
+ 2
172
+ /* CLASS */
173
+ )) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_2, [_ctx.showHeader ? (openBlock(), createElementBlock(
170
174
  "div",
171
- _hoisted_4,
175
+ _hoisted_3,
172
176
  [renderSlot(_ctx.$slots, "header", {}, function() {
173
- return [createElementVNode("div", _hoisted_5, [createElementVNode("div", _hoisted_6, [_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
- _hoisted_7,
183
+ _hoisted_6,
176
184
  toDisplayString(_ctx.title),
177
185
  1
178
186
  /* TEXT */
@@ -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_8, [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
- _hoisted_9,
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.15.0",
3
+ "version": "3.17.0",
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.15.0",
11
- "@opentiny/vue-tooltip": "~3.15.0",
12
- "@opentiny/vue-common": "~3.15.0",
13
- "@opentiny/vue-renderless": "~3.15.0",
14
- "@opentiny/vue-icon": "~3.15.0",
15
- "@opentiny/vue-theme": "~3.15.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;
@@ -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)[];
@@ -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)[];
@@ -125,7 +131,7 @@ declare const _default: import("@vue/runtime-core").DefineComponent<{
125
131
  tiny_chart_theme: ObjectConstructor;
126
132
  }, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
127
133
  [key: string]: any;
128
- }>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
134
+ }>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
129
135
  _constants: {
130
136
  type: ObjectConstructor;
131
137
  default: () => {
@@ -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)[];
@@ -192,8 +199,8 @@ declare const _default: import("@vue/runtime-core").DefineComponent<{
192
199
  _constants: Record<string, any>;
193
200
  placement: string;
194
201
  zIndex: number;
195
- visible: boolean;
196
202
  mask: boolean;
203
+ visible: boolean;
197
204
  showClose: boolean;
198
205
  showHeader: boolean;
199
206
  showFooter: boolean;
@@ -9,8 +9,8 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
9
9
  tiny_chart_theme?: any;
10
10
  width?: any;
11
11
  placement?: any;
12
- visible?: any;
13
12
  mask?: any;
13
+ visible?: any;
14
14
  customClass?: any;
15
15
  showHeader?: any;
16
16
  showFooter?: any;
@@ -27,7 +27,7 @@ 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").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
30
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("close" | "confirm" | "update:visible" | "open")[], "close" | "confirm" | "update:visible" | "open", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
31
31
  title?: any;
32
32
  tiny_mode?: any;
33
33
  tiny_mode_root?: any;
@@ -38,8 +38,8 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
38
38
  tiny_chart_theme?: any;
39
39
  width?: any;
40
40
  placement?: any;
41
- visible?: any;
42
41
  mask?: any;
42
+ visible?: any;
43
43
  customClass?: any;
44
44
  showHeader?: any;
45
45
  showFooter?: any;
@@ -48,7 +48,12 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
48
48
  lockScroll?: any;
49
49
  flex?: any;
50
50
  beforeClose?: any;
51
- }>>>, {
51
+ }>>> & {
52
+ onClose?: ((...args: any[]) => any) | undefined;
53
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
54
+ onConfirm?: ((...args: any[]) => any) | undefined;
55
+ onOpen?: ((...args: any[]) => any) | undefined;
56
+ }, {
52
57
  readonly title?: any;
53
58
  readonly tiny_mode?: any;
54
59
  readonly tiny_mode_root?: any;
@@ -59,8 +64,8 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
59
64
  readonly tiny_chart_theme?: any;
60
65
  readonly width?: any;
61
66
  readonly placement?: any;
62
- readonly visible?: any;
63
67
  readonly mask?: any;
68
+ readonly visible?: any;
64
69
  readonly customClass?: any;
65
70
  readonly showHeader?: any;
66
71
  readonly showFooter?: any;
package/src/pc.vue.d.ts CHANGED
@@ -10,8 +10,8 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
10
10
  width?: any;
11
11
  placement?: any;
12
12
  zIndex?: any;
13
- visible?: any;
14
13
  mask?: any;
14
+ visible?: any;
15
15
  customClass?: any;
16
16
  showClose?: any;
17
17
  showHeader?: any;
@@ -22,6 +22,7 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
22
22
  flex?: any;
23
23
  beforeClose?: 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,7 @@ 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").VNodeProps & import("@vue/runtime-core").AllowedComponentProps & import("@vue/runtime-core").ComponentCustomProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
34
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("close" | "confirm" | "update:visible" | "open")[], "close" | "confirm" | "update:visible" | "open", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
34
35
  title?: any;
35
36
  tiny_mode?: any;
36
37
  tiny_mode_root?: any;
@@ -42,8 +43,8 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
42
43
  width?: any;
43
44
  placement?: any;
44
45
  zIndex?: any;
45
- visible?: any;
46
46
  mask?: any;
47
+ visible?: any;
47
48
  customClass?: any;
48
49
  showClose?: any;
49
50
  showHeader?: any;
@@ -54,7 +55,13 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
54
55
  flex?: any;
55
56
  beforeClose?: any;
56
57
  tipsProps?: any;
57
- }>>>, {
58
+ customSlots?: any;
59
+ }>>> & {
60
+ onClose?: ((...args: any[]) => any) | undefined;
61
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
62
+ onConfirm?: ((...args: any[]) => any) | undefined;
63
+ onOpen?: ((...args: any[]) => any) | undefined;
64
+ }, {
58
65
  readonly title?: any;
59
66
  readonly tiny_mode?: any;
60
67
  readonly tiny_mode_root?: any;
@@ -66,8 +73,8 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
66
73
  readonly width?: any;
67
74
  readonly placement?: any;
68
75
  readonly zIndex?: any;
69
- readonly visible?: any;
70
76
  readonly mask?: any;
77
+ readonly visible?: any;
71
78
  readonly customClass?: any;
72
79
  readonly showClose?: any;
73
80
  readonly showHeader?: any;
@@ -78,5 +85,6 @@ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
78
85
  readonly flex?: any;
79
86
  readonly beforeClose?: any;
80
87
  readonly tipsProps?: any;
88
+ readonly customSlots?: any;
81
89
  }, {}>;
82
90
  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;