@byu-oit/vue-decision-processing-components 9.5.2 → 9.5.4

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.
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <byu-control-date-selector
3
3
  ref="selector"
4
- :value="value"
4
+ :value="internalValue"
5
5
  @change="onChange"
6
6
  :date-type="dateType"
7
7
  :prior-terms="priorTerms"
8
8
  :subsequent-terms="subsequentTerms"
9
- ></byu-control-date-selector>
9
+ />
10
10
  </template>
11
11
 
12
12
  <script>
@@ -27,27 +27,35 @@ export default {
27
27
  default: 4
28
28
  }
29
29
  },
30
+ data() {
31
+ return {
32
+ internalValue: this.value
33
+ }
34
+ },
30
35
  watch: {
31
36
  value(newVal) {
32
- const element = this.$refs.selector
33
- if (element && newVal && element.value !== newVal) {
34
- element.value = newVal
35
- element.dispatchEvent(new Event('input', { bubbles: true }))
37
+ if (this.internalValue !== newVal) {
38
+ this.internalValue = newVal
39
+ const el = this.$refs.selector
40
+ if (el && el.value !== newVal) {
41
+ el.value = newVal
42
+ el.dispatchEvent(new Event('input', { bubbles: true }))
43
+ }
36
44
  }
37
45
  }
38
46
  },
39
47
  mounted() {
40
- if (this.value) {
41
- const element = this.$refs.selector
42
- if (element && element.value !== this.value) {
43
- element.value = this.value
44
- element.dispatchEvent(new Event('input', { bubbles: true }))
45
- }
48
+ const el = this.$refs.selector
49
+ if (el && this.internalValue) {
50
+ el.value = this.internalValue
51
+ el.dispatchEvent(new Event('input', { bubbles: true }))
46
52
  }
47
53
  },
48
54
  methods: {
49
55
  onChange(e) {
50
- this.$emit('input', e.target.value)
56
+ const val = e.target.value
57
+ this.internalValue = val
58
+ this.$emit('input', val)
51
59
  }
52
60
  }
53
61
  }
package/Report.vue CHANGED
@@ -301,27 +301,18 @@ export default {
301
301
  }
302
302
  return q
303
303
  },
304
- async fetchConfigs() {
305
- try {
306
- const base = this.env === 'development'
307
- ? 'https://api-sandbox.byu.edu'
308
- : 'https://api.byu.edu'
309
- const institution = this.institution
310
- const response = await fetch(`${base}/domain/applications/${institution}/admission/v1/configs`)
311
- const json = await response.json()
312
- this.configs = [...json.closed, ...json.open]
313
- } catch (err) {
314
- console.error('Failed to fetch admit period configs:', err)
315
- }
316
- },
317
304
  setDefaultAdmitPeriod() {
318
- const today = new Date()
319
- const future = this.configs
320
- .filter(p => new Date(p.close) >= today)
321
- .sort((a, b) => new Date(a.close) - new Date(b.close))
305
+ try {
306
+ const today = new Date()
307
+ const future = this.configs
308
+ .filter(p => new Date(p.close) >= today)
309
+ .sort((a, b) => new Date(a.close) - new Date(b.close))
322
310
 
323
- if (future.length > 0) {
324
- this.selectedAdmitPeriod = future[0].admit_period
311
+ if (future.length > 0) {
312
+ this.selectedAdmitPeriod = future[0].admit_period
313
+ }
314
+ } catch (err) {
315
+ console.warn('Failed to set default admit period. Using original default admit period. Error: ', err)
325
316
  }
326
317
  },
327
318
  },
@@ -346,16 +337,7 @@ export default {
346
337
  if (this.autoRefresh) {
347
338
  document.addEventListener('visibilitychange', this.reloadOnPageBackIntoFocus)
348
339
  }
349
- // Only fetch configs if none were passed in
350
- if (this.configs.length === 0) {
351
- this.fetchConfigs()
352
- }
353
- // Only set the default admit period if we have configs, else keep the original default
354
- if (this.configs.length > 0) {
355
- this.setDefaultAdmitPeriod()
356
- } else {
357
- console.warn('No admit period configs found. Using original default admit period.')
358
- }
340
+ this.setDefaultAdmitPeriod()
359
341
  },
360
342
  beforeDestroy () {
361
343
  if (this.autoRefresh) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "9.5.2",
3
+ "version": "9.5.4",
4
4
  "description": "Vue components shared between decision processing systems for the CES schools.",
5
5
  "dependencies": {
6
6
  "@fortawesome/fontawesome-free": "^5.15.4",