@routevn/creator-model 1.6.3 → 1.6.4
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/package.json +1 -1
- package/src/model.js +97 -3
package/package.json
CHANGED
package/src/model.js
CHANGED
|
@@ -347,6 +347,7 @@ const LAYOUT_TYPE_KEYS = [
|
|
|
347
347
|
"dialogue-nvl",
|
|
348
348
|
"choice",
|
|
349
349
|
"history",
|
|
350
|
+
"input",
|
|
350
351
|
];
|
|
351
352
|
const LAYOUT_ELEMENT_TEXT_STYLE_ALIGN_KEYS = ["left", "center", "right"];
|
|
352
353
|
const LAYOUT_TEXT_REVEAL_EFFECT_KEYS = ["typewriter", "softWipe", "none"];
|
|
@@ -371,6 +372,7 @@ const LAYOUT_ELEMENT_BASE_TYPES = [
|
|
|
371
372
|
"spritesheet-animation",
|
|
372
373
|
"text",
|
|
373
374
|
"text-revealing",
|
|
375
|
+
"input",
|
|
374
376
|
"slider",
|
|
375
377
|
"text-ref-character-name",
|
|
376
378
|
"text-revealing-ref-dialogue-content",
|
|
@@ -3447,6 +3449,13 @@ const validateLayoutElementData = ({
|
|
|
3447
3449
|
"textStyleId",
|
|
3448
3450
|
"hoverTextStyleId",
|
|
3449
3451
|
"clickTextStyleId",
|
|
3452
|
+
"field",
|
|
3453
|
+
"value",
|
|
3454
|
+
"placeholder",
|
|
3455
|
+
"multiline",
|
|
3456
|
+
"disabled",
|
|
3457
|
+
"maxLength",
|
|
3458
|
+
"padding",
|
|
3450
3459
|
"conditionalOverrides",
|
|
3451
3460
|
"direction",
|
|
3452
3461
|
"gapX",
|
|
@@ -3458,6 +3467,13 @@ const validateLayoutElementData = ({
|
|
|
3458
3467
|
"rightClick",
|
|
3459
3468
|
"scrollUp",
|
|
3460
3469
|
"scrollDown",
|
|
3470
|
+
"submit",
|
|
3471
|
+
"focusEvent",
|
|
3472
|
+
"blurEvent",
|
|
3473
|
+
"selectionChange",
|
|
3474
|
+
"compositionStart",
|
|
3475
|
+
"compositionUpdate",
|
|
3476
|
+
"compositionEnd",
|
|
3461
3477
|
"anchorToBottom",
|
|
3462
3478
|
"thumbImageId",
|
|
3463
3479
|
"barImageId",
|
|
@@ -3525,6 +3541,7 @@ const validateLayoutElementData = ({
|
|
|
3525
3541
|
"step",
|
|
3526
3542
|
"paginationSize",
|
|
3527
3543
|
"opacity",
|
|
3544
|
+
"maxLength",
|
|
3528
3545
|
]) {
|
|
3529
3546
|
if (data[key] !== undefined && !isFiniteNumber(data[key])) {
|
|
3530
3547
|
return invalidFromErrorFactory(
|
|
@@ -3598,6 +3615,9 @@ const validateLayoutElementData = ({
|
|
|
3598
3615
|
"textStyleId",
|
|
3599
3616
|
"hoverTextStyleId",
|
|
3600
3617
|
"clickTextStyleId",
|
|
3618
|
+
"field",
|
|
3619
|
+
"value",
|
|
3620
|
+
"placeholder",
|
|
3601
3621
|
"containerType",
|
|
3602
3622
|
"variableId",
|
|
3603
3623
|
"fragmentLayoutId",
|
|
@@ -3652,6 +3672,18 @@ const validateLayoutElementData = ({
|
|
|
3652
3672
|
}
|
|
3653
3673
|
}
|
|
3654
3674
|
|
|
3675
|
+
if (data.type === "input") {
|
|
3676
|
+
if (
|
|
3677
|
+
(!allowPartial || data.field !== undefined) &&
|
|
3678
|
+
!isNonEmptyString(data.field)
|
|
3679
|
+
) {
|
|
3680
|
+
return invalidFromErrorFactory(
|
|
3681
|
+
errorFactory,
|
|
3682
|
+
`${path}.field must be a non-empty string`,
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3655
3687
|
if (data.conditionalOverrides !== undefined) {
|
|
3656
3688
|
if (!Array.isArray(data.conditionalOverrides)) {
|
|
3657
3689
|
return invalidFromErrorFactory(
|
|
@@ -3953,6 +3985,27 @@ const validateLayoutElementData = ({
|
|
|
3953
3985
|
}
|
|
3954
3986
|
}
|
|
3955
3987
|
|
|
3988
|
+
for (const key of [
|
|
3989
|
+
"submit",
|
|
3990
|
+
"focusEvent",
|
|
3991
|
+
"blurEvent",
|
|
3992
|
+
"selectionChange",
|
|
3993
|
+
"compositionStart",
|
|
3994
|
+
"compositionUpdate",
|
|
3995
|
+
"compositionEnd",
|
|
3996
|
+
]) {
|
|
3997
|
+
if (data[key] !== undefined) {
|
|
3998
|
+
const result = validateLayoutElementInteraction({
|
|
3999
|
+
interaction: data[key],
|
|
4000
|
+
path: `${path}.${key}`,
|
|
4001
|
+
errorFactory,
|
|
4002
|
+
});
|
|
4003
|
+
if (result?.valid === false) {
|
|
4004
|
+
return result;
|
|
4005
|
+
}
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
|
|
3956
4009
|
if (
|
|
3957
4010
|
data.anchorToBottom !== undefined &&
|
|
3958
4011
|
typeof data.anchorToBottom !== "boolean"
|
|
@@ -3963,6 +4016,33 @@ const validateLayoutElementData = ({
|
|
|
3963
4016
|
);
|
|
3964
4017
|
}
|
|
3965
4018
|
|
|
4019
|
+
for (const key of ["multiline", "disabled"]) {
|
|
4020
|
+
if (data[key] !== undefined && typeof data[key] !== "boolean") {
|
|
4021
|
+
return invalidFromErrorFactory(
|
|
4022
|
+
errorFactory,
|
|
4023
|
+
`${path}.${key} must be a boolean when provided`,
|
|
4024
|
+
);
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
|
|
4028
|
+
if (data.maxLength !== undefined && data.maxLength < 0) {
|
|
4029
|
+
return invalidFromErrorFactory(
|
|
4030
|
+
errorFactory,
|
|
4031
|
+
`${path}.maxLength must be a finite number greater than or equal to 0 when provided`,
|
|
4032
|
+
);
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
if (
|
|
4036
|
+
data.padding !== undefined &&
|
|
4037
|
+
!isFiniteNumber(data.padding) &&
|
|
4038
|
+
!isPlainObject(data.padding)
|
|
4039
|
+
) {
|
|
4040
|
+
return invalidFromErrorFactory(
|
|
4041
|
+
errorFactory,
|
|
4042
|
+
`${path}.padding must be a finite number or object when provided`,
|
|
4043
|
+
);
|
|
4044
|
+
}
|
|
4045
|
+
|
|
3966
4046
|
if (data.textStyle !== undefined) {
|
|
3967
4047
|
{
|
|
3968
4048
|
const result = validateLayoutElementTextStyle({
|
|
@@ -4044,6 +4124,13 @@ const validateLayoutElementItems = ({ items, path, errorFactory }) => {
|
|
|
4044
4124
|
"textStyleId",
|
|
4045
4125
|
"hoverTextStyleId",
|
|
4046
4126
|
"clickTextStyleId",
|
|
4127
|
+
"field",
|
|
4128
|
+
"value",
|
|
4129
|
+
"placeholder",
|
|
4130
|
+
"multiline",
|
|
4131
|
+
"disabled",
|
|
4132
|
+
"maxLength",
|
|
4133
|
+
"padding",
|
|
4047
4134
|
"conditionalOverrides",
|
|
4048
4135
|
"direction",
|
|
4049
4136
|
"gapX",
|
|
@@ -4055,6 +4142,13 @@ const validateLayoutElementItems = ({ items, path, errorFactory }) => {
|
|
|
4055
4142
|
"rightClick",
|
|
4056
4143
|
"scrollUp",
|
|
4057
4144
|
"scrollDown",
|
|
4145
|
+
"submit",
|
|
4146
|
+
"focusEvent",
|
|
4147
|
+
"blurEvent",
|
|
4148
|
+
"selectionChange",
|
|
4149
|
+
"compositionStart",
|
|
4150
|
+
"compositionUpdate",
|
|
4151
|
+
"compositionEnd",
|
|
4058
4152
|
"anchorToBottom",
|
|
4059
4153
|
"thumbImageId",
|
|
4060
4154
|
"barImageId",
|
|
@@ -5257,7 +5351,7 @@ const validateLayoutItems = ({ items, path, errorFactory }) => {
|
|
|
5257
5351
|
if (!LAYOUT_TYPE_KEYS.includes(item.layoutType)) {
|
|
5258
5352
|
return invalidFromErrorFactory(
|
|
5259
5353
|
errorFactory,
|
|
5260
|
-
`${itemPath}.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', or '
|
|
5354
|
+
`${itemPath}.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', 'history', or 'input'`,
|
|
5261
5355
|
);
|
|
5262
5356
|
}
|
|
5263
5357
|
|
|
@@ -10776,7 +10870,7 @@ const validateLayoutCreateData = ({ data, errorFactory }) => {
|
|
|
10776
10870
|
if (!LAYOUT_TYPE_KEYS.includes(data.layoutType)) {
|
|
10777
10871
|
return invalidFromErrorFactory(
|
|
10778
10872
|
errorFactory,
|
|
10779
|
-
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', or '
|
|
10873
|
+
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', 'history', or 'input'",
|
|
10780
10874
|
);
|
|
10781
10875
|
}
|
|
10782
10876
|
|
|
@@ -10892,7 +10986,7 @@ const validateLayoutUpdateData = ({ data, errorFactory }) => {
|
|
|
10892
10986
|
) {
|
|
10893
10987
|
return invalidFromErrorFactory(
|
|
10894
10988
|
errorFactory,
|
|
10895
|
-
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', or '
|
|
10989
|
+
"payload.data.layoutType must be 'general', 'save-load', 'confirmDialog', 'dialogue-adv', 'dialogue-nvl', 'choice', 'history', or 'input' when provided",
|
|
10896
10990
|
);
|
|
10897
10991
|
}
|
|
10898
10992
|
|