import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import DatePicker from "../../../../../date-picker/index.js";
import React, { forwardRef, useMemo } from "react";
import { isString } from "@pisell/utils";
import dayjs from "dayjs";
//#region src/components/table/Table/fields/date/Edit/index.tsx
const _excluded = [
	"value",
	"onChange",
	"onPressEnter",
	"onBlur",
	"style",
	"bordered"
];
const Edit = (props, ref) => {
	const { value, onChange, onPressEnter, onBlur, style, bordered } = props, others = _objectWithoutProperties(props, _excluded);
	const dayjsVal = useMemo(() => {
		if (value && isString(value)) return dayjs(value);
		return value;
	}, [value]);
	return /* @__PURE__ */ React.createElement(DatePicker, _objectSpread2(_objectSpread2({}, others), {}, {
		controls: false,
		ref,
		value: dayjsVal,
		onChange: (date, dateStr) => {
			onChange === null || onChange === void 0 || onChange(dateStr);
		},
		onPressEnter,
		onBlur,
		style,
		bordered,
		onClick: (e) => e.stopPropagation(),
		panelRender: (dom) => {
			return /* @__PURE__ */ React.createElement("div", { onClick: (e) => e.stopPropagation() }, dom);
		}
	}));
};
var Edit_default = forwardRef(Edit);
//#endregion
export { Edit_default as default };
