@ynput/ayon-frontend-shared 0.1.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/EmptyPlaceholderFlex.styled-C3tjIk5V.mjs +121 -0
- package/dist/EmptyPlaceholderFlex.styled-C3tjIk5V.mjs.map +1 -0
- package/dist/EmptyPlaceholderFlex.styled-D_9k5mMH.js +78 -0
- package/dist/EmptyPlaceholderFlex.styled-D_9k5mMH.js.map +1 -0
- package/dist/ThumbnailSimple-DbSmXCNa.js +34 -0
- package/dist/ThumbnailSimple-DbSmXCNa.js.map +1 -0
- package/dist/ThumbnailSimple-DotCInch.mjs +78 -0
- package/dist/ThumbnailSimple-DotCInch.mjs.map +1 -0
- package/dist/ayon-frontend-shared.css +1 -0
- package/dist/confirmDelete-BSaFL2RH.mjs +6279 -0
- package/dist/confirmDelete-BSaFL2RH.mjs.map +1 -0
- package/dist/confirmDelete-BoRH88hw.js +43 -0
- package/dist/confirmDelete-BoRH88hw.js.map +1 -0
- package/dist/csstransition.esm-CzUZfsIt.mjs +3101 -0
- package/dist/csstransition.esm-CzUZfsIt.mjs.map +1 -0
- package/dist/csstransition.esm-Riwtyc4r.js +32 -0
- package/dist/csstransition.esm-Riwtyc4r.js.map +1 -0
- package/dist/format-DUCu0Y-3.mjs +1289 -0
- package/dist/format-DUCu0Y-3.mjs.map +1 -0
- package/dist/format-v4Hpvya-.js +2 -0
- package/dist/format-v4Hpvya-.js.map +1 -0
- package/dist/getEntityTypeIcon-BvwosBHR.js +2 -0
- package/dist/getEntityTypeIcon-BvwosBHR.js.map +1 -0
- package/dist/getEntityTypeIcon-BxTCKGSi.mjs +50 -0
- package/dist/getEntityTypeIcon-BxTCKGSi.mjs.map +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.cjs2.js +2 -0
- package/dist/index.cjs2.js.map +1 -0
- package/dist/index.cjs3.js +2 -0
- package/dist/index.cjs3.js.map +1 -0
- package/dist/index.cjs4.js +2 -0
- package/dist/index.cjs4.js.map +1 -0
- package/dist/index.cjs5.js +2 -0
- package/dist/index.cjs5.js.map +1 -0
- package/dist/index.cjs6.js +2 -0
- package/dist/index.cjs6.js.map +1 -0
- package/dist/index.cjs7.js +29 -0
- package/dist/index.cjs7.js.map +1 -0
- package/dist/index.cjs8.js +549 -0
- package/dist/index.cjs8.js.map +1 -0
- package/dist/index.cjs9.js +1753 -0
- package/dist/index.cjs9.js.map +1 -0
- package/dist/index.es.js +8 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.es2.js +11 -0
- package/dist/index.es2.js.map +1 -0
- package/dist/index.es3.js +12 -0
- package/dist/index.es3.js.map +1 -0
- package/dist/index.es4.js +5 -0
- package/dist/index.es4.js.map +1 -0
- package/dist/index.es5.js +5 -0
- package/dist/index.es5.js.map +1 -0
- package/dist/index.es6.js +37 -0
- package/dist/index.es6.js.map +1 -0
- package/dist/index.es7.js +361 -0
- package/dist/index.es7.js.map +1 -0
- package/dist/index.es8.js +4340 -0
- package/dist/index.es8.js.map +1 -0
- package/dist/index.es9.js +56950 -0
- package/dist/index.es9.js.map +1 -0
- package/dist/jsx-runtime-Drh4NO5G.mjs +634 -0
- package/dist/jsx-runtime-Drh4NO5G.mjs.map +1 -0
- package/dist/jsx-runtime-qcKc-DpB.js +31 -0
- package/dist/jsx-runtime-qcKc-DpB.js.map +1 -0
- package/dist/platform-C5rgawOb.js +2 -0
- package/dist/platform-C5rgawOb.js.map +1 -0
- package/dist/platform-DNAvZtra.mjs +36 -0
- package/dist/platform-DNAvZtra.mjs.map +1 -0
- package/dist/types/ContextMenu.d.ts +1 -0
- package/dist/types/Feed.d.ts +1 -0
- package/dist/types/ProjectTreeTable.d.ts +1 -0
- package/dist/types/Slicer.d.ts +1 -0
- package/dist/types/api/activities/index.d.ts +1 -0
- package/dist/types/api/activities/transformations.d.ts +0 -0
- package/dist/types/api/activities/types.d.ts +10 -0
- package/dist/types/api/graphql.d.ts +2096 -0
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api.d.ts +1 -0
- package/dist/types/components/EmptyPlaceholder/EmptyPlaceholder.d.ts +11 -0
- package/dist/types/components/EmptyPlaceholder/EmptyPlaceholderFlex.styled.d.ts +2 -0
- package/dist/types/components/EmptyPlaceholder/index.d.ts +4 -0
- package/dist/types/components/ThumbnailSimple/ThumbnailSimple.d.ts +15 -0
- package/dist/types/components/ThumbnailSimple/index.d.ts +3 -0
- package/dist/types/components/UserImage/UserImage.d.ts +11 -0
- package/dist/types/components/UserImage/index.d.ts +3 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components.d.ts +1 -0
- package/dist/types/containers/ContextMenu/ContextMenuContext.d.ts +21 -0
- package/dist/types/containers/ContextMenu/ContextMenuItem.d.ts +27 -0
- package/dist/types/containers/ContextMenu/GlobalContextMenu.d.ts +1 -0
- package/dist/types/containers/ContextMenu/index.d.ts +4 -0
- package/dist/types/containers/ContextMenu/useCreateContextMenu.d.ts +17 -0
- package/dist/types/containers/Feed/Feed.d.ts +10 -0
- package/dist/types/containers/Feed/Feed.styled.d.ts +5 -0
- package/dist/types/containers/Feed/components/ActivityAssigneeChange/ActivityAssigneeChange.d.ts +15 -0
- package/dist/types/containers/Feed/components/ActivityAssigneeChange/ActivityAssigneeChange.styled.d.ts +3 -0
- package/dist/types/containers/Feed/components/ActivityAssigneeChange/index.d.ts +3 -0
- package/dist/types/containers/Feed/components/ActivityCheckbox/ActivityCheckbox.d.ts +6 -0
- package/dist/types/containers/Feed/components/ActivityCheckbox/ActivityCheckbox.styled.d.ts +1 -0
- package/dist/types/containers/Feed/components/ActivityCheckbox/index.d.ts +3 -0
- package/dist/types/containers/Feed/components/ActivityComment/ActivityComment.d.ts +24 -0
- package/dist/types/containers/Feed/components/ActivityComment/ActivityComment.styled.d.ts +14 -0
- package/dist/types/containers/Feed/components/ActivityComment/ActivityMarkdownComponents.d.ts +43 -0
- package/dist/types/containers/Feed/components/ActivityComment/CommentWrapper.d.ts +5 -0
- package/dist/types/containers/Feed/components/ActivityComment/mappers.d.ts +9 -0
- package/dist/types/containers/Feed/components/ActivityDate.d.ts +7 -0
- package/dist/types/containers/Feed/components/ActivityGroup/ActivityGroup.d.ts +9 -0
- package/dist/types/containers/Feed/components/ActivityGroup/ActivityGroup.styled.d.ts +2 -0
- package/dist/types/containers/Feed/components/ActivityHeader/ActivityHeader.d.ts +40 -0
- package/dist/types/containers/Feed/components/ActivityHeader/ActivityHeader.styled.d.ts +4 -0
- package/dist/types/containers/Feed/components/ActivityItem.d.ts +27 -0
- package/dist/types/containers/Feed/components/ActivityReference/ActivityReference.d.ts +14 -0
- package/dist/types/containers/Feed/components/ActivityReference/ActivityReference.styled.d.ts +3 -0
- package/dist/types/containers/Feed/components/ActivityReferenceTooltip/ActivityReferenceTooltip.d.ts +4 -0
- package/dist/types/containers/Feed/components/ActivityReferenceTooltip/index.d.ts +2 -0
- package/dist/types/containers/Feed/components/ActivityStatus/ActivityStatus.d.ts +9 -0
- package/dist/types/containers/Feed/components/ActivityStatusChange/ActivityStatusChange.d.ts +18 -0
- package/dist/types/containers/Feed/components/ActivityStatusChange/ActivityStatusChange.styled.d.ts +3 -0
- package/dist/types/containers/Feed/components/ActivityStatusChange/hooks/getContextParents.d.ts +2 -0
- package/dist/types/containers/Feed/components/ActivityVersions/ActivityVersions.d.ts +24 -0
- package/dist/types/containers/Feed/components/ActivityVersions/ActivityVersions.styled.d.ts +6 -0
- package/dist/types/containers/Feed/components/CommentInput/CommentInput.d.ts +26 -0
- package/dist/types/containers/Feed/components/CommentInput/CommentInput.styled.d.ts +7 -0
- package/dist/types/containers/Feed/components/CommentInput/InputMarkdownConvert.d.ts +11 -0
- package/dist/types/containers/Feed/components/CommentInput/helpers.d.ts +4 -0
- package/dist/types/containers/Feed/components/CommentInput/hooks/useAnnotationsSync.d.ts +14 -0
- package/dist/types/containers/Feed/components/CommentInput/hooks/useAnnotationsUpload.d.ts +6 -0
- package/dist/types/containers/Feed/components/CommentInput/hooks/useInitialValue.d.ts +11 -0
- package/dist/types/containers/Feed/components/CommentInput/hooks/useMentionLink.d.ts +7 -0
- package/dist/types/containers/Feed/components/CommentInput/hooks/useSetCursorEnd.d.ts +7 -0
- package/dist/types/containers/Feed/components/CommentInput/index.d.ts +0 -0
- package/dist/types/containers/Feed/components/CommentInput/modules/ImageUploader.d.ts +8 -0
- package/dist/types/containers/Feed/components/CommentInput/modules/index.d.ts +12 -0
- package/dist/types/containers/Feed/components/CommentInput/quillToMarkdown.d.ts +5 -0
- package/dist/types/containers/Feed/components/CommentMentionSelect/CommentMentionSelect.d.ts +28 -0
- package/dist/types/containers/Feed/components/CommentMentionSelect/CommentMentionSelect.styled.d.ts +6 -0
- package/dist/types/containers/Feed/components/FileUploadCard/FileUploadCard.d.ts +14 -0
- package/dist/types/containers/Feed/components/FileUploadCard/FileUploadCard.styled.d.ts +4 -0
- package/dist/types/containers/Feed/components/FileUploadCard/index.d.ts +3 -0
- package/dist/types/containers/Feed/components/FileUploadPreview/FileUploadPreview.d.ts +22 -0
- package/dist/types/containers/Feed/components/FileUploadPreview/FileUploadPreview.styled.d.ts +4 -0
- package/dist/types/containers/Feed/components/FileUploadPreview/Mimes/ImageMime.d.ts +9 -0
- package/dist/types/containers/Feed/components/FileUploadPreview/Mimes/TextMime.d.ts +10 -0
- package/dist/types/containers/Feed/components/FileUploadPreview/hooks/useAttachmentNavigation.d.ts +19 -0
- package/dist/types/containers/Feed/components/FileUploadPreview/index.d.ts +3 -0
- package/dist/types/containers/Feed/components/FilesGrid/FilesGrid.d.ts +17 -0
- package/dist/types/containers/Feed/components/FilesGrid/FilesGrid.styled.d.ts +1 -0
- package/dist/types/containers/Feed/components/FilesGrid/index.d.ts +3 -0
- package/dist/types/containers/Feed/components/ReactionContainer/ExistingReactions.d.ts +7 -0
- package/dist/types/containers/Feed/components/ReactionContainer/Reaction.d.ts +10 -0
- package/dist/types/containers/Feed/components/ReactionContainer/ReactionPanelOpener.d.ts +7 -0
- package/dist/types/containers/Feed/components/ReactionContainer/Reactions.d.ts +8 -0
- package/dist/types/containers/Feed/components/ReactionContainer/Reactions.styled.d.ts +7 -0
- package/dist/types/containers/Feed/components/ReactionContainer/helpers.d.ts +11 -0
- package/dist/types/containers/Feed/components/ReactionContainer/types.d.ts +8 -0
- package/dist/types/containers/Feed/components/Tooltips/EntityTooltip/EntityTooltip.d.ts +12 -0
- package/dist/types/containers/Feed/components/Tooltips/EntityTooltip/EntityTooltip.styled.d.ts +3 -0
- package/dist/types/containers/Feed/components/Tooltips/UserTooltip/UserTooltip.d.ts +10 -0
- package/dist/types/containers/Feed/components/Tooltips/UserTooltip/UserTooltip.styled.d.ts +2 -0
- package/dist/types/containers/Feed/context/FeedContext.d.ts +58 -0
- package/dist/types/containers/Feed/feedHelpers.d.ts +1 -0
- package/dist/types/containers/Feed/helpers/groupActivityVersions.d.ts +2 -0
- package/dist/types/containers/Feed/helpers/groupMinorActivities.d.ts +2 -0
- package/dist/types/containers/Feed/helpers/mergeSimilarActivities.d.ts +2 -0
- package/dist/types/containers/Feed/hooks/useCommentMutations.d.ts +30 -0
- package/dist/types/containers/Feed/hooks/useReferenceTooltip.d.ts +3 -0
- package/dist/types/containers/Feed/hooks/useSaveScrollPos.d.ts +13 -0
- package/dist/types/containers/Feed/hooks/useScrollOnInputOpen.d.ts +8 -0
- package/dist/types/containers/Feed/hooks/useScrollToHighlighted.d.ts +10 -0
- package/dist/types/containers/Feed/hooks/useTableKeyboardNavigation.d.ts +22 -0
- package/dist/types/containers/Feed/hooks/useTransformActivities.d.ts +4 -0
- package/dist/types/containers/Feed/index.d.ts +7 -0
- package/dist/types/containers/Feed/mentionHelpers/getMentionOptions.d.ts +2 -0
- package/dist/types/containers/Feed/mentionHelpers/getMentionTasks.d.ts +10 -0
- package/dist/types/containers/Feed/mentionHelpers/getMentionUsers.d.ts +8 -0
- package/dist/types/containers/Feed/mentionHelpers/getMentionVersions.d.ts +12 -0
- package/dist/types/containers/ProjectTreeTable/ProjectTreeTable.d.ts +15 -0
- package/dist/types/containers/ProjectTreeTable/ProjectTreeTable.styled.d.ts +14 -0
- package/dist/types/containers/ProjectTreeTable/ProjectTreeTableColumns.d.ts +16 -0
- package/dist/types/containers/ProjectTreeTable/components/HeaderActionButton.d.ts +6 -0
- package/dist/types/containers/ProjectTreeTable/components/RowSelectionHeader.d.ts +3 -0
- package/dist/types/containers/ProjectTreeTable/components/SelectionCell.d.ts +5 -0
- package/dist/types/containers/ProjectTreeTable/context/CellEditingContext.d.ts +18 -0
- package/dist/types/containers/ProjectTreeTable/context/ClipboardContext.d.ts +4 -0
- package/dist/types/containers/ProjectTreeTable/context/ColumnSettingsContext.d.ts +30 -0
- package/dist/types/containers/ProjectTreeTable/context/ProjectTableContext.d.ts +76 -0
- package/dist/types/containers/ProjectTreeTable/context/ProjectTableQueriesContext.d.ts +21 -0
- package/dist/types/containers/ProjectTreeTable/context/SelectedRowsContext.d.ts +15 -0
- package/dist/types/containers/ProjectTreeTable/context/SelectionContext.d.ts +35 -0
- package/dist/types/containers/ProjectTreeTable/context/clipboard/clipboardTypes.d.ts +27 -0
- package/dist/types/containers/ProjectTreeTable/context/clipboard/clipboardUtils.d.ts +6 -0
- package/dist/types/containers/ProjectTreeTable/context/clipboard/clipboardValidation.d.ts +12 -0
- package/dist/types/containers/ProjectTreeTable/context/clipboard/index.d.ts +3 -0
- package/dist/types/containers/ProjectTreeTable/context/index.d.ts +8 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useCellContextMenu.d.ts +10 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useColumnVirtualization.d.ts +17 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useCustomColumnWidthVars.d.ts +6 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useDeleteEntities.d.ts +5 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useFolderRelationships.d.ts +29 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useHistory.d.ts +17 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useKeyboardNavigation.d.ts +10 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useOverviewTable.d.ts +32 -0
- package/dist/types/containers/ProjectTreeTable/hooks/usePrefetchFolderTasks.d.ts +4 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useUpdateOverview.d.ts +30 -0
- package/dist/types/containers/ProjectTreeTable/hooks/useValidateUpdates.d.ts +3 -0
- package/dist/types/containers/ProjectTreeTable/index.d.ts +14 -0
- package/dist/types/containers/ProjectTreeTable/types/folders.d.ts +14 -0
- package/dist/types/containers/ProjectTreeTable/types/index.d.ts +62 -0
- package/dist/types/containers/ProjectTreeTable/types/operations.d.ts +99 -0
- package/dist/types/containers/ProjectTreeTable/types/project.d.ts +223 -0
- package/dist/types/containers/ProjectTreeTable/types/table.d.ts +83 -0
- package/dist/types/containers/ProjectTreeTable/utils/cellUtils.d.ts +42 -0
- package/dist/types/containers/ProjectTreeTable/utils/clientFilterToQueryFilter.d.ts +4 -0
- package/dist/types/containers/ProjectTreeTable/utils/index.d.ts +3 -0
- package/dist/types/containers/ProjectTreeTable/utils/loadingUtils.d.ts +36 -0
- package/dist/types/containers/ProjectTreeTable/widgets/BooleanWidget.d.ts +7 -0
- package/dist/types/containers/ProjectTreeTable/widgets/CellWidget.d.ts +24 -0
- package/dist/types/containers/ProjectTreeTable/widgets/CollapsedWidget.d.ts +5 -0
- package/dist/types/containers/ProjectTreeTable/widgets/DateWidget.d.ts +8 -0
- package/dist/types/containers/ProjectTreeTable/widgets/DateWidgetInput.d.ts +8 -0
- package/dist/types/containers/ProjectTreeTable/widgets/EntityNameWidget.d.ts +14 -0
- package/dist/types/containers/ProjectTreeTable/widgets/EnumWidget.d.ts +28 -0
- package/dist/types/containers/ProjectTreeTable/widgets/TextWidget.d.ts +10 -0
- package/dist/types/containers/ProjectTreeTable/widgets/TextWidgetInput.d.ts +9 -0
- package/dist/types/containers/ProjectTreeTable/widgets/index.d.ts +7 -0
- package/dist/types/containers/Slicer/createFilterFromSlicer.d.ts +6 -0
- package/dist/types/containers/Slicer/index.d.ts +2 -0
- package/dist/types/containers/Slicer/types.d.ts +18 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useLocalStorage.d.ts +1 -0
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/util/confirmDelete.d.ts +13 -0
- package/dist/types/util/getEntityTypeIcon.d.ts +1 -0
- package/dist/types/util/index.d.ts +5 -0
- package/dist/types/util/platform.d.ts +8 -0
- package/dist/types/util/productTypes.d.ts +8 -0
- package/dist/types/util.d.ts +1 -0
- package/dist/useCreateContextMenu-CDRv1ybg.js +2 -0
- package/dist/useCreateContextMenu-CDRv1ybg.js.map +1 -0
- package/dist/useCreateContextMenu-DvOhPycB.mjs +118 -0
- package/dist/useCreateContextMenu-DvOhPycB.mjs.map +1 -0
- package/dist/useLocalStorage-BQSzWJ4Q.mjs +39 -0
- package/dist/useLocalStorage-BQSzWJ4Q.mjs.map +1 -0
- package/dist/useLocalStorage-BRHTBlxR.js +2 -0
- package/dist/useLocalStorage-BRHTBlxR.js.map +1 -0
- package/package.json +91 -0
|
@@ -0,0 +1,4340 @@
|
|
|
1
|
+
import { j as A } from "./jsx-runtime-Drh4NO5G.mjs";
|
|
2
|
+
import * as Ce from "react";
|
|
3
|
+
import { forwardRef as le, useState as Q, useEffect as J, useRef as re, createContext as de, useContext as ce, useMemo as U, useCallback as M, memo as Me, createElement as pt } from "react";
|
|
4
|
+
import { flushSync as yt, createPortal as wt } from "react-dom";
|
|
5
|
+
import { functionalUpdate as ve, sortingFns as Ve, flexRender as Je, useReactTable as bt, filterFns as xt, getSortedRowModel as It, getExpandedRowModel as vt, getFilteredRowModel as Ct, getCoreRowModel as Tt } from "@tanstack/react-table";
|
|
6
|
+
import { c as q, E as St } from "./EmptyPlaceholderFlex.styled-C3tjIk5V.mjs";
|
|
7
|
+
import N from "styled-components";
|
|
8
|
+
import { c as Et, t as Le, m as Ge, a as Xe, i as Se, f as Oe } from "./format-DUCu0Y-3.mjs";
|
|
9
|
+
import { Icon as ae, Dropdown as At, Button as et, theme as Rt } from "@ynput/ayon-react-components";
|
|
10
|
+
import { y as ie, c as We } from "./confirmDelete-BSaFL2RH.mjs";
|
|
11
|
+
import { u as kt } from "./useLocalStorage-BQSzWJ4Q.mjs";
|
|
12
|
+
import { a as Dt } from "./useCreateContextMenu-DvOhPycB.mjs";
|
|
13
|
+
import { a as Ee, K as Ae } from "./platform-DNAvZtra.mjs";
|
|
14
|
+
function Ue(e, n) {
|
|
15
|
+
const t = () => Et(n == null ? void 0 : n.in, NaN), s = $t(e);
|
|
16
|
+
let i;
|
|
17
|
+
if (s.date) {
|
|
18
|
+
const x = Mt(s.date, 2);
|
|
19
|
+
i = _t(x.restDateString, x.year);
|
|
20
|
+
}
|
|
21
|
+
if (!i || isNaN(+i)) return t();
|
|
22
|
+
const r = +i;
|
|
23
|
+
let l = 0, f;
|
|
24
|
+
if (s.time && (l = Nt(s.time), isNaN(l)))
|
|
25
|
+
return t();
|
|
26
|
+
if (s.timezone) {
|
|
27
|
+
if (f = Ft(s.timezone), isNaN(f)) return t();
|
|
28
|
+
} else {
|
|
29
|
+
const x = new Date(r + l), d = Le(0, n == null ? void 0 : n.in);
|
|
30
|
+
return d.setFullYear(
|
|
31
|
+
x.getUTCFullYear(),
|
|
32
|
+
x.getUTCMonth(),
|
|
33
|
+
x.getUTCDate()
|
|
34
|
+
), d.setHours(
|
|
35
|
+
x.getUTCHours(),
|
|
36
|
+
x.getUTCMinutes(),
|
|
37
|
+
x.getUTCSeconds(),
|
|
38
|
+
x.getUTCMilliseconds()
|
|
39
|
+
), d;
|
|
40
|
+
}
|
|
41
|
+
return Le(r + l + f, n == null ? void 0 : n.in);
|
|
42
|
+
}
|
|
43
|
+
const Ie = {
|
|
44
|
+
dateTimeDelimiter: /[T ]/,
|
|
45
|
+
timeZoneDelimiter: /[Z ]/i,
|
|
46
|
+
timezone: /([Z+-].*)$/
|
|
47
|
+
}, zt = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, jt = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, Ot = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
48
|
+
function $t(e) {
|
|
49
|
+
const n = {}, t = e.split(Ie.dateTimeDelimiter);
|
|
50
|
+
let o;
|
|
51
|
+
if (t.length > 2)
|
|
52
|
+
return n;
|
|
53
|
+
if (/:/.test(t[0]) ? o = t[0] : (n.date = t[0], o = t[1], Ie.timeZoneDelimiter.test(n.date) && (n.date = e.split(Ie.timeZoneDelimiter)[0], o = e.substr(
|
|
54
|
+
n.date.length,
|
|
55
|
+
e.length
|
|
56
|
+
))), o) {
|
|
57
|
+
const s = Ie.timezone.exec(o);
|
|
58
|
+
s ? (n.time = o.replace(s[1], ""), n.timezone = s[1]) : n.time = o;
|
|
59
|
+
}
|
|
60
|
+
return n;
|
|
61
|
+
}
|
|
62
|
+
function Mt(e, n) {
|
|
63
|
+
const t = new RegExp(
|
|
64
|
+
"^(?:(\\d{4}|[+-]\\d{" + (4 + n) + "})|(\\d{2}|[+-]\\d{" + (2 + n) + "})$)"
|
|
65
|
+
), o = e.match(t);
|
|
66
|
+
if (!o) return { year: NaN, restDateString: "" };
|
|
67
|
+
const s = o[1] ? parseInt(o[1]) : null, i = o[2] ? parseInt(o[2]) : null;
|
|
68
|
+
return {
|
|
69
|
+
year: i === null ? s : i * 100,
|
|
70
|
+
restDateString: e.slice((o[1] || o[2]).length)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function _t(e, n) {
|
|
74
|
+
if (n === null) return /* @__PURE__ */ new Date(NaN);
|
|
75
|
+
const t = e.match(zt);
|
|
76
|
+
if (!t) return /* @__PURE__ */ new Date(NaN);
|
|
77
|
+
const o = !!t[4], s = we(t[1]), i = we(t[2]) - 1, r = we(t[3]), l = we(t[4]), f = we(t[5]) - 1;
|
|
78
|
+
if (o)
|
|
79
|
+
return Ut(n, l, f) ? Pt(n, l, f) : /* @__PURE__ */ new Date(NaN);
|
|
80
|
+
{
|
|
81
|
+
const x = /* @__PURE__ */ new Date(0);
|
|
82
|
+
return !Lt(n, i, r) || !Wt(n, s) ? /* @__PURE__ */ new Date(NaN) : (x.setUTCFullYear(n, i, Math.max(s, r)), x);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function we(e) {
|
|
86
|
+
return e ? parseInt(e) : 1;
|
|
87
|
+
}
|
|
88
|
+
function Nt(e) {
|
|
89
|
+
const n = e.match(jt);
|
|
90
|
+
if (!n) return NaN;
|
|
91
|
+
const t = Re(n[1]), o = Re(n[2]), s = Re(n[3]);
|
|
92
|
+
return Kt(t, o, s) ? t * Ge + o * Xe + s * 1e3 : NaN;
|
|
93
|
+
}
|
|
94
|
+
function Re(e) {
|
|
95
|
+
return e && parseFloat(e.replace(",", ".")) || 0;
|
|
96
|
+
}
|
|
97
|
+
function Ft(e) {
|
|
98
|
+
if (e === "Z") return 0;
|
|
99
|
+
const n = e.match(Ot);
|
|
100
|
+
if (!n) return 0;
|
|
101
|
+
const t = n[1] === "+" ? -1 : 1, o = parseInt(n[2]), s = n[3] && parseInt(n[3]) || 0;
|
|
102
|
+
return Bt(o, s) ? t * (o * Ge + s * Xe) : NaN;
|
|
103
|
+
}
|
|
104
|
+
function Pt(e, n, t) {
|
|
105
|
+
const o = /* @__PURE__ */ new Date(0);
|
|
106
|
+
o.setUTCFullYear(e, 0, 4);
|
|
107
|
+
const s = o.getUTCDay() || 7, i = (n - 1) * 7 + t + 1 - s;
|
|
108
|
+
return o.setUTCDate(o.getUTCDate() + i), o;
|
|
109
|
+
}
|
|
110
|
+
const Vt = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
111
|
+
function tt(e) {
|
|
112
|
+
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
|
|
113
|
+
}
|
|
114
|
+
function Lt(e, n, t) {
|
|
115
|
+
return n >= 0 && n <= 11 && t >= 1 && t <= (Vt[n] || (tt(e) ? 29 : 28));
|
|
116
|
+
}
|
|
117
|
+
function Wt(e, n) {
|
|
118
|
+
return n >= 1 && n <= (tt(e) ? 366 : 365);
|
|
119
|
+
}
|
|
120
|
+
function Ut(e, n, t) {
|
|
121
|
+
return n >= 1 && n <= 53 && t >= 0 && t <= 6;
|
|
122
|
+
}
|
|
123
|
+
function Kt(e, n, t) {
|
|
124
|
+
return e === 24 ? n === 0 && t === 0 : t >= 0 && t < 60 && n >= 0 && n < 60 && e >= 0 && e < 25;
|
|
125
|
+
}
|
|
126
|
+
function Bt(e, n) {
|
|
127
|
+
return n >= 0 && n <= 59;
|
|
128
|
+
}
|
|
129
|
+
function ge(e, n, t) {
|
|
130
|
+
let o = t.initialDeps ?? [], s;
|
|
131
|
+
function i() {
|
|
132
|
+
var r, l, f, x;
|
|
133
|
+
let d;
|
|
134
|
+
t.key && ((r = t.debug) != null && r.call(t)) && (d = Date.now());
|
|
135
|
+
const v = e();
|
|
136
|
+
if (!(v.length !== o.length || v.some((a, h) => o[h] !== a)))
|
|
137
|
+
return s;
|
|
138
|
+
o = v;
|
|
139
|
+
let g;
|
|
140
|
+
if (t.key && ((l = t.debug) != null && l.call(t)) && (g = Date.now()), s = n(...v), t.key && ((f = t.debug) != null && f.call(t))) {
|
|
141
|
+
const a = Math.round((Date.now() - d) * 100) / 100, h = Math.round((Date.now() - g) * 100) / 100, c = h / 16, y = (p, w) => {
|
|
142
|
+
for (p = String(p); p.length < w; )
|
|
143
|
+
p = " " + p;
|
|
144
|
+
return p;
|
|
145
|
+
};
|
|
146
|
+
console.info(
|
|
147
|
+
`%c⏱ ${y(h, 5)} /${y(a, 5)} ms`,
|
|
148
|
+
`
|
|
149
|
+
font-size: .6rem;
|
|
150
|
+
font-weight: bold;
|
|
151
|
+
color: hsl(${Math.max(
|
|
152
|
+
0,
|
|
153
|
+
Math.min(120 - 120 * c, 120)
|
|
154
|
+
)}deg 100% 31%);`,
|
|
155
|
+
t == null ? void 0 : t.key
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
return (x = t == null ? void 0 : t.onChange) == null || x.call(t, s), s;
|
|
159
|
+
}
|
|
160
|
+
return i.updateDeps = (r) => {
|
|
161
|
+
o = r;
|
|
162
|
+
}, i;
|
|
163
|
+
}
|
|
164
|
+
function ke(e, n) {
|
|
165
|
+
if (e === void 0)
|
|
166
|
+
throw new Error("Unexpected undefined");
|
|
167
|
+
return e;
|
|
168
|
+
}
|
|
169
|
+
const Ht = (e, n) => Math.abs(e - n) < 1, qt = (e, n, t) => {
|
|
170
|
+
let o;
|
|
171
|
+
return function(...s) {
|
|
172
|
+
e.clearTimeout(o), o = e.setTimeout(() => n.apply(this, s), t);
|
|
173
|
+
};
|
|
174
|
+
}, Yt = (e) => e, Zt = (e) => {
|
|
175
|
+
const n = Math.max(e.startIndex - e.overscan, 0), t = Math.min(e.endIndex + e.overscan, e.count - 1), o = [];
|
|
176
|
+
for (let s = n; s <= t; s++)
|
|
177
|
+
o.push(s);
|
|
178
|
+
return o;
|
|
179
|
+
}, Qt = (e, n) => {
|
|
180
|
+
const t = e.scrollElement;
|
|
181
|
+
if (!t)
|
|
182
|
+
return;
|
|
183
|
+
const o = e.targetWindow;
|
|
184
|
+
if (!o)
|
|
185
|
+
return;
|
|
186
|
+
const s = (r) => {
|
|
187
|
+
const { width: l, height: f } = r;
|
|
188
|
+
n({ width: Math.round(l), height: Math.round(f) });
|
|
189
|
+
};
|
|
190
|
+
if (s(t.getBoundingClientRect()), !o.ResizeObserver)
|
|
191
|
+
return () => {
|
|
192
|
+
};
|
|
193
|
+
const i = new o.ResizeObserver((r) => {
|
|
194
|
+
const l = () => {
|
|
195
|
+
const f = r[0];
|
|
196
|
+
if (f != null && f.borderBoxSize) {
|
|
197
|
+
const x = f.borderBoxSize[0];
|
|
198
|
+
if (x) {
|
|
199
|
+
s({ width: x.inlineSize, height: x.blockSize });
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
s(t.getBoundingClientRect());
|
|
204
|
+
};
|
|
205
|
+
e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(l) : l();
|
|
206
|
+
});
|
|
207
|
+
return i.observe(t, { box: "border-box" }), () => {
|
|
208
|
+
i.unobserve(t);
|
|
209
|
+
};
|
|
210
|
+
}, Ke = {
|
|
211
|
+
passive: !0
|
|
212
|
+
}, Be = typeof window > "u" ? !0 : "onscrollend" in window, Jt = (e, n) => {
|
|
213
|
+
const t = e.scrollElement;
|
|
214
|
+
if (!t)
|
|
215
|
+
return;
|
|
216
|
+
const o = e.targetWindow;
|
|
217
|
+
if (!o)
|
|
218
|
+
return;
|
|
219
|
+
let s = 0;
|
|
220
|
+
const i = e.options.useScrollendEvent && Be ? () => {
|
|
221
|
+
} : qt(
|
|
222
|
+
o,
|
|
223
|
+
() => {
|
|
224
|
+
n(s, !1);
|
|
225
|
+
},
|
|
226
|
+
e.options.isScrollingResetDelay
|
|
227
|
+
), r = (d) => () => {
|
|
228
|
+
const { horizontal: v, isRtl: u } = e.options;
|
|
229
|
+
s = v ? t.scrollLeft * (u && -1 || 1) : t.scrollTop, i(), n(s, d);
|
|
230
|
+
}, l = r(!0), f = r(!1);
|
|
231
|
+
f(), t.addEventListener("scroll", l, Ke);
|
|
232
|
+
const x = e.options.useScrollendEvent && Be;
|
|
233
|
+
return x && t.addEventListener("scrollend", f, Ke), () => {
|
|
234
|
+
t.removeEventListener("scroll", l), x && t.removeEventListener("scrollend", f);
|
|
235
|
+
};
|
|
236
|
+
}, Gt = (e, n, t) => {
|
|
237
|
+
if (n != null && n.borderBoxSize) {
|
|
238
|
+
const o = n.borderBoxSize[0];
|
|
239
|
+
if (o)
|
|
240
|
+
return Math.round(
|
|
241
|
+
o[t.options.horizontal ? "inlineSize" : "blockSize"]
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
return Math.round(
|
|
245
|
+
e.getBoundingClientRect()[t.options.horizontal ? "width" : "height"]
|
|
246
|
+
);
|
|
247
|
+
}, Xt = (e, {
|
|
248
|
+
adjustments: n = 0,
|
|
249
|
+
behavior: t
|
|
250
|
+
}, o) => {
|
|
251
|
+
var s, i;
|
|
252
|
+
const r = e + n;
|
|
253
|
+
(i = (s = o.scrollElement) == null ? void 0 : s.scrollTo) == null || i.call(s, {
|
|
254
|
+
[o.options.horizontal ? "left" : "top"]: r,
|
|
255
|
+
behavior: t
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
class en {
|
|
259
|
+
constructor(n) {
|
|
260
|
+
this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
|
|
261
|
+
let t = null;
|
|
262
|
+
const o = () => t || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : t = new this.targetWindow.ResizeObserver((s) => {
|
|
263
|
+
s.forEach((i) => {
|
|
264
|
+
const r = () => {
|
|
265
|
+
this._measureElement(i.target, i);
|
|
266
|
+
};
|
|
267
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
|
|
268
|
+
});
|
|
269
|
+
}));
|
|
270
|
+
return {
|
|
271
|
+
disconnect: () => {
|
|
272
|
+
var s;
|
|
273
|
+
(s = o()) == null || s.disconnect(), t = null;
|
|
274
|
+
},
|
|
275
|
+
observe: (s) => {
|
|
276
|
+
var i;
|
|
277
|
+
return (i = o()) == null ? void 0 : i.observe(s, { box: "border-box" });
|
|
278
|
+
},
|
|
279
|
+
unobserve: (s) => {
|
|
280
|
+
var i;
|
|
281
|
+
return (i = o()) == null ? void 0 : i.unobserve(s);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
})(), this.range = null, this.setOptions = (t) => {
|
|
285
|
+
Object.entries(t).forEach(([o, s]) => {
|
|
286
|
+
typeof s > "u" && delete t[o];
|
|
287
|
+
}), this.options = {
|
|
288
|
+
debug: !1,
|
|
289
|
+
initialOffset: 0,
|
|
290
|
+
overscan: 1,
|
|
291
|
+
paddingStart: 0,
|
|
292
|
+
paddingEnd: 0,
|
|
293
|
+
scrollPaddingStart: 0,
|
|
294
|
+
scrollPaddingEnd: 0,
|
|
295
|
+
horizontal: !1,
|
|
296
|
+
getItemKey: Yt,
|
|
297
|
+
rangeExtractor: Zt,
|
|
298
|
+
onChange: () => {
|
|
299
|
+
},
|
|
300
|
+
measureElement: Gt,
|
|
301
|
+
initialRect: { width: 0, height: 0 },
|
|
302
|
+
scrollMargin: 0,
|
|
303
|
+
gap: 0,
|
|
304
|
+
indexAttribute: "data-index",
|
|
305
|
+
initialMeasurementsCache: [],
|
|
306
|
+
lanes: 1,
|
|
307
|
+
isScrollingResetDelay: 150,
|
|
308
|
+
enabled: !0,
|
|
309
|
+
isRtl: !1,
|
|
310
|
+
useScrollendEvent: !1,
|
|
311
|
+
useAnimationFrameWithResizeObserver: !1,
|
|
312
|
+
...t
|
|
313
|
+
};
|
|
314
|
+
}, this.notify = (t) => {
|
|
315
|
+
var o, s;
|
|
316
|
+
(s = (o = this.options).onChange) == null || s.call(o, this, t);
|
|
317
|
+
}, this.maybeNotify = ge(
|
|
318
|
+
() => (this.calculateRange(), [
|
|
319
|
+
this.isScrolling,
|
|
320
|
+
this.range ? this.range.startIndex : null,
|
|
321
|
+
this.range ? this.range.endIndex : null
|
|
322
|
+
]),
|
|
323
|
+
(t) => {
|
|
324
|
+
this.notify(t);
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
328
|
+
debug: () => this.options.debug,
|
|
329
|
+
initialDeps: [
|
|
330
|
+
this.isScrolling,
|
|
331
|
+
this.range ? this.range.startIndex : null,
|
|
332
|
+
this.range ? this.range.endIndex : null
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
), this.cleanup = () => {
|
|
336
|
+
this.unsubs.filter(Boolean).forEach((t) => t()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
|
|
337
|
+
}, this._didMount = () => () => {
|
|
338
|
+
this.cleanup();
|
|
339
|
+
}, this._willUpdate = () => {
|
|
340
|
+
var t;
|
|
341
|
+
const o = this.options.enabled ? this.options.getScrollElement() : null;
|
|
342
|
+
if (this.scrollElement !== o) {
|
|
343
|
+
if (this.cleanup(), !o) {
|
|
344
|
+
this.maybeNotify();
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
this.scrollElement = o, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this.elementsCache.forEach((s) => {
|
|
348
|
+
this.observer.observe(s);
|
|
349
|
+
}), this._scrollToOffset(this.getScrollOffset(), {
|
|
350
|
+
adjustments: void 0,
|
|
351
|
+
behavior: void 0
|
|
352
|
+
}), this.unsubs.push(
|
|
353
|
+
this.options.observeElementRect(this, (s) => {
|
|
354
|
+
this.scrollRect = s, this.maybeNotify();
|
|
355
|
+
})
|
|
356
|
+
), this.unsubs.push(
|
|
357
|
+
this.options.observeElementOffset(this, (s, i) => {
|
|
358
|
+
this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < s ? "forward" : "backward" : null, this.scrollOffset = s, this.isScrolling = i, this.maybeNotify();
|
|
359
|
+
})
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
}, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (t, o) => {
|
|
363
|
+
const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
364
|
+
for (let r = o - 1; r >= 0; r--) {
|
|
365
|
+
const l = t[r];
|
|
366
|
+
if (s.has(l.lane))
|
|
367
|
+
continue;
|
|
368
|
+
const f = i.get(
|
|
369
|
+
l.lane
|
|
370
|
+
);
|
|
371
|
+
if (f == null || l.end > f.end ? i.set(l.lane, l) : l.end < f.end && s.set(l.lane, !0), s.size === this.options.lanes)
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
return i.size === this.options.lanes ? Array.from(i.values()).sort((r, l) => r.end === l.end ? r.index - l.index : r.end - l.end)[0] : void 0;
|
|
375
|
+
}, this.getMeasurementOptions = ge(
|
|
376
|
+
() => [
|
|
377
|
+
this.options.count,
|
|
378
|
+
this.options.paddingStart,
|
|
379
|
+
this.options.scrollMargin,
|
|
380
|
+
this.options.getItemKey,
|
|
381
|
+
this.options.enabled
|
|
382
|
+
],
|
|
383
|
+
(t, o, s, i, r) => (this.pendingMeasuredCacheIndexes = [], {
|
|
384
|
+
count: t,
|
|
385
|
+
paddingStart: o,
|
|
386
|
+
scrollMargin: s,
|
|
387
|
+
getItemKey: i,
|
|
388
|
+
enabled: r
|
|
389
|
+
}),
|
|
390
|
+
{
|
|
391
|
+
key: !1
|
|
392
|
+
}
|
|
393
|
+
), this.getMeasurements = ge(
|
|
394
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
395
|
+
({ count: t, paddingStart: o, scrollMargin: s, getItemKey: i, enabled: r }, l) => {
|
|
396
|
+
if (!r)
|
|
397
|
+
return this.measurementsCache = [], this.itemSizeCache.clear(), [];
|
|
398
|
+
this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((d) => {
|
|
399
|
+
this.itemSizeCache.set(d.key, d.size);
|
|
400
|
+
}));
|
|
401
|
+
const f = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
402
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
403
|
+
const x = this.measurementsCache.slice(0, f);
|
|
404
|
+
for (let d = f; d < t; d++) {
|
|
405
|
+
const v = i(d), u = this.options.lanes === 1 ? x[d - 1] : this.getFurthestMeasurement(x, d), g = u ? u.end + this.options.gap : o + s, a = l.get(v), h = typeof a == "number" ? a : this.options.estimateSize(d), c = g + h, y = u ? u.lane : d % this.options.lanes;
|
|
406
|
+
x[d] = {
|
|
407
|
+
index: d,
|
|
408
|
+
start: g,
|
|
409
|
+
size: h,
|
|
410
|
+
end: c,
|
|
411
|
+
key: v,
|
|
412
|
+
lane: y
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
return this.measurementsCache = x, x;
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
419
|
+
debug: () => this.options.debug
|
|
420
|
+
}
|
|
421
|
+
), this.calculateRange = ge(
|
|
422
|
+
() => [
|
|
423
|
+
this.getMeasurements(),
|
|
424
|
+
this.getSize(),
|
|
425
|
+
this.getScrollOffset(),
|
|
426
|
+
this.options.lanes
|
|
427
|
+
],
|
|
428
|
+
(t, o, s, i) => this.range = t.length > 0 && o > 0 ? tn({
|
|
429
|
+
measurements: t,
|
|
430
|
+
outerSize: o,
|
|
431
|
+
scrollOffset: s,
|
|
432
|
+
lanes: i
|
|
433
|
+
}) : null,
|
|
434
|
+
{
|
|
435
|
+
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
436
|
+
debug: () => this.options.debug
|
|
437
|
+
}
|
|
438
|
+
), this.getVirtualIndexes = ge(
|
|
439
|
+
() => {
|
|
440
|
+
let t = null, o = null;
|
|
441
|
+
const s = this.calculateRange();
|
|
442
|
+
return s && (t = s.startIndex, o = s.endIndex), this.maybeNotify.updateDeps([this.isScrolling, t, o]), [
|
|
443
|
+
this.options.rangeExtractor,
|
|
444
|
+
this.options.overscan,
|
|
445
|
+
this.options.count,
|
|
446
|
+
t,
|
|
447
|
+
o
|
|
448
|
+
];
|
|
449
|
+
},
|
|
450
|
+
(t, o, s, i, r) => i === null || r === null ? [] : t({
|
|
451
|
+
startIndex: i,
|
|
452
|
+
endIndex: r,
|
|
453
|
+
overscan: o,
|
|
454
|
+
count: s
|
|
455
|
+
}),
|
|
456
|
+
{
|
|
457
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
458
|
+
debug: () => this.options.debug
|
|
459
|
+
}
|
|
460
|
+
), this.indexFromElement = (t) => {
|
|
461
|
+
const o = this.options.indexAttribute, s = t.getAttribute(o);
|
|
462
|
+
return s ? parseInt(s, 10) : (console.warn(
|
|
463
|
+
`Missing attribute name '${o}={index}' on measured element.`
|
|
464
|
+
), -1);
|
|
465
|
+
}, this._measureElement = (t, o) => {
|
|
466
|
+
const s = this.indexFromElement(t), i = this.measurementsCache[s];
|
|
467
|
+
if (!i)
|
|
468
|
+
return;
|
|
469
|
+
const r = i.key, l = this.elementsCache.get(r);
|
|
470
|
+
l !== t && (l && this.observer.unobserve(l), this.observer.observe(t), this.elementsCache.set(r, t)), t.isConnected && this.resizeItem(s, this.options.measureElement(t, o, this));
|
|
471
|
+
}, this.resizeItem = (t, o) => {
|
|
472
|
+
const s = this.measurementsCache[t];
|
|
473
|
+
if (!s)
|
|
474
|
+
return;
|
|
475
|
+
const i = this.itemSizeCache.get(s.key) ?? s.size, r = o - i;
|
|
476
|
+
r !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(s, r, this) : s.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", r), this._scrollToOffset(this.getScrollOffset(), {
|
|
477
|
+
adjustments: this.scrollAdjustments += r,
|
|
478
|
+
behavior: void 0
|
|
479
|
+
})), this.pendingMeasuredCacheIndexes.push(s.index), this.itemSizeCache = new Map(this.itemSizeCache.set(s.key, o)), this.notify(!1));
|
|
480
|
+
}, this.measureElement = (t) => {
|
|
481
|
+
if (!t) {
|
|
482
|
+
this.elementsCache.forEach((o, s) => {
|
|
483
|
+
o.isConnected || (this.observer.unobserve(o), this.elementsCache.delete(s));
|
|
484
|
+
});
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
this._measureElement(t, void 0);
|
|
488
|
+
}, this.getVirtualItems = ge(
|
|
489
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
490
|
+
(t, o) => {
|
|
491
|
+
const s = [];
|
|
492
|
+
for (let i = 0, r = t.length; i < r; i++) {
|
|
493
|
+
const l = t[i], f = o[l];
|
|
494
|
+
s.push(f);
|
|
495
|
+
}
|
|
496
|
+
return s;
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
500
|
+
debug: () => this.options.debug
|
|
501
|
+
}
|
|
502
|
+
), this.getVirtualItemForOffset = (t) => {
|
|
503
|
+
const o = this.getMeasurements();
|
|
504
|
+
if (o.length !== 0)
|
|
505
|
+
return ke(
|
|
506
|
+
o[nt(
|
|
507
|
+
0,
|
|
508
|
+
o.length - 1,
|
|
509
|
+
(s) => ke(o[s]).start,
|
|
510
|
+
t
|
|
511
|
+
)]
|
|
512
|
+
);
|
|
513
|
+
}, this.getOffsetForAlignment = (t, o, s = 0) => {
|
|
514
|
+
const i = this.getSize(), r = this.getScrollOffset();
|
|
515
|
+
o === "auto" && (o = t >= r + i ? "end" : "start"), o === "center" ? t += (s - i) / 2 : o === "end" && (t -= i);
|
|
516
|
+
const l = this.options.horizontal ? "scrollWidth" : "scrollHeight", x = (this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[l] : this.scrollElement[l] : 0) - i;
|
|
517
|
+
return Math.max(Math.min(x, t), 0);
|
|
518
|
+
}, this.getOffsetForIndex = (t, o = "auto") => {
|
|
519
|
+
t = Math.max(0, Math.min(t, this.options.count - 1));
|
|
520
|
+
const s = this.measurementsCache[t];
|
|
521
|
+
if (!s)
|
|
522
|
+
return;
|
|
523
|
+
const i = this.getSize(), r = this.getScrollOffset();
|
|
524
|
+
if (o === "auto")
|
|
525
|
+
if (s.end >= r + i - this.options.scrollPaddingEnd)
|
|
526
|
+
o = "end";
|
|
527
|
+
else if (s.start <= r + this.options.scrollPaddingStart)
|
|
528
|
+
o = "start";
|
|
529
|
+
else
|
|
530
|
+
return [r, o];
|
|
531
|
+
const l = o === "end" ? s.end + this.options.scrollPaddingEnd : s.start - this.options.scrollPaddingStart;
|
|
532
|
+
return [
|
|
533
|
+
this.getOffsetForAlignment(l, o, s.size),
|
|
534
|
+
o
|
|
535
|
+
];
|
|
536
|
+
}, this.isDynamicMode = () => this.elementsCache.size > 0, this.cancelScrollToIndex = () => {
|
|
537
|
+
this.scrollToIndexTimeoutId !== null && this.targetWindow && (this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId), this.scrollToIndexTimeoutId = null);
|
|
538
|
+
}, this.scrollToOffset = (t, { align: o = "start", behavior: s } = {}) => {
|
|
539
|
+
this.cancelScrollToIndex(), s === "smooth" && this.isDynamicMode() && console.warn(
|
|
540
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
541
|
+
), this._scrollToOffset(this.getOffsetForAlignment(t, o), {
|
|
542
|
+
adjustments: void 0,
|
|
543
|
+
behavior: s
|
|
544
|
+
});
|
|
545
|
+
}, this.scrollToIndex = (t, { align: o = "auto", behavior: s } = {}) => {
|
|
546
|
+
t = Math.max(0, Math.min(t, this.options.count - 1)), this.cancelScrollToIndex(), s === "smooth" && this.isDynamicMode() && console.warn(
|
|
547
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
548
|
+
);
|
|
549
|
+
const i = this.getOffsetForIndex(t, o);
|
|
550
|
+
if (!i) return;
|
|
551
|
+
const [r, l] = i;
|
|
552
|
+
this._scrollToOffset(r, { adjustments: void 0, behavior: s }), s !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
|
|
553
|
+
if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
|
|
554
|
+
this.options.getItemKey(t)
|
|
555
|
+
)) {
|
|
556
|
+
const [x] = ke(
|
|
557
|
+
this.getOffsetForIndex(t, l)
|
|
558
|
+
);
|
|
559
|
+
Ht(x, this.getScrollOffset()) || this.scrollToIndex(t, { align: l, behavior: s });
|
|
560
|
+
} else
|
|
561
|
+
this.scrollToIndex(t, { align: l, behavior: s });
|
|
562
|
+
}));
|
|
563
|
+
}, this.scrollBy = (t, { behavior: o } = {}) => {
|
|
564
|
+
this.cancelScrollToIndex(), o === "smooth" && this.isDynamicMode() && console.warn(
|
|
565
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
566
|
+
), this._scrollToOffset(this.getScrollOffset() + t, {
|
|
567
|
+
adjustments: void 0,
|
|
568
|
+
behavior: o
|
|
569
|
+
});
|
|
570
|
+
}, this.getTotalSize = () => {
|
|
571
|
+
var t;
|
|
572
|
+
const o = this.getMeasurements();
|
|
573
|
+
let s;
|
|
574
|
+
if (o.length === 0)
|
|
575
|
+
s = this.options.paddingStart;
|
|
576
|
+
else if (this.options.lanes === 1)
|
|
577
|
+
s = ((t = o[o.length - 1]) == null ? void 0 : t.end) ?? 0;
|
|
578
|
+
else {
|
|
579
|
+
const i = Array(this.options.lanes).fill(null);
|
|
580
|
+
let r = o.length - 1;
|
|
581
|
+
for (; r >= 0 && i.some((l) => l === null); ) {
|
|
582
|
+
const l = o[r];
|
|
583
|
+
i[l.lane] === null && (i[l.lane] = l.end), r--;
|
|
584
|
+
}
|
|
585
|
+
s = Math.max(...i.filter((l) => l !== null));
|
|
586
|
+
}
|
|
587
|
+
return Math.max(
|
|
588
|
+
s - this.options.scrollMargin + this.options.paddingEnd,
|
|
589
|
+
0
|
|
590
|
+
);
|
|
591
|
+
}, this._scrollToOffset = (t, {
|
|
592
|
+
adjustments: o,
|
|
593
|
+
behavior: s
|
|
594
|
+
}) => {
|
|
595
|
+
this.options.scrollToFn(t, { behavior: s, adjustments: o }, this);
|
|
596
|
+
}, this.measure = () => {
|
|
597
|
+
this.itemSizeCache = /* @__PURE__ */ new Map(), this.notify(!1);
|
|
598
|
+
}, this.setOptions(n);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
const nt = (e, n, t, o) => {
|
|
602
|
+
for (; e <= n; ) {
|
|
603
|
+
const s = (e + n) / 2 | 0, i = t(s);
|
|
604
|
+
if (i < o)
|
|
605
|
+
e = s + 1;
|
|
606
|
+
else if (i > o)
|
|
607
|
+
n = s - 1;
|
|
608
|
+
else
|
|
609
|
+
return s;
|
|
610
|
+
}
|
|
611
|
+
return e > 0 ? e - 1 : 0;
|
|
612
|
+
};
|
|
613
|
+
function tn({
|
|
614
|
+
measurements: e,
|
|
615
|
+
outerSize: n,
|
|
616
|
+
scrollOffset: t,
|
|
617
|
+
lanes: o
|
|
618
|
+
}) {
|
|
619
|
+
const s = e.length - 1, i = (f) => e[f].start;
|
|
620
|
+
if (e.length <= o)
|
|
621
|
+
return {
|
|
622
|
+
startIndex: 0,
|
|
623
|
+
endIndex: s
|
|
624
|
+
};
|
|
625
|
+
let r = nt(
|
|
626
|
+
0,
|
|
627
|
+
s,
|
|
628
|
+
i,
|
|
629
|
+
t
|
|
630
|
+
), l = r;
|
|
631
|
+
if (o === 1)
|
|
632
|
+
for (; l < s && e[l].end < t + n; )
|
|
633
|
+
l++;
|
|
634
|
+
else if (o > 1) {
|
|
635
|
+
const f = Array(o).fill(0);
|
|
636
|
+
for (; l < s && f.some((d) => d < t + n); ) {
|
|
637
|
+
const d = e[l];
|
|
638
|
+
f[d.lane] = d.end, l++;
|
|
639
|
+
}
|
|
640
|
+
const x = Array(o).fill(t + n);
|
|
641
|
+
for (; r >= 0 && x.some((d) => d >= t); ) {
|
|
642
|
+
const d = e[r];
|
|
643
|
+
x[d.lane] = d.start, r--;
|
|
644
|
+
}
|
|
645
|
+
r = Math.max(0, r - r % o), l = Math.min(s, l + (o - 1 - l % o));
|
|
646
|
+
}
|
|
647
|
+
return { startIndex: r, endIndex: l };
|
|
648
|
+
}
|
|
649
|
+
const He = typeof document < "u" ? Ce.useLayoutEffect : Ce.useEffect;
|
|
650
|
+
function nn(e) {
|
|
651
|
+
const n = Ce.useReducer(() => ({}), {})[1], t = {
|
|
652
|
+
...e,
|
|
653
|
+
onChange: (s, i) => {
|
|
654
|
+
var r;
|
|
655
|
+
i ? yt(n) : n(), (r = e.onChange) == null || r.call(e, s, i);
|
|
656
|
+
}
|
|
657
|
+
}, [o] = Ce.useState(
|
|
658
|
+
() => new en(t)
|
|
659
|
+
);
|
|
660
|
+
return o.setOptions(t), He(() => o._didMount(), []), He(() => o._willUpdate()), o;
|
|
661
|
+
}
|
|
662
|
+
function ot(e) {
|
|
663
|
+
return nn({
|
|
664
|
+
observeElementRect: Qt,
|
|
665
|
+
observeElementOffset: Jt,
|
|
666
|
+
scrollToFn: Xt,
|
|
667
|
+
...e
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
const on = N.div`
|
|
671
|
+
width: 8px;
|
|
672
|
+
height: 8px;
|
|
673
|
+
border-radius: 50%;
|
|
674
|
+
background-color: #ffffff;
|
|
675
|
+
|
|
676
|
+
position: absolute;
|
|
677
|
+
top: 50%;
|
|
678
|
+
left: 50%;
|
|
679
|
+
transform: translate(-50%, -50%);
|
|
680
|
+
`, sn = le(
|
|
681
|
+
({ color: e, ...n }, t) => /* @__PURE__ */ A.jsx(on, { style: { backgroundColor: e }, ...n, ref: t })
|
|
682
|
+
), rn = N.input`
|
|
683
|
+
z-index: 10;
|
|
684
|
+
border: none;
|
|
685
|
+
outline: none;
|
|
686
|
+
padding: 0;
|
|
687
|
+
padding-left: 1px;
|
|
688
|
+
margin: 0;
|
|
689
|
+
cursor: text;
|
|
690
|
+
font-size: inherit;
|
|
691
|
+
font-family: inherit;
|
|
692
|
+
font-weight: inherit;
|
|
693
|
+
background-color: transparent;
|
|
694
|
+
width: 100%;
|
|
695
|
+
box-sizing: border-box;
|
|
696
|
+
`, ln = le(
|
|
697
|
+
({ value: e, onChange: n, onCancel: t, autoFocus: o = !0, ...s }, i) => {
|
|
698
|
+
const [r, l] = Q(() => {
|
|
699
|
+
if (e) {
|
|
700
|
+
const g = Ue(e);
|
|
701
|
+
if (Se(g))
|
|
702
|
+
return Oe(g, "yyyy-MM-dd");
|
|
703
|
+
}
|
|
704
|
+
return "";
|
|
705
|
+
});
|
|
706
|
+
J(() => {
|
|
707
|
+
if (e) {
|
|
708
|
+
const g = Ue(e);
|
|
709
|
+
Se(g) ? l(Oe(g, "yyyy-MM-dd")) : l("");
|
|
710
|
+
}
|
|
711
|
+
}, [e]);
|
|
712
|
+
const f = re(null);
|
|
713
|
+
J(() => {
|
|
714
|
+
o && f.current && (f.current.focus(), setTimeout(() => {
|
|
715
|
+
var g;
|
|
716
|
+
try {
|
|
717
|
+
(g = f.current) == null || g.showPicker();
|
|
718
|
+
} catch (a) {
|
|
719
|
+
console.debug("Date picker could not be shown automatically:", a);
|
|
720
|
+
}
|
|
721
|
+
}, 100));
|
|
722
|
+
}, [o]);
|
|
723
|
+
const x = (g) => {
|
|
724
|
+
var a;
|
|
725
|
+
g.preventDefault();
|
|
726
|
+
try {
|
|
727
|
+
(a = f.current) == null || a.showPicker();
|
|
728
|
+
} catch (h) {
|
|
729
|
+
console.debug("Date picker could not be shown on click:", h);
|
|
730
|
+
}
|
|
731
|
+
}, d = (g) => {
|
|
732
|
+
if (r) {
|
|
733
|
+
const a = Date.parse(r);
|
|
734
|
+
if (Se(a)) {
|
|
735
|
+
const h = new Date(a);
|
|
736
|
+
return h.setUTCHours(0, 0, 0, 0), n(h.toISOString(), g), !0;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return !1;
|
|
740
|
+
}, v = () => {
|
|
741
|
+
d("Click") || t == null || t();
|
|
742
|
+
}, u = (g) => {
|
|
743
|
+
var a;
|
|
744
|
+
g.key === "Enter" ? (g.preventDefault(), d("Enter"), (a = f.current) == null || a.blur()) : g.key === "Escape" && (g.preventDefault(), t == null || t());
|
|
745
|
+
};
|
|
746
|
+
return /* @__PURE__ */ A.jsx(
|
|
747
|
+
rn,
|
|
748
|
+
{
|
|
749
|
+
...s,
|
|
750
|
+
ref: f,
|
|
751
|
+
type: "date",
|
|
752
|
+
value: r,
|
|
753
|
+
onChange: (g) => l(g.target.value),
|
|
754
|
+
onBlur: v,
|
|
755
|
+
onKeyDown: u,
|
|
756
|
+
onClick: x
|
|
757
|
+
}
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
), an = le(
|
|
761
|
+
({ value: e, isEditing: n, isReadOnly: t, isInherited: o, onChange: s, onCancelEdit: i, ...r }, l) => {
|
|
762
|
+
let f = "";
|
|
763
|
+
try {
|
|
764
|
+
f = Oe(new Date(e), "dd-MM-yyyy");
|
|
765
|
+
} catch {
|
|
766
|
+
console.error("Invalid date value:", e), f = "Invalid Date";
|
|
767
|
+
}
|
|
768
|
+
return n ? /* @__PURE__ */ A.jsx(
|
|
769
|
+
ln,
|
|
770
|
+
{
|
|
771
|
+
value: e,
|
|
772
|
+
onChange: s,
|
|
773
|
+
onCancel: i,
|
|
774
|
+
readOnly: t,
|
|
775
|
+
disabled: t,
|
|
776
|
+
...r
|
|
777
|
+
}
|
|
778
|
+
) : /* @__PURE__ */ A.jsx("span", { ...r, ref: l, children: f });
|
|
779
|
+
}
|
|
780
|
+
), dn = N.div`
|
|
781
|
+
display: flex;
|
|
782
|
+
gap: var(--base-gap-small);
|
|
783
|
+
align-items: center;
|
|
784
|
+
width: 100%;
|
|
785
|
+
height: 100%;
|
|
786
|
+
overflow: hidden;
|
|
787
|
+
border-radius: var(--border-radius-m);
|
|
788
|
+
padding: 0 2px;
|
|
789
|
+
cursor: pointer;
|
|
790
|
+
|
|
791
|
+
&:hover {
|
|
792
|
+
background-color: var(--md-sys-color-surface-container-high-hover);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
&.item {
|
|
796
|
+
padding: 4px 2px;
|
|
797
|
+
border-radius: 0;
|
|
798
|
+
|
|
799
|
+
&:hover {
|
|
800
|
+
background-color: var(--md-sys-color-surface-container-hover);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
&.selected {
|
|
805
|
+
background-color: var(--md-sys-color-primary-container);
|
|
806
|
+
|
|
807
|
+
&:hover {
|
|
808
|
+
background-color: var(--md-sys-color-primary-container-hover);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
`, cn = N.div`
|
|
812
|
+
display: flex;
|
|
813
|
+
gap: var(--base-gap-small);
|
|
814
|
+
align-items: center;
|
|
815
|
+
overflow: hidden;
|
|
816
|
+
border-radius: var(--border-radius-m);
|
|
817
|
+
`, un = N.div`
|
|
818
|
+
display: flex;
|
|
819
|
+
gap: var(--base-gap-small);
|
|
820
|
+
align-items: center;
|
|
821
|
+
|
|
822
|
+
overflow: hidden;
|
|
823
|
+
max-width: 100%;
|
|
824
|
+
min-width: 20px;
|
|
825
|
+
`, hn = N.span`
|
|
826
|
+
/* push expand icon to the end */
|
|
827
|
+
flex: 1;
|
|
828
|
+
overflow: hidden;
|
|
829
|
+
white-space: nowrap;
|
|
830
|
+
width: 100%;
|
|
831
|
+
text-overflow: ellipsis;
|
|
832
|
+
text-align: left;
|
|
833
|
+
border-radius: var(--border-radius-m);
|
|
834
|
+
padding: 0px 2px;
|
|
835
|
+
text-align: center;
|
|
836
|
+
|
|
837
|
+
&.placeholder {
|
|
838
|
+
color: var(--md-sys-color-outline);
|
|
839
|
+
}
|
|
840
|
+
`, fn = N.img`
|
|
841
|
+
width: 20px;
|
|
842
|
+
height: 20px;
|
|
843
|
+
object-fit: cover;
|
|
844
|
+
|
|
845
|
+
&.avatar {
|
|
846
|
+
border-radius: 50%;
|
|
847
|
+
}
|
|
848
|
+
`, gn = N(ae)`
|
|
849
|
+
margin-left: auto;
|
|
850
|
+
transition: rotate 0.2s;
|
|
851
|
+
`, mn = N(At)`
|
|
852
|
+
height: 100%;
|
|
853
|
+
width: 100%;
|
|
854
|
+
`, pn = (e = "") => e.startsWith("/") || e.startsWith("./") || e.startsWith("../") || e.startsWith("http://") || e.startsWith("https://"), yn = (e) => e.includes("avatar"), wn = le(
|
|
855
|
+
({
|
|
856
|
+
value: e,
|
|
857
|
+
isEditing: n,
|
|
858
|
+
options: t,
|
|
859
|
+
type: o,
|
|
860
|
+
autoOpen: s = !0,
|
|
861
|
+
isReadOnly: i,
|
|
862
|
+
enableCustomValues: r,
|
|
863
|
+
onOpen: l,
|
|
864
|
+
onChange: f,
|
|
865
|
+
onCancelEdit: x,
|
|
866
|
+
onNext: d,
|
|
867
|
+
pt: v,
|
|
868
|
+
...u
|
|
869
|
+
}, g) => {
|
|
870
|
+
var D;
|
|
871
|
+
const a = e.map((b) => b == null ? void 0 : b.toString()).filter((b) => !!b);
|
|
872
|
+
let h = t.filter(
|
|
873
|
+
(b) => a.includes(b.value.toString())
|
|
874
|
+
);
|
|
875
|
+
a.forEach((b) => {
|
|
876
|
+
t.find((I) => I.value === b) || (h = [
|
|
877
|
+
...h,
|
|
878
|
+
{
|
|
879
|
+
label: b,
|
|
880
|
+
value: b,
|
|
881
|
+
color: r ? "var(--md-sys-color-surface-container)" : "var(--md-sys-color-error)",
|
|
882
|
+
icon: r ? void 0 : "warning"
|
|
883
|
+
}
|
|
884
|
+
]);
|
|
885
|
+
});
|
|
886
|
+
const c = h.length > 1, y = re(null), p = (b) => {
|
|
887
|
+
b.target instanceof HTMLElement && b.target.closest(".expand") && l && !i && (l(), b.stopPropagation());
|
|
888
|
+
}, [w, m] = Q(!1);
|
|
889
|
+
J(() => {
|
|
890
|
+
var b;
|
|
891
|
+
n && y.current && s ? (!y.current.isOpen && ((b = y.current) == null || b.open()), m(!0)) : m(!1);
|
|
892
|
+
}, [n, y.current, s]), J(() => {
|
|
893
|
+
var b;
|
|
894
|
+
if (w) {
|
|
895
|
+
const I = (b = y.current) == null ? void 0 : b.getOptions(), C = I == null ? void 0 : I.querySelector("li");
|
|
896
|
+
C && (C.focus(), C.style.outline = "none");
|
|
897
|
+
}
|
|
898
|
+
}, [w]);
|
|
899
|
+
const E = !!(o != null && o.includes("list")), k = (b) => {
|
|
900
|
+
const I = r ? b : b.filter((C) => t.find((S) => S.value === C));
|
|
901
|
+
o != null && o.includes("list") ? f(I, "Click") : f(I[0], "Click");
|
|
902
|
+
};
|
|
903
|
+
return n ? /* @__PURE__ */ A.jsx(
|
|
904
|
+
mn,
|
|
905
|
+
{
|
|
906
|
+
options: t,
|
|
907
|
+
value: a,
|
|
908
|
+
ref: y,
|
|
909
|
+
valueTemplate: (b, I, C) => {
|
|
910
|
+
var S;
|
|
911
|
+
return /* @__PURE__ */ A.jsx(
|
|
912
|
+
De,
|
|
913
|
+
{
|
|
914
|
+
selectedOptions: h,
|
|
915
|
+
hasMultipleValues: I.length > 1,
|
|
916
|
+
isOpen: C,
|
|
917
|
+
isReadOnly: i,
|
|
918
|
+
isMultiSelect: E,
|
|
919
|
+
...v == null ? void 0 : v.template,
|
|
920
|
+
placeholder: u.placeholder,
|
|
921
|
+
className: q("enum-dropdown-value", (S = v == null ? void 0 : v.template) == null ? void 0 : S.className)
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
},
|
|
925
|
+
itemTemplate: (b, I, C) => {
|
|
926
|
+
var S;
|
|
927
|
+
return /* @__PURE__ */ A.jsx(
|
|
928
|
+
De,
|
|
929
|
+
{
|
|
930
|
+
selectedOptions: [b],
|
|
931
|
+
hasMultipleValues: !1,
|
|
932
|
+
isOpen: !1,
|
|
933
|
+
isItem: !0,
|
|
934
|
+
isSelected: C,
|
|
935
|
+
...v == null ? void 0 : v.template,
|
|
936
|
+
className: q("enum-dropdown-item", (S = v == null ? void 0 : v.template) == null ? void 0 : S.className)
|
|
937
|
+
}
|
|
938
|
+
);
|
|
939
|
+
},
|
|
940
|
+
widthExpand: !0,
|
|
941
|
+
multiSelect: E,
|
|
942
|
+
disableOpen: i,
|
|
943
|
+
disabled: i,
|
|
944
|
+
sortBySelected: !0,
|
|
945
|
+
...u,
|
|
946
|
+
onChange: k,
|
|
947
|
+
onClose: x
|
|
948
|
+
}
|
|
949
|
+
) : /* @__PURE__ */ A.jsx(
|
|
950
|
+
De,
|
|
951
|
+
{
|
|
952
|
+
selectedOptions: h,
|
|
953
|
+
hasMultipleValues: c,
|
|
954
|
+
onClick: p,
|
|
955
|
+
isMultiSelect: E,
|
|
956
|
+
isReadOnly: i,
|
|
957
|
+
...v == null ? void 0 : v.template,
|
|
958
|
+
placeholder: u.placeholder,
|
|
959
|
+
className: q("enum-value", (D = v == null ? void 0 : v.template) == null ? void 0 : D.className, u.className)
|
|
960
|
+
}
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
), De = ({
|
|
964
|
+
selectedOptions: e,
|
|
965
|
+
placeholder: n,
|
|
966
|
+
hasMultipleValues: t,
|
|
967
|
+
isMultiSelect: o,
|
|
968
|
+
isOpen: s,
|
|
969
|
+
isItem: i,
|
|
970
|
+
isSelected: r,
|
|
971
|
+
isReadOnly: l,
|
|
972
|
+
className: f,
|
|
973
|
+
...x
|
|
974
|
+
}) => {
|
|
975
|
+
const d = e.every((a) => a.icon), v = !t || !d, u = !d && o && !i, g = !e.length && n;
|
|
976
|
+
return g && (e = [
|
|
977
|
+
{
|
|
978
|
+
label: n,
|
|
979
|
+
value: ""
|
|
980
|
+
}
|
|
981
|
+
]), /* @__PURE__ */ A.jsxs(dn, { className: q(f, { selected: r, item: i }), ...x, children: [
|
|
982
|
+
/* @__PURE__ */ A.jsx(cn, { children: e.map((a, h) => /* @__PURE__ */ A.jsxs(un, { children: [
|
|
983
|
+
a.icon && pn(a.icon) ? /* @__PURE__ */ A.jsx(
|
|
984
|
+
fn,
|
|
985
|
+
{
|
|
986
|
+
src: a.icon,
|
|
987
|
+
className: q({ avatar: yn(a.icon) })
|
|
988
|
+
}
|
|
989
|
+
) : a.icon ? /* @__PURE__ */ A.jsx(ae, { icon: a.icon, style: { color: a.color } }) : null,
|
|
990
|
+
(v || !a.icon) && /* @__PURE__ */ A.jsx(
|
|
991
|
+
hn,
|
|
992
|
+
{
|
|
993
|
+
style: {
|
|
994
|
+
color: u ? "inherit" : a.color,
|
|
995
|
+
backgroundColor: u ? a.color || "var(--md-sys-color-surface-container)" : "transparent"
|
|
996
|
+
},
|
|
997
|
+
className: q({ placeholder: g }),
|
|
998
|
+
children: a.label
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] }, a.value.toString() + h)) }),
|
|
1002
|
+
!i && !l && /* @__PURE__ */ A.jsx(
|
|
1003
|
+
gn,
|
|
1004
|
+
{
|
|
1005
|
+
className: "expand",
|
|
1006
|
+
icon: "expand_more",
|
|
1007
|
+
style: { rotate: s ? "180deg" : "0" }
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
] });
|
|
1011
|
+
}, bn = N.input`
|
|
1012
|
+
z-index: 10;
|
|
1013
|
+
border: none;
|
|
1014
|
+
outline: none;
|
|
1015
|
+
padding: 0;
|
|
1016
|
+
padding-left: 1px;
|
|
1017
|
+
margin: 0;
|
|
1018
|
+
cursor: text;
|
|
1019
|
+
font-size: inherit;
|
|
1020
|
+
font-family: inherit;
|
|
1021
|
+
font-weight: inherit;
|
|
1022
|
+
background-color: transparent;
|
|
1023
|
+
width: 100%;
|
|
1024
|
+
box-sizing: border-box;
|
|
1025
|
+
`, xn = le(
|
|
1026
|
+
({ value: e, onChange: n, onCancel: t, autoFocus: o = !0, ...s }, i) => {
|
|
1027
|
+
const [r, l] = Q(e), f = re(null), x = re(!1);
|
|
1028
|
+
J(() => {
|
|
1029
|
+
o && f && f.current && (f.current.focus(), f.current.select());
|
|
1030
|
+
}, [o]);
|
|
1031
|
+
const d = (u) => {
|
|
1032
|
+
u.key === "Enter" ? (u.preventDefault(), n(r, "Enter")) : u.key === "Escape" && (u.preventDefault(), u.stopPropagation(), x.current = !0, t == null || t());
|
|
1033
|
+
}, v = (u) => {
|
|
1034
|
+
var g;
|
|
1035
|
+
((g = u.relatedTarget) == null ? void 0 : g.tagName) !== "INPUT" && (x.current || n(r, "Click"), x.current = !1);
|
|
1036
|
+
};
|
|
1037
|
+
return /* @__PURE__ */ A.jsx(
|
|
1038
|
+
bn,
|
|
1039
|
+
{
|
|
1040
|
+
...s,
|
|
1041
|
+
ref: f,
|
|
1042
|
+
value: r,
|
|
1043
|
+
onChange: (u) => l(u.target.value),
|
|
1044
|
+
onKeyDown: d,
|
|
1045
|
+
onBlur: v
|
|
1046
|
+
}
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
), In = N.span`
|
|
1050
|
+
overflow: hidden;
|
|
1051
|
+
text-overflow: ellipsis;
|
|
1052
|
+
white-space: nowrap;
|
|
1053
|
+
`, qe = le(
|
|
1054
|
+
({ value: e, isEditing: n, isInherited: t, onChange: o, onCancelEdit: s, ...i }, r) => n ? /* @__PURE__ */ A.jsx(xn, { value: e, onChange: o, onCancel: s, type: "text" }) : /* @__PURE__ */ A.jsx(In, { ...i, ref: r, children: e })
|
|
1055
|
+
), vn = N.input`
|
|
1056
|
+
margin: auto;
|
|
1057
|
+
z-index: 1;
|
|
1058
|
+
cursor: pointer;
|
|
1059
|
+
|
|
1060
|
+
width: 16px;
|
|
1061
|
+
height: 16px;
|
|
1062
|
+
background-color: transparent;
|
|
1063
|
+
border: 1px solid var(--md-sys-color-outline);
|
|
1064
|
+
appearance: none;
|
|
1065
|
+
border-radius: 2px;
|
|
1066
|
+
|
|
1067
|
+
&:hover {
|
|
1068
|
+
border-color: hsl(212.31deg 16.83% 74.65%);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
&:checked {
|
|
1072
|
+
background-color: var(--md-sys-color-primary);
|
|
1073
|
+
border-color: var(--md-sys-color-primary);
|
|
1074
|
+
appearance: auto;
|
|
1075
|
+
}
|
|
1076
|
+
`, Cn = le(
|
|
1077
|
+
({ value: e, onChange: n, isReadOnly: t, isEditing: o, onCancelEdit: s, ...i }, r) => /* @__PURE__ */ A.jsx(
|
|
1078
|
+
vn,
|
|
1079
|
+
{
|
|
1080
|
+
...i,
|
|
1081
|
+
checked: e,
|
|
1082
|
+
onChange: (l) => n(l.target.checked),
|
|
1083
|
+
ref: r,
|
|
1084
|
+
type: "checkbox",
|
|
1085
|
+
disabled: t,
|
|
1086
|
+
readOnly: t
|
|
1087
|
+
}
|
|
1088
|
+
)
|
|
1089
|
+
), st = de(
|
|
1090
|
+
void 0
|
|
1091
|
+
), Lo = ({
|
|
1092
|
+
children: e,
|
|
1093
|
+
updateEntities: n,
|
|
1094
|
+
getFoldersTasks: t
|
|
1095
|
+
}) => /* @__PURE__ */ A.jsx(
|
|
1096
|
+
st.Provider,
|
|
1097
|
+
{
|
|
1098
|
+
value: {
|
|
1099
|
+
updateEntities: n,
|
|
1100
|
+
getFoldersTasks: t
|
|
1101
|
+
},
|
|
1102
|
+
children: e
|
|
1103
|
+
}
|
|
1104
|
+
), _e = () => {
|
|
1105
|
+
const e = ce(st);
|
|
1106
|
+
if (!e)
|
|
1107
|
+
throw new Error(
|
|
1108
|
+
"useProjectTableQueriesContext must be used within a ProjectTableQueriesProvider"
|
|
1109
|
+
);
|
|
1110
|
+
return e;
|
|
1111
|
+
}, $e = (e, n = 50, { type: t = "folder", parentId: o } = {}) => new Array(n).fill(0).map(
|
|
1112
|
+
(s, i) => ({
|
|
1113
|
+
id: `loading-${t}-${i}-${o}`,
|
|
1114
|
+
name: "Loading...",
|
|
1115
|
+
parentId: o,
|
|
1116
|
+
isLoading: !0,
|
|
1117
|
+
label: "Loading...",
|
|
1118
|
+
color: null,
|
|
1119
|
+
icon: null,
|
|
1120
|
+
img: null,
|
|
1121
|
+
entityType: t,
|
|
1122
|
+
ownAttrib: [],
|
|
1123
|
+
tags: [],
|
|
1124
|
+
subRows: [],
|
|
1125
|
+
path: "",
|
|
1126
|
+
attrib: e.reduce((r, l) => (r[l.name] = null, r), {})
|
|
1127
|
+
})
|
|
1128
|
+
), Tn = (e = 10) => Array(e).fill(null).map((n, t) => ({
|
|
1129
|
+
name: `loading-attribute${t}`,
|
|
1130
|
+
scope: ["folder", "task"],
|
|
1131
|
+
data: {
|
|
1132
|
+
type: "string"
|
|
1133
|
+
},
|
|
1134
|
+
position: t
|
|
1135
|
+
})), Wo = ({
|
|
1136
|
+
expandedFoldersTasks: e,
|
|
1137
|
+
expandedParentIds: n,
|
|
1138
|
+
foldersMap: t
|
|
1139
|
+
}) => {
|
|
1140
|
+
var f;
|
|
1141
|
+
const o = e.map((x) => x.folderId), s = n.filter(
|
|
1142
|
+
(x) => {
|
|
1143
|
+
var d;
|
|
1144
|
+
return (d = t.get(x)) == null ? void 0 : d.hasTasks;
|
|
1145
|
+
}
|
|
1146
|
+
), i = new Set(o), r = /* @__PURE__ */ new Set();
|
|
1147
|
+
for (const x of s)
|
|
1148
|
+
i.has(x) || r.add(x);
|
|
1149
|
+
const l = {};
|
|
1150
|
+
for (const x of r) {
|
|
1151
|
+
const d = t.get(x);
|
|
1152
|
+
d && (l[x] = ((f = d.taskNames) == null ? void 0 : f.length) || 0);
|
|
1153
|
+
}
|
|
1154
|
+
return l;
|
|
1155
|
+
}, Sn = 100;
|
|
1156
|
+
function En({
|
|
1157
|
+
foldersMap: e,
|
|
1158
|
+
tasksMap: n,
|
|
1159
|
+
tasksByFolderMap: t,
|
|
1160
|
+
expanded: o,
|
|
1161
|
+
folderTypes: s = [],
|
|
1162
|
+
taskTypes: i = [],
|
|
1163
|
+
showHierarchy: r,
|
|
1164
|
+
loadingTasks: l = {},
|
|
1165
|
+
isLoadingMore: f = !1
|
|
1166
|
+
}) {
|
|
1167
|
+
const x = U(() => {
|
|
1168
|
+
const c = /* @__PURE__ */ new Map();
|
|
1169
|
+
for (const y of s)
|
|
1170
|
+
c.set(y.name, y);
|
|
1171
|
+
return c;
|
|
1172
|
+
}, [s]), d = U(() => {
|
|
1173
|
+
const c = /* @__PURE__ */ new Map();
|
|
1174
|
+
for (const y of i)
|
|
1175
|
+
c.set(y.name, y);
|
|
1176
|
+
return c;
|
|
1177
|
+
}, [i]), v = U(() => JSON.stringify(o), [o]), u = U(() => new Set(
|
|
1178
|
+
Object.entries(o).filter(([c, y]) => y).map(([c]) => c)
|
|
1179
|
+
), [v]), { childToParentMap: g, parentToChildrenMap: a } = U(() => {
|
|
1180
|
+
const c = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
|
|
1181
|
+
for (const p of e.values()) {
|
|
1182
|
+
if (!p.id) continue;
|
|
1183
|
+
const w = p.parentId;
|
|
1184
|
+
if (w) {
|
|
1185
|
+
c.set(p.id, w);
|
|
1186
|
+
let m = y.get(w);
|
|
1187
|
+
m || (m = /* @__PURE__ */ new Set(), y.set(w, m)), m.add(p.id);
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return { childToParentMap: c, parentToChildrenMap: y };
|
|
1191
|
+
}, [e]), h = U(() => {
|
|
1192
|
+
const c = /* @__PURE__ */ new Set(), y = [];
|
|
1193
|
+
for (const p of e.values())
|
|
1194
|
+
p.id && (!p.parentId || !e.has(p.parentId)) && (c.add(p.id), y.push(p.id));
|
|
1195
|
+
for (; y.length > 0; ) {
|
|
1196
|
+
const p = y.shift();
|
|
1197
|
+
if (!u.has(p)) continue;
|
|
1198
|
+
const m = a.get(p);
|
|
1199
|
+
if (m)
|
|
1200
|
+
for (const E of m)
|
|
1201
|
+
c.has(E) || (c.add(E), y.push(E));
|
|
1202
|
+
}
|
|
1203
|
+
return c;
|
|
1204
|
+
}, [e, a, u]);
|
|
1205
|
+
return U(() => {
|
|
1206
|
+
var w, m, E, k, D, b, I;
|
|
1207
|
+
const c = (C, S) => {
|
|
1208
|
+
var j, T;
|
|
1209
|
+
return {
|
|
1210
|
+
id: C.id,
|
|
1211
|
+
entityType: "task",
|
|
1212
|
+
parentId: S || C.folderId,
|
|
1213
|
+
name: C.name || "",
|
|
1214
|
+
label: C.label || C.name || "",
|
|
1215
|
+
icon: ((j = d.get(C.taskType)) == null ? void 0 : j.icon) || null,
|
|
1216
|
+
color: ((T = d.get(C.taskType)) == null ? void 0 : T.color) || null,
|
|
1217
|
+
status: C.status,
|
|
1218
|
+
assignees: C.assignees,
|
|
1219
|
+
tags: C.tags,
|
|
1220
|
+
img: null,
|
|
1221
|
+
subRows: [],
|
|
1222
|
+
subType: C.taskType || null,
|
|
1223
|
+
attrib: C.attrib,
|
|
1224
|
+
ownAttrib: C.ownAttrib,
|
|
1225
|
+
path: C.folder.path
|
|
1226
|
+
};
|
|
1227
|
+
};
|
|
1228
|
+
if (!r) {
|
|
1229
|
+
const C = [];
|
|
1230
|
+
for (const S of n.values())
|
|
1231
|
+
S.id && C.push(c(S));
|
|
1232
|
+
if (C.length > 1 && C.sort((S, j) => S.name < j.name ? -1 : S.name > j.name ? 1 : 0), f) {
|
|
1233
|
+
const S = ((E = (m = (w = n.entries().next()) == null ? void 0 : w.value) == null ? void 0 : m[1]) == null ? void 0 : E.attrib) || {}, j = Object.keys(S).map((z) => ({
|
|
1234
|
+
name: z
|
|
1235
|
+
})), T = Sn;
|
|
1236
|
+
{
|
|
1237
|
+
const z = $e(j, T, {
|
|
1238
|
+
type: "task"
|
|
1239
|
+
});
|
|
1240
|
+
C.push(...z);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return C;
|
|
1244
|
+
}
|
|
1245
|
+
const y = /* @__PURE__ */ new Map(), p = [];
|
|
1246
|
+
for (const C of h) {
|
|
1247
|
+
const S = e.get(C);
|
|
1248
|
+
if (!S) continue;
|
|
1249
|
+
const j = {
|
|
1250
|
+
id: C,
|
|
1251
|
+
entityType: "folder",
|
|
1252
|
+
parentId: S.parentId || void 0,
|
|
1253
|
+
name: S.name || "",
|
|
1254
|
+
label: S.label || S.name || "",
|
|
1255
|
+
icon: ((k = x.get(S.folderType)) == null ? void 0 : k.icon) || null,
|
|
1256
|
+
color: null,
|
|
1257
|
+
img: null,
|
|
1258
|
+
subRows: [],
|
|
1259
|
+
status: S.status,
|
|
1260
|
+
tags: S.tags || [],
|
|
1261
|
+
subType: S.folderType || null,
|
|
1262
|
+
ownAttrib: S.ownAttrib || [],
|
|
1263
|
+
path: S.path,
|
|
1264
|
+
attrib: S.attrib || {},
|
|
1265
|
+
childOnlyMatch: S.childOnlyMatch || !1
|
|
1266
|
+
};
|
|
1267
|
+
if (y.set(C, j), (!S.parentId || !e.has(S.parentId)) && p.push(j), u.has(C)) {
|
|
1268
|
+
const z = (t.get(C) || []).flatMap((R) => n.get(R) || []);
|
|
1269
|
+
if (z.length || l[C]) {
|
|
1270
|
+
const R = new Array(z.length);
|
|
1271
|
+
for (let O = 0; O < z.length; O++)
|
|
1272
|
+
R[O] = c(z[O], C);
|
|
1273
|
+
if (l[C]) {
|
|
1274
|
+
const O = ((I = (b = (D = n.entries().next()) == null ? void 0 : D.value) == null ? void 0 : b[1]) == null ? void 0 : I.attrib) || {}, $ = Object.keys(O).map((_) => ({
|
|
1275
|
+
name: _
|
|
1276
|
+
})), F = l[C];
|
|
1277
|
+
if (F > 0) {
|
|
1278
|
+
const _ = $e($, F, {
|
|
1279
|
+
type: "task",
|
|
1280
|
+
parentId: C
|
|
1281
|
+
});
|
|
1282
|
+
R.push(..._);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
R.length > 1 && R.sort((O, $) => O.name < $.name ? -1 : O.name > $.name ? 1 : 0), j.subRows = R;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
for (const C of h) {
|
|
1290
|
+
const S = g.get(C);
|
|
1291
|
+
if (!S || !u.has(S)) continue;
|
|
1292
|
+
const j = y.get(C), T = y.get(S);
|
|
1293
|
+
!j || !T || T.subRows.push(j);
|
|
1294
|
+
}
|
|
1295
|
+
for (const C of u) {
|
|
1296
|
+
const S = y.get(C);
|
|
1297
|
+
if (!S || S.subRows.length <= 1) continue;
|
|
1298
|
+
S.subRows.some((T) => T.entityType === "task") && S.subRows.some((T) => T.entityType === "folder") && S.subRows.sort((T, z) => {
|
|
1299
|
+
const R = T.entityType === "task" ? 0 : 1, O = z.entityType === "task" ? 0 : 1;
|
|
1300
|
+
return R !== O ? R - O : T.name < z.name ? -1 : T.name > z.name ? 1 : 0;
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
return p.length > 1 && p.sort((C, S) => C.name < S.name ? -1 : C.name > S.name ? 1 : 0), p;
|
|
1304
|
+
}, [
|
|
1305
|
+
e,
|
|
1306
|
+
n,
|
|
1307
|
+
h,
|
|
1308
|
+
g,
|
|
1309
|
+
u,
|
|
1310
|
+
r,
|
|
1311
|
+
d,
|
|
1312
|
+
l,
|
|
1313
|
+
f
|
|
1314
|
+
]);
|
|
1315
|
+
}
|
|
1316
|
+
function An({
|
|
1317
|
+
foldersMap: e,
|
|
1318
|
+
tasksMap: n,
|
|
1319
|
+
tasksByFolderMap: t,
|
|
1320
|
+
getEntityById: o,
|
|
1321
|
+
projectAttrib: s,
|
|
1322
|
+
attribFields: i
|
|
1323
|
+
}) {
|
|
1324
|
+
const r = U(() => {
|
|
1325
|
+
const g = /* @__PURE__ */ new Map();
|
|
1326
|
+
for (const a of e.values()) {
|
|
1327
|
+
const h = a.parentId;
|
|
1328
|
+
h && (g.has(h) || g.set(h, []), g.get(h).push(a.id));
|
|
1329
|
+
}
|
|
1330
|
+
return g;
|
|
1331
|
+
}, [e]), l = M(
|
|
1332
|
+
(g) => {
|
|
1333
|
+
const a = [], h = [g], c = /* @__PURE__ */ new Set();
|
|
1334
|
+
for (; h.length > 0; ) {
|
|
1335
|
+
const y = h.shift();
|
|
1336
|
+
if (c.has(y)) continue;
|
|
1337
|
+
if (c.add(y), y !== g) {
|
|
1338
|
+
const m = e.get(y);
|
|
1339
|
+
m && a.push({ ...m, entityType: "folder" });
|
|
1340
|
+
}
|
|
1341
|
+
const p = t.get(y);
|
|
1342
|
+
if (p != null && p.length)
|
|
1343
|
+
for (const m of p) {
|
|
1344
|
+
const E = n.get(m);
|
|
1345
|
+
E && a.push({ ...E, entityType: "task" });
|
|
1346
|
+
}
|
|
1347
|
+
const w = r.get(y);
|
|
1348
|
+
w != null && w.length && h.push(...w);
|
|
1349
|
+
}
|
|
1350
|
+
return a;
|
|
1351
|
+
},
|
|
1352
|
+
[e, t, n, r]
|
|
1353
|
+
), f = M(
|
|
1354
|
+
(g) => {
|
|
1355
|
+
const a = [];
|
|
1356
|
+
let h = g;
|
|
1357
|
+
for (; ; ) {
|
|
1358
|
+
const c = e.get(h);
|
|
1359
|
+
if (!c || !c.parentId) break;
|
|
1360
|
+
a.push(c.parentId), h = c.parentId;
|
|
1361
|
+
}
|
|
1362
|
+
return a;
|
|
1363
|
+
},
|
|
1364
|
+
[e]
|
|
1365
|
+
), x = M(
|
|
1366
|
+
(g) => {
|
|
1367
|
+
const a = n.get(g);
|
|
1368
|
+
if (!a || !a.folderId) return [];
|
|
1369
|
+
const h = [a.folderId], c = f(a.folderId);
|
|
1370
|
+
return h.push(...c), h;
|
|
1371
|
+
},
|
|
1372
|
+
[n, f]
|
|
1373
|
+
), d = M(
|
|
1374
|
+
(g, a) => {
|
|
1375
|
+
var p;
|
|
1376
|
+
if (!a.length) return {};
|
|
1377
|
+
const h = {}, c = new Set(a);
|
|
1378
|
+
let y = g;
|
|
1379
|
+
for (; c.size > 0; ) {
|
|
1380
|
+
const w = o(y);
|
|
1381
|
+
if (!w || !y) {
|
|
1382
|
+
for (const m of c)
|
|
1383
|
+
s && m in s && (h[m] = s[m], c.delete(m));
|
|
1384
|
+
break;
|
|
1385
|
+
}
|
|
1386
|
+
for (const m of Array.from(c))
|
|
1387
|
+
(p = w.ownAttrib) != null && p.includes(m) && w.attrib && m in w.attrib && (h[m] = w.attrib[m], c.delete(m));
|
|
1388
|
+
y = w.parentId;
|
|
1389
|
+
}
|
|
1390
|
+
for (const w of c)
|
|
1391
|
+
h[w] = null;
|
|
1392
|
+
return h;
|
|
1393
|
+
},
|
|
1394
|
+
[o]
|
|
1395
|
+
), v = M(
|
|
1396
|
+
(g) => {
|
|
1397
|
+
if (!g.length) return [];
|
|
1398
|
+
const a = [], h = /* @__PURE__ */ new Map();
|
|
1399
|
+
for (const c of g) {
|
|
1400
|
+
if (c.entityType !== "folder") continue;
|
|
1401
|
+
const y = Object.entries(c.attrib);
|
|
1402
|
+
if (!y.length) continue;
|
|
1403
|
+
const w = l(c.entityId).filter(
|
|
1404
|
+
(m) => !g.find((E) => E.entityId === m.id)
|
|
1405
|
+
);
|
|
1406
|
+
if (w.length)
|
|
1407
|
+
for (const m of w) {
|
|
1408
|
+
const E = y.filter(
|
|
1409
|
+
([b]) => {
|
|
1410
|
+
var I, C, S;
|
|
1411
|
+
return !((I = m.ownAttrib) != null && I.includes(b)) && ((S = (C = i == null ? void 0 : i.find((j) => j.name === b)) == null ? void 0 : C.data) == null ? void 0 : S.inherit);
|
|
1412
|
+
}
|
|
1413
|
+
), k = y.filter(
|
|
1414
|
+
([b]) => {
|
|
1415
|
+
var I;
|
|
1416
|
+
return (I = m.ownAttrib) == null ? void 0 : I.includes(b);
|
|
1417
|
+
}
|
|
1418
|
+
);
|
|
1419
|
+
k.length && (h.has(m.id) || h.set(m.id, /* @__PURE__ */ new Set()), k.forEach(([b]) => {
|
|
1420
|
+
h.get(m.id).add(b);
|
|
1421
|
+
}));
|
|
1422
|
+
const D = E.filter(([b]) => {
|
|
1423
|
+
const I = m.entityType === "task" ? x(m.id) : f(m.id);
|
|
1424
|
+
for (const C of I)
|
|
1425
|
+
if (h.has(C) && h.get(C).has(b))
|
|
1426
|
+
return !1;
|
|
1427
|
+
return !0;
|
|
1428
|
+
});
|
|
1429
|
+
if (D.length) {
|
|
1430
|
+
const b = a.findIndex((I) => I.entityId === m.id);
|
|
1431
|
+
b !== -1 ? a[b].attrib = {
|
|
1432
|
+
...a[b].attrib,
|
|
1433
|
+
...Object.fromEntries(D)
|
|
1434
|
+
} : a.push({
|
|
1435
|
+
entityId: m.id,
|
|
1436
|
+
entityType: m.entityType || ("parentId" in m ? "folder" : "task"),
|
|
1437
|
+
attrib: Object.fromEntries(D)
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
return a;
|
|
1443
|
+
},
|
|
1444
|
+
[l, n, x, f]
|
|
1445
|
+
), u = M(
|
|
1446
|
+
(g, a, h) => {
|
|
1447
|
+
var p;
|
|
1448
|
+
const c = o(g);
|
|
1449
|
+
if (!c) return null;
|
|
1450
|
+
let y = a === "task" ? c.folderId : c.parentId;
|
|
1451
|
+
for (; y; ) {
|
|
1452
|
+
const w = o(y);
|
|
1453
|
+
if (!w) break;
|
|
1454
|
+
if ((p = w.ownAttrib) != null && p.includes(h) && w.attrib && h in w.attrib)
|
|
1455
|
+
return w.attrib[h];
|
|
1456
|
+
y = w.parentId;
|
|
1457
|
+
}
|
|
1458
|
+
return null;
|
|
1459
|
+
},
|
|
1460
|
+
[o]
|
|
1461
|
+
);
|
|
1462
|
+
return {
|
|
1463
|
+
folderChildrenMap: r,
|
|
1464
|
+
getChildrenEntities: l,
|
|
1465
|
+
getInheritedDependents: v,
|
|
1466
|
+
findInheritedValueFromAncestors: u,
|
|
1467
|
+
findNonInheritedValues: d,
|
|
1468
|
+
getAncestorsOf: f
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1471
|
+
const it = de(void 0), Uo = ({
|
|
1472
|
+
children: e,
|
|
1473
|
+
foldersMap: n,
|
|
1474
|
+
tasksMap: t,
|
|
1475
|
+
tasksByFolderMap: o,
|
|
1476
|
+
expanded: s,
|
|
1477
|
+
projectInfo: i,
|
|
1478
|
+
showHierarchy: r,
|
|
1479
|
+
loadingTasks: l,
|
|
1480
|
+
isLoadingMore: f,
|
|
1481
|
+
isLoading: x,
|
|
1482
|
+
isInitialized: d,
|
|
1483
|
+
projectName: v,
|
|
1484
|
+
users: u,
|
|
1485
|
+
attribFields: g,
|
|
1486
|
+
filters: a,
|
|
1487
|
+
setFilters: h,
|
|
1488
|
+
queryFilters: c,
|
|
1489
|
+
updateShowHierarchy: y,
|
|
1490
|
+
toggleExpanded: p,
|
|
1491
|
+
updateExpanded: w,
|
|
1492
|
+
sorting: m,
|
|
1493
|
+
updateSorting: E,
|
|
1494
|
+
fetchNextPage: k,
|
|
1495
|
+
reloadTableData: D,
|
|
1496
|
+
setExpanded: b
|
|
1497
|
+
}) => {
|
|
1498
|
+
const { folderTypes: I, taskTypes: C } = i || {}, S = En({
|
|
1499
|
+
foldersMap: n,
|
|
1500
|
+
tasksMap: t,
|
|
1501
|
+
tasksByFolderMap: o,
|
|
1502
|
+
expanded: s,
|
|
1503
|
+
folderTypes: I,
|
|
1504
|
+
taskTypes: C,
|
|
1505
|
+
showHierarchy: r,
|
|
1506
|
+
loadingTasks: l,
|
|
1507
|
+
isLoadingMore: f
|
|
1508
|
+
}), j = M(
|
|
1509
|
+
(_) => {
|
|
1510
|
+
if (n.has(_))
|
|
1511
|
+
return { ...n.get(_), entityType: "folder" };
|
|
1512
|
+
if (t.has(_))
|
|
1513
|
+
return { ...t.get(_), entityType: "task" };
|
|
1514
|
+
},
|
|
1515
|
+
[n, t]
|
|
1516
|
+
), {
|
|
1517
|
+
getInheritedDependents: T,
|
|
1518
|
+
getChildrenEntities: z,
|
|
1519
|
+
findInheritedValueFromAncestors: R,
|
|
1520
|
+
findNonInheritedValues: O,
|
|
1521
|
+
getAncestorsOf: $
|
|
1522
|
+
} = An({
|
|
1523
|
+
foldersMap: n,
|
|
1524
|
+
tasksMap: t,
|
|
1525
|
+
tasksByFolderMap: o,
|
|
1526
|
+
getEntityById: j,
|
|
1527
|
+
projectAttrib: i == null ? void 0 : i.attrib,
|
|
1528
|
+
attribFields: g
|
|
1529
|
+
}), F = M(
|
|
1530
|
+
(_, K) => {
|
|
1531
|
+
const L = typeof s == "object" ? s : {}, W = { ...L };
|
|
1532
|
+
_.forEach((P) => {
|
|
1533
|
+
const ee = z(P).map((Y) => Y.id), G = L[P] || !1;
|
|
1534
|
+
(K !== void 0 ? !K : G) ? (W[P] = !1, ee.forEach((Y) => {
|
|
1535
|
+
W[Y] = !1;
|
|
1536
|
+
})) : (W[P] = !0, ee.forEach((Y) => {
|
|
1537
|
+
W[Y] = !0;
|
|
1538
|
+
}));
|
|
1539
|
+
}), b(W);
|
|
1540
|
+
},
|
|
1541
|
+
[s, z, b]
|
|
1542
|
+
);
|
|
1543
|
+
return /* @__PURE__ */ A.jsx(
|
|
1544
|
+
it.Provider,
|
|
1545
|
+
{
|
|
1546
|
+
value: {
|
|
1547
|
+
// from this context
|
|
1548
|
+
tableData: S,
|
|
1549
|
+
// forwarded on
|
|
1550
|
+
isInitialized: d,
|
|
1551
|
+
isLoading: x,
|
|
1552
|
+
projectInfo: i,
|
|
1553
|
+
attribFields: g,
|
|
1554
|
+
users: u,
|
|
1555
|
+
projectName: v,
|
|
1556
|
+
tasksMap: t,
|
|
1557
|
+
foldersMap: n,
|
|
1558
|
+
fetchNextPage: k,
|
|
1559
|
+
reloadTableData: D,
|
|
1560
|
+
// filters
|
|
1561
|
+
filters: a,
|
|
1562
|
+
setFilters: h,
|
|
1563
|
+
queryFilters: c,
|
|
1564
|
+
// hierarchy
|
|
1565
|
+
showHierarchy: r,
|
|
1566
|
+
updateShowHierarchy: y,
|
|
1567
|
+
// expanded state
|
|
1568
|
+
expanded: s,
|
|
1569
|
+
toggleExpanded: p,
|
|
1570
|
+
updateExpanded: w,
|
|
1571
|
+
toggleExpandAll: F,
|
|
1572
|
+
// sorting
|
|
1573
|
+
sorting: m,
|
|
1574
|
+
updateSorting: E,
|
|
1575
|
+
getEntityById: j,
|
|
1576
|
+
// folder relationships
|
|
1577
|
+
getInheritedDependents: T,
|
|
1578
|
+
findInheritedValueFromAncestors: R,
|
|
1579
|
+
findNonInheritedValues: O,
|
|
1580
|
+
getAncestorsOf: $
|
|
1581
|
+
},
|
|
1582
|
+
children: e
|
|
1583
|
+
}
|
|
1584
|
+
);
|
|
1585
|
+
}, ue = () => {
|
|
1586
|
+
const e = ce(it);
|
|
1587
|
+
if (!e)
|
|
1588
|
+
throw new Error("useProjectTableContext must be used within a ProjectTableProvider");
|
|
1589
|
+
return e;
|
|
1590
|
+
}, Rn = (e) => {
|
|
1591
|
+
const { pushHistory: n } = e || {}, {
|
|
1592
|
+
getEntityById: t,
|
|
1593
|
+
projectName: o,
|
|
1594
|
+
getInheritedDependents: s,
|
|
1595
|
+
findInheritedValueFromAncestors: i,
|
|
1596
|
+
findNonInheritedValues: r
|
|
1597
|
+
} = ue(), { updateEntities: l } = _e(), f = M(
|
|
1598
|
+
async (d = [], v = !0) => {
|
|
1599
|
+
var y;
|
|
1600
|
+
if (!d.length || !o)
|
|
1601
|
+
return;
|
|
1602
|
+
if (n && v) {
|
|
1603
|
+
const p = d.map(
|
|
1604
|
+
({ id: m, type: E, field: k, isAttrib: D }) => {
|
|
1605
|
+
var j;
|
|
1606
|
+
const b = t(m), I = D ? ((j = b.attrib) == null ? void 0 : j[k]) ?? null : b[k] ?? null, C = (b == null ? void 0 : b.ownAttrib) || [], S = D && !C.includes(k);
|
|
1607
|
+
return {
|
|
1608
|
+
id: m,
|
|
1609
|
+
type: E,
|
|
1610
|
+
field: k,
|
|
1611
|
+
value: I,
|
|
1612
|
+
isAttrib: D,
|
|
1613
|
+
wasInherited: S,
|
|
1614
|
+
// Track inheritance status for undo
|
|
1615
|
+
ownAttrib: C,
|
|
1616
|
+
folderId: b == null ? void 0 : b.folderId
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
), w = d.flatMap(
|
|
1620
|
+
({ id: m, type: E, field: k, value: D, isAttrib: b }) => {
|
|
1621
|
+
const I = t(m);
|
|
1622
|
+
return I ? {
|
|
1623
|
+
id: m,
|
|
1624
|
+
type: E,
|
|
1625
|
+
field: k,
|
|
1626
|
+
value: D,
|
|
1627
|
+
isAttrib: b,
|
|
1628
|
+
ownAttrib: (I == null ? void 0 : I.ownAttrib) || [],
|
|
1629
|
+
folderId: "folderId" in I ? I.folderId : I == null ? void 0 : I.parentId
|
|
1630
|
+
} : [];
|
|
1631
|
+
}
|
|
1632
|
+
);
|
|
1633
|
+
n(p, w);
|
|
1634
|
+
}
|
|
1635
|
+
const u = ["task", "folder"];
|
|
1636
|
+
let g = [];
|
|
1637
|
+
for (const p of d) {
|
|
1638
|
+
let { id: w, type: m, field: E, value: k, isAttrib: D } = p, b = m;
|
|
1639
|
+
if (!u.includes(b))
|
|
1640
|
+
continue;
|
|
1641
|
+
const I = D ? { attrib: { [E]: k } } : { [E]: k };
|
|
1642
|
+
if (D) {
|
|
1643
|
+
const S = t(w), j = [...(S == null ? void 0 : S.ownAttrib) || []];
|
|
1644
|
+
j.includes(E) || j.push(E), I.ownAttrib = j;
|
|
1645
|
+
}
|
|
1646
|
+
const C = g.findIndex(
|
|
1647
|
+
(S) => S.entityId === p.id && S.entityType === b
|
|
1648
|
+
);
|
|
1649
|
+
if (C !== -1) {
|
|
1650
|
+
const S = g[C];
|
|
1651
|
+
let j = { ...S.data, ...I };
|
|
1652
|
+
(y = S.data) != null && y.attrib && I.attrib && (j = { ...j, attrib: { ...S.data.attrib, ...I.attrib } }), g[C] = {
|
|
1653
|
+
...S,
|
|
1654
|
+
data: j
|
|
1655
|
+
};
|
|
1656
|
+
} else
|
|
1657
|
+
g.push({
|
|
1658
|
+
entityType: b,
|
|
1659
|
+
entityId: p.id,
|
|
1660
|
+
type: "update",
|
|
1661
|
+
data: I
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
const a = g.filter((p) => !!p.entityId && p.type === "update" && p.data && "attrib" in p.data).map((p) => {
|
|
1665
|
+
var w;
|
|
1666
|
+
return {
|
|
1667
|
+
entityId: p.entityId,
|
|
1668
|
+
entityType: p.entityType,
|
|
1669
|
+
attrib: p.data && "attrib" in p.data ? (w = p.data) == null ? void 0 : w.attrib : {}
|
|
1670
|
+
};
|
|
1671
|
+
}), c = s(a).map((p) => ({
|
|
1672
|
+
entityId: p.entityId,
|
|
1673
|
+
entityType: p.entityType,
|
|
1674
|
+
data: {
|
|
1675
|
+
attrib: p.attrib
|
|
1676
|
+
}
|
|
1677
|
+
}));
|
|
1678
|
+
try {
|
|
1679
|
+
await l({
|
|
1680
|
+
operations: g,
|
|
1681
|
+
patchOperations: c
|
|
1682
|
+
});
|
|
1683
|
+
} catch {
|
|
1684
|
+
ie.error("Failed to update entities");
|
|
1685
|
+
}
|
|
1686
|
+
},
|
|
1687
|
+
[o, l, t, s, n]
|
|
1688
|
+
), x = M(
|
|
1689
|
+
async (d, v = !0) => {
|
|
1690
|
+
var c, y;
|
|
1691
|
+
if (!d.length || !o)
|
|
1692
|
+
return;
|
|
1693
|
+
if (v && n) {
|
|
1694
|
+
const p = [];
|
|
1695
|
+
for (const m of d) {
|
|
1696
|
+
const E = t(m.entityId);
|
|
1697
|
+
for (const k of m.attribs)
|
|
1698
|
+
E != null && E.attrib && k in E.attrib && p.push({
|
|
1699
|
+
id: m.entityId,
|
|
1700
|
+
type: m.entityType,
|
|
1701
|
+
field: k,
|
|
1702
|
+
value: E.attrib[k],
|
|
1703
|
+
isAttrib: !0,
|
|
1704
|
+
wasInherited: !1,
|
|
1705
|
+
// Mark as not inherited
|
|
1706
|
+
ownAttrib: (E == null ? void 0 : E.ownAttrib) || [],
|
|
1707
|
+
folderId: E == null ? void 0 : E.folderId
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
const w = d.flatMap(
|
|
1711
|
+
(m) => m.attribs.map((E) => ({
|
|
1712
|
+
id: m.entityId,
|
|
1713
|
+
type: m.entityType,
|
|
1714
|
+
field: E,
|
|
1715
|
+
value: null,
|
|
1716
|
+
isAttrib: !0,
|
|
1717
|
+
wasInherited: !0,
|
|
1718
|
+
// Mark as inherited
|
|
1719
|
+
ownAttrib: m.ownAttrib,
|
|
1720
|
+
folderId: m.folderId
|
|
1721
|
+
}))
|
|
1722
|
+
);
|
|
1723
|
+
p.length > 0 && n(p, w);
|
|
1724
|
+
}
|
|
1725
|
+
const u = ["task", "folder"], g = [], a = [];
|
|
1726
|
+
for (const p of d) {
|
|
1727
|
+
let w = p.entityType;
|
|
1728
|
+
if (!u.includes(w))
|
|
1729
|
+
continue;
|
|
1730
|
+
w = w;
|
|
1731
|
+
const m = {};
|
|
1732
|
+
p.attribs.forEach((C) => {
|
|
1733
|
+
m[C] = null;
|
|
1734
|
+
}), g.push({
|
|
1735
|
+
entityType: w,
|
|
1736
|
+
entityId: p.entityId,
|
|
1737
|
+
type: "update",
|
|
1738
|
+
data: {
|
|
1739
|
+
attrib: m
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
const k = (() => {
|
|
1743
|
+
const C = p.folderId, S = [];
|
|
1744
|
+
let j = C, T = d.find((R) => R.entityId === j);
|
|
1745
|
+
for (; T; )
|
|
1746
|
+
S.push(T), j = T.folderId, T = d.find((R) => R.entityId === j);
|
|
1747
|
+
return S.length > 0 ? S[S.length - 1] : null;
|
|
1748
|
+
})(), D = (k == null ? void 0 : k.attribs) || [], b = p.attribs.filter(
|
|
1749
|
+
(C) => D.includes(C)
|
|
1750
|
+
), I = p.attribs.filter(
|
|
1751
|
+
(C) => !D.includes(C)
|
|
1752
|
+
);
|
|
1753
|
+
I.length > 0 && a.push({
|
|
1754
|
+
...p,
|
|
1755
|
+
attribs: I
|
|
1756
|
+
}), k && b.length > 0 && a.push({
|
|
1757
|
+
...p,
|
|
1758
|
+
attribs: b,
|
|
1759
|
+
folderId: k.folderId
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
const h = [];
|
|
1763
|
+
for (const p of a) {
|
|
1764
|
+
const w = p.entityType, m = [...p.ownAttrib || []].filter(
|
|
1765
|
+
(I) => !p.attribs.includes(I)
|
|
1766
|
+
), E = r(p.folderId, p.attribs), k = {
|
|
1767
|
+
entityId: p.entityId,
|
|
1768
|
+
entityType: w,
|
|
1769
|
+
data: {
|
|
1770
|
+
attrib: E,
|
|
1771
|
+
ownAttrib: m
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
h.push(k);
|
|
1775
|
+
const b = s([
|
|
1776
|
+
{ entityId: p.entityId, entityType: w, attrib: E }
|
|
1777
|
+
]).map((I) => ({
|
|
1778
|
+
entityId: I.entityId,
|
|
1779
|
+
entityType: I.entityType,
|
|
1780
|
+
data: {
|
|
1781
|
+
attrib: I.attrib
|
|
1782
|
+
}
|
|
1783
|
+
}));
|
|
1784
|
+
for (const I of b) {
|
|
1785
|
+
const C = h.findIndex(
|
|
1786
|
+
(S) => S.entityId === I.entityId
|
|
1787
|
+
);
|
|
1788
|
+
if (C !== -1) {
|
|
1789
|
+
const S = h[C];
|
|
1790
|
+
let j = {
|
|
1791
|
+
// @ts-ignore
|
|
1792
|
+
...((c = S.data) == null ? void 0 : c.attrib) || {},
|
|
1793
|
+
// @ts-ignore
|
|
1794
|
+
...((y = I.data) == null ? void 0 : y.attrib) || {}
|
|
1795
|
+
};
|
|
1796
|
+
h[C] = {
|
|
1797
|
+
...S,
|
|
1798
|
+
data: { attrib: j }
|
|
1799
|
+
};
|
|
1800
|
+
} else
|
|
1801
|
+
h.push({
|
|
1802
|
+
entityId: I.entityId,
|
|
1803
|
+
entityType: I.entityType,
|
|
1804
|
+
data: I.data
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
try {
|
|
1809
|
+
await l({
|
|
1810
|
+
operations: g,
|
|
1811
|
+
patchOperations: h
|
|
1812
|
+
});
|
|
1813
|
+
} catch {
|
|
1814
|
+
ie.error("Failed to update entities");
|
|
1815
|
+
}
|
|
1816
|
+
},
|
|
1817
|
+
[
|
|
1818
|
+
o,
|
|
1819
|
+
l,
|
|
1820
|
+
s,
|
|
1821
|
+
i,
|
|
1822
|
+
n
|
|
1823
|
+
]
|
|
1824
|
+
);
|
|
1825
|
+
return { updateEntities: f, inheritFromParent: x };
|
|
1826
|
+
}, kn = {
|
|
1827
|
+
status: "statuses",
|
|
1828
|
+
folderType: "folderTypes",
|
|
1829
|
+
taskType: "taskTypes"
|
|
1830
|
+
}, X = (e) => ie.error(e), Dn = (e) => {
|
|
1831
|
+
const n = e.trim().split(`
|
|
1832
|
+
`), t = [], o = [];
|
|
1833
|
+
return n.forEach((s) => {
|
|
1834
|
+
const i = s.split(" ");
|
|
1835
|
+
t.push({ values: i, colIds: o });
|
|
1836
|
+
}), t;
|
|
1837
|
+
}, rt = (e, n, t, o) => {
|
|
1838
|
+
const s = n ? t.get(e) : o.get(e);
|
|
1839
|
+
if (!s) return "";
|
|
1840
|
+
const i = s.name || "", r = s.folderId || s.parentId;
|
|
1841
|
+
if (!r) return i;
|
|
1842
|
+
const l = rt(r, !0, t, o);
|
|
1843
|
+
return l ? `${l} / ${i}` : i;
|
|
1844
|
+
}, zn = (e, n) => {
|
|
1845
|
+
if (n === "array")
|
|
1846
|
+
try {
|
|
1847
|
+
try {
|
|
1848
|
+
const t = JSON.parse(e);
|
|
1849
|
+
return Array.isArray(t) ? t : [t];
|
|
1850
|
+
} catch {
|
|
1851
|
+
return e.includes(",") ? e.split(",").map((t) => t.trim()) : [e];
|
|
1852
|
+
}
|
|
1853
|
+
} catch {
|
|
1854
|
+
return [e];
|
|
1855
|
+
}
|
|
1856
|
+
else {
|
|
1857
|
+
if (n === "number")
|
|
1858
|
+
return Number(e) || 0;
|
|
1859
|
+
if (n === "boolean")
|
|
1860
|
+
return e.toLowerCase() === "true" || e === "1" || e.toLowerCase() === "yes";
|
|
1861
|
+
}
|
|
1862
|
+
return e;
|
|
1863
|
+
}, jn = (e) => {
|
|
1864
|
+
const {
|
|
1865
|
+
colId: n,
|
|
1866
|
+
isFolder: t,
|
|
1867
|
+
pasteValue: o,
|
|
1868
|
+
parsedData: s,
|
|
1869
|
+
columnEnums: i,
|
|
1870
|
+
columnReadOnly: r,
|
|
1871
|
+
rowIndex: l,
|
|
1872
|
+
colIndex: f,
|
|
1873
|
+
isSingleCellValue: x
|
|
1874
|
+
} = e;
|
|
1875
|
+
if (!o) return !0;
|
|
1876
|
+
if (n.startsWith("attrib_") && r.includes(n.replace("attrib_", "")))
|
|
1877
|
+
return X(`This column is read-only: "${n}". Paste operation cancelled.`), !1;
|
|
1878
|
+
if (n === "assignees") {
|
|
1879
|
+
const a = o.split(",").map((y) => y.trim()), h = i.assignees || [], c = a.filter(
|
|
1880
|
+
(y) => h.some((p) => p.value === y || p.label === y)
|
|
1881
|
+
);
|
|
1882
|
+
if (x)
|
|
1883
|
+
s[0].values[0] = c.join(", ");
|
|
1884
|
+
else {
|
|
1885
|
+
const y = l % s.length, p = f % s[y].values.length;
|
|
1886
|
+
s[y].values[p] = c.join(", ");
|
|
1887
|
+
}
|
|
1888
|
+
return !0;
|
|
1889
|
+
}
|
|
1890
|
+
let d = n === "subType" ? t ? "folderType" : "taskType" : n;
|
|
1891
|
+
if (d = kn[d] || d, !(d in i)) return !0;
|
|
1892
|
+
const v = i[d];
|
|
1893
|
+
return !Array.isArray(v) || v.length === 0 || o.split(",").map((a) => a.trim()).every(
|
|
1894
|
+
(a) => v.some((h) => h.value === a || h.label === a)
|
|
1895
|
+
) ? !0 : (X(`Invalid ${d === "folderType" || d === "taskType" ? `${t ? "folder" : "task"} type` : d} value: "${o}". Paste operation cancelled.`), !1);
|
|
1896
|
+
};
|
|
1897
|
+
var pe = /* @__PURE__ */ ((e) => (e[e.None = 0] = "None", e[e.Top = 1] = "Top", e[e.Right = 2] = "Right", e[e.Bottom = 4] = "Bottom", e[e.Left = 8] = "Left", e[e.All = 15] = "All", e))(pe || {});
|
|
1898
|
+
const B = (e, n) => `cell-${e}-${n}`, V = (e) => {
|
|
1899
|
+
const n = e.match(/^cell-(.+)-(.+)$/);
|
|
1900
|
+
return n ? { rowId: n[1], colId: n[2] } : null;
|
|
1901
|
+
}, Te = (e, n) => {
|
|
1902
|
+
if (!e || !n) return;
|
|
1903
|
+
const t = n.split("_");
|
|
1904
|
+
let o = e;
|
|
1905
|
+
for (const s of t)
|
|
1906
|
+
if (o && typeof o == "object" && s in o)
|
|
1907
|
+
o = o[s];
|
|
1908
|
+
else
|
|
1909
|
+
return;
|
|
1910
|
+
return o;
|
|
1911
|
+
}, On = (e) => {
|
|
1912
|
+
const n = [];
|
|
1913
|
+
return e & 1 && n.push("shadow-top"), e & 2 && n.push("shadow-right"), e & 4 && n.push("shadow-bottom"), e & 8 && n.push("shadow-left"), n;
|
|
1914
|
+
}, H = "__row_selection__", lt = de(void 0), Ko = ({ children: e }) => {
|
|
1915
|
+
const [n, t] = Q(/* @__PURE__ */ new Set()), [o, s] = Q(null), [i, r] = Q(!1), [l, f] = Q(null), [x, d] = Q({
|
|
1916
|
+
rowIdToIndex: /* @__PURE__ */ new Map(),
|
|
1917
|
+
colIdToIndex: /* @__PURE__ */ new Map(),
|
|
1918
|
+
indexToRowId: /* @__PURE__ */ new Map(),
|
|
1919
|
+
indexToColId: /* @__PURE__ */ new Map()
|
|
1920
|
+
}), v = (T) => JSON.stringify(Array.from(T.entries())), u = U(
|
|
1921
|
+
() => x,
|
|
1922
|
+
[
|
|
1923
|
+
v(x.rowIdToIndex),
|
|
1924
|
+
v(x.colIdToIndex),
|
|
1925
|
+
v(x.indexToRowId),
|
|
1926
|
+
v(x.indexToColId)
|
|
1927
|
+
]
|
|
1928
|
+
), g = re(!1), a = U(
|
|
1929
|
+
() => Array.from(n).filter(
|
|
1930
|
+
(T) => {
|
|
1931
|
+
var z, R;
|
|
1932
|
+
return ((z = V(T)) == null ? void 0 : z.colId) === H && ((R = V(T)) == null ? void 0 : R.rowId);
|
|
1933
|
+
}
|
|
1934
|
+
).map((T) => {
|
|
1935
|
+
var z;
|
|
1936
|
+
return (z = V(T)) == null ? void 0 : z.rowId;
|
|
1937
|
+
}),
|
|
1938
|
+
[n]
|
|
1939
|
+
), h = M((T, z) => {
|
|
1940
|
+
const R = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
1941
|
+
T.forEach((_, K) => {
|
|
1942
|
+
R.set(_, K), $.set(K, _);
|
|
1943
|
+
}), z.forEach((_, K) => {
|
|
1944
|
+
O.set(_, K), F.set(K, _);
|
|
1945
|
+
}), d({ rowIdToIndex: R, colIdToIndex: O, indexToRowId: $, indexToColId: F });
|
|
1946
|
+
}, []), c = M((T, z) => {
|
|
1947
|
+
t((R) => {
|
|
1948
|
+
let O = new Set(T);
|
|
1949
|
+
if (z.colId !== H) {
|
|
1950
|
+
const $ = Array.from(R).filter(
|
|
1951
|
+
(F) => {
|
|
1952
|
+
var _;
|
|
1953
|
+
return ((_ = V(F)) == null ? void 0 : _.colId) === H;
|
|
1954
|
+
}
|
|
1955
|
+
);
|
|
1956
|
+
$.length && (O = /* @__PURE__ */ new Set([...O, ...$]));
|
|
1957
|
+
}
|
|
1958
|
+
return O;
|
|
1959
|
+
});
|
|
1960
|
+
}, []), y = M(
|
|
1961
|
+
(T, z, R) => {
|
|
1962
|
+
R || c(/* @__PURE__ */ new Set(), T);
|
|
1963
|
+
const O = u.rowIdToIndex.get(T.rowId) ?? 0, $ = u.colIdToIndex.get(T.colId) ?? 0, F = u.rowIdToIndex.get(z.rowId) ?? 0, _ = u.colIdToIndex.get(z.colId) ?? 0, K = Math.min(O, F), L = Math.max(O, F), W = Math.min($, _), P = Math.max($, _), ee = new Set(R ? n : []);
|
|
1964
|
+
for (let G = K; G <= L; G++) {
|
|
1965
|
+
const Y = u.indexToRowId.get(G);
|
|
1966
|
+
if (Y)
|
|
1967
|
+
for (let fe = W; fe <= P; fe++) {
|
|
1968
|
+
const xe = u.indexToColId.get(fe);
|
|
1969
|
+
xe && ee.add(B(Y, xe));
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
return ee;
|
|
1973
|
+
},
|
|
1974
|
+
[u, n]
|
|
1975
|
+
), p = M(
|
|
1976
|
+
(T, z) => {
|
|
1977
|
+
const R = V(T);
|
|
1978
|
+
R && (r(!0), g.current = n.has(T), z ? t((O) => {
|
|
1979
|
+
const $ = new Set(O);
|
|
1980
|
+
return $.has(T) ? ($.delete(T), o === T && ($.size > 0 ? s(Array.from($)[Array.from($).length - 1]) : s(null))) : ($.add(T), s(T), f(R)), $;
|
|
1981
|
+
}) : n.size === 1 && n.has(T) && [H, "name"].includes(R.colId) ? (t(/* @__PURE__ */ new Set()), f(null), s(null)) : (c(/* @__PURE__ */ new Set([T]), R), f(R), s(T)));
|
|
1982
|
+
},
|
|
1983
|
+
[n, o]
|
|
1984
|
+
), w = M(
|
|
1985
|
+
(T, z) => {
|
|
1986
|
+
if (!i || !l) return;
|
|
1987
|
+
const R = V(T);
|
|
1988
|
+
if (R)
|
|
1989
|
+
if (z)
|
|
1990
|
+
t((O) => {
|
|
1991
|
+
const $ = new Set(O);
|
|
1992
|
+
return V(T) && (g.current ? $.delete(T) : $.add(T)), $;
|
|
1993
|
+
});
|
|
1994
|
+
else {
|
|
1995
|
+
const O = y(l, R, !1);
|
|
1996
|
+
c(O, R);
|
|
1997
|
+
}
|
|
1998
|
+
},
|
|
1999
|
+
[i, l, y]
|
|
2000
|
+
), m = M(() => {
|
|
2001
|
+
r(!1);
|
|
2002
|
+
}, []), E = M(
|
|
2003
|
+
(T, z, R) => {
|
|
2004
|
+
const O = V(T);
|
|
2005
|
+
if (O)
|
|
2006
|
+
if (R && l) {
|
|
2007
|
+
const $ = y(l, O, z);
|
|
2008
|
+
c($, O);
|
|
2009
|
+
} else z ? t(($) => {
|
|
2010
|
+
const F = new Set($);
|
|
2011
|
+
return F.has(T) ? F.delete(T) : F.add(T), F;
|
|
2012
|
+
}) : (c(/* @__PURE__ */ new Set([T]), O), f(O));
|
|
2013
|
+
},
|
|
2014
|
+
[l, y]
|
|
2015
|
+
), k = M((T) => {
|
|
2016
|
+
s(T);
|
|
2017
|
+
}, []), D = M(() => {
|
|
2018
|
+
t(/* @__PURE__ */ new Set()), f(null);
|
|
2019
|
+
}, []), b = M((T) => n.has(T), [n]), I = M((T) => T === o, [o]), C = M((T) => V(T), []), S = M(
|
|
2020
|
+
(T) => {
|
|
2021
|
+
if (!b(T)) return [];
|
|
2022
|
+
const z = V(T);
|
|
2023
|
+
if (!z) return [];
|
|
2024
|
+
const R = u.rowIdToIndex.get(z.rowId), O = u.colIdToIndex.get(z.colId);
|
|
2025
|
+
if (R === void 0 || O === void 0) return [];
|
|
2026
|
+
const $ = u.indexToRowId.get(R - 1), F = u.indexToColId.get(O + 1), _ = u.indexToRowId.get(R + 1), K = u.indexToColId.get(O - 1);
|
|
2027
|
+
let L = pe.None;
|
|
2028
|
+
return (!$ || !n.has(B($, z.colId))) && (L |= pe.Top), (!F || !n.has(B(z.rowId, F))) && (L |= pe.Right), (!_ || !n.has(B(_, z.colId))) && (L |= pe.Bottom), (!K || !n.has(B(z.rowId, K))) && (L |= pe.Left), On(L);
|
|
2029
|
+
},
|
|
2030
|
+
[n, u, b]
|
|
2031
|
+
), j = U(
|
|
2032
|
+
() => ({
|
|
2033
|
+
selectedCells: n,
|
|
2034
|
+
selectedRows: a,
|
|
2035
|
+
focusedCellId: o,
|
|
2036
|
+
selectionInProgress: i,
|
|
2037
|
+
anchorCell: l,
|
|
2038
|
+
gridMap: u,
|
|
2039
|
+
setSelectedCells: t,
|
|
2040
|
+
setFocusedCellId: s,
|
|
2041
|
+
setAnchorCell: f,
|
|
2042
|
+
registerGrid: h,
|
|
2043
|
+
selectCell: E,
|
|
2044
|
+
startSelection: p,
|
|
2045
|
+
extendSelection: w,
|
|
2046
|
+
endSelection: m,
|
|
2047
|
+
focusCell: k,
|
|
2048
|
+
clearSelection: D,
|
|
2049
|
+
isCellSelected: b,
|
|
2050
|
+
isCellFocused: I,
|
|
2051
|
+
getCellPositionFromId: C,
|
|
2052
|
+
getCellBorderClasses: S
|
|
2053
|
+
}),
|
|
2054
|
+
[
|
|
2055
|
+
n,
|
|
2056
|
+
a,
|
|
2057
|
+
o,
|
|
2058
|
+
i,
|
|
2059
|
+
l,
|
|
2060
|
+
u
|
|
2061
|
+
// setSelectedCells,
|
|
2062
|
+
// setFocusedCellId,
|
|
2063
|
+
// setAnchorCell,
|
|
2064
|
+
// registerGrid,
|
|
2065
|
+
// selectCell,
|
|
2066
|
+
// startSelection,
|
|
2067
|
+
// extendSelection,
|
|
2068
|
+
// endSelection,
|
|
2069
|
+
// focusCell,
|
|
2070
|
+
// clearSelection,
|
|
2071
|
+
// isCellSelected,
|
|
2072
|
+
// isCellFocused,
|
|
2073
|
+
// getCellPositionFromId,
|
|
2074
|
+
// getCellBorderClasses,
|
|
2075
|
+
]
|
|
2076
|
+
);
|
|
2077
|
+
return /* @__PURE__ */ A.jsx(lt.Provider, { value: j, children: e });
|
|
2078
|
+
}, he = () => {
|
|
2079
|
+
const e = ce(lt);
|
|
2080
|
+
if (e === void 0)
|
|
2081
|
+
throw new Error("useSelectionContext must be used within a SelectionProvider");
|
|
2082
|
+
return e;
|
|
2083
|
+
}, at = de(void 0), $n = ({
|
|
2084
|
+
children: e,
|
|
2085
|
+
foldersMap: n,
|
|
2086
|
+
tasksMap: t,
|
|
2087
|
+
columnEnums: o,
|
|
2088
|
+
columnReadOnly: s
|
|
2089
|
+
}) => {
|
|
2090
|
+
const { selectedCells: i, gridMap: r, focusedCellId: l } = he(), { updateEntities: f } = ye(), x = M(
|
|
2091
|
+
async (a, h) => {
|
|
2092
|
+
const { headers: c, fullRow: y } = h || {};
|
|
2093
|
+
try {
|
|
2094
|
+
const p = /* @__PURE__ */ new Map();
|
|
2095
|
+
a.forEach((D) => {
|
|
2096
|
+
var S;
|
|
2097
|
+
const b = V(D);
|
|
2098
|
+
if (!b) return;
|
|
2099
|
+
const { rowId: I, colId: C } = b;
|
|
2100
|
+
C !== H && (p.has(I) || p.set(I, /* @__PURE__ */ new Set()), (S = p.get(I)) == null || S.add(C));
|
|
2101
|
+
}), y && a.filter(
|
|
2102
|
+
(b) => {
|
|
2103
|
+
var I, C;
|
|
2104
|
+
return ((I = V(b)) == null ? void 0 : I.rowId) && ((C = V(b)) == null ? void 0 : C.colId) === H;
|
|
2105
|
+
}
|
|
2106
|
+
).map((b) => {
|
|
2107
|
+
var I;
|
|
2108
|
+
return (I = V(b)) == null ? void 0 : I.rowId;
|
|
2109
|
+
}).forEach((b) => {
|
|
2110
|
+
p.has(b) || p.set(b, /* @__PURE__ */ new Set()), Array.from(r.colIdToIndex.keys()).forEach((C) => {
|
|
2111
|
+
var S;
|
|
2112
|
+
(S = p.get(b)) == null || S.add(C);
|
|
2113
|
+
});
|
|
2114
|
+
});
|
|
2115
|
+
const w = Array.from(p.keys()).sort((D, b) => {
|
|
2116
|
+
const I = r.rowIdToIndex.get(D) ?? 1 / 0, C = r.rowIdToIndex.get(b) ?? 1 / 0;
|
|
2117
|
+
return I - C;
|
|
2118
|
+
});
|
|
2119
|
+
let m = "";
|
|
2120
|
+
const E = w[0];
|
|
2121
|
+
if (!E) return "";
|
|
2122
|
+
const k = Array.from(p.get(E) || []).sort((D, b) => {
|
|
2123
|
+
const I = r.colIdToIndex.get(D) ?? 1 / 0, C = r.colIdToIndex.get(b) ?? 1 / 0;
|
|
2124
|
+
return I - C;
|
|
2125
|
+
});
|
|
2126
|
+
if (c && k.length > 0) {
|
|
2127
|
+
const D = [];
|
|
2128
|
+
for (const b of k) {
|
|
2129
|
+
const I = b;
|
|
2130
|
+
D.push(`${I.replace(/"/g, '""')}`);
|
|
2131
|
+
}
|
|
2132
|
+
m += D.join(" ") + `
|
|
2133
|
+
`;
|
|
2134
|
+
}
|
|
2135
|
+
for (const D of w) {
|
|
2136
|
+
const b = n.has(D), I = b ? n.get(D) : t.get(D);
|
|
2137
|
+
if (!I) continue;
|
|
2138
|
+
const S = Array.from(p.get(D) || []).sort((T, z) => {
|
|
2139
|
+
const R = r.colIdToIndex.get(T) ?? 1 / 0, O = r.colIdToIndex.get(z) ?? 1 / 0;
|
|
2140
|
+
return R - O;
|
|
2141
|
+
}).filter((T) => T !== H), j = [];
|
|
2142
|
+
for (const T of S) {
|
|
2143
|
+
let z = "";
|
|
2144
|
+
const R = Te(I, T);
|
|
2145
|
+
z = R != null ? String(R) : "", T === "name" && (z = rt(D, b, n, t)), T === "subType" && (z = I[b ? "folderType" : "taskType"] || ""), j.push(`${z.replace(/"/g, '""')}`);
|
|
2146
|
+
}
|
|
2147
|
+
m += j.join(" ") + `
|
|
2148
|
+
`;
|
|
2149
|
+
}
|
|
2150
|
+
return m;
|
|
2151
|
+
} catch (p) {
|
|
2152
|
+
console.error("Failed to copy to clipboard:", p);
|
|
2153
|
+
}
|
|
2154
|
+
},
|
|
2155
|
+
[i, l, r, n, t]
|
|
2156
|
+
), d = M(
|
|
2157
|
+
async (a, h) => {
|
|
2158
|
+
if (a = a || Array.from(i), !a.length) return;
|
|
2159
|
+
const c = await x(a, { fullRow: h });
|
|
2160
|
+
if (c) {
|
|
2161
|
+
if (!navigator.clipboard) {
|
|
2162
|
+
X("Clipboard API not supported in this browser.");
|
|
2163
|
+
return;
|
|
2164
|
+
}
|
|
2165
|
+
if (!window.isSecureContext) {
|
|
2166
|
+
X("Clipboard operations require a secure HTTPS context.");
|
|
2167
|
+
return;
|
|
2168
|
+
}
|
|
2169
|
+
try {
|
|
2170
|
+
await navigator.clipboard.writeText(c), console.log("Copied to clipboard successfully", c);
|
|
2171
|
+
} catch (y) {
|
|
2172
|
+
X(`Failed to copy to clipboard: ${y.message}`);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
[i, n, t, r]
|
|
2177
|
+
), v = M(
|
|
2178
|
+
async (a, h, c) => {
|
|
2179
|
+
if (a = a || Array.from(i), !!a.length)
|
|
2180
|
+
try {
|
|
2181
|
+
const y = await x(a, { headers: !0, fullRow: c });
|
|
2182
|
+
if (!y) return;
|
|
2183
|
+
const p = new Blob([y], { type: "text/csv" }), w = URL.createObjectURL(p), m = document.createElement("a");
|
|
2184
|
+
m.href = w;
|
|
2185
|
+
const E = a.length;
|
|
2186
|
+
m.download = `${h}-export-${E}_cells-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.csv`, m.click(), URL.revokeObjectURL(w);
|
|
2187
|
+
} catch (y) {
|
|
2188
|
+
console.error("Failed to copy to clipboard:", y);
|
|
2189
|
+
}
|
|
2190
|
+
},
|
|
2191
|
+
[i, n, t, r, x]
|
|
2192
|
+
), u = M(
|
|
2193
|
+
async (a) => {
|
|
2194
|
+
if (a = a || Array.from(i), !a.length) return;
|
|
2195
|
+
if (!navigator.clipboard) {
|
|
2196
|
+
X("Clipboard API not supported in this browser.");
|
|
2197
|
+
return;
|
|
2198
|
+
}
|
|
2199
|
+
if (!window.isSecureContext) {
|
|
2200
|
+
X("Clipboard operations require a secure HTTPS context.");
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
let h;
|
|
2204
|
+
try {
|
|
2205
|
+
h = await navigator.clipboard.readText();
|
|
2206
|
+
} catch (b) {
|
|
2207
|
+
X(`Failed to read from clipboard: ${b.message}`);
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
if (!h.trim()) return;
|
|
2211
|
+
const c = Dn(h);
|
|
2212
|
+
if (!c.length) return;
|
|
2213
|
+
const y = c.length === 1 && c[0].values.length === 1, p = /* @__PURE__ */ new Map();
|
|
2214
|
+
Array.from(a).forEach((b) => {
|
|
2215
|
+
var j;
|
|
2216
|
+
const I = V(b);
|
|
2217
|
+
if (!I) return;
|
|
2218
|
+
const { rowId: C, colId: S } = I;
|
|
2219
|
+
p.has(C) || p.set(C, /* @__PURE__ */ new Set()), (j = p.get(C)) == null || j.add(S);
|
|
2220
|
+
});
|
|
2221
|
+
const w = Array.from(p.keys()).sort((b, I) => {
|
|
2222
|
+
const C = r.rowIdToIndex.get(b) ?? 1 / 0, S = r.rowIdToIndex.get(I) ?? 1 / 0;
|
|
2223
|
+
return C - S;
|
|
2224
|
+
}), m = w[0], E = Array.from(p.get(m) || []).sort((b, I) => {
|
|
2225
|
+
const C = r.colIdToIndex.get(b) ?? 1 / 0, S = r.colIdToIndex.get(I) ?? 1 / 0;
|
|
2226
|
+
return C - S;
|
|
2227
|
+
});
|
|
2228
|
+
for (let b = 0; b < E.length; b++) {
|
|
2229
|
+
const I = E[b];
|
|
2230
|
+
for (let C = 0; C < w.length; C++) {
|
|
2231
|
+
const S = w[C], j = n.has(S);
|
|
2232
|
+
let T;
|
|
2233
|
+
if (y)
|
|
2234
|
+
T = c[0].values[0];
|
|
2235
|
+
else {
|
|
2236
|
+
const R = C % c.length, O = b % c[R].values.length;
|
|
2237
|
+
T = c[R].values[O];
|
|
2238
|
+
}
|
|
2239
|
+
if (!jn({
|
|
2240
|
+
colId: I,
|
|
2241
|
+
isFolder: j,
|
|
2242
|
+
pasteValue: T,
|
|
2243
|
+
parsedData: c,
|
|
2244
|
+
columnEnums: o,
|
|
2245
|
+
columnReadOnly: s,
|
|
2246
|
+
rowIndex: C,
|
|
2247
|
+
colIndex: b,
|
|
2248
|
+
isSingleCellValue: y
|
|
2249
|
+
})) return;
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
const k = /* @__PURE__ */ new Map();
|
|
2253
|
+
for (let b = 0; b < E.length; b++) {
|
|
2254
|
+
const I = E[b];
|
|
2255
|
+
if (I === "name") continue;
|
|
2256
|
+
let C = !1, S = "string";
|
|
2257
|
+
if (w.length > 0) {
|
|
2258
|
+
const j = w[0], z = n.has(j) ? n.get(j) : t.get(j);
|
|
2259
|
+
if (z) {
|
|
2260
|
+
C = I.startsWith("attrib_");
|
|
2261
|
+
const R = Te(z, I);
|
|
2262
|
+
Array.isArray(R) ? S = "array" : typeof R == "number" ? S = "number" : typeof R == "boolean" && (S = "boolean"), I === "subType" && (C = !1);
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
for (let j = 0; j < w.length; j++) {
|
|
2266
|
+
const T = w[j], z = n.has(T), R = z ? "folder" : "task";
|
|
2267
|
+
let O;
|
|
2268
|
+
if (y)
|
|
2269
|
+
O = c[0].values[0];
|
|
2270
|
+
else {
|
|
2271
|
+
const L = j % c.length, W = b % c[L].values.length;
|
|
2272
|
+
O = c[L].values[W];
|
|
2273
|
+
}
|
|
2274
|
+
let $ = I.split("_").pop() || I;
|
|
2275
|
+
if (I === "subType" && ($ = z ? "folderType" : "taskType", C = !1, !O))
|
|
2276
|
+
continue;
|
|
2277
|
+
const F = zn(O, S), _ = `${T}-${R}`;
|
|
2278
|
+
k.has(_) || k.set(_, {
|
|
2279
|
+
id: T,
|
|
2280
|
+
type: R,
|
|
2281
|
+
fields: {},
|
|
2282
|
+
attrib: {}
|
|
2283
|
+
});
|
|
2284
|
+
const K = k.get(_);
|
|
2285
|
+
C ? K.attrib[$] = F : K.fields[$] = F;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
const D = [];
|
|
2289
|
+
if (k.forEach((b) => {
|
|
2290
|
+
Object.entries(b.fields).forEach(([I, C]) => {
|
|
2291
|
+
D.push({
|
|
2292
|
+
id: b.id,
|
|
2293
|
+
type: b.type,
|
|
2294
|
+
field: I,
|
|
2295
|
+
value: C
|
|
2296
|
+
});
|
|
2297
|
+
}), Object.entries(b.attrib).forEach(([I, C]) => {
|
|
2298
|
+
D.push({
|
|
2299
|
+
id: b.id,
|
|
2300
|
+
type: b.type,
|
|
2301
|
+
field: I,
|
|
2302
|
+
value: C,
|
|
2303
|
+
isAttrib: !0
|
|
2304
|
+
});
|
|
2305
|
+
});
|
|
2306
|
+
}), D.length > 0)
|
|
2307
|
+
try {
|
|
2308
|
+
await f(D);
|
|
2309
|
+
} catch (b) {
|
|
2310
|
+
console.error("Error updating entities:", b), X(
|
|
2311
|
+
`Failed to update: ${b instanceof Error ? b.message : "Unknown error"}`
|
|
2312
|
+
);
|
|
2313
|
+
}
|
|
2314
|
+
},
|
|
2315
|
+
[i, r, n, t, f, o]
|
|
2316
|
+
);
|
|
2317
|
+
J(() => {
|
|
2318
|
+
const a = (h) => {
|
|
2319
|
+
(h.ctrlKey || h.metaKey) && h.key === "c" && d(), (h.ctrlKey || h.metaKey) && h.key === "v" && u();
|
|
2320
|
+
};
|
|
2321
|
+
return window.addEventListener("keydown", a), () => {
|
|
2322
|
+
window.removeEventListener("keydown", a);
|
|
2323
|
+
};
|
|
2324
|
+
}, [d, u]);
|
|
2325
|
+
const g = U(
|
|
2326
|
+
() => ({
|
|
2327
|
+
copyToClipboard: d,
|
|
2328
|
+
pasteFromClipboard: u,
|
|
2329
|
+
exportCSV: v
|
|
2330
|
+
}),
|
|
2331
|
+
[d, u]
|
|
2332
|
+
);
|
|
2333
|
+
return /* @__PURE__ */ A.jsx(at.Provider, { value: g, children: e });
|
|
2334
|
+
}, Mn = () => {
|
|
2335
|
+
const e = ce(at);
|
|
2336
|
+
if (e === void 0)
|
|
2337
|
+
throw new Error("useClipboard must be used within a ClipboardProvider");
|
|
2338
|
+
return e;
|
|
2339
|
+
}, dt = de(void 0), Bo = ({
|
|
2340
|
+
children: e,
|
|
2341
|
+
config: n,
|
|
2342
|
+
onChange: t
|
|
2343
|
+
}) => {
|
|
2344
|
+
const o = n, { columnOrder: s = [], columnPinning: i = {}, columnVisibility: r = {} } = o, l = (w) => {
|
|
2345
|
+
t({
|
|
2346
|
+
...o,
|
|
2347
|
+
columnVisibility: w
|
|
2348
|
+
});
|
|
2349
|
+
}, f = (w) => {
|
|
2350
|
+
t({
|
|
2351
|
+
...o,
|
|
2352
|
+
columnOrder: w
|
|
2353
|
+
});
|
|
2354
|
+
}, x = (w) => {
|
|
2355
|
+
t({
|
|
2356
|
+
...o,
|
|
2357
|
+
columnPinning: w
|
|
2358
|
+
});
|
|
2359
|
+
}, d = (w) => {
|
|
2360
|
+
const m = { ...i }, E = m.left || [], k = Object.keys(w).filter((b) => w[b] === !1), D = E.filter((b) => !k.includes(b));
|
|
2361
|
+
return {
|
|
2362
|
+
...m,
|
|
2363
|
+
left: D
|
|
2364
|
+
};
|
|
2365
|
+
}, v = (w) => {
|
|
2366
|
+
const m = { ...i }, E = m.left || [], k = w.filter((D) => E.includes(D));
|
|
2367
|
+
return {
|
|
2368
|
+
...m,
|
|
2369
|
+
left: k
|
|
2370
|
+
};
|
|
2371
|
+
}, u = (w) => [...s].sort((m, E) => {
|
|
2372
|
+
var b, I;
|
|
2373
|
+
const k = (b = w.left) != null && b.includes(m) ? 1 : 0;
|
|
2374
|
+
return ((I = w.left) != null && I.includes(E) ? 1 : 0) - k;
|
|
2375
|
+
}), g = (w) => {
|
|
2376
|
+
const m = d(w);
|
|
2377
|
+
t({
|
|
2378
|
+
...o,
|
|
2379
|
+
columnVisibility: w,
|
|
2380
|
+
columnPinning: m
|
|
2381
|
+
});
|
|
2382
|
+
}, a = (w) => {
|
|
2383
|
+
const m = v(w);
|
|
2384
|
+
t({
|
|
2385
|
+
...o,
|
|
2386
|
+
columnOrder: w,
|
|
2387
|
+
columnPinning: m
|
|
2388
|
+
});
|
|
2389
|
+
}, h = (w) => {
|
|
2390
|
+
const m = u(w);
|
|
2391
|
+
t({
|
|
2392
|
+
...o,
|
|
2393
|
+
columnOrder: m,
|
|
2394
|
+
columnPinning: w
|
|
2395
|
+
});
|
|
2396
|
+
}, c = (w) => {
|
|
2397
|
+
const m = ve(w, r);
|
|
2398
|
+
g(m);
|
|
2399
|
+
}, y = (w) => {
|
|
2400
|
+
const m = ve(w, s);
|
|
2401
|
+
a(m);
|
|
2402
|
+
}, p = (w) => {
|
|
2403
|
+
const m = ve(w, i);
|
|
2404
|
+
h(m);
|
|
2405
|
+
};
|
|
2406
|
+
return /* @__PURE__ */ A.jsx(
|
|
2407
|
+
dt.Provider,
|
|
2408
|
+
{
|
|
2409
|
+
value: {
|
|
2410
|
+
// column visibility
|
|
2411
|
+
columnVisibility: r,
|
|
2412
|
+
setColumnVisibility: l,
|
|
2413
|
+
updateColumnVisibility: g,
|
|
2414
|
+
columnVisibilityUpdater: c,
|
|
2415
|
+
// column pinning
|
|
2416
|
+
columnPinning: i,
|
|
2417
|
+
setColumnPinning: x,
|
|
2418
|
+
updateColumnPinning: h,
|
|
2419
|
+
columnPinningUpdater: p,
|
|
2420
|
+
// column order
|
|
2421
|
+
columnOrder: s,
|
|
2422
|
+
setColumnOrder: f,
|
|
2423
|
+
updateColumnOrder: a,
|
|
2424
|
+
columnOrderUpdater: y,
|
|
2425
|
+
// global change
|
|
2426
|
+
setColumnsConfig: t
|
|
2427
|
+
},
|
|
2428
|
+
children: e
|
|
2429
|
+
}
|
|
2430
|
+
);
|
|
2431
|
+
}, _n = () => {
|
|
2432
|
+
const e = ce(dt);
|
|
2433
|
+
if (!e)
|
|
2434
|
+
throw new Error("useColumnSettings must be used within a ColumnSettingsProvider");
|
|
2435
|
+
return e;
|
|
2436
|
+
}, ct = de(void 0), Ho = ({ children: e }) => {
|
|
2437
|
+
const { selectedCells: n, gridMap: t, setSelectedCells: o, setFocusedCellId: s, setAnchorCell: i } = he(), r = re([]), l = U(
|
|
2438
|
+
() => Array.from(n).filter(
|
|
2439
|
+
(h) => {
|
|
2440
|
+
var c, y;
|
|
2441
|
+
return ((c = V(h)) == null ? void 0 : c.colId) === H && ((y = V(h)) == null ? void 0 : y.rowId);
|
|
2442
|
+
}
|
|
2443
|
+
).map((h) => {
|
|
2444
|
+
var c;
|
|
2445
|
+
return (c = V(h)) == null ? void 0 : c.rowId;
|
|
2446
|
+
}),
|
|
2447
|
+
[n]
|
|
2448
|
+
), f = U(() => {
|
|
2449
|
+
const h = [...l].sort(), c = [...r.current].sort();
|
|
2450
|
+
return h.length !== c.length || h.some((p, w) => p !== c[w]) ? (r.current = l, l) : r.current;
|
|
2451
|
+
}, [l]), x = M(() => {
|
|
2452
|
+
const h = Array.from(t.rowIdToIndex.keys()), c = /* @__PURE__ */ new Set();
|
|
2453
|
+
if (h.forEach((y) => {
|
|
2454
|
+
c.add(B(y, H));
|
|
2455
|
+
}), o(c), h.length > 0) {
|
|
2456
|
+
const y = B(h[0], H);
|
|
2457
|
+
s(y), i(V(y));
|
|
2458
|
+
}
|
|
2459
|
+
}, [t]), d = M(() => {
|
|
2460
|
+
o((h) => {
|
|
2461
|
+
const c = new Set(h);
|
|
2462
|
+
return Array.from(c).forEach((y) => {
|
|
2463
|
+
var p;
|
|
2464
|
+
((p = V(y)) == null ? void 0 : p.colId) === H && c.delete(y);
|
|
2465
|
+
}), c;
|
|
2466
|
+
});
|
|
2467
|
+
}, [o]), v = M(
|
|
2468
|
+
(h) => f.includes(h),
|
|
2469
|
+
[f]
|
|
2470
|
+
), u = M(() => {
|
|
2471
|
+
const h = t.rowIdToIndex.size;
|
|
2472
|
+
return h > 0 && f.length === h;
|
|
2473
|
+
}, [t, f]), g = M(() => f.length > 0 && !u(), [f, u]), a = U(() => ({
|
|
2474
|
+
selectedRows: f,
|
|
2475
|
+
selectAllRows: x,
|
|
2476
|
+
clearRowsSelection: d,
|
|
2477
|
+
isRowSelected: v,
|
|
2478
|
+
areAllRowsSelected: u,
|
|
2479
|
+
areSomeRowsSelected: g
|
|
2480
|
+
}), [f, x, u, g, d]);
|
|
2481
|
+
return /* @__PURE__ */ A.jsx(ct.Provider, { value: a, children: e });
|
|
2482
|
+
}, ut = () => {
|
|
2483
|
+
const e = ce(ct);
|
|
2484
|
+
if (!e)
|
|
2485
|
+
throw new Error("useSelectedRowsContext must be used within a SelectedRowsProvider");
|
|
2486
|
+
return e;
|
|
2487
|
+
}, Nn = () => {
|
|
2488
|
+
const { attribFields: e } = ue();
|
|
2489
|
+
return (t = []) => {
|
|
2490
|
+
for (const { isAttrib: o, value: s, field: i } of t) {
|
|
2491
|
+
if (!o) continue;
|
|
2492
|
+
const r = e.find((m) => m.name === i);
|
|
2493
|
+
if (!r) continue;
|
|
2494
|
+
let l = s;
|
|
2495
|
+
const { type: f } = r.data;
|
|
2496
|
+
if (f === "integer" || f === "float") {
|
|
2497
|
+
if (typeof s == "string") {
|
|
2498
|
+
if (s.trim() === "" || isNaN(Number(s)))
|
|
2499
|
+
throw new Error(`“${i}” must be a valid number`);
|
|
2500
|
+
l = f === "integer" ? parseInt(s, 10) : parseFloat(s);
|
|
2501
|
+
} else if (typeof s != "number")
|
|
2502
|
+
throw new Error(`“${i}” must be a valid number`);
|
|
2503
|
+
}
|
|
2504
|
+
const x = [
|
|
2505
|
+
"ge",
|
|
2506
|
+
"gt",
|
|
2507
|
+
"le",
|
|
2508
|
+
"lt",
|
|
2509
|
+
"minLength",
|
|
2510
|
+
"maxLength",
|
|
2511
|
+
"minItems",
|
|
2512
|
+
"maxItems"
|
|
2513
|
+
], d = Object.entries(r.data).reduce((m, [E, k]) => (x.includes(E) && (m[E] = k), m), {}), { ge: v, gt: u, le: g, lt: a, minLength: h, maxLength: c, minItems: y, maxItems: p } = d, w = r.data.regex;
|
|
2514
|
+
if (typeof l == "number") {
|
|
2515
|
+
if (v != null && l < v) throw new Error(`“${i}” must be ≥ ${v}`);
|
|
2516
|
+
if (u != null && l <= u) throw new Error(`“${i}” must be > ${u}`);
|
|
2517
|
+
if (g != null && l > g) throw new Error(`“${i}” must be ≤ ${g}`);
|
|
2518
|
+
if (a != null && l >= a) throw new Error(`“${i}” must be < ${a}`);
|
|
2519
|
+
} else if (typeof l == "string") {
|
|
2520
|
+
if (h != null && l.length < h)
|
|
2521
|
+
throw new Error(`“${i}” length must be ≥ ${h}`);
|
|
2522
|
+
if (c != null && l.length > c)
|
|
2523
|
+
throw new Error(`“${i}” length must be ≤ ${c}`);
|
|
2524
|
+
if (w && !new RegExp(w).test(l))
|
|
2525
|
+
throw new Error(`“${i}” must match pattern ${w}`);
|
|
2526
|
+
} else if (Array.isArray(l)) {
|
|
2527
|
+
if (y != null && l.length < y)
|
|
2528
|
+
throw new Error(`“${i}” items must be ≥ ${y}`);
|
|
2529
|
+
if (p != null && l.length > p)
|
|
2530
|
+
throw new Error(`“${i}” items must be ≤ ${p}`);
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
};
|
|
2534
|
+
}, Fn = (e = 50) => {
|
|
2535
|
+
const [n, t] = Q([]), [o, s] = Q([]), i = M(
|
|
2536
|
+
(d, v) => {
|
|
2537
|
+
d.length && (t((u) => {
|
|
2538
|
+
const g = [...u, { undo: d, redo: v, timestamp: Date.now() }];
|
|
2539
|
+
return g.length > e ? g.slice(g.length - e) : g;
|
|
2540
|
+
}), s([]));
|
|
2541
|
+
},
|
|
2542
|
+
[e]
|
|
2543
|
+
), r = (d) => d.reduce(
|
|
2544
|
+
(v, u) => (u.wasInherited && u.folderId ? v[1].push({
|
|
2545
|
+
entityId: u.id,
|
|
2546
|
+
entityType: u.type,
|
|
2547
|
+
folderId: u.folderId,
|
|
2548
|
+
attribs: [u.field],
|
|
2549
|
+
ownAttrib: u.ownAttrib
|
|
2550
|
+
}) : v[0].push(u), v),
|
|
2551
|
+
[[], []]
|
|
2552
|
+
), l = M(() => {
|
|
2553
|
+
if (n.length === 0) return null;
|
|
2554
|
+
const d = [...n], v = d.pop();
|
|
2555
|
+
return t(d), s((u) => [...u, v]), r(v.undo);
|
|
2556
|
+
}, [n]), f = M(() => {
|
|
2557
|
+
if (o.length === 0) return null;
|
|
2558
|
+
const d = [...o], v = d.pop();
|
|
2559
|
+
return s(d), t((u) => [...u, v]), r(v.redo);
|
|
2560
|
+
}, [o]), x = M(() => {
|
|
2561
|
+
t([]), s([]);
|
|
2562
|
+
}, []);
|
|
2563
|
+
return {
|
|
2564
|
+
pushHistory: i,
|
|
2565
|
+
undo: l,
|
|
2566
|
+
redo: f,
|
|
2567
|
+
canUndo: n.length > 0,
|
|
2568
|
+
canRedo: o.length > 0,
|
|
2569
|
+
clearHistory: x
|
|
2570
|
+
};
|
|
2571
|
+
}, ht = de(void 0), qo = ({ children: e }) => {
|
|
2572
|
+
const [n, t] = Q(null), o = M((c) => c === n, [n]), { pushHistory: s, undo: i, redo: r, canUndo: l, canRedo: f } = Fn(), { updateEntities: x, inheritFromParent: d } = Rn({
|
|
2573
|
+
pushHistory: s
|
|
2574
|
+
}), v = Nn(), u = async (c = [], y = !0) => {
|
|
2575
|
+
try {
|
|
2576
|
+
return v(c), await x(c, y);
|
|
2577
|
+
} catch (p) {
|
|
2578
|
+
return ie.error(p.message), Promise.reject(p);
|
|
2579
|
+
}
|
|
2580
|
+
}, g = async () => {
|
|
2581
|
+
const [c, y] = i() || [];
|
|
2582
|
+
if (c && c.length > 0)
|
|
2583
|
+
try {
|
|
2584
|
+
await u(c, !1);
|
|
2585
|
+
} catch {
|
|
2586
|
+
ie.error("Failed to undo changes");
|
|
2587
|
+
}
|
|
2588
|
+
if (y && y.length > 0)
|
|
2589
|
+
try {
|
|
2590
|
+
await d(y, !1);
|
|
2591
|
+
} catch {
|
|
2592
|
+
ie.error("Failed to inherit changes");
|
|
2593
|
+
}
|
|
2594
|
+
}, a = async () => {
|
|
2595
|
+
const [c, y] = r() || [];
|
|
2596
|
+
if (c && c.length > 0)
|
|
2597
|
+
try {
|
|
2598
|
+
await u(c, !1);
|
|
2599
|
+
} catch {
|
|
2600
|
+
ie.error("Failed to redo changes");
|
|
2601
|
+
}
|
|
2602
|
+
if (y && y.length > 0)
|
|
2603
|
+
try {
|
|
2604
|
+
await d(y, !1);
|
|
2605
|
+
} catch {
|
|
2606
|
+
ie.error("Failed to inherit changes");
|
|
2607
|
+
}
|
|
2608
|
+
}, h = U(
|
|
2609
|
+
() => ({
|
|
2610
|
+
editingCellId: n,
|
|
2611
|
+
setEditingCellId: t,
|
|
2612
|
+
isEditing: o,
|
|
2613
|
+
updateEntities: u,
|
|
2614
|
+
inheritFromParent: d,
|
|
2615
|
+
undo: g,
|
|
2616
|
+
redo: a,
|
|
2617
|
+
canUndo: l,
|
|
2618
|
+
canRedo: f
|
|
2619
|
+
}),
|
|
2620
|
+
[
|
|
2621
|
+
n,
|
|
2622
|
+
o,
|
|
2623
|
+
u,
|
|
2624
|
+
d,
|
|
2625
|
+
g,
|
|
2626
|
+
a,
|
|
2627
|
+
l,
|
|
2628
|
+
f
|
|
2629
|
+
]
|
|
2630
|
+
);
|
|
2631
|
+
return J(() => {
|
|
2632
|
+
const c = (y) => {
|
|
2633
|
+
const p = y.target;
|
|
2634
|
+
if (p.tagName === "INPUT" || p.tagName === "TEXTAREA" || p.isContentEditable || p.getAttribute("role") === "textbox" || p.tagName === "LI")
|
|
2635
|
+
return;
|
|
2636
|
+
const m = typeof navigator < "u" && // @ts-expect-error
|
|
2637
|
+
(navigator.userAgentData && // @ts-expect-error
|
|
2638
|
+
navigator.userAgentData.platform.toUpperCase().includes("MAC") || navigator.userAgent.toUpperCase().includes("MAC")) ? y.metaKey : y.ctrlKey;
|
|
2639
|
+
m && y.key === "z" && (y.preventDefault(), l && g()), (m && y.key === "y" || m && y.shiftKey && y.key === "z" || m && y.key === "Z") && (y.preventDefault(), f && a());
|
|
2640
|
+
};
|
|
2641
|
+
return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
|
|
2642
|
+
}, [l, f, g, a]), /* @__PURE__ */ A.jsx(ht.Provider, { value: h, children: e });
|
|
2643
|
+
}, ye = () => {
|
|
2644
|
+
const e = ce(ht);
|
|
2645
|
+
if (e === void 0)
|
|
2646
|
+
throw new Error("useCellEditing must be used within a CellEditingProvider");
|
|
2647
|
+
return e;
|
|
2648
|
+
}, Pn = N.div`
|
|
2649
|
+
position: absolute;
|
|
2650
|
+
inset: 0;
|
|
2651
|
+
padding: 4px 8px;
|
|
2652
|
+
display: flex;
|
|
2653
|
+
align-items: center;
|
|
2654
|
+
|
|
2655
|
+
&:focus-visible {
|
|
2656
|
+
outline: none;
|
|
2657
|
+
}
|
|
2658
|
+
|
|
2659
|
+
&.inherited {
|
|
2660
|
+
opacity: 0.6;
|
|
2661
|
+
font-style: italic;
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
&.loading {
|
|
2665
|
+
inset: 4px;
|
|
2666
|
+
border-radius: 4px;
|
|
2667
|
+
opacity: 1;
|
|
2668
|
+
}
|
|
2669
|
+
`, Vn = ({
|
|
2670
|
+
rowId: e,
|
|
2671
|
+
columnId: n,
|
|
2672
|
+
value: t,
|
|
2673
|
+
attributeData: o,
|
|
2674
|
+
options: s = [],
|
|
2675
|
+
isCollapsed: i,
|
|
2676
|
+
isInherited: r,
|
|
2677
|
+
isPlaceholder: l,
|
|
2678
|
+
isReadOnly: f,
|
|
2679
|
+
enableCustomValues: x,
|
|
2680
|
+
onChange: d,
|
|
2681
|
+
...v
|
|
2682
|
+
}) => {
|
|
2683
|
+
const u = re(null), g = o == null ? void 0 : o.type, { isEditing: a, setEditingCellId: h } = ye(), { isCellFocused: c, gridMap: y, selectCell: p, focusCell: w } = he(), m = B(e, n), E = a(m), k = c(m), D = M(() => {
|
|
2684
|
+
l || f || h(m);
|
|
2685
|
+
}, [m, h, l]), b = () => {
|
|
2686
|
+
E || h(null);
|
|
2687
|
+
}, I = () => {
|
|
2688
|
+
const T = y.rowIdToIndex.get(e);
|
|
2689
|
+
if (T === void 0) return;
|
|
2690
|
+
const z = y.indexToRowId.get(T + 1);
|
|
2691
|
+
if (z) {
|
|
2692
|
+
const R = B(z, n);
|
|
2693
|
+
p(R, !1, !1), w(R), h(R);
|
|
2694
|
+
}
|
|
2695
|
+
}, C = (T, z) => {
|
|
2696
|
+
h(null), !f && (z === "Enter" && I(), (T !== t || z === "Enter") && (d == null || d(T, z)));
|
|
2697
|
+
}, S = () => {
|
|
2698
|
+
h(null);
|
|
2699
|
+
}, j = U(() => {
|
|
2700
|
+
const T = {
|
|
2701
|
+
onChange: C,
|
|
2702
|
+
onCancelEdit: S,
|
|
2703
|
+
isEditing: E
|
|
2704
|
+
}, z = ["string", "integer", "float"];
|
|
2705
|
+
switch (!0) {
|
|
2706
|
+
// this is showing the collapsed widget (dot)
|
|
2707
|
+
case i: {
|
|
2708
|
+
const R = g != null && g.includes("list") ? s.find(
|
|
2709
|
+
($) => Array.isArray(t) ? t.includes($.value) : t === $.value
|
|
2710
|
+
) : void 0, O = R == null ? void 0 : R.color;
|
|
2711
|
+
return /* @__PURE__ */ A.jsx(sn, { color: O });
|
|
2712
|
+
}
|
|
2713
|
+
case !!s.length: {
|
|
2714
|
+
const R = Array.isArray(t) ? t : [t];
|
|
2715
|
+
return /* @__PURE__ */ A.jsx(
|
|
2716
|
+
wn,
|
|
2717
|
+
{
|
|
2718
|
+
value: R,
|
|
2719
|
+
options: s,
|
|
2720
|
+
type: g,
|
|
2721
|
+
onOpen: () => !f && h(m),
|
|
2722
|
+
enableCustomValues: x,
|
|
2723
|
+
...T
|
|
2724
|
+
}
|
|
2725
|
+
);
|
|
2726
|
+
}
|
|
2727
|
+
case z.includes(g):
|
|
2728
|
+
return /* @__PURE__ */ A.jsx(qe, { value: t, isInherited: r, ...T });
|
|
2729
|
+
case (g === "datetime" && t !== null && t !== void 0):
|
|
2730
|
+
return /* @__PURE__ */ A.jsx(an, { value: t, isInherited: r, ...T });
|
|
2731
|
+
case g === "boolean":
|
|
2732
|
+
return /* @__PURE__ */ A.jsx(Cn, { value: t, ...T });
|
|
2733
|
+
case l:
|
|
2734
|
+
return null;
|
|
2735
|
+
default:
|
|
2736
|
+
return /* @__PURE__ */ A.jsx(qe, { value: t, ...T });
|
|
2737
|
+
}
|
|
2738
|
+
}, [m, t, g, E, s, i]);
|
|
2739
|
+
return /* @__PURE__ */ A.jsx(
|
|
2740
|
+
Pn,
|
|
2741
|
+
{
|
|
2742
|
+
...v,
|
|
2743
|
+
className: q(v.className, { inherited: r && !E }),
|
|
2744
|
+
ref: u,
|
|
2745
|
+
onDoubleClick: D,
|
|
2746
|
+
onClick: b,
|
|
2747
|
+
id: m,
|
|
2748
|
+
"data-tooltip": r && !E && k ? "Inherited" : void 0,
|
|
2749
|
+
"data-tooltip-delay": 200,
|
|
2750
|
+
children: j
|
|
2751
|
+
}
|
|
2752
|
+
);
|
|
2753
|
+
};
|
|
2754
|
+
function Ln(e, n) {
|
|
2755
|
+
var t, o, s, i, r, l;
|
|
2756
|
+
return e.rowId === n.rowId && e.columnId === n.columnId && e.isCollapsed === n.isCollapsed && JSON.stringify(e.value) === JSON.stringify(n.value) && ((t = e == null ? void 0 : e.attributeData) == null ? void 0 : t.type) === ((o = n == null ? void 0 : n.attributeData) == null ? void 0 : o.type) && // Only check options length for list types to avoid deep comparison
|
|
2757
|
+
(!((s = e == null ? void 0 : e.attributeData) != null && s.type.includes("list")) && !((i = n == null ? void 0 : n.attributeData) != null && i.type.includes("list")) || ((r = e.options) == null ? void 0 : r.length) === ((l = n.options) == null ? void 0 : l.length)) && e.isInherited === n.isInherited && e.enableCustomValues === n.enableCustomValues && e.isReadOnly === n.isReadOnly && e.isPlaceholder === n.isPlaceholder && e.isFocused === n.isFocused && e.isCollapsed === n.isCollapsed;
|
|
2758
|
+
}
|
|
2759
|
+
const me = Me(Vn, Ln), Wn = N(et)`
|
|
2760
|
+
background-color: unset;
|
|
2761
|
+
padding: 2px !important;
|
|
2762
|
+
cursor: pointer;
|
|
2763
|
+
`, Un = N.div`
|
|
2764
|
+
position: relative;
|
|
2765
|
+
display: flex;
|
|
2766
|
+
align-items: center;
|
|
2767
|
+
gap: var(--base-gap-small);
|
|
2768
|
+
height: 100%;
|
|
2769
|
+
width: 100%;
|
|
2770
|
+
padding-right: 8px;
|
|
2771
|
+
`, Kn = N.div`
|
|
2772
|
+
width: 100%;
|
|
2773
|
+
height: 24px;
|
|
2774
|
+
overflow: hidden;
|
|
2775
|
+
position: relative;
|
|
2776
|
+
`, Bn = N.div`
|
|
2777
|
+
position: absolute;
|
|
2778
|
+
inset: 0;
|
|
2779
|
+
`, Hn = N.div`
|
|
2780
|
+
display: flex;
|
|
2781
|
+
align-items: center;
|
|
2782
|
+
gap: var(--base-gap-large);
|
|
2783
|
+
padding: 2px 4px;
|
|
2784
|
+
border-radius: var(--border-radius-m);
|
|
2785
|
+
cursor: pointer;
|
|
2786
|
+
overflow: hidden;
|
|
2787
|
+
width: fit-content;
|
|
2788
|
+
max-width: 100%;
|
|
2789
|
+
height: 100%;
|
|
2790
|
+
|
|
2791
|
+
/* &:hover {
|
|
2792
|
+
&,
|
|
2793
|
+
.icon,
|
|
2794
|
+
.path {
|
|
2795
|
+
color: var(--md-sys-color-primary);
|
|
2796
|
+
}
|
|
2797
|
+
} */
|
|
2798
|
+
`, qn = N.div`
|
|
2799
|
+
display: flex;
|
|
2800
|
+
flex-direction: column;
|
|
2801
|
+
overflow: hidden;
|
|
2802
|
+
|
|
2803
|
+
.path {
|
|
2804
|
+
${Rt.labelSmall}
|
|
2805
|
+
margin-bottom: -4px;
|
|
2806
|
+
color: var(--md-sys-color-outline);
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
span {
|
|
2810
|
+
overflow: hidden;
|
|
2811
|
+
white-space: nowrap;
|
|
2812
|
+
text-overflow: ellipsis;
|
|
2813
|
+
}
|
|
2814
|
+
`, Yn = ({
|
|
2815
|
+
id: e,
|
|
2816
|
+
label: n,
|
|
2817
|
+
name: t,
|
|
2818
|
+
path: o,
|
|
2819
|
+
showHierarchy: s,
|
|
2820
|
+
icon: i,
|
|
2821
|
+
type: r,
|
|
2822
|
+
isExpanded: l,
|
|
2823
|
+
toggleExpandAll: f,
|
|
2824
|
+
toggleExpanded: x
|
|
2825
|
+
}) => /* @__PURE__ */ A.jsxs(Un, { children: [
|
|
2826
|
+
s ? r === "folder" ? /* @__PURE__ */ A.jsx(
|
|
2827
|
+
Wn,
|
|
2828
|
+
{
|
|
2829
|
+
onClick: (d) => {
|
|
2830
|
+
d.stopPropagation(), d.altKey ? f(e) : x();
|
|
2831
|
+
},
|
|
2832
|
+
className: "expander",
|
|
2833
|
+
icon: l ? "expand_more" : "chevron_right"
|
|
2834
|
+
}
|
|
2835
|
+
) : /* @__PURE__ */ A.jsx("div", { style: { display: "inline-block", minWidth: 24 } }) : null,
|
|
2836
|
+
/* @__PURE__ */ A.jsx(Kn, { style: { height: o ? 32 : 24 }, children: /* @__PURE__ */ A.jsx(Bn, { children: /* @__PURE__ */ A.jsxs(Hn, { children: [
|
|
2837
|
+
i && /* @__PURE__ */ A.jsx(ae, { icon: i }),
|
|
2838
|
+
/* @__PURE__ */ A.jsxs(qn, { children: [
|
|
2839
|
+
o && /* @__PURE__ */ A.jsx("span", { className: "path", children: o }),
|
|
2840
|
+
/* @__PURE__ */ A.jsx("span", { className: "label", children: n || t })
|
|
2841
|
+
] })
|
|
2842
|
+
] }) }) })
|
|
2843
|
+
] }), te = "inset 0 1px 0 0 var(--md-sys-color-primary)", ne = "inset -1px 0 0 0 var(--md-sys-color-primary)", oe = "inset 0 -1px 0 0 var(--md-sys-color-primary)", se = "inset 1px 0 0 0 var(--md-sys-color-primary)", Z = (e) => e ? "inset -2px -1px 0 0 var(--md-sys-color-surface-container), inset 1px 0 0 0 var(--md-sys-color-surface-container)" : "inset 1px -1px 0 0 var(--md-sys-color-surface-container)", Zn = N.tr`
|
|
2844
|
+
display: flex;
|
|
2845
|
+
position: absolute;
|
|
2846
|
+
width: 100%;
|
|
2847
|
+
`, Ne = 50, ft = N.div`
|
|
2848
|
+
display: flex;
|
|
2849
|
+
align-items: center;
|
|
2850
|
+
gap: var(--base-gap-small);
|
|
2851
|
+
height: 100%;
|
|
2852
|
+
width: 100%;
|
|
2853
|
+
padding: 0px 8px;
|
|
2854
|
+
border-radius: var(--border-radius-m);
|
|
2855
|
+
user-select: none;
|
|
2856
|
+
padding-right: 0;
|
|
2857
|
+
|
|
2858
|
+
min-width: ${Ne}px;
|
|
2859
|
+
&.bold {
|
|
2860
|
+
font-weight: 600;
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
&.loading {
|
|
2864
|
+
margin: 0px 5px;
|
|
2865
|
+
padding: 0 !important;
|
|
2866
|
+
width: calc(100% - 10px);
|
|
2867
|
+
height: 28px;
|
|
2868
|
+
margin-top: 3px;
|
|
2869
|
+
|
|
2870
|
+
&:not(.hierarchy) {
|
|
2871
|
+
height: 32px;
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
&:focus-visible {
|
|
2876
|
+
outline: none;
|
|
2877
|
+
}
|
|
2878
|
+
`, Qn = N.div`
|
|
2879
|
+
position: absolute;
|
|
2880
|
+
right: -1px;
|
|
2881
|
+
top: 0;
|
|
2882
|
+
bottom: 0;
|
|
2883
|
+
width: 6px;
|
|
2884
|
+
cursor: col-resize;
|
|
2885
|
+
background-color: var(--md-sys-color-surface-container-high);
|
|
2886
|
+
|
|
2887
|
+
opacity: 0;
|
|
2888
|
+
|
|
2889
|
+
&.resizing {
|
|
2890
|
+
background-color: var(--md-sys-color-primary);
|
|
2891
|
+
opacity: 1;
|
|
2892
|
+
}
|
|
2893
|
+
`, Jn = N.tr`
|
|
2894
|
+
background-color: var(--md-sys-color-surface-container-low);
|
|
2895
|
+
`, Gn = N.th`
|
|
2896
|
+
position: relative;
|
|
2897
|
+
background-color: var(--md-sys-color-surface-container-lowest);
|
|
2898
|
+
box-shadow: inset 1px -1px 0 0 var(--md-sys-color-surface-container);
|
|
2899
|
+
display: flex;
|
|
2900
|
+
align-items: center;
|
|
2901
|
+
min-height: fit-content;
|
|
2902
|
+
min-width: ${Ne}px;
|
|
2903
|
+
&.large {
|
|
2904
|
+
min-width: 300px;
|
|
2905
|
+
}
|
|
2906
|
+
&:hover {
|
|
2907
|
+
.resize-handle {
|
|
2908
|
+
opacity: 1;
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
/* show action button */
|
|
2913
|
+
&:hover {
|
|
2914
|
+
.action {
|
|
2915
|
+
display: flex;
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
/* Styling for the last pinned left column */
|
|
2920
|
+
&.last-pinned-left {
|
|
2921
|
+
box-shadow: inset 1px -1px 0 0 var(--md-sys-color-surface-container),
|
|
2922
|
+
inset -2px 0 0 0 var(--md-sys-color-surface-container);
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
/* special styles for the left selection column */
|
|
2926
|
+
&.__row_selection__ {
|
|
2927
|
+
min-width: unset;
|
|
2928
|
+
width: 20px !important;
|
|
2929
|
+
|
|
2930
|
+
.actions {
|
|
2931
|
+
display: none;
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
`, Xn = N.div`
|
|
2935
|
+
display: flex;
|
|
2936
|
+
gap: var(--base-gap-small);
|
|
2937
|
+
|
|
2938
|
+
position: absolute;
|
|
2939
|
+
z-index: 10;
|
|
2940
|
+
right: 8px;
|
|
2941
|
+
top: 50%;
|
|
2942
|
+
transform: translateY(-50%);
|
|
2943
|
+
`, eo = N.td`
|
|
2944
|
+
position: relative;
|
|
2945
|
+
box-shadow: ${Z(!1)};
|
|
2946
|
+
min-width: ${Ne}px;
|
|
2947
|
+
background-color: var(--md-sys-color-surface-container-low);
|
|
2948
|
+
|
|
2949
|
+
&.task {
|
|
2950
|
+
background-color: hsl(216 15% 11.5% / 1);
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
&.selected-row {
|
|
2954
|
+
background-color: var(--md-sys-color-surface-container-high);
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
&.selected {
|
|
2958
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
2959
|
+
position: relative;
|
|
2960
|
+
z-index: 1;
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
/* remove default focus style */
|
|
2964
|
+
&:focus-visible {
|
|
2965
|
+
outline: none;
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
/* Styling for the last pinned left column */
|
|
2969
|
+
/* extra border on the right */
|
|
2970
|
+
&.last-pinned-left {
|
|
2971
|
+
box-shadow: inset 1px -1px 0 0 var(--md-sys-color-surface-container),
|
|
2972
|
+
inset -2px 0 0 0 var(--md-sys-color-surface-container);
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
/* Shadow combinations - single side */
|
|
2976
|
+
&.shadow-top:not(.shadow-right):not(.shadow-bottom):not(.shadow-left) {
|
|
2977
|
+
box-shadow: ${te}, ${({ $isLastPinned: e }) => Z(e || !1)};
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
&.shadow-right:not(.shadow-top):not(.shadow-bottom):not(.shadow-left) {
|
|
2981
|
+
box-shadow: ${ne}, ${({ $isLastPinned: e }) => Z(e || !1)};
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
&.shadow-bottom:not(.shadow-top):not(.shadow-right):not(.shadow-left) {
|
|
2985
|
+
box-shadow: ${oe}, ${({ $isLastPinned: e }) => Z(e || !1)};
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
&.shadow-left:not(.shadow-top):not(.shadow-right):not(.shadow-bottom) {
|
|
2989
|
+
box-shadow: ${se}, ${({ $isLastPinned: e }) => Z(e || !1)};
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
/* Two sides */
|
|
2993
|
+
&.shadow-top.shadow-right:not(.shadow-bottom):not(.shadow-left) {
|
|
2994
|
+
box-shadow: ${te}, ${ne},
|
|
2995
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
&.shadow-top.shadow-bottom:not(.shadow-right):not(.shadow-left) {
|
|
2999
|
+
box-shadow: ${te}, ${oe},
|
|
3000
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3001
|
+
}
|
|
3002
|
+
|
|
3003
|
+
&.shadow-top.shadow-left:not(.shadow-right):not(.shadow-bottom) {
|
|
3004
|
+
box-shadow: ${te}, ${se},
|
|
3005
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
&.shadow-right.shadow-bottom:not(.shadow-top):not(.shadow-left) {
|
|
3009
|
+
box-shadow: ${ne}, ${oe},
|
|
3010
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
&.shadow-right.shadow-left:not(.shadow-top):not(.shadow-bottom) {
|
|
3014
|
+
box-shadow: ${ne}, ${se},
|
|
3015
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
&.shadow-bottom.shadow-left:not(.shadow-top):not(.shadow-right) {
|
|
3019
|
+
box-shadow: ${oe}, ${se},
|
|
3020
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
/* Three sides */
|
|
3024
|
+
&.shadow-top.shadow-right.shadow-bottom:not(.shadow-left) {
|
|
3025
|
+
box-shadow: ${te}, ${ne}, ${oe},
|
|
3026
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3029
|
+
&.shadow-top.shadow-right.shadow-left:not(.shadow-bottom) {
|
|
3030
|
+
box-shadow: ${te}, ${ne}, ${se},
|
|
3031
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
&.shadow-top.shadow-bottom.shadow-left:not(.shadow-right) {
|
|
3035
|
+
box-shadow: ${te}, ${oe}, ${se},
|
|
3036
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
&.shadow-right.shadow-bottom.shadow-left:not(.shadow-top) {
|
|
3040
|
+
box-shadow: ${ne}, ${oe}, ${se},
|
|
3041
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
/* All four sides */
|
|
3045
|
+
&.shadow-top.shadow-right.shadow-bottom.shadow-left {
|
|
3046
|
+
box-shadow: ${te}, ${ne}, ${oe}, ${se},
|
|
3047
|
+
${({ $isLastPinned: e }) => Z(e || !1)};
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
/* Focus styling */
|
|
3051
|
+
&.focused {
|
|
3052
|
+
position: relative;
|
|
3053
|
+
z-index: 2;
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
/* Use pseudo-element for focused outline to avoid box-shadow conflicts */
|
|
3057
|
+
&.focused::after {
|
|
3058
|
+
content: '';
|
|
3059
|
+
position: absolute;
|
|
3060
|
+
top: 0;
|
|
3061
|
+
left: 0;
|
|
3062
|
+
right: 0;
|
|
3063
|
+
bottom: 0;
|
|
3064
|
+
border: 2px solid var(--md-sys-color-primary);
|
|
3065
|
+
pointer-events: none;
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
&.editing {
|
|
3069
|
+
z-index: 10 !important;
|
|
3070
|
+
/* light border around the outside */
|
|
3071
|
+
&::before {
|
|
3072
|
+
content: '';
|
|
3073
|
+
position: absolute;
|
|
3074
|
+
inset: 2px;
|
|
3075
|
+
border: 2px solid var(--md-sys-color-surface-container-low);
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
/* special styles for selection bar cells */
|
|
3080
|
+
&.__row_selection__ {
|
|
3081
|
+
width: 20px !important;
|
|
3082
|
+
min-width: unset;
|
|
3083
|
+
|
|
3084
|
+
&.selected {
|
|
3085
|
+
background-color: var(--md-sys-color-primary-container) !important;
|
|
3086
|
+
box-shadow: none !important;
|
|
3087
|
+
/* reveal the check mark */
|
|
3088
|
+
[icon='check'] {
|
|
3089
|
+
display: block;
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
`, to = N.thead`
|
|
3094
|
+
display: grid !important;
|
|
3095
|
+
position: sticky;
|
|
3096
|
+
top: 0;
|
|
3097
|
+
min-height: 34px;
|
|
3098
|
+
z-index: 10;
|
|
3099
|
+
background-color: var(--md-sys-color-surface-container-lowest);
|
|
3100
|
+
`, no = N.div`
|
|
3101
|
+
overflow: hidden;
|
|
3102
|
+
position: absolute;
|
|
3103
|
+
inset: 0;
|
|
3104
|
+
border-radius: var(--border-radius-m);
|
|
3105
|
+
|
|
3106
|
+
background-color: var(--md-sys-color-surface-container-low);
|
|
3107
|
+
`, oo = N.div`
|
|
3108
|
+
display: flex;
|
|
3109
|
+
|
|
3110
|
+
height: 100%;
|
|
3111
|
+
width: 100%;
|
|
3112
|
+
overflow: auto;
|
|
3113
|
+
padding: 4px;
|
|
3114
|
+
padding-top: 0;
|
|
3115
|
+
|
|
3116
|
+
&.isLoading {
|
|
3117
|
+
overflow: hidden;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
table {
|
|
3121
|
+
height: fit-content;
|
|
3122
|
+
width: 100%;
|
|
3123
|
+
display: grid;
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
thead {
|
|
3127
|
+
display: none;
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
tbody {
|
|
3131
|
+
position: relative;
|
|
3132
|
+
display: grid;
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
td {
|
|
3136
|
+
height: 34px;
|
|
3137
|
+
padding: 1px 0px;
|
|
3138
|
+
width: 100%;
|
|
3139
|
+
}
|
|
3140
|
+
`, so = N.div`
|
|
3141
|
+
display: flex;
|
|
3142
|
+
align-items: center;
|
|
3143
|
+
justify-content: center;
|
|
3144
|
+
/* This is super important as it prevents onMouseOver incorrectly firing when Icon is added/removed */
|
|
3145
|
+
pointer-events: none;
|
|
3146
|
+
height: 100%;
|
|
3147
|
+
|
|
3148
|
+
/* default hidden. Shown with styles in ProjectTreeTable.styled */
|
|
3149
|
+
[icon='check'] {
|
|
3150
|
+
display: none;
|
|
3151
|
+
}
|
|
3152
|
+
`, io = le(
|
|
3153
|
+
({ isSelected: e, ...n }, t) => /* @__PURE__ */ A.jsx(so, { ...n, ref: t, children: /* @__PURE__ */ A.jsx(ae, { icon: "check" }) })
|
|
3154
|
+
), ro = N.div`
|
|
3155
|
+
position: absolute;
|
|
3156
|
+
inset: 0;
|
|
3157
|
+
display: flex;
|
|
3158
|
+
align-items: center;
|
|
3159
|
+
justify-content: center;
|
|
3160
|
+
cursor: pointer;
|
|
3161
|
+
|
|
3162
|
+
&:hover {
|
|
3163
|
+
background-color: var(--md-sys-color-surface-container-high);
|
|
3164
|
+
}
|
|
3165
|
+
`, lo = () => {
|
|
3166
|
+
const { areAllRowsSelected: e, areSomeRowsSelected: n, selectAllRows: t, clearRowsSelection: o } = ut(), s = e(), i = n(), r = () => {
|
|
3167
|
+
s || i ? o() : t();
|
|
3168
|
+
};
|
|
3169
|
+
return /* @__PURE__ */ A.jsx(ro, { onClick: r, children: s ? (
|
|
3170
|
+
// Show double check mark when all rows are selected
|
|
3171
|
+
/* @__PURE__ */ A.jsx(ae, { icon: "done_all" })
|
|
3172
|
+
) : i ? (
|
|
3173
|
+
// Show minimize icon when some (but not all) rows are selected
|
|
3174
|
+
/* @__PURE__ */ A.jsx(ae, { icon: "remove" })
|
|
3175
|
+
) : (
|
|
3176
|
+
// Show nothing when no rows are selected
|
|
3177
|
+
null
|
|
3178
|
+
) });
|
|
3179
|
+
}, ao = Me(lo), ze = (e) => (n, t, ...o) => n.original.isLoading !== t.original.isLoading ? n.original.isLoading ? 1 : -1 : e(n, t, ...o), co = (e, n) => {
|
|
3180
|
+
const t = e.original.label || e.original.name, o = n.original.label || n.original.name;
|
|
3181
|
+
return t.localeCompare(o);
|
|
3182
|
+
}, uo = (e, n) => {
|
|
3183
|
+
const t = e.original.path || e.original.name, o = n.original.path || n.original.name;
|
|
3184
|
+
return t.localeCompare(o);
|
|
3185
|
+
}, Ye = (e, n, t, o) => {
|
|
3186
|
+
const s = Te(e.original, t), i = Te(n.original, t);
|
|
3187
|
+
if (o && o.enum) {
|
|
3188
|
+
const r = o.enum.findIndex((f) => f.value === s), l = o.enum.findIndex((f) => f.value === i);
|
|
3189
|
+
return r - l < 0 ? 1 : -1;
|
|
3190
|
+
} else return (o == null ? void 0 : o.type) === "datetime" ? Ve.datetime(e, n, t) : (o == null ? void 0 : o.type) === "boolean" ? (s === !0 ? 1 : 0) - (i === !0 ? 1 : 0) : Ve.alphanumeric(e, n, t);
|
|
3191
|
+
}, ho = ({
|
|
3192
|
+
tableData: e,
|
|
3193
|
+
attribs: n,
|
|
3194
|
+
columnSizing: t = {},
|
|
3195
|
+
showHierarchy: o,
|
|
3196
|
+
isLoading: s,
|
|
3197
|
+
sliceId: i,
|
|
3198
|
+
options: r,
|
|
3199
|
+
toggleExpandAll: l,
|
|
3200
|
+
toggleExpanded: f
|
|
3201
|
+
}) => {
|
|
3202
|
+
const { updateEntities: x } = ye();
|
|
3203
|
+
return U(() => {
|
|
3204
|
+
const d = [
|
|
3205
|
+
{
|
|
3206
|
+
id: H,
|
|
3207
|
+
header: () => /* @__PURE__ */ A.jsx(ao, {}),
|
|
3208
|
+
cell: () => /* @__PURE__ */ A.jsx(io, {}),
|
|
3209
|
+
size: 20
|
|
3210
|
+
},
|
|
3211
|
+
{
|
|
3212
|
+
accessorKey: "name",
|
|
3213
|
+
header: () => "Folder / Task",
|
|
3214
|
+
sortingFn: ze(o ? co : uo),
|
|
3215
|
+
cell: ({ row: u, column: g }) => {
|
|
3216
|
+
const a = B(u.id, g.id);
|
|
3217
|
+
return /* @__PURE__ */ A.jsx(
|
|
3218
|
+
ft,
|
|
3219
|
+
{
|
|
3220
|
+
id: a,
|
|
3221
|
+
className: q("large", u.original.entityType, {
|
|
3222
|
+
loading: u.original.isLoading,
|
|
3223
|
+
hierarchy: o
|
|
3224
|
+
}),
|
|
3225
|
+
style: {
|
|
3226
|
+
paddingLeft: `calc(${u.depth * 1}rem + 8px)`
|
|
3227
|
+
},
|
|
3228
|
+
tabIndex: 0,
|
|
3229
|
+
children: /* @__PURE__ */ A.jsx(
|
|
3230
|
+
Yn,
|
|
3231
|
+
{
|
|
3232
|
+
id: u.id,
|
|
3233
|
+
label: u.original.label,
|
|
3234
|
+
name: u.original.name,
|
|
3235
|
+
path: o ? void 0 : u.original.path,
|
|
3236
|
+
showHierarchy: o,
|
|
3237
|
+
icon: u.original.icon,
|
|
3238
|
+
type: u.original.entityType,
|
|
3239
|
+
isExpanded: u.getIsExpanded(),
|
|
3240
|
+
toggleExpandAll: l,
|
|
3241
|
+
toggleExpanded: () => f(u.id)
|
|
3242
|
+
}
|
|
3243
|
+
)
|
|
3244
|
+
}
|
|
3245
|
+
);
|
|
3246
|
+
}
|
|
3247
|
+
},
|
|
3248
|
+
{
|
|
3249
|
+
accessorKey: "status",
|
|
3250
|
+
header: () => "Status",
|
|
3251
|
+
sortingFn: ze(
|
|
3252
|
+
(u, g, a) => Ye(u, g, a, { enum: r.statuses, type: "string" })
|
|
3253
|
+
),
|
|
3254
|
+
sortDescFirst: !0,
|
|
3255
|
+
size: t.status || 150,
|
|
3256
|
+
cell: ({ row: u, column: g }) => {
|
|
3257
|
+
const { value: a, id: h, type: c } = be(u, g.id);
|
|
3258
|
+
return /* @__PURE__ */ A.jsx(
|
|
3259
|
+
me,
|
|
3260
|
+
{
|
|
3261
|
+
rowId: h,
|
|
3262
|
+
className: q("status", { loading: u.original.isLoading }),
|
|
3263
|
+
columnId: g.id,
|
|
3264
|
+
value: a,
|
|
3265
|
+
attributeData: { type: "string" },
|
|
3266
|
+
options: r.statuses.filter((y) => {
|
|
3267
|
+
var p;
|
|
3268
|
+
return (p = y.scope) == null ? void 0 : p.includes(c);
|
|
3269
|
+
}),
|
|
3270
|
+
isCollapsed: !!u.original.childOnlyMatch,
|
|
3271
|
+
onChange: (y) => x([{ field: g.id, value: y, id: h, type: c }])
|
|
3272
|
+
}
|
|
3273
|
+
);
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
{
|
|
3277
|
+
accessorKey: "subType",
|
|
3278
|
+
header: () => "Type",
|
|
3279
|
+
size: t.type || 150,
|
|
3280
|
+
cell: ({ row: u, column: g }) => {
|
|
3281
|
+
const { value: a, id: h, type: c } = be(u, g.id), y = c === "folder" ? "folderType" : "taskType";
|
|
3282
|
+
return /* @__PURE__ */ A.jsx(
|
|
3283
|
+
me,
|
|
3284
|
+
{
|
|
3285
|
+
rowId: h,
|
|
3286
|
+
className: q("subType", { loading: u.original.isLoading }),
|
|
3287
|
+
columnId: g.id,
|
|
3288
|
+
value: a,
|
|
3289
|
+
attributeData: { type: "string" },
|
|
3290
|
+
options: c === "folder" ? r.folderTypes : r.taskTypes,
|
|
3291
|
+
isCollapsed: !!u.original.childOnlyMatch,
|
|
3292
|
+
onChange: (p) => x([{ field: y, value: p, id: h, type: c }])
|
|
3293
|
+
}
|
|
3294
|
+
);
|
|
3295
|
+
}
|
|
3296
|
+
},
|
|
3297
|
+
{
|
|
3298
|
+
accessorKey: "assignees",
|
|
3299
|
+
header: () => "Assignees",
|
|
3300
|
+
size: t.assignees || 150,
|
|
3301
|
+
cell: ({ row: u, column: g }) => {
|
|
3302
|
+
const { value: a, id: h, type: c } = be(u, g.id);
|
|
3303
|
+
return c === "folder" ? /* @__PURE__ */ A.jsx(
|
|
3304
|
+
me,
|
|
3305
|
+
{
|
|
3306
|
+
rowId: h,
|
|
3307
|
+
className: q("assignees", { loading: u.original.isLoading }),
|
|
3308
|
+
columnId: g.id,
|
|
3309
|
+
value: "",
|
|
3310
|
+
isPlaceholder: !0
|
|
3311
|
+
}
|
|
3312
|
+
) : /* @__PURE__ */ A.jsx(
|
|
3313
|
+
me,
|
|
3314
|
+
{
|
|
3315
|
+
rowId: h,
|
|
3316
|
+
className: q("assignees", { loading: u.original.isLoading }),
|
|
3317
|
+
columnId: g.id,
|
|
3318
|
+
value: a,
|
|
3319
|
+
attributeData: { type: "list_of_strings" },
|
|
3320
|
+
options: r.assignees,
|
|
3321
|
+
isCollapsed: !!u.original.childOnlyMatch,
|
|
3322
|
+
onChange: (y) => x([{ field: g.id, value: y, id: h, type: c }])
|
|
3323
|
+
}
|
|
3324
|
+
);
|
|
3325
|
+
}
|
|
3326
|
+
},
|
|
3327
|
+
{
|
|
3328
|
+
accessorKey: "tags",
|
|
3329
|
+
header: () => "Tags",
|
|
3330
|
+
size: t.tags || 150,
|
|
3331
|
+
cell: ({ row: u, column: g }) => {
|
|
3332
|
+
const { value: a, id: h, type: c } = be(u, g.id);
|
|
3333
|
+
return /* @__PURE__ */ A.jsx(
|
|
3334
|
+
me,
|
|
3335
|
+
{
|
|
3336
|
+
rowId: h,
|
|
3337
|
+
className: q("tags", { loading: u.original.isLoading }),
|
|
3338
|
+
columnId: g.id,
|
|
3339
|
+
value: a,
|
|
3340
|
+
attributeData: { type: "list_of_strings" },
|
|
3341
|
+
options: r.tags,
|
|
3342
|
+
isCollapsed: !!u.original.childOnlyMatch,
|
|
3343
|
+
onChange: (y) => x([{ field: g.id, value: y, id: h, type: c }]),
|
|
3344
|
+
enableCustomValues: !0
|
|
3345
|
+
}
|
|
3346
|
+
);
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
], v = n.map((u) => ({
|
|
3350
|
+
accessorKey: "attrib." + u.name,
|
|
3351
|
+
header: () => u.data.title || u.name,
|
|
3352
|
+
filterFn: "fuzzy",
|
|
3353
|
+
sortingFn: ze((a, h, c) => Ye(a, h, c, u.data)),
|
|
3354
|
+
cell: ({ row: a, column: h }) => {
|
|
3355
|
+
const c = h.id.replace("attrib_", ""), { value: y, id: p, type: w } = be(a, c, "attrib"), m = !a.original.ownAttrib.includes(c);
|
|
3356
|
+
return /* @__PURE__ */ A.jsx(
|
|
3357
|
+
me,
|
|
3358
|
+
{
|
|
3359
|
+
rowId: p,
|
|
3360
|
+
className: q("attrib", { loading: a.original.isLoading }),
|
|
3361
|
+
columnId: h.id,
|
|
3362
|
+
value: y,
|
|
3363
|
+
attributeData: { type: u.data.type || "string" },
|
|
3364
|
+
options: u.data.enum || [],
|
|
3365
|
+
isCollapsed: !!a.original.childOnlyMatch,
|
|
3366
|
+
isInherited: m,
|
|
3367
|
+
isReadOnly: u.readOnly,
|
|
3368
|
+
onChange: (E) => x([{ field: c, value: E, id: p, type: w, isAttrib: !0 }])
|
|
3369
|
+
}
|
|
3370
|
+
);
|
|
3371
|
+
}
|
|
3372
|
+
}));
|
|
3373
|
+
return [...d, ...v];
|
|
3374
|
+
}, [s, i, e, r, n, o, x]);
|
|
3375
|
+
}, be = (e, n, t) => {
|
|
3376
|
+
var o;
|
|
3377
|
+
return {
|
|
3378
|
+
value: t ? (o = e.original[t]) == null ? void 0 : o[n] : e.original[n],
|
|
3379
|
+
id: e.id,
|
|
3380
|
+
type: e.original.entityType
|
|
3381
|
+
};
|
|
3382
|
+
}, fo = N(et)`
|
|
3383
|
+
padding: 0px !important;
|
|
3384
|
+
display: none;
|
|
3385
|
+
background-color: var(--md-sys-color-surface-container-lowest);
|
|
3386
|
+
|
|
3387
|
+
&.selected {
|
|
3388
|
+
display: flex;
|
|
3389
|
+
}
|
|
3390
|
+
`, je = ({ selected: e, style: n, ...t }) => /* @__PURE__ */ A.jsx(
|
|
3391
|
+
fo,
|
|
3392
|
+
{
|
|
3393
|
+
...t,
|
|
3394
|
+
selected: e,
|
|
3395
|
+
className: q(t.className, "action", { selected: e }),
|
|
3396
|
+
variant: "text",
|
|
3397
|
+
style: { ...n }
|
|
3398
|
+
}
|
|
3399
|
+
), go = (e, n) => {
|
|
3400
|
+
const t = e.getFlatHeaders(), o = e.getState().columnSizingInfo;
|
|
3401
|
+
return U(() => {
|
|
3402
|
+
const i = {};
|
|
3403
|
+
for (let r = 0; r < t.length; r++) {
|
|
3404
|
+
const l = t[r];
|
|
3405
|
+
i[`--header-${l.id}-size`] = l.getSize(), i[`--col-${l.column.id}-size`] = l.column.getSize();
|
|
3406
|
+
}
|
|
3407
|
+
return i;
|
|
3408
|
+
}, [o, n, t]);
|
|
3409
|
+
}, mo = () => {
|
|
3410
|
+
const { getFoldersTasks: e } = _e(), [n, t] = Q([]), { projectName: o, queryFilters: s } = ue();
|
|
3411
|
+
return { handlePreFetchTasks: (r) => {
|
|
3412
|
+
const l = r.target, f = l.closest("td");
|
|
3413
|
+
if (!l.closest(".expander") || !f) return;
|
|
3414
|
+
const x = f.firstElementChild, d = x == null ? void 0 : x.id;
|
|
3415
|
+
if (!d) return;
|
|
3416
|
+
const { colId: v, rowId: u } = V(d) || {};
|
|
3417
|
+
v !== "name" || !u || !x.className.includes("folder") || n.includes(u) || (t((a) => [...a, u]), e(
|
|
3418
|
+
{
|
|
3419
|
+
parentIds: [u],
|
|
3420
|
+
filter: s.filterString,
|
|
3421
|
+
search: s.search
|
|
3422
|
+
},
|
|
3423
|
+
!0
|
|
3424
|
+
));
|
|
3425
|
+
} };
|
|
3426
|
+
}, po = ({ onSuccess: e }) => {
|
|
3427
|
+
const { updateEntities: n } = _e(), { getEntityById: t } = ue();
|
|
3428
|
+
return M(
|
|
3429
|
+
async (s) => {
|
|
3430
|
+
if (!s || s.length === 0)
|
|
3431
|
+
return;
|
|
3432
|
+
const i = s.map((l) => {
|
|
3433
|
+
var f;
|
|
3434
|
+
return t(((f = V(l)) == null ? void 0 : f.rowId) || "");
|
|
3435
|
+
}).filter(Boolean);
|
|
3436
|
+
if (i.length === 0) return;
|
|
3437
|
+
const r = async (l = !1) => {
|
|
3438
|
+
const f = [];
|
|
3439
|
+
for (const x of i)
|
|
3440
|
+
x && f.push({
|
|
3441
|
+
entityType: "folderId" in x ? "task" : "folder",
|
|
3442
|
+
type: "delete",
|
|
3443
|
+
entityId: x.id,
|
|
3444
|
+
force: l
|
|
3445
|
+
});
|
|
3446
|
+
try {
|
|
3447
|
+
await (n == null ? void 0 : n({ operations: f })), e && e();
|
|
3448
|
+
} catch (x) {
|
|
3449
|
+
const d = (x == null ? void 0 : x.error) || "Failed to delete entities";
|
|
3450
|
+
throw console.error("Failed to delete entities:", x), { message: d, ...x };
|
|
3451
|
+
}
|
|
3452
|
+
};
|
|
3453
|
+
We({
|
|
3454
|
+
label: "folders and tasks",
|
|
3455
|
+
message: `Are you sure you want to delete ${s.length} entities? This action cannot be undone.`,
|
|
3456
|
+
accept: r,
|
|
3457
|
+
onError: (l) => {
|
|
3458
|
+
var x;
|
|
3459
|
+
(x = l == null ? void 0 : l.errorCodes) != null && x.includes("delete-folder-with-children") && We({
|
|
3460
|
+
label: "folders and tasks",
|
|
3461
|
+
message: `This folder has child tasks or products that will also be deleted. Are you sure you want to delete ${s.length} entities and all of it's dependencies?`,
|
|
3462
|
+
accept: () => r(!0),
|
|
3463
|
+
deleteLabel: "Delete all (dangerous)"
|
|
3464
|
+
});
|
|
3465
|
+
},
|
|
3466
|
+
deleteLabel: "Delete forever"
|
|
3467
|
+
});
|
|
3468
|
+
},
|
|
3469
|
+
[t, n, e]
|
|
3470
|
+
);
|
|
3471
|
+
}, yo = ({ attribs: e, onOpenNew: n }) => {
|
|
3472
|
+
const { projectName: t, showHierarchy: o, getEntityById: s, toggleExpandAll: i } = ue(), { copyToClipboard: r, exportCSV: l, pasteFromClipboard: f } = Mn(), { isCellSelected: x, selectedCells: d, clearSelection: v, selectCell: u } = he(), { inheritFromParent: g } = ye(), a = po({}), [h] = Dt(), c = (w, m, E) => {
|
|
3473
|
+
const { rowId: k, colId: D } = V(m) || {}, b = e.find((L) => L.name === (D == null ? void 0 : D.replace("attrib_", "")));
|
|
3474
|
+
if (!k)
|
|
3475
|
+
return [
|
|
3476
|
+
{
|
|
3477
|
+
label: "Copy",
|
|
3478
|
+
icon: "content_copy",
|
|
3479
|
+
shortcut: Ee("c", [Ae.Ctrl]),
|
|
3480
|
+
command: () => r(E),
|
|
3481
|
+
shouldShow: !0
|
|
3482
|
+
}
|
|
3483
|
+
];
|
|
3484
|
+
const I = D === "name", C = E.length === 1, S = y(E), j = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set();
|
|
3485
|
+
for (const L of E) {
|
|
3486
|
+
const W = V(L);
|
|
3487
|
+
W && (W.rowId && j.add(W.rowId), W.colId && T.add(W.colId));
|
|
3488
|
+
}
|
|
3489
|
+
const z = Array.from(j), R = Array.from(d).filter(
|
|
3490
|
+
(L) => {
|
|
3491
|
+
var W;
|
|
3492
|
+
return ((W = V(L)) == null ? void 0 : W.colId) === H;
|
|
3493
|
+
}
|
|
3494
|
+
), O = j.size > 1, $ = T.size > 1, F = O && $, _ = S.length > 0 && o && !F;
|
|
3495
|
+
return [
|
|
3496
|
+
// Clipboard operations
|
|
3497
|
+
{
|
|
3498
|
+
label: "Copy",
|
|
3499
|
+
icon: "content_copy",
|
|
3500
|
+
shortcut: Ee("c", [Ae.Ctrl]),
|
|
3501
|
+
command: () => r(E),
|
|
3502
|
+
shouldShow: !0
|
|
3503
|
+
// Always shown
|
|
3504
|
+
},
|
|
3505
|
+
{
|
|
3506
|
+
label: `Copy row${R.length > 1 ? "s" : ""}`,
|
|
3507
|
+
icon: "content_copy",
|
|
3508
|
+
command: () => r(R, !0),
|
|
3509
|
+
shouldShow: I && R.some((L) => {
|
|
3510
|
+
var W, P;
|
|
3511
|
+
return ((W = V(L)) == null ? void 0 : W.rowId) === ((P = V(m)) == null ? void 0 : P.rowId);
|
|
3512
|
+
})
|
|
3513
|
+
},
|
|
3514
|
+
{
|
|
3515
|
+
label: "Paste",
|
|
3516
|
+
icon: "content_paste",
|
|
3517
|
+
shortcut: Ee("v", [Ae.Ctrl]),
|
|
3518
|
+
command: () => f(E),
|
|
3519
|
+
shouldShow: !I,
|
|
3520
|
+
disabled: b == null ? void 0 : b.readOnly
|
|
3521
|
+
},
|
|
3522
|
+
// Entity operations
|
|
3523
|
+
{
|
|
3524
|
+
label: "Show details",
|
|
3525
|
+
icon: "dock_to_left",
|
|
3526
|
+
shortcut: "Double click",
|
|
3527
|
+
command: () => {
|
|
3528
|
+
const L = B(k, H);
|
|
3529
|
+
u(L, !1, !1);
|
|
3530
|
+
},
|
|
3531
|
+
shouldShow: I && C
|
|
3532
|
+
},
|
|
3533
|
+
// Expand/collapse (all) operations - only for name column
|
|
3534
|
+
{
|
|
3535
|
+
label: "Expand all",
|
|
3536
|
+
icon: "expand_all",
|
|
3537
|
+
shortcut: "Alt + click",
|
|
3538
|
+
command: () => i(z, !0),
|
|
3539
|
+
shouldShow: I
|
|
3540
|
+
},
|
|
3541
|
+
{
|
|
3542
|
+
label: "Collapse all",
|
|
3543
|
+
icon: "collapse_all",
|
|
3544
|
+
shortcut: "Alt + click",
|
|
3545
|
+
command: () => i(z, !1),
|
|
3546
|
+
shouldShow: I
|
|
3547
|
+
},
|
|
3548
|
+
// Attribute operations
|
|
3549
|
+
{
|
|
3550
|
+
label: "Inherit from parent",
|
|
3551
|
+
icon: "disabled_by_default",
|
|
3552
|
+
command: () => g(S),
|
|
3553
|
+
shouldShow: _
|
|
3554
|
+
},
|
|
3555
|
+
// Export operations
|
|
3556
|
+
{
|
|
3557
|
+
label: "Export selection",
|
|
3558
|
+
icon: "download",
|
|
3559
|
+
command: () => l(E, t),
|
|
3560
|
+
shouldShow: !0
|
|
3561
|
+
// Always shown
|
|
3562
|
+
},
|
|
3563
|
+
// Creation operations (only in name column and hierarchy mode)
|
|
3564
|
+
{
|
|
3565
|
+
label: "Create folder",
|
|
3566
|
+
icon: "create_new_folder",
|
|
3567
|
+
command: () => n == null ? void 0 : n("folder"),
|
|
3568
|
+
shouldShow: I && o && !!n
|
|
3569
|
+
},
|
|
3570
|
+
{
|
|
3571
|
+
label: "Create root folder",
|
|
3572
|
+
icon: "create_new_folder",
|
|
3573
|
+
command: () => {
|
|
3574
|
+
v(), n == null || n("folder");
|
|
3575
|
+
},
|
|
3576
|
+
shouldShow: I && o && !!n
|
|
3577
|
+
},
|
|
3578
|
+
{
|
|
3579
|
+
label: "Create task",
|
|
3580
|
+
icon: "add_task",
|
|
3581
|
+
command: () => n == null ? void 0 : n("task"),
|
|
3582
|
+
shouldShow: I && o && !!n
|
|
3583
|
+
},
|
|
3584
|
+
// Destructive operations
|
|
3585
|
+
{
|
|
3586
|
+
label: "Delete",
|
|
3587
|
+
icon: "delete",
|
|
3588
|
+
danger: !0,
|
|
3589
|
+
command: () => a(E),
|
|
3590
|
+
shouldShow: I
|
|
3591
|
+
}
|
|
3592
|
+
].filter((L) => L.shouldShow).map(({ shouldShow: L, ...W }) => W);
|
|
3593
|
+
}, y = (w) => w.reduce((m, E) => {
|
|
3594
|
+
var j;
|
|
3595
|
+
const { rowId: k, colId: D } = V(E) || {};
|
|
3596
|
+
if (!k || !D || !D.startsWith("attrib_")) return m;
|
|
3597
|
+
const b = s(k);
|
|
3598
|
+
if (!b) return m;
|
|
3599
|
+
const I = D.replace("attrib_", ""), C = e.find((T) => T.name === I), S = C == null ? void 0 : C.data.inherit;
|
|
3600
|
+
if ((j = b.ownAttrib) != null && j.includes(I) && S) {
|
|
3601
|
+
const T = m.findIndex((z) => z.entityId === k);
|
|
3602
|
+
T >= 0 ? m[T].attribs.includes(I) || m[T].attribs.push(I) : m.push({
|
|
3603
|
+
entityId: k,
|
|
3604
|
+
entityType: "folderId" in b ? "task" : "folder",
|
|
3605
|
+
attribs: [I],
|
|
3606
|
+
ownAttrib: b.ownAttrib || [],
|
|
3607
|
+
// @ts-ignore
|
|
3608
|
+
folderId: b.parentId ?? b.folderId
|
|
3609
|
+
});
|
|
3610
|
+
}
|
|
3611
|
+
return m;
|
|
3612
|
+
}, []);
|
|
3613
|
+
return { handleTableBodyContextMenu: (w) => {
|
|
3614
|
+
var D;
|
|
3615
|
+
const E = w.target.closest("td"), k = (D = E == null ? void 0 : E.firstElementChild) == null ? void 0 : D.id;
|
|
3616
|
+
if (k) {
|
|
3617
|
+
let b = Array.from(d);
|
|
3618
|
+
x(k) || (b = [k]), h(w, c(w, k, b));
|
|
3619
|
+
}
|
|
3620
|
+
} };
|
|
3621
|
+
}, wo = ({
|
|
3622
|
+
visibleColumns: e,
|
|
3623
|
+
tableContainerRef: n,
|
|
3624
|
+
columnPinning: t
|
|
3625
|
+
}) => {
|
|
3626
|
+
var x;
|
|
3627
|
+
const o = U(() => e.filter((d) => d.getIsPinned() === "left").map((d) => d.getIndex()), [e, t]), s = [];
|
|
3628
|
+
if (o.length > 0) {
|
|
3629
|
+
const d = Math.max(...o);
|
|
3630
|
+
for (let v = 0; v <= d; v++)
|
|
3631
|
+
s.push(v);
|
|
3632
|
+
}
|
|
3633
|
+
const i = ot({
|
|
3634
|
+
count: e.length,
|
|
3635
|
+
estimateSize: (d) => e[d].getSize(),
|
|
3636
|
+
//estimate width of each column for accurate scrollbar dragging
|
|
3637
|
+
getScrollElement: () => n.current,
|
|
3638
|
+
horizontal: !0,
|
|
3639
|
+
overscan: 0,
|
|
3640
|
+
//how many columns to render on each side off screen each way (adjust this for performance)
|
|
3641
|
+
rangeExtractor: (d) => {
|
|
3642
|
+
const v = d.startIndex, u = d.endIndex, g = d.overscan, a = [];
|
|
3643
|
+
for (let c = v - g; c <= u + g; c++)
|
|
3644
|
+
c >= 0 && c < e.length && a.push(c);
|
|
3645
|
+
const h = /* @__PURE__ */ new Set([
|
|
3646
|
+
...s,
|
|
3647
|
+
// All columns up to the highest pinned column
|
|
3648
|
+
...a
|
|
3649
|
+
// Visible columns in the current range
|
|
3650
|
+
]);
|
|
3651
|
+
return Array.from(h).sort((c, y) => c - y);
|
|
3652
|
+
}
|
|
3653
|
+
}), r = i.getVirtualItems();
|
|
3654
|
+
let l, f;
|
|
3655
|
+
if (i && r.length) {
|
|
3656
|
+
const d = i.getTotalSize(), v = r.findIndex(
|
|
3657
|
+
(g) => !s.includes(g.index)
|
|
3658
|
+
);
|
|
3659
|
+
if (v !== -1) {
|
|
3660
|
+
const g = r[v].start, a = s.reduce((h, c) => {
|
|
3661
|
+
const y = e[c];
|
|
3662
|
+
return h + y.getSize();
|
|
3663
|
+
}, 0);
|
|
3664
|
+
l = Math.max(0, g - a);
|
|
3665
|
+
} else
|
|
3666
|
+
l = 0;
|
|
3667
|
+
const u = ((x = r[r.length - 1]) == null ? void 0 : x.end) ?? 0;
|
|
3668
|
+
f = Math.max(0, d - u);
|
|
3669
|
+
}
|
|
3670
|
+
return {
|
|
3671
|
+
columnVirtualizer: i,
|
|
3672
|
+
virtualPaddingLeft: l,
|
|
3673
|
+
virtualPaddingRight: f
|
|
3674
|
+
};
|
|
3675
|
+
};
|
|
3676
|
+
function bo() {
|
|
3677
|
+
const { attribFields: e } = ue(), { focusedCellId: n, gridMap: t, selectCell: o, focusCell: s, clearSelection: i, setFocusedCellId: r } = he(), { setEditingCellId: l, editingCellId: f } = ye(), x = M(
|
|
3678
|
+
(d) => {
|
|
3679
|
+
var p;
|
|
3680
|
+
const v = d.target;
|
|
3681
|
+
if (!(v != null && v.closest("table")) || v.tagName === "INPUT" || v.tagName === "TEXTAREA" || v.isContentEditable || v.getAttribute("role") === "textbox" || v.tagName === "LI" || f || !n) return;
|
|
3682
|
+
const u = V(n);
|
|
3683
|
+
if (!u) return;
|
|
3684
|
+
const { rowId: g, colId: a } = u, h = t.rowIdToIndex.get(g), c = t.colIdToIndex.get(a);
|
|
3685
|
+
if (h === void 0 || c === void 0) return;
|
|
3686
|
+
const y = a.startsWith("attrib_") && ((p = e.find((w) => w.name === a.replace("attrib_", ""))) == null ? void 0 : p.readOnly);
|
|
3687
|
+
switch (d.key) {
|
|
3688
|
+
case "ArrowUp": {
|
|
3689
|
+
if (d.preventDefault(), h > 0) {
|
|
3690
|
+
const w = t.indexToRowId.get(h - 1);
|
|
3691
|
+
if (w) {
|
|
3692
|
+
const m = B(w, a);
|
|
3693
|
+
o(m, d.shiftKey, d.shiftKey), s(m);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
break;
|
|
3697
|
+
}
|
|
3698
|
+
case "ArrowDown": {
|
|
3699
|
+
d.preventDefault();
|
|
3700
|
+
const w = t.indexToRowId.get(h + 1);
|
|
3701
|
+
if (w) {
|
|
3702
|
+
const m = B(w, a);
|
|
3703
|
+
o(m, d.shiftKey, d.shiftKey), s(m);
|
|
3704
|
+
}
|
|
3705
|
+
break;
|
|
3706
|
+
}
|
|
3707
|
+
case "ArrowLeft": {
|
|
3708
|
+
if (d.preventDefault(), c > 0) {
|
|
3709
|
+
const w = t.indexToColId.get(c - 1);
|
|
3710
|
+
if (w) {
|
|
3711
|
+
const m = B(g, w);
|
|
3712
|
+
o(m, d.shiftKey, d.shiftKey), s(m);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
break;
|
|
3716
|
+
}
|
|
3717
|
+
case "ArrowRight": {
|
|
3718
|
+
d.preventDefault();
|
|
3719
|
+
const w = t.indexToColId.get(c + 1);
|
|
3720
|
+
if (w) {
|
|
3721
|
+
const m = B(g, w);
|
|
3722
|
+
o(m, d.shiftKey, d.shiftKey), s(m);
|
|
3723
|
+
}
|
|
3724
|
+
break;
|
|
3725
|
+
}
|
|
3726
|
+
case "Enter": {
|
|
3727
|
+
if (d.preventDefault(), y) return;
|
|
3728
|
+
l(n);
|
|
3729
|
+
break;
|
|
3730
|
+
}
|
|
3731
|
+
case "Escape": {
|
|
3732
|
+
d.preventDefault(), i(), l(null), r(null);
|
|
3733
|
+
break;
|
|
3734
|
+
}
|
|
3735
|
+
case "Tab": {
|
|
3736
|
+
d.preventDefault();
|
|
3737
|
+
const w = d.shiftKey ? c - 1 : c + 1, m = t.indexToColId.get(w);
|
|
3738
|
+
if (m) {
|
|
3739
|
+
const E = B(g, m);
|
|
3740
|
+
o(E, !1, !1), s(E);
|
|
3741
|
+
} else if (!d.shiftKey && h < t.rowIdToIndex.size - 1) {
|
|
3742
|
+
const E = t.indexToRowId.get(h + 1), k = t.indexToColId.get(0);
|
|
3743
|
+
if (E && k) {
|
|
3744
|
+
const D = B(E, k);
|
|
3745
|
+
o(D, !1, !1), s(D);
|
|
3746
|
+
}
|
|
3747
|
+
} else if (d.shiftKey && h > 0) {
|
|
3748
|
+
const E = t.indexToRowId.get(h - 1), k = t.indexToColId.get(t.colIdToIndex.size - 1);
|
|
3749
|
+
if (E && k) {
|
|
3750
|
+
const D = B(E, k);
|
|
3751
|
+
o(D, !1, !1), s(D);
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
break;
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
},
|
|
3758
|
+
[
|
|
3759
|
+
n,
|
|
3760
|
+
t,
|
|
3761
|
+
o,
|
|
3762
|
+
s,
|
|
3763
|
+
i,
|
|
3764
|
+
l,
|
|
3765
|
+
f
|
|
3766
|
+
]
|
|
3767
|
+
);
|
|
3768
|
+
return J(() => (document.addEventListener("keydown", x), () => {
|
|
3769
|
+
document.removeEventListener("keydown", x);
|
|
3770
|
+
}), [
|
|
3771
|
+
x,
|
|
3772
|
+
n,
|
|
3773
|
+
t,
|
|
3774
|
+
o,
|
|
3775
|
+
s,
|
|
3776
|
+
i,
|
|
3777
|
+
l,
|
|
3778
|
+
f
|
|
3779
|
+
]), {
|
|
3780
|
+
handleKeyDown: x,
|
|
3781
|
+
focusedCellId: n,
|
|
3782
|
+
gridMap: t,
|
|
3783
|
+
selectCell: o,
|
|
3784
|
+
focusCell: s,
|
|
3785
|
+
clearSelection: i,
|
|
3786
|
+
setEditingCellId: l,
|
|
3787
|
+
editingCellId: f
|
|
3788
|
+
};
|
|
3789
|
+
}
|
|
3790
|
+
const gt = (e) => {
|
|
3791
|
+
const n = e.getIsPinned();
|
|
3792
|
+
return {
|
|
3793
|
+
left: n === "left" ? `${e.getStart("left")}px` : void 0,
|
|
3794
|
+
right: n === "right" ? `${e.getAfter("right")}px` : void 0,
|
|
3795
|
+
position: n ? "sticky" : "relative",
|
|
3796
|
+
width: e.getSize(),
|
|
3797
|
+
zIndex: n ? 100 : 0
|
|
3798
|
+
};
|
|
3799
|
+
}, Yo = (e) => {
|
|
3800
|
+
const n = U(() => e.attribs.reduce((t, o) => {
|
|
3801
|
+
var s, i, r;
|
|
3802
|
+
return (i = (s = o.data) == null ? void 0 : s.enum) != null && i.length && (t[o.name] = (r = o.data) == null ? void 0 : r.enum), t;
|
|
3803
|
+
}, {}), [e.attribs]);
|
|
3804
|
+
return /* @__PURE__ */ A.jsx(
|
|
3805
|
+
$n,
|
|
3806
|
+
{
|
|
3807
|
+
foldersMap: e.foldersMap,
|
|
3808
|
+
tasksMap: e.tasksMap,
|
|
3809
|
+
columnEnums: { ...e.options, ...n },
|
|
3810
|
+
columnReadOnly: e.attribs.filter((t) => t.readOnly).map((t) => t.name),
|
|
3811
|
+
children: /* @__PURE__ */ A.jsx(xo, { ...e })
|
|
3812
|
+
}
|
|
3813
|
+
);
|
|
3814
|
+
}, xo = ({
|
|
3815
|
+
scope: e,
|
|
3816
|
+
attribs: n,
|
|
3817
|
+
options: t,
|
|
3818
|
+
sliceId: o,
|
|
3819
|
+
fetchMoreOnBottomReached: s,
|
|
3820
|
+
onOpenNew: i
|
|
3821
|
+
}) => {
|
|
3822
|
+
const {
|
|
3823
|
+
columnVisibility: r,
|
|
3824
|
+
columnVisibilityUpdater: l,
|
|
3825
|
+
columnPinning: f,
|
|
3826
|
+
columnPinningUpdater: x,
|
|
3827
|
+
columnOrder: d,
|
|
3828
|
+
columnOrderUpdater: v
|
|
3829
|
+
} = _n(), {
|
|
3830
|
+
tableData: u,
|
|
3831
|
+
isLoading: g,
|
|
3832
|
+
isInitialized: a,
|
|
3833
|
+
expanded: h,
|
|
3834
|
+
updateExpanded: c,
|
|
3835
|
+
toggleExpandAll: y,
|
|
3836
|
+
toggleExpanded: p,
|
|
3837
|
+
sorting: w,
|
|
3838
|
+
updateSorting: m,
|
|
3839
|
+
showHierarchy: E
|
|
3840
|
+
} = ue(), k = re(null), { registerGrid: D } = he(), [b, I] = kt(
|
|
3841
|
+
`column-widths-${e}`,
|
|
3842
|
+
{}
|
|
3843
|
+
), C = (P) => {
|
|
3844
|
+
I(ve(P, b));
|
|
3845
|
+
};
|
|
3846
|
+
J(() => {
|
|
3847
|
+
s(k.current);
|
|
3848
|
+
}, [s]);
|
|
3849
|
+
const { loadingAttrib: S, loadingRows: j } = U(() => {
|
|
3850
|
+
var Y;
|
|
3851
|
+
const P = ((Y = k.current) == null ? void 0 : Y.querySelectorAll("tbody tr").length) || 0, ee = Tn(), G = $e(
|
|
3852
|
+
n,
|
|
3853
|
+
E && u.length > 0 ? Math.min(P, 50) : 50
|
|
3854
|
+
);
|
|
3855
|
+
return { loadingAttrib: ee, loadingRows: G };
|
|
3856
|
+
}, [n, u, E, k.current]), T = !a || g, z = ho({
|
|
3857
|
+
tableData: T ? j : u,
|
|
3858
|
+
columnSizing: b,
|
|
3859
|
+
attribs: a ? n : S,
|
|
3860
|
+
isLoading: !a,
|
|
3861
|
+
showHierarchy: E,
|
|
3862
|
+
sliceId: o,
|
|
3863
|
+
options: t,
|
|
3864
|
+
toggleExpandAll: (P) => y([P]),
|
|
3865
|
+
toggleExpanded: (P) => p(P)
|
|
3866
|
+
}), R = bt({
|
|
3867
|
+
data: T ? j : u,
|
|
3868
|
+
columns: z,
|
|
3869
|
+
enableRowSelection: !0,
|
|
3870
|
+
//enable row selection for all rows
|
|
3871
|
+
getRowId: (P) => P.id,
|
|
3872
|
+
enableSubRowSelection: !1,
|
|
3873
|
+
//disable sub row selection
|
|
3874
|
+
getSubRows: (P) => P.subRows,
|
|
3875
|
+
getRowCanExpand: () => !0,
|
|
3876
|
+
getCoreRowModel: Tt(),
|
|
3877
|
+
getFilteredRowModel: Ct(),
|
|
3878
|
+
getExpandedRowModel: vt(),
|
|
3879
|
+
filterFromLeafRows: !0,
|
|
3880
|
+
// EXPANDABLE
|
|
3881
|
+
onExpandedChange: c,
|
|
3882
|
+
// SORTING
|
|
3883
|
+
getSortedRowModel: It(),
|
|
3884
|
+
onSortingChange: m,
|
|
3885
|
+
columnResizeMode: "onChange",
|
|
3886
|
+
onColumnPinningChange: x,
|
|
3887
|
+
onColumnSizingChange: C,
|
|
3888
|
+
onColumnVisibilityChange: l,
|
|
3889
|
+
onColumnOrderChange: v,
|
|
3890
|
+
// @ts-ignore
|
|
3891
|
+
filterFns: xt,
|
|
3892
|
+
state: {
|
|
3893
|
+
expanded: h,
|
|
3894
|
+
sorting: w,
|
|
3895
|
+
columnPinning: {
|
|
3896
|
+
left: [H, ...f.left || []],
|
|
3897
|
+
right: f.right
|
|
3898
|
+
},
|
|
3899
|
+
columnSizing: b,
|
|
3900
|
+
columnVisibility: r,
|
|
3901
|
+
columnOrder: d
|
|
3902
|
+
},
|
|
3903
|
+
enableSorting: !0
|
|
3904
|
+
}), { rows: O } = R.getRowModel();
|
|
3905
|
+
J(() => {
|
|
3906
|
+
const P = O.map((Y) => Y.id), G = [...R.getAllLeafColumns().map((Y) => Y.id)].sort((Y, fe) => {
|
|
3907
|
+
var Fe, Pe;
|
|
3908
|
+
if (H === fe) return 1;
|
|
3909
|
+
const xe = (Fe = f.left) != null && Fe.includes(Y) ? 0 : 1, mt = (Pe = f.left) != null && Pe.includes(fe) ? 0 : 1;
|
|
3910
|
+
return xe - mt;
|
|
3911
|
+
});
|
|
3912
|
+
D(P, G);
|
|
3913
|
+
}, [O, R.getAllLeafColumns(), f, H, D]);
|
|
3914
|
+
const $ = R.getVisibleLeafColumns(), { columnVirtualizer: F, virtualPaddingLeft: _, virtualPaddingRight: K } = wo({
|
|
3915
|
+
visibleColumns: $,
|
|
3916
|
+
tableContainerRef: k,
|
|
3917
|
+
columnPinning: f
|
|
3918
|
+
}), L = go(R, b), W = U(
|
|
3919
|
+
() => n.filter((P) => P.readOnly).map((P) => "attrib_" + P.name),
|
|
3920
|
+
[n]
|
|
3921
|
+
);
|
|
3922
|
+
return /* @__PURE__ */ A.jsx(no, { children: /* @__PURE__ */ A.jsx(
|
|
3923
|
+
oo,
|
|
3924
|
+
{
|
|
3925
|
+
ref: k,
|
|
3926
|
+
style: { height: "100%", padding: 0 },
|
|
3927
|
+
onScroll: (P) => s(P.currentTarget),
|
|
3928
|
+
className: "table-container",
|
|
3929
|
+
children: /* @__PURE__ */ A.jsxs(
|
|
3930
|
+
"table",
|
|
3931
|
+
{
|
|
3932
|
+
style: {
|
|
3933
|
+
display: "grid",
|
|
3934
|
+
borderCollapse: "collapse",
|
|
3935
|
+
userSelect: "none",
|
|
3936
|
+
...L,
|
|
3937
|
+
width: R.getTotalSize()
|
|
3938
|
+
},
|
|
3939
|
+
children: [
|
|
3940
|
+
/* @__PURE__ */ A.jsx(
|
|
3941
|
+
Io,
|
|
3942
|
+
{
|
|
3943
|
+
columnVirtualizer: F,
|
|
3944
|
+
table: R,
|
|
3945
|
+
virtualPaddingLeft: _,
|
|
3946
|
+
virtualPaddingRight: K,
|
|
3947
|
+
isLoading: g,
|
|
3948
|
+
readOnlyColumns: W
|
|
3949
|
+
}
|
|
3950
|
+
),
|
|
3951
|
+
/* @__PURE__ */ A.jsx(
|
|
3952
|
+
To,
|
|
3953
|
+
{
|
|
3954
|
+
columnVirtualizer: F,
|
|
3955
|
+
table: R,
|
|
3956
|
+
tableContainerRef: k,
|
|
3957
|
+
virtualPaddingLeft: _,
|
|
3958
|
+
virtualPaddingRight: K,
|
|
3959
|
+
showHierarchy: E,
|
|
3960
|
+
attribs: n,
|
|
3961
|
+
onOpenNew: i
|
|
3962
|
+
}
|
|
3963
|
+
)
|
|
3964
|
+
]
|
|
3965
|
+
}
|
|
3966
|
+
)
|
|
3967
|
+
}
|
|
3968
|
+
) });
|
|
3969
|
+
}, Io = ({
|
|
3970
|
+
columnVirtualizer: e,
|
|
3971
|
+
table: n,
|
|
3972
|
+
virtualPaddingLeft: t,
|
|
3973
|
+
virtualPaddingRight: o,
|
|
3974
|
+
isLoading: s,
|
|
3975
|
+
readOnlyColumns: i
|
|
3976
|
+
}) => /* @__PURE__ */ A.jsx(to, { children: n.getHeaderGroups().map((r) => /* @__PURE__ */ A.jsx(
|
|
3977
|
+
vo,
|
|
3978
|
+
{
|
|
3979
|
+
columnVirtualizer: e,
|
|
3980
|
+
headerGroup: r,
|
|
3981
|
+
virtualPaddingLeft: t,
|
|
3982
|
+
virtualPaddingRight: o,
|
|
3983
|
+
isLoading: s,
|
|
3984
|
+
readOnlyColumns: i
|
|
3985
|
+
},
|
|
3986
|
+
r.id
|
|
3987
|
+
)) }), vo = ({
|
|
3988
|
+
columnVirtualizer: e,
|
|
3989
|
+
headerGroup: n,
|
|
3990
|
+
virtualPaddingLeft: t,
|
|
3991
|
+
virtualPaddingRight: o,
|
|
3992
|
+
isLoading: s,
|
|
3993
|
+
readOnlyColumns: i
|
|
3994
|
+
}) => {
|
|
3995
|
+
const r = e.getVirtualItems();
|
|
3996
|
+
return /* @__PURE__ */ A.jsxs(Jn, { style: { display: "flex" }, children: [
|
|
3997
|
+
t ? (
|
|
3998
|
+
//fake empty column to the left for virtualization scroll padding
|
|
3999
|
+
/* @__PURE__ */ A.jsx("th", { style: { display: "flex", width: t } })
|
|
4000
|
+
) : null,
|
|
4001
|
+
r.map((l) => {
|
|
4002
|
+
const f = n.headers[l.index];
|
|
4003
|
+
return /* @__PURE__ */ A.jsx(
|
|
4004
|
+
Co,
|
|
4005
|
+
{
|
|
4006
|
+
header: f,
|
|
4007
|
+
isLoading: s,
|
|
4008
|
+
isReadOnly: i == null ? void 0 : i.includes(f.id)
|
|
4009
|
+
},
|
|
4010
|
+
f.id
|
|
4011
|
+
);
|
|
4012
|
+
}),
|
|
4013
|
+
o ? (
|
|
4014
|
+
//fake empty column to the right for virtualization scroll padding
|
|
4015
|
+
/* @__PURE__ */ A.jsx("th", { style: { display: "flex", width: o } })
|
|
4016
|
+
) : null
|
|
4017
|
+
] }, n.id);
|
|
4018
|
+
}, Co = ({ header: e, isLoading: n, isReadOnly: t }) => {
|
|
4019
|
+
const { column: o } = e, s = o.id === H;
|
|
4020
|
+
return /* @__PURE__ */ A.jsx(
|
|
4021
|
+
Gn,
|
|
4022
|
+
{
|
|
4023
|
+
className: q(e.id, "shimmer-dark", {
|
|
4024
|
+
loading: n,
|
|
4025
|
+
large: o.id === "folderType",
|
|
4026
|
+
"last-pinned-left": o.getIsPinned() === "left" && o.getIsLastColumn("left")
|
|
4027
|
+
}),
|
|
4028
|
+
style: {
|
|
4029
|
+
...gt(o),
|
|
4030
|
+
width: `calc(var(--header-${e == null ? void 0 : e.id}-size) * 1px)`
|
|
4031
|
+
},
|
|
4032
|
+
children: e.isPlaceholder ? null : /* @__PURE__ */ A.jsxs(
|
|
4033
|
+
ft,
|
|
4034
|
+
{
|
|
4035
|
+
className: q("bold", {
|
|
4036
|
+
large: o.id === "folderType"
|
|
4037
|
+
}),
|
|
4038
|
+
children: [
|
|
4039
|
+
Je(o.columnDef.header, e.getContext()),
|
|
4040
|
+
t && /* @__PURE__ */ A.jsx(ae, { icon: "lock", "data-tooltip": "You only have permission to read this column." }),
|
|
4041
|
+
/* @__PURE__ */ A.jsxs(Xn, { className: "actions", children: [
|
|
4042
|
+
/* @__PURE__ */ A.jsx(
|
|
4043
|
+
je,
|
|
4044
|
+
{
|
|
4045
|
+
icon: "visibility_off",
|
|
4046
|
+
selected: !o.getIsVisible(),
|
|
4047
|
+
onClick: o.getToggleVisibilityHandler()
|
|
4048
|
+
}
|
|
4049
|
+
),
|
|
4050
|
+
/* @__PURE__ */ A.jsx(
|
|
4051
|
+
je,
|
|
4052
|
+
{
|
|
4053
|
+
icon: "push_pin",
|
|
4054
|
+
selected: e.column.getIsPinned() === "left",
|
|
4055
|
+
onClick: () => {
|
|
4056
|
+
e.column.getIsPinned() === "left" ? e.column.pin(!1) : e.column.pin("left");
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
),
|
|
4060
|
+
/* @__PURE__ */ A.jsx(
|
|
4061
|
+
je,
|
|
4062
|
+
{
|
|
4063
|
+
icon: "sort",
|
|
4064
|
+
style: {
|
|
4065
|
+
transform: o.getIsSorted() === "asc" ? "scaleY(-1)" : void 0
|
|
4066
|
+
},
|
|
4067
|
+
onClick: o.getToggleSortingHandler(),
|
|
4068
|
+
selected: !!o.getIsSorted()
|
|
4069
|
+
}
|
|
4070
|
+
)
|
|
4071
|
+
] }),
|
|
4072
|
+
!s && /* @__PURE__ */ A.jsx(
|
|
4073
|
+
Qn,
|
|
4074
|
+
{
|
|
4075
|
+
onDoubleClick: () => o.resetSize(),
|
|
4076
|
+
onMouseDown: e.getResizeHandler(),
|
|
4077
|
+
onTouchStart: e.getResizeHandler(),
|
|
4078
|
+
className: q("resize-handle", {
|
|
4079
|
+
resizing: o.getIsResizing()
|
|
4080
|
+
})
|
|
4081
|
+
}
|
|
4082
|
+
)
|
|
4083
|
+
]
|
|
4084
|
+
}
|
|
4085
|
+
)
|
|
4086
|
+
},
|
|
4087
|
+
e.id
|
|
4088
|
+
);
|
|
4089
|
+
}, To = ({
|
|
4090
|
+
columnVirtualizer: e,
|
|
4091
|
+
table: n,
|
|
4092
|
+
tableContainerRef: t,
|
|
4093
|
+
showHierarchy: o,
|
|
4094
|
+
virtualPaddingLeft: s,
|
|
4095
|
+
virtualPaddingRight: i,
|
|
4096
|
+
attribs: r,
|
|
4097
|
+
onOpenNew: l
|
|
4098
|
+
}) => {
|
|
4099
|
+
const { handleTableBodyContextMenu: f } = yo({ attribs: r, onOpenNew: l }), { handlePreFetchTasks: x } = mo(), { rows: d } = n.getRowModel(), v = ot({
|
|
4100
|
+
count: d.length,
|
|
4101
|
+
estimateSize: () => o ? 36 : 40,
|
|
4102
|
+
//estimate row height for accurate scrollbar dragging
|
|
4103
|
+
getScrollElement: () => t.current,
|
|
4104
|
+
//measure dynamic row height, except in firefox because it measures table border height incorrectly
|
|
4105
|
+
measureElement: typeof window < "u" && navigator.userAgent.indexOf("Firefox") === -1 ? (g) => g == null ? void 0 : g.getBoundingClientRect().height : void 0,
|
|
4106
|
+
overscan: 5
|
|
4107
|
+
}), u = v.getVirtualItems();
|
|
4108
|
+
return bo(), u.length ? /* @__PURE__ */ A.jsx(
|
|
4109
|
+
"tbody",
|
|
4110
|
+
{
|
|
4111
|
+
style: {
|
|
4112
|
+
height: `${v.getTotalSize()}px`,
|
|
4113
|
+
position: "relative",
|
|
4114
|
+
display: "grid"
|
|
4115
|
+
},
|
|
4116
|
+
onContextMenu: f,
|
|
4117
|
+
onMouseOver: (g) => {
|
|
4118
|
+
x(g);
|
|
4119
|
+
},
|
|
4120
|
+
children: u.map((g) => {
|
|
4121
|
+
const a = d[g.index];
|
|
4122
|
+
return /* @__PURE__ */ A.jsx(
|
|
4123
|
+
So,
|
|
4124
|
+
{
|
|
4125
|
+
columnVirtualizer: e,
|
|
4126
|
+
row: a,
|
|
4127
|
+
rowVirtualizer: v,
|
|
4128
|
+
virtualPaddingLeft: s,
|
|
4129
|
+
virtualPaddingRight: i,
|
|
4130
|
+
virtualRow: g,
|
|
4131
|
+
showHierarchy: o
|
|
4132
|
+
},
|
|
4133
|
+
a.id
|
|
4134
|
+
);
|
|
4135
|
+
})
|
|
4136
|
+
}
|
|
4137
|
+
) : t.current && wt(
|
|
4138
|
+
/* @__PURE__ */ A.jsx(St, { message: "No folders or tasks found" }),
|
|
4139
|
+
t.current
|
|
4140
|
+
);
|
|
4141
|
+
}, So = ({
|
|
4142
|
+
columnVirtualizer: e,
|
|
4143
|
+
row: n,
|
|
4144
|
+
rowVirtualizer: t,
|
|
4145
|
+
virtualPaddingLeft: o,
|
|
4146
|
+
virtualPaddingRight: s,
|
|
4147
|
+
virtualRow: i,
|
|
4148
|
+
showHierarchy: r
|
|
4149
|
+
}) => {
|
|
4150
|
+
const l = n.getVisibleCells(), f = e.getVirtualItems();
|
|
4151
|
+
return /* @__PURE__ */ A.jsxs(
|
|
4152
|
+
Zn,
|
|
4153
|
+
{
|
|
4154
|
+
"data-index": i.index,
|
|
4155
|
+
ref: (x) => t.measureElement(x),
|
|
4156
|
+
style: {
|
|
4157
|
+
transform: `translateY(${i.start}px)`
|
|
4158
|
+
//this should always be a `style` as it changes on scroll
|
|
4159
|
+
},
|
|
4160
|
+
children: [
|
|
4161
|
+
o ? (
|
|
4162
|
+
//fake empty column to the left for virtualization scroll padding
|
|
4163
|
+
/* @__PURE__ */ A.jsx("td", { style: { display: "flex", width: o } })
|
|
4164
|
+
) : null,
|
|
4165
|
+
f.map((x) => {
|
|
4166
|
+
const d = l[x.index], v = B(n.id, d.column.id);
|
|
4167
|
+
return /* @__PURE__ */ A.jsx(
|
|
4168
|
+
Ao,
|
|
4169
|
+
{
|
|
4170
|
+
cell: d,
|
|
4171
|
+
cellId: v,
|
|
4172
|
+
rowId: n.id,
|
|
4173
|
+
showHierarchy: r
|
|
4174
|
+
},
|
|
4175
|
+
d.id
|
|
4176
|
+
);
|
|
4177
|
+
}),
|
|
4178
|
+
s ? (
|
|
4179
|
+
//fake empty column to the right for virtualization scroll padding
|
|
4180
|
+
/* @__PURE__ */ A.jsx("td", { style: { display: "flex", width: s } })
|
|
4181
|
+
) : null
|
|
4182
|
+
]
|
|
4183
|
+
},
|
|
4184
|
+
n.id
|
|
4185
|
+
);
|
|
4186
|
+
}, Eo = ({ cell: e, rowId: n, cellId: t, className: o, showHierarchy: s, ...i }) => {
|
|
4187
|
+
const {
|
|
4188
|
+
isCellSelected: r,
|
|
4189
|
+
isCellFocused: l,
|
|
4190
|
+
startSelection: f,
|
|
4191
|
+
extendSelection: x,
|
|
4192
|
+
endSelection: d,
|
|
4193
|
+
selectCell: v,
|
|
4194
|
+
getCellBorderClasses: u
|
|
4195
|
+
} = he(), { isRowSelected: g } = ut(), { isEditing: a } = ye(), h = u(t), y = e.column.getIsPinned() === "left" && e.column.getIsLastColumn("left"), p = e.column.id === H;
|
|
4196
|
+
return /* @__PURE__ */ pt(
|
|
4197
|
+
eo,
|
|
4198
|
+
{
|
|
4199
|
+
...i,
|
|
4200
|
+
tabIndex: 0,
|
|
4201
|
+
key: e.id,
|
|
4202
|
+
$isLastPinned: y,
|
|
4203
|
+
className: q(
|
|
4204
|
+
e.column.id,
|
|
4205
|
+
e.column.id === "folderType" ? "large" : "",
|
|
4206
|
+
{
|
|
4207
|
+
selected: r(t),
|
|
4208
|
+
focused: l(t),
|
|
4209
|
+
editing: a(t),
|
|
4210
|
+
"last-pinned-left": y,
|
|
4211
|
+
"selected-row": g(n),
|
|
4212
|
+
task: e.row.original.entityType === "task"
|
|
4213
|
+
},
|
|
4214
|
+
o,
|
|
4215
|
+
...h
|
|
4216
|
+
),
|
|
4217
|
+
style: {
|
|
4218
|
+
...gt(e.column),
|
|
4219
|
+
width: `calc(var(--col-${e.column.id}-size) * 1px)`,
|
|
4220
|
+
height: s ? 36 : 40
|
|
4221
|
+
},
|
|
4222
|
+
onMouseDown: (w) => {
|
|
4223
|
+
if (w.button !== 0 || w.target.closest(".expander")) return;
|
|
4224
|
+
const m = w.metaKey || w.ctrlKey || p;
|
|
4225
|
+
w.shiftKey ? v(t, m, !0) : f(t, m);
|
|
4226
|
+
},
|
|
4227
|
+
onMouseOver: (w) => {
|
|
4228
|
+
w.buttons === 1 && x(t, p);
|
|
4229
|
+
},
|
|
4230
|
+
onMouseUp: () => {
|
|
4231
|
+
d(t);
|
|
4232
|
+
},
|
|
4233
|
+
onDoubleClick: (w) => {
|
|
4234
|
+
if (e.column.id === "name") {
|
|
4235
|
+
const m = B(e.row.id, H);
|
|
4236
|
+
if (!r(m)) {
|
|
4237
|
+
const E = w.metaKey || w.ctrlKey;
|
|
4238
|
+
v(m, E, !1);
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
},
|
|
4242
|
+
onContextMenu: (w) => {
|
|
4243
|
+
w.preventDefault(), r(t) || v(t, !1, !1);
|
|
4244
|
+
}
|
|
4245
|
+
},
|
|
4246
|
+
Je(e.column.columnDef.cell, e.getContext())
|
|
4247
|
+
);
|
|
4248
|
+
}, Ao = Me(Eo), Ze = "no_date", Zo = (e) => {
|
|
4249
|
+
if (!e || e.length === 0)
|
|
4250
|
+
return {};
|
|
4251
|
+
const n = e.filter((t) => {
|
|
4252
|
+
var o;
|
|
4253
|
+
return !!((o = t.values) != null && o.length);
|
|
4254
|
+
}).filter((t) => !t.id.includes("text")).filter((t) => t.id !== "hierarchy").flatMap((t) => Ro(t));
|
|
4255
|
+
return console.log(n), {
|
|
4256
|
+
conditions: n,
|
|
4257
|
+
operator: "and"
|
|
4258
|
+
};
|
|
4259
|
+
}, Ro = (e) => {
|
|
4260
|
+
var f, x, d;
|
|
4261
|
+
const n = e.id.split("_")[0];
|
|
4262
|
+
let t;
|
|
4263
|
+
const o = Array.isArray(e.values) && ((f = e.values.map((v) => v.id)) == null ? void 0 : f.includes("hasValue")), s = Array.isArray(e.values) && ((x = e.values.map((v) => v.id)) == null ? void 0 : x.includes("noValue"));
|
|
4264
|
+
e.values && e.values.length > 0 && (e.singleSelect ? t = Qe(e.values[0].id, e.type) : t = e.values.map((v) => Qe(v.id, e.type)));
|
|
4265
|
+
const i = ((d = e.type) == null ? void 0 : d.startsWith("list_of_")) || n.includes("tags") || n.includes("assignees"), r = e.type === "datetime";
|
|
4266
|
+
let l = "eq";
|
|
4267
|
+
if (t === void 0)
|
|
4268
|
+
return l = e.inverted ? "notnull" : "isnull", { key: n, operator: l };
|
|
4269
|
+
if (o)
|
|
4270
|
+
t = i ? [] : void 0, l = i ? e.inverted ? "eq" : "ne" : e.inverted ? "isnull" : "notnull";
|
|
4271
|
+
else if (s)
|
|
4272
|
+
t = i ? [] : void 0, l = i ? e.inverted ? "ne" : "eq" : e.inverted ? "notnull" : "isnull";
|
|
4273
|
+
else if (i)
|
|
4274
|
+
e.inverted ? l = e.operator === "AND" ? "excludesall" : "excludesany" : l = e.operator === "AND" ? "includesall" : "includesany";
|
|
4275
|
+
else if (r) {
|
|
4276
|
+
if (e.values && e.values.length > 0) {
|
|
4277
|
+
const v = e.values.flatMap((u) => {
|
|
4278
|
+
const g = [], a = u.values;
|
|
4279
|
+
return (a == null ? void 0 : a[0]) !== void 0 && (a == null ? void 0 : a[0].id) !== Ze && g.push({
|
|
4280
|
+
key: n,
|
|
4281
|
+
operator: e.inverted ? "lte" : "gte",
|
|
4282
|
+
value: a[0].id
|
|
4283
|
+
}), (a == null ? void 0 : a[1]) !== void 0 && (a == null ? void 0 : a[1].id) !== Ze && g.push({
|
|
4284
|
+
key: n,
|
|
4285
|
+
operator: e.inverted ? "gte" : "lte",
|
|
4286
|
+
value: a[1].id
|
|
4287
|
+
}), g;
|
|
4288
|
+
});
|
|
4289
|
+
if (v.length > 0)
|
|
4290
|
+
return {
|
|
4291
|
+
conditions: v,
|
|
4292
|
+
operator: e.inverted ? "or" : "and"
|
|
4293
|
+
};
|
|
4294
|
+
}
|
|
4295
|
+
l = e.inverted ? "ne" : "eq";
|
|
4296
|
+
} else
|
|
4297
|
+
l = e.inverted ? "notin" : "in";
|
|
4298
|
+
return { key: n, value: t, operator: l };
|
|
4299
|
+
}, Qe = (e, n) => {
|
|
4300
|
+
if (!n) return e;
|
|
4301
|
+
switch (n) {
|
|
4302
|
+
case "integer":
|
|
4303
|
+
return parseInt(e, 10);
|
|
4304
|
+
case "float":
|
|
4305
|
+
return parseFloat(e);
|
|
4306
|
+
case "boolean":
|
|
4307
|
+
return e.toLowerCase() === "true";
|
|
4308
|
+
default:
|
|
4309
|
+
return e;
|
|
4310
|
+
}
|
|
4311
|
+
};
|
|
4312
|
+
export {
|
|
4313
|
+
qo as CellEditingProvider,
|
|
4314
|
+
$n as ClipboardProvider,
|
|
4315
|
+
Bo as ColumnSettingsProvider,
|
|
4316
|
+
Uo as ProjectTableProvider,
|
|
4317
|
+
Lo as ProjectTableQueriesProvider,
|
|
4318
|
+
Yo as ProjectTreeTable,
|
|
4319
|
+
H as ROW_SELECTION_COLUMN_ID,
|
|
4320
|
+
Ho as SelectedRowsProvider,
|
|
4321
|
+
Ko as SelectionProvider,
|
|
4322
|
+
kn as builtInFieldMappings,
|
|
4323
|
+
Zo as clientFilterToQueryFilter,
|
|
4324
|
+
X as clipboardError,
|
|
4325
|
+
Wo as determineLoadingTaskFolders,
|
|
4326
|
+
Tn as generateDummyAttributes,
|
|
4327
|
+
$e as generateLoadingRows,
|
|
4328
|
+
rt as getEntityPath,
|
|
4329
|
+
Dn as parseClipboardText,
|
|
4330
|
+
zn as processFieldValue,
|
|
4331
|
+
ye as useCellEditing,
|
|
4332
|
+
Mn as useClipboard,
|
|
4333
|
+
_n as useColumnSettings,
|
|
4334
|
+
ue as useProjectTableContext,
|
|
4335
|
+
_e as useProjectTableQueriesContext,
|
|
4336
|
+
ut as useSelectedRowsContext,
|
|
4337
|
+
he as useSelectionContext,
|
|
4338
|
+
jn as validateClipboardData
|
|
4339
|
+
};
|
|
4340
|
+
//# sourceMappingURL=index.es8.js.map
|