@xcelsior/ui-spreadsheets 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -215,10 +215,31 @@ var SpreadsheetCell = ({
215
215
  if (isRowHovered) return "rgb(243 244 246)";
216
216
  return "white";
217
217
  };
218
+ const handleCheckboxChange = (e) => {
219
+ e.stopPropagation();
220
+ const newValue = e.target.checked;
221
+ onConfirm?.(newValue);
222
+ };
218
223
  const renderContent = () => {
219
224
  if (column.render) {
220
225
  return column.render(value, row, rowIndex);
221
226
  }
227
+ if (column.type === "checkbox") {
228
+ return /* @__PURE__ */ jsx(
229
+ "input",
230
+ {
231
+ type: "checkbox",
232
+ checked: Boolean(value),
233
+ onChange: handleCheckboxChange,
234
+ onClick: (e) => e.stopPropagation(),
235
+ disabled: !isEditable,
236
+ className: cn(
237
+ "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 cursor-pointer",
238
+ !isEditable && "cursor-not-allowed opacity-60"
239
+ )
240
+ }
241
+ );
242
+ }
222
243
  if (value === null || value === void 0 || value === "") {
223
244
  return /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "-" });
224
245
  }
@@ -231,6 +252,9 @@ var SpreadsheetCell = ({
231
252
  return String(value);
232
253
  };
233
254
  const renderEditInput = () => {
255
+ if (column.type === "checkbox") {
256
+ return renderContent();
257
+ }
234
258
  if (column.type === "select" && column.options) {
235
259
  return /* @__PURE__ */ jsx(
236
260
  "select",
@@ -2218,7 +2242,10 @@ function RowContextMenu({
2218
2242
  return /* @__PURE__ */ jsxs11(
2219
2243
  ContextMenuItem,
2220
2244
  {
2221
- onClick: () => item.onClick(row, rowId),
2245
+ onClick: (e) => {
2246
+ e.stopPropagation();
2247
+ item.onClick(row, rowId);
2248
+ },
2222
2249
  disabled: isDisabled,
2223
2250
  className: `${variantClass} ${item.className || ""}`,
2224
2251
  children: [