@antelopejs/dms-lang 0.0.6 → 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/README.md +12 -6
- package/dist/pages/actions.d.ts +7 -0
- package/dist/pages/actions.js +15 -0
- package/dist/pages/actions.js.map +1 -0
- package/dist/pages/component-action.d.ts +2 -0
- package/dist/pages/component-action.js +10 -0
- package/dist/pages/component-action.js.map +1 -0
- package/dist/pages/header-actions.d.ts +9 -0
- package/dist/pages/header-actions.js +146 -0
- package/dist/pages/header-actions.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +6 -0
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/language.d.ts +10 -0
- package/dist/pages/language.js +89 -0
- package/dist/pages/language.js.map +1 -0
- package/dist/pages/languages-table.d.ts +2 -0
- package/dist/pages/languages-table.js +120 -0
- package/dist/pages/languages-table.js.map +1 -0
- package/dist/pages/module.d.ts +7 -1
- package/dist/pages/module.js +28 -2
- package/dist/pages/module.js.map +1 -1
- package/dist/pages/overview.d.ts +2 -1
- package/dist/pages/overview.js +83 -8
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/page-actions.d.ts +6 -0
- package/dist/pages/page-actions.js +10 -0
- package/dist/pages/page-actions.js.map +1 -0
- package/dist/pages/quick-actions.d.ts +1 -0
- package/dist/pages/quick-actions.js +56 -0
- package/dist/pages/quick-actions.js.map +1 -0
- package/dist/pages/translations.d.ts +7 -1
- package/dist/pages/translations.js +47 -10
- package/dist/pages/translations.js.map +1 -1
- package/dist/pages/workspace-guard.d.ts +1 -0
- package/dist/pages/workspace-guard.js +35 -0
- package/dist/pages/workspace-guard.js.map +1 -0
- package/dist/pages/workspace.d.ts +18 -0
- package/dist/pages/workspace.js +162 -0
- package/dist/pages/workspace.js.map +1 -0
- package/dist/pages/workspaces.d.ts +14 -0
- package/dist/pages/workspaces.js +88 -0
- package/dist/pages/workspaces.js.map +1 -0
- package/dist/routes/publicLocales.d.ts +3 -2
- package/dist/routes/publicLocales.js +39 -18
- package/dist/routes/publicLocales.js.map +1 -1
- package/dist/routes/translations.d.ts +59 -63
- package/dist/routes/translations.js +400 -119
- package/dist/routes/translations.js.map +1 -1
- package/dist/utils/announce.d.ts +9 -0
- package/dist/utils/announce.js +29 -0
- package/dist/utils/announce.js.map +1 -0
- package/dist/utils/blocks.d.ts +8 -0
- package/dist/utils/blocks.js +213 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/body.d.ts +1 -0
- package/dist/utils/body.js +21 -0
- package/dist/utils/body.js.map +1 -0
- package/dist/utils/cache.d.ts +3 -0
- package/dist/utils/cache.js +32 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/catalog.d.ts +7 -0
- package/dist/utils/catalog.js +62 -0
- package/dist/utils/catalog.js.map +1 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +10 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/coverage.d.ts +2 -0
- package/dist/utils/coverage.js +11 -0
- package/dist/utils/coverage.js.map +1 -0
- package/dist/utils/dialogs.d.ts +7 -0
- package/dist/utils/dialogs.js +103 -0
- package/dist/utils/dialogs.js.map +1 -0
- package/dist/utils/errors.d.ts +40 -0
- package/dist/utils/errors.js +60 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/export.d.ts +17 -0
- package/dist/utils/export.js +129 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/json.d.ts +10 -1
- package/dist/utils/json.js +127 -19
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/key-stores.d.ts +3 -0
- package/dist/utils/key-stores.js +24 -0
- package/dist/utils/key-stores.js.map +1 -0
- package/dist/utils/keys.d.ts +23 -0
- package/dist/utils/keys.js +252 -0
- package/dist/utils/keys.js.map +1 -0
- package/dist/utils/languages.d.ts +27 -0
- package/dist/utils/languages.js +121 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/locale-codes.d.ts +5 -0
- package/dist/utils/locale-codes.js +56 -0
- package/dist/utils/locale-codes.js.map +1 -0
- package/dist/utils/locale-discovery.d.ts +1 -0
- package/dist/utils/locale-discovery.js +19 -1
- package/dist/utils/locale-discovery.js.map +1 -1
- package/dist/utils/message-check.d.ts +1 -0
- package/dist/utils/message-check.js +93 -0
- package/dist/utils/message-check.js.map +1 -0
- package/dist/utils/message-syntax.d.ts +6 -0
- package/dist/utils/message-syntax.js +38 -0
- package/dist/utils/message-syntax.js.map +1 -0
- package/dist/utils/namespaces.d.ts +12 -0
- package/dist/utils/namespaces.js +52 -0
- package/dist/utils/namespaces.js.map +1 -0
- package/dist/utils/notices.d.ts +4 -0
- package/dist/utils/notices.js +60 -0
- package/dist/utils/notices.js.map +1 -0
- package/dist/utils/own.d.ts +2 -3
- package/dist/utils/own.js +17 -57
- package/dist/utils/own.js.map +1 -1
- package/dist/utils/public-url.d.ts +8 -0
- package/dist/utils/public-url.js +87 -0
- package/dist/utils/public-url.js.map +1 -0
- package/dist/utils/registry.d.ts +3 -1
- package/dist/utils/registry.js +26 -10
- package/dist/utils/registry.js.map +1 -1
- package/dist/utils/resolve.d.ts +18 -15
- package/dist/utils/resolve.js +98 -151
- package/dist/utils/resolve.js.map +1 -1
- package/dist/utils/review.d.ts +5 -0
- package/dist/utils/review.js +64 -0
- package/dist/utils/review.js.map +1 -0
- package/dist/utils/snippets.d.ts +7 -0
- package/dist/utils/snippets.js +129 -0
- package/dist/utils/snippets.js.map +1 -0
- package/dist/utils/summary.d.ts +23 -0
- package/dist/utils/summary.js +65 -0
- package/dist/utils/summary.js.map +1 -0
- package/dist/utils/tree.d.ts +2 -17
- package/dist/utils/tree.js +21 -126
- package/dist/utils/tree.js.map +1 -1
- package/dist/utils/workspaces.d.ts +45 -15
- package/dist/utils/workspaces.js +256 -164
- package/dist/utils/workspaces.js.map +1 -1
- package/dist/validation/key.schema.d.ts +71 -0
- package/dist/validation/key.schema.js +67 -0
- package/dist/validation/key.schema.js.map +1 -0
- package/dist/validation/query.schema.d.ts +17 -0
- package/dist/validation/query.schema.js +44 -0
- package/dist/validation/query.schema.js.map +1 -0
- package/dist/validation/validate.d.ts +2 -0
- package/dist/validation/validate.js +24 -0
- package/dist/validation/validate.js.map +1 -0
- package/dist/validation/workspace.schema.d.ts +145 -0
- package/dist/validation/workspace.schema.js +83 -0
- package/dist/validation/workspace.schema.js.map +1 -0
- package/frontend-vue/app/build/components/KeyAddModal.vue +340 -0
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +951 -0
- package/frontend-vue/app/build/components/KeyRenameModal.vue +172 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +199 -0
- package/frontend-vue/app/build/components/LanguagePicker.vue +233 -0
- package/frontend-vue/app/build/components/LocaleTile.vue +52 -0
- package/frontend-vue/app/build/components/PlaceholderText.vue +42 -0
- package/frontend-vue/app/build/components/ShortcutKbds.vue +22 -0
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +193 -0
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +107 -0
- package/frontend-vue/app/build/components/form/FormFieldRow.vue +70 -0
- package/frontend-vue/app/build/components/form/FormRows.vue +25 -0
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +44 -0
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +488 -0
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +177 -0
- package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +57 -0
- package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +83 -0
- package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +167 -0
- package/frontend-vue/app/build/components/queue/QueueActions.vue +60 -0
- package/frontend-vue/app/build/components/queue/QueueDone.vue +185 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +374 -0
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +162 -0
- package/frontend-vue/app/build/components/queue/QueueUpNext.vue +61 -0
- package/frontend-vue/app/build/composables/useCellEditor.ts +324 -0
- package/frontend-vue/app/build/composables/useCellMoves.ts +155 -0
- package/frontend-vue/app/build/composables/useCellSaves.ts +339 -0
- package/frontend-vue/app/build/composables/useKeyPanel.ts +284 -0
- package/frontend-vue/app/build/composables/useKeySaves.ts +280 -0
- package/frontend-vue/app/build/composables/useMatrixFilters.ts +213 -0
- package/frontend-vue/app/build/composables/useMatrixRows.ts +104 -0
- package/frontend-vue/app/build/composables/useMatrixView.ts +181 -0
- package/frontend-vue/app/build/composables/useQueueContext.ts +31 -0
- package/frontend-vue/app/build/composables/useQueueEditing.ts +53 -0
- package/frontend-vue/app/build/composables/useQueueOrphans.ts +54 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +290 -0
- package/frontend-vue/app/build/composables/useQueueShortcuts.ts +106 -0
- package/frontend-vue/app/build/composables/useQueueToasts.ts +99 -0
- package/frontend-vue/app/components/LanguageNamespaces.vue +77 -0
- package/frontend-vue/app/components/NamespaceCoverage.vue +222 -0
- package/frontend-vue/app/components/TranslationMatrix.vue +809 -0
- package/frontend-vue/app/components/TranslationQueue.vue +212 -0
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +81 -0
- package/frontend-vue/app/components/WorkspaceGeneral.vue +232 -0
- package/frontend-vue/app/components/WorkspaceList.vue +454 -0
- package/frontend-vue/app/components/WorkspaceScope.vue +384 -0
- package/frontend-vue/app/composables/translation/useFirstRun.ts +8 -0
- package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +221 -133
- package/frontend-vue/app/composables/translation/useKeyActions.ts +224 -0
- package/frontend-vue/app/composables/translation/useLangFormat.ts +10 -0
- package/frontend-vue/app/composables/translation/useLangLinks.ts +80 -0
- package/frontend-vue/app/composables/translation/useLanguageActions.ts +159 -0
- package/frontend-vue/app/composables/translation/useLanguageQueue.ts +232 -0
- package/frontend-vue/app/composables/translation/useLocaleNames.ts +166 -0
- package/frontend-vue/app/composables/translation/useMutationToast.ts +51 -17
- package/frontend-vue/app/composables/translation/useQueueDrafts.ts +115 -0
- package/frontend-vue/app/composables/translation/useQueueSession.ts +182 -0
- package/frontend-vue/app/composables/translation/useServedConfirm.ts +152 -0
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +259 -0
- package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +46 -15
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +322 -70
- package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +55 -0
- package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +129 -0
- package/frontend-vue/app/config/shortcuts-registry.ts +72 -0
- package/frontend-vue/app/types/lang.ts +130 -0
- package/frontend-vue/app/utils/boundedCache.ts +22 -0
- package/frontend-vue/app/utils/download.ts +16 -0
- package/frontend-vue/app/utils/keySaveErrors.ts +61 -0
- package/frontend-vue/app/utils/keySaves.ts +108 -0
- package/frontend-vue/app/utils/languages.ts +272 -0
- package/frontend-vue/app/utils/matrixExport.ts +47 -0
- package/frontend-vue/app/utils/queueDrafts.ts +115 -0
- package/frontend-vue/app/utils/queuePass.ts +145 -0
- package/frontend-vue/app/utils/queueView.ts +22 -0
- package/frontend-vue/app/utils/shortcuts.ts +75 -0
- package/frontend-vue/app/utils/translations.ts +756 -0
- package/frontend-vue/app/utils/workspaceBackup.ts +119 -0
- package/frontend-vue/app/utils/workspaces.ts +45 -0
- package/frontend-vue/dms.frontend.build.ts +5 -0
- package/frontend-vue/dms.frontend.ts +9 -20
- package/frontend-vue/i18n/locales/lang-en-GB.json +792 -69
- package/frontend-vue/i18n/locales/lang-fr-FR.json +792 -69
- package/frontend-vue/package.json +10 -5
- package/package.json +10 -8
- package/dist/utils/mutations.d.ts +0 -3
- package/dist/utils/mutations.js +0 -35
- package/dist/utils/mutations.js.map +0 -1
- package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +0 -284
- package/frontend-vue/app/components/LanguageAddModal.vue +0 -78
- package/frontend-vue/app/components/WorkspaceEndpoint.vue +0 -29
- package/frontend-vue/app/components/WorkspaceSelector.vue +0 -180
- package/frontend-vue/app/components/WorkspaceStatus.vue +0 -24
- package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +0 -90
- package/frontend-vue/app/composables/translation/useLocaleMeta.ts +0 -18
- package/frontend-vue/app/composables/translation/useTranslationProgress.ts +0 -73
- package/frontend-vue/app/custom-pages/lang/overview.vue +0 -397
- package/frontend-vue/app/custom-pages/lang/translations.vue +0 -498
- package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +0 -12
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ComponentPublicInstance } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
useActiveElement,
|
|
5
|
+
useElementSize,
|
|
6
|
+
useIntersectionObserver,
|
|
7
|
+
} from '@vueuse/core'
|
|
8
|
+
import UButton from '@nuxt/ui/components/Button.vue'
|
|
9
|
+
import UDropdownMenu from '@nuxt/ui/components/DropdownMenu.vue'
|
|
10
|
+
import { useDmsRouter } from '#dms/frontend-module'
|
|
11
|
+
import type { FlatTranslationRow, LanguageCoverage } from '../types/lang'
|
|
12
|
+
import { useWorkspaceFlatSync } from '../composables/translation/useWorkspaceFlat'
|
|
13
|
+
import {
|
|
14
|
+
coverageTone,
|
|
15
|
+
languageCoverage,
|
|
16
|
+
stringValue,
|
|
17
|
+
} from '../utils/translations'
|
|
18
|
+
import { exportFileName, translationsCsv } from '../utils/matrixExport'
|
|
19
|
+
import LocaleTile from '../build/components/LocaleTile.vue'
|
|
20
|
+
import PlaceholderText from '../build/components/PlaceholderText.vue'
|
|
21
|
+
import MatrixCell from '../build/components/matrix/MatrixCell.vue'
|
|
22
|
+
import MatrixColumns from '../build/components/matrix/MatrixColumns.vue'
|
|
23
|
+
import MatrixGroupHeader from '../build/components/matrix/MatrixGroupHeader.vue'
|
|
24
|
+
import MatrixKeyCell from '../build/components/matrix/MatrixKeyCell.vue'
|
|
25
|
+
import MatrixToolbar from '../build/components/matrix/MatrixToolbar.vue'
|
|
26
|
+
import ShortcutKbds from '../build/components/ShortcutKbds.vue'
|
|
27
|
+
import {
|
|
28
|
+
useCellSaves,
|
|
29
|
+
type CellAddress,
|
|
30
|
+
} from '../build/composables/useCellSaves'
|
|
31
|
+
import {
|
|
32
|
+
useCellEditor,
|
|
33
|
+
type CellRef,
|
|
34
|
+
} from '../build/composables/useCellEditor'
|
|
35
|
+
import {
|
|
36
|
+
focusNeighbourCell,
|
|
37
|
+
useCellMoves,
|
|
38
|
+
type JumpStep,
|
|
39
|
+
} from '../build/composables/useCellMoves'
|
|
40
|
+
import { useKeyPanel } from '../build/composables/useKeyPanel'
|
|
41
|
+
import { useMatrixRows } from '../build/composables/useMatrixRows'
|
|
42
|
+
import { useMatrixView } from '../build/composables/useMatrixView'
|
|
43
|
+
import { useMatrixFilters } from '../build/composables/useMatrixFilters'
|
|
44
|
+
import { MATRIX_KEYS, shortcutName } from '../utils/shortcuts'
|
|
45
|
+
|
|
46
|
+
const COMPACT_WIDTH = 768
|
|
47
|
+
const OPEN_OVERLAY = '[role="dialog"][data-state="open"], [role="alertdialog"]'
|
|
48
|
+
const SCROLL_MARGIN = '400px'
|
|
49
|
+
const KEY_COLUMN_REM = 16
|
|
50
|
+
const LANGUAGE_COLUMN_REM = 15
|
|
51
|
+
const TODO_COLUMN_REM = 28
|
|
52
|
+
const SKELETON_ROWS = 6
|
|
53
|
+
|
|
54
|
+
const { t } = useI18n()
|
|
55
|
+
const { formatCount } = useLangFormat()
|
|
56
|
+
const { selectedWorkspace, editable: serverEditable } = useI18nWorkspaces()
|
|
57
|
+
const { flat, isLoaded, isLoading, hasError, reload } = useWorkspaceFlat()
|
|
58
|
+
useWorkspaceFlatSync()
|
|
59
|
+
const {
|
|
60
|
+
current,
|
|
61
|
+
isUnknown,
|
|
62
|
+
isResolved,
|
|
63
|
+
isDefault,
|
|
64
|
+
isModules,
|
|
65
|
+
canEditValues,
|
|
66
|
+
canManage,
|
|
67
|
+
canManageKeys,
|
|
68
|
+
} = useWorkspaceContext()
|
|
69
|
+
const { nameAmong, fullName } = useLocaleNames()
|
|
70
|
+
const { addKey } = useKeyActions()
|
|
71
|
+
const { addLanguage } = useLanguageActions()
|
|
72
|
+
const { route, pageAction, clearPageAction, selectWorkspace } =
|
|
73
|
+
useWorkspaceRoute()
|
|
74
|
+
const router = useDmsRouter()
|
|
75
|
+
const toast = useToast()
|
|
76
|
+
const links = useLangLinks()
|
|
77
|
+
const { filters, order, saveOrder, sanitize, resetFilters } = useMatrixView()
|
|
78
|
+
|
|
79
|
+
const pinned = ref<Set<string>>(new Set())
|
|
80
|
+
const root = useTemplateRef<ComponentPublicInstance>('root')
|
|
81
|
+
const scroller = useTemplateRef<HTMLElement>('scroller')
|
|
82
|
+
const sentinel = useTemplateRef<HTMLElement>('sentinel')
|
|
83
|
+
const rootElement = computed<HTMLElement | undefined>(() => root.value?.$el)
|
|
84
|
+
const { width } = useElementSize(rootElement, {
|
|
85
|
+
width: Number.POSITIVE_INFINITY,
|
|
86
|
+
height: 0,
|
|
87
|
+
})
|
|
88
|
+
const isCompact = computed(() => width.value < COMPACT_WIDTH)
|
|
89
|
+
|
|
90
|
+
const rowsByKey = computed(
|
|
91
|
+
() => new Map(flat.value.rows.map((row) => [row.key, row])),
|
|
92
|
+
)
|
|
93
|
+
const saves = useCellSaves(rowOf, (address) => {
|
|
94
|
+
if (address.workspace === selectedWorkspace.value) pin(address.key)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const languages = computed<LanguageCoverage[]>(() =>
|
|
98
|
+
languageCoverage(flat.value, (code) => nameAmong(code, flat.value.locales)),
|
|
99
|
+
)
|
|
100
|
+
const languageByCode = computed(
|
|
101
|
+
() => new Map(languages.value.map((entry) => [entry.code, entry])),
|
|
102
|
+
)
|
|
103
|
+
const targetLanguages = computed(() =>
|
|
104
|
+
languages.value
|
|
105
|
+
.filter((entry) => !entry.isBase)
|
|
106
|
+
.map((entry) => ({ code: entry.code, name: fullName(entry.code) })),
|
|
107
|
+
)
|
|
108
|
+
const todoLanguage = computed(() => {
|
|
109
|
+
const chosen = filters.value.missingIn
|
|
110
|
+
if (chosen && flat.value.locales.includes(chosen)) return chosen
|
|
111
|
+
if (!isCompact.value) return ''
|
|
112
|
+
const base = flat.value.defaultLocale
|
|
113
|
+
return order.value.find((code) => code !== base) ?? ''
|
|
114
|
+
})
|
|
115
|
+
const columnCodes = computed(() => {
|
|
116
|
+
if (!todoLanguage.value) return order.value
|
|
117
|
+
const base = flat.value.defaultLocale
|
|
118
|
+
return [base, todoLanguage.value].filter((code) =>
|
|
119
|
+
flat.value.locales.includes(code),
|
|
120
|
+
)
|
|
121
|
+
})
|
|
122
|
+
const columns = computed(() =>
|
|
123
|
+
columnCodes.value
|
|
124
|
+
.map((code) => languageByCode.value.get(code))
|
|
125
|
+
.filter((entry): entry is LanguageCoverage => Boolean(entry)),
|
|
126
|
+
)
|
|
127
|
+
const columnSiblings = computed(() => columns.value.map((entry) => entry.code))
|
|
128
|
+
const compactColumn = computed(() => columns.value.at(-1))
|
|
129
|
+
const tableMinWidth = computed(() => {
|
|
130
|
+
const column = todoLanguage.value ? TODO_COLUMN_REM : LANGUAGE_COLUMN_REM
|
|
131
|
+
return `${KEY_COLUMN_REM + columns.value.length * column}rem`
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const { rows, groups, counts, targets, namespaces, isRowDone } =
|
|
135
|
+
useMatrixFilters(flat, filters, columnCodes, pinned)
|
|
136
|
+
const doneCount = computed(() => rows.value.filter(isRowFinished).length)
|
|
137
|
+
const rowCount = computed(() => rows.value.length)
|
|
138
|
+
const view = useMatrixRows(groups, rowCount)
|
|
139
|
+
const rowIndex = computed(
|
|
140
|
+
() => new Map(view.renderedRows.value.map((row, index) => [row.key, index])),
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
const panel = useKeyPanel({
|
|
144
|
+
keys: () => rows.value.map((row) => row.key),
|
|
145
|
+
editable: () => canEditValues.value,
|
|
146
|
+
manageKeys: () => canManageKeys.value,
|
|
147
|
+
canOverride: () => isModules.value && serverEditable.value,
|
|
148
|
+
isKnown: (key) => rowsByKey.value.has(key),
|
|
149
|
+
onUnknown: (key) => void dropUnknownKey(key),
|
|
150
|
+
onKeep: (holds) => saves.hold(holds),
|
|
151
|
+
onOverride: (key) => {
|
|
152
|
+
const row = rowsByKey.value.get(key)
|
|
153
|
+
if (row) void overrideKey(row)
|
|
154
|
+
},
|
|
155
|
+
})
|
|
156
|
+
const moves = useCellMoves({
|
|
157
|
+
view,
|
|
158
|
+
groups,
|
|
159
|
+
columnCodes,
|
|
160
|
+
targets,
|
|
161
|
+
baseLocale: () => flat.value.defaultLocale,
|
|
162
|
+
isPending: (key, code) => saves.isPending(at(key, code)),
|
|
163
|
+
})
|
|
164
|
+
const editor = useCellEditor({
|
|
165
|
+
saves,
|
|
166
|
+
panel,
|
|
167
|
+
workspace: selectedWorkspace,
|
|
168
|
+
baseLocale: () => flat.value.defaultLocale,
|
|
169
|
+
locales: () => flat.value.locales,
|
|
170
|
+
canEdit: () => canEditValues.value,
|
|
171
|
+
shownValue,
|
|
172
|
+
targetOf: moves.targetOf,
|
|
173
|
+
onStart: pin,
|
|
174
|
+
onMoveEnd: focusCell,
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
const countedLabel = computed(() =>
|
|
178
|
+
targets.value.length === 1
|
|
179
|
+
? (languageByCode.value.get(targets.value[0])?.name ?? targets.value[0])
|
|
180
|
+
: t(
|
|
181
|
+
'dms_lang.matrix.languages_counted',
|
|
182
|
+
{ count: targets.value.length },
|
|
183
|
+
targets.value.length,
|
|
184
|
+
),
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
useUnsavedChanges({
|
|
188
|
+
dirty: () => saves.hasUnsaved.value || editor.hasOpenDraft.value,
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
function at(key: string, code: string): CellAddress {
|
|
192
|
+
return { workspace: selectedWorkspace.value, key, code }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function rowOf(address: CellAddress): FlatTranslationRow | undefined {
|
|
196
|
+
if (address.workspace !== selectedWorkspace.value) return undefined
|
|
197
|
+
return rowsByKey.value.get(address.key)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function isRowFinished(row: FlatTranslationRow): boolean {
|
|
201
|
+
return (
|
|
202
|
+
isRowDone(row) && !saves.hasRowFailure(selectedWorkspace.value, row.key)
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function pin(key: string) {
|
|
207
|
+
if (pinned.value.has(key)) return
|
|
208
|
+
pinned.value = new Set([...pinned.value, key])
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function rowValue(row: FlatTranslationRow | undefined, code: string): string {
|
|
212
|
+
return row
|
|
213
|
+
? saves.shownValue(at(row.key, code), stringValue(row.values[code]))
|
|
214
|
+
: ''
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function shownValue(key: string, code: string): string {
|
|
218
|
+
return rowValue(rowsByKey.value.get(key), code)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function dropUnknownKey(key: string) {
|
|
222
|
+
toast.add({
|
|
223
|
+
title: t('dms_lang.matrix.key_not_found', { key }),
|
|
224
|
+
description: t('dms_lang.matrix.key_not_found_description'),
|
|
225
|
+
color: 'warning',
|
|
226
|
+
icon: 'i-ph-magnifying-glass',
|
|
227
|
+
})
|
|
228
|
+
if (route.query.key !== key) return
|
|
229
|
+
await router.replace(
|
|
230
|
+
linkWithQuery(route.path, { ...route.query, key: undefined }),
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function jumpToMissing(step: JumpStep) {
|
|
235
|
+
const target = moves.nextMissing(editor.cursor.value, step)
|
|
236
|
+
if (!target) return
|
|
237
|
+
view.reveal(target.key)
|
|
238
|
+
editor.startEdit(target.key, target.code)
|
|
239
|
+
nextTick(() =>
|
|
240
|
+
rootElement.value
|
|
241
|
+
?.querySelector('[data-editing]')
|
|
242
|
+
?.scrollIntoView({ block: 'center', inline: 'nearest' }),
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const activeElement = useActiveElement()
|
|
247
|
+
|
|
248
|
+
function jumpUnlessOverlay(step: JumpStep) {
|
|
249
|
+
return () => {
|
|
250
|
+
if (document.querySelector(OPEN_OVERLAY) === null) jumpToMissing(step)
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
defineShortcuts(
|
|
255
|
+
computed(() =>
|
|
256
|
+
canEditValues.value && !isFocusInsideOverlay(activeElement.value)
|
|
257
|
+
? {
|
|
258
|
+
[shortcutName(MATRIX_KEYS.nextMissing)]: jumpUnlessOverlay(1),
|
|
259
|
+
[shortcutName(MATRIX_KEYS.previousMissing)]: jumpUnlessOverlay(-1),
|
|
260
|
+
}
|
|
261
|
+
: {},
|
|
262
|
+
),
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
function focusCell(cell: CellRef) {
|
|
266
|
+
const selector = `[data-matrix-cell][data-key="${CSS.escape(cell.key)}"][data-code="${CSS.escape(cell.code)}"]`
|
|
267
|
+
nextTick(() =>
|
|
268
|
+
rootElement.value?.querySelector<HTMLElement>(selector)?.focus(),
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function onGridKeydown(event: KeyboardEvent) {
|
|
273
|
+
focusNeighbourCell(event, rootElement.value)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
async function overrideKey(row: FlatTranslationRow) {
|
|
277
|
+
panel.seedOverride(row)
|
|
278
|
+
await selectWorkspace(DEFAULT_WORKSPACE, { query: { key: row.key } })
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function inheritedOf(row: FlatTranslationRow, code: string) {
|
|
282
|
+
if (!isDefault.value || !row.inherited) return undefined
|
|
283
|
+
return stringValue(row.inherited[code]) || undefined
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function cellProps(row: FlatTranslationRow, column: LanguageCoverage) {
|
|
287
|
+
const { key } = row
|
|
288
|
+
const { code } = column
|
|
289
|
+
const isEditing = editor.isEditing(key, code)
|
|
290
|
+
return {
|
|
291
|
+
value: rowValue(row, code),
|
|
292
|
+
baseValue: rowValue(row, flat.value.defaultLocale),
|
|
293
|
+
inherited: inheritedOf(row, code),
|
|
294
|
+
override: isModules.value ? row.overrides?.[code] : undefined,
|
|
295
|
+
isBase: column.isBase,
|
|
296
|
+
editable: canEditValues.value,
|
|
297
|
+
isEditing,
|
|
298
|
+
code,
|
|
299
|
+
initialDraft: editor.initialDraftOf(key, code),
|
|
300
|
+
state: saves.stateOf(at(key, code)),
|
|
301
|
+
failure: saves.failureOf(at(key, code)),
|
|
302
|
+
rowKey: key,
|
|
303
|
+
languageName: column.name,
|
|
304
|
+
isOutdated: row.outdated?.includes(code) ?? false,
|
|
305
|
+
hasIssue: row.issues?.includes(code) ?? false,
|
|
306
|
+
changedElsewhere: isEditing
|
|
307
|
+
? saves.changedElsewhere(at(key, code))
|
|
308
|
+
: undefined,
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function discardCell(key: string, code: string) {
|
|
313
|
+
saves.discard(at(key, code))
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function reviewCell(key: string, code: string) {
|
|
317
|
+
void saves.markReviewed(at(key, code))
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function hideDone() {
|
|
321
|
+
pinned.value = new Set()
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function exportCsv(isView: boolean) {
|
|
325
|
+
const base = flat.value.defaultLocale
|
|
326
|
+
const ordered = isView
|
|
327
|
+
? columnCodes.value
|
|
328
|
+
: [...new Set([...order.value, ...flat.value.locales])].filter((code) =>
|
|
329
|
+
flat.value.locales.includes(code),
|
|
330
|
+
)
|
|
331
|
+
const locales = [base, ...ordered.filter((code) => code !== base)]
|
|
332
|
+
const content = translationsCsv(
|
|
333
|
+
isView ? rows.value : flat.value.rows,
|
|
334
|
+
locales,
|
|
335
|
+
)
|
|
336
|
+
downloadText(
|
|
337
|
+
exportFileName(selectedWorkspace.value, isView ? locales : undefined),
|
|
338
|
+
content,
|
|
339
|
+
'text/csv;charset=utf-8',
|
|
340
|
+
)
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function keysLabel(count: number): string {
|
|
344
|
+
return t('dms_lang.matrix.group_keys', { count: formatCount(count) }, count)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function languagesLabel(count: number): string {
|
|
348
|
+
return t('dms_lang.matrix.languages_counted', { count }, count)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
usePageHeaderActions(
|
|
352
|
+
() => [
|
|
353
|
+
h(
|
|
354
|
+
UDropdownMenu,
|
|
355
|
+
{
|
|
356
|
+
items: [
|
|
357
|
+
{
|
|
358
|
+
label: t('dms_lang.matrix.export_view', {
|
|
359
|
+
keys: keysLabel(rows.value.length),
|
|
360
|
+
languages: languagesLabel(columnCodes.value.length),
|
|
361
|
+
}),
|
|
362
|
+
icon: 'i-ph-funnel',
|
|
363
|
+
onSelect: () => exportCsv(true),
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
label: t('dms_lang.matrix.export_all', {
|
|
367
|
+
keys: keysLabel(flat.value.rows.length),
|
|
368
|
+
languages: languagesLabel(flat.value.locales.length),
|
|
369
|
+
}),
|
|
370
|
+
icon: 'i-ph-table',
|
|
371
|
+
onSelect: () => exportCsv(false),
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
content: { align: 'end' },
|
|
375
|
+
},
|
|
376
|
+
() =>
|
|
377
|
+
h(UButton, {
|
|
378
|
+
label: t('dms_lang.matrix.export'),
|
|
379
|
+
icon: 'i-ph-download-simple',
|
|
380
|
+
trailingIcon: 'i-ph-caret-down',
|
|
381
|
+
color: 'neutral',
|
|
382
|
+
variant: 'outline',
|
|
383
|
+
disabled: !isLoaded.value,
|
|
384
|
+
}),
|
|
385
|
+
),
|
|
386
|
+
],
|
|
387
|
+
{ order: -1 },
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
watch(
|
|
391
|
+
() => [filters.value, selectedWorkspace.value],
|
|
392
|
+
() => {
|
|
393
|
+
editor.commitEditing()
|
|
394
|
+
pinned.value = new Set()
|
|
395
|
+
view.reset()
|
|
396
|
+
},
|
|
397
|
+
{ deep: true },
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
watch([namespaces, () => flat.value.locales.join(',')], () =>
|
|
401
|
+
sanitize(namespaces.value),
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
watch(
|
|
405
|
+
[pageAction, () => isResolved.value && isLoaded.value, isUnknown],
|
|
406
|
+
async ([action, resolved, unknown]) => {
|
|
407
|
+
if (action !== PAGE_ACTIONS.addKey || (!resolved && !unknown)) return
|
|
408
|
+
await clearPageAction()
|
|
409
|
+
if (resolved && canManageKeys.value) await addKey()
|
|
410
|
+
},
|
|
411
|
+
{ immediate: true },
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
const endObserver = useIntersectionObserver(
|
|
415
|
+
sentinel,
|
|
416
|
+
(entries) => {
|
|
417
|
+
if (entries.some((entry) => entry.isIntersecting)) view.showMore()
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
root: () => (isCompact.value ? null : scroller.value),
|
|
421
|
+
rootMargin: SCROLL_MARGIN,
|
|
422
|
+
},
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
watch(
|
|
426
|
+
() => view.renderedRows.value.length,
|
|
427
|
+
() => {
|
|
428
|
+
endObserver.pause()
|
|
429
|
+
endObserver.resume()
|
|
430
|
+
},
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
const matrixPath = route.path
|
|
434
|
+
|
|
435
|
+
onBeforeUnmount(() => {
|
|
436
|
+
if (route.path === matrixPath) editor.leaveEditing()
|
|
437
|
+
})
|
|
438
|
+
</script>
|
|
439
|
+
|
|
440
|
+
<template>
|
|
441
|
+
<DmsCard v-if="!isUnknown" ref="root" :padded="false" class="overflow-hidden">
|
|
442
|
+
<MatrixToolbar
|
|
443
|
+
v-model:filters="filters"
|
|
444
|
+
:counts="counts"
|
|
445
|
+
:languages="targetLanguages"
|
|
446
|
+
:namespaces="namespaces"
|
|
447
|
+
:counted-languages="targets.length"
|
|
448
|
+
:shown-language="todoLanguage"
|
|
449
|
+
:is-compact="isCompact"
|
|
450
|
+
>
|
|
451
|
+
<MatrixColumns
|
|
452
|
+
v-if="!todoLanguage && !isCompact"
|
|
453
|
+
:order="order"
|
|
454
|
+
:languages="languages"
|
|
455
|
+
:can-manage="canManage"
|
|
456
|
+
:settings-link="links.workspaceSettings()"
|
|
457
|
+
@update:order="saveOrder"
|
|
458
|
+
@add="addLanguage()"
|
|
459
|
+
/>
|
|
460
|
+
</MatrixToolbar>
|
|
461
|
+
|
|
462
|
+
<div v-if="isModules" class="p-3">
|
|
463
|
+
<DmsBanner
|
|
464
|
+
tone="warning"
|
|
465
|
+
size="sm"
|
|
466
|
+
icon="i-ph-lock-simple"
|
|
467
|
+
:title="$t('dms_lang.modules_notice.title')"
|
|
468
|
+
:description="$t('dms_lang.modules_notice.override')"
|
|
469
|
+
/>
|
|
470
|
+
</div>
|
|
471
|
+
|
|
472
|
+
<div
|
|
473
|
+
v-if="doneCount"
|
|
474
|
+
class="border-default bg-success/5 flex flex-wrap items-center gap-2 border-b px-4 py-2 text-sm"
|
|
475
|
+
role="status"
|
|
476
|
+
>
|
|
477
|
+
<UIcon name="i-ph-check-circle" class="text-success size-4" />
|
|
478
|
+
<span class="text-default">
|
|
479
|
+
{{
|
|
480
|
+
$t(
|
|
481
|
+
'dms_lang.matrix.done_banner',
|
|
482
|
+
{ count: formatCount(doneCount) },
|
|
483
|
+
doneCount,
|
|
484
|
+
)
|
|
485
|
+
}}
|
|
486
|
+
</span>
|
|
487
|
+
<UButton
|
|
488
|
+
size="xs"
|
|
489
|
+
color="neutral"
|
|
490
|
+
variant="outline"
|
|
491
|
+
class="ml-auto"
|
|
492
|
+
:label="$t('dms_lang.matrix.hide_done')"
|
|
493
|
+
@click="hideDone"
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
<DmsEmptyState
|
|
498
|
+
v-if="hasError && !isLoaded"
|
|
499
|
+
variant="error"
|
|
500
|
+
size="lg"
|
|
501
|
+
hatched
|
|
502
|
+
:title="$t('dms_lang.errors.load_title', { name: current?.id ?? '' })"
|
|
503
|
+
:description="$t('dms_lang.errors.load_description')"
|
|
504
|
+
:actions="[
|
|
505
|
+
{
|
|
506
|
+
label: $t('dms_lang.actions.retry'),
|
|
507
|
+
icon: 'i-ph-arrow-clockwise',
|
|
508
|
+
color: 'neutral',
|
|
509
|
+
variant: 'outline',
|
|
510
|
+
loading: isLoading,
|
|
511
|
+
onClick: () => reload(),
|
|
512
|
+
},
|
|
513
|
+
]"
|
|
514
|
+
/>
|
|
515
|
+
|
|
516
|
+
<div v-else-if="!isLoaded" class="divide-default divide-y">
|
|
517
|
+
<div
|
|
518
|
+
v-for="index in SKELETON_ROWS"
|
|
519
|
+
:key="index"
|
|
520
|
+
class="grid grid-cols-4 gap-4 px-4 py-4"
|
|
521
|
+
>
|
|
522
|
+
<USkeleton class="h-4 w-40" />
|
|
523
|
+
<USkeleton class="h-4 w-full" />
|
|
524
|
+
<USkeleton class="h-4 w-full" />
|
|
525
|
+
<USkeleton class="h-4 w-3/4" />
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
|
|
529
|
+
<DmsEmptyState
|
|
530
|
+
v-else-if="!rows.length"
|
|
531
|
+
:variant="flat.rows.length ? 'no-result' : 'no-data'"
|
|
532
|
+
size="lg"
|
|
533
|
+
hatched
|
|
534
|
+
:title="
|
|
535
|
+
flat.rows.length
|
|
536
|
+
? $t('dms_lang.matrix.no_match', { search: filters.search })
|
|
537
|
+
: $t('dms_lang.matrix.no_keys')
|
|
538
|
+
"
|
|
539
|
+
:description="
|
|
540
|
+
flat.rows.length
|
|
541
|
+
? $t(
|
|
542
|
+
'dms_lang.matrix.no_match_description',
|
|
543
|
+
{ count: formatCount(flat.rows.length) },
|
|
544
|
+
flat.rows.length,
|
|
545
|
+
)
|
|
546
|
+
: $t('dms_lang.matrix.no_keys_description')
|
|
547
|
+
"
|
|
548
|
+
:actions="[
|
|
549
|
+
...(flat.rows.length
|
|
550
|
+
? [
|
|
551
|
+
{
|
|
552
|
+
label: $t(
|
|
553
|
+
'dms_lang.matrix.show_all',
|
|
554
|
+
{ count: formatCount(flat.rows.length) },
|
|
555
|
+
flat.rows.length,
|
|
556
|
+
),
|
|
557
|
+
color: 'neutral',
|
|
558
|
+
variant: 'outline',
|
|
559
|
+
onClick: resetFilters,
|
|
560
|
+
},
|
|
561
|
+
]
|
|
562
|
+
: []),
|
|
563
|
+
...(canManageKeys
|
|
564
|
+
? [
|
|
565
|
+
{
|
|
566
|
+
label: filters.search
|
|
567
|
+
? $t('dms_lang.matrix.add_named', { key: filters.search })
|
|
568
|
+
: $t('dms_lang.key_add.title'),
|
|
569
|
+
icon: 'i-ph-plus',
|
|
570
|
+
color: 'neutral',
|
|
571
|
+
variant: 'ghost',
|
|
572
|
+
onClick: () => addKey(),
|
|
573
|
+
},
|
|
574
|
+
]
|
|
575
|
+
: []),
|
|
576
|
+
]"
|
|
577
|
+
/>
|
|
578
|
+
|
|
579
|
+
<div v-else-if="isCompact && compactColumn">
|
|
580
|
+
<template v-for="group in view.rendered.value" :key="group.namespace">
|
|
581
|
+
<div class="border-default border-b bg-(--dms-bg-muted) px-4 py-2">
|
|
582
|
+
<MatrixGroupHeader
|
|
583
|
+
:namespace="group.namespace"
|
|
584
|
+
:keys="group.keys"
|
|
585
|
+
:missing="group.missing"
|
|
586
|
+
:collapsed="group.collapsed"
|
|
587
|
+
@toggle="view.toggle(group.namespace)"
|
|
588
|
+
/>
|
|
589
|
+
</div>
|
|
590
|
+
<div
|
|
591
|
+
v-for="row in group.shown"
|
|
592
|
+
:key="row.key"
|
|
593
|
+
class="border-default group/row space-y-2 border-b px-4 py-3"
|
|
594
|
+
:data-editing="
|
|
595
|
+
editor.isEditing(row.key, compactColumn.code) || undefined
|
|
596
|
+
"
|
|
597
|
+
>
|
|
598
|
+
<MatrixKeyCell
|
|
599
|
+
:row-key="row.key"
|
|
600
|
+
:is-done="isRowFinished(row)"
|
|
601
|
+
:is-modules="isModules"
|
|
602
|
+
:is-overridden="row.overridden === true"
|
|
603
|
+
:can-override="serverEditable"
|
|
604
|
+
@open="editor.openKey(row.key, compactColumn.code)"
|
|
605
|
+
@override="overrideKey(row)"
|
|
606
|
+
/>
|
|
607
|
+
<p
|
|
608
|
+
v-if="
|
|
609
|
+
!compactColumn.isBase &&
|
|
610
|
+
!editor.isEditing(row.key, compactColumn.code)
|
|
611
|
+
"
|
|
612
|
+
class="text-dimmed line-clamp-3 text-xs"
|
|
613
|
+
>
|
|
614
|
+
<PlaceholderText :text="rowValue(row, flat.defaultLocale)" />
|
|
615
|
+
</p>
|
|
616
|
+
<MatrixCell
|
|
617
|
+
v-bind="cellProps(row, compactColumn)"
|
|
618
|
+
@edit="editor.startEdit"
|
|
619
|
+
@commit="editor.commitCell"
|
|
620
|
+
@cancel="editor.cancelEdit"
|
|
621
|
+
@retry="editor.retryCell"
|
|
622
|
+
@discard="discardCell"
|
|
623
|
+
@escape="editor.escapeFailure"
|
|
624
|
+
@open-panel="editor.openFromCell"
|
|
625
|
+
@review="reviewCell"
|
|
626
|
+
@draft="editor.trackDraft"
|
|
627
|
+
/>
|
|
628
|
+
</div>
|
|
629
|
+
</template>
|
|
630
|
+
<div v-if="view.hasMore.value" ref="sentinel" class="h-8" />
|
|
631
|
+
</div>
|
|
632
|
+
|
|
633
|
+
<div v-else ref="scroller" class="max-h-[70vh] overflow-auto">
|
|
634
|
+
<table
|
|
635
|
+
role="grid"
|
|
636
|
+
:aria-rowcount="rows.length"
|
|
637
|
+
class="w-full table-fixed border-separate border-spacing-0 text-sm"
|
|
638
|
+
:style="{ minWidth: tableMinWidth }"
|
|
639
|
+
@keydown="onGridKeydown"
|
|
640
|
+
>
|
|
641
|
+
<colgroup>
|
|
642
|
+
<col class="w-44 sm:w-64" />
|
|
643
|
+
<col
|
|
644
|
+
v-for="column in columns"
|
|
645
|
+
:key="column.code"
|
|
646
|
+
:class="todoLanguage ? 'w-[28rem]' : 'w-60'"
|
|
647
|
+
/>
|
|
648
|
+
</colgroup>
|
|
649
|
+
<thead class="sticky top-0 z-20 bg-(--dms-surface-card)">
|
|
650
|
+
<tr>
|
|
651
|
+
<th
|
|
652
|
+
class="border-default sticky left-0 z-10 border-r border-b bg-(--dms-surface-card) px-4 py-2.5 text-left shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
|
|
653
|
+
>
|
|
654
|
+
<DmsEyebrow :label="$t('dms_lang.matrix.key')" size="xs" />
|
|
655
|
+
</th>
|
|
656
|
+
<th
|
|
657
|
+
v-for="column in columns"
|
|
658
|
+
:key="column.code"
|
|
659
|
+
class="border-default border-b border-l px-3 pt-2.5 pb-0 text-left font-normal"
|
|
660
|
+
>
|
|
661
|
+
<div class="flex items-center gap-2">
|
|
662
|
+
<LocaleTile
|
|
663
|
+
:code="column.code"
|
|
664
|
+
size="sm"
|
|
665
|
+
:is-base="column.isBase"
|
|
666
|
+
:siblings="columnSiblings"
|
|
667
|
+
/>
|
|
668
|
+
<span class="text-highlighted truncate font-medium">
|
|
669
|
+
{{ column.name }}
|
|
670
|
+
</span>
|
|
671
|
+
<DmsStatusPill
|
|
672
|
+
v-if="column.isBase"
|
|
673
|
+
dot="none"
|
|
674
|
+
tone="neutral"
|
|
675
|
+
size="sm"
|
|
676
|
+
:label="$t('dms_lang.common.base')"
|
|
677
|
+
/>
|
|
678
|
+
<span
|
|
679
|
+
v-else
|
|
680
|
+
class="text-dimmed ml-auto font-mono text-[10.5px] whitespace-nowrap"
|
|
681
|
+
>
|
|
682
|
+
{{
|
|
683
|
+
$t(
|
|
684
|
+
'dms_lang.matrix.column_missing',
|
|
685
|
+
{ count: formatCount(column.missing) },
|
|
686
|
+
column.missing,
|
|
687
|
+
)
|
|
688
|
+
}}
|
|
689
|
+
</span>
|
|
690
|
+
</div>
|
|
691
|
+
<DmsMeter
|
|
692
|
+
class="mt-2"
|
|
693
|
+
:value="column.coverage"
|
|
694
|
+
:max="100"
|
|
695
|
+
size="xs"
|
|
696
|
+
:tone="column.isBase ? 'primary' : coverageTone(column.coverage)"
|
|
697
|
+
/>
|
|
698
|
+
</th>
|
|
699
|
+
</tr>
|
|
700
|
+
</thead>
|
|
701
|
+
<tbody v-for="group in view.rendered.value" :key="group.namespace">
|
|
702
|
+
<tr>
|
|
703
|
+
<td
|
|
704
|
+
:colspan="columns.length + 1"
|
|
705
|
+
class="border-default border-b bg-(--dms-bg-muted) py-1.5"
|
|
706
|
+
>
|
|
707
|
+
<div class="sticky left-0 inline-block px-4">
|
|
708
|
+
<MatrixGroupHeader
|
|
709
|
+
:namespace="group.namespace"
|
|
710
|
+
:keys="group.keys"
|
|
711
|
+
:missing="group.missing"
|
|
712
|
+
:collapsed="group.collapsed"
|
|
713
|
+
@toggle="view.toggle(group.namespace)"
|
|
714
|
+
/>
|
|
715
|
+
</div>
|
|
716
|
+
</td>
|
|
717
|
+
</tr>
|
|
718
|
+
<tr
|
|
719
|
+
v-for="row in group.shown"
|
|
720
|
+
:key="row.key"
|
|
721
|
+
class="group/row align-top"
|
|
722
|
+
>
|
|
723
|
+
<td
|
|
724
|
+
class="border-default group-hover/row:bg-elevated/30 sticky left-0 z-10 border-r border-b bg-(--dms-surface-card) px-4 py-2.5 shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
|
|
725
|
+
>
|
|
726
|
+
<MatrixKeyCell
|
|
727
|
+
:row-key="row.key"
|
|
728
|
+
:is-done="isRowFinished(row)"
|
|
729
|
+
:is-modules="isModules"
|
|
730
|
+
:is-overridden="row.overridden === true"
|
|
731
|
+
:can-override="serverEditable"
|
|
732
|
+
@open="editor.openKey(row.key)"
|
|
733
|
+
@override="overrideKey(row)"
|
|
734
|
+
/>
|
|
735
|
+
</td>
|
|
736
|
+
<td
|
|
737
|
+
v-for="(column, columnIndex) in columns"
|
|
738
|
+
:key="column.code"
|
|
739
|
+
:data-row="rowIndex.get(row.key)"
|
|
740
|
+
:data-col="columnIndex"
|
|
741
|
+
:data-editing="editor.isEditing(row.key, column.code) || undefined"
|
|
742
|
+
class="border-default group-hover/row:bg-elevated/30 border-b border-l px-1.5 py-1"
|
|
743
|
+
>
|
|
744
|
+
<MatrixCell
|
|
745
|
+
v-bind="cellProps(row, column)"
|
|
746
|
+
@edit="editor.startEdit"
|
|
747
|
+
@commit="editor.commitCell"
|
|
748
|
+
@cancel="editor.cancelEdit"
|
|
749
|
+
@retry="editor.retryCell"
|
|
750
|
+
@discard="discardCell"
|
|
751
|
+
@escape="editor.escapeFailure"
|
|
752
|
+
@open-panel="editor.openFromCell"
|
|
753
|
+
@review="reviewCell"
|
|
754
|
+
@draft="editor.trackDraft"
|
|
755
|
+
/>
|
|
756
|
+
</td>
|
|
757
|
+
</tr>
|
|
758
|
+
</tbody>
|
|
759
|
+
</table>
|
|
760
|
+
<div v-if="view.hasMore.value" ref="sentinel" class="h-8" />
|
|
761
|
+
</div>
|
|
762
|
+
|
|
763
|
+
<div
|
|
764
|
+
v-if="isLoaded"
|
|
765
|
+
class="border-default text-dimmed flex flex-wrap items-center gap-x-4 gap-y-1 border-t px-4 py-2 text-xs"
|
|
766
|
+
>
|
|
767
|
+
<span>
|
|
768
|
+
{{
|
|
769
|
+
$t(
|
|
770
|
+
'dms_lang.matrix.footer_keys',
|
|
771
|
+
{ count: formatCount(counts.missing) },
|
|
772
|
+
counts.missing,
|
|
773
|
+
)
|
|
774
|
+
}}
|
|
775
|
+
·
|
|
776
|
+
{{
|
|
777
|
+
$t(
|
|
778
|
+
'dms_lang.matrix.footer_cells',
|
|
779
|
+
{ count: formatCount(counts.cells), languages: countedLabel },
|
|
780
|
+
counts.cells,
|
|
781
|
+
)
|
|
782
|
+
}}
|
|
783
|
+
</span>
|
|
784
|
+
<span
|
|
785
|
+
v-if="canEditValues && !isCompact"
|
|
786
|
+
class="ml-auto inline-flex flex-wrap items-center gap-3"
|
|
787
|
+
>
|
|
788
|
+
<span class="inline-flex items-center gap-1">
|
|
789
|
+
<ShortcutKbds :keys="MATRIX_KEYS.saveDown" />
|
|
790
|
+
{{ $t('dms_lang.matrix.shortcut_save_down') }}
|
|
791
|
+
</span>
|
|
792
|
+
<span class="inline-flex items-center gap-1">
|
|
793
|
+
<ShortcutKbds :keys="MATRIX_KEYS.nextCell" />
|
|
794
|
+
{{ $t('dms_lang.matrix.shortcut_next_cell') }}
|
|
795
|
+
</span>
|
|
796
|
+
<span class="inline-flex items-center gap-1">
|
|
797
|
+
<ShortcutKbds :keys="MATRIX_KEYS.nextMissing" />
|
|
798
|
+
/
|
|
799
|
+
<ShortcutKbds :keys="MATRIX_KEYS.previousMissing" />
|
|
800
|
+
{{ $t('dms_lang.matrix.shortcut_next_missing') }}
|
|
801
|
+
</span>
|
|
802
|
+
<span class="inline-flex items-center gap-1">
|
|
803
|
+
<ShortcutKbds :keys="MATRIX_KEYS.openPanel" />
|
|
804
|
+
{{ $t('dms_lang.matrix.open_panel') }}
|
|
805
|
+
</span>
|
|
806
|
+
</span>
|
|
807
|
+
</div>
|
|
808
|
+
</DmsCard>
|
|
809
|
+
</template>
|