miniapp-web-jsapi
Version:
JSAPI/View adapter for miniprogram running on the web
122 lines • 6.54 kB
JavaScript
import _createClass from "@babel/runtime/helpers/createClass";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/* packages/miniapp-web-jsapi/src/web/components/modal/Modal.svelte generated by Svelte v3.49.0 */
import { SvelteComponent, append_styles, attr, create_slot, detach, element, get_all_dirty_from_scope, get_slot_changes, init, insert, null_to_empty, safe_not_equal, transition_in, transition_out, update_slot_base } from "svelte/internal";
import { getPrefixCls } from "../../../../lib/web";
import reactToCSS from 'react-style-object-to-css';
function add_css(target) {
append_styles(target, "svelte-1l3ztq7", ".alipay-mwj-modal.svelte-1l3ztq7{width:100vw;height:100vh;position:fixed;left:0;top:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center}");
}
function create_fragment(ctx) {
var div;
var div_class_value;
var current;
var default_slot_template = /*#slots*/ctx[7].default;
var default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ctx[6], null);
return {
c: function c() {
div = element("div");
if (default_slot) default_slot.c();
attr(div, "class", div_class_value = "" + (null_to_empty(/*className*/ctx[0] ? "".concat(/*prefixCls*/ctx[2], " ").concat(/*className*/ctx[0]) : /*prefixCls*/ctx[2]) + " svelte-1l3ztq7"));
attr(div, "style", /*styleString*/ctx[1]);
},
m: function m(target, anchor) {
insert(target, div, anchor);
if (default_slot) {
default_slot.m(div, null);
}
current = true;
},
p: function p(ctx, _ref) {
var _ref2 = _slicedToArray(_ref, 1),
dirty = _ref2[0];
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope*/64)) {
update_slot_base(default_slot, default_slot_template, ctx, /*$$scope*/ctx[6], !current ? get_all_dirty_from_scope(/*$$scope*/ctx[6]) : get_slot_changes(default_slot_template, /*$$scope*/ctx[6], dirty, null), null);
}
}
if (!current || dirty & /*className*/1 && div_class_value !== (div_class_value = "" + (null_to_empty(/*className*/ctx[0] ? "".concat(/*prefixCls*/ctx[2], " ").concat(/*className*/ctx[0]) : /*prefixCls*/ctx[2]) + " svelte-1l3ztq7"))) {
attr(div, "class", div_class_value);
}
if (!current || dirty & /*styleString*/2) {
attr(div, "style", /*styleString*/ctx[1]);
}
},
i: function i(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o: function o(local) {
transition_out(default_slot, local);
current = false;
},
d: function d(detaching) {
if (detaching) detach(div);
if (default_slot) default_slot.d(detaching);
}
};
}
function instance($$self, $$props, $$invalidate) {
var styleString;
var _$$props$$$slots = $$props.$$slots,
slots = _$$props$$$slots === void 0 ? {} : _$$props$$$slots,
$$scope = $$props.$$scope;
var prefixCls = getPrefixCls('modal');
var _$$props$duration = $$props.duration,
duration = _$$props$duration === void 0 ? undefined : _$$props$duration;
var _$$props$afterClose = $$props.afterClose,
afterClose = _$$props$afterClose === void 0 ? function () {} : _$$props$afterClose;
var _$$props$className = $$props.className,
className = _$$props$className === void 0 ? '' : _$$props$className;
var _$$props$style = $$props.style,
style = _$$props$style === void 0 ? {} : _$$props$style;
setTimeout(function () {
if (duration && duration > 0) {
afterClose();
}
}, duration && duration > 0 ? duration : 0);
$$self.$$set = function ($$props) {
if ('duration' in $$props) $$invalidate(3, duration = $$props.duration);
if ('afterClose' in $$props) $$invalidate(4, afterClose = $$props.afterClose);
if ('className' in $$props) $$invalidate(0, className = $$props.className);
if ('style' in $$props) $$invalidate(5, style = $$props.style);
if ('$$scope' in $$props) $$invalidate(6, $$scope = $$props.$$scope);
};
$$self.$$.update = function () {
if ($$self.$$.dirty & /*style*/32) {
$: $$invalidate(1, styleString = reactToCSS(_objectSpread({
zIndex: 999999
}, style)));
}
};
return [className, styleString, prefixCls, duration, afterClose, style, $$scope, slots];
}
var Modal = /*#__PURE__*/function (_SvelteComponent) {
_inherits(Modal, _SvelteComponent);
var _super = _createSuper(Modal);
function Modal(options) {
var _this;
_classCallCheck(this, Modal);
_this = _super.call(this);
init(_assertThisInitialized(_this), options, instance, create_fragment, safe_not_equal, {
duration: 3,
afterClose: 4,
className: 0,
style: 5
}, add_css);
return _this;
}
return _createClass(Modal);
}(SvelteComponent);
export default Modal;