@rypen-dev/shared-components 8.0.11 → 8.0.13

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@rypen-dev/shared-components",
3
3
  "description": "Shared styles and Vuejs ui components for Rypen projects. Starting with version 8, this package is built with Vite 7 and Vue 3.",
4
- "version": "8.0.11",
4
+ "version": "8.0.13",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "scripts": {
@@ -18,7 +18,10 @@
18
18
  },
19
19
 
20
20
  file: [Object, File],
21
- id: String,
21
+ id: {
22
+ type: String,
23
+ required: true,
24
+ },
22
25
  updating: {
23
26
  type: Boolean,
24
27
  default: false,
@@ -44,11 +47,12 @@
44
47
  const emit = defineEmits(['change']);
45
48
 
46
49
  const reader = ref(null);
50
+ const internalFile = ref('');
47
51
  const fileupload = ref(null);
48
52
 
49
53
  onMounted(() => {
50
54
  if (props.file) {
51
- internalFile.value = props.assetBasePath + props.file;
55
+ internalFile.value = props.assetBasePath + props.file;
52
56
  }
53
57
 
54
58
  reader.value = new FileReader();
@@ -60,7 +64,6 @@
60
64
  if (files[0]) {
61
65
  readFile(files[0]);
62
66
 
63
- // emit the file change
64
67
  emit('change', files[0]);
65
68
  }
66
69
  }
@@ -58,7 +58,6 @@
58
58
  default: false,
59
59
  },
60
60
  });
61
-
62
61
  const emit = defineEmits(['navigate', 'top']);
63
62
 
64
63
  const initialPageset = reactive([]);
@@ -18,7 +18,10 @@
18
18
  import { ref, reactive, computed, watch, onMounted } from 'vue';
19
19
 
20
20
  const props = defineProps({
21
- id: String,
21
+ id: {
22
+ type: String,
23
+ required: true,
24
+ },
22
25
  label: String,
23
26
  externalValueId: String,
24
27
  externalValueName: String,
@@ -24,14 +24,16 @@
24
24
  type: String,
25
25
  default: 'No',
26
26
  },
27
- id: String,
27
+ id: {
28
+ type: String,
29
+ required: true,
30
+ },
28
31
  cssClass: String,
29
32
  });
33
+ const emit = defineEmits(['change']);
30
34
 
31
35
  const internalValue = ref(props.value);
32
36
 
33
- const emit = defineEmits(['change']);
34
-
35
37
  function change() {
36
38
  internalValue.value = !internalValue.value;
37
39
  emit('change', internalValue.value);
@@ -1,13 +1,12 @@
1
1
  <template>
2
2
  <div class="timespan">
3
3
  <div class="input-container">
4
- <input type="number" :min="0" :max="9999" @change="updateValue" :value="value" />
4
+ <input type="number" :min="0" :max="9999" @change="updateValue" :value="daysValue" />
5
5
  </div>
6
6
  <div class="input-container select">
7
7
  <select :value="selectedInterval" @change="updateTimeInterval">
8
8
  <option :value="TIMESPAN_INTERVALS.DAYS">Days</option>
9
9
  <option :value="TIMESPAN_INTERVALS.WEEKS">Weeks</option>
10
- <option :value="TIMESPAN_INTERVALS.MONTHS">Months</option>
11
10
  <option :value="TIMESPAN_INTERVALS.YEARS">Years</option>
12
11
  </select>
13
12
  </div>
@@ -17,7 +16,6 @@
17
16
  const TIMESPAN_INTERVALS = {
18
17
  DAYS: 'DAYS',
19
18
  WEEKS: 'WEEKS',
20
- MONTHS: 'MONTHS',
21
19
  YEARS: 'YEARS',
22
20
  };
23
21
 
@@ -32,7 +30,7 @@
32
30
  });
33
31
  const emit = defineEmits(['update']);
34
32
 
35
- const value = ref('');
33
+ const daysValue = ref('');
36
34
  const selectedInterval = ref(TIMESPAN_INTERVALS.DAYS);
37
35
 
38
36
  onMounted(() => {
@@ -53,7 +51,7 @@
53
51
  }
54
52
  }
55
53
 
56
- value.value = newValue;
54
+ daysValue.value = newValue;
57
55
  selectedInterval.value = newInterval;
58
56
  }
59
57
 
@@ -70,9 +68,9 @@
70
68
  newValue = newValue / 7;
71
69
  newInterval = TIMESPAN_INTERVALS.WEEKS;
72
70
  }
73
- } else if (selectedInterval.value === TIMESPAN_INTERVALS.MONTHS) {
74
- if (value % 12 === 0) {
75
- newValue = value / 12;
71
+ } else if (selectedInterval.value === TIMESPAN_INTERVALS.WEEKS) {
72
+ if (value % 52 === 0) {
73
+ newValue = value / 52;
76
74
  newInterval = TIMESPAN_INTERVALS.YEARS;
77
75
  }
78
76
  }
@@ -81,7 +79,7 @@
81
79
  newInterval = TIMESPAN_INTERVALS.DAYS;
82
80
  }
83
81
 
84
- value.value = newValue;
82
+ daysValue.value = newValue;
85
83
  selectedInterval.value = newInterval;
86
84
 
87
85
  if (callback !== undefined) {
@@ -93,7 +91,7 @@
93
91
  const { value } = e.target;
94
92
  selectedInterval.value = value;
95
93
 
96
- syncValueAndInterval(value, sendUpdate);
94
+ syncValueAndInterval(daysValue.value, sendUpdate);
97
95
  };
98
96
 
99
97
  function updateValue(e) {
@@ -106,7 +104,7 @@
106
104
  };
107
105
 
108
106
  const realValue = computed(() => {
109
- let finalValue = value.value;
107
+ let finalValue = daysValue.value;
110
108
 
111
109
  if (selectedInterval.value === TIMESPAN_INTERVALS.WEEKS) {
112
110
  finalValue = finalValue * 7;