mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-22 12:03:25 -04:00
(grammar) allow empty cells in grammar table
This commit is contained in:
parent
acddb91946
commit
f22148ceff
@ -16,6 +16,9 @@ const expandVariantsForSection = (sectionVariants: SectionDefinition['variants']
|
|||||||
if (Array.isArray(sectionVariants)) {
|
if (Array.isArray(sectionVariants)) {
|
||||||
return sectionVariants.map((sectionVariant) => {
|
return sectionVariants.map((sectionVariant) => {
|
||||||
const morphemeCells = sectionVariant.morphemeCells.map((morphemeCell) => {
|
const morphemeCells = sectionVariant.morphemeCells.map((morphemeCell) => {
|
||||||
|
if (morphemeCell === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (typeof morphemeCell === 'string') {
|
if (typeof morphemeCell === 'string') {
|
||||||
return { morpheme: morphemeCell };
|
return { morpheme: morphemeCell };
|
||||||
}
|
}
|
||||||
@ -43,7 +46,8 @@ const buildVariantsForSection = (
|
|||||||
): Variant[] => {
|
): Variant[] => {
|
||||||
return expandVariantsForSection(sectionVariants).filter((variant) => {
|
return expandVariantsForSection(sectionVariants).filter((variant) => {
|
||||||
return variant.morphemeCells.some((morphemeCell) => {
|
return variant.morphemeCells.some((morphemeCell) => {
|
||||||
return props.exampleValues.morphemeValues.getSpelling(morphemeCell.morpheme) !== undefined;
|
return morphemeCell !== null &&
|
||||||
|
props.exampleValues.morphemeValues.getSpelling(morphemeCell.morpheme) !== undefined;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -125,8 +129,9 @@ const rowHeaderCount = computed(() => {
|
|||||||
</th>
|
</th>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<td v-for="morphemeCell in variant.morphemeCells" :key="morphemeCell.morpheme">
|
<td v-for="(morphemeCell, index) in variant.morphemeCells" :key="index">
|
||||||
<MorphemeWithPronunciation
|
<MorphemeWithPronunciation
|
||||||
|
v-if="morphemeCell !== null"
|
||||||
:morpheme="morphemeCell.morpheme"
|
:morpheme="morphemeCell.morpheme"
|
||||||
:example-values
|
:example-values
|
||||||
:prefix="morphemeCell.prefix"
|
:prefix="morphemeCell.prefix"
|
||||||
|
@ -20,6 +20,47 @@ pronouns:
|
|||||||
- 'plural_indefinite_article'
|
- 'plural_indefinite_article'
|
||||||
- 'inflection_c'
|
- 'inflection_c'
|
||||||
- 'possessive'
|
- 'possessive'
|
||||||
|
grammarTables:
|
||||||
|
-
|
||||||
|
columnHeader:
|
||||||
|
-
|
||||||
|
name: 'Pronombre'
|
||||||
|
-
|
||||||
|
name: 'Pr. de objeto directo'
|
||||||
|
-
|
||||||
|
name: 'Artículo determinado'
|
||||||
|
-
|
||||||
|
name: 'Artículo indeterminado'
|
||||||
|
-
|
||||||
|
name: 'Flexión'
|
||||||
|
sections:
|
||||||
|
-
|
||||||
|
header:
|
||||||
|
name: 'Singular'
|
||||||
|
variants:
|
||||||
|
-
|
||||||
|
morphemeCells:
|
||||||
|
- 'pronoun'
|
||||||
|
- 'de_pronoun'
|
||||||
|
- 'definite_article'
|
||||||
|
- 'indefinite_article'
|
||||||
|
-
|
||||||
|
morpheme: 'inflection'
|
||||||
|
prefix: '-'
|
||||||
|
-
|
||||||
|
header:
|
||||||
|
name: 'Plural'
|
||||||
|
variants:
|
||||||
|
-
|
||||||
|
morphemeCells:
|
||||||
|
- 'plural_pronoun'
|
||||||
|
- ~
|
||||||
|
- 'plural_definite_article'
|
||||||
|
- 'plural_indefinite_article'
|
||||||
|
-
|
||||||
|
morpheme: 'inflection'
|
||||||
|
prefix: '-'
|
||||||
|
suffix: 's'
|
||||||
route: 'pronomes'
|
route: 'pronomes'
|
||||||
any: 'any'
|
any: 'any'
|
||||||
plurals: false
|
plurals: false
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section>
|
|
||||||
<h2 class="h4">
|
|
||||||
<Icon v="spell-check" />
|
|
||||||
<T>pronouns.grammarTable</T><T>quotation.colon</T>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-sm">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Pronombre</th>
|
|
||||||
<th>Pr. de objeto directo</th>
|
|
||||||
<th>Artículo determinado</th>
|
|
||||||
<th>Artículo indeterminado</th>
|
|
||||||
<th>Flexión</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th>Singular</th>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="pronoun" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="direct_object_pronoun" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="definite_article" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="indefinite_article" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="inflection" :counter="counter" prepend="-" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Plural</th>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_pronoun" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_direct_object_pronoun" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_definite_article" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_indefinite_article" :counter="counter" /></td>
|
|
||||||
<td><PronounsMorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="inflection" :counter="counter" prepend="-" append="s" /></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
props: {
|
|
||||||
selectedPronoun: { required: true },
|
|
||||||
counter: { required: true },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
@ -20,7 +20,7 @@ export interface SectionDefinition {
|
|||||||
|
|
||||||
export interface VariantDefinition {
|
export interface VariantDefinition {
|
||||||
name?: string;
|
name?: string;
|
||||||
morphemeCells: (string | MorphemeCellDefinition)[];
|
morphemeCells: (string | MorphemeCellDefinition | null)[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VariantsFromBaseDefinition {
|
export interface VariantsFromBaseDefinition {
|
||||||
@ -41,7 +41,7 @@ export interface Variant {
|
|||||||
name?: string;
|
name?: string;
|
||||||
numerus?: 'singular' | 'plural';
|
numerus?: 'singular' | 'plural';
|
||||||
icon?: string;
|
icon?: string;
|
||||||
morphemeCells: MorphemeCell[];
|
morphemeCells: (MorphemeCell | null)[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MorphemeCell {
|
export interface MorphemeCell {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user