@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,243 @@
|
|
|
1
|
+
import { buildAccountingPeriodClosingPath, buildChartOfAccountsPath, buildGeneralJournalEntriesPath } from '../accounting/navigation'
|
|
2
|
+
import { buildCatalogFullPageUrl } from '../editor/catalogNavigation'
|
|
3
|
+
import { buildDocumentEffectsPageUrl, buildDocumentFlowPageUrl, buildDocumentFullPageUrl } from '../editor/documentNavigation'
|
|
4
|
+
import { buildReportPageUrl } from '../reporting/navigation'
|
|
5
|
+
import type {
|
|
6
|
+
CommandPaletteGroupCode,
|
|
7
|
+
CommandPaletteItemSeed,
|
|
8
|
+
CommandPaletteScope,
|
|
9
|
+
} from './types'
|
|
10
|
+
import type { NgbIconName } from '../primitives/iconNames'
|
|
11
|
+
|
|
12
|
+
export type BuildNgbHeuristicCurrentActionsOptions = {
|
|
13
|
+
excludedCatalogTypes?: string[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function createRouteAction(
|
|
17
|
+
key: string,
|
|
18
|
+
title: string,
|
|
19
|
+
route: string,
|
|
20
|
+
options?: Partial<CommandPaletteItemSeed>,
|
|
21
|
+
): CommandPaletteItemSeed {
|
|
22
|
+
return {
|
|
23
|
+
key,
|
|
24
|
+
group: 'actions',
|
|
25
|
+
kind: 'command',
|
|
26
|
+
scope: 'commands',
|
|
27
|
+
title,
|
|
28
|
+
subtitle: options?.subtitle ?? null,
|
|
29
|
+
icon: options?.icon ?? 'arrow-right',
|
|
30
|
+
badge: options?.badge ?? 'Action',
|
|
31
|
+
hint: options?.hint ?? null,
|
|
32
|
+
route,
|
|
33
|
+
commandCode: options?.commandCode ?? null,
|
|
34
|
+
status: options?.status ?? null,
|
|
35
|
+
openInNewTabSupported: options?.openInNewTabSupported ?? true,
|
|
36
|
+
keywords: options?.keywords ?? [],
|
|
37
|
+
defaultRank: options?.defaultRank ?? 980,
|
|
38
|
+
isCurrentContext: true,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function createStaticCreateItem(key: string, title: string, route: string, keywords: string[]): CommandPaletteItemSeed {
|
|
43
|
+
return {
|
|
44
|
+
key,
|
|
45
|
+
group: 'actions',
|
|
46
|
+
kind: 'command',
|
|
47
|
+
scope: 'commands',
|
|
48
|
+
title,
|
|
49
|
+
subtitle: 'Create a new record',
|
|
50
|
+
icon: 'plus',
|
|
51
|
+
badge: 'Create',
|
|
52
|
+
hint: null,
|
|
53
|
+
route,
|
|
54
|
+
commandCode: key,
|
|
55
|
+
status: null,
|
|
56
|
+
openInNewTabSupported: true,
|
|
57
|
+
keywords: ['create', 'new', ...keywords],
|
|
58
|
+
defaultRank: 0,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function createStaticPageItem(
|
|
63
|
+
key: string,
|
|
64
|
+
title: string,
|
|
65
|
+
route: string,
|
|
66
|
+
icon: NgbIconName,
|
|
67
|
+
keywords: string[],
|
|
68
|
+
subtitle: string,
|
|
69
|
+
): CommandPaletteItemSeed {
|
|
70
|
+
return {
|
|
71
|
+
key,
|
|
72
|
+
group: 'go-to' as CommandPaletteGroupCode,
|
|
73
|
+
kind: 'page',
|
|
74
|
+
scope: 'pages' as CommandPaletteScope,
|
|
75
|
+
title,
|
|
76
|
+
subtitle,
|
|
77
|
+
icon,
|
|
78
|
+
badge: 'Page',
|
|
79
|
+
hint: null,
|
|
80
|
+
route,
|
|
81
|
+
commandCode: null,
|
|
82
|
+
status: null,
|
|
83
|
+
openInNewTabSupported: true,
|
|
84
|
+
keywords,
|
|
85
|
+
defaultRank: 0,
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function toUrl(route: string): URL {
|
|
90
|
+
return new URL(route || '/', 'https://ngb.local')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function buildNgbHeuristicCurrentActions(
|
|
94
|
+
fullRoute: string,
|
|
95
|
+
options: BuildNgbHeuristicCurrentActionsOptions = {},
|
|
96
|
+
): CommandPaletteItemSeed[] {
|
|
97
|
+
const url = toUrl(fullRoute)
|
|
98
|
+
const path = url.pathname
|
|
99
|
+
const items: CommandPaletteItemSeed[] = []
|
|
100
|
+
const excludedCatalogTypes = new Set(options.excludedCatalogTypes ?? [])
|
|
101
|
+
|
|
102
|
+
const documentMatch = path.match(/^\/documents\/([^/]+)\/([^/]+)$/)
|
|
103
|
+
if (documentMatch) {
|
|
104
|
+
const [, documentType, entityId] = documentMatch
|
|
105
|
+
if (entityId !== 'new') {
|
|
106
|
+
items.push(
|
|
107
|
+
createRouteAction(`current:flow:${documentType}:${entityId}`, 'Open document flow', buildDocumentFlowPageUrl(documentType, entityId), {
|
|
108
|
+
icon: 'document-flow',
|
|
109
|
+
subtitle: 'Open workflow for this document',
|
|
110
|
+
badge: 'Flow',
|
|
111
|
+
keywords: ['flow', 'document flow', documentType],
|
|
112
|
+
}),
|
|
113
|
+
createRouteAction(`current:effects:${documentType}:${entityId}`, 'Open accounting effects', buildDocumentEffectsPageUrl(documentType, entityId), {
|
|
114
|
+
icon: 'effects-flow',
|
|
115
|
+
subtitle: 'Review ledger impact for this document',
|
|
116
|
+
badge: 'Effects',
|
|
117
|
+
keywords: ['effects', 'accounting effects', 'posting', documentType],
|
|
118
|
+
}),
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
return items
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const documentReadonlyMatch = path.match(/^\/documents\/([^/]+)\/([^/]+)\/(effects|flow|print)$/)
|
|
125
|
+
if (documentReadonlyMatch) {
|
|
126
|
+
const [, documentType, entityId] = documentReadonlyMatch
|
|
127
|
+
items.push(
|
|
128
|
+
createRouteAction(`current:document:${documentType}:${entityId}`, 'Open source document', buildDocumentFullPageUrl(documentType, entityId), {
|
|
129
|
+
icon: 'file-text',
|
|
130
|
+
subtitle: 'Return to the source document',
|
|
131
|
+
badge: 'Document',
|
|
132
|
+
keywords: ['document', 'source document', documentType],
|
|
133
|
+
}),
|
|
134
|
+
)
|
|
135
|
+
return items
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (/^\/documents\/[^/]+$/.test(path)) {
|
|
139
|
+
const documentType = path.split('/')[2] ?? ''
|
|
140
|
+
items.push(
|
|
141
|
+
createRouteAction(`current:create:${documentType}`, 'Create new', buildDocumentFullPageUrl(documentType), {
|
|
142
|
+
icon: 'plus',
|
|
143
|
+
subtitle: 'Start a new record from this page',
|
|
144
|
+
badge: 'Create',
|
|
145
|
+
keywords: ['create', 'new', documentType],
|
|
146
|
+
}),
|
|
147
|
+
)
|
|
148
|
+
return items
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (/^\/catalogs\/[^/]+$/.test(path)) {
|
|
152
|
+
const catalogType = path.split('/')[2] ?? ''
|
|
153
|
+
if (!excludedCatalogTypes.has(catalogType)) {
|
|
154
|
+
items.push(
|
|
155
|
+
createRouteAction(`current:create-catalog:${catalogType}`, 'Create new', buildCatalogFullPageUrl(catalogType), {
|
|
156
|
+
icon: 'plus',
|
|
157
|
+
subtitle: 'Start a new catalog record',
|
|
158
|
+
badge: 'Create',
|
|
159
|
+
keywords: ['create', 'new', catalogType],
|
|
160
|
+
}),
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
return items
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (path === '/accounting/general-journal-entries') {
|
|
167
|
+
items.push(
|
|
168
|
+
createRouteAction('current:create-gje', 'Create Journal Entry', buildGeneralJournalEntriesPath(), {
|
|
169
|
+
icon: 'plus',
|
|
170
|
+
subtitle: 'Start a new journal entry',
|
|
171
|
+
badge: 'Create',
|
|
172
|
+
keywords: ['create', 'general journal', 'journal entry', 'journal entries'],
|
|
173
|
+
}),
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return items
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export const NGB_ACCOUNTING_FAVORITE_ITEMS: CommandPaletteItemSeed[] = [
|
|
181
|
+
{
|
|
182
|
+
key: 'favorite:trial-balance',
|
|
183
|
+
group: 'actions',
|
|
184
|
+
kind: 'report',
|
|
185
|
+
scope: 'reports',
|
|
186
|
+
title: 'Trial Balance',
|
|
187
|
+
subtitle: 'Review balances by account',
|
|
188
|
+
icon: 'bar-chart',
|
|
189
|
+
badge: 'Accounting',
|
|
190
|
+
hint: null,
|
|
191
|
+
route: buildReportPageUrl('accounting.trial_balance'),
|
|
192
|
+
commandCode: null,
|
|
193
|
+
status: null,
|
|
194
|
+
openInNewTabSupported: true,
|
|
195
|
+
keywords: ['trial balance', 'accounting', 'report'],
|
|
196
|
+
defaultRank: 0,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
key: 'favorite:period-closing',
|
|
200
|
+
group: 'actions',
|
|
201
|
+
kind: 'page',
|
|
202
|
+
scope: 'pages',
|
|
203
|
+
title: 'Period Close',
|
|
204
|
+
subtitle: 'Manage the month-end close',
|
|
205
|
+
icon: 'calendar-check',
|
|
206
|
+
badge: 'Setup & Controls',
|
|
207
|
+
hint: null,
|
|
208
|
+
route: buildAccountingPeriodClosingPath(),
|
|
209
|
+
commandCode: null,
|
|
210
|
+
status: null,
|
|
211
|
+
openInNewTabSupported: true,
|
|
212
|
+
keywords: ['period closing', 'close month'],
|
|
213
|
+
defaultRank: 0,
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
key: 'favorite:chart-of-accounts',
|
|
217
|
+
group: 'actions',
|
|
218
|
+
kind: 'page',
|
|
219
|
+
scope: 'pages',
|
|
220
|
+
title: 'Chart of Accounts',
|
|
221
|
+
subtitle: 'Maintain the ledger account list',
|
|
222
|
+
icon: 'book-open',
|
|
223
|
+
badge: 'Setup & Controls',
|
|
224
|
+
hint: null,
|
|
225
|
+
route: buildChartOfAccountsPath(),
|
|
226
|
+
commandCode: null,
|
|
227
|
+
status: null,
|
|
228
|
+
openInNewTabSupported: true,
|
|
229
|
+
keywords: ['chart of accounts', 'accounts', 'coa'],
|
|
230
|
+
defaultRank: 0,
|
|
231
|
+
},
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
export const NGB_ACCOUNTING_CREATE_ITEMS: CommandPaletteItemSeed[] = [
|
|
235
|
+
createStaticCreateItem('create:gje', 'Create Journal Entry', buildGeneralJournalEntriesPath(), ['general journal entry', 'journal entry', 'journal entries']),
|
|
236
|
+
]
|
|
237
|
+
|
|
238
|
+
export const NGB_ACCOUNTING_SPECIAL_PAGE_ITEMS: CommandPaletteItemSeed[] = [
|
|
239
|
+
createStaticPageItem('page:chart-of-accounts', 'Chart of Accounts', buildChartOfAccountsPath(), 'book-open', ['chart of accounts', 'accounts', 'coa'], 'Setup & Controls'),
|
|
240
|
+
createStaticPageItem('page:period-closing', 'Period Close', buildAccountingPeriodClosingPath(), 'calendar-check', ['period close', 'period closing', 'close month'], 'Setup & Controls'),
|
|
241
|
+
createStaticPageItem('page:posting-log', 'Posting Log', buildReportPageUrl('accounting.posting_log'), 'history', ['posting log'], 'Setup & Controls'),
|
|
242
|
+
createStaticPageItem('page:accounting-consistency', 'Integrity Checks', buildReportPageUrl('accounting.consistency'), 'shield-check', ['integrity checks', 'consistency', 'accounting consistency'], 'Setup & Controls'),
|
|
243
|
+
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readStorageJson, writeStorageJson } from '../utils/storage'
|
|
2
|
+
import type { CommandPaletteRecentEntry } from './types'
|
|
3
|
+
|
|
4
|
+
export function loadCommandPaletteRecent(storageKey: string): CommandPaletteRecentEntry[] {
|
|
5
|
+
const parsed = readStorageJson<unknown[]>('local', storageKey, [])
|
|
6
|
+
if (!Array.isArray(parsed)) return []
|
|
7
|
+
|
|
8
|
+
return parsed
|
|
9
|
+
.map((entry) => normalizeRecentEntry(entry))
|
|
10
|
+
.filter((entry): entry is CommandPaletteRecentEntry => !!entry)
|
|
11
|
+
.sort((a, b) => String(b.timestamp).localeCompare(String(a.timestamp)))
|
|
12
|
+
.slice(0, 10)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function saveCommandPaletteRecent(storageKey: string, entries: CommandPaletteRecentEntry[]): void {
|
|
16
|
+
void writeStorageJson('local', storageKey, entries.slice(0, 10))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function normalizeRecentEntry(value: unknown): CommandPaletteRecentEntry | null {
|
|
20
|
+
if (!value || typeof value !== 'object') return null
|
|
21
|
+
const entry = value as Record<string, unknown>
|
|
22
|
+
|
|
23
|
+
const key = String(entry.key ?? '').trim()
|
|
24
|
+
const kind = String(entry.kind ?? '').trim()
|
|
25
|
+
const scope = String(entry.scope ?? '').trim()
|
|
26
|
+
const title = String(entry.title ?? '').trim()
|
|
27
|
+
const timestamp = String(entry.timestamp ?? '').trim()
|
|
28
|
+
|
|
29
|
+
if (!key || !kind || !scope || !title || !timestamp) return null
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
key,
|
|
33
|
+
kind: kind as CommandPaletteRecentEntry['kind'],
|
|
34
|
+
scope: scope as CommandPaletteRecentEntry['scope'],
|
|
35
|
+
title,
|
|
36
|
+
subtitle: typeof entry.subtitle === 'string' ? entry.subtitle : null,
|
|
37
|
+
icon: typeof entry.icon === 'string' ? entry.icon : null,
|
|
38
|
+
badge: typeof entry.badge === 'string' ? entry.badge : null,
|
|
39
|
+
route: typeof entry.route === 'string' ? entry.route : null,
|
|
40
|
+
status: typeof entry.status === 'string' ? entry.status : null,
|
|
41
|
+
openInNewTabSupported: Boolean(entry.openInNewTabSupported),
|
|
42
|
+
timestamp,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|