const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_index = require("../../../button/index.js");
const require_index$1 = require("../../../icon/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
let _pisell_icon_es_DotsSix = require("@pisell/icon/es/DotsSix");
_pisell_icon_es_DotsSix = require_runtime.__toESM(_pisell_icon_es_DotsSix);
require("./index.less");
//#region src/components/pisellDropSort/components/SortableItem/index.tsx
const _excluded = [
	"item",
	"depth",
	"clone",
	"ghost",
	"indicator",
	"disableSelection",
	"disableInteraction",
	"wrapperRef",
	"style",
	"onCollapse",
	"onRemove",
	"childCount",
	"indentationWidth",
	"handleProps",
	"collapsed",
	"isError"
];
const SortableItem = (props) => {
	const { itemProps, render, domRef, allowAddChild, allowDelete, allowDrag, allowIsShow, disabled, onAdd, onDelete, showBorder, spacing, maxLevel, __designMode, isCustomAction, getItemStyle } = props;
	const { item, depth, clone, ghost, indicator, disableSelection, disableInteraction, wrapperRef, style, onCollapse, onRemove, childCount, indentationWidth, handleProps, collapsed, isError } = itemProps, otherProps = require_objectWithoutProperties._objectWithoutProperties(itemProps, _excluded);
	const mergedStyle = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, (getItemStyle === null || getItemStyle === void 0 ? void 0 : getItemStyle(itemProps)) || {}), style);
	if (isError) mergedStyle.backgroundColor = "#FECDCA";
	return /* @__PURE__ */ react.default.createElement("li", require_objectSpread2._objectSpread2({
		className: (0, classnames.default)("pisell-lowcode-drop-sort-item", clone && "clone", ghost && "ghost", indicator && "indicator", disableSelection && "disableSelection", disableInteraction && "disableInteraction"),
		ref: wrapperRef,
		style: { "--spacing": `${indentationWidth * depth}px` }
	}, otherProps), /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("pisell-lowcode-drop-sort-item-tree-item", {
			"pisell-lowcode-drop-sort-item-tree-item-border": showBorder,
			disabled
		}),
		ref: domRef,
		style: mergedStyle
	}, allowDrag && !disabled && /* @__PURE__ */ react.default.createElement(require_index.default, require_objectSpread2._objectSpread2({
		icon: /* @__PURE__ */ react.default.createElement(_pisell_icon_es_DotsSix.default, { className: "pisell-lowcode-drop-sort-item-drag-handle-icon" }),
		type: "text",
		className: "pisell-lowcode-drop-sort-item-button"
	}, __designMode === "design" ? {} : require_objectSpread2._objectSpread2({}, handleProps))), onCollapse && /* @__PURE__ */ react.default.createElement(require_index.default, {
		icon: /* @__PURE__ */ react.default.createElement(require_index$1.default, {
			type: "pisell2-chevron-down",
			className: "pisell-lowcode-drop-sort-item-icon"
		}),
		onClick: onCollapse,
		type: "text",
		className: (0, classnames.default)("Collapse", collapsed && "collapsed", "pisell-lowcode-drop-sort-item-button")
	}), /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode-drop-sort-item-content" }, render && render(itemProps)), !isCustomAction && /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, !clone && allowAddChild && !disabled && /* @__PURE__ */ react.default.createElement(require_index.default, {
		icon: /* @__PURE__ */ react.default.createElement(require_index$1.default, {
			type: "pisell2-plus",
			className: "pisell-lowcode-drop-sort-item-icon"
		}),
		onClick: () => onAdd === null || onAdd === void 0 ? void 0 : onAdd(itemProps),
		type: "text",
		className: "pisell-lowcode-drop-sort-item-button"
	}), !clone && allowDelete && !disabled && /* @__PURE__ */ react.default.createElement(require_index.default, {
		icon: /* @__PURE__ */ react.default.createElement(require_index$1.default, {
			type: "pisell2-trash-01",
			className: "pisell-lowcode-drop-sort-item-icon"
		}),
		onClick: () => onDelete === null || onDelete === void 0 ? void 0 : onDelete(itemProps),
		type: "text",
		className: "pisell-lowcode-drop-sort-item-button"
	})), clone && childCount && childCount > 1 ? /* @__PURE__ */ react.default.createElement("span", { className: "pisell-lowcode-drop-sort-item-count" }, childCount) : null));
};
//#endregion
exports.default = SortableItem;
