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,189 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ApiBoundComponent = ApiBoundComponent;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
function ApiBoundComponent({ uid, node, apiBoundProps, apiBoundEvents, renderChild, layoutContextRef, dynamicChildren, }) {
|
|
41
|
+
const wrappedWithAdapter = (0, react_1.useMemo)(() => {
|
|
42
|
+
function generateloaderUid(key) {
|
|
43
|
+
return `${node.uid}_data_${key}`;
|
|
44
|
+
}
|
|
45
|
+
const loaders = [...(node.loaders || [])];
|
|
46
|
+
const events = Object.assign({}, (node.events || {}));
|
|
47
|
+
const props = Object.assign({}, (node.props || {}));
|
|
48
|
+
const vars = Object.assign({}, (node.vars || {}));
|
|
49
|
+
const api = Object.assign({}, (node.api || {}));
|
|
50
|
+
apiBoundEvents.forEach((key) => {
|
|
51
|
+
const { type } = node.events[key];
|
|
52
|
+
switch (type) {
|
|
53
|
+
case "UploadAction": {
|
|
54
|
+
const actionComponent = node.events[key];
|
|
55
|
+
const { invalidates, asForm, formParams, queryParams, rawBody, body, url, headers, method, file } = actionComponent.props;
|
|
56
|
+
const { success, error } = actionComponent.events || {};
|
|
57
|
+
events[key] = `(eventArgs) => {
|
|
58
|
+
return Actions.upload({
|
|
59
|
+
asForm: ${JSON.stringify(asForm)},
|
|
60
|
+
formParams: ${JSON.stringify(formParams)},
|
|
61
|
+
queryParams: ${JSON.stringify(queryParams)},
|
|
62
|
+
rawBody: ${JSON.stringify(rawBody)},
|
|
63
|
+
body: ${JSON.stringify(body)},
|
|
64
|
+
url: ${JSON.stringify(url)},
|
|
65
|
+
headers: ${JSON.stringify(headers)},
|
|
66
|
+
method: ${JSON.stringify(method)},
|
|
67
|
+
file: ${JSON.stringify(file)},
|
|
68
|
+
params: { '$eventArgs': eventArgs },
|
|
69
|
+
onError: ${JSON.stringify(error)},
|
|
70
|
+
onSuccess: ${JSON.stringify(success)},
|
|
71
|
+
onProgress: eventArgs.onProgress,
|
|
72
|
+
invalidates: ${invalidates === undefined ? undefined : JSON.stringify(invalidates)} }, { resolveBindingExpressions: true });
|
|
73
|
+
}`;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case "DownloadAction": {
|
|
77
|
+
const actionComponent = node.events[key];
|
|
78
|
+
const { url, queryParams, rawBody, body, headers, method, fileName } = actionComponent.props;
|
|
79
|
+
events[key] = `(eventArgs) => {
|
|
80
|
+
return Actions.download({
|
|
81
|
+
queryParams: ${JSON.stringify(queryParams)},
|
|
82
|
+
rawBody: ${JSON.stringify(rawBody)},
|
|
83
|
+
body: ${JSON.stringify(body)},
|
|
84
|
+
url: ${JSON.stringify(url)},
|
|
85
|
+
headers: ${JSON.stringify(headers)},
|
|
86
|
+
method: ${JSON.stringify(method)},
|
|
87
|
+
fileName: ${JSON.stringify(fileName)},
|
|
88
|
+
params: { '$eventArgs': eventArgs },
|
|
89
|
+
}, { resolveBindingExpressions: true });
|
|
90
|
+
}`;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "ApiAction": {
|
|
94
|
+
const actionComponent = node.events[key];
|
|
95
|
+
const { when, uid } = actionComponent;
|
|
96
|
+
const { confirmTitle, confirmMessage, confirmButtonLabel, inProgressNotificationMessage, completedNotificationMessage, errorNotificationMessage, invalidates, updates, optimisticValue, getOptimisticValue, headers, payloadType, method, url, queryParams, rawBody, body, } = actionComponent.props;
|
|
97
|
+
const { success, error, progress, beforeRequest } = actionComponent.events || {};
|
|
98
|
+
events[key] = `(eventArgs, options) => {
|
|
99
|
+
return Actions.callApi({
|
|
100
|
+
uid: ${JSON.stringify(uid)},
|
|
101
|
+
headers: ${JSON.stringify(headers)},
|
|
102
|
+
method: ${JSON.stringify(method)},
|
|
103
|
+
url: ${JSON.stringify(url)},
|
|
104
|
+
queryParams: ${JSON.stringify(queryParams)},
|
|
105
|
+
rawBody: ${JSON.stringify(rawBody)},
|
|
106
|
+
body: ${JSON.stringify(body)} || (options?.passAsDefaultBody ? eventArgs : undefined),
|
|
107
|
+
confirmTitle: ${JSON.stringify(confirmTitle)},
|
|
108
|
+
confirmMessage: ${JSON.stringify(confirmMessage)},
|
|
109
|
+
confirmButtonLabel: ${JSON.stringify(confirmButtonLabel)},
|
|
110
|
+
inProgressNotificationMessage: ${JSON.stringify(inProgressNotificationMessage)},
|
|
111
|
+
completedNotificationMessage: ${JSON.stringify(completedNotificationMessage)},
|
|
112
|
+
errorNotificationMessage: ${JSON.stringify(errorNotificationMessage)},
|
|
113
|
+
params: { '$eventArgs': eventArgs },
|
|
114
|
+
onError: ${JSON.stringify(error)},
|
|
115
|
+
onProgress: ${JSON.stringify(progress)},
|
|
116
|
+
beforeRequest: ${JSON.stringify(beforeRequest)},
|
|
117
|
+
onSuccess: ${JSON.stringify(success)},
|
|
118
|
+
updates: ${JSON.stringify(updates)},
|
|
119
|
+
optimisticValue: ${JSON.stringify(optimisticValue)},
|
|
120
|
+
payloadType: ${JSON.stringify(payloadType)},
|
|
121
|
+
getOptimisticValue: ${JSON.stringify(getOptimisticValue)},
|
|
122
|
+
invalidates: ${invalidates === undefined ? undefined : JSON.stringify(invalidates)},
|
|
123
|
+
when: ${when === undefined ? undefined : JSON.stringify(when)} }, { resolveBindingExpressions: true });
|
|
124
|
+
}`;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
default: {
|
|
128
|
+
throw new Error("Unknown event handler component type: ", type);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
apiBoundProps.forEach((key) => {
|
|
133
|
+
const loaderUid = generateloaderUid(key);
|
|
134
|
+
const _a = node.props[key].props || node.props[key], { transformResult } = _a, operation = __rest(_a, ["transformResult"]);
|
|
135
|
+
const loaderEvents = {};
|
|
136
|
+
Object.entries(node.events || {}).forEach(([eventKey, value]) => {
|
|
137
|
+
if (eventKey.startsWith(key)) {
|
|
138
|
+
const capitalizedEventName = eventKey.substring(key.length);
|
|
139
|
+
const eventName = capitalizedEventName.charAt(0).toLowerCase() + capitalizedEventName.slice(1);
|
|
140
|
+
loaderEvents[eventName] = value;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
loaders.push({
|
|
144
|
+
type: "DataLoader",
|
|
145
|
+
uid: loaderUid,
|
|
146
|
+
props: Object.assign({}, operation),
|
|
147
|
+
events: loaderEvents,
|
|
148
|
+
});
|
|
149
|
+
if (transformResult) {
|
|
150
|
+
vars[`transform_${loaderUid}`] = transformResult;
|
|
151
|
+
}
|
|
152
|
+
api[`fetch_${key}`] = `() => { ${loaderUid}.refetch(); }`;
|
|
153
|
+
api[`update_${key}`] = `(updaterFn) => { ${loaderUid}.update(updaterFn); }`;
|
|
154
|
+
api[`addItem_${key}`] = `(element, index) => { ${loaderUid}.addItem(element, index); }`;
|
|
155
|
+
api[`getItems_${key}`] = `() => { return ${loaderUid}.getItems(); }`;
|
|
156
|
+
api[`deleteItem_${key}`] = `(element) => { ${loaderUid}.deleteItem(element); }`;
|
|
157
|
+
let propKey = key;
|
|
158
|
+
if (key === "datasource") {
|
|
159
|
+
props[key] = undefined;
|
|
160
|
+
propKey = "data";
|
|
161
|
+
}
|
|
162
|
+
props[propKey] = `{ !!transform_${loaderUid} ? transform_${loaderUid}(${loaderUid}.value) : ${loaderUid}.value }`;
|
|
163
|
+
props.loading = `{${loaderUid}.inProgress}`;
|
|
164
|
+
props.pageInfo = `{${loaderUid}.pageInfo}`;
|
|
165
|
+
events.requestFetchPrevPage = `${loaderUid}.fetchPrevPage()`;
|
|
166
|
+
events.requestFetchNextPage = `${loaderUid}.fetchNextPage()`;
|
|
167
|
+
});
|
|
168
|
+
const wrapped = Object.assign(Object.assign({}, node), { containerUid: uid, apiBoundContainer: true, props,
|
|
169
|
+
events });
|
|
170
|
+
if (loaders.length) {
|
|
171
|
+
//to make sure that we don't wrap the component with a container if we don't have to
|
|
172
|
+
wrapped.loaders = loaders;
|
|
173
|
+
}
|
|
174
|
+
if (Object.keys(vars).length) {
|
|
175
|
+
//to make sure that we don't wrap the component with a container if we don't have to
|
|
176
|
+
wrapped.vars = vars;
|
|
177
|
+
}
|
|
178
|
+
if (Object.keys(api).length) {
|
|
179
|
+
//to make sure that we don't wrap the component with a container if we don't have to
|
|
180
|
+
wrapped.api = api;
|
|
181
|
+
}
|
|
182
|
+
return wrapped;
|
|
183
|
+
}, [apiBoundEvents, apiBoundProps, node, uid]);
|
|
184
|
+
// useEffect(() => {
|
|
185
|
+
// console.log("wrapped with adapter changed", wrappedWithAdapter);
|
|
186
|
+
// }, [wrappedWithAdapter]);
|
|
187
|
+
const renderedChild = renderChild(wrappedWithAdapter, layoutContextRef === null || layoutContextRef === void 0 ? void 0 : layoutContextRef.current, dynamicChildren);
|
|
188
|
+
return react_1.default.isValidElement(renderedChild) ? renderedChild : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: renderedChild });
|
|
189
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppContext = void 0;
|
|
4
|
+
exports.useAppContext = useAppContext;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
/**
|
|
7
|
+
* This object provides the React context of the application services, which we pass the root component, and thus all
|
|
8
|
+
* nested apps and components may use it.
|
|
9
|
+
*/
|
|
10
|
+
exports.AppContext = (0, react_1.createContext)(undefined);
|
|
11
|
+
/**
|
|
12
|
+
* This React hook makes the current context of application services available within any component logic using
|
|
13
|
+
* the hook.
|
|
14
|
+
*/
|
|
15
|
+
function useAppContext() {
|
|
16
|
+
return (0, react_1.useContext)(exports.AppContext);
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.childrenSlotHolder = exports.metadata = void 0;
|
|
4
|
+
const renderers_1 = require("@components-core/renderers");
|
|
5
|
+
exports.metadata = {
|
|
6
|
+
displayName: "ChildrenSlot",
|
|
7
|
+
description: "Placeholder in a reusable component. " +
|
|
8
|
+
"Signs the slot where the component's injected children should be rendered.",
|
|
9
|
+
};
|
|
10
|
+
exports.childrenSlotHolder = (0, renderers_1.createPropHolderComponent)("ChildrenSlot", exports.metadata);
|
|
@@ -0,0 +1,280 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const UnknownComponent_1 = __importDefault(require("./UnknownComponent"));
|
|
43
|
+
const InvalidComponent_1 = __importDefault(require("./InvalidComponent"));
|
|
44
|
+
const lodash_es_1 = require("lodash-es");
|
|
45
|
+
const extractParam_1 = require("./utils/extractParam");
|
|
46
|
+
const ThemeContext_1 = require("@components-core/theming/ThemeContext");
|
|
47
|
+
const mergeProps_1 = require("@components-core/utils/mergeProps");
|
|
48
|
+
const ComponentDecorator_1 = __importDefault(require("@components-core/ComponentDecorator"));
|
|
49
|
+
const valueExtractor_1 = require("@components-core/container/valueExtractor");
|
|
50
|
+
const constants_1 = require("@components-core/constants");
|
|
51
|
+
const ViewComponentRegistryContext_1 = require("@components/ViewComponentRegistryContext");
|
|
52
|
+
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
53
|
+
const ApiBoundComponent_1 = require("@components-core/ApiBoundComponent");
|
|
54
|
+
const hooks_1 = require("./utils/hooks");
|
|
55
|
+
const containers_1 = require("./abstractions/containers");
|
|
56
|
+
function useEventHandler(eventName, lookupEvent, shouldSkip) {
|
|
57
|
+
const onEvent = shouldSkip ? undefined : lookupEvent(eventName);
|
|
58
|
+
const eventHandler = (0, react_1.useCallback)((event) => {
|
|
59
|
+
if (onEvent) {
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
onEvent(event);
|
|
62
|
+
}
|
|
63
|
+
}, [onEvent]);
|
|
64
|
+
return !onEvent ? undefined : eventHandler;
|
|
65
|
+
}
|
|
66
|
+
function useMouseEventHandlers(lookupEvent, shouldSkip) {
|
|
67
|
+
const onClick = useEventHandler("click", lookupEvent, shouldSkip);
|
|
68
|
+
const onMouseLeave = useEventHandler("mouseLeave", lookupEvent, shouldSkip);
|
|
69
|
+
const onMouseEnter = useEventHandler("mouseEnter", lookupEvent, shouldSkip);
|
|
70
|
+
const onDoubleClick = useEventHandler("doubleClick", lookupEvent, shouldSkip);
|
|
71
|
+
if (shouldSkip) {
|
|
72
|
+
return constants_1.EMPTY_OBJECT;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
onClick,
|
|
76
|
+
onMouseLeave,
|
|
77
|
+
onMouseEnter,
|
|
78
|
+
onDoubleClick,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* This component's primary responsibility is to transform a particular component definition
|
|
83
|
+
* into its React representation using the current rendering context.
|
|
84
|
+
*
|
|
85
|
+
* Its properties hold a transformed version of an `InnerRendererContext` (which describes the
|
|
86
|
+
* current rendering context). The modified version uses a stable reference to the layout context
|
|
87
|
+
* and provides a cleanup function (`onUnmount`) to call when the component is about to be disposed.
|
|
88
|
+
*/
|
|
89
|
+
const Component = (0, react_1.forwardRef)(function Component(_a, ref) {
|
|
90
|
+
var _b;
|
|
91
|
+
var { node, state, appContext, dispatch, lookupAction, lookupSyncCallback, renderChild, registerComponentApi, layoutCss, layoutNonCss, layoutContextRef, dynamicChildren, memoedVarsRef, onUnmount, childIndex } = _a, rest = __rest(_a, ["node", "state", "appContext", "dispatch", "lookupAction", "lookupSyncCallback", "renderChild", "registerComponentApi", "layoutCss", "layoutNonCss", "layoutContextRef", "dynamicChildren", "memoedVarsRef", "onUnmount", "childIndex"]);
|
|
92
|
+
// --- Memoizes the node object with a safe version that contains empty objects for props and events
|
|
93
|
+
// --- were they no props or events defined
|
|
94
|
+
const safeNode = (0, react_1.useMemo)(() => {
|
|
95
|
+
return Object.assign(Object.assign({}, node), { props: node.props || constants_1.EMPTY_OBJECT, events: node.events || constants_1.EMPTY_OBJECT });
|
|
96
|
+
}, [node]);
|
|
97
|
+
// --- Each component receives a unique identifier
|
|
98
|
+
const uid = (0, react_1.useMemo)(() => Symbol(safeNode.uid), [safeNode.uid]);
|
|
99
|
+
// --- Takes care the component cleanup function is called when the component is about to be disposed
|
|
100
|
+
(0, react_1.useEffect)(() => {
|
|
101
|
+
return () => {
|
|
102
|
+
onUnmount(uid);
|
|
103
|
+
};
|
|
104
|
+
}, [onUnmount, uid]);
|
|
105
|
+
const componentRegistry = (0, ViewComponentRegistryContext_1.useComponentRegistry)();
|
|
106
|
+
const { getResourceUrl } = (0, ThemeContext_1.useTheme)();
|
|
107
|
+
// --- Memoizes component API registration
|
|
108
|
+
const memoedRegisterComponentApi = (0, react_1.useCallback)((api) => {
|
|
109
|
+
registerComponentApi(uid, api);
|
|
110
|
+
}, [registerComponentApi, uid]);
|
|
111
|
+
// --- Memoizes the state update function
|
|
112
|
+
const memoedUpdateState = (0, react_1.useCallback)((componentState) => {
|
|
113
|
+
dispatch(componentStateChanged(uid, componentState));
|
|
114
|
+
}, [dispatch, uid]);
|
|
115
|
+
// --- Memoizes the action resolution by action definition value
|
|
116
|
+
const memoedLookupAction = (0, react_1.useCallback)((action, actionOptions) => {
|
|
117
|
+
return lookupAction(action, uid, actionOptions);
|
|
118
|
+
}, [lookupAction, uid]);
|
|
119
|
+
// --- Memoizes the lookupSyncCallback function's call
|
|
120
|
+
const memoedLookupSyncCallback = (0, react_1.useCallback)((action) => {
|
|
121
|
+
return lookupSyncCallback(action, uid);
|
|
122
|
+
}, [lookupSyncCallback, uid]);
|
|
123
|
+
// --- Memoizes event handler resolution by event name
|
|
124
|
+
const memoedLookupEventHandler = (0, react_1.useCallback)((eventName, actionOptions) => {
|
|
125
|
+
var _a;
|
|
126
|
+
const action = (_a = safeNode.events) === null || _a === void 0 ? void 0 : _a[eventName];
|
|
127
|
+
return lookupAction(action, uid, Object.assign({ eventName }, actionOptions));
|
|
128
|
+
}, [lookupAction, safeNode.events, uid]);
|
|
129
|
+
// --- Get the tracked APIs of the compomnent
|
|
130
|
+
const referenceTrackedApi = (0, hooks_1.useReferenceTrackedApi)(state);
|
|
131
|
+
// --- Memoizes the value extractor object
|
|
132
|
+
const valueExtractor = (0, react_1.useMemo)(() => {
|
|
133
|
+
return (0, valueExtractor_1.createValueExtractor)(state, appContext, referenceTrackedApi, memoedVarsRef);
|
|
134
|
+
}, [appContext, memoedVarsRef, referenceTrackedApi, state]);
|
|
135
|
+
// --- Memoizes the resource URL extraction function
|
|
136
|
+
const extractResourceUrl = (0, react_1.useCallback)((url) => {
|
|
137
|
+
const extractedUrl = valueExtractor(url);
|
|
138
|
+
return getResourceUrl(extractedUrl);
|
|
139
|
+
}, [getResourceUrl, valueExtractor]);
|
|
140
|
+
// --- Obtain the component renderer and descriptor from the component registry
|
|
141
|
+
const { renderer, descriptor, isCompoundComponent } = componentRegistry.lookupComponentRenderer(safeNode.type) || {};
|
|
142
|
+
// --- Memoizes the renderChild function
|
|
143
|
+
const memoedRenderChild = (0, react_1.useCallback)((children, lc, rc) => {
|
|
144
|
+
return renderChild(children, lc, rc || dynamicChildren);
|
|
145
|
+
}, [renderChild, dynamicChildren]);
|
|
146
|
+
// --- Memoizes the node object with the resolved children. If the children contain a `ChildrenSlot`,
|
|
147
|
+
// --- the resolved children (DynamicChildComponentDef) are used instead of the original children.
|
|
148
|
+
const memoedNode = (0, react_1.useMemo)(() => {
|
|
149
|
+
const children = [];
|
|
150
|
+
let didResolve = false;
|
|
151
|
+
if (Array.isArray(safeNode.children)) {
|
|
152
|
+
safeNode.children.forEach((child) => {
|
|
153
|
+
if (child.type === "ChildrenSlot") {
|
|
154
|
+
didResolve = true;
|
|
155
|
+
if (dynamicChildren) {
|
|
156
|
+
children.push(...dynamicChildren);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
children.push(child);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// --- Because of performance reasons, we only return the changed `safeNode` if we resolve the
|
|
165
|
+
// --- rendered children to a `ChildrenSlot`; otherwise, we return the original reference.
|
|
166
|
+
if (didResolve) {
|
|
167
|
+
return Object.assign(Object.assign({}, safeNode), { children });
|
|
168
|
+
}
|
|
169
|
+
return safeNode;
|
|
170
|
+
}, [safeNode, dynamicChildren]);
|
|
171
|
+
const apiBoundProps = (0, react_1.useMemo)(() => getApiBoundItems(safeNode.props, "Datasource"), [safeNode.props]);
|
|
172
|
+
const apiBoundEvents = (0, react_1.useMemo)(() => getApiBoundItems(safeNode.events, "ApiAction", "DownloadAction", "UploadAction"), [safeNode.events]);
|
|
173
|
+
const isApiBound = apiBoundProps.length > 0 || apiBoundEvents.length > 0;
|
|
174
|
+
const mouseEventHandlers = useMouseEventHandlers(memoedLookupEventHandler, (descriptor === null || descriptor === void 0 ? void 0 : descriptor.nonVisual) || isApiBound);
|
|
175
|
+
// --- API-bound components provide helpful behavior out of the box, such as transforming API-bound
|
|
176
|
+
// --- events and properties. This extra functionality is implemented in `ApiBoundComponent`.
|
|
177
|
+
if (isApiBound) {
|
|
178
|
+
return ((0, jsx_runtime_1.jsx)(ApiBoundComponent_1.ApiBoundComponent, { uid: uid, renderChild: memoedRenderChild, node: memoedNode, apiBoundEvents: apiBoundEvents, apiBoundProps: apiBoundProps, layoutContextRef: layoutContextRef, dynamicChildren: dynamicChildren }, safeNode.uid));
|
|
179
|
+
}
|
|
180
|
+
// --- No special behavior, let's render the component according to its definition.
|
|
181
|
+
let renderedNode = null;
|
|
182
|
+
let renderingError = null;
|
|
183
|
+
try {
|
|
184
|
+
// --- Assemble the renderer context we pass down the rendering chain
|
|
185
|
+
const rendererContext = {
|
|
186
|
+
node: memoedNode,
|
|
187
|
+
state: state[uid] || constants_1.EMPTY_OBJECT,
|
|
188
|
+
updateState: memoedUpdateState,
|
|
189
|
+
appContext,
|
|
190
|
+
extractValue: valueExtractor,
|
|
191
|
+
lookupEventHandler: memoedLookupEventHandler,
|
|
192
|
+
lookupAction: memoedLookupAction,
|
|
193
|
+
lookupSyncCallback: memoedLookupSyncCallback,
|
|
194
|
+
extractResourceUrl,
|
|
195
|
+
renderChild: memoedRenderChild,
|
|
196
|
+
registerComponentApi: memoedRegisterComponentApi,
|
|
197
|
+
layoutCss,
|
|
198
|
+
layoutNonCss,
|
|
199
|
+
layoutContext: layoutContextRef === null || layoutContextRef === void 0 ? void 0 : layoutContextRef.current,
|
|
200
|
+
uid,
|
|
201
|
+
childIndex,
|
|
202
|
+
};
|
|
203
|
+
if (!renderer) {
|
|
204
|
+
console.error(`Component '${safeNode.type}' is not available. Did you forget to register it?`);
|
|
205
|
+
return (0, jsx_runtime_1.jsx)(UnknownComponent_1.default, { message: `${safeNode.type}` });
|
|
206
|
+
}
|
|
207
|
+
// --- Render the component using the renderer function obtained from the component registry
|
|
208
|
+
renderedNode = renderer(rendererContext);
|
|
209
|
+
// --- Components may have a `testId` property for E2E testing purposes. Inject the value of `testId`
|
|
210
|
+
// --- into the DOM object of the rendered React component.
|
|
211
|
+
if (
|
|
212
|
+
// --- The component has its "id" (internally, "uid") or "testId" property defined
|
|
213
|
+
(memoedNode.uid !== undefined || memoedNode.testId !== undefined) &&
|
|
214
|
+
(
|
|
215
|
+
// --- The app context indicates test mode
|
|
216
|
+
appContext === null || appContext === void 0 ? void 0 : appContext.decorateComponentsWithTestId) &&
|
|
217
|
+
// --- The component is visual
|
|
218
|
+
(descriptor === null || descriptor === void 0 ? void 0 : descriptor.nonVisual) !== true &&
|
|
219
|
+
// --- The component is not opaque
|
|
220
|
+
(descriptor === null || descriptor === void 0 ? void 0 : descriptor.opaque) !== true) {
|
|
221
|
+
// --- Use `ComponentDecorator` to inject the `data-testid` attribute into the component.
|
|
222
|
+
const testId = memoedNode.testId || memoedNode.uid;
|
|
223
|
+
const resolvedUid = (0, extractParam_1.extractParam)(state, testId, appContext, true);
|
|
224
|
+
renderedNode = ((0, jsx_runtime_1.jsx)(ComponentDecorator_1.default, { attr: { "data-testid": resolvedUid }, allowOnlyRefdChild: isCompoundComponent || safeNode.type === "ModalDialog", ref: ref, children: (0, react_1.cloneElement)(renderedNode, Object.assign({}, (0, mergeProps_1.mergeProps)(Object.assign(Object.assign({}, renderedNode.props), mouseEventHandlers), rest))) }));
|
|
225
|
+
}
|
|
226
|
+
// --- The current layout context may suggest to wrap the rendered node.
|
|
227
|
+
if ((_b = layoutContextRef.current) === null || _b === void 0 ? void 0 : _b.wrapChild) {
|
|
228
|
+
renderedNode = layoutContextRef.current.wrapChild(rendererContext, renderedNode, descriptor);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
catch (e) {
|
|
232
|
+
// --- Mark the potential rendering error and display it
|
|
233
|
+
renderingError = (e === null || e === void 0 ? void 0 : e.message) || "Internal error";
|
|
234
|
+
console.error(e);
|
|
235
|
+
}
|
|
236
|
+
// --- The rendering process may result in errors. If so, we render an error message.
|
|
237
|
+
if (renderingError) {
|
|
238
|
+
return ((0, jsx_runtime_1.jsx)(InvalidComponent_1.default, { errors: [renderingError], node: safeNode, children: renderedNode }));
|
|
239
|
+
}
|
|
240
|
+
// --- If we have a single React node with forwarded reference, let's merge the "rest"
|
|
241
|
+
// --- properties with it.
|
|
242
|
+
if ((ref || !(0, lodash_es_1.isEmpty)(mouseEventHandlers)) && renderedNode && react_1.default.isValidElement(renderedNode)) {
|
|
243
|
+
// --- For radix UI/accessibility, read more here:
|
|
244
|
+
// --- https://www.radix-ui.com/primitives/docs/guides/composition
|
|
245
|
+
return (0, react_1.cloneElement)(renderedNode, Object.assign({ ref: ref ? (0, react_compose_refs_1.composeRefs)(ref, renderedNode.ref) : undefined }, (0, mergeProps_1.mergeProps)(Object.assign(Object.assign({}, renderedNode.props), mouseEventHandlers), rest)));
|
|
246
|
+
}
|
|
247
|
+
// --- If the rendering resulted in multiple React nodes, wrap them in a fragment.
|
|
248
|
+
return react_1.default.isValidElement(renderedNode) ? renderedNode : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: renderedNode });
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* This function gets the API-bound component properties. A property is API-bound if its value is a
|
|
252
|
+
* component definition with one of the `type` values passed to this function.
|
|
253
|
+
* @param items Hash object of component properties
|
|
254
|
+
* @param type Types to consider as API-bound properties
|
|
255
|
+
* @returns List of API-bound property names
|
|
256
|
+
*/
|
|
257
|
+
function getApiBoundItems(items, ...type) {
|
|
258
|
+
const ret = [];
|
|
259
|
+
if (!items) {
|
|
260
|
+
return ret;
|
|
261
|
+
}
|
|
262
|
+
const entries = Object.entries(items);
|
|
263
|
+
for (let i = 0; i < entries.length; i++) {
|
|
264
|
+
const [key, value] = entries[i];
|
|
265
|
+
if ((0, lodash_es_1.isPlainObject)(value) && type.includes(value.type)) {
|
|
266
|
+
ret.push(key);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return ret;
|
|
270
|
+
}
|
|
271
|
+
function componentStateChanged(uid, state) {
|
|
272
|
+
return {
|
|
273
|
+
type: containers_1.ContainerActionKind.COMPONENT_STATE_CHANGED,
|
|
274
|
+
payload: {
|
|
275
|
+
uid,
|
|
276
|
+
state,
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
exports.default = Component;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
29
|
+
/**
|
|
30
|
+
* This component decorates a React element's DOM node (through a React ref) with the specified
|
|
31
|
+
* attributes. We use this component to add test IDs to particular components.
|
|
32
|
+
*/
|
|
33
|
+
const ComponentDecorator = (0, react_1.forwardRef)((props, forwardedRef) => {
|
|
34
|
+
const [parentElement, setParentElement] = (0, react_1.useState)(null);
|
|
35
|
+
// --- We wrap the component in a `Fragment`, if it has a parent element; otherwise, we use a `div`
|
|
36
|
+
const Wrapper = parentElement ? react_1.default.Fragment : "div";
|
|
37
|
+
const ref = (0, react_1.useRef)(null);
|
|
38
|
+
const itemRef = (0, react_1.useRef)(null);
|
|
39
|
+
const targetIndex = (0, react_1.useRef)(0);
|
|
40
|
+
// --- When the component mounts, we find the index of the component in its parent
|
|
41
|
+
(0, react_1.useEffect)(() => {
|
|
42
|
+
var _a;
|
|
43
|
+
if ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
44
|
+
targetIndex.current = Array.from(ref.current.parentElement.children).indexOf(ref.current);
|
|
45
|
+
setParentElement(ref.current.parentElement);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
// --- When the component mounts, we add the attributes to the component's DOM node
|
|
50
|
+
(0, react_1.useEffect)(() => {
|
|
51
|
+
let node = itemRef.current || (parentElement === null || parentElement === void 0 ? void 0 : parentElement.children[targetIndex.current]) || null;
|
|
52
|
+
if (props.allowOnlyRefdChild) {
|
|
53
|
+
node = itemRef.current;
|
|
54
|
+
}
|
|
55
|
+
Object.entries(props.attr).forEach(([key, value]) => {
|
|
56
|
+
node === null || node === void 0 ? void 0 : node.setAttribute(key, value);
|
|
57
|
+
});
|
|
58
|
+
}, [parentElement, targetIndex, props.attr, props.allowOnlyRefdChild]);
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)(Wrapper, { ref: parentElement ? undefined : ref, children: (0, react_1.cloneElement)(props.children, {
|
|
60
|
+
ref: forwardedRef ? (0, react_compose_refs_1.composeRefs)(itemRef, forwardedRef) : itemRef,
|
|
61
|
+
}) }));
|
|
62
|
+
});
|
|
63
|
+
exports.default = ComponentDecorator;
|