UNPKG

@doreamonjs/gate

Version:
66 lines (65 loc) 2.66 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importDefault(require("react")); const dva_1 = require("dva"); const antd_1 = require("antd"); const components_1 = require("@doreamonjs/components"); const iframe = __importStar(require("@doreamonjs/plugin-iframe")); const IFrame = (props) => { const drawerProps = { className: props.className, width: props.width || 800, title: props.title, placement: props.placement || 'right', visible: props.visible, onClose: props.onClose, closable: false, }; const style = { backgroundColor: '#000', padding: 0, // ...props.style, }; return (react_1.default.createElement(antd_1.Drawer, { ...drawerProps, bodyStyle: style, placement: "right" }, props.visible && (react_1.default.createElement(components_1.Frame, { src: props.src, allowFullScreen: props.allowFullScreen, allowOpenInNewTab: props.allowOpenInNewTab, sanbox: props.sanbox, allow: props.allow })))); }; const mapState = (states) => { const state = states[iframe.NAMESPACE]; const loading = states.loading; const { nextEffect } = state; const btnLoading = loading.effects[nextEffect]; return { loading: btnLoading, visible: state.visible, // attributes: state.attributes, // values: state.datasets.values, ...state.attributes, ...state.datasets.values, }; }; const mapActions = (dispatch) => ({ onClose: () => dispatch({ type: `${iframe.NAMESPACE}/close` }), }); exports.default = dva_1.connect(mapState, mapActions)(IFrame);