const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_index = require("../../locales/index.js");
const require_index$1 = require("../button/index.js");
const require_index$2 = require("./components/SortableItem/index.js");
const require_index$3 = require("../pisellDraggable/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _ant_design_icons = require("@ant-design/icons");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./PisellDropSort.less");
//#region src/components/pisellDropSort/PisellDropSort.tsx
const PisellDropSort = ({ value = [], allowDrag = true, allowDelete = true, allowAddChild = true, allowAddRoot = true, allowIsShow = false, disabled = false, spacing = 8, maxLevel = 3, showBorder = true, style, className, onChange, onDelete, onAdd, renderItem: propsRenderItem, leftContent, rightContent, onAddRoot, __designMode, isCustomAction, emptyContent, getItemStyle, canDrop, indentationWidth }) => {
	const renderItem = (0, react.useCallback)((itemProps, ref) => {
		return /* @__PURE__ */ react.default.createElement(require_index$2.default, {
			itemProps,
			domRef: ref,
			render: propsRenderItem,
			allowAddChild,
			allowDelete,
			allowDrag,
			allowIsShow,
			disabled,
			onAdd,
			onDelete,
			showBorder,
			spacing,
			maxLevel,
			__designMode,
			isCustomAction,
			getItemStyle
		});
	}, [
		allowAddChild,
		allowDelete,
		allowDrag,
		value,
		disabled,
		maxLevel,
		onAdd,
		onDelete,
		showBorder,
		spacing,
		isCustomAction
	]);
	const handleChange = (0, react.useCallback)((items) => {
		onChange === null || onChange === void 0 || onChange(items);
	}, [onChange]);
	const containerClassName = (0, classnames.default)("pisell-lowcode-drop-sort-container", className);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: containerClassName,
		style
	}, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode-drop-sort-container-header" }, /* @__PURE__ */ react.default.createElement("span", null, leftContent), /* @__PURE__ */ react.default.createElement("span", null, rightContent || allowAddRoot && !disabled && /* @__PURE__ */ react.default.createElement(require_index$1.default, {
		icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.PlusOutlined, null),
		type: "primary",
		onClick: () => onAddRoot === null || onAddRoot === void 0 ? void 0 : onAddRoot(),
		size: "large"
	}, require_index.getText("pisell-lowcode-drop-sort-add")))), /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-lowcode-drop-sort-container-content",
		style: { gap: spacing !== null && spacing !== void 0 ? spacing : 8 }
	}, value.length === 0 && emptyContent ? emptyContent : /* @__PURE__ */ react.default.createElement(require_index$3.SortableTree, {
		value,
		collapsible: true,
		indicator: false,
		indentationWidth,
		removable: allowDelete,
		renderItem,
		onChange: handleChange,
		canDrop,
		maxLevel
	})));
};
//#endregion
exports.default = PisellDropSort;
