@ynput/ayon-frontend-shared 0.2.25 → 0.2.26

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 (56) hide show
  1. package/dist/Views.cjs.js +1 -1
  2. package/dist/Views.es.js +14 -14
  3. package/dist/shared/src/components/LinksManager/hooks/useUpdateLinks.cjs.js +1 -1
  4. package/dist/shared/src/components/LinksManager/hooks/useUpdateLinks.cjs.js.map +1 -1
  5. package/dist/shared/src/components/LinksManager/hooks/useUpdateLinks.es.js +33 -25
  6. package/dist/shared/src/components/LinksManager/hooks/useUpdateLinks.es.js.map +1 -1
  7. package/dist/shared/src/containers/ProjectTreeTable/context/CellEditingProvider.cjs.js +1 -1
  8. package/dist/shared/src/containers/ProjectTreeTable/context/CellEditingProvider.cjs.js.map +1 -1
  9. package/dist/shared/src/containers/ProjectTreeTable/context/CellEditingProvider.es.js +10 -10
  10. package/dist/shared/src/containers/ProjectTreeTable/context/CellEditingProvider.es.js.map +1 -1
  11. package/dist/shared/src/containers/ProjectTreeTable/hooks/usePasteLinks.cjs.js +1 -1
  12. package/dist/shared/src/containers/ProjectTreeTable/hooks/usePasteLinks.cjs.js.map +1 -1
  13. package/dist/shared/src/containers/ProjectTreeTable/hooks/usePasteLinks.es.js +229 -68
  14. package/dist/shared/src/containers/ProjectTreeTable/hooks/usePasteLinks.es.js.map +1 -1
  15. package/dist/shared/src/containers/Slicer/createFilterFromSlicer.cjs.js +1 -1
  16. package/dist/shared/src/containers/Slicer/createFilterFromSlicer.cjs.js.map +1 -1
  17. package/dist/shared/src/containers/Slicer/createFilterFromSlicer.es.js +21 -25
  18. package/dist/shared/src/containers/Slicer/createFilterFromSlicer.es.js.map +1 -1
  19. package/dist/shared/src/containers/Views/ViewItem/ViewItem.cjs.js +1 -1
  20. package/dist/shared/src/containers/Views/ViewItem/ViewItem.cjs.js.map +1 -1
  21. package/dist/shared/src/containers/Views/ViewItem/ViewItem.es.js +64 -54
  22. package/dist/shared/src/containers/Views/ViewItem/ViewItem.es.js.map +1 -1
  23. package/dist/shared/src/containers/Views/ViewsDialogContainer/ViewFormDialogFallback.cjs.js.map +1 -1
  24. package/dist/shared/src/containers/Views/ViewsDialogContainer/ViewFormDialogFallback.es.js.map +1 -1
  25. package/dist/shared/src/containers/Views/ViewsDialogContainer/ViewsDialogContainer.cjs.js +1 -1
  26. package/dist/shared/src/containers/Views/ViewsDialogContainer/ViewsDialogContainer.cjs.js.map +1 -1
  27. package/dist/shared/src/containers/Views/ViewsDialogContainer/ViewsDialogContainer.es.js +22 -20
  28. package/dist/shared/src/containers/Views/ViewsDialogContainer/ViewsDialogContainer.es.js.map +1 -1
  29. package/dist/shared/src/containers/Views/context/ViewsContext.cjs.js +1 -1
  30. package/dist/shared/src/containers/Views/context/ViewsContext.cjs.js.map +1 -1
  31. package/dist/shared/src/containers/Views/context/ViewsContext.es.js +60 -59
  32. package/dist/shared/src/containers/Views/context/ViewsContext.es.js.map +1 -1
  33. package/dist/shared/src/containers/Views/hooks/useSaveViewFromCurrent.cjs.js +1 -1
  34. package/dist/shared/src/containers/Views/hooks/useSaveViewFromCurrent.cjs.js.map +1 -1
  35. package/dist/shared/src/containers/Views/hooks/useSaveViewFromCurrent.es.js +14 -14
  36. package/dist/shared/src/containers/Views/hooks/useSaveViewFromCurrent.es.js.map +1 -1
  37. package/dist/shared/src/containers/Views/hooks/useViewsMutations.cjs.js +1 -1
  38. package/dist/shared/src/containers/Views/hooks/useViewsMutations.cjs.js.map +1 -1
  39. package/dist/shared/src/containers/Views/hooks/useViewsMutations.es.js +17 -18
  40. package/dist/shared/src/containers/Views/hooks/useViewsMutations.es.js.map +1 -1
  41. package/dist/shared/src/hooks/useActionTriggers.cjs.js +1 -1
  42. package/dist/shared/src/hooks/useActionTriggers.cjs.js.map +1 -1
  43. package/dist/shared/src/hooks/useActionTriggers.es.js +38 -33
  44. package/dist/shared/src/hooks/useActionTriggers.es.js.map +1 -1
  45. package/dist/shared/src/hooks/useCustomProtocolCheck.cjs.js +2 -0
  46. package/dist/shared/src/hooks/useCustomProtocolCheck.cjs.js.map +1 -0
  47. package/dist/shared/src/hooks/useCustomProtocolCheck.es.js +43 -0
  48. package/dist/shared/src/hooks/useCustomProtocolCheck.es.js.map +1 -0
  49. package/dist/types/containers/Slicer/createFilterFromSlicer.d.ts +3 -1
  50. package/dist/types/containers/Slicer/types.d.ts +1 -1
  51. package/dist/types/containers/Views/ViewsDialogContainer/ViewFormDialogFallback.d.ts +1 -0
  52. package/dist/types/containers/Views/context/ViewsContext.d.ts +2 -1
  53. package/dist/types/containers/Views/hooks/useViewsMutations.d.ts +3 -3
  54. package/dist/types/hooks/useActionTriggers.d.ts +1 -1
  55. package/dist/types/hooks/useCustomProtocolCheck.d.ts +10 -0
  56. package/package.json +1 -1
@@ -57,7 +57,7 @@ import "../../../api/queries/entityLists/getListsAttributes.es.js";
57
57
  import "../../../api/queries/entityLists/updateListsAttributes.es.js";
58
58
  import "../../../api/queries/folders/getFolders.es.js";
59
59
  import "../../../api/queries/grouping/getGrouping.es.js";
60
- import { useDeleteEntityLinkMutation as b, useCreateEntityLinkMutation as j } from "../../../api/queries/links/updateLinks.es.js";
60
+ import { useDeleteEntityLinkMutation as x, useCreateEntityLinkMutation as $ } from "../../../api/queries/links/updateLinks.es.js";
61
61
  import "../../../api/queries/links/getLinks.es.js";
62
62
  import "../../../api/queries/links/getEntityLinks.es.js";
63
63
  import "../../../api/queries/overview/getOverview.es.js";
@@ -77,100 +77,261 @@ import "../../../api/queries/versions/updateVersions.es.js";
77
77
  import "../../../api/queries/views/getViews.es.js";
78
78
  import "../../../api/queries/views/updateViews.es.js";
79
79
  import "../../../api/queries/watchers/getWatchers.es.js";
80
- import { removeMultipleLinks as x, addMultipleLinks as $ } from "../../../components/LinksManager/utils/linkUpdates.es.js";
81
- import { useProjectTableContext as C } from "../context/ProjectTableContext.es.js";
80
+ import { removeMultipleLinks as L, addMultipleLinks as P } from "../../../components/LinksManager/utils/linkUpdates.es.js";
81
+ import { useProjectTableContext as S } from "../context/ProjectTableContext.es.js";
82
82
  import "lodash";
83
- import "react-toastify";
84
- import { getEntityId as L } from "../../../util/getEntityId.es.js";
83
+ import { toast as D } from "react-toastify";
84
+ import { getEntityId as A } from "../../../util/getEntityId.es.js";
85
85
  import "../../../util/pubsub.es.js";
86
- const yo = (N) => {
87
- const { getEntityById: k, projectName: w } = C(), p = w, [T] = b(), [g] = j();
86
+ import "../../ContextMenu/ContextMenuContext.es.js";
87
+ import "../../../../../_virtual/jsx-runtime.es.js";
88
+ import "@ynput/ayon-react-components";
89
+ /* empty css */
90
+ import "clsx";
91
+ import "react-dom";
92
+ import "../../Feed/context/FeedContext.es.js";
93
+ import "../../Feed/components/Tooltips/UserTooltip/UserTooltip.styled.es.js";
94
+ import "../../Feed/components/Tooltips/EntityTooltip/EntityTooltip.styled.es.js";
95
+ import "../../Feed/components/FileUploadPreview/FileUploadPreview.styled.es.js";
96
+ import "../../Feed/components/FileUploadPreview/Mimes/TextMime.es.js";
97
+ import "react-markdown";
98
+ import "remark-emoji";
99
+ import "remark-gfm";
100
+ import "remark-directive";
101
+ import "remark-directive-rehype";
102
+ import "../../Feed/components/CommentInput/CommentInput.es.js";
103
+ import "../../Feed/components/ReactionContainer/Reactions.styled.es.js";
104
+ import "../../Feed/components/FilesGrid/FilesGrid.styled.es.js";
105
+ import "../../Feed/components/FileUploadCard/FileUploadCard.styled.es.js";
106
+ import "../../../context/RemoteModulesContext.es.js";
107
+ import "../../../context/DetailsPanelContext.es.js";
108
+ import "../../../context/ThumbnailUploaderContext.es.js";
109
+ import "../../../context/SettingsPanelContext.es.js";
110
+ import "../../../context/pip/PiPProvider.es.js";
111
+ import "../../../context/pip/PiPWrapper.es.js";
112
+ import "../../../context/AddonProjectContext.es.js";
113
+ import "../../../context/AddonContext.es.js";
114
+ import "../../../context/PowerpackContext.es.js";
115
+ import "../../../context/MoveEntityContext.es.js";
116
+ import "../../Feed/components/CommentInput/quillToMarkdown.es.js";
117
+ import "../../Feed/components/ActivityComment/ActivityComment.styled.es.js";
118
+ import "../../Feed/components/ActivityCheckbox/ActivityCheckbox.styled.es.js";
119
+ import "../../Feed/components/ActivityReference/ActivityReference.styled.es.js";
120
+ import "react-router-dom";
121
+ import "../../Feed/components/ActivityStatus/ActivityStatus.es.js";
122
+ import "../../Feed/components/ActivityHeader/ActivityHeader.styled.es.js";
123
+ import "../../Feed/components/ActivityDate.es.js";
124
+ import "../../Feed/components/ActivityStatusChange/ActivityStatusChange.styled.es.js";
125
+ import "../../Feed/components/ActivityAssigneeChange/ActivityAssigneeChange.styled.es.js";
126
+ import "../../Feed/components/ActivityVersions/ActivityVersions.styled.es.js";
127
+ import "../../Feed/components/ActivityGroup/ActivityGroup.styled.es.js";
128
+ import "../../Feed/Feed.styled.es.js";
129
+ import "date-fns";
130
+ import "../../../components/EmptyPlaceholder/EmptyPlaceholder.es.js";
131
+ import "../../../components/EmptyPlaceholder/EmptyPlaceholderFlex.styled.es.js";
132
+ import "../ProjectTreeTable.es.js";
133
+ import { useCellEditing as R } from "../context/CellEditingContext.es.js";
134
+ import "@tanstack/react-table";
135
+ import "../widgets/CollapsedWidget.es.js";
136
+ import "../widgets/DateWidget.es.js";
137
+ import "../widgets/EnumWidget.es.js";
138
+ import "../widgets/TextWidget.es.js";
139
+ import "../widgets/BooleanWidget.es.js";
140
+ import "../widgets/CellWidget.es.js";
141
+ import "../widgets/EntityNameWidget.es.js";
142
+ import "../widgets/GroupHeaderWidget.es.js";
143
+ import "../widgets/ThumbnailWidget.es.js";
144
+ import "../../../components/ThumbnailSimple/ThumbnailSimple.es.js";
145
+ import "@dnd-kit/core";
146
+ import "@dnd-kit/sortable";
147
+ import "../../../components/ReviewablesList/ReviewablesList.styled.es.js";
148
+ import "../../../components/ReviewablesList/ReviewablesUpload.styled.es.js";
149
+ import "axios";
150
+ import "../../../components/ReviewableCard/ReviewableCard.es.js";
151
+ import "../../../components/ReviewableProgressCard/ReviewableProgressCard.styled.es.js";
152
+ import "../../../components/FileThumbnail/FileThumbnail.es.js";
153
+ import "../../../components/Thumbnail/Thumbnail.styled.es.js";
154
+ import "../../../components/Thumbnail/StackedThumbnails.es.js";
155
+ import "../../../components/EntityPanelUploader/EntityPanelUploader.styled.es.js";
156
+ import "../../../components/SimpleFormDialog/SimpleFormDialog.es.js";
157
+ import "../../../components/EntityPath/EntityPath.styled.es.js";
158
+ import "../../../components/EntityPath/SegmentProvider.es.js";
159
+ import "../../../components/DetailsPanelAttributes/DetailsPanelAttributesEditor.es.js";
160
+ import "../../../../../_virtual/runtime.es.js";
161
+ import "../../../../../_virtual/semver.es.js";
162
+ import "react-redux";
163
+ import "custom-protocol-check";
164
+ import "../../../components/Watchers/Watchers.es.js";
165
+ import "../../../components/ProjectTableSettings/ProjectTableSettings.es.js";
166
+ import "../../../components/Powerpack/PowerpackButton.es.js";
167
+ import "../../../components/Powerpack/PricingLink.es.js";
168
+ import "../../../components/Powerpack/PowerpackDialog.styled.es.js";
169
+ import "../../../components/Powerpack/CTAButton.es.js";
170
+ import "../../../components/SettingsPanel/SettingsPanel.es.js";
171
+ import "../../../components/SettingsPanel/SettingsPanelItemTemplate.es.js";
172
+ import "../../../components/AttributeEditor/components/MinMaxField.es.js";
173
+ import "../../../components/EnumEditor/EnumEditor.styled.es.js";
174
+ import "../../../components/SearchFilter/filterDates.es.js";
175
+ import "../../../components/Badge/Badge.es.js";
176
+ import "../../../components/VersionUploader/components/UploadVersionDialog.es.js";
177
+ import "../../../components/VersionUploader/context/VersionUploadContext.es.js";
178
+ import "../../../components/Feedback/FeedbackContext.es.js";
179
+ import "../../../components/Feedback/SupportBubble.es.js";
180
+ import "../../../components/Chips/Chips.es.js";
181
+ import "../../../components/LinksManager/LinksManager.styled.es.js";
182
+ import "../../EntityPickerDialog/EntityPickerDialog.es.js";
183
+ import "../../../components/LinksManager/LinksManagerDialog.es.js";
184
+ import "../context/DetailsPanelEntityContext.es.js";
185
+ import "../context/SelectedRowsContext.es.js";
186
+ import "../ProjectTreeTable.styled.es.js";
187
+ import "../components/SelectionCell.es.js";
188
+ import "../components/RowSelectionHeader.es.js";
189
+ import "../context/SelectionCellsContext.es.js";
190
+ import "../widgets/LoadMoreWidget.es.js";
191
+ import "../context/ProjectTableQueriesContext.es.js";
192
+ import "../context/ClipboardContext.es.js";
193
+ import "../context/ColumnSettingsContext.es.js";
194
+ import "../components/GroupSettingsFallback.es.js";
195
+ import "../context/ProjectDataContext.es.js";
196
+ import "../components/HeaderActionButton.es.js";
197
+ import "../components/ColumnHeaderMenu.es.js";
198
+ import "../../DetailsPanel/DetailsPanel.styled.es.js";
199
+ import "../../DetailsPanel/FeedFilters/FeedFilters.styled.es.js";
200
+ import "../../DetailsPanel/DetailsPanelHeader/DetailsPanelHeader.styled.es.js";
201
+ import "../../../components/PlayableIcon/PlayableIcon.es.js";
202
+ import "../../DetailsPanel/DetailsPanelFiles/DetailsPanelFiles.es.js";
203
+ import "../../DetailsPanel/DetailsPanelSlideOut/DetailsPanelSlideOut.styled.es.js";
204
+ import "../../DetailsPanel/DetailsPanelFloating/DetailsPanelFloating.styled.es.js";
205
+ import "../../Actions/Actions.styled.es.js";
206
+ import "../../Actions/ActionsDropdown/ActionsDropdown.es.js";
207
+ import "../../Actions/ActionIcon.es.js";
208
+ import "../../Views/context/ViewsContext.es.js";
209
+ import "../../Views/Views.styled.es.js";
210
+ import "../../Views/ViewsMenuContainer/ViewsMenuContainer.es.js";
211
+ import "../../Views/ViewsMenu/ViewsMenu.es.js";
212
+ import "uuid";
213
+ const Rr = (B) => {
214
+ const { getEntityById: j, projectName: C } = S(), n = C, { history: E } = R(), [u] = x(), [l] = $();
88
215
  return { pasteTableLinks: M(
89
- async (h) => {
90
- if (!p || !h.length) return;
216
+ async (w) => {
217
+ if (!n || !w.length) return;
91
218
  const s = /* @__PURE__ */ new Map();
92
- for (const i of h) {
219
+ for (const i of w) {
93
220
  const r = `${i.sourceEntityId}-${i.linkType}-${i.direction}`;
94
221
  s.has(r) || s.set(r, []), s.get(r).push(i);
95
222
  }
96
- const d = [];
223
+ const I = [], a = [], c = [];
224
+ for (const [, i] of s) {
225
+ const { sourceEntityId: r } = i[0], e = /* @__PURE__ */ new Set();
226
+ if (i.forEach((m) => m.targetEntityIds.forEach((t) => e.add(t))), e.has(r)) {
227
+ D.error("You can't link an entity to itself");
228
+ return;
229
+ }
230
+ }
97
231
  for (const [i, r] of s) {
98
- const P = r[0], {
99
- sourceEntityId: e,
100
- sourceEntityType: f,
101
- linkType: m,
102
- direction: n,
103
- targetEntityType: a,
104
- operation: E
105
- } = P, l = /* @__PURE__ */ new Set();
106
- r.forEach((t) => {
107
- t.targetEntityIds.forEach((o) => l.add(o));
232
+ const e = r[0], {
233
+ sourceEntityId: m,
234
+ sourceEntityType: t,
235
+ linkType: y,
236
+ direction: d,
237
+ targetEntityType: h,
238
+ operation: N
239
+ } = e, k = /* @__PURE__ */ new Set();
240
+ r.forEach((o) => {
241
+ o.targetEntityIds.forEach((p) => k.add(p));
108
242
  });
109
- const c = [], u = [], I = k(e);
110
- if (!I) {
111
- console.warn(`Entity not found: ${e}`);
243
+ const f = [], g = [], b = j(m);
244
+ if (!b) {
245
+ console.warn(`Entity not found: ${m}`);
112
246
  continue;
113
247
  }
114
- const y = I.links;
115
- if (E === "replace") {
116
- if (Array.isArray(y))
117
- for (const t of y)
118
- t.entityType === a && t.direction === n && t.linkType === m.split("|")[0] && u.push({
119
- id: t.id,
248
+ const T = b.links;
249
+ if (N === "replace") {
250
+ if (Array.isArray(T))
251
+ for (const o of T)
252
+ o.entityType === h && o.direction === d && o.linkType === y.split("|")[0] && g.push({
253
+ id: o.id,
120
254
  target: {
121
- entityId: t.node.id,
122
- entityType: t.entityType
255
+ entityId: o.node.id,
256
+ entityType: o.entityType
123
257
  },
124
- source: { entityId: e, entityType: f },
125
- linkType: m,
126
- direction: n,
127
- projectName: p
258
+ source: { entityId: m, entityType: t },
259
+ linkType: y,
260
+ direction: d,
261
+ projectName: n
128
262
  });
129
- for (const t of l) {
130
- const o = L();
131
- c.push({
132
- targetEntityId: t,
133
- linkId: o,
134
- sourceEntityId: e,
135
- sourceEntityType: f,
136
- targetEntityType: a,
137
- linkType: m,
138
- direction: n,
139
- projectName: p
263
+ for (const o of k) {
264
+ const p = A();
265
+ f.push({
266
+ targetEntityId: o,
267
+ linkId: p,
268
+ sourceEntityId: m,
269
+ sourceEntityType: t,
270
+ targetEntityType: h,
271
+ linkType: y,
272
+ direction: d,
273
+ projectName: n
140
274
  });
141
275
  }
142
- } else if (E === "merge") {
143
- const t = /* @__PURE__ */ new Set();
144
- Array.isArray(y) && y.forEach((o) => {
145
- o.entityType === a && o.direction === n && o.linkType === m && t.add(o.node.id);
146
- }), console.log(t);
147
- for (const o of l)
148
- if (!t.has(o)) {
149
- const A = L();
150
- c.push({
151
- targetEntityId: o,
152
- linkId: A,
153
- sourceEntityId: e,
154
- sourceEntityType: f,
155
- targetEntityType: a,
156
- linkType: m,
157
- direction: n,
158
- projectName: p
276
+ } else if (N === "merge") {
277
+ const o = /* @__PURE__ */ new Set();
278
+ Array.isArray(T) && T.forEach((p) => {
279
+ p.entityType === h && p.direction === d && p.linkType === y && o.add(p.node.id);
280
+ }), console.log(o);
281
+ for (const p of k)
282
+ if (!o.has(p)) {
283
+ const v = A();
284
+ f.push({
285
+ targetEntityId: p,
286
+ linkId: v,
287
+ sourceEntityId: m,
288
+ sourceEntityType: t,
289
+ targetEntityType: h,
290
+ linkType: y,
291
+ direction: d,
292
+ projectName: n
159
293
  });
160
294
  }
161
295
  }
162
- u.length > 0 && d.push(x(u, T)), c.length > 0 && d.push($(c, g));
296
+ g.length > 0 && (I.push(L(g, u)), c.push(...g)), f.length > 0 && (I.push(P(f, l)), a.push(...f));
163
297
  }
164
298
  try {
165
- await Promise.all(d);
299
+ if (await Promise.all(I), E && (a.length > 0 || c.length > 0)) {
300
+ const i = a.map((t) => ({
301
+ id: t.linkId,
302
+ projectName: t.projectName,
303
+ linkType: t.linkType,
304
+ direction: t.direction,
305
+ target: { entityId: t.targetEntityId, entityType: t.targetEntityType },
306
+ source: { entityId: t.sourceEntityId, entityType: t.sourceEntityType }
307
+ })), r = c.map((t) => ({
308
+ targetEntityId: t.target.entityId,
309
+ linkId: t.id,
310
+ sourceEntityId: t.source.entityId,
311
+ sourceEntityType: t.source.entityType,
312
+ targetEntityType: t.target.entityType,
313
+ linkType: t.linkType,
314
+ direction: t.direction,
315
+ projectName: t.projectName
316
+ })), e = () => {
317
+ const t = [];
318
+ i.length && t.push(L(i, u)), r.length && t.push(P(r, l)), t.length && Promise.all(t).catch(() => {
319
+ });
320
+ }, m = () => {
321
+ const t = [];
322
+ c.length && t.push(L(c, u)), a.length && t.push(P(a, l)), t.length && Promise.all(t).catch(() => {
323
+ });
324
+ };
325
+ E.pushHistory([e], [m]);
326
+ }
166
327
  } catch (i) {
167
328
  throw i;
168
329
  }
169
330
  },
170
- [p, k, T, g]
331
+ [n, j, u, l, E]
171
332
  ) };
172
333
  };
173
334
  export {
174
- yo as default
335
+ Rr as default
175
336
  };
176
337
  //# sourceMappingURL=usePasteLinks.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePasteLinks.es.js","sources":["../../../../../../src/containers/ProjectTreeTable/hooks/usePasteLinks.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport { useCreateEntityLinkMutation, useDeleteEntityLinkMutation } from '@shared/api'\nimport {\n addMultipleLinks,\n removeMultipleLinks,\n LinkToAdd,\n LinkToRemove,\n} from '@shared/components/LinksManager/utils/linkUpdates'\nimport { useProjectTableContext } from '../context/ProjectTableContext'\nimport { getEntityId } from '@shared/util'\nimport { PasteMethod } from '../context'\n\n/**\n * Represents a link update operation for table links\n */\nexport type LinkUpdate = {\n /** Row ID in the table */\n rowId: string\n /** ID of the source entity (the entity that will have links) */\n sourceEntityId: string\n /** Type of the source entity (e.g., 'folder', 'task') */\n sourceEntityType: string\n /** Type of link (e.g., 'workflow', 'dependency') */\n linkType: string\n /** Direction of the link from source entity perspective */\n direction: 'in' | 'out'\n /** Type of the target entities that will be linked */\n targetEntityType: string\n /**\n * Operation type:\n * - 'replace': Remove all existing links of this type and add new ones\n * - 'merge': Keep existing links and add new ones (skip duplicates)\n */\n operation: PasteMethod\n /** Array of target entity IDs to link to */\n targetEntityIds: string[]\n}\n\nexport type PasteTableLinks = (linkUpdates: LinkUpdate[]) => Promise<void>\n\ninterface usePasteLinksProps {\n projectName?: string\n}\n\nconst usePasteLinks = (props?: usePasteLinksProps) => {\n const { getEntityById, projectName: contextProjectName } = useProjectTableContext()\n const projectName = props?.projectName || contextProjectName\n\n // Add mutation hooks for link operations\n const [deleteLink] = useDeleteEntityLinkMutation()\n const [addLink] = useCreateEntityLinkMutation()\n\n // Handle link updates using the utility functions\n const pasteTableLinks = useCallback<PasteTableLinks>(\n async (linkUpdates: LinkUpdate[]) => {\n if (!projectName || !linkUpdates.length) return\n\n // Group operations by entity and link type for processing\n const operationsToProcess = new Map<string, LinkUpdate[]>()\n\n for (const update of linkUpdates) {\n const key = `${update.sourceEntityId}-${update.linkType}-${update.direction}`\n if (!operationsToProcess.has(key)) {\n operationsToProcess.set(key, [])\n }\n operationsToProcess.get(key)!.push(update)\n }\n\n const updatePromises: Promise<void>[] = []\n // Process each unique entity-linkType-direction combination\n for (const [key, updates] of operationsToProcess) {\n const firstUpdate = updates[0]\n const {\n sourceEntityId,\n sourceEntityType,\n linkType,\n direction,\n targetEntityType,\n operation,\n } = firstUpdate\n\n // Collect all target entity IDs from all updates for this combination\n const allTargetEntityIds = new Set<string>()\n updates.forEach((update) => {\n update.targetEntityIds.forEach((id) => allTargetEntityIds.add(id))\n })\n\n const linksToAdd: LinkToAdd[] = []\n const linksToRemove: LinkToRemove[] = []\n\n // Get current links for this entity and link type\n const entityData = getEntityById(sourceEntityId)\n if (!entityData) {\n console.warn(`Entity not found: ${sourceEntityId}`)\n continue\n }\n\n // Get current links for this link type and direction\n const currentLinks = entityData.links\n\n if (operation === 'replace') {\n // Remove all current links of this (linkType + direction + targetEntityType) only.\n if (Array.isArray(currentLinks)) {\n for (const link of currentLinks) {\n if (\n link.entityType === targetEntityType &&\n link.direction === direction &&\n link.linkType === linkType.split('|')[0]\n ) {\n linksToRemove.push({\n id: link.id,\n target: {\n entityId: link.node.id,\n entityType: link.entityType,\n },\n source: { entityId: sourceEntityId, entityType: sourceEntityType },\n linkType,\n direction,\n projectName,\n })\n }\n }\n }\n\n // Add all new links\n for (const targetEntityId of allTargetEntityIds) {\n const linkId = getEntityId()\n\n linksToAdd.push({\n targetEntityId,\n linkId,\n sourceEntityId,\n sourceEntityType,\n targetEntityType,\n linkType,\n direction,\n projectName,\n })\n }\n } else if (operation === 'merge') {\n // Get existing target entity IDs for this (linkType + direction + targetEntityType)\n const existingTargetIds = new Set<string>()\n if (Array.isArray(currentLinks)) {\n currentLinks.forEach((link) => {\n if (\n link.entityType === targetEntityType &&\n link.direction === direction &&\n link.linkType === linkType\n ) {\n existingTargetIds.add(link.node.id)\n }\n })\n }\n\n console.log(existingTargetIds)\n\n // Only add links that don't already exist\n for (const targetEntityId of allTargetEntityIds) {\n if (!existingTargetIds.has(targetEntityId)) {\n const linkId = getEntityId()\n\n linksToAdd.push({\n targetEntityId,\n linkId,\n sourceEntityId,\n sourceEntityType,\n targetEntityType,\n linkType,\n direction,\n projectName,\n })\n }\n }\n }\n\n if (linksToRemove.length > 0) {\n updatePromises.push(removeMultipleLinks(linksToRemove, deleteLink))\n }\n if (linksToAdd.length > 0) {\n updatePromises.push(addMultipleLinks(linksToAdd, addLink))\n }\n }\n try {\n // Execute all link operations in parallel\n await Promise.all(updatePromises)\n } catch (error) {\n throw error\n }\n },\n [projectName, getEntityById, deleteLink, addLink],\n )\n\n return { pasteTableLinks }\n}\n\nexport default usePasteLinks\n"],"names":["usePasteLinks","props","getEntityById","contextProjectName","useProjectTableContext","projectName","deleteLink","useDeleteEntityLinkMutation","addLink","useCreateEntityLinkMutation","useCallback","linkUpdates","operationsToProcess","update","key","updatePromises","updates","firstUpdate","sourceEntityId","sourceEntityType","linkType","direction","targetEntityType","operation","allTargetEntityIds","id","linksToAdd","linksToRemove","entityData","currentLinks","link","targetEntityId","linkId","getEntityId","existingTargetIds","removeMultipleLinks","addMultipleLinks","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CM,MAAAA,KAAgB,CAACC,MAA+B;AACpD,QAAM,EAAE,eAAAC,GAAe,aAAaC,EAAA,IAAuBC,EAAuB,GAC5EC,IAAoCF,GAGpC,CAACG,CAAU,IAAIC,EAA4B,GAC3C,CAACC,CAAO,IAAIC,EAA4B;AA8I9C,SAAO,EAAE,iBA3IeC;AAAA,IACtB,OAAOC,MAA8B;AACnC,UAAI,CAACN,KAAe,CAACM,EAAY,OAAQ;AAGnC,YAAAC,wBAA0B,IAA0B;AAE1D,iBAAWC,KAAUF,GAAa;AAC1B,cAAAG,IAAM,GAAGD,EAAO,cAAc,IAAIA,EAAO,QAAQ,IAAIA,EAAO,SAAS;AAC3E,QAAKD,EAAoB,IAAIE,CAAG,KACVF,EAAA,IAAIE,GAAK,EAAE,GAEjCF,EAAoB,IAAIE,CAAG,EAAG,KAAKD,CAAM;AAAA,MAAA;AAG3C,YAAME,IAAkC,CAAC;AAEzC,iBAAW,CAACD,GAAKE,CAAO,KAAKJ,GAAqB;AAC1C,cAAAK,IAAcD,EAAQ,CAAC,GACvB;AAAA,UACJ,gBAAAE;AAAA,UACA,kBAAAC;AAAA,UACA,UAAAC;AAAA,UACA,WAAAC;AAAA,UACA,kBAAAC;AAAA,UACA,WAAAC;AAAA,QAAA,IACEN,GAGEO,wBAAyB,IAAY;AACnC,QAAAR,EAAA,QAAQ,CAACH,MAAW;AAC1B,UAAAA,EAAO,gBAAgB,QAAQ,CAACY,MAAOD,EAAmB,IAAIC,CAAE,CAAC;AAAA,QAAA,CAClE;AAED,cAAMC,IAA0B,CAA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,oBAAMC,IAASC,EAAY;AAE3B,cAAAP,EAAW,KAAK;AAAA,gBACd,gBAAAK;AAAA,gBACA,QAAAC;AAAA,gBACA,gBAAAd;AAAA,gBACA,kBAAAC;AAAA,gBACA,kBAAAG;AAAA,gBACA,UAAAF;AAAA,gBACA,WAAAC;AAAA,gBACA,aAAAhB;AAAA,cAAA,CACD;AAAA,YAAA;AAAA,QAEL;AAGE,QAAAsB,EAAc,SAAS,KACzBZ,EAAe,KAAKoB,EAAoBR,GAAerB,CAAU,CAAC,GAEhEoB,EAAW,SAAS,KACtBX,EAAe,KAAKqB,EAAiBV,GAAYlB,CAAO,CAAC;AAAA,MAC3D;AAEE,UAAA;AAEI,cAAA,QAAQ,IAAIO,CAAc;AAAA,eACzBsB,GAAO;AACR,cAAAA;AAAA,MAAA;AAAA,IAEV;AAAA,IACA,CAAChC,GAAaH,GAAeI,GAAYE,CAAO;AAAA,EAClD,EAEyB;AAC3B;"}
1
+ {"version":3,"file":"usePasteLinks.es.js","sources":["../../../../../../src/containers/ProjectTreeTable/hooks/usePasteLinks.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport { useCreateEntityLinkMutation, useDeleteEntityLinkMutation } from '@shared/api'\nimport {\n addMultipleLinks,\n removeMultipleLinks,\n LinkToAdd,\n LinkToRemove,\n} from '@shared/components/LinksManager/utils/linkUpdates'\nimport { useProjectTableContext } from '../context/ProjectTableContext'\nimport { getEntityId } from '@shared/util'\nimport { PasteMethod } from '../context'\nimport { useCellEditing } from '@shared/containers'\nimport { toast } from 'react-toastify'\n\n/**\n * Represents a link update operation for table links\n */\nexport type LinkUpdate = {\n /** Row ID in the table */\n rowId: string\n /** ID of the source entity (the entity that will have links) */\n sourceEntityId: string\n /** Type of the source entity (e.g., 'folder', 'task') */\n sourceEntityType: string\n /** Type of link (e.g., 'workflow', 'dependency') */\n linkType: string\n /** Direction of the link from source entity perspective */\n direction: 'in' | 'out'\n /** Type of the target entities that will be linked */\n targetEntityType: string\n /**\n * Operation type:\n * - 'replace': Remove all existing links of this type and add new ones\n * - 'merge': Keep existing links and add new ones (skip duplicates)\n */\n operation: PasteMethod\n /** Array of target entity IDs to link to */\n targetEntityIds: string[]\n}\n\nexport type PasteTableLinks = (linkUpdates: LinkUpdate[]) => Promise<void>\n\ninterface usePasteLinksProps {\n projectName?: string\n}\n\nconst usePasteLinks = (props?: usePasteLinksProps) => {\n const { getEntityById, projectName: contextProjectName } = useProjectTableContext()\n const projectName = props?.projectName || contextProjectName\n const { history } = useCellEditing()\n\n // Add mutation hooks for link operations\n const [deleteLink] = useDeleteEntityLinkMutation()\n const [addLink] = useCreateEntityLinkMutation()\n\n // Handle link updates using the utility functions\n const pasteTableLinks = useCallback<PasteTableLinks>(\n async (linkUpdates: LinkUpdate[]) => {\n if (!projectName || !linkUpdates.length) return\n\n // Group operations by entity and link type for processing\n const operationsToProcess = new Map<string, LinkUpdate[]>()\n\n for (const update of linkUpdates) {\n const key = `${update.sourceEntityId}-${update.linkType}-${update.direction}`\n if (!operationsToProcess.has(key)) {\n operationsToProcess.set(key, [])\n }\n operationsToProcess.get(key)!.push(update)\n }\n\n const updatePromises: Promise<void>[] = []\n // Collect all adds/removes across all operations to build a single history entry\n const addedInPaste: LinkToAdd[] = []\n const removedInPaste: LinkToRemove[] = []\n\n // Pre-flight validation: detect any self-referential links across the whole paste\n for (const [, updates] of operationsToProcess) {\n const { sourceEntityId } = updates[0]\n const targets = new Set<string>()\n updates.forEach((u) => u.targetEntityIds.forEach((id) => targets.add(id)))\n if (targets.has(sourceEntityId)) {\n toast.error(\"You can't link an entity to itself\")\n return\n }\n }\n // Process each unique entity-linkType-direction combination\n for (const [key, updates] of operationsToProcess) {\n const firstUpdate = updates[0]\n const {\n sourceEntityId,\n sourceEntityType,\n linkType,\n direction,\n targetEntityType,\n operation,\n } = firstUpdate\n\n // Collect all target entity IDs from all updates for this combination\n const allTargetEntityIds = new Set<string>()\n updates.forEach((update) => {\n update.targetEntityIds.forEach((id) => allTargetEntityIds.add(id))\n })\n\n const linksToAdd: LinkToAdd[] = []\n const linksToRemove: LinkToRemove[] = []\n\n // Get current links for this entity and link type\n const entityData = getEntityById(sourceEntityId)\n if (!entityData) {\n console.warn(`Entity not found: ${sourceEntityId}`)\n continue\n }\n\n // Get current links for this link type and direction\n const currentLinks = entityData.links\n\n if (operation === 'replace') {\n // Remove all current links of this (linkType + direction + targetEntityType) only.\n if (Array.isArray(currentLinks)) {\n for (const link of currentLinks) {\n if (\n link.entityType === targetEntityType &&\n link.direction === direction &&\n link.linkType === linkType.split('|')[0]\n ) {\n linksToRemove.push({\n id: link.id,\n target: {\n entityId: link.node.id,\n entityType: link.entityType,\n },\n source: { entityId: sourceEntityId, entityType: sourceEntityType },\n linkType,\n direction,\n projectName,\n })\n }\n }\n }\n\n // Add all new links\n for (const targetEntityId of allTargetEntityIds) {\n const linkId = getEntityId()\n\n linksToAdd.push({\n targetEntityId,\n linkId,\n sourceEntityId,\n sourceEntityType,\n targetEntityType,\n linkType,\n direction,\n projectName,\n })\n }\n } else if (operation === 'merge') {\n // Get existing target entity IDs for this (linkType + direction + targetEntityType)\n const existingTargetIds = new Set<string>()\n if (Array.isArray(currentLinks)) {\n currentLinks.forEach((link) => {\n if (\n link.entityType === targetEntityType &&\n link.direction === direction &&\n link.linkType === linkType\n ) {\n existingTargetIds.add(link.node.id)\n }\n })\n }\n\n console.log(existingTargetIds)\n\n // Only add links that don't already exist\n for (const targetEntityId of allTargetEntityIds) {\n if (!existingTargetIds.has(targetEntityId)) {\n const linkId = getEntityId()\n\n linksToAdd.push({\n targetEntityId,\n linkId,\n sourceEntityId,\n sourceEntityType,\n targetEntityType,\n linkType,\n direction,\n projectName,\n })\n }\n }\n }\n\n if (linksToRemove.length > 0) {\n updatePromises.push(removeMultipleLinks(linksToRemove, deleteLink))\n removedInPaste.push(...linksToRemove)\n }\n if (linksToAdd.length > 0) {\n updatePromises.push(addMultipleLinks(linksToAdd, addLink))\n addedInPaste.push(...linksToAdd)\n }\n }\n try {\n // Execute all link operations in parallel\n await Promise.all(updatePromises)\n\n // Push a single history entry that undoes BOTH: remove added links and re-add removed links\n if (history && (addedInPaste.length > 0 || removedInPaste.length > 0)) {\n // Prepare inverse operations for undo\n const addedToRemove: LinkToRemove[] = addedInPaste.map((link) => ({\n id: link.linkId,\n projectName: link.projectName,\n linkType: link.linkType,\n direction: link.direction,\n target: { entityId: link.targetEntityId, entityType: link.targetEntityType },\n source: { entityId: link.sourceEntityId, entityType: link.sourceEntityType },\n }))\n\n const removedToAdd: LinkToAdd[] = removedInPaste.map((link) => ({\n targetEntityId: link.target.entityId,\n linkId: link.id,\n sourceEntityId: link.source.entityId,\n sourceEntityType: link.source.entityType,\n targetEntityType: link.target.entityType,\n linkType: link.linkType,\n direction: link.direction,\n projectName: link.projectName,\n }))\n\n // Single callbacks to keep history atomic\n const undoCallback = () => {\n const tasks: Promise<void>[] = []\n if (addedToRemove.length) tasks.push(removeMultipleLinks(addedToRemove, deleteLink))\n if (removedToAdd.length) tasks.push(addMultipleLinks(removedToAdd, addLink))\n if (tasks.length) Promise.all(tasks).catch(() => {})\n }\n\n const redoCallback = () => {\n const tasks: Promise<void>[] = []\n if (removedInPaste.length) tasks.push(removeMultipleLinks(removedInPaste, deleteLink))\n if (addedInPaste.length) tasks.push(addMultipleLinks(addedInPaste, addLink))\n if (tasks.length) Promise.all(tasks).catch(() => {})\n }\n\n history.pushHistory([undoCallback], [redoCallback])\n }\n } catch (error) {\n throw error\n }\n },\n [projectName, getEntityById, deleteLink, addLink, history],\n )\n\n return { pasteTableLinks }\n}\n\nexport default usePasteLinks\n"],"names":["usePasteLinks","props","getEntityById","contextProjectName","useProjectTableContext","projectName","history","useCellEditing","deleteLink","useDeleteEntityLinkMutation","addLink","useCreateEntityLinkMutation","useCallback","linkUpdates","operationsToProcess","update","key","updatePromises","addedInPaste","removedInPaste","updates","sourceEntityId","targets","u","id","toast","firstUpdate","sourceEntityType","linkType","direction","targetEntityType","operation","allTargetEntityIds","linksToAdd","linksToRemove","entityData","currentLinks","link","targetEntityId","linkId","getEntityId","existingTargetIds","removeMultipleLinks","addMultipleLinks","addedToRemove","removedToAdd","undoCallback","tasks","redoCallback","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CM,MAAAA,KAAgB,CAACC,MAA+B;AACpD,QAAM,EAAE,eAAAC,GAAe,aAAaC,EAAA,IAAuBC,EAAuB,GAC5EC,IAAoCF,GACpC,EAAE,SAAAG,EAAQ,IAAIC,EAAe,GAG7B,CAACC,CAAU,IAAIC,EAA4B,GAC3C,CAACC,CAAO,IAAIC,EAA4B;AAuM9C,SAAO,EAAE,iBApMeC;AAAA,IACtB,OAAOC,MAA8B;AACnC,UAAI,CAACR,KAAe,CAACQ,EAAY,OAAQ;AAGnC,YAAAC,wBAA0B,IAA0B;AAE1D,iBAAWC,KAAUF,GAAa;AAC1B,cAAAG,IAAM,GAAGD,EAAO,cAAc,IAAIA,EAAO,QAAQ,IAAIA,EAAO,SAAS;AAC3E,QAAKD,EAAoB,IAAIE,CAAG,KACVF,EAAA,IAAIE,GAAK,EAAE,GAEjCF,EAAoB,IAAIE,CAAG,EAAG,KAAKD,CAAM;AAAA,MAAA;AAG3C,YAAME,IAAkC,CAAC,GAEnCC,IAA4B,CAAC,GAC7BC,IAAiC,CAAC;AAGxC,iBAAW,CAAA,EAAGC,CAAO,KAAKN,GAAqB;AAC7C,cAAM,EAAE,gBAAAO,EAAA,IAAmBD,EAAQ,CAAC,GAC9BE,wBAAc,IAAY;AAE5B,YADJF,EAAQ,QAAQ,CAACG,MAAMA,EAAE,gBAAgB,QAAQ,CAACC,MAAOF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3D,EAEyB;AAC3B;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=({selection:t,type:s})=>{const l={assignees:{id:"assignees",type:"list_of_strings",mapValue:a=>a.map(e=>({id:e.name||e.id,label:e.name||""}))},status:{id:"status",type:"string",mapValue:a=>a.map(e=>({id:e.name||e.id,label:e.name||""}))},taskType:{id:"taskType",type:"string",mapValue:a=>a.map(e=>({id:e.name||e.id,label:e.name||""}))},hierarchy:void 0};return(()=>{const a=l[s];if(!a)return null;const e=Object.values(t),r=a.mapValue(e);return{id:a.id,label:a.id,type:a.type,inverted:!1,operator:"OR",values:r}})()};exports.createFilterFromSlicer=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=({selection:l,type:t,attribFields:i})=>{const a={assignees:"list_of_strings",status:"string",taskType:"string",hierarchy:void 0,...i.reduce((e,r)=>(e["attrib."+r.name]=r.data.type,e),{})};return(()=>{const e=a[t];if(!e)return null;const n=Object.values(l).map(s=>({id:s.id,label:s.label||s.name||""}));return{id:t,label:t,type:e,inverted:!1,operator:"OR",values:n}})()};exports.createFilterFromSlicer=c;
2
2
  //# sourceMappingURL=createFilterFromSlicer.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createFilterFromSlicer.cjs.js","sources":["../../../../../src/containers/Slicer/createFilterFromSlicer.ts"],"sourcesContent":["import { AttributeModel } from '../ProjectTreeTable'\nimport { SelectionData, SliceDataItem, SliceFilter, SliceType } from './types'\n\ninterface FilterMapping {\n id: string\n type: AttributeModel['data']['type']\n mapValue: (items: SliceDataItem[]) => { id: string; label: string }[]\n}\n\nexport type CreateFilterFromSlicer = ({\n selection,\n type,\n}: {\n selection: SelectionData\n type: SliceType\n}) => SliceFilter | null\n\nexport const createFilterFromSlicer: CreateFilterFromSlicer = ({ selection, type }) => {\n const sliceTypeToFilterMap: Record<string, FilterMapping | undefined> = {\n assignees: {\n id: 'assignees',\n type: 'list_of_strings',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n status: {\n id: 'status',\n type: 'string',\n\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n taskType: {\n id: 'taskType',\n type: 'string',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n hierarchy: undefined,\n }\n\n const filter: SliceFilter | null = (() => {\n const mapping = sliceTypeToFilterMap[type]\n if (!mapping) return null\n\n const selectedItems = Object.values(selection)\n const values = mapping.mapValue(selectedItems)\n\n return {\n id: mapping.id,\n label: mapping.id,\n type: mapping.type,\n inverted: false,\n operator: 'OR',\n values,\n }\n })()\n\n return filter\n}\n"],"names":["createFilterFromSlicer","selection","type","sliceTypeToFilterMap","items","item","mapping","selectedItems","values"],"mappings":"gFAiBO,MAAMA,EAAiD,CAAC,CAAE,UAAAC,EAAW,KAAAC,KAAW,CACrF,MAAMC,EAAkE,CACtE,UAAW,CACT,GAAI,YACJ,KAAM,kBACN,SAAWC,GACTA,EAAM,IAAKC,IAAU,CAAE,GAAIA,EAAK,MAAQA,EAAK,GAAI,MAAOA,EAAK,MAAQ,IAAK,CAC9E,EACA,OAAQ,CACN,GAAI,SACJ,KAAM,SAEN,SAAWD,GACTA,EAAM,IAAKC,IAAU,CAAE,GAAIA,EAAK,MAAQA,EAAK,GAAI,MAAOA,EAAK,MAAQ,IAAK,CAC9E,EACA,SAAU,CACR,GAAI,WACJ,KAAM,SACN,SAAWD,GACTA,EAAM,IAAKC,IAAU,CAAE,GAAIA,EAAK,MAAQA,EAAK,GAAI,MAAOA,EAAK,MAAQ,IAAK,CAC9E,EACA,UAAW,MACb,EAmBO,OAjB6B,IAAM,CAClC,MAAAC,EAAUH,EAAqBD,CAAI,EACrC,GAAA,CAACI,EAAgB,OAAA,KAEf,MAAAC,EAAgB,OAAO,OAAON,CAAS,EACvCO,EAASF,EAAQ,SAASC,CAAa,EAEtC,MAAA,CACL,GAAID,EAAQ,GACZ,MAAOA,EAAQ,GACf,KAAMA,EAAQ,KACd,SAAU,GACV,SAAU,KACV,OAAAE,CACF,CAAA,GACC,CAGL"}
1
+ {"version":3,"file":"createFilterFromSlicer.cjs.js","sources":["../../../../../src/containers/Slicer/createFilterFromSlicer.ts"],"sourcesContent":["import { AttributeModel } from '../ProjectTreeTable'\nimport { ProjectTableAttribute } from '../ProjectTreeTable/hooks/useAttributesList'\nimport { SelectionData, SliceDataItem, SliceFilter, SliceType } from './types'\n\ninterface FilterMapping {\n id: string\n type: AttributeModel['data']['type']\n mapValue: (items: SliceDataItem[]) => { id: string; label: string }[]\n}\n\nexport type CreateFilterFromSlicer = ({\n selection,\n type,\n attribFields,\n}: {\n selection: SelectionData\n type: SliceType\n attribFields: ProjectTableAttribute[]\n}) => SliceFilter | null\n\nexport const createFilterFromSlicer: CreateFilterFromSlicer = ({\n selection,\n type,\n attribFields,\n}) => {\n const sliceTypeToFilterMap: Record<string, FilterMapping | undefined> = {\n assignees: {\n id: 'assignees',\n type: 'list_of_strings',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n status: {\n id: 'status',\n type: 'string',\n\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n taskType: {\n id: 'taskType',\n type: 'string',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n hierarchy: undefined,\n }\n\n const sliceFilterTypes = {\n assignees: 'list_of_strings',\n status: 'string',\n taskType: 'string',\n hierarchy: undefined,\n ...attribFields.reduce((acc, field) => {\n acc['attrib.' + field.name] = field.data.type\n return acc\n }, {} as Record<string, AttributeModel['data']['type']>),\n }\n\n const filter: SliceFilter | null = (() => {\n const sliceType = sliceFilterTypes[type as keyof typeof sliceFilterTypes]\n if (!sliceType) return null\n\n const selectedItems = Object.values(selection)\n const values = selectedItems.map((item) => ({\n id: item.id,\n label: item.label || item.name || '',\n }))\n\n return {\n id: type,\n label: type,\n type: sliceType,\n inverted: false,\n operator: 'OR',\n values,\n }\n })()\n\n return filter\n}\n"],"names":["createFilterFromSlicer","selection","type","attribFields","sliceFilterTypes","acc","field","sliceType","values","item"],"mappings":"gFAoBO,MAAMA,EAAiD,CAAC,CAC7D,UAAAC,EACA,KAAAC,EACA,aAAAC,CACF,IAAM,CAwBJ,MAAMC,EAAmB,CACvB,UAAW,kBACX,OAAQ,SACR,SAAU,SACV,UAAW,OACX,GAAGD,EAAa,OAAO,CAACE,EAAKC,KAC3BD,EAAI,UAAYC,EAAM,IAAI,EAAIA,EAAM,KAAK,KAClCD,GACN,CAAoD,CAAA,CACzD,EAsBO,OApB6B,IAAM,CAClC,MAAAE,EAAYH,EAAiBF,CAAqC,EACpE,GAAA,CAACK,EAAkB,OAAA,KAGvB,MAAMC,EADgB,OAAO,OAAOP,CAAS,EAChB,IAAKQ,IAAU,CAC1C,GAAIA,EAAK,GACT,MAAOA,EAAK,OAASA,EAAK,MAAQ,EAAA,EAClC,EAEK,MAAA,CACL,GAAIP,EACJ,MAAOA,EACP,KAAMK,EACN,SAAU,GACV,SAAU,KACV,OAAAC,CACF,CAAA,GACC,CAGL"}
@@ -1,30 +1,26 @@
1
- const r = ({ selection: s, type: t }) => {
2
- const l = {
3
- assignees: {
4
- id: "assignees",
5
- type: "list_of_strings",
6
- mapValue: (a) => a.map((e) => ({ id: e.name || e.id, label: e.name || "" }))
7
- },
8
- status: {
9
- id: "status",
10
- type: "string",
11
- mapValue: (a) => a.map((e) => ({ id: e.name || e.id, label: e.name || "" }))
12
- },
13
- taskType: {
14
- id: "taskType",
15
- type: "string",
16
- mapValue: (a) => a.map((e) => ({ id: e.name || e.id, label: e.name || "" }))
17
- },
18
- hierarchy: void 0
1
+ const o = ({
2
+ selection: l,
3
+ type: t,
4
+ attribFields: n
5
+ }) => {
6
+ const a = {
7
+ assignees: "list_of_strings",
8
+ status: "string",
9
+ taskType: "string",
10
+ hierarchy: void 0,
11
+ ...n.reduce((e, s) => (e["attrib." + s.name] = s.data.type, e), {})
19
12
  };
20
13
  return (() => {
21
- const a = l[t];
22
- if (!a) return null;
23
- const e = Object.values(s), i = a.mapValue(e);
14
+ const e = a[t];
15
+ if (!e) return null;
16
+ const i = Object.values(l).map((r) => ({
17
+ id: r.id,
18
+ label: r.label || r.name || ""
19
+ }));
24
20
  return {
25
- id: a.id,
26
- label: a.id,
27
- type: a.type,
21
+ id: t,
22
+ label: t,
23
+ type: e,
28
24
  inverted: !1,
29
25
  operator: "OR",
30
26
  values: i
@@ -32,6 +28,6 @@ const r = ({ selection: s, type: t }) => {
32
28
  })();
33
29
  };
34
30
  export {
35
- r as createFilterFromSlicer
31
+ o as createFilterFromSlicer
36
32
  };
37
33
  //# sourceMappingURL=createFilterFromSlicer.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createFilterFromSlicer.es.js","sources":["../../../../../src/containers/Slicer/createFilterFromSlicer.ts"],"sourcesContent":["import { AttributeModel } from '../ProjectTreeTable'\nimport { SelectionData, SliceDataItem, SliceFilter, SliceType } from './types'\n\ninterface FilterMapping {\n id: string\n type: AttributeModel['data']['type']\n mapValue: (items: SliceDataItem[]) => { id: string; label: string }[]\n}\n\nexport type CreateFilterFromSlicer = ({\n selection,\n type,\n}: {\n selection: SelectionData\n type: SliceType\n}) => SliceFilter | null\n\nexport const createFilterFromSlicer: CreateFilterFromSlicer = ({ selection, type }) => {\n const sliceTypeToFilterMap: Record<string, FilterMapping | undefined> = {\n assignees: {\n id: 'assignees',\n type: 'list_of_strings',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n status: {\n id: 'status',\n type: 'string',\n\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n taskType: {\n id: 'taskType',\n type: 'string',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n hierarchy: undefined,\n }\n\n const filter: SliceFilter | null = (() => {\n const mapping = sliceTypeToFilterMap[type]\n if (!mapping) return null\n\n const selectedItems = Object.values(selection)\n const values = mapping.mapValue(selectedItems)\n\n return {\n id: mapping.id,\n label: mapping.id,\n type: mapping.type,\n inverted: false,\n operator: 'OR',\n values,\n }\n })()\n\n return filter\n}\n"],"names":["createFilterFromSlicer","selection","type","sliceTypeToFilterMap","items","item","mapping","selectedItems","values"],"mappings":"AAiBO,MAAMA,IAAiD,CAAC,EAAE,WAAAC,GAAW,MAAAC,QAAW;AACrF,QAAMC,IAAkE;AAAA,IACtE,WAAW;AAAA,MACT,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU,CAACC,MACTA,EAAM,IAAI,CAACC,OAAU,EAAE,IAAIA,EAAK,QAAQA,EAAK,IAAI,OAAOA,EAAK,QAAQ,KAAK;AAAA,IAC9E;AAAA,IACA,QAAQ;AAAA,MACN,IAAI;AAAA,MACJ,MAAM;AAAA,MAEN,UAAU,CAACD,MACTA,EAAM,IAAI,CAACC,OAAU,EAAE,IAAIA,EAAK,QAAQA,EAAK,IAAI,OAAOA,EAAK,QAAQ,KAAK;AAAA,IAC9E;AAAA,IACA,UAAU;AAAA,MACR,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU,CAACD,MACTA,EAAM,IAAI,CAACC,OAAU,EAAE,IAAIA,EAAK,QAAQA,EAAK,IAAI,OAAOA,EAAK,QAAQ,KAAK;AAAA,IAC9E;AAAA,IACA,WAAW;AAAA,EACb;AAmBO,UAjB6B,MAAM;AAClC,UAAAC,IAAUH,EAAqBD,CAAI;AACrC,QAAA,CAACI,EAAgB,QAAA;AAEf,UAAAC,IAAgB,OAAO,OAAON,CAAS,GACvCO,IAASF,EAAQ,SAASC,CAAa;AAEtC,WAAA;AAAA,MACL,IAAID,EAAQ;AAAA,MACZ,OAAOA,EAAQ;AAAA,MACf,MAAMA,EAAQ;AAAA,MACd,UAAU;AAAA,MACV,UAAU;AAAA,MACV,QAAAE;AAAA,IACF;AAAA,EAAA,GACC;AAGL;"}
1
+ {"version":3,"file":"createFilterFromSlicer.es.js","sources":["../../../../../src/containers/Slicer/createFilterFromSlicer.ts"],"sourcesContent":["import { AttributeModel } from '../ProjectTreeTable'\nimport { ProjectTableAttribute } from '../ProjectTreeTable/hooks/useAttributesList'\nimport { SelectionData, SliceDataItem, SliceFilter, SliceType } from './types'\n\ninterface FilterMapping {\n id: string\n type: AttributeModel['data']['type']\n mapValue: (items: SliceDataItem[]) => { id: string; label: string }[]\n}\n\nexport type CreateFilterFromSlicer = ({\n selection,\n type,\n attribFields,\n}: {\n selection: SelectionData\n type: SliceType\n attribFields: ProjectTableAttribute[]\n}) => SliceFilter | null\n\nexport const createFilterFromSlicer: CreateFilterFromSlicer = ({\n selection,\n type,\n attribFields,\n}) => {\n const sliceTypeToFilterMap: Record<string, FilterMapping | undefined> = {\n assignees: {\n id: 'assignees',\n type: 'list_of_strings',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n status: {\n id: 'status',\n type: 'string',\n\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n taskType: {\n id: 'taskType',\n type: 'string',\n mapValue: (items) =>\n items.map((item) => ({ id: item.name || item.id, label: item.name || '' })),\n },\n hierarchy: undefined,\n }\n\n const sliceFilterTypes = {\n assignees: 'list_of_strings',\n status: 'string',\n taskType: 'string',\n hierarchy: undefined,\n ...attribFields.reduce((acc, field) => {\n acc['attrib.' + field.name] = field.data.type\n return acc\n }, {} as Record<string, AttributeModel['data']['type']>),\n }\n\n const filter: SliceFilter | null = (() => {\n const sliceType = sliceFilterTypes[type as keyof typeof sliceFilterTypes]\n if (!sliceType) return null\n\n const selectedItems = Object.values(selection)\n const values = selectedItems.map((item) => ({\n id: item.id,\n label: item.label || item.name || '',\n }))\n\n return {\n id: type,\n label: type,\n type: sliceType,\n inverted: false,\n operator: 'OR',\n values,\n }\n })()\n\n return filter\n}\n"],"names":["createFilterFromSlicer","selection","type","attribFields","sliceFilterTypes","acc","field","sliceType","values","item"],"mappings":"AAoBO,MAAMA,IAAiD,CAAC;AAAA,EAC7D,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AACF,MAAM;AAwBJ,QAAMC,IAAmB;AAAA,IACvB,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,WAAW;AAAA,IACX,GAAGD,EAAa,OAAO,CAACE,GAAKC,OAC3BD,EAAI,YAAYC,EAAM,IAAI,IAAIA,EAAM,KAAK,MAClCD,IACN,CAAoD,CAAA;AAAA,EACzD;AAsBO,UApB6B,MAAM;AAClC,UAAAE,IAAYH,EAAiBF,CAAqC;AACpE,QAAA,CAACK,EAAkB,QAAA;AAGvB,UAAMC,IADgB,OAAO,OAAOP,CAAS,EAChB,IAAI,CAACQ,OAAU;AAAA,MAC1C,IAAIA,EAAK;AAAA,MACT,OAAOA,EAAK,SAASA,EAAK,QAAQ;AAAA,IAAA,EAClC;AAEK,WAAA;AAAA,MACL,IAAIP;AAAA,MACJ,OAAOA;AAAA,MACP,MAAMK;AAAA,MACN,UAAU;AAAA,MACV,UAAU;AAAA,MACV,QAAAC;AAAA,IACF;AAAA,EAAA,GACC;AAGL;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../../_virtual/jsx-runtime.cjs.js"),q=require("react"),t=require("./ViewItem.styled.cjs.js"),r=require("clsx"),s=require("../../../util/platform.cjs.js");require("lodash");require("react-toastify");require("uuid");require("../../../util/pubsub.cjs.js");const f=q.forwardRef(({label:m,startContent:i,endContent:o,isSelected:a,isEditable:c,isSaveable:x,highlighted:n,onEdit:u,onSave:v,onResetView:l,className:j,...d},p)=>e.jsxRuntimeExports.jsxs(t.ViewItem,{...d,className:r(j,{selected:a}),ref:p,children:[i&&i,e.jsxRuntimeExports.jsx("span",{className:"label",children:m}),l&&e.jsxRuntimeExports.jsx(t.ActionButton,{icon:"restart_alt",variant:"text",className:"reset",onClick:l,"data-tooltip":"Reset this view to default","data-shortcut":s.getPlatformShortcutKey("0",[s.KeyMode.Shift,s.KeyMode.Ctrl])}),c&&x&&!a&&e.jsxRuntimeExports.jsx(t.ActionButton,{icon:"save",variant:"text",className:r("save",{active:n==="save"}),onClick:v,"data-tooltip":"Save view settings from current view"}),c&&u&&e.jsxRuntimeExports.jsx(t.ActionButton,{variant:"text",icon:"more_horiz",className:r("more",{active:n==="edit"}),onClick:u,"data-tooltip":"Edit view"}),o&&o]}));exports.ViewItem=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../../../_virtual/jsx-runtime.cjs.js"),R=require("react"),s=require("./ViewItem.styled.cjs.js"),a=require("clsx"),o=require("../../../util/platform.cjs.js");require("lodash");const y=require("../../../../node_modules/primereact/confirmdialog/confirmdialog.esm.cjs.js");require("react-toastify");require("uuid");require("../../../util/pubsub.cjs.js");const g=R.forwardRef(({label:v,startContent:c,endContent:n,isSelected:u,isEditable:l,isSaveable:d,highlighted:i,onEdit:m,onSave:r,onResetView:x,className:p,...f},j)=>{const w=(e,q)=>{e.stopPropagation(),q?y.confirmDialog({message:"Save current view settings and overwrite this view?",header:"Confirm save",accept:()=>r&&r(e)}):r&&r(e)};return t.jsxRuntimeExports.jsxs(s.ViewItem,{...f,className:a(p,{selected:u}),ref:j,children:[c&&c,t.jsxRuntimeExports.jsx("span",{className:"label",children:v}),x&&t.jsxRuntimeExports.jsx(s.ActionButton,{icon:"restart_alt",variant:"text",className:"reset",onClick:x,"data-tooltip":"Reset this view to default","data-shortcut":o.getPlatformShortcutKey("0",[o.KeyMode.Shift,o.KeyMode.Ctrl])}),l&&d&&!u&&t.jsxRuntimeExports.jsx(s.ActionButton,{icon:"save",variant:"text",className:a("save",{active:i==="save"}),onClick:e=>w(e,i!=="save"),"data-tooltip":"Save view settings from current view"}),l&&m&&t.jsxRuntimeExports.jsx(s.ActionButton,{variant:"text",icon:"more_horiz",className:a("more",{active:i==="edit"}),onClick:m,"data-tooltip":"Edit view"}),n&&n]})});exports.ViewItem=g;
2
2
  //# sourceMappingURL=ViewItem.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ViewItem.cjs.js","sources":["../../../../../../src/containers/Views/ViewItem/ViewItem.tsx"],"sourcesContent":["import { forwardRef, ReactNode } from 'react'\nimport * as Styled from './ViewItem.styled'\nimport clsx from 'clsx'\nimport { getPlatformShortcutKey, KeyMode } from '@shared/util'\n\nexport interface ViewItem {\n id: string\n label: string\n startContent?: ReactNode\n endContent?: ReactNode\n isSelected?: boolean\n isEditable?: boolean\n isSaveable?: boolean // can this be saved from working view (shows little save button)\n highlighted?: 'save' | 'edit' // highlights a button\n onEdit?: (e: React.MouseEvent<HTMLButtonElement>) => void\n onSave?: (e: React.MouseEvent<HTMLButtonElement>) => void // saves the view settings from selected view\n onResetView?: (e: React.MouseEvent<HTMLButtonElement>) => void // resets working view\n onClick?: (e: React.MouseEvent<HTMLLIElement>) => void\n}\n\nexport interface ViewMenuItemProps\n extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'id'>,\n ViewItem {}\n\nexport const ViewItem = forwardRef<HTMLLIElement, ViewMenuItemProps>(\n (\n {\n label,\n startContent,\n endContent,\n isSelected,\n isEditable,\n isSaveable,\n highlighted,\n onEdit,\n onSave,\n onResetView,\n className,\n ...props\n },\n ref,\n ) => {\n return (\n <Styled.ViewItem {...props} className={clsx(className, { selected: isSelected })} ref={ref}>\n {startContent && startContent}\n <span className=\"label\">{label}</span>\n {/* Reset button (e.g., for working view) - shows if handler is provided */}\n {onResetView && (\n <Styled.ActionButton\n icon=\"restart_alt\"\n variant=\"text\"\n className=\"reset\"\n onClick={onResetView}\n data-tooltip=\"Reset this view to default\"\n data-shortcut={getPlatformShortcutKey('0', [KeyMode.Shift, KeyMode.Ctrl])}\n />\n )}\n {isEditable && isSaveable && !isSelected && (\n <Styled.ActionButton\n icon=\"save\"\n variant=\"text\"\n className={clsx('save', { active: highlighted === 'save' })}\n onClick={onSave}\n data-tooltip=\"Save view settings from current view\"\n />\n )}\n {isEditable && onEdit && (\n <Styled.ActionButton\n variant=\"text\"\n icon=\"more_horiz\"\n className={clsx('more', { active: highlighted === 'edit' })}\n onClick={onEdit}\n data-tooltip=\"Edit view\"\n />\n )}\n {endContent && endContent}\n </Styled.ViewItem>\n )\n },\n)\n"],"names":["ViewItem","forwardRef","label","startContent","endContent","isSelected","isEditable","isSaveable","highlighted","onEdit","onSave","onResetView","className","props","ref","jsxs","Styled.ViewItem","clsx","jsx","Styled.ActionButton","getPlatformShortcutKey","KeyMode"],"mappings":"uWAwBO,MAAMA,EAAWC,EAAA,WACtB,CACE,CACE,MAAAC,EACA,aAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EACA,OAAAC,EACA,OAAAC,EACA,YAAAC,EACA,UAAAC,EACA,GAAGC,GAELC,IAGGC,EAAA,kBAAA,KAAAC,EAAA,SAAA,CAAiB,GAAGH,EAAO,UAAWI,EAAKL,EAAW,CAAE,SAAUP,CAAY,CAAA,EAAG,IAAAS,EAC/E,SAAA,CAAgBX,GAAAA,EAChBe,EAAA,kBAAA,IAAA,OAAA,CAAK,UAAU,QAAS,SAAMhB,EAAA,EAE9BS,GACCO,EAAA,kBAAA,IAACC,EAAO,aAAP,CACC,KAAK,cACL,QAAQ,OACR,UAAU,QACV,QAASR,EACT,eAAa,6BACb,gBAAeS,yBAAuB,IAAK,CAACC,UAAQ,MAAOA,EAAA,QAAQ,IAAI,CAAC,CAAA,CAC1E,EAEDf,GAAcC,GAAc,CAACF,GAC5Ba,EAAA,kBAAA,IAACC,EAAO,aAAP,CACC,KAAK,OACL,QAAQ,OACR,UAAWF,EAAK,OAAQ,CAAE,OAAQT,IAAgB,OAAQ,EAC1D,QAASE,EACT,eAAa,sCAAA,CACf,EAEDJ,GAAcG,GACbS,EAAA,kBAAA,IAACC,EAAO,aAAP,CACC,QAAQ,OACR,KAAK,aACL,UAAWF,EAAK,OAAQ,CAAE,OAAQT,IAAgB,OAAQ,EAC1D,QAASC,EACT,eAAa,WAAA,CACf,EAEDL,GAAcA,CAAA,EACjB,CAGN"}
1
+ {"version":3,"file":"ViewItem.cjs.js","sources":["../../../../../../src/containers/Views/ViewItem/ViewItem.tsx"],"sourcesContent":["import { forwardRef, ReactNode } from 'react'\nimport * as Styled from './ViewItem.styled'\nimport clsx from 'clsx'\nimport { getPlatformShortcutKey, KeyMode } from '@shared/util'\nimport { confirmDialog } from 'primereact/confirmdialog'\n\nexport interface ViewItem {\n id: string\n label: string\n startContent?: ReactNode\n endContent?: ReactNode\n isSelected?: boolean\n isEditable?: boolean\n isSaveable?: boolean // can this be saved from working view (shows little save button)\n highlighted?: 'save' | 'edit' // highlights a button\n onEdit?: (e: React.MouseEvent<HTMLButtonElement>) => void\n onSave?: (e: React.MouseEvent<HTMLButtonElement>) => void // saves the view settings from selected view\n onResetView?: (e: React.MouseEvent<HTMLButtonElement>) => void // resets working view\n onClick?: (e: React.MouseEvent<HTMLLIElement>) => void\n}\n\nexport interface ViewMenuItemProps\n extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'id'>,\n ViewItem {}\n\nexport const ViewItem = forwardRef<HTMLLIElement, ViewMenuItemProps>(\n (\n {\n label,\n startContent,\n endContent,\n isSelected,\n isEditable,\n isSaveable,\n highlighted,\n onEdit,\n onSave,\n onResetView,\n className,\n ...props\n },\n ref,\n ) => {\n const handleSave = (e: React.MouseEvent<HTMLButtonElement>, requireConfirm: boolean) => {\n // prevent selecting the view when clicking save\n e.stopPropagation()\n if (requireConfirm) {\n // first validate we actually want to save by asking user to confirm\n confirmDialog({\n message: 'Save current view settings and overwrite this view?',\n header: 'Confirm save',\n accept: () => onSave && onSave(e),\n })\n } else {\n onSave && onSave(e)\n }\n }\n\n return (\n <Styled.ViewItem {...props} className={clsx(className, { selected: isSelected })} ref={ref}>\n {startContent && startContent}\n <span className=\"label\">{label}</span>\n {/* Reset button (e.g., for working view) - shows if handler is provided */}\n {onResetView && (\n <Styled.ActionButton\n icon=\"restart_alt\"\n variant=\"text\"\n className=\"reset\"\n onClick={onResetView}\n data-tooltip=\"Reset this view to default\"\n data-shortcut={getPlatformShortcutKey('0', [KeyMode.Shift, KeyMode.Ctrl])}\n />\n )}\n {isEditable && isSaveable && !isSelected && (\n <Styled.ActionButton\n icon=\"save\"\n variant=\"text\"\n className={clsx('save', { active: highlighted === 'save' })}\n onClick={(e) => handleSave(e, highlighted !== 'save')}\n data-tooltip=\"Save view settings from current view\"\n />\n )}\n {isEditable && onEdit && (\n <Styled.ActionButton\n variant=\"text\"\n icon=\"more_horiz\"\n className={clsx('more', { active: highlighted === 'edit' })}\n onClick={onEdit}\n data-tooltip=\"Edit view\"\n />\n )}\n {endContent && endContent}\n </Styled.ViewItem>\n )\n },\n)\n"],"names":["ViewItem","forwardRef","label","startContent","endContent","isSelected","isEditable","isSaveable","highlighted","onEdit","onSave","onResetView","className","props","ref","handleSave","requireConfirm","confirmDialog","jsxs","Styled.ViewItem","clsx","jsx","Styled.ActionButton","getPlatformShortcutKey","KeyMode"],"mappings":"qcAyBO,MAAMA,EAAWC,EAAA,WACtB,CACE,CACE,MAAAC,EACA,aAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,EACA,OAAAC,EACA,OAAAC,EACA,YAAAC,EACA,UAAAC,EACA,GAAGC,GAELC,IACG,CACG,MAAAC,EAAa,CAAC,EAAwCC,IAA4B,CAEtF,EAAE,gBAAgB,EACdA,EAEYC,gBAAA,CACZ,QAAS,sDACT,OAAQ,eACR,OAAQ,IAAMP,GAAUA,EAAO,CAAC,CAAA,CACjC,EAEDA,GAAUA,EAAO,CAAC,CAEtB,EAEA,OACGQ,EAAA,kBAAA,KAAAC,EAAA,SAAA,CAAiB,GAAGN,EAAO,UAAWO,EAAKR,EAAW,CAAE,SAAUP,CAAY,CAAA,EAAG,IAAAS,EAC/E,SAAA,CAAg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