@live-change/image-frontend 0.9.41 → 0.9.43

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.
@@ -61,6 +61,7 @@
61
61
  const { width, height } = loaded
62
62
  size.value = { width, height }
63
63
  imageData.value = loaded
64
+ updateUrl()
64
65
  }
65
66
  if(!imageData.value && !upload.value) {
66
67
  tryCount ++
@@ -98,7 +99,7 @@
98
99
  if(props.noResize) return ''
99
100
  const domSize = stableDomSize.value
100
101
  if(props.domResize && domSize) {
101
- console.log("DOM SIZE", domSize)
102
+ //console.log("DOM SIZE", domSize)
102
103
  let width = (domSize.width * dpr)|0
103
104
  let height = (domSize.height * dpr)|0
104
105
  if(imageData.value) {
@@ -119,29 +120,32 @@
119
120
  return ''
120
121
  }
121
122
 
122
- function updateUrl() {
123
+ async function updateUrl() {
123
124
  //console.log("UPDATE URL!", upload.value)
124
125
  if(upload.value && upload.value.url) { // available upload
125
126
  size.value = { ...upload.value.size }
126
127
  url.value = upload.value.url
127
128
  return
128
129
  }
129
- if(!imageData.value) {
130
+ if(!imageData.value || (!props.imageData && props.image && imageData.value?.id !== props.image)) {
131
+ //console.log("IMAGE DATA NEED RELOAD!", imageData.value, props.image)
130
132
  tryCount = 0
131
- loadImageData()
133
+ await loadImageData()
132
134
  return
133
135
  } else {
136
+ //console.log("IMAGE DATA", imageData.value, 'UPDATE URL')
134
137
  const suffix = getSuffix()
135
138
  url.value = `/api/image/image/${props.image}${suffix}`
136
139
  }
137
140
  }
138
141
 
139
- if(!imageData.value) updateUrl()
140
142
  watch(() => props.image, () => updateUrl())
141
143
  watch(() => upload.value && upload.value.url, () => updateUrl())
142
- watch(() => imageData.value, (v) => updateUrl())
143
144
  watch(() => props.imageData, (v) => {
144
145
  imageData.value = v
146
+ updateUrl()
145
147
  })
146
148
 
149
+ if(!imageData.value) await updateUrl()
150
+
147
151
  </script>
@@ -37,6 +37,9 @@
37
37
  <Button type="button" label="Upload Image" icon="pi pi-upload" class="p-button-primary" />
38
38
  </FileInput>
39
39
  </div>
40
+ </div>
41
+ <div v-else-if="state === 'uploading'" class="h-[10em] flex items-center justify-center">
42
+
40
43
  </div>
41
44
  <div v-else>
42
45
  <ProgressSpinner />
@@ -158,7 +161,7 @@
158
161
  emit('update:modelValue', upload.value.id)
159
162
  if(sourceUpload.value) await sourceUpload.value.upload()
160
163
  await upload.value.upload()
161
- state.value = 'edit'
164
+ //state.value = 'edit'
162
165
  emit('close')
163
166
  })())
164
167
  }
package/index.js CHANGED
@@ -7,7 +7,10 @@ import preProcessImageFile from "./front/src/preprocessImageFile.js";
7
7
 
8
8
  export { ImageUpload, Image, uploadImage, preProcessImageFile, imageUploads, ImageEditor, ImageInput }
9
9
 
10
- import { inputConfig } from "@live-change/frontend-auto-form"
11
- inputConfig.types.Image = inputConfig.inputs.image = inputConfig.input(
12
- () => import('./front/src/ImageInput.vue'))
10
+ import { inputConfig, provideInputConfig } from "@live-change/frontend-auto-form"
11
+ export function provideImageInputConfig() {
12
+ const config = inputConfig(() => import('./front/src/ImageInput.vue'))
13
+ provideInputConfig({ name: 'image' }, config)
14
+ provideInputConfig({ type: 'Image' }, config)
15
+ }
13
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/image-frontend",
3
- "version": "0.9.41",
3
+ "version": "0.9.43",
4
4
  "scripts": {
5
5
  "memDev": "node server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
@@ -22,15 +22,15 @@
22
22
  "type": "module",
23
23
  "dependencies": {
24
24
  "@fortawesome/fontawesome-free": "^6.7.2",
25
- "@live-change/cli": "^0.9.41",
26
- "@live-change/dao": "^0.9.41",
27
- "@live-change/dao-vue3": "^0.9.41",
28
- "@live-change/dao-websocket": "^0.9.41",
29
- "@live-change/framework": "^0.9.41",
30
- "@live-change/image-service": "^0.9.41",
31
- "@live-change/session-service": "^0.9.41",
32
- "@live-change/vue3-components": "^0.9.41",
33
- "@live-change/vue3-ssr": "^0.9.41",
25
+ "@live-change/cli": "^0.9.43",
26
+ "@live-change/dao": "^0.9.43",
27
+ "@live-change/dao-vue3": "^0.9.43",
28
+ "@live-change/dao-websocket": "^0.9.43",
29
+ "@live-change/framework": "^0.9.43",
30
+ "@live-change/image-service": "^0.9.43",
31
+ "@live-change/session-service": "^0.9.43",
32
+ "@live-change/vue3-components": "^0.9.43",
33
+ "@live-change/vue3-ssr": "^0.9.43",
34
34
  "@vueuse/core": "^12.3.0",
35
35
  "codeceptjs-assert": "^0.0.5",
36
36
  "compression": "^1.7.5",
@@ -50,7 +50,7 @@
50
50
  "vue3-scroll-border": "0.1.6"
51
51
  },
52
52
  "devDependencies": {
53
- "@live-change/codeceptjs-helper": "^0.9.41",
53
+ "@live-change/codeceptjs-helper": "^0.9.43",
54
54
  "codeceptjs": "^3.6.10",
55
55
  "generate-password": "1.7.1",
56
56
  "playwright": "1.49.1",
@@ -61,5 +61,5 @@
61
61
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
62
62
  "license": "BSD-3-Clause",
63
63
  "description": "",
64
- "gitHead": "88ccfef9ea84e2de85935f771d2b03dabfa8d845"
64
+ "gitHead": "608a5e07398216f7f52f58ec338e7b10df457bc3"
65
65
  }