@ngbplatform/ui 1.3.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/LICENSE +201 -0
- package/README.md +44 -0
- package/package.json +61 -0
- package/public/favicon.svg +6 -0
- package/public/silent-check-sso.html +8 -0
- package/src/assets/ngb_logo.svg +17 -0
- package/src/assets/ngb_logo_color.svg +17 -0
- package/src/index.ts +1023 -0
- package/src/ngb/README.md +27 -0
- package/src/ngb/accounting/NgbAccountingPeriodClosingPage.vue +1157 -0
- package/src/ngb/accounting/NgbChartOfAccountEditor.vue +590 -0
- package/src/ngb/accounting/NgbChartOfAccountsPage.vue +420 -0
- package/src/ngb/accounting/NgbGeneralJournalEntryEditPage.vue +796 -0
- package/src/ngb/accounting/NgbGeneralJournalEntryLinesEditor.vue +454 -0
- package/src/ngb/accounting/NgbGeneralJournalEntryListPage.vue +186 -0
- package/src/ngb/accounting/api.ts +79 -0
- package/src/ngb/accounting/generalJournalEntry.ts +127 -0
- package/src/ngb/accounting/generalJournalEntryApi.ts +112 -0
- package/src/ngb/accounting/generalJournalEntryTypes.ts +155 -0
- package/src/ngb/accounting/navigation.ts +83 -0
- package/src/ngb/accounting/periodClosing.ts +75 -0
- package/src/ngb/accounting/periodClosingApi.ts +60 -0
- package/src/ngb/accounting/periodClosingTypes.ts +73 -0
- package/src/ngb/accounting/types.ts +57 -0
- package/src/ngb/api/audit.ts +23 -0
- package/src/ngb/api/catalogs.ts +50 -0
- package/src/ngb/api/contracts.ts +285 -0
- package/src/ngb/api/documents.ts +170 -0
- package/src/ngb/api/http.ts +446 -0
- package/src/ngb/api/lookups.ts +14 -0
- package/src/ngb/api/types.ts +6 -0
- package/src/ngb/auth/index.ts +13 -0
- package/src/ngb/auth/keycloak.ts +374 -0
- package/src/ngb/auth/router.ts +35 -0
- package/src/ngb/auth/types.ts +12 -0
- package/src/ngb/auth/useAuthStore.ts +209 -0
- package/src/ngb/command-palette/NgbCommandPaletteDialog.vue +342 -0
- package/src/ngb/command-palette/NgbCommandPaletteEmptyState.vue +55 -0
- package/src/ngb/command-palette/NgbCommandPaletteFooterHints.vue +29 -0
- package/src/ngb/command-palette/api.ts +10 -0
- package/src/ngb/command-palette/config.ts +16 -0
- package/src/ngb/command-palette/presentation.ts +85 -0
- package/src/ngb/command-palette/search.ts +130 -0
- package/src/ngb/command-palette/staticItems.ts +243 -0
- package/src/ngb/command-palette/storage.ts +45 -0
- package/src/ngb/command-palette/store.ts +716 -0
- package/src/ngb/command-palette/types.ts +120 -0
- package/src/ngb/command-palette/useCommandPaletteHotkeys.ts +27 -0
- package/src/ngb/command-palette/useCommandPalettePageContext.ts +18 -0
- package/src/ngb/components/NgbConfirmDialog.vue +63 -0
- package/src/ngb/components/NgbDialog.vue +44 -0
- package/src/ngb/components/NgbDrawer.vue +156 -0
- package/src/ngb/components/NgbHeaderActionCluster.vue +140 -0
- package/src/ngb/components/NgbModalShell.vue +99 -0
- package/src/ngb/components/NgbToolbar.vue +14 -0
- package/src/ngb/components/forms/NgbFormLayout.vue +13 -0
- package/src/ngb/components/forms/NgbFormRow.vue +21 -0
- package/src/ngb/components/forms/NgbFormSection.vue +16 -0
- package/src/ngb/components/forms/NgbValidationSummary.vue +18 -0
- package/src/ngb/components/navigation/NgbNavigationTree.vue +68 -0
- package/src/ngb/components/navigation/NgbTreeNode.vue +94 -0
- package/src/ngb/components/register/NgbColumnChooser.vue +101 -0
- package/src/ngb/components/register/NgbRegisterGrid.vue +473 -0
- package/src/ngb/components/register/registerTypes.ts +51 -0
- package/src/ngb/components/register/useRegisterColumnResize.ts +99 -0
- package/src/ngb/components/register/useRegisterColumnState.ts +220 -0
- package/src/ngb/components/register/useRegisterRows.ts +209 -0
- package/src/ngb/components/register/useRegisterViewport.ts +56 -0
- package/src/ngb/editor/NgbDocumentEffectsPage.vue +512 -0
- package/src/ngb/editor/NgbDocumentFlowPage.vue +409 -0
- package/src/ngb/editor/NgbDocumentPrintPage.vue +712 -0
- package/src/ngb/editor/NgbEditorDiscardDialog.vue +40 -0
- package/src/ngb/editor/NgbEntityAuditSidebar.vue +288 -0
- package/src/ngb/editor/NgbEntityEditor.vue +250 -0
- package/src/ngb/editor/NgbEntityEditorDrawerActions.vue +88 -0
- package/src/ngb/editor/NgbEntityEditorHeader.vue +114 -0
- package/src/ngb/editor/catalogNavigation.ts +13 -0
- package/src/ngb/editor/config.ts +252 -0
- package/src/ngb/editor/documentCopyDraft.ts +245 -0
- package/src/ngb/editor/documentEffects.ts +43 -0
- package/src/ngb/editor/documentEffectsDateFormatting.ts +18 -0
- package/src/ngb/editor/documentNavigation.ts +115 -0
- package/src/ngb/editor/documentStatus.ts +45 -0
- package/src/ngb/editor/entityEditorErrors.ts +162 -0
- package/src/ngb/editor/entityEditorPersistence.ts +241 -0
- package/src/ngb/editor/extensions.ts +40 -0
- package/src/ngb/editor/types.ts +295 -0
- package/src/ngb/editor/useConfiguredEntityEditorDocumentActions.ts +183 -0
- package/src/ngb/editor/useDocumentEditorDrawerState.ts +152 -0
- package/src/ngb/editor/useEditorDrawerState.ts +88 -0
- package/src/ngb/editor/useEntityEditorBusinessContext.ts +97 -0
- package/src/ngb/editor/useEntityEditorCapabilities.ts +190 -0
- package/src/ngb/editor/useEntityEditorCommandPalette.ts +154 -0
- package/src/ngb/editor/useEntityEditorCommitHandlers.ts +102 -0
- package/src/ngb/editor/useEntityEditorHeaderActions.ts +253 -0
- package/src/ngb/editor/useEntityEditorLeaveGuard.ts +66 -0
- package/src/ngb/editor/useEntityEditorNavigationActions.ts +235 -0
- package/src/ngb/editor/useEntityEditorOutputs.ts +59 -0
- package/src/ngb/editor/useEntityEditorPageActions.ts +57 -0
- package/src/ngb/editor/useRouteQueryEditorDrawer.ts +173 -0
- package/src/ngb/env/runtimeConfig.ts +25 -0
- package/src/ngb/lookup/config.ts +42 -0
- package/src/ngb/lookup/defaultConfig.ts +136 -0
- package/src/ngb/lookup/navigation.ts +76 -0
- package/src/ngb/lookup/prefetch.ts +40 -0
- package/src/ngb/lookup/store.ts +261 -0
- package/src/ngb/metadata/NgbDocumentListFiltersDrawer.vue +78 -0
- package/src/ngb/metadata/NgbDocumentPeriodFilter.vue +53 -0
- package/src/ngb/metadata/NgbEntityForm.vue +84 -0
- package/src/ngb/metadata/NgbEntityFormFieldsBlock.vue +110 -0
- package/src/ngb/metadata/NgbEntityListPageHeader.vue +80 -0
- package/src/ngb/metadata/NgbFilterFieldControl.vue +104 -0
- package/src/ngb/metadata/NgbMetadataCatalogEditPage.vue +42 -0
- package/src/ngb/metadata/NgbMetadataCatalogListPage.vue +269 -0
- package/src/ngb/metadata/NgbMetadataDocumentEditPage.vue +68 -0
- package/src/ngb/metadata/NgbMetadataDocumentListPage.vue +353 -0
- package/src/ngb/metadata/NgbMetadataFieldRenderer.vue +124 -0
- package/src/ngb/metadata/NgbMetadataLookupControl.vue +92 -0
- package/src/ngb/metadata/NgbRecycleBinFilter.vue +53 -0
- package/src/ngb/metadata/NgbRegisterPageLayout.vue +143 -0
- package/src/ngb/metadata/config.ts +28 -0
- package/src/ngb/metadata/dataTypes.ts +27 -0
- package/src/ngb/metadata/entityForm.ts +114 -0
- package/src/ngb/metadata/entityModel.ts +34 -0
- package/src/ngb/metadata/entityValueFormatting.ts +83 -0
- package/src/ngb/metadata/fieldRendererState.ts +84 -0
- package/src/ngb/metadata/filtering.ts +153 -0
- package/src/ngb/metadata/lookup.ts +25 -0
- package/src/ngb/metadata/monthPagedListQuery.ts +108 -0
- package/src/ngb/metadata/normalization.ts +100 -0
- package/src/ngb/metadata/referenceHydration.ts +99 -0
- package/src/ngb/metadata/register.ts +135 -0
- package/src/ngb/metadata/routePages.ts +86 -0
- package/src/ngb/metadata/store.ts +35 -0
- package/src/ngb/metadata/types.ts +276 -0
- package/src/ngb/metadata/useMetadataListFilters.ts +306 -0
- package/src/ngb/metadata/useMetadataRegisterPageData.ts +246 -0
- package/src/ngb/metadata/useValidationFocus.ts +49 -0
- package/src/ngb/primitives/NgbBadge.vue +31 -0
- package/src/ngb/primitives/NgbButton.vue +53 -0
- package/src/ngb/primitives/NgbCheckbox.vue +33 -0
- package/src/ngb/primitives/NgbDatePicker.vue +141 -0
- package/src/ngb/primitives/NgbIcon.vue +545 -0
- package/src/ngb/primitives/NgbInput.vue +57 -0
- package/src/ngb/primitives/NgbLookup.vue +264 -0
- package/src/ngb/primitives/NgbMonthPicker.vue +132 -0
- package/src/ngb/primitives/NgbMultiSelect.vue +179 -0
- package/src/ngb/primitives/NgbPeriodPicker.vue +125 -0
- package/src/ngb/primitives/NgbPickerNavButton.vue +31 -0
- package/src/ngb/primitives/NgbPickerPopover.vue +79 -0
- package/src/ngb/primitives/NgbRadioGroup.vue +53 -0
- package/src/ngb/primitives/NgbSelect.vue +108 -0
- package/src/ngb/primitives/NgbStatusIcon.vue +63 -0
- package/src/ngb/primitives/NgbSwitch.vue +42 -0
- package/src/ngb/primitives/NgbTabs.vue +116 -0
- package/src/ngb/primitives/NgbToastHost.vue +49 -0
- package/src/ngb/primitives/NgbTooltip.vue +27 -0
- package/src/ngb/primitives/iconNames.ts +83 -0
- package/src/ngb/primitives/toast.ts +66 -0
- package/src/ngb/primitives/useAsyncComboboxQuery.ts +85 -0
- package/src/ngb/primitives/useFloatingDropdownPosition.ts +129 -0
- package/src/ngb/reporting/NgbReportComposerCollectionSection.vue +106 -0
- package/src/ngb/reporting/NgbReportComposerPanel.vue +1187 -0
- package/src/ngb/reporting/NgbReportDateRangeFilter.vue +54 -0
- package/src/ngb/reporting/NgbReportPage.vue +1124 -0
- package/src/ngb/reporting/NgbReportSheet.vue +467 -0
- package/src/ngb/reporting/api.ts +35 -0
- package/src/ngb/reporting/composer.ts +904 -0
- package/src/ngb/reporting/config.ts +120 -0
- package/src/ngb/reporting/defaultConfig.ts +15 -0
- package/src/ngb/reporting/lookupFilters.ts +43 -0
- package/src/ngb/reporting/navigation.ts +181 -0
- package/src/ngb/reporting/pageHelpers.ts +73 -0
- package/src/ngb/reporting/pageSession.ts +92 -0
- package/src/ngb/reporting/paging.ts +66 -0
- package/src/ngb/reporting/types.ts +333 -0
- package/src/ngb/router/backNavigation.ts +122 -0
- package/src/ngb/router/queryParams.ts +129 -0
- package/src/ngb/router/queryState.ts +121 -0
- package/src/ngb/router/routeAliases.ts +66 -0
- package/src/ngb/router/routeParams.ts +15 -0
- package/src/ngb/router/shareLink.ts +39 -0
- package/src/ngb/security/NgbAccessAuditPanel.vue +32 -0
- package/src/ngb/security/NgbAccessDeniedState.vue +27 -0
- package/src/ngb/security/NgbEffectiveAccessPanel.vue +60 -0
- package/src/ngb/security/NgbPermissionMatrix.vue +160 -0
- package/src/ngb/security/NgbRoleEditorPage.vue +319 -0
- package/src/ngb/security/NgbRolesPage.vue +125 -0
- package/src/ngb/security/NgbUserEditorPage.vue +615 -0
- package/src/ngb/security/NgbUsersPage.vue +125 -0
- package/src/ngb/security/api.ts +91 -0
- package/src/ngb/security/audit.ts +21 -0
- package/src/ngb/security/permissions.ts +65 -0
- package/src/ngb/security/types.ts +157 -0
- package/src/ngb/security/useAccessStore.ts +69 -0
- package/src/ngb/site/NgbDashboardAsOfToolbar.vue +100 -0
- package/src/ngb/site/NgbDashboardStatusBanner.vue +91 -0
- package/src/ngb/site/NgbLogo.vue +44 -0
- package/src/ngb/site/NgbPageHeader.vue +49 -0
- package/src/ngb/site/NgbSiteShell.vue +286 -0
- package/src/ngb/site/NgbSiteSidebar.vue +270 -0
- package/src/ngb/site/NgbTopBar.vue +425 -0
- package/src/ngb/site/NgbTrendChart.vue +224 -0
- package/src/ngb/site/dashboardData.ts +324 -0
- package/src/ngb/site/mainMenuStore.ts +49 -0
- package/src/ngb/site/types.ts +31 -0
- package/src/ngb/site/useDashboardPageState.ts +98 -0
- package/src/ngb/site/useTheme.ts +95 -0
- package/src/ngb/utils/clone.ts +43 -0
- package/src/ngb/utils/dateValues.ts +107 -0
- package/src/ngb/utils/errorMessage.ts +14 -0
- package/src/ngb/utils/guid.ts +21 -0
- package/src/ngb/utils/stableValue.ts +21 -0
- package/src/ngb/utils/storage.ts +135 -0
- package/src/styles/tailwind.css +165 -0
- package/src/vite/publicAssets.ts +104 -0
- package/vite-public-assets.js +68 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { computed, type ComputedRef } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
DocumentHeaderActionGroup,
|
|
5
|
+
DocumentHeaderActionItem,
|
|
6
|
+
DocumentHeaderActionKey,
|
|
7
|
+
EditorKind,
|
|
8
|
+
EditorMode,
|
|
9
|
+
} from './types';
|
|
10
|
+
|
|
11
|
+
type ActionHandler = () => void | Promise<void>;
|
|
12
|
+
|
|
13
|
+
type UseEntityEditorHeaderActionsArgs = {
|
|
14
|
+
kind: ComputedRef<EditorKind>;
|
|
15
|
+
mode: ComputedRef<EditorMode>;
|
|
16
|
+
compactTo: ComputedRef<string | null>;
|
|
17
|
+
expandTo: ComputedRef<string | null>;
|
|
18
|
+
currentId: ComputedRef<string | null>;
|
|
19
|
+
loading: ComputedRef<boolean>;
|
|
20
|
+
saving: ComputedRef<boolean>;
|
|
21
|
+
isNew: ComputedRef<boolean>;
|
|
22
|
+
isMarkedForDeletion: ComputedRef<boolean>;
|
|
23
|
+
canSave: ComputedRef<boolean>;
|
|
24
|
+
canPost: ComputedRef<boolean>;
|
|
25
|
+
canUnpost: ComputedRef<boolean>;
|
|
26
|
+
canMarkForDeletion: ComputedRef<boolean>;
|
|
27
|
+
canUnmarkForDeletion: ComputedRef<boolean>;
|
|
28
|
+
canOpenEffectsPage: ComputedRef<boolean>;
|
|
29
|
+
canOpenDocumentFlowPage: ComputedRef<boolean>;
|
|
30
|
+
canPrintDocument: ComputedRef<boolean>;
|
|
31
|
+
canOpenAudit: ComputedRef<boolean>;
|
|
32
|
+
canShareLink: ComputedRef<boolean>;
|
|
33
|
+
onOpenCompactPage: ActionHandler;
|
|
34
|
+
onOpenFullPage: ActionHandler;
|
|
35
|
+
onCopyDocument: ActionHandler;
|
|
36
|
+
onPrintDocument: ActionHandler;
|
|
37
|
+
onToggleMarkForDeletion: ActionHandler;
|
|
38
|
+
onSave: ActionHandler;
|
|
39
|
+
onTogglePost: ActionHandler;
|
|
40
|
+
onOpenEffectsPage: ActionHandler;
|
|
41
|
+
onOpenDocumentFlowPage: ActionHandler;
|
|
42
|
+
onOpenAuditLog: ActionHandler;
|
|
43
|
+
onCopyShareLink: ActionHandler;
|
|
44
|
+
extraPrimaryActions?: ComputedRef<DocumentHeaderActionItem[]>;
|
|
45
|
+
extraMoreActionGroups?: ComputedRef<DocumentHeaderActionGroup[]>;
|
|
46
|
+
extraActionHandlers?: Record<string, ActionHandler>;
|
|
47
|
+
onUnhandledAction?: (action: string) => void | Promise<void>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
function runAction(handler: ActionHandler | undefined): void {
|
|
51
|
+
if (!handler) return;
|
|
52
|
+
void Promise.resolve(handler());
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function mergeActionGroups(
|
|
56
|
+
baseGroups: DocumentHeaderActionGroup[],
|
|
57
|
+
extraGroups: DocumentHeaderActionGroup[],
|
|
58
|
+
): DocumentHeaderActionGroup[] {
|
|
59
|
+
if (extraGroups.length === 0) return baseGroups;
|
|
60
|
+
|
|
61
|
+
const order = baseGroups.map((group) => group.key);
|
|
62
|
+
const merged = new Map<string, DocumentHeaderActionGroup>(
|
|
63
|
+
baseGroups.map((group) => [group.key, { ...group, items: [...group.items] }]),
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
for (const group of extraGroups) {
|
|
67
|
+
const existing = merged.get(group.key);
|
|
68
|
+
if (existing) {
|
|
69
|
+
existing.items.push(...group.items);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
order.push(group.key);
|
|
74
|
+
merged.set(group.key, { ...group, items: [...group.items] });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return order.map((key) => merged.get(key)!);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function useEntityEditorHeaderActions(args: UseEntityEditorHeaderActionsArgs) {
|
|
81
|
+
const documentPrimaryActions = computed<DocumentHeaderActionItem[]>(() => {
|
|
82
|
+
if (args.kind.value !== 'document') return [];
|
|
83
|
+
|
|
84
|
+
const actions: DocumentHeaderActionItem[] = [];
|
|
85
|
+
|
|
86
|
+
if (args.mode.value === 'page' && args.compactTo.value) {
|
|
87
|
+
actions.push({
|
|
88
|
+
key: 'openCompactPage',
|
|
89
|
+
title: 'Open compact page',
|
|
90
|
+
icon: 'panel-right',
|
|
91
|
+
disabled: args.loading.value || args.saving.value,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (args.mode.value === 'drawer' && args.expandTo.value) {
|
|
96
|
+
actions.push({
|
|
97
|
+
key: 'openFullPage',
|
|
98
|
+
title: 'Open full page',
|
|
99
|
+
icon: 'open-in-new',
|
|
100
|
+
disabled: args.loading.value || args.saving.value,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (args.canMarkForDeletion.value || args.canUnmarkForDeletion.value) {
|
|
105
|
+
actions.push({
|
|
106
|
+
key: 'toggleMarkForDeletion',
|
|
107
|
+
title: args.canUnmarkForDeletion.value ? 'Unmark for deletion' : 'Mark for deletion',
|
|
108
|
+
icon: args.canUnmarkForDeletion.value ? 'trash-restore' : 'trash',
|
|
109
|
+
disabled: args.loading.value || args.saving.value,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
actions.push({
|
|
114
|
+
key: 'save',
|
|
115
|
+
title: !args.isNew.value && args.isMarkedForDeletion.value ? 'Restore to edit' : 'Save',
|
|
116
|
+
icon: 'save',
|
|
117
|
+
disabled: args.loading.value || args.saving.value || !args.canSave.value,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
if (args.canPost.value || args.canUnpost.value) {
|
|
121
|
+
actions.push({
|
|
122
|
+
key: 'togglePost',
|
|
123
|
+
title: args.canUnpost.value ? 'Unpost' : 'Post',
|
|
124
|
+
icon: args.canUnpost.value ? 'undo' : 'check',
|
|
125
|
+
disabled: args.loading.value || args.saving.value,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return [...actions, ...(args.extraPrimaryActions?.value ?? [])];
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const documentMoreActionGroups = computed<DocumentHeaderActionGroup[]>(() => {
|
|
133
|
+
if (args.kind.value !== 'document') return [];
|
|
134
|
+
|
|
135
|
+
const groups: DocumentHeaderActionGroup[] = [];
|
|
136
|
+
const createActions: DocumentHeaderActionItem[] = [];
|
|
137
|
+
const relatedViews: DocumentHeaderActionItem[] = [];
|
|
138
|
+
const outputActions: DocumentHeaderActionItem[] = [];
|
|
139
|
+
const historyAndShare: DocumentHeaderActionItem[] = [];
|
|
140
|
+
|
|
141
|
+
if (args.currentId.value) {
|
|
142
|
+
createActions.push({
|
|
143
|
+
key: 'copyDocument',
|
|
144
|
+
title: 'Copy',
|
|
145
|
+
icon: 'copy',
|
|
146
|
+
disabled: args.loading.value || args.saving.value,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (createActions.length > 0) groups.push({ key: 'create', label: 'Create', items: createActions });
|
|
151
|
+
|
|
152
|
+
if (args.canOpenEffectsPage.value) {
|
|
153
|
+
relatedViews.push({
|
|
154
|
+
key: 'openEffectsPage',
|
|
155
|
+
title: 'Accounting entries / effects',
|
|
156
|
+
icon: 'effects-flow',
|
|
157
|
+
disabled: !args.canOpenEffectsPage.value,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (args.canOpenDocumentFlowPage.value) {
|
|
162
|
+
relatedViews.push({
|
|
163
|
+
key: 'openDocumentFlowPage',
|
|
164
|
+
title: 'Document flow',
|
|
165
|
+
icon: 'document-flow',
|
|
166
|
+
disabled: !args.canOpenDocumentFlowPage.value,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (relatedViews.length > 0) groups.push({ key: 'related-views', label: 'Related views', items: relatedViews });
|
|
171
|
+
|
|
172
|
+
if (args.canPrintDocument.value) {
|
|
173
|
+
outputActions.push({
|
|
174
|
+
key: 'printDocument',
|
|
175
|
+
title: 'Print',
|
|
176
|
+
icon: 'printer',
|
|
177
|
+
disabled: !args.canPrintDocument.value,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (outputActions.length > 0) groups.push({ key: 'output', label: 'Output', items: outputActions });
|
|
182
|
+
|
|
183
|
+
if (args.canOpenAudit.value) {
|
|
184
|
+
historyAndShare.push({
|
|
185
|
+
key: 'openAuditLog',
|
|
186
|
+
title: 'Audit log',
|
|
187
|
+
icon: 'history',
|
|
188
|
+
disabled: args.loading.value || args.saving.value,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (args.canShareLink.value) {
|
|
193
|
+
historyAndShare.push({
|
|
194
|
+
key: 'copyShareLink',
|
|
195
|
+
title: 'Share link',
|
|
196
|
+
icon: 'share',
|
|
197
|
+
disabled: args.loading.value || args.saving.value,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (historyAndShare.length > 0) {
|
|
202
|
+
groups.push({ key: 'history-and-share', label: 'History & share', items: historyAndShare });
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return mergeActionGroups(groups, args.extraMoreActionGroups?.value ?? []);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
function handleDocumentHeaderAction(action: string) {
|
|
209
|
+
switch (action as DocumentHeaderActionKey) {
|
|
210
|
+
case 'openCompactPage':
|
|
211
|
+
runAction(args.onOpenCompactPage);
|
|
212
|
+
return;
|
|
213
|
+
case 'openFullPage':
|
|
214
|
+
runAction(args.onOpenFullPage);
|
|
215
|
+
return;
|
|
216
|
+
case 'copyDocument':
|
|
217
|
+
runAction(args.onCopyDocument);
|
|
218
|
+
return;
|
|
219
|
+
case 'printDocument':
|
|
220
|
+
runAction(args.onPrintDocument);
|
|
221
|
+
return;
|
|
222
|
+
case 'toggleMarkForDeletion':
|
|
223
|
+
runAction(args.onToggleMarkForDeletion);
|
|
224
|
+
return;
|
|
225
|
+
case 'save':
|
|
226
|
+
runAction(args.onSave);
|
|
227
|
+
return;
|
|
228
|
+
case 'togglePost':
|
|
229
|
+
runAction(args.onTogglePost);
|
|
230
|
+
return;
|
|
231
|
+
case 'openEffectsPage':
|
|
232
|
+
runAction(args.onOpenEffectsPage);
|
|
233
|
+
return;
|
|
234
|
+
case 'openDocumentFlowPage':
|
|
235
|
+
runAction(args.onOpenDocumentFlowPage);
|
|
236
|
+
return;
|
|
237
|
+
case 'openAuditLog':
|
|
238
|
+
runAction(args.onOpenAuditLog);
|
|
239
|
+
return;
|
|
240
|
+
case 'copyShareLink':
|
|
241
|
+
runAction(args.onCopyShareLink);
|
|
242
|
+
return;
|
|
243
|
+
default:
|
|
244
|
+
runAction(args.extraActionHandlers?.[action] ?? (args.onUnhandledAction ? () => args.onUnhandledAction?.(action) : undefined));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
documentPrimaryActions,
|
|
250
|
+
documentMoreActionGroups,
|
|
251
|
+
handleDocumentHeaderAction,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ref, type ComputedRef, type Ref } from 'vue';
|
|
2
|
+
import type { Router } from 'vue-router';
|
|
3
|
+
|
|
4
|
+
const DRAWER_CLOSE_SENTINEL = '__ngb_drawer_close__';
|
|
5
|
+
|
|
6
|
+
export type UseEntityEditorLeaveGuardArgs = {
|
|
7
|
+
isDirty: ComputedRef<boolean>;
|
|
8
|
+
loading: Ref<boolean>;
|
|
9
|
+
saving: Ref<boolean>;
|
|
10
|
+
router: Router;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function useEntityEditorLeaveGuard(args: UseEntityEditorLeaveGuardArgs) {
|
|
15
|
+
const leaveOpen = ref(false);
|
|
16
|
+
const leaveTo = ref<string | null>(null);
|
|
17
|
+
|
|
18
|
+
function requestNavigate(to: string | null | undefined) {
|
|
19
|
+
if (!to) return;
|
|
20
|
+
|
|
21
|
+
if (args.isDirty.value && !args.loading.value && !args.saving.value) {
|
|
22
|
+
leaveTo.value = to;
|
|
23
|
+
leaveOpen.value = true;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
void args.router.push(to);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function requestClose() {
|
|
31
|
+
if (args.isDirty.value && !args.loading.value && !args.saving.value) {
|
|
32
|
+
leaveTo.value = DRAWER_CLOSE_SENTINEL;
|
|
33
|
+
leaveOpen.value = true;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
args.onClose();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function confirmLeave() {
|
|
41
|
+
const target = leaveTo.value;
|
|
42
|
+
leaveTo.value = null;
|
|
43
|
+
leaveOpen.value = false;
|
|
44
|
+
|
|
45
|
+
if (!target) return;
|
|
46
|
+
if (target === DRAWER_CLOSE_SENTINEL) {
|
|
47
|
+
args.onClose();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
void args.router.push(target);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function cancelLeave() {
|
|
55
|
+
leaveTo.value = null;
|
|
56
|
+
leaveOpen.value = false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
leaveOpen,
|
|
61
|
+
requestNavigate,
|
|
62
|
+
requestClose,
|
|
63
|
+
confirmLeave,
|
|
64
|
+
cancelLeave,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { computed, ref, type ComputedRef, type Ref } from 'vue';
|
|
2
|
+
import type { RouteLocationNormalizedLoaded, Router } from 'vue-router';
|
|
3
|
+
|
|
4
|
+
import { copyAppLink } from '../router/shareLink';
|
|
5
|
+
import { buildPathWithQuery, currentRouteBackTarget, withBackTarget } from '../router/backNavigation';
|
|
6
|
+
import { clonePlainData } from '../utils/clone';
|
|
7
|
+
import type { ToastApi } from '../primitives/toast';
|
|
8
|
+
import type {
|
|
9
|
+
CatalogTypeMetadata,
|
|
10
|
+
DocumentTypeMetadata,
|
|
11
|
+
EntityFormModel,
|
|
12
|
+
RecordFields,
|
|
13
|
+
RecordPayload,
|
|
14
|
+
} from '../metadata/types';
|
|
15
|
+
import {
|
|
16
|
+
buildCatalogCompactPageUrl,
|
|
17
|
+
} from './catalogNavigation';
|
|
18
|
+
import {
|
|
19
|
+
buildDocumentCompactPageUrl,
|
|
20
|
+
buildDocumentEffectsPageUrl,
|
|
21
|
+
buildDocumentFlowPageUrl,
|
|
22
|
+
buildDocumentFullPageUrl,
|
|
23
|
+
buildDocumentPrintPageUrl,
|
|
24
|
+
buildEntityFallbackCloseTarget,
|
|
25
|
+
listFormFields,
|
|
26
|
+
resolveCompactDocumentSourceTarget,
|
|
27
|
+
shouldOpenDocumentInFullPageByDefault,
|
|
28
|
+
} from './documentNavigation';
|
|
29
|
+
import { saveDocumentCopyDraft } from './documentCopyDraft';
|
|
30
|
+
import type { EditorKind, EditorMode } from './types';
|
|
31
|
+
|
|
32
|
+
type UseEntityEditorNavigationActionsArgs = {
|
|
33
|
+
kind: ComputedRef<EditorKind>;
|
|
34
|
+
typeCode: ComputedRef<string>;
|
|
35
|
+
mode: ComputedRef<EditorMode>;
|
|
36
|
+
compactTo: ComputedRef<string | null>;
|
|
37
|
+
expandTo: ComputedRef<string | null>;
|
|
38
|
+
closeTo: ComputedRef<string | null>;
|
|
39
|
+
currentId: Ref<string | null>;
|
|
40
|
+
metadata: ComputedRef<CatalogTypeMetadata | DocumentTypeMetadata | null>;
|
|
41
|
+
docMeta: Ref<DocumentTypeMetadata | null>;
|
|
42
|
+
model: Ref<EntityFormModel>;
|
|
43
|
+
loading: Ref<boolean>;
|
|
44
|
+
saving: Ref<boolean>;
|
|
45
|
+
canOpenAudit: ComputedRef<boolean>;
|
|
46
|
+
canPrintDocument: ComputedRef<boolean>;
|
|
47
|
+
canOpenDocumentFlowPage: ComputedRef<boolean>;
|
|
48
|
+
canOpenEffectsPage: ComputedRef<boolean>;
|
|
49
|
+
requestNavigate: (to: string | null | undefined) => void;
|
|
50
|
+
requestClose: () => void;
|
|
51
|
+
router: Router;
|
|
52
|
+
route: RouteLocationNormalizedLoaded;
|
|
53
|
+
toasts: Pick<ToastApi, 'push'>;
|
|
54
|
+
buildCopyParts?: () => RecordPayload['parts'] | null;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export function useEntityEditorNavigationActions(args: UseEntityEditorNavigationActionsArgs) {
|
|
58
|
+
const auditOpen = ref(false);
|
|
59
|
+
const currentRouteTarget = computed(() => currentRouteBackTarget(args.route));
|
|
60
|
+
|
|
61
|
+
const fallbackCloseTarget = computed(() =>
|
|
62
|
+
buildEntityFallbackCloseTarget(args.kind.value, args.typeCode.value),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const shareLinkTarget = computed(() => {
|
|
66
|
+
if (!args.currentId.value) return null;
|
|
67
|
+
|
|
68
|
+
if (args.kind.value === 'catalog') {
|
|
69
|
+
return buildCatalogCompactPageUrl(args.typeCode.value, args.currentId.value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (shouldOpenDocumentInFullPageByDefault(args.docMeta.value)) {
|
|
73
|
+
return buildDocumentFullPageUrl(args.typeCode.value, args.currentId.value);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return buildDocumentCompactPageUrl(args.typeCode.value, args.currentId.value);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const drawerBackTarget = computed(() => {
|
|
80
|
+
if (args.mode.value !== 'drawer') return currentRouteTarget.value;
|
|
81
|
+
|
|
82
|
+
return buildPathWithQuery(currentRouteTarget.value, {
|
|
83
|
+
panel: args.currentId.value ? 'edit' : 'new',
|
|
84
|
+
id: args.currentId.value,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const relatedViewBackTarget = computed(() => {
|
|
89
|
+
if (args.kind.value !== 'document') {
|
|
90
|
+
return args.mode.value === 'drawer' ? drawerBackTarget.value : currentRouteTarget.value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (args.mode.value !== 'page') {
|
|
94
|
+
return drawerBackTarget.value;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return resolveCompactDocumentSourceTarget(args.route, args.compactTo.value)
|
|
98
|
+
?? currentRouteTarget.value;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
async function copyShareLink() {
|
|
102
|
+
const target = shareLinkTarget.value;
|
|
103
|
+
if (!target) return;
|
|
104
|
+
await copyAppLink(args.router, args.toasts, target);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function buildDocumentCopyFields(): RecordFields {
|
|
108
|
+
const result: RecordFields = {};
|
|
109
|
+
const formFields = args.metadata.value?.form
|
|
110
|
+
? listFormFields(args.metadata.value.form).filter((field) => !field?.isReadOnly)
|
|
111
|
+
: Object.keys(args.model.value).map((key) => ({ key, isReadOnly: false }));
|
|
112
|
+
|
|
113
|
+
for (const field of formFields) {
|
|
114
|
+
const key = String(field?.key ?? '').trim();
|
|
115
|
+
if (!key || key === 'display' || key === 'number') continue;
|
|
116
|
+
if (!(key in args.model.value)) continue;
|
|
117
|
+
result[key] = clonePlainData(args.model.value[key]) as RecordFields[string];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function buildDocumentCopyTarget(token: string): string {
|
|
124
|
+
if (args.mode.value === 'drawer') {
|
|
125
|
+
return `${buildDocumentCompactPageUrl(args.typeCode.value)}©Draft=${encodeURIComponent(token)}`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return `${buildDocumentFullPageUrl(args.typeCode.value)}?copyDraft=${encodeURIComponent(token)}`;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function copyDocument() {
|
|
132
|
+
if (args.kind.value !== 'document') return;
|
|
133
|
+
if (!args.currentId.value || args.loading.value || args.saving.value) return;
|
|
134
|
+
|
|
135
|
+
const token = saveDocumentCopyDraft({
|
|
136
|
+
documentType: args.typeCode.value,
|
|
137
|
+
fields: buildDocumentCopyFields(),
|
|
138
|
+
parts: args.buildCopyParts?.() ?? null,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
if (!token) {
|
|
142
|
+
args.toasts.push({
|
|
143
|
+
title: 'Could not copy',
|
|
144
|
+
message: 'The document copy could not be prepared.',
|
|
145
|
+
tone: 'danger',
|
|
146
|
+
});
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
args.requestNavigate(buildDocumentCopyTarget(token));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function openDocumentPrintPage() {
|
|
154
|
+
if (!args.canPrintDocument.value || !args.currentId.value) return;
|
|
155
|
+
|
|
156
|
+
const target = withBackTarget(
|
|
157
|
+
buildDocumentPrintPageUrl(args.typeCode.value, args.currentId.value, { autoPrint: true }),
|
|
158
|
+
relatedViewBackTarget.value,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
args.requestNavigate(target);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function openAuditLog() {
|
|
165
|
+
if (!args.canOpenAudit.value) return;
|
|
166
|
+
auditOpen.value = true;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function closeAuditLog() {
|
|
170
|
+
auditOpen.value = false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function openDocumentEffectsPage() {
|
|
174
|
+
if (!args.canOpenEffectsPage.value || !args.currentId.value) return;
|
|
175
|
+
void args.router.push(
|
|
176
|
+
withBackTarget(
|
|
177
|
+
buildDocumentEffectsPageUrl(args.typeCode.value, args.currentId.value),
|
|
178
|
+
relatedViewBackTarget.value,
|
|
179
|
+
),
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function openDocumentFlowPage() {
|
|
184
|
+
if (!args.canOpenDocumentFlowPage.value || !args.currentId.value) return;
|
|
185
|
+
void args.router.push(
|
|
186
|
+
withBackTarget(
|
|
187
|
+
buildDocumentFlowPageUrl(args.typeCode.value, args.currentId.value),
|
|
188
|
+
relatedViewBackTarget.value,
|
|
189
|
+
),
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function openFullPage() {
|
|
194
|
+
const target = args.expandTo.value;
|
|
195
|
+
if (!target) {
|
|
196
|
+
args.requestNavigate(target);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (args.mode.value === 'drawer') {
|
|
201
|
+
args.requestNavigate(withBackTarget(target, drawerBackTarget.value));
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
args.requestNavigate(target);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function openCompactPage() {
|
|
209
|
+
args.requestNavigate(args.compactTo.value);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function closePage() {
|
|
213
|
+
if (args.mode.value === 'drawer') {
|
|
214
|
+
args.requestClose();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
args.requestNavigate(args.closeTo.value ?? fallbackCloseTarget.value);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
auditOpen,
|
|
223
|
+
fallbackCloseTarget,
|
|
224
|
+
copyShareLink,
|
|
225
|
+
copyDocument,
|
|
226
|
+
openDocumentPrintPage,
|
|
227
|
+
openAuditLog,
|
|
228
|
+
closeAuditLog,
|
|
229
|
+
openDocumentEffectsPage,
|
|
230
|
+
openDocumentFlowPage,
|
|
231
|
+
openFullPage,
|
|
232
|
+
openCompactPage,
|
|
233
|
+
closePage,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { computed, watch, type ComputedRef } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type { EntityEditorFlags } from './types';
|
|
4
|
+
|
|
5
|
+
type UseEntityEditorOutputsArgs = {
|
|
6
|
+
emit: {
|
|
7
|
+
(event: 'state', value: { title: string; subtitle?: string }): void;
|
|
8
|
+
(event: 'flags', value: EntityEditorFlags): void;
|
|
9
|
+
};
|
|
10
|
+
title: ComputedRef<string>;
|
|
11
|
+
subtitle: ComputedRef<string | undefined>;
|
|
12
|
+
isDirty: ComputedRef<boolean>;
|
|
13
|
+
loading: ComputedRef<boolean>;
|
|
14
|
+
saving: ComputedRef<boolean>;
|
|
15
|
+
canExpand: ComputedRef<boolean>;
|
|
16
|
+
canDelete: ComputedRef<boolean>;
|
|
17
|
+
canMarkForDeletion: ComputedRef<boolean>;
|
|
18
|
+
canUnmarkForDeletion: ComputedRef<boolean>;
|
|
19
|
+
canPost: ComputedRef<boolean>;
|
|
20
|
+
canUnpost: ComputedRef<boolean>;
|
|
21
|
+
canOpenAudit: ComputedRef<boolean>;
|
|
22
|
+
canShareLink: ComputedRef<boolean>;
|
|
23
|
+
canSave: ComputedRef<boolean>;
|
|
24
|
+
extraFlags?: ComputedRef<Record<string, boolean | undefined> | null | undefined>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function useEntityEditorOutputs(args: UseEntityEditorOutputsArgs) {
|
|
28
|
+
const flags = computed<EntityEditorFlags>(() => ({
|
|
29
|
+
canSave: !!args.canSave.value,
|
|
30
|
+
isDirty: !!args.isDirty.value,
|
|
31
|
+
loading: !!args.loading.value,
|
|
32
|
+
saving: !!args.saving.value,
|
|
33
|
+
canExpand: !!args.canExpand.value,
|
|
34
|
+
canDelete: !!args.canDelete.value,
|
|
35
|
+
canMarkForDeletion: !!args.canMarkForDeletion.value,
|
|
36
|
+
canUnmarkForDeletion: !!args.canUnmarkForDeletion.value,
|
|
37
|
+
canPost: !!args.canPost.value,
|
|
38
|
+
canUnpost: !!args.canUnpost.value,
|
|
39
|
+
canShowAudit: !!args.canOpenAudit.value,
|
|
40
|
+
canShareLink: !!args.canShareLink.value,
|
|
41
|
+
extras: args.extraFlags?.value ? { ...args.extraFlags.value } : undefined,
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
watch(
|
|
45
|
+
() => [args.title.value, args.subtitle.value] as const,
|
|
46
|
+
() => args.emit('state', { title: args.title.value, subtitle: args.subtitle.value }),
|
|
47
|
+
{ immediate: true },
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
watch(
|
|
51
|
+
flags,
|
|
52
|
+
(value) => args.emit('flags', value),
|
|
53
|
+
{ immediate: true },
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
flags,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
|
|
3
|
+
import type { EntityHeaderIconAction } from './types';
|
|
4
|
+
import type { UseEntityEditorPageActionsArgs } from './extensions';
|
|
5
|
+
|
|
6
|
+
export function useEntityEditorPageActions(args: UseEntityEditorPageActionsArgs) {
|
|
7
|
+
return computed<EntityHeaderIconAction[]>(() => {
|
|
8
|
+
if (args.kind.value === 'document' || args.mode.value !== 'page') return [];
|
|
9
|
+
|
|
10
|
+
const actions: EntityHeaderIconAction[] = [];
|
|
11
|
+
|
|
12
|
+
if (args.compactTo.value) {
|
|
13
|
+
actions.push({
|
|
14
|
+
key: 'openCompactPage',
|
|
15
|
+
title: 'Open compact page',
|
|
16
|
+
icon: 'panel-right',
|
|
17
|
+
disabled: args.loading.value || args.saving.value,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (args.canShareLink.value) {
|
|
22
|
+
actions.push({
|
|
23
|
+
key: 'copyShareLink',
|
|
24
|
+
title: 'Share link',
|
|
25
|
+
icon: 'share',
|
|
26
|
+
disabled: args.loading.value || args.saving.value,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (args.canOpenAudit.value) {
|
|
31
|
+
actions.push({
|
|
32
|
+
key: 'openAuditLog',
|
|
33
|
+
title: 'Audit log',
|
|
34
|
+
icon: 'history',
|
|
35
|
+
disabled: args.loading.value || args.saving.value,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (args.canMarkForDeletion.value || args.canUnmarkForDeletion.value) {
|
|
40
|
+
actions.push({
|
|
41
|
+
key: 'toggleMarkForDeletion',
|
|
42
|
+
title: args.canUnmarkForDeletion.value ? 'Unmark for deletion' : 'Mark for deletion',
|
|
43
|
+
icon: args.canUnmarkForDeletion.value ? 'trash-restore' : 'trash',
|
|
44
|
+
disabled: args.loading.value || args.saving.value,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
actions.push({
|
|
49
|
+
key: 'save',
|
|
50
|
+
title: !args.isNew.value && args.isMarkedForDeletion.value ? 'Restore to edit' : 'Save',
|
|
51
|
+
icon: 'save',
|
|
52
|
+
disabled: args.loading.value || args.saving.value || !args.canSave.value,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return [...actions, ...(args.extraActions?.value ?? [])];
|
|
56
|
+
});
|
|
57
|
+
}
|