@live-change/vue3-components 0.1.12 → 0.1.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.
@@ -76,6 +76,7 @@
76
76
  type: String
77
77
  }
78
78
  },
79
+ emits: ['submit', 'done', 'error'],
79
80
  inject: ['loadingZone', 'workingZone'],
80
81
  data() {
81
82
  return {
@@ -289,6 +290,7 @@
289
290
  })
290
291
  },
291
292
  handleSubmitEvent(ev) {
293
+ console.log("HANDLE SUBMIT EVENT!", ev)
292
294
  ev.preventDefault()
293
295
  this.submit()
294
296
  },
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <component v-if="tag" :is="tag" v-on:submit="ev => $emit('submit', ev)" :class="class" :style="style">
2
+ <component v-if="tag" :is="tag" v-on:submit="ev => handleSubmitEvent(ev)" :class="class" :style="style">
3
3
  <slot v-bind="{ data }"></slot>
4
4
  </component>
5
5
  <slot v-else v-bind="{ data }"></slot>
@@ -388,6 +388,7 @@
388
388
  type: String
389
389
  }
390
390
  },
391
+ //emits: ['submit', 'update'],
391
392
  provide() {
392
393
  return {
393
394
  form: {
@@ -407,7 +408,7 @@
407
408
  validate: () => this.validate(),
408
409
  clearFieldValidation: (propName) => this.clearFieldValidation(propName),
409
410
  clearValidation: () => this.clearValidation(),
410
-
411
+
411
412
  addElementToArray: (propName, initialValue) => this.addElementToArray(propName, initialValue),
412
413
  removeElementFromArray: (propName, index) => this.removeElementFromArray(propName, index)
413
414
  }
@@ -519,6 +520,11 @@
519
520
  let position = getElementPositionInDocument(errorFieldElement)
520
521
  window.scrollTo(0, position.y - 100) /// TODO: remove fixed nav-bar and do it properly.
521
522
  },
523
+ handleSubmitEvent(ev) {
524
+ console.log("HANDLE SUBMIT!", ev)
525
+ ev.preventDefault()
526
+ this.$emit('submit', ev)
527
+ }
522
528
  },
523
529
  created() {
524
530
  this.initForm()
@@ -37,6 +37,7 @@
37
37
 
38
38
  export default {
39
39
  name: "LoadingZone",
40
+ emits: ['isLoading', 'error'],
40
41
  props: {
41
42
  suspense: {
42
43
  type: Boolean,
@@ -60,7 +61,15 @@
60
61
  errors
61
62
  }
62
63
  },
64
+ watch: {
65
+ isLoading(l) {
66
+ this.$emit('isLoading', l)
67
+ }
68
+ },
63
69
  computed: {
70
+ isLoading() {
71
+ return this.loading.length > 0
72
+ }
64
73
  },
65
74
  methods: {
66
75
  loadingStarted(task) {
@@ -122,6 +131,7 @@
122
131
  this.$allLoadingTasks.splice(this.$allLoadingTasks.indexOf(task), 1)
123
132
  if(this.$allLoadingErrors)
124
133
  this.$allLoadingErrors.push({ task, reason })
134
+ this.$emit('error', this.errors)
125
135
  },
126
136
  addLoadingPromise(name, promise) {
127
137
  let task = this.loadingStarted({ name, promise })
@@ -1,5 +1,5 @@
1
- <template>
2
- <slot v-bind="{ isWorking: !!working.length, working, errors }"></slot>
1
+ <template>
2
+ <slot v-bind="{ isWorking: !!working.length, working, errors }"></slot>
3
3
  <slot name="working" v-if="working.length && !errors.length">
4
4
  Processing...
5
5
  </slot>
@@ -21,6 +21,7 @@
21
21
 
22
22
  export default {
23
23
  name: "WorkingZone",
24
+ emits: ['isWorking', 'error'],
24
25
  data() {
25
26
  return {
26
27
  working: [],
@@ -29,7 +30,15 @@
29
30
  connectionProblem: false
30
31
  }
31
32
  },
33
+ watch: {
34
+ isWorking(w) {
35
+ this.$emit('isWorking', w)
36
+ }
37
+ },
32
38
  computed: {
39
+ isWorking() {
40
+ return this.working.length > 0
41
+ }
33
42
  },
34
43
  methods: {
35
44
  workingStarted(task) {
@@ -91,6 +100,7 @@
91
100
  this.$allWorkingTasks.splice(this.$allWorkingTasks.indexOf(task), 1)
92
101
  if(this.$allWorkingErrors)
93
102
  this.$allWorkingErrors.push({ task, reason })
103
+ this.$emit('error', this.errors)
94
104
  },
95
105
  addWorkingPromise(name, promise) {
96
106
  let task = this.workingStarted({ name, promise })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/vue3-components",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {