xmlui 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Pdf-DeGhSMXe.mjs +19537 -0
- package/dist/Pdf.css +1 -0
- package/dist/apiInterceptorWorker-CwuUhYyc.mjs +9229 -0
- package/dist/array-USo-Szhp.mjs +12 -0
- package/dist/index-C24dkfpd.mjs +1434 -0
- package/dist/index-ao27SnVp.mjs +145185 -0
- package/dist/index.css +1 -0
- package/dist/nivo-bar.es-CWh0ZlxB.mjs +1666 -0
- package/dist/nivo-geo.es-BTqNt5Db.mjs +1579 -0
- package/dist/nivo-legends.es-BuIxHGSU.mjs +6916 -0
- package/dist/nivo-pie.es-BvCBFA0L.mjs +700 -0
- package/dist/react-apexcharts.min-DqWuDOyO.mjs +8881 -0
- package/dist/scripts/bin/bootstrap.js +11 -0
- package/dist/scripts/bin/build.js +256 -0
- package/dist/scripts/bin/index.js +88 -0
- package/dist/scripts/bin/preview.js +27 -0
- package/dist/scripts/bin/start.js +41 -0
- package/dist/scripts/bin/vite-ueml-plugin.js +113 -0
- package/dist/scripts/bin/viteConfig.js +112 -0
- package/dist/scripts/src/abstractions/ActionDefs.js +2 -0
- package/dist/scripts/src/abstractions/AppContextDefs.js +2 -0
- package/dist/scripts/src/abstractions/BlockScope.js +4 -0
- package/dist/scripts/src/abstractions/ComponentDefs.js +2 -0
- package/dist/scripts/src/abstractions/ComponentDescriptorDefs.js +2 -0
- package/dist/scripts/src/abstractions/ContainerDefs.js +2 -0
- package/dist/scripts/src/abstractions/FunctionDefs.js +2 -0
- package/dist/scripts/src/abstractions/RendererDefs.js +2 -0
- package/dist/scripts/src/abstractions/scripting/ScriptParserError.js +2 -0
- package/dist/scripts/src/abstractions/scripting/ScriptingSourceTree.js +2 -0
- package/dist/scripts/src/abstractions/scripting/Token.js +110 -0
- package/dist/scripts/src/components/App/App.js +253 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +9 -0
- package/dist/scripts/src/components/App/AppStateContext.js +9 -0
- package/dist/scripts/src/components/App/Sheet.js +89 -0
- package/dist/scripts/src/components/AppHeader/AppHeader.js +121 -0
- package/dist/scripts/src/components/AppState/AppState.js +29 -0
- package/dist/scripts/src/components/Avatar/Avatar.js +81 -0
- package/dist/scripts/src/components/Badge/Badge.js +56 -0
- package/dist/scripts/src/components/BarChart/BarChart.js +199 -0
- package/dist/scripts/src/components/Bookmark/Bookmark.js +11 -0
- package/dist/scripts/src/components/Button/Button.js +196 -0
- package/dist/scripts/src/components/Card/Card.js +65 -0
- package/dist/scripts/src/components/ChangeListener/ChangeListener.js +43 -0
- package/dist/scripts/src/components/Chart/Chart.js +158 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.js +43 -0
- package/dist/scripts/src/components/Combobox/Combobox.js +145 -0
- package/dist/scripts/src/components/ComponentProvider.js +357 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +40 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.js +196 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +175 -0
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +56 -0
- package/dist/scripts/src/components/FileInput/FileInput.js +127 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +106 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayout.js +139 -0
- package/dist/scripts/src/components/Footer/Footer.js +42 -0
- package/dist/scripts/src/components/Form/Form.js +320 -0
- package/dist/scripts/src/components/Form/FormContext.js +9 -0
- package/dist/scripts/src/components/Form/formActions.js +86 -0
- package/dist/scripts/src/components/FormItem/FormItem.js +204 -0
- package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +39 -0
- package/dist/scripts/src/components/FormItem/Validations.js +346 -0
- package/dist/scripts/src/components/FormSection/FormSection.js +45 -0
- package/dist/scripts/src/components/Heading/Heading.js +206 -0
- package/dist/scripts/src/components/HoverCard/HoverCard.js +45 -0
- package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
- package/dist/scripts/src/components/Icon/Attach.js +10 -0
- package/dist/scripts/src/components/Icon/Binding.js +11 -0
- package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
- package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
- package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
- package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
- package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
- package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/Icon.js +101 -0
- package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
- package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
- package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
- package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
- package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
- package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
- package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
- package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +249 -0
- package/dist/scripts/src/components/IconRegistryContext.js +307 -0
- package/dist/scripts/src/components/Image/Image.js +34 -0
- package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
- package/dist/scripts/src/components/Input/input-abstractions.js +44 -0
- package/dist/scripts/src/components/Items/Items.js +48 -0
- package/dist/scripts/src/components/Link/Link.js +72 -0
- package/dist/scripts/src/components/List/List.js +442 -0
- package/dist/scripts/src/components/Logo/Logo.js +25 -0
- package/dist/scripts/src/components/Map/Map.js +60 -0
- package/dist/scripts/src/components/Map/world_countries.json +45307 -0
- package/dist/scripts/src/components/Markdown/Markdown.js +120 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +106 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +145 -0
- package/dist/scripts/src/components/MultiCombobox/MultiCombobox.js +249 -0
- package/dist/scripts/src/components/MultiSelect/MultiSelect.js +192 -0
- package/dist/scripts/src/components/NavGroup/NavGroup.js +113 -0
- package/dist/scripts/src/components/NavLink/NavLink.js +115 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.js +101 -0
- package/dist/scripts/src/components/NoResult/NoResult.js +39 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +373 -0
- package/dist/scripts/src/components/Option/Option.js +41 -0
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +22 -0
- package/dist/scripts/src/components/Pages/Pages.js +74 -0
- package/dist/scripts/src/components/Pdf/LazyPdf.js +44 -0
- package/dist/scripts/src/components/Pdf/Pdf.js +19 -0
- package/dist/scripts/src/components/PieChart/PieChart.js +184 -0
- package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +29 -0
- package/dist/scripts/src/components/ProgressBar/ProgressBar.js +38 -0
- package/dist/scripts/src/components/Queue/Queue.js +286 -0
- package/dist/scripts/src/components/Queue/queueActions.js +87 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +144 -0
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +147 -0
- package/dist/scripts/src/components/Redirect/Redirect.js +10 -0
- package/dist/scripts/src/components/Select/Select.js +139 -0
- package/dist/scripts/src/components/Select/SelectContext.js +45 -0
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +88 -0
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +22 -0
- package/dist/scripts/src/components/Spinner/Spinner.js +59 -0
- package/dist/scripts/src/components/Splitter/Splitter.js +205 -0
- package/dist/scripts/src/components/Splitter/utils.js +17 -0
- package/dist/scripts/src/components/Stack/Stack.js +117 -0
- package/dist/scripts/src/components/StickyBox/StickyBox.js +33 -0
- package/dist/scripts/src/components/Switch/Switch.js +50 -0
- package/dist/scripts/src/components/Table/Table.js +499 -0
- package/dist/scripts/src/components/Table/useRowSelection.js +169 -0
- package/dist/scripts/src/components/TableColumnDef/TableColumnDef.js +44 -0
- package/dist/scripts/src/components/TableColumnDef/TableContext.js +12 -0
- package/dist/scripts/src/components/Tabs/Tabs.js +85 -0
- package/dist/scripts/src/components/Text/Text.js +175 -0
- package/dist/scripts/src/components/TextArea/TextArea.js +194 -0
- package/dist/scripts/src/components/TextArea/TextAreaResizable.js +63 -0
- package/dist/scripts/src/components/TextArea/useComposedRef.js +50 -0
- package/dist/scripts/src/components/TextBox/TextBox.js +145 -0
- package/dist/scripts/src/components/Theme/NotificationToast.js +39 -0
- package/dist/scripts/src/components/Theme/Theme.js +153 -0
- package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +125 -0
- package/dist/scripts/src/components/Toggle/Toggle.js +88 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +79 -0
- package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
- package/dist/scripts/src/components/ViewComponentRegistryContext.js +34 -0
- package/dist/scripts/src/components/abstractions.js +2 -0
- package/dist/scripts/src/components/chart-color-schemes.js +43 -0
- package/dist/scripts/src/components/component-utils.js +32 -0
- package/dist/scripts/src/components/container-helpers.js +18 -0
- package/dist/scripts/src/components-core/ApiBoundComponent.js +189 -0
- package/dist/scripts/src/components-core/AppContext.js +17 -0
- package/dist/scripts/src/components-core/ChildrenSlot.js +10 -0
- package/dist/scripts/src/components-core/Component.js +280 -0
- package/dist/scripts/src/components-core/ComponentDecorator.js +63 -0
- package/dist/scripts/src/components-core/CompoundComponent.js +132 -0
- package/dist/scripts/src/components-core/EngineError.js +91 -0
- package/dist/scripts/src/components-core/ErrorBoundary.js +58 -0
- package/dist/scripts/src/components-core/Fragment.js +14 -0
- package/dist/scripts/src/components-core/InvalidComponent.js +15 -0
- package/dist/scripts/src/components-core/LoaderComponent.js +78 -0
- package/dist/scripts/src/components-core/RestApiProxy.js +341 -0
- package/dist/scripts/src/components-core/RootComponent.js +272 -0
- package/dist/scripts/src/components-core/RouteContext.js +45 -0
- package/dist/scripts/src/components-core/ScrollContext.js +9 -0
- package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
- package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
- package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
- package/dist/scripts/src/components-core/action/ApiAction.js +276 -0
- package/dist/scripts/src/components-core/action/DownloadFileAction.js +80 -0
- package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
- package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
- package/dist/scripts/src/components-core/action/UploadAction.js +88 -0
- package/dist/scripts/src/components-core/action/actions.js +15 -0
- package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
- package/dist/scripts/src/components-core/component-hooks.js +25 -0
- package/dist/scripts/src/components-core/constants.js +18 -0
- package/dist/scripts/src/components-core/container/Container.js +1110 -0
- package/dist/scripts/src/components-core/container/ContainerComponentDef.js +16 -0
- package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
- package/dist/scripts/src/components-core/container/collectFnVarDeps.js +26 -0
- package/dist/scripts/src/components-core/container/valueExtractor.js +195 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +75 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/loader/ApiLoader.js +46 -0
- package/dist/scripts/src/components-core/loader/DataLoader.js +160 -0
- package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +52 -0
- package/dist/scripts/src/components-core/loader/Loader.js +115 -0
- package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +32 -0
- package/dist/scripts/src/components-core/loader/PageableLoader.js +240 -0
- package/dist/scripts/src/components-core/renderers.js +45 -0
- package/dist/scripts/src/components-core/reportEngineError.js +59 -0
- package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
- package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
- package/dist/scripts/src/components-core/script-runner/LogicalThread.js +2 -0
- package/dist/scripts/src/components-core/script-runner/LoopScope.js +2 -0
- package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
- package/dist/scripts/src/components-core/script-runner/TryScope.js +2 -0
- package/dist/scripts/src/components-core/script-runner/asyncProxy.js +96 -0
- package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
- package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
- package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +551 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +498 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +434 -0
- package/dist/scripts/src/components-core/script-runner/modules.js +250 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-async.js +818 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +740 -0
- package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
- package/dist/scripts/src/components-core/script-runner/visitors.js +352 -0
- package/dist/scripts/src/components-core/theming/ThemeContext.js +43 -0
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +334 -0
- package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
- package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
- package/dist/scripts/src/components-core/theming/hvar.js +105 -0
- package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
- package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
- package/dist/scripts/src/components-core/theming/themes/palette.js +53 -0
- package/dist/scripts/src/components-core/theming/themes/root.js +257 -0
- package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
- package/dist/scripts/src/components-core/theming/themes/theme-colors.js +407 -0
- package/dist/scripts/src/components-core/theming/themes/xmlui.js +32 -0
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +286 -0
- package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +34 -0
- package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
- package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
- package/dist/scripts/src/components-core/utils/classnames.js +58 -0
- package/dist/scripts/src/components-core/utils/css-utils.js +127 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
- package/dist/scripts/src/components-core/utils/hooks.js +221 -0
- package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
- package/dist/scripts/src/components-core/utils/misc.js +460 -0
- package/dist/scripts/src/components-core/utils/statementUtils.js +205 -0
- package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
- package/dist/scripts/src/components-core/xmlui-parser.js +52 -0
- package/dist/scripts/src/parsers/scripting/InputStream.js +59 -0
- package/dist/scripts/src/parsers/scripting/Lexer.js +1028 -0
- package/dist/scripts/src/parsers/scripting/Parser.js +2647 -0
- package/dist/scripts/src/parsers/scripting/ParserError.js +46 -0
- package/dist/scripts/src/parsers/scripting/TokenTrait.js +109 -0
- package/dist/scripts/src/parsers/scripting/code-behind-collect.js +118 -0
- package/dist/scripts/src/parsers/scripting/tree-visitor.js +602 -0
- package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
- package/dist/scripts/src/parsers/style-parser/StyleLexer.js +621 -0
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +1000 -0
- package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
- package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
- package/dist/scripts/src/parsers/style-parser/style-compiler.js +513 -0
- package/dist/scripts/src/parsers/style-parser/tokens.js +42 -0
- package/dist/scripts/src/parsers/ueml/ParserError.js +54 -0
- package/dist/scripts/src/parsers/ueml/UemlHelper.js +579 -0
- package/dist/scripts/src/parsers/ueml/UemlInputStream.js +59 -0
- package/dist/scripts/src/parsers/ueml/UemlLexer.js +868 -0
- package/dist/scripts/src/parsers/ueml/UemlParser.js +1439 -0
- package/dist/scripts/src/parsers/ueml/UemlToken.js +24 -0
- package/dist/scripts/src/parsers/ueml/fileExtensions.js +6 -0
- package/dist/scripts/src/parsers/ueml/source-tree.js +2 -0
- package/dist/scripts/src/parsers/ueml/ueml-tree.js +2 -0
- package/dist/scripts/src/parsers/xmlui-parser/CharacterCodes.js +136 -0
- package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +100 -0
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +476 -0
- package/dist/scripts/src/parsers/xmlui-parser/scanner.js +415 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +106 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +2 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +922 -0
- package/dist/scripts/src/parsers/xmlui-parser/utils.js +83 -0
- package/dist/xmlui.es.d.ts +1667 -0
- package/dist/xmlui.es.js +17 -0
- package/dist/xmlui.umd.js +1589 -0
- package/package.json +175 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = useRowSelection;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const SelectionStore_1 = require("../SelectionStore/SelectionStore");
|
|
6
|
+
const misc_1 = require("@components-core/utils/misc");
|
|
7
|
+
const lodash_es_1 = require("lodash-es");
|
|
8
|
+
const constants_1 = require("@components-core/constants");
|
|
9
|
+
/**
|
|
10
|
+
* This React hook takes care of managing row selection in a table
|
|
11
|
+
* @param items Items (with a unique ID) that can be selected
|
|
12
|
+
* @return Operations to manage the selection
|
|
13
|
+
*/
|
|
14
|
+
function useRowSelection(items = constants_1.EMPTY_ARRAY) {
|
|
15
|
+
// --- The focused index in the row source (if there is any)
|
|
16
|
+
const [focusedIndex, setFocusedIndex] = (0, react_1.useState)(-1);
|
|
17
|
+
// --- The current selection interval
|
|
18
|
+
const [selectionInterval, setSelectionInterval] = (0, react_1.useState)(null);
|
|
19
|
+
// --- Access the selection context that stores the current state of selection
|
|
20
|
+
const { selectedItems, setSelectedRowIds, refreshSelection, idKey } = (0, SelectionStore_1.useSelectionContext)();
|
|
21
|
+
// --- Refresh the list of item IDs whenever the items in the selection change
|
|
22
|
+
const walkableList = (0, react_1.useMemo)(() => {
|
|
23
|
+
return items.map((item) => item[idKey]);
|
|
24
|
+
}, [idKey, items]);
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
refreshSelection(items);
|
|
27
|
+
}, [refreshSelection, items]);
|
|
28
|
+
// --- If the focused item is not available set the focus to the first item
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
if (focusedIndex !== -1 && !walkableList[focusedIndex] && walkableList[0]) {
|
|
31
|
+
setFocusedIndex(0);
|
|
32
|
+
}
|
|
33
|
+
}, [focusedIndex, setFocusedIndex, walkableList]);
|
|
34
|
+
// --- Handle the user event to change the current selection. The event function handles the SHIFT, CTRL,
|
|
35
|
+
// --- and META keys to decide how to change or extend the existing selection
|
|
36
|
+
const toggleRowIndex = (0, misc_1.useEvent)(
|
|
37
|
+
// targetIndex: the item affected by an event
|
|
38
|
+
// options: key event options
|
|
39
|
+
(targetIndex, options = {}) => {
|
|
40
|
+
const targetId = walkableList[targetIndex];
|
|
41
|
+
const { shiftKey, metaKey, ctrlKey } = options;
|
|
42
|
+
// --- This variable will hold the newest selection interval
|
|
43
|
+
let newSelectionInterval;
|
|
44
|
+
let newSelectedRowsIdsInOrder = [...(selectedItems.map(item => item[idKey]))];
|
|
45
|
+
if (shiftKey) {
|
|
46
|
+
// --- SHIFT is pressed, extend the current selection
|
|
47
|
+
let normalizedFromIdx;
|
|
48
|
+
let normalizedToIdx;
|
|
49
|
+
let from;
|
|
50
|
+
let to;
|
|
51
|
+
if (selectionInterval) {
|
|
52
|
+
// --- Get the selection boundaries and normalize them (from is less than or equal than to)
|
|
53
|
+
let oldFromIdx = walkableList.indexOf(selectionInterval.from);
|
|
54
|
+
let oldToIdx = walkableList.indexOf(selectionInterval.to);
|
|
55
|
+
let normalizedOldFromIdx = Math.min(oldFromIdx, oldToIdx);
|
|
56
|
+
let normalizedOldToIdx = Math.max(oldFromIdx, oldToIdx);
|
|
57
|
+
// --- Get the slice of selected IDs
|
|
58
|
+
const slice = walkableList.slice(normalizedOldFromIdx, normalizedOldToIdx + 1);
|
|
59
|
+
newSelectedRowsIdsInOrder = newSelectedRowsIdsInOrder.filter((item) => !slice.includes(item));
|
|
60
|
+
from = selectionInterval.from;
|
|
61
|
+
to = targetId;
|
|
62
|
+
let fromIdx = walkableList.indexOf(from);
|
|
63
|
+
let toIdx = walkableList.indexOf(to);
|
|
64
|
+
normalizedFromIdx = Math.min(fromIdx, toIdx);
|
|
65
|
+
normalizedToIdx = Math.max(fromIdx, toIdx);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
from = targetId;
|
|
69
|
+
to = targetId;
|
|
70
|
+
normalizedFromIdx = targetIndex;
|
|
71
|
+
normalizedToIdx = targetIndex;
|
|
72
|
+
}
|
|
73
|
+
const sl = walkableList.slice(normalizedFromIdx, normalizedToIdx + 1);
|
|
74
|
+
newSelectedRowsIdsInOrder = (0, lodash_es_1.union)(newSelectedRowsIdsInOrder, sl);
|
|
75
|
+
newSelectionInterval = {
|
|
76
|
+
from: from,
|
|
77
|
+
to: to,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// --- SHIFT is not pressed, set the new interval to the newly focused item
|
|
82
|
+
newSelectionInterval = {
|
|
83
|
+
from: targetId,
|
|
84
|
+
to: targetId,
|
|
85
|
+
};
|
|
86
|
+
if (metaKey || ctrlKey) {
|
|
87
|
+
// --- If META key (Mac) or CTRL (Windows) is pressed, toggle the selection of the targeted item
|
|
88
|
+
if (newSelectedRowsIdsInOrder.includes(targetId)) {
|
|
89
|
+
newSelectedRowsIdsInOrder = newSelectedRowsIdsInOrder.filter((item) => item !== targetId);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
newSelectedRowsIdsInOrder.push(targetId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// --- The targeted item remains the only selection
|
|
97
|
+
newSelectedRowsIdsInOrder = [targetId];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// --- Update the state variables of the selection
|
|
101
|
+
setFocusedIndex(targetIndex);
|
|
102
|
+
setSelectedRowIds((0, lodash_es_1.uniq)(newSelectedRowsIdsInOrder));
|
|
103
|
+
setSelectionInterval(newSelectionInterval);
|
|
104
|
+
});
|
|
105
|
+
// --- This function handles the user event to change the current selection according to the row ID
|
|
106
|
+
// --- affected by the event
|
|
107
|
+
const toggleRow = (0, misc_1.useEvent)((item, options) => {
|
|
108
|
+
const targetIndex = walkableList.indexOf(item[idKey]);
|
|
109
|
+
toggleRowIndex(targetIndex, options);
|
|
110
|
+
});
|
|
111
|
+
// --- Handle the key events that may change the current selection
|
|
112
|
+
const onKeyDown = (0, misc_1.useEvent)((event) => {
|
|
113
|
+
if (event.key === "ArrowDown") {
|
|
114
|
+
// --- Move/extend the selection to the item below the focused one
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
let newFocusIndex = Math.min(items.length - 1, focusedIndex + 1);
|
|
117
|
+
if (focusedIndex !== items.length - 1) {
|
|
118
|
+
toggleRowIndex(newFocusIndex, event);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (event.key === "PageDown") {
|
|
122
|
+
// --- Move/extend the selection to the item 8 items below the focused one
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
const newFocusIndex = Math.min(items.length - 1, focusedIndex + 8);
|
|
125
|
+
toggleRowIndex(newFocusIndex, event);
|
|
126
|
+
}
|
|
127
|
+
if (event.key === "ArrowUp") {
|
|
128
|
+
// --- Move/extend the selection to the item above the focused one
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
let newFocusIndex = Math.max(0, focusedIndex - 1);
|
|
131
|
+
if (focusedIndex >= 0) {
|
|
132
|
+
toggleRowIndex(newFocusIndex, event);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (event.key === "PageUp") {
|
|
136
|
+
// --- Move/extend the selection to the item 8 items above the focused one
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
const newFocusIndex = Math.max(0, focusedIndex - 8);
|
|
139
|
+
toggleRowIndex(newFocusIndex, event);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* This operation checks or clears all rows
|
|
144
|
+
*/
|
|
145
|
+
const checkAllRows = (0, misc_1.useEvent)((checked) => {
|
|
146
|
+
setSelectedRowIds(checked ? walkableList : []);
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* This operation creates a hash object that indicates the selected status of selected row IDs
|
|
150
|
+
*/
|
|
151
|
+
const selectedRowIdMap = (0, react_1.useMemo)(() => {
|
|
152
|
+
let rows = {};
|
|
153
|
+
selectedItems.forEach((item) => {
|
|
154
|
+
rows[item[idKey]] = true;
|
|
155
|
+
});
|
|
156
|
+
return rows;
|
|
157
|
+
}, [idKey, selectedItems]);
|
|
158
|
+
// --- Retrieve the selection management object
|
|
159
|
+
return {
|
|
160
|
+
onKeyDown,
|
|
161
|
+
focusedIndex,
|
|
162
|
+
toggleRowIndex,
|
|
163
|
+
toggleRow,
|
|
164
|
+
checkAllRows,
|
|
165
|
+
selectedRowIdMap,
|
|
166
|
+
selectedItems,
|
|
167
|
+
idKey
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.tableColumnDefComponentRenderer = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const renderers_1 = require("@components-core/renderers");
|
|
17
|
+
const TableContext_1 = require("@components/TableColumnDef/TableContext");
|
|
18
|
+
const react_1 = require("react");
|
|
19
|
+
const container_helpers_1 = require("@components/container-helpers");
|
|
20
|
+
function TableColumnDef(_a) {
|
|
21
|
+
var { nodeChildren, renderChild, index } = _a, columnMetadata = __rest(_a, ["nodeChildren", "renderChild", "index"]);
|
|
22
|
+
const id = (0, react_1.useId)();
|
|
23
|
+
const { registerColumn, unRegisterColumn } = (0, TableContext_1.useTableContext)();
|
|
24
|
+
const cellRenderer = (0, react_1.useCallback)((row) => {
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: nodeChildren, item: row, renderChild: renderChild });
|
|
26
|
+
}, [nodeChildren, renderChild]);
|
|
27
|
+
const safeCellRenderer = (0, react_1.useMemo)(() => {
|
|
28
|
+
return nodeChildren ? cellRenderer : undefined;
|
|
29
|
+
}, [cellRenderer, nodeChildren]);
|
|
30
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
31
|
+
registerColumn(Object.assign(Object.assign({}, columnMetadata), { cellRenderer: safeCellRenderer, id,
|
|
32
|
+
index }));
|
|
33
|
+
}, [index, columnMetadata, id, registerColumn, safeCellRenderer]);
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
return () => {
|
|
36
|
+
unRegisterColumn(id);
|
|
37
|
+
};
|
|
38
|
+
}, [id, unRegisterColumn]);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
exports.tableColumnDefComponentRenderer = (0, renderers_1.createComponentRenderer)("TableColumnDef", (rendererContext) => {
|
|
42
|
+
const { node, renderChild, extractValue, childIndex, layoutCss } = rendererContext;
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(TableColumnDef, { style: layoutCss, header: extractValue.asDisplayText(node.props.header), accessorKey: extractValue.asOptionalString(node.props.bindTo), canSort: extractValue.asOptionalBoolean(node.props.canSort), canResize: extractValue.asOptionalBoolean(node.props.canResize), pinTo: extractValue.asOptionalString(node.props.pinTo), width: extractValue(node.props.width), minWidth: extractValue(node.props.minWidth), maxWidth: extractValue(node.props.maxWidth), nodeChildren: node.children, renderChild: renderChild, index: childIndex || 0 }));
|
|
44
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableContext = void 0;
|
|
4
|
+
exports.useTableContext = useTableContext;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.TableContext = (0, react_1.createContext)({
|
|
7
|
+
registerColumn: (col) => { },
|
|
8
|
+
unRegisterColumn: (id) => { },
|
|
9
|
+
});
|
|
10
|
+
function useTableContext() {
|
|
11
|
+
return (0, react_1.useContext)(exports.TableContext);
|
|
12
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.tabsComponentRenderer = void 0;
|
|
30
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
const react_1 = require("react");
|
|
32
|
+
const RTabs = __importStar(require("@radix-ui/react-tabs"));
|
|
33
|
+
const descriptorHelper_1 = require("@components-core/descriptorHelper");
|
|
34
|
+
const themeVars_1 = require("@components-core/theming/themeVars");
|
|
35
|
+
const Tabs_module_scss_1 = __importDefault(require("./Tabs.module.scss"));
|
|
36
|
+
const renderers_1 = require("@components-core/renderers");
|
|
37
|
+
const container_helpers_1 = require("@components/container-helpers");
|
|
38
|
+
const Tabs = ({ tabs = [], activeTab = 0, orientation = "vertical", tabRenderer, style }) => {
|
|
39
|
+
const _activeTab = activeTab < 0 ? 0 : activeTab > tabs.length - 1 ? tabs.length - 1 : activeTab;
|
|
40
|
+
const [currentTab, setCurrentTab] = (0, react_1.useState)(`${_activeTab}`);
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(RTabs.Root, { className: Tabs_module_scss_1.default.tabs, value: `${currentTab}`, onValueChange: setCurrentTab, orientation: orientation, style: style, children: [(0, jsx_runtime_1.jsxs)(RTabs.List, { className: Tabs_module_scss_1.default.tabsList, children: [tabs.map((tab, index) => tabRenderer ? ((0, jsx_runtime_1.jsx)(RTabs.Trigger, { value: `${index}`, children: tabRenderer({ label: tab.label, isActive: `${index}` === currentTab }) }, index)) : ((0, jsx_runtime_1.jsx)(RTabs.Trigger, { className: Tabs_module_scss_1.default.tabTrigger, value: `${index}`, children: tab.label }, index))), (0, jsx_runtime_1.jsx)("div", { className: Tabs_module_scss_1.default.filler, "data-orientation": orientation })] }), tabs.map((tab, index) => ((0, jsx_runtime_1.jsx)(RTabs.Content, { value: `${index}`, className: Tabs_module_scss_1.default.tabsContent, children: tab.content }, index)))] }));
|
|
42
|
+
};
|
|
43
|
+
const metadata = {
|
|
44
|
+
displayName: "Tabs",
|
|
45
|
+
description: "Tabs component",
|
|
46
|
+
props: {
|
|
47
|
+
tabs: (0, descriptorHelper_1.desc)("The tabs to be displayed in the tab component"),
|
|
48
|
+
activeTab: (0, descriptorHelper_1.desc)("The active tab index"),
|
|
49
|
+
orientation: (0, descriptorHelper_1.desc)("The orientation of the tabs"),
|
|
50
|
+
tabTemplate: (0, descriptorHelper_1.desc)("The template for the tab"),
|
|
51
|
+
},
|
|
52
|
+
themeVars: (0, themeVars_1.parseScssVar)(Tabs_module_scss_1.default.themeVars),
|
|
53
|
+
defaultThemeVars: {
|
|
54
|
+
"color-bg-Tabs": "$color-bg-primary",
|
|
55
|
+
"style-border-Tabs": "solid",
|
|
56
|
+
"color-border-Tabs": "$color-border",
|
|
57
|
+
"color-border-active-Tabs": "$color-primary",
|
|
58
|
+
"thickness-border-Tabs": "2px",
|
|
59
|
+
"color-bg-trigger-Tabs": "$color-bg-primary",
|
|
60
|
+
light: {
|
|
61
|
+
"color-bg-trigger-Tabs--hover": "$color-primary-50",
|
|
62
|
+
},
|
|
63
|
+
dark: {
|
|
64
|
+
"color-bg-trigger-Tabs--hover": "$color-primary-800",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
exports.tabsComponentRenderer = (0, renderers_1.createComponentRenderer)("Tabs", ({ extractValue, node, renderChild, layoutCss }) => {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
const tabs = [];
|
|
71
|
+
if (Array.isArray(node.children)) {
|
|
72
|
+
node.children.forEach((child) => {
|
|
73
|
+
var _a;
|
|
74
|
+
if (child.type === "TabItem") {
|
|
75
|
+
tabs.push({
|
|
76
|
+
label: (_a = child.props) === null || _a === void 0 ? void 0 : _a.label,
|
|
77
|
+
content: renderChild(child.children),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(Tabs, { style: layoutCss, tabRenderer: !!((_a = node === null || node === void 0 ? void 0 : node.props) === null || _a === void 0 ? void 0 : _a.tabTemplate)
|
|
83
|
+
? (item) => (0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.tabTemplate, item: item, renderChild: renderChild })
|
|
84
|
+
: undefined, tabs: tabs, activeTab: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.activeTab), orientation: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.orientation) }));
|
|
85
|
+
}, metadata);
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.textComponentRenderer = exports.Text = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const Text_module_scss_1 = __importDefault(require("./Text.module.scss"));
|
|
21
|
+
const classnames_1 = __importDefault(require("@components-core/utils/classnames"));
|
|
22
|
+
const renderers_1 = require("@components-core/renderers");
|
|
23
|
+
const themeVars_1 = require("@components-core/theming/themeVars");
|
|
24
|
+
const descriptorHelper_1 = require("@components-core/descriptorHelper");
|
|
25
|
+
const css_utils_1 = require("@components-core/utils/css-utils");
|
|
26
|
+
// =====================================================================================================================
|
|
27
|
+
// React Text component definition
|
|
28
|
+
const TextVariantKeys = [
|
|
29
|
+
"abbr", // use <abbr>
|
|
30
|
+
"cite", // use <cite>
|
|
31
|
+
"code", // use <code>
|
|
32
|
+
"codefence", // use uniquely styled <![CDATA[
|
|
33
|
+
"deleted", // use <del>
|
|
34
|
+
"inserted", // use <ins>
|
|
35
|
+
"keyboard", // use <kbd>,
|
|
36
|
+
"marked", // use <mark>
|
|
37
|
+
"sample", // use <samp>
|
|
38
|
+
"sub", // use <sub>
|
|
39
|
+
"sup", // use <sup>
|
|
40
|
+
"var", // use <var>
|
|
41
|
+
"strong", // use <strong> element for content that is of greater importance (used in Markdown)
|
|
42
|
+
"em", // use <em> element changes the meaning of a sentence - as spoken emphasis does (used in Markdown)
|
|
43
|
+
"mono", // use monospace font with <![CDATA[
|
|
44
|
+
"title", // Title text in the particular context
|
|
45
|
+
"subtitle", // Subtitle text in the particular context
|
|
46
|
+
"small", // Small text in the particular context
|
|
47
|
+
"caption", // Caption text in the particular context
|
|
48
|
+
"placeholder", // Placeholder text in the particular context
|
|
49
|
+
"paragraph", // use <p>
|
|
50
|
+
];
|
|
51
|
+
const TextVariantElement = {
|
|
52
|
+
abbr: "abbr",
|
|
53
|
+
cite: "cite",
|
|
54
|
+
code: "code",
|
|
55
|
+
codefence: "pre",
|
|
56
|
+
deleted: "del",
|
|
57
|
+
inserted: "ins",
|
|
58
|
+
keyboard: "kbd",
|
|
59
|
+
marked: "mark",
|
|
60
|
+
sample: "samp",
|
|
61
|
+
sub: "sub",
|
|
62
|
+
sup: "sup",
|
|
63
|
+
var: "var",
|
|
64
|
+
mono: "pre",
|
|
65
|
+
strong: "strong",
|
|
66
|
+
em: "em",
|
|
67
|
+
title: "span",
|
|
68
|
+
subtitle: "span",
|
|
69
|
+
small: "span",
|
|
70
|
+
caption: "span",
|
|
71
|
+
placeholder: "span",
|
|
72
|
+
paragraph: "p",
|
|
73
|
+
};
|
|
74
|
+
const AbbreviationKeys = ["title"];
|
|
75
|
+
const InsertedKeys = ["cite", "dateTime"];
|
|
76
|
+
const VariantPropsKeys = [...AbbreviationKeys, ...InsertedKeys];
|
|
77
|
+
const Text = (_a) => {
|
|
78
|
+
var { uid, variant, maxLines = 0, layout, children, preserveLinebreaks, ellipses = true } = _a, variantSpecificProps = __rest(_a, ["uid", "variant", "maxLines", "layout", "children", "preserveLinebreaks", "ellipses"]);
|
|
79
|
+
const ref = (0, react_1.useRef)(null);
|
|
80
|
+
const Element = (0, react_1.useMemo)(() => {
|
|
81
|
+
if (!variant || !TextVariantElement[variant])
|
|
82
|
+
return "div"; //todo illesg, could be a span?
|
|
83
|
+
return TextVariantElement[variant];
|
|
84
|
+
}, [variant]);
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Element, Object.assign({}, variantSpecificProps, { ref: (node) => {
|
|
86
|
+
if (!node)
|
|
87
|
+
return;
|
|
88
|
+
ref.current = node;
|
|
89
|
+
}, className: (0, classnames_1.default)([
|
|
90
|
+
Text_module_scss_1.default.text,
|
|
91
|
+
Text_module_scss_1.default[variant || "default"],
|
|
92
|
+
{
|
|
93
|
+
[Text_module_scss_1.default.truncateOverflow]: maxLines > 0,
|
|
94
|
+
[Text_module_scss_1.default.preserveLinebreaks]: preserveLinebreaks,
|
|
95
|
+
[Text_module_scss_1.default.noEllipsis]: !ellipses
|
|
96
|
+
},
|
|
97
|
+
]), style: Object.assign(Object.assign({}, layout), (0, css_utils_1.getMaxLinesStyle)(maxLines)), children: children })) }));
|
|
98
|
+
};
|
|
99
|
+
exports.Text = Text;
|
|
100
|
+
const metadata = {
|
|
101
|
+
displayName: "Text",
|
|
102
|
+
description: "Display a text with several variants (styles)",
|
|
103
|
+
props: {
|
|
104
|
+
value: (0, descriptorHelper_1.desc)("The text to display in the component - can be empty"),
|
|
105
|
+
variant: (0, descriptorHelper_1.desc)("Indicates the styling of the Text component, see stylesheet for details"),
|
|
106
|
+
maxLines: (0, descriptorHelper_1.desc)("Limits the number of lines the component can use"),
|
|
107
|
+
preserveLinebreaks: (0, descriptorHelper_1.desc)("Allow preserving linebreak information?"),
|
|
108
|
+
ellipses: (0, descriptorHelper_1.desc)("Indicates if ellipsis should be hidden from the end of the text"),
|
|
109
|
+
},
|
|
110
|
+
themeVars: (0, themeVars_1.parseScssVar)(Text_module_scss_1.default.themeVars),
|
|
111
|
+
defaultThemeVars: {
|
|
112
|
+
"border-radius-Text": "$radius",
|
|
113
|
+
"style-border-Text": "solid",
|
|
114
|
+
"thickness-border-Text": "$space-0",
|
|
115
|
+
"font-weight-Text-abbr": "$font-weight-bold",
|
|
116
|
+
"transform-Text-abbr": "uppercase",
|
|
117
|
+
"font-size-Text-secondary": "$color-text-secondary",
|
|
118
|
+
"font-style-Text-cite": "italic",
|
|
119
|
+
"font-family-Text-code": "$font-family-monospace",
|
|
120
|
+
"font-size-Text-code": "$font-size-small",
|
|
121
|
+
"thickness-border-Text-code": "1px",
|
|
122
|
+
"padding-horizontal-Text-code": "$space-1",
|
|
123
|
+
"line-decoration-Text-deleted": "line-through",
|
|
124
|
+
"line-decoration-Text-inserted": "underline",
|
|
125
|
+
"font-family-Text-keyboard": "$font-family-monospace",
|
|
126
|
+
"font-size-Text-keyboard": "$font-size-small",
|
|
127
|
+
"font-weight-Text-keyboard": "$font-weight-bold",
|
|
128
|
+
"thickness-border-Text-keyboard": "1px",
|
|
129
|
+
"padding-horizontal-Text-keyboard": "$space-1",
|
|
130
|
+
"font-family-Text-sample": "$font-family-monospace",
|
|
131
|
+
"font-size-Text-sample": "$font-size-small",
|
|
132
|
+
"font-size-Text-sup": "$font-size-smaller",
|
|
133
|
+
"align-vertical-Text-sup": "super",
|
|
134
|
+
"font-size-Text-sub": "$font-size-smaller",
|
|
135
|
+
"align-vertical-Text-sub": "sub",
|
|
136
|
+
"font-style-Text-var": "italic",
|
|
137
|
+
"font-family-Text-mono": "$font-family-monospace",
|
|
138
|
+
"font-size-Text-title": "$font-size-large",
|
|
139
|
+
"font-size-Text-subtitle": "$font-size-medium",
|
|
140
|
+
"font-size-Text-small": "$font-size-small",
|
|
141
|
+
"letter-spacing-Text-caption": "0.05rem",
|
|
142
|
+
"font-size-Text-placeholder": "$font-size-small",
|
|
143
|
+
"font-family-Text-codefence": "$font-family-monospace",
|
|
144
|
+
"padding-horizontal-Text-codefence": "$space-3",
|
|
145
|
+
"padding-vertical-Text-codefence": "$space-2",
|
|
146
|
+
"padding-vertical-Text-paragraph": "$space-1",
|
|
147
|
+
light: {
|
|
148
|
+
"color-bg-Text-code": "$color-surface-100",
|
|
149
|
+
"color-border-Text-code": "$color-surface-200",
|
|
150
|
+
"color-bg-Text-keyboard": "$color-surface-200",
|
|
151
|
+
"color-border-Text-keyboard": "$color-surface-300",
|
|
152
|
+
"color-bg-Text-marked": "yellow",
|
|
153
|
+
"color-Text-placeholder": "$color-surface-500",
|
|
154
|
+
"color-bg-Text-codefence": "$color-primary-100",
|
|
155
|
+
"color-Text-codefence": "$color-surface-900",
|
|
156
|
+
},
|
|
157
|
+
dark: {
|
|
158
|
+
"color-bg-Text-code": "$color-surface-800",
|
|
159
|
+
"color-border-Text-code": "$color-surface-700",
|
|
160
|
+
"color-bg-Text-keyboard": "$color-surface-800",
|
|
161
|
+
"color-border-Text-keyboard": "$color-surface-700",
|
|
162
|
+
"color-bg-Text-marked": "orange",
|
|
163
|
+
"color-Text-placeholder": "$color-surface-500",
|
|
164
|
+
"color-bg-Text-codefence": "$color-primary-800",
|
|
165
|
+
"color-Text-codefence": "$color-surface-200",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
exports.textComponentRenderer = (0, renderers_1.createComponentRenderer)("Text", ({ node, extractValue, layoutCss, renderChild }) => {
|
|
170
|
+
const _a = node.props, { variant, maxLines, preserveLinebreaks, ellipses, value } = _a, variantSpecific = __rest(_a, ["variant", "maxLines", "preserveLinebreaks", "ellipses", "value"]);
|
|
171
|
+
const variantSpecificProps = Object.fromEntries(Object.entries(variantSpecific)
|
|
172
|
+
.filter(([key, _]) => VariantPropsKeys.includes(key))
|
|
173
|
+
.map(([key, value]) => [key, extractValue(value)]));
|
|
174
|
+
return ((0, jsx_runtime_1.jsx)(exports.Text, Object.assign({ variant: extractValue(variant), maxLines: extractValue.asOptionalNumber(maxLines), layout: layoutCss, preserveLinebreaks: extractValue.asOptionalBoolean(preserveLinebreaks, false), ellipses: extractValue.asOptionalBoolean(ellipses, true) }, variantSpecificProps, { children: extractValue.asDisplayText(value) || renderChild(node.children) })));
|
|
175
|
+
}, metadata);
|