@live-change/vue3-components 0.2.33 → 0.2.35

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.
@@ -77,7 +77,7 @@
77
77
  type: String
78
78
  }
79
79
  },
80
- emits: ['submit', 'done', 'error'],
80
+ emits: ['validate', 'submit', 'done', 'error'],
81
81
  inject: ['loadingZone', 'workingZone'],
82
82
  data() {
83
83
  return {
@@ -228,6 +228,8 @@
228
228
  parameters: { ...this.parameters, ...additionalParameters }
229
229
  })
230
230
 
231
+ this.$emit("validate", { parameters: { ...this.parameters, ...additionalParameters }, form: this })
232
+
231
233
  const validationError = await this.validate({
232
234
  parameters: { ...this.parameters, ...additionalParameters }
233
235
  })
@@ -248,7 +250,7 @@
248
250
  //console.trace("SUBMIT!")
249
251
  debug("SUBMIT DATA:\n"+JSON.stringify(parameters, null, " "))
250
252
 
251
- this.$emit("submit", { parameters })
253
+ this.$emit("submit", { parameters, form: this })
252
254
 
253
255
  return this.$api.request([this.service, this.action], parameters).then((result) => {
254
256
  debug("DATA SUBMITED")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/vue3-components",
3
- "version": "0.2.33",
3
+ "version": "0.2.35",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,10 +21,10 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-framework-vue3",
23
23
  "dependencies": {
24
- "@live-change/vue3-ssr": "^0.2.33",
24
+ "@live-change/vue3-ssr": "^0.2.35",
25
25
  "debug": "^4.3.4",
26
- "mitt": "3.0.0",
27
- "vue": "^3.2.47"
26
+ "mitt": "3.0.1",
27
+ "vue": "^3.4.19"
28
28
  },
29
- "gitHead": "cd48bb411965818bb6716798f9cc33af33dae96d"
29
+ "gitHead": "9e6d202e22c70e585b57109d0136f85030f240bb"
30
30
  }
@@ -0,0 +1,228 @@
1
+ <template>
2
+ <div>
3
+
4
+ <scroll-border placement="top"
5
+ key="top-scroll-border"
6
+ :load="loadTop"
7
+ :canLoad="canLoadTop"
8
+ :loadSensorSize="loadTopSensorSize"
9
+ :drop="dropTop"
10
+ :canDrop="canDropTop"
11
+ :dropSensorSize="dropTopSensorSize"
12
+ :loadDelay="loadTopDelay"
13
+ :dropDelay="loadBottomDelay"
14
+ />
15
+
16
+ <slot v-if="loadingTop" name="loadingTop"></slot>
17
+
18
+ <template v-for="(bucket, bucketIndex) in buckets.buckets" :key="bucket.id">
19
+
20
+ <slot v-for="(item, itemIndex) in bucket.data" v-bind="{ item, bucket, itemIndex, bucketIndex }">
21
+ <h4>{{bucketIndex}}.{{itemIndex}}</h4>
22
+ <pre>{{ item }}</pre>
23
+ </slot>
24
+
25
+ </template>
26
+
27
+ <slot v-if="loadingBottom" name="loadingBottom"></slot>
28
+
29
+ <scroll-border placement="bottom"
30
+ key="bottom-scroll-border"
31
+ :load="loadBottom"
32
+ :canLoad="canLoadBottom"
33
+ :loadSensorSize="loadBottomSensorSize"
34
+ :drop="dropBottom"
35
+ :canDrop="canDropBottom"
36
+ :dropSensorSize="dropBottomSensorSize"
37
+ :loadDelay="loadTopDelay"
38
+ :dropDelay="loadBottomDelay"
39
+ />
40
+
41
+ </div>
42
+ </template>
43
+
44
+ <script setup>
45
+
46
+ import ScrollBorder from 'vue3-scroll-border'
47
+ import { ref, toRefs, defineProps, defineEmits, watch } from 'vue'
48
+ import { rangeBuckets } from '@live-change/vue3-ssr'
49
+
50
+ const props = defineProps({
51
+ pathFunction: {
52
+ type: Function,
53
+ default: undefined
54
+ },
55
+ buckets:{
56
+ type: Object,
57
+ default: undefined
58
+ },
59
+ bucketSize: {
60
+ type: Number,
61
+ default: 20
62
+ },
63
+ initialPosition: {
64
+ type: String,
65
+ default: undefined
66
+ },
67
+ softClose: {
68
+ type: Boolean,
69
+ default: false
70
+ },
71
+ canLoadTop: {
72
+ type: Boolean,
73
+ default: true
74
+ },
75
+ canDropTop: {
76
+ type: Boolean,
77
+ default: false
78
+ },
79
+ canLoadBottom: {
80
+ type: Boolean,
81
+ default: true
82
+ },
83
+ canDropBottom: {
84
+ type: Boolean,
85
+ default: false
86
+ },
87
+ loadTopSensorSize: {
88
+ type: Number,
89
+ default: '500px'
90
+ },
91
+ loadBottomSensorSize: {
92
+ type: Number,
93
+ default: '500px'
94
+ },
95
+ dropTopSensorSize: {
96
+ type: Number,
97
+ default: '5000px'
98
+ },
99
+ dropBottomSensorSize: {
100
+ type: Number,
101
+ default: '5000px'
102
+ },
103
+ loadTopDelay: {
104
+ type: Number,
105
+ default: 200
106
+ },
107
+ loadBottomDelay: {
108
+ type: Number,
109
+ default: 200
110
+ },
111
+ dropTopDelay: {
112
+ type: Number,
113
+ default: 200
114
+ },
115
+ dropBottomDelay: {
116
+ type: Number,
117
+ default: 200
118
+ }
119
+ })
120
+
121
+ const {
122
+ pathFunction, bucketSize, initialPosition, softClose,
123
+ loadTopSensorSize, loadBottomSensorSize, dropTopSensorSize, dropBottomSensorSize,
124
+ loadTopDelay, loadBottomDelay, dropTopDelay, dropBottomDelay,
125
+ } = toRefs(props)
126
+
127
+ const emit = defineEmits([
128
+ 'loadTop', 'loadBottom', 'loadedTop', 'loadedBottom',
129
+ 'dropTop', 'dropBottom', 'droppedTop', 'droppedBottom'
130
+ ])
131
+
132
+ const loadingTop = ref(false)
133
+ const loadingBottom = ref(false)
134
+
135
+ async function createBuckets() {
136
+ return rangeBuckets(
137
+ (range, p) => pathFunction.value(range, p),
138
+ {
139
+ bucketSize: bucketSize.value,
140
+ initialPosition: initialPosition.value,
141
+ softClose: softClose.value
142
+ }
143
+ )
144
+ }
145
+
146
+ const buckets = ref()
147
+
148
+ if(props.buckets) {
149
+ buckets.value = props.buckets
150
+ } else if(props.pathFunction) {
151
+ const [ initialBuckets ] = await Promise.all([
152
+ createBuckets()
153
+ ])
154
+ watch(pathFunction, async () => {
155
+ console.warn("PATH FUNCTION CHANGED - BUCKETS RELOAD EXPERIMENTAL!")
156
+ const newBuckets = await createBuckets()
157
+ if(buckets.value) buckets.value.dispose()
158
+ buckets.value = newBuckets
159
+ })
160
+ buckets.value = initialBuckets
161
+ } else {
162
+ throw new Error("Either buckets or pathFunction must be provided")
163
+ }
164
+
165
+ function canLoadBottom() {
166
+ return props.canLoadBottom && buckets.value.canLoadBottom()
167
+ }
168
+ function canLoadTop() {
169
+ return props.canLoadTop && buckets.value.canLoadTop()
170
+ }
171
+ function canDropTop() {
172
+ return props.canDropTop && buckets.value.buckets.length > 2
173
+ }
174
+ function canDropBottom() {
175
+ return props.canDropBottom && buckets.value.buckets.length > 2
176
+ }
177
+
178
+
179
+ async function loadTop() {
180
+ if(!props.canLoadTop) return
181
+ if(!buckets.value.canLoadTop()) return
182
+ emit('loadTop')
183
+ loadingTop.value = true
184
+ const result = await buckets.value.loadTop()
185
+ loadingTop.value = false
186
+ emit('loadedTop')
187
+ return result
188
+ }
189
+
190
+ async function loadBottom() {
191
+ if(!props.canLoadBottom) return
192
+ if(!buckets.value.canLoadBottom()) return
193
+ emit('loadBottom')
194
+ loadingBottom.value = true
195
+ const result = await buckets.value.loadBottom()
196
+ loadingBottom.value = false
197
+ emit('loadedBottom')
198
+ return result
199
+ }
200
+
201
+ function dropTop() {
202
+ if(!props.canDropTop) return
203
+ if(buckets.value.buckets.length < 2) return
204
+ emit('dropTop')
205
+ loadingTop.value = true
206
+ const result = buckets.value.dropTop()
207
+ loadingTop.value = false
208
+ emit('droppedTop')
209
+ return result
210
+ }
211
+
212
+ function dropBottom() {
213
+ if(!props.canDropBottom) return
214
+ if(buckets.value.buckets.length < 2) return
215
+ emit('dropBottom')
216
+ loadingBottom.value = true
217
+ const result = buckets.value.dropBottom()
218
+ loadingBottom.value = false
219
+ emit('droppedBottom')
220
+ console.log("DROPPED BOTTOM", result)
221
+ return result
222
+ }
223
+
224
+ </script>
225
+
226
+ <style scoped>
227
+
228
+ </style>
package/view/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import ScrollLoader from "./ScrollLoader.vue"
2
2
  import VisibleArea from "./VisibleArea.vue"
3
+ import RangeViewer from "./RangeViewer.vue"
3
4
 
4
- export { ScrollLoader, VisibleArea }
5
+ export { ScrollLoader, VisibleArea, RangeViewer }
5
6
 
6
7
  function registerViewComponents(app) {
7
8
  app.component("scroll-loader", ScrollLoader)