@opentiny/vue-drawer 2.8.3 → 2.9.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
@@ -13,13 +13,34 @@ function _extends() {
13
13
  return _extends.apply(this, arguments);
14
14
  }
15
15
  import { $prefix, $props, $setup } from "@opentiny/vue-common";
16
+ import PcTemplate from "./pc.js";
16
17
  import MobileFirstTemplate from "./mobile-first.js";
17
- var template = function template2() {
18
- return MobileFirstTemplate;
18
+ var template = function template2(mode) {
19
+ if ("pc" === (process.env.TINY_MODE || mode)) {
20
+ return PcTemplate;
21
+ }
22
+ if ("mobile-first" === (process.env.TINY_MODE || mode)) {
23
+ return MobileFirstTemplate;
24
+ }
25
+ return PcTemplate;
26
+ };
27
+ var $constants = {
28
+ SCROLL_LOCK_CLASS: function SCROLL_LOCK_CLASS(mode) {
29
+ var scrollLockClasses = {
30
+ "mobile-first": "overflow-hidden"
31
+ };
32
+ return scrollLockClasses[mode] || "";
33
+ }
19
34
  };
20
35
  var Drawer = {
21
36
  name: $prefix + "Drawer",
22
37
  props: _extends({}, $props, {
38
+ _constants: {
39
+ type: Object,
40
+ default: function _default() {
41
+ return $constants;
42
+ }
43
+ },
23
44
  visible: {
24
45
  type: Boolean,
25
46
  default: false
@@ -31,9 +52,13 @@ var Drawer = {
31
52
  },
32
53
  width: {
33
54
  type: String,
34
- default: "300px"
55
+ default: "500px"
35
56
  },
36
57
  title: String,
58
+ showClose: {
59
+ type: Boolean,
60
+ default: true
61
+ },
37
62
  showHeader: {
38
63
  type: Boolean,
39
64
  default: true
@@ -50,7 +75,19 @@ var Drawer = {
50
75
  type: Boolean,
51
76
  default: true
52
77
  },
53
- dragable: Boolean
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
+ }
54
91
  }),
55
92
  setup: function setup(props, context) {
56
93
  return $setup({
@@ -60,7 +97,7 @@ var Drawer = {
60
97
  });
61
98
  }
62
99
  };
63
- var version = "3.7.0";
100
+ var version = "2.9.0";
64
101
  Drawer.model = {
65
102
  prop: "modelValue",
66
103
  event: "update:modelValue"
@@ -61,7 +61,7 @@ var __vue2_script = {
61
61
  TinyButton: Button,
62
62
  IconClose: IconClose()
63
63
  },
64
- props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable"]),
64
+ props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable", "lockScroll", "flex"]),
65
65
  setup: function setup(props2, context) {
66
66
  return _setup({
67
67
  props: props2,
@@ -88,8 +88,8 @@ var render = function render2() {
88
88
  }
89
89
  }, [_vm.mask ? _c("div", {
90
90
  ref: "mask",
91
- class: _vm.m("fixed z-50 inset-0 w-full h-full bg-black opacity-0 transition-opacity ease-linear duration-200", {
92
- "opacity-30": _vm.state.toggle
91
+ class: _vm.m("fixed z-50 left-0 right-0 top-0 bottom-0 w-full h-full transition-opacity ease-linear duration-200", {
92
+ "bg-color-bg-7": _vm.state.toggle
93
93
  }),
94
94
  on: {
95
95
  "click": function click($event) {
@@ -98,10 +98,12 @@ var render = function render2() {
98
98
  }
99
99
  }) : _vm._e(), _c("div", {
100
100
  ref: "drawerBox",
101
- class: _vm.m("fixed w-full max-w-full flex flex-col bg-white z-50 shadow-sm border-color-border-separator", {
101
+ class: _vm.m("fixed w-full max-w-full flex flex-col bg-color-bg-1 z-50 shadow-sm border-color-border-separator", {
102
102
  "transition-all ease-linear duration-200": !_vm.state.dragEvent.isDrag
103
103
  }, {
104
104
  "h-full": ["left", "right"].includes(_vm.placement)
105
+ }, {
106
+ "max-h-full": ["top", "bottom"].includes(_vm.placement)
105
107
  }, {
106
108
  "left-0 bottom-0 translate-y-full border-t-0.5": _vm.placement === "bottom"
107
109
  }, {
@@ -128,10 +130,10 @@ var render = function render2() {
128
130
  "data-tag": "drawer-drag-bar"
129
131
  }
130
132
  }) : _vm._e(), _c("div", {
131
- class: ["flex-auto flex-col flex max-h-full"]
133
+ class: ["flex-auto flex-col flex max-h-full overflow-hidden"]
132
134
  }, [_vm.showHeader ? _c("div", {
133
135
  ref: "header",
134
- staticClass: "flex leading-6 p-4 text-base items-center",
136
+ staticClass: "flex-none flex leading-6 p-4 text-base items-center",
135
137
  attrs: {
136
138
  "data-tag": "drawer-header"
137
139
  }
@@ -152,7 +154,9 @@ var render = function render2() {
152
154
  })], 2)];
153
155
  })], 2) : _vm._e(), _c("div", {
154
156
  ref: "body",
155
- staticClass: "flex-auto flex flex-col overflow-auto",
157
+ class: ["flex-auto overflow-auto", {
158
+ "flex flex-col": _vm.flex
159
+ }],
156
160
  attrs: {
157
161
  "data-tag": "drawer-body"
158
162
  }
package/lib/pc.js ADDED
@@ -0,0 +1,197 @@
1
+ import { renderless, api } from "@opentiny/vue-renderless/drawer/vue";
2
+ import { props, setup as _setup } from "@opentiny/vue-common";
3
+ import "@opentiny/vue-theme/drawer/index.css";
4
+ import { IconClose } from "@opentiny/vue-icon";
5
+ import Button from "@opentiny/vue-button";
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
+ if (functionalTemplate) {
14
+ options.functional = true;
15
+ }
16
+ if (scopeId) {
17
+ options._scopeId = "data-v-" + scopeId;
18
+ }
19
+ var hook;
20
+ if (moduleIdentifier) {
21
+ hook = function hook2(context) {
22
+ context = context || // cached call
23
+ this.$vnode && this.$vnode.ssrContext || // stateful
24
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
25
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
26
+ context = __VUE_SSR_CONTEXT__;
27
+ }
28
+ if (injectStyles) {
29
+ injectStyles.call(this, context);
30
+ }
31
+ if (context && context._registeredComponents) {
32
+ context._registeredComponents.add(moduleIdentifier);
33
+ }
34
+ };
35
+ options._ssrRegister = hook;
36
+ } else if (injectStyles) {
37
+ hook = shadowMode ? function() {
38
+ injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
39
+ } : injectStyles;
40
+ }
41
+ if (hook) {
42
+ if (options.functional) {
43
+ options._injectStyles = hook;
44
+ var originalRender = options.render;
45
+ options.render = function renderWithStyleInjection(h, context) {
46
+ hook.call(context);
47
+ return originalRender(h, context);
48
+ };
49
+ } else {
50
+ var existing = options.beforeCreate;
51
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
52
+ }
53
+ }
54
+ return {
55
+ exports: scriptExports,
56
+ options
57
+ };
58
+ }
59
+
60
+ var __vue2_script = {
61
+ components: {
62
+ TinyButton: Button,
63
+ IconClose: IconClose()
64
+ },
65
+ props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable", "lockScroll", "flex", "showClose", "zIndex"]),
66
+ setup: function setup(props2, context) {
67
+ return _setup({
68
+ props: props2,
69
+ context,
70
+ renderless,
71
+ api
72
+ });
73
+ }
74
+ };
75
+ var render = function render2() {
76
+ var _vm = this;
77
+ var _h = _vm.$createElement;
78
+ var _c = _vm._self._c || _h;
79
+ return _c("div", {
80
+ directives: [{
81
+ name: "show",
82
+ rawName: "v-show",
83
+ value: _vm.visible,
84
+ expression: "visible"
85
+ }],
86
+ staticClass: "tiny-drawer",
87
+ attrs: {
88
+ "data-tag": "tiny-drawer"
89
+ }
90
+ }, [_vm.mask ? _c("div", {
91
+ ref: "mask",
92
+ class: ["tiny-drawer__mask", {
93
+ "show-bg-color": _vm.state.toggle
94
+ }],
95
+ style: {
96
+ zIndex: _vm.zIndex
97
+ },
98
+ on: {
99
+ "click": function click($event) {
100
+ _vm.maskClosable && _vm.close();
101
+ }
102
+ }
103
+ }) : _vm._e(), _c("div", {
104
+ ref: "drawerBox",
105
+ class: ["tiny-drawer__main", {
106
+ "is-left": _vm.placement === "left",
107
+ "is-right": _vm.placement === "right",
108
+ "is-top": _vm.placement === "top",
109
+ "is-bottom": _vm.placement === "bottom",
110
+ "drag-effects": !_vm.state.dragEvent.isDrag
111
+ }, _vm.customClass],
112
+ style: {
113
+ width: ["left", "right"].includes(_vm.placement) ? _vm.state.computedWidth : null,
114
+ zIndex: _vm.zIndex
115
+ },
116
+ attrs: {
117
+ "data-tag": "tiny-drawer-main"
118
+ }
119
+ }, [_vm.dragable ? _c("div", {
120
+ ref: "dragBar",
121
+ class: ["tiny-drawer__drag-bar"],
122
+ attrs: {
123
+ "data-tag": "drawer-drag-bar"
124
+ }
125
+ }) : _vm._e(), _c("div", {
126
+ staticClass: "tiny-drawer__box"
127
+ }, [_vm.showHeader ? _c("div", {
128
+ ref: "header",
129
+ staticClass: "tiny-drawer__header-wrapper",
130
+ attrs: {
131
+ "data-tag": "drawer-header"
132
+ }
133
+ }, [_vm._t("header", function() {
134
+ return [_c("div", {
135
+ staticClass: "tiny-drawer__header"
136
+ }, [_vm.title ? _c("div", {
137
+ staticClass: "tiny-drawer__title"
138
+ }, [_vm._v(_vm._s(_vm.title))]) : _vm._e(), _c("div", {
139
+ staticClass: "tiny-drawer__header-right"
140
+ }, [_vm._t("header-right")], 2)])];
141
+ }), _vm.showClose ? _c("button", {
142
+ staticClass: "tiny-drawer__headerbtn",
143
+ attrs: {
144
+ "type": "button",
145
+ "aria-label": "Close"
146
+ },
147
+ on: {
148
+ "click": _vm.close
149
+ }
150
+ }, [_c("icon-close", {
151
+ staticClass: "tiny-svg-size tiny-drawer__close"
152
+ })], 1) : _vm._e()], 2) : _vm._e(), _c("div", {
153
+ ref: "body",
154
+ class: ["tiny-drawer__body", {
155
+ "flex flex-col": _vm.flex
156
+ }],
157
+ attrs: {
158
+ "data-tag": "drawer-body"
159
+ }
160
+ }, [_vm._t("default")], 2), _vm.showFooter ? _c("div", {
161
+ ref: "footer",
162
+ staticClass: "tiny-drawer__footer",
163
+ attrs: {
164
+ "data-tag": "drawer-footer"
165
+ }
166
+ }, [_vm._t("footer", function() {
167
+ return [_c("tiny-button", {
168
+ attrs: {
169
+ "type": "primary"
170
+ },
171
+ on: {
172
+ "click": _vm.confirm
173
+ }
174
+ }, [_vm._v(_vm._s(_vm.t("ui.button.confirm")))]), _c("tiny-button", {
175
+ attrs: {
176
+ "plain": ""
177
+ },
178
+ on: {
179
+ "click": _vm.close
180
+ }
181
+ }, [_vm._v(_vm._s(_vm.t("ui.button.cancel")))])];
182
+ })], 2) : _vm._e()])])]);
183
+ };
184
+ var staticRenderFns = [];
185
+ var __cssModules = {};
186
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
187
+ function __vue2_injectStyles(context) {
188
+ for (var o in __cssModules) {
189
+ this[o] = __cssModules[o];
190
+ }
191
+ }
192
+ var pc = /* @__PURE__ */ function() {
193
+ return __component__.exports;
194
+ }();
195
+ export {
196
+ pc as default
197
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@opentiny/vue-drawer",
3
- "version": "2.8.3",
3
+ "version": "2.9.0",
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": "~2.8.3",
10
- "@opentiny/vue-common": "~2.8.3",
11
- "@opentiny/vue-renderless": "~3.8.3"
9
+ "@opentiny/vue-button": "~2.9.0",
10
+ "@opentiny/vue-common": "~2.9.0",
11
+ "@opentiny/vue-renderless": "~3.9.0"
12
12
  },
13
13
  "license": "MIT",
14
14
  "types": "index.d.ts"
package/src/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  declare const _default: {
2
2
  name: string;
3
3
  props: {
4
+ _constants: {
5
+ type: ObjectConstructor;
6
+ default: () => {
7
+ SCROLL_LOCK_CLASS(mode: any): any;
8
+ };
9
+ };
4
10
  visible: {
5
11
  type: BooleanConstructor;
6
12
  default: boolean;
@@ -15,6 +21,10 @@ declare const _default: {
15
21
  default: string;
16
22
  };
17
23
  title: StringConstructor;
24
+ showClose: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
18
28
  showHeader: {
19
29
  type: BooleanConstructor;
20
30
  default: boolean;
@@ -32,6 +42,18 @@ declare const _default: {
32
42
  default: boolean;
33
43
  };
34
44
  dragable: BooleanConstructor;
45
+ lockScroll: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ flex: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ zIndex: {
54
+ type: NumberConstructor;
55
+ default: number;
56
+ };
35
57
  tiny_mode: StringConstructor;
36
58
  tiny_mode_root: BooleanConstructor;
37
59
  tiny_template: (ObjectConstructor | FunctionConstructor)[];
@@ -0,0 +1,15 @@
1
+ declare const _sfc_main: {
2
+ components: undefined;
3
+ props: string[];
4
+ setup(props: any, context: any): {
5
+ t: (this: any, path: any, options?: any) => any;
6
+ vm: any;
7
+ f: (props: any, attrs?: {}) => {};
8
+ a: (attrs: any, filters: any, include: any) => {};
9
+ d: (props: any) => void;
10
+ dp: (props: any) => void;
11
+ gcls: (key: any) => any;
12
+ m: (...cssClasses: any[]) => string;
13
+ };
14
+ };
15
+ export default _sfc_main;