@vixoniccom/news-internal 0.4.21-dev.35 → 0.4.21-dev.37

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/build.zip CHANGED
Binary file
@@ -1,8 +1,8 @@
1
1
  import { Configuration } from '@vixoniccom/modules'
2
- import { appereanceGroup } from './appearanceGroup'
2
+ import { appearanceGroup } from './appearanceGroup'
3
3
  import { newsGroup } from './newsGroup'
4
4
 
5
5
  export const configuration: Configuration = new Configuration({
6
6
  durationFormula: `(_values.news && _values.news.filter(function(newsItem) { return new Date(newsItem.expirationDate) > new Date() || isNaN(new Date(newsItem.expirationDate)) ; }).length || 0) * (_values.showTime || 10)`,
7
- schema: [newsGroup, appereanceGroup],
7
+ schema: [newsGroup, appearanceGroup],
8
8
  })
@@ -10,8 +10,8 @@ export const newsGroup = new List({
10
10
  range: new NumberRangeValue(1, 200),
11
11
  itemDisplayClass: '2-lines',
12
12
  itemDisplayAttributes: {
13
- title: 'title',
14
- subtitle: 'description',
13
+ title: 'titleMedium',
14
+ subtitle: 'descriptionMedium',
15
15
  expirationDate: 'expirationDate',
16
16
  },
17
17
  })
@@ -3,7 +3,7 @@ import { ShowValidations } from '../utils'
3
3
 
4
4
  export const newsInputs = [
5
5
  new TextInput({
6
- id: 'title',
6
+ id: 'titleShort',
7
7
  label: 'Título corto',
8
8
  required: true,
9
9
  show: ShowValidations.shortTitleEnabled,
@@ -11,7 +11,7 @@ export const newsInputs = [
11
11
  pattern: '^(?!\\s*$).+',
12
12
  }),
13
13
  new TextInput({
14
- id: 'title',
14
+ id: 'titleMedium',
15
15
  label: 'Título mediano',
16
16
  required: true,
17
17
  show: ShowValidations.mediumTitleEnabled,
@@ -19,7 +19,7 @@ export const newsInputs = [
19
19
  pattern: '^(?!\\s*$).+',
20
20
  }),
21
21
  new TextInput({
22
- id: 'title',
22
+ id: 'titleLarge',
23
23
  label: 'Título largo',
24
24
  required: true,
25
25
  show: ShowValidations.largeTitleEnabled,
@@ -28,7 +28,7 @@ export const newsInputs = [
28
28
  }),
29
29
 
30
30
  new TextInput({
31
- id: 'title',
31
+ id: 'titleExtraLarge',
32
32
  label: 'Título extra largo',
33
33
  required: true,
34
34
  show: ShowValidations.extraLargeTitleEnabled,
@@ -37,7 +37,7 @@ export const newsInputs = [
37
37
  }),
38
38
 
39
39
  new TextArea({
40
- id: 'description',
40
+ id: 'descriptionShort',
41
41
  label: 'Descripción corta',
42
42
  required: true,
43
43
  show: ShowValidations.shortDescriptionEnabled,
@@ -47,7 +47,7 @@ export const newsInputs = [
47
47
  }),
48
48
 
49
49
  new TextArea({
50
- id: 'description',
50
+ id: 'descriptionMedium',
51
51
  label: 'Descripción mediana',
52
52
  required: true,
53
53
  show: ShowValidations.mediumDescriptionEnabled,
@@ -57,7 +57,7 @@ export const newsInputs = [
57
57
  }),
58
58
 
59
59
  new TextArea({
60
- id: 'description',
60
+ id: 'descriptionLarge',
61
61
  label: 'Descripción larga',
62
62
  required: true,
63
63
  show: ShowValidations.largeDescriptionEnabled,
@@ -67,7 +67,7 @@ export const newsInputs = [
67
67
  }),
68
68
 
69
69
  new TextArea({
70
- id: 'description',
70
+ id: 'descriptionExtraLarge',
71
71
  label: 'Descripción extra larga',
72
72
  required: true,
73
73
  show: ShowValidations.extraLargeDescriptionEnabled,
@@ -7,79 +7,79 @@
7
7
  "type": "list",
8
8
  "itemSchema": [
9
9
  {
10
- "id": "title",
10
+ "id": "titleShort",
11
11
  "label": "Título corto",
12
12
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'short')",
13
13
  "type": "text-input",
14
14
  "required": true,
15
15
  "pattern": "^(?!\\s*$).+",
16
- "range": "[1:25]"
16
+ "range": "[1:25:]"
17
17
  },
18
18
  {
19
- "id": "title",
19
+ "id": "titleMedium",
20
20
  "label": "Título mediano",
21
21
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'medium')",
22
22
  "type": "text-input",
23
23
  "required": true,
24
24
  "pattern": "^(?!\\s*$).+",
25
- "range": "[1:40]"
25
+ "range": "[1:40:]"
26
26
  },
27
27
  {
28
- "id": "title",
28
+ "id": "titleLarge",
29
29
  "label": "Título largo",
30
30
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'large')",
31
31
  "type": "text-input",
32
32
  "required": true,
33
33
  "pattern": "^(?!\\s*$).+",
34
- "range": "[1:50]"
34
+ "range": "[1:50:]"
35
35
  },
36
36
  {
37
- "id": "title",
37
+ "id": "titleExtraLarge",
38
38
  "label": "Título extra largo",
39
39
  "show": "{{titleEnabled}} === true && ({{newsSizeSelect}} === 'extra-large')",
40
40
  "type": "text-input",
41
41
  "required": true,
42
42
  "pattern": "^(?!\\s*$).+",
43
- "range": "[1:70]"
43
+ "range": "[1:70:]"
44
44
  },
45
45
  {
46
- "id": "description",
46
+ "id": "descriptionShort",
47
47
  "label": "Descripción corta",
48
48
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'short')",
49
49
  "type": "text-area",
50
50
  "required": true,
51
51
  "pattern": "^(?!\\s*$).+",
52
- "range": "[1:80]",
52
+ "range": "[1:80:]",
53
53
  "html": true
54
54
  },
55
55
  {
56
- "id": "description",
56
+ "id": "descriptionMedium",
57
57
  "label": "Descripción mediana",
58
58
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'medium')",
59
59
  "type": "text-area",
60
60
  "required": true,
61
61
  "pattern": "^(?!\\s*$).+",
62
- "range": "[1:180]",
62
+ "range": "[1:180:]",
63
63
  "html": true
64
64
  },
65
65
  {
66
- "id": "description",
66
+ "id": "descriptionLarge",
67
67
  "label": "Descripción larga",
68
68
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'large')",
69
69
  "type": "text-area",
70
70
  "required": true,
71
71
  "pattern": "^(?!\\s*$).+",
72
- "range": "[1:350]",
72
+ "range": "[1:350:]",
73
73
  "html": true
74
74
  },
75
75
  {
76
- "id": "description",
76
+ "id": "descriptionExtraLarge",
77
77
  "label": "Descripción extra larga",
78
78
  "show": "{{descriptionEnabled}} === true && ({{newsSizeSelect}} === 'extra-large')",
79
79
  "type": "text-area",
80
80
  "required": true,
81
81
  "pattern": "^(?!\\s*$).+",
82
- "range": "[1:500]",
82
+ "range": "[1:500:]",
83
83
  "html": true
84
84
  },
85
85
  {
@@ -119,11 +119,11 @@
119
119
  }
120
120
  ],
121
121
  "description": "Lista de noticias",
122
- "range": "[1:200]",
122
+ "range": "[1:200:]",
123
123
  "itemDisplayClass": "2-lines",
124
124
  "itemDisplayAttributes": {
125
- "title": "title",
126
- "subtitle": "description",
125
+ "title": "titleMedium",
126
+ "subtitle": "descriptionMedium",
127
127
  "expirationDate": "expirationDate"
128
128
  },
129
129
  "sortable": true
@@ -188,7 +188,7 @@
188
188
  "id": "showTime",
189
189
  "label": "Persistencia",
190
190
  "type": "number-input",
191
- "range": "[5:9999]",
191
+ "range": "[5:9999:]",
192
192
  "description": "Tiempo en segundos por noticia. Por defecto 10"
193
193
  },
194
194
  {
@@ -253,12 +253,13 @@
253
253
  },
254
254
  {
255
255
  "id": "defaultMessage",
256
- "label": "Sin noticias",
257
- "type": "text-input"
256
+ "label": "Mensaje sin noticias",
257
+ "type": "text-input",
258
+ "description": "Mensaje a mostrar cuando no existen noticias o han caducado"
258
259
  },
259
260
  {
260
261
  "id": "defaultMessageFormat",
261
- "label": "Formato mensaje sin noticias",
262
+ "label": "Formato del mensaje sin noticias",
262
263
  "type": "text-format"
263
264
  },
264
265
  {
@@ -282,7 +283,7 @@
282
283
  "label": "Altura de línea",
283
284
  "show": "{{titleEnabled}} === true",
284
285
  "type": "number-input",
285
- "range": "[0.8:100]"
286
+ "range": "[0.8:100:]"
286
287
  },
287
288
  {
288
289
  "id": "descriptionEnabled",
@@ -301,7 +302,7 @@
301
302
  "label": "Altura de línea",
302
303
  "show": "{{descriptionEnabled}} === true",
303
304
  "type": "number-input",
304
- "range": "[0.8:100]"
305
+ "range": "[0.8:100:]"
305
306
  },
306
307
  {
307
308
  "id": "textSeparation",
@@ -348,7 +349,7 @@
348
349
  "label": "Tamaño personalizado",
349
350
  "show": "{{imageEnabled}} === true && ( ( {{template}} === 'gallery' ) === false ) && ( ( {{template}} === 'gradient' ) === false ) && ( {{imageSize}} === 'custom' )",
350
351
  "type": "number-input",
351
- "range": "[1:100]",
352
+ "range": "[1:100:]",
352
353
  "description": "En porcentaje.",
353
354
  "required": true
354
355
  },
@@ -454,7 +455,7 @@
454
455
  "label": "Porcentje de degradado",
455
456
  "show": "{{template}} === 'gradient'",
456
457
  "type": "number-input",
457
- "range": "[1:100]",
458
+ "range": "[1:100:]",
458
459
  "description": "Por defecto 50"
459
460
  },
460
461
  {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "author": {
9
9
  "name": ""
10
10
  },
11
- "version": "0.4.21-dev.35",
11
+ "version": "0.4.21-dev.37",
12
12
  "scripts": {
13
13
  "prepublish": "vixonic-module-packager --mode=build",
14
14
  "watch": "vixonic-module-packager --mode=watch",
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { v4 as uuid } from 'uuid'
2
3
  import { NewsContainer } from './NewsContainer'
3
4
  import { FontLoader } from './FontLoader'
4
5
  import dayjs from 'dayjs'
@@ -9,26 +10,36 @@ export type Props = {
9
10
 
10
11
  export const App: React.FunctionComponent<Props> = ({ data }) => {
11
12
  const [news, setNews] = useState<NewsItem[]>([])
12
-
13
+
14
+ const getPrefixBySize = (n: any, size: string, prefix: string): string => {
15
+ const prefixMap: { [key: string]: string } = {
16
+ 'short': n[`${prefix}Short`],
17
+ 'medium': n[`${prefix}Medium`],
18
+ 'large': n[`${prefix}Large`],
19
+ 'extra-large': n[`${prefix}ExtraLarge`]
20
+ }
21
+ return prefixMap[size] || n[`${prefix}Medium`] || n[prefix] || ''
22
+ }
23
+
13
24
  const parseNews = (data?: VixonicData): NewsItem[] => {
14
25
  if (!data) return []
15
- const { news } = data.parameters
16
- const parsedNews = news?.map((n, index) => {
26
+ const { news, newsSizeSelect } = data.parameters
27
+ const parsedNews = news?.map((n) => {
17
28
  const { image, ...rest } = n
18
29
  let parsedImage
19
30
  const qrUrl = n.qrCodeUrl
20
31
  if (image?.filename) parsedImage = `${data.downloadsPath}/${image.filename}`
21
-
22
- let title = n.title
23
- let description = n.description
32
+
33
+ let title = getPrefixBySize(n, newsSizeSelect ?? 'medium', 'title')
34
+ let description = getPrefixBySize(n, newsSizeSelect ?? 'medium', 'description')
24
35
 
25
36
  return {
26
37
  ...rest,
27
38
  title,
28
39
  description,
29
40
  image: parsedImage,
30
- id: n.__id ?? String(index),
31
- qrCodeUrl: qrUrl
41
+ id: uuid(),
42
+ qrCodeUrl: qrUrl
32
43
  }
33
44
  }).filter((n) => {
34
45
  const { expirationDate } = n
@@ -4,118 +4,6 @@ declare type VixonicData = {
4
4
  parameters: VixonicParameters
5
5
  }
6
6
 
7
- declare type VixonicParameters =
8
- Partial<{
9
- news: {
10
- title: string,
11
- description: string,
12
- image: {
13
- id?: string,
14
- filename?: string,
15
- extension?: string
16
- },
17
- qrCodeUrl: string,
18
- qrCodeTitle: string,
19
- expirationDate: string,
20
- __id: string | undefined}[],
21
- newsSizeSelect: 'short' | 'medium' | 'large' | 'extra-large',
22
- template: 'standard' | 'gallery' | 'gradient',
23
- showTime: number, animationSpeed: number,
24
- animationType: 'fade' | 'crossFade',
25
- textAlignment: 'flex-start' | 'flex-end' | 'center' | 'space-around' | 'space-between',
26
- defaultMessage: string
27
- defaultMessageFormat: {
28
- fontSize?: number,
29
- fontColor?: string,
30
- alignment?: {
31
- horizontal?: 'left' | 'right' | 'center'},
32
- font?: {
33
- filename: string;
34
- id: string;
35
- __isAsset: true}
36
- }
37
- titleEnabled: boolean,
38
- titleFormat: {
39
- fontSize?: number,
40
- fontColor?: string,
41
- alignment?: {
42
- horizontal?: 'left' | 'right' | 'center'
43
- },
44
- font?: {
45
- filename: string,
46
- id: string,
47
- __isAsset: true
48
- }
49
- },
50
- titleLineHeight: number,
51
- descriptionEnabled: boolean,
52
- descriptionFormat: {
53
- fontSize?: number,
54
- fontColor?: string,
55
- alignment?: {
56
- horizontal?: 'left' | 'right' | 'center'
57
- },
58
- font?: {
59
- filename: string,
60
- id: string,
61
- __isAsset: true
62
- }
63
- },
64
- descriptionLineHeight: number,
65
- textSeparation: number,
66
- imageEnabled: boolean,
67
- imageSize: 'small' | 'medium' | 'large' | 'custom',
68
- imageCustomSize: number,
69
- imagePosition: 'top' | 'right' | 'bottom' | 'left',
70
- imageMode: 'contain' | 'cover' | 'fill' | 'none',
71
- imageStyle: 'normal' | 'rounded' | 'circle' | 'hex',
72
- imageSeparation: number,
73
- gradientBackgroundColor: string,
74
- gradientRate: number,
75
- gradientOrientation: 'left' | 'right',
76
- gradientTitleEnabled: boolean,
77
- gradientTitle: string,
78
- gradientTitlePositionX: number,
79
- gradientTitlePositionY: number,
80
- gradientTitleFormat: {
81
- fontSize?: number,
82
- fontColor?: string,
83
- alignment?: {
84
- horizontal?: 'left' | 'right' | 'center'
85
- },
86
- font?: {
87
- filename: string,
88
- id: string,
89
- __isAsset: true
90
- }
91
- },
92
- barSize: 'small' | 'medium' | 'big',
93
- barColor: string,
94
- barOpacity: number,
95
- iconVisible: boolean,
96
- iconColor: string,
97
- qrCodeEnabled: boolean,
98
- qrCodeWidth: number,
99
- qrCodeHeight: number,
100
- qrCodePositionX: number,
101
- qrCodePositionY: number,
102
- qrCodeBackgroundColor: string,
103
- qrCodeColor: string,
104
- QrCodeTitleFormat: {
105
- fontSize?: number,
106
- fontColor?: string,
107
- alignment?: {
108
- horizontal?: 'left' | 'right' | 'center' },
109
- font?: {
110
- filename: string,
111
- id: string,
112
- __isAsset: true
113
- }
114
- },
115
- background: {
116
- id?: string,
117
- filename?: string,
118
- extension?: string
119
- },
120
- padding: string
7
+ declare type VixonicParameters = Partial<{
8
+ news: {titleShort: string, titleMedium: string, titleLarge: string, titleExtraLarge: string, descriptionShort: string, descriptionMedium: string, descriptionLarge: string, descriptionExtraLarge: string, image: {id?: string, filename?: string, extension?: string}, qrCodeUrl: string, qrCodeTitle: string, expirationDate: string, __id: string | undefined}[], newsSizeSelect: 'short' | 'medium' | 'large' | 'extra-large', template: 'standard' | 'gallery' | 'gradient', showTime: number, animationSpeed: number, animationType: 'fade' | 'crossFade', textAlignment: 'flex-start' | 'flex-end' | 'center' | 'space-around' | 'space-between', defaultMessage: string, defaultMessageFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, titleEnabled: boolean, titleFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, titleLineHeight: number, descriptionEnabled: boolean, descriptionFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, descriptionLineHeight: number, textSeparation: number, imageEnabled: boolean, imageSize: 'small' | 'medium' | 'large' | 'custom', imageCustomSize: number, imagePosition: 'top' | 'right' | 'bottom' | 'left', imageMode: 'contain' | 'cover' | 'fill' | 'none', imageStyle: 'normal' | 'rounded' | 'circle' | 'hex', imageSeparation: number, gradientBackgroundColor: string, gradientRate: number, gradientOrientation: 'left' | 'right', gradientTitleEnabled: boolean, gradientTitle: string, gradientTitlePositionX: number, gradientTitlePositionY: number, gradientTitleFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, barSize: 'small' | 'medium' | 'big', barColor: string, barOpacity: number, iconVisible: boolean, iconColor: string, qrCodeEnabled: boolean, qrCodeWidth: number, qrCodeHeight: number, qrCodePositionX: number, qrCodePositionY: number, qrCodeBackgroundColor: string, qrCodeColor: string, QrCodeTitleFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, background: {id?: string, filename?: string, extension?: string}, padding: string
121
9
  }>