import React from "react";
import * as std from "../../law/std";
import { assertNever } from "../../util";
import { withKey } from "../common";
import type { DOCXComponentProps } from "../common/docx/component";
import { DOCXMargin, wrapDOCXComponent } from "../common/docx/component";
import { w } from "../common/docx/tags";
import TextBoxRun from "../common/docx/TextBoxRun";
import type { HTMLComponentProps } from "../common/html";
import { elProps, HTMLMarginSpan, wrapHTMLComponent } from "../common/html";
import { DOCXSentenceChildrenRun, HTMLSentenceChildrenRun } from "./sentenceChildrenRun";
import { DOCXTable, HTMLTable } from "./table";
interface ColumnsOrSentencesRunProps {
els: (std.Sentence | std.Column | std.Table)[],
}
export const HTMLColumnsOrSentencesRunCSS = /*css*/`
`;
export const HTMLColumnsOrSentencesRun = wrapHTMLComponent("HTMLColumnsOrSentencesRun", ((props: HTMLComponentProps & ColumnsOrSentencesRunProps) => {
const { els, htmlOptions } = props;
const runs: React.JSX.Element[] = [];
for (let i = 0; i < els.length; i++) {
const el = els[i];
if (std.isSentence(el)) {
runs.push();
} else if (std.isColumn(el)) {
if (i !== 0) {
runs.push();
}
const subruns: React.JSX.Element[] = [];
for (let j = 0; j < el.children.length; j++) {
const subel = el.children[j];
subruns.push();
}
runs.push({withKey(subruns)});
} else if (std.isTable(el)) {
runs.push((
));
}
else { assertNever(el); }
}
return <>
{withKey(runs)}
>;
}));
export const DOCXColumnsOrSentencesRun = wrapDOCXComponent("DOCXColumnsOrSentencesRun", ((props: DOCXComponentProps & ColumnsOrSentencesRunProps) => {
const { els, docxOptions } = props;
const runs: React.JSX.Element[] = [];
for (let i = 0; i < els.length; i++) {
const el = els[i];
if (std.isSentence(el)) {
runs.push();
} else if (std.isColumn(el)) {
if (i !== 0) {
runs.push((
{DOCXMargin}
));
}
for (let j = 0; j < el.children.length; j++) {
const subel = el.children[j];
runs.push();
}
} else if (std.isTable(el)) {
runs.push((
));
}
else { assertNever(el); }
}
return <>
{withKey(runs)}
>;
}));