import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import Input$1 from "../../../../../input/index.js";
import React, { forwardRef, useRef } from "react";
import { Form } from "antd";
import { useClickAway } from "ahooks";
//#region src/components/table/Table/fields/link/Edit/index.tsx
const Edit = (props, ref) => {
	const { value, onChange, onPressEnter, onBlur, style, bordered } = props;
	const { content, url } = value;
	const wrapRef = useRef(null);
	const mountTime = useRef((/* @__PURE__ */ new Date()).getTime());
	useClickAway(() => {
		if ((/* @__PURE__ */ new Date()).getTime() - mountTime.current < 100) return;
		onBlur();
	}, wrapRef);
	return /* @__PURE__ */ React.createElement("div", {
		className: "",
		onClick: (e) => e.stopPropagation(),
		ref: wrapRef
	}, /* @__PURE__ */ React.createElement(Form.Item, {
		label: "Default value",
		name: "default_value",
		initialValue: content
	}, /* @__PURE__ */ React.createElement(Input$1, {
		ref,
		onChange: (e) => onChange(_objectSpread2(_objectSpread2({}, value), {}, { content: e.target.value }))
	})), /* @__PURE__ */ React.createElement(Form.Item, {
		label: "Link Url",
		name: "link_url",
		initialValue: url
	}, /* @__PURE__ */ React.createElement(Input$1, { onChange: (e) => onChange(_objectSpread2(_objectSpread2({}, value), {}, { url: e.target.value })) })));
};
var Edit_default = forwardRef(Edit);
//#endregion
export { Edit_default as default };
