@fy-/fws-vue 0.9.4 → 0.9.6

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.
@@ -14,10 +14,12 @@ const props = withDefaults(
14
14
  defineProps<{
15
15
  imageDomain?: string;
16
16
  onCompleted?: (data: any) => void;
17
+ hidePublic?: boolean;
17
18
  }>(),
18
19
  {
19
20
  imageDomain: "https://s.nocachenocry.com",
20
21
  onCompleted: () => {},
22
+ hidePublic: false,
21
23
  },
22
24
  );
23
25
  const rest = useRest();
@@ -70,9 +72,15 @@ const patchUser = async () => {
70
72
  if (await v$.value.userData.$validate()) {
71
73
  const data = { ...state.userData };
72
74
  const birtdate = new Date(`${data.Birthdate}T00:00:00Z`);
73
- const birtdateAtUnixms = birtdate.getTime();
75
+ try {
76
+ const birtdateAtUnixms = birtdate.getTime();
77
+ // format for go in string
78
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
79
+ } catch (e) {
80
+ const birtdateAtUnixms = new Date(birtdate).getTime();
81
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
82
+ }
74
83
  // @ts-ignore
75
- data.Birthdate = birtdateAtUnixms;
76
84
  const response = await rest("User/_Profile", "PATCH", data);
77
85
  if (response && response.result == "success") {
78
86
  if (props.onCompleted) {
@@ -211,7 +219,7 @@ function selectFile(e: Event) {
211
219
  id="birthdateFWS"
212
220
  v-model="state.userData.Birthdate"
213
221
  class="mb-4"
214
- type="date"
222
+ type="datepicker"
215
223
  :label="$t('fws_birthdate_label')"
216
224
  :error-vuelidate="v$.userData.Birthdate.$errors"
217
225
  />
@@ -223,28 +231,29 @@ function selectFile(e: Event) {
223
231
  :label="$t('fws_bio_label')"
224
232
  :error-vuelidate="v$.userData.Bio.$errors"
225
233
  />
226
- <DefaultInput
227
- id="publicGenderFWS"
228
- v-model:checkbox-value="state.userData.PublicGender"
229
- type="toggle"
230
- :label="$t('fws_public_gender')"
231
- :error-vuelidate="v$.userData.PublicGender.$errors"
232
- />
233
- <DefaultInput
234
- id="publicBioFWS"
235
- v-model:checkbox-value="state.userData.PublicBio"
236
- type="toggle"
237
- :label="$t('fws_public_bio')"
238
- :error-vuelidate="v$.userData.PublicBio.$errors"
239
- />
240
- <DefaultInput
241
- id="publicBirthdateFWS"
242
- v-model:checkbox-value="state.userData.PublicBirthdate"
243
- type="toggle"
244
- :label="$t('fws_public_birthdate')"
245
- :error-vuelidate="v$.userData.PublicBirthdate.$errors"
246
- />
247
-
234
+ <template v-if="!hidePublic">
235
+ <DefaultInput
236
+ id="publicGenderFWS"
237
+ v-model:checkbox-value="state.userData.PublicGender"
238
+ type="toggle"
239
+ :label="$t('fws_public_gender')"
240
+ :error-vuelidate="v$.userData.PublicGender.$errors"
241
+ />
242
+ <DefaultInput
243
+ id="publicBioFWS"
244
+ v-model:checkbox-value="state.userData.PublicBio"
245
+ type="toggle"
246
+ :label="$t('fws_public_bio')"
247
+ :error-vuelidate="v$.userData.PublicBio.$errors"
248
+ />
249
+ <DefaultInput
250
+ id="publicBirthdateFWS"
251
+ v-model:checkbox-value="state.userData.PublicBirthdate"
252
+ type="toggle"
253
+ :label="$t('fws_public_birthdate')"
254
+ :error-vuelidate="v$.userData.PublicBirthdate.$errors"
255
+ />
256
+ </template>
248
257
  <div class="flex">
249
258
  <button type="submit" class="btn defaults primary">
250
259
  {{ $t("fws_save_user_cta") }}
@@ -82,9 +82,14 @@ const patchUser = async () => {
82
82
  if (await v$.value.userData.$validate()) {
83
83
  const data = { ...state.userData };
84
84
  const birtdate = new Date(`${data.Birthdate}T00:00:00Z`);
85
- const birtdateAtUnixms = birtdate.getTime();
86
- // @ts-ignore
87
- data.Birthdate = birtdateAtUnixms;
85
+ try {
86
+ const birtdateAtUnixms = birtdate.getTime();
87
+ // format for go in string
88
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
89
+ } catch (e) {
90
+ const birtdateAtUnixms = new Date(birtdate).getTime();
91
+ data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
92
+ }
88
93
  const response = await rest("User/_ForceProfile", "PATCH", data);
89
94
  if (response && response.result == "success") {
90
95
  if (props.onCompleted) {
@@ -127,7 +132,7 @@ const patchUser = async () => {
127
132
  id="birthdateFWS"
128
133
  v-model="state.userData.Birthdate"
129
134
  class="mb-4"
130
- type="date"
135
+ type="datepicker"
131
136
  :label="$t('fws_birthdate_label')"
132
137
  :error-vuelidate="v$.userData.Birthdate.$errors"
133
138
  />
@@ -156,6 +156,43 @@ defineExpose({ focus, blur, getInputRef });
156
156
  @blur="handleBlur"
157
157
  />
158
158
  </div>
159
+ <div v-if="type == 'datepicker'">
160
+ <label
161
+ :for="id"
162
+ v-if="label || placeholder"
163
+ class="block mb-2 text-sm font-medium text-fv-neutral-900 dark:text-white"
164
+ >{{ label ? label : placeholder }}
165
+ </label>
166
+ <div class="relative max-w-sm">
167
+ <div
168
+ class="absolute inset-y-0 start-0 flex items-center ps-3.5 pointer-events-none"
169
+ >
170
+ <svg
171
+ class="w-4 h-4 text-fv-neutral-500 dark:text-fv-neutral-400"
172
+ aria-hidden="true"
173
+ xmlns="http://www.w3.org/2000/svg"
174
+ fill="currentColor"
175
+ viewBox="0 0 20 20"
176
+ >
177
+ <path
178
+ d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"
179
+ />
180
+ </svg>
181
+ </div>
182
+ <input
183
+ datepicker
184
+ type="text"
185
+ class="bg-fv-neutral-50 border border-fv-neutral-300 text-fv-neutral-900 text-sm rounded-lg focus:ring-fv-primary-500 focus:border-fv-primary-500 block w-full ps-10 p-2.5 dark:bg-fv-neutral-700 dark:border-fv-neutral-600 dark:placeholder-fv-neutral-400 dark:text-white dark:focus:ring-fv-primary-500 dark:focus:border-fv-primary-500"
186
+ :placeholder="placeholder"
187
+ :disabled="disabled"
188
+ :aria-describedby="help ? `${id}-help` : id"
189
+ :required="req"
190
+ @focus="handleFocus"
191
+ @blur="handleBlur"
192
+ v-model="model"
193
+ />
194
+ </div>
195
+ </div>
159
196
  <div v-if="type == 'chips' || type == 'tags'">
160
197
  <label
161
198
  :for="id"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {