@opentinyvue/vue-dialog-box 2.21.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,13 @@
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
+ import DialogBox from './src/index';
13
+ export default DialogBox;
package/lib/index.js ADDED
@@ -0,0 +1,214 @@
1
+ function _extends() {
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) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6
+ }
7
+ return n;
8
+ }, _extends.apply(null, arguments);
9
+ }
10
+ import { defineComponent, $prefix, $setup, $props } from "@opentinyvue/vue-common";
11
+ import PcTemplate from "./pc.js";
12
+ import MobileTemplate from "./mobile.js";
13
+ import MobileFirstTemplate from "./mobile-first.js";
14
+ var template = function template2(mode) {
15
+ var _process$env;
16
+ var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
17
+ if ("pc" === (tinyMode || mode)) {
18
+ return PcTemplate;
19
+ }
20
+ if ("mobile" === (tinyMode || mode)) {
21
+ return MobileTemplate;
22
+ }
23
+ if ("mobile-first" === (tinyMode || mode)) {
24
+ return MobileFirstTemplate;
25
+ }
26
+ return PcTemplate;
27
+ };
28
+ var $constants = {
29
+ DIALOG_SLIDER_RIGHT: "dialog-slideRight",
30
+ DIALOG_FADE: "dialog-fade",
31
+ SELECT_DROPDOWN: $prefix + "SelectDropdown",
32
+ DROPDOWN_MENU: $prefix + "DropdownMenu",
33
+ DIALOG_BOX_CLASS: "div.tiny-dialog-box",
34
+ PC_SCROLL_LOCK_CLASS: "dialog-box__scroll-lock",
35
+ MOBILE_SCROLL_LOCK_CLASS: "mobile-dialog-box__scroll-lock",
36
+ DIALOG_BOX_DATA_TAG: "tiny-dialog-box",
37
+ Mode: "pc",
38
+ SCROLL_LOCK_CLASS: function SCROLL_LOCK_CLASS(mode) {
39
+ return mode === this.Mode ? this.PC_SCROLL_LOCK_CLASS : this.MOBILE_SCROLL_LOCK_CLASS;
40
+ }
41
+ };
42
+ var dialogBoxProps = _extends({}, $props, {
43
+ _constants: {
44
+ type: Object,
45
+ default: function _default() {
46
+ return $constants;
47
+ }
48
+ },
49
+ appendToBody: {
50
+ type: Boolean,
51
+ default: function _default2() {
52
+ return false;
53
+ }
54
+ },
55
+ beforeClose: Function,
56
+ center: {
57
+ type: Boolean,
58
+ default: function _default3() {
59
+ return false;
60
+ }
61
+ },
62
+ closeOnClickModal: {
63
+ type: Boolean,
64
+ default: function _default4() {
65
+ return true;
66
+ }
67
+ },
68
+ closeOnPressEscape: {
69
+ type: Boolean,
70
+ default: function _default5() {
71
+ return true;
72
+ }
73
+ },
74
+ destroyOnClose: {
75
+ type: Boolean,
76
+ default: function _default6() {
77
+ return false;
78
+ }
79
+ },
80
+ dialogClass: {
81
+ type: String,
82
+ default: function _default7() {
83
+ return "";
84
+ }
85
+ },
86
+ draggable: {
87
+ type: Boolean,
88
+ default: function _default8() {
89
+ return false;
90
+ }
91
+ },
92
+ dragOutsideWindow: {
93
+ type: Boolean,
94
+ default: function _default9() {
95
+ return false;
96
+ }
97
+ },
98
+ fullscreen: {
99
+ type: Boolean,
100
+ default: function _default10() {
101
+ return false;
102
+ }
103
+ },
104
+ isFormReset: {
105
+ type: Boolean,
106
+ default: function _default11() {
107
+ return true;
108
+ }
109
+ },
110
+ lockScroll: {
111
+ type: Boolean,
112
+ default: function _default12() {
113
+ return true;
114
+ }
115
+ },
116
+ modal: {
117
+ type: Boolean,
118
+ default: function _default13() {
119
+ return true;
120
+ }
121
+ },
122
+ modalAppendToBody: {
123
+ type: Boolean,
124
+ default: function _default14() {
125
+ return true;
126
+ }
127
+ },
128
+ resize: {
129
+ type: Boolean,
130
+ default: function _default15() {
131
+ return false;
132
+ }
133
+ },
134
+ rightSlide: {
135
+ type: Boolean,
136
+ default: function _default16() {
137
+ return false;
138
+ }
139
+ },
140
+ showClose: {
141
+ type: Boolean,
142
+ default: function _default17() {
143
+ return true;
144
+ }
145
+ },
146
+ showHeader: {
147
+ type: Boolean,
148
+ default: function _default18() {
149
+ return true;
150
+ }
151
+ },
152
+ title: {
153
+ type: String,
154
+ default: function _default19() {
155
+ return "";
156
+ }
157
+ },
158
+ top: String,
159
+ visible: {
160
+ type: Boolean,
161
+ default: function _default20() {
162
+ return false;
163
+ }
164
+ },
165
+ width: {
166
+ type: String,
167
+ default: function _default21() {
168
+ return "500px";
169
+ }
170
+ },
171
+ maxHeight: {
172
+ type: String,
173
+ default: function _default22() {
174
+ return "";
175
+ }
176
+ },
177
+ dialogTransition: {
178
+ type: String,
179
+ default: ""
180
+ },
181
+ noAnimation: {
182
+ type: Boolean,
183
+ default: false
184
+ },
185
+ customStyle: {
186
+ type: Object,
187
+ default: function _default23() {
188
+ return {};
189
+ }
190
+ }
191
+ });
192
+ var DialogBox = defineComponent({
193
+ name: $prefix + "DialogBox",
194
+ model: {
195
+ prop: "visible",
196
+ event: "update:visible"
197
+ },
198
+ props: dialogBoxProps,
199
+ setup: function setup(props, context) {
200
+ return $setup({
201
+ props,
202
+ context,
203
+ template
204
+ });
205
+ }
206
+ });
207
+ var version = "2.21.0";
208
+ DialogBox.install = function(Vue) {
209
+ Vue.component(DialogBox.name, DialogBox);
210
+ };
211
+ DialogBox.version = version;
212
+ export {
213
+ DialogBox as default
214
+ };
@@ -0,0 +1,221 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/dialog-box/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import { IconClose, IconFullscreen, IconMinscreen } from '@opentinyvue/vue-icon';
4
+ import ActionSheet from '@opentinyvue/vue-action-sheet';
5
+
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
+ var hook;
14
+ if (injectStyles) {
15
+ hook = injectStyles;
16
+ }
17
+ if (hook) {
18
+ if (options.functional) {
19
+ options._injectStyles = hook;
20
+ var originalRender = options.render;
21
+ options.render = function renderWithStyleInjection(h, context) {
22
+ hook.call(context);
23
+ return originalRender(h, context);
24
+ };
25
+ } else {
26
+ var existing = options.beforeCreate;
27
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
28
+ }
29
+ }
30
+ return {
31
+ exports: scriptExports,
32
+ options
33
+ };
34
+ }
35
+
36
+ var __vue2_script = defineComponent({
37
+ components: {
38
+ IconClose: IconClose(),
39
+ IconFullscreen: IconFullscreen(),
40
+ IconMinscreen: IconMinscreen(),
41
+ TinyActionSheet: ActionSheet
42
+ },
43
+ emits: ["update:visible", "change", "before-close", "open", "close", "opened", "confirm", "cancel", "closed", "drag-start", "drag-move", "drag-end"],
44
+ props: [].concat(props, ["resize", "isFormReset", "visible", "title", "modal", "modalAppendToBody", "appendToBody", "lockScroll", "closeOnClickModal", "closeOnPressEscape", "showClose", "width", "fullscreen", "top", "center", "draggable", "showHeader", "rightSlide", "destroyOnClose", "dialogClass", "beforeClose", "maxHeight", "customStyle", "noAnimation"]),
45
+ model: {
46
+ prop: "visible",
47
+ event: "update:visible"
48
+ },
49
+ setup: function setup$1(props2, context) {
50
+ return setup({
51
+ props: props2,
52
+ context,
53
+ renderless,
54
+ api
55
+ });
56
+ }
57
+ });
58
+ var render = function render2() {
59
+ var _vm = this;
60
+ var _h = _vm.$createElement;
61
+ var _c = _vm._self._c || _h;
62
+ return _c("div", [_vm.state.current !== "default" ? _c("div", [_c("transition", {
63
+ attrs: {
64
+ "duration": _vm.noAnimation ? 0 : void 0,
65
+ "name": _vm.state.animationName
66
+ },
67
+ on: {
68
+ "after-enter": _vm.afterEnter,
69
+ "after-leave": _vm.afterLeave
70
+ }
71
+ }, [_c("div", {
72
+ directives: [{
73
+ name: "show",
74
+ rawName: "v-show",
75
+ value: _vm.visible,
76
+ expression: "visible"
77
+ }],
78
+ class: ["fixed inset-0 m-0 flex items-center", _vm.dialogClass],
79
+ attrs: {
80
+ "data-tag": "tiny-dialog-box__wrapper"
81
+ },
82
+ on: {
83
+ "click": function click($event) {
84
+ if ($event.target !== $event.currentTarget) return null;
85
+ return _vm.handleWrapperClick.apply(null, arguments);
86
+ }
87
+ }
88
+ }, [(_vm.destroyOnClose ? _vm.visible : true) ? _c("div", {
89
+ key: _vm.state.key,
90
+ ref: "dialog",
91
+ staticClass: "absolute bg-color-bg-1 border-none overflow-hidden shadow-xl rounded flex flex-col",
92
+ class: [{
93
+ "left-0 top-0 w-screen h-screen": _vm.state.isFull,
94
+ "text-center": _vm.center,
95
+ "flex flex-col rounded-none": _vm.rightSlide
96
+ }],
97
+ style: _vm.state.style,
98
+ attrs: {
99
+ "data-tag": "tiny-dialog-box"
100
+ }
101
+ }, [_vm.showHeader ? _c("div", {
102
+ staticClass: "px-6 py-4 leading-5.5 bg-color-bg-1 flex justify-between items-center border-b border-b-color-bg-3",
103
+ attrs: {
104
+ "data-tag": "tiny-dialog-box__header"
105
+ },
106
+ on: {
107
+ "mousedown": _vm.handleDrag
108
+ }
109
+ }, [_vm._t("title", function() {
110
+ return [_c("span", {
111
+ staticClass: "text-sm text-color-text-primary mr-4 flex-1 font-bold",
112
+ attrs: {
113
+ "data-tag": "tiny-dialog-box__title"
114
+ }
115
+ }, [_vm._v(_vm._s(_vm.title))])];
116
+ }), _vm.resize && !_vm.state.isFull ? _c("button", {
117
+ staticClass: "border-none p-0 leading-none cursor-pointer focus:outline-0",
118
+ attrs: {
119
+ "type": "button",
120
+ "data-tag": "tiny-dialog-box__headerbtn",
121
+ "aria-label": "Resize"
122
+ },
123
+ on: {
124
+ "click": function click($event) {
125
+ return _vm.toggleFullScreen(true);
126
+ }
127
+ }
128
+ }, [_c("icon-fullscreen", {
129
+ staticClass: "fill-color-text-primary text-base hover:fill-color-brand",
130
+ attrs: {
131
+ "data-tag": "tiny-svg-size tiny-dialog-box__close"
132
+ }
133
+ })], 1) : _vm._e(), _vm.resize && _vm.state.isFull ? _c("button", {
134
+ staticClass: "border-none p-0 leading-none cursor-pointer focus:outline-0",
135
+ attrs: {
136
+ "type": "button",
137
+ "data-tag": "tiny-dialog-box__headerbtn",
138
+ "aria-label": "Resize"
139
+ },
140
+ on: {
141
+ "click": function click($event) {
142
+ return _vm.toggleFullScreen(false);
143
+ }
144
+ }
145
+ }, [_c("icon-minscreen", {
146
+ staticClass: "fill-color-text-primary text-base hover:fill-color-brand",
147
+ attrs: {
148
+ "data-tag": "tiny-svg-size tiny-dialog-box__close"
149
+ }
150
+ })], 1) : _vm._e(), _vm.showClose ? _c("button", {
151
+ staticClass: "border-none p-0 leading-none cursor-pointer focus:outline-0",
152
+ attrs: {
153
+ "type": "button",
154
+ "data-tag": "tiny-dialog-box__headerbtn",
155
+ "aria-label": "Close"
156
+ },
157
+ on: {
158
+ "click": function click($event) {
159
+ return _vm.handleClose("close", $event);
160
+ }
161
+ }
162
+ }, [_c("icon-close", {
163
+ staticClass: "fill-color-text-primary text-base hover:fill-color-brand",
164
+ attrs: {
165
+ "data-tag": "tiny-svg-size tiny-dialog-box__close"
166
+ }
167
+ })], 1) : _vm._e()], 2) : _vm._e(), _c("div", {
168
+ staticClass: "text-left pt-0 pr-6 pb-0 pl-6 mb-3 mt-3 text-color-text-primary leading-5.5 text-sm overflow-auto",
169
+ class: [_vm.rightSlide || _vm.state.isFull ? "max-h-[none] flex-auto" : "max-h-[65vh]"],
170
+ attrs: {
171
+ "data-tag": "tiny-dialog-box__body"
172
+ }
173
+ }, [_vm._t("default")], 2), _vm.slots.footer ? _c("div", {
174
+ staticClass: "pt-4 pr-6 pb-4 pl-6 text-right box-border border-t border-t-color-bg-3 [&_[data-tag=tiny-button]]:mx-1 [&_[data-tag=tiny-button]]:my-0 [&_[data-tag=tiny-toolbar]_[data-tag=tiny-button]]:my-0 [&_[data-tag=tiny-toolbar]_[data-tag=tiny-button]]:mx-1",
175
+ attrs: {
176
+ "data-tag": "tiny-dialog-box__footer"
177
+ }
178
+ }, [_vm._t("footer", null, {
179
+ "beforeClose": _vm.beforeClose
180
+ })], 2) : _vm._e()]) : _vm._e()])])], 1) : _vm._e(), _vm.state.current === "default" ? _c("div", [(_vm.destroyOnClose ? _vm.visible : true) ? _c("tiny-action-sheet", _vm._b({
181
+ ref: "dialog",
182
+ attrs: {
183
+ "show-footer": true,
184
+ "mask": _vm.modal,
185
+ "mask-closable": _vm.closeOnClickModal,
186
+ "before-close": _vm.beforeClose
187
+ },
188
+ on: {
189
+ "update:visible": function updateVisible($event) {
190
+ return _vm.$emit("update:visible", $event);
191
+ }
192
+ },
193
+ scopedSlots: _vm._u([_vm._l(_vm.slots, function(value, name) {
194
+ return {
195
+ key: name,
196
+ fn: function fn(scopeData) {
197
+ return [_c("div", {
198
+ key: name,
199
+ class: {
200
+ "flex w-full justify-between px-4 [&_[data-tag=tiny-button]]:flex-grow [&_[data-tag=tiny-button]:nth-child(2)]:ml-2": name === "footer",
201
+ "px-4 min-h-[250px]": name === "default"
202
+ }
203
+ }, [_vm._t(name, null, null, scopeData)], 2)];
204
+ }
205
+ };
206
+ })], null, true)
207
+ }, "tiny-action-sheet", _vm.$props, false)) : _vm._e()], 1) : _vm._e()]);
208
+ };
209
+ var staticRenderFns = [];
210
+ var __cssModules = {};
211
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
212
+ function __vue2_injectStyles(context) {
213
+ for (var o in __cssModules) {
214
+ this[o] = __cssModules[o];
215
+ }
216
+ }
217
+ var mobileFirst = /* @__PURE__ */ function() {
218
+ return __component__.exports;
219
+ }();
220
+
221
+ export { mobileFirst as default };
package/lib/mobile.js ADDED
@@ -0,0 +1,122 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/dialog-box/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import '@opentinyvue/vue-theme-mobile/dialog-box/index.css';
4
+
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
+ var hook;
13
+ if (injectStyles) {
14
+ hook = injectStyles;
15
+ }
16
+ if (hook) {
17
+ if (options.functional) {
18
+ options._injectStyles = hook;
19
+ var originalRender = options.render;
20
+ options.render = function renderWithStyleInjection(h, context) {
21
+ hook.call(context);
22
+ return originalRender(h, context);
23
+ };
24
+ } else {
25
+ var existing = options.beforeCreate;
26
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
27
+ }
28
+ }
29
+ return {
30
+ exports: scriptExports,
31
+ options
32
+ };
33
+ }
34
+
35
+ var __vue2_script = defineComponent({
36
+ emits: ["update:visible", "change", "before-close", "open", "close", "opened", "confirm", "cancel", "closed"],
37
+ props: [].concat(props, ["visible", "title", "modal", "closeOnClickModal", "modalAppendToBody", "appendToBody", "width", "top", "showHeader", "destroyOnClose"]),
38
+ model: {
39
+ prop: "visible",
40
+ event: "update:visible"
41
+ },
42
+ setup: function setup$1(props2, context) {
43
+ return setup({
44
+ props: props2,
45
+ context,
46
+ renderless,
47
+ api
48
+ });
49
+ }
50
+ });
51
+ var render = function render2() {
52
+ var _vm = this;
53
+ var _h = _vm.$createElement;
54
+ var _c = _vm._self._c || _h;
55
+ return _c("transition", {
56
+ attrs: {
57
+ "name": "dialog-fade"
58
+ }
59
+ }, [_c("div", {
60
+ directives: [{
61
+ name: "show",
62
+ rawName: "v-show",
63
+ value: _vm.visible,
64
+ expression: "visible"
65
+ }],
66
+ staticClass: "tiny-mobile-dialog-box__wrapper",
67
+ on: {
68
+ "click": function click($event) {
69
+ if ($event.target !== $event.currentTarget) return null;
70
+ return _vm.handleWrapperClick.apply(null, arguments);
71
+ }
72
+ }
73
+ }, [_c("div", {
74
+ key: _vm.state.key,
75
+ ref: "dialog",
76
+ staticClass: "tiny-mobile-dialog-box",
77
+ class: {
78
+ "is-hide-header": !_vm.showHeader
79
+ }
80
+ }, [_vm.showHeader ? _c("div", {
81
+ staticClass: "tiny-mobile-dialog-box__header"
82
+ }, [_vm._t("title", function() {
83
+ return [_c("span", {
84
+ staticClass: "tiny-mobile-dialog-box__title"
85
+ }, [_vm._v(_vm._s(_vm.title))])];
86
+ })], 2) : _vm._e(), _c("div", {
87
+ staticClass: "tiny-mobile-dialog-box__body"
88
+ }, [_vm._t("default")], 2), _c("div", {
89
+ staticClass: "tiny-mobile-dialog-box__footer"
90
+ }, [_vm._t("footer", function() {
91
+ return [_c("button", {
92
+ staticClass: "tiny-mobile-dialog-box__button cancel-button",
93
+ attrs: {
94
+ "type": "button"
95
+ },
96
+ on: {
97
+ "click": _vm.handleCancel
98
+ }
99
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.dialogBox.cancel")) + " ")]), _c("button", {
100
+ staticClass: "tiny-mobile-dialog-box__button confirm-button",
101
+ attrs: {
102
+ "type": "button"
103
+ },
104
+ on: {
105
+ "click": _vm.handleConfirm
106
+ }
107
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.dialogBox.confirm")) + " ")])];
108
+ })], 2)])])]);
109
+ };
110
+ var staticRenderFns = [];
111
+ var __cssModules = {};
112
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
113
+ function __vue2_injectStyles(context) {
114
+ for (var o in __cssModules) {
115
+ this[o] = __cssModules[o];
116
+ }
117
+ }
118
+ var mobile = /* @__PURE__ */ function() {
119
+ return __component__.exports;
120
+ }();
121
+
122
+ export { mobile as default };
package/lib/pc.js ADDED
@@ -0,0 +1,202 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/dialog-box/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import { iconClose, iconFullscreen, iconMinscreen } from '@opentinyvue/vue-icon';
4
+ import '@opentinyvue/vue-theme/dialog-box/index.css';
5
+
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
+ var hook;
14
+ if (injectStyles) {
15
+ hook = injectStyles;
16
+ }
17
+ if (hook) {
18
+ if (options.functional) {
19
+ options._injectStyles = hook;
20
+ var originalRender = options.render;
21
+ options.render = function renderWithStyleInjection(h, context) {
22
+ hook.call(context);
23
+ return originalRender(h, context);
24
+ };
25
+ } else {
26
+ var existing = options.beforeCreate;
27
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
28
+ }
29
+ }
30
+ return {
31
+ exports: scriptExports,
32
+ options
33
+ };
34
+ }
35
+
36
+ var __vue2_script = defineComponent({
37
+ components: {
38
+ IconClose: iconClose(),
39
+ IconFullscreen: iconFullscreen(),
40
+ IconMinscreen: iconMinscreen()
41
+ },
42
+ emits: [
43
+ "update:visible",
44
+ "change",
45
+ "before-close",
46
+ "open",
47
+ "close",
48
+ "opened",
49
+ "confirm",
50
+ "cancel",
51
+ "closed",
52
+ "drag-start",
53
+ "drag-move",
54
+ "drag-end",
55
+ // tiny 新增
56
+ "resize"
57
+ ],
58
+ props: [].concat(props, ["resize", "isFormReset", "visible", "title", "modal", "modalAppendToBody", "appendToBody", "lockScroll", "closeOnClickModal", "closeOnPressEscape", "showClose", "width", "fullscreen", "top", "center", "draggable", "dragOutsideWindow", "showHeader", "rightSlide", "destroyOnClose", "dialogClass", "beforeClose", "maxHeight", "dialogTransition", "customStyle", "noAnimation"]),
59
+ model: {
60
+ prop: "visible",
61
+ event: "update:visible"
62
+ },
63
+ provide: function provide() {
64
+ return {
65
+ dialog: this
66
+ };
67
+ },
68
+ setup: function setup$1(props2, context) {
69
+ return setup({
70
+ props: props2,
71
+ context,
72
+ renderless,
73
+ api
74
+ });
75
+ }
76
+ });
77
+ var render = function render2() {
78
+ var _vm = this;
79
+ var _h = _vm.$createElement;
80
+ var _c = _vm._self._c || _h;
81
+ return _c("transition", {
82
+ attrs: {
83
+ "duration": _vm.noAnimation ? 0 : void 0,
84
+ "name": _vm.state.animationName
85
+ },
86
+ on: {
87
+ "after-enter": _vm.afterEnter,
88
+ "after-leave": _vm.afterLeave
89
+ }
90
+ }, [_c("div", {
91
+ directives: [{
92
+ name: "show",
93
+ rawName: "v-show",
94
+ value: _vm.visible,
95
+ expression: "visible"
96
+ }],
97
+ class: ["tiny-dialog-box__wrapper", _vm.dialogClass],
98
+ on: {
99
+ "click": function click($event) {
100
+ if ($event.target !== $event.currentTarget) return null;
101
+ return _vm.handleWrapperClick.apply(null, arguments);
102
+ },
103
+ "mouseup": _vm.useMouseEventUp,
104
+ "mousedown": _vm.useMouseEventDown
105
+ }
106
+ }, [_c("transition", {
107
+ attrs: {
108
+ "name": _vm.dialogTransition
109
+ }
110
+ }, [(_vm.destroyOnClose ? _vm.visible : true) ? _c("div", {
111
+ directives: [{
112
+ name: "show",
113
+ rawName: "v-show",
114
+ value: _vm.visible,
115
+ expression: "visible"
116
+ }],
117
+ key: _vm.state.key,
118
+ ref: "dialog",
119
+ staticClass: "tiny-dialog-box",
120
+ class: [{
121
+ "is-fullscreen": _vm.state.isFull,
122
+ "is-center": _vm.center,
123
+ "is-right-slide": _vm.rightSlide
124
+ }],
125
+ style: _vm.state.style,
126
+ attrs: {
127
+ "data-tag": "tiny-dialog-box",
128
+ "data-dialog-box-draggable": _vm.draggable
129
+ }
130
+ }, [_vm.showHeader ? _c("div", {
131
+ ref: "header",
132
+ staticClass: "tiny-dialog-box__header",
133
+ on: {
134
+ "mousedown": _vm.handleDrag
135
+ }
136
+ }, [_vm._t("title", function() {
137
+ return [_c("span", {
138
+ staticClass: "tiny-dialog-box__title"
139
+ }, [_vm._v(_vm._s(_vm.title))])];
140
+ }), _c("div", {
141
+ staticClass: "tiny-dialog-box__btn-tools"
142
+ }, [_vm.resize && !_vm.state.isFull ? _c("button", {
143
+ staticClass: "tiny-dialog-box__headerbtn",
144
+ attrs: {
145
+ "type": "button",
146
+ "aria-label": "Resize"
147
+ },
148
+ on: {
149
+ "click": function click($event) {
150
+ return _vm.toggleFullScreen(true);
151
+ }
152
+ }
153
+ }, [_c("icon-fullscreen", {
154
+ staticClass: "tiny-svg-size tiny-dialog-box__resize"
155
+ })], 1) : _vm._e(), _vm.resize && _vm.state.isFull ? _c("button", {
156
+ staticClass: "tiny-dialog-box__headerbtn",
157
+ attrs: {
158
+ "type": "button",
159
+ "aria-label": "Resize"
160
+ },
161
+ on: {
162
+ "click": function click($event) {
163
+ return _vm.toggleFullScreen(false);
164
+ }
165
+ }
166
+ }, [_c("icon-minscreen", {
167
+ staticClass: "tiny-svg-size tiny-dialog-box__resize"
168
+ })], 1) : _vm._e(), _vm.showClose ? _c("button", {
169
+ staticClass: "tiny-dialog-box__headerbtn",
170
+ attrs: {
171
+ "type": "button",
172
+ "aria-label": "Close"
173
+ },
174
+ on: {
175
+ "click": function click($event) {
176
+ return _vm.handleClose("close", $event);
177
+ }
178
+ }
179
+ }, [_c("icon-close", {
180
+ staticClass: "tiny-svg-size tiny-dialog-box__close"
181
+ })], 1) : _vm._e()])], 2) : _vm._e(), _c("div", {
182
+ staticClass: "tiny-dialog-box__body"
183
+ }, [_vm._t("default")], 2), _vm.slots.footer ? _c("div", {
184
+ ref: "footer",
185
+ staticClass: "tiny-dialog-box__footer"
186
+ }, [_vm._t("footer", null, {
187
+ "beforeClose": _vm.beforeClose
188
+ })], 2) : _vm._e()]) : _vm._e()])], 1)]);
189
+ };
190
+ var staticRenderFns = [];
191
+ var __cssModules = {};
192
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
193
+ function __vue2_injectStyles(context) {
194
+ for (var o in __cssModules) {
195
+ this[o] = __cssModules[o];
196
+ }
197
+ }
198
+ var pc = /* @__PURE__ */ function() {
199
+ return __component__.exports;
200
+ }();
201
+
202
+ export { pc as default };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@opentinyvue/vue-dialog-box",
3
+ "version": "2.21.0",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "dependencies": {
10
+ "@opentinyvue/vue-common": "~2.21.0",
11
+ "@opentinyvue/vue-icon": "~2.21.0",
12
+ "@opentinyvue/vue-action-sheet": "~2.21.0",
13
+ "@opentinyvue/vue-renderless": "~3.21.0",
14
+ "@opentinyvue/vue-theme-mobile": "~3.21.0",
15
+ "@opentinyvue/vue-theme": "~3.21.0"
16
+ },
17
+ "license": "MIT",
18
+ "types": "index.d.ts",
19
+ "scripts": {
20
+ "build": "pnpm -w build:ui $npm_package_name",
21
+ "//postversion": "pnpm build"
22
+ }
23
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,146 @@
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 $constants: {
13
+ DIALOG_SLIDER_RIGHT: string;
14
+ DIALOG_FADE: string;
15
+ SELECT_DROPDOWN: string;
16
+ DROPDOWN_MENU: string;
17
+ DIALOG_BOX_CLASS: string;
18
+ PC_SCROLL_LOCK_CLASS: string;
19
+ MOBILE_SCROLL_LOCK_CLASS: string;
20
+ DIALOG_BOX_DATA_TAG: string;
21
+ Mode: string;
22
+ SCROLL_LOCK_CLASS(mode: any): string;
23
+ };
24
+ export declare const dialogBoxProps: {
25
+ _constants: {
26
+ type: ObjectConstructor;
27
+ default: () => {
28
+ DIALOG_SLIDER_RIGHT: string;
29
+ DIALOG_FADE: string;
30
+ SELECT_DROPDOWN: string;
31
+ DROPDOWN_MENU: string;
32
+ DIALOG_BOX_CLASS: string;
33
+ PC_SCROLL_LOCK_CLASS: string;
34
+ MOBILE_SCROLL_LOCK_CLASS: string;
35
+ DIALOG_BOX_DATA_TAG: string;
36
+ Mode: string;
37
+ SCROLL_LOCK_CLASS(mode: any): string;
38
+ };
39
+ };
40
+ appendToBody: {
41
+ type: BooleanConstructor;
42
+ default: () => boolean;
43
+ };
44
+ beforeClose: FunctionConstructor;
45
+ center: {
46
+ type: BooleanConstructor;
47
+ default: () => boolean;
48
+ };
49
+ closeOnClickModal: {
50
+ type: BooleanConstructor;
51
+ default: () => boolean;
52
+ };
53
+ closeOnPressEscape: {
54
+ type: BooleanConstructor;
55
+ default: () => boolean;
56
+ };
57
+ destroyOnClose: {
58
+ type: BooleanConstructor;
59
+ default: () => boolean;
60
+ };
61
+ dialogClass: {
62
+ type: StringConstructor;
63
+ default: () => string;
64
+ };
65
+ draggable: {
66
+ type: BooleanConstructor;
67
+ default: () => boolean;
68
+ };
69
+ dragOutsideWindow: {
70
+ type: BooleanConstructor;
71
+ default: () => boolean;
72
+ };
73
+ fullscreen: {
74
+ type: BooleanConstructor;
75
+ default: () => boolean;
76
+ };
77
+ isFormReset: {
78
+ type: BooleanConstructor;
79
+ default: () => boolean;
80
+ };
81
+ lockScroll: {
82
+ type: BooleanConstructor;
83
+ default: () => boolean;
84
+ };
85
+ modal: {
86
+ type: BooleanConstructor;
87
+ default: () => boolean;
88
+ };
89
+ modalAppendToBody: {
90
+ type: BooleanConstructor;
91
+ default: () => boolean;
92
+ };
93
+ resize: {
94
+ type: BooleanConstructor;
95
+ default: () => boolean;
96
+ };
97
+ rightSlide: {
98
+ type: BooleanConstructor;
99
+ default: () => boolean;
100
+ };
101
+ showClose: {
102
+ type: BooleanConstructor;
103
+ default: () => boolean;
104
+ };
105
+ showHeader: {
106
+ type: BooleanConstructor;
107
+ default: () => boolean;
108
+ };
109
+ title: {
110
+ type: StringConstructor;
111
+ default: () => string;
112
+ };
113
+ top: StringConstructor;
114
+ visible: {
115
+ type: BooleanConstructor;
116
+ default: () => boolean;
117
+ };
118
+ width: {
119
+ type: StringConstructor;
120
+ default: () => string;
121
+ };
122
+ maxHeight: {
123
+ type: StringConstructor;
124
+ default: () => string;
125
+ };
126
+ dialogTransition: {
127
+ type: StringConstructor;
128
+ default: string;
129
+ };
130
+ noAnimation: {
131
+ type: BooleanConstructor;
132
+ default: boolean;
133
+ };
134
+ customStyle: {
135
+ type: ObjectConstructor;
136
+ default: () => {};
137
+ };
138
+ tiny_mode: StringConstructor;
139
+ tiny_mode_root: BooleanConstructor;
140
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
141
+ tiny_renderless: FunctionConstructor;
142
+ tiny_theme: StringConstructor;
143
+ tiny_chart_theme: ObjectConstructor;
144
+ };
145
+ declare const _default: any;
146
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;