capibara 1.2.0 → 1.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capibara",
3
- "version": "1.2.0",
3
+ "version": "1.3.3",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -564,6 +564,10 @@ export class Capibara{
564
564
 
565
565
  switch (inputConfig.type) {
566
566
 
567
+ case 'custom':
568
+ value = inputConfig.getValue ? inputConfig.getValue({elem, props: inputConfig}) : null;
569
+ break;
570
+
567
571
  case 'time':
568
572
  let hhElement= elem.querySelector(".hour");
569
573
  let mmElement= elem.querySelector(".minutes");
@@ -640,10 +644,23 @@ export class Capibara{
640
644
  });
641
645
  break;
642
646
  case 'data-list':
643
- //TODO implementar
644
- break;
647
+ inputsElement = elem.querySelectorAll(".mini-input-section");
648
+ value = [];
649
+ inputsElement.forEach(i => {
650
+ let v = i.getAttribute("data-value")
651
+ if(v){
652
+ v = parseFloat(v);
653
+ }
654
+ value.push({
655
+ id : i.getAttribute("data-id"),
656
+ key : i.getAttribute("data-key"),
657
+ value : v || null,
658
+ })
659
+ });
660
+ break;
645
661
  case 'title':
646
662
  //no es realmente un input, es solo un texto
663
+ //no es necesario obtener valores de aqui
647
664
  break;
648
665
 
649
666
  case 'text':
@@ -19,7 +19,6 @@
19
19
  display: none !important;
20
20
  }
21
21
 
22
- //fonts
23
22
  .text-title{
24
23
  font-size: 1.25em;
25
24
  font-weight: bold;
@@ -33,6 +32,13 @@
33
32
  flex: 0 0 auto;
34
33
  }
35
34
 
35
+ .text-hint{
36
+ font-size: 0.75em;
37
+ margin: 0.3em;
38
+ text-align: left;
39
+ align-self: flex-start;
40
+ }
41
+
36
42
  .text-subtitle-2{
37
43
  font-size: 0.75em;
38
44
  margin: 0.5em 0.3em;
@@ -46,5 +52,10 @@
46
52
  .d-block{
47
53
  display:block;
48
54
  }
55
+ .d-flex{
56
+ display:flex;
57
+ flex-direction: column;
58
+ align-items: center;
59
+ }
49
60
 
50
61
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  button{
4
4
  outline: none;
5
+ cursor: pointer;
5
6
  &.cap-rotate{
6
7
  svg,
7
8
  .mdi:before{
@@ -22,31 +23,35 @@
22
23
  }
23
24
  }
24
25
 
25
- .cap-btn-sm{
26
+ button.cap-btn-sm{
26
27
  font-size: 0.75em;
27
- margin: 4px !important;
28
- padding: 4px 8px !important;
28
+ margin: 4px;
29
+ padding: 4px 8px;
29
30
  }
30
31
 
31
- .cap-btn-raised{
32
+ .cap-btn-outline{
33
+ background: transparent;
32
34
  cursor: pointer;
35
+ color: grey;
36
+ border: 2px solid grey;
33
37
  padding: 8px 16px;
34
38
  margin: 0px 8px;
35
39
  border-radius: 6px;
36
- background: grey;
37
- border: 2px solid grey;
38
- color: white;
39
40
  font-weight: bold;
41
+ &.selected{
42
+ background: grey;
43
+ color: white;
44
+ }
40
45
  }
41
46
 
42
- .cap-btn-outline{
43
- background: transparent;
47
+ .cap-btn-raised{
44
48
  cursor: pointer;
45
- color: grey;
46
- border: 2px solid grey;
47
49
  padding: 8px 16px;
48
50
  margin: 0px 8px;
49
51
  border-radius: 6px;
52
+ background: grey;
53
+ border: 2px solid grey;
54
+ color: white;
50
55
  font-weight: bold;
51
56
  }
52
57
 
@@ -274,6 +279,10 @@
274
279
  background: mapGet($theme,button,outline, background);
275
280
  border:2px solid mapGet($theme,button,outline, border);
276
281
  color: mapGet($theme,button,outline, color);
282
+ &.selected{
283
+ background: mapGet($theme,button,raised, background);
284
+ color: mapGet($theme,button,raised, color);
285
+ }
277
286
  }
278
287
 
279
288
  .cap-btn-shape{
@@ -73,6 +73,7 @@
73
73
 
74
74
  .dot-container-top {
75
75
  top: 1px;
76
+
76
77
  .dot {
77
78
  border-radius: 0px 0px 50% 50%;
78
79
  }
@@ -84,6 +85,7 @@
84
85
 
85
86
  .dot-container-bottom {
86
87
  bottom: 5px;
88
+
87
89
  .dot {
88
90
  border-radius: 0px 0px 50% 50%;
89
91
  }
@@ -100,14 +102,28 @@
100
102
  border-style: solid;
101
103
  border-color: var(--local-color, rgba(255, 255, 255, 0.8));
102
104
  background: var(--local-color, rgba(100, 100, 100, 0.5));
103
- backdrop-filter: blur(2px);
105
+ //backdrop-filter: blur(2px);
106
+
104
107
  &.diamond {
105
108
  border-radius: 0;
106
109
  transform: rotate(45deg) skew(10deg, 10deg);
107
110
  }
111
+
108
112
  &.outlined {
109
113
  background-color: transparent;
110
114
  }
115
+
116
+ &.triangle {
117
+ width: 0;
118
+ height: 0;
119
+ border-style: solid;
120
+ border-width: 5px;
121
+ transform: rotate(45deg) skew(10deg, 10deg) translate(1px, 1px);
122
+ border-color: var(--local-color, rgba(100, 100, 100, 0.8)) transparent
123
+ transparent var(--local-color, rgba(100, 100, 100, 0.8));
124
+ border-radius: 0;
125
+ background-color: transparent;
126
+ }
111
127
  }
112
128
 
113
129
  span.data {
@@ -132,6 +148,7 @@
132
148
 
133
149
  &.shape-outlined {
134
150
  background-color: transparent !important;
151
+
135
152
  &:before {
136
153
  content: "";
137
154
  opacity: 0.3;
@@ -154,7 +171,8 @@
154
171
  color: transparent;
155
172
  border-radius: 1px;
156
173
  margin: 0px 3px;
157
- &:first-child {
174
+
175
+ &:first-of-type {
158
176
  margin-top: 3px;
159
177
  }
160
178
  }
@@ -167,7 +185,8 @@
167
185
  border-radius: 1px;
168
186
  margin: 0px 3px;
169
187
  background-color: transparent !important;
170
- &:first-child {
188
+
189
+ &:first-of-type {
171
190
  margin-top: 3px;
172
191
  }
173
192
 
@@ -193,7 +212,8 @@
193
212
  border-radius: 1px;
194
213
  margin: 0px 3px;
195
214
  background-color: transparent !important;
196
- &:first-child {
215
+
216
+ &:first-of-type {
197
217
  margin-top: 3px;
198
218
  }
199
219
 
@@ -231,7 +251,7 @@
231
251
  margin: 1px;
232
252
  border-color: var(--local-color, rgba(0, 0, 0, 0.2));
233
253
 
234
- &:first-child {
254
+ &:first-of-type {
235
255
  margin-top: 3px;
236
256
  }
237
257
 
@@ -266,6 +286,44 @@
266
286
  }
267
287
  }
268
288
  }
289
+
290
+ .plot-floatbox-container {
291
+ position: absolute;
292
+ left: 0;
293
+ top: 0;
294
+ width: 100%;
295
+ height: 100%;
296
+ overflow: visible;
297
+
298
+ .plot-floatbox {
299
+ position: absolute;
300
+ left: 0;
301
+ top: 0;
302
+ width: 100%;
303
+ height: 100%;
304
+ background-color: var(--local-color, rgba(0, 0, 0, 0.4));
305
+
306
+ &.stripe {
307
+ background: repeating-linear-gradient(
308
+ 53deg,
309
+ var(--local-color, rgba(0, 0, 0, 0.4)),
310
+ var(--local-color, rgba(0, 0, 0, 0.4)) 5px,
311
+ transparent 5px,
312
+ transparent 12px
313
+ );
314
+ }
315
+
316
+ &.stripe-inverse {
317
+ background: repeating-linear-gradient(
318
+ 127deg,
319
+ var(--local-color, rgba(0, 0, 0, 0.4)),
320
+ var(--local-color, rgba(0, 0, 0, 0.4)) 5px,
321
+ transparent 5px,
322
+ transparent 12px
323
+ );
324
+ }
325
+ }
326
+ }
269
327
  }
270
328
 
271
329
  .float-box-ext {
@@ -284,11 +342,16 @@
284
342
  flex-direction: column;
285
343
  justify-content: start;
286
344
  align-items: start;
345
+
287
346
  .long-bar {
288
347
  //width: var(--local-width, 0px);
289
- width: calc(var(--day-width, 0) * var(--long, 0));
348
+ width: calc(
349
+ var(--day-width, 0) * var(--long, 0) - (var(--day-width, 0) * 0.5)
350
+ );
290
351
  //min-width: var(--local-width, calc(var(--day-width) *3) );
291
- min-width: calc(var(--day-width, 0) * var(--long, 0));
352
+ min-width: calc(
353
+ var(--day-width, 0) * var(--long, 0) - (var(--day-width, 0) * 0.5)
354
+ );
292
355
  height: calc(var(--item-height) / 4 - 3.5px);
293
356
  line-height: 0;
294
357
  color: transparent;
@@ -299,20 +362,22 @@
299
362
  margin-top: 1px;
300
363
  margin-bottom: 1px;
301
364
  border-width: 2px 2px 2px 0;
302
- opacity: var(--local-opacity, 0.4);
365
+ opacity: var(--local-opacity, 0);
303
366
  border-style: solid;
304
- border-color: rgba(0,0,0, 0.2);
367
+ border-color: rgba(0, 0, 0, 0.2);
305
368
  transition: 0.3s opacity ease;
306
- &:hover{
369
+
370
+ &:hover {
307
371
  z-index: 10;
308
372
  }
309
- &.solid{
373
+
374
+ &.solid {
310
375
  opacity: 1;
311
376
  }
312
- &:first-child {
377
+
378
+ &:first-of-type {
313
379
  margin-top: 4px;
314
380
  }
315
-
316
381
  }
317
382
  }
318
383
  }
@@ -324,21 +389,22 @@
324
389
  .float-box {
325
390
  &:hover {
326
391
  box-shadow: 0px 0px 2px 7px mapGet($theme, floatBox, shadow);
392
+
327
393
  & + .float-box-ext {
328
- .long-bar{
329
- z-index: 2;
394
+ .long-bar {
395
+ z-index: 6;
330
396
  box-shadow: 0px 0px 2px 4px mapGet($theme, floatBox, shadow);
331
- opacity: 1;
397
+ opacity: 0.6;
332
398
  }
333
399
  }
334
400
  }
401
+
335
402
  span.data {
336
403
  &.shape-bar {
337
404
  border-color: mapGet($theme, floatBox, shapeBar, border);
338
405
  }
339
406
  }
340
407
  }
341
-
342
408
  }
343
409
  }
344
410
  }
@@ -67,6 +67,23 @@
67
67
  }
68
68
  }
69
69
 
70
+ .buttons-group{
71
+ display: flex;
72
+ flex-direction: row;
73
+ button.cap-btn-outline{
74
+ border-radius: 0;
75
+ margin: 0px -2px 0px 0px;
76
+ &:first-of-type{
77
+ border-radius: 6px 0 0 6px;
78
+ margin-left: 4px;
79
+ }
80
+ &:last-of-type{
81
+ border-radius: 0 6px 6px 0;
82
+ margin-right: 4px;
83
+ }
84
+ }
85
+ }
86
+
70
87
  .input-box-tab-container {
71
88
  display: flex;
72
89
  width: 100%;
@@ -128,6 +145,8 @@
128
145
  right: 1em;
129
146
  top: 0.4em;
130
147
  color: rgba(100, 100, 100, 0.6);
148
+ background-color: transparent;
149
+ border-style: none;
131
150
  }
132
151
  }
133
152
 
@@ -366,8 +385,10 @@
366
385
  input.nav-input {
367
386
  border: 2px solid transparentize(grey, 0.3);
368
387
  border-radius: 6px;
369
- width: 70%;
388
+ //width: 70%;
389
+ width: 100%;
370
390
  min-width: 130px;
391
+ max-width: 170px;
371
392
  font-size: 2em;
372
393
  text-align: center;
373
394
  padding: 3px 6px;
@@ -150,6 +150,16 @@
150
150
  &.outlined{
151
151
  background: transparent;
152
152
  }
153
+ &.triangle{
154
+ border-radius: 0;
155
+ transform: rotate(45deg) skew(10deg, 10deg) translate(3px, 3px);
156
+ width: 0px;
157
+ height: 0px;
158
+ border-width: 5px;
159
+ border-style: solid;
160
+ background-color: transparent;
161
+ //border-color: grey transparent transparent grey;
162
+ }
153
163
  }
154
164
 
155
165
  .name {
@@ -285,6 +295,10 @@
285
295
  border: 1px solid var(--local-color, inherit);
286
296
  box-shadow: inset 0px 0px 0px 1px var(--local-color, inherit);
287
297
  }
298
+ &.triangle{
299
+ background: transparent;
300
+ border-color: var(--local-color, inherit) transparent transparent var(--local-color, inherit);
301
+ }
288
302
  }
289
303
  }
290
304
  }
@@ -145,6 +145,9 @@
145
145
  .cap-btn-outline{
146
146
  border-color: $color;
147
147
  color: $color;
148
+ &.selected{
149
+ background: transparentize($color,0.2);
150
+ }
148
151
  }
149
152
 
150
153
  .select-container{
@@ -1,12 +1,10 @@
1
- import utils from '../util/utils';
2
-
3
- export default{
1
+ import utils from "../util/utils";
4
2
 
3
+ export default {
5
4
  /**
6
5
  * Dia en milisegundos
7
6
  */
8
- dayInMilliseconds : 24*60*60*1000,
9
-
7
+ dayInMilliseconds: 24 * 60 * 60 * 1000,
10
8
 
11
9
  /**
12
10
  * Obtiene Array de fechas con formato arbol en objetos
@@ -18,24 +16,24 @@ export default{
18
16
  * @param {Date} dateEnd - fecha termino
19
17
  * @return {Object} objeto con formato fechas con formato de arbol
20
18
  */
21
- getDateTreeRange(dateIni, dateEnd){
19
+ getDateTreeRange(dateIni, dateEnd) {
22
20
  let obj = {};
23
21
  let arr = this.getDateRange(dateIni, dateEnd);
24
22
  let today = new Date();
25
- arr.forEach(a => {
26
- obj[a.getUTCFullYear()] = obj[a.getUTCFullYear()] || {};
27
- obj[a.getUTCFullYear()][a.getUTCMonth()] = obj[a.getUTCFullYear()][a.getUTCMonth()] || {};
23
+ arr.forEach((a) => {
24
+ obj[a.getUTCFullYear()] = obj[a.getUTCFullYear()] || {};
25
+ obj[a.getUTCFullYear()][a.getUTCMonth()] =
26
+ obj[a.getUTCFullYear()][a.getUTCMonth()] || {};
28
27
  obj[a.getUTCFullYear()][a.getUTCMonth()][a.getUTCDate()] = {
29
- label : a.getUTCDate(),
30
- Date : a,
31
- isWeekend : [5, 6].indexOf(a.getDate) > -1,
32
- isToday : today.toDateString() == a.toDateString(),
33
- isFuture : today.getTime() < a.getTime(),
34
- }
35
- })
36
- return obj;
37
- },
38
-
28
+ label: a.getUTCDate(),
29
+ Date: a,
30
+ isWeekend: [5, 6].indexOf(a.getDate) > -1,
31
+ isToday: today.toDateString() == a.toDateString(),
32
+ isFuture: today.getTime() < a.getTime()
33
+ };
34
+ });
35
+ return obj;
36
+ },
39
37
 
40
38
  /**
41
39
  * Obtiene Array de Dates, con las fechas entre 2 rangos
@@ -48,16 +46,28 @@ export default{
48
46
  * @return {Date[]} array de Dates
49
47
  */
50
48
 
51
- getDateRange(dateIni, dateEnd){
49
+ getDateRange(dateIni, dateEnd) {
52
50
  let arr = [];
53
- let dateIniCorrected = new Date(dateIni.getUTCFullYear(), dateIni.getUTCMonth(), dateIni.getUTCDate());
54
- let dateEndCorrected = new Date(dateEnd.getUTCFullYear(),dateEnd.getUTCMonth(),dateEnd.getUTCDate(), 4);
55
- for(let dt = new Date(dateIniCorrected); dt <= dateEndCorrected; dt.setDate(dt.getDate() + 1)){
51
+ let dateIniCorrected = new Date(
52
+ dateIni.getUTCFullYear(),
53
+ dateIni.getUTCMonth(),
54
+ dateIni.getUTCDate()
55
+ );
56
+ let dateEndCorrected = new Date(
57
+ dateEnd.getUTCFullYear(),
58
+ dateEnd.getUTCMonth(),
59
+ dateEnd.getUTCDate(),
60
+ 4
61
+ );
62
+ for (
63
+ let dt = new Date(dateIniCorrected);
64
+ dt <= dateEndCorrected;
65
+ dt.setDate(dt.getDate() + 1)
66
+ ) {
56
67
  arr.push(new Date(dt));
57
68
  }
58
- return arr;
59
- },
60
-
69
+ return arr;
70
+ },
61
71
 
62
72
  /**
63
73
  * Compara 2 fechas, sin considerar las horas
@@ -69,13 +79,11 @@ export default{
69
79
  isSameDate(date1, date2) {
70
80
  return (
71
81
  date1.getFullYear() === date2.getFullYear() &&
72
- date1.getMonth() === date2.getMonth() &&
73
- date1.getDate() === date2.getDate()
82
+ date1.getMonth() === date2.getMonth() &&
83
+ date1.getDate() === date2.getDate()
74
84
  );
75
85
  },
76
86
 
77
-
78
-
79
87
  /**
80
88
  * Verifica si la fecha enviadas es futura, sin considerar las horas
81
89
  * la compara con un new Date()
@@ -83,11 +91,10 @@ export default{
83
91
  * @param {Date} date - fecha a analizar
84
92
  * @return {Boolean} true si la fecha es futura
85
93
  */
86
- isFuture(date){
87
- return date.setHours(0,0,0,0) > new Date().setHours(0,0,0,0)
94
+ isFuture(date) {
95
+ return date.setHours(0, 0, 0, 0) > new Date().setHours(0, 0, 0, 0);
88
96
  },
89
97
 
90
-
91
98
  /**
92
99
  * Verifica si la fecha enviadas es hoy
93
100
  * la compara con un new Date()
@@ -95,14 +102,10 @@ export default{
95
102
  * @param {Date} date - fecha a analizar
96
103
  * @return {Boolean} true si la fecha es hoy
97
104
  */
98
- isToday(date){
105
+ isToday(date) {
99
106
  return this.isSameDate(date, new Date());
100
107
  },
101
108
 
102
-
103
-
104
-
105
-
106
109
  /**
107
110
  * Verifica si es una fecha valida
108
111
  *
@@ -113,35 +116,35 @@ export default{
113
116
  return date instanceof Date && !isNaN(date);
114
117
  },
115
118
 
116
-
117
-
118
119
  /**
119
120
  * Obtiene la diferencia en dias entre 2 fechas
120
121
  *
121
122
  * Si la fecha de termino no se envia, se considera el dia actual
122
123
  *
123
- * Basado en
124
+ * Basado en
124
125
  * https://www.geeksforgeeks.org/how-to-calculate-the-number-of-days-between-two-dates-in-javascript/
125
126
  *
126
127
  * @param {Date} ini - Fecha inicio
127
128
  * @param {Date} [end = new Date() ] - Fecha Termino
128
129
  * @return {Integer} Cantidad de dias de diferencia
129
130
  */
130
- diffDays(ini, end){
131
+ diffDays(ini, end) {
131
132
  let iniDate = new Date(ini);
132
133
  let endDate = end ? new Date(end) : new Date();
133
- if(this.isValidDate(iniDate) && this.isValidDate(endDate)){
134
- let iniDate_utc = new Date(iniDate.getTime() + iniDate.getTimezoneOffset() * 60000);
135
- let endDate_utc = new Date(endDate.getTime() + endDate.getTimezoneOffset() * 60000);
136
- let time = endDate_utc.getTime() - iniDate_utc.getTime();
137
- let days = utils.round(time / (1000 * 3600 * 24), 0);
134
+ if (this.isValidDate(iniDate) && this.isValidDate(endDate)) {
135
+ let iniDate_utc = new Date(
136
+ iniDate.getTime() + iniDate.getTimezoneOffset() * 60000
137
+ );
138
+ let endDate_utc = new Date(
139
+ endDate.getTime() + endDate.getTimezoneOffset() * 60000
140
+ );
141
+ let time = endDate_utc.getTime() - iniDate_utc.getTime();
142
+ let days = utils.round(time / (1000 * 3600 * 24), 0);
138
143
  return days;
139
144
  }
140
145
  return 0;
141
146
  },
142
147
 
143
-
144
-
145
148
  /**
146
149
  * Suma dias a una fecha (preferentemente String)
147
150
  * devuelve la fecha formateada como String "YYYY-MM-DD"
@@ -151,57 +154,50 @@ export default{
151
154
  * @return {String} Devuelve fecha formateada ya sumada
152
155
  */
153
156
  addDaysString(date, days) {
154
- let d = new Date(date);
155
- let date_utc = new Date(d.getTime() + d.getTimezoneOffset() * 60000);
156
- date_utc.setDate(date_utc.getDate() + days);
157
- let dateFormated = this.formatDate(date_utc);
158
- return dateFormated;
157
+ let d = new Date(date);
158
+ let date_utc = new Date(d.getTime() + d.getTimezoneOffset() * 60000);
159
+ date_utc.setDate(date_utc.getDate() + days);
160
+ let dateFormated = this.formatDate(date_utc);
161
+ return dateFormated;
159
162
  },
160
163
 
161
-
162
-
163
164
  /**
164
165
  * Formatea fecha Date a string con formato YYYY-MM-DD
165
166
  *
166
167
  * @param {Date} date - Fecha a formatear
167
168
  * @return {String} Fecha formateada
168
169
  */
169
- formatDate(date){
170
- let month = '' + (date.getMonth() + 1),
171
- day = '' +date.getDate(),
172
- year = date.getFullYear();
170
+ formatDate(date) {
171
+ let month = "" + (date.getMonth() + 1),
172
+ day = "" + date.getDate(),
173
+ year = date.getFullYear();
173
174
 
174
- if (month.length < 2) month = '0' + month;
175
- if (day.length < 2) day = '0' + day;
175
+ if (month.length < 2) month = "0" + month;
176
+ if (day.length < 2) day = "0" + day;
176
177
 
177
- return [year, month, day].join('-');
178
+ return [year, month, day].join("-");
178
179
  },
179
180
 
180
-
181
181
  /**
182
- * Formatea fecha Date a string con formato YYYY-MM-DD
182
+ * Formatea fecha Date a string con formato 01 de Enero, 2023
183
183
  *
184
184
  * @param {Date} date - Fecha a formatear
185
185
  * @return {String} Fecha formateada
186
186
  */
187
- formatDateReadeable(dateParam){
187
+ formatDateReadeable(dateParam) {
188
188
  let date = dateParam;
189
-
190
- if(typeof dateParam == "string" ){
191
- date = new Date(dateParam+"T12:00:00-00:00");
192
- }
193
189
 
194
- //let month = '' + (date.getMonth() + 1),
195
- let day = date.getDate();
196
- let year = date.getFullYear();
190
+ if (typeof dateParam == "string") {
191
+ date = new Date(dateParam + "T12:00:00-00:00");
192
+ }
197
193
 
198
- let monthReadeable = utils.toCapitalize(date.toLocaleString('default', { month: 'long' }));
194
+ let day = date.getDate();
195
+ let year = date.getFullYear();
199
196
 
200
- //if (month.length < 2) month = '0' + month;
201
- //if (day.length < 2) day = '0' + day;
197
+ let monthReadeable = utils.toCapitalize(
198
+ date.toLocaleString("default", { month: "long" })
199
+ );
202
200
 
203
- //return [year, month, day].join('-');
204
201
  return `${day} de ${monthReadeable} , ${year}`;
205
- },
206
-
207
- }
202
+ }
203
+ };