@ynput/ayon-frontend-shared 0.3.55 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.cjs8.js +1 -1
- package/dist/_virtual/index.cjs9.js +1 -1
- package/dist/_virtual/index.es15.js +2 -2
- package/dist/_virtual/index.es4.js +5 -2
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index.es5.js +2 -5
- package/dist/_virtual/index.es5.js.map +1 -1
- package/dist/_virtual/index.es6.js +2 -2
- package/dist/_virtual/index.es8.js +2 -5
- package/dist/_virtual/index.es8.js.map +1 -1
- package/dist/_virtual/index.es9.js +5 -2
- package/dist/_virtual/index.es9.js.map +1 -1
- package/dist/api.cjs.js +1 -1
- package/dist/api.es.js +193 -192
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.cjs.js +1 -1
- package/dist/node_modules/match-sorter/dist/match-sorter.esm.es.js +1 -1
- package/dist/node_modules/parse-numeric-range/index.cjs.js +1 -1
- package/dist/node_modules/parse-numeric-range/index.es.js +1 -1
- package/dist/node_modules/remove-accents/index.cjs.js +1 -1
- package/dist/node_modules/remove-accents/index.cjs.js.map +1 -1
- package/dist/node_modules/remove-accents/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/error-codes/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/error-codes/dist/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime/dist/index.es.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/index.cjs.js +1 -1
- package/dist/shared/node_modules/@module-federation/runtime-core/dist/index.es.js +1 -1
- package/dist/shared/node_modules/prop-types/index.cjs.js +1 -1
- package/dist/shared/node_modules/prop-types/index.cjs.js.map +1 -1
- package/dist/shared/node_modules/prop-types/index.es.js +1 -1
- package/dist/shared/node_modules/react-is/index.cjs.js +1 -1
- package/dist/shared/node_modules/react-is/index.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/CSSTransition.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/Transition.es.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.cjs.js +1 -1
- package/dist/shared/node_modules/react-transition-group/esm/utils/PropTypes.es.js +1 -1
- package/dist/shared/src/api/generated/graphql.cjs.js +4 -0
- package/dist/shared/src/api/generated/graphql.cjs.js.map +1 -1
- package/dist/shared/src/api/generated/graphql.es.js +4 -0
- package/dist/shared/src/api/generated/graphql.es.js.map +1 -1
- package/dist/shared/src/api/generated/graphqlLinks.cjs.js.map +1 -1
- package/dist/shared/src/api/generated/graphqlLinks.es.js.map +1 -1
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.cjs.js +1 -1
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.es.js +17 -16
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.es.js.map +1 -1
- package/dist/shared/src/api/queries/entityLists/getLists.cjs.js +1 -1
- package/dist/shared/src/api/queries/entityLists/getLists.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/entityLists/getLists.es.js +47 -47
- package/dist/shared/src/api/queries/entityLists/getLists.es.js.map +1 -1
- package/dist/shared/src/api/queries/folders/getFolders.cjs.js +1 -1
- package/dist/shared/src/api/queries/folders/getFolders.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/folders/getFolders.es.js +20 -22
- package/dist/shared/src/api/queries/folders/getFolders.es.js.map +1 -1
- package/dist/shared/src/api/queries/overview/getOverview.cjs.js +1 -1
- package/dist/shared/src/api/queries/overview/getOverview.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/overview/getOverview.es.js +92 -89
- package/dist/shared/src/api/queries/overview/getOverview.es.js.map +1 -1
- package/dist/shared/src/api/queries/project/getProject.cjs.js +1 -1
- package/dist/shared/src/api/queries/project/getProject.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/project/getProject.es.js +1 -1
- package/dist/shared/src/api/queries/project/getProject.es.js.map +1 -1
- package/dist/shared/src/api/queries/users/getUsers.cjs.js +1 -1
- package/dist/shared/src/api/queries/users/getUsers.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/users/getUsers.es.js +1 -1
- package/dist/shared/src/api/queries/users/getUsers.es.js.map +1 -1
- package/dist/shared/src/api/queries/versions/getVersionsProducts.cjs.js +1 -1
- package/dist/shared/src/api/queries/versions/getVersionsProducts.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/versions/getVersionsProducts.es.js +23 -23
- package/dist/shared/src/api/queries/versions/getVersionsProducts.es.js.map +1 -1
- package/dist/shared/src/api/queries/versions/getVersionsProductsUtils.cjs.js +1 -1
- package/dist/shared/src/api/queries/versions/getVersionsProductsUtils.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/versions/getVersionsProductsUtils.es.js +13 -13
- package/dist/shared/src/api/queries/versions/getVersionsProductsUtils.es.js.map +1 -1
- package/dist/shared/src/components/DetailsPanelAttributes/components/RenderFieldWidget.cjs.js +3 -3
- package/dist/shared/src/components/DetailsPanelAttributes/components/RenderFieldWidget.cjs.js.map +1 -1
- package/dist/shared/src/components/DetailsPanelAttributes/components/RenderFieldWidget.es.js +51 -50
- package/dist/shared/src/components/DetailsPanelAttributes/components/RenderFieldWidget.es.js.map +1 -1
- package/dist/shared/src/components/RemotePage/ProjectPageRemote.cjs.js +1 -1
- package/dist/shared/src/components/RemotePage/ProjectPageRemote.cjs.js.map +1 -1
- package/dist/shared/src/components/RemotePage/ProjectPageRemote.es.js +26 -24
- package/dist/shared/src/components/RemotePage/ProjectPageRemote.es.js.map +1 -1
- package/dist/shared/src/components/RemotePage/RemotePageWrapper.cjs.js +1 -1
- package/dist/shared/src/components/RemotePage/RemotePageWrapper.cjs.js.map +1 -1
- package/dist/shared/src/components/RemotePage/RemotePageWrapper.es.js +31 -18
- package/dist/shared/src/components/RemotePage/RemotePageWrapper.es.js.map +1 -1
- package/dist/shared/src/containers/ListTable/ListTableWidgets.cjs.js +1 -1
- package/dist/shared/src/containers/ListTable/ListTableWidgets.cjs.js.map +1 -1
- package/dist/shared/src/containers/ListTable/ListTableWidgets.es.js +62 -58
- package/dist/shared/src/containers/ListTable/ListTableWidgets.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js +21 -20
- package/dist/shared/src/containers/ProjectTreeTable/buildTreeTableColumns.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.cjs.js +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.es.js +25 -24
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildGroupByTableData.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildProjectDataTable.cjs.js +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildProjectDataTable.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildProjectDataTable.es.js +20 -19
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildProjectDataTable.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useUpdateTableData.cjs.js +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useUpdateTableData.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useUpdateTableData.es.js +152 -133
- package/dist/shared/src/containers/ProjectTreeTable/hooks/useUpdateTableData.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.cjs.js +2 -2
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.es.js +75 -73
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.cjs.js +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.es.js +21 -19
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidgetInput.cjs.js +2 -2
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidgetInput.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidgetInput.es.js +58 -43
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidgetInput.es.js.map +1 -1
- package/dist/types/api/generated/graphql.d.ts +5 -0
- package/dist/types/api/generated/graphqlLinks.d.ts +1 -0
- package/dist/types/api/queries/entities/transformDetailsPanelData.d.ts +1 -0
- package/dist/types/api/queries/overview/getOverview.d.ts +2 -1
- package/dist/types/components/RemotePage/RemotePageWrapper.d.ts +25 -1
- package/dist/types/containers/ProjectTreeTable/types/table.d.ts +3 -1
- package/dist/types/containers/ProjectTreeTable/widgets/CellWidget.d.ts +1 -0
- package/dist/types/containers/ProjectTreeTable/widgets/DateWidget.d.ts +1 -0
- package/dist/types/containers/ProjectTreeTable/widgets/DateWidgetInput.d.ts +1 -0
- package/package.json +1 -1
|
@@ -302,7 +302,7 @@ import "../../../components/Menu/MenuItem.es.js";
|
|
|
302
302
|
import "../../../components/ReviewablesSelector/ReviewablesSelector.es.js";
|
|
303
303
|
import "../../../components/ColumnHeaderMenuUI.es.js";
|
|
304
304
|
import { linksToTableData as P } from "../utils/linksToTableData.es.js";
|
|
305
|
-
const
|
|
305
|
+
const H = 100;
|
|
306
306
|
function Tm({
|
|
307
307
|
foldersMap: a,
|
|
308
308
|
tasksMap: h,
|
|
@@ -310,15 +310,15 @@ function Tm({
|
|
|
310
310
|
tasksByFolderMap: b,
|
|
311
311
|
expanded: R,
|
|
312
312
|
showHierarchy: A,
|
|
313
|
-
isFlatFolderView:
|
|
314
|
-
showEmptyFolders:
|
|
313
|
+
isFlatFolderView: S = !1,
|
|
314
|
+
showEmptyFolders: j = !1,
|
|
315
315
|
loadingTasks: c = {},
|
|
316
316
|
isLoadingMore: v = !1,
|
|
317
317
|
selectedFolders: E = []
|
|
318
318
|
}) {
|
|
319
|
-
const T = K(),
|
|
319
|
+
const T = K(), D = V({ projectInfo: T }), N = I(() => JSON.stringify(R), [R]), f = I(() => new Set(
|
|
320
320
|
Object.entries(R).filter(([r, p]) => p).map(([r]) => r)
|
|
321
|
-
), [
|
|
321
|
+
), [N]), { childToParentMap: x, parentToChildrenMap: _ } = I(() => {
|
|
322
322
|
const r = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
323
323
|
for (const i of a.values()) {
|
|
324
324
|
if (!i?.id) continue;
|
|
@@ -330,23 +330,23 @@ function Tm({
|
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
return { childToParentMap: r, parentToChildrenMap: p };
|
|
333
|
-
}, [a]),
|
|
333
|
+
}, [a]), C = I(() => {
|
|
334
334
|
const r = /* @__PURE__ */ new Set(), p = [];
|
|
335
335
|
for (const i of a.values())
|
|
336
336
|
i?.id && (!i.parentId || !a.has(i.parentId)) && (r.add(i.id), p.push(i.id));
|
|
337
337
|
for (; p.length > 0; ) {
|
|
338
338
|
const i = p.shift();
|
|
339
339
|
if (!f.has(i)) continue;
|
|
340
|
-
const o =
|
|
340
|
+
const o = _.get(i);
|
|
341
341
|
if (o)
|
|
342
342
|
for (const t of o)
|
|
343
343
|
r.has(t) || (r.add(t), p.push(t));
|
|
344
344
|
}
|
|
345
345
|
return r;
|
|
346
|
-
}, [a,
|
|
346
|
+
}, [a, _, f]);
|
|
347
347
|
return I(() => {
|
|
348
348
|
const r = (o, t) => {
|
|
349
|
-
const m =
|
|
349
|
+
const m = D("task", o.taskType), e = P(o.links, "task", T.anatomy);
|
|
350
350
|
return {
|
|
351
351
|
id: o.id,
|
|
352
352
|
entityType: "task",
|
|
@@ -363,6 +363,7 @@ function Tm({
|
|
|
363
363
|
subRows: [],
|
|
364
364
|
subType: o.taskType || null,
|
|
365
365
|
attrib: o.attrib,
|
|
366
|
+
midnightExclusiveFields: o.data?.schedulerSyncData?.allDay ? ["attrib_endDate"] : void 0,
|
|
366
367
|
ownAttrib: o.ownAttrib,
|
|
367
368
|
parents: o.parents || [],
|
|
368
369
|
path: o.parents.join("/") || null,
|
|
@@ -388,13 +389,13 @@ function Tm({
|
|
|
388
389
|
}
|
|
389
390
|
return o;
|
|
390
391
|
};
|
|
391
|
-
if (
|
|
392
|
+
if (S) {
|
|
392
393
|
const o = [];
|
|
393
394
|
for (const t of a.values()) {
|
|
394
395
|
if (!t?.id) continue;
|
|
395
396
|
const m = t.hasTasks ?? b.has(t.id);
|
|
396
|
-
if (!
|
|
397
|
-
const e =
|
|
397
|
+
if (!j && !m) continue;
|
|
398
|
+
const e = D("folder", t.folderType), l = P(t.links, "folder", T.anatomy), O = {
|
|
398
399
|
id: t.id,
|
|
399
400
|
entityType: "folder",
|
|
400
401
|
parentId: void 0,
|
|
@@ -443,7 +444,7 @@ function Tm({
|
|
|
443
444
|
for (const t of y || [])
|
|
444
445
|
o.push(t);
|
|
445
446
|
if (v) {
|
|
446
|
-
const t =
|
|
447
|
+
const t = H;
|
|
447
448
|
{
|
|
448
449
|
const m = g(t, {
|
|
449
450
|
type: "task"
|
|
@@ -454,10 +455,10 @@ function Tm({
|
|
|
454
455
|
return o;
|
|
455
456
|
}
|
|
456
457
|
const i = /* @__PURE__ */ new Map(), s = [];
|
|
457
|
-
for (const o of
|
|
458
|
+
for (const o of C) {
|
|
458
459
|
const t = a.get(o);
|
|
459
460
|
if (!t) continue;
|
|
460
|
-
const m = P(t.links, "folder", T.anatomy), e =
|
|
461
|
+
const m = P(t.links, "folder", T.anatomy), e = D("folder", t.folderType), l = {
|
|
461
462
|
id: o,
|
|
462
463
|
entityType: "folder",
|
|
463
464
|
parentId: t.parentId || void 0,
|
|
@@ -501,14 +502,14 @@ function Tm({
|
|
|
501
502
|
}
|
|
502
503
|
}
|
|
503
504
|
}
|
|
504
|
-
for (const o of
|
|
505
|
+
for (const o of C) {
|
|
505
506
|
const t = x.get(o);
|
|
506
507
|
if (!t || !f.has(t)) continue;
|
|
507
508
|
const m = i.get(o), e = i.get(t);
|
|
508
509
|
!m || !e || e.subRows?.push(m);
|
|
509
510
|
}
|
|
510
511
|
if (s.push(...p()), A && v) {
|
|
511
|
-
const o =
|
|
512
|
+
const o = H;
|
|
512
513
|
s.push(...g(o, { type: "task" }));
|
|
513
514
|
}
|
|
514
515
|
for (const o of y || [])
|
|
@@ -519,12 +520,12 @@ function Tm({
|
|
|
519
520
|
h,
|
|
520
521
|
b,
|
|
521
522
|
y,
|
|
522
|
-
|
|
523
|
+
C,
|
|
523
524
|
x,
|
|
524
525
|
f,
|
|
525
526
|
A,
|
|
526
|
-
j,
|
|
527
527
|
S,
|
|
528
|
+
j,
|
|
528
529
|
c,
|
|
529
530
|
v,
|
|
530
531
|
E
|
package/dist/shared/src/containers/ProjectTreeTable/hooks/useBuildProjectDataTable.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBuildProjectDataTable.es.js","sources":["../../../../../../src/containers/ProjectTreeTable/hooks/useBuildProjectDataTable.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport {\n EditorTaskNode,\n FolderNodeMap,\n TableRow,\n TaskNodeMap,\n TasksByFolderMap,\n} from '../types/table'\nimport { ExpandedState } from '@tanstack/react-table'\nimport { generateLoadingRows } from '../utils/loadingUtils'\nconst TASKS_INFINITE_QUERY_COUNT = 100\nimport { LoadingTasks } from '../types'\nimport { useGetEntityTypeData } from './useGetEntityTypeData'\nimport { TableGroupBy } from '../context'\nimport { linksToTableData } from '../utils'\nimport { useProjectContext } from '@shared/context'\n\ntype Params = {\n foldersMap: FolderNodeMap\n tasksMap: TaskNodeMap\n tasksByFolderMap: TasksByFolderMap\n rows?: TableRow[]\n expanded: ExpandedState\n showHierarchy: boolean\n isFlatFolderView?: boolean\n showEmptyFolders?: boolean\n loadingTasks?: LoadingTasks\n isLoadingMore?: boolean\n groupBy?: TableGroupBy\n selectedFolders?: string[]\n}\n\nexport default function useBuildProjectDataTable({\n foldersMap,\n tasksMap,\n rows,\n tasksByFolderMap,\n expanded,\n showHierarchy,\n isFlatFolderView = false,\n showEmptyFolders = false,\n loadingTasks = {},\n isLoadingMore = false,\n selectedFolders = [],\n}: Params): TableRow[] {\n const project = useProjectContext()\n const getEntityTypeData = useGetEntityTypeData({ projectInfo: project })\n\n // Convert expanded object to a stable string for memoization comparison\n const expandedKey = useMemo(() => JSON.stringify(expanded), [expanded])\n\n // Memoize expandedFolderIds set for efficient lookups\n const expandedFolderIds = useMemo(() => {\n return new Set(\n Object.entries(expanded)\n .filter(([_, isExpanded]) => isExpanded)\n .map(([id]) => id),\n )\n }, [expandedKey])\n\n // Memoize relationship maps to avoid rebuilding them on every render\n const { childToParentMap, parentToChildrenMap } = useMemo(() => {\n const childToParent = new Map<string, string>()\n const parentToChildren = new Map<string, Set<string>>()\n\n // Construct relationship maps in a single pass\n for (const folder of foldersMap.values()) {\n if (!folder?.id) continue\n\n const parentId = folder.parentId\n if (parentId) {\n childToParent.set(folder.id, parentId)\n\n let children = parentToChildren.get(parentId)\n if (!children) {\n children = new Set<string>()\n parentToChildren.set(parentId, children)\n }\n children.add(folder.id)\n }\n }\n\n return { childToParentMap: childToParent, parentToChildrenMap: parentToChildren }\n }, [foldersMap])\n\n // Memoize visible folders calculation\n const visibleFolders = useMemo(() => {\n const visible = new Set<string>()\n\n // Start with root folders and folders with non-existent parents\n const queue: string[] = []\n for (const folder of foldersMap.values()) {\n if (!folder?.id) continue\n\n // Include folders with no parent OR with a parent that doesn't exist\n if (!folder.parentId || !foldersMap.has(folder.parentId)) {\n visible.add(folder.id)\n queue.push(folder.id)\n }\n }\n\n // Process queue to identify visible folders (BFS)\n while (queue.length > 0) {\n const folderId = queue.shift()!\n const isParentExpanded = expandedFolderIds.has(folderId)\n\n if (!isParentExpanded) continue\n\n // Add children of expanded folders to visible set\n const childrenIds = parentToChildrenMap.get(folderId)\n if (childrenIds) {\n for (const childId of childrenIds) {\n if (!visible.has(childId)) {\n visible.add(childId)\n queue.push(childId)\n }\n }\n }\n }\n\n return visible\n }, [foldersMap, parentToChildrenMap, expandedFolderIds])\n\n // Final memoized result - build the table tree\n return useMemo(() => {\n // Helper function to create a task row\n const createTaskRow = (task: EditorTaskNode, parentId?: string): TableRow => {\n const typeData = getEntityTypeData('task', task.taskType)\n\n const links = linksToTableData(task.links, 'task', project.anatomy)\n\n return {\n id: task.id,\n entityType: 'task',\n parentId: parentId || task.folderId,\n folderId: task.folderId,\n name: task.name || '',\n label: task.label || task.name || '',\n icon: typeData?.icon || null,\n color: typeData?.color || null,\n status: task.status,\n assignees: task.assignees,\n tags: task.tags,\n img: null,\n subRows: [],\n subType: task.taskType || null,\n attrib: task.attrib,\n ownAttrib: task.ownAttrib,\n parents: task.parents || [],\n path: task.parents.join('/') || null, // todo: probably remove this and just use parents\n folder: task.parents[task.parents.length - 1] || undefined,\n updatedAt: task.updatedAt,\n createdAt: task.createdAt,\n thumbnailHash: task.thumbnailHash,\n hasReviewables: task.hasReviewables || false,\n links: links,\n subtasks: task.subtasks || [],\n latestComments: task.latestComments || [],\n }\n }\n\n const createRootTaskRows = (): TableRow[] => {\n const rootTaskRows: TableRow[] = []\n for (const folderId of selectedFolders) {\n if (foldersMap.has(folderId)) continue\n const folderTaskIds = tasksByFolderMap.get(folderId) || []\n for (const taskId of folderTaskIds) {\n const task = tasksMap.get(taskId)\n if (task) rootTaskRows.push(createTaskRow(task))\n }\n }\n return rootTaskRows\n }\n\n // Flat folder view: all folders at root level, each expandable to show tasks\n if (isFlatFolderView) {\n const flatFolderRows: TableRow[] = []\n\n for (const folder of foldersMap.values()) {\n if (!folder?.id) continue\n\n // Use the folder's hasTasks flag (from REST data) to filter before tasks are loaded\n const hasTasks = folder.hasTasks ?? tasksByFolderMap.has(folder.id)\n // Skip folders without tasks when showEmptyFolders is off\n if (!showEmptyFolders && !hasTasks) continue\n\n const folderTypeData = getEntityTypeData('folder', folder.folderType)\n const links = linksToTableData(folder.links, 'folder', project.anatomy)\n\n const row: TableRow = {\n id: folder.id,\n entityType: 'folder',\n parentId: undefined, // flat — no parent nesting\n folderId: folder.id,\n name: folder.name || '',\n label: folder.label || folder.name || '',\n icon: folderTypeData?.icon || null,\n color: folderTypeData?.color || null,\n img: null,\n subRows: [],\n status: folder.status,\n tags: folder.tags || [],\n subType: folder.folderType || null,\n ownAttrib: folder.ownAttrib || [],\n path: folder.path,\n folder: folder.parents[folder.parents.length - 1] || undefined,\n attrib: folder.attrib || {},\n childOnlyMatch: folder.childOnlyMatch || false,\n updatedAt: folder.updatedAt,\n createdAt: folder.createdAt,\n thumbnailHash: folder.thumbnailHash,\n hasReviewables: folder.hasReviewables || false,\n hasVersions: folder.hasVersions || false,\n links: links,\n }\n\n // If folder is expanded, attach task subRows\n if (expandedFolderIds.has(folder.id)) {\n const folderTaskIds = tasksByFolderMap.get(folder.id) || []\n const folderTasks = folderTaskIds.flatMap((taskId) => tasksMap.get(taskId) || [])\n\n if (folderTasks.length || loadingTasks[folder.id]) {\n const taskRows = folderTasks.map((task) => createTaskRow(task, folder.id))\n\n if (loadingTasks[folder.id]) {\n const count = loadingTasks[folder.id]\n if (count > 0) {\n taskRows.push(...generateLoadingRows(count, { parentId: folder.id }))\n }\n }\n\n row.subRows = taskRows\n }\n }\n\n flatFolderRows.push(row)\n }\n\n flatFolderRows.push(...createRootTaskRows())\n\n return flatFolderRows\n }\n\n // If showHierarchy is false, create a flat list of task rows\n if (!showHierarchy) {\n const flatRows: TableRow[] = []\n\n // Loop through all tasks\n for (const task of tasksMap.values()) {\n if (!task.id) continue\n flatRows.push(createTaskRow(task))\n }\n\n // Loop through all extra rows\n for (const row of rows || []) {\n flatRows.push(row)\n }\n\n // if we are loading more tasks, add loading rows\n if (isLoadingMore) {\n // number of tasks we loading with the infinite query\n const count = TASKS_INFINITE_QUERY_COUNT\n if (count > 0) {\n const loadingTaskRows = generateLoadingRows(count, {\n type: 'task',\n })\n\n flatRows.push(...loadingTaskRows)\n }\n }\n\n return flatRows\n }\n\n // Use Map for O(1) lookups\n const rowsById = new Map<string, TableRow>()\n const rootRows: TableRow[] = []\n\n // Create minimal rows for only visible folders\n for (const folderId of visibleFolders) {\n const folder = foldersMap.get(folderId)\n if (!folder) continue\n\n const links = linksToTableData(folder.links, 'folder', project.anatomy)\n\n const folderTypeData = getEntityTypeData('folder', folder.folderType)\n\n // Create row with minimal required properties\n const row: TableRow = {\n id: folderId,\n entityType: 'folder',\n parentId: folder.parentId || undefined,\n folderId: folderId || null, // root folders have no folderId\n name: folder.name || '',\n label: folder.label || folder.name || '',\n icon: folderTypeData?.icon || null,\n color: folderTypeData?.color || null,\n img: null,\n subRows: [],\n status: folder.status,\n tags: folder.tags || [],\n subType: folder.folderType || null,\n ownAttrib: folder.ownAttrib || [],\n path: folder.path,\n folder: folder.parents[folder.parents.length - 1] || undefined,\n attrib: folder.attrib || {},\n childOnlyMatch: folder.childOnlyMatch || false,\n updatedAt: folder.updatedAt,\n createdAt: folder.createdAt,\n thumbnailHash: folder.thumbnailHash,\n hasReviewables: folder.hasReviewables || false,\n hasVersions: folder.hasVersions || false,\n links: links,\n }\n\n rowsById.set(folderId, row)\n\n // Add root rows directly to the rootRows array\n if (!folder.parentId || !foldersMap.has(folder.parentId)) {\n rootRows.push(row)\n }\n\n // Process tasks immediately if folder is expanded\n if (expandedFolderIds.has(folderId)) {\n // because tasksByFolderMap is a map of tasks by folder ID\n // we can directly get the tasks for the current folder\n const folderTaskIds = tasksByFolderMap.get(folderId) || []\n const folderTasks = folderTaskIds.flatMap((taskId) => tasksMap.get(taskId) || [])\n\n if (folderTasks.length || loadingTasks[folderId]) {\n // Use array literal with known length for better performance\n const taskRows = new Array<TableRow>(folderTasks.length)\n\n // Direct array assignment is faster than push operations\n for (let i = 0; i < folderTasks.length; i++) {\n taskRows[i] = createTaskRow(folderTasks[i], folderId)\n }\n\n // Add loading rows if applicable\n if (loadingTasks[folderId]) {\n const count = loadingTasks[folderId]\n if (count > 0) {\n const loadingTaskRows = generateLoadingRows(count, { parentId: folderId })\n\n taskRows.push(...loadingTaskRows)\n }\n }\n\n row.subRows = taskRows\n }\n }\n }\n\n // Build the folder hierarchy efficiently\n for (const folderId of visibleFolders) {\n const parentId = childToParentMap.get(folderId)\n if (!parentId || !expandedFolderIds.has(parentId)) continue\n\n const childRow = rowsById.get(folderId)\n const parentRow = rowsById.get(parentId)\n\n if (!childRow || !parentRow) continue\n\n // Add folder to its parent's subRows\n parentRow.subRows?.push(childRow)\n }\n\n rootRows.push(...createRootTaskRows())\n\n // if we are loading more tasks, add loading rows at the root level\n // this happens when in hierarchy mode but with a slicer selection that causes paginated tasks\n if (showHierarchy && isLoadingMore) {\n const count = TASKS_INFINITE_QUERY_COUNT\n if (count > 0) {\n rootRows.push(...generateLoadingRows(count, { type: 'task' }))\n }\n }\n\n // Add any extra rows to the root rows\n for (const row of rows || []) {\n rootRows.push(row)\n }\n\n return rootRows\n }, [\n foldersMap,\n tasksMap,\n tasksByFolderMap,\n rows,\n visibleFolders,\n childToParentMap,\n expandedFolderIds,\n showHierarchy,\n isFlatFolderView,\n showEmptyFolders,\n loadingTasks,\n isLoadingMore,\n selectedFolders,\n ])\n}\n"],"names":["TASKS_INFINITE_QUERY_COUNT","useBuildProjectDataTable","foldersMap","tasksMap","rows","tasksByFolderMap","expanded","showHierarchy","isFlatFolderView","showEmptyFolders","loadingTasks","isLoadingMore","selectedFolders","project","useProjectContext","getEntityTypeData","useGetEntityTypeData","expandedKey","useMemo","expandedFolderIds","_","isExpanded","id","childToParentMap","parentToChildrenMap","childToParent","parentToChildren","folder","parentId","children","visibleFolders","visible","queue","folderId","childrenIds","childId","createTaskRow","task","typeData","links","linksToTableData","createRootTaskRows","rootTaskRows","folderTaskIds","taskId","flatFolderRows","hasTasks","folderTypeData","row","folderTasks","taskRows","count","generateLoadingRows","flatRows","loadingTaskRows","rowsById","rootRows","i","childRow","parentRow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,IAA6B;AAsBnC,SAAwBC,GAAyB;AAAA,EAC/C,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,kBAAAC,IAAmB;AAAA,EACnB,kBAAAC,IAAmB;AAAA,EACnB,cAAAC,IAAe,CAAA;AAAA,EACf,eAAAC,IAAgB;AAAA,EAChB,iBAAAC,IAAkB,CAAA;AACpB,GAAuB;AACrB,QAAMC,IAAUC,EAAA,GACVC,IAAoBC,EAAqB,EAAE,aAAaH,GAAS,GAGj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A,IACA0B;AAAA,IACAP;AAAA,IACAJ;AAAA,IACAZ;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,CACD;AACH;"}
|
|
1
|
+
{"version":3,"file":"useBuildProjectDataTable.es.js","sources":["../../../../../../src/containers/ProjectTreeTable/hooks/useBuildProjectDataTable.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport {\n EditorTaskNode,\n FolderNodeMap,\n TableRow,\n TaskNodeMap,\n TasksByFolderMap,\n} from '../types/table'\nimport { ExpandedState } from '@tanstack/react-table'\nimport { generateLoadingRows } from '../utils/loadingUtils'\nconst TASKS_INFINITE_QUERY_COUNT = 100\nimport { LoadingTasks } from '../types'\nimport { useGetEntityTypeData } from './useGetEntityTypeData'\nimport { TableGroupBy } from '../context'\nimport { linksToTableData } from '../utils'\nimport { useProjectContext } from '@shared/context'\n\ntype Params = {\n foldersMap: FolderNodeMap\n tasksMap: TaskNodeMap\n tasksByFolderMap: TasksByFolderMap\n rows?: TableRow[]\n expanded: ExpandedState\n showHierarchy: boolean\n isFlatFolderView?: boolean\n showEmptyFolders?: boolean\n loadingTasks?: LoadingTasks\n isLoadingMore?: boolean\n groupBy?: TableGroupBy\n selectedFolders?: string[]\n}\n\nexport default function useBuildProjectDataTable({\n foldersMap,\n tasksMap,\n rows,\n tasksByFolderMap,\n expanded,\n showHierarchy,\n isFlatFolderView = false,\n showEmptyFolders = false,\n loadingTasks = {},\n isLoadingMore = false,\n selectedFolders = [],\n}: Params): TableRow[] {\n const project = useProjectContext()\n const getEntityTypeData = useGetEntityTypeData({ projectInfo: project })\n\n // Convert expanded object to a stable string for memoization comparison\n const expandedKey = useMemo(() => JSON.stringify(expanded), [expanded])\n\n // Memoize expandedFolderIds set for efficient lookups\n const expandedFolderIds = useMemo(() => {\n return new Set(\n Object.entries(expanded)\n .filter(([_, isExpanded]) => isExpanded)\n .map(([id]) => id),\n )\n }, [expandedKey])\n\n // Memoize relationship maps to avoid rebuilding them on every render\n const { childToParentMap, parentToChildrenMap } = useMemo(() => {\n const childToParent = new Map<string, string>()\n const parentToChildren = new Map<string, Set<string>>()\n\n // Construct relationship maps in a single pass\n for (const folder of foldersMap.values()) {\n if (!folder?.id) continue\n\n const parentId = folder.parentId\n if (parentId) {\n childToParent.set(folder.id, parentId)\n\n let children = parentToChildren.get(parentId)\n if (!children) {\n children = new Set<string>()\n parentToChildren.set(parentId, children)\n }\n children.add(folder.id)\n }\n }\n\n return { childToParentMap: childToParent, parentToChildrenMap: parentToChildren }\n }, [foldersMap])\n\n // Memoize visible folders calculation\n const visibleFolders = useMemo(() => {\n const visible = new Set<string>()\n\n // Start with root folders and folders with non-existent parents\n const queue: string[] = []\n for (const folder of foldersMap.values()) {\n if (!folder?.id) continue\n\n // Include folders with no parent OR with a parent that doesn't exist\n if (!folder.parentId || !foldersMap.has(folder.parentId)) {\n visible.add(folder.id)\n queue.push(folder.id)\n }\n }\n\n // Process queue to identify visible folders (BFS)\n while (queue.length > 0) {\n const folderId = queue.shift()!\n const isParentExpanded = expandedFolderIds.has(folderId)\n\n if (!isParentExpanded) continue\n\n // Add children of expanded folders to visible set\n const childrenIds = parentToChildrenMap.get(folderId)\n if (childrenIds) {\n for (const childId of childrenIds) {\n if (!visible.has(childId)) {\n visible.add(childId)\n queue.push(childId)\n }\n }\n }\n }\n\n return visible\n }, [foldersMap, parentToChildrenMap, expandedFolderIds])\n\n // Final memoized result - build the table tree\n return useMemo(() => {\n // Helper function to create a task row\n const createTaskRow = (task: EditorTaskNode, parentId?: string): TableRow => {\n const typeData = getEntityTypeData('task', task.taskType)\n\n const links = linksToTableData(task.links, 'task', project.anatomy)\n\n return {\n id: task.id,\n entityType: 'task',\n parentId: parentId || task.folderId,\n folderId: task.folderId,\n name: task.name || '',\n label: task.label || task.name || '',\n icon: typeData?.icon || null,\n color: typeData?.color || null,\n status: task.status,\n assignees: task.assignees,\n tags: task.tags,\n img: null,\n subRows: [],\n subType: task.taskType || null,\n attrib: task.attrib,\n midnightExclusiveFields: task.data?.schedulerSyncData?.allDay\n ? ['attrib_endDate']\n : undefined,\n ownAttrib: task.ownAttrib,\n parents: task.parents || [],\n path: task.parents.join('/') || null, // todo: probably remove this and just use parents\n folder: task.parents[task.parents.length - 1] || undefined,\n updatedAt: task.updatedAt,\n createdAt: task.createdAt,\n thumbnailHash: task.thumbnailHash,\n hasReviewables: task.hasReviewables || false,\n links: links,\n subtasks: task.subtasks || [],\n latestComments: task.latestComments || [],\n }\n }\n\n const createRootTaskRows = (): TableRow[] => {\n const rootTaskRows: TableRow[] = []\n for (const folderId of selectedFolders) {\n if (foldersMap.has(folderId)) continue\n const folderTaskIds = tasksByFolderMap.get(folderId) || []\n for (const taskId of folderTaskIds) {\n const task = tasksMap.get(taskId)\n if (task) rootTaskRows.push(createTaskRow(task))\n }\n }\n return rootTaskRows\n }\n\n // Flat folder view: all folders at root level, each expandable to show tasks\n if (isFlatFolderView) {\n const flatFolderRows: TableRow[] = []\n\n for (const folder of foldersMap.values()) {\n if (!folder?.id) continue\n\n // Use the folder's hasTasks flag (from REST data) to filter before tasks are loaded\n const hasTasks = folder.hasTasks ?? tasksByFolderMap.has(folder.id)\n // Skip folders without tasks when showEmptyFolders is off\n if (!showEmptyFolders && !hasTasks) continue\n\n const folderTypeData = getEntityTypeData('folder', folder.folderType)\n const links = linksToTableData(folder.links, 'folder', project.anatomy)\n\n const row: TableRow = {\n id: folder.id,\n entityType: 'folder',\n parentId: undefined, // flat — no parent nesting\n folderId: folder.id,\n name: folder.name || '',\n label: folder.label || folder.name || '',\n icon: folderTypeData?.icon || null,\n color: folderTypeData?.color || null,\n img: null,\n subRows: [],\n status: folder.status,\n tags: folder.tags || [],\n subType: folder.folderType || null,\n ownAttrib: folder.ownAttrib || [],\n path: folder.path,\n folder: folder.parents[folder.parents.length - 1] || undefined,\n attrib: folder.attrib || {},\n childOnlyMatch: folder.childOnlyMatch || false,\n updatedAt: folder.updatedAt,\n createdAt: folder.createdAt,\n thumbnailHash: folder.thumbnailHash,\n hasReviewables: folder.hasReviewables || false,\n hasVersions: folder.hasVersions || false,\n links: links,\n }\n\n // If folder is expanded, attach task subRows\n if (expandedFolderIds.has(folder.id)) {\n const folderTaskIds = tasksByFolderMap.get(folder.id) || []\n const folderTasks = folderTaskIds.flatMap((taskId) => tasksMap.get(taskId) || [])\n\n if (folderTasks.length || loadingTasks[folder.id]) {\n const taskRows = folderTasks.map((task) => createTaskRow(task, folder.id))\n\n if (loadingTasks[folder.id]) {\n const count = loadingTasks[folder.id]\n if (count > 0) {\n taskRows.push(...generateLoadingRows(count, { parentId: folder.id }))\n }\n }\n\n row.subRows = taskRows\n }\n }\n\n flatFolderRows.push(row)\n }\n\n flatFolderRows.push(...createRootTaskRows())\n\n return flatFolderRows\n }\n\n // If showHierarchy is false, create a flat list of task rows\n if (!showHierarchy) {\n const flatRows: TableRow[] = []\n\n // Loop through all tasks\n for (const task of tasksMap.values()) {\n if (!task.id) continue\n flatRows.push(createTaskRow(task))\n }\n\n // Loop through all extra rows\n for (const row of rows || []) {\n flatRows.push(row)\n }\n\n // if we are loading more tasks, add loading rows\n if (isLoadingMore) {\n // number of tasks we loading with the infinite query\n const count = TASKS_INFINITE_QUERY_COUNT\n if (count > 0) {\n const loadingTaskRows = generateLoadingRows(count, {\n type: 'task',\n })\n\n flatRows.push(...loadingTaskRows)\n }\n }\n\n return flatRows\n }\n\n // Use Map for O(1) lookups\n const rowsById = new Map<string, TableRow>()\n const rootRows: TableRow[] = []\n\n // Create minimal rows for only visible folders\n for (const folderId of visibleFolders) {\n const folder = foldersMap.get(folderId)\n if (!folder) continue\n\n const links = linksToTableData(folder.links, 'folder', project.anatomy)\n\n const folderTypeData = getEntityTypeData('folder', folder.folderType)\n\n // Create row with minimal required properties\n const row: TableRow = {\n id: folderId,\n entityType: 'folder',\n parentId: folder.parentId || undefined,\n folderId: folderId || null, // root folders have no folderId\n name: folder.name || '',\n label: folder.label || folder.name || '',\n icon: folderTypeData?.icon || null,\n color: folderTypeData?.color || null,\n img: null,\n subRows: [],\n status: folder.status,\n tags: folder.tags || [],\n subType: folder.folderType || null,\n ownAttrib: folder.ownAttrib || [],\n path: folder.path,\n folder: folder.parents[folder.parents.length - 1] || undefined,\n attrib: folder.attrib || {},\n childOnlyMatch: folder.childOnlyMatch || false,\n updatedAt: folder.updatedAt,\n createdAt: folder.createdAt,\n thumbnailHash: folder.thumbnailHash,\n hasReviewables: folder.hasReviewables || false,\n hasVersions: folder.hasVersions || false,\n links: links,\n }\n\n rowsById.set(folderId, row)\n\n // Add root rows directly to the rootRows array\n if (!folder.parentId || !foldersMap.has(folder.parentId)) {\n rootRows.push(row)\n }\n\n // Process tasks immediately if folder is expanded\n if (expandedFolderIds.has(folderId)) {\n // because tasksByFolderMap is a map of tasks by folder ID\n // we can directly get the tasks for the current folder\n const folderTaskIds = tasksByFolderMap.get(folderId) || []\n const folderTasks = folderTaskIds.flatMap((taskId) => tasksMap.get(taskId) || [])\n\n if (folderTasks.length || loadingTasks[folderId]) {\n // Use array literal with known length for better performance\n const taskRows = new Array<TableRow>(folderTasks.length)\n\n // Direct array assignment is faster than push operations\n for (let i = 0; i < folderTasks.length; i++) {\n taskRows[i] = createTaskRow(folderTasks[i], folderId)\n }\n\n // Add loading rows if applicable\n if (loadingTasks[folderId]) {\n const count = loadingTasks[folderId]\n if (count > 0) {\n const loadingTaskRows = generateLoadingRows(count, { parentId: folderId })\n\n taskRows.push(...loadingTaskRows)\n }\n }\n\n row.subRows = taskRows\n }\n }\n }\n\n // Build the folder hierarchy efficiently\n for (const folderId of visibleFolders) {\n const parentId = childToParentMap.get(folderId)\n if (!parentId || !expandedFolderIds.has(parentId)) continue\n\n const childRow = rowsById.get(folderId)\n const parentRow = rowsById.get(parentId)\n\n if (!childRow || !parentRow) continue\n\n // Add folder to its parent's subRows\n parentRow.subRows?.push(childRow)\n }\n\n rootRows.push(...createRootTaskRows())\n\n // if we are loading more tasks, add loading rows at the root level\n // this happens when in hierarchy mode but with a slicer selection that causes paginated tasks\n if (showHierarchy && isLoadingMore) {\n const count = TASKS_INFINITE_QUERY_COUNT\n if (count > 0) {\n rootRows.push(...generateLoadingRows(count, { type: 'task' }))\n }\n }\n\n // Add any extra rows to the root rows\n for (const row of rows || []) {\n rootRows.push(row)\n }\n\n return rootRows\n }, [\n foldersMap,\n tasksMap,\n tasksByFolderMap,\n rows,\n visibleFolders,\n childToParentMap,\n expandedFolderIds,\n showHierarchy,\n isFlatFolderView,\n showEmptyFolders,\n loadingTasks,\n isLoadingMore,\n selectedFolders,\n ])\n}\n"],"names":["TASKS_INFINITE_QUERY_COUNT","useBuildProjectDataTable","foldersMap","tasksMap","rows","tasksByFolderMap","expanded","showHierarchy","isFlatFolderView","showEmptyFolders","loadingTasks","isLoadingMore","selectedFolders","project","useProjectContext","getEntityTypeData","useGetEntityTypeData","expandedKey","useMemo","expandedFolderIds","_","isExpanded","id","childToParentMap","parentToChildrenMap","childToParent","parentToChildren","folder","parentId","children","visibleFolders","visible","queue","folderId","childrenIds","childId","createTaskRow","task","typeData","links","linksToTableData","createRootTaskRows","rootTaskRows","folderTaskIds","taskId","flatFolderRows","hasTasks","folderTypeData","row","folderTasks","taskRows","count","generateLoadingRows","flatRows","loadingTaskRows","rowsById","rootRows","i","childRow","parentRow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,IAA6B;AAsBnC,SAAwBC,GAAyB;AAAA,EAC/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AI,CAAC8B,KAAY,CAACC,KAGlBA,EAAU,SAAS,KAAKD,CAAQ;AAAA,IAClC;AAMA,QAJAF,EAAS,KAAK,GAAGf,GAAoB,GAIjClC,KAAiBI,GAAe;AAClC,YAAMwC,IAAQnD;AAEZ,MAAAwD,EAAS,KAAK,GAAGJ,EAAoBD,GAAO,EAAE,MAAM,OAAA,CAAQ,CAAC;AAAA,IAEjE;AAGA,eAAWH,KAAO5C,KAAQ;AACxB,MAAAoD,EAAS,KAAKR,CAAG;AAGnB,WAAOQ;AAAA,EACT,GAAG;AAAA,IACDtD;AAAA,IACAC;AAAA,IACAE;AAAA,IACAD;AAAA,IACA0B;AAAA,IACAP;AAAA,IACAJ;AAAA,IACAZ;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const x=require("react-toastify"),Q=require("../context/ProjectTableQueriesContext.cjs.js"),O=require("react"),R=require("../context/ProjectTableContext.cjs.js");require("../../../context/RemoteModulesContext.cjs.js");require("../../../../../_virtual/jsx-runtime.cjs.js");require("../../../../../_virtual/runtime.cjs.js");require("../../../../../_virtual/semver.cjs.js");require("../../../api/base/client.cjs.js");require("../../../api/generated/graphql.cjs.js");require("../../../api/generated/graphqlLinks.cjs.js");require("../../../api/generated/access.cjs.js");require("../../../api/generated/actions.cjs.js");require("../../../api/generated/activityFeed.cjs.js");require("../../../api/generated/addons.cjs.js");require("../../../api/generated/anatomy.cjs.js");require("../../../api/generated/attributes.cjs.js");require("../../../api/generated/authentication.cjs.js");require("../../../api/generated/bundles.cjs.js");require("../../../api/generated/configuration.cjs.js");require("../../../api/generated/dataImport.cjs.js");require("../../../api/generated/desktop.cjs.js");require("../../../api/generated/entityLists.cjs.js");require("../../../api/generated/events.cjs.js");require("../../../api/generated/files.cjs.js");require("../../../api/generated/folders.cjs.js");require("../../../api/generated/inbox.cjs.js");require("../../../api/generated/links.cjs.js");require("../../../api/generated/market.cjs.js");require("../../../api/generated/onboarding.cjs.js");require("../../../api/generated/operations.cjs.js");require("../../../api/generated/products.cjs.js");require("../../../api/generated/projectDashboard.cjs.js");require("../../../api/generated/projects.cjs.js");require("../../../api/generated/projectFolders.cjs.js");require("../../../api/generated/reviewables.cjs.js");require("../../../api/generated/services.cjs.js");require("../../../api/generated/system.cjs.js");require("../../../api/generated/tasks.cjs.js");require("../../../api/generated/teams.cjs.js");require("../../../api/generated/thumbnails.cjs.js");require("../../../api/generated/uRIs.cjs.js");require("../../../api/generated/users.cjs.js");require("../../../api/generated/versions.cjs.js");require("../../../api/generated/workfiles.cjs.js");require("../../../api/generated/ynputCloud.cjs.js");require("../../../api/generated/grouping.cjs.js");require("../../../api/generated/views.cjs.js");require("../../../api/queries/actions/getActions.cjs.js");require("../../../api/queries/activities/getActivities.cjs.js");require("../../../api/queries/activities/updateReaction.cjs.js");require("../../../api/queries/activities/getMentions.cjs.js");require("../../../api/queries/activities/getCategories.cjs.js");require("../../../api/queries/addons/getAddons.cjs.js");require("../../../api/queries/addons/updateAddons.cjs.js");require("../../../api/queries/attributes/getAttributes.cjs.js");require("../../../api/queries/attributes/updateAttributes.cjs.js");require("../../../api/queries/authentication/getAuthentication.cjs.js");require("../../../api/queries/bundles/getBundles.cjs.js");require("../../../api/queries/bundles/updateBundles.cjs.js");require("../../../api/queries/cloud/cloud.cjs.js");require("../../../api/queries/columnStats/metricTargets.cjs.js");require("../../../api/queries/columnStats/groupCounts.cjs.js");require("../../../api/queries/config/getConfig.cjs.js");require("../../../api/queries/config/updateConfig.cjs.js");require("../../../api/queries/entities/getEntity.cjs.js");require("../../../api/queries/entities/getEntityPanel.cjs.js");require("../../../api/queries/overview/getOverview.cjs.js");require("../../../api/queries/overview/updateOverview.cjs.js");require("../../../api/queries/versions/getVersionsProducts.cjs.js");require("../../../api/queries/links/getEntityLinks.cjs.js");require("../../../api/queries/entities/updateEntity.cjs.js");require("../../../api/queries/entityLists/getLists.cjs.js");require("../../../api/queries/entityLists/updateLists.cjs.js");require("../../../api/queries/entityLists/getListsAttributes.cjs.js");require("../../../api/queries/entityLists/listItemsColumnStats.cjs.js");require("../../../api/queries/entityLists/updateListsAttributes.cjs.js");require("../../../api/queries/entityLists/listFolders.cjs.js");require("../../../api/queries/folders/getFolders.cjs.js");require("../../../api/queries/folders/getFolderDeleteInfo.cjs.js");require("../../../api/queries/grouping/getGrouping.cjs.js");require("../../../api/queries/links/updateLinks.cjs.js");require("../../../api/queries/links/getLinks.cjs.js");require("../../../api/queries/permissions/getPermissions.cjs.js");require("../../../api/queries/products/createProduct.cjs.js");require("../../../api/queries/products/getFolderProducts.cjs.js");require("../../../api/queries/project/getProject.cjs.js");require("../../../api/queries/project/updateProject.cjs.js");require("../../../api/queries/projectFolders/projectFolders.cjs.js");require("../../../api/queries/review/getReview.cjs.js");require("../../../api/queries/review/updateReview.cjs.js");require("../../../api/queries/share/share.cjs.js");require("../../../api/queries/system/getSystem.cjs.js");require("../../../api/queries/tasks/getTasks.cjs.js");require("../../../api/queries/tasks/updateTasks.cjs.js");require("../../../api/queries/teams/getTeams.cjs.js");require("../../../api/queries/userDashboard/getUserDashboard.cjs.js");require("../../../api/queries/users/getUsers.cjs.js");require("../../../api/queries/users/updateUsers.cjs.js");require("../../../api/queries/users/guests.cjs.js");require("../../../api/queries/versions/updateVersions.cjs.js");require("../../../api/queries/views/getViews.cjs.js");require("../../../api/queries/views/updateViews.cjs.js");require("../../../api/queries/watchers/getWatchers.cjs.js");require("../../../api/queries/uris/getUris.cjs.js");require("lodash");require("react-redux");require("custom-protocol-check");require("../components/GroupSettingsFallback.cjs.js");require("uuid");require("../../../util/pubsub.cjs.js");require("../../../context/PowerpackContextInstance.cjs.js");require("../../../context/UriContext.cjs.js");require("../../../context/DetailsPanelContextInstance.cjs.js");require("../../../context/SubtasksModulesContextInstance.cjs.js");require("../../../context/ThumbnailUploaderContext.cjs.js");require("../../../context/SettingsPanelContext.cjs.js");require("../../../context/pip/PiPProvider.cjs.js");require("react-dom");require("../../../context/pip/PiPWrapper.cjs.js");require("../../../context/AddonProjectContext.cjs.js");require("../../../context/AddonContext.cjs.js");require("../../../context/MenuContext.cjs.js");require("../../../context/WebsocketContext.cjs.js");require("../../../context/GlobalContext.cjs.js");const B=require("../../../context/ProjectContext.cjs.js");require("../../../context/ProjectFoldersContextInstance.cjs.js");require("../../../context/EntityUpdatesContextInstance.cjs.js");require("../../ContextMenu/ContextMenuContext.cjs.js");require("@ynput/ayon-react-components");;/* empty css */require("clsx");require("../../Feed/context/FeedContext.cjs.js");require("../../Feed/components/Tooltips/UserTooltipItem.cjs.js");require("../../Feed/components/Tooltips/UserTooltip/UserTooltip.styled.cjs.js");require("../../Feed/components/Tooltips/TeamTooltip/TeamTooltip.styled.cjs.js");require("../../Feed/components/Tooltips/EntityTooltip/EntityTooltip.styled.cjs.js");require("../../Feed/components/FileUploadPreview/FileUploadPreview.styled.cjs.js");require("../../Feed/components/FileUploadPreview/Mimes/TextMime.cjs.js");require("react-markdown");require("remark-emoji");require("remark-gfm");require("remark-directive");require("remark-directive-rehype");require("../../Feed/components/CommentInput/CommentInput.cjs.js");require("../../Feed/components/ReactionContainer/Reactions.styled.cjs.js");require("../../Feed/components/FilesGrid/FilesGrid.styled.cjs.js");require("../../Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js");require("../../Feed/components/CommentInput/quillToMarkdown.cjs.js");require("../../Feed/components/ActivityComment/ActivityComment.styled.cjs.js");require("../../Feed/components/ActivityCheckbox/ActivityCheckbox.styled.cjs.js");require("../../../components/AddonLoadingScreen/AddonLoadingScreen.cjs.js");require("../../../../../node_modules/match-sorter/dist/match-sorter.esm.cjs.js");require("../../../components/AccessSearchInput/AccessSearchInput.styled.cjs.js");require("../../../components/AccessUser/AccessUser.cjs.js");require("../../../components/AttributeEditor/AttributeEditor.cjs.js");require("../../../components/AttributeEditor/attributeTypeMap.cjs.js");require("../../../components/Badge/Badge.cjs.js");require("../../../components/Chips/Chips.cjs.js");require("date-fns");require("../../../components/DateRangePicker/DateRangePicker.styled.cjs.js");require("../../../components/LinksManager/CellEditingDialog.cjs.js");require("../../../components/DeleteEntitiesConfirm/DeleteConfirmContent.cjs.js");require("../../../components/DeleteEntitiesConfirm/DeleteEntitiesConfirmDialog.styled.cjs.js");require("../../../../../_virtual/index.cjs.js");require("../../../../../node_modules/refractor/lib/common.cjs.js");require("../../../../../node_modules/refractor/lib/all.cjs.js");;/* empty css */require("../../../components/DetailsPanelAttributes/DetailsPanelAttributesEditor.cjs.js");require("../../../components/DetailsPanelDetails/DetailsPanelDetails.cjs.js");require("react-quill-ayon");require("../../../components/DetailsPanelDetails/BorderedSection.cjs.js");require("../../../components/QuillListStyles/QuillListStyles.cjs.js");require("../../../components/DetailsPanelDetails/DescriptionSection.styles.cjs.js");require("rehype-raw");require("../../../components/DetailsPanelDetails/hooks/useMentionSystem.cjs.js");require("../../Feed/components/CommentInput/modules/index.cjs.js");require("../../../components/DetailsPanelDetails/DetailsSection.cjs.js");require("../../../components/DetailsPanelDetails/FieldLabel.cjs.js");require("../../../components/DoneCheckbox/DoneCheckbox.cjs.js");require("../../../components/EarlyPreview/EarlyPreview.cjs.js");require("../../../components/EmptyPlaceholder/EmptyPlaceholder.cjs.js");require("../../../components/EmptyPlaceholder/EmptyPlaceholderFlex.styled.cjs.js");require("../../../components/InfoMessage/InfoMessage.cjs.js");require("@dnd-kit/core");require("@dnd-kit/sortable");require("../../../components/EnumEditor/EnumEditor.styled.cjs.js");require("../../../components/EntityPanelUploader/EntityPanelUploader.styled.cjs.js");require("axios");require("../../../components/ReviewablesList/ReviewablesList.styled.cjs.js");require("../../../components/ReviewablesList/ReviewablesUpload.styled.cjs.js");require("../../../components/EntityPath/EntityPath.styled.cjs.js");require("../../../components/EntityPath/SegmentProvider.cjs.js");require("../../../components/FeaturedVersionOrder/FeaturedVersionOrder.cjs.js");require("../../../components/Feedback/FeedbackContextInstance.cjs.js");require("../../../components/Feedback/SupportBubble.cjs.js");require("../../../components/FileThumbnail/FileThumbnail.cjs.js");require("../../../components/LegacyBadge/LegacyBadge.cjs.js");require("../../../components/LinksManager/LinksManager.styled.cjs.js");require("../../EntityPickerDialog/EntityPickerDialog.cjs.js");require("../../../components/Powerpack/PowerpackButton.cjs.js");require("../../../components/Powerpack/FreeTrialLink.cjs.js");require("../../../components/Powerpack/PowerpackDialog.styled.cjs.js");require("../../../components/Powerpack/CTAButton.cjs.js");require("../../../components/Powerpack/RequiredAddonVersion.cjs.js");require("../../../components/ProjectTableSettings/ProjectTableSettings.cjs.js");require("../../../components/SizeSlider/SizeSlider.cjs.js");require("react-router-dom");require("../../Slicer/components/Slicer.cjs.js");require("../../Slicer/context/SlicerContextInstance.cjs.js");require("../../Slicer/components/SlicerDropdownFallback.cjs.js");require("../../NewEntity/components/NewEntity.cjs.js");require("@tanstack/react-virtual");require("@tanstack/react-table");require("../widgets/CollapsedWidget.cjs.js");require("../widgets/DateWidget.cjs.js");require("../widgets/EnumWidget.cjs.js");require("../widgets/EnumCellValue.cjs.js");require("../widgets/TextWidget.cjs.js");require("../widgets/MarkdownWidget.cjs.js");require("../widgets/BooleanWidget.cjs.js");require("../widgets/CellWidget.cjs.js");require("../widgets/EntityNameWidget.cjs.js");require("../widgets/GroupHeaderWidget.cjs.js");require("../widgets/ThumbnailWidget.cjs.js");require("../widgets/LinksWidget.cjs.js");require("../widgets/EmptyWidget.cjs.js");require("../widgets/ErrorWidget.cjs.js");require("../context/CellEditingContext.cjs.js");require("../../../components/SearchFilter/filterDates.cjs.js");require("short-uuid");require("../context/SelectionCellsContext.cjs.js");require("../context/ClipboardContext.cjs.js");require("../context/ColumnSettingsContext.cjs.js");require("../context/SelectedRowsContext.cjs.js");require("../context/DetailsPanelEntityContext.cjs.js");require("../context/ProjectDataContextInstance.cjs.js");require("../ProjectTreeTable.styled.cjs.js");require("../components/SelectionCell.cjs.js");require("../components/RowSelectionHeader.cjs.js");require("../widgets/LoadMoreWidget.cjs.js");require("../components/HeaderActionButton.cjs.js");require("../components/TableFooterRow.cjs.js");require("../../NewEntity/context/NewEntityContextInstance.cjs.js");require("../../NewEntity/components/NewEntityForm.cjs.js");require("../../Slicer/hooks/useTableDataBySlice.cjs.js");require("../../../components/ReviewableCard/ReviewableCard.cjs.js");require("../../../components/ReviewableProgressCard/ReviewableProgressCard.styled.cjs.js");require("../../../components/SearchFilter/CustomDateRangeDialog.cjs.js");require("../../../components/SettingsPanel/SettingsPanel.cjs.js");require("../../../components/SettingsPanel/SettingsPanelItemTemplate.cjs.js");require("../../../components/ShareOptionIcon/ShareOptionIcon.cjs.js");require("../../../components/SimpleFormDialog/SimpleFormDialog.cjs.js");require("../../../components/StyledLink/StyledLink.cjs.js");require("../../../components/SyncButton/SyncButton.cjs.js");require("../../../components/TableGridSwitch/TableGridSwitch.cjs.js");require("../../../components/Thumbnail/Thumbnail.styled.cjs.js");require("../../../components/Thumbnail/StackedThumbnails.cjs.js");require("../../../components/ThumbnailSimple/ThumbnailSimple.cjs.js");require("../../../components/VersionUploader/components/UploadVersionDialog.cjs.js");require("../../../components/VersionUploader/context/VersionUploadContextInstance.cjs.js");require("../../../components/Watchers/Watchers.cjs.js");require("../../../components/Menu/Menu.styled.cjs.js");require("../../../components/Menu/MenuItem.cjs.js");require("../../../components/ReviewablesSelector/ReviewablesSelector.cjs.js");require("../../../components/ColumnHeaderMenuUI.cjs.js");require("../../Feed/components/ActivityReference/ActivityReference.styled.cjs.js");require("../../Feed/components/ActivityStatus/ActivityStatus.cjs.js");require("../../Feed/components/ActivityHeader/ActivityHeader.styled.cjs.js");require("../../Feed/components/ActivityDate.cjs.js");require("../../Feed/components/ActivityVersionReview/ActivityVersionReview.styled.cjs.js");require("../../Feed/components/ActivityCategorySelect/ActivityCategorySelect.cjs.js");require("../../Feed/components/ActivityCategorySelect/CategoryDropdownItem.cjs.js");require("../../Feed/components/ActivityCategorySelect/CategoryTag.cjs.js");require("../../Feed/components/ActivityFieldChange/ActivityFieldChange.styled.cjs.js");require("../../Feed/components/ActivityFieldChange/FieldValue.cjs.js");require("../../Feed/components/ActivityAssigneeChange/ActivityAssigneeChange.styled.cjs.js");require("../../Feed/components/ActivityVersions/ActivityVersions.styled.cjs.js");require("../../Feed/components/ActivityGroup/ActivityGroup.styled.cjs.js");require("../../Feed/Feed.styled.cjs.js");require("../../Feed/components/FeedSearchFilter.cjs.js");require("../../DetailsPanel/DetailsPanel.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelTabs/DetailsPanelTabs.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelHeader/LinkedTaskRow.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelHeader/DetailsPanelHeader.styled.cjs.js");require("../../../components/PlayableIcon/PlayableIcon.cjs.js");require("../../DetailsPanel/components/DetailsPanelFiles/DetailsPanelFiles.cjs.js");require("../../DetailsPanel/components/DetailsPanelMoreMenu/components/ShareDialog.cjs.js");require("../../DetailsPanel/components/TabHeaderAndFilters/TabHeaderAndFilters.styled.cjs.js");require("../../DetailsPanel/components/SubtasksSearchFilter/SubtasksSearchFilter.cjs.js");require("../../DetailsPanel/components/DetailsPanelSlideOut/DetailsPanelSlideOut.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelFloating/DetailsPanelFloating.styled.cjs.js");require("../../Actions/Actions.styled.cjs.js");require("../../Actions/ActionsDropdown/ActionsDropdown.cjs.js");require("../../Actions/ActionIcon.cjs.js");require("../../Views/ViewsMenu/ViewsMenu.cjs.js");require("../../Views/context/ViewsContextInstance.cjs.js");require("../../Views/Views.styled.cjs.js");require("../../Views/ViewsMenuContainer/ViewsMenuContainer.cjs.js");require("../../ListTable/ListTableRow.cjs.js");require("../../ListTable/ListTable.styled.cjs.js");require("../../../context/DeleteEntitiesContext.cjs.js");const j=($,a,p)=>{switch($){case"unique-violation":return`${a} with the name "${p}" already exists`;case"not-null-violation":return`${a} "${p}" is missing required fields`;case"foreign-key-violation":return`${a} "${p}" references invalid data`;case"integrity-constraint-violation":return`${a} "${p}" violates data integrity rules`;default:return`Failed to update ${a}: ${p}`}},L=$=>{const{pushHistory:a,removeHistoryEntries:p}=$||{},{projectName:v}=B.useProjectContext(),{getEntityById:g,getInheritedDependents:C,findInheritedValueFromAncestors:k,findNonInheritedValues:U}=R.useProjectTableContext(),{updateEntities:F}=Q.useProjectTableQueriesContext(),V=O.useCallback(async(b=[],D=!0)=>{if(!b.length||!v)return;let h=b.filter(e=>!e.isLink);const m=h.filter(e=>!(e.field==="folderType"&&e.type==="folder"&&g(e.id)?.hasVersions)),A=h.length-m.length;if(A>0&&x.toast.error(`Cannot change folder type for ${A} folder${A>1?"s":""} with published versions`),h=m,!h.length)return;if(a&&D){const e=h.map(({rowId:s,id:i,type:n,field:u,isAttrib:y,meta:I})=>{const d=g(i);if(!d)throw"Entity not found: "+i;const o=d?.entityId||d.id,w=y?d.attrib?.[u]??null:d[u]??null,E=d?.ownAttrib||[],f=y&&!E.includes(u);return{rowId:s,id:o,type:n,field:u,value:w,isAttrib:y,wasInherited:f,ownAttrib:E,folderId:d?.folderId||d?.parentId,meta:I}}),c=h.flatMap(({rowId:s,id:i,type:n,field:u,value:y,isAttrib:I,meta:d})=>{const o=g(i),w=o?.entityId||o?.id||i;return o?{rowId:s,id:w,type:n,field:u,value:y,isAttrib:I,ownAttrib:o?.ownAttrib||[],folderId:"folderId"in o?o.folderId:o?.parentId,meta:d}:[]});a(e,c)}const T=["task","folder","product","version"];let r=[];for(const e of h){let{id:c,type:s,field:i,value:n,isAttrib:u,meta:y}=e;const I=g(c),d=I?.entityId||I?.id||c;let o=s;if(!T.includes(o))continue;const w=u?{attrib:{[i]:n}}:{[i]:n};if(u){const f=[...I?.ownAttrib||[]];f.includes(i)||f.push(i),w.ownAttrib=f}const E=r.findIndex(f=>f.entityId===d&&f.entityType===o);if(E!==-1){const f=r[E];let P={...f.data,...w};f.data?.attrib&&w.attrib&&(P={...P,attrib:{...f.data.attrib,...w.attrib}}),r[E]={...f,data:P}}else r.push({entityType:o,entityId:d,rowId:e.rowId,type:"update",data:w,meta:y})}const l=r.filter(e=>!!e.entityId&&e.type==="update"&&e.data&&"attrib"in e.data).map(e=>({entityId:e.entityId,entityType:e.entityType,attrib:e.data&&"attrib"in e.data?e.data?.attrib:{}})),q=C(l).map(e=>({entityId:e.entityId,entityType:e.entityType,data:{attrib:e.attrib}}));try{r.length&&await F({operations:r,patchOperations:q})}catch(e){console.error("Error updating entities:",e),r.length===1?e.errorCodes.forEach(c=>{const s=r[0],i=g(s.entityId),n=i?.label||i?.name||s.entityId||"",u=j(c,s.entityType,n);x.toast.error(u)}):x.toast.error("Failed to update entities"),a&&D&&p&&p(1)}},[v,F,g,C,a,p]),M=O.useCallback(async(b,D=!0)=>{if(!b.length||!v)return;if(D&&a){const r=[];for(const t of b){const q=g(t.entityId);for(const e of t.attribs)q?.attrib&&e in q.attrib&&r.push({rowId:t.rowId,id:q?.entityId||q?.id||t.entityId,type:t.entityType,field:e,value:q.attrib[e],isAttrib:!0,wasInherited:!1,ownAttrib:q?.ownAttrib||[],folderId:q?.folderId,meta:q.meta})}const l=b.flatMap(t=>t.attribs.map(q=>({rowId:t.rowId,id:t.entityId,type:t.entityType,field:q,value:null,isAttrib:!0,wasInherited:!0,ownAttrib:t.ownAttrib,folderId:t.folderId,meta:t.meta})));r.length>0&&a(r,l)}const h=["task","folder"],m=[],A=[];for(const r of b){let l=r.entityType;if(!h.includes(l))continue;l=l;const t={};r.attribs.forEach(n=>{t[n]=null}),m.push({entityType:l,entityId:r.entityId,rowId:r.rowId,type:"update",data:{attrib:t},meta:r.meta});const e=(()=>{const n=r.folderId,u=[];let y=n,I=b.find(o=>o.entityId===y);for(;I;)u.push(I),y=I.folderId,I=b.find(o=>o.entityId===y);return u.length>0?u[u.length-1]:null})(),c=e?.attribs||[],s=r.attribs.filter(n=>c.includes(n)),i=r.attribs.filter(n=>!c.includes(n));i.length>0&&A.push({...r,attribs:i}),e&&s.length>0&&A.push({...r,attribs:s,folderId:e.folderId})}const T=[];for(const r of A){const l=r.entityType,t=[...r.ownAttrib||[]].filter(i=>!r.attribs.includes(i)),q=U(r.folderId,r.attribs),e={entityId:r.entityId,entityType:l,data:{attrib:q,ownAttrib:t}};T.push(e);const s=C([{entityId:r.entityId,entityType:l,attrib:q}]).map(i=>({entityId:i.entityId,entityType:i.entityType,data:{attrib:i.attrib}}));for(const i of s){const n=T.findIndex(u=>u.entityId===i.entityId);if(n!==-1){const u=T[n];let y={...u.data?.attrib||{},...i.data?.attrib||{}};T[n]={...u,data:{attrib:y}}}else T.push({entityId:i.entityId,entityType:i.entityType,data:i.data})}}try{await F({operations:m,patchOperations:T})}catch(r){m.length===1?r.errorCodes.forEach(l=>{const t=m[0],q=g(t.entityId),e=q?.label||q?.name||t.entityId||"",c=j(l,t.entityType,e);x.toast.error(c)}):x.toast.error("Failed to update entities"),D&&a&&p&&p(1)}},[v,F,C,k,a,p]);return{updateEntities:V,inheritFromParent:M}};module.exports=L;
|
|
1
|
+
"use strict";const C=require("react-toastify"),N=require("../context/ProjectTableQueriesContext.cjs.js"),j=require("react"),Q=require("../context/ProjectTableContext.cjs.js");require("../../../context/RemoteModulesContext.cjs.js");require("../../../../../_virtual/jsx-runtime.cjs.js");require("../../../../../_virtual/runtime.cjs.js");require("../../../../../_virtual/semver.cjs.js");require("../../../api/base/client.cjs.js");require("../../../api/generated/graphql.cjs.js");require("../../../api/generated/graphqlLinks.cjs.js");require("../../../api/generated/access.cjs.js");require("../../../api/generated/actions.cjs.js");require("../../../api/generated/activityFeed.cjs.js");require("../../../api/generated/addons.cjs.js");require("../../../api/generated/anatomy.cjs.js");require("../../../api/generated/attributes.cjs.js");require("../../../api/generated/authentication.cjs.js");require("../../../api/generated/bundles.cjs.js");require("../../../api/generated/configuration.cjs.js");require("../../../api/generated/dataImport.cjs.js");require("../../../api/generated/desktop.cjs.js");require("../../../api/generated/entityLists.cjs.js");require("../../../api/generated/events.cjs.js");require("../../../api/generated/files.cjs.js");require("../../../api/generated/folders.cjs.js");require("../../../api/generated/inbox.cjs.js");require("../../../api/generated/links.cjs.js");require("../../../api/generated/market.cjs.js");require("../../../api/generated/onboarding.cjs.js");require("../../../api/generated/operations.cjs.js");require("../../../api/generated/products.cjs.js");require("../../../api/generated/projectDashboard.cjs.js");require("../../../api/generated/projects.cjs.js");require("../../../api/generated/projectFolders.cjs.js");require("../../../api/generated/reviewables.cjs.js");require("../../../api/generated/services.cjs.js");require("../../../api/generated/system.cjs.js");require("../../../api/generated/tasks.cjs.js");require("../../../api/generated/teams.cjs.js");require("../../../api/generated/thumbnails.cjs.js");require("../../../api/generated/uRIs.cjs.js");require("../../../api/generated/users.cjs.js");require("../../../api/generated/versions.cjs.js");require("../../../api/generated/workfiles.cjs.js");require("../../../api/generated/ynputCloud.cjs.js");require("../../../api/generated/grouping.cjs.js");require("../../../api/generated/views.cjs.js");require("../../../api/queries/actions/getActions.cjs.js");require("../../../api/queries/activities/getActivities.cjs.js");require("../../../api/queries/activities/updateReaction.cjs.js");require("../../../api/queries/activities/getMentions.cjs.js");require("../../../api/queries/activities/getCategories.cjs.js");require("../../../api/queries/addons/getAddons.cjs.js");require("../../../api/queries/addons/updateAddons.cjs.js");require("../../../api/queries/attributes/getAttributes.cjs.js");require("../../../api/queries/attributes/updateAttributes.cjs.js");require("../../../api/queries/authentication/getAuthentication.cjs.js");require("../../../api/queries/bundles/getBundles.cjs.js");require("../../../api/queries/bundles/updateBundles.cjs.js");require("../../../api/queries/cloud/cloud.cjs.js");require("../../../api/queries/columnStats/metricTargets.cjs.js");require("../../../api/queries/columnStats/groupCounts.cjs.js");require("../../../api/queries/config/getConfig.cjs.js");require("../../../api/queries/config/updateConfig.cjs.js");require("../../../api/queries/entities/getEntity.cjs.js");require("../../../api/queries/entities/getEntityPanel.cjs.js");require("../../../api/queries/overview/getOverview.cjs.js");require("../../../api/queries/overview/updateOverview.cjs.js");require("../../../api/queries/versions/getVersionsProducts.cjs.js");require("../../../api/queries/links/getEntityLinks.cjs.js");require("../../../api/queries/entities/updateEntity.cjs.js");require("../../../api/queries/entityLists/getLists.cjs.js");require("../../../api/queries/entityLists/updateLists.cjs.js");require("../../../api/queries/entityLists/getListsAttributes.cjs.js");require("../../../api/queries/entityLists/listItemsColumnStats.cjs.js");require("../../../api/queries/entityLists/updateListsAttributes.cjs.js");require("../../../api/queries/entityLists/listFolders.cjs.js");require("../../../api/queries/folders/getFolders.cjs.js");require("../../../api/queries/folders/getFolderDeleteInfo.cjs.js");require("../../../api/queries/grouping/getGrouping.cjs.js");require("../../../api/queries/links/updateLinks.cjs.js");require("../../../api/queries/links/getLinks.cjs.js");require("../../../api/queries/permissions/getPermissions.cjs.js");require("../../../api/queries/products/createProduct.cjs.js");require("../../../api/queries/products/getFolderProducts.cjs.js");require("../../../api/queries/project/getProject.cjs.js");require("../../../api/queries/project/updateProject.cjs.js");require("../../../api/queries/projectFolders/projectFolders.cjs.js");require("../../../api/queries/review/getReview.cjs.js");require("../../../api/queries/review/updateReview.cjs.js");require("../../../api/queries/share/share.cjs.js");require("../../../api/queries/system/getSystem.cjs.js");require("../../../api/queries/tasks/getTasks.cjs.js");require("../../../api/queries/tasks/updateTasks.cjs.js");require("../../../api/queries/teams/getTeams.cjs.js");require("../../../api/queries/userDashboard/getUserDashboard.cjs.js");require("../../../api/queries/users/getUsers.cjs.js");require("../../../api/queries/users/updateUsers.cjs.js");require("../../../api/queries/users/guests.cjs.js");require("../../../api/queries/versions/updateVersions.cjs.js");require("../../../api/queries/views/getViews.cjs.js");require("../../../api/queries/views/updateViews.cjs.js");require("../../../api/queries/watchers/getWatchers.cjs.js");require("../../../api/queries/uris/getUris.cjs.js");require("lodash");require("react-redux");require("custom-protocol-check");require("../components/GroupSettingsFallback.cjs.js");require("uuid");require("../../../util/pubsub.cjs.js");require("../../../context/PowerpackContextInstance.cjs.js");require("../../../context/UriContext.cjs.js");require("../../../context/DetailsPanelContextInstance.cjs.js");require("../../../context/SubtasksModulesContextInstance.cjs.js");require("../../../context/ThumbnailUploaderContext.cjs.js");require("../../../context/SettingsPanelContext.cjs.js");require("../../../context/pip/PiPProvider.cjs.js");require("react-dom");require("../../../context/pip/PiPWrapper.cjs.js");require("../../../context/AddonProjectContext.cjs.js");require("../../../context/AddonContext.cjs.js");require("../../../context/MenuContext.cjs.js");require("../../../context/WebsocketContext.cjs.js");require("../../../context/GlobalContext.cjs.js");const R=require("../../../context/ProjectContext.cjs.js");require("../../../context/ProjectFoldersContextInstance.cjs.js");require("../../../context/EntityUpdatesContextInstance.cjs.js");require("../../ContextMenu/ContextMenuContext.cjs.js");require("@ynput/ayon-react-components");;/* empty css */require("clsx");require("../../Feed/context/FeedContext.cjs.js");require("../../Feed/components/Tooltips/UserTooltipItem.cjs.js");require("../../Feed/components/Tooltips/UserTooltip/UserTooltip.styled.cjs.js");require("../../Feed/components/Tooltips/TeamTooltip/TeamTooltip.styled.cjs.js");require("../../Feed/components/Tooltips/EntityTooltip/EntityTooltip.styled.cjs.js");require("../../Feed/components/FileUploadPreview/FileUploadPreview.styled.cjs.js");require("../../Feed/components/FileUploadPreview/Mimes/TextMime.cjs.js");require("react-markdown");require("remark-emoji");require("remark-gfm");require("remark-directive");require("remark-directive-rehype");require("../../Feed/components/CommentInput/CommentInput.cjs.js");require("../../Feed/components/ReactionContainer/Reactions.styled.cjs.js");require("../../Feed/components/FilesGrid/FilesGrid.styled.cjs.js");require("../../Feed/components/FileUploadCard/FileUploadCard.styled.cjs.js");require("../../Feed/components/CommentInput/quillToMarkdown.cjs.js");require("../../Feed/components/ActivityComment/ActivityComment.styled.cjs.js");require("../../Feed/components/ActivityCheckbox/ActivityCheckbox.styled.cjs.js");require("../../../components/AddonLoadingScreen/AddonLoadingScreen.cjs.js");require("../../../../../node_modules/match-sorter/dist/match-sorter.esm.cjs.js");require("../../../components/AccessSearchInput/AccessSearchInput.styled.cjs.js");require("../../../components/AccessUser/AccessUser.cjs.js");require("../../../components/AttributeEditor/AttributeEditor.cjs.js");require("../../../components/AttributeEditor/attributeTypeMap.cjs.js");require("../../../components/Badge/Badge.cjs.js");require("../../../components/Chips/Chips.cjs.js");require("date-fns");require("../../../components/DateRangePicker/DateRangePicker.styled.cjs.js");require("../../../components/LinksManager/CellEditingDialog.cjs.js");require("../../../components/DeleteEntitiesConfirm/DeleteConfirmContent.cjs.js");require("../../../components/DeleteEntitiesConfirm/DeleteEntitiesConfirmDialog.styled.cjs.js");require("../../../../../_virtual/index.cjs.js");require("../../../../../node_modules/refractor/lib/common.cjs.js");require("../../../../../node_modules/refractor/lib/all.cjs.js");;/* empty css */require("../../../components/DetailsPanelAttributes/DetailsPanelAttributesEditor.cjs.js");require("../../../components/DetailsPanelDetails/DetailsPanelDetails.cjs.js");require("react-quill-ayon");require("../../../components/DetailsPanelDetails/BorderedSection.cjs.js");require("../../../components/QuillListStyles/QuillListStyles.cjs.js");require("../../../components/DetailsPanelDetails/DescriptionSection.styles.cjs.js");require("rehype-raw");require("../../../components/DetailsPanelDetails/hooks/useMentionSystem.cjs.js");require("../../Feed/components/CommentInput/modules/index.cjs.js");require("../../../components/DetailsPanelDetails/DetailsSection.cjs.js");require("../../../components/DetailsPanelDetails/FieldLabel.cjs.js");require("../../../components/DoneCheckbox/DoneCheckbox.cjs.js");require("../../../components/EarlyPreview/EarlyPreview.cjs.js");require("../../../components/EmptyPlaceholder/EmptyPlaceholder.cjs.js");require("../../../components/EmptyPlaceholder/EmptyPlaceholderFlex.styled.cjs.js");require("../../../components/InfoMessage/InfoMessage.cjs.js");require("@dnd-kit/core");require("@dnd-kit/sortable");require("../../../components/EnumEditor/EnumEditor.styled.cjs.js");require("../../../components/EntityPanelUploader/EntityPanelUploader.styled.cjs.js");require("axios");require("../../../components/ReviewablesList/ReviewablesList.styled.cjs.js");require("../../../components/ReviewablesList/ReviewablesUpload.styled.cjs.js");require("../../../components/EntityPath/EntityPath.styled.cjs.js");require("../../../components/EntityPath/SegmentProvider.cjs.js");require("../../../components/FeaturedVersionOrder/FeaturedVersionOrder.cjs.js");require("../../../components/Feedback/FeedbackContextInstance.cjs.js");require("../../../components/Feedback/SupportBubble.cjs.js");require("../../../components/FileThumbnail/FileThumbnail.cjs.js");require("../../../components/LegacyBadge/LegacyBadge.cjs.js");require("../../../components/LinksManager/LinksManager.styled.cjs.js");require("../../EntityPickerDialog/EntityPickerDialog.cjs.js");require("../../../components/Powerpack/PowerpackButton.cjs.js");require("../../../components/Powerpack/FreeTrialLink.cjs.js");require("../../../components/Powerpack/PowerpackDialog.styled.cjs.js");require("../../../components/Powerpack/CTAButton.cjs.js");require("../../../components/Powerpack/RequiredAddonVersion.cjs.js");require("../../../components/ProjectTableSettings/ProjectTableSettings.cjs.js");require("../../../components/SizeSlider/SizeSlider.cjs.js");require("react-router-dom");require("../../Slicer/components/Slicer.cjs.js");require("../../Slicer/context/SlicerContextInstance.cjs.js");require("../../Slicer/components/SlicerDropdownFallback.cjs.js");require("../../NewEntity/components/NewEntity.cjs.js");require("@tanstack/react-virtual");require("@tanstack/react-table");require("../widgets/CollapsedWidget.cjs.js");require("../widgets/DateWidget.cjs.js");require("../widgets/EnumWidget.cjs.js");require("../widgets/EnumCellValue.cjs.js");require("../widgets/TextWidget.cjs.js");require("../widgets/MarkdownWidget.cjs.js");require("../widgets/BooleanWidget.cjs.js");require("../widgets/CellWidget.cjs.js");require("../widgets/EntityNameWidget.cjs.js");require("../widgets/GroupHeaderWidget.cjs.js");require("../widgets/ThumbnailWidget.cjs.js");require("../widgets/LinksWidget.cjs.js");require("../widgets/EmptyWidget.cjs.js");require("../widgets/ErrorWidget.cjs.js");require("../context/CellEditingContext.cjs.js");require("../../../components/SearchFilter/filterDates.cjs.js");require("short-uuid");require("../context/SelectionCellsContext.cjs.js");require("../context/ClipboardContext.cjs.js");require("../context/ColumnSettingsContext.cjs.js");require("../context/SelectedRowsContext.cjs.js");require("../context/DetailsPanelEntityContext.cjs.js");require("../context/ProjectDataContextInstance.cjs.js");require("../ProjectTreeTable.styled.cjs.js");require("../components/SelectionCell.cjs.js");require("../components/RowSelectionHeader.cjs.js");require("../widgets/LoadMoreWidget.cjs.js");require("../components/HeaderActionButton.cjs.js");require("../components/TableFooterRow.cjs.js");require("../../NewEntity/context/NewEntityContextInstance.cjs.js");require("../../NewEntity/components/NewEntityForm.cjs.js");require("../../Slicer/hooks/useTableDataBySlice.cjs.js");require("../../../components/ReviewableCard/ReviewableCard.cjs.js");require("../../../components/ReviewableProgressCard/ReviewableProgressCard.styled.cjs.js");require("../../../components/SearchFilter/CustomDateRangeDialog.cjs.js");require("../../../components/SettingsPanel/SettingsPanel.cjs.js");require("../../../components/SettingsPanel/SettingsPanelItemTemplate.cjs.js");require("../../../components/ShareOptionIcon/ShareOptionIcon.cjs.js");require("../../../components/SimpleFormDialog/SimpleFormDialog.cjs.js");require("../../../components/StyledLink/StyledLink.cjs.js");require("../../../components/SyncButton/SyncButton.cjs.js");require("../../../components/TableGridSwitch/TableGridSwitch.cjs.js");require("../../../components/Thumbnail/Thumbnail.styled.cjs.js");require("../../../components/Thumbnail/StackedThumbnails.cjs.js");require("../../../components/ThumbnailSimple/ThumbnailSimple.cjs.js");require("../../../components/VersionUploader/components/UploadVersionDialog.cjs.js");require("../../../components/VersionUploader/context/VersionUploadContextInstance.cjs.js");require("../../../components/Watchers/Watchers.cjs.js");require("../../../components/Menu/Menu.styled.cjs.js");require("../../../components/Menu/MenuItem.cjs.js");require("../../../components/ReviewablesSelector/ReviewablesSelector.cjs.js");require("../../../components/ColumnHeaderMenuUI.cjs.js");require("../../Feed/components/ActivityReference/ActivityReference.styled.cjs.js");require("../../Feed/components/ActivityStatus/ActivityStatus.cjs.js");require("../../Feed/components/ActivityHeader/ActivityHeader.styled.cjs.js");require("../../Feed/components/ActivityDate.cjs.js");require("../../Feed/components/ActivityVersionReview/ActivityVersionReview.styled.cjs.js");require("../../Feed/components/ActivityCategorySelect/ActivityCategorySelect.cjs.js");require("../../Feed/components/ActivityCategorySelect/CategoryDropdownItem.cjs.js");require("../../Feed/components/ActivityCategorySelect/CategoryTag.cjs.js");require("../../Feed/components/ActivityFieldChange/ActivityFieldChange.styled.cjs.js");require("../../Feed/components/ActivityFieldChange/FieldValue.cjs.js");require("../../Feed/components/ActivityAssigneeChange/ActivityAssigneeChange.styled.cjs.js");require("../../Feed/components/ActivityVersions/ActivityVersions.styled.cjs.js");require("../../Feed/components/ActivityGroup/ActivityGroup.styled.cjs.js");require("../../Feed/Feed.styled.cjs.js");require("../../Feed/components/FeedSearchFilter.cjs.js");require("../../DetailsPanel/DetailsPanel.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelTabs/DetailsPanelTabs.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelHeader/LinkedTaskRow.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelHeader/DetailsPanelHeader.styled.cjs.js");require("../../../components/PlayableIcon/PlayableIcon.cjs.js");require("../../DetailsPanel/components/DetailsPanelFiles/DetailsPanelFiles.cjs.js");require("../../DetailsPanel/components/DetailsPanelMoreMenu/components/ShareDialog.cjs.js");require("../../DetailsPanel/components/TabHeaderAndFilters/TabHeaderAndFilters.styled.cjs.js");require("../../DetailsPanel/components/SubtasksSearchFilter/SubtasksSearchFilter.cjs.js");require("../../DetailsPanel/components/DetailsPanelSlideOut/DetailsPanelSlideOut.styled.cjs.js");require("../../DetailsPanel/components/DetailsPanelFloating/DetailsPanelFloating.styled.cjs.js");require("../../Actions/Actions.styled.cjs.js");require("../../Actions/ActionsDropdown/ActionsDropdown.cjs.js");require("../../Actions/ActionIcon.cjs.js");require("../../Views/ViewsMenu/ViewsMenu.cjs.js");require("../../Views/context/ViewsContextInstance.cjs.js");require("../../Views/Views.styled.cjs.js");require("../../Views/ViewsMenuContainer/ViewsMenuContainer.cjs.js");require("../../ListTable/ListTableRow.cjs.js");require("../../ListTable/ListTable.styled.cjs.js");require("../../../context/DeleteEntitiesContext.cjs.js");const $=(P,d,p)=>{switch(P){case"unique-violation":return`${d} with the name "${p}" already exists`;case"not-null-violation":return`${d} "${p}" is missing required fields`;case"foreign-key-violation":return`${d} "${p}" references invalid data`;case"integrity-constraint-violation":return`${d} "${p}" violates data integrity rules`;default:return`Failed to update ${d}: ${p}`}},B=P=>{const{pushHistory:d,removeHistoryEntries:p}=P||{},{projectName:D}=R.useProjectContext(),{getEntityById:b,getInheritedDependents:x,findInheritedValueFromAncestors:k,findNonInheritedValues:U}=Q.useProjectTableContext(),{updateEntities:F}=N.useProjectTableQueriesContext(),V=j.useCallback(async(h=[],v=!0)=>{if(!h.length||!D)return;let g=h.filter(e=>!e.isLink);const w=g.filter(e=>!(e.field==="folderType"&&e.type==="folder"&&b(e.id)?.hasVersions)),A=g.length-w.length;if(A>0&&C.toast.error(`Cannot change folder type for ${A} folder${A>1?"s":""} with published versions`),g=w,!g.length)return;if(d&&v){const e=g.map(({rowId:o,id:i,type:n,field:q,isAttrib:s,meta:I})=>{const y=b(i);if(!y)throw"Entity not found: "+i;const a=y?.entityId||y.id,T=s?y.attrib?.[q]??null:y[q]??null,E=y?.ownAttrib||[],f=s&&!E.includes(q);return{rowId:o,id:a,type:n,field:q,value:T,isAttrib:s,wasInherited:f,ownAttrib:E,folderId:y?.folderId||y?.parentId,meta:I}}),c=g.flatMap(({rowId:o,id:i,type:n,field:q,value:s,isAttrib:I,meta:y})=>{const a=b(i),T=a?.entityId||a?.id||i;return a?{rowId:o,id:T,type:n,field:q,value:s,isAttrib:I,ownAttrib:a?.ownAttrib||[],folderId:"folderId"in a?a.folderId:a?.parentId,meta:y}:[]});d(e,c)}const m=["task","folder","product","version"];let r=[];for(const e of g){let{id:c,type:o,field:i,value:n,isAttrib:q,meta:s}=e;const I=b(c),y=I?.entityId||I?.id||c;let a=o;if(!m.includes(a))continue;const T=q?{attrib:{[i]:n}}:{[i]:n};if(q){const f=[...I?.ownAttrib||[]];f.includes(i)||f.push(i),T.ownAttrib=f}const E=r.findIndex(f=>f.entityId===y&&f.entityType===a);if(E!==-1){const f=r[E];let O={...f.data,...T};f.data?.attrib&&T.attrib&&(O={...O,attrib:{...f.data.attrib,...T.attrib}}),r[E]={...f,data:O}}else r.push({entityType:a,entityId:y,rowId:e.rowId,type:"update",data:T,meta:s})}const l=r.filter(e=>!!e.entityId&&e.type==="update"&&e.data&&"attrib"in e.data).map(e=>({entityId:e.entityId,entityType:e.entityType,attrib:e.data&&"attrib"in e.data?e.data?.attrib:{}})),u=x(l).map(e=>({entityId:e.entityId,entityType:e.entityType,data:{attrib:e.attrib}}));try{r.length&&await F({operations:r,patchOperations:u})}catch(e){console.error("Error updating entities:",e);const c=Array.isArray(e?.errorCodes)?e.errorCodes:[];if(r.length===1&&c.length>0)c.forEach(o=>{const i=r[0],n=b(i.entityId),q=n?.label||n?.name||i.entityId||"",s=$(o,i.entityType,q);C.toast.error(s)});else{const o=r[0],i=o&&b(o.entityId),n=i?.label||i?.name||o?.entityId||"";C.toast.error(r.length===1?$(void 0,o.entityType,n):"Failed to update entities")}d&&v&&p&&p(1)}},[D,F,b,x,d,p]),M=j.useCallback(async(h,v=!0)=>{if(!h.length||!D)return;if(v&&d){const r=[];for(const t of h){const u=b(t.entityId);for(const e of t.attribs)u?.attrib&&e in u.attrib&&r.push({rowId:t.rowId,id:u?.entityId||u?.id||t.entityId,type:t.entityType,field:e,value:u.attrib[e],isAttrib:!0,wasInherited:!1,ownAttrib:u?.ownAttrib||[],folderId:u?.folderId,meta:u.meta})}const l=h.flatMap(t=>t.attribs.map(u=>({rowId:t.rowId,id:t.entityId,type:t.entityType,field:u,value:null,isAttrib:!0,wasInherited:!0,ownAttrib:t.ownAttrib,folderId:t.folderId,meta:t.meta})));r.length>0&&d(r,l)}const g=["task","folder"],w=[],A=[];for(const r of h){let l=r.entityType;if(!g.includes(l))continue;l=l;const t={};r.attribs.forEach(n=>{t[n]=null}),w.push({entityType:l,entityId:r.entityId,rowId:r.rowId,type:"update",data:{attrib:t},meta:r.meta});const e=(()=>{const n=r.folderId,q=[];let s=n,I=h.find(a=>a.entityId===s);for(;I;)q.push(I),s=I.folderId,I=h.find(a=>a.entityId===s);return q.length>0?q[q.length-1]:null})(),c=e?.attribs||[],o=r.attribs.filter(n=>c.includes(n)),i=r.attribs.filter(n=>!c.includes(n));i.length>0&&A.push({...r,attribs:i}),e&&o.length>0&&A.push({...r,attribs:o,folderId:e.folderId})}const m=[];for(const r of A){const l=r.entityType,t=[...r.ownAttrib||[]].filter(i=>!r.attribs.includes(i)),u=U(r.folderId,r.attribs),e={entityId:r.entityId,entityType:l,data:{attrib:u,ownAttrib:t}};m.push(e);const o=x([{entityId:r.entityId,entityType:l,attrib:u}]).map(i=>({entityId:i.entityId,entityType:i.entityType,data:{attrib:i.attrib}}));for(const i of o){const n=m.findIndex(q=>q.entityId===i.entityId);if(n!==-1){const q=m[n];let s={...q.data?.attrib||{},...i.data?.attrib||{}};m[n]={...q,data:{attrib:s}}}else m.push({entityId:i.entityId,entityType:i.entityType,data:i.data})}}try{await F({operations:w,patchOperations:m})}catch(r){const l=Array.isArray(r?.errorCodes)?r.errorCodes:[];if(w.length===1&&l.length>0)l.forEach(t=>{const u=w[0],e=b(u.entityId),c=e?.label||e?.name||u.entityId||"",o=$(t,u.entityType,c);C.toast.error(o)});else{const t=w[0],u=t&&b(t.entityId),e=u?.label||u?.name||t?.entityId||"";C.toast.error(w.length===1?$(void 0,t.entityType,e):"Failed to update entities")}v&&d&&p&&p(1)}},[D,F,x,k,d,p]);return{updateEntities:V,inheritFromParent:M}};module.exports=B;
|
|
2
2
|
//# sourceMappingURL=useUpdateTableData.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUpdateTableData.cjs.js","sources":["../../../../../../src/containers/ProjectTreeTable/hooks/useUpdateTableData.ts"],"sourcesContent":["import { CellId } from '../utils/cellUtils'\nimport { CellValue } from '../widgets/CellWidget'\nimport { toast } from 'react-toastify'\nimport { useProjectTableQueriesContext } from '../context/ProjectTableQueriesContext'\nimport { useCallback } from 'react'\nimport { InheritedDependent } from './useFolderRelationships'\nimport { useProjectTableContext } from '../context/ProjectTableContext'\nimport { OperationModel } from '../types/operations'\nimport { PatchOperation } from '../types'\nimport { HistoryEntityUpdate, UseHistoryReturn } from './useHistory'\nimport { useProjectContext } from '@shared/context'\n\nconst getErrorMessage = (\n errorCode: string | undefined,\n entityType: string,\n entityName: string,\n): string => {\n switch (errorCode) {\n case 'unique-violation':\n return `${entityType} with the name \"${entityName}\" already exists`\n case 'not-null-violation':\n return `${entityType} \"${entityName}\" is missing required fields`\n case 'foreign-key-violation':\n return `${entityType} \"${entityName}\" references invalid data`\n case 'integrity-constraint-violation':\n return `${entityType} \"${entityName}\" violates data integrity rules`\n default:\n return `Failed to update ${entityType}: ${entityName}`\n }\n}\n\nexport type EntityUpdate = {\n rowId: string\n id: string\n type: string\n field: string\n value: CellValue | CellValue[] | null\n isAttrib?: boolean\n isLink?: boolean // link updates use different endpoint\n meta?: Record<string, any>\n}\nexport type UpdateTableEntities = (entities: EntityUpdate[], pushHistory?: boolean) => Promise<void>\n\nexport type InheritFromParentEntity = {\n rowId: string\n entityId: string\n entityType: string\n attribs: string[]\n ownAttrib: string[]\n folderId?: string // the parent folder ID\n meta?: Record<string, any>\n}\nexport type InheritFromParent = (\n entities: InheritFromParentEntity[],\n pushHistory?: boolean,\n) => Promise<void>\n\nexport type UpdateTableEntity = (\n cellId: CellId,\n value: string,\n { includeSelection }: { includeSelection: boolean },\n) => Promise<void>\n\nexport type OperationWithRowId = OperationModel & { rowId: string; meta?: Record<string, any> }\n\ninterface UseUpdateTableDataProps {\n pushHistory?: UseHistoryReturn['pushHistory']\n removeHistoryEntries?: UseHistoryReturn['removeHistoryEntries']\n}\n\nconst useUpdateTableData = (props?: UseUpdateTableDataProps) => {\n const { pushHistory, removeHistoryEntries } = props || {}\n const { projectName } = useProjectContext()\n const {\n getEntityById,\n getInheritedDependents,\n findInheritedValueFromAncestors,\n findNonInheritedValues,\n } = useProjectTableContext()\n const { updateEntities } = useProjectTableQueriesContext()\n\n const handleUpdateEntities = useCallback<UpdateTableEntities>(\n async (entities = [], pushToHistory = true) => {\n if (!entities.length || !projectName) {\n return\n }\n\n // Filter out link updates - they should be handled by useUpdateTableLinks\n let entityUpdates = entities.filter((e) => !e.isLink)\n\n // Filter out folder type updates for folders with versions\n const filteredUpdates = entityUpdates.filter((entity) => {\n if (entity.field === 'folderType' && entity.type === 'folder') {\n const entityData = getEntityById(entity.id)\n if (entityData?.hasVersions) {\n return false\n }\n }\n return true\n })\n\n // Show warning if any updates were filtered out\n const filteredCount = entityUpdates.length - filteredUpdates.length\n if (filteredCount > 0) {\n toast.error(\n `Cannot change folder type for ${filteredCount} folder${\n filteredCount > 1 ? 's' : ''\n } with published versions`,\n )\n }\n\n entityUpdates = filteredUpdates\n\n // If no entity updates to process, return early\n if (!entityUpdates.length) {\n return\n }\n\n // Record history of previous values before applying update\n if (pushHistory && pushToHistory) {\n const inverseEntities: HistoryEntityUpdate[] = entityUpdates.map(\n ({ rowId, id, type, field, isAttrib, meta }) => {\n const entityData = getEntityById(id) as Record<string, any>\n if (!entityData) {\n throw 'Entity not found: ' + id\n }\n const entityId = entityData?.entityId || entityData.id\n const oldValue = isAttrib\n ? (entityData.attrib as Record<string, any>)?.[field] ?? null\n : entityData[field] ?? null\n\n // Check if the field was inherited (not in ownAttrib)\n const ownAttrib = entityData?.ownAttrib || []\n const wasInherited = isAttrib && !ownAttrib.includes(field)\n\n return {\n rowId: rowId,\n id: entityId,\n type,\n field,\n value: oldValue,\n isAttrib,\n wasInherited, // Track inheritance status for undo\n ownAttrib: ownAttrib,\n folderId: entityData?.folderId || entityData?.parentId,\n meta,\n }\n },\n )\n const historyEntities: HistoryEntityUpdate[] = entityUpdates.flatMap(\n ({ rowId, id, type, field, value, isAttrib, meta }) => {\n const entityData = getEntityById(id)\n const entityId = entityData?.entityId || entityData?.id || id\n\n if (!entityData) return []\n\n return {\n rowId: rowId,\n id: entityId,\n type,\n field,\n value,\n isAttrib,\n ownAttrib: entityData?.ownAttrib || [],\n folderId: 'folderId' in entityData ? entityData.folderId : entityData?.parentId,\n meta,\n }\n },\n )\n pushHistory(inverseEntities, historyEntities)\n }\n\n const supportedEntityTypes: OperationModel['entityType'][] = [\n 'task',\n 'folder',\n 'product',\n 'version',\n ]\n // Group operations by entity type for bulk processing\n let operations: OperationWithRowId[] = []\n for (const entity of entityUpdates) {\n let { id, type, field, value, isAttrib, meta } = entity\n const entityData = getEntityById(id)\n const entityId = entityData?.entityId || entityData?.id || id\n // Skip unsupported entity types\n let entityType = type as OperationModel['entityType']\n if (!supportedEntityTypes.includes(entityType)) {\n continue\n }\n\n // create data object for change, taking into account if it's an attribute change\n const data: Record<string, any> = isAttrib\n ? { attrib: { [field]: value } }\n : { [field]: value }\n\n // if the entity is an attribute get the entity data\n // then update ownAttrib to include the new value\n if (isAttrib) {\n const ownAttrib = [...(entityData?.ownAttrib || [])]\n // add the new value to the ownAttrib if it doesn't already exist\n if (!ownAttrib.includes(field)) {\n ownAttrib.push(field)\n }\n // update the data object with the new ownAttrib\n data.ownAttrib = ownAttrib\n }\n\n const existingOperationIndex = operations.findIndex(\n (op) => op.entityId === entityId && op.entityType === entityType,\n )\n\n if (existingOperationIndex !== -1) {\n // Merge data with existing operation\n const existingOperation = operations[existingOperationIndex]\n let newData = { ...existingOperation.data, ...data }\n\n // @ts-ignore\n if (existingOperation.data?.attrib && data.attrib) {\n // @ts-ignore\n newData = { ...newData, attrib: { ...existingOperation.data.attrib, ...data.attrib } }\n }\n\n operations[existingOperationIndex] = {\n ...existingOperation,\n data: newData,\n }\n } else {\n // Add new operation\n operations.push({\n entityType: entityType,\n entityId: entityId,\n rowId: entity.rowId,\n type: 'update',\n data: data,\n meta: meta,\n })\n }\n }\n\n const folderAttribEntities: InheritedDependent[] = operations\n .filter((op) => !!op.entityId && op.type === 'update' && op.data && 'attrib' in op.data)\n .map((op) => ({\n entityId: op.entityId as string,\n entityType: op.entityType as 'folder' | 'task',\n attrib:\n op.data && 'attrib' in op.data ? (op.data?.attrib as InheritedDependent['attrib']) : {},\n }))\n\n const inheritedDependents = getInheritedDependents(folderAttribEntities)\n\n // convert to operations\n const inheritedDependentsOperations: PatchOperation[] = inheritedDependents.map((op) => ({\n entityId: op.entityId,\n entityType: op.entityType,\n data: {\n attrib: op.attrib,\n },\n }))\n\n // now make api call to update all entities and links\n try {\n if (operations.length) {\n await updateEntities({\n operations,\n patchOperations: inheritedDependentsOperations,\n })\n }\n } catch (error: any) {\n console.error('Error updating entities:', error)\n if (operations.length === 1) {\n error.errorCodes.forEach((errorCode: string) => {\n const op = operations[0]\n const entity = getEntityById(op.entityId as string)\n const entityName = entity?.label || entity?.name || op.entityId || ''\n const message = getErrorMessage(errorCode, op.entityType, entityName)\n toast.error(message)\n })\n } else {\n toast.error('Failed to update entities')\n }\n // Remove the failed update from history stack\n if (pushHistory && pushToHistory && removeHistoryEntries) {\n removeHistoryEntries(1)\n }\n }\n },\n [\n projectName,\n updateEntities, //\n getEntityById,\n getInheritedDependents,\n pushHistory,\n removeHistoryEntries,\n ],\n )\n\n // set the attrib fields to be inherited from the parent\n // (remove the field from the ownAttrib array)\n // invalidate the cache for the folder/task so that it can be re-fetched with inherited values\n const inheritFromParent = useCallback<InheritFromParent>(\n async (entities, pushToHistory = true) => {\n if (!entities.length || !projectName) {\n return\n }\n\n // Record history for the inheritance operation\n if (pushToHistory && pushHistory) {\n // Create undo entities (restore explicit values)\n const undoEntities: HistoryEntityUpdate[] = []\n\n // For each entity and attribute being inherited, record current values\n for (const entity of entities) {\n const entityData = getEntityById(entity.entityId) as Record<string, any>\n\n // For each attribute that will be inherited, record its current value\n for (const attrib of entity.attribs) {\n if (entityData?.attrib && attrib in entityData.attrib) {\n undoEntities.push({\n rowId: entity.rowId,\n id: entityData?.entityId || entityData?.id || entity.entityId,\n type: entity.entityType,\n field: attrib,\n value: (entityData.attrib as Record<string, any>)[attrib],\n isAttrib: true,\n wasInherited: false, // Mark as not inherited\n ownAttrib: entityData?.ownAttrib || [],\n folderId: entityData?.folderId,\n meta: entityData.meta,\n })\n }\n }\n }\n\n // Create redo entities (to re-inherit)\n const redoEntities: HistoryEntityUpdate[] = entities.flatMap((entity) =>\n entity.attribs.map((attrib) => ({\n rowId: entity.rowId,\n id: entity.entityId,\n type: entity.entityType,\n field: attrib,\n value: null,\n isAttrib: true,\n wasInherited: true, // Mark as inherited\n ownAttrib: entity.ownAttrib,\n folderId: entity.folderId,\n meta: entity.meta,\n })),\n )\n\n // Push to history if we have changes to record\n if (undoEntities.length > 0) {\n pushHistory(undoEntities, redoEntities)\n }\n }\n\n const supportedEntityTypes: OperationModel['entityType'][] = ['task', 'folder']\n // Group operations by entity type for bulk processing\n const operations: OperationWithRowId[] = [] // operations sent to the server\n const entitiesToPatch: InheritFromParentEntity[] = []\n for (const entity of entities) {\n // Skip unsupported entity types\n let entityType = entity.entityType as OperationModel['entityType']\n if (!supportedEntityTypes.includes(entityType)) {\n continue\n }\n entityType = entityType as 'task' | 'folder'\n\n // Create data object with null values for each attrib to inherit\n const attribData: Record<string, null> = {}\n entity.attribs.forEach((attrib) => {\n attribData[attrib] = null\n })\n\n // Add new operation this is what's sent to the server and is actually updated in the DB\n operations.push({\n entityType: entityType,\n entityId: entity.entityId,\n rowId: entity.rowId,\n type: 'update',\n data: {\n attrib: attribData,\n },\n meta: entity.meta,\n })\n\n // check if this entity has a folderId that is in entities\n // if so we check their intersection attrib names\n const findTopFolder = () => {\n // For each entity, we need to find the top-most folder in the hierarchy\n const folderId = entity.folderId\n\n // Find all ancestor folders that are in our entities list\n const ancestorChain: InheritFromParentEntity[] = []\n let currentFolderId = folderId\n let currentFolder = entities.find((e) => e.entityId === currentFolderId)\n\n // Climb up the folder hierarchy to build the chain of ancestors\n while (currentFolder) {\n ancestorChain.push(currentFolder)\n currentFolderId = currentFolder.folderId\n currentFolder = entities.find((e) => e.entityId === currentFolderId)\n }\n\n // The top folder is the last one in our ancestor chain (if any)\n const topFolder =\n ancestorChain.length > 0 ? ancestorChain[ancestorChain.length - 1] : null\n\n return topFolder\n }\n\n const topFolder = findTopFolder()\n const folderAttribs = topFolder?.attribs || []\n const entityAttribsIntersection = entity.attribs.filter((attrib) =>\n folderAttribs.includes(attrib),\n )\n const entityAttribsRemoved = entity.attribs.filter(\n (attrib) => !folderAttribs.includes(attrib),\n )\n\n // only add to patch operations if there are attribs left\n if (entityAttribsRemoved.length > 0)\n entitiesToPatch.push({\n ...entity,\n attribs: entityAttribsRemoved,\n })\n\n if (topFolder && entityAttribsIntersection.length > 0) {\n entitiesToPatch.push({\n ...entity,\n attribs: entityAttribsIntersection,\n folderId: topFolder.folderId,\n })\n }\n }\n\n const patchOperations: PatchOperation[] = [] // operations only for patching the cache\n for (const entity of entitiesToPatch) {\n const entityType = entity.entityType as 'task' | 'folder'\n // we also need to update ownAttrib to remove the inherited attribs\n const ownAttrib = [...(entity.ownAttrib || [])].filter(\n (attrib) => !entity.attribs.includes(attrib),\n )\n\n // now we must calculate all the entities that need to be updated in the cache\n // first we need to find the the ancestor folder to inherit from\n const ancestorAttrib = findNonInheritedValues(entity.folderId, entity.attribs)\n\n const entityPatch = {\n entityId: entity.entityId,\n entityType: entityType,\n data: {\n attrib: ancestorAttrib,\n ownAttrib: ownAttrib,\n },\n }\n\n // create new patch operation for the entity\n patchOperations.push(entityPatch)\n\n // now find any dependent that also need updating\n const inheritedDependents = getInheritedDependents([\n { entityId: entity.entityId, entityType: entityType, attrib: ancestorAttrib },\n ])\n\n // convert to operations\n const inheritedDependentsOperations: PatchOperation[] = inheritedDependents.map((op) => ({\n entityId: op.entityId,\n entityType: op.entityType,\n data: {\n attrib: op.attrib,\n },\n }))\n\n // try to add to patch operations\n // if it already exists then merge the attribs\n for (const inheritedDependent of inheritedDependentsOperations) {\n const existingOperationIndex = patchOperations.findIndex(\n (op) => op.entityId === inheritedDependent.entityId,\n )\n\n if (existingOperationIndex !== -1) {\n // Merge attribs with existing operation\n const existingOperation = patchOperations[existingOperationIndex]\n let newAttrib = {\n // @ts-ignore\n ...(existingOperation.data?.attrib || {}),\n // @ts-ignore\n ...(inheritedDependent.data?.attrib || {}),\n }\n\n patchOperations[existingOperationIndex] = {\n ...existingOperation,\n data: { attrib: newAttrib },\n }\n } else {\n // Add new operation\n patchOperations.push({\n entityId: inheritedDependent.entityId,\n entityType: inheritedDependent.entityType,\n data: inheritedDependent.data,\n })\n }\n }\n }\n\n // now make api call to update all entities\n try {\n await updateEntities({\n operations,\n patchOperations,\n })\n } catch (error: any) {\n // Extract error code from operation result - check multiple paths\n if (operations.length === 1) {\n error.errorCodes.forEach((errorCode: string) => {\n const op = operations[0]\n const entity = getEntityById(op.entityId as string)\n const entityName = entity?.label || entity?.name || op.entityId || ''\n const message = getErrorMessage(errorCode, op.entityType, entityName)\n toast.error(message)\n })\n } else {\n toast.error('Failed to update entities')\n }\n\n // Remove the failed update from history stack\n if (pushToHistory && pushHistory && removeHistoryEntries) {\n removeHistoryEntries(1)\n }\n }\n },\n [\n projectName,\n updateEntities,\n getInheritedDependents,\n findInheritedValueFromAncestors,\n pushHistory,\n removeHistoryEntries,\n ],\n )\n\n return { updateEntities: handleUpdateEntities, inheritFromParent }\n}\n\nexport default useUpdateTableData\n"],"names":["getErrorMessage","errorCode","entityType","entityName","useUpdateTableData","props","pushHistory","removeHistoryEntries","projectName","useProjectContext","getEntityById","getInheritedDependents","findInheritedValueFromAncestors","findNonInheritedValues","useProjectTableContext","updateEntities","useProjectTableQueriesContext","handleUpdateEntities","useCallback","entities","pushToHistory","entityUpdates","filteredUpdates","entity","filteredCount","toast","inverseEntities","rowId","id","type","field","isAttrib","meta","entityData","entityId","oldValue","ownAttrib","wasInherited","historyEntities","value","supportedEntityTypes","operations","data","existingOperationIndex","op","existingOperation","newData","folderAttribEntities","inheritedDependentsOperations","error","message","inheritFromParent","undoEntities","attrib","redoEntities","entitiesToPatch","attribData","topFolder","folderId","ancestorChain","currentFolderId","currentFolder","e","folderAttribs","entityAttribsIntersection","entityAttribsRemoved","patchOperations","ancestorAttrib","entityPatch","inheritedDependent","newAttrib"],"mappings":"02i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,CACD,CACH,OAASjB,EAAY,CAEfR,EAAW,SAAW,EACxBQ,EAAM,WAAW,QAAShD,GAAsB,CAC9C,MAAM2C,EAAKH,EAAW,CAAC,EACjBlB,EAASb,EAAckC,EAAG,QAAkB,EAC5CzC,EAAaoB,GAAQ,OAASA,GAAQ,MAAQqB,EAAG,UAAY,GAC7DM,EAAUlD,EAAgBC,EAAW2C,EAAG,WAAYzC,CAAU,EACpEsB,EAAAA,MAAM,MAAMyB,CAAO,CACrB,CAAC,EAEDzB,EAAAA,MAAM,MAAM,2BAA2B,EAIrCL,GAAiBd,GAAeC,GAClCA,EAAqB,CAAC,CAE1B,CACF,EACA,CACEC,EACAO,EACAJ,EACAC,EACAN,EACAC,CAAA,CACF,EAGF,MAAO,CAAE,eAAgBU,EAAsB,kBAAAkC,CAAA,CACjD"}
|
|
1
|
+
{"version":3,"file":"useUpdateTableData.cjs.js","sources":["../../../../../../src/containers/ProjectTreeTable/hooks/useUpdateTableData.ts"],"sourcesContent":["import { CellId } from '../utils/cellUtils'\nimport { CellValue } from '../widgets/CellWidget'\nimport { toast } from 'react-toastify'\nimport { useProjectTableQueriesContext } from '../context/ProjectTableQueriesContext'\nimport { useCallback } from 'react'\nimport { InheritedDependent } from './useFolderRelationships'\nimport { useProjectTableContext } from '../context/ProjectTableContext'\nimport { OperationModel } from '../types/operations'\nimport { PatchOperation } from '../types'\nimport { HistoryEntityUpdate, UseHistoryReturn } from './useHistory'\nimport { useProjectContext } from '@shared/context'\n\nconst getErrorMessage = (\n errorCode: string | undefined,\n entityType: string,\n entityName: string,\n): string => {\n switch (errorCode) {\n case 'unique-violation':\n return `${entityType} with the name \"${entityName}\" already exists`\n case 'not-null-violation':\n return `${entityType} \"${entityName}\" is missing required fields`\n case 'foreign-key-violation':\n return `${entityType} \"${entityName}\" references invalid data`\n case 'integrity-constraint-violation':\n return `${entityType} \"${entityName}\" violates data integrity rules`\n default:\n return `Failed to update ${entityType}: ${entityName}`\n }\n}\n\nexport type EntityUpdate = {\n rowId: string\n id: string\n type: string\n field: string\n value: CellValue | CellValue[] | null\n isAttrib?: boolean\n isLink?: boolean // link updates use different endpoint\n meta?: Record<string, any>\n}\nexport type UpdateTableEntities = (entities: EntityUpdate[], pushHistory?: boolean) => Promise<void>\n\nexport type InheritFromParentEntity = {\n rowId: string\n entityId: string\n entityType: string\n attribs: string[]\n ownAttrib: string[]\n folderId?: string // the parent folder ID\n meta?: Record<string, any>\n}\nexport type InheritFromParent = (\n entities: InheritFromParentEntity[],\n pushHistory?: boolean,\n) => Promise<void>\n\nexport type UpdateTableEntity = (\n cellId: CellId,\n value: string,\n { includeSelection }: { includeSelection: boolean },\n) => Promise<void>\n\nexport type OperationWithRowId = OperationModel & { rowId: string; meta?: Record<string, any> }\n\ninterface UseUpdateTableDataProps {\n pushHistory?: UseHistoryReturn['pushHistory']\n removeHistoryEntries?: UseHistoryReturn['removeHistoryEntries']\n}\n\nconst useUpdateTableData = (props?: UseUpdateTableDataProps) => {\n const { pushHistory, removeHistoryEntries } = props || {}\n const { projectName } = useProjectContext()\n const {\n getEntityById,\n getInheritedDependents,\n findInheritedValueFromAncestors,\n findNonInheritedValues,\n } = useProjectTableContext()\n const { updateEntities } = useProjectTableQueriesContext()\n\n const handleUpdateEntities = useCallback<UpdateTableEntities>(\n async (entities = [], pushToHistory = true) => {\n if (!entities.length || !projectName) {\n return\n }\n\n // Filter out link updates - they should be handled by useUpdateTableLinks\n let entityUpdates = entities.filter((e) => !e.isLink)\n\n // Filter out folder type updates for folders with versions\n const filteredUpdates = entityUpdates.filter((entity) => {\n if (entity.field === 'folderType' && entity.type === 'folder') {\n const entityData = getEntityById(entity.id)\n if (entityData?.hasVersions) {\n return false\n }\n }\n return true\n })\n\n // Show warning if any updates were filtered out\n const filteredCount = entityUpdates.length - filteredUpdates.length\n if (filteredCount > 0) {\n toast.error(\n `Cannot change folder type for ${filteredCount} folder${\n filteredCount > 1 ? 's' : ''\n } with published versions`,\n )\n }\n\n entityUpdates = filteredUpdates\n\n // If no entity updates to process, return early\n if (!entityUpdates.length) {\n return\n }\n\n // Record history of previous values before applying update\n if (pushHistory && pushToHistory) {\n const inverseEntities: HistoryEntityUpdate[] = entityUpdates.map(\n ({ rowId, id, type, field, isAttrib, meta }) => {\n const entityData = getEntityById(id) as Record<string, any>\n if (!entityData) {\n throw 'Entity not found: ' + id\n }\n const entityId = entityData?.entityId || entityData.id\n const oldValue = isAttrib\n ? (entityData.attrib as Record<string, any>)?.[field] ?? null\n : entityData[field] ?? null\n\n // Check if the field was inherited (not in ownAttrib)\n const ownAttrib = entityData?.ownAttrib || []\n const wasInherited = isAttrib && !ownAttrib.includes(field)\n\n return {\n rowId: rowId,\n id: entityId,\n type,\n field,\n value: oldValue,\n isAttrib,\n wasInherited, // Track inheritance status for undo\n ownAttrib: ownAttrib,\n folderId: entityData?.folderId || entityData?.parentId,\n meta,\n }\n },\n )\n const historyEntities: HistoryEntityUpdate[] = entityUpdates.flatMap(\n ({ rowId, id, type, field, value, isAttrib, meta }) => {\n const entityData = getEntityById(id)\n const entityId = entityData?.entityId || entityData?.id || id\n\n if (!entityData) return []\n\n return {\n rowId: rowId,\n id: entityId,\n type,\n field,\n value,\n isAttrib,\n ownAttrib: entityData?.ownAttrib || [],\n folderId: 'folderId' in entityData ? entityData.folderId : entityData?.parentId,\n meta,\n }\n },\n )\n pushHistory(inverseEntities, historyEntities)\n }\n\n const supportedEntityTypes: OperationModel['entityType'][] = [\n 'task',\n 'folder',\n 'product',\n 'version',\n ]\n // Group operations by entity type for bulk processing\n let operations: OperationWithRowId[] = []\n for (const entity of entityUpdates) {\n let { id, type, field, value, isAttrib, meta } = entity\n const entityData = getEntityById(id)\n const entityId = entityData?.entityId || entityData?.id || id\n // Skip unsupported entity types\n let entityType = type as OperationModel['entityType']\n if (!supportedEntityTypes.includes(entityType)) {\n continue\n }\n\n // create data object for change, taking into account if it's an attribute change\n const data: Record<string, any> = isAttrib\n ? { attrib: { [field]: value } }\n : { [field]: value }\n\n // if the entity is an attribute get the entity data\n // then update ownAttrib to include the new value\n if (isAttrib) {\n const ownAttrib = [...(entityData?.ownAttrib || [])]\n // add the new value to the ownAttrib if it doesn't already exist\n if (!ownAttrib.includes(field)) {\n ownAttrib.push(field)\n }\n // update the data object with the new ownAttrib\n data.ownAttrib = ownAttrib\n }\n\n const existingOperationIndex = operations.findIndex(\n (op) => op.entityId === entityId && op.entityType === entityType,\n )\n\n if (existingOperationIndex !== -1) {\n // Merge data with existing operation\n const existingOperation = operations[existingOperationIndex]\n let newData = { ...existingOperation.data, ...data }\n\n // @ts-ignore\n if (existingOperation.data?.attrib && data.attrib) {\n // @ts-ignore\n newData = { ...newData, attrib: { ...existingOperation.data.attrib, ...data.attrib } }\n }\n\n operations[existingOperationIndex] = {\n ...existingOperation,\n data: newData,\n }\n } else {\n // Add new operation\n operations.push({\n entityType: entityType,\n entityId: entityId,\n rowId: entity.rowId,\n type: 'update',\n data: data,\n meta: meta,\n })\n }\n }\n\n const folderAttribEntities: InheritedDependent[] = operations\n .filter((op) => !!op.entityId && op.type === 'update' && op.data && 'attrib' in op.data)\n .map((op) => ({\n entityId: op.entityId as string,\n entityType: op.entityType as 'folder' | 'task',\n attrib:\n op.data && 'attrib' in op.data ? (op.data?.attrib as InheritedDependent['attrib']) : {},\n }))\n\n const inheritedDependents = getInheritedDependents(folderAttribEntities)\n\n // convert to operations\n const inheritedDependentsOperations: PatchOperation[] = inheritedDependents.map((op) => ({\n entityId: op.entityId,\n entityType: op.entityType,\n data: {\n attrib: op.attrib,\n },\n }))\n\n // now make api call to update all entities and links\n try {\n if (operations.length) {\n await updateEntities({\n operations,\n patchOperations: inheritedDependentsOperations,\n })\n }\n } catch (error: any) {\n console.error('Error updating entities:', error)\n const errorCodes = Array.isArray(error?.errorCodes) ? error.errorCodes : []\n if (operations.length === 1 && errorCodes.length > 0) {\n errorCodes.forEach((errorCode: string) => {\n const op = operations[0]\n const entity = getEntityById(op.entityId as string)\n const entityName = entity?.label || entity?.name || op.entityId || ''\n const message = getErrorMessage(errorCode, op.entityType, entityName)\n toast.error(message)\n })\n } else {\n const op = operations[0]\n const entity = op && getEntityById(op.entityId as string)\n const entityName = entity?.label || entity?.name || op?.entityId || ''\n toast.error(\n operations.length === 1\n ? getErrorMessage(undefined, op.entityType, entityName)\n : 'Failed to update entities',\n )\n }\n // Remove the failed update from history stack\n if (pushHistory && pushToHistory && removeHistoryEntries) {\n removeHistoryEntries(1)\n }\n }\n },\n [\n projectName,\n updateEntities, //\n getEntityById,\n getInheritedDependents,\n pushHistory,\n removeHistoryEntries,\n ],\n )\n\n // set the attrib fields to be inherited from the parent\n // (remove the field from the ownAttrib array)\n // invalidate the cache for the folder/task so that it can be re-fetched with inherited values\n const inheritFromParent = useCallback<InheritFromParent>(\n async (entities, pushToHistory = true) => {\n if (!entities.length || !projectName) {\n return\n }\n\n // Record history for the inheritance operation\n if (pushToHistory && pushHistory) {\n // Create undo entities (restore explicit values)\n const undoEntities: HistoryEntityUpdate[] = []\n\n // For each entity and attribute being inherited, record current values\n for (const entity of entities) {\n const entityData = getEntityById(entity.entityId) as Record<string, any>\n\n // For each attribute that will be inherited, record its current value\n for (const attrib of entity.attribs) {\n if (entityData?.attrib && attrib in entityData.attrib) {\n undoEntities.push({\n rowId: entity.rowId,\n id: entityData?.entityId || entityData?.id || entity.entityId,\n type: entity.entityType,\n field: attrib,\n value: (entityData.attrib as Record<string, any>)[attrib],\n isAttrib: true,\n wasInherited: false, // Mark as not inherited\n ownAttrib: entityData?.ownAttrib || [],\n folderId: entityData?.folderId,\n meta: entityData.meta,\n })\n }\n }\n }\n\n // Create redo entities (to re-inherit)\n const redoEntities: HistoryEntityUpdate[] = entities.flatMap((entity) =>\n entity.attribs.map((attrib) => ({\n rowId: entity.rowId,\n id: entity.entityId,\n type: entity.entityType,\n field: attrib,\n value: null,\n isAttrib: true,\n wasInherited: true, // Mark as inherited\n ownAttrib: entity.ownAttrib,\n folderId: entity.folderId,\n meta: entity.meta,\n })),\n )\n\n // Push to history if we have changes to record\n if (undoEntities.length > 0) {\n pushHistory(undoEntities, redoEntities)\n }\n }\n\n const supportedEntityTypes: OperationModel['entityType'][] = ['task', 'folder']\n // Group operations by entity type for bulk processing\n const operations: OperationWithRowId[] = [] // operations sent to the server\n const entitiesToPatch: InheritFromParentEntity[] = []\n for (const entity of entities) {\n // Skip unsupported entity types\n let entityType = entity.entityType as OperationModel['entityType']\n if (!supportedEntityTypes.includes(entityType)) {\n continue\n }\n entityType = entityType as 'task' | 'folder'\n\n // Create data object with null values for each attrib to inherit\n const attribData: Record<string, null> = {}\n entity.attribs.forEach((attrib) => {\n attribData[attrib] = null\n })\n\n // Add new operation this is what's sent to the server and is actually updated in the DB\n operations.push({\n entityType: entityType,\n entityId: entity.entityId,\n rowId: entity.rowId,\n type: 'update',\n data: {\n attrib: attribData,\n },\n meta: entity.meta,\n })\n\n // check if this entity has a folderId that is in entities\n // if so we check their intersection attrib names\n const findTopFolder = () => {\n // For each entity, we need to find the top-most folder in the hierarchy\n const folderId = entity.folderId\n\n // Find all ancestor folders that are in our entities list\n const ancestorChain: InheritFromParentEntity[] = []\n let currentFolderId = folderId\n let currentFolder = entities.find((e) => e.entityId === currentFolderId)\n\n // Climb up the folder hierarchy to build the chain of ancestors\n while (currentFolder) {\n ancestorChain.push(currentFolder)\n currentFolderId = currentFolder.folderId\n currentFolder = entities.find((e) => e.entityId === currentFolderId)\n }\n\n // The top folder is the last one in our ancestor chain (if any)\n const topFolder =\n ancestorChain.length > 0 ? ancestorChain[ancestorChain.length - 1] : null\n\n return topFolder\n }\n\n const topFolder = findTopFolder()\n const folderAttribs = topFolder?.attribs || []\n const entityAttribsIntersection = entity.attribs.filter((attrib) =>\n folderAttribs.includes(attrib),\n )\n const entityAttribsRemoved = entity.attribs.filter(\n (attrib) => !folderAttribs.includes(attrib),\n )\n\n // only add to patch operations if there are attribs left\n if (entityAttribsRemoved.length > 0)\n entitiesToPatch.push({\n ...entity,\n attribs: entityAttribsRemoved,\n })\n\n if (topFolder && entityAttribsIntersection.length > 0) {\n entitiesToPatch.push({\n ...entity,\n attribs: entityAttribsIntersection,\n folderId: topFolder.folderId,\n })\n }\n }\n\n const patchOperations: PatchOperation[] = [] // operations only for patching the cache\n for (const entity of entitiesToPatch) {\n const entityType = entity.entityType as 'task' | 'folder'\n // we also need to update ownAttrib to remove the inherited attribs\n const ownAttrib = [...(entity.ownAttrib || [])].filter(\n (attrib) => !entity.attribs.includes(attrib),\n )\n\n // now we must calculate all the entities that need to be updated in the cache\n // first we need to find the the ancestor folder to inherit from\n const ancestorAttrib = findNonInheritedValues(entity.folderId, entity.attribs)\n\n const entityPatch = {\n entityId: entity.entityId,\n entityType: entityType,\n data: {\n attrib: ancestorAttrib,\n ownAttrib: ownAttrib,\n },\n }\n\n // create new patch operation for the entity\n patchOperations.push(entityPatch)\n\n // now find any dependent that also need updating\n const inheritedDependents = getInheritedDependents([\n { entityId: entity.entityId, entityType: entityType, attrib: ancestorAttrib },\n ])\n\n // convert to operations\n const inheritedDependentsOperations: PatchOperation[] = inheritedDependents.map((op) => ({\n entityId: op.entityId,\n entityType: op.entityType,\n data: {\n attrib: op.attrib,\n },\n }))\n\n // try to add to patch operations\n // if it already exists then merge the attribs\n for (const inheritedDependent of inheritedDependentsOperations) {\n const existingOperationIndex = patchOperations.findIndex(\n (op) => op.entityId === inheritedDependent.entityId,\n )\n\n if (existingOperationIndex !== -1) {\n // Merge attribs with existing operation\n const existingOperation = patchOperations[existingOperationIndex]\n let newAttrib = {\n // @ts-ignore\n ...(existingOperation.data?.attrib || {}),\n // @ts-ignore\n ...(inheritedDependent.data?.attrib || {}),\n }\n\n patchOperations[existingOperationIndex] = {\n ...existingOperation,\n data: { attrib: newAttrib },\n }\n } else {\n // Add new operation\n patchOperations.push({\n entityId: inheritedDependent.entityId,\n entityType: inheritedDependent.entityType,\n data: inheritedDependent.data,\n })\n }\n }\n }\n\n // now make api call to update all entities\n try {\n await updateEntities({\n operations,\n patchOperations,\n })\n } catch (error: any) {\n // Extract error code from operation result - check multiple paths\n const errorCodes = Array.isArray(error?.errorCodes) ? error.errorCodes : []\n if (operations.length === 1 && errorCodes.length > 0) {\n errorCodes.forEach((errorCode: string) => {\n const op = operations[0]\n const entity = getEntityById(op.entityId as string)\n const entityName = entity?.label || entity?.name || op.entityId || ''\n const message = getErrorMessage(errorCode, op.entityType, entityName)\n toast.error(message)\n })\n } else {\n const op = operations[0]\n const entity = op && getEntityById(op.entityId as string)\n const entityName = entity?.label || entity?.name || op?.entityId || ''\n toast.error(\n operations.length === 1\n ? getErrorMessage(undefined, op.entityType, entityName)\n : 'Failed to update entities',\n )\n }\n\n // Remove the failed update from history stack\n if (pushToHistory && pushHistory && removeHistoryEntries) {\n removeHistoryEntries(1)\n }\n }\n },\n [\n projectName,\n updateEntities,\n getInheritedDependents,\n findInheritedValueFromAncestors,\n pushHistory,\n removeHistoryEntries,\n ],\n )\n\n return { updateEntities: handleUpdateEntities, inheritFromParent }\n}\n\nexport default useUpdateTableData\n"],"names":["getErrorMessage","errorCode","entityType","entityName","useUpdateTableData","props","pushHistory","removeHistoryEntries","projectName","useProjectContext","getEntityById","getInheritedDependents","findInheritedValueFromAncestors","findNonInheritedValues","useProjectTableContext","updateEntities","useProjectTableQueriesContext","handleUpdateEntities","useCallback","entities","pushToHistory","entityUpdates","filteredUpdates","entity","filteredCount","toast","inverseEntities","rowId","id","type","field","isAttrib","meta","entityData","entityId","oldValue","ownAttrib","wasInherited","historyEntities","value","supportedEntityTypes","operations","data","existingOperationIndex","op","existingOperation","newData","folderAttribEntities","inheritedDependentsOperations","error","errorCodes","message","inheritFromParent","undoEntities","attrib","redoEntities","entitiesToPatch","attribData","topFolder","folderId","ancestorChain","currentFolderId","currentFolder","e","folderAttribs","entityAttribsIntersection","entityAttribsRemoved","patchOperations","ancestorAttrib","entityPatch","inheritedDependent","newAttrib"],"mappings":"02iBAYA,MAAMA,EAAkB,CACtBC,EACAC,EACAC,IACW,CACX,OAAQF,EAAA,CACN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