@vixoniccom/news-internal 0.4.21-dev.36 → 0.4.21-dev.38

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
  })
@@ -1,26 +1,7 @@
1
- import { List, NumberRangeValue, isInput } from '@vixoniccom/modules'
1
+ import { List, NumberRangeValue } from '@vixoniccom/modules'
2
2
  import { newsInputs } from './newsInputs'
3
3
 
4
- class SmartList extends List {
5
- validateItem(value: any, ctx: any): any {
6
- if (!value.__id) return [{ type: 'ItemHasNoUniqueId' }]
7
-
8
- const itemErrors: Record<string, any[]> = {}
9
- this.itemSchema.forEach((input) => {
10
- if (isInput(input)) {
11
- const i = input as any
12
- if (i.shouldShow(ctx)) {
13
- itemErrors[i.id] = i.validate((value as any)[i.id], ctx)
14
- } else if (!(i.id in itemErrors)) {
15
- itemErrors[i.id] = []
16
- }
17
- }
18
- })
19
- return itemErrors
20
- }
21
- }
22
-
23
- export const newsGroup = new SmartList({
4
+ export const newsGroup = new List({
24
5
  id: 'news',
25
6
  label: 'Noticias',
26
7
  description: 'Lista de noticias',
@@ -5,7 +5,6 @@ export const newsInputs = [
5
5
  new TextInput({
6
6
  id: 'title',
7
7
  label: 'Título corto',
8
- required: true,
9
8
  show: ShowValidations.shortTitleEnabled,
10
9
  range: new NumberRangeValue(1, 25),
11
10
  pattern: '^(?!\\s*$).+',
@@ -13,7 +12,6 @@ export const newsInputs = [
13
12
  new TextInput({
14
13
  id: 'title',
15
14
  label: 'Título mediano',
16
- required: true,
17
15
  show: ShowValidations.mediumTitleEnabled,
18
16
  range: new NumberRangeValue(1, 40),
19
17
  pattern: '^(?!\\s*$).+',
@@ -21,7 +19,6 @@ export const newsInputs = [
21
19
  new TextInput({
22
20
  id: 'title',
23
21
  label: 'Título largo',
24
- required: true,
25
22
  show: ShowValidations.largeTitleEnabled,
26
23
  range: new NumberRangeValue(1, 50),
27
24
  pattern: '^(?!\\s*$).+',
@@ -30,7 +27,6 @@ export const newsInputs = [
30
27
  new TextInput({
31
28
  id: 'title',
32
29
  label: 'Título extra largo',
33
- required: true,
34
30
  show: ShowValidations.extraLargeTitleEnabled,
35
31
  range: new NumberRangeValue(1, 70),
36
32
  pattern: '^(?!\\s*$).+',
@@ -39,7 +35,6 @@ export const newsInputs = [
39
35
  new TextArea({
40
36
  id: 'description',
41
37
  label: 'Descripción corta',
42
- required: true,
43
38
  show: ShowValidations.shortDescriptionEnabled,
44
39
  range: new NumberRangeValue(1, 80),
45
40
  html: true,
@@ -49,7 +44,6 @@ export const newsInputs = [
49
44
  new TextArea({
50
45
  id: 'description',
51
46
  label: 'Descripción mediana',
52
- required: true,
53
47
  show: ShowValidations.mediumDescriptionEnabled,
54
48
  range: new NumberRangeValue(1, 180),
55
49
  html: true,
@@ -59,7 +53,6 @@ export const newsInputs = [
59
53
  new TextArea({
60
54
  id: 'description',
61
55
  label: 'Descripción larga',
62
- required: true,
63
56
  show: ShowValidations.largeDescriptionEnabled,
64
57
  range: new NumberRangeValue(1, 350),
65
58
  html: true,
@@ -69,7 +62,6 @@ export const newsInputs = [
69
62
  new TextArea({
70
63
  id: 'description',
71
64
  label: 'Descripción extra larga',
72
- required: true,
73
65
  show: ShowValidations.extraLargeDescriptionEnabled,
74
66
  range: new NumberRangeValue(1, 500),
75
67
  html: true,
@@ -129,7 +129,7 @@
129
129
  "sortable": true
130
130
  },
131
131
  {
132
- "id": "appearanceGroup",
132
+ "id": "appaeranceGroup",
133
133
  "label": "Apariencia",
134
134
  "type": "group",
135
135
  "items": [
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "author": {
9
9
  "name": ""
10
10
  },
11
- "version": "0.4.21-dev.36",
11
+ "version": "0.4.21-dev.38",
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,21 @@ export type Props = {
9
10
 
10
11
  export const App: React.FunctionComponent<Props> = ({ data }) => {
11
12
  const [news, setNews] = useState<NewsItem[]>([])
12
-
13
+
13
14
  const parseNews = (data?: VixonicData): NewsItem[] => {
14
15
  if (!data) return []
15
16
  const { news } = data.parameters
16
- const parsedNews = news?.map((n, index) => {
17
+ const parsedNews = news?.map((n) => {
17
18
  const { image, ...rest } = n
18
19
  let parsedImage
19
20
  const qrUrl = n.qrCodeUrl
20
21
  if (image?.filename) parsedImage = `${data.downloadsPath}/${image.filename}`
21
-
22
- let title = n.title
23
- let description = n.description
24
22
 
25
23
  return {
26
24
  ...rest,
27
- title,
28
- description,
29
25
  image: parsedImage,
30
- id: n.__id ?? String(index),
31
- qrCodeUrl: qrUrl
26
+ id: uuid(),
27
+ qrCodeUrl: qrUrl
32
28
  }
33
29
  }).filter((n) => {
34
30
  const { expirationDate } = n
package/src/global.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- declare module '*.css'
2
-
3
1
  type NewsItem = {
4
2
  id: string
5
3
  title?: string
@@ -7,8 +7,8 @@ declare type VixonicData = {
7
7
  declare type VixonicParameters =
8
8
  Partial<{
9
9
  news: {
10
- title: string,
11
- description: string,
10
+ title: string,
11
+ description: string,
12
12
  image: {
13
13
  id?: string,
14
14
  filename?: string,