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,341 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const lodash_es_1 = require("lodash-es");
|
|
39
|
+
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
40
|
+
const extractParam_1 = require("@components-core/utils/extractParam");
|
|
41
|
+
const misc_1 = require("@components-core/utils/misc");
|
|
42
|
+
const EngineError_1 = require("@components-core/EngineError");
|
|
43
|
+
const process_statement_sync_1 = require("@components-core/script-runner/process-statement-sync");
|
|
44
|
+
function isAxiosResponse(response) {
|
|
45
|
+
return "data" in response;
|
|
46
|
+
}
|
|
47
|
+
function parseResponseJson(response) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
let resp;
|
|
50
|
+
if (isAxiosResponse(response)) {
|
|
51
|
+
resp = response.data;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
try {
|
|
55
|
+
resp = yield response.clone().json();
|
|
56
|
+
}
|
|
57
|
+
catch (e) { }
|
|
58
|
+
}
|
|
59
|
+
return resp;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//TODO illesg unit test.....
|
|
63
|
+
function appendFormFieldValue({ key, value }, formData, prevKey = key) {
|
|
64
|
+
if (value === undefined || value === null) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (value instanceof File || value instanceof Blob) {
|
|
68
|
+
formData.append(key, value);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
value.forEach((val) => {
|
|
73
|
+
appendFormFieldValue({ key, value: val }, formData, prevKey);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else if ((0, isPlainObject_1.default)(value)) {
|
|
77
|
+
Object.entries(value).forEach(([objKey, objVal]) => {
|
|
78
|
+
const concatenatedObjectKey = `${prevKey}.${objKey}`;
|
|
79
|
+
appendFormFieldValue({
|
|
80
|
+
key: concatenatedObjectKey,
|
|
81
|
+
value: objVal,
|
|
82
|
+
}, formData, concatenatedObjectKey);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
formData.append(key, value.toString());
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
class RestApiProxy {
|
|
90
|
+
constructor(appContext) {
|
|
91
|
+
var _a;
|
|
92
|
+
this.execute = (_a) => __awaiter(this, [_a], void 0, function* ({ abortSignal, operation, params, parseOptions, resolveBindingExpressions = false, transactionId = (0, misc_1.randomUUID)(), onProgress, }) {
|
|
93
|
+
return yield this.executeOperation({
|
|
94
|
+
operation,
|
|
95
|
+
abortSignal,
|
|
96
|
+
contextParams: params,
|
|
97
|
+
resolveBindingExpressions,
|
|
98
|
+
parseResponse: (parseOptions === null || parseOptions === void 0 ? void 0 : parseOptions.asFile)
|
|
99
|
+
? (response) => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
var _a;
|
|
101
|
+
//we can't access content-disposition header if it's a CORS request: The suggested workaround was adding Access-Control-Expose-Headers:Content-Disposition to the response header on the server.
|
|
102
|
+
// more info here: https://github.com/matthew-andrews/isomorphic-fetch/issues/67
|
|
103
|
+
let fileName = operation.fileName || "unknown";
|
|
104
|
+
if (response.headers && response.headers.get && typeof response.headers.get === "function") {
|
|
105
|
+
const contentDisposition = (_a = response.headers.get("Content-Disposition")) === null || _a === void 0 ? void 0 : _a.toString();
|
|
106
|
+
if (contentDisposition) {
|
|
107
|
+
const fileNameMatch = contentDisposition.match(/filename="(.+)"/);
|
|
108
|
+
if (fileNameMatch && fileNameMatch.length === 2)
|
|
109
|
+
fileName = fileNameMatch[1];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return isAxiosResponse(response) ? response.data : new File([yield response.clone().blob()], fileName);
|
|
113
|
+
})
|
|
114
|
+
: undefined,
|
|
115
|
+
transactionId,
|
|
116
|
+
onUploadProgress: onProgress,
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
this.upload = (_a) => __awaiter(this, [_a], void 0, function* ({ operation, params = {}, chunk, onUploadProgress, abortSignal, transactionId = (0, misc_1.randomUUID)(), resolveBindingExpressions = false, }) {
|
|
120
|
+
const { file, asForm, formParams } = this.extractParam(resolveBindingExpressions, operation, params);
|
|
121
|
+
const uploadParams = {
|
|
122
|
+
chunkStart: chunk === null || chunk === void 0 ? void 0 : chunk.chunkStart,
|
|
123
|
+
chunkEnd: chunk ? (chunk === null || chunk === void 0 ? void 0 : chunk.chunkEnd) - 1 : undefined,
|
|
124
|
+
chunkLength: chunk ? (chunk === null || chunk === void 0 ? void 0 : chunk.chunkEnd) - (chunk === null || chunk === void 0 ? void 0 : chunk.chunkStart) : undefined,
|
|
125
|
+
fileSize: file.size,
|
|
126
|
+
urlSafeName: encodeURIComponent(file.name),
|
|
127
|
+
fileName: file.name,
|
|
128
|
+
};
|
|
129
|
+
const contextParams = Object.assign(Object.assign({}, params), { $uploadParams: uploadParams });
|
|
130
|
+
if (asForm) {
|
|
131
|
+
const data = new FormData();
|
|
132
|
+
data.append(file.name, (chunk === null || chunk === void 0 ? void 0 : chunk.blob) || file);
|
|
133
|
+
if (formParams) {
|
|
134
|
+
Object.entries(this.extractParam(resolveBindingExpressions, formParams, params)).forEach(([key, value]) => {
|
|
135
|
+
data.append(key, value);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return yield this.executeOperation({
|
|
139
|
+
operation,
|
|
140
|
+
contextParams,
|
|
141
|
+
resolveBindingExpressions,
|
|
142
|
+
rawBody: data,
|
|
143
|
+
headers: Object.assign(Object.assign({}, this.extractParam(resolveBindingExpressions, operation.headers || {}, contextParams)), {
|
|
144
|
+
// https://muffinman.io/blog/uploading-files-using-fetch-multipart-form-data/
|
|
145
|
+
// the browser sets the content-type in this case
|
|
146
|
+
"Content-Type": undefined }),
|
|
147
|
+
onUploadProgress,
|
|
148
|
+
abortSignal,
|
|
149
|
+
transactionId,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return new Promise((resolve, reject) => {
|
|
153
|
+
const reader = new FileReader();
|
|
154
|
+
reader.readAsArrayBuffer((chunk === null || chunk === void 0 ? void 0 : chunk.blob) || file);
|
|
155
|
+
reader.onload = (evt) => __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
try {
|
|
157
|
+
if (evt.target === null) {
|
|
158
|
+
reject();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
resolve(yield this.executeOperation({
|
|
162
|
+
operation,
|
|
163
|
+
contextParams,
|
|
164
|
+
resolveBindingExpressions,
|
|
165
|
+
rawBody: evt.target.result,
|
|
166
|
+
headers: Object.assign(Object.assign({}, this.extractParam(resolveBindingExpressions, operation.headers || {}, contextParams)), { "Content-Type": file.type }),
|
|
167
|
+
onUploadProgress,
|
|
168
|
+
abortSignal,
|
|
169
|
+
transactionId,
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
reject(e);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
reader.onerror = () => {
|
|
177
|
+
reject();
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
this.resolveUrl = ({ operation, params = {}, resolveBindingExpressions = false, }) => {
|
|
182
|
+
return this.generateFullApiUrl(this.extractParam(resolveBindingExpressions, operation.url, params), this.extractParam(resolveBindingExpressions, operation.queryParams, params));
|
|
183
|
+
};
|
|
184
|
+
this.extractParam = (resolveAsBindingExpression, value, params = {}, strict) => {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
const localContext = Object.assign({ $adapterConfig: this.config }, params);
|
|
187
|
+
if (resolveAsBindingExpression) {
|
|
188
|
+
return (0, extractParam_1.extractParam)(localContext, value, this.appContext, strict);
|
|
189
|
+
}
|
|
190
|
+
if (value === null || value === void 0 ? void 0 : value._ARROW_EXPR_) {
|
|
191
|
+
//TODO illesg review, this whole processstatement is because of the chunked uploads (headers as function)
|
|
192
|
+
const evalContext = {
|
|
193
|
+
eventArgs: [localContext],
|
|
194
|
+
};
|
|
195
|
+
try {
|
|
196
|
+
const arrowStmt = {
|
|
197
|
+
type: "ArrowS",
|
|
198
|
+
expression: value,
|
|
199
|
+
};
|
|
200
|
+
(0, process_statement_sync_1.processStatementQueue)([arrowStmt], evalContext);
|
|
201
|
+
if ((_b = (_a = evalContext.mainThread) === null || _a === void 0 ? void 0 : _a.blocks) === null || _b === void 0 ? void 0 : _b.length) {
|
|
202
|
+
return evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1].returnValue;
|
|
203
|
+
}
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
catch (e) {
|
|
207
|
+
console.error(e);
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return value;
|
|
212
|
+
};
|
|
213
|
+
this.executeOperation = (_a) => __awaiter(this, [_a], void 0, function* ({ operation, contextParams, abortSignal, resolveBindingExpressions, relativePath = this.extractParam(resolveBindingExpressions, operation.url, contextParams), method = this.extractParam(resolveBindingExpressions, operation.method, contextParams), queryParams = this.extractParam(resolveBindingExpressions, operation.queryParams, contextParams), body = this.extractParam(resolveBindingExpressions, operation.body, contextParams, true), rawBody = this.extractParam(resolveBindingExpressions, operation.rawBody, contextParams), headers = this.extractParam(resolveBindingExpressions, operation.headers, contextParams), payloadType = this.extractParam(resolveBindingExpressions, operation.payloadType, contextParams) || "json", onUploadProgress, parseResponse = this.tryParseResponse, transactionId, }) {
|
|
214
|
+
const includeClientTxId = method && method !== "get" && !!transactionId;
|
|
215
|
+
const headersWithoutContentType = Object.assign(Object.assign({}, this.getHeaders()), { ["Content-Type"]: undefined });
|
|
216
|
+
const aggregatedHeaders = (0, lodash_es_1.omitBy)(Object.assign(Object.assign({}, (body ? this.getHeaders() : headersWithoutContentType)), headers), lodash_es_1.isUndefined);
|
|
217
|
+
if (includeClientTxId) {
|
|
218
|
+
aggregatedHeaders["x-ue-client-tx-id"] = transactionId;
|
|
219
|
+
}
|
|
220
|
+
let requestBody;
|
|
221
|
+
if (rawBody) {
|
|
222
|
+
requestBody = rawBody;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
if (payloadType === "multipart-form" || payloadType === "form") {
|
|
226
|
+
const formData = new FormData();
|
|
227
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
228
|
+
appendFormFieldValue({ key, value }, formData);
|
|
229
|
+
});
|
|
230
|
+
if (payloadType === "multipart-form") {
|
|
231
|
+
requestBody = formData;
|
|
232
|
+
// https://muffinman.io/blog/uploading-files-using-fetch-multipart-form-data/
|
|
233
|
+
// the browser sets the content-type in this case
|
|
234
|
+
delete aggregatedHeaders["Content-Type"];
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
requestBody = new URLSearchParams(formData).toString();
|
|
238
|
+
aggregatedHeaders["Content-Type"] = "application/x-www-form-urlencoded";
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
requestBody = body ? JSON.stringify(body) : undefined;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const options = {
|
|
246
|
+
method: method,
|
|
247
|
+
headers: aggregatedHeaders,
|
|
248
|
+
signal: abortSignal,
|
|
249
|
+
body: requestBody,
|
|
250
|
+
};
|
|
251
|
+
if (onUploadProgress) {
|
|
252
|
+
console.log("Falling back to axios. Reason: onUploadProgress specified");
|
|
253
|
+
const axios = (yield Promise.resolve().then(() => __importStar(require("axios")))).default;
|
|
254
|
+
try {
|
|
255
|
+
const response = yield axios.request({
|
|
256
|
+
url: this.generateFullApiUrl(relativePath, queryParams),
|
|
257
|
+
method: options.method,
|
|
258
|
+
headers: aggregatedHeaders,
|
|
259
|
+
data: options.body,
|
|
260
|
+
onUploadProgress,
|
|
261
|
+
});
|
|
262
|
+
return yield parseResponse(response);
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
if (axios.isAxiosError(error) && error.response) {
|
|
266
|
+
throw yield this.raiseError(error.response);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const response = yield fetch(this.generateFullApiUrl(relativePath, queryParams), options);
|
|
275
|
+
if (!response.clone().ok) {
|
|
276
|
+
throw yield this.raiseError(response);
|
|
277
|
+
}
|
|
278
|
+
return yield parseResponse(response.clone());
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
this.tryParseResponse = (response) => __awaiter(this, void 0, void 0, function* () {
|
|
282
|
+
return yield parseResponseJson(response);
|
|
283
|
+
});
|
|
284
|
+
this.raiseError = (response) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
+
if ("config" in response) {
|
|
286
|
+
//poor man's axios response type guard
|
|
287
|
+
try {
|
|
288
|
+
return new EngineError_1.GenericBackendError(this.config.errorResponseTransform
|
|
289
|
+
? this.extractParam(true, this.config.errorResponseTransform, { $response: response.data })
|
|
290
|
+
: response.data, response.status);
|
|
291
|
+
}
|
|
292
|
+
catch (_a) { }
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
try {
|
|
296
|
+
const respObject = yield response.json();
|
|
297
|
+
return new EngineError_1.GenericBackendError(this.config.errorResponseTransform
|
|
298
|
+
? this.extractParam(true, this.config.errorResponseTransform, { $response: respObject })
|
|
299
|
+
: respObject, response.status);
|
|
300
|
+
}
|
|
301
|
+
catch (_b) { }
|
|
302
|
+
}
|
|
303
|
+
return new Error(`[!] Server responded with an error: ${response.status} - ${response.statusText}`);
|
|
304
|
+
});
|
|
305
|
+
this.getHeaders = () => {
|
|
306
|
+
var _a;
|
|
307
|
+
return Object.assign({ ["Content-Type"]: "application/json; charset=UTF-8" }, ((_a = this.config.headers) !== null && _a !== void 0 ? _a : {}));
|
|
308
|
+
};
|
|
309
|
+
const conf = (appContext === null || appContext === void 0 ? void 0 : appContext.globals) || { apiUrl: "" };
|
|
310
|
+
const { apiUrl, errorResponseTransform } = conf;
|
|
311
|
+
this.appContext = appContext;
|
|
312
|
+
this.config = {
|
|
313
|
+
apiUrl,
|
|
314
|
+
errorResponseTransform,
|
|
315
|
+
headers: Object.assign({}, (_a = appContext === null || appContext === void 0 ? void 0 : appContext.globals) === null || _a === void 0 ? void 0 : _a.headers)
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
generateFullApiUrl(relativePath, queryParams) {
|
|
319
|
+
let queryString = "";
|
|
320
|
+
if (queryParams) {
|
|
321
|
+
const params = new URLSearchParams();
|
|
322
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
323
|
+
if (Array.isArray(value)) {
|
|
324
|
+
value.forEach((item) => {
|
|
325
|
+
params.append(key, item);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
else if (value !== undefined) {
|
|
329
|
+
params.append(key, value);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
queryString = `?${params}`;
|
|
333
|
+
}
|
|
334
|
+
if (relativePath.startsWith("http://") || relativePath.startsWith("https://")) {
|
|
335
|
+
return `${relativePath}${queryString}`;
|
|
336
|
+
}
|
|
337
|
+
//TODO check if autoEncode is enabled
|
|
338
|
+
return `${this.config.apiUrl || ""}${relativePath}${queryString}`;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
exports.default = RestApiProxy;
|
|
@@ -0,0 +1,272 @@
|
|
|
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
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
32
|
+
const react_2 = require("@remix-run/react");
|
|
33
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
34
|
+
const lodash_es_1 = require("lodash-es");
|
|
35
|
+
const react_helmet_async_1 = require("react-helmet-async");
|
|
36
|
+
const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
|
|
37
|
+
const immer_1 = require("immer");
|
|
38
|
+
const ErrorBoundary_1 = require("./ErrorBoundary");
|
|
39
|
+
const ThemeProvider_1 = __importDefault(require("@components-core//theming/ThemeProvider"));
|
|
40
|
+
const Container_1 = require("./container/Container");
|
|
41
|
+
const misc_1 = require("@components-core/utils/misc");
|
|
42
|
+
const treeUtils_1 = require("./utils/treeUtils");
|
|
43
|
+
const constants_1 = require("@components-core/constants");
|
|
44
|
+
const IconProvider_1 = require("@components/IconProvider");
|
|
45
|
+
const date_fns_1 = require("date-fns");
|
|
46
|
+
const AppContext_1 = require("@components-core/AppContext");
|
|
47
|
+
const useApiInterceptorContext_1 = require("@components-core/interception/useApiInterceptorContext");
|
|
48
|
+
const themeVars_1 = require("@components-core/theming/themeVars");
|
|
49
|
+
const reportEngineError_1 = require("@components-core/reportEngineError");
|
|
50
|
+
const ThemeContext_1 = require("@components-core/theming/ThemeContext");
|
|
51
|
+
const date_functions_1 = require("./appContext/date-functions");
|
|
52
|
+
const misc_utils_1 = require("./appContext/misc-utils");
|
|
53
|
+
const ViewComponentRegistryContext_1 = require("@components/ViewComponentRegistryContext");
|
|
54
|
+
const abstractions_1 = require("@components-core/theming/abstractions");
|
|
55
|
+
const ComponentProvider_1 = require("@components/ComponentProvider");
|
|
56
|
+
const ConfirmationModalContextProvider_1 = require("@components/ModalDialog/ConfirmationModalContextProvider");
|
|
57
|
+
const AppStateContext_1 = require("@components/App/AppStateContext");
|
|
58
|
+
const hooks_1 = require("./utils/hooks");
|
|
59
|
+
// --- We want to enable the produce method of `immer` on Map objects
|
|
60
|
+
(0, immer_1.enableMapSet)();
|
|
61
|
+
// =====================================================================================================================
|
|
62
|
+
/**
|
|
63
|
+
* We use this object in the app context to represent the `QlientQuery` of the react-query package.
|
|
64
|
+
*/
|
|
65
|
+
const queryClient = new react_query_1.QueryClient({
|
|
66
|
+
defaultOptions: {
|
|
67
|
+
queries: {
|
|
68
|
+
refetchOnWindowFocus: false,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const Transforms = {
|
|
73
|
+
unPackTree: treeUtils_1.unPackTree,
|
|
74
|
+
};
|
|
75
|
+
const Utils = {
|
|
76
|
+
getByPath: lodash_es_1.get,
|
|
77
|
+
};
|
|
78
|
+
const DateUtils = {
|
|
79
|
+
differenceInMinutes: (date1, date2) => {
|
|
80
|
+
return (0, date_fns_1.differenceInMinutes)(new Date(date1), new Date(date2));
|
|
81
|
+
},
|
|
82
|
+
isSameDay: (dateLeft, dateRight) => {
|
|
83
|
+
// console.log("IS SAME DAY", dateLeft, dateRight);
|
|
84
|
+
if (!dateLeft || !dateRight) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
return (0, date_fns_1.isSameDay)(new Date(dateLeft), new Date(dateRight));
|
|
88
|
+
},
|
|
89
|
+
isToday: (date) => {
|
|
90
|
+
return (0, date_fns_1.isToday)(new Date(date));
|
|
91
|
+
},
|
|
92
|
+
isThisYear: (date) => {
|
|
93
|
+
return (0, date_fns_1.isThisYear)(new Date(date));
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
function handleError(error) {
|
|
97
|
+
react_hot_toast_1.default.error(typeof error === "string" ? error : error.message || "Something went wrong");
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* This React component implements the innermost part of the root component with access to the app and view state
|
|
101
|
+
* contexts.
|
|
102
|
+
*/
|
|
103
|
+
function RootContentComponent({ rootContainer, routerBaseName, globalProps, standalone, decorateComponentsWithTestId, }) {
|
|
104
|
+
const [localLoggedInUser, setLocalLoggedInUser] = (0, react_1.useState)(null);
|
|
105
|
+
const componentRegistry = (0, ViewComponentRegistryContext_1.useComponentRegistry)();
|
|
106
|
+
const navigate = (0, react_2.useNavigate)();
|
|
107
|
+
const { confirm } = (0, ConfirmationModalContextProvider_1.useConfirm)();
|
|
108
|
+
const { activeThemeId, activeThemeTone, setActiveThemeId, setActiveThemeTone, availableThemeIds, root } = (0, ThemeContext_1.useThemes)();
|
|
109
|
+
(0, hooks_1.useDocumentKeydown)((event) => {
|
|
110
|
+
if (event.code === "KeyT" && event.altKey && event.ctrlKey && event.shiftKey) {
|
|
111
|
+
setActiveThemeId(availableThemeIds[(availableThemeIds.indexOf(activeThemeId) + 1) % availableThemeIds.length]);
|
|
112
|
+
}
|
|
113
|
+
if (event.code === "KeyO" && event.altKey && event.ctrlKey && event.shiftKey) {
|
|
114
|
+
setActiveThemeTone(abstractions_1.ThemeToneKeys[(abstractions_1.ThemeToneKeys.indexOf(activeThemeTone) + 1) % abstractions_1.ThemeToneKeys.length]);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
// we use the initial value from the scss variable
|
|
118
|
+
const [maxWidthPhone, setMaxWidthPhone] = (0, react_1.useState)("0");
|
|
119
|
+
const [maxWidthTablet, setMaxWidthTablet] = (0, react_1.useState)("0");
|
|
120
|
+
// we sync with the theme variable value (because we can't use css var in media queries)
|
|
121
|
+
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
122
|
+
setMaxWidthPhone(getComputedStyle(root).getPropertyValue((0, themeVars_1.getVarKey)("media-max-width-phone")));
|
|
123
|
+
setMaxWidthTablet(getComputedStyle(root).getPropertyValue((0, themeVars_1.getVarKey)("media-max-width-tablet")));
|
|
124
|
+
}, [activeThemeId, root]);
|
|
125
|
+
const isViewportPhone = (0, hooks_1.useMediaQuery)(`(max-width: ${maxWidthPhone})`);
|
|
126
|
+
const isViewportTablet = (0, hooks_1.useMediaQuery)(`(min-width: ${maxWidthPhone}) and (max-width: ${maxWidthTablet})`);
|
|
127
|
+
const isViewportDesktop = (0, hooks_1.useMediaQuery)(`(min-width: ${maxWidthTablet})`);
|
|
128
|
+
const isInIFrame = (0, hooks_1.useIsInIFrame)();
|
|
129
|
+
const isWindowFocused = (0, hooks_1.useIsWindowFocused)();
|
|
130
|
+
const apiInterceptorContext = (0, useApiInterceptorContext_1.useApiInterceptorContext)();
|
|
131
|
+
const location = (0, react_2.useLocation)();
|
|
132
|
+
const lastHash = (0, react_1.useRef)("");
|
|
133
|
+
// listen to location change using useEffect with location as dependency
|
|
134
|
+
// https://jasonwatmore.com/react-router-v6-listen-to-location-route-change-without-history-listen
|
|
135
|
+
(0, react_1.useEffect)(() => {
|
|
136
|
+
if (location.hash) {
|
|
137
|
+
lastHash.current = location.hash.slice(1); // safe hash for further use after navigation
|
|
138
|
+
}
|
|
139
|
+
if (lastHash.current) {
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
var _a;
|
|
142
|
+
(_a = document.getElementById(lastHash.current)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: "instant", block: "start" });
|
|
143
|
+
lastHash.current = "";
|
|
144
|
+
}, 100);
|
|
145
|
+
}
|
|
146
|
+
}, [location]);
|
|
147
|
+
const Actions = (0, react_1.useMemo)(() => {
|
|
148
|
+
const ret = {
|
|
149
|
+
_SUPPORT_IMPLICIT_CONTEXT: true,
|
|
150
|
+
};
|
|
151
|
+
for (const [key, value] of componentRegistry.actionFunctions) {
|
|
152
|
+
ret[key] = value;
|
|
153
|
+
}
|
|
154
|
+
return ret;
|
|
155
|
+
}, [componentRegistry.actionFunctions]);
|
|
156
|
+
const embed = (0, react_1.useMemo)(() => {
|
|
157
|
+
return {
|
|
158
|
+
isInIFrame: isInIFrame,
|
|
159
|
+
};
|
|
160
|
+
}, [isInIFrame]);
|
|
161
|
+
const environment = (0, react_1.useMemo)(() => {
|
|
162
|
+
return {
|
|
163
|
+
isWindowFocused,
|
|
164
|
+
};
|
|
165
|
+
}, [isWindowFocused]);
|
|
166
|
+
const mediaSize = (0, react_1.useMemo)(() => {
|
|
167
|
+
return {
|
|
168
|
+
phone: isViewportPhone,
|
|
169
|
+
tablet: isViewportTablet,
|
|
170
|
+
desktop: isViewportDesktop,
|
|
171
|
+
smallScreen: isViewportPhone || isViewportTablet,
|
|
172
|
+
largeScreen: isViewportDesktop,
|
|
173
|
+
};
|
|
174
|
+
}, [isViewportDesktop, isViewportPhone, isViewportTablet]);
|
|
175
|
+
const globals = (0, react_1.useMemo)(() => {
|
|
176
|
+
return globalProps ? Object.assign({}, globalProps) : constants_1.EMPTY_OBJECT;
|
|
177
|
+
}, [globalProps]);
|
|
178
|
+
const appContextValue = (0, react_1.useMemo)(() => {
|
|
179
|
+
const ret = Object.assign(Object.assign(Object.assign({}, date_functions_1.dateFunctions), misc_utils_1.miscellaneousUtils), { navigate,
|
|
180
|
+
confirm, signError: handleError, toast: react_hot_toast_1.default, loggedInUser: localLoggedInUser, setLoggedInUser: setLocalLoggedInUser, queryClient,
|
|
181
|
+
routerBaseName,
|
|
182
|
+
standalone,
|
|
183
|
+
decorateComponentsWithTestId, activeThemeUid: activeThemeId, activeThemeTone: activeThemeTone, availableThemeUids: availableThemeIds, globals,
|
|
184
|
+
delay: misc_1.delay,
|
|
185
|
+
Actions,
|
|
186
|
+
Transforms,
|
|
187
|
+
Utils,
|
|
188
|
+
DateUtils,
|
|
189
|
+
embed,
|
|
190
|
+
environment,
|
|
191
|
+
mediaSize,
|
|
192
|
+
apiInterceptorContext, setTheme: setActiveThemeId, setTone: setActiveThemeTone });
|
|
193
|
+
return ret;
|
|
194
|
+
}, [
|
|
195
|
+
Actions,
|
|
196
|
+
activeThemeId,
|
|
197
|
+
activeThemeTone,
|
|
198
|
+
apiInterceptorContext,
|
|
199
|
+
availableThemeIds,
|
|
200
|
+
confirm,
|
|
201
|
+
decorateComponentsWithTestId,
|
|
202
|
+
embed,
|
|
203
|
+
environment,
|
|
204
|
+
globals,
|
|
205
|
+
localLoggedInUser,
|
|
206
|
+
mediaSize,
|
|
207
|
+
navigate,
|
|
208
|
+
routerBaseName,
|
|
209
|
+
setActiveThemeId,
|
|
210
|
+
setActiveThemeTone,
|
|
211
|
+
standalone,
|
|
212
|
+
]);
|
|
213
|
+
const [appState, setAppState] = (0, react_1.useState)(constants_1.EMPTY_OBJECT);
|
|
214
|
+
const registerAppState = (0, react_1.useCallback)((bucket, initialValue) => {
|
|
215
|
+
setAppState((prev) => {
|
|
216
|
+
return Object.assign(Object.assign({}, prev), { [bucket]: initialValue });
|
|
217
|
+
});
|
|
218
|
+
}, []);
|
|
219
|
+
const update = (0, react_1.useCallback)((bucket, patch) => {
|
|
220
|
+
setAppState((prev) => {
|
|
221
|
+
return Object.assign(Object.assign({}, prev), { [bucket]: Object.assign(Object.assign({}, (prev[bucket] || {})), patch) });
|
|
222
|
+
});
|
|
223
|
+
}, []);
|
|
224
|
+
const appStateContextValue = (0, react_1.useMemo)(() => {
|
|
225
|
+
return {
|
|
226
|
+
registerAppState,
|
|
227
|
+
appState,
|
|
228
|
+
update,
|
|
229
|
+
};
|
|
230
|
+
}, [appState, registerAppState, update]);
|
|
231
|
+
const memoedVars = (0, react_1.useRef)(new Map());
|
|
232
|
+
return ((0, jsx_runtime_1.jsx)(AppContext_1.AppContext.Provider, { value: appContextValue, children: (0, jsx_runtime_1.jsx)(AppStateContext_1.AppStateContext.Provider, { value: appStateContextValue, children: (0, Container_1.renderRoot)(rootContainer, memoedVars) }) }));
|
|
233
|
+
}
|
|
234
|
+
// =====================================================================================================================
|
|
235
|
+
/**
|
|
236
|
+
* This React component is intended to be the root component in a browser window. It handles the application state
|
|
237
|
+
* changes, routing, and theming, provides an error boundary, and handles a few other aspects.
|
|
238
|
+
*/
|
|
239
|
+
const RootComponent = ({ node, previewMode = false, servedFromSingleFile = false, baseName = "", contributes = constants_1.EMPTY_OBJECT, globalProps, standalone, decorateComponentsWithTestId, defaultTheme, defaultTone, resources, resourceMap, }) => {
|
|
240
|
+
if (previewMode) {
|
|
241
|
+
//to prevent leaking the meta items to the parent document, if it lives in an iframe (e.g. docs)
|
|
242
|
+
react_helmet_async_1.HelmetProvider.canUseDOM = false;
|
|
243
|
+
}
|
|
244
|
+
const siteName = (globalProps === null || globalProps === void 0 ? void 0 : globalProps.name) || "NS app";
|
|
245
|
+
const dynamicChildren = ((0, jsx_runtime_1.jsxs)(react_helmet_async_1.HelmetProvider, { children: [(0, jsx_runtime_1.jsx)(react_helmet_async_1.Helmet, { defaultTitle: siteName, titleTemplate: `%s | ${siteName}` }), (0, jsx_runtime_1.jsx)(IconProvider_1.IconProvider, { children: (0, jsx_runtime_1.jsx)(ThemeProvider_1.default, { resourceMap: resourceMap, themes: contributes.themes, defaultTheme: defaultTheme, defaultTone: defaultTone, resources: resources, children: (0, jsx_runtime_1.jsx)(ConfirmationModalContextProvider_1.ConfirmationModalContextProvider, { children: (0, jsx_runtime_1.jsx)(RootContentComponent, { rootContainer: node, routerBaseName: baseName, globalProps: globalProps, standalone: standalone, decorateComponentsWithTestId: decorateComponentsWithTestId }) }) }) })] }));
|
|
246
|
+
const Router = previewMode
|
|
247
|
+
? react_router_dom_1.MemoryRouter
|
|
248
|
+
: servedFromSingleFile || (globalProps === null || globalProps === void 0 ? void 0 : globalProps.useHashBasedRouting)
|
|
249
|
+
? react_router_dom_1.HashRouter
|
|
250
|
+
: react_router_dom_1.BrowserRouter;
|
|
251
|
+
return ((0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "root-outer", children: (0, jsx_runtime_1.jsxs)(react_query_1.QueryClientProvider, { client: queryClient, children: [(typeof window === "undefined" || process.env.VITE_REMIX) && dynamicChildren, !(typeof window === "undefined" || process.env.VITE_REMIX) && ((0, jsx_runtime_1.jsx)(Router, { basename: baseName, children: dynamicChildren }))] }) }) }));
|
|
252
|
+
};
|
|
253
|
+
function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, defaultTheme, defaultTone, resources, globalProps, standalone, baseName, previewMode, servedFromSingleFile, resourceMap, }) {
|
|
254
|
+
const rootNode = (0, react_1.useMemo)(() => {
|
|
255
|
+
const themedRoot = node.type === "Theme"
|
|
256
|
+
? Object.assign(Object.assign({}, node), { props: Object.assign(Object.assign({}, node.props), { root: true }) }) : {
|
|
257
|
+
type: "Theme",
|
|
258
|
+
props: {
|
|
259
|
+
root: true,
|
|
260
|
+
},
|
|
261
|
+
children: [node],
|
|
262
|
+
};
|
|
263
|
+
return {
|
|
264
|
+
type: "Container",
|
|
265
|
+
children: [themedRoot],
|
|
266
|
+
uses: [],
|
|
267
|
+
};
|
|
268
|
+
}, [node]);
|
|
269
|
+
(0, reportEngineError_1.resetErrors)();
|
|
270
|
+
return ((0, jsx_runtime_1.jsx)(ComponentProvider_1.ComponentProvider, { contributes: contributes, children: (0, jsx_runtime_1.jsx)(RootComponent, { resourceMap: resourceMap, apiInterceptor: apiInterceptor, node: rootNode, contributes: contributes, resources: resources, baseName: baseName, decorateComponentsWithTestId: decorateComponentsWithTestId, defaultTheme: defaultTheme, defaultTone: defaultTone, globalProps: globalProps, standalone: standalone, previewMode: previewMode, servedFromSingleFile: servedFromSingleFile }) }));
|
|
271
|
+
}
|
|
272
|
+
exports.default = AppRoot;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
exports.RouteContext = void 0;
|
|
7
|
+
exports.useRouteContextValue = useRouteContextValue;
|
|
8
|
+
exports.useRouteContext = useRouteContext;
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const immer_1 = __importDefault(require("immer"));
|
|
11
|
+
const constants_1 = require("@components-core/constants");
|
|
12
|
+
exports.RouteContext = (0, react_1.createContext)({
|
|
13
|
+
register: (col) => { },
|
|
14
|
+
unRegister: (id) => { },
|
|
15
|
+
});
|
|
16
|
+
function useRouteContextValue() {
|
|
17
|
+
const [routes, setRoutes] = (0, react_1.useState)(constants_1.EMPTY_ARRAY);
|
|
18
|
+
const routeContextValue = (0, react_1.useMemo)(() => {
|
|
19
|
+
return {
|
|
20
|
+
register: (column) => {
|
|
21
|
+
setRoutes((0, immer_1.default)((draft) => {
|
|
22
|
+
const existing = draft.findIndex((col) => col.id === column.id);
|
|
23
|
+
if (existing < 0) {
|
|
24
|
+
draft.push(column);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
draft[existing] = column;
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
},
|
|
31
|
+
unRegister: (id) => {
|
|
32
|
+
setRoutes((0, immer_1.default)((draft) => {
|
|
33
|
+
return draft.filter((col) => col.id !== id);
|
|
34
|
+
}));
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}, []);
|
|
38
|
+
return {
|
|
39
|
+
routes,
|
|
40
|
+
routeContextValue,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function useRouteContext() {
|
|
44
|
+
return (0, react_1.useContext)(exports.RouteContext);
|
|
45
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
exports.ScrollContext = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
// --- The scroll context of the app
|
|
9
|
+
exports.ScrollContext = react_1.default.createContext(null);
|