UNPKG

@adaptabletools/adaptable-cjs

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

49 lines (48 loc) 4.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AdaptablePopupTeamSharing = void 0; const tslib_1 = require("tslib"); const Dialog_1 = tslib_1.__importDefault(require("../../../components/Dialog")); const StringExtensions_1 = require("../../../Utilities/Extensions/StringExtensions"); const Input_1 = tslib_1.__importDefault(require("../../../components/Input")); const react_1 = require("react"); const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton")); const React = tslib_1.__importStar(require("react")); const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout")); const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlock")); const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio")); const Flex_1 = require("../../../components/Flex"); const AdaptablePopupTeamSharing = (props) => { const { showPopup, onClose, onConfirm, header } = props; const [config, setConfig] = (0, react_1.useState)({ description: '', type: 'Snapshot', }); return (React.createElement(React.Fragment, null, React.createElement(Dialog_1.default, { modal: true, "data-name": "teamsharing-popup", isOpen: showPopup, onDismiss: onClose, autoFocus: false, showCloseButton: false, className: "twa:min-h-auto twa:max-w-1/2" }, React.createElement(Flex_1.Flex, { flexDirection: "column" }, React.createElement(HelpBlock_1.default, { "data-name": "teamsharing-popup-description", className: "twa:m-2 twa:mb-2 twa:p-2 twa:text-3" }, "Create a ", header, " which may be either:", React.createElement("ul", null, React.createElement("li", null, React.createElement("strong", null, "Snapshot"), ": a one-off share of an exact copy of the current object"), React.createElement("li", null, React.createElement("strong", null, "Active"), ": a \"live\" share that is automatically updated with every local change"))), React.createElement(FormLayout_1.default, { className: "twa:p-2" }, React.createElement(FormLayout_1.FormRow, { label: "Name: " }, React.createElement(Input_1.default, { "data-name": "teamsharing-entity-name", autoFocus: true, value: config.description, type: "string", className: "twa:w-[300px]", placeholder: "Enter text", onChange: (e) => setConfig({ ...config, description: e.target.value }) })), React.createElement(FormLayout_1.FormRow, { label: "Share: " }, React.createElement(Flex_1.Flex, { flexDirection: "row" }, React.createElement(Radio_1.default, { "data-name": "teamsharing-entity-type-snapshot", checked: config.type === 'Snapshot', onChange: () => setConfig({ ...config, type: 'Snapshot' }) }, "Snapshot"), React.createElement(Radio_1.default, { "data-name": "teamsharing-entity-type-active", className: "twa:ml-3", checked: config.type === 'Active', onChange: () => setConfig({ ...config, type: 'Active' }) }, "Active")))), React.createElement(Flex_1.Box, { className: "twa:mt-3" }, React.createElement(Flex_1.Flex, { className: "twa:p-2" }, React.createElement(SimpleButton_1.default, { "data-name": "cancel", tone: "neutral", variant: "raised", onClick: () => onClose() }, "Cancel"), React.createElement("div", { className: "twa:flex-1" }), React.createElement(SimpleButton_1.default, { "data-name": "ok", tone: "accent", variant: "raised", disabled: StringExtensions_1.StringExtensions.IsNullOrEmpty(config.description), onClick: () => onConfirm(config) }, "OK"))))))); }; exports.AdaptablePopupTeamSharing = AdaptablePopupTeamSharing;