@live-change/user-frontend 0.8.97 → 0.8.99

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.
@@ -43,7 +43,11 @@
43
43
  <div class="flex flex-row flex-wrap">
44
44
  <router-link v-for="contactType in contactsTypes"
45
45
  :to="{ name: 'user:connect-'+contactType.contactType }" class="mr-2 no-underline block mb-1">
46
- <Button :label="'Add '+contactType.contactType" icon="pi pi-envelope" id="connect" />
46
+ <Button v-if="contactType.contactType === 'email'"
47
+ :label="'Add '+contactType.contactType" icon="pi pi-envelope" id="connect" />
48
+ <Button v-else-if="contactType.contactType === 'phone'"
49
+ :label="'Add '+contactType.contactType" icon="pi pi-phone" id="connect" />
50
+ <Button v-else :label="'Add '+contactType.contactType" icon="pi pi-envelope" id="connect" />
47
51
  </router-link>
48
52
  <router-link v-for="accountType in accountTypes"
49
53
  :to="{ name: 'user:connect-'+accountType.accountType }" class="mr-2 no-underline block mb-1">
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="flex flex-row align-items-center">
3
- <AutoComplete v-model="selectedCountry" dropdown optionLabel="dial_code" placeholder="+XX" forceSelection
3
+ <AutoComplete v-model="selectedCountry" dropdown optionLabel="dial_code" placeholder="+XX"
4
4
  :suggestions="filteredCountries" @complete="searchCountry"
5
5
  class="mr-2 w-14rem">
6
6
  <template #option="slotProps">
@@ -11,7 +11,7 @@
11
11
  style="width: 18px; height: 12.27px" />
12
12
  <div>{{ slotProps.option.name }}</div>
13
13
  </div>
14
- </template>}}
14
+ </template>
15
15
  </AutoComplete>
16
16
  <InputText v-model="rest" :disabled="!selectedCountry" class="w-full"
17
17
  pattern="[0-9 ]*" inputmode="numeric" ref="phoneInput"
@@ -45,6 +45,7 @@
45
45
  const selectedCountry = ref()
46
46
  watch(value, (newValue) => {
47
47
  if(!newValue) return
48
+ if(newValue.startsWith('+')) newValue = newValue.slice(1)
48
49
  const found = countries.find((country) => newValue.startsWith(country.dial_code))
49
50
  if(found) {
50
51
  selectedCountry.value = found
@@ -57,22 +58,44 @@
57
58
  }
58
59
  }
59
60
  })
60
- watch(selectedCountry, (country) => {
61
- if(!country) return
62
- const currentCountry = value.value && countries.find((country) => value.value.startsWith(country.dial_code))
63
- const code = typeof country === 'object' ? country.dial_code : country.replace(/[^\d]/g, '')
64
- if(currentCountry) {
65
- value.value = value.value.replace(currentCountry.dial_code, code)
66
- } else {
67
- value.value = code
61
+ watch(selectedCountry, (country, oldCountry) => {
62
+ let full = value.value
63
+ if(oldCountry && oldCountry !== country) {
64
+ const oldCode = typeof oldCountry === 'object' ? oldCountry.dial_code.slice(1) : oldCountry.replace(/[^\d]/g, '')
65
+ if(full.startsWith(oldCode)) {
66
+ full = full.slice(oldCode.length)
67
+ }
68
68
  }
69
+ if(!country) return value.value = full
70
+ const code = typeof country === 'object' ? country.dial_code.slice(1) : country.replace(/[^\d]/g, '')
71
+ full = code + full.replace(/[^\d ]/g, '')
72
+ value.value = full
69
73
  })
70
74
 
75
+
71
76
  const rest = computed({
72
- get: () => value.value && (value.value
73
- .replace(selectedCountry.value?.dial_code, '')
74
- .replace(/[^\d ]/g, '')),
75
- set: (rest) => value.value = selectedCountry.value?.dial_code + rest.replace(/[^\d ]/g, '')
77
+ get: () => {
78
+ const country = selectedCountry.value
79
+ if(country) {
80
+ const code = typeof country === 'object' ? country.dial_code.slice(1) : country.replace(/[^\d]/g, '')
81
+ if(value.value.startsWith(code)) {
82
+ return value.value.slice(code.length)
83
+ } else {
84
+ return value.value
85
+ }
86
+ } else {
87
+ return value.value
88
+ }
89
+ },
90
+ set: (rest) => {
91
+ const country = selectedCountry.value
92
+ if(country) {
93
+ const code = typeof country === 'object' ? country.dial_code.slice(1) : country.replace(/[^\d]/g, '')
94
+ value.value = code + rest.replace(/[^\d ]/g, '')
95
+ } else {
96
+ value.value = rest.replace(/[^\d ]/g, '')
97
+ }
98
+ }
76
99
  })
77
100
 
78
101
  const filteredCountries = ref(countries)
@@ -99,6 +122,8 @@
99
122
  selectedCountry.value = countries.find(c => c.code.toLowerCase() === myCountry.value.toLowerCase())
100
123
  }
101
124
 
125
+
126
+
102
127
  </script>
103
128
 
104
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-frontend",
3
- "version": "0.8.97",
3
+ "version": "0.8.99",
4
4
  "scripts": {
5
5
  "memDev": "node --inspect --expose-gc server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js",
@@ -22,29 +22,29 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/cli": "^0.8.97",
26
- "@live-change/dao": "^0.8.97",
27
- "@live-change/dao-vue3": "^0.8.97",
28
- "@live-change/dao-websocket": "^0.8.97",
29
- "@live-change/email-service": "^0.8.97",
30
- "@live-change/framework": "^0.8.97",
31
- "@live-change/identicon-service": "^0.8.97",
32
- "@live-change/image-frontend": "^0.8.97",
33
- "@live-change/message-authentication-service": "^0.8.97",
34
- "@live-change/notification-service": "^0.8.97",
35
- "@live-change/password-authentication-service": "^0.8.97",
36
- "@live-change/pattern": "^0.8.97",
37
- "@live-change/secret-code-service": "^0.8.97",
38
- "@live-change/secret-link-service": "^0.8.97",
39
- "@live-change/security-frontend": "^0.8.97",
40
- "@live-change/security-service": "^0.8.97",
41
- "@live-change/session-service": "^0.8.97",
42
- "@live-change/timer-service": "^0.8.97",
43
- "@live-change/upload-service": "^0.8.97",
44
- "@live-change/user-identification-service": "^0.8.97",
45
- "@live-change/user-service": "^0.8.97",
46
- "@live-change/vue3-components": "^0.8.97",
47
- "@live-change/vue3-ssr": "^0.8.97",
25
+ "@live-change/cli": "^0.8.99",
26
+ "@live-change/dao": "^0.8.99",
27
+ "@live-change/dao-vue3": "^0.8.99",
28
+ "@live-change/dao-websocket": "^0.8.99",
29
+ "@live-change/email-service": "^0.8.99",
30
+ "@live-change/framework": "^0.8.99",
31
+ "@live-change/identicon-service": "^0.8.99",
32
+ "@live-change/image-frontend": "^0.8.99",
33
+ "@live-change/message-authentication-service": "^0.8.99",
34
+ "@live-change/notification-service": "^0.8.99",
35
+ "@live-change/password-authentication-service": "^0.8.99",
36
+ "@live-change/pattern": "^0.8.99",
37
+ "@live-change/secret-code-service": "^0.8.99",
38
+ "@live-change/secret-link-service": "^0.8.99",
39
+ "@live-change/security-frontend": "^0.8.99",
40
+ "@live-change/security-service": "^0.8.99",
41
+ "@live-change/session-service": "^0.8.99",
42
+ "@live-change/timer-service": "^0.8.99",
43
+ "@live-change/upload-service": "^0.8.99",
44
+ "@live-change/user-identification-service": "^0.8.99",
45
+ "@live-change/user-service": "^0.8.99",
46
+ "@live-change/vue3-components": "^0.8.99",
47
+ "@live-change/vue3-ssr": "^0.8.99",
48
48
  "@vueuse/core": "^10.11.0",
49
49
  "codeceptjs-assert": "^0.0.5",
50
50
  "codeceptjs-video-helper": "0.1.3",
@@ -65,7 +65,7 @@
65
65
  "wtfnode": "^0.9.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@live-change/codeceptjs-helper": "^0.8.97",
68
+ "@live-change/codeceptjs-helper": "^0.8.99",
69
69
  "codeceptjs": "^3.6.5",
70
70
  "generate-password": "1.7.1",
71
71
  "playwright": "^1.41.2",
@@ -76,5 +76,5 @@
76
76
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
77
77
  "license": "BSD-3-Clause",
78
78
  "description": "",
79
- "gitHead": "5e1beea2df2a168d9da8f9fa802f4340de9d75e6"
79
+ "gitHead": "7d9970c62f5d019473e04353c5b4890683fa5dd6"
80
80
  }