feat: migrate DateField and shared date input group
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { defineComponent, watch } from "vue";
|
||||
import { injectDateFieldRootContext } from "reka-ui";
|
||||
|
||||
/** Reka does not watch equal primitive null values after a rejected edit.
|
||||
* Clear its existing segment refs without replacing DOM, focus or IDs. */
|
||||
export default defineComponent({
|
||||
name: "EmptyDateBridge",
|
||||
props: { revision: { type: Number, required: true } },
|
||||
setup(props) {
|
||||
const base = injectDateFieldRootContext();
|
||||
watch(
|
||||
() => props.revision,
|
||||
() => {
|
||||
base.segmentValues.value = Object.fromEntries(
|
||||
Object.keys(base.segmentValues.value).map((part) => [
|
||||
part,
|
||||
part === "dayPeriod" ? "AM" : null,
|
||||
]),
|
||||
) as typeof base.segmentValues.value;
|
||||
},
|
||||
{ flush: "post" },
|
||||
);
|
||||
return () => null;
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user