UNPKG

@adaptabletools/adaptable

Version:

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

19 lines (18 loc) 2.88 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import Dialog from '../../../components/Dialog'; import { StringExtensions } from '../../../Utilities/Extensions/StringExtensions'; import Input from '../../../components/Input'; import { useState } from 'react'; import SimpleButton from '../../../components/SimpleButton'; import FormLayout, { FormRow } from '../../../components/FormLayout'; import HelpBlock from '../../../components/HelpBlock'; import Radio from '../../../components/Radio'; import { Box, Flex } from '../../../components/Flex'; export const AdaptablePopupTeamSharing = (props) => { const { showPopup, onClose, onConfirm, header } = props; const [config, setConfig] = useState({ description: '', type: 'Snapshot', }); return (_jsx(_Fragment, { children: _jsx(Dialog, { modal: true, "data-name": "teamsharing-popup", isOpen: showPopup, onDismiss: onClose, autoFocus: false, showCloseButton: false, className: "twa:min-h-auto twa:max-w-1/2", children: _jsxs(Flex, { flexDirection: "column", children: [_jsxs(HelpBlock, { "data-name": "teamsharing-popup-description", className: "twa:m-2 twa:mb-2 twa:p-2 twa:text-3", children: ["Create a ", header, " which may be either:", _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Snapshot" }), ": a one-off share of an exact copy of the current object"] }), _jsxs("li", { children: [_jsx("strong", { children: "Active" }), ": a \"live\" share that is automatically updated with every local change"] })] })] }), _jsxs(FormLayout, { className: "twa:p-2", children: [_jsx(FormRow, { label: "Name: ", children: _jsx(Input, { "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 }) }) }), _jsx(FormRow, { label: "Share: ", children: _jsxs(Flex, { flexDirection: "row", children: [_jsx(Radio, { "data-name": "teamsharing-entity-type-snapshot", checked: config.type === 'Snapshot', onChange: () => setConfig({ ...config, type: 'Snapshot' }), children: "Snapshot" }), _jsx(Radio, { "data-name": "teamsharing-entity-type-active", className: "twa:ml-3", checked: config.type === 'Active', onChange: () => setConfig({ ...config, type: 'Active' }), children: "Active" })] }) })] }), _jsx(Box, { className: "twa:mt-3", children: _jsxs(Flex, { className: "twa:p-2", children: [_jsx(SimpleButton, { "data-name": "cancel", tone: "neutral", variant: "raised", onClick: () => onClose(), children: "Cancel" }), _jsx("div", { className: "twa:flex-1" }), _jsx(SimpleButton, { "data-name": "ok", tone: "accent", variant: "raised", disabled: StringExtensions.IsNullOrEmpty(config.description), onClick: () => onConfirm(config), children: "OK" })] }) })] }) }) })); };