@xcelsior/ui-spreadsheets 1.1.13 → 1.1.15
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.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +824 -565
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +805 -547
- package/dist/index.mjs.map +1 -1
- package/dist/styles/globals.css +58 -0
- package/dist/styles/globals.css.map +1 -1
- package/package.json +1 -1
- package/src/components/ActiveFiltersDisplay.tsx +257 -0
- package/src/components/Spreadsheet.tsx +16 -1
- package/src/components/SpreadsheetCell.tsx +13 -0
- package/src/components/SpreadsheetHeader.tsx +13 -0
- package/src/components/SpreadsheetToolbar.tsx +62 -19
- package/src/hooks/useSpreadsheetPinning.ts +8 -3
- package/src/index.ts +2 -0
- package/src/types.ts +10 -0
package/dist/index.mjs
CHANGED
|
@@ -145,7 +145,162 @@ function cn(...inputs) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// src/components/SpreadsheetCell.tsx
|
|
148
|
-
import { useState, useRef, useEffect, memo } from "react";
|
|
148
|
+
import { useState as useState2, useRef, useEffect, memo } from "react";
|
|
149
|
+
|
|
150
|
+
// src/hooks/useSpreadsheetPinning.ts
|
|
151
|
+
import { useCallback, useMemo, useState } from "react";
|
|
152
|
+
var ROW_INDEX_COLUMN_ID = "__row_index__";
|
|
153
|
+
var ROW_INDEX_COLUMN_WIDTH = 80;
|
|
154
|
+
var MIN_PINNED_COLUMN_WIDTH = 150;
|
|
155
|
+
function useSpreadsheetPinning({
|
|
156
|
+
columns,
|
|
157
|
+
columnGroups,
|
|
158
|
+
showRowIndex = true,
|
|
159
|
+
defaultPinnedColumns = [],
|
|
160
|
+
defaultPinnedRightColumns = []
|
|
161
|
+
}) {
|
|
162
|
+
const [pinnedColumns, setPinnedColumns] = useState(() => {
|
|
163
|
+
const map = /* @__PURE__ */ new Map();
|
|
164
|
+
defaultPinnedColumns.forEach((col) => {
|
|
165
|
+
map.set(col, "left");
|
|
166
|
+
});
|
|
167
|
+
defaultPinnedRightColumns.forEach((col) => {
|
|
168
|
+
map.set(col, "right");
|
|
169
|
+
});
|
|
170
|
+
return map;
|
|
171
|
+
});
|
|
172
|
+
const [collapsedGroups, setCollapsedGroups] = useState(/* @__PURE__ */ new Set());
|
|
173
|
+
const isRowIndexPinned = pinnedColumns.has(ROW_INDEX_COLUMN_ID);
|
|
174
|
+
const handleTogglePin = useCallback((columnId) => {
|
|
175
|
+
setPinnedColumns((prev) => {
|
|
176
|
+
const newMap = new Map(prev);
|
|
177
|
+
if (newMap.has(columnId)) {
|
|
178
|
+
newMap.delete(columnId);
|
|
179
|
+
} else {
|
|
180
|
+
newMap.set(columnId, "left");
|
|
181
|
+
}
|
|
182
|
+
return newMap;
|
|
183
|
+
});
|
|
184
|
+
}, []);
|
|
185
|
+
const setPinnedColumnsFromIds = useCallback((columnIds) => {
|
|
186
|
+
const map = /* @__PURE__ */ new Map();
|
|
187
|
+
columnIds.forEach((col) => {
|
|
188
|
+
map.set(col, "left");
|
|
189
|
+
});
|
|
190
|
+
setPinnedColumns(map);
|
|
191
|
+
}, []);
|
|
192
|
+
const handleToggleGroupCollapse = useCallback((groupId) => {
|
|
193
|
+
setCollapsedGroups((prev) => {
|
|
194
|
+
const newSet = new Set(prev);
|
|
195
|
+
if (newSet.has(groupId)) {
|
|
196
|
+
newSet.delete(groupId);
|
|
197
|
+
} else {
|
|
198
|
+
newSet.add(groupId);
|
|
199
|
+
}
|
|
200
|
+
return newSet;
|
|
201
|
+
});
|
|
202
|
+
}, []);
|
|
203
|
+
const visibleColumns = useMemo(() => {
|
|
204
|
+
if (!columns || !Array.isArray(columns) || columns.length === 0) {
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
let result = [...columns];
|
|
208
|
+
if (columnGroups && Array.isArray(columnGroups)) {
|
|
209
|
+
result = result.filter((column) => {
|
|
210
|
+
const group = columnGroups.find((g) => g.columns.includes(column.id));
|
|
211
|
+
if (!group) return true;
|
|
212
|
+
if (!collapsedGroups.has(group.id)) return true;
|
|
213
|
+
return pinnedColumns.has(column.id);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
const nonRowIndexPinned = Array.from(pinnedColumns.keys()).filter(
|
|
217
|
+
(id) => id !== ROW_INDEX_COLUMN_ID
|
|
218
|
+
);
|
|
219
|
+
if (nonRowIndexPinned.length === 0) {
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
const leftPinned = [];
|
|
223
|
+
const unpinned = [];
|
|
224
|
+
const rightPinned = [];
|
|
225
|
+
const pinnedLeftIds = Array.from(pinnedColumns.entries()).filter(([id, side]) => side === "left" && id !== ROW_INDEX_COLUMN_ID).map(([id]) => id);
|
|
226
|
+
const pinnedRightIds = Array.from(pinnedColumns.entries()).filter(([id, side]) => side === "right" && id !== ROW_INDEX_COLUMN_ID).map(([id]) => id);
|
|
227
|
+
for (const column of result) {
|
|
228
|
+
const pinSide = pinnedColumns.get(column.id);
|
|
229
|
+
if (pinSide === "left") {
|
|
230
|
+
leftPinned.push(column);
|
|
231
|
+
} else if (pinSide === "right") {
|
|
232
|
+
rightPinned.push(column);
|
|
233
|
+
} else {
|
|
234
|
+
unpinned.push(column);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
leftPinned.sort((a, b) => pinnedLeftIds.indexOf(a.id) - pinnedLeftIds.indexOf(b.id));
|
|
238
|
+
rightPinned.sort((a, b) => pinnedRightIds.indexOf(a.id) - pinnedRightIds.indexOf(b.id));
|
|
239
|
+
return [...leftPinned, ...unpinned, ...rightPinned];
|
|
240
|
+
}, [columns, columnGroups, collapsedGroups, pinnedColumns]);
|
|
241
|
+
const getColumnLeftOffset = useCallback(
|
|
242
|
+
(columnId) => {
|
|
243
|
+
if (columnId === ROW_INDEX_COLUMN_ID) {
|
|
244
|
+
return 0;
|
|
245
|
+
}
|
|
246
|
+
const pinnedLeft = Array.from(pinnedColumns.entries()).filter(([id, side]) => side === "left" && id !== ROW_INDEX_COLUMN_ID).map(([id]) => id);
|
|
247
|
+
const index = pinnedLeft.indexOf(columnId);
|
|
248
|
+
const isRowIndexPinnedNow = pinnedColumns.has(ROW_INDEX_COLUMN_ID);
|
|
249
|
+
const baseOffset = showRowIndex && isRowIndexPinnedNow ? ROW_INDEX_COLUMN_WIDTH : 0;
|
|
250
|
+
if (index === -1) return baseOffset;
|
|
251
|
+
let offset = baseOffset;
|
|
252
|
+
for (let i = 0; i < index; i++) {
|
|
253
|
+
const col = columns.find((c) => c.id === pinnedLeft[i]);
|
|
254
|
+
const configuredWidth = col?.minWidth || col?.width || MIN_PINNED_COLUMN_WIDTH;
|
|
255
|
+
offset += Math.max(configuredWidth, MIN_PINNED_COLUMN_WIDTH);
|
|
256
|
+
}
|
|
257
|
+
return offset;
|
|
258
|
+
},
|
|
259
|
+
[pinnedColumns, columns, showRowIndex]
|
|
260
|
+
);
|
|
261
|
+
const isColumnPinned = useCallback(
|
|
262
|
+
(columnId) => {
|
|
263
|
+
return pinnedColumns.has(columnId);
|
|
264
|
+
},
|
|
265
|
+
[pinnedColumns]
|
|
266
|
+
);
|
|
267
|
+
const getColumnPinSide = useCallback(
|
|
268
|
+
(columnId) => {
|
|
269
|
+
return pinnedColumns.get(columnId);
|
|
270
|
+
},
|
|
271
|
+
[pinnedColumns]
|
|
272
|
+
);
|
|
273
|
+
const getColumnRightOffset = useCallback(
|
|
274
|
+
(columnId) => {
|
|
275
|
+
const pinnedRight = Array.from(pinnedColumns.entries()).filter(([, side]) => side === "right").map(([id]) => id);
|
|
276
|
+
const index = pinnedRight.indexOf(columnId);
|
|
277
|
+
if (index === -1) return 0;
|
|
278
|
+
let offset = 0;
|
|
279
|
+
for (let i = pinnedRight.length - 1; i > index; i--) {
|
|
280
|
+
const col = columns.find((c) => c.id === pinnedRight[i]);
|
|
281
|
+
const configuredWidth = col?.minWidth || col?.width || MIN_PINNED_COLUMN_WIDTH;
|
|
282
|
+
offset += Math.max(configuredWidth, MIN_PINNED_COLUMN_WIDTH);
|
|
283
|
+
}
|
|
284
|
+
return offset;
|
|
285
|
+
},
|
|
286
|
+
[pinnedColumns, columns]
|
|
287
|
+
);
|
|
288
|
+
return {
|
|
289
|
+
pinnedColumns,
|
|
290
|
+
isRowIndexPinned,
|
|
291
|
+
collapsedGroups,
|
|
292
|
+
visibleColumns,
|
|
293
|
+
handleTogglePin,
|
|
294
|
+
handleToggleGroupCollapse,
|
|
295
|
+
setPinnedColumnsFromIds,
|
|
296
|
+
getColumnLeftOffset,
|
|
297
|
+
getColumnRightOffset,
|
|
298
|
+
isColumnPinned,
|
|
299
|
+
getColumnPinSide
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// src/components/SpreadsheetCell.tsx
|
|
149
304
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
150
305
|
var cellPaddingCompact = "px-1 py-px";
|
|
151
306
|
var cellPaddingNormal = "px-2 py-1";
|
|
@@ -182,7 +337,7 @@ var SpreadsheetCell = ({
|
|
|
182
337
|
onViewComments,
|
|
183
338
|
className
|
|
184
339
|
}) => {
|
|
185
|
-
const [localValue, setLocalValue] =
|
|
340
|
+
const [localValue, setLocalValue] = useState2(value);
|
|
186
341
|
const inputRef = useRef(null);
|
|
187
342
|
const selectRef = useRef(null);
|
|
188
343
|
useEffect(() => {
|
|
@@ -361,6 +516,18 @@ var SpreadsheetCell = ({
|
|
|
361
516
|
style: {
|
|
362
517
|
backgroundColor: isInSelection ? "rgb(239 246 255)" : getBackgroundColor(),
|
|
363
518
|
minWidth: column.minWidth || column.width,
|
|
519
|
+
// Pinned columns must have a fixed width so sticky offsets stay correct.
|
|
520
|
+
// Enforce MIN_PINNED_COLUMN_WIDTH so header actions always fit.
|
|
521
|
+
...isPinned && {
|
|
522
|
+
width: Math.max(
|
|
523
|
+
column.minWidth || column.width || MIN_PINNED_COLUMN_WIDTH,
|
|
524
|
+
MIN_PINNED_COLUMN_WIDTH
|
|
525
|
+
),
|
|
526
|
+
maxWidth: Math.max(
|
|
527
|
+
column.minWidth || column.width || MIN_PINNED_COLUMN_WIDTH,
|
|
528
|
+
MIN_PINNED_COLUMN_WIDTH
|
|
529
|
+
)
|
|
530
|
+
},
|
|
364
531
|
...positionStyles,
|
|
365
532
|
...selectionBorderStyles
|
|
366
533
|
},
|
|
@@ -461,7 +628,7 @@ var MemoizedSpreadsheetCell = memo(SpreadsheetCell, (prevProps, nextProps) => {
|
|
|
461
628
|
MemoizedSpreadsheetCell.displayName = "MemoizedSpreadsheetCell";
|
|
462
629
|
|
|
463
630
|
// src/components/SpreadsheetFilterDropdown.tsx
|
|
464
|
-
import { useEffect as useEffect2, useRef as useRef2, useState as
|
|
631
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
465
632
|
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
466
633
|
var TEXT_OPERATORS = [
|
|
467
634
|
{ value: "contains", label: "Contains" },
|
|
@@ -507,24 +674,24 @@ var SpreadsheetFilterDropdown = ({
|
|
|
507
674
|
onClose,
|
|
508
675
|
className
|
|
509
676
|
}) => {
|
|
510
|
-
const [textOperator, setTextOperator] =
|
|
677
|
+
const [textOperator, setTextOperator] = useState3(
|
|
511
678
|
filter?.textCondition?.operator || "contains"
|
|
512
679
|
);
|
|
513
|
-
const [textValue, setTextValue] =
|
|
514
|
-
const [numberOperator, setNumberOperator] =
|
|
680
|
+
const [textValue, setTextValue] = useState3(filter?.textCondition?.value || "");
|
|
681
|
+
const [numberOperator, setNumberOperator] = useState3(
|
|
515
682
|
filter?.numberCondition?.operator || "equals"
|
|
516
683
|
);
|
|
517
|
-
const [numberValue, setNumberValue] =
|
|
684
|
+
const [numberValue, setNumberValue] = useState3(
|
|
518
685
|
filter?.numberCondition?.value?.toString() || ""
|
|
519
686
|
);
|
|
520
|
-
const [numberValueTo, setNumberValueTo] =
|
|
687
|
+
const [numberValueTo, setNumberValueTo] = useState3(
|
|
521
688
|
filter?.numberCondition?.valueTo?.toString() || ""
|
|
522
689
|
);
|
|
523
|
-
const [dateOperator, setDateOperator] =
|
|
690
|
+
const [dateOperator, setDateOperator] = useState3(
|
|
524
691
|
filter?.dateCondition?.operator || "equals"
|
|
525
692
|
);
|
|
526
|
-
const [dateValue, setDateValue] =
|
|
527
|
-
const [dateValueTo, setDateValueTo] =
|
|
693
|
+
const [dateValue, setDateValue] = useState3(filter?.dateCondition?.value || "");
|
|
694
|
+
const [dateValueTo, setDateValueTo] = useState3(filter?.dateCondition?.valueTo || "");
|
|
528
695
|
const dropdownRef = useRef2(null);
|
|
529
696
|
const isNumeric = column.type === "number";
|
|
530
697
|
const isDate = column.type === "date";
|
|
@@ -767,7 +934,198 @@ SpreadsheetFilterDropdown.displayName = "SpreadsheetFilterDropdown";
|
|
|
767
934
|
|
|
768
935
|
// src/components/SpreadsheetToolbar.tsx
|
|
769
936
|
import React3 from "react";
|
|
937
|
+
|
|
938
|
+
// src/components/ActiveFiltersDisplay.tsx
|
|
770
939
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
940
|
+
var TEXT_OPERATOR_LABELS = {
|
|
941
|
+
contains: "contains",
|
|
942
|
+
notContains: "does not contain",
|
|
943
|
+
equals: "equals",
|
|
944
|
+
notEquals: "does not equal",
|
|
945
|
+
startsWith: "starts with",
|
|
946
|
+
endsWith: "ends with",
|
|
947
|
+
isEmpty: "is empty",
|
|
948
|
+
isNotEmpty: "is not empty"
|
|
949
|
+
};
|
|
950
|
+
var NUMBER_OPERATOR_LABELS = {
|
|
951
|
+
equals: "=",
|
|
952
|
+
notEquals: "\u2260",
|
|
953
|
+
greaterThan: ">",
|
|
954
|
+
greaterThanOrEqual: "\u2265",
|
|
955
|
+
lessThan: "<",
|
|
956
|
+
lessThanOrEqual: "\u2264",
|
|
957
|
+
between: "between",
|
|
958
|
+
isEmpty: "is empty",
|
|
959
|
+
isNotEmpty: "is not empty"
|
|
960
|
+
};
|
|
961
|
+
var DATE_OPERATOR_LABELS = {
|
|
962
|
+
equals: "is",
|
|
963
|
+
notEquals: "is not",
|
|
964
|
+
before: "before",
|
|
965
|
+
after: "after",
|
|
966
|
+
between: "between",
|
|
967
|
+
today: "is today",
|
|
968
|
+
yesterday: "is yesterday",
|
|
969
|
+
thisWeek: "is this week",
|
|
970
|
+
lastWeek: "is last week",
|
|
971
|
+
thisMonth: "is this month",
|
|
972
|
+
lastMonth: "is last month",
|
|
973
|
+
thisYear: "is this year",
|
|
974
|
+
isEmpty: "is empty",
|
|
975
|
+
isNotEmpty: "is not empty"
|
|
976
|
+
};
|
|
977
|
+
function formatFilter(filter, _column) {
|
|
978
|
+
const parts = [];
|
|
979
|
+
if (filter.textCondition) {
|
|
980
|
+
const { operator, value } = filter.textCondition;
|
|
981
|
+
const label = TEXT_OPERATOR_LABELS[operator];
|
|
982
|
+
if (["isEmpty", "isNotEmpty"].includes(operator)) {
|
|
983
|
+
parts.push(label);
|
|
984
|
+
} else if (value) {
|
|
985
|
+
parts.push(`${label} "${value}"`);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
if (filter.numberCondition) {
|
|
989
|
+
const { operator, value, valueTo } = filter.numberCondition;
|
|
990
|
+
const label = NUMBER_OPERATOR_LABELS[operator];
|
|
991
|
+
if (["isEmpty", "isNotEmpty"].includes(operator)) {
|
|
992
|
+
parts.push(label);
|
|
993
|
+
} else if (operator === "between" && value !== void 0 && valueTo !== void 0) {
|
|
994
|
+
parts.push(`${label} ${value} and ${valueTo}`);
|
|
995
|
+
} else if (value !== void 0) {
|
|
996
|
+
parts.push(`${label} ${value}`);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
if (filter.dateCondition) {
|
|
1000
|
+
const { operator, value, valueTo } = filter.dateCondition;
|
|
1001
|
+
const label = DATE_OPERATOR_LABELS[operator];
|
|
1002
|
+
const noValueOperators = [
|
|
1003
|
+
"isEmpty",
|
|
1004
|
+
"isNotEmpty",
|
|
1005
|
+
"today",
|
|
1006
|
+
"yesterday",
|
|
1007
|
+
"thisWeek",
|
|
1008
|
+
"lastWeek",
|
|
1009
|
+
"thisMonth",
|
|
1010
|
+
"lastMonth",
|
|
1011
|
+
"thisYear"
|
|
1012
|
+
];
|
|
1013
|
+
if (noValueOperators.includes(operator)) {
|
|
1014
|
+
parts.push(label);
|
|
1015
|
+
} else if (operator === "between" && value && valueTo) {
|
|
1016
|
+
parts.push(`${label} ${formatDate(value)} and ${formatDate(valueTo)}`);
|
|
1017
|
+
} else if (value) {
|
|
1018
|
+
parts.push(`${label} ${formatDate(value)}`);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
if (filter.text) {
|
|
1022
|
+
parts.push(`contains "${filter.text}"`);
|
|
1023
|
+
}
|
|
1024
|
+
if (filter.selectedValues && filter.selectedValues.length > 0) {
|
|
1025
|
+
if (filter.selectedValues.length === 1) {
|
|
1026
|
+
parts.push(`is "${filter.selectedValues[0]}"`);
|
|
1027
|
+
} else {
|
|
1028
|
+
parts.push(`is one of ${filter.selectedValues.length} values`);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
if (filter.min !== void 0 && filter.max !== void 0) {
|
|
1032
|
+
parts.push(`between ${filter.min} and ${filter.max}`);
|
|
1033
|
+
} else if (filter.min !== void 0) {
|
|
1034
|
+
parts.push(`\u2265 ${filter.min}`);
|
|
1035
|
+
} else if (filter.max !== void 0) {
|
|
1036
|
+
parts.push(`\u2264 ${filter.max}`);
|
|
1037
|
+
}
|
|
1038
|
+
if (filter.includeBlanks) {
|
|
1039
|
+
parts.push("includes blanks");
|
|
1040
|
+
}
|
|
1041
|
+
if (filter.excludeBlanks) {
|
|
1042
|
+
parts.push("excludes blanks");
|
|
1043
|
+
}
|
|
1044
|
+
return parts.join(", ") || "filtered";
|
|
1045
|
+
}
|
|
1046
|
+
function formatDate(dateStr) {
|
|
1047
|
+
try {
|
|
1048
|
+
const date = new Date(dateStr);
|
|
1049
|
+
return date.toLocaleDateString("en-US", {
|
|
1050
|
+
month: "short",
|
|
1051
|
+
day: "numeric",
|
|
1052
|
+
year: "numeric"
|
|
1053
|
+
});
|
|
1054
|
+
} catch {
|
|
1055
|
+
return dateStr;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
var ActiveFiltersDisplay = ({
|
|
1059
|
+
filters,
|
|
1060
|
+
columns,
|
|
1061
|
+
onClearFilter,
|
|
1062
|
+
onClearAllFilters,
|
|
1063
|
+
className
|
|
1064
|
+
}) => {
|
|
1065
|
+
const activeFilters = Object.entries(filters).filter(([_, filter]) => {
|
|
1066
|
+
return filter.textCondition || filter.numberCondition || filter.dateCondition || filter.text || filter.selectedValues && filter.selectedValues.length > 0 || filter.min !== void 0 || filter.max !== void 0 || filter.includeBlanks || filter.excludeBlanks;
|
|
1067
|
+
});
|
|
1068
|
+
if (activeFilters.length === 0) {
|
|
1069
|
+
return null;
|
|
1070
|
+
}
|
|
1071
|
+
const getColumnLabel = (columnId) => {
|
|
1072
|
+
const column = columns.find((c) => c.id === columnId);
|
|
1073
|
+
return column?.label || columnId;
|
|
1074
|
+
};
|
|
1075
|
+
const getColumn = (columnId) => {
|
|
1076
|
+
return columns.find((c) => c.id === columnId);
|
|
1077
|
+
};
|
|
1078
|
+
return /* @__PURE__ */ jsxs3(
|
|
1079
|
+
"div",
|
|
1080
|
+
{
|
|
1081
|
+
className: cn(
|
|
1082
|
+
"flex flex-wrap items-center gap-2 px-4 py-2 bg-amber-50 border-b border-amber-200",
|
|
1083
|
+
className
|
|
1084
|
+
),
|
|
1085
|
+
children: [
|
|
1086
|
+
/* @__PURE__ */ jsx3("span", { className: "text-xs font-medium text-amber-700 mr-1", children: "Active filters:" }),
|
|
1087
|
+
activeFilters.map(([columnId, filter]) => {
|
|
1088
|
+
const column = getColumn(columnId);
|
|
1089
|
+
const filterDescription = column ? formatFilter(filter, column) : formatFilter(filter, { id: columnId, label: columnId });
|
|
1090
|
+
return /* @__PURE__ */ jsxs3(
|
|
1091
|
+
"div",
|
|
1092
|
+
{
|
|
1093
|
+
className: "inline-flex items-center gap-1.5 px-2.5 py-1 bg-white border border-amber-300 rounded-full shadow-sm",
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ jsx3("span", { className: "text-xs font-medium text-gray-700", children: getColumnLabel(columnId) }),
|
|
1096
|
+
/* @__PURE__ */ jsx3("span", { className: "text-xs text-gray-500", children: filterDescription }),
|
|
1097
|
+
/* @__PURE__ */ jsx3(
|
|
1098
|
+
"button",
|
|
1099
|
+
{
|
|
1100
|
+
type: "button",
|
|
1101
|
+
onClick: () => onClearFilter(columnId),
|
|
1102
|
+
className: "p-0.5 hover:bg-amber-100 rounded-full transition-colors",
|
|
1103
|
+
title: `Clear filter for ${getColumnLabel(columnId)}`,
|
|
1104
|
+
children: /* @__PURE__ */ jsx3(HiX, { className: "h-3 w-3 text-amber-600 hover:text-amber-800" })
|
|
1105
|
+
}
|
|
1106
|
+
)
|
|
1107
|
+
]
|
|
1108
|
+
},
|
|
1109
|
+
columnId
|
|
1110
|
+
);
|
|
1111
|
+
}),
|
|
1112
|
+
activeFilters.length > 1 && /* @__PURE__ */ jsx3(
|
|
1113
|
+
"button",
|
|
1114
|
+
{
|
|
1115
|
+
type: "button",
|
|
1116
|
+
onClick: onClearAllFilters,
|
|
1117
|
+
className: "text-xs text-amber-700 hover:text-amber-900 underline ml-2 transition-colors",
|
|
1118
|
+
children: "Clear all"
|
|
1119
|
+
}
|
|
1120
|
+
)
|
|
1121
|
+
]
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
};
|
|
1125
|
+
ActiveFiltersDisplay.displayName = "ActiveFiltersDisplay";
|
|
1126
|
+
|
|
1127
|
+
// src/components/SpreadsheetToolbar.tsx
|
|
1128
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
771
1129
|
var SpreadsheetToolbar = ({
|
|
772
1130
|
zoom,
|
|
773
1131
|
canUndo,
|
|
@@ -791,6 +1149,11 @@ var SpreadsheetToolbar = ({
|
|
|
791
1149
|
onShowShortcuts,
|
|
792
1150
|
hasActiveFilters,
|
|
793
1151
|
onClearFilters,
|
|
1152
|
+
filters,
|
|
1153
|
+
columns,
|
|
1154
|
+
onClearFilter,
|
|
1155
|
+
showFiltersPanel,
|
|
1156
|
+
onToggleFiltersPanel,
|
|
794
1157
|
className
|
|
795
1158
|
}) => {
|
|
796
1159
|
const [showMoreMenu, setShowMoreMenu] = React3.useState(false);
|
|
@@ -844,231 +1207,253 @@ var SpreadsheetToolbar = ({
|
|
|
844
1207
|
return "bg-blue-50 border-blue-200 text-blue-700";
|
|
845
1208
|
}
|
|
846
1209
|
};
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1210
|
+
const activeFilterCount = filters ? Object.values(filters).filter(
|
|
1211
|
+
(f) => f.textCondition || f.numberCondition || f.dateCondition || f.text || f.selectedValues && f.selectedValues.length > 0 || f.min !== void 0 || f.max !== void 0 || f.includeBlanks || f.excludeBlanks
|
|
1212
|
+
).length : 0;
|
|
1213
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
|
|
1214
|
+
/* @__PURE__ */ jsxs4(
|
|
1215
|
+
"div",
|
|
1216
|
+
{
|
|
1217
|
+
className: cn(
|
|
1218
|
+
"flex flex-wrap items-center justify-between gap-2 px-4 py-2 border-b border-gray-200 bg-white",
|
|
1219
|
+
className
|
|
1220
|
+
),
|
|
1221
|
+
children: [
|
|
1222
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1223
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
|
|
1224
|
+
/* @__PURE__ */ jsx4(
|
|
1225
|
+
"button",
|
|
1226
|
+
{
|
|
1227
|
+
type: "button",
|
|
1228
|
+
onClick: onUndo,
|
|
1229
|
+
disabled: !canUndo,
|
|
1230
|
+
className: cn(
|
|
1231
|
+
buttonBaseClasses,
|
|
1232
|
+
canUndo ? "bg-gray-100 text-gray-700 hover:bg-gray-200" : "bg-gray-50 text-gray-400"
|
|
1233
|
+
),
|
|
1234
|
+
title: `Undo (${undoCount} changes)`,
|
|
1235
|
+
children: /* @__PURE__ */ jsx4(HiReply, { className: "h-4 w-4" })
|
|
1236
|
+
}
|
|
1237
|
+
),
|
|
1238
|
+
/* @__PURE__ */ jsx4(
|
|
1239
|
+
"button",
|
|
1240
|
+
{
|
|
1241
|
+
type: "button",
|
|
1242
|
+
onClick: onRedo,
|
|
1243
|
+
disabled: !canRedo,
|
|
1244
|
+
className: cn(
|
|
1245
|
+
buttonBaseClasses,
|
|
1246
|
+
canRedo ? "bg-gray-100 text-gray-700 hover:bg-gray-200" : "bg-gray-50 text-gray-400"
|
|
1247
|
+
),
|
|
1248
|
+
title: `Redo (${redoCount} changes)`,
|
|
1249
|
+
style: { transform: "scaleX(-1)" },
|
|
1250
|
+
children: /* @__PURE__ */ jsx4(HiReply, { className: "h-4 w-4" })
|
|
1251
|
+
}
|
|
1252
|
+
)
|
|
1253
|
+
] }),
|
|
1254
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1 px-1.5 py-1 bg-gray-100 rounded", children: [
|
|
1255
|
+
/* @__PURE__ */ jsx4(
|
|
1256
|
+
"button",
|
|
1257
|
+
{
|
|
1258
|
+
type: "button",
|
|
1259
|
+
onClick: onZoomOut,
|
|
1260
|
+
className: "p-1 hover:bg-white rounded",
|
|
1261
|
+
title: "Zoom out",
|
|
1262
|
+
children: /* @__PURE__ */ jsx4(HiZoomOut, { className: "h-4 w-4 text-gray-600" })
|
|
1263
|
+
}
|
|
1264
|
+
),
|
|
1265
|
+
/* @__PURE__ */ jsxs4(
|
|
1266
|
+
"button",
|
|
1267
|
+
{
|
|
1268
|
+
type: "button",
|
|
1269
|
+
onClick: onZoomReset,
|
|
1270
|
+
className: "px-2 py-0.5 hover:bg-white rounded text-xs min-w-[45px] text-center text-gray-600",
|
|
1271
|
+
title: "Reset zoom",
|
|
1272
|
+
children: [
|
|
1273
|
+
zoom,
|
|
1274
|
+
"%"
|
|
1275
|
+
]
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
/* @__PURE__ */ jsx4(
|
|
1279
|
+
"button",
|
|
1280
|
+
{
|
|
1281
|
+
type: "button",
|
|
1282
|
+
onClick: onZoomIn,
|
|
1283
|
+
className: "p-1 hover:bg-white rounded",
|
|
1284
|
+
title: "Zoom in",
|
|
1285
|
+
children: /* @__PURE__ */ jsx4(HiZoomIn, { className: "h-4 w-4 text-gray-600" })
|
|
1286
|
+
}
|
|
1287
|
+
)
|
|
1288
|
+
] })
|
|
1289
|
+
] }),
|
|
1290
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
1291
|
+
selectedRowCount > 0 && /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 px-2.5 py-1.5 bg-blue-600 text-white rounded", children: [
|
|
1292
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-xs font-medium whitespace-nowrap", children: [
|
|
1293
|
+
selectedRowCount,
|
|
1294
|
+
" row",
|
|
1295
|
+
selectedRowCount !== 1 ? "s" : "",
|
|
1296
|
+
" selected"
|
|
1297
|
+
] }),
|
|
1298
|
+
/* @__PURE__ */ jsx4(
|
|
1299
|
+
"button",
|
|
1300
|
+
{
|
|
1301
|
+
type: "button",
|
|
1302
|
+
onClick: onClearSelection,
|
|
1303
|
+
className: "p-0.5 hover:bg-blue-700 rounded",
|
|
1304
|
+
title: "Clear selection",
|
|
1305
|
+
children: /* @__PURE__ */ jsx4(HiX, { className: "h-3 w-3" })
|
|
1306
|
+
}
|
|
1307
|
+
)
|
|
1308
|
+
] }),
|
|
1309
|
+
hasActiveFilters && onToggleFiltersPanel && /* @__PURE__ */ jsxs4(
|
|
858
1310
|
"button",
|
|
859
1311
|
{
|
|
860
1312
|
type: "button",
|
|
861
|
-
onClick:
|
|
862
|
-
disabled: !canUndo,
|
|
1313
|
+
onClick: onToggleFiltersPanel,
|
|
863
1314
|
className: cn(
|
|
864
|
-
|
|
865
|
-
|
|
1315
|
+
"flex items-center gap-2 px-2.5 py-1.5 rounded transition-colors",
|
|
1316
|
+
showFiltersPanel ? "bg-amber-600 text-white hover:bg-amber-700" : "bg-amber-500 text-white hover:bg-amber-600"
|
|
866
1317
|
),
|
|
867
|
-
title:
|
|
868
|
-
children:
|
|
1318
|
+
title: showFiltersPanel ? "Hide active filters" : "Show active filters",
|
|
1319
|
+
children: [
|
|
1320
|
+
/* @__PURE__ */ jsx4(HiFilter, { className: "h-3.5 w-3.5" }),
|
|
1321
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-xs font-medium whitespace-nowrap", children: [
|
|
1322
|
+
activeFilterCount,
|
|
1323
|
+
" filter",
|
|
1324
|
+
activeFilterCount !== 1 ? "s" : "",
|
|
1325
|
+
" active"
|
|
1326
|
+
] }),
|
|
1327
|
+
showFiltersPanel ? /* @__PURE__ */ jsx4(HiChevronUp, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx4(HiChevronDown, { className: "h-3 w-3" })
|
|
1328
|
+
]
|
|
869
1329
|
}
|
|
870
1330
|
),
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
"
|
|
1331
|
+
summary && /* @__PURE__ */ jsxs4(
|
|
1332
|
+
"div",
|
|
873
1333
|
{
|
|
874
|
-
type: "button",
|
|
875
|
-
onClick: onRedo,
|
|
876
|
-
disabled: !canRedo,
|
|
877
1334
|
className: cn(
|
|
878
|
-
|
|
879
|
-
|
|
1335
|
+
"flex items-center gap-2 px-2.5 py-1.5 rounded border text-xs",
|
|
1336
|
+
getSummaryVariantClasses(summary.variant)
|
|
880
1337
|
),
|
|
881
|
-
title: `Redo (${redoCount} changes)`,
|
|
882
|
-
style: { transform: "scaleX(-1)" },
|
|
883
|
-
children: /* @__PURE__ */ jsx3(HiReply, { className: "h-4 w-4" })
|
|
884
|
-
}
|
|
885
|
-
)
|
|
886
|
-
] }),
|
|
887
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1 px-1.5 py-1 bg-gray-100 rounded", children: [
|
|
888
|
-
/* @__PURE__ */ jsx3(
|
|
889
|
-
"button",
|
|
890
|
-
{
|
|
891
|
-
type: "button",
|
|
892
|
-
onClick: onZoomOut,
|
|
893
|
-
className: "p-1 hover:bg-white rounded",
|
|
894
|
-
title: "Zoom out",
|
|
895
|
-
children: /* @__PURE__ */ jsx3(HiZoomOut, { className: "h-4 w-4 text-gray-600" })
|
|
896
|
-
}
|
|
897
|
-
),
|
|
898
|
-
/* @__PURE__ */ jsxs3(
|
|
899
|
-
"button",
|
|
900
|
-
{
|
|
901
|
-
type: "button",
|
|
902
|
-
onClick: onZoomReset,
|
|
903
|
-
className: "px-2 py-0.5 hover:bg-white rounded text-xs min-w-[45px] text-center text-gray-600",
|
|
904
|
-
title: "Reset zoom",
|
|
905
1338
|
children: [
|
|
906
|
-
|
|
907
|
-
|
|
1339
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-semibold whitespace-nowrap", children: [
|
|
1340
|
+
summary.label,
|
|
1341
|
+
":"
|
|
1342
|
+
] }),
|
|
1343
|
+
/* @__PURE__ */ jsx4("span", { className: "font-bold whitespace-nowrap", children: summary.value })
|
|
908
1344
|
]
|
|
909
1345
|
}
|
|
910
|
-
),
|
|
911
|
-
/* @__PURE__ */ jsx3(
|
|
912
|
-
"button",
|
|
913
|
-
{
|
|
914
|
-
type: "button",
|
|
915
|
-
onClick: onZoomIn,
|
|
916
|
-
className: "p-1 hover:bg-white rounded",
|
|
917
|
-
title: "Zoom in",
|
|
918
|
-
children: /* @__PURE__ */ jsx3(HiZoomIn, { className: "h-4 w-4 text-gray-600" })
|
|
919
|
-
}
|
|
920
|
-
)
|
|
921
|
-
] })
|
|
922
|
-
] }),
|
|
923
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
924
|
-
selectedRowCount > 0 && /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2 px-2.5 py-1.5 bg-blue-600 text-white rounded", children: [
|
|
925
|
-
/* @__PURE__ */ jsxs3("span", { className: "text-xs font-medium whitespace-nowrap", children: [
|
|
926
|
-
selectedRowCount,
|
|
927
|
-
" row",
|
|
928
|
-
selectedRowCount !== 1 ? "s" : "",
|
|
929
|
-
" selected"
|
|
930
|
-
] }),
|
|
931
|
-
/* @__PURE__ */ jsx3(
|
|
932
|
-
"button",
|
|
933
|
-
{
|
|
934
|
-
type: "button",
|
|
935
|
-
onClick: onClearSelection,
|
|
936
|
-
className: "p-0.5 hover:bg-blue-700 rounded",
|
|
937
|
-
title: "Clear selection",
|
|
938
|
-
children: /* @__PURE__ */ jsx3(HiX, { className: "h-3 w-3" })
|
|
939
|
-
}
|
|
940
1346
|
)
|
|
941
1347
|
] }),
|
|
942
|
-
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
|
|
945
|
-
/* @__PURE__ */ jsx3(
|
|
946
|
-
"button",
|
|
1348
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
|
|
1349
|
+
saveStatusDisplay && /* @__PURE__ */ jsx4(
|
|
1350
|
+
"span",
|
|
947
1351
|
{
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
children:
|
|
1352
|
+
className: cn(
|
|
1353
|
+
"text-xs flex items-center gap-1",
|
|
1354
|
+
saveStatusDisplay.className
|
|
1355
|
+
),
|
|
1356
|
+
children: saveStatusDisplay.text
|
|
953
1357
|
}
|
|
954
|
-
)
|
|
955
|
-
|
|
956
|
-
summary && /* @__PURE__ */ jsxs3(
|
|
957
|
-
"div",
|
|
958
|
-
{
|
|
959
|
-
className: cn(
|
|
960
|
-
"flex items-center gap-2 px-2.5 py-1.5 rounded border text-xs",
|
|
961
|
-
getSummaryVariantClasses(summary.variant)
|
|
962
|
-
),
|
|
963
|
-
children: [
|
|
964
|
-
/* @__PURE__ */ jsxs3("span", { className: "font-semibold whitespace-nowrap", children: [
|
|
965
|
-
summary.label,
|
|
966
|
-
":"
|
|
967
|
-
] }),
|
|
968
|
-
/* @__PURE__ */ jsx3("span", { className: "font-bold whitespace-nowrap", children: summary.value })
|
|
969
|
-
]
|
|
970
|
-
}
|
|
971
|
-
)
|
|
972
|
-
] }),
|
|
973
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
974
|
-
saveStatusDisplay && /* @__PURE__ */ jsx3(
|
|
975
|
-
"span",
|
|
976
|
-
{
|
|
977
|
-
className: cn(
|
|
978
|
-
"text-xs flex items-center gap-1",
|
|
979
|
-
saveStatusDisplay.className
|
|
980
|
-
),
|
|
981
|
-
children: saveStatusDisplay.text
|
|
982
|
-
}
|
|
983
|
-
),
|
|
984
|
-
!autoSave && onSave && /* @__PURE__ */ jsxs3(
|
|
985
|
-
"button",
|
|
986
|
-
{
|
|
987
|
-
type: "button",
|
|
988
|
-
onClick: onSave,
|
|
989
|
-
disabled: !hasUnsavedChanges,
|
|
990
|
-
className: cn(
|
|
991
|
-
"px-3 py-1.5 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors flex items-center gap-1.5",
|
|
992
|
-
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-blue-600"
|
|
993
|
-
),
|
|
994
|
-
children: [
|
|
995
|
-
/* @__PURE__ */ jsx3(HiCheck, { className: "h-3.5 w-3.5" }),
|
|
996
|
-
"Save"
|
|
997
|
-
]
|
|
998
|
-
}
|
|
999
|
-
),
|
|
1000
|
-
/* @__PURE__ */ jsxs3("div", { className: "relative", ref: menuRef, children: [
|
|
1001
|
-
/* @__PURE__ */ jsxs3(
|
|
1358
|
+
),
|
|
1359
|
+
!autoSave && onSave && /* @__PURE__ */ jsxs4(
|
|
1002
1360
|
"button",
|
|
1003
1361
|
{
|
|
1004
1362
|
type: "button",
|
|
1005
|
-
onClick:
|
|
1006
|
-
|
|
1007
|
-
|
|
1363
|
+
onClick: onSave,
|
|
1364
|
+
disabled: !hasUnsavedChanges,
|
|
1365
|
+
className: cn(
|
|
1366
|
+
"px-3 py-1.5 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors flex items-center gap-1.5",
|
|
1367
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-blue-600"
|
|
1368
|
+
),
|
|
1008
1369
|
children: [
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
|
|
1370
|
+
/* @__PURE__ */ jsx4(HiCheck, { className: "h-3.5 w-3.5" }),
|
|
1371
|
+
"Save"
|
|
1011
1372
|
]
|
|
1012
1373
|
}
|
|
1013
1374
|
),
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
"button",
|
|
1017
|
-
{
|
|
1018
|
-
type: "button",
|
|
1019
|
-
onClick: () => {
|
|
1020
|
-
onSettings();
|
|
1021
|
-
setShowMoreMenu(false);
|
|
1022
|
-
},
|
|
1023
|
-
className: "w-full px-3 py-2 text-left hover:bg-gray-50 flex items-center gap-2 text-xs transition-colors",
|
|
1024
|
-
children: [
|
|
1025
|
-
/* @__PURE__ */ jsx3(HiCog, { className: "h-3.5 w-3.5 text-gray-500" }),
|
|
1026
|
-
/* @__PURE__ */ jsx3("span", { className: "text-gray-700", children: "Settings" })
|
|
1027
|
-
]
|
|
1028
|
-
}
|
|
1029
|
-
),
|
|
1030
|
-
onShowShortcuts && /* @__PURE__ */ jsxs3(
|
|
1375
|
+
/* @__PURE__ */ jsxs4("div", { className: "relative", ref: menuRef, children: [
|
|
1376
|
+
/* @__PURE__ */ jsxs4(
|
|
1031
1377
|
"button",
|
|
1032
1378
|
{
|
|
1033
1379
|
type: "button",
|
|
1034
|
-
onClick: () =>
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
},
|
|
1038
|
-
className: "w-full px-3 py-2 text-left hover:bg-gray-50 flex items-center gap-2 text-xs transition-colors",
|
|
1380
|
+
onClick: () => setShowMoreMenu(!showMoreMenu),
|
|
1381
|
+
className: "px-2.5 py-1.5 bg-gray-100 text-gray-700 rounded hover:bg-gray-200 transition-colors flex items-center gap-1.5 text-xs",
|
|
1382
|
+
title: "More actions",
|
|
1039
1383
|
children: [
|
|
1040
|
-
/* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1384
|
+
/* @__PURE__ */ jsx4(HiDotsVertical, { className: "h-3.5 w-3.5" }),
|
|
1385
|
+
/* @__PURE__ */ jsx4("span", { className: "hidden lg:inline", children: "More" })
|
|
1042
1386
|
]
|
|
1043
1387
|
}
|
|
1044
1388
|
),
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1389
|
+
showMoreMenu && /* @__PURE__ */ jsxs4("div", { className: "absolute right-0 top-full mt-1 bg-white border border-gray-200 shadow-lg rounded py-1 min-w-[180px] z-20", children: [
|
|
1390
|
+
onSettings && /* @__PURE__ */ jsxs4(
|
|
1391
|
+
"button",
|
|
1392
|
+
{
|
|
1393
|
+
type: "button",
|
|
1394
|
+
onClick: () => {
|
|
1395
|
+
onSettings();
|
|
1396
|
+
setShowMoreMenu(false);
|
|
1397
|
+
},
|
|
1398
|
+
className: "w-full px-3 py-2 text-left hover:bg-gray-50 flex items-center gap-2 text-xs transition-colors",
|
|
1399
|
+
children: [
|
|
1400
|
+
/* @__PURE__ */ jsx4(HiCog, { className: "h-3.5 w-3.5 text-gray-500" }),
|
|
1401
|
+
/* @__PURE__ */ jsx4("span", { className: "text-gray-700", children: "Settings" })
|
|
1402
|
+
]
|
|
1403
|
+
}
|
|
1404
|
+
),
|
|
1405
|
+
onShowShortcuts && /* @__PURE__ */ jsxs4(
|
|
1406
|
+
"button",
|
|
1407
|
+
{
|
|
1408
|
+
type: "button",
|
|
1409
|
+
onClick: () => {
|
|
1410
|
+
onShowShortcuts();
|
|
1411
|
+
setShowMoreMenu(false);
|
|
1412
|
+
},
|
|
1413
|
+
className: "w-full px-3 py-2 text-left hover:bg-gray-50 flex items-center gap-2 text-xs transition-colors",
|
|
1414
|
+
children: [
|
|
1415
|
+
/* @__PURE__ */ jsx4(HiOutlineQuestionMarkCircle, { className: "h-3.5 w-3.5 text-gray-500" }),
|
|
1416
|
+
/* @__PURE__ */ jsx4("span", { className: "text-gray-700", children: "Keyboard Shortcuts" })
|
|
1417
|
+
]
|
|
1418
|
+
}
|
|
1419
|
+
),
|
|
1420
|
+
menuItems && menuItems.length > 0 && (onSettings || onShowShortcuts) && /* @__PURE__ */ jsx4("div", { className: "border-t border-gray-100 my-1" }),
|
|
1421
|
+
menuItems?.map((item) => /* @__PURE__ */ jsxs4(
|
|
1422
|
+
"button",
|
|
1423
|
+
{
|
|
1424
|
+
type: "button",
|
|
1425
|
+
disabled: item.disabled,
|
|
1426
|
+
onClick: () => {
|
|
1427
|
+
item.onClick();
|
|
1428
|
+
setShowMoreMenu(false);
|
|
1429
|
+
},
|
|
1430
|
+
className: cn(
|
|
1431
|
+
"w-full px-3 py-2 text-left hover:bg-gray-50 flex items-center gap-2 text-xs transition-colors",
|
|
1432
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
1433
|
+
),
|
|
1434
|
+
children: [
|
|
1435
|
+
item.icon && /* @__PURE__ */ jsx4("span", { className: "h-3.5 w-3.5 text-gray-500 flex items-center justify-center", children: item.icon }),
|
|
1436
|
+
/* @__PURE__ */ jsx4("span", { className: "text-gray-700", children: item.label })
|
|
1437
|
+
]
|
|
1054
1438
|
},
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
),
|
|
1059
|
-
children: [
|
|
1060
|
-
item.icon && /* @__PURE__ */ jsx3("span", { className: "h-3.5 w-3.5 text-gray-500 flex items-center justify-center", children: item.icon }),
|
|
1061
|
-
/* @__PURE__ */ jsx3("span", { className: "text-gray-700", children: item.label })
|
|
1062
|
-
]
|
|
1063
|
-
},
|
|
1064
|
-
item.id
|
|
1065
|
-
))
|
|
1439
|
+
item.id
|
|
1440
|
+
))
|
|
1441
|
+
] })
|
|
1066
1442
|
] })
|
|
1067
1443
|
] })
|
|
1068
|
-
]
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1444
|
+
]
|
|
1445
|
+
}
|
|
1446
|
+
),
|
|
1447
|
+
showFiltersPanel && filters && columns && onClearFilter && onClearFilters && /* @__PURE__ */ jsx4(
|
|
1448
|
+
ActiveFiltersDisplay,
|
|
1449
|
+
{
|
|
1450
|
+
filters,
|
|
1451
|
+
columns,
|
|
1452
|
+
onClearFilter,
|
|
1453
|
+
onClearAllFilters: onClearFilters
|
|
1454
|
+
}
|
|
1455
|
+
)
|
|
1456
|
+
] });
|
|
1072
1457
|
};
|
|
1073
1458
|
SpreadsheetToolbar.displayName = "SpreadsheetToolbar";
|
|
1074
1459
|
|
|
@@ -1081,7 +1466,7 @@ function MdOutlinePushPin(props) {
|
|
|
1081
1466
|
}
|
|
1082
1467
|
|
|
1083
1468
|
// src/components/ColumnHeaderActions.tsx
|
|
1084
|
-
import { jsx as
|
|
1469
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1085
1470
|
function ColumnHeaderActions({
|
|
1086
1471
|
enableFiltering = false,
|
|
1087
1472
|
enableHighlighting = false,
|
|
@@ -1098,8 +1483,8 @@ function ColumnHeaderActions({
|
|
|
1098
1483
|
unpinnedTitle = "Pin column",
|
|
1099
1484
|
className
|
|
1100
1485
|
}) {
|
|
1101
|
-
return /* @__PURE__ */
|
|
1102
|
-
enableFiltering && onFilterClick && /* @__PURE__ */
|
|
1486
|
+
return /* @__PURE__ */ jsxs5("div", { className: cn("flex items-center gap-0.5", className), children: [
|
|
1487
|
+
enableFiltering && onFilterClick && /* @__PURE__ */ jsx5(
|
|
1103
1488
|
"button",
|
|
1104
1489
|
{
|
|
1105
1490
|
type: "button",
|
|
@@ -1112,10 +1497,10 @@ function ColumnHeaderActions({
|
|
|
1112
1497
|
hasActiveFilter ? "text-blue-600 opacity-100" : "text-gray-400 opacity-0 group-hover:opacity-100"
|
|
1113
1498
|
),
|
|
1114
1499
|
title: filterTitle,
|
|
1115
|
-
children: /* @__PURE__ */
|
|
1500
|
+
children: /* @__PURE__ */ jsx5(HiFilter, { className: "h-3 w-3" })
|
|
1116
1501
|
}
|
|
1117
1502
|
),
|
|
1118
|
-
enableHighlighting && onHighlightClick && /* @__PURE__ */
|
|
1503
|
+
enableHighlighting && onHighlightClick && /* @__PURE__ */ jsx5(
|
|
1119
1504
|
"button",
|
|
1120
1505
|
{
|
|
1121
1506
|
type: "button",
|
|
@@ -1128,10 +1513,10 @@ function ColumnHeaderActions({
|
|
|
1128
1513
|
hasActiveHighlight ? "text-amber-500 opacity-100" : "text-gray-400 opacity-0 group-hover:opacity-100"
|
|
1129
1514
|
),
|
|
1130
1515
|
title: highlightTitle,
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1516
|
+
children: /* @__PURE__ */ jsx5(AiFillHighlight, { className: "h-3 w-3" })
|
|
1132
1517
|
}
|
|
1133
1518
|
),
|
|
1134
|
-
enablePinning && onPinClick && /* @__PURE__ */
|
|
1519
|
+
enablePinning && onPinClick && /* @__PURE__ */ jsx5(
|
|
1135
1520
|
"button",
|
|
1136
1521
|
{
|
|
1137
1522
|
type: "button",
|
|
@@ -1144,7 +1529,7 @@ function ColumnHeaderActions({
|
|
|
1144
1529
|
isPinned ? "text-blue-600 opacity-100" : "text-gray-400 opacity-0 group-hover:opacity-100"
|
|
1145
1530
|
),
|
|
1146
1531
|
title: isPinned ? pinnedTitle : unpinnedTitle,
|
|
1147
|
-
children: isPinned ? /* @__PURE__ */
|
|
1532
|
+
children: isPinned ? /* @__PURE__ */ jsx5(MdPushPin, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx5(MdOutlinePushPin, { className: "h-3 w-3" })
|
|
1148
1533
|
}
|
|
1149
1534
|
)
|
|
1150
1535
|
] });
|
|
@@ -1152,7 +1537,7 @@ function ColumnHeaderActions({
|
|
|
1152
1537
|
ColumnHeaderActions.displayName = "ColumnHeaderActions";
|
|
1153
1538
|
|
|
1154
1539
|
// src/components/SpreadsheetHeader.tsx
|
|
1155
|
-
import { jsx as
|
|
1540
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1156
1541
|
var cellPaddingCompact2 = "px-1 py-0.5";
|
|
1157
1542
|
var cellPaddingNormal2 = "px-2 py-1.5";
|
|
1158
1543
|
var SpreadsheetHeader = ({
|
|
@@ -1184,7 +1569,7 @@ var SpreadsheetHeader = ({
|
|
|
1184
1569
|
positionStyles.right = `${rightOffset}px`;
|
|
1185
1570
|
}
|
|
1186
1571
|
}
|
|
1187
|
-
return /* @__PURE__ */
|
|
1572
|
+
return /* @__PURE__ */ jsxs6(
|
|
1188
1573
|
"th",
|
|
1189
1574
|
{
|
|
1190
1575
|
onClick: column.sortable ? onClick : void 0,
|
|
@@ -1202,17 +1587,29 @@ var SpreadsheetHeader = ({
|
|
|
1202
1587
|
backgroundColor: highlightColor || "rgb(243 244 246)",
|
|
1203
1588
|
// gray-100
|
|
1204
1589
|
minWidth: column.minWidth || column.width,
|
|
1590
|
+
// Pinned columns must have a fixed width so sticky offsets stay correct.
|
|
1591
|
+
// Enforce MIN_PINNED_COLUMN_WIDTH so header actions (pin/filter/highlight) always fit.
|
|
1592
|
+
...isPinned && {
|
|
1593
|
+
width: Math.max(
|
|
1594
|
+
column.minWidth || column.width || MIN_PINNED_COLUMN_WIDTH,
|
|
1595
|
+
MIN_PINNED_COLUMN_WIDTH
|
|
1596
|
+
),
|
|
1597
|
+
maxWidth: Math.max(
|
|
1598
|
+
column.minWidth || column.width || MIN_PINNED_COLUMN_WIDTH,
|
|
1599
|
+
MIN_PINNED_COLUMN_WIDTH
|
|
1600
|
+
)
|
|
1601
|
+
},
|
|
1205
1602
|
top: 0,
|
|
1206
1603
|
// For sticky header
|
|
1207
1604
|
...positionStyles
|
|
1208
1605
|
},
|
|
1209
1606
|
children: [
|
|
1210
|
-
/* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1607
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-1", children: [
|
|
1608
|
+
/* @__PURE__ */ jsxs6("span", { className: "flex-1 flex items-center gap-1", children: [
|
|
1212
1609
|
column.label,
|
|
1213
|
-
isSorted && /* @__PURE__ */
|
|
1610
|
+
isSorted && /* @__PURE__ */ jsx6("span", { className: "text-blue-600", children: sortDirection === "asc" ? /* @__PURE__ */ jsx6(HiChevronUp, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx6(HiChevronDown, { className: "h-3 w-3" }) })
|
|
1214
1611
|
] }),
|
|
1215
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ jsx6(
|
|
1216
1613
|
ColumnHeaderActions,
|
|
1217
1614
|
{
|
|
1218
1615
|
enableFiltering: column.filterable,
|
|
@@ -1234,158 +1631,8 @@ var SpreadsheetHeader = ({
|
|
|
1234
1631
|
};
|
|
1235
1632
|
SpreadsheetHeader.displayName = "SpreadsheetHeader";
|
|
1236
1633
|
|
|
1237
|
-
// src/hooks/useSpreadsheetPinning.ts
|
|
1238
|
-
import { useCallback, useMemo, useState as useState3 } from "react";
|
|
1239
|
-
var ROW_INDEX_COLUMN_ID = "__row_index__";
|
|
1240
|
-
var ROW_INDEX_COLUMN_WIDTH = 80;
|
|
1241
|
-
function useSpreadsheetPinning({
|
|
1242
|
-
columns,
|
|
1243
|
-
columnGroups,
|
|
1244
|
-
showRowIndex = true,
|
|
1245
|
-
defaultPinnedColumns = [],
|
|
1246
|
-
defaultPinnedRightColumns = []
|
|
1247
|
-
}) {
|
|
1248
|
-
const [pinnedColumns, setPinnedColumns] = useState3(() => {
|
|
1249
|
-
const map = /* @__PURE__ */ new Map();
|
|
1250
|
-
defaultPinnedColumns.forEach((col) => {
|
|
1251
|
-
map.set(col, "left");
|
|
1252
|
-
});
|
|
1253
|
-
defaultPinnedRightColumns.forEach((col) => {
|
|
1254
|
-
map.set(col, "right");
|
|
1255
|
-
});
|
|
1256
|
-
return map;
|
|
1257
|
-
});
|
|
1258
|
-
const [collapsedGroups, setCollapsedGroups] = useState3(/* @__PURE__ */ new Set());
|
|
1259
|
-
const isRowIndexPinned = pinnedColumns.has(ROW_INDEX_COLUMN_ID);
|
|
1260
|
-
const handleTogglePin = useCallback((columnId) => {
|
|
1261
|
-
setPinnedColumns((prev) => {
|
|
1262
|
-
const newMap = new Map(prev);
|
|
1263
|
-
if (newMap.has(columnId)) {
|
|
1264
|
-
newMap.delete(columnId);
|
|
1265
|
-
} else {
|
|
1266
|
-
newMap.set(columnId, "left");
|
|
1267
|
-
}
|
|
1268
|
-
return newMap;
|
|
1269
|
-
});
|
|
1270
|
-
}, []);
|
|
1271
|
-
const setPinnedColumnsFromIds = useCallback((columnIds) => {
|
|
1272
|
-
const map = /* @__PURE__ */ new Map();
|
|
1273
|
-
columnIds.forEach((col) => {
|
|
1274
|
-
map.set(col, "left");
|
|
1275
|
-
});
|
|
1276
|
-
setPinnedColumns(map);
|
|
1277
|
-
}, []);
|
|
1278
|
-
const handleToggleGroupCollapse = useCallback((groupId) => {
|
|
1279
|
-
setCollapsedGroups((prev) => {
|
|
1280
|
-
const newSet = new Set(prev);
|
|
1281
|
-
if (newSet.has(groupId)) {
|
|
1282
|
-
newSet.delete(groupId);
|
|
1283
|
-
} else {
|
|
1284
|
-
newSet.add(groupId);
|
|
1285
|
-
}
|
|
1286
|
-
return newSet;
|
|
1287
|
-
});
|
|
1288
|
-
}, []);
|
|
1289
|
-
const visibleColumns = useMemo(() => {
|
|
1290
|
-
if (!columns || !Array.isArray(columns) || columns.length === 0) {
|
|
1291
|
-
return [];
|
|
1292
|
-
}
|
|
1293
|
-
let result = [...columns];
|
|
1294
|
-
if (columnGroups && Array.isArray(columnGroups)) {
|
|
1295
|
-
result = result.filter((column) => {
|
|
1296
|
-
const group = columnGroups.find((g) => g.columns.includes(column.id));
|
|
1297
|
-
if (!group) return true;
|
|
1298
|
-
if (!collapsedGroups.has(group.id)) return true;
|
|
1299
|
-
return pinnedColumns.has(column.id);
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
const nonRowIndexPinned = Array.from(pinnedColumns.keys()).filter(
|
|
1303
|
-
(id) => id !== ROW_INDEX_COLUMN_ID
|
|
1304
|
-
);
|
|
1305
|
-
if (nonRowIndexPinned.length === 0) {
|
|
1306
|
-
return result;
|
|
1307
|
-
}
|
|
1308
|
-
const leftPinned = [];
|
|
1309
|
-
const unpinned = [];
|
|
1310
|
-
const rightPinned = [];
|
|
1311
|
-
const pinnedLeftIds = Array.from(pinnedColumns.entries()).filter(([id, side]) => side === "left" && id !== ROW_INDEX_COLUMN_ID).map(([id]) => id);
|
|
1312
|
-
const pinnedRightIds = Array.from(pinnedColumns.entries()).filter(([id, side]) => side === "right" && id !== ROW_INDEX_COLUMN_ID).map(([id]) => id);
|
|
1313
|
-
for (const column of result) {
|
|
1314
|
-
const pinSide = pinnedColumns.get(column.id);
|
|
1315
|
-
if (pinSide === "left") {
|
|
1316
|
-
leftPinned.push(column);
|
|
1317
|
-
} else if (pinSide === "right") {
|
|
1318
|
-
rightPinned.push(column);
|
|
1319
|
-
} else {
|
|
1320
|
-
unpinned.push(column);
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
leftPinned.sort((a, b) => pinnedLeftIds.indexOf(a.id) - pinnedLeftIds.indexOf(b.id));
|
|
1324
|
-
rightPinned.sort((a, b) => pinnedRightIds.indexOf(a.id) - pinnedRightIds.indexOf(b.id));
|
|
1325
|
-
return [...leftPinned, ...unpinned, ...rightPinned];
|
|
1326
|
-
}, [columns, columnGroups, collapsedGroups, pinnedColumns]);
|
|
1327
|
-
const getColumnLeftOffset = useCallback(
|
|
1328
|
-
(columnId) => {
|
|
1329
|
-
if (columnId === ROW_INDEX_COLUMN_ID) {
|
|
1330
|
-
return 0;
|
|
1331
|
-
}
|
|
1332
|
-
const pinnedLeft = Array.from(pinnedColumns.entries()).filter(([id, side]) => side === "left" && id !== ROW_INDEX_COLUMN_ID).map(([id]) => id);
|
|
1333
|
-
const index = pinnedLeft.indexOf(columnId);
|
|
1334
|
-
const isRowIndexPinnedNow = pinnedColumns.has(ROW_INDEX_COLUMN_ID);
|
|
1335
|
-
const baseOffset = showRowIndex && isRowIndexPinnedNow ? ROW_INDEX_COLUMN_WIDTH : 0;
|
|
1336
|
-
if (index === -1) return baseOffset;
|
|
1337
|
-
let offset = baseOffset;
|
|
1338
|
-
for (let i = 0; i < index; i++) {
|
|
1339
|
-
const col = columns.find((c) => c.id === pinnedLeft[i]);
|
|
1340
|
-
offset += col?.minWidth || col?.width || 100;
|
|
1341
|
-
}
|
|
1342
|
-
return offset;
|
|
1343
|
-
},
|
|
1344
|
-
[pinnedColumns, columns, showRowIndex]
|
|
1345
|
-
);
|
|
1346
|
-
const isColumnPinned = useCallback(
|
|
1347
|
-
(columnId) => {
|
|
1348
|
-
return pinnedColumns.has(columnId);
|
|
1349
|
-
},
|
|
1350
|
-
[pinnedColumns]
|
|
1351
|
-
);
|
|
1352
|
-
const getColumnPinSide = useCallback(
|
|
1353
|
-
(columnId) => {
|
|
1354
|
-
return pinnedColumns.get(columnId);
|
|
1355
|
-
},
|
|
1356
|
-
[pinnedColumns]
|
|
1357
|
-
);
|
|
1358
|
-
const getColumnRightOffset = useCallback(
|
|
1359
|
-
(columnId) => {
|
|
1360
|
-
const pinnedRight = Array.from(pinnedColumns.entries()).filter(([, side]) => side === "right").map(([id]) => id);
|
|
1361
|
-
const index = pinnedRight.indexOf(columnId);
|
|
1362
|
-
if (index === -1) return 0;
|
|
1363
|
-
let offset = 0;
|
|
1364
|
-
for (let i = pinnedRight.length - 1; i > index; i--) {
|
|
1365
|
-
const col = columns.find((c) => c.id === pinnedRight[i]);
|
|
1366
|
-
offset += col?.minWidth || col?.width || 100;
|
|
1367
|
-
}
|
|
1368
|
-
return offset;
|
|
1369
|
-
},
|
|
1370
|
-
[pinnedColumns, columns]
|
|
1371
|
-
);
|
|
1372
|
-
return {
|
|
1373
|
-
pinnedColumns,
|
|
1374
|
-
isRowIndexPinned,
|
|
1375
|
-
collapsedGroups,
|
|
1376
|
-
visibleColumns,
|
|
1377
|
-
handleTogglePin,
|
|
1378
|
-
handleToggleGroupCollapse,
|
|
1379
|
-
setPinnedColumnsFromIds,
|
|
1380
|
-
getColumnLeftOffset,
|
|
1381
|
-
getColumnRightOffset,
|
|
1382
|
-
isColumnPinned,
|
|
1383
|
-
getColumnPinSide
|
|
1384
|
-
};
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
1634
|
// src/components/RowIndexColumnHeader.tsx
|
|
1388
|
-
import { jsx as
|
|
1635
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1389
1636
|
var cellPaddingCompact3 = "px-1 py-0.5";
|
|
1390
1637
|
var cellPaddingNormal3 = "px-2 py-1.5";
|
|
1391
1638
|
function RowIndexColumnHeader({
|
|
@@ -1399,7 +1646,7 @@ function RowIndexColumnHeader({
|
|
|
1399
1646
|
className
|
|
1400
1647
|
}) {
|
|
1401
1648
|
const cellPadding = compactMode ? cellPaddingCompact3 : cellPaddingNormal3;
|
|
1402
|
-
return /* @__PURE__ */
|
|
1649
|
+
return /* @__PURE__ */ jsx7(
|
|
1403
1650
|
"th",
|
|
1404
1651
|
{
|
|
1405
1652
|
className: cn(
|
|
@@ -1418,9 +1665,9 @@ function RowIndexColumnHeader({
|
|
|
1418
1665
|
left: isPinned ? 0 : void 0,
|
|
1419
1666
|
backgroundColor: highlightColor || "rgb(243 244 246)"
|
|
1420
1667
|
},
|
|
1421
|
-
children: /* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1423
|
-
/* @__PURE__ */
|
|
1668
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-center gap-1", children: [
|
|
1669
|
+
/* @__PURE__ */ jsx7("span", { children: "#" }),
|
|
1670
|
+
/* @__PURE__ */ jsx7(
|
|
1424
1671
|
ColumnHeaderActions,
|
|
1425
1672
|
{
|
|
1426
1673
|
enableHighlighting,
|
|
@@ -1623,7 +1870,7 @@ function useSpreadsheetHighlighting({
|
|
|
1623
1870
|
}
|
|
1624
1871
|
|
|
1625
1872
|
// src/components/ColorPickerPopover.tsx
|
|
1626
|
-
import { jsx as
|
|
1873
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1627
1874
|
function ColorPickerPopover({
|
|
1628
1875
|
title,
|
|
1629
1876
|
paletteType = "column",
|
|
@@ -1633,9 +1880,9 @@ function ColorPickerPopover({
|
|
|
1633
1880
|
className
|
|
1634
1881
|
}) {
|
|
1635
1882
|
const colorPalette = colors ?? [...HIGHLIGHT_COLORS[paletteType], null];
|
|
1636
|
-
return /* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1883
|
+
return /* @__PURE__ */ jsx8("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ jsxs8("div", { className: cn("bg-white rounded-lg shadow-xl p-4 w-64", className), children: [
|
|
1884
|
+
/* @__PURE__ */ jsx8("h3", { className: "text-sm font-semibold mb-3", children: title }),
|
|
1885
|
+
/* @__PURE__ */ jsx8("div", { className: "grid grid-cols-5 gap-2", children: colorPalette.map((color) => /* @__PURE__ */ jsx8(
|
|
1639
1886
|
"button",
|
|
1640
1887
|
{
|
|
1641
1888
|
type: "button",
|
|
@@ -1650,7 +1897,7 @@ function ColorPickerPopover({
|
|
|
1650
1897
|
},
|
|
1651
1898
|
color || "clear"
|
|
1652
1899
|
)) }),
|
|
1653
|
-
/* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ jsx8("div", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx8(
|
|
1654
1901
|
"button",
|
|
1655
1902
|
{
|
|
1656
1903
|
type: "button",
|
|
@@ -1665,7 +1912,7 @@ ColorPickerPopover.displayName = "ColorPickerPopover";
|
|
|
1665
1912
|
|
|
1666
1913
|
// src/components/SpreadsheetSettingsModal.tsx
|
|
1667
1914
|
import { useState as useState5, useEffect as useEffect3 } from "react";
|
|
1668
|
-
import { jsx as
|
|
1915
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1669
1916
|
var DEFAULT_SETTINGS = {
|
|
1670
1917
|
defaultPinnedColumns: [],
|
|
1671
1918
|
defaultSort: null,
|
|
@@ -1740,7 +1987,7 @@ var SpreadsheetSettingsModal = ({
|
|
|
1740
1987
|
{ id: "sorting", label: "Default Sorting", Icon: HiSortAscending },
|
|
1741
1988
|
{ id: "display", label: "Display Options", Icon: HiEye }
|
|
1742
1989
|
];
|
|
1743
|
-
return /* @__PURE__ */
|
|
1990
|
+
return /* @__PURE__ */ jsxs9(
|
|
1744
1991
|
"div",
|
|
1745
1992
|
{
|
|
1746
1993
|
className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50",
|
|
@@ -1748,7 +1995,7 @@ var SpreadsheetSettingsModal = ({
|
|
|
1748
1995
|
"aria-modal": "true",
|
|
1749
1996
|
"aria-labelledby": "settings-modal-title",
|
|
1750
1997
|
children: [
|
|
1751
|
-
/* @__PURE__ */
|
|
1998
|
+
/* @__PURE__ */ jsx9(
|
|
1752
1999
|
"button",
|
|
1753
2000
|
{
|
|
1754
2001
|
type: "button",
|
|
@@ -1758,55 +2005,55 @@ var SpreadsheetSettingsModal = ({
|
|
|
1758
2005
|
"aria-label": "Close settings"
|
|
1759
2006
|
}
|
|
1760
2007
|
),
|
|
1761
|
-
/* @__PURE__ */
|
|
1762
|
-
/* @__PURE__ */
|
|
1763
|
-
/* @__PURE__ */
|
|
1764
|
-
/* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
2008
|
+
/* @__PURE__ */ jsxs9("div", { className: "bg-white rounded-lg w-[90%] max-w-[700px] max-h-[90vh] flex flex-col shadow-xl relative z-10", children: [
|
|
2009
|
+
/* @__PURE__ */ jsxs9("div", { className: "px-6 py-5 border-b border-gray-200 flex items-center justify-between", children: [
|
|
2010
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3", children: [
|
|
2011
|
+
/* @__PURE__ */ jsx9(HiCog, { className: "h-6 w-6 text-blue-600" }),
|
|
2012
|
+
/* @__PURE__ */ jsx9("h2", { id: "settings-modal-title", className: "text-xl font-bold text-gray-900", children: title })
|
|
1766
2013
|
] }),
|
|
1767
|
-
/* @__PURE__ */
|
|
2014
|
+
/* @__PURE__ */ jsx9(
|
|
1768
2015
|
"button",
|
|
1769
2016
|
{
|
|
1770
2017
|
type: "button",
|
|
1771
2018
|
onClick: onClose,
|
|
1772
2019
|
className: "p-2 hover:bg-gray-100 rounded-lg transition-colors text-gray-500 hover:text-gray-700",
|
|
1773
|
-
children: /* @__PURE__ */
|
|
2020
|
+
children: /* @__PURE__ */ jsx9(HiX, { className: "h-5 w-5" })
|
|
1774
2021
|
}
|
|
1775
2022
|
)
|
|
1776
2023
|
] }),
|
|
1777
|
-
/* @__PURE__ */
|
|
2024
|
+
/* @__PURE__ */ jsx9("div", { className: "flex border-b border-gray-200 px-6", children: tabs.map((tab) => /* @__PURE__ */ jsxs9(
|
|
1778
2025
|
"button",
|
|
1779
2026
|
{
|
|
1780
2027
|
type: "button",
|
|
1781
2028
|
onClick: () => setActiveTab(tab.id),
|
|
1782
2029
|
className: `px-4 py-3 flex items-center gap-2 text-sm font-medium transition-colors border-b-2 ${activeTab === tab.id ? "text-blue-600 border-blue-600" : "text-gray-500 border-transparent hover:text-gray-700"}`,
|
|
1783
2030
|
children: [
|
|
1784
|
-
/* @__PURE__ */
|
|
2031
|
+
/* @__PURE__ */ jsx9(tab.Icon, { className: "h-4 w-4" }),
|
|
1785
2032
|
tab.label
|
|
1786
2033
|
]
|
|
1787
2034
|
},
|
|
1788
2035
|
tab.id
|
|
1789
2036
|
)) }),
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
activeTab === "columns" && /* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1795
|
-
/* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
2037
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex-1 overflow-auto p-6", children: [
|
|
2038
|
+
activeTab === "columns" && /* @__PURE__ */ jsxs9("div", { children: [
|
|
2039
|
+
/* @__PURE__ */ jsxs9("div", { className: "p-4 bg-blue-50 border border-blue-200 rounded-lg mb-4 flex gap-3", children: [
|
|
2040
|
+
/* @__PURE__ */ jsx9(HiViewBoards, { className: "h-4 w-4 text-blue-600 shrink-0 mt-0.5" }),
|
|
2041
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
2042
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm font-semibold text-gray-900 mb-1", children: "About Pinned Columns" }),
|
|
2043
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm text-gray-600", children: "Pinned columns stay visible while you scroll horizontally through the table." })
|
|
1797
2044
|
] })
|
|
1798
2045
|
] }),
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
/* @__PURE__ */
|
|
2046
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm text-gray-600 mb-4", children: "Select which columns should be pinned to the left by default." }),
|
|
2047
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2", children: [
|
|
2048
|
+
/* @__PURE__ */ jsxs9(
|
|
1802
2049
|
"button",
|
|
1803
2050
|
{
|
|
1804
2051
|
type: "button",
|
|
1805
2052
|
onClick: () => togglePinnedColumn("__row_index__"),
|
|
1806
2053
|
className: `flex items-center gap-2 p-3 rounded-lg border transition-colors text-left ${localSettings.defaultPinnedColumns.includes("__row_index__") ? "bg-blue-50 border-blue-300 text-blue-700" : "bg-gray-50 border-gray-200 text-gray-700 hover:border-blue-300"}`,
|
|
1807
2054
|
children: [
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ jsx9(HiViewBoards, { className: "h-4 w-4 shrink-0" }),
|
|
2056
|
+
/* @__PURE__ */ jsx9("span", { className: "text-sm flex-1 truncate", children: "# (Row Index)" })
|
|
1810
2057
|
]
|
|
1811
2058
|
}
|
|
1812
2059
|
),
|
|
@@ -1814,15 +2061,15 @@ var SpreadsheetSettingsModal = ({
|
|
|
1814
2061
|
const isPinned = localSettings.defaultPinnedColumns.includes(
|
|
1815
2062
|
column.id
|
|
1816
2063
|
);
|
|
1817
|
-
return /* @__PURE__ */
|
|
2064
|
+
return /* @__PURE__ */ jsxs9(
|
|
1818
2065
|
"button",
|
|
1819
2066
|
{
|
|
1820
2067
|
type: "button",
|
|
1821
2068
|
onClick: () => togglePinnedColumn(column.id),
|
|
1822
2069
|
className: `flex items-center gap-2 p-3 rounded-lg border transition-colors text-left ${isPinned ? "bg-blue-50 border-blue-300 text-blue-700" : "bg-gray-50 border-gray-200 text-gray-700 hover:border-blue-300"}`,
|
|
1823
2070
|
children: [
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
2071
|
+
/* @__PURE__ */ jsx9(HiViewBoards, { className: "h-4 w-4 shrink-0" }),
|
|
2072
|
+
/* @__PURE__ */ jsx9("span", { className: "text-sm flex-1 truncate", children: column.label })
|
|
1826
2073
|
]
|
|
1827
2074
|
},
|
|
1828
2075
|
column.id
|
|
@@ -1830,12 +2077,12 @@ var SpreadsheetSettingsModal = ({
|
|
|
1830
2077
|
})
|
|
1831
2078
|
] })
|
|
1832
2079
|
] }),
|
|
1833
|
-
activeTab === "sorting" && /* @__PURE__ */
|
|
1834
|
-
/* @__PURE__ */
|
|
1835
|
-
/* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
/* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
2080
|
+
activeTab === "sorting" && /* @__PURE__ */ jsxs9("div", { children: [
|
|
2081
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm text-gray-600 mb-4", children: "Set the default column sorting when opening the spreadsheet." }),
|
|
2082
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-4", children: [
|
|
2083
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
2084
|
+
/* @__PURE__ */ jsx9("label", { className: "block text-sm font-medium text-gray-900 mb-2", children: "Sort Column" }),
|
|
2085
|
+
/* @__PURE__ */ jsxs9(
|
|
1839
2086
|
"select",
|
|
1840
2087
|
{
|
|
1841
2088
|
value: localSettings.defaultSort?.columnId || "",
|
|
@@ -1845,15 +2092,15 @@ var SpreadsheetSettingsModal = ({
|
|
|
1845
2092
|
),
|
|
1846
2093
|
className: "w-full p-3 text-sm bg-white border border-gray-300 rounded-lg text-gray-900 cursor-pointer focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
1847
2094
|
children: [
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
columns.filter((col) => col.sortable !== false).map((column) => /* @__PURE__ */
|
|
2095
|
+
/* @__PURE__ */ jsx9("option", { value: "", children: "No default sorting" }),
|
|
2096
|
+
columns.filter((col) => col.sortable !== false).map((column) => /* @__PURE__ */ jsx9("option", { value: column.id, children: column.label }, column.id))
|
|
1850
2097
|
]
|
|
1851
2098
|
}
|
|
1852
2099
|
)
|
|
1853
2100
|
] }),
|
|
1854
|
-
localSettings.defaultSort && /* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__PURE__ */
|
|
2101
|
+
localSettings.defaultSort && /* @__PURE__ */ jsxs9("div", { children: [
|
|
2102
|
+
/* @__PURE__ */ jsx9("label", { className: "block text-sm font-medium text-gray-900 mb-2", children: "Sort Direction" }),
|
|
2103
|
+
/* @__PURE__ */ jsxs9(
|
|
1857
2104
|
"select",
|
|
1858
2105
|
{
|
|
1859
2106
|
value: localSettings.defaultSort.direction,
|
|
@@ -1863,19 +2110,19 @@ var SpreadsheetSettingsModal = ({
|
|
|
1863
2110
|
),
|
|
1864
2111
|
className: "w-full p-3 text-sm bg-white border border-gray-300 rounded-lg text-gray-900 cursor-pointer focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
1865
2112
|
children: [
|
|
1866
|
-
/* @__PURE__ */
|
|
1867
|
-
/* @__PURE__ */
|
|
2113
|
+
/* @__PURE__ */ jsx9("option", { value: "asc", children: "Ascending (A \u2192 Z, 0 \u2192 9)" }),
|
|
2114
|
+
/* @__PURE__ */ jsx9("option", { value: "desc", children: "Descending (Z \u2192 A, 9 \u2192 0)" })
|
|
1868
2115
|
]
|
|
1869
2116
|
}
|
|
1870
2117
|
)
|
|
1871
2118
|
] })
|
|
1872
2119
|
] })
|
|
1873
2120
|
] }),
|
|
1874
|
-
activeTab === "display" && /* @__PURE__ */
|
|
1875
|
-
/* @__PURE__ */
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
/* @__PURE__ */
|
|
1878
|
-
/* @__PURE__ */
|
|
2121
|
+
activeTab === "display" && /* @__PURE__ */ jsxs9("div", { className: "space-y-5", children: [
|
|
2122
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm text-gray-600", children: "Customize the display and behavior of the spreadsheet." }),
|
|
2123
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
2124
|
+
/* @__PURE__ */ jsx9("label", { className: "block text-sm font-medium text-gray-900 mb-2", children: "Default Page Size" }),
|
|
2125
|
+
/* @__PURE__ */ jsx9(
|
|
1879
2126
|
"select",
|
|
1880
2127
|
{
|
|
1881
2128
|
value: localSettings.defaultPageSize,
|
|
@@ -1884,20 +2131,20 @@ var SpreadsheetSettingsModal = ({
|
|
|
1884
2131
|
defaultPageSize: parseInt(e.target.value, 10)
|
|
1885
2132
|
}),
|
|
1886
2133
|
className: "w-full p-3 text-sm bg-white border border-gray-300 rounded-lg text-gray-900 cursor-pointer focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
1887
|
-
children: pageSizeOptions.map((size) => /* @__PURE__ */
|
|
2134
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsxs9("option", { value: size, children: [
|
|
1888
2135
|
size,
|
|
1889
2136
|
" rows"
|
|
1890
2137
|
] }, size))
|
|
1891
2138
|
}
|
|
1892
2139
|
)
|
|
1893
2140
|
] }),
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
/* @__PURE__ */
|
|
2141
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
2142
|
+
/* @__PURE__ */ jsxs9("label", { className: "block text-sm font-medium text-gray-900 mb-2", children: [
|
|
1896
2143
|
"Default Zoom Level: ",
|
|
1897
2144
|
localSettings.defaultZoom,
|
|
1898
2145
|
"%"
|
|
1899
2146
|
] }),
|
|
1900
|
-
/* @__PURE__ */
|
|
2147
|
+
/* @__PURE__ */ jsx9(
|
|
1901
2148
|
"input",
|
|
1902
2149
|
{
|
|
1903
2150
|
type: "range",
|
|
@@ -1912,14 +2159,14 @@ var SpreadsheetSettingsModal = ({
|
|
|
1912
2159
|
className: "w-full cursor-pointer"
|
|
1913
2160
|
}
|
|
1914
2161
|
),
|
|
1915
|
-
/* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
/* @__PURE__ */
|
|
2162
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex justify-between mt-1 text-xs text-gray-500", children: [
|
|
2163
|
+
/* @__PURE__ */ jsx9("span", { children: "50%" }),
|
|
2164
|
+
/* @__PURE__ */ jsx9("span", { children: "150%" })
|
|
1918
2165
|
] })
|
|
1919
2166
|
] }),
|
|
1920
|
-
/* @__PURE__ */
|
|
1921
|
-
/* @__PURE__ */
|
|
1922
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-3", children: [
|
|
2168
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-3 p-4 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-100 transition-colors", children: [
|
|
2169
|
+
/* @__PURE__ */ jsx9(
|
|
1923
2170
|
"input",
|
|
1924
2171
|
{
|
|
1925
2172
|
type: "checkbox",
|
|
@@ -1928,13 +2175,13 @@ var SpreadsheetSettingsModal = ({
|
|
|
1928
2175
|
className: "w-5 h-5 cursor-pointer rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
1929
2176
|
}
|
|
1930
2177
|
),
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
2178
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex-1", children: [
|
|
2179
|
+
/* @__PURE__ */ jsx9("div", { className: "text-sm font-medium text-gray-900", children: "Auto-save changes" }),
|
|
2180
|
+
/* @__PURE__ */ jsx9("div", { className: "text-sm text-gray-500 mt-0.5", children: "Automatically save changes without confirmation" })
|
|
1934
2181
|
] })
|
|
1935
2182
|
] }),
|
|
1936
|
-
/* @__PURE__ */
|
|
1937
|
-
/* @__PURE__ */
|
|
2183
|
+
/* @__PURE__ */ jsxs9("label", { className: "flex items-center gap-3 p-4 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-100 transition-colors", children: [
|
|
2184
|
+
/* @__PURE__ */ jsx9(
|
|
1938
2185
|
"input",
|
|
1939
2186
|
{
|
|
1940
2187
|
type: "checkbox",
|
|
@@ -1946,16 +2193,16 @@ var SpreadsheetSettingsModal = ({
|
|
|
1946
2193
|
className: "w-5 h-5 cursor-pointer rounded border-gray-300 text-blue-600 focus:ring-blue-500"
|
|
1947
2194
|
}
|
|
1948
2195
|
),
|
|
1949
|
-
/* @__PURE__ */
|
|
1950
|
-
/* @__PURE__ */
|
|
1951
|
-
/* @__PURE__ */
|
|
2196
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex-1", children: [
|
|
2197
|
+
/* @__PURE__ */ jsx9("div", { className: "text-sm font-medium text-gray-900", children: "Compact view" }),
|
|
2198
|
+
/* @__PURE__ */ jsx9("div", { className: "text-sm text-gray-500 mt-0.5", children: "Reduce padding and spacing to show more rows on screen" })
|
|
1952
2199
|
] })
|
|
1953
2200
|
] })
|
|
1954
2201
|
] })
|
|
1955
2202
|
] })
|
|
1956
2203
|
] }),
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
2204
|
+
/* @__PURE__ */ jsxs9("div", { className: "px-6 py-4 border-t border-gray-200 flex justify-between items-center gap-3", children: [
|
|
2205
|
+
/* @__PURE__ */ jsx9(
|
|
1959
2206
|
"button",
|
|
1960
2207
|
{
|
|
1961
2208
|
type: "button",
|
|
@@ -1964,8 +2211,8 @@ var SpreadsheetSettingsModal = ({
|
|
|
1964
2211
|
children: "Reset to Defaults"
|
|
1965
2212
|
}
|
|
1966
2213
|
),
|
|
1967
|
-
/* @__PURE__ */
|
|
1968
|
-
/* @__PURE__ */
|
|
2214
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex gap-2", children: [
|
|
2215
|
+
/* @__PURE__ */ jsx9(
|
|
1969
2216
|
"button",
|
|
1970
2217
|
{
|
|
1971
2218
|
type: "button",
|
|
@@ -1974,7 +2221,7 @@ var SpreadsheetSettingsModal = ({
|
|
|
1974
2221
|
children: "Cancel"
|
|
1975
2222
|
}
|
|
1976
2223
|
),
|
|
1977
|
-
/* @__PURE__ */
|
|
2224
|
+
/* @__PURE__ */ jsx9(
|
|
1978
2225
|
"button",
|
|
1979
2226
|
{
|
|
1980
2227
|
type: "button",
|
|
@@ -1994,7 +2241,7 @@ SpreadsheetSettingsModal.displayName = "SpreadsheetSettingsModal";
|
|
|
1994
2241
|
|
|
1995
2242
|
// src/components/CommentModals.tsx
|
|
1996
2243
|
import { useState as useState6, useEffect as useEffect4 } from "react";
|
|
1997
|
-
import { jsx as
|
|
2244
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1998
2245
|
function AddCommentModal({ isOpen, columnLabel, onAdd, onClose }) {
|
|
1999
2246
|
const [commentText, setCommentText] = useState6("");
|
|
2000
2247
|
useEffect4(() => {
|
|
@@ -2013,12 +2260,12 @@ function AddCommentModal({ isOpen, columnLabel, onAdd, onClose }) {
|
|
|
2013
2260
|
setCommentText("");
|
|
2014
2261
|
onClose();
|
|
2015
2262
|
};
|
|
2016
|
-
return /* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2263
|
+
return /* @__PURE__ */ jsx10("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ jsxs10("div", { className: "bg-white rounded-lg shadow-xl p-6 w-96 max-w-full mx-4", children: [
|
|
2264
|
+
/* @__PURE__ */ jsxs10("h3", { className: "text-lg font-semibold mb-4", children: [
|
|
2018
2265
|
"Add Comment",
|
|
2019
2266
|
columnLabel ? ` - ${columnLabel}` : ""
|
|
2020
2267
|
] }),
|
|
2021
|
-
/* @__PURE__ */
|
|
2268
|
+
/* @__PURE__ */ jsx10(
|
|
2022
2269
|
"textarea",
|
|
2023
2270
|
{
|
|
2024
2271
|
value: commentText,
|
|
@@ -2032,8 +2279,8 @@ function AddCommentModal({ isOpen, columnLabel, onAdd, onClose }) {
|
|
|
2032
2279
|
autoFocus: true
|
|
2033
2280
|
}
|
|
2034
2281
|
),
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2282
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex justify-end gap-2 mt-4", children: [
|
|
2283
|
+
/* @__PURE__ */ jsx10(
|
|
2037
2284
|
"button",
|
|
2038
2285
|
{
|
|
2039
2286
|
type: "button",
|
|
@@ -2042,7 +2289,7 @@ function AddCommentModal({ isOpen, columnLabel, onAdd, onClose }) {
|
|
|
2042
2289
|
children: "Cancel"
|
|
2043
2290
|
}
|
|
2044
2291
|
),
|
|
2045
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx10(
|
|
2046
2293
|
"button",
|
|
2047
2294
|
{
|
|
2048
2295
|
type: "button",
|
|
@@ -2065,13 +2312,13 @@ function ViewCommentsModal({
|
|
|
2065
2312
|
onClose
|
|
2066
2313
|
}) {
|
|
2067
2314
|
if (!isOpen) return null;
|
|
2068
|
-
return /* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2070
|
-
/* @__PURE__ */
|
|
2315
|
+
return /* @__PURE__ */ jsx10("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ jsxs10("div", { className: "bg-white rounded-lg shadow-xl p-6 w-[480px] max-w-full mx-4 max-h-[80vh] flex flex-col", children: [
|
|
2316
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between mb-4", children: [
|
|
2317
|
+
/* @__PURE__ */ jsxs10("h3", { className: "text-lg font-semibold", children: [
|
|
2071
2318
|
"Comments",
|
|
2072
2319
|
columnLabel ? ` - ${columnLabel}` : ""
|
|
2073
2320
|
] }),
|
|
2074
|
-
/* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ jsx10(
|
|
2075
2322
|
"button",
|
|
2076
2323
|
{
|
|
2077
2324
|
type: "button",
|
|
@@ -2081,8 +2328,8 @@ function ViewCommentsModal({
|
|
|
2081
2328
|
}
|
|
2082
2329
|
)
|
|
2083
2330
|
] }),
|
|
2084
|
-
/* @__PURE__ */
|
|
2085
|
-
comments.map((comment) => /* @__PURE__ */
|
|
2331
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-1 overflow-y-auto space-y-3", children: [
|
|
2332
|
+
comments.map((comment) => /* @__PURE__ */ jsxs10(
|
|
2086
2333
|
"div",
|
|
2087
2334
|
{
|
|
2088
2335
|
className: cn(
|
|
@@ -2090,9 +2337,9 @@ function ViewCommentsModal({
|
|
|
2090
2337
|
comment.resolved ? "bg-gray-50 border-gray-200" : "bg-yellow-50 border-yellow-200"
|
|
2091
2338
|
),
|
|
2092
2339
|
children: [
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-start justify-between gap-2", children: [
|
|
2341
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm text-gray-700", children: comment.text }),
|
|
2342
|
+
/* @__PURE__ */ jsx10(
|
|
2096
2343
|
"button",
|
|
2097
2344
|
{
|
|
2098
2345
|
type: "button",
|
|
@@ -2105,23 +2352,23 @@ function ViewCommentsModal({
|
|
|
2105
2352
|
}
|
|
2106
2353
|
)
|
|
2107
2354
|
] }),
|
|
2108
|
-
/* @__PURE__ */
|
|
2109
|
-
comment.author && /* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2355
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 mt-2 text-xs text-gray-500", children: [
|
|
2356
|
+
comment.author && /* @__PURE__ */ jsx10("span", { children: comment.author }),
|
|
2357
|
+
/* @__PURE__ */ jsx10("span", { children: new Date(comment.timestamp).toLocaleString() })
|
|
2111
2358
|
] })
|
|
2112
2359
|
]
|
|
2113
2360
|
},
|
|
2114
2361
|
comment.id
|
|
2115
2362
|
)),
|
|
2116
|
-
comments.length === 0 && /* @__PURE__ */
|
|
2363
|
+
comments.length === 0 && /* @__PURE__ */ jsx10("p", { className: "text-center text-gray-500 py-8", children: "No comments for this cell." })
|
|
2117
2364
|
] }),
|
|
2118
|
-
onAddComment && /* @__PURE__ */
|
|
2365
|
+
onAddComment && /* @__PURE__ */ jsx10("div", { className: "mt-4 pt-4 border-t border-gray-200", children: /* @__PURE__ */ jsx10(
|
|
2119
2366
|
"button",
|
|
2120
2367
|
{
|
|
2121
2368
|
type: "button",
|
|
2122
2369
|
onClick: onAddComment,
|
|
2123
2370
|
className: "w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center justify-center gap-2",
|
|
2124
|
-
children: /* @__PURE__ */
|
|
2371
|
+
children: /* @__PURE__ */ jsx10("span", { children: "+ Add Comment" })
|
|
2125
2372
|
}
|
|
2126
2373
|
) })
|
|
2127
2374
|
] }) });
|
|
@@ -2136,11 +2383,11 @@ function DeleteConfirmationModal({
|
|
|
2136
2383
|
onClose
|
|
2137
2384
|
}) {
|
|
2138
2385
|
if (!isOpen) return null;
|
|
2139
|
-
return /* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2386
|
+
return /* @__PURE__ */ jsx10("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ jsxs10("div", { className: "bg-white rounded-lg shadow-xl p-6 w-96 max-w-full mx-4", children: [
|
|
2387
|
+
/* @__PURE__ */ jsx10("h3", { className: "text-lg font-semibold mb-2", children: title }),
|
|
2388
|
+
/* @__PURE__ */ jsx10("p", { className: "text-gray-600 mb-6", children: message }),
|
|
2389
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex justify-end gap-2", children: [
|
|
2390
|
+
/* @__PURE__ */ jsx10(
|
|
2144
2391
|
"button",
|
|
2145
2392
|
{
|
|
2146
2393
|
type: "button",
|
|
@@ -2149,7 +2396,7 @@ function DeleteConfirmationModal({
|
|
|
2149
2396
|
children: "Cancel"
|
|
2150
2397
|
}
|
|
2151
2398
|
),
|
|
2152
|
-
/* @__PURE__ */
|
|
2399
|
+
/* @__PURE__ */ jsx10(
|
|
2153
2400
|
"button",
|
|
2154
2401
|
{
|
|
2155
2402
|
type: "button",
|
|
@@ -2168,50 +2415,50 @@ DeleteConfirmationModal.displayName = "DeleteConfirmationModal";
|
|
|
2168
2415
|
|
|
2169
2416
|
// src/components/KeyboardShortcutsModal.tsx
|
|
2170
2417
|
import React4 from "react";
|
|
2171
|
-
import { jsx as
|
|
2418
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2172
2419
|
function KeyboardShortcutsModal({
|
|
2173
2420
|
isOpen,
|
|
2174
2421
|
onClose,
|
|
2175
2422
|
shortcuts
|
|
2176
2423
|
}) {
|
|
2177
2424
|
if (!isOpen) return null;
|
|
2178
|
-
return /* @__PURE__ */
|
|
2179
|
-
/* @__PURE__ */
|
|
2180
|
-
/* @__PURE__ */
|
|
2181
|
-
/* @__PURE__ */
|
|
2425
|
+
return /* @__PURE__ */ jsx11("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: /* @__PURE__ */ jsxs11("div", { className: "bg-white rounded-lg shadow-xl p-6 w-full max-w-2xl max-h-[80vh] overflow-y-auto mx-4", children: [
|
|
2426
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between mb-4", children: [
|
|
2427
|
+
/* @__PURE__ */ jsx11("h3", { className: "text-xl font-bold text-gray-900", children: "Keyboard Shortcuts" }),
|
|
2428
|
+
/* @__PURE__ */ jsx11(
|
|
2182
2429
|
"button",
|
|
2183
2430
|
{
|
|
2184
2431
|
type: "button",
|
|
2185
2432
|
onClick: onClose,
|
|
2186
2433
|
className: "p-1 hover:bg-gray-100 rounded",
|
|
2187
|
-
children: /* @__PURE__ */
|
|
2434
|
+
children: /* @__PURE__ */ jsx11("span", { className: "text-gray-500 text-xl", children: "\u2715" })
|
|
2188
2435
|
}
|
|
2189
2436
|
)
|
|
2190
2437
|
] }),
|
|
2191
|
-
/* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
/* @__PURE__ */
|
|
2194
|
-
/* @__PURE__ */
|
|
2195
|
-
/* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
/* @__PURE__ */
|
|
2438
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-6", children: [
|
|
2439
|
+
/* @__PURE__ */ jsx11(ShortcutSection, { title: "General", children: shortcuts.general.map((shortcut, index) => /* @__PURE__ */ jsx11(ShortcutRow, { label: shortcut.label, keys: shortcut.keys }, index)) }),
|
|
2440
|
+
/* @__PURE__ */ jsx11(ShortcutSection, { title: "Row Selection", children: shortcuts.rowSelection.map((shortcut, index) => /* @__PURE__ */ jsx11(ShortcutRow, { label: shortcut.label, keys: shortcut.keys }, index)) }),
|
|
2441
|
+
/* @__PURE__ */ jsx11(ShortcutSection, { title: "Editing", children: shortcuts.editing.map((shortcut, index) => /* @__PURE__ */ jsx11(ShortcutRow, { label: shortcut.label, keys: shortcut.keys }, index)) }),
|
|
2442
|
+
/* @__PURE__ */ jsx11(ShortcutSection, { title: "Cell Navigation", children: shortcuts.navigation.map((shortcut, index) => /* @__PURE__ */ jsx11(ShortcutRow, { label: shortcut.label, keys: shortcut.keys }, index)) }),
|
|
2443
|
+
/* @__PURE__ */ jsx11(ShortcutSection, { title: "Row Actions (hover over row #)", children: shortcuts.rowActions.map((action, index) => /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
2444
|
+
/* @__PURE__ */ jsx11("span", { className: "text-gray-600 text-sm", children: action.label }),
|
|
2445
|
+
/* @__PURE__ */ jsx11("span", { className: "text-gray-500 text-xs", children: action.description })
|
|
2199
2446
|
] }, index)) })
|
|
2200
2447
|
] })
|
|
2201
2448
|
] }) });
|
|
2202
2449
|
}
|
|
2203
2450
|
function ShortcutSection({ title, children }) {
|
|
2204
|
-
return /* @__PURE__ */
|
|
2205
|
-
/* @__PURE__ */
|
|
2206
|
-
/* @__PURE__ */
|
|
2451
|
+
return /* @__PURE__ */ jsxs11("div", { children: [
|
|
2452
|
+
/* @__PURE__ */ jsx11("h4", { className: "text-gray-900 font-semibold mb-3", children: title }),
|
|
2453
|
+
/* @__PURE__ */ jsx11("div", { className: "space-y-2", children })
|
|
2207
2454
|
] });
|
|
2208
2455
|
}
|
|
2209
2456
|
function ShortcutRow({ label, keys }) {
|
|
2210
|
-
return /* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
index > 0 && /* @__PURE__ */
|
|
2214
|
-
key.includes("Click") ? /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between", children: [
|
|
2458
|
+
/* @__PURE__ */ jsx11("span", { className: "text-gray-600 text-sm", children: label }),
|
|
2459
|
+
/* @__PURE__ */ jsx11("div", { className: "flex items-center gap-1", children: keys.map((key, index) => /* @__PURE__ */ jsxs11(React4.Fragment, { children: [
|
|
2460
|
+
index > 0 && /* @__PURE__ */ jsx11("span", { className: "text-gray-400", children: "+" }),
|
|
2461
|
+
key.includes("Click") ? /* @__PURE__ */ jsx11("span", { className: "text-gray-500 text-xs", children: key }) : /* @__PURE__ */ jsx11("kbd", { className: "px-2 py-1 bg-gray-100 text-gray-800 rounded text-xs border border-gray-200", children: key })
|
|
2215
2462
|
] }, index)) })
|
|
2216
2463
|
] });
|
|
2217
2464
|
}
|
|
@@ -2220,7 +2467,7 @@ KeyboardShortcutsModal.displayName = "KeyboardShortcutsModal";
|
|
|
2220
2467
|
// src/components/RowContextMenu.tsx
|
|
2221
2468
|
import { useMemo as useMemo2 } from "react";
|
|
2222
2469
|
import { ContextMenu, ContextMenuItem } from "@xcelsior/design-system";
|
|
2223
|
-
import { jsx as
|
|
2470
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2224
2471
|
function RowContextMenu({
|
|
2225
2472
|
row,
|
|
2226
2473
|
rowId,
|
|
@@ -2234,10 +2481,10 @@ function RowContextMenu({
|
|
|
2234
2481
|
if (visibleItems.length === 0) {
|
|
2235
2482
|
return null;
|
|
2236
2483
|
}
|
|
2237
|
-
return /* @__PURE__ */
|
|
2484
|
+
return /* @__PURE__ */ jsx12(
|
|
2238
2485
|
ContextMenu,
|
|
2239
2486
|
{
|
|
2240
|
-
trigger: /* @__PURE__ */
|
|
2487
|
+
trigger: /* @__PURE__ */ jsx12(
|
|
2241
2488
|
"button",
|
|
2242
2489
|
{
|
|
2243
2490
|
type: "button",
|
|
@@ -2246,7 +2493,7 @@ function RowContextMenu({
|
|
|
2246
2493
|
className
|
|
2247
2494
|
),
|
|
2248
2495
|
title: "More actions",
|
|
2249
|
-
children: /* @__PURE__ */
|
|
2496
|
+
children: /* @__PURE__ */ jsx12(
|
|
2250
2497
|
HiDotsVertical,
|
|
2251
2498
|
{
|
|
2252
2499
|
className: cn("text-gray-500", compactMode ? "h-2.5 w-2.5" : "h-3 w-3")
|
|
@@ -2258,7 +2505,7 @@ function RowContextMenu({
|
|
|
2258
2505
|
children: visibleItems.map((item) => {
|
|
2259
2506
|
const isDisabled = item.disabled?.(row);
|
|
2260
2507
|
const variantClass = item.variant === "destructive" ? "text-red-600 hover:bg-red-50" : "";
|
|
2261
|
-
return /* @__PURE__ */
|
|
2508
|
+
return /* @__PURE__ */ jsxs12(
|
|
2262
2509
|
ContextMenuItem,
|
|
2263
2510
|
{
|
|
2264
2511
|
onClick: (e) => {
|
|
@@ -2268,7 +2515,7 @@ function RowContextMenu({
|
|
|
2268
2515
|
disabled: isDisabled,
|
|
2269
2516
|
className: `${variantClass} ${item.className || ""}`,
|
|
2270
2517
|
children: [
|
|
2271
|
-
item.icon && /* @__PURE__ */
|
|
2518
|
+
item.icon && /* @__PURE__ */ jsx12("span", { className: "mr-2", children: item.icon }),
|
|
2272
2519
|
item.label
|
|
2273
2520
|
]
|
|
2274
2521
|
},
|
|
@@ -3367,7 +3614,7 @@ function useSpreadsheetSelection({
|
|
|
3367
3614
|
}
|
|
3368
3615
|
|
|
3369
3616
|
// src/components/Spreadsheet.tsx
|
|
3370
|
-
import { jsx as
|
|
3617
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3371
3618
|
function Spreadsheet({
|
|
3372
3619
|
data,
|
|
3373
3620
|
columns,
|
|
@@ -3498,6 +3745,7 @@ function Spreadsheet({
|
|
|
3498
3745
|
onToggleCommentResolved
|
|
3499
3746
|
});
|
|
3500
3747
|
const [showSettingsModal, setShowSettingsModal] = useState12(false);
|
|
3748
|
+
const [showFiltersPanel, setShowFiltersPanel] = useState12(false);
|
|
3501
3749
|
const {
|
|
3502
3750
|
canUndo,
|
|
3503
3751
|
canRedo,
|
|
@@ -3942,8 +4190,8 @@ function Spreadsheet({
|
|
|
3942
4190
|
);
|
|
3943
4191
|
return [...leftPinned, ...groups, ...rightPinned];
|
|
3944
4192
|
}, [columnGroups, collapsedGroups, columns, pinnedColumns]);
|
|
3945
|
-
return /* @__PURE__ */
|
|
3946
|
-
showToolbar && /* @__PURE__ */
|
|
4193
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn("flex flex-col h-full bg-white", className), children: [
|
|
4194
|
+
showToolbar && /* @__PURE__ */ jsx13(
|
|
3947
4195
|
SpreadsheetToolbar,
|
|
3948
4196
|
{
|
|
3949
4197
|
zoom,
|
|
@@ -3957,6 +4205,11 @@ function Spreadsheet({
|
|
|
3957
4205
|
autoSave: spreadsheetSettings.autoSave,
|
|
3958
4206
|
hasActiveFilters,
|
|
3959
4207
|
onClearFilters: clearAllFilters,
|
|
4208
|
+
filters,
|
|
4209
|
+
columns,
|
|
4210
|
+
onClearFilter: (columnId) => handleFilterChange(columnId, void 0),
|
|
4211
|
+
showFiltersPanel,
|
|
4212
|
+
onToggleFiltersPanel: () => setShowFiltersPanel(!showFiltersPanel),
|
|
3960
4213
|
onZoomIn: () => setZoom((z) => Math.min(z + 10, 200)),
|
|
3961
4214
|
onZoomOut: () => setZoom((z) => Math.max(z - 10, 50)),
|
|
3962
4215
|
onZoomReset: () => setZoom(100),
|
|
@@ -3973,16 +4226,16 @@ function Spreadsheet({
|
|
|
3973
4226
|
menuItems: toolbarMenuItems
|
|
3974
4227
|
}
|
|
3975
4228
|
),
|
|
3976
|
-
/* @__PURE__ */
|
|
4229
|
+
/* @__PURE__ */ jsx13("div", { ref: tableRef, className: "flex-1 overflow-auto border border-gray-200 rounded", children: /* @__PURE__ */ jsx13(
|
|
3977
4230
|
"div",
|
|
3978
4231
|
{
|
|
3979
4232
|
style: {
|
|
3980
4233
|
zoom: zoom / 100
|
|
3981
4234
|
},
|
|
3982
|
-
children: /* @__PURE__ */
|
|
3983
|
-
/* @__PURE__ */
|
|
3984
|
-
columnGroups && groupHeaderItems && /* @__PURE__ */
|
|
3985
|
-
/* @__PURE__ */
|
|
4235
|
+
children: /* @__PURE__ */ jsxs13("table", { className: "border-separate border-spacing-0 text-xs select-none", children: [
|
|
4236
|
+
/* @__PURE__ */ jsxs13("thead", { children: [
|
|
4237
|
+
columnGroups && groupHeaderItems && /* @__PURE__ */ jsxs13("tr", { children: [
|
|
4238
|
+
/* @__PURE__ */ jsx13(
|
|
3986
4239
|
RowIndexColumnHeader,
|
|
3987
4240
|
{
|
|
3988
4241
|
enableHighlighting,
|
|
@@ -3998,7 +4251,11 @@ function Spreadsheet({
|
|
|
3998
4251
|
if (item.type === "pinned-column") {
|
|
3999
4252
|
const col = columns.find((c) => c.id === item.columnId);
|
|
4000
4253
|
const isPinnedLeft = item.pinSide === "left";
|
|
4001
|
-
|
|
4254
|
+
const pinnedWidth = Math.max(
|
|
4255
|
+
col?.minWidth || col?.width || MIN_PINNED_COLUMN_WIDTH,
|
|
4256
|
+
MIN_PINNED_COLUMN_WIDTH
|
|
4257
|
+
);
|
|
4258
|
+
return /* @__PURE__ */ jsx13(
|
|
4002
4259
|
"th",
|
|
4003
4260
|
{
|
|
4004
4261
|
className: cn(
|
|
@@ -4010,14 +4267,14 @@ function Spreadsheet({
|
|
|
4010
4267
|
position: "sticky",
|
|
4011
4268
|
left: isPinnedLeft ? `${getColumnLeftOffset(item.columnId)}px` : void 0,
|
|
4012
4269
|
right: !isPinnedLeft ? `${getColumnRightOffset(item.columnId)}px` : void 0,
|
|
4013
|
-
minWidth:
|
|
4270
|
+
minWidth: pinnedWidth
|
|
4014
4271
|
}
|
|
4015
4272
|
},
|
|
4016
4273
|
`pinned-group-${item.columnId}`
|
|
4017
4274
|
);
|
|
4018
4275
|
}
|
|
4019
4276
|
const { group, colSpan, isCollapsed } = item;
|
|
4020
|
-
return /* @__PURE__ */
|
|
4277
|
+
return /* @__PURE__ */ jsx13(
|
|
4021
4278
|
"th",
|
|
4022
4279
|
{
|
|
4023
4280
|
colSpan,
|
|
@@ -4029,17 +4286,17 @@ function Spreadsheet({
|
|
|
4029
4286
|
backgroundColor: group.headerColor || "rgb(243 244 246)"
|
|
4030
4287
|
},
|
|
4031
4288
|
onClick: () => group.collapsible && handleToggleGroupCollapse(group.id),
|
|
4032
|
-
children: /* @__PURE__ */
|
|
4033
|
-
group.collapsible && (isCollapsed ? /* @__PURE__ */
|
|
4034
|
-
/* @__PURE__ */
|
|
4289
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-center gap-1", children: [
|
|
4290
|
+
group.collapsible && (isCollapsed ? /* @__PURE__ */ jsx13(HiChevronRight, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx13(HiChevronDown, { className: "h-3 w-3" })),
|
|
4291
|
+
/* @__PURE__ */ jsx13("span", { children: group.label })
|
|
4035
4292
|
] })
|
|
4036
4293
|
},
|
|
4037
4294
|
group.id
|
|
4038
4295
|
);
|
|
4039
4296
|
})
|
|
4040
4297
|
] }),
|
|
4041
|
-
/* @__PURE__ */
|
|
4042
|
-
!columnGroups && /* @__PURE__ */
|
|
4298
|
+
/* @__PURE__ */ jsxs13("tr", { children: [
|
|
4299
|
+
!columnGroups && /* @__PURE__ */ jsx13(
|
|
4043
4300
|
RowIndexColumnHeader,
|
|
4044
4301
|
{
|
|
4045
4302
|
enableHighlighting,
|
|
@@ -4053,7 +4310,7 @@ function Spreadsheet({
|
|
|
4053
4310
|
),
|
|
4054
4311
|
columnRenderItems.map((item) => {
|
|
4055
4312
|
if (item.type === "collapsed-placeholder") {
|
|
4056
|
-
return /* @__PURE__ */
|
|
4313
|
+
return /* @__PURE__ */ jsx13(
|
|
4057
4314
|
"th",
|
|
4058
4315
|
{
|
|
4059
4316
|
className: "border border-gray-200 px-2 py-1 text-center text-gray-400",
|
|
@@ -4069,7 +4326,7 @@ function Spreadsheet({
|
|
|
4069
4326
|
const column = item.column;
|
|
4070
4327
|
const isPinnedLeft = isColumnPinned(column.id) && getColumnPinSide(column.id) === "left";
|
|
4071
4328
|
const isPinnedRight = isColumnPinned(column.id) && getColumnPinSide(column.id) === "right";
|
|
4072
|
-
return /* @__PURE__ */
|
|
4329
|
+
return /* @__PURE__ */ jsx13(
|
|
4073
4330
|
SpreadsheetHeader,
|
|
4074
4331
|
{
|
|
4075
4332
|
column,
|
|
@@ -4087,7 +4344,7 @@ function Spreadsheet({
|
|
|
4087
4344
|
),
|
|
4088
4345
|
onPinClick: () => handleTogglePin(column.id),
|
|
4089
4346
|
onHighlightClick: enableHighlighting ? () => setHighlightPickerColumn(column.id) : void 0,
|
|
4090
|
-
children: activeFilterColumn === column.id && /* @__PURE__ */
|
|
4347
|
+
children: activeFilterColumn === column.id && /* @__PURE__ */ jsx13(
|
|
4091
4348
|
SpreadsheetFilterDropdown,
|
|
4092
4349
|
{
|
|
4093
4350
|
column,
|
|
@@ -4102,17 +4359,17 @@ function Spreadsheet({
|
|
|
4102
4359
|
})
|
|
4103
4360
|
] })
|
|
4104
4361
|
] }),
|
|
4105
|
-
/* @__PURE__ */
|
|
4362
|
+
/* @__PURE__ */ jsx13("tbody", { children: isLoading ? /* @__PURE__ */ jsx13("tr", { children: /* @__PURE__ */ jsx13(
|
|
4106
4363
|
"td",
|
|
4107
4364
|
{
|
|
4108
4365
|
colSpan: columnRenderItems.length + 1,
|
|
4109
4366
|
className: "text-center py-8 text-gray-500",
|
|
4110
|
-
children: /* @__PURE__ */
|
|
4111
|
-
/* @__PURE__ */
|
|
4367
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-center gap-2", children: [
|
|
4368
|
+
/* @__PURE__ */ jsx13("div", { className: "w-4 h-4 border-2 border-blue-600 border-t-transparent rounded-full animate-spin" }),
|
|
4112
4369
|
"Loading..."
|
|
4113
4370
|
] })
|
|
4114
4371
|
}
|
|
4115
|
-
) }) : paginatedData.length === 0 ? /* @__PURE__ */
|
|
4372
|
+
) }) : paginatedData.length === 0 ? /* @__PURE__ */ jsx13("tr", { children: /* @__PURE__ */ jsx13(
|
|
4116
4373
|
"td",
|
|
4117
4374
|
{
|
|
4118
4375
|
colSpan: columnRenderItems.length + 1,
|
|
@@ -4125,7 +4382,7 @@ function Spreadsheet({
|
|
|
4125
4382
|
const isRowHovered = hoveredRow === rowId;
|
|
4126
4383
|
const rowHighlight = getRowHighlight(rowId);
|
|
4127
4384
|
const displayIndex = rowIndex + 1 + (currentPage - 1) * pageSize;
|
|
4128
|
-
return /* @__PURE__ */
|
|
4385
|
+
return /* @__PURE__ */ jsxs13(
|
|
4129
4386
|
"tr",
|
|
4130
4387
|
{
|
|
4131
4388
|
onMouseEnter: () => setHoveredRow(rowId),
|
|
@@ -4135,7 +4392,7 @@ function Spreadsheet({
|
|
|
4135
4392
|
},
|
|
4136
4393
|
onDoubleClick: () => onRowDoubleClick?.(row, rowIndex),
|
|
4137
4394
|
children: [
|
|
4138
|
-
/* @__PURE__ */
|
|
4395
|
+
/* @__PURE__ */ jsx13(
|
|
4139
4396
|
"td",
|
|
4140
4397
|
{
|
|
4141
4398
|
onClick: (e) => handleRowSelect(rowId, e),
|
|
@@ -4156,10 +4413,10 @@ function Spreadsheet({
|
|
|
4156
4413
|
left: 0
|
|
4157
4414
|
}
|
|
4158
4415
|
},
|
|
4159
|
-
children: /* @__PURE__ */
|
|
4160
|
-
/* @__PURE__ */
|
|
4161
|
-
/* @__PURE__ */
|
|
4162
|
-
rowContextMenuItems && rowContextMenuItems.length > 0 && /* @__PURE__ */
|
|
4416
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "relative flex items-center justify-center w-full h-full", children: [
|
|
4417
|
+
/* @__PURE__ */ jsx13("span", { children: displayIndex }),
|
|
4418
|
+
/* @__PURE__ */ jsxs13("div", { className: "absolute inset-0 flex items-center justify-evenly", children: [
|
|
4419
|
+
rowContextMenuItems && rowContextMenuItems.length > 0 && /* @__PURE__ */ jsx13(
|
|
4163
4420
|
RowContextMenu,
|
|
4164
4421
|
{
|
|
4165
4422
|
row,
|
|
@@ -4168,7 +4425,7 @@ function Spreadsheet({
|
|
|
4168
4425
|
compactMode: effectiveCompactMode
|
|
4169
4426
|
}
|
|
4170
4427
|
),
|
|
4171
|
-
enableHighlighting && /* @__PURE__ */
|
|
4428
|
+
enableHighlighting && /* @__PURE__ */ jsx13(
|
|
4172
4429
|
"button",
|
|
4173
4430
|
{
|
|
4174
4431
|
type: "button",
|
|
@@ -4178,7 +4435,7 @@ function Spreadsheet({
|
|
|
4178
4435
|
},
|
|
4179
4436
|
className: "opacity-0 group-hover:opacity-100 transition-opacity p-0.5 bg-gray-100 hover:bg-gray-200 rounded",
|
|
4180
4437
|
title: "Highlight row",
|
|
4181
|
-
children: /* @__PURE__ */
|
|
4438
|
+
children: /* @__PURE__ */ jsx13(
|
|
4182
4439
|
AiFillHighlight,
|
|
4183
4440
|
{
|
|
4184
4441
|
className: cn(
|
|
@@ -4192,7 +4449,7 @@ function Spreadsheet({
|
|
|
4192
4449
|
enableComments && (cellHasComments(
|
|
4193
4450
|
rowId,
|
|
4194
4451
|
ROW_INDEX_COLUMN_ID
|
|
4195
|
-
) ? /* @__PURE__ */
|
|
4452
|
+
) ? /* @__PURE__ */ jsxs13(
|
|
4196
4453
|
"button",
|
|
4197
4454
|
{
|
|
4198
4455
|
type: "button",
|
|
@@ -4206,11 +4463,11 @@ function Spreadsheet({
|
|
|
4206
4463
|
className: "p-0.5 bg-amber-100 hover:bg-amber-200 rounded transition-colors flex items-center gap-0.5",
|
|
4207
4464
|
title: `${getCellUnresolvedCommentCount(rowId, ROW_INDEX_COLUMN_ID)} comment(s) - click to view`,
|
|
4208
4465
|
children: [
|
|
4209
|
-
/* @__PURE__ */
|
|
4466
|
+
/* @__PURE__ */ jsx13(FaComment, { className: "h-2.5 w-2.5 text-amber-500" }),
|
|
4210
4467
|
getCellUnresolvedCommentCount(
|
|
4211
4468
|
rowId,
|
|
4212
4469
|
ROW_INDEX_COLUMN_ID
|
|
4213
|
-
) > 0 && /* @__PURE__ */
|
|
4470
|
+
) > 0 && /* @__PURE__ */ jsx13("span", { className: "text-[9px] font-medium text-amber-600", children: getCellUnresolvedCommentCount(
|
|
4214
4471
|
rowId,
|
|
4215
4472
|
ROW_INDEX_COLUMN_ID
|
|
4216
4473
|
) > 99 ? "99+" : getCellUnresolvedCommentCount(
|
|
@@ -4219,7 +4476,7 @@ function Spreadsheet({
|
|
|
4219
4476
|
) })
|
|
4220
4477
|
]
|
|
4221
4478
|
}
|
|
4222
|
-
) : /* @__PURE__ */
|
|
4479
|
+
) : /* @__PURE__ */ jsx13(
|
|
4223
4480
|
"button",
|
|
4224
4481
|
{
|
|
4225
4482
|
type: "button",
|
|
@@ -4232,13 +4489,13 @@ function Spreadsheet({
|
|
|
4232
4489
|
},
|
|
4233
4490
|
className: "opacity-0 group-hover:opacity-100 transition-opacity p-0.5 bg-gray-100 hover:bg-gray-200 rounded",
|
|
4234
4491
|
title: "Add comment",
|
|
4235
|
-
children: /* @__PURE__ */
|
|
4492
|
+
children: /* @__PURE__ */ jsx13(FaRegComment, { className: "h-2.5 w-2.5 text-gray-500" })
|
|
4236
4493
|
}
|
|
4237
4494
|
)),
|
|
4238
4495
|
rowActions?.map((action) => {
|
|
4239
4496
|
if (action.visible && !action.visible(row))
|
|
4240
4497
|
return null;
|
|
4241
|
-
return /* @__PURE__ */
|
|
4498
|
+
return /* @__PURE__ */ jsx13(
|
|
4242
4499
|
"button",
|
|
4243
4500
|
{
|
|
4244
4501
|
type: "button",
|
|
@@ -4262,7 +4519,7 @@ function Spreadsheet({
|
|
|
4262
4519
|
),
|
|
4263
4520
|
columnRenderItems.map((item) => {
|
|
4264
4521
|
if (item.type === "collapsed-placeholder") {
|
|
4265
|
-
return /* @__PURE__ */
|
|
4522
|
+
return /* @__PURE__ */ jsx13(
|
|
4266
4523
|
"td",
|
|
4267
4524
|
{
|
|
4268
4525
|
className: "border border-gray-200 px-2 py-1 text-center text-gray-300",
|
|
@@ -4288,7 +4545,7 @@ function Spreadsheet({
|
|
|
4288
4545
|
const cellOrRowOrColumnHighlight = getCellHighlight(rowId, column.id) || rowHighlight?.color || getColumnHighlight(column.id);
|
|
4289
4546
|
const isColPinned = isColumnPinned(column.id);
|
|
4290
4547
|
const colPinSide = getColumnPinSide(column.id);
|
|
4291
|
-
return /* @__PURE__ */
|
|
4548
|
+
return /* @__PURE__ */ jsx13(
|
|
4292
4549
|
MemoizedSpreadsheetCell,
|
|
4293
4550
|
{
|
|
4294
4551
|
value,
|
|
@@ -4348,7 +4605,7 @@ function Spreadsheet({
|
|
|
4348
4605
|
] })
|
|
4349
4606
|
}
|
|
4350
4607
|
) }),
|
|
4351
|
-
showPagination && effectiveTotalItems > 0 && /* @__PURE__ */
|
|
4608
|
+
showPagination && effectiveTotalItems > 0 && /* @__PURE__ */ jsx13(
|
|
4352
4609
|
Pagination,
|
|
4353
4610
|
{
|
|
4354
4611
|
currentPage,
|
|
@@ -4363,7 +4620,7 @@ function Spreadsheet({
|
|
|
4363
4620
|
onPageSizeChange: handlePageSizeChange
|
|
4364
4621
|
}
|
|
4365
4622
|
),
|
|
4366
|
-
/* @__PURE__ */
|
|
4623
|
+
/* @__PURE__ */ jsx13(
|
|
4367
4624
|
AddCommentModal,
|
|
4368
4625
|
{
|
|
4369
4626
|
isOpen: commentModalCell !== null,
|
|
@@ -4374,7 +4631,7 @@ function Spreadsheet({
|
|
|
4374
4631
|
}
|
|
4375
4632
|
}
|
|
4376
4633
|
),
|
|
4377
|
-
/* @__PURE__ */
|
|
4634
|
+
/* @__PURE__ */ jsx13(
|
|
4378
4635
|
ViewCommentsModal,
|
|
4379
4636
|
{
|
|
4380
4637
|
isOpen: viewCommentsCell !== null,
|
|
@@ -4389,7 +4646,7 @@ function Spreadsheet({
|
|
|
4389
4646
|
onClose: () => setViewCommentsCell(null)
|
|
4390
4647
|
}
|
|
4391
4648
|
),
|
|
4392
|
-
highlightPickerRow !== null && /* @__PURE__ */
|
|
4649
|
+
highlightPickerRow !== null && /* @__PURE__ */ jsx13(
|
|
4393
4650
|
ColorPickerPopover,
|
|
4394
4651
|
{
|
|
4395
4652
|
title: "Highlight Row",
|
|
@@ -4398,7 +4655,7 @@ function Spreadsheet({
|
|
|
4398
4655
|
onClose: () => setHighlightPickerRow(null)
|
|
4399
4656
|
}
|
|
4400
4657
|
),
|
|
4401
|
-
highlightPickerColumn !== null && /* @__PURE__ */
|
|
4658
|
+
highlightPickerColumn !== null && /* @__PURE__ */ jsx13(
|
|
4402
4659
|
ColorPickerPopover,
|
|
4403
4660
|
{
|
|
4404
4661
|
title: highlightPickerColumn === ROW_INDEX_COLUMN_ID ? "Highlight Row Index Column" : `Highlight Column: ${columns.find((c) => c.id === highlightPickerColumn)?.label || ""}`,
|
|
@@ -4407,7 +4664,7 @@ function Spreadsheet({
|
|
|
4407
4664
|
onClose: () => setHighlightPickerColumn(null)
|
|
4408
4665
|
}
|
|
4409
4666
|
),
|
|
4410
|
-
highlightPickerCell !== null && /* @__PURE__ */
|
|
4667
|
+
highlightPickerCell !== null && /* @__PURE__ */ jsx13(
|
|
4411
4668
|
ColorPickerPopover,
|
|
4412
4669
|
{
|
|
4413
4670
|
title: "Highlight Cell",
|
|
@@ -4420,7 +4677,7 @@ function Spreadsheet({
|
|
|
4420
4677
|
onClose: () => setHighlightPickerCell(null)
|
|
4421
4678
|
}
|
|
4422
4679
|
),
|
|
4423
|
-
/* @__PURE__ */
|
|
4680
|
+
/* @__PURE__ */ jsx13(
|
|
4424
4681
|
KeyboardShortcutsModal,
|
|
4425
4682
|
{
|
|
4426
4683
|
isOpen: showKeyboardShortcuts,
|
|
@@ -4428,7 +4685,7 @@ function Spreadsheet({
|
|
|
4428
4685
|
shortcuts
|
|
4429
4686
|
}
|
|
4430
4687
|
),
|
|
4431
|
-
/* @__PURE__ */
|
|
4688
|
+
/* @__PURE__ */ jsx13(
|
|
4432
4689
|
SpreadsheetSettingsModal,
|
|
4433
4690
|
{
|
|
4434
4691
|
isOpen: showSettingsModal,
|
|
@@ -4455,6 +4712,7 @@ function Spreadsheet({
|
|
|
4455
4712
|
}
|
|
4456
4713
|
Spreadsheet.displayName = "Spreadsheet";
|
|
4457
4714
|
export {
|
|
4715
|
+
ActiveFiltersDisplay,
|
|
4458
4716
|
RowContextMenu,
|
|
4459
4717
|
Spreadsheet,
|
|
4460
4718
|
MemoizedSpreadsheetCell as SpreadsheetCell,
|