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,373 @@
|
|
|
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.numberBoxComponentRenderer = exports.NumberBox = void 0;
|
|
30
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
const input_abstractions_1 = require("@components/Input/input-abstractions");
|
|
32
|
+
const renderers_1 = require("@components-core/renderers");
|
|
33
|
+
const react_1 = __importStar(require("react"));
|
|
34
|
+
const classnames_1 = __importDefault(require("@components-core/utils/classnames"));
|
|
35
|
+
const NumberBox_module_scss_1 = __importDefault(require("./NumberBox.module.scss"));
|
|
36
|
+
const constants_1 = require("@components-core/constants");
|
|
37
|
+
const Icon_1 = require("@components/Icon/Icon");
|
|
38
|
+
const InputAdornment_1 = require("@components/Input/InputAdornment");
|
|
39
|
+
const Button_1 = require("@components/Button/Button");
|
|
40
|
+
const themeVars_1 = require("@components-core/theming/themeVars");
|
|
41
|
+
const descriptorHelper_1 = require("@components-core/descriptorHelper");
|
|
42
|
+
const misc_1 = require("@components-core/utils/misc");
|
|
43
|
+
// =====================================================================================================================
|
|
44
|
+
// React NumberBox component definition
|
|
45
|
+
const MAX_VALUE = 999999999999999;
|
|
46
|
+
const DECIMAL_SEPARATOR = ".";
|
|
47
|
+
const EXPONENTIAL_SEPARATOR = "e";
|
|
48
|
+
const NumberBox = ({ id, value, initialValue, style, enabled = true, placeholder, validationStatus = "none", hasSpinBox = true, step, integersOnly = false, zeroOrPositive = false, min = zeroOrPositive ? 0 : -MAX_VALUE, max = MAX_VALUE, maxLength, updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, autoFocus, readOnly, }) => {
|
|
49
|
+
// Ensure the provided minimum is not smaller than the 0 if zeroOrPositive is set to true
|
|
50
|
+
min = Math.max(zeroOrPositive ? 0 : -MAX_VALUE, min);
|
|
51
|
+
// Step must be an integer since floating point arithmetic needs a deeper dive.
|
|
52
|
+
const _step = toUsableNumber(step, true) || 1;
|
|
53
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
54
|
+
const upButton = (0, react_1.useRef)(null);
|
|
55
|
+
const downButton = (0, react_1.useRef)(null);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
if (autoFocus) {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
var _a;
|
|
60
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
61
|
+
}, 0);
|
|
62
|
+
}
|
|
63
|
+
}, [autoFocus]);
|
|
64
|
+
// --- Convert to representable string value (from number | null | undefined)
|
|
65
|
+
const [valueStrRep, setValueStrRep] = react_1.default.useState(mapToRepresentation(value));
|
|
66
|
+
(0, react_1.useEffect)(() => {
|
|
67
|
+
setValueStrRep(mapToRepresentation(value));
|
|
68
|
+
}, [value]);
|
|
69
|
+
// --- Initialize the related field with the input's initial value
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
updateState({ value: initialValue });
|
|
72
|
+
}, [initialValue, updateState]);
|
|
73
|
+
// --- Handle the value change events for this input
|
|
74
|
+
const updateValue = (0, react_1.useCallback)((newValue, rep) => {
|
|
75
|
+
setValueStrRep(rep);
|
|
76
|
+
updateState({ value: newValue });
|
|
77
|
+
onDidChange(newValue);
|
|
78
|
+
}, [onDidChange, updateState]);
|
|
79
|
+
// --- Keypress
|
|
80
|
+
const onInputChange = (0, react_1.useCallback)((event) => {
|
|
81
|
+
// const newValue = sanitizeInput(event.target.value.trim(), value, integersOnly, zeroOrPositive, min, max);
|
|
82
|
+
// if (!newValue) return;
|
|
83
|
+
// updateValue(newValue[0], newValue[1]);
|
|
84
|
+
const value = event.target.value;
|
|
85
|
+
const repr = value;
|
|
86
|
+
updateValue(value, repr);
|
|
87
|
+
}, [integersOnly, updateValue, min, max, zeroOrPositive, value]);
|
|
88
|
+
// --- Stepper logic
|
|
89
|
+
const handleIncStep = (0, react_1.useCallback)(() => {
|
|
90
|
+
if (readOnly)
|
|
91
|
+
return;
|
|
92
|
+
const newValue = applyStep(valueStrRep, _step, min, max, integersOnly);
|
|
93
|
+
if (newValue === undefined)
|
|
94
|
+
return;
|
|
95
|
+
updateValue(newValue, newValue.toString());
|
|
96
|
+
}, [valueStrRep, _step, min, max, integersOnly, updateValue, readOnly]);
|
|
97
|
+
const handleDecStep = (0, react_1.useCallback)(() => {
|
|
98
|
+
if (readOnly)
|
|
99
|
+
return;
|
|
100
|
+
const newValue = applyStep(valueStrRep, -_step, min, max, integersOnly);
|
|
101
|
+
if (newValue === undefined)
|
|
102
|
+
return;
|
|
103
|
+
updateValue(newValue, newValue.toString());
|
|
104
|
+
}, [valueStrRep, _step, min, max, integersOnly, updateValue, readOnly]);
|
|
105
|
+
// --- Register stepper logic to buttons
|
|
106
|
+
useLongPress(upButton.current, handleIncStep);
|
|
107
|
+
useLongPress(downButton.current, handleDecStep);
|
|
108
|
+
// --- This logic prevenst the user from typing invalid characters (in the current typing context)
|
|
109
|
+
const handleOnBeforeInput = (event) => {
|
|
110
|
+
var _a;
|
|
111
|
+
// --- Prevent the default behavior for some characters
|
|
112
|
+
let shouldPreventDefault = false;
|
|
113
|
+
let currentValue = (_a = event.target.value) !== null && _a !== void 0 ? _a : "";
|
|
114
|
+
const currentPos = event.target.selectionStart;
|
|
115
|
+
// --- Are the caret after the exponential separator?
|
|
116
|
+
const beforeCaret = currentValue.substring(0, event.target.selectionStart);
|
|
117
|
+
// --- If "expPos" is -1, the caret is not after the exponential separator
|
|
118
|
+
const expPos = beforeCaret.indexOf(EXPONENTIAL_SEPARATOR);
|
|
119
|
+
switch (event.data) {
|
|
120
|
+
case "-":
|
|
121
|
+
shouldPreventDefault = true;
|
|
122
|
+
if (expPos === -1) {
|
|
123
|
+
// --- Change the first char to "-" if we are before the exponential separator and it's not already there
|
|
124
|
+
if (!currentValue.startsWith("-")) {
|
|
125
|
+
setNewValue("-" + currentValue, currentPos + 1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
// --- Change the char after the exponential separator to "-" if it's not already there
|
|
130
|
+
if (currentValue[expPos + 1] !== "-") {
|
|
131
|
+
setNewValue(currentValue.substring(0, expPos + 1) + "-" + currentValue.substring(expPos + 1), currentPos + 1);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case "+":
|
|
136
|
+
shouldPreventDefault = true;
|
|
137
|
+
if (expPos === -1) {
|
|
138
|
+
// --- Remove the first char if it's "-" and we are before the exponential separator
|
|
139
|
+
if (currentValue.startsWith("-")) {
|
|
140
|
+
setNewValue(currentValue.substring(1), currentPos - 1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// --- Remove the char after the exponential separator if it's "-"
|
|
145
|
+
if (currentValue[expPos + 1] === "-") {
|
|
146
|
+
setNewValue(currentValue.substring(0, expPos + 1) + currentValue.substring(expPos + 2), currentPos - 1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
150
|
+
case DECIMAL_SEPARATOR:
|
|
151
|
+
// --- Prevent multiple decimal separators (integers only),
|
|
152
|
+
// --- or decimal separator after the exponential separator
|
|
153
|
+
if (integersOnly || currentValue.includes(DECIMAL_SEPARATOR) || expPos !== -1) {
|
|
154
|
+
shouldPreventDefault = true;
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case EXPONENTIAL_SEPARATOR:
|
|
158
|
+
// --- Prevent exponential notation for integers
|
|
159
|
+
if (integersOnly) {
|
|
160
|
+
shouldPreventDefault = true;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
// --- Prevent multiple exponential separators (and too many digits after it)
|
|
164
|
+
if (currentValue.includes(EXPONENTIAL_SEPARATOR) || tooManyDigitsAfterExponentialSeparator(currentPos, 2)) {
|
|
165
|
+
shouldPreventDefault = true;
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
default:
|
|
169
|
+
// --- Prevent non-digit characters
|
|
170
|
+
if (event.data < "0" || event.data > "9") {
|
|
171
|
+
shouldPreventDefault = true;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
// --- Prevent digits before minus sign
|
|
175
|
+
if (currentValue.startsWith("-") && event.target.selectionStart === 0) {
|
|
176
|
+
shouldPreventDefault = true;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
// --- Prevent too many digits after the exponential separator
|
|
180
|
+
if (expPos !== -1 && tooManyDigitsAfterExponentialSeparator(expPos + 1, 1)) {
|
|
181
|
+
// --- Caret after the exponential separator
|
|
182
|
+
// --- Prevent typing a digi if more than 2 digits after the exponential separator
|
|
183
|
+
shouldPreventDefault = true;
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
// --- Done.
|
|
188
|
+
if (shouldPreventDefault) {
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
}
|
|
191
|
+
return;
|
|
192
|
+
// --- Helpers
|
|
193
|
+
function tooManyDigitsAfterExponentialSeparator(pos, maxDigits) {
|
|
194
|
+
let numDigitsAfter = 0;
|
|
195
|
+
while (pos < currentValue.length) {
|
|
196
|
+
if (/\d/.test(currentValue[pos++])) {
|
|
197
|
+
numDigitsAfter++;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
numDigitsAfter = maxDigits + 1;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return numDigitsAfter > maxDigits;
|
|
205
|
+
}
|
|
206
|
+
function setNewValue(newValue, pos) {
|
|
207
|
+
var _a;
|
|
208
|
+
event.target.value = newValue;
|
|
209
|
+
updateValue(newValue, newValue);
|
|
210
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.setSelectionRange(pos, pos);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
// --- Setting steppers with keyboard
|
|
214
|
+
const handleOnKey = (0, react_1.useCallback)((event) => {
|
|
215
|
+
if (event.code === "ArrowUp") {
|
|
216
|
+
event.preventDefault();
|
|
217
|
+
handleIncStep();
|
|
218
|
+
}
|
|
219
|
+
if (event.code === "ArrowDown") {
|
|
220
|
+
event.preventDefault();
|
|
221
|
+
handleDecStep();
|
|
222
|
+
}
|
|
223
|
+
}, [handleIncStep, handleDecStep]);
|
|
224
|
+
// --- Manage obtaining and losing focus & blur
|
|
225
|
+
const handleOnFocus = (0, react_1.useCallback)(() => {
|
|
226
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
227
|
+
}, [onFocus]);
|
|
228
|
+
const handleOnBlur = (0, react_1.useCallback)(() => {
|
|
229
|
+
setValueStrRep(mapToRepresentation(value));
|
|
230
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
231
|
+
}, [value, onBlur]);
|
|
232
|
+
const focus = (0, react_1.useCallback)(() => {
|
|
233
|
+
var _a;
|
|
234
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
235
|
+
}, []);
|
|
236
|
+
const setValue = (0, misc_1.useEvent)((newValue) => {
|
|
237
|
+
updateValue(newValue, isEmptyLike(newValue) ? "" : String(newValue));
|
|
238
|
+
});
|
|
239
|
+
(0, react_1.useEffect)(() => {
|
|
240
|
+
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
241
|
+
focus,
|
|
242
|
+
setValue,
|
|
243
|
+
});
|
|
244
|
+
}, [focus, registerComponentApi, setValue]);
|
|
245
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(NumberBox_module_scss_1.default.inputRoot, {
|
|
246
|
+
[NumberBox_module_scss_1.default.readOnly]: readOnly,
|
|
247
|
+
[NumberBox_module_scss_1.default.disabled]: !enabled,
|
|
248
|
+
[NumberBox_module_scss_1.default.noSpinBox]: !hasSpinBox,
|
|
249
|
+
[NumberBox_module_scss_1.default.error]: validationStatus === "error",
|
|
250
|
+
[NumberBox_module_scss_1.default.warning]: validationStatus === "warning",
|
|
251
|
+
[NumberBox_module_scss_1.default.valid]: validationStatus === "valid",
|
|
252
|
+
}), tabIndex: -1, style: style, onFocus: () => {
|
|
253
|
+
var _a;
|
|
254
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
255
|
+
}, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: NumberBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: "text", inputMode: "numeric", className: (0, classnames_1.default)(NumberBox_module_scss_1.default.input, { [NumberBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: NumberBox_module_scss_1.default.adornment }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { type: "button", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled, ref: upButton, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "button", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled, ref: downButton, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: "chevrondown", size: "sm" }) })] }))] }));
|
|
256
|
+
};
|
|
257
|
+
exports.NumberBox = NumberBox;
|
|
258
|
+
function applyStep(valueStrRep, step, min, max, integersOnly) {
|
|
259
|
+
const currentValue = toUsableNumber(valueStrRep, integersOnly);
|
|
260
|
+
if (isEmptyLike(currentValue)) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
let newValue = clamp(currentValue + step, min, max);
|
|
264
|
+
return newValue;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Check whether the input value is a usable number for operations.
|
|
268
|
+
* Passes if it's of type number or a non-empty string that evaluates to a number.
|
|
269
|
+
*/
|
|
270
|
+
function isUsableFloat(value) {
|
|
271
|
+
if (typeof value === "string" && value.length > 0) {
|
|
272
|
+
return !Number.isNaN(+value) && naiveFloatBounding(value);
|
|
273
|
+
}
|
|
274
|
+
return typeof value === "number";
|
|
275
|
+
}
|
|
276
|
+
// TEMP
|
|
277
|
+
// Rounding and arithmetic with large floats is a hassle if loss of precision is apparent.
|
|
278
|
+
// Just bound the incoming floating point value to the max value available.
|
|
279
|
+
// This is an edge case but makes it so that we stay consistent and can do arithmetic with the spinner box.
|
|
280
|
+
function naiveFloatBounding(value) {
|
|
281
|
+
const integerPart = value.split(".")[0];
|
|
282
|
+
return Math.abs(Number.parseInt(integerPart)) <= MAX_VALUE;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Check whether the input value is a usable integer for operations.
|
|
286
|
+
* Passes if it's of type number and is an integer
|
|
287
|
+
* or a non-empty string that evaluates to an integer.
|
|
288
|
+
*/
|
|
289
|
+
function isUsableInteger(value) {
|
|
290
|
+
if (typeof value === "string" &&
|
|
291
|
+
value.length > 0 &&
|
|
292
|
+
![EXPONENTIAL_SEPARATOR, DECIMAL_SEPARATOR].some((item) => value.includes(item))) {
|
|
293
|
+
return Number.isSafeInteger(+value);
|
|
294
|
+
}
|
|
295
|
+
else if (typeof value === "number") {
|
|
296
|
+
return Number.isSafeInteger(value);
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
function toUsableNumber(value, isInteger = false) {
|
|
301
|
+
const isUsable = isInteger ? isUsableInteger : isUsableFloat;
|
|
302
|
+
if (!isUsable(value))
|
|
303
|
+
return null;
|
|
304
|
+
if (typeof value === "string") {
|
|
305
|
+
value = isInteger ? Number.parseInt(value) : +value;
|
|
306
|
+
}
|
|
307
|
+
return value;
|
|
308
|
+
}
|
|
309
|
+
function mapToRepresentation(value) {
|
|
310
|
+
if (typeof value === "string")
|
|
311
|
+
return value;
|
|
312
|
+
if (typeof value === "number")
|
|
313
|
+
return value.toString();
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
function clamp(value, min, max) {
|
|
317
|
+
let clamped = value;
|
|
318
|
+
if (value < min)
|
|
319
|
+
clamped = min;
|
|
320
|
+
if (value > max)
|
|
321
|
+
clamped = max;
|
|
322
|
+
return clamped;
|
|
323
|
+
}
|
|
324
|
+
function isEmptyLike(value) {
|
|
325
|
+
return typeof value === "undefined" || value === null || value === "";
|
|
326
|
+
}
|
|
327
|
+
function useLongPress(elementRef, action, delay = 500) {
|
|
328
|
+
const timeoutId = (0, react_1.useRef)(0);
|
|
329
|
+
const intervalId = (0, react_1.useRef)(0);
|
|
330
|
+
const savedAction = (0, react_1.useRef)(action);
|
|
331
|
+
// Remember the latest action callback, since it is different every render
|
|
332
|
+
(0, react_1.useEffect)(() => {
|
|
333
|
+
savedAction.current = action;
|
|
334
|
+
}, [action]);
|
|
335
|
+
(0, react_1.useEffect)(() => {
|
|
336
|
+
const onMouseDown = () => {
|
|
337
|
+
var _a;
|
|
338
|
+
(_a = savedAction.current) === null || _a === void 0 ? void 0 : _a.call(savedAction);
|
|
339
|
+
timeoutId.current = window.setTimeout(() => {
|
|
340
|
+
intervalId.current = window.setInterval(() => {
|
|
341
|
+
var _a;
|
|
342
|
+
(_a = savedAction.current) === null || _a === void 0 ? void 0 : _a.call(savedAction);
|
|
343
|
+
}, 100);
|
|
344
|
+
}, delay);
|
|
345
|
+
};
|
|
346
|
+
const onMouseUp = () => {
|
|
347
|
+
clearTimeout(timeoutId.current);
|
|
348
|
+
clearInterval(intervalId.current);
|
|
349
|
+
};
|
|
350
|
+
const onMouseOut = () => {
|
|
351
|
+
clearTimeout(timeoutId.current);
|
|
352
|
+
clearInterval(intervalId.current);
|
|
353
|
+
};
|
|
354
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef.addEventListener("mousedown", onMouseDown);
|
|
355
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef.addEventListener("mouseup", onMouseUp);
|
|
356
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef.addEventListener("mouseout", onMouseOut);
|
|
357
|
+
return () => {
|
|
358
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef.removeEventListener("mousedown", onMouseDown);
|
|
359
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef.removeEventListener("mouseup", onMouseUp);
|
|
360
|
+
elementRef === null || elementRef === void 0 ? void 0 : elementRef.removeEventListener("mouseout", onMouseOut);
|
|
361
|
+
};
|
|
362
|
+
}, [elementRef, action, delay]);
|
|
363
|
+
}
|
|
364
|
+
const metadata = {
|
|
365
|
+
displayName: "NumberBox",
|
|
366
|
+
description: "Represents an input component for numeric data entry",
|
|
367
|
+
props: Object.assign(Object.assign({}, input_abstractions_1.inputComponentPropertyDescriptors), { hasSpinBox: (0, descriptorHelper_1.desc)("Indicates if the component displays a spin box"), step: (0, descriptorHelper_1.desc)("Number of increment and decrement steps used with the spin box"), integersOnly: (0, descriptorHelper_1.desc)("Indicates if the component accepts only integer numbers"), zeroOrPositive: (0, descriptorHelper_1.desc)("Indicates if the component accepts only positive numbers"), minValue: (0, descriptorHelper_1.desc)("Lower boundary of input values (inclusive)"), maxValue: (0, descriptorHelper_1.desc)("Upper boundary of input values (inclusive)") }),
|
|
368
|
+
events: input_abstractions_1.inputComponentEventDescriptors,
|
|
369
|
+
themeVars: (0, themeVars_1.parseScssVar)(NumberBox_module_scss_1.default.themeVars),
|
|
370
|
+
};
|
|
371
|
+
exports.numberBoxComponentRenderer = (0, renderers_1.createComponentRenderer)("NumberBox", ({ node, state, updateState, lookupEventHandler, extractValue, layoutCss, registerComponentApi }) => {
|
|
372
|
+
return ((0, jsx_runtime_1.jsx)(exports.NumberBox, { style: layoutCss, value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue.asOptionalString(node.props.initialValue), step: extractValue(node.props.step), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, hasSpinBox: extractValue.asOptionalBoolean(node.props.hasSpinBox), integersOnly: extractValue.asOptionalBoolean(node.props.integersOnly), zeroOrPositive: extractValue.asOptionalBoolean(node.props.zeroOrPositive), min: extractValue.asOptionalNumber(node.props.minValue), max: extractValue.asOptionalNumber(node.props.maxValue), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), maxLength: extractValue(node.props.maxLength) }));
|
|
373
|
+
}, metadata);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionComponentRenderer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const renderers_1 = require("@components-core/renderers");
|
|
7
|
+
const SelectContext_1 = require("@components/Select/SelectContext");
|
|
8
|
+
const container_helpers_1 = require("@components/container-helpers");
|
|
9
|
+
function OptionComponent(props) {
|
|
10
|
+
const id = (0, react_1.useId)();
|
|
11
|
+
const { register, unRegister } = (0, SelectContext_1.useSelectContext)();
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
register(Object.assign(Object.assign({}, props), { id }));
|
|
14
|
+
}, [id, props, register]);
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
return () => {
|
|
17
|
+
unRegister(id);
|
|
18
|
+
};
|
|
19
|
+
}, [id, unRegister]);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
exports.optionComponentRenderer = (0, renderers_1.createComponentRenderer)("Option", (rendererContext) => {
|
|
23
|
+
var _a;
|
|
24
|
+
const { node, renderChild, extractValue } = rendererContext;
|
|
25
|
+
let label = extractValue(node.props.label);
|
|
26
|
+
let value = extractValue(node.props.value);
|
|
27
|
+
if (label == undefined && value == undefined) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (label != undefined && value == undefined) {
|
|
31
|
+
value = label;
|
|
32
|
+
}
|
|
33
|
+
else if (label == undefined && value != undefined) {
|
|
34
|
+
label = value;
|
|
35
|
+
}
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(OptionComponent, { value: value, label: label, disabled: extractValue.asOptionalBoolean(node.props.disabled), renderer: ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length)
|
|
37
|
+
? (item) => {
|
|
38
|
+
return (0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.children, item: item, renderChild: renderChild });
|
|
39
|
+
}
|
|
40
|
+
: undefined }));
|
|
41
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageMetaTitleComponentRenderer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const renderers_1 = require("@components-core/renderers");
|
|
6
|
+
const react_helmet_async_1 = require("react-helmet-async");
|
|
7
|
+
const descriptorHelper_1 = require("@components-core/descriptorHelper");
|
|
8
|
+
// =====================================================================================================================
|
|
9
|
+
// React PageMetaTitle component implementation
|
|
10
|
+
const PageMetaTitle = ({ title }) => {
|
|
11
|
+
return (0, jsx_runtime_1.jsx)(react_helmet_async_1.Helmet, { title: title });
|
|
12
|
+
};
|
|
13
|
+
const metadata = {
|
|
14
|
+
displayName: "PageMetaTitle",
|
|
15
|
+
description: "This component defines the title to add to the current page's metadata",
|
|
16
|
+
props: {
|
|
17
|
+
value: (0, descriptorHelper_1.desc)("Page title"),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
exports.pageMetaTitleComponentRenderer = (0, renderers_1.createComponentRenderer)("PageMetaTitle", ({ node, extractValue }) => {
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(PageMetaTitle, { title: extractValue(node.props.value) });
|
|
22
|
+
}, metadata);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pagesRenderer = exports.pageRenderer = void 0;
|
|
4
|
+
exports.RouteWrapper = RouteWrapper;
|
|
5
|
+
exports.Page = Page;
|
|
6
|
+
exports.Pages = Pages;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const renderers_1 = require("@components-core/renderers");
|
|
10
|
+
const react_2 = require("@remix-run/react");
|
|
11
|
+
const descriptorHelper_1 = require("@components-core/descriptorHelper");
|
|
12
|
+
const RouteContext_1 = require("@components-core/RouteContext");
|
|
13
|
+
const constants_1 = require("@components-core/constants");
|
|
14
|
+
//we need this component to make sure all the child routes are wrapped in a container.
|
|
15
|
+
// this way they can access the routeParams
|
|
16
|
+
function RouteWrapper({ childRoute = constants_1.EMPTY_ARRAY, renderChild, layoutContext, }) {
|
|
17
|
+
const params = (0, react_2.useParams)();
|
|
18
|
+
const wrappedWithContainer = (0, react_1.useMemo)(() => {
|
|
19
|
+
if (Array.isArray(childRoute)) {
|
|
20
|
+
return {
|
|
21
|
+
type: "Container",
|
|
22
|
+
children: childRoute,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
type: "Container",
|
|
27
|
+
children: [childRoute],
|
|
28
|
+
};
|
|
29
|
+
}, [childRoute]);
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderChild(wrappedWithContainer, layoutContext) }, JSON.stringify(params));
|
|
31
|
+
}
|
|
32
|
+
const PageMetadata = {
|
|
33
|
+
displayName: "Page",
|
|
34
|
+
description: "A placeholder for the content to display with a particular route",
|
|
35
|
+
props: {
|
|
36
|
+
url: (0, descriptorHelper_1.desc)("The URL of the route associated with the content"),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
function Page({ children, url }) {
|
|
40
|
+
const id = (0, react_1.useId)();
|
|
41
|
+
const { register, unRegister } = (0, RouteContext_1.useRouteContext)();
|
|
42
|
+
(0, react_1.useEffect)(() => {
|
|
43
|
+
register({
|
|
44
|
+
id,
|
|
45
|
+
url,
|
|
46
|
+
children,
|
|
47
|
+
});
|
|
48
|
+
}, [children, id, register, url]);
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
return () => {
|
|
51
|
+
unRegister(id);
|
|
52
|
+
};
|
|
53
|
+
}, [id, unRegister]);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
exports.pageRenderer = (0, renderers_1.createComponentRenderer)("Page", ({ node, extractValue, renderChild }) => {
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(Page, { url: extractValue(node.props.url), children: (0, jsx_runtime_1.jsx)(RouteWrapper, { childRoute: node.children, renderChild: renderChild }) }));
|
|
58
|
+
}, PageMetadata);
|
|
59
|
+
function Pages({ defaultRoute, children }) {
|
|
60
|
+
const { routes, routeContextValue } = (0, RouteContext_1.useRouteContextValue)();
|
|
61
|
+
return ((0, jsx_runtime_1.jsxs)(RouteContext_1.RouteContext.Provider, { value: routeContextValue, children: [children, routes.length > 0 && ((0, jsx_runtime_1.jsxs)(react_2.Routes, { children: [routes.map((value) => {
|
|
62
|
+
return (0, jsx_runtime_1.jsx)(react_2.Route, { path: value.url, element: value.children }, value.id);
|
|
63
|
+
}), defaultRoute && (0, jsx_runtime_1.jsx)(react_2.Route, { path: "*", element: (0, jsx_runtime_1.jsx)(react_2.Navigate, { to: defaultRoute, replace: true }) })] }))] }));
|
|
64
|
+
}
|
|
65
|
+
const PagesMetadata = {
|
|
66
|
+
displayName: "Pages",
|
|
67
|
+
description: "A node grouping routes with their contents",
|
|
68
|
+
props: {
|
|
69
|
+
defaultRoute: (0, descriptorHelper_1.desc)("The default route when displaying the app"),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
exports.pagesRenderer = (0, renderers_1.createComponentRenderer)("Pages", ({ node, extractValue, renderChild }) => {
|
|
73
|
+
return (0, jsx_runtime_1.jsx)(Pages, { defaultRoute: extractValue(node.props.defaultRoute), children: renderChild(node.children) });
|
|
74
|
+
}, PagesMetadata);
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.pdfComponentRenderer = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const renderers_1 = require("@components-core/renderers");
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const descriptorHelper_1 = require("@components-core/descriptorHelper");
|
|
31
|
+
const Pdf = react_1.default.lazy(() => Promise.resolve().then(() => __importStar(require("./Pdf"))));
|
|
32
|
+
const LazyPdf = (props) => {
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)("div", { children: "Loading..." }), children: (0, jsx_runtime_1.jsx)(Pdf, Object.assign({}, props)) }));
|
|
34
|
+
};
|
|
35
|
+
const metadata = {
|
|
36
|
+
displayName: "PDF Preview",
|
|
37
|
+
description: "Displays a PDF document preview",
|
|
38
|
+
props: {
|
|
39
|
+
src: (0, descriptorHelper_1.desc)("Specifies the path to the pdf"),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.pdfComponentRenderer = (0, renderers_1.createComponentRenderer)("Pdf", ({ node, extractValue }) => {
|
|
43
|
+
return (0, jsx_runtime_1.jsx)(LazyPdf, { src: extractValue(node.props.src) });
|
|
44
|
+
}, metadata);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const Pdf_module_scss_1 = __importDefault(require("./Pdf.module.scss"));
|
|
9
|
+
const react_pdf_1 = require("react-pdf");
|
|
10
|
+
const pdf_worker_url_1 = __importDefault(require("pdfjs-dist/build/pdf.worker?url"));
|
|
11
|
+
react_pdf_1.pdfjs.GlobalWorkerOptions.workerSrc = pdf_worker_url_1.default;
|
|
12
|
+
const Pdf = ({ src }) => {
|
|
13
|
+
const [numPages, setNumPages] = (0, react_1.useState)(null);
|
|
14
|
+
function onLoadSuccess({ numPages }) {
|
|
15
|
+
setNumPages(numPages);
|
|
16
|
+
}
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: Pdf_module_scss_1.default.wrapper, children: (0, jsx_runtime_1.jsx)("div", { style: { position: "relative", minHeight: 0 }, children: (0, jsx_runtime_1.jsx)(react_pdf_1.Document, { file: src, onLoadSuccess: onLoadSuccess, children: Array.from(new Array(numPages), (_, index) => ((0, jsx_runtime_1.jsx)(react_pdf_1.Page, { pageNumber: index + 1, loading: "", className: Pdf_module_scss_1.default.page }, index + 1))) }) }) }));
|
|
18
|
+
};
|
|
19
|
+
exports.default = Pdf;
|