const require_runtime = require("../../../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_index = require("../../../../../input/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let ahooks = require("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 = (0, react.useRef)(null);
	const mountTime = (0, react.useRef)((/* @__PURE__ */ new Date()).getTime());
	(0, ahooks.useClickAway)(() => {
		if ((/* @__PURE__ */ new Date()).getTime() - mountTime.current < 100) return;
		onBlur();
	}, wrapRef);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: "",
		onClick: (e) => e.stopPropagation(),
		ref: wrapRef
	}, /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		label: "Default value",
		name: "default_value",
		initialValue: content
	}, /* @__PURE__ */ react.default.createElement(require_index.default, {
		ref,
		onChange: (e) => onChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, value), {}, { content: e.target.value }))
	})), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		label: "Link Url",
		name: "link_url",
		initialValue: url
	}, /* @__PURE__ */ react.default.createElement(require_index.default, { onChange: (e) => onChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, value), {}, { url: e.target.value })) })));
};
var Edit_default = (0, react.forwardRef)(Edit);
//#endregion
exports.default = Edit_default;
