@antelopejs/dms-lang 0.5.3 → 0.7.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 +5 -5
- package/dist/routes/translations.d.ts +14 -13
- package/dist/routes/translations.js +31 -29
- package/dist/routes/translations.js.map +1 -1
- package/dist/utils/query.d.ts +2 -0
- package/dist/utils/query.js +7 -0
- package/dist/utils/query.js.map +1 -0
- package/frontend-vue/.prettierignore +1 -0
- package/frontend-vue/.prettierrc +2 -2
- package/frontend-vue/app/build/components/KeyAddModal.vue +13 -5
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +24 -26
- package/frontend-vue/app/build/components/KeyRenameModal.vue +7 -1
- package/frontend-vue/app/build/components/KeyStatus.vue +4 -1
- package/frontend-vue/app/build/components/LanguageAddModal.vue +24 -4
- package/frontend-vue/app/build/components/LanguagePicker.vue +30 -10
- package/frontend-vue/app/build/components/LocaleTile.vue +2 -1
- package/frontend-vue/app/build/components/PlaceholderText.vue +10 -3
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +10 -1
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +23 -7
- package/frontend-vue/app/build/components/form/FormFieldRow.vue +12 -3
- package/frontend-vue/app/build/components/form/FormRows.vue +10 -2
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +2 -1
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +81 -20
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +6 -3
- package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +1 -0
- package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +2 -2
- package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +2 -1
- package/frontend-vue/app/build/components/queue/QueueActions.vue +12 -2
- package/frontend-vue/app/build/components/queue/QueueDone.vue +3 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +63 -19
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +24 -5
- package/frontend-vue/app/build/components/queue/QueueUpNext.vue +1 -1
- package/frontend-vue/app/build/composables/useCellEditor.ts +12 -2
- package/frontend-vue/app/build/composables/useCellMoves.ts +1 -0
- package/frontend-vue/app/build/composables/useCellSaves.ts +1 -0
- package/frontend-vue/app/build/composables/useKeyPanel.ts +4 -0
- package/frontend-vue/app/build/composables/useKeySaves.ts +3 -0
- package/frontend-vue/app/build/composables/useMatrixColumns.ts +78 -0
- package/frontend-vue/app/build/composables/useMatrixExport.ts +1 -0
- package/frontend-vue/app/build/composables/useMatrixFilters.ts +6 -0
- package/frontend-vue/app/build/composables/useMatrixView.ts +4 -0
- package/frontend-vue/app/build/composables/useQueueOrphans.ts +2 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +4 -0
- package/frontend-vue/app/build/drawer/KeyLanguageField.vue +37 -19
- package/frontend-vue/app/build/drawer/fieldFocus.ts +24 -0
- package/frontend-vue/app/build/matrix/MatrixDoneBanner.vue +4 -1
- package/frontend-vue/app/build/matrix/MatrixLanguageHeader.vue +36 -36
- package/frontend-vue/app/build/matrix/MatrixNoRows.vue +48 -39
- package/frontend-vue/app/components/LanguageNamespaces.vue +39 -11
- package/frontend-vue/app/components/NamespaceCoverage.vue +35 -9
- package/frontend-vue/app/components/TranslationMatrix.vue +84 -63
- package/frontend-vue/app/components/TranslationQueue.vue +25 -9
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +6 -2
- package/frontend-vue/app/components/WorkspaceGeneral.vue +34 -9
- package/frontend-vue/app/components/WorkspaceList.vue +63 -30
- package/frontend-vue/app/components/WorkspaceScope.vue +64 -31
- package/frontend-vue/app/composables/translation/useFirstRun.ts +1 -0
- package/frontend-vue/app/composables/translation/useKeyActions.ts +10 -0
- package/frontend-vue/app/composables/translation/useLangLinks.ts +1 -0
- package/frontend-vue/app/composables/translation/useLanguageActions.ts +11 -2
- package/frontend-vue/app/composables/translation/useLanguageQueue.ts +10 -0
- package/frontend-vue/app/composables/translation/useQueueDrafts.ts +4 -0
- package/frontend-vue/app/composables/translation/useQueueSession.ts +6 -0
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +6 -0
- package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +1 -0
- package/frontend-vue/app/composables/translation/useWorkspaceFill.ts +4 -0
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +11 -4
- package/frontend-vue/app/composables/translation/useWorkspaceLabel.ts +2 -0
- package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +5 -0
- package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +8 -0
- package/frontend-vue/app/utils/keySaveErrors.ts +1 -0
- package/frontend-vue/app/utils/keySaves.ts +1 -0
- package/frontend-vue/app/utils/matrixExport.ts +1 -0
- package/frontend-vue/app/utils/translations.ts +3 -3
- package/frontend-vue/app/utils/workspaceBackup.ts +1 -0
- package/frontend-vue/build/backend-boundary.ts +7 -2
- package/frontend-vue/eslint.config.mjs +20 -45
- package/frontend-vue/package.json +8 -8
- package/package.json +16 -16
|
@@ -12,41 +12,41 @@ defineProps<{
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<template>
|
|
15
|
-
<div class="flex items-center gap-2">
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
<div class="flex items-center gap-2">
|
|
16
|
+
<LocaleTile
|
|
17
|
+
:code="column.code"
|
|
18
|
+
size="sm"
|
|
19
|
+
:is-base="column.isBase"
|
|
20
|
+
:siblings="columnSiblings"
|
|
21
|
+
/>
|
|
22
|
+
<span class="text-highlighted truncate font-medium">
|
|
23
|
+
{{ column.name }}
|
|
24
|
+
</span>
|
|
25
|
+
<DmsStatusPill
|
|
26
|
+
v-if="column.isBase"
|
|
27
|
+
dot="none"
|
|
28
|
+
tone="neutral"
|
|
29
|
+
size="sm"
|
|
30
|
+
:label="$t('dms_lang.common.base')"
|
|
31
|
+
/>
|
|
32
|
+
<span
|
|
33
|
+
v-else
|
|
34
|
+
class="text-dimmed ml-auto whitespace-nowrap font-mono text-[10.5px]"
|
|
35
|
+
>
|
|
36
|
+
{{
|
|
37
|
+
$t(
|
|
38
|
+
'dms_lang.matrix.column_missing',
|
|
39
|
+
{ count: formatCount(column.missing) },
|
|
40
|
+
column.missing,
|
|
41
|
+
)
|
|
42
|
+
}}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
<DmsMeterBar
|
|
46
|
+
class="mt-2"
|
|
47
|
+
:value="column.coverage"
|
|
48
|
+
:max="100"
|
|
49
|
+
size="xs"
|
|
50
|
+
:tone="column.isBase ? 'primary' : coverageTone(column.coverage)"
|
|
21
51
|
/>
|
|
22
|
-
<span class="text-highlighted truncate font-medium">
|
|
23
|
-
{{ column.name }}
|
|
24
|
-
</span>
|
|
25
|
-
<DmsStatusPill
|
|
26
|
-
v-if="column.isBase"
|
|
27
|
-
dot="none"
|
|
28
|
-
tone="neutral"
|
|
29
|
-
size="sm"
|
|
30
|
-
:label="$t('dms_lang.common.base')"
|
|
31
|
-
/>
|
|
32
|
-
<span
|
|
33
|
-
v-else
|
|
34
|
-
class="text-dimmed ml-auto font-mono text-[10.5px] whitespace-nowrap"
|
|
35
|
-
>
|
|
36
|
-
{{
|
|
37
|
-
$t(
|
|
38
|
-
'dms_lang.matrix.column_missing',
|
|
39
|
-
{ count: formatCount(column.missing) },
|
|
40
|
-
column.missing,
|
|
41
|
-
)
|
|
42
|
-
}}
|
|
43
|
-
</span>
|
|
44
|
-
</div>
|
|
45
|
-
<DmsMeter
|
|
46
|
-
class="mt-2"
|
|
47
|
-
:value="column.coverage"
|
|
48
|
-
:max="100"
|
|
49
|
-
size="xs"
|
|
50
|
-
:tone="column.isBase ? 'primary' : coverageTone(column.coverage)"
|
|
51
|
-
/>
|
|
52
52
|
</template>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { ButtonProps } from '@nuxt/ui'
|
|
2
3
|
import type { FlatTranslations } from '../../types/lang'
|
|
3
4
|
import type { MatrixFilterState } from '../composables/useMatrixFilters'
|
|
4
5
|
|
|
@@ -6,7 +7,7 @@ import type { MatrixFilterState } from '../composables/useMatrixFilters'
|
|
|
6
7
|
* The matrix with no row to show: no key matches the filters (show them all),
|
|
7
8
|
* or the workspace has no key yet (add one).
|
|
8
9
|
*/
|
|
9
|
-
defineProps<{
|
|
10
|
+
const props = defineProps<{
|
|
10
11
|
flat: FlatTranslations
|
|
11
12
|
filters: MatrixFilterState
|
|
12
13
|
canManageKeys: boolean
|
|
@@ -14,6 +15,50 @@ defineProps<{
|
|
|
14
15
|
resetFilters: () => void
|
|
15
16
|
addKey: () => unknown
|
|
16
17
|
}>()
|
|
18
|
+
|
|
19
|
+
const { t } = useI18n()
|
|
20
|
+
|
|
21
|
+
const description = computed(() => {
|
|
22
|
+
const count = props.flat.rows.length
|
|
23
|
+
if (!count) return t('dms_lang.matrix.no_keys_description')
|
|
24
|
+
return t(
|
|
25
|
+
'dms_lang.matrix.no_match_description',
|
|
26
|
+
{ count: props.formatCount(count) },
|
|
27
|
+
count,
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const actions = computed((): ButtonProps[] => {
|
|
32
|
+
const count = props.flat.rows.length
|
|
33
|
+
const showAll: ButtonProps[] = count
|
|
34
|
+
? [
|
|
35
|
+
{
|
|
36
|
+
label: t(
|
|
37
|
+
'dms_lang.matrix.show_all',
|
|
38
|
+
{ count: props.formatCount(count) },
|
|
39
|
+
count,
|
|
40
|
+
),
|
|
41
|
+
color: 'neutral',
|
|
42
|
+
variant: 'outline',
|
|
43
|
+
onClick: props.resetFilters,
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
: []
|
|
47
|
+
const addNew: ButtonProps[] = props.canManageKeys
|
|
48
|
+
? [
|
|
49
|
+
{
|
|
50
|
+
label: props.filters.search
|
|
51
|
+
? t('dms_lang.matrix.add_named', { key: props.filters.search })
|
|
52
|
+
: t('dms_lang.key_add.title'),
|
|
53
|
+
icon: 'i-ph-plus',
|
|
54
|
+
color: 'neutral',
|
|
55
|
+
variant: 'ghost',
|
|
56
|
+
onClick: () => props.addKey(),
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
: []
|
|
60
|
+
return [...showAll, ...addNew]
|
|
61
|
+
})
|
|
17
62
|
</script>
|
|
18
63
|
|
|
19
64
|
<template>
|
|
@@ -26,43 +71,7 @@ defineProps<{
|
|
|
26
71
|
? $t('dms_lang.matrix.no_match', { search: filters.search })
|
|
27
72
|
: $t('dms_lang.matrix.no_keys')
|
|
28
73
|
"
|
|
29
|
-
:description="
|
|
30
|
-
|
|
31
|
-
? $t(
|
|
32
|
-
'dms_lang.matrix.no_match_description',
|
|
33
|
-
{ count: formatCount(flat.rows.length) },
|
|
34
|
-
flat.rows.length,
|
|
35
|
-
)
|
|
36
|
-
: $t('dms_lang.matrix.no_keys_description')
|
|
37
|
-
"
|
|
38
|
-
:actions="[
|
|
39
|
-
...(flat.rows.length
|
|
40
|
-
? [
|
|
41
|
-
{
|
|
42
|
-
label: $t(
|
|
43
|
-
'dms_lang.matrix.show_all',
|
|
44
|
-
{ count: formatCount(flat.rows.length) },
|
|
45
|
-
flat.rows.length,
|
|
46
|
-
),
|
|
47
|
-
color: 'neutral',
|
|
48
|
-
variant: 'outline',
|
|
49
|
-
onClick: resetFilters,
|
|
50
|
-
},
|
|
51
|
-
]
|
|
52
|
-
: []),
|
|
53
|
-
...(canManageKeys
|
|
54
|
-
? [
|
|
55
|
-
{
|
|
56
|
-
label: filters.search
|
|
57
|
-
? $t('dms_lang.matrix.add_named', { key: filters.search })
|
|
58
|
-
: $t('dms_lang.key_add.title'),
|
|
59
|
-
icon: 'i-ph-plus',
|
|
60
|
-
color: 'neutral',
|
|
61
|
-
variant: 'ghost',
|
|
62
|
-
onClick: () => addKey(),
|
|
63
|
-
},
|
|
64
|
-
]
|
|
65
|
-
: []),
|
|
66
|
-
]"
|
|
74
|
+
:description="description"
|
|
75
|
+
:actions="actions"
|
|
67
76
|
/>
|
|
68
77
|
</template>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useLangFormat } from '../composables/translation/useLangFormat'
|
|
3
|
+
import { useLanguageQueue } from '../composables/translation/useLanguageQueue'
|
|
4
|
+
import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
|
|
5
|
+
import {
|
|
6
|
+
useWorkspaceFlat,
|
|
7
|
+
useWorkspaceFlatSync,
|
|
8
|
+
} from '../composables/translation/useWorkspaceFlat'
|
|
3
9
|
import { coverageTone } from '../utils/coverage'
|
|
4
10
|
|
|
5
11
|
const { isLoaded } = useWorkspaceFlat()
|
|
@@ -14,12 +20,15 @@ function scope(target: string) {
|
|
|
14
20
|
</script>
|
|
15
21
|
|
|
16
22
|
<template>
|
|
17
|
-
<
|
|
23
|
+
<DmsCardPanel
|
|
18
24
|
v-if="!isUnknown && ((exists && !isBase) || !isLoaded)"
|
|
19
25
|
:padded="false"
|
|
20
26
|
:title="$t('dms_lang.language_namespaces.title')"
|
|
21
27
|
>
|
|
22
|
-
<template
|
|
28
|
+
<template
|
|
29
|
+
v-if="namespace"
|
|
30
|
+
#actions
|
|
31
|
+
>
|
|
23
32
|
<UButton
|
|
24
33
|
size="xs"
|
|
25
34
|
color="neutral"
|
|
@@ -29,11 +38,24 @@ function scope(target: string) {
|
|
|
29
38
|
@click="namespace = ''"
|
|
30
39
|
/>
|
|
31
40
|
</template>
|
|
32
|
-
<div
|
|
33
|
-
|
|
41
|
+
<div
|
|
42
|
+
v-if="!isLoaded"
|
|
43
|
+
class="space-y-2 p-4"
|
|
44
|
+
>
|
|
45
|
+
<USkeleton
|
|
46
|
+
v-for="index in 5"
|
|
47
|
+
:key="index"
|
|
48
|
+
class="h-6 w-full"
|
|
49
|
+
/>
|
|
34
50
|
</div>
|
|
35
|
-
<ul
|
|
36
|
-
|
|
51
|
+
<ul
|
|
52
|
+
v-else
|
|
53
|
+
class="divide-default divide-y"
|
|
54
|
+
>
|
|
55
|
+
<li
|
|
56
|
+
v-for="entry in namespaceProgress"
|
|
57
|
+
:key="entry.namespace"
|
|
58
|
+
>
|
|
37
59
|
<button
|
|
38
60
|
type="button"
|
|
39
61
|
class="grid w-full grid-cols-[minmax(0,1fr)_5rem_3rem_3rem] items-center gap-3 px-4 py-2.5 text-left transition-colors"
|
|
@@ -48,7 +70,7 @@ function scope(target: string) {
|
|
|
48
70
|
<span class="text-highlighted truncate font-mono text-xs">
|
|
49
71
|
{{ entry.namespace }}
|
|
50
72
|
</span>
|
|
51
|
-
<
|
|
73
|
+
<DmsMeterBar
|
|
52
74
|
:value="entry.coverage"
|
|
53
75
|
:max="100"
|
|
54
76
|
format="none"
|
|
@@ -67,11 +89,17 @@ function scope(target: string) {
|
|
|
67
89
|
</button>
|
|
68
90
|
</li>
|
|
69
91
|
</ul>
|
|
70
|
-
<template
|
|
92
|
+
<template
|
|
93
|
+
v-if="isLoaded"
|
|
94
|
+
#footer
|
|
95
|
+
>
|
|
71
96
|
<p class="text-dimmed flex items-center gap-1.5 text-xs">
|
|
72
|
-
<UIcon
|
|
97
|
+
<UIcon
|
|
98
|
+
name="i-ph-info"
|
|
99
|
+
class="size-3.5"
|
|
100
|
+
/>
|
|
73
101
|
{{ $t('dms_lang.language_namespaces.hint') }}
|
|
74
102
|
</p>
|
|
75
103
|
</template>
|
|
76
|
-
</
|
|
104
|
+
</DmsCardPanel>
|
|
77
105
|
</template>
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useFirstRun } from '../composables/translation/useFirstRun'
|
|
3
|
+
import { LANG_API } from '../composables/translation/useI18nWorkspaces'
|
|
4
|
+
import { useLangFormat } from '../composables/translation/useLangFormat'
|
|
5
|
+
import { useLangLinks } from '../composables/translation/useLangLinks'
|
|
6
|
+
import { useLocaleNames } from '../composables/translation/useLocaleNames'
|
|
7
|
+
import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
|
|
2
8
|
import UButton from '@nuxt/ui/components/Button.vue'
|
|
3
9
|
import type { NamespaceMatrix, NamespaceRow } from '../types/lang'
|
|
4
10
|
import LocaleTile from '../build/components/LocaleTile.vue'
|
|
@@ -102,7 +108,7 @@ usePageHeaderActions(() => [
|
|
|
102
108
|
</script>
|
|
103
109
|
|
|
104
110
|
<template>
|
|
105
|
-
<
|
|
111
|
+
<DmsCardPanel
|
|
106
112
|
v-if="!isUnknown && !isFirstRun"
|
|
107
113
|
:padded="false"
|
|
108
114
|
:title="$t('dms_lang.namespaces.title')"
|
|
@@ -118,8 +124,15 @@ usePageHeaderActions(() => [
|
|
|
118
124
|
/>
|
|
119
125
|
</template>
|
|
120
126
|
|
|
121
|
-
<div
|
|
122
|
-
|
|
127
|
+
<div
|
|
128
|
+
v-if="!isLoaded"
|
|
129
|
+
class="space-y-2 p-4"
|
|
130
|
+
>
|
|
131
|
+
<USkeleton
|
|
132
|
+
v-for="index in 4"
|
|
133
|
+
:key="index"
|
|
134
|
+
class="h-8 w-full"
|
|
135
|
+
/>
|
|
123
136
|
</div>
|
|
124
137
|
|
|
125
138
|
<DmsEmptyState
|
|
@@ -133,7 +146,10 @@ usePageHeaderActions(() => [
|
|
|
133
146
|
"
|
|
134
147
|
/>
|
|
135
148
|
|
|
136
|
-
<div
|
|
149
|
+
<div
|
|
150
|
+
v-else
|
|
151
|
+
class="overflow-x-auto px-4 pb-4 pt-3"
|
|
152
|
+
>
|
|
137
153
|
<div
|
|
138
154
|
class="grid items-center gap-1.5"
|
|
139
155
|
:style="{ gridTemplateColumns: gridTemplate }"
|
|
@@ -145,9 +161,16 @@ usePageHeaderActions(() => [
|
|
|
145
161
|
class="flex justify-center"
|
|
146
162
|
:title="`${nameAmong(code, targets)} · ${code}`"
|
|
147
163
|
>
|
|
148
|
-
<LocaleTile
|
|
164
|
+
<LocaleTile
|
|
165
|
+
:code="code"
|
|
166
|
+
:siblings="targets"
|
|
167
|
+
size="sm"
|
|
168
|
+
/>
|
|
149
169
|
</span>
|
|
150
|
-
<template
|
|
170
|
+
<template
|
|
171
|
+
v-for="entry in namespaces"
|
|
172
|
+
:key="entry.namespace"
|
|
173
|
+
>
|
|
151
174
|
<span class="flex min-w-0 items-baseline gap-1.5">
|
|
152
175
|
<span class="text-highlighted truncate font-mono text-xs">
|
|
153
176
|
{{ entry.namespace }}
|
|
@@ -160,7 +183,7 @@ usePageHeaderActions(() => [
|
|
|
160
183
|
v-for="code in locales"
|
|
161
184
|
:key="code"
|
|
162
185
|
:to="cellLink(entry, code)"
|
|
163
|
-
class="grid h-8 place-items-center rounded-md font-mono text-xs font-semibold ring-1 transition-opacity
|
|
186
|
+
class="grid h-8 place-items-center rounded-md font-mono text-xs font-semibold ring-1 ring-inset transition-opacity hover:opacity-80"
|
|
164
187
|
:class="HEAT_CLASSES[coverageTone(shownCoverage(entry, code))]"
|
|
165
188
|
:title="cellLabel(entry, code)"
|
|
166
189
|
:aria-label="cellLabel(entry, code)"
|
|
@@ -201,7 +224,10 @@ usePageHeaderActions(() => [
|
|
|
201
224
|
</div>
|
|
202
225
|
</div>
|
|
203
226
|
|
|
204
|
-
<template
|
|
227
|
+
<template
|
|
228
|
+
v-if="isLoaded && namespaces.length && locales.length"
|
|
229
|
+
#footer
|
|
230
|
+
>
|
|
205
231
|
<div class="text-dimmed flex flex-wrap items-center gap-3 text-xs">
|
|
206
232
|
<span class="inline-flex items-center gap-1.5">
|
|
207
233
|
<span class="bg-success size-2 rounded-sm" />
|
|
@@ -218,5 +244,5 @@ usePageHeaderActions(() => [
|
|
|
218
244
|
<span class="ml-auto">{{ $t('dms_lang.namespaces.legend') }}</span>
|
|
219
245
|
</div>
|
|
220
246
|
</template>
|
|
221
|
-
</
|
|
247
|
+
</DmsCardPanel>
|
|
222
248
|
</template>
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_WORKSPACE,
|
|
4
|
+
useI18nWorkspaces,
|
|
5
|
+
} from '../composables/translation/useI18nWorkspaces'
|
|
6
|
+
import { useKeyActions } from '../composables/translation/useKeyActions'
|
|
7
|
+
import { useLangFormat } from '../composables/translation/useLangFormat'
|
|
8
|
+
import {
|
|
9
|
+
PAGE_ACTIONS,
|
|
10
|
+
linkWithQuery,
|
|
11
|
+
useLangLinks,
|
|
12
|
+
} from '../composables/translation/useLangLinks'
|
|
13
|
+
import { useLanguageActions } from '../composables/translation/useLanguageActions'
|
|
14
|
+
import { useLocaleNames } from '../composables/translation/useLocaleNames'
|
|
15
|
+
import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
|
|
16
|
+
import { useWorkspaceRoute } from '../composables/translation/useWorkspaceRoute'
|
|
2
17
|
import type { ComponentPublicInstance } from 'vue'
|
|
3
18
|
import {
|
|
4
19
|
useActiveElement,
|
|
@@ -7,9 +22,11 @@ import {
|
|
|
7
22
|
} from '@vueuse/core'
|
|
8
23
|
import { useDmsRouter } from '#dms/frontend-module'
|
|
9
24
|
import type { FlatTranslationRow, LanguageCoverage } from '../types/lang'
|
|
10
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
useWorkspaceFlat,
|
|
27
|
+
useWorkspaceFlatSync,
|
|
28
|
+
} from '../composables/translation/useWorkspaceFlat'
|
|
11
29
|
import { stringValue } from '../utils/translations'
|
|
12
|
-
import { languageCoverage } from '../utils/coverage'
|
|
13
30
|
import PlaceholderText from '../build/components/PlaceholderText.vue'
|
|
14
31
|
import MatrixCell from '../build/components/matrix/MatrixCell.vue'
|
|
15
32
|
import MatrixColumns from '../build/components/matrix/MatrixColumns.vue'
|
|
@@ -20,10 +37,7 @@ import {
|
|
|
20
37
|
useCellSaves,
|
|
21
38
|
type CellAddress,
|
|
22
39
|
} from '../build/composables/useCellSaves'
|
|
23
|
-
import {
|
|
24
|
-
useCellEditor,
|
|
25
|
-
type CellRef,
|
|
26
|
-
} from '../build/composables/useCellEditor'
|
|
40
|
+
import { useCellEditor, type CellRef } from '../build/composables/useCellEditor'
|
|
27
41
|
import {
|
|
28
42
|
focusNeighbourCell,
|
|
29
43
|
useCellMoves,
|
|
@@ -34,6 +48,7 @@ import { useMatrixRows } from '../build/composables/useMatrixRows'
|
|
|
34
48
|
import { useMatrixView } from '../build/composables/useMatrixView'
|
|
35
49
|
import { useMatrixFilters } from '../build/composables/useMatrixFilters'
|
|
36
50
|
import { useMatrixExport } from '../build/composables/useMatrixExport'
|
|
51
|
+
import { useMatrixColumns } from '../build/composables/useMatrixColumns'
|
|
37
52
|
import MatrixDoneBanner from '../build/matrix/MatrixDoneBanner.vue'
|
|
38
53
|
import MatrixFooter from '../build/matrix/MatrixFooter.vue'
|
|
39
54
|
import MatrixLanguageHeader from '../build/matrix/MatrixLanguageHeader.vue'
|
|
@@ -43,9 +58,6 @@ import { MATRIX_KEYS, shortcutName } from '../utils/shortcuts'
|
|
|
43
58
|
const COMPACT_WIDTH = 768
|
|
44
59
|
const OPEN_OVERLAY = '[role="dialog"][data-state="open"], [role="alertdialog"]'
|
|
45
60
|
const SCROLL_MARGIN = '400px'
|
|
46
|
-
const KEY_COLUMN_REM = 16
|
|
47
|
-
const LANGUAGE_COLUMN_REM = 15
|
|
48
|
-
const TODO_COLUMN_REM = 28
|
|
49
61
|
const SKELETON_ROWS = 6
|
|
50
62
|
|
|
51
63
|
const { t } = useI18n()
|
|
@@ -91,42 +103,17 @@ const saves = useCellSaves(rowOf, (address) => {
|
|
|
91
103
|
if (address.workspace === selectedWorkspace.value) pin(address.key)
|
|
92
104
|
})
|
|
93
105
|
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
105
|
-
const todoLanguage = computed(() => {
|
|
106
|
-
const chosen = filters.value.missingIn
|
|
107
|
-
if (chosen && flat.value.locales.includes(chosen)) return chosen
|
|
108
|
-
if (!isCompact.value) return ''
|
|
109
|
-
const base = flat.value.defaultLocale
|
|
110
|
-
return order.value.find((code) => code !== base) ?? ''
|
|
111
|
-
})
|
|
112
|
-
const columnCodes = computed(() => {
|
|
113
|
-
if (!todoLanguage.value) return order.value
|
|
114
|
-
const base = flat.value.defaultLocale
|
|
115
|
-
return [base, todoLanguage.value].filter((code) =>
|
|
116
|
-
flat.value.locales.includes(code),
|
|
117
|
-
)
|
|
118
|
-
})
|
|
119
|
-
const columns = computed(() =>
|
|
120
|
-
columnCodes.value
|
|
121
|
-
.map((code) => languageByCode.value.get(code))
|
|
122
|
-
.filter((entry): entry is LanguageCoverage => Boolean(entry)),
|
|
123
|
-
)
|
|
124
|
-
const columnSiblings = computed(() => columns.value.map((entry) => entry.code))
|
|
125
|
-
const compactColumn = computed(() => columns.value.at(-1))
|
|
126
|
-
const tableMinWidth = computed(() => {
|
|
127
|
-
const column = todoLanguage.value ? TODO_COLUMN_REM : LANGUAGE_COLUMN_REM
|
|
128
|
-
return `${KEY_COLUMN_REM + columns.value.length * column}rem`
|
|
129
|
-
})
|
|
106
|
+
const {
|
|
107
|
+
languages,
|
|
108
|
+
languageByCode,
|
|
109
|
+
targetLanguages,
|
|
110
|
+
todoLanguage,
|
|
111
|
+
columnCodes,
|
|
112
|
+
columns,
|
|
113
|
+
columnSiblings,
|
|
114
|
+
compactColumn,
|
|
115
|
+
tableMinWidth,
|
|
116
|
+
} = useMatrixColumns({ flat, filters, order, isCompact, nameAmong, fullName })
|
|
130
117
|
|
|
131
118
|
const { rows, groups, counts, targets, namespaces, isRowDone } =
|
|
132
119
|
useMatrixFilters(flat, filters, pinned)
|
|
@@ -380,7 +367,12 @@ onBeforeUnmount(() => {
|
|
|
380
367
|
</script>
|
|
381
368
|
|
|
382
369
|
<template>
|
|
383
|
-
<
|
|
370
|
+
<DmsCardPanel
|
|
371
|
+
v-if="!isUnknown"
|
|
372
|
+
ref="root"
|
|
373
|
+
:padded="false"
|
|
374
|
+
class="overflow-hidden"
|
|
375
|
+
>
|
|
384
376
|
<MatrixToolbar
|
|
385
377
|
v-model:filters="filters"
|
|
386
378
|
:counts="counts"
|
|
@@ -401,8 +393,11 @@ onBeforeUnmount(() => {
|
|
|
401
393
|
/>
|
|
402
394
|
</MatrixToolbar>
|
|
403
395
|
|
|
404
|
-
<div
|
|
405
|
-
|
|
396
|
+
<div
|
|
397
|
+
v-if="isModules"
|
|
398
|
+
class="p-3"
|
|
399
|
+
>
|
|
400
|
+
<DmsNoticeBanner
|
|
406
401
|
tone="warning"
|
|
407
402
|
size="sm"
|
|
408
403
|
icon="i-ph-lock-simple"
|
|
@@ -437,7 +432,10 @@ onBeforeUnmount(() => {
|
|
|
437
432
|
]"
|
|
438
433
|
/>
|
|
439
434
|
|
|
440
|
-
<div
|
|
435
|
+
<div
|
|
436
|
+
v-else-if="!isLoaded"
|
|
437
|
+
class="divide-default divide-y"
|
|
438
|
+
>
|
|
441
439
|
<div
|
|
442
440
|
v-for="index in SKELETON_ROWS"
|
|
443
441
|
:key="index"
|
|
@@ -461,8 +459,11 @@ onBeforeUnmount(() => {
|
|
|
461
459
|
/>
|
|
462
460
|
|
|
463
461
|
<div v-else-if="isCompact && compactColumn">
|
|
464
|
-
<template
|
|
465
|
-
|
|
462
|
+
<template
|
|
463
|
+
v-for="group in view.rendered.value"
|
|
464
|
+
:key="group.namespace"
|
|
465
|
+
>
|
|
466
|
+
<div class="border-default bg-(--dms-bg-muted) border-b px-4 py-2">
|
|
466
467
|
<MatrixGroupHeader
|
|
467
468
|
:namespace="group.namespace"
|
|
468
469
|
:keys="group.keys"
|
|
@@ -511,10 +512,18 @@ onBeforeUnmount(() => {
|
|
|
511
512
|
/>
|
|
512
513
|
</div>
|
|
513
514
|
</template>
|
|
514
|
-
<div
|
|
515
|
+
<div
|
|
516
|
+
v-if="view.hasMore.value"
|
|
517
|
+
ref="sentinel"
|
|
518
|
+
class="h-8"
|
|
519
|
+
/>
|
|
515
520
|
</div>
|
|
516
521
|
|
|
517
|
-
<div
|
|
522
|
+
<div
|
|
523
|
+
v-else
|
|
524
|
+
ref="scroller"
|
|
525
|
+
class="max-h-[70vh] overflow-auto"
|
|
526
|
+
>
|
|
518
527
|
<table
|
|
519
528
|
role="grid"
|
|
520
529
|
:aria-rowcount="rows.length"
|
|
@@ -530,17 +539,20 @@ onBeforeUnmount(() => {
|
|
|
530
539
|
:class="todoLanguage ? 'w-[28rem]' : 'w-60'"
|
|
531
540
|
/>
|
|
532
541
|
</colgroup>
|
|
533
|
-
<thead class="
|
|
542
|
+
<thead class="bg-(--dms-surface-card) sticky top-0 z-20">
|
|
534
543
|
<tr>
|
|
535
544
|
<th
|
|
536
|
-
class="border-default sticky left-0 z-10 border-
|
|
545
|
+
class="border-default bg-(--dms-surface-card) sticky left-0 z-10 border-b border-r px-4 py-2.5 text-left shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
|
|
537
546
|
>
|
|
538
|
-
<
|
|
547
|
+
<DmsEyebrowLabel
|
|
548
|
+
:label="$t('dms_lang.matrix.key')"
|
|
549
|
+
size="xs"
|
|
550
|
+
/>
|
|
539
551
|
</th>
|
|
540
552
|
<th
|
|
541
553
|
v-for="column in columns"
|
|
542
554
|
:key="column.code"
|
|
543
|
-
class="border-default border-b border-l px-3 pt-2.5
|
|
555
|
+
class="border-default border-b border-l px-3 pb-0 pt-2.5 text-left font-normal"
|
|
544
556
|
>
|
|
545
557
|
<MatrixLanguageHeader
|
|
546
558
|
:column="column"
|
|
@@ -550,11 +562,14 @@ onBeforeUnmount(() => {
|
|
|
550
562
|
</th>
|
|
551
563
|
</tr>
|
|
552
564
|
</thead>
|
|
553
|
-
<tbody
|
|
565
|
+
<tbody
|
|
566
|
+
v-for="group in view.rendered.value"
|
|
567
|
+
:key="group.namespace"
|
|
568
|
+
>
|
|
554
569
|
<tr>
|
|
555
570
|
<td
|
|
556
571
|
:colspan="columns.length + 1"
|
|
557
|
-
class="border-default
|
|
572
|
+
class="border-default bg-(--dms-bg-muted) border-b py-1.5"
|
|
558
573
|
>
|
|
559
574
|
<div class="sticky left-0 inline-block px-4">
|
|
560
575
|
<MatrixGroupHeader
|
|
@@ -573,7 +588,7 @@ onBeforeUnmount(() => {
|
|
|
573
588
|
class="group/row align-top"
|
|
574
589
|
>
|
|
575
590
|
<td
|
|
576
|
-
class="border-default group-hover/row:bg-elevated/30 sticky left-0 z-10 border-
|
|
591
|
+
class="border-default group-hover/row:bg-elevated/30 bg-(--dms-surface-card) sticky left-0 z-10 border-b border-r px-4 py-2.5 shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
|
|
577
592
|
>
|
|
578
593
|
<MatrixKeyCell
|
|
579
594
|
:row-key="row.key"
|
|
@@ -590,7 +605,9 @@ onBeforeUnmount(() => {
|
|
|
590
605
|
:key="column.code"
|
|
591
606
|
:data-row="rowIndex.get(row.key)"
|
|
592
607
|
:data-col="columnIndex"
|
|
593
|
-
:data-editing="
|
|
608
|
+
:data-editing="
|
|
609
|
+
editor.isEditing(row.key, column.code) || undefined
|
|
610
|
+
"
|
|
594
611
|
class="border-default group-hover/row:bg-elevated/30 border-b border-l px-1.5 py-1"
|
|
595
612
|
>
|
|
596
613
|
<MatrixCell
|
|
@@ -609,7 +626,11 @@ onBeforeUnmount(() => {
|
|
|
609
626
|
</tr>
|
|
610
627
|
</tbody>
|
|
611
628
|
</table>
|
|
612
|
-
<div
|
|
629
|
+
<div
|
|
630
|
+
v-if="view.hasMore.value"
|
|
631
|
+
ref="sentinel"
|
|
632
|
+
class="h-8"
|
|
633
|
+
/>
|
|
613
634
|
</div>
|
|
614
635
|
|
|
615
636
|
<MatrixFooter
|
|
@@ -620,5 +641,5 @@ onBeforeUnmount(() => {
|
|
|
620
641
|
:is-compact="isCompact"
|
|
621
642
|
:format-count="formatCount"
|
|
622
643
|
/>
|
|
623
|
-
</
|
|
644
|
+
</DmsCardPanel>
|
|
624
645
|
</template>
|