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-width: 1px;
-webkit-text-stroke-color: white; -webkit-text-stroke-color: white;
} }
.color-selector:not(.new-design):hover { .color-selector:hover {
filter: brightness(90%); filter: brightness(90%);
-webkit-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) { .color-selector.selected:not(.new-design) {
filter: brightness(90%); filter: brightness(90%);
-webkit-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) await $api.dbView.formColumnUpdate(column.id, column)
fields.value[fieldIndex] = column as any fields.value[fieldIndex] = column as any
// await saveOrUpdate(
// {
// ...column,
// show,
// },
// fieldIndex,
// )
reloadEventHook.trigger() reloadEventHook.trigger()

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

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

Loading…
Cancel
Save