ability to show demonstratives without nouns
This commit is contained in:
parent
1a6cc6723c
commit
49f6bd7ed2
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "7.3.1",
|
||||
"version": "7.3.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pashto-inflector",
|
||||
"version": "7.3.1",
|
||||
"version": "7.3.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "7.3.1",
|
||||
"version": "7.3.2",
|
||||
"author": "lingdocs.com",
|
||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||
"homepage": "https://verbs.lingdocs.com",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lingdocs/ps-react",
|
||||
"version": "7.3.1",
|
||||
"version": "7.3.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lingdocs/ps-react",
|
||||
"version": "7.3.1",
|
||||
"version": "7.3.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formkit/auto-animate": "^1.0.0-beta.3",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/ps-react",
|
||||
"version": "7.3.1",
|
||||
"version": "7.3.2",
|
||||
"description": "Pashto inflector library module with React components",
|
||||
"main": "dist/components/library.js",
|
||||
"module": "dist/components/library.js",
|
||||
|
|
|
@ -663,6 +663,8 @@ export function NPBlock({
|
|||
np.selection.possesor &&
|
||||
!np.selection.possesor.shrunken
|
||||
);
|
||||
const demWithoutNoun =
|
||||
np.selection.demonstrative && !np.selection.demonstrative.withNoun;
|
||||
const elements = [
|
||||
...(!inside
|
||||
? [
|
||||
|
@ -676,10 +678,21 @@ export function NPBlock({
|
|||
<Demonstrative opts={opts} script={script}>
|
||||
{np.selection.demonstrative ? np.selection.demonstrative : undefined}
|
||||
</Demonstrative>,
|
||||
<div
|
||||
style={{
|
||||
opacity: demWithoutNoun ? 0.5 : 1,
|
||||
}}
|
||||
>
|
||||
<Adjectives opts={opts} script={script}>
|
||||
{np.selection.adjectives}
|
||||
</Adjectives>,
|
||||
<div className={np.selection.adjectives?.length ? "mx-1" : ""}>
|
||||
</Adjectives>
|
||||
</div>,
|
||||
<div
|
||||
style={{
|
||||
opacity: demWithoutNoun ? 0.5 : 1,
|
||||
}}
|
||||
className={np.selection.adjectives?.length ? "mx-1" : ""}
|
||||
>
|
||||
{" "}
|
||||
{flattenLengths(np.selection.ps)[0][script]}
|
||||
</div>,
|
||||
|
|
|
@ -13,7 +13,7 @@ export default function DemonstrativePicker({
|
|||
onChange({
|
||||
type: "demonstrative",
|
||||
demonstrative: d,
|
||||
hideNoun: false,
|
||||
withNoun: true,
|
||||
});
|
||||
} else {
|
||||
onChange({
|
||||
|
@ -22,7 +22,16 @@ export default function DemonstrativePicker({
|
|||
});
|
||||
}
|
||||
}
|
||||
function handleWithNounChange(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
if (demonstrative) {
|
||||
onChange({
|
||||
...demonstrative,
|
||||
withNoun: e.target.checked,
|
||||
});
|
||||
}
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<div className="d-flex flex-row justify-content-around py-1">
|
||||
<div>
|
||||
<button
|
||||
|
@ -55,5 +64,24 @@ export default function DemonstrativePicker({
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="form-check"
|
||||
style={{
|
||||
opacity: demonstrative ? 1 : 0.5,
|
||||
}}
|
||||
>
|
||||
<input
|
||||
className="form-check-input"
|
||||
type="checkbox"
|
||||
checked={demonstrative?.withNoun}
|
||||
onChange={handleWithNounChange}
|
||||
id="withNoun"
|
||||
disabled={!demonstrative}
|
||||
/>
|
||||
<label className="form-check-label text-muted" htmlFor="withNoun">
|
||||
with noun
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,12 @@ function NPNounPicker(props: {
|
|||
}
|
||||
}
|
||||
return (
|
||||
<div style={{ maxWidth: "225px", minWidth: "125px" }}>
|
||||
<div
|
||||
style={{
|
||||
maxWidth: "225px",
|
||||
minWidth: "125px",
|
||||
}}
|
||||
>
|
||||
{!addingDemonstrative && !props.noun?.demonstrative ? (
|
||||
<div>
|
||||
<span
|
||||
|
@ -143,6 +148,14 @@ function NPNounPicker(props: {
|
|||
handleChange={setPatternFilter}
|
||||
/>
|
||||
</div>} */}
|
||||
<div
|
||||
style={{
|
||||
opacity:
|
||||
props.noun?.demonstrative && !props.noun.demonstrative.withNoun
|
||||
? 0.5
|
||||
: 1,
|
||||
}}
|
||||
>
|
||||
{props.noun && (
|
||||
<AdjectiveManager
|
||||
phraseIsComplete={props.phraseIsComplete}
|
||||
|
@ -236,6 +249,7 @@ function NPNounPicker(props: {
|
|||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/inflect",
|
||||
"version": "7.3.1",
|
||||
"version": "7.3.2",
|
||||
"description": "Pashto inflector library",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/lib/library.d.ts",
|
||||
|
|
|
@ -12,16 +12,22 @@ function getBaseAndAdjectives({
|
|||
return getSandwichPsBaseAndAdjectives(selection);
|
||||
}
|
||||
const adjs = "adjectives" in selection && selection.adjectives;
|
||||
const demons = ("demonstrative" in selection &&
|
||||
const demonstrativePs = ("demonstrative" in selection &&
|
||||
selection.demonstrative?.ps) || { p: "", f: "" };
|
||||
if (!adjs) {
|
||||
// TODO: does this ever get used??
|
||||
return flattenLengths(selection.ps).map((x) => concatPsString(demons, x));
|
||||
return flattenLengths(selection.ps).map((x) =>
|
||||
concatPsString(demonstrativePs, x)
|
||||
);
|
||||
}
|
||||
|
||||
if (selection.demonstrative && !selection.demonstrative.withNoun) {
|
||||
return [demonstrativePs];
|
||||
}
|
||||
|
||||
return flattenLengths(selection.ps).map((p) =>
|
||||
concatPsString(
|
||||
demons,
|
||||
demonstrativePs,
|
||||
// demons ? " " : "",
|
||||
adjs.reduce(
|
||||
(accum, curr) => {
|
||||
|
@ -207,9 +213,10 @@ function addArticlesAndAdjs(
|
|||
: " (m.)"
|
||||
: "";
|
||||
const demonstrative = np.demonstrative ? ` ${np.demonstrative.e}` : "";
|
||||
return `${
|
||||
np.demonstrative ? "" : articles
|
||||
}${demonstrative}${adjs}${word}${genderTag}`;
|
||||
const demWithoutNoun = np.demonstrative && !np.demonstrative.withNoun;
|
||||
return `${np.demonstrative ? "" : articles}${demonstrative}${
|
||||
demWithoutNoun ? ` (${(adjs + word).trim()})` : adjs + word
|
||||
}${genderTag}`;
|
||||
} catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -905,7 +905,7 @@ export type NounSelection = {
|
|||
export type DemonstrativeSelection = {
|
||||
type: "demonstrative";
|
||||
demonstrative: "daa" | "hagha" | "dagha";
|
||||
hideNoun: boolean;
|
||||
withNoun: boolean;
|
||||
};
|
||||
|
||||
export type AdverbSelection = {
|
||||
|
@ -1024,7 +1024,7 @@ export type Rendered<
|
|||
? {
|
||||
type: "demonstrative";
|
||||
demonstrative: DemonstrativeSelection["demonstrative"];
|
||||
hideNoun: boolean;
|
||||
withNoun: boolean;
|
||||
ps: PsString;
|
||||
e: string;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue