import {computed, designComponent, PropType} from "@peryl/react-compose"; import {nextPlcBindId, PlcPropsOptions} from "../plc/utils/plc.utils"; import {iPlcDatePropsType, PlcDateInheritProps, usePlcDateInheritProps} from "./PlcDate.utils"; import {PlcDate} from "./PlcDate"; import {DatePicker} from "../../DatePicker"; import {iDatePropsType} from "../../DatePicker/date.utils"; export const PlcDateRange = designComponent({ name: 'plc-date-range', props: { ...PlcPropsOptions, ...PlcDateInheritProps, startField: { type: String, required: true }, startTitle: { type: String, required: true }, endField: { type: String, required: true }, endTitle: { type: String, required: true }, startAttrs: { type: Object as PropType> }, endAttrs: { type: Object as PropType> }, editAttrs: { type: Object as PropType> }, }, setup({ props }) { const inheritProps = usePlcDateInheritProps(props); const startBindId = nextPlcBindId(); const width = computed(() => { const isDefault = props.width === PlcPropsOptions.width.default; if (!isDefault) {return props.width;} return props.datetime ? 200 : PlcPropsOptions.width.default; }); return () => <> ( ) }} /> ; }, });