@opentiny/vue-modal
Advanced tools
Comparing version 2.6.0 to 2.6.1-alpha.0
218
lib/index.js
@@ -1,93 +0,50 @@ | ||
import { $prefix, $props, $setup, setupComponent, createComponent } from '@opentiny/vue-common'; | ||
import { MsgQueue } from '@opentiny/vue-renderless/modal'; | ||
import PCTemplate from './pc'; | ||
import MobileTemplate from './mobile'; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
function _defineProperty(obj, key, value) { | ||
key = _toPropertyKey(key); | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
var template = function template(mode) { | ||
if (process.env.TINY_MODE === 'pc') return PCTemplate;else if (process.env.TINY_MODE === 'mobile') return MobileTemplate;else return mode === 'mobile' ? MobileTemplate : PCTemplate; | ||
import { defineComponent, $prefix, $props, $setup, setupComponent, createComponent } from "@opentiny/vue-common"; | ||
import { MsgQueue } from "@opentiny/vue-renderless/modal"; | ||
import PcTemplate from "./pc.js"; | ||
import MobileTemplate from "./mobile.js"; | ||
var template = function template2(mode) { | ||
if ("mobile" === (process.env.TINY_MODE || mode)) | ||
return MobileTemplate; | ||
else | ||
return PcTemplate; | ||
}; | ||
var $constants = { | ||
MODAL_STATUS: { | ||
INFO: 'info', | ||
SUCCESS: 'success', | ||
WARNING: 'warning', | ||
ERROR: 'error', | ||
LOADING: 'loading' | ||
INFO: "info", | ||
SUCCESS: "success", | ||
WARNING: "warning", | ||
ERROR: "error", | ||
LOADING: "loading" | ||
}, | ||
NODAL_TYPE: { | ||
ALERT: 'alert', | ||
CONFIRM: 'confirm', | ||
MESSAGE: 'message' | ||
ALERT: "alert", | ||
CONFIRM: "confirm", | ||
MESSAGE: "message" | ||
}, | ||
STATUS_MAPPING_CLASSS: { | ||
INFO: 'tiny-modal-svg__info', | ||
SUCCESS: 'tiny-modal-svg__success', | ||
WARNING: 'tiny-modal-svg__warning', | ||
ERROR: 'tiny-modal-svg__error', | ||
LOADING: 'tiny-modal-svg__refresh roll' | ||
INFO: "tiny-modal-svg__info", | ||
SUCCESS: "tiny-modal-svg__success", | ||
WARNING: "tiny-modal-svg__warning", | ||
ERROR: "tiny-modal-svg__error", | ||
LOADING: "tiny-modal-svg__refresh roll" | ||
} | ||
}; | ||
var TINYModal = { | ||
name: $prefix + 'Modal', | ||
componentName: 'Modal', | ||
props: _objectSpread2(_objectSpread2({}, $props), {}, { | ||
var TINYModal = defineComponent({ | ||
name: $prefix + "Modal", | ||
componentName: "Modal", | ||
props: _extends({}, $props, { | ||
_constants: { | ||
@@ -101,3 +58,3 @@ type: Object, | ||
type: Boolean, | ||
default: function _default() { | ||
default: function _default2() { | ||
return true; | ||
@@ -109,4 +66,4 @@ } | ||
type: [Number, String], | ||
default: function _default() { | ||
return 3000; | ||
default: function _default3() { | ||
return 3e3; | ||
} | ||
@@ -126,3 +83,3 @@ }, | ||
type: Boolean, | ||
default: function _default() { | ||
default: function _default4() { | ||
return true; | ||
@@ -137,3 +94,3 @@ } | ||
type: Boolean, | ||
default: function _default() { | ||
default: function _default5() { | ||
return true; | ||
@@ -146,3 +103,3 @@ } | ||
type: [Number, String], | ||
default: function _default() { | ||
default: function _default6() { | ||
return 200; | ||
@@ -153,3 +110,3 @@ } | ||
type: [Number, String], | ||
default: function _default() { | ||
default: function _default7() { | ||
return 340; | ||
@@ -167,3 +124,3 @@ } | ||
type: [String, Object], | ||
default: '' | ||
default: "" | ||
}, | ||
@@ -177,3 +134,3 @@ title: String, | ||
type: String, | ||
default: 'alert' | ||
default: "alert" | ||
}, | ||
@@ -187,24 +144,24 @@ vSize: String, | ||
return $setup({ | ||
props: props, | ||
context: context, | ||
template: template | ||
props, | ||
context, | ||
template | ||
}); | ||
} | ||
}; | ||
TINYModal.version = '2.6.0'; | ||
}); | ||
var version = "3.7.0"; | ||
TINYModal.version = version; | ||
TINYModal.model = { | ||
prop: 'modelValue', | ||
event: 'update:modelValue' | ||
prop: "modelValue", | ||
event: "update:modelValue" | ||
}; | ||
function Modal(options) { | ||
return new Promise(function (resolve) { | ||
if (options && options.id && MsgQueue.some(function (comp) { | ||
return new Promise(function(resolve) { | ||
if (options && options.id && MsgQueue.some(function(comp) { | ||
return comp.id === options.id; | ||
})) { | ||
resolve('exist'); | ||
resolve("exist"); | ||
} else { | ||
var events = options.events || {}; | ||
var $modal; | ||
options.events = _objectSpread2(_objectSpread2({}, events), {}, { | ||
options.events = _extends({}, events, { | ||
hide: function hide(params) { | ||
@@ -217,3 +174,3 @@ events.hide && events.hide.call(this, params); | ||
$modal = createComponent({ | ||
el: document.createElement('div'), | ||
el: document.createElement("div"), | ||
propsData: options, | ||
@@ -227,4 +184,4 @@ component: TINYModal | ||
var modal = Modal; | ||
var types = ['alert', 'confirm', 'message']; | ||
types.forEach(function (type, index) { | ||
var types = ["alert", "confirm", "message"]; | ||
types.forEach(function(type, index) { | ||
var defOpts = { | ||
@@ -242,20 +199,20 @@ showFooter: true | ||
if (index === 1) { | ||
defOpts.status = 'question'; | ||
defOpts.status = "question"; | ||
} | ||
TINYModal[type] = Modal[type] = function (message, title, options) { | ||
TINYModal[type] = Modal[type] = function(message2, title, options) { | ||
var opts; | ||
if (_typeof(message) === 'object' && message !== null) { | ||
opts = message; | ||
if (typeof message2 === "object" && message2 !== null) { | ||
opts = message2; | ||
} else if (title) { | ||
opts = { | ||
title: title | ||
title | ||
}; | ||
} | ||
if (message === undefined || message === null) { | ||
message = ''; | ||
if (message2 === void 0 || message2 === null) { | ||
message2 = ""; | ||
} | ||
return modal(_objectSpread2(_objectSpread2(_objectSpread2({ | ||
message: message.toString(), | ||
type: type | ||
}, defOpts), opts), options)); | ||
return modal(_extends({ | ||
message: message2.toString(), | ||
type | ||
}, defOpts, opts, options)); | ||
}; | ||
@@ -269,16 +226,25 @@ }); | ||
install: function install(Vue) { | ||
if (TINYModal.installed) return; | ||
Vue.component(TINYModal.name, TINYModal); | ||
if (TINYModal.installed) | ||
return; | ||
var isVue2 = !!Vue.component; | ||
var tinyMode = isVue2 ? Vue.prototype.tiny_mode : Vue.config.globalProperties.tiny_mode; | ||
TINYModal.tiny_mode = process.env.TINY_MODE || tinyMode && tinyMode.value; | ||
TINYModal.installed = true; | ||
}, | ||
init: function init(root) { | ||
root.$alert = Modal.alert; | ||
root.$message = Modal.message; | ||
root.$confirm = Modal.confirm; | ||
var prefix = root.$TinyModalApiPrefix || "$"; | ||
root[prefix + "alert"] = Modal.alert; | ||
root[prefix + "message"] = Modal.message; | ||
root[prefix + "confirm"] = Modal.confirm; | ||
} | ||
}; | ||
TINYModal.install = function (Vue) { | ||
setupComponent.TINYModal.install(Vue); | ||
TINYModal.install = function(Vue) { | ||
Vue.component(TINYModal.name, TINYModal); | ||
}; | ||
export { Modal, alert, confirm, TINYModal as default, message }; | ||
export { | ||
Modal, | ||
alert, | ||
confirm, | ||
TINYModal as default, | ||
message | ||
}; |
@@ -1,65 +0,64 @@ | ||
import { setup, h, props } from '@opentiny/vue-common'; | ||
import { renderless, api } from '@opentiny/vue-renderless/modal/vue'; | ||
import Button from '@opentiny/vue-button'; | ||
import { iconMinscreenLeft, iconFullscreenLeft } from '@opentiny/vue-icon'; | ||
import '@opentiny/vue-theme-mobile/modal/index.css'; | ||
function _defineProperty(obj, key, value) { | ||
key = _toPropertyKey(key); | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
import { defineComponent, props, setup as _setup, h } from "@opentiny/vue-common"; | ||
import { renderless, api } from "@opentiny/vue-renderless/modal/vue"; | ||
import Button from "@opentiny/vue-button"; | ||
import { iconMinscreenLeft, iconFullscreenLeft } from "@opentiny/vue-icon"; | ||
import "@opentiny/vue-theme-mobile/modal/index.css"; | ||
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) { | ||
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports; | ||
if (render) { | ||
options.render = render; | ||
options.staticRenderFns = staticRenderFns; | ||
options._compiled = true; | ||
} | ||
return obj; | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
if (functionalTemplate) { | ||
options.functional = true; | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
if (scopeId) { | ||
options._scopeId = "data-v-" + scopeId; | ||
} | ||
var hook; | ||
if (moduleIdentifier) { | ||
hook = function hook2(context) { | ||
context = context || // cached call | ||
this.$vnode && this.$vnode.ssrContext || // stateful | ||
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") { | ||
context = __VUE_SSR_CONTEXT__; | ||
} | ||
if (injectStyles) { | ||
injectStyles.call(this, context); | ||
} | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; | ||
options._ssrRegister = hook; | ||
} else if (injectStyles) { | ||
hook = shadowMode ? function() { | ||
injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot); | ||
} : injectStyles; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
options._injectStyles = hook; | ||
var originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} else { | ||
var existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return { | ||
exports: scriptExports, | ||
options | ||
}; | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
var script = { | ||
props: [].concat(_toConsumableArray(props), ['_constants', 'animat', 'beforeClose', 'duration', 'escClosable', 'events', 'fullscreen', 'height', 'id', 'isFormReset', 'lockScroll', 'lockView', 'marginSize', 'mask', 'maskClosable', 'message', 'minHeight', 'minWidth', 'modelValue', 'resize', 'showFooter', 'showHeader', 'title', 'top', 'type', 'vSize', 'width', 'zIndex']), | ||
var __vue2_script = defineComponent({ | ||
props: [].concat(props, ["_constants", "animat", "beforeClose", "duration", "escClosable", "events", "fullscreen", "height", "id", "isFormReset", "lockScroll", "lockView", "marginSize", "mask", "maskClosable", "message", "minHeight", "minWidth", "modelValue", "resize", "showFooter", "showHeader", "title", "top", "type", "vSize", "width", "zIndex"]), | ||
components: { | ||
Button: Button | ||
Button | ||
}, | ||
@@ -71,39 +70,22 @@ provide: function provide() { | ||
}, | ||
setup: function setup$1(props, context) { | ||
return setup({ | ||
props: props, | ||
context: context, | ||
renderless: renderless, | ||
api: api | ||
setup: function setup(props2, context) { | ||
return _setup({ | ||
props: props2, | ||
context, | ||
renderless, | ||
api | ||
}); | ||
}, | ||
render: function render() { | ||
var _ref, | ||
_this = this; | ||
var state = this.state, | ||
scopedSlots = this.scopedSlots, | ||
vSize = this.vSize, | ||
type = this.type, | ||
resize = this.resize, | ||
animat = this.animat, | ||
showHeader = this.showHeader; | ||
var showFooter = this.showFooter, | ||
title = this.title, | ||
message = this.message, | ||
lockScroll = this.lockScroll, | ||
lockView = this.lockView, | ||
mask = this.mask, | ||
t = this.t; | ||
var zoomLocat = state.zoomLocat, | ||
visible = state.visible, | ||
contentVisible = state.contentVisible, | ||
modalTop = state.modalTop, | ||
isMsg = state.isMsg; | ||
var _ref, _this = this; | ||
var state = this.state, scopedSlots = this.scopedSlots, vSize = this.vSize, type = this.type, resize = this.resize, animat = this.animat, showHeader = this.showHeader; | ||
var showFooter = this.showFooter, title = this.title, message = this.message, lockScroll = this.lockScroll, lockView = this.lockView, mask = this.mask, t = this.t; | ||
var zoomLocat = state.zoomLocat, visible = state.visible, contentVisible = state.contentVisible, modalTop = state.modalTop, isMsg = state.isMsg; | ||
var defaultSlot = scopedSlots.default; | ||
var footerSlot = scopedSlots.footer; | ||
return h('div', { | ||
class: ['tiny-mobile-modal', 'tiny-mobile-modal__wrapper', "type__".concat(type), (_ref = {}, _defineProperty(_ref, "size__".concat(vSize), vSize), _defineProperty(_ref, "is__animat", animat), _defineProperty(_ref, "lock__scroll", lockScroll), _defineProperty(_ref, "lock__view", lockView), _defineProperty(_ref, "is__mask", mask), _defineProperty(_ref, "is__maximize", zoomLocat), _defineProperty(_ref, "is__visible", contentVisible), _defineProperty(_ref, "active", visible), _ref)], | ||
return h("div", { | ||
class: ["tiny-mobile-modal", "tiny-mobile-modal__wrapper", "type__" + type, (_ref = {}, _ref["size__" + vSize] = vSize, _ref.is__animat = animat, _ref.lock__scroll = lockScroll, _ref.lock__view = lockView, _ref.is__mask = mask, _ref.is__maximize = zoomLocat, _ref.is__visible = contentVisible, _ref.active = visible, _ref)], | ||
style: { | ||
zIndex: this.state.modalZindex, | ||
top: modalTop ? "".concat(modalTop, "px") : null | ||
top: modalTop ? modalTop + "px" : null | ||
}, | ||
@@ -113,35 +95,35 @@ on: { | ||
} | ||
}, [h('div', { | ||
class: 'tiny-mobile-modal__box', | ||
ref: 'modalBox' | ||
}, [showHeader ? h('div', { | ||
class: 'tiny-mobile-modal__header', | ||
}, [h("div", { | ||
class: "tiny-mobile-modal__box", | ||
ref: "modalBox" | ||
}, [showHeader ? h("div", { | ||
class: "tiny-mobile-modal__header", | ||
on: { | ||
mousedown: this.mousedownEvent | ||
} | ||
}, [h('span', { | ||
class: 'tiny-mobile-modal__title' | ||
}, title || t('ui.alert.title')), resize ? h(zoomLocat ? iconMinscreenLeft() : iconFullscreenLeft(), { | ||
class: ['tiny-mobile-modal__zoom-btn', 'trigger__btn'], | ||
}, [h("span", { | ||
class: "tiny-mobile-modal__title" | ||
}, title || t("ui.alert.title")), resize ? h(zoomLocat ? iconMinscreenLeft() : iconFullscreenLeft(), { | ||
class: ["tiny-mobile-modal__zoom-btn", "trigger__btn"], | ||
on: { | ||
click: this.toggleZoomEvent | ||
} | ||
}) : null]) : null, h('div', { | ||
class: 'tiny-mobile-modal__body' | ||
}, [isMsg ? h('div', { | ||
class: 'tiny-mobile-modal__status-wrapper' | ||
}) : null, h('div', { | ||
class: 'tiny-mobile-modal__content' | ||
}) : null]) : null, h("div", { | ||
class: "tiny-mobile-modal__body" | ||
}, [isMsg ? h("div", { | ||
class: "tiny-mobile-modal__status-wrapper" | ||
}) : null, h("div", { | ||
class: "tiny-mobile-modal__content" | ||
}, defaultSlot ? defaultSlot.call(this, { | ||
$modal: this | ||
}, h) : [h('div', { | ||
class: 'tiny-mobile-modal__text' | ||
}, typeof message === 'function' ? message.call(this, h) : message)])]), showFooter ? h('div', { | ||
class: 'tiny-mobile-modal__footer' | ||
}, h) : [h("div", { | ||
class: "tiny-mobile-modal__text" | ||
}, typeof message === "function" ? message.call(this, h) : message)])]), showFooter ? h("div", { | ||
class: "tiny-mobile-modal__footer" | ||
}, footerSlot ? footerSlot.call(this, { | ||
$modal: this, | ||
beforeClose: this.beforeClose | ||
}, h) : [type === 'confirm' ? h(Button, { | ||
}, h) : [type === "confirm" ? h(Button, { | ||
props: { | ||
class: ['tiny-mobile-button', 'tiny-mobile-button--default'] | ||
class: ["tiny-mobile-button", "tiny-mobile-button--default"] | ||
}, | ||
@@ -151,6 +133,6 @@ on: { | ||
} | ||
}, t('ui.button.cancel')) : null, h(Button, { | ||
}, t("ui.button.cancel")) : null, h(Button, { | ||
props: { | ||
type: 'primary', | ||
class: ['tiny-mobile-button', type !== 'confirm' ? 'tiny-mobile-button__single' : ''] | ||
type: "primary", | ||
class: ["tiny-mobile-button", type !== "confirm" ? "tiny-mobile-button__single" : ""] | ||
}, | ||
@@ -160,9 +142,9 @@ on: { | ||
} | ||
}, t('ui.button.confirm'))]) : null, !isMsg && resize ? h('span', { | ||
class: 'tiny-mobile-modal__resize' | ||
}, ['wl', 'wr', 'swst', 'sest', 'st', 'swlb', 'selb', 'sb'].map(function (type) { | ||
return h('span', { | ||
class: "".concat(type, "-resize"), | ||
}, t("ui.button.confirm"))]) : null, !isMsg && resize ? h("span", { | ||
class: "tiny-mobile-modal__resize" | ||
}, ["wl", "wr", "swst", "sest", "st", "swlb", "selb", "sb"].map(function(type2) { | ||
return h("span", { | ||
class: type2 + "-resize", | ||
attrs: { | ||
'data-type': type | ||
"data-type": type2 | ||
}, | ||
@@ -175,96 +157,16 @@ on: { | ||
} | ||
}; | ||
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier | ||
/* server only */ | ||
, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof shadowMode !== 'boolean') { | ||
createInjectorSSR = createInjector; | ||
createInjector = shadowMode; | ||
shadowMode = false; | ||
} // Vue.extend constructor export interop. | ||
var options = typeof script === 'function' ? script.options : script; // render functions | ||
if (template && template.render) { | ||
options.render = template.render; | ||
options.staticRenderFns = template.staticRenderFns; | ||
options._compiled = true; // functional template | ||
if (isFunctionalTemplate) { | ||
options.functional = true; | ||
} | ||
} // scopedId | ||
if (scopeId) { | ||
options._scopeId = scopeId; | ||
}); | ||
var __vue2_render, __vue2_staticRenderFns; | ||
var __cssModules = {}; | ||
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, __vue2_render, __vue2_staticRenderFns, false, __vue2_injectStyles, null, null, null); | ||
function __vue2_injectStyles(context) { | ||
for (var o in __cssModules) { | ||
this[o] = __cssModules[o]; | ||
} | ||
var hook; | ||
if (moduleIdentifier) { | ||
// server build | ||
hook = function hook(context) { | ||
// 2.3 injection | ||
context = context || // cached call | ||
this.$vnode && this.$vnode.ssrContext || // stateful | ||
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional | ||
// 2.2 with runInNewContext: true | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { | ||
context = __VUE_SSR_CONTEXT__; | ||
} // inject component styles | ||
if (style) { | ||
style.call(this, createInjectorSSR(context)); | ||
} // register component module identifier for async chunk inference | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; // used by ssr in case component is cached and beforeCreate | ||
// never gets called | ||
options._ssrRegister = hook; | ||
} else if (style) { | ||
hook = shadowMode ? function () { | ||
style.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); | ||
} : function (context) { | ||
style.call(this, createInjector(context)); | ||
}; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
// register for functional component in vue file | ||
var originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} else { | ||
// inject component registration as beforeCreate hook | ||
var existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return script; | ||
} | ||
var normalizeComponent_1 = normalizeComponent; | ||
var __vue_script__ = script; | ||
var __vue_inject_styles__ = undefined; | ||
var __vue_scope_id__ = undefined; | ||
var __vue_module_identifier__ = undefined; | ||
var __vue_is_functional_template__ = undefined; | ||
var __vue_component__ = normalizeComponent_1({}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined); | ||
export { __vue_component__ as default }; | ||
var mobile = /* @__PURE__ */ function() { | ||
return __component__.exports; | ||
}(); | ||
export { | ||
mobile as default | ||
}; |
336
lib/pc.js
@@ -1,65 +0,64 @@ | ||
import { setup, h, props } from '@opentiny/vue-common'; | ||
import { renderless, api } from '@opentiny/vue-renderless/modal/vue'; | ||
import Button from '@opentiny/vue-button'; | ||
import { iconHelpSolid, iconInfoSolid, iconSuccess, iconWarning, iconError, iconLoading, iconMinscreenLeft, iconFullscreenLeft, iconClose } from '@opentiny/vue-icon'; | ||
import '@opentiny/vue-theme/modal/index.css'; | ||
function _defineProperty(obj, key, value) { | ||
key = _toPropertyKey(key); | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
import { defineComponent, props, setup as _setup, h } from "@opentiny/vue-common"; | ||
import { renderless, api } from "@opentiny/vue-renderless/modal/vue"; | ||
import Button from "@opentiny/vue-button"; | ||
import { iconHelpSolid, iconInfoSolid, iconSuccess, iconWarning, iconError, iconLoading, iconMinscreenLeft, iconFullscreenLeft, iconClose } from "@opentiny/vue-icon"; | ||
import "@opentiny/vue-theme/modal/index.css"; | ||
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) { | ||
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports; | ||
if (render) { | ||
options.render = render; | ||
options.staticRenderFns = staticRenderFns; | ||
options._compiled = true; | ||
} | ||
return obj; | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
if (functionalTemplate) { | ||
options.functional = true; | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
if (scopeId) { | ||
options._scopeId = "data-v-" + scopeId; | ||
} | ||
var hook; | ||
if (moduleIdentifier) { | ||
hook = function hook2(context) { | ||
context = context || // cached call | ||
this.$vnode && this.$vnode.ssrContext || // stateful | ||
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") { | ||
context = __VUE_SSR_CONTEXT__; | ||
} | ||
if (injectStyles) { | ||
injectStyles.call(this, context); | ||
} | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; | ||
options._ssrRegister = hook; | ||
} else if (injectStyles) { | ||
hook = shadowMode ? function() { | ||
injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot); | ||
} : injectStyles; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
options._injectStyles = hook; | ||
var originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} else { | ||
var existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return { | ||
exports: scriptExports, | ||
options | ||
}; | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
var script = { | ||
props: [].concat(_toConsumableArray(props), ['_constants', 'animat', 'beforeClose', 'duration', 'escClosable', 'events', 'fullscreen', 'height', 'id', 'isFormReset', 'lockScroll', 'lockView', 'marginSize', 'mask', 'maskClosable', 'message', 'minHeight', 'minWidth', 'modelValue', 'resize', 'showFooter', 'showHeader', 'status', 'title', 'top', 'type', 'vSize', 'width', 'zIndex']), | ||
var __vue2_script = defineComponent({ | ||
props: [].concat(props, ["_constants", "animat", "beforeClose", "duration", "escClosable", "events", "fullscreen", "height", "id", "isFormReset", "lockScroll", "lockView", "marginSize", "mask", "maskClosable", "message", "minHeight", "minWidth", "modelValue", "resize", "showFooter", "showHeader", "status", "title", "top", "type", "vSize", "width", "zIndex"]), | ||
components: { | ||
Button: Button | ||
Button | ||
}, | ||
@@ -71,34 +70,15 @@ provide: function provide() { | ||
}, | ||
setup: function setup$1(props, context) { | ||
return setup({ | ||
props: props, | ||
context: context, | ||
renderless: renderless, | ||
api: api | ||
setup: function setup(props2, context) { | ||
return _setup({ | ||
props: props2, | ||
context, | ||
renderless, | ||
api | ||
}); | ||
}, | ||
render: function render() { | ||
var _ref, | ||
_this = this; | ||
var state = this.state, | ||
scopedSlots = this.scopedSlots, | ||
vSize = this.vSize, | ||
type = this.type, | ||
resize = this.resize, | ||
animat = this.animat, | ||
status = this.status, | ||
showHeader = this.showHeader; | ||
var showFooter = this.showFooter, | ||
title = this.title, | ||
message = this.message, | ||
lockScroll = this.lockScroll, | ||
lockView = this.lockView, | ||
mask = this.mask, | ||
constants = this._constants, | ||
t = this.t; | ||
var zoomLocat = state.zoomLocat, | ||
visible = state.visible, | ||
contentVisible = state.contentVisible, | ||
modalTop = state.modalTop, | ||
isMsg = state.isMsg; | ||
var _ref, _this = this; | ||
var state = this.state, scopedSlots = this.scopedSlots, vSize = this.vSize, type = this.type, resize = this.resize, animat = this.animat, status = this.status, showHeader = this.showHeader; | ||
var showFooter = this.showFooter, title = this.title, message = this.message, lockScroll = this.lockScroll, lockView = this.lockView, mask = this.mask, constants = this._constants, t = this.t; | ||
var zoomLocat = state.zoomLocat, visible = state.visible, contentVisible = state.contentVisible, modalTop = state.modalTop, isMsg = state.isMsg; | ||
var defaultSlot = scopedSlots.default; | ||
@@ -114,7 +94,7 @@ var footerSlot = scopedSlots.footer; | ||
}; | ||
return h('div', { | ||
class: ['tiny-modal', 'tiny-modal__wrapper', "type__".concat(type), (_ref = {}, _defineProperty(_ref, "size__".concat(vSize), vSize), _defineProperty(_ref, "status__".concat(status), typeof status === 'string'), _defineProperty(_ref, "is__animat", animat), _defineProperty(_ref, "lock__scroll", lockScroll), _defineProperty(_ref, "lock__view", lockView), _defineProperty(_ref, "is__mask", mask), _defineProperty(_ref, "is__maximize", zoomLocat), _defineProperty(_ref, "is__visible", contentVisible), _defineProperty(_ref, "active", visible), _ref)], | ||
return h("div", { | ||
class: ["tiny-modal", "tiny-modal__wrapper", "type__" + type, (_ref = {}, _ref["size__" + vSize] = vSize, _ref["status__" + status] = typeof status === "string", _ref.is__animat = animat, _ref.lock__scroll = lockScroll, _ref.lock__view = lockView, _ref.is__mask = mask, _ref.is__maximize = zoomLocat, _ref.is__visible = contentVisible, _ref.active = visible, _ref)], | ||
style: { | ||
zIndex: this.state.modalZindex, | ||
top: modalTop ? "".concat(modalTop, "px") : null | ||
top: modalTop ? modalTop + "px" : null | ||
}, | ||
@@ -124,20 +104,20 @@ on: { | ||
} | ||
}, [h('div', { | ||
class: 'tiny-modal__box', | ||
ref: 'modalBox' | ||
}, [showHeader ? h('div', { | ||
class: 'tiny-modal__header', | ||
}, [h("div", { | ||
class: "tiny-modal__box", | ||
ref: "modalBox" | ||
}, [showHeader ? h("div", { | ||
class: "tiny-modal__header", | ||
on: { | ||
mousedown: this.mousedownEvent | ||
} | ||
}, [status ? h('div', { | ||
class: 'tiny-modal__status-wrapper' | ||
}, [typeof status === 'string' ? h(STATUS_MAPPING_COMPINENT[status.toUpperCase()], { | ||
}, [status ? h("div", { | ||
class: "tiny-modal__status-wrapper" | ||
}, [typeof status === "string" ? h(STATUS_MAPPING_COMPINENT[status.toUpperCase()], { | ||
class: [constants.STATUS_MAPPING_CLASSS[status.toUpperCase()]] | ||
}) : h(status, { | ||
class: ['tiny-modal__status-icon'] | ||
})]) : null, h('span', { | ||
class: 'tiny-modal__title' | ||
}, title || t('ui.alert.title')), resize ? h(zoomLocat ? iconMinscreenLeft() : iconFullscreenLeft(), { | ||
class: ['tiny-modal__zoom-btn', 'trigger__btn'], | ||
class: ["tiny-modal__status-icon"] | ||
})]) : null, h("span", { | ||
class: "tiny-modal__title" | ||
}, title || t("ui.alert.title")), resize ? h(zoomLocat ? iconMinscreenLeft() : iconFullscreenLeft(), { | ||
class: ["tiny-modal__zoom-btn", "trigger__btn"], | ||
on: { | ||
@@ -147,22 +127,22 @@ click: this.toggleZoomEvent | ||
}) : null, h(iconClose(), { | ||
class: ['tiny-modal__close-btn', 'trigger__btn'], | ||
class: ["tiny-modal__close-btn", "trigger__btn"], | ||
on: { | ||
click: this.closeEvent | ||
} | ||
})]) : null, h('div', { | ||
class: 'tiny-modal__body' | ||
}, [isMsg && status ? h('div', { | ||
class: 'tiny-modal__status-wrapper' | ||
}, [typeof status === 'string' ? h(STATUS_MAPPING_COMPINENT[status.toUpperCase()], { | ||
})]) : null, h("div", { | ||
class: "tiny-modal__body" | ||
}, [isMsg && status ? h("div", { | ||
class: "tiny-modal__status-wrapper" | ||
}, [typeof status === "string" ? h(STATUS_MAPPING_COMPINENT[status.toUpperCase()], { | ||
class: [constants.STATUS_MAPPING_CLASSS[status.toUpperCase()]] | ||
}) : h(status, { | ||
class: ['tiny-modal__status-icon'] | ||
})]) : null, h('div', { | ||
class: 'tiny-modal__content' | ||
class: ["tiny-modal__status-icon"] | ||
})]) : null, h("div", { | ||
class: "tiny-modal__content" | ||
}, defaultSlot ? defaultSlot.call(this, { | ||
$modal: this | ||
}, h) : [h('div', { | ||
class: 'tiny-modal__text' | ||
}, typeof message === 'function' ? message.call(this, h) : message)])]), showFooter ? h('div', { | ||
class: 'tiny-modal__footer' | ||
}, h) : [h("div", { | ||
class: "tiny-modal__text" | ||
}, typeof message === "function" ? message.call(this, h) : message)])]), showFooter ? h("div", { | ||
class: "tiny-modal__footer" | ||
}, footerSlot ? footerSlot.call(this, { | ||
@@ -173,3 +153,3 @@ $modal: this, | ||
props: { | ||
type: 'primary' | ||
type: "primary" | ||
}, | ||
@@ -179,13 +159,13 @@ on: { | ||
} | ||
}, t('ui.button.confirm')), type === 'confirm' ? h(Button, { | ||
}, t("ui.button.confirm")), type === "confirm" ? h(Button, { | ||
on: { | ||
click: this.cancelEvent | ||
} | ||
}, t('ui.button.cancel')) : null]) : null, !isMsg && resize ? h('span', { | ||
class: 'tiny-modal__resize' | ||
}, ['wl', 'wr', 'swst', 'sest', 'st', 'swlb', 'selb', 'sb'].map(function (type) { | ||
return h('span', { | ||
class: "".concat(type, "-resize"), | ||
}, t("ui.button.cancel")) : null]) : null, !isMsg && resize ? h("span", { | ||
class: "tiny-modal__resize" | ||
}, ["wl", "wr", "swst", "sest", "st", "swlb", "selb", "sb"].map(function(type2) { | ||
return h("span", { | ||
class: type2 + "-resize", | ||
attrs: { | ||
'data-type': type | ||
"data-type": type2 | ||
}, | ||
@@ -198,96 +178,16 @@ on: { | ||
} | ||
}; | ||
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier | ||
/* server only */ | ||
, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof shadowMode !== 'boolean') { | ||
createInjectorSSR = createInjector; | ||
createInjector = shadowMode; | ||
shadowMode = false; | ||
} // Vue.extend constructor export interop. | ||
var options = typeof script === 'function' ? script.options : script; // render functions | ||
if (template && template.render) { | ||
options.render = template.render; | ||
options.staticRenderFns = template.staticRenderFns; | ||
options._compiled = true; // functional template | ||
if (isFunctionalTemplate) { | ||
options.functional = true; | ||
} | ||
} // scopedId | ||
if (scopeId) { | ||
options._scopeId = scopeId; | ||
}); | ||
var __vue2_render, __vue2_staticRenderFns; | ||
var __cssModules = {}; | ||
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, __vue2_render, __vue2_staticRenderFns, false, __vue2_injectStyles, null, null, null); | ||
function __vue2_injectStyles(context) { | ||
for (var o in __cssModules) { | ||
this[o] = __cssModules[o]; | ||
} | ||
var hook; | ||
if (moduleIdentifier) { | ||
// server build | ||
hook = function hook(context) { | ||
// 2.3 injection | ||
context = context || // cached call | ||
this.$vnode && this.$vnode.ssrContext || // stateful | ||
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional | ||
// 2.2 with runInNewContext: true | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { | ||
context = __VUE_SSR_CONTEXT__; | ||
} // inject component styles | ||
if (style) { | ||
style.call(this, createInjectorSSR(context)); | ||
} // register component module identifier for async chunk inference | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; // used by ssr in case component is cached and beforeCreate | ||
// never gets called | ||
options._ssrRegister = hook; | ||
} else if (style) { | ||
hook = shadowMode ? function () { | ||
style.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); | ||
} : function (context) { | ||
style.call(this, createInjector(context)); | ||
}; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
// register for functional component in vue file | ||
var originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} else { | ||
// inject component registration as beforeCreate hook | ||
var existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return script; | ||
} | ||
var normalizeComponent_1 = normalizeComponent; | ||
var __vue_script__ = script; | ||
var __vue_inject_styles__ = undefined; | ||
var __vue_scope_id__ = undefined; | ||
var __vue_module_identifier__ = undefined; | ||
var __vue_is_functional_template__ = undefined; | ||
var __vue_component__ = normalizeComponent_1({}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined); | ||
export { __vue_component__ as default }; | ||
var pc = /* @__PURE__ */ function() { | ||
return __component__.exports; | ||
}(); | ||
export { | ||
pc as default | ||
}; |
{ | ||
"name": "@opentiny/vue-modal", | ||
"version": "2.6.0", | ||
"version": "2.6.1-alpha.0", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"lint": "eslint src/**/*{.js,.html,.vue} --quiet", | ||
"build:ui2": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../build/build-ui.js", | ||
"build:ui3": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../example/build/build-ui.js" | ||
}, | ||
"main": "./lib/index.js", | ||
"dependencies": { | ||
"@opentiny/vue-renderless": "~3.6.0", | ||
"@opentiny/vue-common": "~2.6.0", | ||
"@opentiny/vue-button": "~2.6.0", | ||
"@opentiny/vue-locale": "~2.6.0", | ||
"@opentiny/vue-icon": "~2.6.0", | ||
"@opentiny/vue-theme": "~3.6.0", | ||
"@opentiny/vue-theme-mobile": "~3.6.0" | ||
"@opentiny/vue-renderless": "~3.6.1-alpha.0", | ||
"@opentiny/vue-common": "~2.6.1-alpha.0", | ||
"@opentiny/vue-button": "~2.6.1-alpha.0", | ||
"@opentiny/vue-locale": "~2.6.1-alpha.0" | ||
}, | ||
"license": "MIT", | ||
"sideEffects": false | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"build": "pnpm -w build:ui $npm_package_name", | ||
"//postversion": "pnpm build" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28454
4
9
835
2
80
2
1
+ Addednanoid@3.3.8(transitive)
- Removed@opentiny/vue-icon@~2.6.0
- Removed@opentiny/vue-theme@~3.6.0
- Removed@opentiny/vue-theme-mobile@~3.6.0
- Removednanoid@3.3.7(transitive)