@wg-npm/survey-core 0.5.136 → 0.5.138
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/survey-core.esm.js +16 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/question-title-utils.ts +20 -0
package/dist/survey-core.esm.js
CHANGED
|
@@ -353,10 +353,25 @@ function translate(obj, locale, prettyMath = false) {
|
|
|
353
353
|
obj["zh-TW"]);
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
function formatTitle(question, locale) {
|
|
357
|
+
const title = translate(question.header.text, locale, true);
|
|
358
|
+
if (!_.get(question, "options.richTextEnabled", false)) {
|
|
359
|
+
return [title];
|
|
360
|
+
}
|
|
361
|
+
return title.split(/_{5,}/g);
|
|
362
|
+
}
|
|
363
|
+
function showInput(index, formatTitle) {
|
|
364
|
+
if (index === formatTitle.length - 2 &&
|
|
365
|
+
formatTitle[formatTitle.length - 1] === "") {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
return index < formatTitle.length - 1;
|
|
369
|
+
}
|
|
370
|
+
|
|
356
371
|
function move(array, fromIndex, toIndex) {
|
|
357
372
|
const moveValue = array[fromIndex];
|
|
358
373
|
array[fromIndex] = array[toIndex];
|
|
359
374
|
array[toIndex] = moveValue;
|
|
360
375
|
}
|
|
361
376
|
|
|
362
|
-
export { BaseQuestionModel, ChoiceModel, EvaluationItemModel, ExprConditionModel, ExprEvaluationItemModel, PlanModel, PlanStatisticsModel, QuestionCheckBoxModel, QuestionEvaluationModel, QuestionFactory, QuestionFillBlankModel, QuestionHeaderModel, QuestionMatrixModel, QuestionMulitSelectionModel, QuestionOptionsModel, QuestionScoringModel, QuestionShortAnswerModel, QuestionSingleSelectionModel, QuestionTextTitleModel, ResponseModel, ResponseStatisticsModel, StarEvaluationItemModel, SubQuestionModel, move, translate };
|
|
377
|
+
export { BaseQuestionModel, ChoiceModel, EvaluationItemModel, ExprConditionModel, ExprEvaluationItemModel, PlanModel, PlanStatisticsModel, QuestionCheckBoxModel, QuestionEvaluationModel, QuestionFactory, QuestionFillBlankModel, QuestionHeaderModel, QuestionMatrixModel, QuestionMulitSelectionModel, QuestionOptionsModel, QuestionScoringModel, QuestionShortAnswerModel, QuestionSingleSelectionModel, QuestionTextTitleModel, ResponseModel, ResponseStatisticsModel, StarEvaluationItemModel, SubQuestionModel, formatTitle, move, showInput, translate };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { translate } from "./locale-utils";
|
|
3
|
+
|
|
4
|
+
export function formatTitle(question, locale) {
|
|
5
|
+
const title = translate(question.header.text, locale, true);
|
|
6
|
+
if (!_.get(question, "options.richTextEnabled", false)) {
|
|
7
|
+
return [title];
|
|
8
|
+
}
|
|
9
|
+
return title.split(/_{5,}/g);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function showInput(index, formatTitle) {
|
|
13
|
+
if (
|
|
14
|
+
index === formatTitle.length - 2 &&
|
|
15
|
+
formatTitle[formatTitle.length - 1] === ""
|
|
16
|
+
) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return index < formatTitle.length - 1;
|
|
20
|
+
}
|