@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/.turbo/turbo-build.log +14 -14
- package/.turbo/turbo-lint.log +185 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -1
- package/dist/index.mjs.map +1 -1
- package/dist/styles/globals.css +3 -0
- package/dist/styles/globals.css.map +1 -1
- package/package.json +2 -2
- package/src/components/RowContextMenu.tsx +4 -1
- package/src/components/Spreadsheet.stories.tsx +92 -0
- package/src/components/SpreadsheetCell.tsx +28 -0
- package/src/types.ts +1 -1
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: () =>
|
|
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: [
|