@nakamura-123/pages 1.3.13 → 1.3.14
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/dist/quiz/common/MyTextqqyy.d.ts +1 -0
- package/dist/quiz/common/MyTextqqyy.js +46 -4
- package/dist/quiz/explain/ExplainBox.d.ts +8 -0
- package/dist/quiz/explain/ExplainBox.js +82 -0
- package/dist/quiz/explain/ExplainLogic.d.ts +14 -0
- package/dist/quiz/explain/ExplainLogic.js +62 -1
- package/dist/quiz/explain/ExplainTable.d.ts +6 -0
- package/dist/quiz/explain/ExplainTable.js +50 -0
- package/dist/quiz/explain/NormalExplain.js +52 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -11,12 +11,14 @@ const react_redux_2 = require("react-redux");
|
|
|
11
11
|
const common_1 = require("@nakamura-123/common");
|
|
12
12
|
const lib_1 = require("@nakamura-123/lib");
|
|
13
13
|
const react_native_animatable_1 = require("react-native-animatable");
|
|
14
|
-
const MyTextqqyy = ({ children, style, isNotSearch, fsize, selectable, }) => {
|
|
14
|
+
const MyTextqqyy = ({ children, style, isNotSearch, fsize, selectable, weight, }) => {
|
|
15
15
|
const dispatch = (0, react_redux_2.useDispatch)();
|
|
16
16
|
let fontSize = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fsize);
|
|
17
17
|
let fontWeigth = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fWeight);
|
|
18
18
|
if (fsize)
|
|
19
19
|
fontSize = fsize;
|
|
20
|
+
if (weight)
|
|
21
|
+
fontWeigth = weight;
|
|
20
22
|
const parsedText = parseText(children, isNotSearch !== null && isNotSearch !== void 0 ? isNotSearch : false);
|
|
21
23
|
return (<common_1.MyText style={Object.assign(Object.assign({}, styles.p), style)} selectable={selectable}>
|
|
22
24
|
{parsedText.map((item) => renderText(item, (word) => lib_1.utilFnc.handleSearch(word), fontSize, fontWeigth, dispatch))}
|
|
@@ -25,7 +27,7 @@ const MyTextqqyy = ({ children, style, isNotSearch, fsize, selectable, }) => {
|
|
|
25
27
|
exports.default = MyTextqqyy;
|
|
26
28
|
// 01_まず、文章をqqとyyで分割したうえで、オブジェクトを作る関数を作成します。
|
|
27
29
|
const parseText = (text, isNotSearch) => {
|
|
28
|
-
const parts = text.split(/(qq.*?qq|yy.*?yy|JJ.*?JJ|JB.*?BJ|ZZ[AB]ZZ|XX.*?XX)/g);
|
|
30
|
+
const parts = text.split(/(qq.*?qq|yy.*?yy|JJ.*?JJ|JB.*?BJ|ZZ[AB]ZZ|XX.*?XX|udl\[.*?\])/g);
|
|
29
31
|
return parts.map((chunk, index) => {
|
|
30
32
|
// 共通処理: 前後の識別子を取り除くヘルパー
|
|
31
33
|
const extractContent = (identifier) => chunk.slice(identifier.length, -identifier.length);
|
|
@@ -54,6 +56,13 @@ const parseText = (text, isNotSearch) => {
|
|
|
54
56
|
// f.穴埋め問題の答え
|
|
55
57
|
if (chunk.startsWith("XX") && chunk.endsWith("XX"))
|
|
56
58
|
return { type: "blankAns", content: extractContent("XX"), key: index };
|
|
59
|
+
// g.強調(JLPTのudl[]と同じ書き方)。中の検索語の印は外す
|
|
60
|
+
if (chunk.startsWith("udl[") && chunk.endsWith("]"))
|
|
61
|
+
return {
|
|
62
|
+
type: "udl",
|
|
63
|
+
content: chunk.slice(4, -1).replace(/yy/g, ""),
|
|
64
|
+
key: index,
|
|
65
|
+
};
|
|
57
66
|
// z.検索の無い、普通の文字
|
|
58
67
|
return { type: "text", content: chunk, key: index };
|
|
59
68
|
});
|
|
@@ -64,7 +73,7 @@ const renderText = (item, onSearch, fsize, fWeight, dispatch) => {
|
|
|
64
73
|
const multiAnsElement = (color) => {
|
|
65
74
|
const content = item.content || "";
|
|
66
75
|
if (content.startsWith("qq") && content.endsWith("qq"))
|
|
67
|
-
return (<MathView math={content.slice(2, -2)} key={item.key} color={lib_1.colors[color]}/>);
|
|
76
|
+
return (<MathView math={content.slice(2, -2)} key={item.key} color={lib_1.colors[color]} config={mathConfigs[fsize]}/>);
|
|
68
77
|
const text = content.replace(/yy/g, "");
|
|
69
78
|
return (<common_1.MyText key={item.key} fsize={fsize} weight={fWeight} color={color} onPress={() => onSearch(text)}>
|
|
70
79
|
{text}
|
|
@@ -72,7 +81,7 @@ const renderText = (item, onSearch, fsize, fWeight, dispatch) => {
|
|
|
72
81
|
};
|
|
73
82
|
// ここからが、02の各タイプに応じたレンダリング処理です。
|
|
74
83
|
const renderContentByType = {
|
|
75
|
-
math: <MathView math={item.content} key={item.key}
|
|
84
|
+
math: (<MathView math={item.content} key={item.key} config={mathConfigs[fsize]}/>),
|
|
76
85
|
search: (<common_1.MyText key={item.key} style={styles.searchText} onPress={() => onSearch(item.content || "")} fsize={fsize} weight={fWeight} color="ltBlack">
|
|
77
86
|
{item.content}
|
|
78
87
|
</common_1.MyText>),
|
|
@@ -88,13 +97,46 @@ const renderText = (item, onSearch, fsize, fWeight, dispatch) => {
|
|
|
88
97
|
{item.content}
|
|
89
98
|
</common_1.MyText>
|
|
90
99
|
</common_1.PressAnimatedWrap>),
|
|
100
|
+
// 検索語(yy)の黒い下線と見分けるため、赤い太めの線を文字の下に敷く
|
|
101
|
+
udl: (<react_native_animatable_1.View key={item.key} style={udlStyles[fsize].box}>
|
|
102
|
+
<common_1.MyText fsize={fsize} weight={fWeight}>
|
|
103
|
+
{item.content}
|
|
104
|
+
</common_1.MyText>
|
|
105
|
+
<react_native_animatable_1.View style={[styles.udlLine, udlStyles[fsize].line]}/>
|
|
106
|
+
</react_native_animatable_1.View>),
|
|
91
107
|
text: (<common_1.MyText key={item.key} fsize={fsize} weight={fWeight}>
|
|
92
108
|
{item.content}
|
|
93
109
|
</common_1.MyText>),
|
|
94
110
|
};
|
|
95
111
|
return renderContentByType[item.type] || renderContentByType.text;
|
|
96
112
|
};
|
|
113
|
+
// 数式を文字サイズの設定に合わせる。em の既定は16pxで、これが md(15px)のときの今の大きさ。
|
|
114
|
+
// 同じ設定ならエンジンを使い回すので、設定ごとに1つずつ固定で持つ
|
|
115
|
+
const mathConfigs = Object.fromEntries(lib_1.infoFontSize.map(({ size, fsize }) => [
|
|
116
|
+
size,
|
|
117
|
+
{ em: fsize + 1, ex: (fsize + 1) / 2 },
|
|
118
|
+
]));
|
|
119
|
+
// 文の中に置いた View は下端が基準線にそろう。高さを文字のままにすると、中の文字がフォントの下の余白
|
|
120
|
+
// (descent)の分だけ浮き、行も押し広げられる。箱は基準線より上の分(ZenKakuGothicNew の
|
|
121
|
+
// ascent は 1160/1000em)に切り詰め、文字の下の余白ははみ出させる。
|
|
122
|
+
// 線は箱の下端に付けると縮んだ箱に合わせて文字の真ん中に来るので、上端からの位置で決める。
|
|
123
|
+
// 1.65em - 5px はシミュレータで文字に重ならない位置を見て決めた
|
|
124
|
+
const udlStyles = Object.fromEntries(lib_1.infoFontSize.map(({ size, fsize }) => [
|
|
125
|
+
size,
|
|
126
|
+
{
|
|
127
|
+
box: { height: fsize * 1.16, overflow: "visible" },
|
|
128
|
+
line: { top: fsize * 1.65 - 5 },
|
|
129
|
+
},
|
|
130
|
+
]));
|
|
97
131
|
const styles = react_native_1.StyleSheet.create({
|
|
132
|
+
udlLine: {
|
|
133
|
+
position: "absolute",
|
|
134
|
+
left: 0,
|
|
135
|
+
right: 0,
|
|
136
|
+
height: 3,
|
|
137
|
+
borderRadius: 3,
|
|
138
|
+
backgroundColor: "rgba(234,122,83,0.7)", // colors.red を 0.7 の透明度で
|
|
139
|
+
},
|
|
98
140
|
p: {
|
|
99
141
|
margin: 5,
|
|
100
142
|
},
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const react_native_1 = require("react-native");
|
|
31
|
+
const react_native_collapsible_1 = __importDefault(require("react-native-collapsible"));
|
|
32
|
+
const react_redux_1 = require("react-redux");
|
|
33
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
34
|
+
const common_1 = require("@nakamura-123/common");
|
|
35
|
+
// ポイントは開いたまま、用語の説明は閉じて置く(知っている人は飛ばせるように)
|
|
36
|
+
const ExplainBox = ({ type, title, children }) => {
|
|
37
|
+
const [collapsed, setCollapsed] = (0, react_1.useState)(type === "term");
|
|
38
|
+
const fsize = (0, react_redux_1.useSelector)((state) => state.quizCfg.inQuizOption.fsize);
|
|
39
|
+
// 題は押して開くための見出しなので、検索語の印(yy)は外して出す
|
|
40
|
+
const label = title.replace(/yy/g, "");
|
|
41
|
+
if (type === "point")
|
|
42
|
+
return (<react_native_1.View style={styles.box}>
|
|
43
|
+
<common_1.MyText fsize="sm" weight={700} color="gray" style={styles.title}>
|
|
44
|
+
{label || "ポイント"}
|
|
45
|
+
</common_1.MyText>
|
|
46
|
+
{children}
|
|
47
|
+
</react_native_1.View>);
|
|
48
|
+
return (<react_native_1.View style={styles.box}>
|
|
49
|
+
<react_native_1.TouchableOpacity style={styles.termHead} onPress={() => setCollapsed(!collapsed)}>
|
|
50
|
+
<common_1.MyText fsize={fsize} weight={700} style={styles.termTitle}>
|
|
51
|
+
【{label}】
|
|
52
|
+
</common_1.MyText>
|
|
53
|
+
<common_1.MyText fsize="sm" color="gray">
|
|
54
|
+
{collapsed ? "開く ▼" : "閉じる ▲"}
|
|
55
|
+
</common_1.MyText>
|
|
56
|
+
</react_native_1.TouchableOpacity>
|
|
57
|
+
<react_native_collapsible_1.default collapsed={collapsed}>{children}</react_native_collapsible_1.default>
|
|
58
|
+
</react_native_1.View>);
|
|
59
|
+
};
|
|
60
|
+
const styles = react_native_1.StyleSheet.create({
|
|
61
|
+
box: {
|
|
62
|
+
borderWidth: 2,
|
|
63
|
+
borderColor: lib_1.colors.blue,
|
|
64
|
+
borderRadius: 6,
|
|
65
|
+
padding: 6,
|
|
66
|
+
marginVertical: 8,
|
|
67
|
+
},
|
|
68
|
+
title: {
|
|
69
|
+
marginHorizontal: 5,
|
|
70
|
+
},
|
|
71
|
+
termHead: {
|
|
72
|
+
flexDirection: "row",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
justifyContent: "space-between",
|
|
75
|
+
paddingHorizontal: 5,
|
|
76
|
+
paddingVertical: 4,
|
|
77
|
+
},
|
|
78
|
+
termTitle: {
|
|
79
|
+
flex: 1,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
exports.default = ExplainBox;
|
|
@@ -14,4 +14,18 @@ type ExplainDataMovieImg = {
|
|
|
14
14
|
};
|
|
15
15
|
type ExplainData = ExplainDataNormal | ExplainDataMovieImg;
|
|
16
16
|
export declare const getExplainDatas: (word: string, Q: Store.DQInStore) => ExplainData;
|
|
17
|
+
export type ExplainBlock = {
|
|
18
|
+
kind: "line";
|
|
19
|
+
word: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "table";
|
|
22
|
+
rows: string[][];
|
|
23
|
+
} | {
|
|
24
|
+
kind: "box";
|
|
25
|
+
type: "point" | "term";
|
|
26
|
+
title: string;
|
|
27
|
+
lines: string[];
|
|
28
|
+
};
|
|
29
|
+
export declare const groupExplainLines: (lines: string[]) => ExplainBlock[];
|
|
30
|
+
export declare const getHeading: (word: string) => string | null;
|
|
17
31
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExplainDatas = void 0;
|
|
3
|
+
exports.getHeading = exports.groupExplainLines = exports.getExplainDatas = void 0;
|
|
4
4
|
const getExplainDatas = (word, Q) => {
|
|
5
5
|
const { yearId, num, form } = Q;
|
|
6
6
|
if (word.startsWith("lmn"))
|
|
@@ -46,3 +46,64 @@ const extractNumber = (input) => {
|
|
|
46
46
|
const match = input.match(/\d+/);
|
|
47
47
|
return match ? parseInt(match[0], 10) : null;
|
|
48
48
|
};
|
|
49
|
+
const BLOCK_START = /^<<(表|ポイント|用語)(?:\s+(.+))?$/;
|
|
50
|
+
const BLOCK_END = ">>";
|
|
51
|
+
// 形が崩れた囲み(閉じ忘れ・入れ子・題の無い用語)はまとめず、目印を文字のまま出す。
|
|
52
|
+
// 壊れていることが画面で見えるようにするため(取り込みの検査でも止める)
|
|
53
|
+
const groupExplainLines = (lines) => {
|
|
54
|
+
const blocks = [];
|
|
55
|
+
let i = 0;
|
|
56
|
+
while (i < lines.length) {
|
|
57
|
+
const block = readBlock(lines, i);
|
|
58
|
+
if (block) {
|
|
59
|
+
blocks.push(block.block);
|
|
60
|
+
i = block.next;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
blocks.push({ kind: "line", word: lines[i] });
|
|
64
|
+
i++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return blocks;
|
|
68
|
+
};
|
|
69
|
+
exports.groupExplainLines = groupExplainLines;
|
|
70
|
+
const readBlock = (lines, start) => {
|
|
71
|
+
const head = lines[start].trim().match(BLOCK_START);
|
|
72
|
+
if (!head)
|
|
73
|
+
return null;
|
|
74
|
+
const [, type, title = ""] = head;
|
|
75
|
+
if (type === "用語" && !title)
|
|
76
|
+
return null;
|
|
77
|
+
const end = lines.findIndex((line, i) => i > start && line.trim() === BLOCK_END);
|
|
78
|
+
if (end === -1)
|
|
79
|
+
return null;
|
|
80
|
+
const inner = lines.slice(start + 1, end);
|
|
81
|
+
if (inner.length === 0 ||
|
|
82
|
+
inner.some((line) => BLOCK_START.test(line.trim())))
|
|
83
|
+
return null;
|
|
84
|
+
const next = end + 1;
|
|
85
|
+
if (type === "表")
|
|
86
|
+
return { block: { kind: "table", rows: inner.map(splitCells) }, next };
|
|
87
|
+
return {
|
|
88
|
+
block: {
|
|
89
|
+
kind: "box",
|
|
90
|
+
type: type === "用語" ? "term" : "point",
|
|
91
|
+
title: title.trim(),
|
|
92
|
+
lines: inner,
|
|
93
|
+
},
|
|
94
|
+
next,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
// 行の両端の | は省いてもよい(`|a|b|` と `a|b` を同じに扱う)
|
|
98
|
+
const splitCells = (line) => {
|
|
99
|
+
const cells = line.split("|").map((cell) => cell.trim());
|
|
100
|
+
if (cells.length > 1 && cells[0] === "")
|
|
101
|
+
cells.shift();
|
|
102
|
+
if (cells.length > 1 && cells[cells.length - 1] === "")
|
|
103
|
+
cells.pop();
|
|
104
|
+
return cells;
|
|
105
|
+
};
|
|
106
|
+
// 要素全体が【…】だけなら見出し
|
|
107
|
+
const HEADING = /^【([^【】]+)】$/;
|
|
108
|
+
const getHeading = (word) => { var _a, _b; return (_b = (_a = word.trim().match(HEADING)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : null; };
|
|
109
|
+
exports.getHeading = getHeading;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const lib_1 = require("@nakamura-123/lib");
|
|
9
|
+
const MyTextqqyy_1 = __importDefault(require("../common/MyTextqqyy"));
|
|
10
|
+
// 問題の画面は横スワイプで次の問題へ移るため、横スクロールにせずセルの中で折り返す
|
|
11
|
+
const ExplainTable = ({ rows }) => {
|
|
12
|
+
const columns = Math.max(...rows.map((cells) => cells.length));
|
|
13
|
+
return (<react_native_1.View style={styles.table}>
|
|
14
|
+
{rows.map((cells, r) => (<react_native_1.View key={r} style={[styles.row, r === 0 && styles.headRow]}>
|
|
15
|
+
{Array.from({ length: columns }, (_, c) => {
|
|
16
|
+
var _a;
|
|
17
|
+
return (<react_native_1.View key={c} style={[styles.cell, c === columns - 1 && styles.lastCell]}>
|
|
18
|
+
<MyTextqqyy_1.default weight={r === 0 ? 700 : undefined}>
|
|
19
|
+
{(_a = cells[c]) !== null && _a !== void 0 ? _a : ""}
|
|
20
|
+
</MyTextqqyy_1.default>
|
|
21
|
+
</react_native_1.View>);
|
|
22
|
+
})}
|
|
23
|
+
</react_native_1.View>))}
|
|
24
|
+
</react_native_1.View>);
|
|
25
|
+
};
|
|
26
|
+
const styles = react_native_1.StyleSheet.create({
|
|
27
|
+
table: {
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
borderColor: lib_1.colors.ltBlack,
|
|
30
|
+
borderBottomWidth: 0,
|
|
31
|
+
marginVertical: 8,
|
|
32
|
+
},
|
|
33
|
+
row: {
|
|
34
|
+
flexDirection: "row",
|
|
35
|
+
borderBottomWidth: 1,
|
|
36
|
+
borderColor: lib_1.colors.ltBlack,
|
|
37
|
+
},
|
|
38
|
+
headRow: {
|
|
39
|
+
backgroundColor: lib_1.colors.light,
|
|
40
|
+
},
|
|
41
|
+
cell: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
borderRightWidth: 1,
|
|
44
|
+
borderColor: lib_1.colors.ltBlack,
|
|
45
|
+
},
|
|
46
|
+
lastCell: {
|
|
47
|
+
borderRightWidth: 0,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
exports.default = ExplainTable;
|
|
@@ -11,6 +11,8 @@ const common_1 = require("@nakamura-123/common");
|
|
|
11
11
|
const RenderImgOrText_1 = __importDefault(require("../common/RenderImgOrText"));
|
|
12
12
|
const quizHook_1 = require("../../hooks/quizHook");
|
|
13
13
|
const ExplainLogic_1 = require("./ExplainLogic");
|
|
14
|
+
const ExplainTable_1 = __importDefault(require("./ExplainTable"));
|
|
15
|
+
const ExplainBox_1 = __importDefault(require("./ExplainBox"));
|
|
14
16
|
const ZoomableImage_1 = __importDefault(require("../common/ZoomableImage"));
|
|
15
17
|
const MyTextqqyy_1 = __importDefault(require("../common/MyTextqqyy"));
|
|
16
18
|
const MovieBtn_1 = __importDefault(require("./MovieBtn"));
|
|
@@ -24,46 +26,61 @@ const NormalExplain = ({ navigation }) => {
|
|
|
24
26
|
const { yearId, explain } = question;
|
|
25
27
|
if (!explain)
|
|
26
28
|
return null;
|
|
27
|
-
const explainInfos = explain.map((word) => {
|
|
28
|
-
return (0, ExplainLogic_1.getExplainDatas)(word, question);
|
|
29
|
-
});
|
|
30
29
|
const formIsInput = question.form === "input";
|
|
31
30
|
// 解説がない場合
|
|
32
|
-
if (
|
|
31
|
+
if (explain.length === 0)
|
|
33
32
|
return (<react_native_1.View style={styles.container}>
|
|
34
33
|
<MyTextqqyy_1.default>
|
|
35
34
|
こちらの問題の解説は掲載しておりません。過去問題集やWEBサイトなどでご確認ください。
|
|
36
35
|
</MyTextqqyy_1.default>
|
|
37
36
|
</react_native_1.View>);
|
|
38
37
|
const marginBottom = getMarginBottom(fsize);
|
|
38
|
+
// 問題が変わったら、用語の枠の開閉を持ち越さない
|
|
39
|
+
const keyBase = `${yearId}-${question.num}`;
|
|
40
|
+
const renderLine = (word, index) => {
|
|
41
|
+
const I = (0, ExplainLogic_1.getExplainDatas)(word, question);
|
|
42
|
+
const color = I.color && !I.word.startsWith("/") ? I.color : "ltBeige";
|
|
43
|
+
if (I.viewType === "base") {
|
|
44
|
+
const heading = I.color ? null : (0, ExplainLogic_1.getHeading)(I.word);
|
|
45
|
+
if (heading)
|
|
46
|
+
return (<react_native_1.View style={[styles.heading, { marginBottom }]} key={index}>
|
|
47
|
+
<MyTextqqyy_1.default weight={700}>{heading}</MyTextqqyy_1.default>
|
|
48
|
+
</react_native_1.View>);
|
|
49
|
+
const mt20 = I.color === "light" ? 25 : 0;
|
|
50
|
+
return (<react_native_1.View style={{
|
|
51
|
+
backgroundColor: lib_1.colors[color],
|
|
52
|
+
marginBottom,
|
|
53
|
+
marginTop: mt20,
|
|
54
|
+
}} key={index}>
|
|
55
|
+
<RenderImgOrText_1.default word={I.word} imgKey={"a" + yearId} navigation={navigation}/>
|
|
56
|
+
</react_native_1.View>);
|
|
57
|
+
}
|
|
58
|
+
if (I.viewType === "copy") {
|
|
59
|
+
return (<react_native_1.View style={{ backgroundColor: lib_1.colors[color], marginBottom }} key={index}>
|
|
60
|
+
<RenderImgOrText_1.default word={I.word} imgKey={"a" + yearId} navigation={navigation} selectable={true}/>
|
|
61
|
+
</react_native_1.View>);
|
|
62
|
+
}
|
|
63
|
+
if (I.viewType === "rImg") {
|
|
64
|
+
const path = lib_1.utilFnc.getrImgPath(rImgs, I.word);
|
|
65
|
+
return (<ZoomableImage_1.default key={index} path={path} navigation={navigation} maxHeightValue={1000}/>);
|
|
66
|
+
}
|
|
67
|
+
if (I.viewType === "mImg") {
|
|
68
|
+
const pathes = lib_1.utilFnc.getmImgPathes(mImgs, I.yearId, I.num);
|
|
69
|
+
return (<MovieBtn_1.default key={index} pathes={pathes} word={I.word} navigation={navigation} index={Number(index)}/>);
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
39
73
|
// 解説表示
|
|
40
74
|
return (<react_native_1.View style={styles.container}>
|
|
41
75
|
{/* 解説表示 */}
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}} key={index}>
|
|
51
|
-
<RenderImgOrText_1.default word={I.word} imgKey={"a" + yearId} navigation={navigation}/>
|
|
52
|
-
</react_native_1.View>);
|
|
53
|
-
}
|
|
54
|
-
if (I.viewType === "copy") {
|
|
55
|
-
return (<react_native_1.View style={{ backgroundColor: lib_1.colors[color], marginBottom }} key={index}>
|
|
56
|
-
<RenderImgOrText_1.default word={I.word} imgKey={"a" + yearId} navigation={navigation} selectable={true}/>
|
|
57
|
-
</react_native_1.View>);
|
|
58
|
-
}
|
|
59
|
-
if (I.viewType === "rImg") {
|
|
60
|
-
const path = lib_1.utilFnc.getrImgPath(rImgs, I.word);
|
|
61
|
-
return (<ZoomableImage_1.default key={index} path={path} navigation={navigation} maxHeightValue={1000}/>);
|
|
62
|
-
}
|
|
63
|
-
if (I.viewType === "mImg") {
|
|
64
|
-
const pathes = lib_1.utilFnc.getmImgPathes(mImgs, I.yearId, I.num);
|
|
65
|
-
return (<MovieBtn_1.default key={index} pathes={pathes} word={I.word} navigation={navigation} index={index}/>);
|
|
66
|
-
}
|
|
76
|
+
{(0, ExplainLogic_1.groupExplainLines)(explain).map((block, index) => {
|
|
77
|
+
if (block.kind === "line")
|
|
78
|
+
return renderLine(block.word, index);
|
|
79
|
+
if (block.kind === "table")
|
|
80
|
+
return <ExplainTable_1.default key={index} rows={block.rows}/>;
|
|
81
|
+
return (<ExplainBox_1.default key={`${keyBase}-${index}`} type={block.type} title={block.title}>
|
|
82
|
+
{block.lines.map((word, j) => renderLine(word, `${index}-${j}`))}
|
|
83
|
+
</ExplainBox_1.default>);
|
|
67
84
|
})}
|
|
68
85
|
{formIsInput && (<common_1.MyText fsize="sm" color="red" style={{ alignSelf: "flex-end" }}>
|
|
69
86
|
※記入例は長押しでコピーできます。
|
|
@@ -80,6 +97,12 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
80
97
|
imgRectangle: {
|
|
81
98
|
marginTop: 10,
|
|
82
99
|
},
|
|
100
|
+
heading: {
|
|
101
|
+
borderLeftWidth: 4,
|
|
102
|
+
borderLeftColor: lib_1.colors.red,
|
|
103
|
+
paddingLeft: 4,
|
|
104
|
+
marginTop: 10,
|
|
105
|
+
},
|
|
83
106
|
});
|
|
84
107
|
const getMarginBottom = (fsize) => {
|
|
85
108
|
switch (fsize) {
|