@opentiny/vue-drawer 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import Drawer from './src/index';
2
+ export default Drawer;
package/lib/index.js ADDED
@@ -0,0 +1,74 @@
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
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ import { $prefix, $props, $setup } from "@opentiny/vue-common";
16
+ import MobileFirstTemplate from "./mobile-first.js";
17
+ var template = function template2() {
18
+ return MobileFirstTemplate;
19
+ };
20
+ var Drawer = {
21
+ name: $prefix + "Drawer",
22
+ props: _extends({}, $props, {
23
+ visible: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ customClass: [String, Object, Array],
28
+ placement: {
29
+ type: String,
30
+ default: "right"
31
+ },
32
+ width: {
33
+ type: String,
34
+ default: "300px"
35
+ },
36
+ title: String,
37
+ showHeader: {
38
+ type: Boolean,
39
+ default: true
40
+ },
41
+ showFooter: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ mask: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ maskClosable: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ dragable: Boolean
54
+ }),
55
+ setup: function setup(props, context) {
56
+ return $setup({
57
+ props,
58
+ context,
59
+ template
60
+ });
61
+ }
62
+ };
63
+ var version = "3.7.0";
64
+ Drawer.model = {
65
+ prop: "modelValue",
66
+ event: "update:modelValue"
67
+ };
68
+ Drawer.install = function(Vue) {
69
+ Vue.component(Drawer.name, Drawer);
70
+ };
71
+ Drawer.version = version;
72
+ export {
73
+ Drawer as default
74
+ };
@@ -0,0 +1,200 @@
1
+ import { renderless, api } from "@opentiny/vue-renderless/drawer/vue";
2
+ import { props, setup as _setup } from "@opentiny/vue-common";
3
+ import { IconClose } from "@opentiny/vue-icon";
4
+ import Button from "@opentiny/vue-button";
5
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
6
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
7
+ if (render) {
8
+ options.render = render;
9
+ options.staticRenderFns = staticRenderFns;
10
+ options._compiled = true;
11
+ }
12
+ if (functionalTemplate) {
13
+ options.functional = true;
14
+ }
15
+ if (scopeId) {
16
+ options._scopeId = "data-v-" + scopeId;
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
+ }
33
+ };
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
+ }
40
+ if (hook) {
41
+ if (options.functional) {
42
+ options._injectStyles = hook;
43
+ var originalRender = options.render;
44
+ options.render = function renderWithStyleInjection(h, context) {
45
+ hook.call(context);
46
+ return originalRender(h, context);
47
+ };
48
+ } else {
49
+ var existing = options.beforeCreate;
50
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
51
+ }
52
+ }
53
+ return {
54
+ exports: scriptExports,
55
+ options
56
+ };
57
+ }
58
+
59
+ var __vue2_script = {
60
+ components: {
61
+ TinyButton: Button,
62
+ IconClose: IconClose()
63
+ },
64
+ props: [].concat(props, ["visible", "title", "showHeader", "showFooter", "customClass", "placement", "width", "mask", "dragable", "maskClosable"]),
65
+ setup: function setup(props2, context) {
66
+ return _setup({
67
+ props: props2,
68
+ context,
69
+ renderless,
70
+ api
71
+ });
72
+ }
73
+ };
74
+ var render = function render2() {
75
+ var _vm = this;
76
+ var _h = _vm.$createElement;
77
+ var _c = _vm._self._c || _h;
78
+ return _c("div", {
79
+ directives: [{
80
+ name: "show",
81
+ rawName: "v-show",
82
+ value: _vm.visible,
83
+ expression: "visible"
84
+ }],
85
+ staticClass: "text-sm",
86
+ attrs: {
87
+ "data-tag": "tiny-drawer"
88
+ }
89
+ }, [_vm.mask ? _c("div", {
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
93
+ }),
94
+ on: {
95
+ "click": function click($event) {
96
+ _vm.maskClosable && _vm.close();
97
+ }
98
+ }
99
+ }) : _vm._e(), _c("div", {
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", {
102
+ "transition-all ease-linear duration-200": !_vm.state.dragEvent.isDrag
103
+ }, {
104
+ "h-full": ["left", "right"].includes(_vm.placement)
105
+ }, {
106
+ "left-0 bottom-0 translate-y-full border-t-0.5": _vm.placement === "bottom"
107
+ }, {
108
+ "left-0 top-0 -translate-y-full border-b-0.5": _vm.placement === "top"
109
+ }, {
110
+ "translate-y-0": ["top", "bottom"].includes(_vm.placement) && _vm.state.toggle
111
+ }, {
112
+ "left-0 top-0 -translate-x-full border-r-0.5": _vm.placement === "left"
113
+ }, {
114
+ "right-0 top-0 translate-x-full border-l-0.5": _vm.placement === "right"
115
+ }, {
116
+ "translate-x-0": ["left", "right"].includes(_vm.placement) && _vm.state.toggle
117
+ }, _vm.customClass),
118
+ style: {
119
+ width: ["left", "right"].includes(_vm.placement) ? _vm.state.computedWidth : null
120
+ },
121
+ attrs: {
122
+ "data-tag": "tiny-drawer-main"
123
+ }
124
+ }, [_vm.dragable ? _c("div", {
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"
171
+ },
172
+ on: {
173
+ "click": _vm.close
174
+ }
175
+ }, [_vm._v(_vm._s(_vm.t("ui.button.cancel")))]), _c("tiny-button", {
176
+ staticClass: "ml-2",
177
+ attrs: {
178
+ "tiny_mode": "mobile-first",
179
+ "type": "primary"
180
+ },
181
+ on: {
182
+ "click": _vm.confirm
183
+ }
184
+ }, [_vm._v(_vm._s(_vm.t("ui.button.confirm")))])];
185
+ })], 2)]) : _vm._e()])])]);
186
+ };
187
+ var staticRenderFns = [];
188
+ var __cssModules = {};
189
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
190
+ function __vue2_injectStyles(context) {
191
+ for (var o in __cssModules) {
192
+ this[o] = __cssModules[o];
193
+ }
194
+ }
195
+ var mobileFirst = /* @__PURE__ */ function() {
196
+ return __component__.exports;
197
+ }();
198
+ export {
199
+ mobileFirst as default
200
+ };
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@opentiny/vue-drawer",
3
+ "version": "2.8.0",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "sideEffects": false,
8
+ "dependencies": {
9
+ "@opentiny/vue-button": "~2.8.0",
10
+ "@opentiny/vue-common": "~2.8.0",
11
+ "@opentiny/vue-renderless": "~3.8.0"
12
+ },
13
+ "license": "MIT",
14
+ "types": "index.d.ts"
15
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ declare const _default: {
2
+ name: string;
3
+ props: {
4
+ visible: {
5
+ type: BooleanConstructor;
6
+ default: boolean;
7
+ };
8
+ customClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
9
+ placement: {
10
+ type: StringConstructor;
11
+ default: string;
12
+ };
13
+ width: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ };
17
+ title: StringConstructor;
18
+ showHeader: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ showFooter: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ mask: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ maskClosable: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ dragable: BooleanConstructor;
35
+ tiny_mode: StringConstructor;
36
+ tiny_mode_root: BooleanConstructor;
37
+ tiny_template: (FunctionConstructor | ObjectConstructor)[];
38
+ tiny_renderless: FunctionConstructor;
39
+ tiny_theme: StringConstructor;
40
+ tiny_chart_theme: ObjectConstructor;
41
+ };
42
+ setup(props: any, context: any): () => import("vue").VNode;
43
+ };
44
+ export default _default;
@@ -0,0 +1,139 @@
1
+ declare const _sfc_main: {
2
+ components: {
3
+ TinyButton: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<() => import("vue").VNode> & import("@vue/composition-api").Data, {}, {}, {
4
+ type: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ tabindex: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ icon: {
13
+ type: (StringConstructor | ObjectConstructor)[];
14
+ default: string;
15
+ };
16
+ text: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ resetTime: {
21
+ type: NumberConstructor;
22
+ default: number;
23
+ };
24
+ nativeType: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ size: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ validator(val: string): boolean;
32
+ };
33
+ round: BooleanConstructor;
34
+ plain: BooleanConstructor;
35
+ circle: BooleanConstructor;
36
+ loading: BooleanConstructor;
37
+ disabled: BooleanConstructor;
38
+ autofocus: BooleanConstructor;
39
+ buttonClass: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ tiny_mode: StringConstructor;
44
+ tiny_mode_root: BooleanConstructor;
45
+ tiny_template: (FunctionConstructor | ObjectConstructor)[];
46
+ tiny_renderless: FunctionConstructor;
47
+ tiny_theme: StringConstructor;
48
+ tiny_chart_theme: ObjectConstructor;
49
+ }, {
50
+ type: string;
51
+ size: string;
52
+ disabled: boolean;
53
+ tabindex: string;
54
+ round: boolean;
55
+ tiny_mode_root: boolean;
56
+ icon: string;
57
+ text: string;
58
+ plain: boolean;
59
+ circle: boolean;
60
+ loading: boolean;
61
+ autofocus: boolean;
62
+ resetTime: number;
63
+ nativeType: string;
64
+ buttonClass: string;
65
+ } & {
66
+ tiny_mode?: string | undefined;
67
+ tiny_template?: unknown;
68
+ tiny_renderless?: Function | undefined;
69
+ tiny_theme?: string | undefined;
70
+ tiny_chart_theme?: Record<string, any> | undefined;
71
+ }> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
72
+ type: string;
73
+ size: string;
74
+ disabled: boolean;
75
+ tabindex: string;
76
+ round: boolean;
77
+ tiny_mode_root: boolean;
78
+ icon: string;
79
+ text: string;
80
+ plain: boolean;
81
+ circle: boolean;
82
+ loading: boolean;
83
+ autofocus: boolean;
84
+ resetTime: number;
85
+ nativeType: string;
86
+ buttonClass: string;
87
+ } & {
88
+ tiny_mode?: string | undefined;
89
+ tiny_template?: unknown;
90
+ tiny_renderless?: Function | undefined;
91
+ tiny_theme?: string | undefined;
92
+ tiny_chart_theme?: Record<string, any> | undefined;
93
+ }, import("@vue/composition-api").ShallowUnwrapRef<() => import("vue").VNode>, import("@vue/composition-api").Data, {}, {}, {
94
+ type: string;
95
+ size: string;
96
+ disabled: boolean;
97
+ tabindex: string;
98
+ round: boolean;
99
+ tiny_mode_root: boolean;
100
+ icon: string;
101
+ text: string;
102
+ plain: boolean;
103
+ circle: boolean;
104
+ loading: boolean;
105
+ autofocus: boolean;
106
+ resetTime: number;
107
+ nativeType: string;
108
+ buttonClass: string;
109
+ } & {
110
+ tiny_mode?: string | undefined;
111
+ tiny_template?: unknown;
112
+ tiny_renderless?: Function | undefined;
113
+ tiny_theme?: string | undefined;
114
+ tiny_chart_theme?: Record<string, any> | undefined;
115
+ }, {
116
+ type: string;
117
+ size: string;
118
+ tabindex: string;
119
+ icon: string;
120
+ text: string;
121
+ resetTime: number;
122
+ nativeType: string;
123
+ buttonClass: string;
124
+ }, true>);
125
+ IconClose: any;
126
+ };
127
+ props: string[];
128
+ setup(props: any, context: any): {
129
+ t: (this: any, path: any, options?: any) => any;
130
+ vm: any;
131
+ f: (props: any, attrs?: {}) => {};
132
+ a: (attrs: any, filters: any, include: any) => {};
133
+ d: (props: any) => void;
134
+ dp: (props: any) => void;
135
+ gcls: (key: any) => any;
136
+ m: (...cssClasses: any[]) => string;
137
+ };
138
+ };
139
+ export default _sfc_main;