@routevn/creator-model 1.10.1 → 1.10.3
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 +61 -0
package/package.json
CHANGED
package/src/model.js
CHANGED
|
@@ -353,6 +353,7 @@ const LAYOUT_TYPE_KEYS = [
|
|
|
353
353
|
];
|
|
354
354
|
const LAYOUT_ELEMENT_TEXT_STYLE_ALIGN_KEYS = ["left", "center", "right"];
|
|
355
355
|
const LAYOUT_TEXT_REVEAL_EFFECT_KEYS = ["typewriter", "softWipe", "none"];
|
|
356
|
+
const LAYOUT_TEXT_REVEAL_SOUND_STOP_TIMING_KEYS = ["loopEnd", "immediate"];
|
|
356
357
|
const LAYOUT_ELEMENT_BLUR_KERNEL_SIZE_OPTIONS = [5, 7, 9, 11, 13, 15];
|
|
357
358
|
const CONTROL_KEYBOARD_KEYS = [
|
|
358
359
|
"enter",
|
|
@@ -394,6 +395,13 @@ const LAYOUT_ELEMENT_BASE_TYPES = [
|
|
|
394
395
|
"container-ref-confirm-dialog-ok",
|
|
395
396
|
"container-ref-confirm-dialog-cancel",
|
|
396
397
|
];
|
|
398
|
+
const SAVE_LOAD_DATE_FORMATS = new Set([
|
|
399
|
+
"DD/MM/YYYY",
|
|
400
|
+
"MM/DD/YYYY",
|
|
401
|
+
"YYYY-MM-DD",
|
|
402
|
+
"DD MMM YYYY",
|
|
403
|
+
"YYYY年MM月DD日",
|
|
404
|
+
]);
|
|
397
405
|
export const SCHEMA_VERSION = 10;
|
|
398
406
|
const LAYOUT_CONTAINER_ELEMENT_TYPES = [
|
|
399
407
|
"folder",
|
|
@@ -3873,6 +3881,7 @@ const validateLayoutElementData = ({
|
|
|
3873
3881
|
"border",
|
|
3874
3882
|
"text",
|
|
3875
3883
|
"content",
|
|
3884
|
+
"dateFormat",
|
|
3876
3885
|
"textStyle",
|
|
3877
3886
|
"displaySpeed",
|
|
3878
3887
|
"revealEffect",
|
|
@@ -3885,6 +3894,7 @@ const validateLayoutElementData = ({
|
|
|
3885
3894
|
"hoverSoundId",
|
|
3886
3895
|
"clickSoundId",
|
|
3887
3896
|
"revealSoundId",
|
|
3897
|
+
"revealSoundStopTiming",
|
|
3888
3898
|
"textStyleId",
|
|
3889
3899
|
"hoverTextStyleId",
|
|
3890
3900
|
"clickTextStyleId",
|
|
@@ -3964,6 +3974,27 @@ const validateLayoutElementData = ({
|
|
|
3964
3974
|
}
|
|
3965
3975
|
}
|
|
3966
3976
|
|
|
3977
|
+
if (
|
|
3978
|
+
data.dateFormat !== undefined &&
|
|
3979
|
+
!SAVE_LOAD_DATE_FORMATS.has(data.dateFormat)
|
|
3980
|
+
) {
|
|
3981
|
+
return invalidFromErrorFactory(
|
|
3982
|
+
errorFactory,
|
|
3983
|
+
`${path}.dateFormat must be one of ${Array.from(SAVE_LOAD_DATE_FORMATS).join(", ")} when provided`,
|
|
3984
|
+
);
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3987
|
+
if (
|
|
3988
|
+
data.dateFormat !== undefined &&
|
|
3989
|
+
data.type !== undefined &&
|
|
3990
|
+
data.type !== "text-ref-save-load-slot-date"
|
|
3991
|
+
) {
|
|
3992
|
+
return invalidFromErrorFactory(
|
|
3993
|
+
errorFactory,
|
|
3994
|
+
`${path}.dateFormat can only be provided for save/load date elements`,
|
|
3995
|
+
);
|
|
3996
|
+
}
|
|
3997
|
+
|
|
3967
3998
|
if (data.hidden !== undefined && typeof data.hidden !== "boolean") {
|
|
3968
3999
|
return invalidFromErrorFactory(
|
|
3969
4000
|
errorFactory,
|
|
@@ -4120,6 +4151,7 @@ const validateLayoutElementData = ({
|
|
|
4120
4151
|
"hoverSoundId",
|
|
4121
4152
|
"clickSoundId",
|
|
4122
4153
|
"revealSoundId",
|
|
4154
|
+
"revealSoundStopTiming",
|
|
4123
4155
|
"textStyleId",
|
|
4124
4156
|
"hoverTextStyleId",
|
|
4125
4157
|
"clickTextStyleId",
|
|
@@ -4398,6 +4430,18 @@ const validateLayoutElementData = ({
|
|
|
4398
4430
|
);
|
|
4399
4431
|
}
|
|
4400
4432
|
|
|
4433
|
+
if (
|
|
4434
|
+
data.revealSoundStopTiming !== undefined &&
|
|
4435
|
+
!LAYOUT_TEXT_REVEAL_SOUND_STOP_TIMING_KEYS.includes(
|
|
4436
|
+
data.revealSoundStopTiming,
|
|
4437
|
+
)
|
|
4438
|
+
) {
|
|
4439
|
+
return invalidFromErrorFactory(
|
|
4440
|
+
errorFactory,
|
|
4441
|
+
`${path}.revealSoundStopTiming must be one of ${LAYOUT_TEXT_REVEAL_SOUND_STOP_TIMING_KEYS.join(", ")} when provided`,
|
|
4442
|
+
);
|
|
4443
|
+
}
|
|
4444
|
+
|
|
4401
4445
|
if (data.formRole !== undefined && data.formRole !== "submit") {
|
|
4402
4446
|
return invalidFromErrorFactory(
|
|
4403
4447
|
errorFactory,
|
|
@@ -4627,6 +4671,7 @@ const validateLayoutElementItems = ({ items, path, errorFactory }) => {
|
|
|
4627
4671
|
"border",
|
|
4628
4672
|
"text",
|
|
4629
4673
|
"content",
|
|
4674
|
+
"dateFormat",
|
|
4630
4675
|
"textStyle",
|
|
4631
4676
|
"displaySpeed",
|
|
4632
4677
|
"revealEffect",
|
|
@@ -4640,6 +4685,7 @@ const validateLayoutElementItems = ({ items, path, errorFactory }) => {
|
|
|
4640
4685
|
"hoverSoundId",
|
|
4641
4686
|
"clickSoundId",
|
|
4642
4687
|
"revealSoundId",
|
|
4688
|
+
"revealSoundStopTiming",
|
|
4643
4689
|
"textStyleId",
|
|
4644
4690
|
"hoverTextStyleId",
|
|
4645
4691
|
"clickTextStyleId",
|
|
@@ -12202,6 +12248,21 @@ const validateVisualElementReferenceTargets = ({
|
|
|
12202
12248
|
state,
|
|
12203
12249
|
errorFactory,
|
|
12204
12250
|
}) => {
|
|
12251
|
+
if (
|
|
12252
|
+
data.dateFormat !== undefined &&
|
|
12253
|
+
data.type !== "text-ref-save-load-slot-date"
|
|
12254
|
+
) {
|
|
12255
|
+
return invalidFromErrorFactory(
|
|
12256
|
+
errorFactory,
|
|
12257
|
+
`${ownerLabel} element dateFormat can only be provided for save/load date elements`,
|
|
12258
|
+
{
|
|
12259
|
+
[ownerIdField]: ownerId,
|
|
12260
|
+
elementId,
|
|
12261
|
+
field: "dateFormat",
|
|
12262
|
+
},
|
|
12263
|
+
);
|
|
12264
|
+
}
|
|
12265
|
+
|
|
12205
12266
|
if (data.blur !== undefined && data.type !== "sprite") {
|
|
12206
12267
|
return invalidFromErrorFactory(
|
|
12207
12268
|
errorFactory,
|