このコミットが含まれているのは:
@@ -78,9 +78,7 @@ const nested: Partial<Record<CountColumn, CountField[]>> = {
|
||||
{ key: 'kind', label: 'counts:columns.kind' },
|
||||
{ key: 'name', label: 'history:name' },
|
||||
{ key: 'category', label: 'common:categoryLabel' },
|
||||
{ key: 'sections', label: 'counts:columns.sections', children: [
|
||||
{ key: 'beginMs', label: 'counts:columns.begin' },
|
||||
{ key: 'endMs', label: 'counts:columns.end' }] },
|
||||
{ key: 'sections', label: 'counts:columns.sections' },
|
||||
{ key: 'names', label: 'counts:columns.names', children: nameFields }],
|
||||
names: nameFields,
|
||||
aliases: [{ key: 'languageCode', label: 'counts:columns.language' }, ...aliasFields],
|
||||
@@ -173,7 +171,7 @@ export const normaliseCountsParams = (
|
||||
|
||||
export const countsRequestParams = (params: URLSearchParams): URLSearchParams => {
|
||||
const result = new URLSearchParams (params)
|
||||
for (const key of ['columns', 'children', 'child_sort'])
|
||||
for (const key of ['columns', 'children', 'child_sort', 'nested_json'])
|
||||
result.delete (key)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export const countsCellText = (
|
||||
case 'resource_id': return String (row.resourceId)
|
||||
case 'version_no': return String (row.versionNo)
|
||||
case 'is_latest':
|
||||
return translateUIMessage (`boolean.${row.isLatest}`, 'counts', locale).text
|
||||
return row.isLatest ? translateUIMessage ('latestValue', 'counts', locale).text : ''
|
||||
case 'title': return row.title ?? ''
|
||||
case 'url': return row.url ?? ''
|
||||
case 'thumbnail':
|
||||
@@ -68,6 +68,20 @@ export const countsCSVCell = (
|
||||
}
|
||||
|
||||
|
||||
const countsSectionRanges = (value: unknown, locale: LocaleCode): string[] | null => {
|
||||
if (!Array.isArray (value)) return null
|
||||
const time = (ms: number): string => {
|
||||
const parts = msToTime (ms).split (':')
|
||||
if (parts.length === 2) parts[0] = parts[0].padStart (2, '0')
|
||||
return parts.join (':')
|
||||
}
|
||||
return value.map ((section: { beginMs: number; endMs: number | null }) =>
|
||||
translateUIMessage ('sections.range', 'counts', locale, {
|
||||
begin: time (section.beginMs),
|
||||
end: section.endMs == null ? '' : time (section.endMs) }).text)
|
||||
}
|
||||
|
||||
|
||||
const displayNames = new Map<string, Intl.DisplayNames> ()
|
||||
|
||||
|
||||
@@ -78,6 +92,9 @@ export const countsLogicalName = (
|
||||
): { text: string; language?: string } => {
|
||||
const value = row[field]
|
||||
if (value == null) return { text: '' }
|
||||
if (field === 'sections')
|
||||
return { text: (countsSectionRanges (value, locale) ?? []).join (
|
||||
translateUIMessage ('sections.separator', 'counts', locale).text) }
|
||||
const code = String (value)
|
||||
if (field === 'languageCode' || field === 'scriptCode')
|
||||
{
|
||||
@@ -106,7 +123,6 @@ export const countsLogicalName = (
|
||||
: `common:categories.${code}`, 'counts', locale)
|
||||
if (typeof value === 'boolean')
|
||||
return translateUIMessage (`boolean.${value}`, 'counts', locale)
|
||||
if (field === 'beginMs' || field === 'endMs') return { text: msToTime (Number (value)) }
|
||||
return { text: String (value) }
|
||||
}
|
||||
|
||||
@@ -130,15 +146,16 @@ export const countsNestedExport = (
|
||||
): unknown => {
|
||||
const selected = selectedCountChildren (params)
|
||||
const columns = fields.filter (field => selected.has (`${path}.${field.key}`))
|
||||
if (columns.length === 0)
|
||||
return { [translateUIMessage ('common:countLabel', 'counts', locale).text]: rows.length }
|
||||
if (columns.length === 0) return rows.map (() => ({ }))
|
||||
return countsNestedOrder (rows, path, params, locale).map (row =>
|
||||
Object.fromEntries (columns.map (field => [
|
||||
translateUIMessage (field.label, 'counts', locale).text,
|
||||
field.children
|
||||
? countsNestedExport (row[field.key] as CountRecord[] ?? [], field.children,
|
||||
`${path}.${field.key}`, params, locale)
|
||||
: countsLogicalName (row, field.key, locale).text])))
|
||||
: (field.key === 'sections'
|
||||
? countsSectionRanges (row[field.key], locale)
|
||||
: countsLogicalName (row, field.key, locale).text)])))
|
||||
}
|
||||
|
||||
|
||||
@@ -168,10 +185,14 @@ export const countsCellCopy = (
|
||||
field: CountField,
|
||||
params: URLSearchParams,
|
||||
locale: LocaleCode,
|
||||
): string => field.children
|
||||
? countsNestedText (row[field.key as keyof CountsVersion] as CountRecord[] ?? [],
|
||||
field.children, field.key, params, locale)
|
||||
: countsCellText (row, field.key as CountColumn, locale)
|
||||
): string => {
|
||||
if (field.children == null) return countsCellText (row, field.key as CountColumn, locale)
|
||||
const rows = row[field.key as keyof CountsVersion] as CountRecord[] ?? []
|
||||
return params.get ('nested_json') === '1'
|
||||
? JSON.stringify (
|
||||
countsNestedExport (rows, field.children, field.key, params, locale), null, 2)
|
||||
: countsNestedText (rows, field.children, field.key, params, locale)
|
||||
}
|
||||
|
||||
|
||||
// Historical URLs are displayed without fetching current attachments or metadata.
|
||||
|
||||
@@ -9,7 +9,7 @@ export const defaultCountWidths: Record<string, number> = {
|
||||
video_ms: 120, original_created_at: 260, original_created_from: 240,
|
||||
original_created_before: 240, name: 240, names: 480, category: 180,
|
||||
aliases: 360, deprecated: 240, user: 200, created_at: 240, group: 240, count: 160,
|
||||
id: 88, versionNo: 88, kind: 140, sections: 240, beginMs: 120, endMs: 120,
|
||||
id: 88, versionNo: 88, kind: 140, sections: 260,
|
||||
languageCode: 180, scriptCode: 200, autoGenerated: 120 }
|
||||
|
||||
type Layout = {
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする