Browse Source

fix(nc-gui): prefill iso date format issue

pull/7786/head
Ramesh Mane 10 months ago
parent
commit
dc31d4db28
  1. 6
      packages/nc-gui/components/general/ColorPicker.vue
  2. 7
      packages/nc-gui/components/smartsheet/Form.vue
  3. 22
      packages/nc-gui/composables/useSharedFormViewStore.ts

6
packages/nc-gui/components/general/ColorPicker.vue

@ -104,15 +104,11 @@ watch(picked, (n, _o) => {
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: white;
}
.color-selector:not(.new-design):hover {
.color-selector:hover {
filter: brightness(90%);
-webkit-filter: brightness(90%);
}
.color-selector.new-design:hover {
box-shadow: 0px 0px 0px 2px #fff, 0px 0px 0px 4px #3069fe;
}
.color-selector.selected:not(.new-design) {
filter: brightness(90%);
-webkit-filter: brightness(90%);

7
packages/nc-gui/components/smartsheet/Form.vue

@ -360,13 +360,6 @@ async function showOrHideColumn(column: Record<string, any>, show: boolean, isSi
await $api.dbView.formColumnUpdate(column.id, column)
fields.value[fieldIndex] = column as any
// await saveOrUpdate(
// {
// ...column,
// show,
// },
// fieldIndex,
// )
reloadEventHook.trigger()

22
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -276,8 +276,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
) {
return c
}
const preFillValue = getPreFillValue(c, (route.query?.[c.title] as string).trim())
const preFillValue = getPreFillValue(c, decodeURIComponent(route.query?.[c.title] as string).trim())
if (preFillValue !== undefined) {
// Prefill form state
formState.value[c.title] = preFillValue
@ -399,21 +398,20 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
break
}
case UITypes.Date: {
const parsedDate = dayjs(value, 'YYYY-MM-DD')
if (parsedDate.isValid()) {
preFillValue = parsedDate.format('YYYY-MM-DD')
const parsedDate = dayjs(value)
if ((parsedDate.isValid() && parsedDate.toISOString() === value) || dayjs(value, 'YYYY-MM-DD').isValid()) {
preFillValue = dayjs(value).format('YYYY-MM-DD')
}
break
}
case UITypes.DateTime: {
let parsedDateTime = dayjs(value, 'YYYY-MM-DD HH:mm:ss')
const parsedDateTime = dayjs(value)
if (parsedDateTime.isValid()) {
preFillValue = parsedDateTime.utc().format('YYYY-MM-DD HH:mm:ssZ')
} else if (dayjs(value).toISOString() === value) {
if (parsedDateTime.isValid() && parsedDateTime.toISOString() === value) {
preFillValue = dayjs(value).format('YYYY-MM-DD HH:mm:ssZ')
}
if (
(parsedDateTime.isValid() && parsedDateTime.toISOString() === value) ||
dayjs(value, 'YYYY-MM-DD HH:mm:ss').isValid()
) {
preFillValue = dayjs(value).utc().format('YYYY-MM-DD HH:mm:ssZ')
}
break
}

Loading…
Cancel
Save