@atom8n/n8n-editor-ui 2.2.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/.stylelintcache +1 -0
- package/README.md +59 -0
- package/biome.jsonc +8 -0
- package/build.log +55 -0
- package/data/node-popularity.json +3998 -0
- package/dist/assets/AddDataTableModal-UINkk54_.js +1555 -0
- package/dist/assets/AgentEditorModal-CVww87TJ.js +358 -0
- package/dist/assets/Alert-Dy86dyOr.js +102 -0
- package/dist/assets/AnimatedSpinner-DmPN4poP.js +15 -0
- package/dist/assets/AnnotationTagsDropdown.ee-BJ7N9lek.js +71 -0
- package/dist/assets/AuthView-D2LWHrMp.js +106 -0
- package/dist/assets/BottomMenu-CIQiK_dJ.js +532 -0
- package/dist/assets/CalendarDate-DgQUMbNo.js +875 -0
- package/dist/assets/ChangePasswordView-Z6tUkw0u.js +133 -0
- package/dist/assets/ChatAgentAvatar-50YBnv3N.js +67 -0
- package/dist/assets/ChatFile-xZxmc2nV.js +146 -0
- package/dist/assets/ChatLayout-CTE_5SiM.js +96 -0
- package/dist/assets/ChatPersonalAgentsView-BGpHk03K.js +149 -0
- package/dist/assets/ChatSidebar-BkVwIypC.js +528 -0
- package/dist/assets/ChatView-BbbdeU9x.js +1559 -0
- package/dist/assets/ChatWorkflowAgentsView-BtunOxlC.js +116 -0
- package/dist/assets/CollectionParameter-BdcPG1lu.js +52 -0
- package/dist/assets/CommitMonoVariable-ytizKI8U.woff2 +0 -0
- package/dist/assets/CommunityNodeUpdateInfo-C37kca4W.js +273 -0
- package/dist/assets/CopyInput-DDZVu2iU.js +74 -0
- package/dist/assets/CredentialIcon-8YdTTFZ1.js +80 -0
- package/dist/assets/CredentialPicker-DWtj314o.js +293 -0
- package/dist/assets/CredentialSelectorModal-DTW2fKh0.js +138 -0
- package/dist/assets/CredentialsView-BjUchcCu.js +480 -0
- package/dist/assets/DataTableActions-DpAkoxg_.js +95 -0
- package/dist/assets/DataTableDetailsView-Coq7zdW5.js +41922 -0
- package/dist/assets/DataTableView-Cs-BIkzw.js +293 -0
- package/dist/assets/DemoFooter-Cga3jvi-.js +65 -0
- package/dist/assets/Draggable-vfvXl9Sp.js +105 -0
- package/dist/assets/EmptySharedSectionActionBox-DOXZtTCv.js +36 -0
- package/dist/assets/EnterpriseEdition.ee-D_rCFexM.js +15 -0
- package/dist/assets/EntityNotFound-3dhTRWsE.js +85 -0
- package/dist/assets/EntityUnAuthorised-ChJYZakE.js +66 -0
- package/dist/assets/ErrorView-zT9cX76a.js +61 -0
- package/dist/assets/EvaluationsRootView-C-OVWYnY.js +523 -0
- package/dist/assets/EvaluationsView-CJwJTruc.js +469 -0
- package/dist/assets/ExecutionsTime-DEQiyozR.js +573 -0
- package/dist/assets/ExecutionsView-Bd5Oh8TH.js +791 -0
- package/dist/assets/ExternalSecretsProviderConnectionSwitch.ee-C7Ih-uRo.js +191 -0
- package/dist/assets/FixedCollectionParameter-CYuTDW9t.js +496 -0
- package/dist/assets/ForgotMyPasswordView-Bs_L9P27.js +102 -0
- package/dist/assets/InsightsChartAverageRuntime-Bp3VA8_7.js +62 -0
- package/dist/assets/InsightsChartFailed-KPaNWoEr.js +52 -0
- package/dist/assets/InsightsChartFailureRate-DE6kE3FM.js +54 -0
- package/dist/assets/InsightsChartTimeSaved-auABNZlc.js +68 -0
- package/dist/assets/InsightsChartTotal-BKzYRKE7.js +56 -0
- package/dist/assets/InsightsDashboard-JWx4W6Db.js +473 -0
- package/dist/assets/InsightsPaywall-C8zLLKe8.js +63 -0
- package/dist/assets/InsightsSummary-cmN1lHDm.js +210 -0
- package/dist/assets/InsightsTableWorkflows-CqcC3IbQ.js +203 -0
- package/dist/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
- package/dist/assets/InterVariable-Italic-FCBEiFp6.woff2 +0 -0
- package/dist/assets/ItemsRenderer-DC8WVyMv.js +922 -0
- package/dist/assets/KeyboardShortcutTooltip-D8PAK5JP.js +31 -0
- package/dist/assets/LogsPanel-BR06u9RK.js +52 -0
- package/dist/assets/LogsPanel-C-_acMHp.js +2325 -0
- package/dist/assets/MCPConnectWorkflowsModal-3g8_iUa4.js +303 -0
- package/dist/assets/MainHeader-DiQc1edn.js +2153 -0
- package/dist/assets/MainSidebar-CoPGG5Ea.js +804 -0
- package/dist/assets/MigrationRuleDetail-BAxk1Pvl.js +295 -0
- package/dist/assets/MigrationRules-IW9lZMpE.js +285 -0
- package/dist/assets/Modal-CIzXlZdZ.js +204 -0
- package/dist/assets/ModelByIdSelectorModal-DLvBjzJO.js +115 -0
- package/dist/assets/NDVEmptyState-33UoX00I.js +19743 -0
- package/dist/assets/NodeCreation-BNzbSWSB.js +240 -0
- package/dist/assets/NodeCreator-BftgCKx7.js +1288 -0
- package/dist/assets/NodeDetailsView-CsoQCpcF.js +1075 -0
- package/dist/assets/NodeDetailsViewV2-C_wNQR_3.js +981 -0
- package/dist/assets/NodeIcon-B9VW6tX6.js +87 -0
- package/dist/assets/NodeSettings-ZwVip6VR.js +1872 -0
- package/dist/assets/NodeView-D4WUEvLB.js +2452 -0
- package/dist/assets/OAuthConsentView-DlrUqZbT.js +230 -0
- package/dist/assets/PageViewLayout-NT1KPFgy.js +12 -0
- package/dist/assets/ParameterInputList-sG2nz-Jo.js +38091 -0
- package/dist/assets/PrebuiltAgentTemplatesView-Csi5U8dc.js +154 -0
- package/dist/assets/ProjectBreadcrumb-C_XiY7sc.js +98 -0
- package/dist/assets/ProjectCardBadge-t_hs7vzx.js +209 -0
- package/dist/assets/ProjectHeader-Dq5Ihb26.js +549 -0
- package/dist/assets/ProjectIcon-DY8gGuHX.js +64 -0
- package/dist/assets/ProjectRoleView-Du-KTrAC.js +435 -0
- package/dist/assets/ProjectRolesView-DjxM_y4u.js +239 -0
- package/dist/assets/ProjectSettings-C6kWuV21.js +966 -0
- package/dist/assets/ProjectSharing-CVUgNWAY.js +262 -0
- package/dist/assets/ProjectVariables-CJlAo3dv.js +467 -0
- package/dist/assets/ProviderSettingsModal-BUFC2ZLv.js +307 -0
- package/dist/assets/PushConnectionTracker-DPBnGV0v.js +27 -0
- package/dist/assets/ResolversView-3BdkvvYA.js +209 -0
- package/dist/assets/ResourceFiltersDropdown-dgyXpcEX.js +159 -0
- package/dist/assets/ResourcesListLayout-qBLtomK6.js +631 -0
- package/dist/assets/RunDataHtml-BrW0OQra.js +7 -0
- package/dist/assets/RunDataHtml-Cleia4Cj.js +40 -0
- package/dist/assets/RunDataJson-uxkrhYRK.js +227 -0
- package/dist/assets/RunDataJsonActions-DkPk7E8d.js +5007 -0
- package/dist/assets/RunDataParsedAiContent-CtPRjig-.js +26 -0
- package/dist/assets/RunDataParsedAiContent-WAuqLQ5M.js +192 -0
- package/dist/assets/RunDataSearch-YBWUr93C.js +141 -0
- package/dist/assets/RunDataTable-DcXaBynW.js +631 -0
- package/dist/assets/SamlOnboarding-BTdQ_hr3.js +78 -0
- package/dist/assets/SaveButton-D5sQSxIk.js +89 -0
- package/dist/assets/SelectedItemsInfo-BHZ-NvF5.js +58 -0
- package/dist/assets/SettingsApiView-IfZTMXx1.js +313 -0
- package/dist/assets/SettingsChatHubView-gWh2X6vX.js +285 -0
- package/dist/assets/SettingsCommunityNodesView-D8VQtpGY.js +349 -0
- package/dist/assets/SettingsExternalSecrets-CpMc7mkW.js +233 -0
- package/dist/assets/SettingsLdapView-CU5a2MAy.js +2553 -0
- package/dist/assets/SettingsLogStreamingView-uojTe-oX.js +375 -0
- package/dist/assets/SettingsMCPView-B5Swp1C_.js +1214 -0
- package/dist/assets/SettingsPersonalView-Cr3aGood.js +402 -0
- package/dist/assets/SettingsSourceControl-DXOvFDEY.js +547 -0
- package/dist/assets/SettingsSso-27MfU1HV.js +1032 -0
- package/dist/assets/SettingsUsageAndPlan-DqIO-G46.js +419 -0
- package/dist/assets/SettingsUsersView-DfHB4_Kh.js +833 -0
- package/dist/assets/SettingsView-C4sA7Uny.js +90 -0
- package/dist/assets/SetupTemplateFormStep-BmiSzZin.js +258 -0
- package/dist/assets/SetupView-VORZ-L_u.js +112 -0
- package/dist/assets/SetupWorkflowCredentialsButton-DTmkOAW5.js +73 -0
- package/dist/assets/SetupWorkflowFromTemplateView-B9NupdJE.js +286 -0
- package/dist/assets/SeverityTag-CX1qTTNA.js +45 -0
- package/dist/assets/SigninView-D9_Pm16j.js +358 -0
- package/dist/assets/SignoutView-BFsjEAGz.js +19 -0
- package/dist/assets/SignupView-Am4ot0QZ.js +137 -0
- package/dist/assets/SkeletonAgentCard-C5TL-h8F.js +191 -0
- package/dist/assets/TagsDropdown-Bvx_Hd6Q.js +230 -0
- package/dist/assets/TemplateCard-CyQ1GuVz.js +105 -0
- package/dist/assets/TemplateDetails-CZRusTxE.js +124 -0
- package/dist/assets/TemplateList-DKvbwuiY.js +333 -0
- package/dist/assets/TemplatesCollectionView-D8dxU8By.js +184 -0
- package/dist/assets/TemplatesSearchView-CebC_GLs.js +1230 -0
- package/dist/assets/TemplatesView-025CcmIY.js +57 -0
- package/dist/assets/TemplatesWorkflowView-C2JfwJAn.js +170 -0
- package/dist/assets/TestRunDetailView-Ck78TTWO.js +395 -0
- package/dist/assets/TextWithHighlights-BxumwGnv.js +57 -0
- package/dist/assets/TimeAgo-C6EN4lCs.js +123 -0
- package/dist/assets/ToolsSelectorModal-8QJoUvRL.js +368 -0
- package/dist/assets/TriggerPanel-B6pacLkk.js +1225 -0
- package/dist/assets/VirtualSchema-B3zGe_8b.js +2402 -0
- package/dist/assets/VirtualSchema-Dkh0Cu5z.js +37 -0
- package/dist/assets/VueMarkdown-CQqJL9vK.js +28 -0
- package/dist/assets/WorkerView-Caznsljo.js +563 -0
- package/dist/assets/WorkflowActivationErrorMessage-CGrfPi9O.js +17 -0
- package/dist/assets/WorkflowActivator-BINnz0f7.js +362 -0
- package/dist/assets/WorkflowExecutionsInfoAccordion-Dg37yEfT.js +166 -0
- package/dist/assets/WorkflowExecutionsLandingPage-V2wdubhK.js +93 -0
- package/dist/assets/WorkflowExecutionsPreview-DdJaqYV6.js +616 -0
- package/dist/assets/WorkflowExecutionsView-DV8ySTfn.js +808 -0
- package/dist/assets/WorkflowHistory-GtaBMzIM.js +973 -0
- package/dist/assets/WorkflowLocation-CQ9Sq-2y.js +164 -0
- package/dist/assets/WorkflowOnboardingView-C49gt0Jr.js +61 -0
- package/dist/assets/WorkflowPreview-CXdvv4Nq.js +186 -0
- package/dist/assets/WorkflowTagsDropdown-QwbICWjN.js +71 -0
- package/dist/assets/WorkflowsView-B-MWIECO.js +3253 -0
- package/dist/assets/_MapCache-CcdIl4Ae.js +363 -0
- package/dist/assets/_baseOrderBy-N8Be_6z6.js +2989 -0
- package/dist/assets/_initCloneObject-viQQyT6o.js +80 -0
- package/dist/assets/_plugin-vue_export-helper-BwBpWJRZ.js +6 -0
- package/dist/assets/aiTemplatesStarterCollection.store-nL9nePkK.js +656 -0
- package/dist/assets/apiKeys.store-BhOFmP2j.js +51 -0
- package/dist/assets/assistant.store-CNywgN4S.js +518 -0
- package/dist/assets/auth.eventBus-CWXS0Qp7.js +5 -0
- package/dist/assets/banners.store-CGEcBTDn.js +195 -0
- package/dist/assets/builder.store-Czk2ipDE.js +31417 -0
- package/dist/assets/buttons.esm-yintpW2E.js +364 -0
- package/dist/assets/chart-CNvyywtJ.js +10958 -0
- package/dist/assets/chartjs.utils-BAE52Cv9.js +155 -0
- package/dist/assets/chat.store-290YeyrQ.js +865 -0
- package/dist/assets/chatPanel.store-NDaawEZL.js +118 -0
- package/dist/assets/chunk-6z4oVpB-.js +36 -0
- package/dist/assets/col-Cmt4cmuS.js +158 -0
- package/dist/assets/constants-C8OH4tTq.js +106256 -0
- package/dist/assets/constants-DMrsrpD7.js +32 -0
- package/dist/assets/core-B9gt_4yk.js +4 -0
- package/dist/assets/core-CP5FY4aX.js +1202 -0
- package/dist/assets/core-CRbPymLT.js +9741 -0
- package/dist/assets/dataTable.store-DmipQsol.js +207 -0
- package/dist/assets/date-picker-2IDsBs2n.js +4115 -0
- package/dist/assets/dateFormatter-ik4-9_9r.js +33 -0
- package/dist/assets/dateformat-hG8NERse.js +181 -0
- package/dist/assets/dialog-lMho1TD8.js +425 -0
- package/dist/assets/dist-Cw46Is-h.js +151 -0
- package/dist/assets/doppler-B__k0MeW.webp +0 -0
- package/dist/assets/element-icons-B-tDfklg.woff +0 -0
- package/dist/assets/element-icons-_lZGOqcG.ttf +0 -0
- package/dist/assets/empty-BuGRxzl4.js +2210 -0
- package/dist/assets/en-CF30SCh2.js +95 -0
- package/dist/assets/en-DyO2pPiC.js +2 -0
- package/dist/assets/es-BkUFJVtD.js +43338 -0
- package/dist/assets/evaluation.constants-GYAwmJnh.js +284 -0
- package/dist/assets/executions.store-B9uRYwgv.js +205 -0
- package/dist/assets/exports-Crx_gvt_.js +1799 -0
- package/dist/assets/externalSecrets.ee.store-BJh4a_6G.js +118 -0
- package/dist/assets/fileUtils-CRWqOQje.js +20 -0
- package/dist/assets/folders.store-yAFj-5Vl.js +235 -0
- package/dist/assets/get-BcEmeOxn.js +2781 -0
- package/dist/assets/index-SL8542zQ.js +28372 -0
- package/dist/assets/insights.constants-BkJCYJTL.js +55 -0
- package/dist/assets/insights.store-BFc3kDUo.js +61 -0
- package/dist/assets/insights.utils-CcLXdrrz.js +77 -0
- package/dist/assets/isEmpty-C3XXoHqJ.js +35216 -0
- package/dist/assets/languageModules-9LyndCqU.js +13862 -0
- package/dist/assets/logStreaming.store-IZhWe_VK.js +190 -0
- package/dist/assets/mcp.constants-_Jcn7fPq.js +10 -0
- package/dist/assets/mcp.store-B9yfcAN9.js +116 -0
- package/dist/assets/merge-DhuTk1HM.js +564 -0
- package/dist/assets/nodeCreator.store-Bpnrwp2l.js +5444 -0
- package/dist/assets/nodeIcon-D6X-ENYt.js +102 -0
- package/dist/assets/nodeTransforms-RzcOM0v2.js +42 -0
- package/dist/assets/orderBy-Cu9F9DU_.js +15 -0
- package/dist/assets/path-browserify-RUt2u7iT.js +328 -0
- package/dist/assets/personalizedTemplatesV3.store-BGYp0YBN.js +334 -0
- package/dist/assets/pickBy-UI0Jt4wC.js +18 -0
- package/dist/assets/preload-helper-dyVz7ck7.js +59 -0
- package/dist/assets/radio-CSce3UT0.js +262 -0
- package/dist/assets/readyToRun.store-YEMvPUqo.js +626 -0
- package/dist/assets/readyToRunWorkflows.store-G3srgIze.js +1319 -0
- package/dist/assets/retry-BgHaYzbB.js +23 -0
- package/dist/assets/roles.store-CRf_zJTb.js +51 -0
- package/dist/assets/router-DNpzz3GH.js +2631 -0
- package/dist/assets/sanitize-html-CbW56HUN.js +10758 -0
- package/dist/assets/schemaPreview.store-DUgN1yVE.js +113 -0
- package/dist/assets/semver-Bk6DGseV.js +1306 -0
- package/dist/assets/smartDecimal-DAZl4HKA.js +6 -0
- package/dist/assets/sortByProperty-Cn7iGKYu.js +8 -0
- package/dist/assets/sourceControl.eventBus-D47xXSc_.js +3 -0
- package/dist/assets/sqlite3-DBpDb1lf.wasm +0 -0
- package/dist/assets/sqlite3-opfs-async-proxy-vVtmDGHX.js +461 -0
- package/dist/assets/sqlite3-worker1-bundler-friendly-DLarOZDL.js +9405 -0
- package/dist/assets/src-jviYSG25.js +55454 -0
- package/dist/assets/sso.store-DyApJwhx.js +139 -0
- package/dist/assets/style-E3CrYFV8.css +111829 -0
- package/dist/assets/table-we1DjFMV.js +3944 -0
- package/dist/assets/templateActions-bEDSARw2.js +65 -0
- package/dist/assets/templateTransforms-BHWiRbtR.js +43 -0
- package/dist/assets/truncate-C0KYt7i3.js +4176 -0
- package/dist/assets/typescript.worker-CYqLvLHh.js +152048 -0
- package/dist/assets/uniqBy-xDyuCRP0.js +10 -0
- package/dist/assets/usage.store-CU5J_nGm.js +100 -0
- package/dist/assets/useActions-B1JckIRj.js +255 -0
- package/dist/assets/useBeforeUnload-DiDkvI8p.js +40 -0
- package/dist/assets/useCanvasMapping-BXT7rGhC.js +12570 -0
- package/dist/assets/useCanvasOperations-8ULLtMkY.js +1765 -0
- package/dist/assets/useClipboard-DvjhVHqJ.js +39 -0
- package/dist/assets/useCommandBar-C4tLJbKt.js +2425 -0
- package/dist/assets/useCredentialResolvers-BKeFGJnY.js +78 -0
- package/dist/assets/useCustomAgent-DpILEt5e.js +471 -0
- package/dist/assets/useDebounce-Br5_1ug-.js +147 -0
- package/dist/assets/useExecutionData-M5iKsX6z.js +23 -0
- package/dist/assets/useExecutionDebugging-8azMzbnd.js +191 -0
- package/dist/assets/useExecutionHelpers-BgRRhpBM.js +91 -0
- package/dist/assets/useImportCurlCommand-CKiEmX5P.js +8891 -0
- package/dist/assets/useIntersectionObserver-BWMwOueh.js +33 -0
- package/dist/assets/useKeybindings-B2jfN6rd.js +62 -0
- package/dist/assets/useLogsTreeExpand-sZViUfdM.js +843 -0
- package/dist/assets/useMcp-DoMOIfqT.js +27 -0
- package/dist/assets/usePageRedirectionHelper-DjkznpX6.js +51 -0
- package/dist/assets/usePinnedData-BhZkqttf.js +203 -0
- package/dist/assets/usePushConnection-DMS-F_IW.js +513 -0
- package/dist/assets/useRecentResources-BVORr7eM.js +118 -0
- package/dist/assets/useRunWorkflow-LO7ffLp9.js +950 -0
- package/dist/assets/useSettingsItems-BhZXwMZn.js +144 -0
- package/dist/assets/useTelemetryContext-V6bv4YRq.js +34 -0
- package/dist/assets/useWorkflowActivate-DeSmDXjI.js +152 -0
- package/dist/assets/useWorkflowsCache-DtcEEAIR.js +179 -0
- package/dist/assets/userRoleProvisioning.store-kkSIdeTo.js +33 -0
- package/dist/assets/utils-DI7dLldp.js +54 -0
- package/dist/assets/versions.store-B1z2OrLE.js +191 -0
- package/dist/assets/vue-CydWIhxN.js +4378 -0
- package/dist/assets/vue-json-pretty-CsGX66mG.js +1130 -0
- package/dist/assets/vue.runtime.esm-bundler-tP5dCd7J.js +7325 -0
- package/dist/assets/xml-B_oj6Mle.js +2060 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.html +157 -0
- package/dist/static/base-path.js +1 -0
- package/dist/static/community_package_tooltip_img.png +0 -0
- package/dist/static/data-mapping-gif.gif +0 -0
- package/dist/static/form-grey.svg +1 -0
- package/dist/static/google-auth/disabled.dark.png +0 -0
- package/dist/static/google-auth/disabled.png +0 -0
- package/dist/static/google-auth/focus.dark.png +0 -0
- package/dist/static/google-auth/focus.png +0 -0
- package/dist/static/google-auth/normal.dark.png +0 -0
- package/dist/static/google-auth/normal.png +0 -0
- package/dist/static/google-auth/pressed.dark.png +0 -0
- package/dist/static/google-auth/pressed.png +0 -0
- package/dist/static/n8n-logo.png +0 -0
- package/dist/static/og_image.png +0 -0
- package/dist/static/open-ai.svg +1 -0
- package/dist/static/openChat.png +0 -0
- package/dist/static/posthog.init.js +41 -0
- package/dist/static/prefers-color-scheme.css +5 -0
- package/dist/static/webhook-icon.svg +1 -0
- package/dist/tree-sitter-bash.wasm +0 -0
- package/dist/tree-sitter.wasm +0 -0
- package/eslint.config.mjs +59 -0
- package/index.html +45 -0
- package/index.js +0 -0
- package/package.json +147 -0
- package/postcss.config.cjs +6 -0
- package/scripts/fetch-node-popularity.mjs +102 -0
- package/stylelint.config.mjs +9 -0
- package/tailwind.config.js +8 -0
- package/tsconfig.json +36 -0
- package/vite/i18n-locales-hmr-helpers.ts +19 -0
- package/vite/source-map-js-shim.ts +1 -0
- package/vite/vite-plugin-node-popularity.mts +32 -0
- package/vite.config.mts +304 -0
|
@@ -0,0 +1,2402 @@
|
|
|
1
|
+
import { o as __toESM } from "./chunk-6z4oVpB-.js";
|
|
2
|
+
import { C as computed, Cn as toDisplayString, Ct as withScopeId, D as createElementBlock, E as createCommentVNode, G as nextTick, Gt as unref, I as guardReactiveProps, It as ref, L as h, Lt as shallowReactive, M as createVNode, Mt as markRaw, P as defineComponent, T as createBlock, W as mergeProps, _ as Fragment, _t as watch, at as renderSlot, bn as normalizeStyle, bt as withCtx, ct as resolveDynamicComponent, et as openBlock, h as withModifiers, it as renderList, j as createTextVNode, l as useCssVars, lt as toHandlers, ot as resolveComponent, pt as useSlots, rt as pushScopeId, st as resolveDirective, tt as popScopeId, vn as normalizeClass, w as createBaseVNode, xt as withDirectives, yn as normalizeProps } from "./vue.runtime.esm-bundler-tP5dCd7J.js";
|
|
3
|
+
import { it as I18nT, rt as useI18n, t as computedAsync } from "./core-CRbPymLT.js";
|
|
4
|
+
import { Cn as N8nIcon_default, bn as N8nText_default, ht as N8nTooltip_default, mt as N8nLink_default, xn as N8nButton_default } from "./src-jviYSG25.js";
|
|
5
|
+
import { t as __plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BwBpWJRZ.js";
|
|
6
|
+
import { Cn as useFlattenSchema, Hi as isEmpty, Kn as useNodeHelpers, N as useNDVStore, P as useWorkflowsStore, Pt as useNodeTypesStore, Qi as nodeViewEventBus, Sn as useDataSchema, Wn as environments_store_default, aa as useUIStore, di as executionDataToJson, h as useMessage, k as useTelemetry, ms as useSettingsStore, qn as injectWorkflowState, x as useExternalHooks, y as useToast, yn as generateCodeForPrompt } from "./builder.store-Czk2ipDE.js";
|
|
7
|
+
import { v as useRouter } from "./get-BcEmeOxn.js";
|
|
8
|
+
import { Ha as DateTime, Ja as AI_TRANSFORM_JS_CODE, N as PLACEHOLDER_FILLED_AT_EXECUTION_TIME, S as SCHEMA_PREVIEW_DOCS_URL, Tn as MANUAL_TRIGGER_NODE_TYPE, Ua as NodeConnectionTypes, Xo as FROM_AI_PARAMETERS_MODAL_KEY, Ya as AI_TRANSFORM_NODE_TYPE, ai as require_pick, hr as WEBHOOK_NODE_TYPE, qa as AI_TRANSFORM_CODE_GENERATED_FOR_PROMPT, rs as MODAL_CONFIRM, un as FORM_TRIGGER_NODE_TYPE, wi as createResultError, xo as ApplicationError, yc as EnterpriseEditionFeature, zt as CHAT_TRIGGER_NODE_TYPE } from "./constants-C8OH4tTq.js";
|
|
9
|
+
import { r as useRootStore } from "./_baseOrderBy-N8Be_6z6.js";
|
|
10
|
+
import { t as useRunWorkflow } from "./useRunWorkflow-LO7ffLp9.js";
|
|
11
|
+
import { t as usePinnedData } from "./usePinnedData-BhZkqttf.js";
|
|
12
|
+
import { t as NodeIcon_default } from "./NodeIcon-B9VW6tX6.js";
|
|
13
|
+
import { i as Ln, o as gu, r as estree_exports, t as NDVEmptyState_default } from "./NDVEmptyState-33UoX00I.js";
|
|
14
|
+
import { t as Draggable_default } from "./Draggable-vfvXl9Sp.js";
|
|
15
|
+
import { t as TextWithHighlights_default } from "./TextWithHighlights-BxumwGnv.js";
|
|
16
|
+
import { n as MappingPill_default, t as useTelemetryContext } from "./useTelemetryContext-V6bv4YRq.js";
|
|
17
|
+
import { t as useSchemaPreviewStore } from "./schemaPreview.store-DUgN1yVE.js";
|
|
18
|
+
import { a as needsAgentInput } from "./nodeTransforms-RzcOM0v2.js";
|
|
19
|
+
var _hoisted_1$3 = { class: "schema-header-wrapper" };
|
|
20
|
+
var _hoisted_2$2 = {
|
|
21
|
+
class: "schema-header",
|
|
22
|
+
"data-test-id": "run-data-schema-header"
|
|
23
|
+
};
|
|
24
|
+
var _hoisted_3 = { class: "title" };
|
|
25
|
+
var _hoisted_4 = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "info"
|
|
28
|
+
};
|
|
29
|
+
var _hoisted_5 = {
|
|
30
|
+
key: 2,
|
|
31
|
+
class: "extra-info",
|
|
32
|
+
"data-test-id": "run-data-schema-node-item-count"
|
|
33
|
+
};
|
|
34
|
+
var _hoisted_6 = {
|
|
35
|
+
key: 3,
|
|
36
|
+
class: "extra-info"
|
|
37
|
+
};
|
|
38
|
+
var VirtualSchemaHeader_default = /* @__PURE__ */ __plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
39
|
+
__name: "VirtualSchemaHeader",
|
|
40
|
+
props: {
|
|
41
|
+
title: {},
|
|
42
|
+
collapsable: { type: Boolean },
|
|
43
|
+
collapsed: { type: Boolean },
|
|
44
|
+
itemCount: {},
|
|
45
|
+
info: {},
|
|
46
|
+
nodeType: {},
|
|
47
|
+
preview: { type: Boolean },
|
|
48
|
+
lastSuccessfulPreview: { type: Boolean }
|
|
49
|
+
},
|
|
50
|
+
emits: ["click:toggle", "execute"],
|
|
51
|
+
setup(__props, { emit: __emit }) {
|
|
52
|
+
const props$1 = __props;
|
|
53
|
+
const i18n = useI18n();
|
|
54
|
+
const isTrigger = computed(() => Boolean(props$1.nodeType?.group.includes("trigger")));
|
|
55
|
+
const emit = __emit;
|
|
56
|
+
return (_ctx, _cache) => {
|
|
57
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [createBaseVNode("div", _hoisted_2$2, [
|
|
58
|
+
createBaseVNode("div", {
|
|
59
|
+
class: "toggle",
|
|
60
|
+
onClickCapture: _cache[0] || (_cache[0] = withModifiers(($event) => emit("click:toggle"), ["stop"]))
|
|
61
|
+
}, [createVNode(unref(N8nIcon_default), {
|
|
62
|
+
size: "medium",
|
|
63
|
+
icon: "chevron-down",
|
|
64
|
+
class: normalizeClass({
|
|
65
|
+
"collapse-icon": true,
|
|
66
|
+
collapsed: _ctx.collapsed
|
|
67
|
+
})
|
|
68
|
+
}, null, 8, ["class"])], 32),
|
|
69
|
+
_ctx.nodeType ? (openBlock(), createBlock(NodeIcon_default, {
|
|
70
|
+
key: 0,
|
|
71
|
+
class: normalizeClass(["icon", { "icon-trigger": isTrigger.value }]),
|
|
72
|
+
"node-type": _ctx.nodeType,
|
|
73
|
+
size: 12
|
|
74
|
+
}, null, 8, ["class", "node-type"])) : createCommentVNode("", true),
|
|
75
|
+
createBaseVNode("div", _hoisted_3, [createTextVNode(toDisplayString(_ctx.title) + " ", 1), _ctx.info ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(_ctx.info), 1)) : createCommentVNode("", true)]),
|
|
76
|
+
isTrigger.value ? (openBlock(), createBlock(unref(N8nIcon_default), {
|
|
77
|
+
key: 1,
|
|
78
|
+
class: "trigger-icon",
|
|
79
|
+
icon: "bolt-filled",
|
|
80
|
+
size: "xsmall"
|
|
81
|
+
})) : createCommentVNode("", true),
|
|
82
|
+
_ctx.itemCount && !_ctx.lastSuccessfulPreview ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(unref(i18n).baseText("ndv.output.items", { interpolate: { count: _ctx.itemCount } })), 1)) : _ctx.preview ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(unref(i18n).baseText("dataMapping.schemaView.previewNode")), 1)) : createCommentVNode("", true)
|
|
83
|
+
]), _ctx.preview && !_ctx.collapsed ? (openBlock(), createElementBlock("div", {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "notice",
|
|
86
|
+
"data-test-id": "schema-preview-warning",
|
|
87
|
+
onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
|
|
88
|
+
}, [_ctx.lastSuccessfulPreview ? (openBlock(), createBlock(unref(I18nT), {
|
|
89
|
+
key: 0,
|
|
90
|
+
keypath: "dataMapping.schemaView.previewLastExecution",
|
|
91
|
+
scope: "global"
|
|
92
|
+
}, {
|
|
93
|
+
execute: withCtx(() => [createVNode(unref(N8nLink_default), {
|
|
94
|
+
onClick: _cache[1] || (_cache[1] = () => emit("execute", _ctx.title)),
|
|
95
|
+
size: "small",
|
|
96
|
+
bold: ""
|
|
97
|
+
}, {
|
|
98
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(i18n).baseText("dataMapping.schemaView.previewLastExecution.executePreviousNodes")), 1)]),
|
|
99
|
+
_: 1
|
|
100
|
+
})]),
|
|
101
|
+
_: 1
|
|
102
|
+
})) : (openBlock(), createBlock(unref(I18nT), {
|
|
103
|
+
key: 1,
|
|
104
|
+
keypath: "dataMapping.schemaView.preview",
|
|
105
|
+
scope: "global"
|
|
106
|
+
}, {
|
|
107
|
+
execute: withCtx(() => [createVNode(unref(N8nLink_default), {
|
|
108
|
+
onClick: _cache[2] || (_cache[2] = () => emit("execute", _ctx.title)),
|
|
109
|
+
size: "small",
|
|
110
|
+
bold: ""
|
|
111
|
+
}, {
|
|
112
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(i18n).baseText("dataMapping.schemaView.preview.executeNode")), 1)]),
|
|
113
|
+
_: 1
|
|
114
|
+
})]),
|
|
115
|
+
link: withCtx(() => [createVNode(unref(N8nLink_default), {
|
|
116
|
+
to: unref(SCHEMA_PREVIEW_DOCS_URL),
|
|
117
|
+
size: "small",
|
|
118
|
+
bold: ""
|
|
119
|
+
}, {
|
|
120
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(i18n).baseText("generic.learnMore")), 1)]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["to"])]),
|
|
123
|
+
_: 1
|
|
124
|
+
}))])) : createCommentVNode("", true)]);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}), [["__scopeId", "data-v-81c3a2d5"]]);
|
|
128
|
+
var _hoisted_1$2 = { class: "toggle-container" };
|
|
129
|
+
var _hoisted_2$1 = [
|
|
130
|
+
"data-name",
|
|
131
|
+
"data-path",
|
|
132
|
+
"data-depth",
|
|
133
|
+
"data-nest-level",
|
|
134
|
+
"data-value",
|
|
135
|
+
"data-node-type",
|
|
136
|
+
"data-target",
|
|
137
|
+
"data-node-name",
|
|
138
|
+
"data-run-index"
|
|
139
|
+
];
|
|
140
|
+
var VirtualSchemaItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
141
|
+
__name: "VirtualSchemaItem",
|
|
142
|
+
props: {
|
|
143
|
+
title: {},
|
|
144
|
+
path: {},
|
|
145
|
+
level: {},
|
|
146
|
+
depth: {},
|
|
147
|
+
expression: {},
|
|
148
|
+
value: {},
|
|
149
|
+
id: {},
|
|
150
|
+
icon: {},
|
|
151
|
+
collapsable: { type: Boolean },
|
|
152
|
+
nodeName: {},
|
|
153
|
+
nodeType: {},
|
|
154
|
+
highlight: { type: Boolean },
|
|
155
|
+
draggable: { type: Boolean },
|
|
156
|
+
collapsed: { type: Boolean },
|
|
157
|
+
search: {},
|
|
158
|
+
preview: { type: Boolean },
|
|
159
|
+
locked: { type: Boolean },
|
|
160
|
+
lockedTooltip: {},
|
|
161
|
+
runIndex: {}
|
|
162
|
+
},
|
|
163
|
+
emits: ["click"],
|
|
164
|
+
setup(__props, { emit: __emit }) {
|
|
165
|
+
useCssVars((_ctx) => ({ "8de62a40": _ctx.level }));
|
|
166
|
+
const props$1 = __props;
|
|
167
|
+
const emit = __emit;
|
|
168
|
+
return (_ctx, _cache) => {
|
|
169
|
+
const _directive_n8n_html = resolveDirective("n8n-html");
|
|
170
|
+
return openBlock(), createElementBlock("div", {
|
|
171
|
+
class: normalizeClass(["schema-item", { draggable: _ctx.draggable }]),
|
|
172
|
+
"data-test-id": "run-data-schema-item"
|
|
173
|
+
}, [
|
|
174
|
+
createBaseVNode("div", _hoisted_1$2, [_ctx.collapsable ? (openBlock(), createElementBlock("div", {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: "toggle",
|
|
177
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click"))
|
|
178
|
+
}, [createVNode(unref(N8nIcon_default), {
|
|
179
|
+
icon: "chevron-down",
|
|
180
|
+
class: normalizeClass({
|
|
181
|
+
"collapse-icon": true,
|
|
182
|
+
collapsed: _ctx.collapsed
|
|
183
|
+
})
|
|
184
|
+
}, null, 8, ["class"])])) : createCommentVNode("", true)]),
|
|
185
|
+
_ctx.title ? (openBlock(), createElementBlock("div", {
|
|
186
|
+
key: 0,
|
|
187
|
+
"data-name": _ctx.title,
|
|
188
|
+
"data-path": _ctx.path,
|
|
189
|
+
"data-depth": _ctx.depth,
|
|
190
|
+
"data-nest-level": _ctx.level,
|
|
191
|
+
"data-value": _ctx.expression,
|
|
192
|
+
"data-node-type": _ctx.nodeType,
|
|
193
|
+
"data-target": !_ctx.locked && "mappable",
|
|
194
|
+
"data-node-name": _ctx.nodeName,
|
|
195
|
+
"data-run-index": _ctx.runIndex,
|
|
196
|
+
class: normalizeClass(["pill", {
|
|
197
|
+
"pill--highlight": _ctx.highlight,
|
|
198
|
+
"pill--preview": _ctx.preview,
|
|
199
|
+
"pill--locked": _ctx.locked
|
|
200
|
+
}]),
|
|
201
|
+
"data-test-id": "run-data-schema-node-name"
|
|
202
|
+
}, [createVNode(unref(N8nIcon_default), {
|
|
203
|
+
class: "type-icon",
|
|
204
|
+
icon: _ctx.icon,
|
|
205
|
+
size: "small"
|
|
206
|
+
}, null, 8, ["icon"]), createVNode(TextWithHighlights_default, {
|
|
207
|
+
class: "title",
|
|
208
|
+
content: _ctx.title,
|
|
209
|
+
search: props$1.search
|
|
210
|
+
}, null, 8, ["content", "search"])], 10, _hoisted_2$1)) : createCommentVNode("", true),
|
|
211
|
+
_ctx.locked ? (openBlock(), createBlock(unref(N8nTooltip_default), {
|
|
212
|
+
key: 1,
|
|
213
|
+
disabled: !_ctx.lockedTooltip,
|
|
214
|
+
"popper-class": _ctx.$style.tooltip
|
|
215
|
+
}, {
|
|
216
|
+
content: withCtx(() => [withDirectives(createBaseVNode("span", null, null, 512), [[_directive_n8n_html, _ctx.lockedTooltip]])]),
|
|
217
|
+
default: withCtx(() => [createVNode(unref(N8nIcon_default), {
|
|
218
|
+
class: "locked-icon",
|
|
219
|
+
icon: "lock",
|
|
220
|
+
size: "small"
|
|
221
|
+
})]),
|
|
222
|
+
_: 1
|
|
223
|
+
}, 8, ["disabled", "popper-class"])) : createCommentVNode("", true),
|
|
224
|
+
createVNode(TextWithHighlights_default, {
|
|
225
|
+
"data-test-id": "run-data-schema-item-value",
|
|
226
|
+
class: "text",
|
|
227
|
+
content: _ctx.value,
|
|
228
|
+
search: props$1.search
|
|
229
|
+
}, null, 8, ["content", "search"])
|
|
230
|
+
], 2);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
var VirtualSchemaItem_vue_vue_type_style_index_1_lang_module_default = { tooltip: "_tooltip_1e5yq_2" };
|
|
235
|
+
var VirtualSchemaItem_default = /* @__PURE__ */ __plugin_vue_export_helper_default(VirtualSchemaItem_vue_vue_type_script_setup_true_lang_default, [["__cssModules", { "$style": VirtualSchemaItem_vue_vue_type_style_index_1_lang_module_default }], ["__scopeId", "data-v-6a0fee4a"]]);
|
|
236
|
+
function getInternetExplorerVersion() {
|
|
237
|
+
var ua = window.navigator.userAgent;
|
|
238
|
+
var msie = ua.indexOf("MSIE ");
|
|
239
|
+
if (msie > 0) return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)), 10);
|
|
240
|
+
if (ua.indexOf("Trident/") > 0) {
|
|
241
|
+
var rv = ua.indexOf("rv:");
|
|
242
|
+
return parseInt(ua.substring(rv + 3, ua.indexOf(".", rv)), 10);
|
|
243
|
+
}
|
|
244
|
+
var edge = ua.indexOf("Edge/");
|
|
245
|
+
if (edge > 0) return parseInt(ua.substring(edge + 5, ua.indexOf(".", edge)), 10);
|
|
246
|
+
return -1;
|
|
247
|
+
}
|
|
248
|
+
var isIE;
|
|
249
|
+
function initCompat() {
|
|
250
|
+
if (!initCompat.init) {
|
|
251
|
+
initCompat.init = true;
|
|
252
|
+
isIE = getInternetExplorerVersion() !== -1;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
var script$2 = {
|
|
256
|
+
name: "ResizeObserver",
|
|
257
|
+
props: {
|
|
258
|
+
emitOnMount: {
|
|
259
|
+
type: Boolean,
|
|
260
|
+
default: false
|
|
261
|
+
},
|
|
262
|
+
ignoreWidth: {
|
|
263
|
+
type: Boolean,
|
|
264
|
+
default: false
|
|
265
|
+
},
|
|
266
|
+
ignoreHeight: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
default: false
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
emits: ["notify"],
|
|
272
|
+
mounted() {
|
|
273
|
+
initCompat();
|
|
274
|
+
nextTick(() => {
|
|
275
|
+
this._w = this.$el.offsetWidth;
|
|
276
|
+
this._h = this.$el.offsetHeight;
|
|
277
|
+
if (this.emitOnMount) this.emitSize();
|
|
278
|
+
});
|
|
279
|
+
const object = document.createElement("object");
|
|
280
|
+
this._resizeObject = object;
|
|
281
|
+
object.setAttribute("aria-hidden", "true");
|
|
282
|
+
object.setAttribute("tabindex", -1);
|
|
283
|
+
object.onload = this.addResizeHandlers;
|
|
284
|
+
object.type = "text/html";
|
|
285
|
+
if (isIE) this.$el.appendChild(object);
|
|
286
|
+
object.data = "about:blank";
|
|
287
|
+
if (!isIE) this.$el.appendChild(object);
|
|
288
|
+
},
|
|
289
|
+
beforeUnmount() {
|
|
290
|
+
this.removeResizeHandlers();
|
|
291
|
+
},
|
|
292
|
+
methods: {
|
|
293
|
+
compareAndNotify() {
|
|
294
|
+
if (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) {
|
|
295
|
+
this._w = this.$el.offsetWidth;
|
|
296
|
+
this._h = this.$el.offsetHeight;
|
|
297
|
+
this.emitSize();
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
emitSize() {
|
|
301
|
+
this.$emit("notify", {
|
|
302
|
+
width: this._w,
|
|
303
|
+
height: this._h
|
|
304
|
+
});
|
|
305
|
+
},
|
|
306
|
+
addResizeHandlers() {
|
|
307
|
+
this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify);
|
|
308
|
+
this.compareAndNotify();
|
|
309
|
+
},
|
|
310
|
+
removeResizeHandlers() {
|
|
311
|
+
if (this._resizeObject && this._resizeObject.onload) {
|
|
312
|
+
if (!isIE && this._resizeObject.contentDocument) this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify);
|
|
313
|
+
this.$el.removeChild(this._resizeObject);
|
|
314
|
+
this._resizeObject.onload = null;
|
|
315
|
+
this._resizeObject = null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
var _withId = /* @__PURE__ */ withScopeId("data-v-b329ee4c");
|
|
321
|
+
pushScopeId("data-v-b329ee4c");
|
|
322
|
+
var _hoisted_1$1 = {
|
|
323
|
+
class: "resize-observer",
|
|
324
|
+
tabindex: "-1"
|
|
325
|
+
};
|
|
326
|
+
popScopeId();
|
|
327
|
+
script$2.render = /* @__PURE__ */ _withId((_ctx, _cache, $props, $setup, $data, $options) => {
|
|
328
|
+
return openBlock(), createBlock("div", _hoisted_1$1);
|
|
329
|
+
});
|
|
330
|
+
script$2.__scopeId = "data-v-b329ee4c";
|
|
331
|
+
script$2.__file = "src/components/ResizeObserver.vue";
|
|
332
|
+
function _typeof$1(obj) {
|
|
333
|
+
"@babel/helpers - typeof";
|
|
334
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof$1 = function(obj$1) {
|
|
335
|
+
return typeof obj$1;
|
|
336
|
+
};
|
|
337
|
+
else _typeof$1 = function(obj$1) {
|
|
338
|
+
return obj$1 && typeof Symbol === "function" && obj$1.constructor === Symbol && obj$1 !== Symbol.prototype ? "symbol" : typeof obj$1;
|
|
339
|
+
};
|
|
340
|
+
return _typeof$1(obj);
|
|
341
|
+
}
|
|
342
|
+
function _classCallCheck(instance, Constructor) {
|
|
343
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
344
|
+
}
|
|
345
|
+
function _defineProperties(target, props$1) {
|
|
346
|
+
for (var i = 0; i < props$1.length; i++) {
|
|
347
|
+
var descriptor = props$1[i];
|
|
348
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
349
|
+
descriptor.configurable = true;
|
|
350
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
351
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
355
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
356
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
357
|
+
return Constructor;
|
|
358
|
+
}
|
|
359
|
+
function _toConsumableArray(arr) {
|
|
360
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
361
|
+
}
|
|
362
|
+
function _arrayWithoutHoles(arr) {
|
|
363
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
364
|
+
}
|
|
365
|
+
function _iterableToArray(iter) {
|
|
366
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
367
|
+
}
|
|
368
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
369
|
+
if (!o) return;
|
|
370
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
371
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
372
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
373
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
374
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
375
|
+
}
|
|
376
|
+
function _arrayLikeToArray(arr, len) {
|
|
377
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
378
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
379
|
+
return arr2;
|
|
380
|
+
}
|
|
381
|
+
function _nonIterableSpread() {
|
|
382
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
383
|
+
}
|
|
384
|
+
function processOptions(value) {
|
|
385
|
+
var options;
|
|
386
|
+
if (typeof value === "function") options = { callback: value };
|
|
387
|
+
else options = value;
|
|
388
|
+
return options;
|
|
389
|
+
}
|
|
390
|
+
function throttle(callback, delay) {
|
|
391
|
+
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
392
|
+
var timeout;
|
|
393
|
+
var lastState;
|
|
394
|
+
var currentArgs;
|
|
395
|
+
var throttled = function throttled$1(state) {
|
|
396
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
|
|
397
|
+
currentArgs = args;
|
|
398
|
+
if (timeout && state === lastState) return;
|
|
399
|
+
var leading = options.leading;
|
|
400
|
+
if (typeof leading === "function") leading = leading(state, lastState);
|
|
401
|
+
if ((!timeout || state !== lastState) && leading) callback.apply(void 0, [state].concat(_toConsumableArray(currentArgs)));
|
|
402
|
+
lastState = state;
|
|
403
|
+
clearTimeout(timeout);
|
|
404
|
+
timeout = setTimeout(function() {
|
|
405
|
+
callback.apply(void 0, [state].concat(_toConsumableArray(currentArgs)));
|
|
406
|
+
timeout = 0;
|
|
407
|
+
}, delay);
|
|
408
|
+
};
|
|
409
|
+
throttled._clear = function() {
|
|
410
|
+
clearTimeout(timeout);
|
|
411
|
+
timeout = null;
|
|
412
|
+
};
|
|
413
|
+
return throttled;
|
|
414
|
+
}
|
|
415
|
+
function deepEqual(val1, val2) {
|
|
416
|
+
if (val1 === val2) return true;
|
|
417
|
+
if (_typeof$1(val1) === "object") {
|
|
418
|
+
for (var key in val1) if (!deepEqual(val1[key], val2[key])) return false;
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
var VisibilityState = /* @__PURE__ */ function() {
|
|
424
|
+
function VisibilityState$1(el, options, vnode) {
|
|
425
|
+
_classCallCheck(this, VisibilityState$1);
|
|
426
|
+
this.el = el;
|
|
427
|
+
this.observer = null;
|
|
428
|
+
this.frozen = false;
|
|
429
|
+
this.createObserver(options, vnode);
|
|
430
|
+
}
|
|
431
|
+
_createClass(VisibilityState$1, [
|
|
432
|
+
{
|
|
433
|
+
key: "createObserver",
|
|
434
|
+
value: function createObserver(options, vnode) {
|
|
435
|
+
var _this = this;
|
|
436
|
+
if (this.observer) this.destroyObserver();
|
|
437
|
+
if (this.frozen) return;
|
|
438
|
+
this.options = processOptions(options);
|
|
439
|
+
this.callback = function(result, entry) {
|
|
440
|
+
_this.options.callback(result, entry);
|
|
441
|
+
if (result && _this.options.once) {
|
|
442
|
+
_this.frozen = true;
|
|
443
|
+
_this.destroyObserver();
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
if (this.callback && this.options.throttle) {
|
|
447
|
+
var _leading = (this.options.throttleOptions || {}).leading;
|
|
448
|
+
this.callback = throttle(this.callback, this.options.throttle, { leading: function leading(state) {
|
|
449
|
+
return _leading === "both" || _leading === "visible" && state || _leading === "hidden" && !state;
|
|
450
|
+
} });
|
|
451
|
+
}
|
|
452
|
+
this.oldResult = void 0;
|
|
453
|
+
this.observer = new IntersectionObserver(function(entries) {
|
|
454
|
+
var entry = entries[0];
|
|
455
|
+
if (entries.length > 1) {
|
|
456
|
+
var intersectingEntry = entries.find(function(e) {
|
|
457
|
+
return e.isIntersecting;
|
|
458
|
+
});
|
|
459
|
+
if (intersectingEntry) entry = intersectingEntry;
|
|
460
|
+
}
|
|
461
|
+
if (_this.callback) {
|
|
462
|
+
var result = entry.isIntersecting && entry.intersectionRatio >= _this.threshold;
|
|
463
|
+
if (result === _this.oldResult) return;
|
|
464
|
+
_this.oldResult = result;
|
|
465
|
+
_this.callback(result, entry);
|
|
466
|
+
}
|
|
467
|
+
}, this.options.intersection);
|
|
468
|
+
nextTick(function() {
|
|
469
|
+
if (_this.observer) _this.observer.observe(_this.el);
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
key: "destroyObserver",
|
|
475
|
+
value: function destroyObserver() {
|
|
476
|
+
if (this.observer) {
|
|
477
|
+
this.observer.disconnect();
|
|
478
|
+
this.observer = null;
|
|
479
|
+
}
|
|
480
|
+
if (this.callback && this.callback._clear) {
|
|
481
|
+
this.callback._clear();
|
|
482
|
+
this.callback = null;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
key: "threshold",
|
|
488
|
+
get: function get() {
|
|
489
|
+
return this.options.intersection && typeof this.options.intersection.threshold === "number" ? this.options.intersection.threshold : 0;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
]);
|
|
493
|
+
return VisibilityState$1;
|
|
494
|
+
}();
|
|
495
|
+
function beforeMount(el, _ref2, vnode) {
|
|
496
|
+
var value = _ref2.value;
|
|
497
|
+
if (!value) return;
|
|
498
|
+
if (typeof IntersectionObserver === "undefined") console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");
|
|
499
|
+
else el._vue_visibilityState = new VisibilityState(el, value, vnode);
|
|
500
|
+
}
|
|
501
|
+
function updated(el, _ref3, vnode) {
|
|
502
|
+
var value = _ref3.value, oldValue = _ref3.oldValue;
|
|
503
|
+
if (deepEqual(value, oldValue)) return;
|
|
504
|
+
var state = el._vue_visibilityState;
|
|
505
|
+
if (!value) {
|
|
506
|
+
unmounted(el);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (state) state.createObserver(value, vnode);
|
|
510
|
+
else beforeMount(el, { value }, vnode);
|
|
511
|
+
}
|
|
512
|
+
function unmounted(el) {
|
|
513
|
+
var state = el._vue_visibilityState;
|
|
514
|
+
if (state) {
|
|
515
|
+
state.destroyObserver();
|
|
516
|
+
delete el._vue_visibilityState;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
var ObserveVisibility = {
|
|
520
|
+
beforeMount,
|
|
521
|
+
updated,
|
|
522
|
+
unmounted
|
|
523
|
+
};
|
|
524
|
+
function mitt_es_default(n) {
|
|
525
|
+
return {
|
|
526
|
+
all: n = n || /* @__PURE__ */ new Map(),
|
|
527
|
+
on: function(t, e) {
|
|
528
|
+
var i = n.get(t);
|
|
529
|
+
i && i.push(e) || n.set(t, [e]);
|
|
530
|
+
},
|
|
531
|
+
off: function(t, e) {
|
|
532
|
+
var i = n.get(t);
|
|
533
|
+
i && i.splice(i.indexOf(e) >>> 0, 1);
|
|
534
|
+
},
|
|
535
|
+
emit: function(t, e) {
|
|
536
|
+
(n.get(t) || []).slice().map(function(n$1) {
|
|
537
|
+
n$1(e);
|
|
538
|
+
}), (n.get("*") || []).slice().map(function(n$1) {
|
|
539
|
+
n$1(t, e);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
var config = { itemsLimit: 1e3 };
|
|
545
|
+
var regex = /(auto|scroll)/;
|
|
546
|
+
function parents(node, ps) {
|
|
547
|
+
if (node.parentNode === null) return ps;
|
|
548
|
+
return parents(node.parentNode, ps.concat([node]));
|
|
549
|
+
}
|
|
550
|
+
var style = function style$1(node, prop) {
|
|
551
|
+
return getComputedStyle(node, null).getPropertyValue(prop);
|
|
552
|
+
};
|
|
553
|
+
var overflow = function overflow$1(node) {
|
|
554
|
+
return style(node, "overflow") + style(node, "overflow-y") + style(node, "overflow-x");
|
|
555
|
+
};
|
|
556
|
+
var scroll = function scroll$1(node) {
|
|
557
|
+
return regex.test(overflow(node));
|
|
558
|
+
};
|
|
559
|
+
function getScrollParent(node) {
|
|
560
|
+
if (!(node instanceof HTMLElement || node instanceof SVGElement)) return;
|
|
561
|
+
var ps = parents(node.parentNode, []);
|
|
562
|
+
for (var i = 0; i < ps.length; i += 1) if (scroll(ps[i])) return ps[i];
|
|
563
|
+
return document.scrollingElement || document.documentElement;
|
|
564
|
+
}
|
|
565
|
+
function _typeof(obj) {
|
|
566
|
+
"@babel/helpers - typeof";
|
|
567
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj$1) {
|
|
568
|
+
return typeof obj$1;
|
|
569
|
+
} : function(obj$1) {
|
|
570
|
+
return obj$1 && "function" == typeof Symbol && obj$1.constructor === Symbol && obj$1 !== Symbol.prototype ? "symbol" : typeof obj$1;
|
|
571
|
+
}, _typeof(obj);
|
|
572
|
+
}
|
|
573
|
+
var props = {
|
|
574
|
+
items: {
|
|
575
|
+
type: Array,
|
|
576
|
+
required: true
|
|
577
|
+
},
|
|
578
|
+
keyField: {
|
|
579
|
+
type: String,
|
|
580
|
+
default: "id"
|
|
581
|
+
},
|
|
582
|
+
direction: {
|
|
583
|
+
type: String,
|
|
584
|
+
default: "vertical",
|
|
585
|
+
validator: function validator(value) {
|
|
586
|
+
return ["vertical", "horizontal"].includes(value);
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
listTag: {
|
|
590
|
+
type: String,
|
|
591
|
+
default: "div"
|
|
592
|
+
},
|
|
593
|
+
itemTag: {
|
|
594
|
+
type: String,
|
|
595
|
+
default: "div"
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
function simpleArray() {
|
|
599
|
+
return this.items.length && _typeof(this.items[0]) !== "object";
|
|
600
|
+
}
|
|
601
|
+
var supportsPassive = false;
|
|
602
|
+
if (typeof window !== "undefined") {
|
|
603
|
+
supportsPassive = false;
|
|
604
|
+
try {
|
|
605
|
+
var opts = Object.defineProperty({}, "passive", { get: function get() {
|
|
606
|
+
supportsPassive = true;
|
|
607
|
+
} });
|
|
608
|
+
window.addEventListener("test", null, opts);
|
|
609
|
+
} catch (e) {}
|
|
610
|
+
}
|
|
611
|
+
var uid = 0;
|
|
612
|
+
var script$2$1 = {
|
|
613
|
+
name: "RecycleScroller",
|
|
614
|
+
components: { ResizeObserver: script$2 },
|
|
615
|
+
directives: { ObserveVisibility },
|
|
616
|
+
props: {
|
|
617
|
+
...props,
|
|
618
|
+
itemSize: {
|
|
619
|
+
type: Number,
|
|
620
|
+
default: null
|
|
621
|
+
},
|
|
622
|
+
gridItems: {
|
|
623
|
+
type: Number,
|
|
624
|
+
default: void 0
|
|
625
|
+
},
|
|
626
|
+
itemSecondarySize: {
|
|
627
|
+
type: Number,
|
|
628
|
+
default: void 0
|
|
629
|
+
},
|
|
630
|
+
minItemSize: {
|
|
631
|
+
type: [Number, String],
|
|
632
|
+
default: null
|
|
633
|
+
},
|
|
634
|
+
sizeField: {
|
|
635
|
+
type: String,
|
|
636
|
+
default: "size"
|
|
637
|
+
},
|
|
638
|
+
typeField: {
|
|
639
|
+
type: String,
|
|
640
|
+
default: "type"
|
|
641
|
+
},
|
|
642
|
+
buffer: {
|
|
643
|
+
type: Number,
|
|
644
|
+
default: 200
|
|
645
|
+
},
|
|
646
|
+
pageMode: {
|
|
647
|
+
type: Boolean,
|
|
648
|
+
default: false
|
|
649
|
+
},
|
|
650
|
+
prerender: {
|
|
651
|
+
type: Number,
|
|
652
|
+
default: 0
|
|
653
|
+
},
|
|
654
|
+
emitUpdate: {
|
|
655
|
+
type: Boolean,
|
|
656
|
+
default: false
|
|
657
|
+
},
|
|
658
|
+
updateInterval: {
|
|
659
|
+
type: Number,
|
|
660
|
+
default: 0
|
|
661
|
+
},
|
|
662
|
+
skipHover: {
|
|
663
|
+
type: Boolean,
|
|
664
|
+
default: false
|
|
665
|
+
},
|
|
666
|
+
listTag: {
|
|
667
|
+
type: String,
|
|
668
|
+
default: "div"
|
|
669
|
+
},
|
|
670
|
+
itemTag: {
|
|
671
|
+
type: String,
|
|
672
|
+
default: "div"
|
|
673
|
+
},
|
|
674
|
+
listClass: {
|
|
675
|
+
type: [
|
|
676
|
+
String,
|
|
677
|
+
Object,
|
|
678
|
+
Array
|
|
679
|
+
],
|
|
680
|
+
default: ""
|
|
681
|
+
},
|
|
682
|
+
itemClass: {
|
|
683
|
+
type: [
|
|
684
|
+
String,
|
|
685
|
+
Object,
|
|
686
|
+
Array
|
|
687
|
+
],
|
|
688
|
+
default: ""
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
emits: [
|
|
692
|
+
"resize",
|
|
693
|
+
"visible",
|
|
694
|
+
"hidden",
|
|
695
|
+
"update",
|
|
696
|
+
"scroll-start",
|
|
697
|
+
"scroll-end"
|
|
698
|
+
],
|
|
699
|
+
data() {
|
|
700
|
+
return {
|
|
701
|
+
pool: [],
|
|
702
|
+
totalSize: 0,
|
|
703
|
+
ready: false,
|
|
704
|
+
hoverKey: null
|
|
705
|
+
};
|
|
706
|
+
},
|
|
707
|
+
computed: {
|
|
708
|
+
sizes() {
|
|
709
|
+
if (this.itemSize === null) {
|
|
710
|
+
const sizes = { "-1": { accumulator: 0 } };
|
|
711
|
+
const items = this.items;
|
|
712
|
+
const field = this.sizeField;
|
|
713
|
+
const minItemSize = this.minItemSize;
|
|
714
|
+
let computedMinSize = 1e4;
|
|
715
|
+
let accumulator = 0;
|
|
716
|
+
let current;
|
|
717
|
+
for (let i = 0, l = items.length; i < l; i++) {
|
|
718
|
+
current = items[i][field] || minItemSize;
|
|
719
|
+
if (current < computedMinSize) computedMinSize = current;
|
|
720
|
+
accumulator += current;
|
|
721
|
+
sizes[i] = {
|
|
722
|
+
accumulator,
|
|
723
|
+
size: current
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
this.$_computedMinItemSize = computedMinSize;
|
|
727
|
+
return sizes;
|
|
728
|
+
}
|
|
729
|
+
return [];
|
|
730
|
+
},
|
|
731
|
+
simpleArray,
|
|
732
|
+
itemIndexByKey() {
|
|
733
|
+
const { keyField, items } = this;
|
|
734
|
+
const result = {};
|
|
735
|
+
for (let i = 0, l = items.length; i < l; i++) result[items[i][keyField]] = i;
|
|
736
|
+
return result;
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
watch: {
|
|
740
|
+
items() {
|
|
741
|
+
this.updateVisibleItems(true);
|
|
742
|
+
},
|
|
743
|
+
pageMode() {
|
|
744
|
+
this.applyPageMode();
|
|
745
|
+
this.updateVisibleItems(false);
|
|
746
|
+
},
|
|
747
|
+
sizes: {
|
|
748
|
+
handler() {
|
|
749
|
+
this.updateVisibleItems(false);
|
|
750
|
+
},
|
|
751
|
+
deep: true
|
|
752
|
+
},
|
|
753
|
+
gridItems() {
|
|
754
|
+
this.updateVisibleItems(true);
|
|
755
|
+
},
|
|
756
|
+
itemSecondarySize() {
|
|
757
|
+
this.updateVisibleItems(true);
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
created() {
|
|
761
|
+
this.$_startIndex = 0;
|
|
762
|
+
this.$_endIndex = 0;
|
|
763
|
+
this.$_views = /* @__PURE__ */ new Map();
|
|
764
|
+
this.$_unusedViews = /* @__PURE__ */ new Map();
|
|
765
|
+
this.$_scrollDirty = false;
|
|
766
|
+
this.$_lastUpdateScrollPosition = 0;
|
|
767
|
+
if (this.prerender) {
|
|
768
|
+
this.$_prerender = true;
|
|
769
|
+
this.updateVisibleItems(false);
|
|
770
|
+
}
|
|
771
|
+
if (this.gridItems && !this.itemSize) console.error("[vue-recycle-scroller] You must provide an itemSize when using gridItems");
|
|
772
|
+
},
|
|
773
|
+
mounted() {
|
|
774
|
+
this.applyPageMode();
|
|
775
|
+
this.$nextTick(() => {
|
|
776
|
+
this.$_prerender = false;
|
|
777
|
+
this.updateVisibleItems(true);
|
|
778
|
+
this.ready = true;
|
|
779
|
+
});
|
|
780
|
+
},
|
|
781
|
+
activated() {
|
|
782
|
+
const lastPosition = this.$_lastUpdateScrollPosition;
|
|
783
|
+
if (typeof lastPosition === "number") this.$nextTick(() => {
|
|
784
|
+
this.scrollToPosition(lastPosition);
|
|
785
|
+
});
|
|
786
|
+
},
|
|
787
|
+
beforeUnmount() {
|
|
788
|
+
this.removeListeners();
|
|
789
|
+
},
|
|
790
|
+
methods: {
|
|
791
|
+
addView(pool, index, item, key, type) {
|
|
792
|
+
const view = shallowReactive({
|
|
793
|
+
item,
|
|
794
|
+
position: 0,
|
|
795
|
+
nr: markRaw({
|
|
796
|
+
id: uid++,
|
|
797
|
+
index,
|
|
798
|
+
used: true,
|
|
799
|
+
key,
|
|
800
|
+
type
|
|
801
|
+
})
|
|
802
|
+
});
|
|
803
|
+
pool.push(view);
|
|
804
|
+
return view;
|
|
805
|
+
},
|
|
806
|
+
unuseView(view, fake = false) {
|
|
807
|
+
const unusedViews = this.$_unusedViews;
|
|
808
|
+
const type = view.nr.type;
|
|
809
|
+
let unusedPool = unusedViews.get(type);
|
|
810
|
+
if (!unusedPool) {
|
|
811
|
+
unusedPool = [];
|
|
812
|
+
unusedViews.set(type, unusedPool);
|
|
813
|
+
}
|
|
814
|
+
unusedPool.push(view);
|
|
815
|
+
if (!fake) {
|
|
816
|
+
view.nr.used = false;
|
|
817
|
+
view.position = -9999;
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
handleResize() {
|
|
821
|
+
this.$emit("resize");
|
|
822
|
+
if (this.ready) this.updateVisibleItems(false);
|
|
823
|
+
},
|
|
824
|
+
handleScroll(event) {
|
|
825
|
+
if (!this.$_scrollDirty) {
|
|
826
|
+
this.$_scrollDirty = true;
|
|
827
|
+
if (this.$_updateTimeout) return;
|
|
828
|
+
const requestUpdate = () => requestAnimationFrame(() => {
|
|
829
|
+
this.$_scrollDirty = false;
|
|
830
|
+
const { continuous } = this.updateVisibleItems(false, true);
|
|
831
|
+
if (!continuous) {
|
|
832
|
+
clearTimeout(this.$_refreshTimout);
|
|
833
|
+
this.$_refreshTimout = setTimeout(this.handleScroll, this.updateInterval + 100);
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
requestUpdate();
|
|
837
|
+
if (this.updateInterval) this.$_updateTimeout = setTimeout(() => {
|
|
838
|
+
this.$_updateTimeout = 0;
|
|
839
|
+
if (this.$_scrollDirty) requestUpdate();
|
|
840
|
+
}, this.updateInterval);
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
handleVisibilityChange(isVisible, entry) {
|
|
844
|
+
if (this.ready) if (isVisible || entry.boundingClientRect.width !== 0 || entry.boundingClientRect.height !== 0) {
|
|
845
|
+
this.$emit("visible");
|
|
846
|
+
requestAnimationFrame(() => {
|
|
847
|
+
this.updateVisibleItems(false);
|
|
848
|
+
});
|
|
849
|
+
} else this.$emit("hidden");
|
|
850
|
+
},
|
|
851
|
+
updateVisibleItems(checkItem, checkPositionDiff = false) {
|
|
852
|
+
const itemSize = this.itemSize;
|
|
853
|
+
const gridItems = this.gridItems || 1;
|
|
854
|
+
const itemSecondarySize = this.itemSecondarySize || itemSize;
|
|
855
|
+
const minItemSize = this.$_computedMinItemSize;
|
|
856
|
+
const typeField = this.typeField;
|
|
857
|
+
const keyField = this.simpleArray ? null : this.keyField;
|
|
858
|
+
const items = this.items;
|
|
859
|
+
const count = items.length;
|
|
860
|
+
const sizes = this.sizes;
|
|
861
|
+
const views = this.$_views;
|
|
862
|
+
const unusedViews = this.$_unusedViews;
|
|
863
|
+
const pool = this.pool;
|
|
864
|
+
const itemIndexByKey = this.itemIndexByKey;
|
|
865
|
+
let startIndex, endIndex;
|
|
866
|
+
let totalSize;
|
|
867
|
+
let visibleStartIndex, visibleEndIndex;
|
|
868
|
+
if (!count) startIndex = endIndex = visibleStartIndex = visibleEndIndex = totalSize = 0;
|
|
869
|
+
else if (this.$_prerender) {
|
|
870
|
+
startIndex = visibleStartIndex = 0;
|
|
871
|
+
endIndex = visibleEndIndex = Math.min(this.prerender, items.length);
|
|
872
|
+
totalSize = null;
|
|
873
|
+
} else {
|
|
874
|
+
const scroll$1 = this.getScroll();
|
|
875
|
+
if (checkPositionDiff) {
|
|
876
|
+
let positionDiff = scroll$1.start - this.$_lastUpdateScrollPosition;
|
|
877
|
+
if (positionDiff < 0) positionDiff = -positionDiff;
|
|
878
|
+
if (itemSize === null && positionDiff < minItemSize || positionDiff < itemSize) return { continuous: true };
|
|
879
|
+
}
|
|
880
|
+
this.$_lastUpdateScrollPosition = scroll$1.start;
|
|
881
|
+
const buffer = this.buffer;
|
|
882
|
+
scroll$1.start -= buffer;
|
|
883
|
+
scroll$1.end += buffer;
|
|
884
|
+
let beforeSize = 0;
|
|
885
|
+
if (this.$refs.before) {
|
|
886
|
+
beforeSize = this.$refs.before.scrollHeight;
|
|
887
|
+
scroll$1.start -= beforeSize;
|
|
888
|
+
}
|
|
889
|
+
if (this.$refs.after) {
|
|
890
|
+
const afterSize = this.$refs.after.scrollHeight;
|
|
891
|
+
scroll$1.end += afterSize;
|
|
892
|
+
}
|
|
893
|
+
if (itemSize === null) {
|
|
894
|
+
let h$1;
|
|
895
|
+
let a = 0;
|
|
896
|
+
let b = count - 1;
|
|
897
|
+
let i = ~~(count / 2);
|
|
898
|
+
let oldI;
|
|
899
|
+
do {
|
|
900
|
+
oldI = i;
|
|
901
|
+
h$1 = sizes[i].accumulator;
|
|
902
|
+
if (h$1 < scroll$1.start) a = i;
|
|
903
|
+
else if (i < count - 1 && sizes[i + 1].accumulator > scroll$1.start) b = i;
|
|
904
|
+
i = ~~((a + b) / 2);
|
|
905
|
+
} while (i !== oldI);
|
|
906
|
+
i < 0 && (i = 0);
|
|
907
|
+
startIndex = i;
|
|
908
|
+
totalSize = sizes[count - 1].accumulator;
|
|
909
|
+
for (endIndex = i; endIndex < count && sizes[endIndex].accumulator < scroll$1.end; endIndex++);
|
|
910
|
+
if (endIndex === -1) endIndex = items.length - 1;
|
|
911
|
+
else {
|
|
912
|
+
endIndex++;
|
|
913
|
+
endIndex > count && (endIndex = count);
|
|
914
|
+
}
|
|
915
|
+
for (visibleStartIndex = startIndex; visibleStartIndex < count && beforeSize + sizes[visibleStartIndex].accumulator < scroll$1.start; visibleStartIndex++);
|
|
916
|
+
for (visibleEndIndex = visibleStartIndex; visibleEndIndex < count && beforeSize + sizes[visibleEndIndex].accumulator < scroll$1.end; visibleEndIndex++);
|
|
917
|
+
} else {
|
|
918
|
+
startIndex = ~~(scroll$1.start / itemSize * gridItems);
|
|
919
|
+
const remainer = startIndex % gridItems;
|
|
920
|
+
startIndex -= remainer;
|
|
921
|
+
endIndex = Math.ceil(scroll$1.end / itemSize * gridItems);
|
|
922
|
+
visibleStartIndex = Math.max(0, Math.floor((scroll$1.start - beforeSize) / itemSize * gridItems));
|
|
923
|
+
visibleEndIndex = Math.floor((scroll$1.end - beforeSize) / itemSize * gridItems);
|
|
924
|
+
startIndex < 0 && (startIndex = 0);
|
|
925
|
+
endIndex > count && (endIndex = count);
|
|
926
|
+
visibleStartIndex < 0 && (visibleStartIndex = 0);
|
|
927
|
+
visibleEndIndex > count && (visibleEndIndex = count);
|
|
928
|
+
totalSize = Math.ceil(count / gridItems) * itemSize;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
if (endIndex - startIndex > config.itemsLimit) this.itemsLimitError();
|
|
932
|
+
this.totalSize = totalSize;
|
|
933
|
+
let view;
|
|
934
|
+
const continuous = startIndex <= this.$_endIndex && endIndex >= this.$_startIndex;
|
|
935
|
+
if (continuous) for (let i = 0, l = pool.length; i < l; i++) {
|
|
936
|
+
view = pool[i];
|
|
937
|
+
if (view.nr.used) {
|
|
938
|
+
if (checkItem) view.nr.index = itemIndexByKey[view.item[keyField]];
|
|
939
|
+
if (view.nr.index == null || view.nr.index < startIndex || view.nr.index >= endIndex) this.unuseView(view);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
const unusedIndex = continuous ? null : /* @__PURE__ */ new Map();
|
|
943
|
+
let item, type;
|
|
944
|
+
let v;
|
|
945
|
+
for (let i = startIndex; i < endIndex; i++) {
|
|
946
|
+
item = items[i];
|
|
947
|
+
const key = keyField ? item[keyField] : item;
|
|
948
|
+
if (key == null) throw new Error(`Key is ${key} on item (keyField is '${keyField}')`);
|
|
949
|
+
view = views.get(key);
|
|
950
|
+
if (!itemSize && !sizes[i].size) {
|
|
951
|
+
if (view) this.unuseView(view);
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
type = item[typeField];
|
|
955
|
+
let unusedPool = unusedViews.get(type);
|
|
956
|
+
let newlyUsedView = false;
|
|
957
|
+
if (!view) {
|
|
958
|
+
if (continuous) if (unusedPool && unusedPool.length) view = unusedPool.pop();
|
|
959
|
+
else view = this.addView(pool, i, item, key, type);
|
|
960
|
+
else {
|
|
961
|
+
v = unusedIndex.get(type) || 0;
|
|
962
|
+
if (!unusedPool || v >= unusedPool.length) {
|
|
963
|
+
view = this.addView(pool, i, item, key, type);
|
|
964
|
+
this.unuseView(view, true);
|
|
965
|
+
unusedPool = unusedViews.get(type);
|
|
966
|
+
}
|
|
967
|
+
view = unusedPool[v];
|
|
968
|
+
unusedIndex.set(type, v + 1);
|
|
969
|
+
}
|
|
970
|
+
views.delete(view.nr.key);
|
|
971
|
+
view.nr.used = true;
|
|
972
|
+
view.nr.index = i;
|
|
973
|
+
view.nr.key = key;
|
|
974
|
+
view.nr.type = type;
|
|
975
|
+
views.set(key, view);
|
|
976
|
+
newlyUsedView = true;
|
|
977
|
+
} else if (!view.nr.used) {
|
|
978
|
+
view.nr.used = true;
|
|
979
|
+
newlyUsedView = true;
|
|
980
|
+
if (unusedPool) {
|
|
981
|
+
const index = unusedPool.indexOf(view);
|
|
982
|
+
if (index !== -1) unusedPool.splice(index, 1);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
view.item = item;
|
|
986
|
+
if (newlyUsedView) {
|
|
987
|
+
if (i === items.length - 1) this.$emit("scroll-end");
|
|
988
|
+
if (i === 0) this.$emit("scroll-start");
|
|
989
|
+
}
|
|
990
|
+
if (itemSize === null) {
|
|
991
|
+
view.position = sizes[i - 1].accumulator;
|
|
992
|
+
view.offset = 0;
|
|
993
|
+
} else {
|
|
994
|
+
view.position = Math.floor(i / gridItems) * itemSize;
|
|
995
|
+
view.offset = i % gridItems * itemSecondarySize;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
this.$_startIndex = startIndex;
|
|
999
|
+
this.$_endIndex = endIndex;
|
|
1000
|
+
if (this.emitUpdate) this.$emit("update", startIndex, endIndex, visibleStartIndex, visibleEndIndex);
|
|
1001
|
+
clearTimeout(this.$_sortTimer);
|
|
1002
|
+
this.$_sortTimer = setTimeout(this.sortViews, this.updateInterval + 300);
|
|
1003
|
+
return { continuous };
|
|
1004
|
+
},
|
|
1005
|
+
getListenerTarget() {
|
|
1006
|
+
let target = getScrollParent(this.$el);
|
|
1007
|
+
if (window.document && (target === window.document.documentElement || target === window.document.body)) target = window;
|
|
1008
|
+
return target;
|
|
1009
|
+
},
|
|
1010
|
+
getScroll() {
|
|
1011
|
+
const { $el: el, direction } = this;
|
|
1012
|
+
const isVertical = direction === "vertical";
|
|
1013
|
+
let scrollState;
|
|
1014
|
+
if (this.pageMode) {
|
|
1015
|
+
const bounds = el.getBoundingClientRect();
|
|
1016
|
+
const boundsSize = isVertical ? bounds.height : bounds.width;
|
|
1017
|
+
let start = -(isVertical ? bounds.top : bounds.left);
|
|
1018
|
+
let size = isVertical ? window.innerHeight : window.innerWidth;
|
|
1019
|
+
if (start < 0) {
|
|
1020
|
+
size += start;
|
|
1021
|
+
start = 0;
|
|
1022
|
+
}
|
|
1023
|
+
if (start + size > boundsSize) size = boundsSize - start;
|
|
1024
|
+
scrollState = {
|
|
1025
|
+
start,
|
|
1026
|
+
end: start + size
|
|
1027
|
+
};
|
|
1028
|
+
} else if (isVertical) scrollState = {
|
|
1029
|
+
start: el.scrollTop,
|
|
1030
|
+
end: el.scrollTop + el.clientHeight
|
|
1031
|
+
};
|
|
1032
|
+
else scrollState = {
|
|
1033
|
+
start: el.scrollLeft,
|
|
1034
|
+
end: el.scrollLeft + el.clientWidth
|
|
1035
|
+
};
|
|
1036
|
+
return scrollState;
|
|
1037
|
+
},
|
|
1038
|
+
applyPageMode() {
|
|
1039
|
+
if (this.pageMode) this.addListeners();
|
|
1040
|
+
else this.removeListeners();
|
|
1041
|
+
},
|
|
1042
|
+
addListeners() {
|
|
1043
|
+
this.listenerTarget = this.getListenerTarget();
|
|
1044
|
+
this.listenerTarget.addEventListener("scroll", this.handleScroll, supportsPassive ? { passive: true } : false);
|
|
1045
|
+
this.listenerTarget.addEventListener("resize", this.handleResize);
|
|
1046
|
+
},
|
|
1047
|
+
removeListeners() {
|
|
1048
|
+
if (!this.listenerTarget) return;
|
|
1049
|
+
this.listenerTarget.removeEventListener("scroll", this.handleScroll);
|
|
1050
|
+
this.listenerTarget.removeEventListener("resize", this.handleResize);
|
|
1051
|
+
this.listenerTarget = null;
|
|
1052
|
+
},
|
|
1053
|
+
scrollToItem(index) {
|
|
1054
|
+
let scroll$1;
|
|
1055
|
+
const gridItems = this.gridItems || 1;
|
|
1056
|
+
if (this.itemSize === null) scroll$1 = index > 0 ? this.sizes[index - 1].accumulator : 0;
|
|
1057
|
+
else scroll$1 = Math.floor(index / gridItems) * this.itemSize;
|
|
1058
|
+
this.scrollToPosition(scroll$1);
|
|
1059
|
+
},
|
|
1060
|
+
scrollToPosition(position) {
|
|
1061
|
+
const direction = this.direction === "vertical" ? {
|
|
1062
|
+
scroll: "scrollTop",
|
|
1063
|
+
start: "top"
|
|
1064
|
+
} : {
|
|
1065
|
+
scroll: "scrollLeft",
|
|
1066
|
+
start: "left"
|
|
1067
|
+
};
|
|
1068
|
+
let viewport;
|
|
1069
|
+
let scrollDirection;
|
|
1070
|
+
let scrollDistance;
|
|
1071
|
+
if (this.pageMode) {
|
|
1072
|
+
const viewportEl = getScrollParent(this.$el);
|
|
1073
|
+
const scrollTop = viewportEl.tagName === "HTML" ? 0 : viewportEl[direction.scroll];
|
|
1074
|
+
const bounds = viewportEl.getBoundingClientRect();
|
|
1075
|
+
const scrollerPosition = this.$el.getBoundingClientRect()[direction.start] - bounds[direction.start];
|
|
1076
|
+
viewport = viewportEl;
|
|
1077
|
+
scrollDirection = direction.scroll;
|
|
1078
|
+
scrollDistance = position + scrollTop + scrollerPosition;
|
|
1079
|
+
} else {
|
|
1080
|
+
viewport = this.$el;
|
|
1081
|
+
scrollDirection = direction.scroll;
|
|
1082
|
+
scrollDistance = position;
|
|
1083
|
+
}
|
|
1084
|
+
viewport[scrollDirection] = scrollDistance;
|
|
1085
|
+
},
|
|
1086
|
+
itemsLimitError() {
|
|
1087
|
+
setTimeout(() => {
|
|
1088
|
+
console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.", "Scroller:", this.$el);
|
|
1089
|
+
console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.");
|
|
1090
|
+
});
|
|
1091
|
+
throw new Error("Rendered items limit reached");
|
|
1092
|
+
},
|
|
1093
|
+
sortViews() {
|
|
1094
|
+
this.pool.sort((viewA, viewB) => viewA.nr.index - viewB.nr.index);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
var _hoisted_1 = {
|
|
1099
|
+
key: 0,
|
|
1100
|
+
ref: "before",
|
|
1101
|
+
class: "vue-recycle-scroller__slot"
|
|
1102
|
+
};
|
|
1103
|
+
var _hoisted_2 = {
|
|
1104
|
+
key: 1,
|
|
1105
|
+
ref: "after",
|
|
1106
|
+
class: "vue-recycle-scroller__slot"
|
|
1107
|
+
};
|
|
1108
|
+
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1109
|
+
const _component_ResizeObserver = resolveComponent("ResizeObserver");
|
|
1110
|
+
const _directive_observe_visibility = resolveDirective("observe-visibility");
|
|
1111
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
1112
|
+
class: normalizeClass(["vue-recycle-scroller", {
|
|
1113
|
+
ready: $data.ready,
|
|
1114
|
+
"page-mode": $props.pageMode,
|
|
1115
|
+
[`direction-${_ctx.direction}`]: true
|
|
1116
|
+
}]),
|
|
1117
|
+
onScrollPassive: _cache[0] || (_cache[0] = (...args) => $options.handleScroll && $options.handleScroll(...args))
|
|
1118
|
+
}, [
|
|
1119
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "before")], 512)) : createCommentVNode("v-if", true),
|
|
1120
|
+
(openBlock(), createBlock(resolveDynamicComponent($props.listTag), {
|
|
1121
|
+
ref: "wrapper",
|
|
1122
|
+
style: normalizeStyle({ [_ctx.direction === "vertical" ? "minHeight" : "minWidth"]: $data.totalSize + "px" }),
|
|
1123
|
+
class: normalizeClass(["vue-recycle-scroller__item-wrapper", $props.listClass])
|
|
1124
|
+
}, {
|
|
1125
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList($data.pool, (view) => {
|
|
1126
|
+
return openBlock(), createBlock(resolveDynamicComponent($props.itemTag), mergeProps({
|
|
1127
|
+
key: view.nr.id,
|
|
1128
|
+
style: $data.ready ? {
|
|
1129
|
+
transform: `translate${_ctx.direction === "vertical" ? "Y" : "X"}(${view.position}px) translate${_ctx.direction === "vertical" ? "X" : "Y"}(${view.offset}px)`,
|
|
1130
|
+
width: $props.gridItems ? `${_ctx.direction === "vertical" ? $props.itemSecondarySize || $props.itemSize : $props.itemSize}px` : void 0,
|
|
1131
|
+
height: $props.gridItems ? `${_ctx.direction === "horizontal" ? $props.itemSecondarySize || $props.itemSize : $props.itemSize}px` : void 0
|
|
1132
|
+
} : null,
|
|
1133
|
+
class: ["vue-recycle-scroller__item-view", [$props.itemClass, { hover: !$props.skipHover && $data.hoverKey === view.nr.key }]]
|
|
1134
|
+
}, toHandlers($props.skipHover ? {} : {
|
|
1135
|
+
mouseenter: () => {
|
|
1136
|
+
$data.hoverKey = view.nr.key;
|
|
1137
|
+
},
|
|
1138
|
+
mouseleave: () => {
|
|
1139
|
+
$data.hoverKey = null;
|
|
1140
|
+
}
|
|
1141
|
+
})), {
|
|
1142
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
|
|
1143
|
+
item: view.item,
|
|
1144
|
+
index: view.nr.index,
|
|
1145
|
+
active: view.nr.used
|
|
1146
|
+
})]),
|
|
1147
|
+
_: 2
|
|
1148
|
+
}, 1040, ["style", "class"]);
|
|
1149
|
+
}), 128)), renderSlot(_ctx.$slots, "empty")]),
|
|
1150
|
+
_: 3
|
|
1151
|
+
}, 8, ["style", "class"])),
|
|
1152
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_2, [renderSlot(_ctx.$slots, "after")], 512)) : createCommentVNode("v-if", true),
|
|
1153
|
+
createVNode(_component_ResizeObserver, { onNotify: $options.handleResize }, null, 8, ["onNotify"])
|
|
1154
|
+
], 34)), [[_directive_observe_visibility, $options.handleVisibilityChange]]);
|
|
1155
|
+
}
|
|
1156
|
+
script$2$1.render = render$1;
|
|
1157
|
+
script$2$1.__file = "src/components/RecycleScroller.vue";
|
|
1158
|
+
var script$1 = {
|
|
1159
|
+
name: "DynamicScroller",
|
|
1160
|
+
components: { RecycleScroller: script$2$1 },
|
|
1161
|
+
provide() {
|
|
1162
|
+
if (typeof ResizeObserver !== "undefined") this.$_resizeObserver = new ResizeObserver((entries) => {
|
|
1163
|
+
requestAnimationFrame(() => {
|
|
1164
|
+
if (!Array.isArray(entries)) return;
|
|
1165
|
+
for (const entry of entries) if (entry.target && entry.target.$_vs_onResize) {
|
|
1166
|
+
let width, height;
|
|
1167
|
+
if (entry.borderBoxSize) {
|
|
1168
|
+
const resizeObserverSize = entry.borderBoxSize[0];
|
|
1169
|
+
width = resizeObserverSize.inlineSize;
|
|
1170
|
+
height = resizeObserverSize.blockSize;
|
|
1171
|
+
} else {
|
|
1172
|
+
width = entry.contentRect.width;
|
|
1173
|
+
height = entry.contentRect.height;
|
|
1174
|
+
}
|
|
1175
|
+
entry.target.$_vs_onResize(entry.target.$_vs_id, width, height);
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
});
|
|
1179
|
+
return {
|
|
1180
|
+
vscrollData: this.vscrollData,
|
|
1181
|
+
vscrollParent: this,
|
|
1182
|
+
vscrollResizeObserver: this.$_resizeObserver
|
|
1183
|
+
};
|
|
1184
|
+
},
|
|
1185
|
+
inheritAttrs: false,
|
|
1186
|
+
props: {
|
|
1187
|
+
...props,
|
|
1188
|
+
minItemSize: {
|
|
1189
|
+
type: [Number, String],
|
|
1190
|
+
required: true
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
1193
|
+
emits: ["resize", "visible"],
|
|
1194
|
+
data() {
|
|
1195
|
+
return { vscrollData: {
|
|
1196
|
+
active: true,
|
|
1197
|
+
sizes: {},
|
|
1198
|
+
keyField: this.keyField,
|
|
1199
|
+
simpleArray: false
|
|
1200
|
+
} };
|
|
1201
|
+
},
|
|
1202
|
+
computed: {
|
|
1203
|
+
simpleArray,
|
|
1204
|
+
itemsWithSize() {
|
|
1205
|
+
const result = [];
|
|
1206
|
+
const { items, keyField, simpleArray: simpleArray$1 } = this;
|
|
1207
|
+
const sizes = this.vscrollData.sizes;
|
|
1208
|
+
const l = items.length;
|
|
1209
|
+
for (let i = 0; i < l; i++) {
|
|
1210
|
+
const item = items[i];
|
|
1211
|
+
const id = simpleArray$1 ? i : item[keyField];
|
|
1212
|
+
let size = sizes[id];
|
|
1213
|
+
if (typeof size === "undefined" && !this.$_undefinedMap[id]) size = 0;
|
|
1214
|
+
result.push({
|
|
1215
|
+
item,
|
|
1216
|
+
id,
|
|
1217
|
+
size
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
return result;
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
watch: {
|
|
1224
|
+
items() {
|
|
1225
|
+
this.forceUpdate();
|
|
1226
|
+
},
|
|
1227
|
+
simpleArray: {
|
|
1228
|
+
handler(value) {
|
|
1229
|
+
this.vscrollData.simpleArray = value;
|
|
1230
|
+
},
|
|
1231
|
+
immediate: true
|
|
1232
|
+
},
|
|
1233
|
+
direction(value) {
|
|
1234
|
+
this.forceUpdate(true);
|
|
1235
|
+
},
|
|
1236
|
+
itemsWithSize(next, prev) {
|
|
1237
|
+
const scrollTop = this.$el.scrollTop;
|
|
1238
|
+
let prevActiveTop = 0;
|
|
1239
|
+
let activeTop = 0;
|
|
1240
|
+
const length = Math.min(next.length, prev.length);
|
|
1241
|
+
for (let i = 0; i < length; i++) {
|
|
1242
|
+
if (prevActiveTop >= scrollTop) break;
|
|
1243
|
+
prevActiveTop += prev[i].size || this.minItemSize;
|
|
1244
|
+
activeTop += next[i].size || this.minItemSize;
|
|
1245
|
+
}
|
|
1246
|
+
const offset = activeTop - prevActiveTop;
|
|
1247
|
+
if (offset === 0) return;
|
|
1248
|
+
this.$el.scrollTop += offset;
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
beforeCreate() {
|
|
1252
|
+
this.$_updates = [];
|
|
1253
|
+
this.$_undefinedSizes = 0;
|
|
1254
|
+
this.$_undefinedMap = {};
|
|
1255
|
+
this.$_events = mitt_es_default();
|
|
1256
|
+
},
|
|
1257
|
+
activated() {
|
|
1258
|
+
this.vscrollData.active = true;
|
|
1259
|
+
},
|
|
1260
|
+
deactivated() {
|
|
1261
|
+
this.vscrollData.active = false;
|
|
1262
|
+
},
|
|
1263
|
+
unmounted() {
|
|
1264
|
+
this.$_events.all.clear();
|
|
1265
|
+
},
|
|
1266
|
+
methods: {
|
|
1267
|
+
onScrollerResize() {
|
|
1268
|
+
if (this.$refs.scroller) this.forceUpdate();
|
|
1269
|
+
this.$emit("resize");
|
|
1270
|
+
},
|
|
1271
|
+
onScrollerVisible() {
|
|
1272
|
+
this.$_events.emit("vscroll:update", { force: false });
|
|
1273
|
+
this.$emit("visible");
|
|
1274
|
+
},
|
|
1275
|
+
forceUpdate(clear = false) {
|
|
1276
|
+
if (clear || this.simpleArray) this.vscrollData.sizes = {};
|
|
1277
|
+
this.$_events.emit("vscroll:update", { force: true });
|
|
1278
|
+
},
|
|
1279
|
+
scrollToItem(index) {
|
|
1280
|
+
const scroller = this.$refs.scroller;
|
|
1281
|
+
if (scroller) scroller.scrollToItem(index);
|
|
1282
|
+
},
|
|
1283
|
+
getItemSize(item, index = void 0) {
|
|
1284
|
+
const id = this.simpleArray ? index != null ? index : this.items.indexOf(item) : item[this.keyField];
|
|
1285
|
+
return this.vscrollData.sizes[id] || 0;
|
|
1286
|
+
},
|
|
1287
|
+
scrollToBottom() {
|
|
1288
|
+
if (this.$_scrollingToBottom) return;
|
|
1289
|
+
this.$_scrollingToBottom = true;
|
|
1290
|
+
const el = this.$el;
|
|
1291
|
+
this.$nextTick(() => {
|
|
1292
|
+
el.scrollTop = el.scrollHeight + 5e3;
|
|
1293
|
+
const cb = () => {
|
|
1294
|
+
el.scrollTop = el.scrollHeight + 5e3;
|
|
1295
|
+
requestAnimationFrame(() => {
|
|
1296
|
+
el.scrollTop = el.scrollHeight + 5e3;
|
|
1297
|
+
if (this.$_undefinedSizes === 0) this.$_scrollingToBottom = false;
|
|
1298
|
+
else requestAnimationFrame(cb);
|
|
1299
|
+
});
|
|
1300
|
+
};
|
|
1301
|
+
requestAnimationFrame(cb);
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1307
|
+
const _component_RecycleScroller = resolveComponent("RecycleScroller");
|
|
1308
|
+
return openBlock(), createBlock(_component_RecycleScroller, mergeProps({
|
|
1309
|
+
ref: "scroller",
|
|
1310
|
+
items: $options.itemsWithSize,
|
|
1311
|
+
"min-item-size": $props.minItemSize,
|
|
1312
|
+
direction: _ctx.direction,
|
|
1313
|
+
"key-field": "id",
|
|
1314
|
+
"list-tag": _ctx.listTag,
|
|
1315
|
+
"item-tag": _ctx.itemTag
|
|
1316
|
+
}, _ctx.$attrs, {
|
|
1317
|
+
onResize: $options.onScrollerResize,
|
|
1318
|
+
onVisible: $options.onScrollerVisible
|
|
1319
|
+
}), {
|
|
1320
|
+
default: withCtx(({ item: itemWithSize, index, active }) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
|
|
1321
|
+
item: itemWithSize.item,
|
|
1322
|
+
index,
|
|
1323
|
+
active,
|
|
1324
|
+
itemWithSize
|
|
1325
|
+
})))]),
|
|
1326
|
+
before: withCtx(() => [renderSlot(_ctx.$slots, "before")]),
|
|
1327
|
+
after: withCtx(() => [renderSlot(_ctx.$slots, "after")]),
|
|
1328
|
+
empty: withCtx(() => [renderSlot(_ctx.$slots, "empty")]),
|
|
1329
|
+
_: 3
|
|
1330
|
+
}, 16, [
|
|
1331
|
+
"items",
|
|
1332
|
+
"min-item-size",
|
|
1333
|
+
"direction",
|
|
1334
|
+
"list-tag",
|
|
1335
|
+
"item-tag",
|
|
1336
|
+
"onResize",
|
|
1337
|
+
"onVisible"
|
|
1338
|
+
]);
|
|
1339
|
+
}
|
|
1340
|
+
script$1.render = render;
|
|
1341
|
+
script$1.__file = "src/components/DynamicScroller.vue";
|
|
1342
|
+
var script = {
|
|
1343
|
+
name: "DynamicScrollerItem",
|
|
1344
|
+
inject: [
|
|
1345
|
+
"vscrollData",
|
|
1346
|
+
"vscrollParent",
|
|
1347
|
+
"vscrollResizeObserver"
|
|
1348
|
+
],
|
|
1349
|
+
props: {
|
|
1350
|
+
item: { required: true },
|
|
1351
|
+
watchData: {
|
|
1352
|
+
type: Boolean,
|
|
1353
|
+
default: false
|
|
1354
|
+
},
|
|
1355
|
+
active: {
|
|
1356
|
+
type: Boolean,
|
|
1357
|
+
required: true
|
|
1358
|
+
},
|
|
1359
|
+
index: {
|
|
1360
|
+
type: Number,
|
|
1361
|
+
default: void 0
|
|
1362
|
+
},
|
|
1363
|
+
sizeDependencies: {
|
|
1364
|
+
type: [Array, Object],
|
|
1365
|
+
default: null
|
|
1366
|
+
},
|
|
1367
|
+
emitResize: {
|
|
1368
|
+
type: Boolean,
|
|
1369
|
+
default: false
|
|
1370
|
+
},
|
|
1371
|
+
tag: {
|
|
1372
|
+
type: String,
|
|
1373
|
+
default: "div"
|
|
1374
|
+
}
|
|
1375
|
+
},
|
|
1376
|
+
emits: ["resize"],
|
|
1377
|
+
computed: {
|
|
1378
|
+
id() {
|
|
1379
|
+
if (this.vscrollData.simpleArray) return this.index;
|
|
1380
|
+
if (this.vscrollData.keyField in this.item) return this.item[this.vscrollData.keyField];
|
|
1381
|
+
throw new Error(`keyField '${this.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`);
|
|
1382
|
+
},
|
|
1383
|
+
size() {
|
|
1384
|
+
return this.vscrollData.sizes[this.id] || 0;
|
|
1385
|
+
},
|
|
1386
|
+
finalActive() {
|
|
1387
|
+
return this.active && this.vscrollData.active;
|
|
1388
|
+
}
|
|
1389
|
+
},
|
|
1390
|
+
watch: {
|
|
1391
|
+
watchData: "updateWatchData",
|
|
1392
|
+
id(value, oldValue) {
|
|
1393
|
+
this.$el.$_vs_id = this.id;
|
|
1394
|
+
if (!this.size) this.onDataUpdate();
|
|
1395
|
+
if (this.$_sizeObserved) {
|
|
1396
|
+
const oldSize = this.vscrollData.sizes[oldValue];
|
|
1397
|
+
const size = this.vscrollData.sizes[value];
|
|
1398
|
+
if (oldSize != null && oldSize !== size) this.applySize(oldSize);
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
finalActive(value) {
|
|
1402
|
+
if (!this.size) {
|
|
1403
|
+
if (value) {
|
|
1404
|
+
if (!this.vscrollParent.$_undefinedMap[this.id]) {
|
|
1405
|
+
this.vscrollParent.$_undefinedSizes++;
|
|
1406
|
+
this.vscrollParent.$_undefinedMap[this.id] = true;
|
|
1407
|
+
}
|
|
1408
|
+
} else if (this.vscrollParent.$_undefinedMap[this.id]) {
|
|
1409
|
+
this.vscrollParent.$_undefinedSizes--;
|
|
1410
|
+
this.vscrollParent.$_undefinedMap[this.id] = false;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
if (this.vscrollResizeObserver) if (value) this.observeSize();
|
|
1414
|
+
else this.unobserveSize();
|
|
1415
|
+
else if (value && this.$_pendingVScrollUpdate === this.id) this.updateSize();
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1418
|
+
created() {
|
|
1419
|
+
if (this.$isServer) return;
|
|
1420
|
+
this.$_forceNextVScrollUpdate = null;
|
|
1421
|
+
this.updateWatchData();
|
|
1422
|
+
if (!this.vscrollResizeObserver) {
|
|
1423
|
+
for (const k in this.sizeDependencies) this.$watch(() => this.sizeDependencies[k], this.onDataUpdate);
|
|
1424
|
+
this.vscrollParent.$_events.on("vscroll:update", this.onVscrollUpdate);
|
|
1425
|
+
}
|
|
1426
|
+
},
|
|
1427
|
+
mounted() {
|
|
1428
|
+
if (this.finalActive) {
|
|
1429
|
+
this.updateSize();
|
|
1430
|
+
this.observeSize();
|
|
1431
|
+
}
|
|
1432
|
+
},
|
|
1433
|
+
beforeUnmount() {
|
|
1434
|
+
this.vscrollParent.$_events.off("vscroll:update", this.onVscrollUpdate);
|
|
1435
|
+
this.unobserveSize();
|
|
1436
|
+
},
|
|
1437
|
+
methods: {
|
|
1438
|
+
updateSize() {
|
|
1439
|
+
if (this.finalActive) {
|
|
1440
|
+
if (this.$_pendingSizeUpdate !== this.id) {
|
|
1441
|
+
this.$_pendingSizeUpdate = this.id;
|
|
1442
|
+
this.$_forceNextVScrollUpdate = null;
|
|
1443
|
+
this.$_pendingVScrollUpdate = null;
|
|
1444
|
+
this.computeSize(this.id);
|
|
1445
|
+
}
|
|
1446
|
+
} else this.$_forceNextVScrollUpdate = this.id;
|
|
1447
|
+
},
|
|
1448
|
+
updateWatchData() {
|
|
1449
|
+
if (this.watchData && !this.vscrollResizeObserver) this.$_watchData = this.$watch("item", () => {
|
|
1450
|
+
this.onDataUpdate();
|
|
1451
|
+
}, { deep: true });
|
|
1452
|
+
else if (this.$_watchData) {
|
|
1453
|
+
this.$_watchData();
|
|
1454
|
+
this.$_watchData = null;
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
onVscrollUpdate({ force }) {
|
|
1458
|
+
if (!this.finalActive && force) this.$_pendingVScrollUpdate = this.id;
|
|
1459
|
+
if (this.$_forceNextVScrollUpdate === this.id || force || !this.size) this.updateSize();
|
|
1460
|
+
},
|
|
1461
|
+
onDataUpdate() {
|
|
1462
|
+
this.updateSize();
|
|
1463
|
+
},
|
|
1464
|
+
computeSize(id) {
|
|
1465
|
+
this.$nextTick(() => {
|
|
1466
|
+
if (this.id === id) {
|
|
1467
|
+
const width = this.$el.offsetWidth;
|
|
1468
|
+
const height = this.$el.offsetHeight;
|
|
1469
|
+
this.applyWidthHeight(width, height);
|
|
1470
|
+
}
|
|
1471
|
+
this.$_pendingSizeUpdate = null;
|
|
1472
|
+
});
|
|
1473
|
+
},
|
|
1474
|
+
applyWidthHeight(width, height) {
|
|
1475
|
+
const size = ~~(this.vscrollParent.direction === "vertical" ? height : width);
|
|
1476
|
+
if (size && this.size !== size) this.applySize(size);
|
|
1477
|
+
},
|
|
1478
|
+
applySize(size) {
|
|
1479
|
+
if (this.vscrollParent.$_undefinedMap[this.id]) {
|
|
1480
|
+
this.vscrollParent.$_undefinedSizes--;
|
|
1481
|
+
this.vscrollParent.$_undefinedMap[this.id] = void 0;
|
|
1482
|
+
}
|
|
1483
|
+
this.vscrollData.sizes[this.id] = size;
|
|
1484
|
+
if (this.emitResize) this.$emit("resize", this.id);
|
|
1485
|
+
},
|
|
1486
|
+
observeSize() {
|
|
1487
|
+
if (!this.vscrollResizeObserver) return;
|
|
1488
|
+
if (this.$_sizeObserved) return;
|
|
1489
|
+
this.vscrollResizeObserver.observe(this.$el);
|
|
1490
|
+
this.$el.$_vs_id = this.id;
|
|
1491
|
+
this.$el.$_vs_onResize = this.onResize;
|
|
1492
|
+
this.$_sizeObserved = true;
|
|
1493
|
+
},
|
|
1494
|
+
unobserveSize() {
|
|
1495
|
+
if (!this.vscrollResizeObserver) return;
|
|
1496
|
+
if (!this.$_sizeObserved) return;
|
|
1497
|
+
this.vscrollResizeObserver.unobserve(this.$el);
|
|
1498
|
+
this.$el.$_vs_onResize = void 0;
|
|
1499
|
+
this.$_sizeObserved = false;
|
|
1500
|
+
},
|
|
1501
|
+
onResize(id, width, height) {
|
|
1502
|
+
if (this.id === id) this.applyWidthHeight(width, height);
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
render() {
|
|
1506
|
+
return h(this.tag, this.$slots.default());
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
script.__file = "src/components/DynamicScrollerItem.vue";
|
|
1510
|
+
function getParentNodes() {
|
|
1511
|
+
const activeNode = useNDVStore().activeNode;
|
|
1512
|
+
const { workflowObject, getNodeByName } = useWorkflowsStore();
|
|
1513
|
+
if (!activeNode || !workflowObject) return [];
|
|
1514
|
+
return workflowObject.getParentNodesByDepth(activeNode?.name).filter(({ name }, i, nodes) => {
|
|
1515
|
+
return name !== activeNode.name && nodes.findIndex((node) => node.name === name) === i;
|
|
1516
|
+
}).map((n) => getNodeByName(n.name)).filter((n) => n !== null);
|
|
1517
|
+
}
|
|
1518
|
+
function getSchemas() {
|
|
1519
|
+
const parentNodes = getParentNodes();
|
|
1520
|
+
const parentNodesNames = parentNodes.map((node) => node?.name);
|
|
1521
|
+
const { getSchemaForExecutionData, getInputDataWithPinned } = useDataSchema();
|
|
1522
|
+
const parentNodesSchemas = parentNodes.map((node) => {
|
|
1523
|
+
const inputData = getInputDataWithPinned(node);
|
|
1524
|
+
return {
|
|
1525
|
+
nodeName: node?.name || "",
|
|
1526
|
+
schema: getSchemaForExecutionData(executionDataToJson(inputData), false)
|
|
1527
|
+
};
|
|
1528
|
+
}).filter((node) => node.schema?.value.length > 0);
|
|
1529
|
+
return {
|
|
1530
|
+
parentNodesNames,
|
|
1531
|
+
inputSchema: parentNodesSchemas.shift(),
|
|
1532
|
+
parentNodesSchemas
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
var estimateNumberOfTokens = (item, averageTokenLength) => {
|
|
1536
|
+
if (typeof item === "object") return Math.ceil(JSON.stringify(item).length / averageTokenLength);
|
|
1537
|
+
return 0;
|
|
1538
|
+
};
|
|
1539
|
+
var calculateRemainingTokens = (error) => {
|
|
1540
|
+
const tokens = error.message.match(/\d+/g);
|
|
1541
|
+
if (!tokens || tokens.length < 2) throw error;
|
|
1542
|
+
const maxTokens = parseInt(tokens[0], 10);
|
|
1543
|
+
return parseInt(tokens[1], 10) - maxTokens;
|
|
1544
|
+
};
|
|
1545
|
+
var trimParentNodesSchema = (payload, remainingTokensToReduce, averageTokenLength) => {
|
|
1546
|
+
let parentNodesTokenCount = estimateNumberOfTokens(payload.context.schema, averageTokenLength);
|
|
1547
|
+
if (remainingTokensToReduce > parentNodesTokenCount) {
|
|
1548
|
+
remainingTokensToReduce -= parentNodesTokenCount;
|
|
1549
|
+
payload.context.schema = [];
|
|
1550
|
+
}
|
|
1551
|
+
if (payload.context.schema.length) {
|
|
1552
|
+
const nodes = [...payload.context.schema];
|
|
1553
|
+
for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex++) {
|
|
1554
|
+
if (payload.question.includes(nodes[nodeIndex].nodeName)) continue;
|
|
1555
|
+
const nodeTokens = estimateNumberOfTokens(nodes[nodeIndex], averageTokenLength);
|
|
1556
|
+
remainingTokensToReduce -= nodeTokens;
|
|
1557
|
+
parentNodesTokenCount -= nodeTokens;
|
|
1558
|
+
payload.context.schema.splice(nodeIndex, 1);
|
|
1559
|
+
if (remainingTokensToReduce <= 0) break;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
return [remainingTokensToReduce, parentNodesTokenCount];
|
|
1563
|
+
};
|
|
1564
|
+
var trimInputSchemaProperties = (payload, remainingTokensToReduce, averageTokenLength, parentNodesTokenCount) => {
|
|
1565
|
+
if (remainingTokensToReduce <= 0) return remainingTokensToReduce;
|
|
1566
|
+
if (Array.isArray(payload.context.inputSchema.schema.value)) {
|
|
1567
|
+
const props$1 = [...payload.context.inputSchema.schema.value];
|
|
1568
|
+
for (let index = 0; index < props$1.length; index++) {
|
|
1569
|
+
const key = props$1[index].key;
|
|
1570
|
+
if (key && payload.question.includes(key)) continue;
|
|
1571
|
+
const propTokens = estimateNumberOfTokens(props$1[index], averageTokenLength);
|
|
1572
|
+
remainingTokensToReduce -= propTokens;
|
|
1573
|
+
payload.context.inputSchema.schema.value.splice(index, 1);
|
|
1574
|
+
if (remainingTokensToReduce <= 0) break;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
if (remainingTokensToReduce > 0) {
|
|
1578
|
+
payload.context.schema = [];
|
|
1579
|
+
remainingTokensToReduce -= parentNodesTokenCount;
|
|
1580
|
+
}
|
|
1581
|
+
return remainingTokensToReduce;
|
|
1582
|
+
};
|
|
1583
|
+
function reducePayloadSizeOrThrow(payload, error, averageTokenLength = 4) {
|
|
1584
|
+
let remainingTokensToReduce = calculateRemainingTokens(error);
|
|
1585
|
+
const [remaining, parentNodesTokenCount] = trimParentNodesSchema(payload, remainingTokensToReduce, averageTokenLength);
|
|
1586
|
+
remainingTokensToReduce = remaining;
|
|
1587
|
+
remainingTokensToReduce = trimInputSchemaProperties(payload, remainingTokensToReduce, averageTokenLength, parentNodesTokenCount);
|
|
1588
|
+
if (remainingTokensToReduce > 0) throw error;
|
|
1589
|
+
}
|
|
1590
|
+
async function generateCodeForAiTransform(prompt$1, path, retries = 1) {
|
|
1591
|
+
const schemas = getSchemas();
|
|
1592
|
+
const payload = {
|
|
1593
|
+
question: prompt$1,
|
|
1594
|
+
context: {
|
|
1595
|
+
schema: schemas.parentNodesSchemas,
|
|
1596
|
+
inputSchema: schemas.inputSchema,
|
|
1597
|
+
ndvPushRef: useNDVStore().pushRef,
|
|
1598
|
+
pushRef: useRootStore().pushRef
|
|
1599
|
+
},
|
|
1600
|
+
forNode: "transform"
|
|
1601
|
+
};
|
|
1602
|
+
let value;
|
|
1603
|
+
if (useSettingsStore().isAskAiEnabled) {
|
|
1604
|
+
const { restApiContext } = useRootStore();
|
|
1605
|
+
let code = "";
|
|
1606
|
+
while (retries > 0) try {
|
|
1607
|
+
const { code: generatedCode } = await generateCodeForPrompt(restApiContext, payload);
|
|
1608
|
+
code = generatedCode;
|
|
1609
|
+
break;
|
|
1610
|
+
} catch (e) {
|
|
1611
|
+
if (typeof e.message === "string" && e.message.includes("maximum context length")) {
|
|
1612
|
+
reducePayloadSizeOrThrow(payload, e);
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1615
|
+
retries--;
|
|
1616
|
+
if (!retries) throw e;
|
|
1617
|
+
}
|
|
1618
|
+
value = code;
|
|
1619
|
+
} else throw new ApplicationError("AI code generation is not enabled");
|
|
1620
|
+
if (value === void 0) return;
|
|
1621
|
+
return {
|
|
1622
|
+
name: path,
|
|
1623
|
+
value: await gu(String(value), {
|
|
1624
|
+
parser: "babel",
|
|
1625
|
+
plugins: [Ln, estree_exports]
|
|
1626
|
+
})
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
function splitText(textarea, textareaRowsData) {
|
|
1630
|
+
if (textareaRowsData) return textareaRowsData;
|
|
1631
|
+
const rows = [];
|
|
1632
|
+
const linesToRowsMap = [];
|
|
1633
|
+
const style$1 = window.getComputedStyle(textarea);
|
|
1634
|
+
const padding = parseFloat(style$1.paddingLeft) + parseFloat(style$1.paddingRight);
|
|
1635
|
+
const border = parseFloat(style$1.borderLeftWidth) + parseFloat(style$1.borderRightWidth);
|
|
1636
|
+
const textareaWidth = textarea.clientWidth - padding - border;
|
|
1637
|
+
const context = createTextContext(style$1);
|
|
1638
|
+
const lines = textarea.value.split("\n");
|
|
1639
|
+
lines.forEach((_) => {
|
|
1640
|
+
linesToRowsMap.push([]);
|
|
1641
|
+
});
|
|
1642
|
+
lines.forEach((line, index) => {
|
|
1643
|
+
if (line === "") {
|
|
1644
|
+
rows.push(line);
|
|
1645
|
+
linesToRowsMap[index].push(rows.length - 1);
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
let currentLine = "";
|
|
1649
|
+
line.split(/(\s+)/).forEach((word) => {
|
|
1650
|
+
const testLine = currentLine + word;
|
|
1651
|
+
if (context.measureText(testLine).width <= textareaWidth) currentLine = testLine;
|
|
1652
|
+
else {
|
|
1653
|
+
rows.push(currentLine.trimEnd());
|
|
1654
|
+
linesToRowsMap[index].push(rows.length - 1);
|
|
1655
|
+
currentLine = word;
|
|
1656
|
+
}
|
|
1657
|
+
});
|
|
1658
|
+
if (currentLine) {
|
|
1659
|
+
rows.push(currentLine.trimEnd());
|
|
1660
|
+
linesToRowsMap[index].push(rows.length - 1);
|
|
1661
|
+
}
|
|
1662
|
+
});
|
|
1663
|
+
return {
|
|
1664
|
+
rows,
|
|
1665
|
+
linesToRowsMap
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
function createTextContext(style$1) {
|
|
1669
|
+
const context = document.createElement("canvas").getContext("2d");
|
|
1670
|
+
context.font = `${style$1.fontWeight} ${style$1.fontSize} ${style$1.fontFamily}`;
|
|
1671
|
+
return context;
|
|
1672
|
+
}
|
|
1673
|
+
var getRowIndex = (textareaY, lineHeight) => {
|
|
1674
|
+
const rowHeight = parseInt(lineHeight, 10);
|
|
1675
|
+
const snapPosition = textareaY - rowHeight / 2 - 1;
|
|
1676
|
+
return Math.floor(snapPosition / rowHeight);
|
|
1677
|
+
};
|
|
1678
|
+
var getColumnIndex = (rowText, textareaX, font) => {
|
|
1679
|
+
const span = document.createElement("span");
|
|
1680
|
+
span.style.font = font;
|
|
1681
|
+
span.style.visibility = "hidden";
|
|
1682
|
+
span.style.position = "absolute";
|
|
1683
|
+
span.style.whiteSpace = "pre";
|
|
1684
|
+
document.body.appendChild(span);
|
|
1685
|
+
let left = 0;
|
|
1686
|
+
let right = rowText.length;
|
|
1687
|
+
let col = 0;
|
|
1688
|
+
while (left <= right) {
|
|
1689
|
+
const mid = Math.floor((left + right) / 2);
|
|
1690
|
+
span.textContent = rowText.substring(0, mid);
|
|
1691
|
+
if (span.getBoundingClientRect().width <= textareaX) {
|
|
1692
|
+
col = mid;
|
|
1693
|
+
left = mid + 1;
|
|
1694
|
+
} else right = mid - 1;
|
|
1695
|
+
}
|
|
1696
|
+
document.body.removeChild(span);
|
|
1697
|
+
return rowText.length === col ? col : col - 1;
|
|
1698
|
+
};
|
|
1699
|
+
function getUpdatedTextareaValue(event, textareaRowsData, value) {
|
|
1700
|
+
const textarea = event.target;
|
|
1701
|
+
const rect = textarea.getBoundingClientRect();
|
|
1702
|
+
const textareaX = event.clientX - rect.left;
|
|
1703
|
+
const textareaY = event.clientY - rect.top;
|
|
1704
|
+
const { lineHeight, font } = window.getComputedStyle(textarea);
|
|
1705
|
+
const rowIndex = getRowIndex(textareaY, lineHeight);
|
|
1706
|
+
const rowsData = splitText(textarea, textareaRowsData);
|
|
1707
|
+
let newText = value;
|
|
1708
|
+
if (rowsData.rows[rowIndex] === void 0) newText = `${textarea.value} ${value}`;
|
|
1709
|
+
const { rows, linesToRowsMap } = rowsData;
|
|
1710
|
+
const rowText = rows[rowIndex];
|
|
1711
|
+
if (rowText === "") rows[rowIndex] = value;
|
|
1712
|
+
else {
|
|
1713
|
+
const col = getColumnIndex(rowText, textareaX, font);
|
|
1714
|
+
rows[rowIndex] = [
|
|
1715
|
+
rows[rowIndex].slice(0, col).trim(),
|
|
1716
|
+
value,
|
|
1717
|
+
rows[rowIndex].slice(col).trim()
|
|
1718
|
+
].join(" ").trim();
|
|
1719
|
+
}
|
|
1720
|
+
newText = linesToRowsMap.map((lineMap) => {
|
|
1721
|
+
return lineMap.map((index) => rows[index]).join(" ");
|
|
1722
|
+
}).join("\n");
|
|
1723
|
+
return newText;
|
|
1724
|
+
}
|
|
1725
|
+
function getTextareaCursorPosition(textarea, textareaRowsData, clientX, clientY) {
|
|
1726
|
+
const rect = textarea.getBoundingClientRect();
|
|
1727
|
+
const textareaX = clientX - rect.left;
|
|
1728
|
+
const textareaY = clientY - rect.top;
|
|
1729
|
+
const { lineHeight, font } = window.getComputedStyle(textarea);
|
|
1730
|
+
const rowIndex = getRowIndex(textareaY, lineHeight);
|
|
1731
|
+
const { rows } = splitText(textarea, textareaRowsData);
|
|
1732
|
+
if (rowIndex < 0 || rowIndex >= rows.length) return textarea.value.length;
|
|
1733
|
+
const rowText = rows[rowIndex];
|
|
1734
|
+
const col = getColumnIndex(rowText, textareaX, font);
|
|
1735
|
+
return rows.slice(0, rowIndex).reduce((acc, curr) => acc + curr.length + 1, 0) + col;
|
|
1736
|
+
}
|
|
1737
|
+
var NODE_TEST_STEP_POPUP_COUNT_KEY = "N8N_NODE_TEST_STEP_POPUP_COUNT";
|
|
1738
|
+
var MAX_POPUP_COUNT = 10;
|
|
1739
|
+
var POPUP_UPDATE_DELAY = 3e3;
|
|
1740
|
+
var NodeExecuteButton_default = /* @__PURE__ */ defineComponent({
|
|
1741
|
+
inheritAttrs: false,
|
|
1742
|
+
__name: "NodeExecuteButton",
|
|
1743
|
+
props: {
|
|
1744
|
+
nodeName: {},
|
|
1745
|
+
telemetrySource: {},
|
|
1746
|
+
disabled: {
|
|
1747
|
+
type: Boolean,
|
|
1748
|
+
default: false
|
|
1749
|
+
},
|
|
1750
|
+
label: {},
|
|
1751
|
+
type: {},
|
|
1752
|
+
size: {},
|
|
1753
|
+
icon: {},
|
|
1754
|
+
square: {
|
|
1755
|
+
type: Boolean,
|
|
1756
|
+
default: false
|
|
1757
|
+
},
|
|
1758
|
+
transparent: {
|
|
1759
|
+
type: Boolean,
|
|
1760
|
+
default: false
|
|
1761
|
+
},
|
|
1762
|
+
hideIcon: { type: Boolean },
|
|
1763
|
+
hideLabel: { type: Boolean },
|
|
1764
|
+
tooltip: {},
|
|
1765
|
+
tooltipPlacement: {},
|
|
1766
|
+
showLoadingSpinner: {
|
|
1767
|
+
type: Boolean,
|
|
1768
|
+
default: true
|
|
1769
|
+
},
|
|
1770
|
+
executionMode: { default: "inclusive" }
|
|
1771
|
+
},
|
|
1772
|
+
emits: [
|
|
1773
|
+
"stopExecution",
|
|
1774
|
+
"execute",
|
|
1775
|
+
"valueChanged"
|
|
1776
|
+
],
|
|
1777
|
+
setup(__props, { emit: __emit }) {
|
|
1778
|
+
const props$1 = __props;
|
|
1779
|
+
const emit = __emit;
|
|
1780
|
+
const slots = useSlots();
|
|
1781
|
+
const lastPopupCountUpdate = ref(0);
|
|
1782
|
+
const codeGenerationInProgress = ref(false);
|
|
1783
|
+
const { runWorkflow, stopCurrentExecution } = useRunWorkflow({ router: useRouter() });
|
|
1784
|
+
const workflowsStore = useWorkflowsStore();
|
|
1785
|
+
const workflowState = injectWorkflowState();
|
|
1786
|
+
const externalHooks = useExternalHooks();
|
|
1787
|
+
const toast = useToast();
|
|
1788
|
+
const ndvStore = useNDVStore();
|
|
1789
|
+
const nodeTypesStore = useNodeTypesStore();
|
|
1790
|
+
const i18n = useI18n();
|
|
1791
|
+
const message = useMessage();
|
|
1792
|
+
const telemetry = useTelemetry();
|
|
1793
|
+
const uiStore = useUIStore();
|
|
1794
|
+
const node = computed(() => workflowsStore.getNodeByName(props$1.nodeName));
|
|
1795
|
+
const pinnedData = usePinnedData(node);
|
|
1796
|
+
const nodeType = computed(() => {
|
|
1797
|
+
return node.value ? nodeTypesStore.getNodeType(node.value.type, node.value.typeVersion) : null;
|
|
1798
|
+
});
|
|
1799
|
+
const isNodeRunning = computed(() => {
|
|
1800
|
+
if (!workflowsStore.isWorkflowRunning || codeGenerationInProgress.value) return false;
|
|
1801
|
+
const triggeredNode = workflowsStore.executedNode;
|
|
1802
|
+
return workflowState.executingNode.isNodeExecuting(node.value?.name ?? "") || triggeredNode === node.value?.name;
|
|
1803
|
+
});
|
|
1804
|
+
const isTriggerNode = computed(() => {
|
|
1805
|
+
return node.value ? nodeTypesStore.isTriggerNode(node.value.type) : false;
|
|
1806
|
+
});
|
|
1807
|
+
const isManualTriggerNode = computed(() => nodeType.value ? nodeType.value.name === MANUAL_TRIGGER_NODE_TYPE : false);
|
|
1808
|
+
const isChatNode = computed(() => nodeType.value ? nodeType.value.name === CHAT_TRIGGER_NODE_TYPE : false);
|
|
1809
|
+
const isChatChild = computed(() => workflowsStore.checkIfNodeHasChatParent(props$1.nodeName));
|
|
1810
|
+
const isFormTriggerNode = computed(() => nodeType.value ? nodeType.value.name === FORM_TRIGGER_NODE_TYPE : false);
|
|
1811
|
+
const isPollingTypeNode = computed(() => !!nodeType.value?.polling);
|
|
1812
|
+
const isScheduleTrigger = computed(() => !!nodeType.value?.group.includes("schedule"));
|
|
1813
|
+
const isWebhookNode = computed(() => nodeType.value ? nodeType.value.name === WEBHOOK_NODE_TYPE : false);
|
|
1814
|
+
const isListeningForEvents = computed(() => {
|
|
1815
|
+
const waitingOnWebhook = workflowsStore.executionWaitingForWebhook;
|
|
1816
|
+
const executedNode = workflowsStore.executedNode;
|
|
1817
|
+
return !!node.value && !node.value.disabled && isTriggerNode.value && waitingOnWebhook && (!executedNode || executedNode === props$1.nodeName);
|
|
1818
|
+
});
|
|
1819
|
+
const isListeningForWorkflowEvents = computed(() => {
|
|
1820
|
+
return isNodeRunning.value && isTriggerNode.value && !isScheduleTrigger.value && !isManualTriggerNode.value;
|
|
1821
|
+
});
|
|
1822
|
+
const hasIssues = computed(() => Boolean(node.value?.issues && (node.value.issues.parameters || node.value.issues.credentials)));
|
|
1823
|
+
const disabledHint = computed(() => {
|
|
1824
|
+
if (isListeningForEvents.value) return "";
|
|
1825
|
+
if (codeGenerationInProgress.value) return i18n.baseText("ndv.execute.generatingCode");
|
|
1826
|
+
if (node?.value?.disabled) return i18n.baseText("ndv.execute.nodeIsDisabled");
|
|
1827
|
+
if (isTriggerNode.value && hasIssues.value) {
|
|
1828
|
+
const activeNode = ndvStore.activeNode;
|
|
1829
|
+
if (activeNode && activeNode.name !== props$1.nodeName) return i18n.baseText("ndv.execute.fixPrevious");
|
|
1830
|
+
return i18n.baseText("ndv.execute.requiredFieldsMissing");
|
|
1831
|
+
}
|
|
1832
|
+
if (workflowsStore.isWorkflowRunning && !isNodeRunning.value) return i18n.baseText("ndv.execute.workflowAlreadyRunning");
|
|
1833
|
+
return "";
|
|
1834
|
+
});
|
|
1835
|
+
const tooltipText = computed(() => {
|
|
1836
|
+
if (shouldGenerateCode.value) return i18n.baseText("ndv.execute.generateCodeAndTestNode.description");
|
|
1837
|
+
if (disabledHint.value) return disabledHint.value;
|
|
1838
|
+
if (props$1.tooltip && !isLoading.value && testStepButtonPopupCount() < MAX_POPUP_COUNT) return props$1.tooltip;
|
|
1839
|
+
return "";
|
|
1840
|
+
});
|
|
1841
|
+
const buttonLabel = computed(() => {
|
|
1842
|
+
if (props$1.hideLabel) return "";
|
|
1843
|
+
if (isListeningForEvents.value || isListeningForWorkflowEvents.value) return i18n.baseText("ndv.execute.stopListening");
|
|
1844
|
+
if (props$1.label) return props$1.label;
|
|
1845
|
+
if (isChatNode.value) return i18n.baseText("ndv.execute.testChat");
|
|
1846
|
+
if (isWebhookNode.value) return i18n.baseText("ndv.execute.listenForTestEvent");
|
|
1847
|
+
if (isFormTriggerNode.value) return i18n.baseText("ndv.execute.testStep");
|
|
1848
|
+
if (isPollingTypeNode.value || nodeType.value?.mockManualExecution) return i18n.baseText("ndv.execute.fetchEvent");
|
|
1849
|
+
return i18n.baseText("ndv.execute.testNode");
|
|
1850
|
+
});
|
|
1851
|
+
const isLoading = computed(() => codeGenerationInProgress.value || isNodeRunning.value && !isListeningForEvents.value && !isListeningForWorkflowEvents.value);
|
|
1852
|
+
const buttonIcon = computed(() => {
|
|
1853
|
+
if (props$1.icon) return props$1.icon;
|
|
1854
|
+
if (shouldGenerateCode.value) return "terminal";
|
|
1855
|
+
if (!isListeningForEvents.value && !props$1.hideIcon) return "flask-conical";
|
|
1856
|
+
});
|
|
1857
|
+
const shouldGenerateCode = computed(() => {
|
|
1858
|
+
if (node.value?.type !== "n8n-nodes-base.aiTransform") return false;
|
|
1859
|
+
if (!node.value?.parameters?.instructions) return false;
|
|
1860
|
+
if (!node.value?.parameters?.jsCode) return true;
|
|
1861
|
+
if (node.value?.parameters["codeGeneratedForPrompt"] && (node.value?.parameters?.instructions).trim() !== (node.value?.parameters?.["codeGeneratedForPrompt"]).trim()) return true;
|
|
1862
|
+
return false;
|
|
1863
|
+
});
|
|
1864
|
+
async function stopWaitingForWebhook() {
|
|
1865
|
+
try {
|
|
1866
|
+
await workflowsStore.removeTestWebhook(workflowsStore.workflowId);
|
|
1867
|
+
} catch (error) {
|
|
1868
|
+
toast.showError(error, "Error stopping webhook");
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
function testStepButtonPopupCount() {
|
|
1872
|
+
return Number(localStorage.getItem(NODE_TEST_STEP_POPUP_COUNT_KEY));
|
|
1873
|
+
}
|
|
1874
|
+
function onMouseOver() {
|
|
1875
|
+
const count = testStepButtonPopupCount();
|
|
1876
|
+
if (count < MAX_POPUP_COUNT && !disabledHint.value && tooltipText.value) {
|
|
1877
|
+
const now = Date.now();
|
|
1878
|
+
if (!lastPopupCountUpdate.value || now - lastPopupCountUpdate.value >= POPUP_UPDATE_DELAY) {
|
|
1879
|
+
localStorage.setItem(NODE_TEST_STEP_POPUP_COUNT_KEY, `${count + 1}`);
|
|
1880
|
+
lastPopupCountUpdate.value = now;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
async function onClick() {
|
|
1885
|
+
if (shouldGenerateCode.value) {
|
|
1886
|
+
codeGenerationInProgress.value = true;
|
|
1887
|
+
try {
|
|
1888
|
+
toast.showMessage({
|
|
1889
|
+
title: i18n.baseText("ndv.execute.generateCode.title"),
|
|
1890
|
+
message: i18n.baseText("ndv.execute.generateCode.message", { interpolate: { nodeName: node.value?.name } }),
|
|
1891
|
+
type: "success"
|
|
1892
|
+
});
|
|
1893
|
+
const prompt$1 = node.value?.parameters?.instructions;
|
|
1894
|
+
const updateInformation = await generateCodeForAiTransform(prompt$1, `parameters.${AI_TRANSFORM_JS_CODE}`, 5);
|
|
1895
|
+
if (!updateInformation) return;
|
|
1896
|
+
emit("valueChanged", updateInformation);
|
|
1897
|
+
emit("valueChanged", {
|
|
1898
|
+
name: `parameters.${AI_TRANSFORM_CODE_GENERATED_FOR_PROMPT}`,
|
|
1899
|
+
value: prompt$1
|
|
1900
|
+
});
|
|
1901
|
+
useTelemetry().trackAiTransform("generationFinished", {
|
|
1902
|
+
prompt: prompt$1,
|
|
1903
|
+
code: updateInformation.value
|
|
1904
|
+
});
|
|
1905
|
+
} catch (error) {
|
|
1906
|
+
useTelemetry().trackAiTransform("generationFinished", {
|
|
1907
|
+
prompt,
|
|
1908
|
+
code: "",
|
|
1909
|
+
hasError: true
|
|
1910
|
+
});
|
|
1911
|
+
toast.showMessage({
|
|
1912
|
+
type: "error",
|
|
1913
|
+
title: i18n.baseText("codeNodeEditor.askAi.generationFailed"),
|
|
1914
|
+
message: error.message
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
codeGenerationInProgress.value = false;
|
|
1918
|
+
}
|
|
1919
|
+
if (isChatNode.value || isChatChild.value && ndvStore.isInputPanelEmpty) {
|
|
1920
|
+
ndvStore.unsetActiveNodeName();
|
|
1921
|
+
workflowsStore.chatPartialExecutionDestinationNode = props$1.nodeName;
|
|
1922
|
+
nodeViewEventBus.emit("openChat");
|
|
1923
|
+
} else if (isListeningForEvents.value) await stopWaitingForWebhook();
|
|
1924
|
+
else if (isListeningForWorkflowEvents.value) {
|
|
1925
|
+
await stopCurrentExecution();
|
|
1926
|
+
emit("stopExecution");
|
|
1927
|
+
} else {
|
|
1928
|
+
let shouldUnpinAndExecute = false;
|
|
1929
|
+
if (pinnedData.hasData.value) {
|
|
1930
|
+
shouldUnpinAndExecute = await message.confirm(i18n.baseText("ndv.pinData.unpinAndExecute.description"), i18n.baseText("ndv.pinData.unpinAndExecute.title"), {
|
|
1931
|
+
confirmButtonText: i18n.baseText("ndv.pinData.unpinAndExecute.confirm"),
|
|
1932
|
+
cancelButtonText: i18n.baseText("ndv.pinData.unpinAndExecute.cancel")
|
|
1933
|
+
}) === MODAL_CONFIRM;
|
|
1934
|
+
if (shouldUnpinAndExecute && node.value) pinnedData.unsetData("unpin-and-execute-modal");
|
|
1935
|
+
}
|
|
1936
|
+
if (!pinnedData.hasData.value || shouldUnpinAndExecute) if (node.value && needsAgentInput(node.value)) uiStore.openModalWithData({
|
|
1937
|
+
name: FROM_AI_PARAMETERS_MODAL_KEY,
|
|
1938
|
+
data: { nodeName: props$1.nodeName }
|
|
1939
|
+
});
|
|
1940
|
+
else {
|
|
1941
|
+
const telemetryPayload = {
|
|
1942
|
+
node_type: nodeType.value ? nodeType.value.name : null,
|
|
1943
|
+
workflow_id: workflowsStore.workflowId,
|
|
1944
|
+
source: props$1.telemetrySource,
|
|
1945
|
+
push_ref: ndvStore.pushRef
|
|
1946
|
+
};
|
|
1947
|
+
telemetry.track("User clicked execute node button", telemetryPayload);
|
|
1948
|
+
await externalHooks.run("nodeExecuteButton.onClick", telemetryPayload);
|
|
1949
|
+
await runWorkflow({
|
|
1950
|
+
destinationNode: {
|
|
1951
|
+
nodeName: props$1.nodeName,
|
|
1952
|
+
mode: props$1.executionMode
|
|
1953
|
+
},
|
|
1954
|
+
source: "RunData.ExecuteNodeButton"
|
|
1955
|
+
});
|
|
1956
|
+
emit("execute");
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
return (_ctx, _cache) => {
|
|
1961
|
+
return openBlock(), createBlock(unref(N8nTooltip_default), {
|
|
1962
|
+
placement: _ctx.tooltipPlacement ?? "right",
|
|
1963
|
+
disabled: !tooltipText.value && !slots.persistentTooltipContent,
|
|
1964
|
+
visible: slots.persistentTooltipContent ? true : void 0
|
|
1965
|
+
}, {
|
|
1966
|
+
content: withCtx(() => [renderSlot(_ctx.$slots, "persistentTooltipContent", {}, () => [createTextVNode(toDisplayString(tooltipText.value), 1)])]),
|
|
1967
|
+
default: withCtx(() => [createVNode(unref(N8nButton_default), mergeProps(_ctx.$attrs, {
|
|
1968
|
+
loading: isLoading.value && _ctx.showLoadingSpinner,
|
|
1969
|
+
disabled: _ctx.disabled || !!disabledHint.value || isLoading.value && !_ctx.showLoadingSpinner,
|
|
1970
|
+
label: buttonLabel.value,
|
|
1971
|
+
type: _ctx.type,
|
|
1972
|
+
size: _ctx.size,
|
|
1973
|
+
icon: buttonIcon.value,
|
|
1974
|
+
square: _ctx.square,
|
|
1975
|
+
"transparent-background": _ctx.transparent,
|
|
1976
|
+
title: !isTriggerNode.value && !tooltipText.value ? unref(i18n).baseText("ndv.execute.testNode.description") : "",
|
|
1977
|
+
onMouseover: onMouseOver,
|
|
1978
|
+
onClick
|
|
1979
|
+
}), null, 16, [
|
|
1980
|
+
"loading",
|
|
1981
|
+
"disabled",
|
|
1982
|
+
"label",
|
|
1983
|
+
"type",
|
|
1984
|
+
"size",
|
|
1985
|
+
"icon",
|
|
1986
|
+
"square",
|
|
1987
|
+
"transparent-background",
|
|
1988
|
+
"title"
|
|
1989
|
+
])]),
|
|
1990
|
+
_: 3
|
|
1991
|
+
}, 8, [
|
|
1992
|
+
"placement",
|
|
1993
|
+
"disabled",
|
|
1994
|
+
"visible"
|
|
1995
|
+
]);
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
var import_pick = /* @__PURE__ */ __toESM(require_pick());
|
|
2000
|
+
var VirtualSchema_default = /* @__PURE__ */ __plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2001
|
+
__name: "VirtualSchema",
|
|
2002
|
+
props: {
|
|
2003
|
+
nodes: { default: () => [] },
|
|
2004
|
+
node: { default: null },
|
|
2005
|
+
data: { default: () => [] },
|
|
2006
|
+
mappingEnabled: {
|
|
2007
|
+
type: Boolean,
|
|
2008
|
+
default: false
|
|
2009
|
+
},
|
|
2010
|
+
paneType: {},
|
|
2011
|
+
connectionType: { default: NodeConnectionTypes.Main },
|
|
2012
|
+
search: { default: "" },
|
|
2013
|
+
compact: {
|
|
2014
|
+
type: Boolean,
|
|
2015
|
+
default: false
|
|
2016
|
+
},
|
|
2017
|
+
outputIndex: { default: void 0 },
|
|
2018
|
+
previewExecution: { default: void 0 },
|
|
2019
|
+
truncateLimit: { default: 600 }
|
|
2020
|
+
},
|
|
2021
|
+
emits: ["clear:search", "execute"],
|
|
2022
|
+
setup(__props, { emit: __emit }) {
|
|
2023
|
+
const props$1 = __props;
|
|
2024
|
+
const telemetry = useTelemetry();
|
|
2025
|
+
const telemetryContext = useTelemetryContext();
|
|
2026
|
+
const i18n = useI18n();
|
|
2027
|
+
const ndvStore = useNDVStore();
|
|
2028
|
+
const nodeTypesStore = useNodeTypesStore();
|
|
2029
|
+
const workflowsStore = useWorkflowsStore();
|
|
2030
|
+
const schemaPreviewStore = useSchemaPreviewStore();
|
|
2031
|
+
const environmentsStore = environments_store_default();
|
|
2032
|
+
const settingsStore = useSettingsStore();
|
|
2033
|
+
const { getSchemaForExecutionData, getSchemaForJsonSchema, getSchema, filterSchema } = useDataSchema();
|
|
2034
|
+
const { closedNodes, flattenSchema, flattenMultipleSchemas, toggleNode } = useFlattenSchema();
|
|
2035
|
+
const { getNodeInputData, getLastRunIndexWithData, hasNodeExecuted } = useNodeHelpers();
|
|
2036
|
+
const emit = __emit;
|
|
2037
|
+
const scroller = ref();
|
|
2038
|
+
const closedNodesBeforeSearch = ref(/* @__PURE__ */ new Set());
|
|
2039
|
+
const canDraggableDrop = computed(() => ndvStore.canDraggableDrop);
|
|
2040
|
+
const draggableStickyPosition = computed(() => ndvStore.draggableStickyPos);
|
|
2041
|
+
const toggleNodeExclusiveAndScrollTop = (id) => {
|
|
2042
|
+
if (closedNodes.value.has(id)) closedNodes.value = new Set(items.value.map((item) => item.id));
|
|
2043
|
+
toggleNode(id);
|
|
2044
|
+
scroller.value?.scrollToItem(0);
|
|
2045
|
+
};
|
|
2046
|
+
const getNodeSchema = async (fullNode, connectedNode) => {
|
|
2047
|
+
const pinData = workflowsStore.pinDataByNodeName(connectedNode.name);
|
|
2048
|
+
const isNodeExecuted = (pinData ? pinData.length > 0 : false) || hasNodeExecuted(connectedNode.name);
|
|
2049
|
+
const previewExecutionData = !isNodeExecuted && props$1.previewExecution ? props$1.previewExecution.data : void 0;
|
|
2050
|
+
const connectedOutputIndexes = connectedNode.indicies.length > 0 ? connectedNode.indicies : [0];
|
|
2051
|
+
const connectedOutputsWithData = connectedOutputIndexes.map((outputIndex) => ({
|
|
2052
|
+
outputIndex,
|
|
2053
|
+
runIndex: getLastRunIndexWithData(fullNode.name, outputIndex, props$1.connectionType, previewExecutionData)
|
|
2054
|
+
})).filter(({ runIndex }) => runIndex !== -1);
|
|
2055
|
+
let filteredOutputsWithData = connectedOutputsWithData;
|
|
2056
|
+
if (props$1.outputIndex !== void 0 && connectedOutputIndexes.length > 1 && connectedOutputIndexes.includes(props$1.outputIndex)) filteredOutputsWithData = connectedOutputsWithData.filter(({ outputIndex }) => outputIndex === props$1.outputIndex);
|
|
2057
|
+
const nodeData = filteredOutputsWithData.map(({ outputIndex, runIndex }) => {
|
|
2058
|
+
return getNodeInputData(fullNode, runIndex, outputIndex, props$1.paneType, props$1.connectionType, previewExecutionData);
|
|
2059
|
+
}).flat();
|
|
2060
|
+
const hasBinary = nodeData.some((data$1) => !isEmpty(data$1.binary));
|
|
2061
|
+
const data = pinData ?? executionDataToJson(nodeData);
|
|
2062
|
+
const isDataEmpty = data.length === 0 || data.length === 1 && Object.keys(data[0]).length === 0;
|
|
2063
|
+
let schema = getSchemaForExecutionData(data);
|
|
2064
|
+
const lastSuccessfulPreview = !isDataEmpty && Boolean(previewExecutionData);
|
|
2065
|
+
let preview = lastSuccessfulPreview;
|
|
2066
|
+
if (isDataEmpty && !preview) {
|
|
2067
|
+
const previewSchema = await getSchemaPreview(fullNode);
|
|
2068
|
+
if (previewSchema.ok) {
|
|
2069
|
+
schema = getSchemaForJsonSchema(previewSchema.result);
|
|
2070
|
+
preview = true;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
return {
|
|
2074
|
+
schema,
|
|
2075
|
+
connectedOutputIndexes,
|
|
2076
|
+
itemsCount: !isDataEmpty ? data.length : 0,
|
|
2077
|
+
runIndex: connectedOutputsWithData[0]?.runIndex ?? 0,
|
|
2078
|
+
preview,
|
|
2079
|
+
lastSuccessfulPreview,
|
|
2080
|
+
hasBinary,
|
|
2081
|
+
isNodeExecuted,
|
|
2082
|
+
isDataEmpty
|
|
2083
|
+
};
|
|
2084
|
+
};
|
|
2085
|
+
const isVariablesEnabled = computed(() => settingsStore.isEnterpriseFeatureEnabled[EnterpriseEditionFeature.Variables]);
|
|
2086
|
+
const contextSchema = computed(() => {
|
|
2087
|
+
const $vars = environmentsStore.variablesAsObject;
|
|
2088
|
+
return filterSchema(getSchema({
|
|
2089
|
+
$now: DateTime.now().toISO(),
|
|
2090
|
+
$today: DateTime.now().set({
|
|
2091
|
+
hour: 0,
|
|
2092
|
+
minute: 0,
|
|
2093
|
+
second: 0,
|
|
2094
|
+
millisecond: 0
|
|
2095
|
+
}).toISO(),
|
|
2096
|
+
$vars,
|
|
2097
|
+
$execution: {
|
|
2098
|
+
id: PLACEHOLDER_FILLED_AT_EXECUTION_TIME,
|
|
2099
|
+
mode: "test",
|
|
2100
|
+
resumeUrl: i18n.baseText("dataMapping.schemaView.execution.resumeUrl")
|
|
2101
|
+
},
|
|
2102
|
+
$workflow: (0, import_pick.default)(workflowsStore.workflow, [
|
|
2103
|
+
"id",
|
|
2104
|
+
"name",
|
|
2105
|
+
"active"
|
|
2106
|
+
])
|
|
2107
|
+
}), props$1.search);
|
|
2108
|
+
});
|
|
2109
|
+
const contextItems = computed(() => {
|
|
2110
|
+
const header = {
|
|
2111
|
+
id: "variables",
|
|
2112
|
+
type: "header",
|
|
2113
|
+
title: i18n.baseText("dataMapping.schemaView.variablesContextTitle"),
|
|
2114
|
+
collapsable: true,
|
|
2115
|
+
itemCount: null
|
|
2116
|
+
};
|
|
2117
|
+
if (closedNodes.value.has(header.id)) return [header];
|
|
2118
|
+
const schema = contextSchema.value;
|
|
2119
|
+
if (!schema) return [];
|
|
2120
|
+
const fields = flattenSchema({
|
|
2121
|
+
schema,
|
|
2122
|
+
depth: 1,
|
|
2123
|
+
isDataEmpty: false,
|
|
2124
|
+
truncateLimit: props$1.truncateLimit
|
|
2125
|
+
}).flatMap((renderItem) => {
|
|
2126
|
+
if (renderItem.type === "item" && renderItem.depth === 1 && renderItem.title === "$vars") {
|
|
2127
|
+
const isVarsOpen = !closedNodes.value.has(renderItem.id);
|
|
2128
|
+
if (!isVariablesEnabled.value) {
|
|
2129
|
+
renderItem.collapsable = false;
|
|
2130
|
+
renderItem.locked = true;
|
|
2131
|
+
renderItem.lockedTooltip = i18n.baseText("dataMapping.schemaView.variablesUpgrade");
|
|
2132
|
+
return renderItem;
|
|
2133
|
+
}
|
|
2134
|
+
if (isVarsOpen && environmentsStore.scopedVariables.length === 0) return [renderItem, {
|
|
2135
|
+
type: "notice",
|
|
2136
|
+
id: "notice-variablesEmpty",
|
|
2137
|
+
level: renderItem.level ?? 0,
|
|
2138
|
+
message: i18n.baseText("dataMapping.schemaView.variablesEmpty")
|
|
2139
|
+
}];
|
|
2140
|
+
}
|
|
2141
|
+
return renderItem;
|
|
2142
|
+
});
|
|
2143
|
+
return [header].concat(fields);
|
|
2144
|
+
});
|
|
2145
|
+
const nodeSchema = computedAsync(async () => {
|
|
2146
|
+
const search = props$1.search;
|
|
2147
|
+
if (props$1.data.length === 0) {
|
|
2148
|
+
const previewSchema = await getSchemaPreview(props$1.node);
|
|
2149
|
+
if (previewSchema.ok) return filterSchema(getSchemaForJsonSchema(previewSchema.result), search);
|
|
2150
|
+
}
|
|
2151
|
+
return filterSchema(getSchemaForExecutionData(props$1.data), search);
|
|
2152
|
+
}, null);
|
|
2153
|
+
async function getSchemaPreview(node) {
|
|
2154
|
+
if (!node) return createResultError(/* @__PURE__ */ new Error());
|
|
2155
|
+
if (nodeTypesStore.getNodeType(node.type, node.typeVersion)?.group.includes("trigger")) return createResultError(/* @__PURE__ */ new Error("Trigger nodes do not have schema previews"));
|
|
2156
|
+
const { type, typeVersion, parameters: { resource, operation } } = node;
|
|
2157
|
+
return await schemaPreviewStore.getSchemaPreview({
|
|
2158
|
+
nodeType: type,
|
|
2159
|
+
version: typeVersion,
|
|
2160
|
+
resource,
|
|
2161
|
+
operation
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
const nodesSchemas = computedAsync(async () => {
|
|
2165
|
+
const result = [];
|
|
2166
|
+
const search = props$1.search;
|
|
2167
|
+
for (const node of props$1.nodes) {
|
|
2168
|
+
const fullNode = workflowsStore.getNodeByName(node.name);
|
|
2169
|
+
if (!fullNode) continue;
|
|
2170
|
+
const nodeType = nodeTypesStore.getNodeType(fullNode.type, fullNode.typeVersion);
|
|
2171
|
+
if (!nodeType) continue;
|
|
2172
|
+
const { schema, connectedOutputIndexes, itemsCount, preview, hasBinary, isNodeExecuted, isDataEmpty, runIndex, lastSuccessfulPreview } = await getNodeSchema(fullNode, node);
|
|
2173
|
+
const filteredSchema = filterSchema(schema, search);
|
|
2174
|
+
if (!filteredSchema) continue;
|
|
2175
|
+
result.push({
|
|
2176
|
+
node: fullNode,
|
|
2177
|
+
connectedOutputIndexes,
|
|
2178
|
+
depth: node.depth,
|
|
2179
|
+
itemsCount,
|
|
2180
|
+
nodeType,
|
|
2181
|
+
schema: filteredSchema,
|
|
2182
|
+
preview,
|
|
2183
|
+
hasBinary,
|
|
2184
|
+
isNodeExecuted,
|
|
2185
|
+
isDataEmpty,
|
|
2186
|
+
runIndex,
|
|
2187
|
+
lastSuccessfulPreview
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
return result;
|
|
2191
|
+
}, []);
|
|
2192
|
+
const nodeAdditionalInfo = (node) => {
|
|
2193
|
+
const returnData = [];
|
|
2194
|
+
if (node.disabled) returnData.push(i18n.baseText("node.disabled"));
|
|
2195
|
+
const connections = ndvStore.ndvNodeInputNumber[node.name];
|
|
2196
|
+
if (connections) if (connections.length === 1) returnData.push(`Input ${connections}`);
|
|
2197
|
+
else returnData.push(`Inputs ${connections.join(", ")}`);
|
|
2198
|
+
return returnData.length ? `(${returnData.join(" | ")})` : "";
|
|
2199
|
+
};
|
|
2200
|
+
const flattenedNodes = computed(() => flattenMultipleSchemas(nodesSchemas.value, nodeAdditionalInfo, props$1.truncateLimit));
|
|
2201
|
+
const flattenNodeSchema = computed(() => nodeSchema.value ? flattenSchema({
|
|
2202
|
+
schema: nodeSchema.value,
|
|
2203
|
+
depth: 0,
|
|
2204
|
+
level: -1,
|
|
2205
|
+
isDataEmpty: props$1.data.length === 0,
|
|
2206
|
+
truncateLimit: props$1.truncateLimit
|
|
2207
|
+
}) : []);
|
|
2208
|
+
const isDebugging = computed(() => !props$1.nodes.length);
|
|
2209
|
+
const items = computed(() => {
|
|
2210
|
+
if (isDebugging.value || props$1.paneType === "output") return flattenNodeSchema.value;
|
|
2211
|
+
return flattenedNodes.value.concat(contextItems.value);
|
|
2212
|
+
});
|
|
2213
|
+
const noSearchResults = computed(() => {
|
|
2214
|
+
return Boolean(props$1.search.trim()) && !items.value.length;
|
|
2215
|
+
});
|
|
2216
|
+
watch(() => Boolean(props$1.search), (hasSearch) => {
|
|
2217
|
+
if (hasSearch) {
|
|
2218
|
+
closedNodesBeforeSearch.value = new Set(closedNodes.value);
|
|
2219
|
+
closedNodes.value.clear();
|
|
2220
|
+
} else if (closedNodes.value.size === 0) closedNodes.value = closedNodesBeforeSearch.value;
|
|
2221
|
+
});
|
|
2222
|
+
const unwatchItems = watch(items, (newItems) => {
|
|
2223
|
+
if (newItems.length < 2) return;
|
|
2224
|
+
closedNodes.value = new Set(newItems.filter((item) => item.type === "header").slice(1).map((item) => item.id));
|
|
2225
|
+
unwatchItems();
|
|
2226
|
+
});
|
|
2227
|
+
const onDragStart = (el, data) => {
|
|
2228
|
+
ndvStore.draggableStartDragging({
|
|
2229
|
+
type: "mapping",
|
|
2230
|
+
data: data ?? "",
|
|
2231
|
+
dimensions: el?.getBoundingClientRect() ?? null
|
|
2232
|
+
});
|
|
2233
|
+
ndvStore.resetMappingTelemetry();
|
|
2234
|
+
};
|
|
2235
|
+
const onDragEnd = (el) => {
|
|
2236
|
+
ndvStore.draggableStopDragging();
|
|
2237
|
+
setTimeout(() => {
|
|
2238
|
+
const mappingTelemetry = ndvStore.mappingTelemetry;
|
|
2239
|
+
const parentNode = nodesSchemas.value.find(({ node }) => node.name === el.dataset.nodeName);
|
|
2240
|
+
const isPreview = parentNode?.preview ?? false;
|
|
2241
|
+
const hasCredential = !isEmpty(parentNode?.node.credentials);
|
|
2242
|
+
const runIndex = Number(el.dataset.runIndex);
|
|
2243
|
+
const telemetryPayload = {
|
|
2244
|
+
src_node_type: el.dataset.nodeType,
|
|
2245
|
+
src_field_name: el.dataset.name ?? "",
|
|
2246
|
+
src_nodes_back: el.dataset.depth,
|
|
2247
|
+
src_run_index: runIndex,
|
|
2248
|
+
src_runs_total: runIndex,
|
|
2249
|
+
src_field_nest_level: el.dataset.level ?? 0,
|
|
2250
|
+
src_view: isPreview ? "schema_preview" : "schema",
|
|
2251
|
+
src_has_credential: hasCredential,
|
|
2252
|
+
src_element: el,
|
|
2253
|
+
success: false,
|
|
2254
|
+
view_shown: telemetryContext.view_shown,
|
|
2255
|
+
...mappingTelemetry
|
|
2256
|
+
};
|
|
2257
|
+
useExternalHooks().run("runDataJson.onDragEnd", telemetryPayload);
|
|
2258
|
+
telemetry.track("User dragged data for mapping", telemetryPayload);
|
|
2259
|
+
}, 250);
|
|
2260
|
+
};
|
|
2261
|
+
return (_ctx, _cache) => {
|
|
2262
|
+
const _directive_n8n_html = resolveDirective("n8n-html");
|
|
2263
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass([
|
|
2264
|
+
"run-data-schema",
|
|
2265
|
+
"full-height",
|
|
2266
|
+
{
|
|
2267
|
+
compact: props$1.compact,
|
|
2268
|
+
"no-search-results": noSearchResults.value
|
|
2269
|
+
}
|
|
2270
|
+
]) }, [noSearchResults.value ? (openBlock(), createBlock(NDVEmptyState_default, {
|
|
2271
|
+
key: 0,
|
|
2272
|
+
title: unref(i18n).baseText("ndv.search.noNodeMatch.title")
|
|
2273
|
+
}, {
|
|
2274
|
+
default: withCtx(() => [createVNode(unref(I18nT), {
|
|
2275
|
+
keypath: "ndv.search.noMatchSchema.description",
|
|
2276
|
+
tag: "span",
|
|
2277
|
+
scope: "global"
|
|
2278
|
+
}, {
|
|
2279
|
+
link: withCtx(() => [createBaseVNode("a", {
|
|
2280
|
+
href: "#",
|
|
2281
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("clear:search"), ["prevent"]))
|
|
2282
|
+
}, toDisplayString(unref(i18n).baseText("ndv.search.noMatchSchema.description.link")), 1)]),
|
|
2283
|
+
_: 1
|
|
2284
|
+
})]),
|
|
2285
|
+
_: 1
|
|
2286
|
+
}, 8, ["title"])) : createCommentVNode("", true), items.value.length ? (openBlock(), createBlock(Draggable_default, {
|
|
2287
|
+
key: 1,
|
|
2288
|
+
class: "full-height",
|
|
2289
|
+
type: "mapping",
|
|
2290
|
+
"target-data-key": "mappable",
|
|
2291
|
+
disabled: !_ctx.mappingEnabled,
|
|
2292
|
+
"can-drop": canDraggableDrop.value,
|
|
2293
|
+
"sticky-position": draggableStickyPosition.value,
|
|
2294
|
+
onDragstart: onDragStart,
|
|
2295
|
+
onDragend: onDragEnd
|
|
2296
|
+
}, {
|
|
2297
|
+
preview: withCtx(({ canDrop, el }) => [el ? (openBlock(), createBlock(MappingPill_default, {
|
|
2298
|
+
key: 0,
|
|
2299
|
+
html: el.outerHTML,
|
|
2300
|
+
"can-drop": canDrop
|
|
2301
|
+
}, null, 8, ["html", "can-drop"])) : createCommentVNode("", true)]),
|
|
2302
|
+
default: withCtx(() => [createVNode(unref(script$1), {
|
|
2303
|
+
ref_key: "scroller",
|
|
2304
|
+
ref: scroller,
|
|
2305
|
+
items: items.value,
|
|
2306
|
+
"min-item-size": 38,
|
|
2307
|
+
class: "full-height scroller"
|
|
2308
|
+
}, {
|
|
2309
|
+
default: withCtx(({ item, index, active }) => [createVNode(unref(script), {
|
|
2310
|
+
item,
|
|
2311
|
+
active,
|
|
2312
|
+
"size-dependencies": [item],
|
|
2313
|
+
"data-index": index
|
|
2314
|
+
}, {
|
|
2315
|
+
default: withCtx(() => [item.type === "header" ? (openBlock(), createBlock(VirtualSchemaHeader_default, mergeProps({ key: 0 }, item, {
|
|
2316
|
+
collapsed: unref(closedNodes).has(item.id),
|
|
2317
|
+
"onClick:toggle": ($event) => unref(toggleNode)(item.id),
|
|
2318
|
+
onClick: ($event) => toggleNodeExclusiveAndScrollTop(item.id),
|
|
2319
|
+
onExecute: _cache[1] || (_cache[1] = (nodeName) => emit("execute", nodeName))
|
|
2320
|
+
}), null, 16, [
|
|
2321
|
+
"collapsed",
|
|
2322
|
+
"onClick:toggle",
|
|
2323
|
+
"onClick"
|
|
2324
|
+
])) : item.type === "item" ? (openBlock(), createBlock(VirtualSchemaItem_default, mergeProps({ key: 1 }, item, {
|
|
2325
|
+
search: _ctx.search,
|
|
2326
|
+
draggable: _ctx.mappingEnabled,
|
|
2327
|
+
collapsed: unref(closedNodes).has(item.id),
|
|
2328
|
+
highlight: unref(ndvStore).highlightDraggables,
|
|
2329
|
+
onClick: ($event) => unref(toggleNode)(item.id)
|
|
2330
|
+
}), null, 16, [
|
|
2331
|
+
"search",
|
|
2332
|
+
"draggable",
|
|
2333
|
+
"collapsed",
|
|
2334
|
+
"highlight",
|
|
2335
|
+
"onClick"
|
|
2336
|
+
])) : item.type === "icon" ? (openBlock(), createBlock(unref(N8nTooltip_default), {
|
|
2337
|
+
key: 2,
|
|
2338
|
+
content: item.tooltip,
|
|
2339
|
+
placement: "top"
|
|
2340
|
+
}, {
|
|
2341
|
+
default: withCtx(() => [createVNode(unref(N8nIcon_default), {
|
|
2342
|
+
size: "small",
|
|
2343
|
+
icon: item.icon,
|
|
2344
|
+
class: "icon"
|
|
2345
|
+
}, null, 8, ["icon"])]),
|
|
2346
|
+
_: 2
|
|
2347
|
+
}, 1032, ["content"])) : item.type === "notice" ? withDirectives((openBlock(), createElementBlock("div", {
|
|
2348
|
+
key: 3,
|
|
2349
|
+
class: "notice",
|
|
2350
|
+
style: normalizeStyle({ "--schema-level": item.level })
|
|
2351
|
+
}, null, 4)), [[_directive_n8n_html, item.message]]) : item.type === "empty" ? (openBlock(), createElementBlock("div", {
|
|
2352
|
+
key: 4,
|
|
2353
|
+
class: "empty-schema",
|
|
2354
|
+
style: normalizeStyle({ "--schema-level": item.level })
|
|
2355
|
+
}, [createVNode(unref(N8nText_default), {
|
|
2356
|
+
tag: "div",
|
|
2357
|
+
size: "small"
|
|
2358
|
+
}, {
|
|
2359
|
+
default: withCtx(() => [item.key === "executeSchema" ? (openBlock(), createBlock(unref(I18nT), {
|
|
2360
|
+
key: 0,
|
|
2361
|
+
tag: "span",
|
|
2362
|
+
keypath: "dataMapping.schemaView.executeSchema",
|
|
2363
|
+
scope: "global"
|
|
2364
|
+
}, {
|
|
2365
|
+
link: withCtx(() => [unref(ndvStore).activeNodeName ? (openBlock(), createBlock(NodeExecuteButton_default, {
|
|
2366
|
+
key: 0,
|
|
2367
|
+
"node-name": unref(ndvStore).activeNodeName,
|
|
2368
|
+
label: unref(i18n).baseText("ndv.input.noOutputData.executePrevious"),
|
|
2369
|
+
"telemetry-source": "inputs",
|
|
2370
|
+
size: "small",
|
|
2371
|
+
type: "secondary",
|
|
2372
|
+
"hide-icon": "",
|
|
2373
|
+
"execution-mode": "exclusive"
|
|
2374
|
+
}, null, 8, ["node-name", "label"])) : createCommentVNode("", true)]),
|
|
2375
|
+
_: 1
|
|
2376
|
+
})) : (openBlock(), createBlock(unref(I18nT), {
|
|
2377
|
+
key: 1,
|
|
2378
|
+
tag: "span",
|
|
2379
|
+
keypath: `dataMapping.schemaView.${item.key}`,
|
|
2380
|
+
scope: "global"
|
|
2381
|
+
}, null, 8, ["keypath"]))]),
|
|
2382
|
+
_: 2
|
|
2383
|
+
}, 1024)], 4)) : createCommentVNode("", true)]),
|
|
2384
|
+
_: 2
|
|
2385
|
+
}, 1032, [
|
|
2386
|
+
"item",
|
|
2387
|
+
"active",
|
|
2388
|
+
"size-dependencies",
|
|
2389
|
+
"data-index"
|
|
2390
|
+
])]),
|
|
2391
|
+
_: 1
|
|
2392
|
+
}, 8, ["items"])]),
|
|
2393
|
+
_: 1
|
|
2394
|
+
}, 8, [
|
|
2395
|
+
"disabled",
|
|
2396
|
+
"can-drop",
|
|
2397
|
+
"sticky-position"
|
|
2398
|
+
])) : createCommentVNode("", true)], 2);
|
|
2399
|
+
};
|
|
2400
|
+
}
|
|
2401
|
+
}), [["__scopeId", "data-v-5923489c"]]);
|
|
2402
|
+
export { getTextareaCursorPosition as a, script$1 as c, getParentNodes as i, NodeExecuteButton_default as n, getUpdatedTextareaValue as o, generateCodeForAiTransform as r, script as s, VirtualSchema_default as t };
|