n8n-editor-ui 1.110.0 → 1.111.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.
Files changed (121) hide show
  1. package/dist/assets/{AddDataStoreModal-B9V0kmK3.js → AddDataStoreModal-COmj3tI8.js} +9 -4
  2. package/dist/assets/{AnimatedSpinner-DsluWUrA.js → AnimatedSpinner-BRe0Ugab.js} +1 -1
  3. package/dist/assets/{AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-CRU6PTDq.js → AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-BllZkKe3.js} +1 -1
  4. package/dist/assets/{AuthView-D6CVGqjD.js → AuthView-z58gFjsc.js} +2 -2
  5. package/dist/assets/{ChangePasswordView-YYerxuPJ.js → ChangePasswordView-DUmtjPAx.js} +3 -3
  6. package/dist/assets/CollectionParameter--MG-Jsbv.js +4 -0
  7. package/dist/assets/{ConsumedTokensDetails.vue_vue_type_script_setup_true_lang-upvzJHw_.js → ConsumedTokensDetails.vue_vue_type_script_setup_true_lang-4IRcAtjj.js} +1 -1
  8. package/dist/assets/{CredentialsView-DOTUEbkP.js → CredentialsView-Ie0l_odH.js} +9 -9
  9. package/dist/assets/{DataStoreActions.vue_vue_type_script_setup_true_lang-BsbILsds.js → DataStoreActions.vue_vue_type_script_setup_true_lang-d31tni9q.js} +7 -2
  10. package/dist/assets/{DataStoreDetailsView-DSpK3R_L.css → DataStoreDetailsView-BPsHPucD.css} +44 -44
  11. package/dist/assets/{DataStoreDetailsView-B_TSNGAN.js → DataStoreDetailsView-DLuRcsh-.js} +1077 -667
  12. package/dist/assets/{DataStoreView-BvrQf26p.js → DataStoreView-DmY3FIsv.js} +9 -9
  13. package/dist/assets/{DemoFooter-Bw8iTzqE.js → DemoFooter-BQj55pTx.js} +6 -6
  14. package/dist/assets/{EmptySharedSectionActionBox.vue_vue_type_script_setup_true_lang-GKs7cbkR.js → EmptySharedSectionActionBox.vue_vue_type_script_setup_true_lang-NJbsTbk5.js} +1 -1
  15. package/dist/assets/{EntityNotFound-CXLwU46X.js → EntityNotFound-B1VWHiBa.js} +1 -1
  16. package/dist/assets/{EntityUnAuthorised-D_OocRok.js → EntityUnAuthorised-B0Yg7JWa.js} +1 -1
  17. package/dist/assets/{ErrorView-Ddve61SR.js → ErrorView-aHqCD3ri.js} +1 -1
  18. package/dist/assets/{EvaluationsRootView-CwnpaTOj.js → EvaluationsRootView-CoYRtuEz.js} +1 -1
  19. package/dist/assets/{EvaluationsView-qyuUuYXa.js → EvaluationsView-BC1UMOb0.js} +3 -3
  20. package/dist/assets/{ExecutionsTime.vue_vue_type_script_setup_true_lang-BUewTSGd.js → ExecutionsTime.vue_vue_type_script_setup_true_lang-CMR49MM7.js} +2 -2
  21. package/dist/assets/{ExecutionsView-DJrYHBv3.js → ExecutionsView-C8r32amj.js} +9 -9
  22. package/dist/assets/{FixedCollectionParameter-DwEogsZk.js → FixedCollectionParameter-BzZrk2iw.js} +1 -1
  23. package/dist/assets/{ForgotMyPasswordView-DI84hvl-.js → ForgotMyPasswordView-CaXCwrIx.js} +3 -3
  24. package/dist/assets/{InfoAccordion-BE3HeAda.js → InfoAccordion-DUHSL9ZE.js} +1 -1
  25. package/dist/assets/{InsightsChartAverageRuntime-BtvhyT4O.js → InsightsChartAverageRuntime-DFunYdc9.js} +4 -4
  26. package/dist/assets/{InsightsChartFailed-dkCtU8dv.js → InsightsChartFailed-0uRNHiAU.js} +4 -4
  27. package/dist/assets/{InsightsChartFailureRate-WuP5IVli.js → InsightsChartFailureRate-BuiZokRI.js} +4 -4
  28. package/dist/assets/{InsightsChartTimeSaved-fJ4sJVOO.js → InsightsChartTimeSaved-CK46Eo2R.js} +4 -4
  29. package/dist/assets/{InsightsChartTotal-iySL1IzO.js → InsightsChartTotal-ZhGp0D6c.js} +4 -4
  30. package/dist/assets/{InsightsDashboard-CWQypWnL.js → InsightsDashboard-DEJEg2jy.js} +10 -10
  31. package/dist/assets/{InsightsPaywall-xxlsNh03.js → InsightsPaywall-CEYbNF-U.js} +1 -1
  32. package/dist/assets/{InsightsSummary-B9ja1nMH.js → InsightsSummary-D4c0lwdE.js} +1 -1
  33. package/dist/assets/{InsightsTableWorkflows-C6FAPyPO.js → InsightsTableWorkflows-Cf2s_w2o.js} +4 -4
  34. package/dist/assets/{Logo-D7CE2pbe.js → Logo-DF7Ve1nG.js} +1 -1
  35. package/dist/assets/{LogsPanel-BiYKXufL.js → LogsPanel-Dz_R5wsR.js} +7 -6
  36. package/dist/assets/{MainHeader-pDg5KXTB.css → MainHeader-6lIHYgJG.css} +16 -16
  37. package/dist/assets/{MainHeader-CglQ1iop.js → MainHeader-DBWR1wTC.js} +12 -13
  38. package/dist/assets/{MainSidebar-CwXyHnb4.js → MainSidebar-3_9O8-rJ.js} +2 -2
  39. package/dist/assets/{NodeCreation-o_K0NT5J.js → NodeCreation-Dtlm36Oq.js} +3 -3
  40. package/dist/assets/{NodeCreator-b-LnZdSN.js → NodeCreator-DUoi7nAW.js} +3 -6
  41. package/dist/assets/{NodeDetailsView-DUVQMLye.js → NodeDetailsView-Di4Qgo0H.js} +13 -13
  42. package/dist/assets/{NodeDetailsViewV2-BQ8TJyUD.js → NodeDetailsViewV2-DeY6N1Bz.js} +13 -13
  43. package/dist/assets/{NodeView-BRa11kAq.css → NodeView-DMJpfBYR.css} +66 -30
  44. package/dist/assets/{NodeView-DbmrvKR2.js → NodeView-DsbJeAY_.js} +106 -48
  45. package/dist/assets/{PageViewLayout-DZqdTTmk.js → PageViewLayout-DC6xqvMl.js} +1 -1
  46. package/dist/assets/{PrebuiltAgentTemplatesView-WwV7YqEW.js → PrebuiltAgentTemplatesView-Bf_4L0Mz.js} +2 -2
  47. package/dist/assets/{ProjectBreadcrumb-BI6swolU.js → ProjectBreadcrumb-OJlbtg71.js} +1 -1
  48. package/dist/assets/{ProjectHeader-CnsOY_oX.js → ProjectHeader-CuQxn8hj.js} +2 -2
  49. package/dist/assets/{ProjectSettings-EJHNdA8h.js → ProjectSettings-CyyS1dIR.js} +3 -3
  50. package/dist/assets/{PushConnectionTracker.vue_vue_type_script_setup_true_lang-CLOnjTDY.js → PushConnectionTracker.vue_vue_type_script_setup_true_lang-DbrwK8IB.js} +1 -1
  51. package/dist/assets/{ResourcesListLayout-DhiDqjXw.js → ResourcesListLayout-i7do2ZBR.js} +6 -6
  52. package/dist/assets/{ResourcesListLayout-B5eMf4SI.css → ResourcesListLayout-vTwRIDRz.css} +8 -8
  53. package/dist/assets/{RunDataJson-B2NTI_mB.js → RunDataJson-DRtbtIz3.js} +3 -3
  54. package/dist/assets/{RunDataJsonActions-DXk7AkuZ.js → RunDataJsonActions-7l2QvE2z.js} +1 -1
  55. package/dist/assets/{RunDataParsedAiContent-DO8FIZ0n.js → RunDataParsedAiContent-CD12A0kN.js} +2 -2
  56. package/dist/assets/{RunDataSearch-B3I1BHmn.js → RunDataSearch-LNeMq9j6.js} +1 -1
  57. package/dist/assets/{RunDataTable-B1jJSa32.js → RunDataTable-DcKBX4aO.js} +1 -1
  58. package/dist/assets/{SamlOnboarding-DNKahChr.js → SamlOnboarding-i5e6HuF6.js} +3 -3
  59. package/dist/assets/{SelectedItemsInfo-Dc4Okb_S.js → SelectedItemsInfo-C55zD1dl.js} +1 -1
  60. package/dist/assets/{SettingsApiView-B1JK9R6f.js → SettingsApiView-C3ju5H4H.js} +1 -1
  61. package/dist/assets/{SettingsCommunityNodesView-PgfaI_WI.js → SettingsCommunityNodesView-i_vIhGwd.js} +4 -4
  62. package/dist/assets/{SettingsExternalSecrets-BZ3lZITS.js → SettingsExternalSecrets-ChCiOX-n.js} +1 -1
  63. package/dist/assets/{SettingsLdapView-MUSj3Las.js → SettingsLdapView-2QEfpHy6.js} +1 -1
  64. package/dist/assets/{SettingsLogStreamingView-g4sm9ihp.js → SettingsLogStreamingView-BORk25bO.js} +1 -1
  65. package/dist/assets/{SettingsPersonalView-DZscNVF5.js → SettingsPersonalView-Yl43xiM_.js} +1 -1
  66. package/dist/assets/{SettingsSourceControl-CaCqYmDO.js → SettingsSourceControl-BpcJX-rJ.js} +1 -1
  67. package/dist/assets/{SettingsSso-BoLpDt6z.js → SettingsSso-BugeRCyt.js} +17 -10
  68. package/dist/assets/{SettingsUsageAndPlan-B1ibE1jm.js → SettingsUsageAndPlan-Dt6g-FQw.js} +1 -1
  69. package/dist/assets/{SettingsUsersView-Be7pqBLD.js → SettingsUsersView-BhBuZop9.js} +1 -1
  70. package/dist/assets/{SettingsView-DIw6ydDb.js → SettingsView-Cx0SMMrn.js} +1 -1
  71. package/dist/assets/{SetupView-BCV1wNp0.js → SetupView-CUJOHrm2.js} +3 -3
  72. package/dist/assets/{SetupWorkflowCredentialsButton-DxydQJ6C.js → SetupWorkflowCredentialsButton-D6h_IgTa.js} +1 -1
  73. package/dist/assets/{SetupWorkflowFromTemplateView-B0B3GOOf.js → SetupWorkflowFromTemplateView-_ReKyIk1.js} +3 -3
  74. package/dist/assets/{SigninView-DOGcmqE3.js → SigninView--fAZZd3A.js} +3 -3
  75. package/dist/assets/{SignoutView-B9IoLPOG.js → SignoutView-DXoOH9BS.js} +1 -1
  76. package/dist/assets/{SignupView-DC6gW-aS.js → SignupView-d0cK_S0B.js} +3 -3
  77. package/dist/assets/{TableBase-rH4yk1ew.js → TableBase-D5vBzOrx.js} +1 -1
  78. package/dist/assets/{Tag-C0MYaZ1N.js → Tag-CGAmDPzS.js} +1 -1
  79. package/dist/assets/{Tags-DbHWxo-G.js → Tags-CZdua1l_.js} +2 -2
  80. package/dist/assets/{TemplateDetails-Bizetmsp.js → TemplateDetails-ccSWABeF.js} +2 -2
  81. package/dist/assets/{TemplateList-nvQBix9z.js → TemplateList-BKUKBRua.js} +1 -1
  82. package/dist/assets/{TemplatesCollectionView-B9sB1kty.js → TemplatesCollectionView-BTyYNxNc.js} +7 -7
  83. package/dist/assets/{TemplatesSearchView-AXAdkVMZ.js → TemplatesSearchView-BYM3HbbU.js} +3 -3
  84. package/dist/assets/{TemplatesView-CumdCs93.js → TemplatesView-CrH_O4he.js} +1 -1
  85. package/dist/assets/{TemplatesWorkflowView-C-gTBSHB.js → TemplatesWorkflowView-Dg3REjWI.js} +7 -7
  86. package/dist/assets/{TriggerPanel-BMnQXPE0.js → TriggerPanel-dDX4Bzu7.js} +5 -5
  87. package/dist/assets/{VariablesView-Bh0OeH4s.css → VariablesView-BHcrNXsw.css} +6 -6
  88. package/dist/assets/{VariablesView-CSyZZSGu.js → VariablesView-DQw3gYG7.js} +16 -14
  89. package/dist/assets/{WorkerView-y1gN4jjY.js → WorkerView-DIs4RXZZ.js} +6 -6
  90. package/dist/assets/{WorkflowActivator-34Rs65ZA.js → WorkflowActivator-z_Ef2Dd7.js} +3 -3
  91. package/dist/assets/{WorkflowExecutionsInfoAccordion-Td0WBvMx.js → WorkflowExecutionsInfoAccordion-ptRuD88E.js} +2 -2
  92. package/dist/assets/{WorkflowExecutionsLandingPage-Bro6PvBk.js → WorkflowExecutionsLandingPage-C-RDf8Mu.js} +3 -3
  93. package/dist/assets/{WorkflowExecutionsPreview-Px9mMJbR.js → WorkflowExecutionsPreview-Bk449wx1.js} +4 -4
  94. package/dist/assets/{WorkflowExecutionsView-Bo7yagw5.js → WorkflowExecutionsView-Dp0exxTM.js} +7 -7
  95. package/dist/assets/{WorkflowHistory-D5nOy2uN.js → WorkflowHistory-D8zH1o6c.js} +2 -2
  96. package/dist/assets/{WorkflowOnboardingView-CapOEI4L.js → WorkflowOnboardingView-8OmgIoUc.js} +1 -1
  97. package/dist/assets/{WorkflowPreview-Dd49ncZV.js → WorkflowPreview-jOuoMEkv.js} +1 -1
  98. package/dist/assets/{WorkflowsView-CnOu7hid.js → WorkflowsView-B9MpreL6.js} +14 -14
  99. package/dist/assets/{canvas-JvPOqEjf.js → canvas-k8kjfgjE.js} +1 -1
  100. package/dist/assets/{chartjs.utils-U9Db2woJ.js → chartjs.utils-BXNxmkto.js} +2 -2
  101. package/dist/assets/{core-BKMZD8Mn.js → core-e2mfCMV8.js} +1 -1
  102. package/dist/assets/{dataStore.store-CN-ElCfI.js → dataStore.store-vaNG0oX7.js} +9 -6
  103. package/dist/assets/{en-DhcqXAmr.js → en-C3wg5zl_.js} +8 -6
  104. package/dist/assets/{global-link-actions-DDCy0nlC.js → global-link-actions-CR3odK4e.js} +1 -1
  105. package/dist/assets/{index-DXNU_2Fk.css → index-DnpNicM9.css} +72 -61
  106. package/dist/assets/{index-De29TdKc.js → index-DuLlH1tF.js} +956 -780
  107. package/dist/assets/{index-BrzJ49KI.js → index-DuaZRDhZ.js} +1 -1
  108. package/dist/assets/{pickBy-BmxGkcfr.js → pickBy-sB8d3BKD.js} +1 -1
  109. package/dist/assets/{readyToRunWorkflows.store-BGvURDML.js → readyToRunWorkflows.store-SxwN_l4P.js} +1 -1
  110. package/dist/assets/{templateActions-AROReKhy.js → templateActions-BUeOwdy0.js} +1 -1
  111. package/dist/assets/{useBeforeUnload-Bl2noypd.js → useBeforeUnload-DpCu12iW.js} +1 -1
  112. package/dist/assets/{useExecutionDebugging-BFA_6rY-.js → useExecutionDebugging-XRtGhlAr.js} +1 -1
  113. package/dist/assets/{useImportCurlCommand-Dj7YTg7e.js → useImportCurlCommand-DJJ0VEAg.js} +1 -1
  114. package/dist/assets/{useProjectPages-B_FiANIN.js → useProjectPages-DrMZX3ez.js} +1 -1
  115. package/dist/assets/{usePushConnection-BmGujaBx.js → usePushConnection-CPQe3uqU.js} +3 -3
  116. package/dist/assets/{useWorkflowActivate-BNP9vQIn.js → useWorkflowActivate-RFJxTj5m.js} +1 -1
  117. package/dist/index.html +3 -3
  118. package/index.html +1 -1
  119. package/package.json +1 -1
  120. package/vite.config.mts +8 -5
  121. package/dist/assets/CollectionParameter--M3ItR7D.js +0 -4
@@ -1,8 +1,8 @@
1
- import { d as defineComponent, aG as useTemplateRef, b as useRouter, a as useToast, r as ref, x as computed, c as useI18n, a7 as watch, h as createElementBlock, g as openBlock, n as normalizeClass, i as createVNode, j as createBaseVNode, w as withCtx, t as toDisplayString, aH as InlineRename, l as unref, e as createBlock, f as createCommentVNode, gk as PROJECT_DATA_STORES, Y as nextTick, _ as _export_sfc, ef as mergeModels, c1 as toRefs, eg as useModel, o as onMounted, ez as getCurrentInstance, gI as markRaw, c7 as onUnmounted, gJ as mergeDefaults, eW as toRaw, gK as render, c0 as isRef, gL as isReactive, fW as isProxy, b2 as withDirectives, N as N8nIcon, b3 as vShow, aM as N8nActionDropdown, P as useDebounce, y as N8nPopoverReka, e5 as N8nInputLabel, cZ as N8nInput, b8 as withKeys, gM as MAX_COLUMN_NAME_LENGTH, p as N8nText, k as createTextVNode, a9 as Tooltip, e8 as N8nSelect, F as Fragment, A as renderList, e9 as _sfc_main$9, q as N8nButton, aa as _sfc_main$a, gN as COLUMN_NAME_REGEX, bd as DateTime, a8 as resolveComponent, ap as normalizeStyle, ca as useClipboard, bq as onClickOutside, gO as DATA_STORE_HEADER_HEIGHT, gP as DATA_STORE_ROW_HEIGHT, gQ as ADD_ROW_ROW_ID, gR as DEFAULT_ID_COLUMN_NAME, am as useMessage, an as MODAL_CONFIRM, gS as NULL_VALUE, gT as EMPTY_VALUE, eS as orderBy, gU as DATA_STORE_ID_COLUMN_WIDTH, ax as useDocumentTitle, gV as MIN_LOADING_TIME, dK as N8nLoading, dJ as _sfc_main$b, gW as DATA_STORE_VIEW } from "./index-De29TdKc.js";
2
- import { u as useDataStoreStore, r as reorderItem } from "./dataStore.store-CN-ElCfI.js";
3
- import { B as Breadcrumbs, _ as __unplugin_components_0 } from "./ProjectBreadcrumb-BI6swolU.js";
4
- import { _ as _sfc_main$8 } from "./DataStoreActions.vue_vue_type_script_setup_true_lang-BsbILsds.js";
5
- import { S as SelectedItemsInfo } from "./SelectedItemsInfo-Dc4Okb_S.js";
1
+ import { d as defineComponent, aG as useTemplateRef, b as useRouter, a as useToast, r as ref, x as computed, c as useI18n, a7 as watch, h as createElementBlock, g as openBlock, n as normalizeClass, i as createVNode, j as createBaseVNode, w as withCtx, t as toDisplayString, aH as InlineRename, l as unref, e as createBlock, f as createCommentVNode, gm as PROJECT_DATA_STORES, Y as nextTick, f4 as telemetry, _ as _export_sfc, eh as mergeModels, c1 as toRefs, ei as useModel, o as onMounted, eB as getCurrentInstance, gK as markRaw, c7 as onUnmounted, gL as mergeDefaults, eY as toRaw, gM as render, c0 as isRef, gN as isReactive, fY as isProxy, b2 as withDirectives, N as N8nIcon, b3 as vShow, aM as N8nActionDropdown, bd as DateTime, a8 as resolveComponent, ap as normalizeStyle, P as useDebounce, y as N8nPopoverReka, e7 as N8nInputLabel, c$ as N8nInput, b8 as withKeys, gO as MAX_COLUMN_NAME_LENGTH, p as N8nText, k as createTextVNode, a9 as Tooltip, ea as N8nSelect, F as Fragment, A as renderList, eb as _sfc_main$9, q as N8nButton, aa as _sfc_main$a, gP as COLUMN_NAME_REGEX, gQ as ADD_ROW_ROW_ID, gR as NULL_VALUE, gS as EMPTY_VALUE, ca as useClipboard, bq as onClickOutside, gT as DEFAULT_ID_COLUMN_NAME, eU as orderBy, gU as DATA_STORE_ID_COLUMN_WIDTH, am as useMessage, an as MODAL_CONFIRM, al as useTelemetry, gV as DATA_STORE_HEADER_HEIGHT, gW as DATA_STORE_ROW_HEIGHT, ax as useDocumentTitle, gX as MIN_LOADING_TIME, dM as N8nLoading, dL as _sfc_main$b, gY as DATA_STORE_VIEW } from "./index-DuLlH1tF.js";
2
+ import { u as useDataStoreStore, r as reorderItem } from "./dataStore.store-vaNG0oX7.js";
3
+ import { B as Breadcrumbs, _ as __unplugin_components_0 } from "./ProjectBreadcrumb-OJlbtg71.js";
4
+ import { _ as _sfc_main$8 } from "./DataStoreActions.vue_vue_type_script_setup_true_lang-d31tni9q.js";
5
+ import { S as SelectedItemsInfo } from "./SelectedItemsInfo-C55zD1dl.js";
6
6
  const BREADCRUMBS_SEPARATOR = "/";
7
7
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
8
8
  __name: "DataStoreBreadcrumbs",
@@ -60,6 +60,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
60
60
  throw new Error(i18n.baseText("generic.unknownError"));
61
61
  }
62
62
  editableName.value = name;
63
+ telemetry.track("User renamed data table", {
64
+ data_table_id: props.dataStore.id,
65
+ data_table_project_id: props.dataStore.projectId
66
+ });
63
67
  } catch (error) {
64
68
  editableName.value = props.dataStore.name;
65
69
  toast.showError(error, i18n.baseText("dataStore.rename.error"));
@@ -3322,6 +3326,38 @@ function _applyColumnState(beans, params, source) {
3322
3326
  colAnimation?.finish();
3323
3327
  return unmatchedCount === 0;
3324
3328
  }
3329
+ function _resetColumnState(beans, source) {
3330
+ const { colModel, autoColSvc, selectionColSvc, eventSvc, gos } = beans;
3331
+ const primaryCols = colModel.getColDefCols();
3332
+ if (!primaryCols?.length) {
3333
+ return;
3334
+ }
3335
+ const primaryColumnTree = colModel.getColDefColTree();
3336
+ const primaryColumns = _getColumnsFromTree(primaryColumnTree);
3337
+ const columnStates = [];
3338
+ let letRowGroupIndex = 1e3;
3339
+ let letPivotIndex = 1e3;
3340
+ const addColState = (col) => {
3341
+ const stateItem = getColumnStateFromColDef(col);
3342
+ if (_missing(stateItem.rowGroupIndex) && stateItem.rowGroup) {
3343
+ stateItem.rowGroupIndex = letRowGroupIndex++;
3344
+ }
3345
+ if (_missing(stateItem.pivotIndex) && stateItem.pivot) {
3346
+ stateItem.pivotIndex = letPivotIndex++;
3347
+ }
3348
+ columnStates.push(stateItem);
3349
+ };
3350
+ autoColSvc?.getColumns()?.forEach(addColState);
3351
+ selectionColSvc?.getColumns()?.forEach(addColState);
3352
+ primaryColumns?.forEach(addColState);
3353
+ _applyColumnState(beans, { state: columnStates }, source);
3354
+ const autoCols = autoColSvc?.getColumns() ?? [];
3355
+ const selectionCols = selectionColSvc?.getColumns() ?? [];
3356
+ const orderedCols = [...selectionCols, ...autoCols, ...primaryCols];
3357
+ const orderedColState = orderedCols.map((col) => ({ colId: col.colId }));
3358
+ _applyColumnState(beans, { state: orderedColState, applyOrder: true }, source);
3359
+ eventSvc.dispatchEvent(_addGridCommonParams(gos, { type: "columnsReset", source }));
3360
+ }
3325
3361
  function _compareColumnStatesAndDispatchEvents(beans, source) {
3326
3362
  const { rowGroupColsSvc, pivotColsSvc, valueColsSvc, colModel, sortSvc, eventSvc } = beans;
3327
3363
  const startState = {
@@ -22054,6 +22090,176 @@ var SkeletonCellRendererModule = {
22054
22090
  agSkeletonCellRenderer: SkeletonCellRenderer
22055
22091
  }
22056
22092
  };
22093
+ function getColumnDef(beans, key) {
22094
+ const column = beans.colModel.getColDefCol(key);
22095
+ if (column) {
22096
+ return column.getColDef();
22097
+ }
22098
+ return null;
22099
+ }
22100
+ function getColumnDefs(beans) {
22101
+ return beans.colModel.getColumnDefs();
22102
+ }
22103
+ function getDisplayNameForColumn(beans, column, location) {
22104
+ return beans.colNames.getDisplayNameForColumn(column, location) || "";
22105
+ }
22106
+ function getColumn(beans, key) {
22107
+ return beans.colModel.getColDefCol(key);
22108
+ }
22109
+ function getColumns(beans) {
22110
+ return beans.colModel.getColDefCols();
22111
+ }
22112
+ function applyColumnState(beans, params) {
22113
+ return _applyColumnState(beans, params, "api");
22114
+ }
22115
+ function getColumnState(beans) {
22116
+ return _getColumnState(beans);
22117
+ }
22118
+ function resetColumnState(beans) {
22119
+ _resetColumnState(beans, "api");
22120
+ }
22121
+ function isPinning(beans) {
22122
+ return beans.visibleCols.isPinningLeft() || beans.visibleCols.isPinningRight();
22123
+ }
22124
+ function isPinningLeft(beans) {
22125
+ return beans.visibleCols.isPinningLeft();
22126
+ }
22127
+ function isPinningRight(beans) {
22128
+ return beans.visibleCols.isPinningRight();
22129
+ }
22130
+ function getDisplayedColAfter(beans, col) {
22131
+ return beans.visibleCols.getColAfter(col);
22132
+ }
22133
+ function getDisplayedColBefore(beans, col) {
22134
+ return beans.visibleCols.getColBefore(col);
22135
+ }
22136
+ function setColumnsVisible(beans, keys, visible) {
22137
+ beans.colModel.setColsVisible(keys, visible, "api");
22138
+ }
22139
+ function setColumnsPinned(beans, keys, pinned) {
22140
+ beans.pinnedCols?.setColsPinned(keys, pinned, "api");
22141
+ }
22142
+ function getAllGridColumns(beans) {
22143
+ return beans.colModel.getCols();
22144
+ }
22145
+ function getDisplayedLeftColumns(beans) {
22146
+ return beans.visibleCols.leftCols;
22147
+ }
22148
+ function getDisplayedCenterColumns(beans) {
22149
+ return beans.visibleCols.centerCols;
22150
+ }
22151
+ function getDisplayedRightColumns(beans) {
22152
+ return beans.visibleCols.rightCols;
22153
+ }
22154
+ function getAllDisplayedColumns(beans) {
22155
+ return beans.visibleCols.allCols;
22156
+ }
22157
+ function getAllDisplayedVirtualColumns(beans) {
22158
+ return beans.colViewport.getViewportColumns();
22159
+ }
22160
+ function _deepCloneDefinition(object, keysToSkip) {
22161
+ if (!object) {
22162
+ return;
22163
+ }
22164
+ const obj = object;
22165
+ const res = {};
22166
+ Object.keys(obj).forEach((key) => {
22167
+ if (keysToSkip && keysToSkip.indexOf(key) >= 0 || SKIP_JS_BUILTINS.has(key)) {
22168
+ return;
22169
+ }
22170
+ const value = obj[key];
22171
+ const sourceIsSimpleObject = typeof value === "object" && value !== null && value.constructor === Object;
22172
+ if (sourceIsSimpleObject) {
22173
+ res[key] = _deepCloneDefinition(value);
22174
+ } else {
22175
+ res[key] = value;
22176
+ }
22177
+ });
22178
+ return res;
22179
+ }
22180
+ var ColumnDefFactory = class extends BeanStub {
22181
+ constructor() {
22182
+ super(...arguments);
22183
+ this.beanName = "colDefFactory";
22184
+ }
22185
+ wireBeans(beans) {
22186
+ this.rowGroupColsSvc = beans.rowGroupColsSvc;
22187
+ this.pivotColsSvc = beans.pivotColsSvc;
22188
+ }
22189
+ getColumnDefs(colDefColsList, showingPivotResult, lastOrder, colsList) {
22190
+ const cols = colDefColsList.slice();
22191
+ if (showingPivotResult) {
22192
+ cols.sort((a, b) => lastOrder.indexOf(a) - lastOrder.indexOf(b));
22193
+ } else if (lastOrder) {
22194
+ cols.sort((a, b) => colsList.indexOf(a) - colsList.indexOf(b));
22195
+ }
22196
+ const rowGroupColumns = this.rowGroupColsSvc?.columns;
22197
+ const pivotColumns = this.pivotColsSvc?.columns;
22198
+ return this.buildColumnDefs(cols, rowGroupColumns, pivotColumns);
22199
+ }
22200
+ buildColumnDefs(cols, rowGroupColumns = [], pivotColumns = []) {
22201
+ const res = [];
22202
+ const colGroupDefs = {};
22203
+ cols.forEach((col) => {
22204
+ const colDef = this.createDefFromColumn(col, rowGroupColumns, pivotColumns);
22205
+ let addToResult = true;
22206
+ let childDef = colDef;
22207
+ let pointer = col.getOriginalParent();
22208
+ let lastPointer = null;
22209
+ while (pointer) {
22210
+ let parentDef = null;
22211
+ if (pointer.isPadding()) {
22212
+ pointer = pointer.getOriginalParent();
22213
+ continue;
22214
+ }
22215
+ const existingParentDef = colGroupDefs[pointer.getGroupId()];
22216
+ if (existingParentDef) {
22217
+ existingParentDef.children.push(childDef);
22218
+ addToResult = false;
22219
+ break;
22220
+ }
22221
+ parentDef = this.createDefFromGroup(pointer);
22222
+ if (parentDef) {
22223
+ parentDef.children = [childDef];
22224
+ colGroupDefs[parentDef.groupId] = parentDef;
22225
+ childDef = parentDef;
22226
+ pointer = pointer.getOriginalParent();
22227
+ }
22228
+ if (pointer != null && lastPointer === pointer) {
22229
+ addToResult = false;
22230
+ break;
22231
+ }
22232
+ lastPointer = pointer;
22233
+ }
22234
+ if (addToResult) {
22235
+ res.push(childDef);
22236
+ }
22237
+ });
22238
+ return res;
22239
+ }
22240
+ createDefFromGroup(group) {
22241
+ const defCloned = _deepCloneDefinition(group.getColGroupDef(), ["children"]);
22242
+ if (defCloned) {
22243
+ defCloned.groupId = group.getGroupId();
22244
+ }
22245
+ return defCloned;
22246
+ }
22247
+ createDefFromColumn(col, rowGroupColumns, pivotColumns) {
22248
+ const colDefCloned = _deepCloneDefinition(col.getColDef());
22249
+ colDefCloned.colId = col.getColId();
22250
+ colDefCloned.width = col.getActualWidth();
22251
+ colDefCloned.rowGroup = col.isRowGroupActive();
22252
+ colDefCloned.rowGroupIndex = col.isRowGroupActive() ? rowGroupColumns.indexOf(col) : null;
22253
+ colDefCloned.pivot = col.isPivotActive();
22254
+ colDefCloned.pivotIndex = col.isPivotActive() ? pivotColumns.indexOf(col) : null;
22255
+ colDefCloned.aggFunc = col.isValueActive() ? col.getAggFunc() : null;
22256
+ colDefCloned.hide = col.isVisible() ? void 0 : true;
22257
+ colDefCloned.pinned = col.isPinned() ? col.getPinned() : null;
22258
+ colDefCloned.sort = col.getSort() ? col.getSort() : null;
22259
+ colDefCloned.sortIndex = col.getSortIndex() != null ? col.getSortIndex() : null;
22260
+ return colDefCloned;
22261
+ }
22262
+ };
22057
22263
  var ColumnFlexService = class extends BeanStub {
22058
22264
  constructor() {
22059
22265
  super(...arguments);
@@ -22828,6 +23034,34 @@ var ColumnFlexModule = {
22828
23034
  version: VERSION,
22829
23035
  beans: [ColumnFlexService]
22830
23036
  };
23037
+ var ColumnApiModule = {
23038
+ moduleName: "ColumnApi",
23039
+ version: VERSION,
23040
+ beans: [ColumnDefFactory],
23041
+ apiFunctions: {
23042
+ getColumnDef,
23043
+ getDisplayNameForColumn,
23044
+ getColumn,
23045
+ getColumns,
23046
+ applyColumnState,
23047
+ getColumnState,
23048
+ resetColumnState,
23049
+ isPinning,
23050
+ isPinningLeft,
23051
+ isPinningRight,
23052
+ getDisplayedColAfter,
23053
+ getDisplayedColBefore,
23054
+ setColumnsVisible,
23055
+ setColumnsPinned,
23056
+ getAllGridColumns,
23057
+ getDisplayedLeftColumns,
23058
+ getDisplayedCenterColumns,
23059
+ getDisplayedRightColumns,
23060
+ getAllDisplayedColumns,
23061
+ getAllDisplayedVirtualColumns,
23062
+ getColumnDefs
23063
+ }
23064
+ };
22831
23065
  function _camelCaseToHumanText(camelCase) {
22832
23066
  if (!camelCase || camelCase == null) {
22833
23067
  return null;
@@ -41189,6 +41423,41 @@ const n8nTheme = themeQuartz.withPart(iconSetAlpine).withParams({
41189
41423
  checkboxUncheckedBackgroundColor: "var(--color-background-light-base)",
41190
41424
  checkboxCheckedBackgroundColor: "var(--color-primary)"
41191
41425
  });
41426
+ const useDataStorePagination = (options = {}) => {
41427
+ const currentPage = ref(options.initialPage ?? 1);
41428
+ const pageSize = ref(options.initialPageSize ?? 20);
41429
+ const totalItems = ref(0);
41430
+ const pageSizeOptions = options.pageSizeOptions ?? [10, 20, 50];
41431
+ const setTotalItems = (count) => {
41432
+ totalItems.value = count;
41433
+ };
41434
+ const setCurrentPage = async (page) => {
41435
+ currentPage.value = page;
41436
+ if (options.onChange) await options.onChange(currentPage.value, pageSize.value);
41437
+ };
41438
+ const setPageSize = async (size) => {
41439
+ pageSize.value = size;
41440
+ currentPage.value = 1;
41441
+ if (options.onChange) await options.onChange(currentPage.value, pageSize.value);
41442
+ };
41443
+ const ensureItemOnPage = async (itemIndex) => {
41444
+ const itemPage = Math.max(1, Math.ceil(itemIndex / pageSize.value));
41445
+ if (currentPage.value !== itemPage) {
41446
+ currentPage.value = itemPage;
41447
+ if (options.onChange) await options.onChange(currentPage.value, pageSize.value);
41448
+ }
41449
+ };
41450
+ return {
41451
+ currentPage,
41452
+ pageSize,
41453
+ pageSizeOptions,
41454
+ totalItems,
41455
+ setTotalItems,
41456
+ setCurrentPage,
41457
+ setPageSize,
41458
+ ensureItemOnPage
41459
+ };
41460
+ };
41192
41461
  const isDataStoreValue = (value) => {
41193
41462
  return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value instanceof Date;
41194
41463
  };
@@ -41360,7 +41629,81 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
41360
41629
  };
41361
41630
  }
41362
41631
  });
41363
- const _hoisted_1$3 = { class: "add-column-header-component-wrapper" };
41632
+ const _hoisted_1$3 = { class: "datastore-datepicker-wrapper" };
41633
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
41634
+ __name: "ElDatePickerCellEditor",
41635
+ props: {
41636
+ params: {}
41637
+ },
41638
+ setup(__props, { expose: __expose }) {
41639
+ const props = __props;
41640
+ const pickerRef = ref(null);
41641
+ const dateValue = ref(null);
41642
+ const initialValue = ref(null);
41643
+ const inputWidth = ref(props.params.column.getActualWidth() - 4);
41644
+ onMounted(async () => {
41645
+ const initial = props.params.value;
41646
+ if (initial === null || initial === void 0) {
41647
+ dateValue.value = null;
41648
+ } else if (initial instanceof Date) {
41649
+ const dt = DateTime.fromJSDate(initial);
41650
+ dateValue.value = dt.minus({ minutes: dt.offset }).toJSDate();
41651
+ }
41652
+ initialValue.value = dateValue.value;
41653
+ await nextTick();
41654
+ try {
41655
+ pickerRef.value?.focus?.();
41656
+ } catch {
41657
+ }
41658
+ });
41659
+ function onChange() {
41660
+ props.params.stopEditing();
41661
+ }
41662
+ function onClear() {
41663
+ dateValue.value = null;
41664
+ props.params.stopEditing();
41665
+ }
41666
+ function onKeydown(e) {
41667
+ if (e.key === "Escape") {
41668
+ e.stopPropagation();
41669
+ dateValue.value = initialValue.value;
41670
+ props.params.stopEditing();
41671
+ } else if (e.key === "Enter") {
41672
+ e.stopPropagation();
41673
+ props.params.stopEditing();
41674
+ }
41675
+ }
41676
+ __expose({
41677
+ getValue: () => {
41678
+ if (dateValue.value === null) return null;
41679
+ const dt = DateTime.fromJSDate(dateValue.value);
41680
+ return dt.plus({ minutes: dt.offset }).toJSDate();
41681
+ },
41682
+ isPopup: () => true
41683
+ });
41684
+ return (_ctx, _cache) => {
41685
+ const _component_el_date_picker = resolveComponent("el-date-picker");
41686
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
41687
+ createVNode(_component_el_date_picker, {
41688
+ ref_key: "pickerRef",
41689
+ ref: pickerRef,
41690
+ modelValue: dateValue.value,
41691
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dateValue.value = $event),
41692
+ type: "datetime",
41693
+ style: normalizeStyle({ width: `${inputWidth.value}px` }),
41694
+ clearable: true,
41695
+ editable: false,
41696
+ teleported: false,
41697
+ placeholder: "",
41698
+ onChange,
41699
+ onClear,
41700
+ onKeydown
41701
+ }, null, 8, ["modelValue", "style"])
41702
+ ]);
41703
+ };
41704
+ }
41705
+ });
41706
+ const _hoisted_1$2 = { class: "add-column-header-component-wrapper" };
41364
41707
  const _hoisted_2$1 = { class: "add-ds-column-header-popover-content" };
41365
41708
  const _hoisted_3 = { class: "popover-body" };
41366
41709
  const _hoisted_4 = {
@@ -41368,7 +41711,7 @@ const _hoisted_4 = {
41368
41711
  class: "error-message"
41369
41712
  };
41370
41713
  const _hoisted_5 = { class: "add-column-option-content" };
41371
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
41714
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
41372
41715
  __name: "AddColumnButton",
41373
41716
  props: {
41374
41717
  params: {},
@@ -41441,7 +41784,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
41441
41784
  content: unref(i18n).baseText("dataStore.addColumn.label")
41442
41785
  }, {
41443
41786
  default: withCtx(() => [
41444
- createBaseVNode("div", _hoisted_1$3, [
41787
+ createBaseVNode("div", _hoisted_1$2, [
41445
41788
  createVNode(_component_N8nPopoverReka, {
41446
41789
  id: popoverId.value,
41447
41790
  open: popoverOpen.value,
@@ -41580,7 +41923,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
41580
41923
  };
41581
41924
  }
41582
41925
  });
41583
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
41926
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
41584
41927
  __name: "AddRowButton",
41585
41928
  props: {
41586
41929
  params: {}
@@ -41605,8 +41948,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
41605
41948
  };
41606
41949
  }
41607
41950
  });
41608
- const _hoisted_1$2 = { class: "n8n-empty-value" };
41609
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
41951
+ const _hoisted_1$1 = { class: "n8n-empty-value" };
41952
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
41610
41953
  __name: "NullEmptyCellRenderer",
41611
41954
  props: {
41612
41955
  params: {}
@@ -41614,84 +41957,652 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
41614
41957
  setup(__props) {
41615
41958
  const props = __props;
41616
41959
  return (_ctx, _cache) => {
41617
- return openBlock(), createElementBlock("span", _hoisted_1$2, toDisplayString(props.params.value), 1);
41960
+ return openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString(props.params.value), 1);
41618
41961
  };
41619
41962
  }
41620
41963
  });
41621
- const _hoisted_1$1 = { class: "datastore-datepicker-wrapper" };
41622
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
41623
- __name: "ElDatePickerCellEditor",
41624
- props: {
41625
- params: {}
41626
- },
41627
- setup(__props, { expose: __expose }) {
41628
- const props = __props;
41629
- const pickerRef = ref(null);
41630
- const dateValue = ref(null);
41631
- const initialValue = ref(null);
41632
- const inputWidth = ref(props.params.column.getActualWidth() - 4);
41633
- onMounted(async () => {
41634
- const initial = props.params.value;
41635
- if (initial === null || initial === void 0) {
41636
- dateValue.value = null;
41637
- } else if (initial instanceof Date) {
41638
- const dt = DateTime.fromJSDate(initial);
41639
- dateValue.value = dt.minus({ minutes: dt.offset }).toJSDate();
41640
- }
41641
- initialValue.value = dateValue.value;
41642
- await nextTick();
41643
- try {
41644
- pickerRef.value?.focus?.();
41645
- } catch {
41646
- }
41647
- });
41648
- function onChange() {
41649
- props.params.stopEditing();
41964
+ const getCellClass = (params) => {
41965
+ if (params.data?.id === ADD_ROW_ROW_ID) {
41966
+ return "add-row-cell";
41967
+ }
41968
+ if (params.column.getUserProvidedColDef()?.cellDataType === "boolean") {
41969
+ return "boolean-cell";
41970
+ }
41971
+ return "";
41972
+ };
41973
+ const createValueGetter = (col) => (params) => {
41974
+ if (params.data?.[col.name] === null || params.data?.[col.name] === void 0) {
41975
+ return null;
41976
+ }
41977
+ if (col.type === "date") {
41978
+ const value = params.data?.[col.name];
41979
+ if (typeof value === "string") {
41980
+ return new Date(value);
41650
41981
  }
41651
- function onClear() {
41652
- dateValue.value = null;
41653
- props.params.stopEditing();
41982
+ }
41983
+ return params.data?.[col.name];
41984
+ };
41985
+ const createCellRendererSelector = (col) => (params) => {
41986
+ if (params.data?.id === ADD_ROW_ROW_ID || col.id === "add-column") {
41987
+ return {};
41988
+ }
41989
+ let rowValue = params.data?.[col.name];
41990
+ if (rowValue === void 0) {
41991
+ rowValue = null;
41992
+ }
41993
+ if (rowValue === null) {
41994
+ return { component: _sfc_main$2, params: { value: NULL_VALUE } };
41995
+ }
41996
+ if (rowValue === "") {
41997
+ return { component: _sfc_main$2, params: { value: EMPTY_VALUE } };
41998
+ }
41999
+ return void 0;
42000
+ };
42001
+ const createStringValueSetter = (col, isTextEditorOpen) => (params) => {
42002
+ let originalValue = params.data[col.name];
42003
+ if (originalValue === void 0) {
42004
+ originalValue = null;
42005
+ }
42006
+ let newValue = params.newValue;
42007
+ if (!isDataStoreValue(newValue)) {
42008
+ return false;
42009
+ }
42010
+ if (originalValue === null && newValue === "") {
42011
+ return false;
42012
+ }
42013
+ if (isTextEditorOpen.value && newValue === null) {
42014
+ newValue = "";
42015
+ }
42016
+ params.data[col.name] = newValue;
42017
+ return true;
42018
+ };
42019
+ const stringCellEditorParams = (params) => ({
42020
+ value: params.value ?? "",
42021
+ maxLength: 999999999
42022
+ });
42023
+ const dateValueFormatter = (params) => {
42024
+ const value = params.value;
42025
+ if (value === null || value === void 0) return "";
42026
+ return value.toISOString();
42027
+ };
42028
+ const useDataStoreGridBase = ({
42029
+ gridContainerRef,
42030
+ onDeleteColumn,
42031
+ onAddRowClick,
42032
+ onAddColumn
42033
+ }) => {
42034
+ const gridApi = ref(null);
42035
+ const colDefs = ref([]);
42036
+ const isTextEditorOpen = ref(false);
42037
+ const { mapToAGCellType } = useDataStoreTypes();
42038
+ const { copy: copyToClipboard } = useClipboard({ onPaste: onClipboardPaste });
42039
+ const currentSortBy = ref(DEFAULT_ID_COLUMN_NAME);
42040
+ const currentSortOrder = ref("asc");
42041
+ const lastFocusedCell = ref(null);
42042
+ const initializedGridApi = computed(() => {
42043
+ if (!gridApi.value) {
42044
+ throw new Error("Grid API is not initialized");
42045
+ }
42046
+ return gridApi.value;
42047
+ });
42048
+ const onGridReady = (params) => {
42049
+ gridApi.value = params.api;
42050
+ if (gridContainerRef.value) {
42051
+ params.api.setGridOption("popupParent", gridContainerRef.value);
41654
42052
  }
41655
- function onKeydown(e) {
41656
- if (e.key === "Escape") {
41657
- e.stopPropagation();
41658
- dateValue.value = initialValue.value;
41659
- props.params.stopEditing();
41660
- } else if (e.key === "Enter") {
41661
- e.stopPropagation();
41662
- props.params.stopEditing();
41663
- }
42053
+ };
42054
+ const setGridData = ({
42055
+ colDefs: colDefs2,
42056
+ rowData
42057
+ }) => {
42058
+ if (colDefs2) {
42059
+ initializedGridApi.value.setGridOption("columnDefs", colDefs2);
41664
42060
  }
41665
- __expose({
41666
- getValue: () => {
41667
- if (dateValue.value === null) return null;
41668
- const dt = DateTime.fromJSDate(dateValue.value);
41669
- return dt.plus({ minutes: dt.offset }).toJSDate();
41670
- },
41671
- isPopup: () => true
42061
+ if (rowData) {
42062
+ initializedGridApi.value.setGridOption("rowData", rowData);
42063
+ }
42064
+ initializedGridApi.value.setGridOption("pinnedBottomRowData", [{ id: ADD_ROW_ROW_ID }]);
42065
+ };
42066
+ const focusFirstEditableCell = (rowId) => {
42067
+ const rowNode = initializedGridApi.value.getRowNode(String(rowId));
42068
+ if (rowNode?.rowIndex === null) return;
42069
+ const firstEditableCol = colDefs.value[1];
42070
+ if (!firstEditableCol?.colId) return;
42071
+ initializedGridApi.value.ensureIndexVisible(rowNode.rowIndex);
42072
+ initializedGridApi.value.setFocusedCell(rowNode.rowIndex, firstEditableCol.colId);
42073
+ initializedGridApi.value.startEditingCell({
42074
+ rowIndex: rowNode.rowIndex,
42075
+ colKey: firstEditableCol.colId
41672
42076
  });
41673
- return (_ctx, _cache) => {
41674
- const _component_el_date_picker = resolveComponent("el-date-picker");
41675
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
41676
- createVNode(_component_el_date_picker, {
41677
- ref_key: "pickerRef",
41678
- ref: pickerRef,
41679
- modelValue: dateValue.value,
41680
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dateValue.value = $event),
41681
- type: "datetime",
41682
- style: normalizeStyle({ width: `${inputWidth.value}px` }),
41683
- clearable: true,
42077
+ };
42078
+ const createColumnDef = (col, extraProps = {}) => {
42079
+ const columnDef = {
42080
+ colId: col.id,
42081
+ field: col.name,
42082
+ headerName: col.name,
42083
+ sortable: true,
42084
+ flex: 1,
42085
+ editable: (params) => params.data?.id !== ADD_ROW_ROW_ID,
42086
+ resizable: true,
42087
+ lockPinned: true,
42088
+ headerComponent: _sfc_main$6,
42089
+ headerComponentParams: { onDelete: onDeleteColumn, allowMenuActions: true },
42090
+ cellEditorPopup: false,
42091
+ cellDataType: mapToAGCellType(col.type),
42092
+ cellClass: getCellClass,
42093
+ valueGetter: createValueGetter(col),
42094
+ cellRendererSelector: createCellRendererSelector(col)
42095
+ };
42096
+ if (col.type === "string") {
42097
+ columnDef.cellEditor = "agLargeTextCellEditor";
42098
+ columnDef.cellEditorPopup = true;
42099
+ columnDef.cellEditorPopupPosition = "over";
42100
+ columnDef.cellEditorParams = stringCellEditorParams;
42101
+ columnDef.valueSetter = createStringValueSetter(col, isTextEditorOpen);
42102
+ } else if (col.type === "date") {
42103
+ columnDef.cellEditorSelector = () => ({
42104
+ component: _sfc_main$5
42105
+ });
42106
+ columnDef.valueFormatter = dateValueFormatter;
42107
+ }
42108
+ return {
42109
+ ...columnDef,
42110
+ ...extraProps
42111
+ };
42112
+ };
42113
+ const onCellEditingStarted = (params) => {
42114
+ if (params.column.getColDef().cellDataType === "text") {
42115
+ isTextEditorOpen.value = true;
42116
+ } else {
42117
+ isTextEditorOpen.value = false;
42118
+ }
42119
+ };
42120
+ const onCellEditingStopped = (params) => {
42121
+ if (params.column.getColDef().cellDataType === "text") {
42122
+ isTextEditorOpen.value = false;
42123
+ }
42124
+ };
42125
+ const getColumnDefinitions = (dataStoreColumns) => {
42126
+ const systemDateColumnOptions = {
42127
+ editable: false,
42128
+ suppressMovable: true,
42129
+ lockPinned: true,
42130
+ lockPosition: "right",
42131
+ headerComponentParams: {
42132
+ allowMenuActions: false
42133
+ }
42134
+ };
42135
+ return [
42136
+ // Always add the ID column, it's not returned by the back-end but all data stores have it
42137
+ // We use it as a placeholder for new datastores
42138
+ createColumnDef(
42139
+ {
42140
+ id: DEFAULT_ID_COLUMN_NAME,
42141
+ name: DEFAULT_ID_COLUMN_NAME,
42142
+ type: "string"
42143
+ },
42144
+ {
41684
42145
  editable: false,
41685
- teleported: false,
41686
- placeholder: "",
41687
- onChange,
41688
- onClear,
41689
- onKeydown
41690
- }, null, 8, ["modelValue", "style"])
41691
- ]);
42146
+ sortable: false,
42147
+ suppressMovable: true,
42148
+ headerComponent: null,
42149
+ lockPosition: true,
42150
+ minWidth: DATA_STORE_ID_COLUMN_WIDTH,
42151
+ maxWidth: DATA_STORE_ID_COLUMN_WIDTH,
42152
+ resizable: false,
42153
+ cellClass: (params) => params.data?.id === ADD_ROW_ROW_ID ? "add-row-cell" : "id-column",
42154
+ cellRendererSelector: (params) => {
42155
+ if (params.value === ADD_ROW_ROW_ID) {
42156
+ return {
42157
+ component: _sfc_main$3,
42158
+ params: { onClick: onAddRowClick }
42159
+ };
42160
+ }
42161
+ return void 0;
42162
+ }
42163
+ }
42164
+ ),
42165
+ // Append other columns
42166
+ ...orderBy(dataStoreColumns, "index").map((col) => createColumnDef(col)),
42167
+ createColumnDef(
42168
+ {
42169
+ index: dataStoreColumns.length + 1,
42170
+ id: "createdAt",
42171
+ name: "createdAt",
42172
+ type: "date"
42173
+ },
42174
+ systemDateColumnOptions
42175
+ ),
42176
+ createColumnDef(
42177
+ {
42178
+ index: dataStoreColumns.length + 2,
42179
+ id: "updatedAt",
42180
+ name: "updatedAt",
42181
+ type: "date"
42182
+ },
42183
+ systemDateColumnOptions
42184
+ ),
42185
+ createColumnDef(
42186
+ {
42187
+ index: dataStoreColumns.length + 3,
42188
+ id: "add-column",
42189
+ name: "Add Column",
42190
+ type: "string"
42191
+ },
42192
+ {
42193
+ editable: false,
42194
+ suppressMovable: true,
42195
+ lockPinned: true,
42196
+ lockPosition: "right",
42197
+ resizable: false,
42198
+ headerComponent: _sfc_main$4,
42199
+ headerComponentParams: { onAddColumn }
42200
+ }
42201
+ )
42202
+ ];
42203
+ };
42204
+ const loadColumns = (dataStoreColumns) => {
42205
+ colDefs.value = getColumnDefinitions(dataStoreColumns);
42206
+ setGridData({ colDefs: colDefs.value });
42207
+ };
42208
+ const deleteColumn = (columnId) => {
42209
+ colDefs.value = colDefs.value.filter((col) => col.colId !== columnId);
42210
+ setGridData({ colDefs: colDefs.value });
42211
+ };
42212
+ const insertColumnAtIndex = (column, index) => {
42213
+ colDefs.value.splice(index, 0, column);
42214
+ setGridData({ colDefs: colDefs.value });
42215
+ };
42216
+ const addColumn = (column) => {
42217
+ colDefs.value = [
42218
+ ...colDefs.value.slice(0, -1),
42219
+ createColumnDef(column),
42220
+ ...colDefs.value.slice(-1)
42221
+ ];
42222
+ setGridData({ colDefs: colDefs.value });
42223
+ };
42224
+ const moveColumn = (oldIndex, newIndex) => {
42225
+ const fromIndex = oldIndex - 1;
42226
+ const columnToBeMoved = colDefs.value[fromIndex];
42227
+ if (!columnToBeMoved) {
42228
+ return;
42229
+ }
42230
+ const middleWithIndex = colDefs.value.slice(1, -1).map((col, index) => ({ ...col, index }));
42231
+ const reorderedMiddle = reorderItem(middleWithIndex, fromIndex, newIndex).sort((a, b) => a.index - b.index).map(({ index, ...col }) => col);
42232
+ colDefs.value = [colDefs.value[0], ...reorderedMiddle, colDefs.value[colDefs.value.length - 1]];
42233
+ };
42234
+ const handleCopyFocusedCell = async (params) => {
42235
+ const focused = params.api.getFocusedCell();
42236
+ if (!focused) {
42237
+ return;
42238
+ }
42239
+ const row = params.api.getDisplayedRowAtIndex(focused.rowIndex);
42240
+ const colDef = focused.column.getColDef();
42241
+ if (row?.data && colDef.field) {
42242
+ const rawValue = row.data[colDef.field];
42243
+ const text = rawValue === null || rawValue === void 0 ? "" : String(rawValue);
42244
+ await copyToClipboard(text);
42245
+ }
42246
+ };
42247
+ function onClipboardPaste(data) {
42248
+ const focusedCell = initializedGridApi.value.getFocusedCell();
42249
+ const isEditing2 = initializedGridApi.value.getEditingCells().length > 0;
42250
+ if (!focusedCell || isEditing2) return;
42251
+ const row = initializedGridApi.value.getDisplayedRowAtIndex(focusedCell.rowIndex);
42252
+ if (!row) return;
42253
+ const colDef = focusedCell.column.getColDef();
42254
+ if (colDef.cellDataType === "text") {
42255
+ row.setDataValue(focusedCell.column.getColId(), data);
42256
+ } else if (colDef.cellDataType === "number") {
42257
+ if (!Number.isNaN(Number(data))) {
42258
+ row.setDataValue(focusedCell.column.getColId(), Number(data));
42259
+ }
42260
+ } else if (colDef.cellDataType === "date") {
42261
+ if (!Number.isNaN(Date.parse(data))) {
42262
+ row.setDataValue(focusedCell.column.getColId(), new Date(data));
42263
+ }
42264
+ } else if (colDef.cellDataType === "boolean") {
42265
+ if (data === "true") {
42266
+ row.setDataValue(focusedCell.column.getColId(), true);
42267
+ } else if (data === "false") {
42268
+ row.setDataValue(focusedCell.column.getColId(), false);
42269
+ }
42270
+ }
42271
+ }
42272
+ const onCellClicked = (params) => {
42273
+ const clickedCellColumn = params.column.getColId();
42274
+ const clickedCellRow = params.rowIndex;
42275
+ if (clickedCellRow === null || params.api.isEditing({ rowIndex: clickedCellRow, column: params.column, rowPinned: null }))
42276
+ return;
42277
+ const wasAlreadyFocused = lastFocusedCell.value && lastFocusedCell.value.rowIndex === clickedCellRow && lastFocusedCell.value.colId === clickedCellColumn;
42278
+ if (wasAlreadyFocused && params.column.getColDef()?.editable) {
42279
+ params.api.startEditingCell({
42280
+ rowIndex: clickedCellRow,
42281
+ colKey: clickedCellColumn
42282
+ });
42283
+ }
42284
+ lastFocusedCell.value = {
42285
+ rowIndex: clickedCellRow,
42286
+ colId: clickedCellColumn
41692
42287
  };
42288
+ };
42289
+ const resetLastFocusedCell = () => {
42290
+ lastFocusedCell.value = null;
42291
+ };
42292
+ const onSortChanged2 = async (event) => {
42293
+ const sortedColumn = event.columns?.filter((col) => col.getSort() !== null).pop() ?? null;
42294
+ if (sortedColumn) {
42295
+ const colId = sortedColumn.getColId();
42296
+ const columnDef = colDefs.value.find((col) => col.colId === colId);
42297
+ currentSortBy.value = columnDef?.field || colId;
42298
+ currentSortOrder.value = sortedColumn.getSort() ?? "asc";
42299
+ } else {
42300
+ currentSortBy.value = DEFAULT_ID_COLUMN_NAME;
42301
+ currentSortOrder.value = "asc";
42302
+ }
42303
+ };
42304
+ onClickOutside(gridContainerRef, () => {
42305
+ resetLastFocusedCell();
42306
+ initializedGridApi.value.clearFocusedCell();
42307
+ });
42308
+ return {
42309
+ onGridReady,
42310
+ setGridData,
42311
+ focusFirstEditableCell,
42312
+ onCellEditingStarted,
42313
+ onCellEditingStopped,
42314
+ createColumnDef,
42315
+ loadColumns,
42316
+ colDefs,
42317
+ deleteColumn,
42318
+ insertColumnAtIndex,
42319
+ addColumn,
42320
+ moveColumn,
42321
+ gridApi: initializedGridApi,
42322
+ handleCopyFocusedCell,
42323
+ onCellClicked,
42324
+ resetLastFocusedCell,
42325
+ currentSortBy,
42326
+ currentSortOrder,
42327
+ onSortChanged: onSortChanged2
42328
+ };
42329
+ };
42330
+ const useDataStoreSelection = ({
42331
+ gridApi
42332
+ }) => {
42333
+ const selectedRowIds = ref(/* @__PURE__ */ new Set());
42334
+ const selectedCount = computed(() => selectedRowIds.value.size);
42335
+ const rowSelection = {
42336
+ mode: "multiRow",
42337
+ enableClickSelection: false,
42338
+ checkboxes: (params) => params.data?.id !== ADD_ROW_ROW_ID,
42339
+ isRowSelectable: (params) => params.data?.id !== ADD_ROW_ROW_ID
42340
+ };
42341
+ const onSelectionChanged = () => {
42342
+ const selectedNodes = gridApi.value.getSelectedNodes();
42343
+ const newSelectedIds = /* @__PURE__ */ new Set();
42344
+ selectedNodes.forEach((node) => {
42345
+ if (typeof node.data?.id === "number") {
42346
+ newSelectedIds.add(node.data.id);
42347
+ }
42348
+ });
42349
+ selectedRowIds.value = newSelectedIds;
42350
+ };
42351
+ const handleClearSelection = () => {
42352
+ selectedRowIds.value = /* @__PURE__ */ new Set();
42353
+ gridApi.value.deselectAll();
42354
+ };
42355
+ return {
42356
+ selectedRowIds,
42357
+ selectedCount,
42358
+ rowSelection,
42359
+ onSelectionChanged,
42360
+ handleClearSelection
42361
+ };
42362
+ };
42363
+ const useDataStoreOperations = ({
42364
+ colDefs,
42365
+ rowData,
42366
+ deleteGridColumn,
42367
+ addGridColumn,
42368
+ setGridData,
42369
+ insertGridColumnAtIndex,
42370
+ moveGridColumn,
42371
+ dataStoreId,
42372
+ projectId,
42373
+ gridApi,
42374
+ totalItems,
42375
+ setTotalItems,
42376
+ ensureItemOnPage,
42377
+ focusFirstEditableCell,
42378
+ toggleSave,
42379
+ currentPage,
42380
+ pageSize,
42381
+ currentSortBy,
42382
+ currentSortOrder,
42383
+ handleClearSelection,
42384
+ selectedRowIds,
42385
+ handleCopyFocusedCell
42386
+ }) => {
42387
+ const i18n = useI18n();
42388
+ const toast = useToast();
42389
+ const message = useMessage();
42390
+ const dataStoreStore = useDataStoreStore();
42391
+ const contentLoading = ref(false);
42392
+ const telemetry2 = useTelemetry();
42393
+ async function onDeleteColumn(columnId) {
42394
+ const columnToDelete = colDefs.value.find((col) => col.colId === columnId);
42395
+ if (!columnToDelete) return;
42396
+ const promptResponse = await message.confirm(
42397
+ i18n.baseText("dataStore.deleteColumn.confirm.message", {
42398
+ interpolate: { name: columnToDelete.headerName ?? "" }
42399
+ }),
42400
+ i18n.baseText("dataStore.deleteColumn.confirm.title"),
42401
+ {
42402
+ confirmButtonText: i18n.baseText("generic.delete"),
42403
+ cancelButtonText: i18n.baseText("generic.cancel")
42404
+ }
42405
+ );
42406
+ if (promptResponse !== MODAL_CONFIRM) {
42407
+ return;
42408
+ }
42409
+ const columnToDeleteIndex = colDefs.value.findIndex((col) => col.colId === columnId);
42410
+ deleteGridColumn(columnId);
42411
+ const rowDataOldValue = [...rowData.value];
42412
+ rowData.value = rowData.value.map((row) => {
42413
+ const { [columnToDelete.field]: _, ...rest } = row;
42414
+ return rest;
42415
+ });
42416
+ setGridData({ rowData: rowData.value });
42417
+ try {
42418
+ await dataStoreStore.deleteDataStoreColumn(dataStoreId, projectId, columnId);
42419
+ telemetry2.track("User deleted data table column", {
42420
+ column_id: columnId,
42421
+ column_type: columnToDelete.cellDataType,
42422
+ data_table_id: dataStoreId
42423
+ });
42424
+ } catch (error) {
42425
+ toast.showError(error, i18n.baseText("dataStore.deleteColumn.error"));
42426
+ insertGridColumnAtIndex(columnToDelete, columnToDeleteIndex);
42427
+ rowData.value = rowDataOldValue;
42428
+ setGridData({ rowData: rowData.value });
42429
+ }
41693
42430
  }
41694
- });
42431
+ async function onAddColumn(column) {
42432
+ try {
42433
+ const newColumn = await dataStoreStore.addDataStoreColumn(dataStoreId, projectId, column);
42434
+ addGridColumn(newColumn);
42435
+ rowData.value = rowData.value.map((row) => {
42436
+ return { ...row, [newColumn.name]: null };
42437
+ });
42438
+ setGridData({ rowData: rowData.value });
42439
+ telemetry2.track("User added data table column", {
42440
+ column_id: newColumn.id,
42441
+ column_type: newColumn.type,
42442
+ data_table_id: dataStoreId
42443
+ });
42444
+ return true;
42445
+ } catch (error) {
42446
+ toast.showError(error, i18n.baseText("dataStore.addColumn.error"));
42447
+ return false;
42448
+ }
42449
+ }
42450
+ const onColumnMoved = async (moveEvent) => {
42451
+ if (!moveEvent.finished || moveEvent.source !== "uiColumnMoved" || moveEvent.toIndex === void 0 || !moveEvent.column) {
42452
+ return;
42453
+ }
42454
+ const oldIndex = colDefs.value.findIndex((col) => col.colId === moveEvent.column.getColId());
42455
+ const newIndex = moveEvent.toIndex - 2;
42456
+ try {
42457
+ await dataStoreStore.moveDataStoreColumn(
42458
+ dataStoreId,
42459
+ projectId,
42460
+ moveEvent.column.getColId(),
42461
+ newIndex
42462
+ );
42463
+ moveGridColumn(oldIndex, newIndex);
42464
+ } catch (error) {
42465
+ toast.showError(error, i18n.baseText("dataStore.moveColumn.error"));
42466
+ gridApi.value.moveColumnByIndex(moveEvent.toIndex, oldIndex + 1);
42467
+ }
42468
+ };
42469
+ async function onAddRowClick() {
42470
+ try {
42471
+ await ensureItemOnPage(totalItems.value + 1);
42472
+ contentLoading.value = true;
42473
+ toggleSave(true);
42474
+ const insertedRow = await dataStoreStore.insertEmptyRow(dataStoreId, projectId);
42475
+ const newRow = insertedRow;
42476
+ rowData.value.push(newRow);
42477
+ setTotalItems(totalItems.value + 1);
42478
+ setGridData({ rowData: rowData.value });
42479
+ focusFirstEditableCell(newRow.id);
42480
+ telemetry2.track("User added row to data table", {
42481
+ data_table_id: dataStoreId
42482
+ });
42483
+ } catch (error) {
42484
+ toast.showError(error, i18n.baseText("dataStore.addRow.error"));
42485
+ } finally {
42486
+ toggleSave(false);
42487
+ contentLoading.value = false;
42488
+ }
42489
+ }
42490
+ const onCellValueChanged = async (params) => {
42491
+ const { data, api, oldValue, colDef } = params;
42492
+ const value = params.data[colDef.field];
42493
+ if (value === void 0 || value === oldValue) {
42494
+ return;
42495
+ }
42496
+ if (typeof data.id !== "number") {
42497
+ throw new Error("Expected row id to be a number");
42498
+ }
42499
+ const fieldName = String(colDef.field);
42500
+ const id = data.id;
42501
+ try {
42502
+ toggleSave(true);
42503
+ await dataStoreStore.updateRow(dataStoreId, projectId, id, {
42504
+ [fieldName]: value
42505
+ });
42506
+ telemetry2.track("User edited data table content", {
42507
+ data_table_id: dataStoreId,
42508
+ column_id: colDef.colId,
42509
+ column_type: colDef.cellDataType
42510
+ });
42511
+ } catch (error) {
42512
+ const validOldValue = isDataStoreValue(oldValue) ? oldValue : null;
42513
+ const revertedData = { ...data, [fieldName]: validOldValue };
42514
+ api.applyTransaction({
42515
+ update: [revertedData]
42516
+ });
42517
+ toast.showError(error, i18n.baseText("dataStore.updateRow.error"));
42518
+ } finally {
42519
+ toggleSave(false);
42520
+ }
42521
+ };
42522
+ async function fetchDataStoreRows() {
42523
+ try {
42524
+ contentLoading.value = true;
42525
+ const fetchedRows = await dataStoreStore.fetchDataStoreContent(
42526
+ dataStoreId,
42527
+ projectId,
42528
+ currentPage.value,
42529
+ pageSize.value,
42530
+ `${currentSortBy.value}:${currentSortOrder.value}`
42531
+ );
42532
+ rowData.value = fetchedRows.data;
42533
+ setTotalItems(fetchedRows.count);
42534
+ setGridData({ rowData: rowData.value, colDefs: colDefs.value });
42535
+ handleClearSelection();
42536
+ } catch (error) {
42537
+ toast.showError(error, i18n.baseText("dataStore.fetchContent.error"));
42538
+ } finally {
42539
+ contentLoading.value = false;
42540
+ }
42541
+ }
42542
+ const handleDeleteSelected = async () => {
42543
+ if (selectedRowIds.value.size === 0) return;
42544
+ const confirmResponse = await message.confirm(
42545
+ i18n.baseText("dataStore.deleteRows.confirmation", {
42546
+ adjustToNumber: selectedRowIds.value.size,
42547
+ interpolate: { count: selectedRowIds.value.size }
42548
+ }),
42549
+ i18n.baseText("dataStore.deleteRows.title"),
42550
+ {
42551
+ confirmButtonText: i18n.baseText("generic.delete"),
42552
+ cancelButtonText: i18n.baseText("generic.cancel")
42553
+ }
42554
+ );
42555
+ if (confirmResponse !== MODAL_CONFIRM) {
42556
+ return;
42557
+ }
42558
+ try {
42559
+ toggleSave(true);
42560
+ const idsToDelete = Array.from(selectedRowIds.value);
42561
+ await dataStoreStore.deleteRows(dataStoreId, projectId, idsToDelete);
42562
+ await fetchDataStoreRows();
42563
+ toast.showToast({
42564
+ title: i18n.baseText("dataStore.deleteRows.success"),
42565
+ message: "",
42566
+ type: "success"
42567
+ });
42568
+ telemetry2.track("User deleted rows in data table", {
42569
+ data_table_id: dataStoreId,
42570
+ deleted_row_count: idsToDelete.length
42571
+ });
42572
+ } catch (error) {
42573
+ toast.showError(error, i18n.baseText("dataStore.deleteRows.error"));
42574
+ } finally {
42575
+ toggleSave(false);
42576
+ }
42577
+ };
42578
+ const onCellKeyDown = async (params) => {
42579
+ if (params.api.getEditingCells().length > 0) {
42580
+ return;
42581
+ }
42582
+ const event = params.event;
42583
+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "c") {
42584
+ event.preventDefault();
42585
+ await handleCopyFocusedCell(params);
42586
+ return;
42587
+ }
42588
+ if (event.key !== "Delete" && event.key !== "Backspace" || selectedRowIds.value.size === 0) {
42589
+ return;
42590
+ }
42591
+ event.preventDefault();
42592
+ await handleDeleteSelected();
42593
+ };
42594
+ return {
42595
+ onDeleteColumn,
42596
+ onAddColumn,
42597
+ onColumnMoved,
42598
+ onAddRowClick,
42599
+ contentLoading,
42600
+ onCellValueChanged,
42601
+ fetchDataStoreRows,
42602
+ handleDeleteSelected,
42603
+ onCellKeyDown
42604
+ };
42605
+ };
41695
42606
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
41696
42607
  __name: "DataStoreTable",
41697
42608
  props: {
@@ -41715,572 +42626,71 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
41715
42626
  UndoRedoEditModule,
41716
42627
  CellStyleModule,
41717
42628
  PinnedRowModule,
41718
- ScrollApiModule
42629
+ ScrollApiModule,
42630
+ ColumnApiModule
41719
42631
  ]);
41720
42632
  const props = __props;
41721
42633
  const emit = __emit;
41722
- const i18n = useI18n();
41723
- const toast = useToast();
41724
- const message = useMessage();
41725
- const { mapToAGCellType } = useDataStoreTypes();
41726
- const dataStoreStore = useDataStoreStore();
41727
- const { copy: copyToClipboard } = useClipboard({ onPaste: onClipboardPaste });
41728
- const gridApi = ref(null);
41729
- const colDefs = ref([]);
42634
+ const gridContainerRef = useTemplateRef("gridContainerRef");
42635
+ const dataStoreGridBase = useDataStoreGridBase({
42636
+ gridContainerRef,
42637
+ onDeleteColumn: onDeleteColumnFunction,
42638
+ onAddRowClick: onAddRowClickFunction,
42639
+ onAddColumn: onAddColumnFunction
42640
+ });
41730
42641
  const rowData = ref([]);
41731
- const rowSelection = {
41732
- mode: "multiRow",
41733
- enableClickSelection: false,
41734
- checkboxes: (params) => params.data?.id !== ADD_ROW_ROW_ID,
41735
- isRowSelectable: (params) => params.data?.id !== ADD_ROW_ROW_ID
41736
- };
41737
- const currentSortBy = ref(DEFAULT_ID_COLUMN_NAME);
41738
- const currentSortOrder = ref("asc");
41739
- const contentLoading = ref(false);
41740
- const lastFocusedCell = ref(null);
41741
- const isTextEditorOpen = ref(false);
41742
- const gridContainer = useTemplateRef("gridContainer");
41743
- const pageSizeOptions = [10, 20, 50];
41744
- const currentPage = ref(1);
41745
- const pageSize = ref(20);
41746
- const totalItems = ref(0);
41747
- const rows = ref([]);
41748
- const selectedRowIds = ref(/* @__PURE__ */ new Set());
41749
- const selectedCount = computed(() => selectedRowIds.value.size);
41750
42642
  const hasRecords = computed(() => rowData.value.length > 0);
41751
- const onGridReady = (params) => {
41752
- gridApi.value = params.api;
41753
- if (gridContainer?.value) {
41754
- params.api.setGridOption("popupParent", gridContainer.value);
41755
- }
41756
- };
41757
- const refreshGridData = () => {
41758
- if (!gridApi.value) return;
41759
- gridApi.value.setGridOption("columnDefs", colDefs.value);
41760
- gridApi.value.setGridOption("rowData", rowData.value);
41761
- gridApi.value.setGridOption("pinnedBottomRowData", [{ id: ADD_ROW_ROW_ID }]);
41762
- };
41763
- const focusFirstEditableCell = (rowId) => {
41764
- if (!gridApi.value) return;
41765
- const rowNode = gridApi.value.getRowNode(String(rowId));
41766
- if (rowNode?.rowIndex === null) return;
41767
- const firstEditableCol = colDefs.value[1];
41768
- if (!firstEditableCol?.colId) return;
41769
- gridApi.value.ensureIndexVisible(rowNode.rowIndex);
41770
- gridApi.value.setFocusedCell(rowNode.rowIndex, firstEditableCol.colId);
41771
- gridApi.value.startEditingCell({ rowIndex: rowNode.rowIndex, colKey: firstEditableCol.colId });
41772
- };
41773
- const setCurrentPage = async (page) => {
41774
- currentPage.value = page;
41775
- await fetchDataStoreContent();
41776
- };
41777
- const setPageSize = async (size) => {
41778
- pageSize.value = size;
41779
- currentPage.value = 1;
41780
- await fetchDataStoreContent();
41781
- };
41782
- const onDeleteColumn = async (columnId) => {
41783
- if (!gridApi.value) return;
41784
- const columnToDelete = colDefs.value.find((col) => col.colId === columnId);
41785
- if (!columnToDelete) return;
41786
- const promptResponse = await message.confirm(
41787
- i18n.baseText("dataStore.deleteColumn.confirm.message", {
41788
- interpolate: { name: columnToDelete.headerName ?? "" }
41789
- }),
41790
- i18n.baseText("dataStore.deleteColumn.confirm.title"),
41791
- {
41792
- confirmButtonText: i18n.baseText("generic.delete"),
41793
- cancelButtonText: i18n.baseText("generic.cancel")
41794
- }
41795
- );
41796
- if (promptResponse !== MODAL_CONFIRM) {
41797
- return;
41798
- }
41799
- const columnToDeleteIndex = colDefs.value.findIndex((col) => col.colId === columnId);
41800
- colDefs.value = colDefs.value.filter((def) => def.colId !== columnId);
41801
- const rowDataOldValue = [...rowData.value];
41802
- rowData.value = rowData.value.map((row) => {
41803
- const { [columnToDelete.field]: _, ...rest } = row;
41804
- return rest;
41805
- });
41806
- refreshGridData();
41807
- try {
41808
- await dataStoreStore.deleteDataStoreColumn(
41809
- props.dataStore.id,
41810
- props.dataStore.projectId,
41811
- columnId
41812
- );
41813
- } catch (error) {
41814
- toast.showError(error, i18n.baseText("dataStore.deleteColumn.error"));
41815
- colDefs.value.splice(columnToDeleteIndex, 0, columnToDelete);
41816
- rowData.value = rowDataOldValue;
41817
- refreshGridData();
41818
- }
41819
- };
41820
- const onAddColumn = async (column) => {
41821
- try {
41822
- const newColumn = await dataStoreStore.addDataStoreColumn(
41823
- props.dataStore.id,
41824
- props.dataStore.projectId,
41825
- column
41826
- );
41827
- if (!newColumn) {
41828
- throw new Error(i18n.baseText("generic.unknownError"));
41829
- }
41830
- colDefs.value = [
41831
- ...colDefs.value.slice(0, -1),
41832
- createColumnDef(newColumn),
41833
- ...colDefs.value.slice(-1)
41834
- ];
41835
- rowData.value = rowData.value.map((row) => {
41836
- return { ...row, [newColumn.name]: null };
41837
- });
41838
- refreshGridData();
41839
- return true;
41840
- } catch (error) {
41841
- toast.showError(error, i18n.baseText("dataStore.addColumn.error"));
41842
- return false;
41843
- }
41844
- };
41845
- const createColumnDef = (col, extraProps = {}) => {
41846
- const columnDef = {
41847
- colId: col.id,
41848
- field: col.name,
41849
- headerName: col.name,
41850
- sortable: true,
41851
- flex: 1,
41852
- editable: (params) => params.data?.id !== ADD_ROW_ROW_ID,
41853
- resizable: true,
41854
- lockPinned: true,
41855
- headerComponent: _sfc_main$6,
41856
- headerComponentParams: { onDelete: onDeleteColumn, allowMenuActions: true },
41857
- cellEditorPopup: false,
41858
- cellDataType: mapToAGCellType(col.type),
41859
- cellClass: (params) => {
41860
- if (params.data?.id === ADD_ROW_ROW_ID) {
41861
- return "add-row-cell";
41862
- }
41863
- if (params.column.getUserProvidedColDef()?.cellDataType === "boolean") {
41864
- return "boolean-cell";
41865
- }
41866
- return "";
41867
- },
41868
- valueGetter: (params) => {
41869
- if (params.data?.[col.name] === null || params.data?.[col.name] === void 0) {
41870
- return null;
41871
- }
41872
- if (col.type === "date") {
41873
- const value = params.data?.[col.name];
41874
- if (typeof value === "string") {
41875
- return new Date(value);
41876
- }
41877
- }
41878
- return params.data?.[col.name];
41879
- },
41880
- cellRendererSelector: (params) => {
41881
- if (params.data?.id === ADD_ROW_ROW_ID || col.id === "add-column") {
41882
- return {};
41883
- }
41884
- let rowValue = params.data?.[col.name];
41885
- if (rowValue === void 0) {
41886
- rowValue = null;
41887
- }
41888
- if (rowValue === null) {
41889
- return { component: _sfc_main$3, params: { value: NULL_VALUE } };
41890
- }
41891
- if (rowValue === "") {
41892
- return { component: _sfc_main$3, params: { value: EMPTY_VALUE } };
41893
- }
41894
- return void 0;
41895
- }
41896
- };
41897
- if (col.type === "string") {
41898
- columnDef.cellEditor = "agLargeTextCellEditor";
41899
- columnDef.cellEditorPopup = true;
41900
- columnDef.cellEditorPopupPosition = "over";
41901
- columnDef.cellEditorParams = (params) => ({
41902
- value: params.value ?? "",
41903
- // Rely on the backend to limit the length of the value
41904
- maxLength: 999999999
41905
- });
41906
- columnDef.valueSetter = (params) => {
41907
- let originalValue = params.data[col.name];
41908
- if (originalValue === void 0) {
41909
- originalValue = null;
41910
- }
41911
- let newValue = params.newValue;
41912
- if (!isDataStoreValue(newValue)) {
41913
- return false;
41914
- }
41915
- if (originalValue === null && newValue === "") {
41916
- return false;
41917
- }
41918
- if (isTextEditorOpen.value && newValue === null) {
41919
- newValue = "";
41920
- }
41921
- params.data[col.name] = newValue;
41922
- return true;
41923
- };
41924
- }
41925
- if (col.type === "date") {
41926
- columnDef.cellEditorSelector = () => ({
41927
- component: _sfc_main$2
41928
- });
41929
- columnDef.valueFormatter = (params) => {
41930
- const value = params.value;
41931
- if (value === null || value === void 0) return "";
41932
- return value.toISOString();
41933
- };
41934
- }
41935
- return {
41936
- ...columnDef,
41937
- ...extraProps
41938
- };
41939
- };
41940
- const onColumnMoved = async (moveEvent) => {
41941
- if (!moveEvent.finished || moveEvent.source !== "uiColumnMoved" || moveEvent.toIndex === void 0 || !moveEvent.column) {
41942
- return;
41943
- }
41944
- const oldIndex = colDefs.value.findIndex((col) => col.colId === moveEvent.column.getColId());
41945
- try {
41946
- await dataStoreStore.moveDataStoreColumn(
41947
- props.dataStore.id,
41948
- props.dataStore.projectId,
41949
- moveEvent.column.getColId(),
41950
- moveEvent.toIndex - 2
41951
- // ag grid index start from 1 and also we need to account for the id column
41952
- );
41953
- const fromIndex = oldIndex - 1;
41954
- const toIndex = moveEvent.toIndex - 2;
41955
- const middleWithIndex = colDefs.value.slice(1, -1).map((col, index) => ({ ...col, index }));
41956
- const reorderedMiddle = reorderItem(middleWithIndex, fromIndex, toIndex).sort((a, b) => a.index - b.index).map(({ index, ...col }) => col);
41957
- colDefs.value = [colDefs.value[0], ...reorderedMiddle, colDefs.value[colDefs.value.length - 1]];
41958
- refreshGridData();
41959
- } catch (error) {
41960
- toast.showError(error, i18n.baseText("dataStore.moveColumn.error"));
41961
- gridApi.value?.moveColumnByIndex(moveEvent.toIndex, oldIndex);
41962
- }
41963
- };
41964
- const onAddRowClick = async () => {
41965
- try {
41966
- if (currentPage.value * pageSize.value < totalItems.value + 1) {
41967
- await setCurrentPage(Math.ceil((totalItems.value + 1) / pageSize.value));
41968
- }
41969
- contentLoading.value = true;
41970
- emit("toggleSave", true);
41971
- const insertedRow = await dataStoreStore.insertEmptyRow(props.dataStore);
41972
- const newRow = insertedRow;
41973
- rowData.value.push(newRow);
41974
- totalItems.value += 1;
41975
- refreshGridData();
41976
- await nextTick();
41977
- focusFirstEditableCell(newRow.id);
41978
- } catch (error) {
41979
- toast.showError(error, i18n.baseText("dataStore.addRow.error"));
41980
- } finally {
41981
- emit("toggleSave", false);
41982
- contentLoading.value = false;
41983
- }
41984
- };
41985
- const initColumnDefinitions = () => {
41986
- const systemDateColumnOptions = {
41987
- editable: false,
41988
- suppressMovable: true,
41989
- lockPinned: true,
41990
- lockPosition: "right",
41991
- headerComponentParams: {
41992
- allowMenuActions: false
41993
- }
41994
- };
41995
- colDefs.value = [
41996
- // Always add the ID column, it's not returned by the back-end but all data stores have it
41997
- // We use it as a placeholder for new datastores
41998
- createColumnDef(
41999
- {
42000
- id: DEFAULT_ID_COLUMN_NAME,
42001
- name: DEFAULT_ID_COLUMN_NAME,
42002
- type: "string"
42003
- },
42004
- {
42005
- editable: false,
42006
- sortable: false,
42007
- suppressMovable: true,
42008
- headerComponent: null,
42009
- lockPosition: true,
42010
- minWidth: DATA_STORE_ID_COLUMN_WIDTH,
42011
- maxWidth: DATA_STORE_ID_COLUMN_WIDTH,
42012
- resizable: false,
42013
- cellClass: (params) => params.data?.id === ADD_ROW_ROW_ID ? "add-row-cell" : "id-column",
42014
- cellRendererSelector: (params) => {
42015
- if (params.value === ADD_ROW_ROW_ID) {
42016
- return {
42017
- component: _sfc_main$4,
42018
- params: { onClick: onAddRowClick }
42019
- };
42020
- }
42021
- return void 0;
42022
- }
42023
- }
42024
- ),
42025
- // Append other columns
42026
- ...orderBy(props.dataStore.columns, "index").map((col) => createColumnDef(col)),
42027
- createColumnDef(
42028
- {
42029
- index: props.dataStore.columns.length + 1,
42030
- id: "createdAt",
42031
- name: "createdAt",
42032
- type: "date"
42033
- },
42034
- systemDateColumnOptions
42035
- ),
42036
- createColumnDef(
42037
- {
42038
- index: props.dataStore.columns.length + 2,
42039
- id: "updatedAt",
42040
- name: "updatedAt",
42041
- type: "date"
42042
- },
42043
- systemDateColumnOptions
42044
- ),
42045
- createColumnDef(
42046
- {
42047
- index: props.dataStore.columns.length + 3,
42048
- id: "add-column",
42049
- name: "Add Column",
42050
- type: "string"
42051
- },
42052
- {
42053
- editable: false,
42054
- suppressMovable: true,
42055
- lockPinned: true,
42056
- lockPosition: "right",
42057
- resizable: false,
42058
- headerComponent: _sfc_main$5,
42059
- headerComponentParams: { onAddColumn }
42060
- }
42061
- )
42062
- ];
42063
- };
42064
- const onCellValueChanged = async (params) => {
42065
- const { data, api, oldValue, colDef } = params;
42066
- const value = params.data[colDef.field];
42067
- if (value === void 0 || value === oldValue) {
42068
- return;
42069
- }
42070
- if (typeof data.id !== "number") {
42071
- throw new Error("Expected row id to be a number");
42072
- }
42073
- const fieldName = String(colDef.field);
42074
- const id = data.id;
42075
- try {
42076
- emit("toggleSave", true);
42077
- await dataStoreStore.updateRow(props.dataStore.id, props.dataStore.projectId, id, {
42078
- [fieldName]: value
42079
- });
42080
- } catch (error) {
42081
- const validOldValue = isDataStoreValue(oldValue) ? oldValue : null;
42082
- const revertedData = { ...data, [fieldName]: validOldValue };
42083
- api.applyTransaction({
42084
- update: [revertedData]
42085
- });
42086
- toast.showError(error, i18n.baseText("dataStore.updateRow.error"));
42087
- } finally {
42088
- emit("toggleSave", false);
42089
- }
42090
- };
42091
- const onCellClicked = (params) => {
42092
- const clickedCellColumn = params.column.getColId();
42093
- const clickedCellRow = params.rowIndex;
42094
- if (clickedCellRow === null || params.api.isEditing({ rowIndex: clickedCellRow, column: params.column, rowPinned: null }))
42095
- return;
42096
- const wasAlreadyFocused = lastFocusedCell.value && lastFocusedCell.value.rowIndex === clickedCellRow && lastFocusedCell.value.colId === clickedCellColumn;
42097
- if (wasAlreadyFocused && params.column.getColDef()?.editable) {
42098
- params.api.startEditingCell({
42099
- rowIndex: clickedCellRow,
42100
- colKey: clickedCellColumn
42101
- });
42102
- }
42103
- lastFocusedCell.value = {
42104
- rowIndex: clickedCellRow,
42105
- colId: clickedCellColumn
42106
- };
42107
- };
42108
- const fetchDataStoreContent = async () => {
42109
- try {
42110
- contentLoading.value = true;
42111
- const fetchedRows = await dataStoreStore.fetchDataStoreContent(
42112
- props.dataStore.id,
42113
- props.dataStore.projectId,
42114
- currentPage.value,
42115
- pageSize.value,
42116
- `${currentSortBy.value}:${currentSortOrder.value}`
42117
- );
42118
- rowData.value = fetchedRows.data;
42119
- totalItems.value = fetchedRows.count;
42120
- refreshGridData();
42121
- handleClearSelection();
42122
- } catch (error) {
42123
- toast.showError(error, i18n.baseText("dataStore.fetchContent.error"));
42124
- } finally {
42125
- contentLoading.value = false;
42126
- if (gridApi.value) {
42127
- gridApi.value.refreshHeader();
42128
- }
42129
- }
42130
- };
42131
- onClickOutside(gridContainer, () => {
42132
- resetLastFocusedCell();
42133
- gridApi.value?.clearFocusedCell();
42134
- });
42135
- function onClipboardPaste(data) {
42136
- if (!gridApi.value) return;
42137
- const focusedCell = gridApi.value.getFocusedCell();
42138
- const isEditing2 = gridApi.value.getEditingCells().length > 0;
42139
- if (!focusedCell || isEditing2) return;
42140
- const row = gridApi.value.getDisplayedRowAtIndex(focusedCell.rowIndex);
42141
- if (!row) return;
42142
- const colDef = focusedCell.column.getColDef();
42143
- if (colDef.cellDataType === "text") {
42144
- row.setDataValue(focusedCell.column.getColId(), data);
42145
- } else if (colDef.cellDataType === "number") {
42146
- if (!Number.isNaN(Number(data))) {
42147
- row.setDataValue(focusedCell.column.getColId(), Number(data));
42148
- }
42149
- } else if (colDef.cellDataType === "date") {
42150
- if (!Number.isNaN(Date.parse(data))) {
42151
- row.setDataValue(focusedCell.column.getColId(), new Date(data));
42152
- }
42153
- } else if (colDef.cellDataType === "boolean") {
42154
- if (data === "true") {
42155
- row.setDataValue(focusedCell.column.getColId(), true);
42156
- } else if (data === "false") {
42157
- row.setDataValue(focusedCell.column.getColId(), false);
42158
- }
42159
- }
42160
- }
42161
- const resetLastFocusedCell = () => {
42162
- lastFocusedCell.value = null;
42163
- };
42164
- const initialize = async () => {
42165
- initColumnDefinitions();
42166
- await fetchDataStoreContent();
42167
- };
42168
- const onSortChanged2 = async (event) => {
42169
- const oldSortBy = currentSortBy.value;
42170
- const oldSortOrder = currentSortOrder.value;
42171
- const sortedColumn = event.columns?.filter((col) => col.getSort() !== null).pop() ?? null;
42172
- if (sortedColumn) {
42173
- const colId = sortedColumn.getColId();
42174
- const columnDef = colDefs.value.find((col) => col.colId === colId);
42175
- currentSortBy.value = columnDef?.field || colId;
42176
- currentSortOrder.value = sortedColumn.getSort() ?? "asc";
42177
- } else {
42178
- currentSortBy.value = DEFAULT_ID_COLUMN_NAME;
42179
- currentSortOrder.value = "asc";
42180
- }
42181
- if (oldSortBy !== currentSortBy.value || oldSortOrder !== currentSortOrder.value) {
42182
- currentPage.value = 1;
42183
- await fetchDataStoreContent();
42184
- }
42185
- };
42186
- onMounted(async () => {
42187
- await initialize();
42643
+ const pagination = useDataStorePagination({ onChange: fetchDataStoreRowsFunction });
42644
+ const selection = useDataStoreSelection({
42645
+ gridApi: dataStoreGridBase.gridApi
42646
+ });
42647
+ const dataStoreOperations = useDataStoreOperations({
42648
+ colDefs: dataStoreGridBase.colDefs,
42649
+ rowData,
42650
+ deleteGridColumn: dataStoreGridBase.deleteColumn,
42651
+ setGridData: dataStoreGridBase.setGridData,
42652
+ insertGridColumnAtIndex: dataStoreGridBase.insertColumnAtIndex,
42653
+ dataStoreId: props.dataStore.id,
42654
+ projectId: props.dataStore.projectId,
42655
+ addGridColumn: dataStoreGridBase.addColumn,
42656
+ moveGridColumn: dataStoreGridBase.moveColumn,
42657
+ gridApi: dataStoreGridBase.gridApi,
42658
+ totalItems: pagination.totalItems,
42659
+ setTotalItems: pagination.setTotalItems,
42660
+ ensureItemOnPage: pagination.ensureItemOnPage,
42661
+ focusFirstEditableCell: dataStoreGridBase.focusFirstEditableCell,
42662
+ toggleSave: emit.bind(null, "toggleSave"),
42663
+ currentPage: pagination.currentPage,
42664
+ pageSize: pagination.pageSize,
42665
+ currentSortBy: dataStoreGridBase.currentSortBy,
42666
+ currentSortOrder: dataStoreGridBase.currentSortOrder,
42667
+ handleClearSelection: selection.handleClearSelection,
42668
+ selectedRowIds: selection.selectedRowIds,
42669
+ handleCopyFocusedCell: dataStoreGridBase.handleCopyFocusedCell
42670
+ });
42671
+ async function onDeleteColumnFunction(columnId) {
42672
+ await dataStoreOperations.onDeleteColumn(columnId);
42673
+ }
42674
+ async function onAddColumnFunction(column) {
42675
+ return await dataStoreOperations.onAddColumn(column);
42676
+ }
42677
+ async function onAddRowClickFunction() {
42678
+ await dataStoreOperations.onAddRowClick();
42679
+ }
42680
+ async function fetchDataStoreRowsFunction() {
42681
+ await dataStoreOperations.fetchDataStoreRows();
42682
+ }
42683
+ const initialize = async (params) => {
42684
+ dataStoreGridBase.onGridReady(params);
42685
+ dataStoreGridBase.loadColumns(props.dataStore.columns);
42686
+ await dataStoreOperations.fetchDataStoreRows();
42687
+ };
42688
+ watch([dataStoreGridBase.currentSortBy, dataStoreGridBase.currentSortOrder], async () => {
42689
+ await pagination.setCurrentPage(1);
42188
42690
  });
42189
- const onCellEditingStarted = (params) => {
42190
- if (params.column.getColDef().cellDataType === "text") {
42191
- isTextEditorOpen.value = true;
42192
- } else {
42193
- isTextEditorOpen.value = false;
42194
- }
42195
- };
42196
- const onCellEditingStopped = (params) => {
42197
- if (params.column.getColDef().cellDataType === "text") {
42198
- isTextEditorOpen.value = false;
42199
- }
42200
- };
42201
- const onSelectionChanged = () => {
42202
- if (!gridApi.value) return;
42203
- const selectedNodes = gridApi.value.getSelectedNodes();
42204
- const newSelectedIds = /* @__PURE__ */ new Set();
42205
- selectedNodes.forEach((node) => {
42206
- if (typeof node.data?.id === "number") {
42207
- newSelectedIds.add(node.data.id);
42208
- }
42209
- });
42210
- selectedRowIds.value = newSelectedIds;
42211
- };
42212
- const onCellKeyDown = async (params) => {
42213
- if (params.api.getEditingCells().length > 0) {
42214
- return;
42215
- }
42216
- const event = params.event;
42217
- if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "c") {
42218
- event.preventDefault();
42219
- await handleCopyFocusedCell(params);
42220
- return;
42221
- }
42222
- if (event.key !== "Delete" && event.key !== "Backspace" || selectedRowIds.value.size === 0) {
42223
- return;
42224
- }
42225
- event.preventDefault();
42226
- await handleDeleteSelected();
42227
- };
42228
- const handleCopyFocusedCell = async (params) => {
42229
- const focused = params.api.getFocusedCell();
42230
- if (!focused) {
42231
- return;
42232
- }
42233
- const row = params.api.getDisplayedRowAtIndex(focused.rowIndex);
42234
- const colDef = focused.column.getColDef();
42235
- if (row?.data && colDef.field) {
42236
- const rawValue = row.data[colDef.field];
42237
- const text = rawValue === null || rawValue === void 0 ? "" : String(rawValue);
42238
- await copyToClipboard(text);
42239
- }
42240
- };
42241
- const handleDeleteSelected = async () => {
42242
- if (selectedRowIds.value.size === 0) return;
42243
- const confirmResponse = await message.confirm(
42244
- i18n.baseText("dataStore.deleteRows.confirmation", {
42245
- adjustToNumber: selectedRowIds.value.size,
42246
- interpolate: { count: selectedRowIds.value.size }
42247
- }),
42248
- i18n.baseText("dataStore.deleteRows.title"),
42249
- {
42250
- confirmButtonText: i18n.baseText("generic.delete"),
42251
- cancelButtonText: i18n.baseText("generic.cancel")
42252
- }
42253
- );
42254
- if (confirmResponse !== MODAL_CONFIRM) {
42255
- return;
42256
- }
42257
- try {
42258
- emit("toggleSave", true);
42259
- const idsToDelete = Array.from(selectedRowIds.value);
42260
- await dataStoreStore.deleteRows(props.dataStore.id, props.dataStore.projectId, idsToDelete);
42261
- rows.value = rows.value.filter((row) => !selectedRowIds.value.has(row.id));
42262
- rowData.value = rows.value;
42263
- await fetchDataStoreContent();
42264
- toast.showToast({
42265
- title: i18n.baseText("dataStore.deleteRows.success"),
42266
- message: "",
42267
- type: "success"
42268
- });
42269
- } catch (error) {
42270
- toast.showError(error, i18n.baseText("dataStore.deleteRows.error"));
42271
- } finally {
42272
- emit("toggleSave", false);
42273
- }
42274
- };
42275
- const handleClearSelection = () => {
42276
- selectedRowIds.value = /* @__PURE__ */ new Set();
42277
- if (gridApi.value) {
42278
- gridApi.value.deselectAll();
42279
- }
42280
- };
42281
42691
  __expose({
42282
- addRow: onAddRowClick,
42283
- addColumn: onAddColumn
42692
+ addRow: dataStoreOperations.onAddRowClick,
42693
+ addColumn: dataStoreOperations.onAddColumn
42284
42694
  });
42285
42695
  return (_ctx, _cache) => {
42286
42696
  const _component_el_pagination = resolveComponent("el-pagination");
@@ -42288,8 +42698,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
42288
42698
  class: normalizeClass(_ctx.$style.wrapper)
42289
42699
  }, [
42290
42700
  createBaseVNode("div", {
42291
- ref_key: "gridContainer",
42292
- ref: gridContainer,
42701
+ ref_key: "gridContainerRef",
42702
+ ref: gridContainerRef,
42293
42703
  class: normalizeClass([_ctx.$style["grid-container"], { [_ctx.$style["has-records"]]: hasRecords.value }]),
42294
42704
  "data-test-id": "data-store-grid"
42295
42705
  }, [
@@ -42301,48 +42711,48 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
42301
42711
  "animate-rows": false,
42302
42712
  theme: unref(n8nTheme),
42303
42713
  "suppress-drag-leave-hides-columns": true,
42304
- loading: contentLoading.value,
42305
- "row-selection": rowSelection,
42714
+ loading: unref(dataStoreOperations).contentLoading.value,
42715
+ "row-selection": unref(selection).rowSelection,
42306
42716
  "get-row-id": (params) => String(params.data.id),
42307
42717
  "stop-editing-when-cells-lose-focus": true,
42308
42718
  "undo-redo-cell-editing": true,
42309
42719
  "suppress-multi-sort": true,
42310
- onGridReady,
42311
- onCellValueChanged,
42312
- onColumnMoved,
42313
- onCellClicked,
42314
- onCellEditingStarted,
42315
- onCellEditingStopped,
42316
- onColumnHeaderClicked: resetLastFocusedCell,
42317
- onSelectionChanged,
42318
- onSortChanged: onSortChanged2,
42319
- onCellKeyDown
42320
- }, null, 8, ["row-height", "header-height", "theme", "loading", "get-row-id"])
42720
+ onGridReady: initialize,
42721
+ onCellValueChanged: unref(dataStoreOperations).onCellValueChanged,
42722
+ onColumnMoved: unref(dataStoreOperations).onColumnMoved,
42723
+ onCellClicked: unref(dataStoreGridBase).onCellClicked,
42724
+ onCellEditingStarted: unref(dataStoreGridBase).onCellEditingStarted,
42725
+ onCellEditingStopped: unref(dataStoreGridBase).onCellEditingStopped,
42726
+ onColumnHeaderClicked: unref(dataStoreGridBase).resetLastFocusedCell,
42727
+ onSelectionChanged: unref(selection).onSelectionChanged,
42728
+ onSortChanged: unref(dataStoreGridBase).onSortChanged,
42729
+ onCellKeyDown: unref(dataStoreOperations).onCellKeyDown
42730
+ }, null, 8, ["row-height", "header-height", "theme", "loading", "row-selection", "get-row-id", "onCellValueChanged", "onColumnMoved", "onCellClicked", "onCellEditingStarted", "onCellEditingStopped", "onColumnHeaderClicked", "onSelectionChanged", "onSortChanged", "onCellKeyDown"])
42321
42731
  ], 2),
42322
42732
  createBaseVNode("div", {
42323
42733
  class: normalizeClass(_ctx.$style.footer)
42324
42734
  }, [
42325
42735
  createVNode(_component_el_pagination, {
42326
- "current-page": currentPage.value,
42736
+ "current-page": unref(pagination).currentPage,
42327
42737
  "onUpdate:currentPage": [
42328
- _cache[0] || (_cache[0] = ($event) => currentPage.value = $event),
42329
- setCurrentPage
42738
+ _cache[0] || (_cache[0] = ($event) => unref(pagination).currentPage = $event),
42739
+ unref(pagination).setCurrentPage
42330
42740
  ],
42331
- "page-size": pageSize.value,
42332
- "onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => pageSize.value = $event),
42741
+ "page-size": unref(pagination).pageSize,
42742
+ "onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => unref(pagination).pageSize = $event),
42333
42743
  "data-test-id": "data-store-content-pagination",
42334
42744
  background: "",
42335
- total: totalItems.value,
42336
- "page-sizes": pageSizeOptions,
42745
+ total: unref(pagination).totalItems,
42746
+ "page-sizes": unref(pagination).pageSizeOptions,
42337
42747
  layout: "total, prev, pager, next, sizes",
42338
- onSizeChange: setPageSize
42339
- }, null, 8, ["current-page", "page-size", "total"])
42748
+ onSizeChange: unref(pagination).setPageSize
42749
+ }, null, 8, ["current-page", "page-size", "total", "page-sizes", "onUpdate:currentPage", "onSizeChange"])
42340
42750
  ], 2),
42341
42751
  createVNode(SelectedItemsInfo, {
42342
- "selected-count": selectedCount.value,
42343
- onDeleteSelected: handleDeleteSelected,
42344
- onClearSelection: handleClearSelection
42345
- }, null, 8, ["selected-count"])
42752
+ "selected-count": unref(selection).selectedCount.value,
42753
+ onDeleteSelected: unref(dataStoreOperations).handleDeleteSelected,
42754
+ onClearSelection: unref(selection).handleClearSelection
42755
+ }, null, 8, ["selected-count", "onDeleteSelected", "onClearSelection"])
42346
42756
  ], 2);
42347
42757
  };
42348
42758
  }
@@ -42484,7 +42894,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
42484
42894
  ]),
42485
42895
  _: 1
42486
42896
  }, 8, ["onClick"]),
42487
- createVNode(_sfc_main$5, {
42897
+ createVNode(_sfc_main$4, {
42488
42898
  "use-text-trigger": true,
42489
42899
  "popover-id": "ds-details-add-column-popover",
42490
42900
  params: { onAddColumn }