@claspo/components 1.6.2 → 1.7.0-components-build-perf
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 +6 -4
- package/script/SysButtonComponent/SysButton.manifest.js +126 -0
- package/script/SysButtonComponent/SysButton.styles.js +64 -0
- package/script/SysButtonComponent/SysButtonComponent.js +231 -0
- package/script/SysColumnComponent/SysColumn.manifest.js +17 -0
- package/script/SysColumnComponent/SysColumnComponent.js +107 -0
- package/script/SysColumnsComponent/SysColumns.manifest.js +17 -0
- package/script/SysColumnsComponent/SysColumnsComponent.js +53 -0
- package/script/SysColumnsComponent/getStyleElement.js +23 -0
- package/script/SysContainerComponent/SysBaseContainerComponent.js +41 -0
- package/script/SysContainerComponent/SysContainer.manifest.js +18 -0
- package/script/SysContainerComponent/SysContainerComponent.js +86 -0
- package/script/SysImageComponent/SysImage.manifest.js +18 -0
- package/script/SysImageComponent/SysImageComponent.js +378 -0
- package/script/SysImageComponent/getStyleElement.js +18 -0
- package/script/SysInputComponent/EmailSuggesting.js +252 -0
- package/script/SysInputComponent/InputFormControl.js +136 -0
- package/script/SysInputComponent/SysInput.manifest.js +728 -0
- package/script/SysInputComponent/SysInputComponent.js +84 -0
- package/script/SysInputComponent/emailProvidersList.js +158 -0
- package/script/SysInputComponent/getOverlayStyles.js +220 -0
- package/script/SysInputComponent/getStyleElement.js +69 -0
- package/script/SysInputComponent/inputValidators.js +293 -0
- package/script/SysTextComponent/SysText.manifest.js +29 -0
- package/script/SysTextComponent/SysTextComponent.js +147 -0
- package/script/SysTextComponent/TextRoller.js +298 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import emailProvidersList from './emailProvidersList.js';
|
|
2
|
+
|
|
3
|
+
class InputValidators {
|
|
4
|
+
|
|
5
|
+
static validationErrorKeys = {
|
|
6
|
+
NAME_CONSISTING_ONLY_OF_NUMBERS_AND_SPECIAL_CHARACTERS_IS_NOT_ALLOWED: 'NAME_CONSISTING_ONLY_OF_NUMBERS_AND_SPECIAL_CHARACTERS_IS_NOT_ALLOWED',
|
|
7
|
+
NAME_CONTAINS_MORE_THAN_3_DIGITS: 'NAME_CONTAINS_MORE_THAN_3_DIGITS',
|
|
8
|
+
MORE_THAN_THREE_LONG_WORDS: "MORE_THAN_THREE_LONG_WORDS",
|
|
9
|
+
MORE_THAN_THREE_SHORT_WORDS: 'MORE_THAN_THREE_SHORT_WORDS',
|
|
10
|
+
CONTAINS_FORBIDDEN_CHARACTERS: 'CONTAINS_FORBIDDEN_CHARACTERS',
|
|
11
|
+
EMAIL_IS_INVALID: 'EMAIL_IS_INVALID',
|
|
12
|
+
NAME_CONTAINS_FORBIDDEN_CHARACTERS: 'NAME_CONTAINS_FORBIDDEN_CHARACTERS',
|
|
13
|
+
MAX_LENGTH_50: 'MAX_LENGTH_50',
|
|
14
|
+
MAX_LENGTH_40: 'MAX_LENGTH_40',
|
|
15
|
+
NO_MORE_THAN_4_NUMBERS_ARE_ALLOWED: 'NO_MORE_THAN_4_NUMBERS_ARE_ALLOWED',
|
|
16
|
+
INTEGER_FORMAT: 'INTEGER_FORMAT',
|
|
17
|
+
MIN_VALUE_MINUS_2147483648: 'MIN_VALUE_MINUS_2147483648',
|
|
18
|
+
MAX_VALUE_2147483648: 'MAX_VALUE_2147483648',
|
|
19
|
+
FLOAT_FORMAT: 'FLOAT_FORMAT',
|
|
20
|
+
MAX_LENGTH_1000: 'MAX_LENGTH_1000',
|
|
21
|
+
LONG_NAME_WITH_DOT: 'LONG_NAME_WITH_DOT',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
static validationMap = {
|
|
25
|
+
EMAIL: InputValidators.emailValidationCb,
|
|
26
|
+
SYS_NAME: InputValidators.nameValidationCb,
|
|
27
|
+
SYS_LAST_NAME: InputValidators.lastNameValidationCb,
|
|
28
|
+
ES_TEXT: InputValidators.esTextValidationCb,
|
|
29
|
+
ES_INTEGER: InputValidators.esIntegerValidationCb,
|
|
30
|
+
ES_FLOAT: InputValidators.esFloatValidationCb,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
static emailValidationCb(value = '', props) {
|
|
34
|
+
try {
|
|
35
|
+
if (!/^[_A-Za-z0-9-\p{L}]+(\.[_A-Za-z0-9-\p{L}]+)*(\+.*)?@([A-Za-z0-9-\p{L}]+(\.[A-Za-z0-9\p{L}]+)+)+$/u.test(value)) {
|
|
36
|
+
return {
|
|
37
|
+
isValid: false,
|
|
38
|
+
errorKey: InputValidators.validationErrorKeys.EMAIL_IS_INVALID
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} catch (e) {
|
|
42
|
+
if (!/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*(\+.*)?@([A-Za-z0-9-]+(\.[A-Za-z0-9]+)+)+$/.test(value)) {
|
|
43
|
+
return {
|
|
44
|
+
isValid: false,
|
|
45
|
+
errorKey: InputValidators.validationErrorKeys.EMAIL_IS_INVALID
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (value.length > 50) {
|
|
51
|
+
return {
|
|
52
|
+
isValid: false,
|
|
53
|
+
errorKey: InputValidators.validationErrorKeys.MAX_LENGTH_50
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (
|
|
58
|
+
!props.control.validation ||
|
|
59
|
+
!props.control.validation.restrictFreeDomains
|
|
60
|
+
) {
|
|
61
|
+
return {
|
|
62
|
+
isValid: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const domainPartOfEmail = value.toLowerCase().split('@')[1];
|
|
67
|
+
|
|
68
|
+
if (emailProvidersList.includes(domainPartOfEmail)) {
|
|
69
|
+
return {
|
|
70
|
+
isValid: false,
|
|
71
|
+
errorKey: 'EMAIL_DOMAIN_INVALID'
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
isValid: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static nameValidationCb(value = '') {
|
|
81
|
+
const trimmedValue = value.trim();
|
|
82
|
+
const parts = (trimmedValue || '').split(' ');
|
|
83
|
+
|
|
84
|
+
if (parts.filter(item => item.length > 3).length > 3) {
|
|
85
|
+
return {
|
|
86
|
+
isValid: false,
|
|
87
|
+
errorKey: InputValidators.validationErrorKeys.MORE_THAN_THREE_LONG_WORDS,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (parts.filter(item => item.length <= 3).length > 3) {
|
|
92
|
+
return {
|
|
93
|
+
isValid: false,
|
|
94
|
+
errorKey: InputValidators.validationErrorKeys.MORE_THAN_THREE_SHORT_WORDS,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return InputValidators.lastNameValidator(trimmedValue) || {
|
|
99
|
+
value: trimmedValue,
|
|
100
|
+
isValid: true,
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static lastNameValidator(value) {
|
|
105
|
+
const trimmedValue = value.trim();
|
|
106
|
+
const symbols = ' .\'’ʼ`´ʹʻʽʾʿˈˊˮʹ΄՚᾽᾿‘‛′‵Ꞌꞌ'-';
|
|
107
|
+
|
|
108
|
+
if (trimmedValue.length > 40) {
|
|
109
|
+
return {
|
|
110
|
+
isValid: false,
|
|
111
|
+
errorKey: InputValidators.validationErrorKeys.MAX_LENGTH_40,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const sanitizeExceptDoubleQuotesMatchArray = InputValidators.sanitizeExceptDoubleQuotes(trimmedValue);
|
|
116
|
+
if (sanitizeExceptDoubleQuotesMatchArray && sanitizeExceptDoubleQuotesMatchArray.length) {
|
|
117
|
+
return {
|
|
118
|
+
isValid: false,
|
|
119
|
+
errorKey: InputValidators.validationErrorKeys.CONTAINS_FORBIDDEN_CHARACTERS,
|
|
120
|
+
forbiddenChar: sanitizeExceptDoubleQuotesMatchArray[0][0],
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const forbiddenCharacter = InputValidators.forbiddenCharactersValidator(trimmedValue, `[^\\d\\.\\s\\p{Alphabetic}${symbols}]`);
|
|
125
|
+
|
|
126
|
+
if (forbiddenCharacter) {
|
|
127
|
+
return {
|
|
128
|
+
isValid: false,
|
|
129
|
+
errorKey: InputValidators.validationErrorKeys.CONTAINS_FORBIDDEN_CHARACTERS,
|
|
130
|
+
forbiddenChar: forbiddenCharacter,
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (InputValidators.nameContainsDotValidator(trimmedValue)) {
|
|
135
|
+
return {
|
|
136
|
+
isValid: false,
|
|
137
|
+
errorKey: InputValidators.validationErrorKeys.LONG_NAME_WITH_DOT,
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (InputValidators.nameContainsMoreThanThreeDigitsValidator(trimmedValue)) {
|
|
142
|
+
return {
|
|
143
|
+
isValid: false,
|
|
144
|
+
errorKey: InputValidators.validationErrorKeys.NAME_CONTAINS_MORE_THAN_3_DIGITS
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (InputValidators.nameConsistingOfAlphabeticCharactersValidator(trimmedValue)) {
|
|
149
|
+
return {
|
|
150
|
+
isValid: false,
|
|
151
|
+
errorKey: InputValidators.validationErrorKeys.NAME_CONSISTING_ONLY_OF_NUMBERS_AND_SPECIAL_CHARACTERS_IS_NOT_ALLOWED
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const symbolPositionMatchArray = InputValidators.symbolPositionValidator(trimmedValue);
|
|
156
|
+
|
|
157
|
+
if (symbolPositionMatchArray && symbolPositionMatchArray.length) {
|
|
158
|
+
return {
|
|
159
|
+
isValid: false,
|
|
160
|
+
errorKey: InputValidators.validationErrorKeys.CONTAINS_FORBIDDEN_CHARACTERS,
|
|
161
|
+
forbiddenChar: symbolPositionMatchArray[0][0],
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static lastNameValidationCb(value = '') {
|
|
169
|
+
return InputValidators.lastNameValidator(value) || {
|
|
170
|
+
value: value.trim().replace(/\s+/g, ' '),
|
|
171
|
+
isValid: true,
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static esTextValidationCb(value = '') {
|
|
176
|
+
const trimmedValue = value.trim();
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
isValid: trimmedValue.length <= 1000,
|
|
180
|
+
errorKey: InputValidators.validationErrorKeys.MAX_LENGTH_1000,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static esIntegerValidationCb(value = '') {
|
|
185
|
+
if (!value) {
|
|
186
|
+
return {
|
|
187
|
+
isValid: true,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!/^(\-)?(\d)+$/.test(value)) {
|
|
192
|
+
return {
|
|
193
|
+
isValid: false,
|
|
194
|
+
errorKey: InputValidators.validationErrorKeys.INTEGER_FORMAT,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (value < -2147483647) {
|
|
199
|
+
return {
|
|
200
|
+
isValid: false,
|
|
201
|
+
errorKey: InputValidators.validationErrorKeys.MIN_VALUE_MINUS_2147483648,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
isValid: value <= 2147483647,
|
|
207
|
+
errorKey: InputValidators.validationErrorKeys.MAX_VALUE_2147483648,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
static esFloatValidationCb(value = '') {
|
|
212
|
+
if (!value) {
|
|
213
|
+
return {
|
|
214
|
+
isValid: true,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const floatPattern = /^(\-)?(\d)+(\.(\d)+)?$/;
|
|
219
|
+
const commaPattern = /,/;
|
|
220
|
+
|
|
221
|
+
const isContainingComma = commaPattern.test(value);
|
|
222
|
+
const isFloat = floatPattern.test(value);
|
|
223
|
+
|
|
224
|
+
if (isContainingComma || !isFloat) {
|
|
225
|
+
return {
|
|
226
|
+
isValid: false,
|
|
227
|
+
errorKey: InputValidators.validationErrorKeys.FLOAT_FORMAT,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (value < -9007199254740991) {
|
|
232
|
+
return {
|
|
233
|
+
isValid: false,
|
|
234
|
+
errorKey: InputValidators.validationErrorKeys.MIN_VALUE_MINUS_2147483648,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return {
|
|
239
|
+
isValid: value <= 9007199254740991,
|
|
240
|
+
errorKey: InputValidators.validationErrorKeys.MAX_VALUE_2147483648,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
static sanitizeExceptDoubleQuotes(value) {
|
|
245
|
+
const sanitizePattern = /[%^*|~{};<>]/;
|
|
246
|
+
const regex = new RegExp(sanitizePattern, 'g');
|
|
247
|
+
if (regex.test(value)) {
|
|
248
|
+
return value.match(regex);
|
|
249
|
+
}
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
static forbiddenCharactersValidator(value, regExpString) {
|
|
254
|
+
try {
|
|
255
|
+
const match = value.match(new RegExp(regExpString, 'gu'));
|
|
256
|
+
return match ? match[0] : '';
|
|
257
|
+
} catch (e) {
|
|
258
|
+
const match = value.match(new RegExp(regExpString.replace('\\p{Alphabetic}', ''), 'gu'));
|
|
259
|
+
return match ? match[0] : '';
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
static nameContainsDotValidator(value) {
|
|
264
|
+
return value.match(/(\p{Alphabetic}{4,}\.)/gmu);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
static nameContainsMoreThanThreeDigitsValidator(value) {
|
|
268
|
+
return value.replace(/\D+/g, '').length > 3
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
static nameConsistingOfAlphabeticCharactersValidator(value) {
|
|
272
|
+
try {
|
|
273
|
+
return !new RegExp('[\\p{Alphabetic}]', 'gu').test(value);
|
|
274
|
+
} catch (e) {
|
|
275
|
+
return /^[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~\d]*$/g.test(value);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
static symbolPositionValidator(value) {
|
|
280
|
+
const symbols = ' .\'’ʼ`´ʹʻʽʾʿˈˊˮʹ΄՚᾽᾿‘‛′‵Ꞌꞌ'-';
|
|
281
|
+
const regex = new RegExp(`[${symbols}][${symbols}]|(^[${symbols}])|([${symbols.replace('.', '')}]$)`, 'g');
|
|
282
|
+
|
|
283
|
+
if (regex.test(value)) {
|
|
284
|
+
return value.match(regex)
|
|
285
|
+
.filter(item => item !== '. ')
|
|
286
|
+
.map(item => item.trim());
|
|
287
|
+
|
|
288
|
+
}
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export { InputValidators as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import '@claspo/renderer/sdk/ManifestUtils';
|
|
2
|
+
import '@claspo/renderer/sdk/ModelStyleUtils';
|
|
3
|
+
|
|
4
|
+
var SysTextManifest = {
|
|
5
|
+
"name": "SysTextComponent",
|
|
6
|
+
"componentType": "TEXT",
|
|
7
|
+
"version": "1.0.0",
|
|
8
|
+
"events": {
|
|
9
|
+
"dispatch": [],
|
|
10
|
+
"listen": []
|
|
11
|
+
},
|
|
12
|
+
"autoContrast": [{
|
|
13
|
+
"slave": {
|
|
14
|
+
"element": "text",
|
|
15
|
+
"elementProp": "styleAttributes",
|
|
16
|
+
"elementSubProp": "color"
|
|
17
|
+
},
|
|
18
|
+
"master": {
|
|
19
|
+
"element": "host",
|
|
20
|
+
"propPath": ["styles", "[element=host]", "styleAttributes", "background"]
|
|
21
|
+
},
|
|
22
|
+
"enabledPropPath": ["content", "textContrastEnabled"]
|
|
23
|
+
}],
|
|
24
|
+
"i18nPropPaths": ["content,text", "content,textrollers", "content,mergeTags"],
|
|
25
|
+
"syncEnabled": true,
|
|
26
|
+
"stylesImitationEnabled": true
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { SysTextManifest as default };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import WcElement from '@claspo/renderer/sdk/WcElement';
|
|
2
|
+
import SysTextManifest from './SysText.manifest.js';
|
|
3
|
+
import { createStaticTextRoller, createUpdatingTextRoller } from './TextRoller.js';
|
|
4
|
+
import insertHtmlIntoElement from '@claspo/common/dom/insertHtmlIntoElement';
|
|
5
|
+
|
|
6
|
+
class SysTextComponent extends WcElement {
|
|
7
|
+
static define = {
|
|
8
|
+
name: 'sys-text',
|
|
9
|
+
model: SysTextManifest.name,
|
|
10
|
+
manifest: SysTextManifest,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
manifest = SysTextManifest;
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.getRootElement().innerHTML = `
|
|
18
|
+
<style>
|
|
19
|
+
.text {
|
|
20
|
+
outline: none;
|
|
21
|
+
min-height: fit-content;
|
|
22
|
+
width: 100%;
|
|
23
|
+
overflow-wrap: break-word;
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
[cl-type="TEXT_ROLLER"] {
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.text {
|
|
33
|
+
align-items: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.container--staticTextRoller {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
max-width: 100%;
|
|
39
|
+
width: fit-content;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.container {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
position: relative;
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.opts {
|
|
51
|
+
position: absolute;
|
|
52
|
+
height: 100%;
|
|
53
|
+
width: 100%;
|
|
54
|
+
top: 0;
|
|
55
|
+
left: 0;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
padding: 0;
|
|
58
|
+
margin: 0;
|
|
59
|
+
display: flex;
|
|
60
|
+
gap: 1px;
|
|
61
|
+
flex-direction: column-reverse;
|
|
62
|
+
transform: translateY(-100%);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.opt {
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
text-align: center;
|
|
69
|
+
display: inline-flex;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.opt span {
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
align-items: center;
|
|
76
|
+
text-overflow: ellipsis;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
width: fit-content;
|
|
79
|
+
max-width: 100%;
|
|
80
|
+
padding: 0 2px;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
|
|
84
|
+
<div class="text" cl-element="text" cl-inline-edit="content, text"></div>
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
connectedCallback() {
|
|
89
|
+
super.connectedCallback();
|
|
90
|
+
|
|
91
|
+
this.observeProps((prev, next) => {
|
|
92
|
+
this.applyAutoAdaptiveStyles(next.adaptiveStyles, next.styles);
|
|
93
|
+
|
|
94
|
+
if (next.content?.text && this.getElement('text')) {
|
|
95
|
+
insertHtmlIntoElement({
|
|
96
|
+
element: this.getElement('text'),
|
|
97
|
+
html: next.content?.text,
|
|
98
|
+
});
|
|
99
|
+
this.mergeTagsProcessor.process(this.getElement('text'), next.content.mergeTags, this.getModel().id);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.processTextRoller(next.content?.textrollers);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
this.observeShared(() => {
|
|
106
|
+
const props = this.getProps();
|
|
107
|
+
|
|
108
|
+
this.processTextRoller(props.content?.textrollers);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
processTextRoller(textrollersProps = {}) {
|
|
113
|
+
const container = this.getElement('text');
|
|
114
|
+
if (!container) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const isStatic = this.isStaticRenderMode();
|
|
118
|
+
|
|
119
|
+
container.childNodes.forEach((node) => {
|
|
120
|
+
if ((node.nodeType !== Node.TEXT_NODE) && node.getAttribute('cl-type') === 'TEXT_ROLLER') {
|
|
121
|
+
const id = node.getAttribute('cl-id');
|
|
122
|
+
const props = textrollersProps[id];
|
|
123
|
+
|
|
124
|
+
if (!props) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (isStatic) {
|
|
129
|
+
createStaticTextRoller(node, props);
|
|
130
|
+
} else {
|
|
131
|
+
createUpdatingTextRoller(node, props);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
stylesAppliedToElement(htmlElement, elementModel) {
|
|
138
|
+
if (elementModel.element === 'text') {
|
|
139
|
+
if (elementModel.styleAttributes.textAlign && getComputedStyle(htmlElement).display === 'flex') {
|
|
140
|
+
htmlElement.style.justifyContent = elementModel.styleAttributes.textAlign === 'center'
|
|
141
|
+
? 'center' : `flex-${elementModel.styleAttributes.textAlign}`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { SysTextComponent as default };
|