import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
import { PropertyEditorList } from "../../../../../CommonUI/PropertyEditing/PropertyEditorList";
import { StateManager } from "../../../../../CommonUI/StateManagement/StateManager";
import { BaseRule } from "../BaseRule";
export class BaseObjectRule extends BaseRule {
    renderListEditor(cell) {
        return (_jsx(PropertyEditorList, { list: cell.values.map((item, idx) => ({ name: `object ${idx}`, item })), prototype: () => {
                cell.values.push({});
                return {};
            }, showDialogCancel: false, itemUI: (item) => ({
                onComplete: (item) => {
                    if (!item.content) {
                        cell.values.splice(item.index, 1);
                    }
                    StateManager.propertyChanged(cell, "values");
                },
                onCancel: () => {
                    delete item.content;
                },
                ui: _jsx("div", { children: item.content && _jsx(_Fragment, {}, void 0) }, void 0),
            }) }, void 0));
    }
    renderOneLineEditor(cell) {
        return _jsx(_Fragment, {}, void 0);
    }
}
//# sourceMappingURL=BaseObjectRule.js.map